summaryrefslogtreecommitdiffstats
path: root/src/Detect.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Detect: Add MSVC target triple componentBrad King2020-04-271-0/+3
| | | | When `_MSC_VER` is among compiler predefines, the target ABI is MSVC.
* Update documentation and comments to use https links where possibleBrad King2020-02-131-1/+1
|
* Port to LLVM/Clang Git master as of 2020-02-13 (6c73246179)Brad King2020-02-131-1/+1
| | | | | | The `llvm::StringRef` type now requires explicit conversion to `std::string`. Such explicit conversions still work with older versions of LLVM/Clang too.
* Detect: Drop detected predefined macros conflicting with Clang'sBrad King2019-07-151-4/+12
| | | | | | Extend the filtering added by commit 1cf66488 (Detect: Drop detected predefined macros starting in '__has', 2015-02-04, v0.2.0~199) to cover more Clang builtin macros. In particular, cover builtins on ppc64.
* Detect: Fix GNU builtin include directory detection on ppc64Brad King2019-07-151-1/+5
| | | | | There is no `emmintrin.h` header for this architecture, so use `altivec.h` instead.
* Revise C++ coding style using clang-format-6.0Kitware Robot2019-04-081-2/+2
| | | | | | | | | | | | Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 6.0. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Revise C++ coding style using clang-formatKitware Robot2016-11-101-51/+41
| | | | | | | | | | | | | Run the `src/clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. Fix expected test output for new line numbers. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Remove `//------...` horizontal separator commentsBrad King2016-11-101-7/+0
| | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose.
* RunClang: Adopt logic to add fake __float128 builtinBrad King2016-01-251-16/+0
| | | | | | Delay the decision until we are constructing the final list of builtins when the Clang CompilerInstance is available. This will allow us to adapt based on the compiler language mode.
* castxml: Allow --castxml-cc-<id> to detect C language settingsBrad King2015-09-181-10/+18
| | | | | | If the "<id>" is "gnu-c" or "msvc-c" then run the given compiler command line on a C source file instead of C++. This allows C language settings of the given compiler to be detected.
* Detect: Avoid use of KWSys SystemTools::FileExistsBrad King2015-08-201-3/+2
| | | | Use llvm::sys::fs::exists instead.
* Detect: Avoid use of KWSys SystemTools::SplitBrad King2015-08-201-6/+8
| | | | Use llvm::StringRef::split instead.
* Detect: Avoid use of KWSys SystemTools::GetEnvBrad King2015-08-201-1/+2
| | | | Use std::getenv instead.
* Detect: Avoid use of KWSys SystemTools::ConvertToUnixSlashesBrad King2015-08-201-2/+3
| | | | | We do not need the full conversion performed by ConvertToUnixSlashes. Simply use std::replace to convert backslashes to forward slashes.
* Output: Further hide our __float128 struct from generated xmlBrad King2015-06-241-1/+1
| | | | | | | | | | | | | | | Give the our __float128 struct an internal '__castxml' name so that it can be identified during traversal of member lists. Do not report the struct as a member of the translation unit since the typedef will be generated as a FundamentalType directly. Also generate empty mangled="" attributes for mangled names involving our __float128 struct since the mangled names will not use the "g" that GCC would for the builtin type. Add test cases that do not use --castxml-start. Verify that no test case produces '__castxml' in its output to ensure we always hide such internal details from the generated output. GitHub-Issue: 18
* Detect: Improve target triple selectionBrad King2015-04-161-15/+13
| | | | | | | Use llvm::Triple to compute the triple string for us. Start with the builtin default triple and modify its components based on what we find in the detected preprocessor definitions. Then recompose the final target triple.
* Detect: Provide __float128 when simulating GNU compilersBrad King2015-02-251-0/+16
| | | | | | | GNU compilers provide a __float128 builtin type on Intel architectures. When simulating such GNU compiler preprocessing, define a __float128 type with the expected size and alignment in case the translation unit references it.
* Detect: Use local variable to simplify fixPredefines logicBrad King2015-02-251-4/+5
|
* Detect: Do not use Clang builtin include dir with --castxml-cc-msvcBrad King2015-02-111-2/+0
| | | | | | | | | In commit 8d8aacd6 (Detect: Use Clang builtin include dir even with --castxml-cc-<id>, 2015-02-04) we added the Clang builtin include dir to the beginning of the include path detected by --castxml-cc-msvc. However, since we use only the detected predefined macros and not those builtin to Clang, the Clang builtin headers cannot be included safely. Revert that part of the commit for now.
* Detect: Drop detected predefined macros starting in '__has'Brad King2015-02-041-0/+18
| | | | | These macros are builtin to Clang so we should not try to use any such definitions detected from the compiler.
* Detect: Use Clang builtin include dir even with --castxml-cc-<id>Brad King2015-02-041-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | We need implementation-provided headers to come from Clang to match what is really built in to the parser. When not using --castxml-cc-<id>, the Clang driver adds its builtin include directory in methods like Linux::AddClangSystemIncludeArgs MSVCToolChain::AddClangSystemIncludeArgs CrossWindowsToolChain::AddClangSystemIncludeArgs (see lib/Driver/*ToolChain*.cpp). When using --castxml-cc-<id>, we must add the Clang builtin include dir in the appropriate place. GNU-like compilers should have a builtin include directory too, providing files like <emmintrin.h>. The Clang driver does not add this directory from GCC toolchains and instead adds its own builtin include directory. In this case, replace the detected compiler builtin include directory with ours. MSVC-like compilers have no separate builtin include directory. The Clang driver simply places its own builtin include direcory before the system include directory read from the INCLUDE environment variable. In this case, do the same.
* Detect: Recognize framework include directories on OS XBrad King2014-04-161-1/+13
| | | | | | | | Some OS X compilers report their framework include directories with an explicit suffix in "-v" output. Others report without an explicit suffix but the paths imply they are for frameworks by ending in "/Frameworks". Recognize either suffix and remove the explicit suffix. Add framework directories with "-iframework" instead of "-isystem".
* Detect settings from MSVC-like compilersBrad King2014-02-261-3/+46
| | | | | | | | | | | Implement '--castxml-cc-msvc' option to detect preprocessor settings and the target triplet from MSVC-like compilers. Run the compiler command with '-c -FoNUL detect_vs.cpp' and capture stdout and stderr. Create the 'detect_vs.cpp' source using '#pragma message("...")' to tell the compiler to print detected preprocessor definitions. Treat the stdout as the preprocessor predefines block and parse it to extract the target architecture. Extract the header file search path from the 'INCLUDE' environment variable.
* Detect settings from GNU-like compilersBrad King2014-02-141-5/+101
| | | | | | | | | | | | Implement '--castxml-cc-gnu' option to detect preprocessor settings and the target triplet from GNU-like compilers. Run the compiler command with "-E -dM -v empty.cpp" and capture stdout and stderr. Treat the stdout as the preprocessor predefines block and parse it to extract the target architecture. Parse the stderr to extract the header file search path. Install the now-populated share/castxml resource directory to the CastXML_INSTALL_DATA_DIR.
* Add --castxml-cc-<id> option to specify compiler commandBrad King2014-02-141-0/+34
Add members to the Options struct to hold the preprocessor and target settings detected from a given compiler command. Add an API to fill in the members.