Replace calls to builtin functions with macros or functions that call the
Windows-equivalents when targeting windows and call the original
builtin functions everywhere else.
This change makes more parts of libFuzzer buildable with MSVC.
Details
Diff Detail
- Build Status
 Buildable 26503 Build 26502: arc lint + arc unit 
Event Timeline
Vitaly, could you please take a look?
I think Kostya wants to try making LF compilable with MSVC so he asked me to split up https://reviews.llvm.org/D56363
This change specifically handles replacing calls to builtin functions with things that can be compiled with MSVC
Thank you
| compiler-rt/lib/fuzzer/FuzzerDefs.h | ||
|---|---|---|
| 143 | I added reinterpret_cast<uintptr_t>() to GET_CALLER_PC since every caller casts the result, was this the right call?  | |
| 205 | In my current approach I defined wrapper functions for Windows and non-Windows (which call the builtins).  | |
| compiler-rt/lib/fuzzer/FuzzerDefs.h | ||
|---|---|---|
| 143 | GET_CALLER_PC is defined in sanitizer_common, so it should probably defined there  | |
| 197 | Could you please move them into: include thsese headers unconditionally #if defined(_MSC_VER)  | |
| compiler-rt/lib/fuzzer/FuzzerDefs.h | ||
|---|---|---|
| 143 | 
 Can libFuzzer depend on sanitizer_common? 
 I'll do this, but I figured it would be simpler to do things one way on Windows and another way everywhere else instead of having two ways to do things on Windows.  | |
- less casting and use intrisics.
 - fmt
 - include properly
 - reword
 - add nonwin implementations
 - fix spacing
 - remove newline
 - Move builtin wrappers to their own files.
 - fix headers
 - fix
 - fix
 - fmt
 - fmt
 - move Bswap to FuzzerBuiltin headers for consistency.
 - define LIBFUZZER_MSVC
 - add spacing and ensure not on x86
 
I added reinterpret_cast<uintptr_t>() to GET_CALLER_PC since every caller casts the result, was this the right call?