r338627 - [test] Fix %hmaptool path for standalone builds
Author: mgorny Date: Wed Aug 1 13:38:22 2018 New Revision: 338627 URL: http://llvm.org/viewvc/llvm-project?rev=338627&view=rev Log: [test] Fix %hmaptool path for standalone builds Fix %hmaptool path to refer to clang_tools_dir instead of llvm_tools_dir, in order to fix standalone builds. The tool is built as part of clang, so it won't be found in installed LLVM tools. Differential Revision: https://reviews.llvm.org/D50156 Modified: cfe/trunk/test/lit.cfg.py Modified: cfe/trunk/test/lit.cfg.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=338627&r1=338626&r2=338627&view=diff == --- cfe/trunk/test/lit.cfg.py (original) +++ cfe/trunk/test/lit.cfg.py Wed Aug 1 13:38:22 2018 @@ -71,7 +71,7 @@ llvm_config.add_tool_substitutions(tools config.substitutions.append( ('%hmaptool', "'%s' %s" % (config.python_executable, - os.path.join(config.llvm_tools_dir, 'hmaptool' + os.path.join(config.clang_tools_dir, 'hmaptool' # Plugins (loadable modules) # TODO: This should be supplied by Makefile or autoconf. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r304715 - [test] Fix baremetal test to allow any -resource-dir
Author: mgorny Date: Mon Jun 5 09:13:37 2017 New Revision: 304715 URL: http://llvm.org/viewvc/llvm-project?rev=304715&view=rev Log: [test] Fix baremetal test to allow any -resource-dir The baremetal test (r303873) has been added with expectance of very specific -resource-dir. However, the test itself nor the BareMetal driver does not enforce any specific -resource-dir, making this constraint invalid. It already has been altered twice -- in r303910 for Windows compatibility, and in r304085 for systems using lib64. To account for even more systems, just use [[RESOURCE_DIR]] like a number of other tests do. This is needed for Gentoo where RESOURCE_DIR starts with ../ (uses relative path to a parent directory). Differential Revision: https://reviews.llvm.org/D33877 Modified: cfe/trunk/test/Driver/baremetal.cpp Modified: cfe/trunk/test/Driver/baremetal.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/baremetal.cpp?rev=304715&r1=304714&r2=304715&view=diff == --- cfe/trunk/test/Driver/baremetal.cpp (original) +++ cfe/trunk/test/Driver/baremetal.cpp Mon Jun 5 09:13:37 2017 @@ -5,13 +5,13 @@ // RUN: --sysroot=%S/Inputs/baremetal_arm \ // RUN: | FileCheck --check-prefix=CHECK-V6M-C %s // CHECK-V6M-C: "[[PREFIX_DIR:.*]]{{[/\\]+}}{{[^/^\\]+}}{{[/\\]+}}clang{{.*}}" "-cc1" "-triple" "thumbv6m-none--eabi" -// CHECK-V6M-C-SAME: "-resource-dir" "[[PREFIX_DIR]]{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}[[VERSION:[^"]*]]" +// CHECK-V6M-C-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]" // CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1" // CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include" // CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp" // CHECK-V6M-C-NEXT: "{{[^"]*}}ld.lld" "{{.*}}.o" "-Bstatic" -// CHECK-V6M-C-SAME: "-L[[PREFIX_DIR]]{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}[[VERSION]]{{[/\\]+}}lib{{[/\\]+}}baremetal" +// CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal" // CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for" // CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a" // CHECK-V6M-C-SAME: "-o" "{{.*}}.o" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r326836 - [FrontEnd] Allow overriding the default C/C++ -std via CMake vars
Author: mgorny Date: Tue Mar 6 13:26:28 2018 New Revision: 326836 URL: http://llvm.org/viewvc/llvm-project?rev=326836&view=rev Log: [FrontEnd] Allow overriding the default C/C++ -std via CMake vars Provide two new CMake cache variables -- CLANG_DEFAULT_STD_C and CLANG_DEFAULT_STD_CXX -- that can be used to override the default C/ObjC and C++/ObjC++ standards appropriately. They can be set to one of the identifiers from LangStandards.def, or left unset (the default) to respect the current platform default. This option is mostly intended for compiler vendors that may wish to adjust the defaults their compilers are using. For example, Gentoo planned to use it to set clang and gcc to matching standards, so that we could maintain as much compatibility between different compilers as possible. The code relies on explicit identifiers rather than the string aliases for simplicity. This saves us from the necessity of parsing aliases at build-time or adding additional processing at runtime. For the latter case, it also adds trivial value check -- if incorrect value is passed, the code simply fails to compile through referencing an undefined constant. If the variable is used to redefine the default standard, the explicit value overrides the special case for PS4. It is done this way mostly following other kinds of variables where 'platform defaults' are redefined. Differential Revision: https://reviews.llvm.org/D34365 Modified: cfe/trunk/CMakeLists.txt cfe/trunk/include/clang/Config/config.h.cmake cfe/trunk/lib/Frontend/CompilerInvocation.cpp Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=326836&r1=326835&r2=326836&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Tue Mar 6 13:26:28 2018 @@ -212,6 +212,12 @@ set(ENABLE_LINKER_BUILD_ID OFF CACHE BOO set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL "enable x86 relax relocations by default") +# TODO: verify the values against LangStandards.def? +set(CLANG_DEFAULT_STD_C "" CACHE STRING + "Default standard to use for C/ObjC code (IDENT from LangStandards.def, empty for platform default)") +set(CLANG_DEFAULT_STD_CXX "" CACHE STRING + "Default standard to use for C++/ObjC++ code (IDENT from LangStandards.def, empty for platform default)") + set(CLANG_DEFAULT_LINKER "" CACHE STRING "Default linker to use (linker name or absolute path, empty for platform default)") Modified: cfe/trunk/include/clang/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Config/config.h.cmake?rev=326836&r1=326835&r2=326836&view=diff == --- cfe/trunk/include/clang/Config/config.h.cmake (original) +++ cfe/trunk/include/clang/Config/config.h.cmake Tue Mar 6 13:26:28 2018 @@ -11,6 +11,12 @@ /* Default linker to use. */ #define CLANG_DEFAULT_LINKER "${CLANG_DEFAULT_LINKER}" +/* Default C/ObjC standard to use. */ +#cmakedefine CLANG_DEFAULT_STD_C LangStandard::lang_${CLANG_DEFAULT_STD_C} + +/* Default C++/ObjC++ standard to use. */ +#cmakedefine CLANG_DEFAULT_STD_CXX LangStandard::lang_${CLANG_DEFAULT_STD_CXX} + /* Default C++ stdlib to use. */ #define CLANG_DEFAULT_CXX_STDLIB "${CLANG_DEFAULT_CXX_STDLIB}" Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=326836&r1=326835&r2=326836&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Mar 6 13:26:28 2018 @@ -1809,18 +1809,30 @@ void CompilerInvocation::setLangDefaults break; case InputKind::Asm: case InputKind::C: +#if defined(CLANG_DEFAULT_STD_C) + LangStd = CLANG_DEFAULT_STD_C; +#else // The PS4 uses C99 as the default C standard. if (T.isPS4()) LangStd = LangStandard::lang_gnu99; else LangStd = LangStandard::lang_gnu11; +#endif break; case InputKind::ObjC: +#if defined(CLANG_DEFAULT_STD_C) + LangStd = CLANG_DEFAULT_STD_C; +#else LangStd = LangStandard::lang_gnu11; +#endif break; case InputKind::CXX: case InputKind::ObjCXX: +#if defined(CLANG_DEFAULT_STD_CXX) + LangStd = CLANG_DEFAULT_STD_CXX; +#else LangStd = LangStandard::lang_gnucxx14; +#endif break; case InputKind::RenderScript: LangStd = LangStandard::lang_c99; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344240 - [python] [tests] Support overriding library path via environment
Author: mgorny Date: Thu Oct 11 04:58:07 2018 New Revision: 344240 URL: http://llvm.org/viewvc/llvm-project?rev=344240&view=rev Log: [python] [tests] Support overriding library path via environment Support a new CLANG_LIBRARY_PATH environment variable for the Python binding tests. This variable can be used to force the bindings to load libclang.* from a specific directory. I plan to use this when integrating Python binding tests with the CMake build system. Currently, those tests load libclang.so from default search paths, so I would have to rely on platform-specific mechanics such as LD_LIBRARY_PATH. Instead of copying the whole logic necessary to handle platform differences into yet another place, it's easier to just add a dedicated variable for this purpose. Differential Revision: https://reviews.llvm.org/D52806 Modified: cfe/trunk/bindings/python/README.txt cfe/trunk/bindings/python/tests/cindex/test_access_specifiers.py cfe/trunk/bindings/python/tests/cindex/test_cdb.py cfe/trunk/bindings/python/tests/cindex/test_code_completion.py cfe/trunk/bindings/python/tests/cindex/test_comment.py cfe/trunk/bindings/python/tests/cindex/test_cursor.py cfe/trunk/bindings/python/tests/cindex/test_cursor_kind.py cfe/trunk/bindings/python/tests/cindex/test_diagnostics.py cfe/trunk/bindings/python/tests/cindex/test_exception_specification_kind.py cfe/trunk/bindings/python/tests/cindex/test_file.py cfe/trunk/bindings/python/tests/cindex/test_index.py cfe/trunk/bindings/python/tests/cindex/test_linkage.py cfe/trunk/bindings/python/tests/cindex/test_location.py cfe/trunk/bindings/python/tests/cindex/test_tls_kind.py cfe/trunk/bindings/python/tests/cindex/test_token_kind.py cfe/trunk/bindings/python/tests/cindex/test_tokens.py cfe/trunk/bindings/python/tests/cindex/test_translation_unit.py cfe/trunk/bindings/python/tests/cindex/test_type.py Modified: cfe/trunk/bindings/python/README.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/README.txt?rev=344240&r1=344239&r2=344240&view=diff == --- cfe/trunk/bindings/python/README.txt (original) +++ cfe/trunk/bindings/python/README.txt Thu Oct 11 04:58:07 2018 @@ -4,12 +4,12 @@ This directory implements Python bindings for Clang. -You may need to alter LD_LIBRARY_PATH so that the Clang library can be +You may need to set CLANG_LIBRARY_PATH so that the Clang library can be found. The unit tests are designed to be run with any standard test runner. For example: -- $ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/) \ - LD_LIBRARY_PATH=$(llvm-config --libdir) \ + CLANG_LIBRARY_PATH=$(llvm-config --libdir) \ python -m unittest discover -v tests.cindex.test_index.test_create ... ok ... Modified: cfe/trunk/bindings/python/tests/cindex/test_access_specifiers.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_access_specifiers.py?rev=344240&r1=344239&r2=344240&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_access_specifiers.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_access_specifiers.py Thu Oct 11 04:58:07 2018 @@ -1,3 +1,7 @@ +import os +from clang.cindex import Config +if 'CLANG_LIBRARY_PATH' in os.environ: +Config.set_library_path(os.environ['CLANG_LIBRARY_PATH']) from clang.cindex import AccessSpecifier from clang.cindex import Cursor Modified: cfe/trunk/bindings/python/tests/cindex/test_cdb.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cdb.py?rev=344240&r1=344239&r2=344240&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_cdb.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_cdb.py Thu Oct 11 04:58:07 2018 @@ -1,3 +1,8 @@ +import os +from clang.cindex import Config +if 'CLANG_LIBRARY_PATH' in os.environ: +Config.set_library_path(os.environ['CLANG_LIBRARY_PATH']) + from clang.cindex import CompilationDatabase from clang.cindex import CompilationDatabaseError from clang.cindex import CompileCommands Modified: cfe/trunk/bindings/python/tests/cindex/test_code_completion.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_code_completion.py?rev=344240&r1=344239&r2=344240&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_code_completion.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_code_completion.py Thu Oct 11 04:58:07 2018 @@ -1,3 +1,8 @@ +import os +from clang.cindex import Config +if 'CLANG_LIBRARY_PATH' in os.environ: +Config.set_library_path(os.environ['CLANG_LIBRARY_PATH']) + from clang.cindex import TranslationUnit import unit
r344241 - [tests] Include Python binding tests in CMake rules
Author: mgorny Date: Thu Oct 11 04:58:14 2018 New Revision: 344241 URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev Log: [tests] Include Python binding tests in CMake rules Add a new CMake rule check-clang-python to run the Python bindings' test suite, and include it in check-all. Differential Revision: https://reviews.llvm.org/D52840 Added: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018 @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS ) ) endif() add_subdirectory(utils/perf-training) + add_subdirectory(bindings/python/tests) endif() option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs." Added: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 04:58:14 2018 @@ -0,0 +1,7 @@ +# Test target to run Python test suite from main build. + +add_custom_target(check-clang-python + COMMAND CLANG_LIBRARY_PATH=$ ${PYTHON_EXECUTABLE} -m unittest discover + DEPENDS libclang + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) +add_dependencies(check-all check-clang-python) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344258 - [tests] Include Python binding tests in CMake rules
Author: mgorny Date: Thu Oct 11 09:32:54 2018 New Revision: 344258 URL: http://llvm.org/viewvc/llvm-project?rev=344258&view=rev Log: [tests] Include Python binding tests in CMake rules Add a new CMake rule check-clang-python to run the Python bindings' test suite, and include it in check-all. Differential Revision: https://reviews.llvm.org/D52840 Added: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344258&r1=344257&r2=344258&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Thu Oct 11 09:32:54 2018 @@ -485,6 +485,7 @@ if( CLANG_INCLUDE_TESTS ) ) endif() add_subdirectory(test) + add_subdirectory(bindings/python/tests) if(CLANG_BUILT_STANDALONE) # Add a global check rule now that all subdirectories have been traversed @@ -493,11 +494,13 @@ if( CLANG_INCLUDE_TESTS ) get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS) get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS) get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS) +get_property(LLVM_ADDITIONAL_TEST_TARGETS + GLOBAL PROPERTY LLVM_ADDITIONAL_TEST_TARGETS) add_lit_target(check-all "Running all regression tests" ${LLVM_LIT_TESTSUITES} PARAMS ${LLVM_LIT_PARAMS} - DEPENDS ${LLVM_LIT_DEPENDS} + DEPENDS ${LLVM_LIT_DEPENDS} ${LLVM_ADDITIONAL_TEST_TARGETS} ARGS ${LLVM_LIT_EXTRA_ARGS} ) endif() Added: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344258&view=auto == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 09:32:54 2018 @@ -0,0 +1,8 @@ +# Test target to run Python test suite from main build. + +add_custom_target(check-clang-python + COMMAND CLANG_LIBRARY_PATH=$ ${PYTHON_EXECUTABLE} -m unittest discover + DEPENDS libclang + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) + +set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344260 - [tests] Remove Python tests from check-all due to breakage
Author: mgorny Date: Thu Oct 11 10:25:05 2018 New Revision: 344260 URL: http://llvm.org/viewvc/llvm-project?rev=344260&view=rev Log: [tests] Remove Python tests from check-all due to breakage Remove the Python tests from default target in order to fix two kinds of breakage uncovered by enabling them: one failing test on Linux, and problem with the test command on Windows. Both to be addressed in followup revisions. Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344260&r1=344259&r2=344260&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 10:25:05 2018 @@ -5,4 +5,4 @@ add_custom_target(check-clang-python DEPENDS libclang WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) -set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) +#set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344263 - [python] [tests] Retab CMakeLists.txt for consistency (NFC)
Author: mgorny Date: Thu Oct 11 10:45:35 2018 New Revision: 344263 URL: http://llvm.org/viewvc/llvm-project?rev=344263&view=rev Log: [python] [tests] Retab CMakeLists.txt for consistency (NFC) Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344263&r1=344262&r2=344263&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 10:45:35 2018 @@ -1,8 +1,8 @@ # Test target to run Python test suite from main build. add_custom_target(check-clang-python - COMMAND CLANG_LIBRARY_PATH=$ ${PYTHON_EXECUTABLE} -m unittest discover - DEPENDS libclang - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) +COMMAND CLANG_LIBRARY_PATH=$ ${PYTHON_EXECUTABLE} -m unittest discover +DEPENDS libclang +WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) #set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344288 - [python] [tests] Fix calling tests on Windows
Author: mgorny Date: Thu Oct 11 13:26:55 2018 New Revision: 344288 URL: http://llvm.org/viewvc/llvm-project?rev=344288&view=rev Log: [python] [tests] Fix calling tests on Windows Fix passing arguments to the Python test command to use 'env' builtin CMake command, in order to fix compatibility with Windows. Differential Revision: https://reviews.llvm.org/D53151 Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344288&r1=344287&r2=344288&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 13:26:55 2018 @@ -1,7 +1,9 @@ # Test target to run Python test suite from main build. add_custom_target(check-clang-python -COMMAND CLANG_LIBRARY_PATH=$ ${PYTHON_EXECUTABLE} -m unittest discover +COMMAND ${CMAKE_COMMAND} -E env +CLANG_LIBRARY_PATH=$ +${PYTHON_EXECUTABLE} -m unittest discover DEPENDS libclang WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344365 - [tests] Readd Python binding tests to check-all
Author: mgorny Date: Fri Oct 12 09:55:44 2018 New Revision: 344365 URL: http://llvm.org/viewvc/llvm-project?rev=344365&view=rev Log: [tests] Readd Python binding tests to check-all Now that both issues found out during the last iteration have been fixed, reenable the Python binding tests on buildbots. Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344365&r1=344364&r2=344365&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Fri Oct 12 09:55:44 2018 @@ -7,4 +7,5 @@ add_custom_target(check-clang-python DEPENDS libclang WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) -#set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) +set_property(GLOBAL APPEND PROPERTY + LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344364 - [python] [tests] Remove cdb lookup failure test
Author: mgorny Date: Fri Oct 12 09:55:39 2018 New Revision: 344364 URL: http://llvm.org/viewvc/llvm-project?rev=344364&view=rev Log: [python] [tests] Remove cdb lookup failure test Remove the test checking for compilation db lookup failure. Since r342228, JSONCompilationDatabasePlugin infers compile commands for missing files, therefore making the lookup always succeed. Differential Revision: https://reviews.llvm.org/D53202 Modified: cfe/trunk/bindings/python/tests/cindex/test_cdb.py Modified: cfe/trunk/bindings/python/tests/cindex/test_cdb.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cdb.py?rev=344364&r1=344363&r2=344364&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_cdb.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_cdb.py Fri Oct 12 09:55:39 2018 @@ -31,11 +31,6 @@ class TestCDB(unittest.TestCase): """Check we can load a compilation database""" cdb = CompilationDatabase.fromDirectory(kInputsDir) -def test_lookup_fail(self): -"""Check file lookup failure""" -cdb = CompilationDatabase.fromDirectory(kInputsDir) -self.assertIsNone(cdb.getCompileCommands('file_do_not_exist.cpp')) - def test_lookup_succeed(self): """Check we get some results if the file exists in the db""" cdb = CompilationDatabase.fromDirectory(kInputsDir) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344411 - [python] [tests] Re-add once again, this time without Windows
Author: mgorny Date: Fri Oct 12 13:03:54 2018 New Revision: 344411 URL: http://llvm.org/viewvc/llvm-project?rev=344411&view=rev Log: [python] [tests] Re-add once again, this time without Windows Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344411&r1=344410&r2=344411&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Fri Oct 12 13:03:54 2018 @@ -7,4 +7,9 @@ add_custom_target(check-clang-python DEPENDS libclang WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) -#set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) +# Tests fail on Windows, and need someone knowledgeable to fix. +# It's not clear whether it's a test or a valid binding problem. +if(NOT WIN32) +set_property(GLOBAL APPEND PROPERTY + LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) +endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344666 - [python] [tests] Disable on known-broken arches
Author: mgorny Date: Tue Oct 16 20:05:39 2018 New Revision: 344666 URL: http://llvm.org/viewvc/llvm-project?rev=344666&view=rev Log: [python] [tests] Disable on known-broken arches Disable the Python binding tests on AArch64, Hexagon and SystemZ following reports on test failures. The first two yield different results, possibly indicating test case problems. The last one seems to have broken FFI in Python. While at it, refactor the code to make adding future test restrictions easier. Differential Revision: https://reviews.llvm.org/D53326 Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344666&r1=344665&r2=344666&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Tue Oct 16 20:05:39 2018 @@ -7,24 +7,34 @@ add_custom_target(check-clang-python DEPENDS libclang WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) -# Check if we are building with ASan -list(FIND LLVM_USE_SANITIZER "Address" LLVM_USE_ASAN_INDEX) -if (LLVM_USE_ASAN_INDEX EQUAL -1) - set(LLVM_USE_ASAN FALSE) -else() - set(LLVM_USE_ASAN TRUE) -endif() +set(RUN_PYTHON_TESTS TRUE) -# Tests fail on Windows, and need someone knowledgeable to fix. -# It's not clear whether it's a test or a valid binding problem. -# # Do not try to run if libclang was built with ASan because # the sanitizer library will likely be loaded too late to perform # interception and will then fail. # We could use LD_PRELOAD/DYLD_INSERT_LIBRARIES but this isn't # portable so its easier just to not run the tests when building # with ASan. -if((NOT WIN32) AND (NOT LLVM_USE_ASAN)) +list(FIND LLVM_USE_SANITIZER "Address" LLVM_USE_ASAN_INDEX) +if(NOT LLVM_USE_ASAN_INDEX EQUAL -1) + set(RUN_PYTHON_TESTS FALSE) +endif() + +# Tests fail on Windows, and need someone knowledgeable to fix. +# It's not clear whether it's a test or a valid binding problem. +if(WIN32) + set(RUN_PYTHON_TESTS FALSE) +endif() + +# AArch64 and Hexagon have known test failures that need to be +# addressed. +# SystemZ has broken Python/FFI interface: +# https://reviews.llvm.org/D52840#1265716 +if(${LLVM_NATIVE_ARCH} MATCHES "^(AArch64|Hexagon|SystemZ)$") + set(RUN_PYTHON_TESTS FALSE) +endif() + +if(RUN_PYTHON_TESTS) set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-clang-python) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r351002 - [NetBSD] Enable additional sanitizer types
Author: mgorny Date: Sat Jan 12 03:18:35 2019 New Revision: 351002 URL: http://llvm.org/viewvc/llvm-project?rev=351002&view=rev Log: [NetBSD] Enable additional sanitizer types Differential Revision: https://reviews.llvm.org/D56607 Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp cfe/trunk/test/Driver/fsanitize.c Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=351002&r1=351001&r2=351002&view=diff == --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Sat Jan 12 03:18:35 2019 @@ -448,10 +448,14 @@ SanitizerMask NetBSD::getSupportedSaniti Res |= SanitizerKind::Vptr; } if (IsX86_64) { +Res |= SanitizerKind::DataFlow; Res |= SanitizerKind::Efficiency; Res |= SanitizerKind::Fuzzer; Res |= SanitizerKind::FuzzerNoLink; +Res |= SanitizerKind::HWAddress; Res |= SanitizerKind::KernelAddress; +Res |= SanitizerKind::KernelHWAddress; +Res |= SanitizerKind::KernelMemory; Res |= SanitizerKind::Memory; Res |= SanitizerKind::Thread; } Modified: cfe/trunk/test/Driver/fsanitize.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=351002&r1=351001&r2=351002&view=diff == --- cfe/trunk/test/Driver/fsanitize.c (original) +++ cfe/trunk/test/Driver/fsanitize.c Sat Jan 12 03:18:35 2019 @@ -709,28 +709,67 @@ // RUN: %clang -target x86_64-unknown-cloudabi -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI // SAFESTACK-CLOUDABI: "-fsanitize=safe-stack" + + +// * NetBSD; please keep ordered as in Sanitizers.def * + // RUN: %clang -target i386--netbsd -fsanitize=address %s -### 2>&1 | FileCheck %s -check-prefix=ADDRESS-NETBSD // RUN: %clang -target x86_64--netbsd -fsanitize=address %s -### 2>&1 | FileCheck %s -check-prefix=ADDRESS-NETBSD // ADDRESS-NETBSD: "-fsanitize=address" +// RUN: %clang -target x86_64--netbsd -fsanitize=kernel-address %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-ADDRESS-NETBSD +// KERNEL-ADDRESS-NETBSD: "-fsanitize=kernel-address" + +// RUN: %clang -target x86_64--netbsd -fsanitize=hwaddress %s -### 2>&1 | FileCheck %s -check-prefix=HWADDRESS-NETBSD +// HWADDRESS-NETBSD: "-fsanitize=hwaddress" + +// RUN: %clang -target x86_64--netbsd -fsanitize=kernel-hwaddress %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-HWADDRESS-NETBSD +// KERNEL-HWADDRESS-NETBSD: "-fsanitize=kernel-hwaddress" + +// RUN: %clang -target x86_64--netbsd -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=MEMORY-NETBSD +// MEMORY-NETBSD: "-fsanitize=memory" + +// RUN: %clang -target x86_64--netbsd -fsanitize=kernel-memory %s -### 2>&1 | FileCheck %s -check-prefix=KERNEL-MEMORY-NETBSD +// KERNEL-MEMORY-NETBSD: "-fsanitize=kernel-memory" + +// RUN: %clang -target x86_64--netbsd -fsanitize=thread %s -### 2>&1 | FileCheck %s -check-prefix=THREAD-NETBSD +// THREAD-NETBSD: "-fsanitize=thread" + +// RUN: %clang -target i386--netbsd -fsanitize=leak %s -### 2>&1 | FileCheck %s -check-prefix=LEAK-NETBSD +// RUN: %clang -target x86_64--netbsd -fsanitize=leak %s -### 2>&1 | FileCheck %s -check-prefix=LEAK-NETBSD +// LEAK-NETBSD: "-fsanitize=leak" + +// RUN: %clang -target i386--netbsd -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-NETBSD +// RUN: %clang -target x86_64--netbsd -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-NETBSD +// FUNCTION-NETBSD: "-fsanitize=function" + // RUN: %clang -target i386--netbsd -fsanitize=vptr %s -### 2>&1 | FileCheck %s -check-prefix=VPTR-NETBSD // RUN: %clang -target x86_64--netbsd -fsanitize=vptr %s -### 2>&1 | FileCheck %s -check-prefix=VPTR-NETBSD // VPTR-NETBSD: "-fsanitize=vptr" +// RUN: %clang -target x86_64--netbsd -fsanitize=dataflow %s -### 2>&1 | FileCheck %s -check-prefix=DATAFLOW-NETBSD +// DATAFLOW-NETBSD: "-fsanitize=dataflow" + +// RUN: %clang -target i386--netbsd -fsanitize=cfi %s -### 2>&1 | FileCheck %s -check-prefix=CFI-NETBSD +// RUN: %clang -target x86_64--netbsd -fsanitize=cfi %s -### 2>&1 | FileCheck %s -check-prefix=CFI-NETBSD +// CFI-NETBSD: "-fsanitize=cfi-derived-cast,cfi-icall,cfi-mfcall,cfi-unrelated-cast,cfi-nvcall,cfi-vcall" + // RUN: %clang -target i386--netbsd -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-NETBSD // RUN: %clang -target x86_64--netbsd -fsanitize=safe-stack %s -### 2>&1 | FileCheck %s -check-prefix=SAFESTACK-NETBSD // SAFESTACK-NETBSD: "-fsanitize=safe-stack" -// RUN: %clang -target i386--netbsd -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-NETBSD -// RUN: %clang -target x86_64--netbsd -fsanitize=function %s -### 2>&1 | FileCheck %s -check-prefix=FUNCTION-NETBSD -// FUNCTION-NETBSD: "-fsanitize=fun
r351304 - [test] Disable Python binding tests w/ LLVM_ENABLE_PIC=OFF
Author: mgorny Date: Wed Jan 16 00:05:13 2019 New Revision: 351304 URL: http://llvm.org/viewvc/llvm-project?rev=351304&view=rev Log: [test] Disable Python binding tests w/ LLVM_ENABLE_PIC=OFF Disable Python binding tests when LLVM_ENABLE_PIC is disabled, as libclang.so is not being built in that case. Reported by Nico Weber. Differential Revision: https://reviews.llvm.org/D56732 Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt Modified: cfe/trunk/bindings/python/tests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=351304&r1=351303&r2=351304&view=diff == --- cfe/trunk/bindings/python/tests/CMakeLists.txt (original) +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Wed Jan 16 00:05:13 2019 @@ -10,6 +10,11 @@ add_custom_target(check-clang-python set(RUN_PYTHON_TESTS TRUE) set_target_properties(check-clang-python PROPERTIES FOLDER "Clang tests") +# Tests require libclang.so which is only built with LLVM_ENABLE_PIC=ON +if(NOT LLVM_ENABLE_PIC) + set(RUN_PYTHON_TESTS FALSE) +endif() + # Do not try to run if libclang was built with ASan because # the sanitizer library will likely be loaded too late to perform # interception and will then fail. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r351752 - [test] Pass -ccc-install-dir in mac compilation db test
Author: mgorny Date: Mon Jan 21 09:05:43 2019 New Revision: 351752 URL: http://llvm.org/viewvc/llvm-project?rev=351752&view=rev Log: [test] Pass -ccc-install-dir in mac compilation db test Pass -ccc-install-dir explicitly as the compilation database code does not pass argv[0] to getMainExecutable(), while some systems require it to return the correct path. Since the relevant code is apparently only applicable to Darwin, just pass correct -ccc-install-dir to make the tests pass on *BSD systems. Differential Revision: https://reviews.llvm.org/D56976 Modified: cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp Modified: cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp?rev=351752&r1=351751&r2=351752&view=diff == --- cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp (original) +++ cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp Mon Jan 21 09:05:43 2019 @@ -10,6 +10,11 @@ // // RUN: cp clang-check %t/mock-libcxx/bin/ // RUN: cp %s %t/test.cpp -// RUN: "%t/mock-libcxx/bin/clang-check" -p %t %t/test.cpp -- -stdlib=libc++ -target x86_64-apple-darwin +// RUN: "%t/mock-libcxx/bin/clang-check" -p %t %t/test.cpp -- \ +// RUN: -stdlib=libc++ -target x86_64-apple-darwin \ +// RUN: -ccc-install-dir %t/mock-libcxx/bin +// +// ^ -ccc-install-dir passed to unbreak tests on *BSD where +// getMainExecutable() relies on real argv[0] being passed #include vector v; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r352610 - [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Author: mgorny Date: Wed Jan 30 00:20:24 2019 New Revision: 352610 URL: http://llvm.org/viewvc/llvm-project?rev=352610&view=rev Log: [clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes Append appropriate -rpath when using shared compiler-rt runtimes, e.g. '-fsanitize=address -shared-libasan'. There's already a similar logic in CommonArgs.cpp but it uses non-standard arch-suffixed installation directory while we want our driver to work with standard installation paths. Differential Revision: https://reviews.llvm.org/D57303 Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=352610&r1=352609&r2=352610&view=diff == --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Wed Jan 30 00:20:24 2019 @@ -255,6 +255,13 @@ void netbsd::Linker::ConstructJob(Compil bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); + const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs(); + if (SanArgs.needsSharedRt()) { +CmdArgs.push_back("-rpath"); +CmdArgs.push_back(Args.MakeArgString( +ToolChain.getCompilerRTPath().c_str())); + } + unsigned Major, Minor, Micro; ToolChain.getTriple().getOSVersion(Major, Minor, Micro); bool useLibgcc = true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r346586 - [python] Support PathLike filenames and directories
Author: mgorny Date: Sat Nov 10 03:41:36 2018 New Revision: 346586 URL: http://llvm.org/viewvc/llvm-project?rev=346586&view=rev Log: [python] Support PathLike filenames and directories Python 3.6 introduced a file system path protocol (PEP 519[1]). The standard library APIs accepting file system paths now accept path objects too. It could be useful to add this here as well for convenience. [1] https://www.python.org/dev/peps/pep-0519 Authored by: jstasiak (Jakub Stasiak) Differential Revision: https://reviews.llvm.org/D54120 Modified: cfe/trunk/bindings/python/clang/cindex.py cfe/trunk/bindings/python/tests/cindex/test_cdb.py cfe/trunk/bindings/python/tests/cindex/test_code_completion.py cfe/trunk/bindings/python/tests/cindex/test_translation_unit.py cfe/trunk/bindings/python/tests/cindex/util.py Modified: cfe/trunk/bindings/python/clang/cindex.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=346586&r1=346585&r2=346586&view=diff == --- cfe/trunk/bindings/python/clang/cindex.py (original) +++ cfe/trunk/bindings/python/clang/cindex.py Sat Nov 10 03:41:36 2018 @@ -67,6 +67,7 @@ import collections import clang.enumerations +import os import sys if sys.version_info[0] == 3: # Python 3 strings are unicode, translate them to/from utf8 for C-interop. @@ -123,6 +124,14 @@ elif sys.version_info[0] == 2: def b(x): return x +# We only support PathLike objects on Python version with os.fspath present +# to be consistent with the Python standard library. On older Python versions +# we only support strings and we have dummy fspath to just pass them through. +try: +fspath = os.fspath +except AttributeError: +def fspath(x): +return x # ctypes doesn't implicitly convert c_void_p to the appropriate wrapper # object. This is a problem, because it means that from_parameter will see an @@ -2752,11 +2761,11 @@ class TranslationUnit(ClangObject): etc. e.g. ["-Wall", "-I/path/to/include"]. In-memory file content can be provided via unsaved_files. This is an -iterable of 2-tuples. The first element is the str filename. The -second element defines the content. Content can be provided as str -source code or as file objects (anything with a read() method). If -a file object is being used, content will be read until EOF and the -read cursor will not be reset to its original position. +iterable of 2-tuples. The first element is the filename (str or +PathLike). The second element defines the content. Content can be +provided as str source code or as file objects (anything with a read() +method). If a file object is being used, content will be read until EOF +and the read cursor will not be reset to its original position. options is a bitwise or of TranslationUnit.PARSE_XXX flags which will control parsing behavior. @@ -2801,11 +2810,13 @@ class TranslationUnit(ClangObject): if hasattr(contents, "read"): contents = contents.read() -unsaved_array[i].name = b(name) +unsaved_array[i].name = b(fspath(name)) unsaved_array[i].contents = b(contents) unsaved_array[i].length = len(contents) -ptr = conf.lib.clang_parseTranslationUnit(index, filename, args_array, +ptr = conf.lib.clang_parseTranslationUnit(index, +fspath(filename) if filename is not None else None, +args_array, len(args), unsaved_array, len(unsaved_files), options) @@ -2826,11 +2837,13 @@ class TranslationUnit(ClangObject): index is optional and is the Index instance to use. If not provided, a default Index will be created. + +filename can be str or PathLike. """ if index is None: index = Index.create() -ptr = conf.lib.clang_createTranslationUnit(index, filename) +ptr = conf.lib.clang_createTranslationUnit(index, fspath(filename)) if not ptr: raise TranslationUnitLoadError(filename) @@ -2983,7 +2996,7 @@ class TranslationUnit(ClangObject): print(value) if not isinstance(value, str): raise TypeError('Unexpected unsaved file contents.') -unsaved_files_array[i].name = name +unsaved_files_array[i].name = fspath(name) unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) ptr = conf.lib.clang_reparseTranslationUnit(self, len(unsaved_files), @@ -3002,10 +3015,10 @@ class TranslationUnit(ClangObject): case, the reason(s) why should be available via
r348356 - [test] Disable Modules/prune.m on NetBSD as it requires 'touch -a'
Author: mgorny Date: Wed Dec 5 03:17:50 2018 New Revision: 348356 URL: http://llvm.org/viewvc/llvm-project?rev=348356&view=rev Log: [test] Disable Modules/prune.m on NetBSD as it requires 'touch -a' Modified: cfe/trunk/test/Modules/prune.m Modified: cfe/trunk/test/Modules/prune.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/prune.m?rev=348356&r1=348355&r2=348356&view=diff == --- cfe/trunk/test/Modules/prune.m (original) +++ cfe/trunk/test/Modules/prune.m Wed Dec 5 03:17:50 2018 @@ -1,3 +1,6 @@ +// NetBSD: noatime mounts currently inhibit 'touch -a' updates +// UNSUPPORTED: system-netbsd + // Test the automatic pruning of module cache entries. #ifdef IMPORT_DEPENDS_ON_MODULE @import DependsOnModule; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r348852 - [cmake] Rename append_if to avoid collision with LLVM
Author: mgorny Date: Tue Dec 11 07:30:04 2018 New Revision: 348852 URL: http://llvm.org/viewvc/llvm-project?rev=348852&view=rev Log: [cmake] Rename append_if to avoid collision with LLVM Rename the 'append_if' macro used in libunwind to 'unwind_append_if'. Otherwise, when used in a combined LLVM+libunwind build, it overrides the *incompatible* 'append_if' function from LLVM and breaks projects following libunwind, e.g. OpenMP. Differential Revision: https://reviews.llvm.org/D55476 Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=348852&r1=348851&r2=348852&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Tue Dec 11 07:30:04 2018 @@ -204,7 +204,7 @@ set(LIBUNWIND_COMPILE_FLAGS "") set(LIBUNWIND_LINK_FLAGS "") # Get required flags. -macro(append_if list condition var) +macro(unwind_append_if list condition var) if (${condition}) list(APPEND ${list} ${var}) endif() @@ -242,48 +242,48 @@ endif() # Setup Compiler Flags #=== -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG -Werror=return-type) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG -Werror=return-type) # Get warning flags -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_W_FLAG -W) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WALL_FLAG -Wall) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WCHAR_SUBSCRIPTS_FLAG -Wchar-subscripts) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WCONVERSION_FLAG -Wconversion) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WMISMATCHED_TAGS_FLAG -Wmismatched-tags) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WMISSING_BRACES_FLAG -Wmissing-braces) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WNEWLINE_EOF_FLAG -Wnewline-eof) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WNO_UNUSED_FUNCTION_FLAG -Wno-unused-function) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSHADOW_FLAG -Wshadow) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSHORTEN_64_TO_32_FLAG -Wshorten-64-to-32) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSIGN_COMPARE_FLAG -Wsign-compare) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSIGN_CONVERSION_FLAG -Wsign-conversion) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSTRICT_ALIASING_FLAG -Wstrict-aliasing=2) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSTRICT_OVERFLOW_FLAG -Wstrict-overflow=4) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WUNUSED_PARAMETER_FLAG -Wunused-parameter) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WUNUSED_VARIABLE_FLAG -Wunused-variable) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings) -append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WUNDEF_FLAG -Wundef) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_W_FLAG -W) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WALL_FLAG -Wall) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WCHAR_SUBSCRIPTS_FLAG -Wchar-subscripts) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WCONVERSION_FLAG -Wconversion) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WMISMATCHED_TAGS_FLAG -Wmismatched-tags) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WMISSING_BRACES_FLAG -Wmissing-braces) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WNEWLINE_EOF_FLAG -Wnewline-eof) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WNO_UNUSED_FUNCTION_FLAG -Wno-unused-function) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSHADOW_FLAG -Wshadow) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSHORTEN_64_TO_32_FLAG -Wshorten-64-to-32) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSIGN_COMPARE_FLAG -Wsign-compare) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSIGN_CONVERSION_FLAG -Wsign-conversion) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSTRICT_ALIASING_FLAG -Wstrict-aliasing=2) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WSTRICT_OVERFLOW_FLAG -Wstrict-overflow=4) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WUNUSED_PARAMETER_FLAG -Wunused-parameter) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WUNUSED_VARIABLE_FLAG -Wunused-variable) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings) +unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WUNDEF_FLAG -Wundef) if (LIBUNWIND_ENABLE_WERROR) - append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG -Werror) - append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WX_FLAG -WX) + unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WERROR_FLAG -Werror) + unwind_append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_WX_FLAG -WX)
r355282 - [clang] [ToolChains/NetBSD] Support relative libc++ header path
Author: mgorny Date: Sun Mar 3 02:06:34 2019 New Revision: 355282 URL: http://llvm.org/viewvc/llvm-project?rev=355282&view=rev Log: [clang] [ToolChains/NetBSD] Support relative libc++ header path Support locating the libc++ header files relatively to the clang executable, in addition to the default system path. This is meant to cover two use cases: running just-built clang from the install directory, and running installed clang from non-standard location (e.g. /usr/local). This is the first step towards ensuring that tests of more LLVM projects can work out-of-the-box within the build tree, and use the correct set of headers (rather than e.g. mixing just-built clang+libcxx with system install of libcxx). It avoids requiring the user to hack around missing include paths, or LLVM build system to replicate system-specific C++ library defaults in order to append appropriate paths implicitly. Differential Revision: https://reviews.llvm.org/D58592 Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=355282&r1=355281&r2=355282&view=diff == --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Sun Mar 3 02:06:34 2019 @@ -16,6 +16,7 @@ #include "clang/Driver/Options.h" #include "clang/Driver/SanitizerArgs.h" #include "llvm/Option/ArgList.h" +#include "llvm/Support/VirtualFileSystem.h" using namespace clang::driver; using namespace clang::driver::tools; @@ -422,8 +423,23 @@ ToolChain::CXXStdlibType NetBSD::GetDefa void NetBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const { - addSystemInclude(DriverArgs, CC1Args, - getDriver().SysRoot + "/usr/include/c++/"); + const std::string Candidates[] = { +// directory relative to build tree +getDriver().Dir + "/../include/c++/v1", +// system install with full upstream path +getDriver().SysRoot + "/usr/include/c++/v1", +// system install from src +getDriver().SysRoot + "/usr/include/c++", + }; + + for (const auto &IncludePath : Candidates) { +if (!getVFS().exists(IncludePath + "/__config")) + continue; + +// Use the first candidate that looks valid. +addSystemInclude(DriverArgs, CC1Args, IncludePath); +return; + } } void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r342897 - [python] [tests] Update test_code_completion
Author: mgorny Date: Mon Sep 24 09:10:25 2018 New Revision: 342897 URL: http://llvm.org/viewvc/llvm-project?rev=342897&view=rev Log: [python] [tests] Update test_code_completion Update expected completions to match output generated by clang-7.0. Differential Revision: https://reviews.llvm.org/D50171 Modified: cfe/trunk/bindings/python/tests/cindex/test_code_completion.py Modified: cfe/trunk/bindings/python/tests/cindex/test_code_completion.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_code_completion.py?rev=342897&r1=342896&r2=342897&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_code_completion.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_code_completion.py Mon Sep 24 09:10:25 2018 @@ -61,11 +61,11 @@ void f(P x, Q y) { cr = tu.codeComplete('fake.cpp', 12, 5, unsaved_files=files) expected = [ - "{'const', TypedText} || Priority: 40 || Availability: Available || Brief comment: None", - "{'volatile', TypedText} || Priority: 40 || Availability: Available || Brief comment: None", + "{'const', TypedText} || Priority: 50 || Availability: Available || Brief comment: None", + "{'volatile', TypedText} || Priority: 50 || Availability: Available || Brief comment: None", "{'operator', TypedText} || Priority: 40 || Availability: Available || Brief comment: None", - "{'P', TypedText} | {'::', Text} || Priority: 75 || Availability: Available || Brief comment: None", - "{'Q', TypedText} | {'::', Text} || Priority: 75 || Availability: Available || Brief comment: None" + "{'P', TypedText} || Priority: 50 || Availability: Available || Brief comment: None", + "{'Q', TypedText} || Priority: 50 || Availability: Available || Brief comment: None" ] self.check_completion_results(cr, expected) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)
Author: mgorny Date: Sat Aug 26 14:35:11 2017 New Revision: 311836 URL: http://llvm.org/viewvc/llvm-project?rev=311836&view=rev Log: [Driver] Use arch type to find compiler-rt libraries (on Linux) Use llvm::Triple::getArchTypeName() when looking for compiler-rt libraries, rather than the exact arch string from the triple. This is more correct as it matches the values used when building compiler-rt (builtin-config-ix.cmake) which are the subset of the values allowed in triples. For example, this fixes an issue when the compiler set for i686-pc-linux-gnu triple would not find an i386 compiler-rt library, while this is the exact arch that is detected by compiler-rt. The same applies to any other i?86 variant allowed by LLVM. This also makes the special case for MSVC unnecessary, since now i386 will be used reliably for all 32-bit x86 variants. Differential Revision: https://reviews.llvm.org/D26796 Added: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/ cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/ cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/ cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/ cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o Modified: cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/test/Driver/linux-ld.c cfe/trunk/test/Driver/nostdlib.c cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c cfe/trunk/test/Driver/windows-cross.c Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=311836&r1=311835&r2=311836&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Sat Aug 26 14:35:11 2017 @@ -297,15 +297,12 @@ static StringRef getArchNameForCompilerR const llvm::Triple &Triple = TC.getTriple(); bool IsWindows = Triple.isOSWindows(); - if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86) -return "i386"; - if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb) return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows) ? "armhf" : "arm"; - return TC.getArchName(); + return llvm::Triple::getArchTypeName(TC.getArch()); } std::string ToolChain::getCompilerRTPath() const { Added: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep?rev=311836&view=auto == (empty) Added: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o?rev=311836&view=auto == (empty) Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=311836&r1=311835&r2=311836&view=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Sat Aug 26 14:35:11 2017 @@ -71,6 +71,27 @@ // CHECK-LD-RT: libclang_rt.builtins-x86_64.a" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i686-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --rtlib=compiler-rt \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RT-I686 %s +// CHECK-LD-RT-I686-NOT: warning: +// CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RT-I686: "--eh-frame-hdr" +// CHECK-LD-RT-I686: "-m" "elf_i386" +// CHECK-LD-RT-I686: "-dynamic-linker" +// CHECK-LD-RT-I686: "{{.*}}/usr/lib/gcc/i686-unknown-linux/4.6.0{{/|}}crtbegin.o" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../../../i686-unknown-linux/lib" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../.." +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib" +// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" +// CHECK-LD-RT-I686: "-lc" +// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_android_tree/s
r311861 - Revert r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)
Author: mgorny Date: Sun Aug 27 13:38:43 2017 New Revision: 311861 URL: http://llvm.org/viewvc/llvm-project?rev=311861&view=rev Log: Revert r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux) This causes a breakage on the Android build bot. Let's revert it until we figure out the correct solution there. Removed: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o Modified: cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/test/Driver/linux-ld.c cfe/trunk/test/Driver/nostdlib.c cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c cfe/trunk/test/Driver/windows-cross.c Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=311861&r1=311860&r2=311861&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Sun Aug 27 13:38:43 2017 @@ -297,12 +297,15 @@ static StringRef getArchNameForCompilerR const llvm::Triple &Triple = TC.getTriple(); bool IsWindows = Triple.isOSWindows(); + if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86) +return "i386"; + if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb) return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows) ? "armhf" : "arm"; - return llvm::Triple::getArchTypeName(TC.getArch()); + return TC.getArchName(); } std::string ToolChain::getCompilerRTPath() const { Removed: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep?rev=311860&view=auto == (empty) Removed: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o?rev=311860&view=auto == (empty) Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=311861&r1=311860&r2=311861&view=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Sun Aug 27 13:38:43 2017 @@ -71,27 +71,6 @@ // CHECK-LD-RT: libclang_rt.builtins-x86_64.a" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: --target=i686-unknown-linux \ -// RUN: --gcc-toolchain="" \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ -// RUN: --rtlib=compiler-rt \ -// RUN: | FileCheck --check-prefix=CHECK-LD-RT-I686 %s -// CHECK-LD-RT-I686-NOT: warning: -// CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-LD-RT-I686: "--eh-frame-hdr" -// CHECK-LD-RT-I686: "-m" "elf_i386" -// CHECK-LD-RT-I686: "-dynamic-linker" -// CHECK-LD-RT-I686: "{{.*}}/usr/lib/gcc/i686-unknown-linux/4.6.0{{/|}}crtbegin.o" -// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0" -// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../../../i686-unknown-linux/lib" -// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../.." -// CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib" -// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib" -// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" -// CHECK-LD-RT-I686: "-lc" -// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" -// -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ Modified: cfe/trunk/test/Driver/nostdlib.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/nostdlib.c?rev=311861&r1=311860&r2=311861&view=diff == --- cfe/trunk/test/Driver/nostdlib.c (original) +++ cfe/trunk/test/Driver/nostdlib.c Sun Aug 27 13:38:43 2017 @@ -27,5 +27,5 @@ // // CHECK-LINUX-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt' // CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" -// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-i386.a" +// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-i686.a" // CHECK-MSVC-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt' Modified: cfe/trunk
r311923 - Reland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)
Author: mgorny Date: Mon Aug 28 13:29:52 2017 New Revision: 311923 URL: http://llvm.org/viewvc/llvm-project?rev=311923&view=rev Log: Reland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux) Use llvm::Triple::getArchTypeName() when looking for compiler-rt libraries, rather than the exact arch string from the triple. This is more correct as it matches the values used when building compiler-rt (builtin-config-ix.cmake) which are the subset of the values allowed in triples. For example, this fixes an issue when the compiler set for i686-pc-linux-gnu triple would not find an i386 compiler-rt library, while this is the exact arch that is detected by compiler-rt. The same applies to any other i?86 variant allowed by LLVM. This also makes the special case for MSVC unnecessary, since now i386 will be used reliably for all 32-bit x86 variants. Differential Revision: https://reviews.llvm.org/D26796 Added: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o Modified: cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/test/Driver/linux-ld.c cfe/trunk/test/Driver/nostdlib.c cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c cfe/trunk/test/Driver/windows-cross.c Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=311923&r1=311922&r2=311923&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Aug 28 13:29:52 2017 @@ -297,15 +297,12 @@ static StringRef getArchNameForCompilerR const llvm::Triple &Triple = TC.getTriple(); bool IsWindows = Triple.isOSWindows(); - if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86) -return "i386"; - if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb) return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows) ? "armhf" : "arm"; - return TC.getArchName(); + return llvm::Triple::getArchTypeName(TC.getArch()); } std::string ToolChain::getCompilerRTPath() const { Added: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep?rev=311923&view=auto == (empty) Added: cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o?rev=311923&view=auto == (empty) Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=311923&r1=311922&r2=311923&view=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Mon Aug 28 13:29:52 2017 @@ -71,6 +71,27 @@ // CHECK-LD-RT: libclang_rt.builtins-x86_64.a" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i686-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: --rtlib=compiler-rt \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RT-I686 %s +// CHECK-LD-RT-I686-NOT: warning: +// CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RT-I686: "--eh-frame-hdr" +// CHECK-LD-RT-I686: "-m" "elf_i386" +// CHECK-LD-RT-I686: "-dynamic-linker" +// CHECK-LD-RT-I686: "{{.*}}/usr/lib/gcc/i686-unknown-linux/4.6.0{{/|}}crtbegin.o" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../../../i686-unknown-linux/lib" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../.." +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib" +// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib" +// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" +// CHECK-LD-RT-I686: "-lc" +// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ Modified: cfe/trunk/test/Driver/nostdlib.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/nostdlib.c?rev=311923&r1=311922&r2=311923&view=diff == --- cfe/trunk/test/Driver/nostdlib.c (original) +++ cfe/tru
[clang-tools-extra] r311983 - [cmake] Support running extra clang tool tests without static analyzer
Author: mgorny Date: Mon Aug 28 22:58:08 2017 New Revision: 311983 URL: http://llvm.org/viewvc/llvm-project?rev=311983&view=rev Log: [cmake] Support running extra clang tool tests without static analyzer Support running the extra clang tool tests when the static analyzer is disabled. Disable the relevant clang-tidy tests and one include-fixer test that require it to work. Previously, the tests were disabled entirely with CLANG_ENABLE_STATIC_ANALYZER being false. Now, the tests are being enabled and the relevant tests are excluded and marked unsupported appropriately. In order to disable clang-tidy tests, the whole test directory is added to the exclude lists, to avoid having to explicitly add 'REQUIRES' line to every single test. If the other solution is preferable, I can update the patch. The yamldb_plugin include-fixer test is also updated to be disabled without static analyzer. It fails in that case because clang is not outputting a replacement suggestion -- but I don't know the exact reason why it does not do that. Differential Revision: https://reviews.llvm.org/D37188 Modified: clang-tools-extra/trunk/CMakeLists.txt clang-tools-extra/trunk/test/CMakeLists.txt clang-tools-extra/trunk/test/include-fixer/yamldb_plugin.cpp clang-tools-extra/trunk/test/lit.cfg clang-tools-extra/trunk/test/lit.site.cfg.in clang-tools-extra/trunk/unittests/CMakeLists.txt Modified: clang-tools-extra/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/CMakeLists.txt?rev=311983&r1=311982&r2=311983&view=diff == --- clang-tools-extra/trunk/CMakeLists.txt (original) +++ clang-tools-extra/trunk/CMakeLists.txt Mon Aug 28 22:58:08 2017 @@ -15,8 +15,7 @@ add_subdirectory(pp-trace) add_subdirectory(tool-template) # Add the common testsuite after all the tools. -# TODO: Support tests with more granularity when features are off? -if(CLANG_ENABLE_STATIC_ANALYZER AND CLANG_INCLUDE_TESTS) +if(CLANG_INCLUDE_TESTS) add_subdirectory(test) add_subdirectory(unittests) endif() Modified: clang-tools-extra/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/CMakeLists.txt?rev=311983&r1=311982&r2=311983&view=diff == --- clang-tools-extra/trunk/test/CMakeLists.txt (original) +++ clang-tools-extra/trunk/test/CMakeLists.txt Mon Aug 28 22:58:08 2017 @@ -15,6 +15,9 @@ endif () string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) +llvm_canonicalize_cmake_booleans( + CLANG_ENABLE_STATIC_ANALYZER) + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg @@ -31,11 +34,6 @@ if(CLANG_TOOLS_TEST_USE_VG) endif() set(CLANG_TOOLS_TEST_DEPS - # clang-tidy tests require it. - clang-headers - - # For the clang-tidy libclang integration test. - c-index-test # For the clang-apply-replacements test that uses clang-rename. clang-rename @@ -47,7 +45,6 @@ set(CLANG_TOOLS_TEST_DEPS clang-move clang-query clang-reorder-fields - clang-tidy find-all-symbols modularize pp-trace @@ -56,6 +53,17 @@ set(CLANG_TOOLS_TEST_DEPS ExtraToolsUnitTests ) +if(CLANG_ENABLE_STATIC_ANALYZER) + list(APPEND CLANG_TOOLS_TEST_DEPS +# For the clang-tidy libclang integration test. +c-index-test +# clang-tidy tests require it. +clang-headers + +clang-tidy +) +endif() + set(llvm_utils FileCheck count not ) Modified: clang-tools-extra/trunk/test/include-fixer/yamldb_plugin.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/include-fixer/yamldb_plugin.cpp?rev=311983&r1=311982&r2=311983&view=diff == --- clang-tools-extra/trunk/test/include-fixer/yamldb_plugin.cpp (original) +++ clang-tools-extra/trunk/test/include-fixer/yamldb_plugin.cpp Mon Aug 28 22:58:08 2017 @@ -1,23 +1,24 @@ +// REQUIRES: static-analyzer // RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-include-fixer -fspell-checking -Xclang -plugin-arg-clang-include-fixer -Xclang -input=%p/Inputs/fake_yaml_db.yaml 2>&1 | FileCheck %s foo f; foo g; unknown u; -// CHECK: yamldb_plugin.cpp:3:1: error: unknown type name 'foo'; did you mean 'foo'? -// CHECK: Number FIX-ITs = 1 -// CHECK: FIX-IT: Replace [3:1 - 3:4] with "foo" -// CHECK: yamldb_plugin.cpp:3:1: note: Add '#include "foo.h"' to provide the missing declaration [clang-include-fixer] -// CHECK: Number FIX-ITs = 1 -// CHECK: FIX-IT: Insert "#include "foo.h" // CHECK: yamldb_plugin.cpp:4:1: error: unknown type name 'foo'; did you mean 'foo'? // CHECK: Number FIX-ITs = 1 // CHECK: FIX-IT: Replace [4:1 - 4:4] with "foo" // CHECK: yamldb_plugin.cpp:4:1: note: Add '#include "foo.h"' to p
r362587 - [clang] [test] Add a (xfailing) test for PR41027
Author: mgorny Date: Wed Jun 5 01:21:42 2019 New Revision: 362587 URL: http://llvm.org/viewvc/llvm-project?rev=362587&view=rev Log: [clang] [test] Add a (xfailing) test for PR41027 Add a test for tracking PR41027 (8.0 regression breaking assembly code relying on __builtin_constant_p() to identify compile-time constants). Mark it as expected to fail everywhere. Differential Revision: https://reviews.llvm.org/D60728 Added: cfe/trunk/test/Sema/pr41027.c Added: cfe/trunk/test/Sema/pr41027.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/pr41027.c?rev=362587&view=auto == --- cfe/trunk/test/Sema/pr41027.c (added) +++ cfe/trunk/test/Sema/pr41027.c Wed Jun 5 01:21:42 2019 @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64 -fsyntax-only %s +// XFAIL: * + +inline void pr41027(unsigned a, unsigned b) { + if (__builtin_constant_p(a)) { +__asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a)); + } else { +__asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a)); + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r361931 - [libunwind] [test] Fix inferring source paths
Author: mgorny Date: Wed May 29 00:20:30 2019 New Revision: 361931 URL: http://llvm.org/viewvc/llvm-project?rev=361931&view=rev Log: [libunwind] [test] Fix inferring source paths Fix two issues that caused libcxx source path not to be inferred correctly when not specified explicitly: 1. get_lit_conf() uses default value only if the lit variable is set to None. Due to the mehod of substituting lit.site.cfg, they were "" rather than None when unset, effectively causing the default never to apply. Instead, use 'or' construct to use the default whenever get_lit_conf() returns a false value. 2. If os.path.join() is given a component starting with '/', it takes it to be an absolute path and ignores everything preceding it. Remove the slash to correctly append subdirectory. With these two fixes, libunwind tests start working on NetBSD buildbot again. Differential Revision: https://reviews.llvm.org/D62005 Modified: libunwind/trunk/test/libunwind/test/config.py Modified: libunwind/trunk/test/libunwind/test/config.py URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/libunwind/test/config.py?rev=361931&r1=361930&r2=361931&view=diff == --- libunwind/trunk/test/libunwind/test/config.py (original) +++ libunwind/trunk/test/libunwind/test/config.py Wed May 29 00:20:30 2019 @@ -21,12 +21,10 @@ class Configuration(LibcxxConfiguration) self.libcxx_src_root = None def configure_src_root(self): -self.libunwind_src_root = self.get_lit_conf( -'libunwind_src_root', -os.path.dirname(self.config.test_source_root)) -self.libcxx_src_root = self.get_lit_conf( -'libcxx_src_root', -os.path.join(self.libunwind_src_root, '/../libcxx')) +self.libunwind_src_root = (self.get_lit_conf('libunwind_src_root') +or os.path.dirname(self.config.test_source_root)) +self.libcxx_src_root = (self.get_lit_conf('libcxx_src_root') +or os.path.join(self.libunwind_src_root, '..', 'libcxx')) def configure_obj_root(self): self.libunwind_obj_root = self.get_lit_conf('libunwind_obj_root') ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349648 - [Basic] Correct description of SanitizerSet.empty()
Author: mgorny Date: Wed Dec 19 09:25:51 2018 New Revision: 349648 URL: http://llvm.org/viewvc/llvm-project?rev=349648&view=rev Log: [Basic] Correct description of SanitizerSet.empty() Differential Revision: https://reviews.llvm.org/D55830 Modified: cfe/trunk/include/clang/Basic/Sanitizers.h Modified: cfe/trunk/include/clang/Basic/Sanitizers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Sanitizers.h?rev=349648&r1=349647&r2=349648&view=diff == --- cfe/trunk/include/clang/Basic/Sanitizers.h (original) +++ cfe/trunk/include/clang/Basic/Sanitizers.h Wed Dec 19 09:25:51 2018 @@ -66,7 +66,7 @@ struct SanitizerSet { /// Disable the sanitizers specified in \p K. void clear(SanitizerMask K = SanitizerKind::All) { Mask &= ~K; } - /// Returns true if at least one sanitizer is enabled. + /// Returns true if no sanitizers are enabled. bool empty() const { return Mask == 0; } /// Bitmask of enabled sanitizers. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349647 - [Driver] Disable -faddrsig by default on NetBSD
Author: mgorny Date: Wed Dec 19 09:25:46 2018 New Revision: 349647 URL: http://llvm.org/viewvc/llvm-project?rev=349647&view=rev Log: [Driver] Disable -faddrsig by default on NetBSD Avoid passing -faddrsig by default on NetBSD. This platform is still using old GNU binutils that crashes on executables containing those sections. Differential Revision: https://reviews.llvm.org/D55828 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=349647&r1=349646&r2=349647&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Dec 19 09:25:46 2018 @@ -5273,7 +5273,8 @@ void Clang::ConstructJob(Compilation &C, if (Args.hasFlag(options::OPT_faddrsig, options::OPT_fno_addrsig, (TC.getTriple().isOSBinFormatELF() || TC.getTriple().isOSBinFormatCOFF()) && - TC.useIntegratedAs())) + TC.useIntegratedAs() && + RawTriple.getOS() != llvm::Triple::NetBSD)) CmdArgs.push_back("-faddrsig"); // Finally add the compile command to the compilation. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349649 - [Driver] Add .hasAnySanitizer() to SanitizerArgs
Author: mgorny Date: Wed Dec 19 09:25:55 2018 New Revision: 349649 URL: http://llvm.org/viewvc/llvm-project?rev=349649&view=rev Log: [Driver] Add .hasAnySanitizer() to SanitizerArgs Add a simple method to query whether any sanitizer was enabled, via SanitizerArgs. This will be used in the NetBSD driver to pass additional definitions that are required by all sanitizers. Differential Revision: https://reviews.llvm.org/D55832 Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/SanitizerArgs.h?rev=349649&r1=349648&r2=349649&view=diff == --- cfe/trunk/include/clang/Driver/SanitizerArgs.h (original) +++ cfe/trunk/include/clang/Driver/SanitizerArgs.h Wed Dec 19 09:25:55 2018 @@ -82,6 +82,7 @@ class SanitizerArgs { bool needsUnwindTables() const; bool linkCXXRuntimes() const { return LinkCXXRuntimes; } bool hasCrossDsoCfi() const { return CfiCrossDso; } + bool hasAnySanitizer() const { return !Sanitizers.empty(); } void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const; }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349650 - [Driver] [NetBSD] Add -D_REENTRANT when using sanitizers
Author: mgorny Date: Wed Dec 19 09:25:59 2018 New Revision: 349650 URL: http://llvm.org/viewvc/llvm-project?rev=349650&view=rev Log: [Driver] [NetBSD] Add -D_REENTRANT when using sanitizers NetBSD intends to support only reentrant interfaces in interceptors. When -lpthread is used without _REENTRANT defined, things are not guaranteed to work. This is especially important for and sanitization of interfaces around FILE. Some APIs have alternative modes depending on the _REENTRANT definition, and NetBSD intends to support sanitization of the _REENTRANT ones. Differential Revision: https://reviews.llvm.org/D55654 Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp cfe/trunk/lib/Driver/ToolChains/NetBSD.h Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=349650&r1=349649&r2=349650&view=diff == --- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Wed Dec 19 09:25:59 2018 @@ -457,3 +457,11 @@ SanitizerMask NetBSD::getSupportedSaniti } return Res; } + +void NetBSD::addClangTargetOptions(const ArgList &, + ArgStringList &CC1Args, + Action::OffloadKind) const { + const SanitizerArgs &SanArgs = getSanitizerArgs(); + if (SanArgs.hasAnySanitizer()) +CC1Args.push_back("-D_REENTRANT"); +} Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.h?rev=349650&r1=349649&r2=349650&view=diff == --- cfe/trunk/lib/Driver/ToolChains/NetBSD.h (original) +++ cfe/trunk/lib/Driver/ToolChains/NetBSD.h Wed Dec 19 09:25:59 2018 @@ -76,6 +76,10 @@ public: SanitizerMask getSupportedSanitizers() const override; + void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args, + Action::OffloadKind DeviceOffloadKind) const override; + protected: Tool *buildAssembler() const override; Tool *buildLinker() const override; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349752 - Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]
Author: mgorny Date: Thu Dec 20 05:09:30 2018 New Revision: 349752 URL: http://llvm.org/viewvc/llvm-project?rev=349752&view=rev Log: Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI] Replace multiple comparisons of getOS() value with FreeBSD, NetBSD, OpenBSD and DragonFly with matching isOS*BSD() methods. This should improve the consistency of coding style without changing the behavior. Direct getOS() comparisons were left whenever used in switch or switch- like context. Differential Revision: https://reviews.llvm.org/D55916 Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp cfe/trunk/lib/Basic/Targets/ARM.cpp cfe/trunk/lib/Basic/Targets/Mips.h cfe/trunk/lib/Basic/Targets/PPC.cpp cfe/trunk/lib/Basic/Targets/PPC.h cfe/trunk/lib/Basic/Targets/Sparc.h cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/lib/Driver/XRayArgs.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=349752&r1=349751&r2=349752&view=diff == --- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original) +++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Thu Dec 20 05:09:30 2018 @@ -37,11 +37,11 @@ const Builtin::Info AArch64TargetInfo::B AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple), ABI("aapcs") { - if (getTriple().getOS() == llvm::Triple::OpenBSD) { + if (getTriple().isOSOpenBSD()) { Int64Type = SignedLongLong; IntMaxType = SignedLongLong; } else { -if (!getTriple().isOSDarwin() && getTriple().getOS() != llvm::Triple::NetBSD) +if (!getTriple().isOSDarwin() && !getTriple().isOSNetBSD()) WCharType = UnsignedInt; Int64Type = SignedLong; Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=349752&r1=349751&r2=349752&view=diff == --- cfe/trunk/lib/Basic/Targets/ARM.cpp (original) +++ cfe/trunk/lib/Basic/Targets/ARM.cpp Thu Dec 20 05:09:30 2018 @@ -28,8 +28,8 @@ void ARMTargetInfo::setABIAAPCS() { DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64; const llvm::Triple &T = getTriple(); - bool IsNetBSD = T.getOS() == llvm::Triple::NetBSD; - bool IsOpenBSD = T.getOS() == llvm::Triple::OpenBSD; + bool IsNetBSD = T.isOSNetBSD(); + bool IsOpenBSD = T.isOSOpenBSD(); if (!T.isOSWindows() && !IsNetBSD && !IsOpenBSD) WCharType = UnsignedInt; @@ -217,8 +217,8 @@ ARMTargetInfo::ARMTargetInfo(const llvm: const TargetOptions &Opts) : TargetInfo(Triple), FPMath(FP_Default), IsAAPCS(true), LDREX(0), HW_FP(0) { - bool IsOpenBSD = Triple.getOS() == llvm::Triple::OpenBSD; - bool IsNetBSD = Triple.getOS() == llvm::Triple::NetBSD; + bool IsOpenBSD = Triple.isOSOpenBSD(); + bool IsNetBSD = Triple.isOSNetBSD(); // FIXME: the isOSBinFormatMachO is a workaround for identifying a Darwin-like // environment where size_t is `unsigned long` rather than `unsigned int` @@ -282,9 +282,9 @@ ARMTargetInfo::ARMTargetInfo(const llvm: setABI("apcs-gnu"); break; default: - if (Triple.getOS() == llvm::Triple::NetBSD) + if (IsNetBSD) setABI("apcs-gnu"); - else if (Triple.getOS() == llvm::Triple::OpenBSD) + else if (IsOpenBSD) setABI("aapcs-linux"); else setABI("aapcs"); Modified: cfe/trunk/lib/Basic/Targets/Mips.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/Mips.h?rev=349752&r1=349751&r2=349752&view=diff == --- cfe/trunk/lib/Basic/Targets/Mips.h (original) +++ cfe/trunk/lib/Basic/Targets/Mips.h Thu Dec 20 05:09:30 2018 @@ -78,8 +78,8 @@ public: CPU = ABI == "o32" ? "mips32r2" : "mips64r2"; -CanUseBSDABICalls = Triple.getOS() == llvm::Triple::FreeBSD || -Triple.getOS() == llvm::Triple::OpenBSD; +CanUseBSDABICalls = Triple.isOSFreeBSD() || +Triple.isOSOpenBSD(); } bool isIEEE754_2008Default() const { @@ -132,7 +132,7 @@ public: void setN32N64ABITypes() { LongDoubleWidth = LongDoubleAlign = 128; LongDoubleFormat = &llvm::APFloat::IEEEquad(); -if (getTriple().getOS() == llvm::Triple::FreeBSD) { +if (getTriple().isOSFreeBSD()) { LongDoubleWidth = LongDoubleAlign = 64; LongDoubleFormat = &llvm::APFloat::IEEEdouble(); } @@ -142,7 +142,7 @@ public: void setN64ABITypes() { setN32N64ABITypes(); -if (getT
r349754 - [Driver] Fix accidentally reversed condition in r349752
Author: mgorny Date: Thu Dec 20 05:27:37 2018 New Revision: 349754 URL: http://llvm.org/viewvc/llvm-project?rev=349754&view=rev Log: [Driver] Fix accidentally reversed condition in r349752 Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=349754&r1=349753&r2=349754&view=diff == --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Thu Dec 20 05:27:37 2018 @@ -603,7 +603,7 @@ void tools::linkSanitizerRuntimeDeps(con if (TC.getTriple().getOS() != llvm::Triple::RTEMS && !TC.getTriple().isAndroid()) { CmdArgs.push_back("-lpthread"); -if (TC.getTriple().isOSOpenBSD()) +if (!TC.getTriple().isOSOpenBSD()) CmdArgs.push_back("-lrt"); } CmdArgs.push_back("-lm"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r350028 - [Driver] Disable -faddrsig on Gentoo by default
Author: mgorny Date: Sun Dec 23 07:07:26 2018 New Revision: 350028 URL: http://llvm.org/viewvc/llvm-project?rev=350028&view=rev Log: [Driver] Disable -faddrsig on Gentoo by default Gentoo supports combining clang toolchain with GNU binutils, and many users actually do that. As -faddrsig is not supported by GNU strip, this results in a lot of warnings. Disable it by default and let users enable it explicitly if they want it; with the intent of reevaluating when the underlying feature becomes standarized. See also: https://bugs.gentoo.org/667854 Differential Revision: https://reviews.llvm.org/D56047 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/addrsig.c cfe/trunk/test/lit.cfg.py Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=350028&r1=350027&r2=350028&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sun Dec 23 07:07:26 2018 @@ -25,6 +25,7 @@ #include "clang/Basic/LangOptions.h" #include "clang/Basic/ObjCRuntime.h" #include "clang/Basic/Version.h" +#include "clang/Driver/Distro.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" #include "clang/Driver/SanitizerArgs.h" @@ -5290,6 +5291,7 @@ void Clang::ConstructJob(Compilation &C, TC.getTriple().isOSBinFormatCOFF()) && !TC.getTriple().isPS4() && !TC.getTriple().isOSNetBSD() && + !Distro(D.getVFS()).IsGentoo() && TC.useIntegratedAs())) CmdArgs.push_back("-faddrsig"); Modified: cfe/trunk/test/Driver/addrsig.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/addrsig.c?rev=350028&r1=350027&r2=350028&view=diff == --- cfe/trunk/test/Driver/addrsig.c (original) +++ cfe/trunk/test/Driver/addrsig.c Sun Dec 23 07:07:26 2018 @@ -1,3 +1,6 @@ +// Gentoo disables -faddrsig by default +// XFAIL: gentoo + // RUN: %clang -### -target x86_64-unknown-linux -c %s 2>&1 | FileCheck -check-prefix=ADDRSIG %s // RUN: %clang -### -target x86_64-pc-win32 -c %s 2>&1 | FileCheck -check-prefix=ADDRSIG %s // RUN: %clang -### -target x86_64-unknown-linux -fno-integrated-as -c %s 2>&1 | FileCheck -check-prefix=NO-ADDRSIG %s Modified: cfe/trunk/test/lit.cfg.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=350028&r1=350027&r2=350028&view=diff == --- cfe/trunk/test/lit.cfg.py (original) +++ cfe/trunk/test/lit.cfg.py Sun Dec 23 07:07:26 2018 @@ -190,3 +190,6 @@ lit.util.usePlatformSdkOnDarwin(config, macOSSDKVersion = lit.util.findPlatformSdkVersionOnMacOS(config, lit_config) if macOSSDKVersion is not None: config.available_features.add('macos-sdk-' + macOSSDKVersion) + +if os.path.exists('/etc/gentoo-release'): +config.available_features.add('gentoo') ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r350027 - [Distro] Support detecting Gentoo
Author: mgorny Date: Sun Dec 23 07:07:19 2018 New Revision: 350027 URL: http://llvm.org/viewvc/llvm-project?rev=350027&view=rev Log: [Distro] Support detecting Gentoo Add support for distinguishing plain Gentoo distribution, and a unit test for it. This is going to be used to introduce distro-specific customizations in the driver code; most notably, it is going to be used to disable -faddrsig. Differential Revision: https://reviews.llvm.org/D56024 Modified: cfe/trunk/include/clang/Driver/Distro.h cfe/trunk/lib/Driver/Distro.cpp cfe/trunk/unittests/Driver/DistroTest.cpp Modified: cfe/trunk/include/clang/Driver/Distro.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Distro.h?rev=350027&r1=350026&r2=350027&view=diff == --- cfe/trunk/include/clang/Driver/Distro.h (original) +++ cfe/trunk/include/clang/Driver/Distro.h Sun Dec 23 07:07:19 2018 @@ -39,6 +39,7 @@ public: RHEL6, RHEL7, Fedora, +Gentoo, OpenSUSE, UbuntuHardy, UbuntuIntrepid, @@ -123,6 +124,10 @@ public: return DistroVal == AlpineLinux; } + bool IsGentoo() const { +return DistroVal == Gentoo; + } + /// @} }; Modified: cfe/trunk/lib/Driver/Distro.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Distro.cpp?rev=350027&r1=350026&r2=350027&view=diff == --- cfe/trunk/lib/Driver/Distro.cpp (original) +++ cfe/trunk/lib/Driver/Distro.cpp Sun Dec 23 07:07:19 2018 @@ -138,6 +138,9 @@ static Distro::DistroType DetectDistro(l if (VFS.exists("/etc/arch-release")) return Distro::ArchLinux; + if (VFS.exists("/etc/gentoo-release")) +return Distro::Gentoo; + return Distro::UnknownDistro; } Modified: cfe/trunk/unittests/Driver/DistroTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/DistroTest.cpp?rev=350027&r1=350026&r2=350027&view=diff == --- cfe/trunk/unittests/Driver/DistroTest.cpp (original) +++ cfe/trunk/unittests/Driver/DistroTest.cpp Sun Dec 23 07:07:19 2018 @@ -51,6 +51,7 @@ TEST(DistroTest, DetectUbuntu) { ASSERT_FALSE(UbuntuTrusty.IsRedhat()); ASSERT_FALSE(UbuntuTrusty.IsOpenSUSE()); ASSERT_FALSE(UbuntuTrusty.IsDebian()); + ASSERT_FALSE(UbuntuTrusty.IsGentoo()); llvm::vfs::InMemoryFileSystem UbuntuYakketyFileSystem; UbuntuYakketyFileSystem.addFile("/etc/debian_version", 0, @@ -80,6 +81,7 @@ TEST(DistroTest, DetectUbuntu) { ASSERT_FALSE(UbuntuYakkety.IsRedhat()); ASSERT_FALSE(UbuntuYakkety.IsOpenSUSE()); ASSERT_FALSE(UbuntuYakkety.IsDebian()); + ASSERT_FALSE(UbuntuYakkety.IsGentoo()); } TEST(DistroTest, DetectRedhat) { @@ -114,6 +116,7 @@ TEST(DistroTest, DetectRedhat) { ASSERT_TRUE(Fedora25.IsRedhat()); ASSERT_FALSE(Fedora25.IsOpenSUSE()); ASSERT_FALSE(Fedora25.IsDebian()); + ASSERT_FALSE(Fedora25.IsGentoo()); llvm::vfs::InMemoryFileSystem CentOS7FileSystem; CentOS7FileSystem.addFile("/etc/system-release-cpe", 0, @@ -150,6 +153,7 @@ TEST(DistroTest, DetectRedhat) { ASSERT_TRUE(CentOS7.IsRedhat()); ASSERT_FALSE(CentOS7.IsOpenSUSE()); ASSERT_FALSE(CentOS7.IsDebian()); + ASSERT_FALSE(CentOS7.IsGentoo()); } TEST(DistroTest, DetectOpenSUSE) { @@ -177,6 +181,7 @@ TEST(DistroTest, DetectOpenSUSE) { ASSERT_FALSE(OpenSUSELeap421.IsRedhat()); ASSERT_TRUE(OpenSUSELeap421.IsOpenSUSE()); ASSERT_FALSE(OpenSUSELeap421.IsDebian()); + ASSERT_FALSE(OpenSUSELeap421.IsGentoo()); llvm::vfs::InMemoryFileSystem OpenSUSE132FileSystem; OpenSUSE132FileSystem.addFile("/etc/SuSE-release", 0, @@ -202,6 +207,7 @@ TEST(DistroTest, DetectOpenSUSE) { ASSERT_FALSE(OpenSUSE132.IsRedhat()); ASSERT_TRUE(OpenSUSE132.IsOpenSUSE()); ASSERT_FALSE(OpenSUSE132.IsDebian()); + ASSERT_FALSE(OpenSUSE132.IsGentoo()); llvm::vfs::InMemoryFileSystem SLES10FileSystem; SLES10FileSystem.addFile("/etc/SuSE-release", 0, @@ -218,6 +224,7 @@ TEST(DistroTest, DetectOpenSUSE) { ASSERT_FALSE(SLES10.IsRedhat()); ASSERT_FALSE(SLES10.IsOpenSUSE()); ASSERT_FALSE(SLES10.IsDebian()); + ASSERT_FALSE(SLES10.IsGentoo()); } TEST(DistroTest, DetectDebian) { @@ -240,6 +247,7 @@ TEST(DistroTest, DetectDebian) { ASSERT_FALSE(DebianJessie.IsRedhat()); ASSERT_FALSE(DebianJessie.IsOpenSUSE()); ASSERT_TRUE(DebianJessie.IsDebian()); + ASSERT_FALSE(DebianJessie.IsGentoo()); llvm::vfs::InMemoryFileSystem DebianStretchSidFileSystem; DebianStretchSidFileSystem.addFile("/etc/debian_version", 0, @@ -258,6 +266,7 @@ TEST(DistroTest, DetectDebian) { ASSERT_FALSE(DebianStretchSid.IsRedhat()); ASSERT_FALSE(DebianStretchSid.IsOpenSUSE()); ASSERT_TRUE(DebianStretchSid.IsDebian()); + ASSERT_FALSE(DebianStretchSid.IsGentoo()); } TEST(DistroTest, DetectExherbo) { @@ -279,6 +288,7 @@ TEST(DistroTest, DetectExherbo) {
[clang-tools-extra] r350329 - [clangd] Fix detecting atomics in stand-alone builds
Author: mgorny Date: Thu Jan 3 08:43:27 2019 New Revision: 350329 URL: http://llvm.org/viewvc/llvm-project?rev=350329&view=rev Log: [clangd] Fix detecting atomics in stand-alone builds Include CheckAtomic CMake module from LLVM in order to detect support for atomics when building stand-alone. Otherwise, the HAVE_CXX_ATOMICS64_WITHOUT_LIB variable is undefined and clangd wrongly attempts to link -latomic on systems not using the library. Original bug report: https://bugs.gentoo.org/667016 Differential Revision: https://reviews.llvm.org/D56061 Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=350329&r1=350328&r2=350329&view=diff == --- clang-tools-extra/trunk/clangd/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clangd/CMakeLists.txt Thu Jan 3 08:43:27 2019 @@ -2,6 +2,11 @@ set(LLVM_LINK_COMPONENTS Support ) +if(CLANG_BUILT_STANDALONE) + # needed to get HAVE_CXX_ATOMICS64_WITHOUT_LIB defined + include(CheckAtomic) +endif() + set(CLANGD_ATOMIC_LIB "") if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB) list(APPEND CLANGD_ATOMIC_LIB "atomic") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r371733 - [clang] [unittest] Import LLVMTestingSupport if necessary
Author: mgorny Date: Thu Sep 12 06:06:12 2019 New Revision: 371733 URL: http://llvm.org/viewvc/llvm-project?rev=371733&view=rev Log: [clang] [unittest] Import LLVMTestingSupport if necessary Add LLVMTestingSupport directory from LLVM_MAIN_SRC_DIR when building clang stand-alone and LLVMTestingSupport library is not present. This is needed to fix stand-alone builds without clang-tools-extra. Differential Revision: https://reviews.llvm.org/D67452 Modified: cfe/trunk/unittests/CMakeLists.txt Modified: cfe/trunk/unittests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/CMakeLists.txt?rev=371733&r1=371732&r2=371733&view=diff == --- cfe/trunk/unittests/CMakeLists.txt (original) +++ cfe/trunk/unittests/CMakeLists.txt Thu Sep 12 06:06:12 2019 @@ -1,6 +1,15 @@ add_custom_target(ClangUnitTests) set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests") +if(CLANG_BUILT_STANDALONE) + # LLVMTestingSupport library is needed for some of the unittests. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + AND NOT TARGET LLVMTestingSupport) +add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + lib/Testing/Support) + endif() +endif() + # add_clang_unittest(test_dirname file1.cpp file2.cpp) # # Will compile the list of files together and link against the clang ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r372527 - [clang] [Basic] Enable __has_feature(leak_sanitizer)
Author: mgorny Date: Sun Sep 22 13:55:01 2019 New Revision: 372527 URL: http://llvm.org/viewvc/llvm-project?rev=372527&view=rev Log: [clang] [Basic] Enable __has_feature(leak_sanitizer) Add a 'leak_sanitizer' feature akin to existing '*_sanitizer' features to let programmers switch code paths accounting for leak sanitizers being enabled. Differential Revision: https://reviews.llvm.org/D67719 Added: cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp Modified: cfe/trunk/include/clang/Basic/Features.def Modified: cfe/trunk/include/clang/Basic/Features.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=372527&r1=372526&r2=372527&view=diff == --- cfe/trunk/include/clang/Basic/Features.def (original) +++ cfe/trunk/include/clang/Basic/Features.def Sun Sep 22 13:55:01 2019 @@ -39,6 +39,8 @@ FEATURE(address_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Address | SanitizerKind::KernelAddress)) +FEATURE(leak_sanitizer, +LangOpts.Sanitize.has(SanitizerKind::Leak)) FEATURE(hwaddress_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress | SanitizerKind::KernelHWAddress)) Added: cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp?rev=372527&view=auto == --- cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp (added) +++ cfe/trunk/test/Lexer/has_feature_leak_sanitizer.cpp Sun Sep 22 13:55:01 2019 @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -E -fsanitize=leak %s -o - | FileCheck --check-prefix=CHECK-LSAN %s +// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-LSAN %s + +#if __has_feature(leak_sanitizer) +int LeakSanitizerEnabled(); +#else +int LeakSanitizerDisabled(); +#endif + +// CHECK-LSAN: LeakSanitizerEnabled +// CHECK-NO-LSAN: LeakSanitizerDisabled ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r373694 - [clang-tools-extra] [cmake] Use add_clang_tool() to install tools
Author: mgorny Date: Thu Oct 3 22:40:29 2019 New Revision: 373694 URL: http://llvm.org/viewvc/llvm-project?rev=373694&view=rev Log: [clang-tools-extra] [cmake] Use add_clang_tool() to install tools Replace add_clang_executable() calls with add_clang_tool() that takes care of creating correct, distribution-friendly install target. While at it, remove redundant install calls. This change also causes clang-move and pp-trace to be installed. Differential Revision: https://reviews.llvm.org/D68423 Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt clang-tools-extra/trunk/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt clang-tools-extra/trunk/clang-include-fixer/tool/CMakeLists.txt clang-tools-extra/trunk/clang-move/tool/CMakeLists.txt clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt clang-tools-extra/trunk/pp-trace/CMakeLists.txt Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt?rev=373694&r1=373693&r2=373694&view=diff == --- clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt Thu Oct 3 22:40:29 2019 @@ -14,6 +14,3 @@ target_link_libraries(clang-apply-replac clangToolingCore clangToolingRefactoring ) - -install(TARGETS clang-apply-replacements - RUNTIME DESTINATION bin) Modified: clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt?rev=373694&r1=373693&r2=373694&view=diff == --- clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt Thu Oct 3 22:40:29 2019 @@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS Support ) -add_clang_executable(clang-change-namespace +add_clang_tool(clang-change-namespace ClangChangeNamespace.cpp ) target_link_libraries(clang-change-namespace @@ -20,6 +20,3 @@ target_link_libraries(clang-change-names clangTooling clangToolingCore ) - -install(TARGETS clang-change-namespace - RUNTIME DESTINATION bin) Modified: clang-tools-extra/trunk/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt?rev=373694&r1=373693&r2=373694&view=diff == --- clang-tools-extra/trunk/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt Thu Oct 3 22:40:29 2019 @@ -1,6 +1,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) -add_clang_executable(find-all-symbols +add_clang_tool(find-all-symbols FindAllSymbolsMain.cpp ) @@ -16,9 +16,6 @@ target_link_libraries(find-all-symbols findAllSymbols ) -install(TARGETS find-all-symbols - RUNTIME DESTINATION bin) - install(PROGRAMS run-find-all-symbols.py DESTINATION share/clang COMPONENT find-all-symbols) Modified: clang-tools-extra/trunk/clang-include-fixer/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-include-fixer/tool/CMakeLists.txt?rev=373694&r1=373693&r2=373694&view=diff == --- clang-tools-extra/trunk/clang-include-fixer/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-include-fixer/tool/CMakeLists.txt Thu Oct 3 22:40:29 2019 @@ -17,9 +17,6 @@ target_link_libraries(clang-include-fixe findAllSymbols ) -install(TARGETS clang-include-fixer - RUNTIME DESTINATION bin) - install(PROGRAMS clang-include-fixer.el DESTINATION share/clang COMPONENT clang-include-fixer) Modified: clang-tools-extra/trunk/clang-move/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/tool/CMakeLists.txt?rev=373694&r1=373693&r2=373694&view=diff == --- clang-tools-extra/trunk/clang-move/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-move/tool/CMakeLists.txt Thu Oct 3 22:40:29 2019 @@ -1,6 +1,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) -add_clang_executable(clang-move +add_clang_tool(clang-move ClangMove.cpp ) Modified: clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt?rev=37
r373695 - [clang] [cmake] Add distribution install targets for remaining components
Author: mgorny Date: Thu Oct 3 22:43:20 2019 New Revision: 373695 URL: http://llvm.org/viewvc/llvm-project?rev=373695&view=rev Log: [clang] [cmake] Add distribution install targets for remaining components Add install targets as necessary to install bash-autocomplete, scan-build and scan-view via LLVM_DISTRIBUTION_TARGETS. Differential Revision: https://reviews.llvm.org/D68413 Modified: cfe/trunk/CMakeLists.txt cfe/trunk/tools/scan-build/CMakeLists.txt cfe/trunk/tools/scan-view/CMakeLists.txt cfe/trunk/utils/hmaptool/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=373695&r1=373694&r2=373695&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Thu Oct 3 22:43:20 2019 @@ -441,9 +441,15 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) COMPONENT clang-headers) endif() + add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh) install(PROGRAMS utils/bash-autocomplete.sh -DESTINATION share/clang -) + DESTINATION share/clang + COMPONENT bash-autocomplete) + if(NOT LLVM_ENABLE_IDE) +add_llvm_install_targets(install-bash-autocomplete + DEPENDS bash-autocomplete + COMPONENT bash-autocomplete) + endif() endif() add_definitions( -D_GNU_SOURCE ) Modified: cfe/trunk/tools/scan-build/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/CMakeLists.txt?rev=373695&r1=373694&r2=373695&view=diff == --- cfe/trunk/tools/scan-build/CMakeLists.txt (original) +++ cfe/trunk/tools/scan-build/CMakeLists.txt Thu Oct 3 22:43:20 2019 @@ -41,7 +41,9 @@ if(CLANG_INSTALL_SCANBUILD) ${CMAKE_BINARY_DIR}/bin/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) -install(PROGRAMS bin/${BinFile} DESTINATION bin) +install(PROGRAMS bin/${BinFile} +DESTINATION bin +COMPONENT scan-build) endforeach() foreach(LibexecFile ${LibexecFiles}) @@ -53,7 +55,9 @@ if(CLANG_INSTALL_SCANBUILD) ${CMAKE_BINARY_DIR}/libexec/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile}) -install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec) +install(PROGRAMS libexec/${LibexecFile} +DESTINATION libexec +COMPONENT scan-build) endforeach() foreach(ManPage ${ManPages}) @@ -65,7 +69,9 @@ if(CLANG_INSTALL_SCANBUILD) ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}) list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_MANDIR}/man1/${ManPage}) -install(PROGRAMS man/${ManPage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +install(PROGRAMS man/${ManPage} +DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 +COMPONENT scan-build) endforeach() foreach(ShareFile ${ShareFiles}) @@ -77,9 +83,17 @@ if(CLANG_INSTALL_SCANBUILD) ${CMAKE_BINARY_DIR}/share/scan-build/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}) -install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build) +install(FILES share/scan-build/${ShareFile} +DESTINATION share/scan-build +COMPONENT scan-build) endforeach() add_custom_target(scan-build ALL DEPENDS ${Depends}) set_target_properties(scan-build PROPERTIES FOLDER "Misc") + + if(NOT LLVM_ENABLE_IDE) +add_llvm_install_targets("install-scan-build" + DEPENDS scan-build + COMPONENT scan-build) + endif() endif() Modified: cfe/trunk/tools/scan-view/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/CMakeLists.txt?rev=373695&r1=373694&r2=373695&view=diff == --- cfe/trunk/tools/scan-view/CMakeLists.txt (original) +++ cfe/trunk/tools/scan-view/CMakeLists.txt Thu Oct 3 22:43:20 2019 @@ -21,7 +21,9 @@ if(CLANG_INSTALL_SCANVIEW) ${CMAKE_BINARY_DIR}/bin/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) -install(PROGRAMS bin/${BinFile} DESTINATION bin) +install(PROGRAMS bin/${BinFile} +DESTINATION bin +COMPONENT scan-view) endforeach() foreach(ShareFile ${ShareFiles}) @@ -33,
r373785 - [clang] [cmake] Use add_clang_tool() to install all tools
Author: mgorny Date: Fri Oct 4 13:28:59 2019 New Revision: 373785 URL: http://llvm.org/viewvc/llvm-project?rev=373785&view=rev Log: [clang] [cmake] Use add_clang_tool() to install all tools Switch clang-check, clang-extdef-mapping and clang-offload-bundler to use add_clang_tool() rather than add_clang_executable() with a custom install rule. This makes them LLVM_DISTRIBUTION_COMPONENTS-friendly. Differential Revision: https://reviews.llvm.org/D68429 Modified: cfe/trunk/tools/clang-check/CMakeLists.txt cfe/trunk/tools/clang-extdef-mapping/CMakeLists.txt cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt Modified: cfe/trunk/tools/clang-check/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/CMakeLists.txt?rev=373785&r1=373784&r2=373785&view=diff == --- cfe/trunk/tools/clang-check/CMakeLists.txt (original) +++ cfe/trunk/tools/clang-check/CMakeLists.txt Fri Oct 4 13:28:59 2019 @@ -4,7 +4,7 @@ set( LLVM_LINK_COMPONENTS Support ) -add_clang_executable(clang-check +add_clang_tool(clang-check ClangCheck.cpp ) @@ -19,6 +19,3 @@ clang_target_link_libraries(clang-check clangStaticAnalyzerFrontend clangTooling ) - -install(TARGETS clang-check - RUNTIME DESTINATION bin) Modified: cfe/trunk/tools/clang-extdef-mapping/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-extdef-mapping/CMakeLists.txt?rev=373785&r1=373784&r2=373785&view=diff == --- cfe/trunk/tools/clang-extdef-mapping/CMakeLists.txt (original) +++ cfe/trunk/tools/clang-extdef-mapping/CMakeLists.txt Fri Oct 4 13:28:59 2019 @@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS support ) -add_clang_executable(clang-extdef-mapping +add_clang_tool(clang-extdef-mapping ClangExtDefMapGen.cpp ) @@ -16,6 +16,3 @@ clang_target_link_libraries(clang-extdef clangSerialization clangTooling ) - -install(TARGETS clang-extdef-mapping - RUNTIME DESTINATION bin) Modified: cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt?rev=373785&r1=373784&r2=373785&view=diff == --- cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt (original) +++ cfe/trunk/tools/clang-offload-bundler/CMakeLists.txt Fri Oct 4 13:28:59 2019 @@ -4,7 +4,7 @@ if(NOT CLANG_BUILT_STANDALONE) set(tablegen_deps intrinsics_gen) endif() -add_clang_executable(clang-offload-bundler +add_clang_tool(clang-offload-bundler ClangOffloadBundler.cpp DEPENDS @@ -21,5 +21,3 @@ clang_target_link_libraries(clang-offloa PRIVATE ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS} ) - -install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r373786 - [clang-tools-extra] [cmake] Link against libclang-cpp whenever possible
Author: mgorny Date: Fri Oct 4 13:30:02 2019 New Revision: 373786 URL: http://llvm.org/viewvc/llvm-project?rev=373786&view=rev Log: [clang-tools-extra] [cmake] Link against libclang-cpp whenever possible Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt clang-tools-extra/trunk/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt clang-tools-extra/trunk/clang-include-fixer/tool/CMakeLists.txt clang-tools-extra/trunk/clang-move/tool/CMakeLists.txt clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt clang-tools-extra/trunk/clang-reorder-fields/tool/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt clang-tools-extra/trunk/clangd/fuzzer/CMakeLists.txt clang-tools-extra/trunk/clangd/index/dex/dexp/CMakeLists.txt clang-tools-extra/trunk/clangd/indexer/CMakeLists.txt clang-tools-extra/trunk/clangd/tool/CMakeLists.txt clang-tools-extra/trunk/clangd/unittests/CMakeLists.txt clang-tools-extra/trunk/clangd/xpc/test-client/CMakeLists.txt clang-tools-extra/trunk/modularize/CMakeLists.txt clang-tools-extra/trunk/pp-trace/CMakeLists.txt clang-tools-extra/trunk/tool-template/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-apply-replacements/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-change-namespace/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-doc/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-include-fixer/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-include-fixer/find-all-symbols/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-move/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-query/CMakeLists.txt clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt Modified: clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt?rev=373786&r1=373785&r2=373786&view=diff == --- clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-apply-replacements/tool/CMakeLists.txt Fri Oct 4 13:30:02 2019 @@ -5,12 +5,15 @@ set(LLVM_LINK_COMPONENTS add_clang_tool(clang-apply-replacements ClangApplyReplacementsMain.cpp ) -target_link_libraries(clang-apply-replacements +clang_target_link_libraries(clang-apply-replacements PRIVATE - clangApplyReplacements clangBasic clangFormat clangRewrite clangToolingCore clangToolingRefactoring ) +target_link_libraries(clang-apply-replacements + PRIVATE + clangApplyReplacements + ) Modified: clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt?rev=373786&r1=373785&r2=373786&view=diff == --- clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-change-namespace/tool/CMakeLists.txt Fri Oct 4 13:30:02 2019 @@ -7,12 +7,11 @@ set(LLVM_LINK_COMPONENTS add_clang_tool(clang-change-namespace ClangChangeNamespace.cpp ) -target_link_libraries(clang-change-namespace +clang_target_link_libraries(clang-change-namespace PRIVATE clangAST clangASTMatchers clangBasic - clangChangeNamespace clangFormat clangFrontend clangRewrite @@ -20,3 +19,7 @@ target_link_libraries(clang-change-names clangTooling clangToolingCore ) +target_link_libraries(clang-change-namespace + PRIVATE + clangChangeNamespace + ) Modified: clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt?rev=373786&r1=373785&r2=373786&view=diff == --- clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-doc/tool/CMakeLists.txt Fri Oct 4 13:30:02 2019 @@ -4,16 +4,19 @@ add_clang_tool(clang-doc ClangDocMain.cpp ) -target_link_libraries(clang-doc +clang_target_link_libraries(clang-doc PRIVATE clangAST clangASTMatchers clangBasic clangFrontend - clangDoc clangTooling clangToolingCore ) +target_link_libraries(clang-doc + PRIVATE + clangDoc + ) install(FILES ../assets/clang-doc-default-stylesheet.css DESTINATION share/clang Modified: clang-tools-extra/trunk/clang-includ
r373936 - [clang] [cmake] Support LLVM_DISTRIBUTION_COMPONENTS in stand-alone build
Author: mgorny Date: Mon Oct 7 11:14:56 2019 New Revision: 373936 URL: http://llvm.org/viewvc/llvm-project?rev=373936&view=rev Log: [clang] [cmake] Support LLVM_DISTRIBUTION_COMPONENTS in stand-alone build Differential Revision: https://reviews.llvm.org/D68412 Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=373936&r1=373935&r2=373936&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Mon Oct 7 11:14:56 2019 @@ -114,6 +114,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR include(TableGen) include(HandleLLVMOptions) include(VersionFromVCS) + include(LLVMDistributionSupport) set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") @@ -858,6 +859,10 @@ if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUT endif() add_subdirectory(utils/hmaptool) +if(CLANG_BUILT_STANDALONE) + llvm_distribution_add_targets() +endif() + configure_file( ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake ${CLANG_BINARY_DIR}/include/clang/Config/config.h) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r374754 - [clang] [clang-offload-bundler] Fix finding installed llvm-objcopy
Author: mgorny Date: Sun Oct 13 22:33:23 2019 New Revision: 374754 URL: http://llvm.org/viewvc/llvm-project?rev=374754&view=rev Log: [clang] [clang-offload-bundler] Fix finding installed llvm-objcopy Allow finding installed llvm-objcopy in PATH if it's not present in the directory containing clang-offload-bundler. This is the case if clang is being built stand-alone, and llvm-objcopy is already installed while the c-o-b tool is still present in build directory. This is consistent with how e.g. llvm-symbolizer is found in LLVM. However, most of similar searches in LLVM and Clang are performed without special-casing the program directory. Fixes r369955. Differential Revision: https://reviews.llvm.org/D68931 Modified: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp Modified: cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp?rev=374754&r1=374753&r2=374754&view=diff == --- cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp (original) +++ cfe/trunk/tools/clang-offload-bundler/ClangOffloadBundler.cpp Sun Oct 13 22:33:23 2019 @@ -468,6 +468,8 @@ public: // Find llvm-objcopy in order to create the bundle binary. ErrorOr Objcopy = sys::findProgramByName( "llvm-objcopy", sys::path::parent_path(BundlerExecutable)); +if (!Objcopy) + Objcopy = sys::findProgramByName("llvm-objcopy"); if (!Objcopy) { errs() << "error: unable to find 'llvm-objcopy' in path.\n"; return true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r374885 - [clang-tools-extra] Fix overzealous linking of dylib to clangTidy
Author: mgorny Date: Tue Oct 15 06:05:38 2019 New Revision: 374885 URL: http://llvm.org/viewvc/llvm-project?rev=374885&view=rev Log: [clang-tools-extra] Fix overzealous linking of dylib to clangTidy Fix accidentally making clangTidy library link to dylib. This causes libclang.so to also link to dylib which results in duplicate symbols from shared and static libraries, and effectively to registering command-line options twice. Thanks to Sylvestre Ledru for noticing this and tracking it down to r373786. Fixes PR#43589. Differential Revision: https://reviews.llvm.org/D68927 Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=374885&r1=374884&r2=374885&view=diff == --- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Tue Oct 15 06:05:38 2019 @@ -31,7 +31,7 @@ add_clang_library(clangTidy ) if(CLANG_ENABLE_STATIC_ANALYZER) - clang_target_link_libraries(clangTidy PRIVATE + target_link_libraries(clangTidy PRIVATE clangStaticAnalyzerCore clangStaticAnalyzerFrontend ) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r282435 - [include] Declare __STDC_*_MACROS for C++11 compat in old libc
Author: mgorny Date: Mon Sep 26 15:20:00 2016 New Revision: 282435 URL: http://llvm.org/viewvc/llvm-project?rev=282435&view=rev Log: [include] Declare __STDC_*_MACROS for C++11 compat in old libc Declare __STDC_FORMAT_MACROS, __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS before including real inttypes.h/stdint.h when the wrapper-header is included in C++11, in order to enable the necessary macros in C99-compliant libc. The C99 standard defined that the format macros in inttypes.h should be defined by the C++ implementations only when __STDC_FORMAT_MACROS is defined, and the limit and constant macros in stdint.h should be defined only when __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined appropriately. Following this specification, multiple old versions of glibc up to 2.17 do not define those macros by default for C++, rendering the libc++ headers non-compliant to the C++11 standard. In order to achieve the necessary compliance, __STDC_FORMAT_MACROS is defined in wrapped inttypes.h just before including the system inttypes.h, when C++11 or newer is used. Both __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are defined in newly-wrapped stdint.h. This fixes the C++11 compliance while preserving the current behavior for C++03. Differential Revision: https://reviews.llvm.org/D24903 Added: libcxx/trunk/include/stdint.h Modified: libcxx/trunk/include/inttypes.h Modified: libcxx/trunk/include/inttypes.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/inttypes.h?rev=282435&r1=282434&r2=282435&view=diff == --- libcxx/trunk/include/inttypes.h (original) +++ libcxx/trunk/include/inttypes.h Mon Sep 26 15:20:00 2016 @@ -237,6 +237,13 @@ uintmax_t wcstoumax(const wchar_t* restr #pragma GCC system_header #endif +/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed + for C++11 unless __STDC_FORMAT_MACROS is defined +*/ +#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) +# define __STDC_FORMAT_MACROS +#endif + #include_next #ifdef __cplusplus Added: libcxx/trunk/include/stdint.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stdint.h?rev=282435&view=auto == --- libcxx/trunk/include/stdint.h (added) +++ libcxx/trunk/include/stdint.h Mon Sep 26 15:20:00 2016 @@ -0,0 +1,121 @@ +// -*- C++ -*- +//=== stdint.h ===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef _LIBCPP_STDINT_H +#define _LIBCPP_STDINT_H + +/* +stdint.h synopsis + +Macros: + +INT8_MIN +INT16_MIN +INT32_MIN +INT64_MIN + +INT8_MAX +INT16_MAX +INT32_MAX +INT64_MAX + +UINT8_MAX +UINT16_MAX +UINT32_MAX +UINT64_MAX + +INT_LEAST8_MIN +INT_LEAST16_MIN +INT_LEAST32_MIN +INT_LEAST64_MIN + +INT_LEAST8_MAX +INT_LEAST16_MAX +INT_LEAST32_MAX +INT_LEAST64_MAX + +UINT_LEAST8_MAX +UINT_LEAST16_MAX +UINT_LEAST32_MAX +UINT_LEAST64_MAX + +INT_FAST8_MIN +INT_FAST16_MIN +INT_FAST32_MIN +INT_FAST64_MIN + +INT_FAST8_MAX +INT_FAST16_MAX +INT_FAST32_MAX +INT_FAST64_MAX + +UINT_FAST8_MAX +UINT_FAST16_MAX +UINT_FAST32_MAX +UINT_FAST64_MAX + +INTPTR_MIN +INTPTR_MAX +UINTPTR_MAX + +INTMAX_MIN +INTMAX_MAX + +UINTMAX_MAX + +PTRDIFF_MIN +PTRDIFF_MAX + +SIG_ATOMIC_MIN +SIG_ATOMIC_MAX + +SIZE_MAX + +WCHAR_MIN +WCHAR_MAX + +WINT_MIN +WINT_MAX + +INT8_C(value) +INT16_C(value) +INT32_C(value) +INT64_C(value) + +UINT8_C(value) +UINT16_C(value) +UINT32_C(value) +UINT64_C(value) + +INTMAX_C(value) +UINTMAX_C(value) + +*/ + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +/* C99 stdlib (e.g. glibc < 2.18) does not provide macros needed + for C++11 unless __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS + are defined +*/ +#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS) +# define __STDC_LIMIT_MACROS +#endif +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) +# define __STDC_CONSTANT_MACROS +#endif + +#include_next + +#endif // _LIBCPP_STDINT_H ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r282475 - [cmake] Strip possibly-inherited compiler flags in in-tree build only
Author: mgorny Date: Tue Sep 27 02:55:26 2016 New Revision: 282475 URL: http://llvm.org/viewvc/llvm-project?rev=282475&view=rev Log: [cmake] Strip possibly-inherited compiler flags in in-tree build only Strip the set of flags (including debug defs, -m32) that could be inherited from top-level LLVM build only when in-tree build is performed. This prevents libcxx from confusingly and undesiredly stripping user-supplied flags e.g. when performing packaging system controlled multi-ABI build. Otherwise, in order to perform 32-bit builds the build scripts would have to use LIBCXX_BUILD_32_BITS. However, -m32 is only one of the many different ABI flags for different targets, and it really makes no sense to add separate CMake options for each possible -m* flag and then keep a mapping from well-known flags to the custom CMake options. Differential Revision: https://reviews.llvm.org/D24809 Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=282475&r1=282474&r2=282475&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Tue Sep 27 02:55:26 2016 @@ -307,9 +307,12 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" upp include(HandleLibCXXABI) # Setup the ABI library flags -# Remove flags that may have snuck in. -remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG - -stdlib=libc++ -stdlib=libstdc++ -lc++abi -m32) +if (NOT LIBCXX_STANDALONE_BUILD) + # Remove flags that may have snuck in. + remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG + -lc++abi -m32) +endif() +remove_flags(-stdlib=libc++ -stdlib=libstdc++) # FIXME(EricWF): See the FIXME on LIBCXX_ENABLE_PEDANTIC. # Remove the -pedantic flag and -Wno-pedantic and -pedantic-errors ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r282483 - [cmake] Add linker option "-Wl, -z, defs" in standalone build
Author: mgorny Date: Tue Sep 27 07:15:35 2016 New Revision: 282483 URL: http://llvm.org/viewvc/llvm-project?rev=282483&view=rev Log: [cmake] Add linker option "-Wl,-z,defs" in standalone build Add the "-Wl,-z,defs" linker option that is used to prevent underlinking. It is already used by LLVM itself but does not get propagated into stand-alone build of libc++. This patch ensures that the option is passed in independently of whether libc++ is built in-tree or out-of-tree. Patch by Lei Zhang. Differential Revision: https://reviews.llvm.org/D24119 Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=282483&r1=282482&r2=282483&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Tue Sep 27 07:15:35 2016 @@ -319,6 +319,18 @@ remove_flags(-stdlib=libc++ -stdlib=libs # so they don't get transformed into -Wno and -errors respectivly. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) +# FIXME: this is cribbed from HandleLLVMOptions.cmake. +if(LIBCXX_STANDALONE_BUILD) + # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO + # build might work on ELF but fail on MachO/COFF. + if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR + ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND + NOT LLVM_USE_SANITIZER) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") + endif() +endif() + # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r282524 - Revert r282483 - [cmake] Add linker option "-Wl, -z, defs" in standalone build
Author: mgorny Date: Tue Sep 27 13:54:02 2016 New Revision: 282524 URL: http://llvm.org/viewvc/llvm-project?rev=282524&view=rev Log: Revert r282483 - [cmake] Add linker option "-Wl,-z,defs" in standalone build Revert r282483 as it causes build failures due to missing symbols when not linking to -lgcc_s (i.e. doing pure LLVM stack build). The patch can be reintroduced when the build system is fixed to add all needed libraries (libunwind, compiler-rt). Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=282524&r1=282523&r2=282524&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Tue Sep 27 13:54:02 2016 @@ -319,18 +319,6 @@ remove_flags(-stdlib=libc++ -stdlib=libs # so they don't get transformed into -Wno and -errors respectivly. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) -# FIXME: this is cribbed from HandleLLVMOptions.cmake. -if(LIBCXX_STANDALONE_BUILD) - # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO - # build might work on ELF but fail on MachO/COFF. - if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR - ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR - ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND - NOT LLVM_USE_SANITIZER) -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") - endif() -endif() - # Required flags == set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r283075 - [cmake] Install 'clang-cpp' symlink
Author: mgorny Date: Sun Oct 2 14:28:57 2016 New Revision: 283075 URL: http://llvm.org/viewvc/llvm-project?rev=283075&view=rev Log: [cmake] Install 'clang-cpp' symlink Install the 'clang-cpp' symlink used to spawn the preprocessor. The code handling this suffix is already included in Driver. FreeBSD is already creating such a symlink in ports, and a similar one was requested by Gentoo/FreeBSD team. The goal is to handle software that takes a C preprocessor via a variable but does not handle passing options correctly (i.e. 'clang -E' does not work). Bug: https://bugs.gentoo.org/478810 Differential Revision: https://reviews.llvm.org/D25161 Modified: cfe/trunk/tools/driver/CMakeLists.txt Modified: cfe/trunk/tools/driver/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=283075&r1=283074&r2=283075&view=diff == --- cfe/trunk/tools/driver/CMakeLists.txt (original) +++ cfe/trunk/tools/driver/CMakeLists.txt Sun Oct 2 14:28:57 2016 @@ -52,7 +52,7 @@ endif() add_dependencies(clang clang-headers) if(NOT CLANG_LINKS_TO_CREATE) - set(CLANG_LINKS_TO_CREATE clang++ clang-cl) + set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp) if (WIN32) list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Author: mgorny Date: Fri Oct 7 12:08:06 2016 New Revision: 283572 URL: http://llvm.org/viewvc/llvm-project?rev=283572&view=rev Log: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used Make the -print-libgcc-file-name option print an appropriate compiler runtime library, that is libgcc.a if gcc runtime is used and an appropriate compiler-rt library if that runtime is used. The main use for this is to allow linking executables built with -nodefaultlibs (e.g. to avoid linking to the standard C++ library) to the compiler runtime library, e.g. using: clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name) in which case currently a program built like this linked to the gcc runtime unconditionally. The patch fixes it to use compiler-rt libraries instead when compiler-rt is the active runtime. Differential Revision: https://reviews.llvm.org/D25338 Added: cfe/trunk/test/Driver/print-libgcc-file-name.c Modified: cfe/trunk/docs/CommandGuide/clang.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Driver.cpp Modified: cfe/trunk/docs/CommandGuide/clang.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283572&r1=283571&r2=283572&view=diff == --- cfe/trunk/docs/CommandGuide/clang.rst (original) +++ cfe/trunk/docs/CommandGuide/clang.rst Fri Oct 7 12:08:06 2016 @@ -394,7 +394,8 @@ Driver Options .. option:: -print-libgcc-file-name - Print the library path for "libgcc.a". + Print the library path for the currently used compiler runtime library + ("libgcc.a" or "libclang_rt.builtins.*.a"). .. option:: -print-prog-name= Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283572&r1=283571&r2=283572&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Oct 7 12:08:06 2016 @@ -1861,7 +1861,8 @@ def print_file_name_EQ : Joined<["-", "- def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>, HelpText<"Enable Objective-C Ivar layout bitmap print trace">; def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">, - HelpText<"Print the library path for \"libgcc.a\"">; + HelpText<"Print the library path for the currently used compiler runtime " + "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">; def print_multi_directory : Flag<["-", "--"], "print-multi-directory">; def print_multi_lib : Flag<["-", "--"], "print-multi-lib">; def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">, Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283572&r1=283571&r2=283572&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 7 12:08:06 2016 @@ -994,7 +994,15 @@ bool Driver::HandleImmediateArgs(const C } if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) { -llvm::outs() << GetFilePath("libgcc.a", TC) << "\n"; +ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs()); +switch (RLT) { +case ToolChain::RLT_CompilerRT: + llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << "\n"; + break; +case ToolChain::RLT_Libgcc: + llvm::outs() << GetFilePath("libgcc.a", TC) << "\n"; + break; +} return false; } Added: cfe/trunk/test/Driver/print-libgcc-file-name.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name.c?rev=283572&view=auto == --- cfe/trunk/test/Driver/print-libgcc-file-name.c (added) +++ cfe/trunk/test/Driver/print-libgcc-file-name.c Fri Oct 7 12:08:06 2016 @@ -0,0 +1,15 @@ +// Test that -print-libgcc-file-name correctly respects -rtlib=. + +// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-LIBGCC %s +// CHECK-LIBGCC: libgcc.a + +// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ +// RUN: --target=x86_64-pc-linux \ +// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s +// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a + +// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ +// RUN: --target=i686-pc-linux \ +// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s +// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r283586 - Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Author: mgorny Date: Fri Oct 7 15:04:00 2016 New Revision: 283586 URL: http://llvm.org/viewvc/llvm-project?rev=283586&view=rev Log: Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used Revert the -print-libgcc-file-name change as the new test fails on Darwin. It needs to be updated to run the libgcc part only on systems supporting that rtlib. Removed: cfe/trunk/test/Driver/print-libgcc-file-name.c Modified: cfe/trunk/docs/CommandGuide/clang.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Driver.cpp Modified: cfe/trunk/docs/CommandGuide/clang.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283586&r1=283585&r2=283586&view=diff == --- cfe/trunk/docs/CommandGuide/clang.rst (original) +++ cfe/trunk/docs/CommandGuide/clang.rst Fri Oct 7 15:04:00 2016 @@ -394,8 +394,7 @@ Driver Options .. option:: -print-libgcc-file-name - Print the library path for the currently used compiler runtime library - ("libgcc.a" or "libclang_rt.builtins.*.a"). + Print the library path for "libgcc.a". .. option:: -print-prog-name= Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283586&r1=283585&r2=283586&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Oct 7 15:04:00 2016 @@ -1861,8 +1861,7 @@ def print_file_name_EQ : Joined<["-", "- def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>, HelpText<"Enable Objective-C Ivar layout bitmap print trace">; def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">, - HelpText<"Print the library path for the currently used compiler runtime " - "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">; + HelpText<"Print the library path for \"libgcc.a\"">; def print_multi_directory : Flag<["-", "--"], "print-multi-directory">; def print_multi_lib : Flag<["-", "--"], "print-multi-lib">; def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">, Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283586&r1=283585&r2=283586&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 7 15:04:00 2016 @@ -994,15 +994,7 @@ bool Driver::HandleImmediateArgs(const C } if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) { -ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs()); -switch (RLT) { -case ToolChain::RLT_CompilerRT: - llvm::outs() << TC.getCompilerRTArgString(C.getArgs(), "builtins") << "\n"; - break; -case ToolChain::RLT_Libgcc: - llvm::outs() << GetFilePath("libgcc.a", TC) << "\n"; - break; -} +llvm::outs() << GetFilePath("libgcc.a", TC) << "\n"; return false; } Removed: cfe/trunk/test/Driver/print-libgcc-file-name.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name.c?rev=283585&view=auto == --- cfe/trunk/test/Driver/print-libgcc-file-name.c (original) +++ cfe/trunk/test/Driver/print-libgcc-file-name.c (removed) @@ -1,15 +0,0 @@ -// Test that -print-libgcc-file-name correctly respects -rtlib=. - -// RUN: %clang -rtlib=libgcc -print-libgcc-file-name 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-LIBGCC %s -// CHECK-LIBGCC: libgcc.a - -// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ -// RUN: --target=x86_64-pc-linux \ -// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s -// CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a - -// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ -// RUN: --target=i686-pc-linux \ -// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s -// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283659 - [cmake] Split linked libraries into private & public, for linker script
Author: mgorny Date: Sat Oct 8 05:27:45 2016 New Revision: 283659 URL: http://llvm.org/viewvc/llvm-project?rev=283659&view=rev Log: [cmake] Split linked libraries into private & public, for linker script Introduce LIBCXX_LIBRARIES_PUBLIC in addition to LIBCXX_LIBRARIES that holds 'public' interface libraries -- that is, libraries that both libc++ links to and programs linked against it need to link to. Currently this includes the ABI library and optionally -lunwind (when LIBCXXABI_USE_LLVM_UNWINDER is on). The libraries are included in the linker script, in order to make it possible to link C++ programs using clang with compiler-rt runtime out-of-the-box. Differential Revision: https://reviews.llvm.org/D25008 Modified: libcxx/trunk/CMakeLists.txt libcxx/trunk/lib/CMakeLists.txt libcxx/trunk/utils/gen_link_script/gen_link_script.py Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=283659&r1=283658&r2=283659&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Sat Oct 8 05:27:45 2016 @@ -270,9 +270,13 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB # LIBCXX_CXX_FLAGS: General flags for both the compiler and linker. # LIBCXX_COMPILE_FLAGS: Compile only flags. # LIBCXX_LINK_FLAGS: Linker only flags. +# LIBCXX_LIBRARIES: Private libraries libc++ is linked to. +# LIBCXX_LIBRARIES_PUBLIC: Public libraries libc++ is linked to, +# also exposed in the linker script. set(LIBCXX_COMPILE_FLAGS "") set(LIBCXX_LINK_FLAGS "") set(LIBCXX_LIBRARIES "") +set(LIBCXX_LIBRARIES_PUBLIC "") # Include macros for adding and removing libc++ flags. include(HandleLibcxxFlags) Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=283659&r1=283658&r2=283659&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Sat Oct 8 05:27:45 2016 @@ -33,9 +33,17 @@ add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY add_library_flags_if(LIBCXX_COVERAGE_LIBRARY "${LIBCXX_COVERAGE_LIBRARY}") -add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,--whole-archive" "-Wl,-Bstatic") -add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") -add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "-Wl,-Bdynamic" "-Wl,--no-whole-archive") +if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) + add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic") + add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") + add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive") +elseif (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR + LIBCXX_CXX_ABI_LIBNAME STREQUAL "none")) + # Apple re-exports libc++abi in libc++, so don't make it public + add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") +else() + list(APPEND LIBCXX_LIBRARIES_PUBLIC "${LIBCXX_CXX_ABI_LIBRARY}") +endif() if (APPLE AND LLVM_USE_SANITIZER) if (("${LLVM_USE_SANITIZER}" STREQUAL "Address") OR @@ -67,7 +75,7 @@ if (APPLE AND LLVM_USE_SANITIZER) endif() endif() -# Generate library list. +# Generate private library list. add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread) add_library_flags_if(LIBCXX_HAS_C_LIB c) add_library_flags_if(LIBCXX_HAS_M_LIB m) @@ -75,6 +83,11 @@ add_library_flags_if(LIBCXX_HAS_RT_LIB r add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) +# Add the unwinder library. +if (LIBCXXABI_USE_LLVM_UNWINDER) + list(APPEND LIBCXX_LIBRARIES_PUBLIC unwind) +endif() + # Setup flags. if (NOT WIN32) add_flags_if_supported(-fPIC) @@ -151,7 +164,9 @@ set(LIBCXX_TARGETS) # Build the shared library. if (LIBCXX_ENABLE_SHARED) add_library(cxx_shared SHARED $) - target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) + target_link_libraries(cxx_shared +PRIVATE ${LIBCXX_LIBRARIES} +PUBLIC ${LIBCXX_LIBRARIES_PUBLIC}) set_target_properties(cxx_shared PROPERTIES LINK_FLAGS"${LIBCXX_LINK_FLAGS}" @@ -165,7 +180,9 @@ endif() # Build the static library. if (LIBCXX_ENABLE_STATIC) add_library(cxx_static STATIC $) - target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) + target_link_libraries(cxx_static +PRIVATE ${LIBCXX_LIBRARIES} +PUBLIC ${LIBCXX_LIBRARIES_PUBLIC}) set_target_properties(cxx_static PROPERTIES LINK_FLAGS"${LIBCXX_LINK_FLAGS}" @@ -238,7 +255,7 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENAB ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py ARGS "$" - "${SCRIPT_ABI_LIBNAME}" + "\"${LIBCXX_LIBRARIES_PUBLIC}\"" WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} ) endif() Modified: libcxx/trunk/utils/gen_link_script/gen_link_script.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/gen_lin
r283746 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Author: mgorny Date: Mon Oct 10 07:23:40 2016 New Revision: 283746 URL: http://llvm.org/viewvc/llvm-project?rev=283746&view=rev Log: [Driver] Make -print-libgcc-file-name print compiler-rt lib when used Make the -print-libgcc-file-name option print an appropriate compiler runtime library, that is libgcc.a if gcc runtime is used and an appropriate compiler-rt library if that runtime is used. The main use for this is to allow linking executables built with -nodefaultlibs (e.g. to avoid linking to the standard C++ library) to the compiler runtime library, e.g. using: clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name) in which case currently a program built like this linked to the gcc runtime unconditionally. The patch fixes it to use compiler-rt libraries instead when compiler-rt is the active runtime. Differential Revision: https://reviews.llvm.org/D25338 Added: cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c cfe/trunk/test/Driver/print-libgcc-file-name-libgcc.c Modified: cfe/trunk/docs/CommandGuide/clang.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/montavista-gcc-toolchain.c cfe/trunk/test/lit.cfg Modified: cfe/trunk/docs/CommandGuide/clang.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=283746&r1=283745&r2=283746&view=diff == --- cfe/trunk/docs/CommandGuide/clang.rst (original) +++ cfe/trunk/docs/CommandGuide/clang.rst Mon Oct 10 07:23:40 2016 @@ -394,7 +394,8 @@ Driver Options .. option:: -print-libgcc-file-name - Print the library path for "libgcc.a". + Print the library path for the currently used compiler runtime library + ("libgcc.a" or "libclang_rt.builtins.*.a"). .. option:: -print-prog-name= Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=283746&r1=283745&r2=283746&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 10 07:23:40 2016 @@ -1861,7 +1861,8 @@ def print_file_name_EQ : Joined<["-", "- def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>, HelpText<"Enable Objective-C Ivar layout bitmap print trace">; def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">, - HelpText<"Print the library path for \"libgcc.a\"">; + HelpText<"Print the library path for the currently used compiler runtime " + "library (\"libgcc.a\" or \"libclang_rt.builtins.*.a\")">; def print_multi_directory : Flag<["-", "--"], "print-multi-directory">; def print_multi_lib : Flag<["-", "--"], "print-multi-lib">; def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">, Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=283746&r1=283745&r2=283746&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Mon Oct 10 07:23:40 2016 @@ -994,7 +994,15 @@ bool Driver::HandleImmediateArgs(const C } if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) { -llvm::outs() << GetFilePath("libgcc.a", TC) << "\n"; +ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs()); +switch (RLT) { +case ToolChain::RLT_CompilerRT: + llvm::outs() << TC.getCompilerRT(C.getArgs(), "builtins") << "\n"; + break; +case ToolChain::RLT_Libgcc: + llvm::outs() << GetFilePath("libgcc.a", TC) << "\n"; + break; +} return false; } Modified: cfe/trunk/test/Driver/montavista-gcc-toolchain.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/montavista-gcc-toolchain.c?rev=283746&r1=283745&r2=283746&view=diff == --- cfe/trunk/test/Driver/montavista-gcc-toolchain.c (original) +++ cfe/trunk/test/Driver/montavista-gcc-toolchain.c Mon Oct 10 07:23:40 2016 @@ -1,6 +1,6 @@ // Test that the montavista gcc-toolchain is correctly detected // -// RUN: %clang -print-libgcc-file-name 2>&1 \ +// RUN: %clang -rtlib=platform -print-libgcc-file-name 2>&1 \ // RUN: --target=i686-montavista-linux \ // RUN: --gcc-toolchain=%S/Inputs/montavista_i686_tree/usr \ // RUN: | FileCheck %s Added: cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c?rev=283746&view=auto == --- cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c (added) +++ cfe/trunk/test/Driver/print-libgcc-file-name-clangrt.c Mon Oct 10 07:2
[clang-tools-extra] r309979 - [test] Fix clang library dir in LD_LIBRARY_PATH For stand-alone build
Author: mgorny Date: Thu Aug 3 12:41:33 2017 New Revision: 309979 URL: http://llvm.org/viewvc/llvm-project?rev=309979&view=rev Log: [test] Fix clang library dir in LD_LIBRARY_PATH For stand-alone build Prepend the clang library directory (determined using SHLIBDIR, alike in clang) to the LD_LIBRARY_PATH to ensure that just-built clang libraries will be used instead of a previous installed version. When a stand-alone build is performed, LLVM_LIBS_DIR contains the path to installed LLVM library directory. The same directory frequently contains a previously installed version of clang. SHLIBDIR, on the other hand, is always the build-tree directory, and therefore contains the freshly built clang libraries. In a non-stand-alone build, both paths will be the same and therefore including them both will not cause any issues. Differential Revision: https://reviews.llvm.org/D30155 Modified: clang-tools-extra/trunk/test/Unit/lit.cfg clang-tools-extra/trunk/test/lit.cfg clang-tools-extra/trunk/test/lit.site.cfg.in Modified: clang-tools-extra/trunk/test/Unit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/Unit/lit.cfg?rev=309979&r1=309978&r2=309979&view=diff == --- clang-tools-extra/trunk/test/Unit/lit.cfg (original) +++ clang-tools-extra/trunk/test/Unit/lit.cfg Thu Aug 3 12:41:33 2017 @@ -41,14 +41,17 @@ elif platform.system() == 'Windows': shlibpath_var = 'PATH' # Point the dynamic loader at dynamic libraries in 'lib'. +shlibdir = getattr(config, 'shlibdir', None) +if not shlibdir: +lit_config.fatal('No shlibdir set!') llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) if not llvm_libs_dir: lit_config.fatal('No LLVM libs dir set!') -shlibpath = os.path.pathsep.join((llvm_libs_dir, +shlibpath = os.path.pathsep.join((shlibdir, llvm_libs_dir, config.environment.get(shlibpath_var,''))) # Win32 seeks DLLs along %PATH%. -if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir): -shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath)) +if sys.platform in ['win32', 'cygwin'] and os.path.isdir(shlibdir): +shlibpath = os.path.pathsep.join((shlibdir, shlibpath)) config.environment[shlibpath_var] = shlibpath Modified: clang-tools-extra/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.cfg?rev=309979&r1=309978&r2=309979&view=diff == --- clang-tools-extra/trunk/test/lit.cfg (original) +++ clang-tools-extra/trunk/test/lit.cfg Thu Aug 3 12:41:33 2017 @@ -99,10 +99,13 @@ if clang_tools_binary_dir is not None: clang_tools_dir, llvm_tools_dir, config.environment['PATH'])) config.environment['PATH'] = path +clang_libs_dir = getattr(config, 'clang_libs_dir', None) +if not clang_libs_dir: +lit_config.fatal('No Clang libs dir set!') llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) if not llvm_libs_dir: lit_config.fatal('No LLVM libs dir set!') -path = os.path.pathsep.join((llvm_libs_dir, +path = os.path.pathsep.join((clang_libs_dir, llvm_libs_dir, config.environment.get('LD_LIBRARY_PATH',''))) config.environment['LD_LIBRARY_PATH'] = path Modified: clang-tools-extra/trunk/test/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=309979&r1=309978&r2=309979&view=diff == --- clang-tools-extra/trunk/test/lit.site.cfg.in (original) +++ clang-tools-extra/trunk/test/lit.site.cfg.in Thu Aug 3 12:41:33 2017 @@ -7,6 +7,7 @@ config.llvm_libs_dir = "@LLVM_LIBS_DIR@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@" config.clang_tools_dir = "@CLANG_TOOLS_DIR@" +config.clang_libs_dir = "@SHLIBDIR@" config.python_executable = "@PYTHON_EXECUTABLE@" config.target_triple = "@TARGET_TRIPLE@" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r329594 - [cmake] Include LLVMTestingSupport when doing stand-alone build
Author: mgorny Date: Mon Apr 9 10:08:14 2018 New Revision: 329594 URL: http://llvm.org/viewvc/llvm-project?rev=329594&view=rev Log: [cmake] Include LLVMTestingSupport when doing stand-alone build Explicitly include and build lib/Testing/Support from LLVM sources when doing a stand-alone build. This is necessary since clangd tests started to depend on LLVMTestingSupport library which is neither installed by LLVM, nor built by clang itself. Since completely separate build of clang-tools-extra is not supported, this relies on variables set by clang CMakeLists. Differential Revision: https://reviews.llvm.org/D45409 Modified: clang-tools-extra/trunk/unittests/CMakeLists.txt Modified: clang-tools-extra/trunk/unittests/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/CMakeLists.txt?rev=329594&r1=329593&r2=329594&view=diff == --- clang-tools-extra/trunk/unittests/CMakeLists.txt (original) +++ clang-tools-extra/trunk/unittests/CMakeLists.txt Mon Apr 9 10:08:14 2018 @@ -5,6 +5,15 @@ function(add_extra_unittest test_dirname add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN}) endfunction() +if(CLANG_BUILT_STANDALONE) + # LLVMTestingSupport library is needed for clangd tests. + if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + AND NOT TARGET LLVMTestingSupport) +add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support + lib/Testing/Support) + endif() +endif() + add_subdirectory(change-namespace) add_subdirectory(clang-apply-replacements) add_subdirectory(clang-move) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317828 - [python] [tests] Update priority values in code completion test
Author: mgorny Date: Thu Nov 9 12:17:41 2017 New Revision: 317828 URL: http://llvm.org/viewvc/llvm-project?rev=317828&view=rev Log: [python] [tests] Update priority values in code completion test The priority for destructors and operators was reduced in r314019. Adjust the values used in the test appropriately to fix the test failure. Differential Revision: https://reviews.llvm.org/D39838 Modified: cfe/trunk/bindings/python/tests/cindex/test_code_completion.py Modified: cfe/trunk/bindings/python/tests/cindex/test_code_completion.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_code_completion.py?rev=317828&r1=317827&r2=317828&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_code_completion.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_code_completion.py Thu Nov 9 12:17:41 2017 @@ -68,8 +68,8 @@ void f(P x, Q y) { cr = tu.codeComplete('fake.cpp', 13, 5, unsaved_files=files) expected = [ "{'P', TypedText} | {'::', Text} || Priority: 75 || Availability: Available || Brief comment: None", -"{'P &', ResultType} | {'operator=', TypedText} | {'(', LeftParen} | {'const P &', Placeholder} | {')', RightParen} || Priority: 34 || Availability: Available || Brief comment: None", +"{'P &', ResultType} | {'operator=', TypedText} | {'(', LeftParen} | {'const P &', Placeholder} | {')', RightParen} || Priority: 79 || Availability: Available || Brief comment: None", "{'int', ResultType} | {'member', TypedText} || Priority: 35 || Availability: NotAccessible || Brief comment: None", -"{'void', ResultType} | {'~P', TypedText} | {'(', LeftParen} | {')', RightParen} || Priority: 34 || Availability: Available || Brief comment: None" +"{'void', ResultType} | {'~P', TypedText} | {'(', LeftParen} | {')', RightParen} || Priority: 79 || Availability: Available || Brief comment: None" ] check_completion_results(cr, expected) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r317986 - [python] [tests] Fix test_linkage for unique external linkage
Author: mgorny Date: Sat Nov 11 12:01:41 2017 New Revision: 317986 URL: http://llvm.org/viewvc/llvm-project?rev=317986&view=rev Log: [python] [tests] Fix test_linkage for unique external linkage Starting with r314037, anonymous namespaces no longer give unique-external linkage to variables. However, this linkage can still be achieved by using a type which is not exterally visible, e.g. through being declared in an anonymous namespace but used outside it. Fix the test to take advantage of that. Differential Revision: https://reviews.llvm.org/D39810 Modified: cfe/trunk/bindings/python/tests/cindex/test_linkage.py Modified: cfe/trunk/bindings/python/tests/cindex/test_linkage.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_linkage.py?rev=317986&r1=317985&r2=317986&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_linkage.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_linkage.py Sat Nov 11 12:01:41 2017 @@ -15,7 +15,8 @@ class TestLinkage(unittest.TestCase): tu = get_tu(""" void foo() { int no_linkage; } static int internal; -namespace { extern int unique_external; } +namespace { struct unique_external_type {} } +unique_external_type unique_external; extern int external; """, lang = 'cpp') ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r318562 - [cmake] Use llvm-lit directory when provided for stand-alone build
Author: mgorny Date: Fri Nov 17 14:21:23 2017 New Revision: 318562 URL: http://llvm.org/viewvc/llvm-project?rev=318562&view=rev Log: [cmake] Use llvm-lit directory when provided for stand-alone build After the recent lit test changes, clang attempts to run its tests via llvm-lit by default. However, the llvm-lit binary is not present when performing stand-alone build resulting in a failure out of the box. To solve that, add the llvm-lit directory to CMake when performing a stand-alone build and LLVM sources are provided. This includes the CMake rules generating the llvm-lit binary and effectively makes it possible for clang to use it. Differential Revision: https://reviews.llvm.org/D40142 Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=318562&r1=318561&r2=318562&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Fri Nov 17 14:21:23 2017 @@ -132,6 +132,9 @@ Please install Python or specify the PYT if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) # Note: path not really used, except for checking if lit was found set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) + if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/llvm-lit) +add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit utils/llvm-lit) + endif() if(NOT LLVM_UTILS_PROVIDED) add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/FileCheck utils/FileCheck) add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/count utils/count) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289865 - [test] Extend llvm_shlib_dir fix to unittests
Author: mgorny Date: Thu Dec 15 14:31:08 2016 New Revision: 289865 URL: http://llvm.org/viewvc/llvm-project?rev=289865&view=rev Log: [test] Extend llvm_shlib_dir fix to unittests Extend the fix from rL286952 to unittests. The fix added clang built library directories (via llvm_shlib_dir) to LD_LIBRARY_PATH. The previous logic has used llvm_libs_dir only which points to installed LLVM when doing stand-alone builds. The patch also removes the redundant win32 code that is no longer necessary now that shlibdir is used unconditionally. Differential Revision: https://reviews.llvm.org/D27812 Modified: cfe/trunk/test/Unit/lit.cfg Modified: cfe/trunk/test/Unit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Unit/lit.cfg?rev=289865&r1=289864&r2=289865&view=diff == --- cfe/trunk/test/Unit/lit.cfg (original) +++ cfe/trunk/test/Unit/lit.cfg Thu Dec 15 14:31:08 2016 @@ -94,15 +94,16 @@ elif platform.system() == 'Darwin': elif platform.system() == 'Windows': shlibpath_var = 'PATH' +# in stand-alone builds, shlibdir is clang's build tree +# while llvm_libs_dir is installed LLVM (and possibly older clang) +llvm_shlib_dir = getattr(config, 'shlibdir', None) +if not llvm_shlib_dir: +lit_config.fatal('No shlibdir set!') # Point the dynamic loader at dynamic libraries in 'lib'. llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) if not llvm_libs_dir: lit_config.fatal('No LLVM libs dir set!') -shlibpath = os.path.pathsep.join((llvm_libs_dir, +shlibpath = os.path.pathsep.join((llvm_shlib_dir, llvm_libs_dir, config.environment.get(shlibpath_var,''))) -# Win32 seeks DLLs along %PATH%. -if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir): -shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath)) - config.environment[shlibpath_var] = shlibpath ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291477 - [Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin
Author: mgorny Date: Mon Jan 9 14:54:20 2017 New Revision: 291477 URL: http://llvm.org/viewvc/llvm-project?rev=291477&view=rev Log: [Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin Correct the logic used to set ATOMIC_*_LOCK_FREE preprocessor macros not to rely on the ABI alignment of types. Instead, just assume all those types are aligned correctly by default since clang uses safe alignment for _Atomic types even if the underlying types are aligned to a lower boundary by default. For example, the 'long long' and 'double' types on x86 are aligned to 32-bit boundary by default. However, '_Atomic long long' and '_Atomic double' are aligned to 64-bit boundary, therefore satisfying the requirements of lock-free atomic operations. This fixes PR #19355 by correcting the value of __GCC_ATOMIC_LLONG_LOCK_FREE on x86, and therefore also fixing the assumption made in libc++ tests. This also fixes PR #30581 by applying a consistent logic between the functions used to implement both interfaces. Differential Revision: https://reviews.llvm.org/D28213 Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp cfe/trunk/test/Sema/atomic-ops.c Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=291477&r1=291476&r2=291477&view=diff == --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original) +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Jan 9 14:54:20 2017 @@ -286,12 +286,12 @@ static void DefineFastIntType(unsigned T /// Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with /// the specified properties. -static const char *getLockFreeValue(unsigned TypeWidth, unsigned TypeAlign, -unsigned InlineWidth) { +static const char *getLockFreeValue(unsigned TypeWidth, unsigned InlineWidth) { // Fully-aligned, power-of-2 sizes no larger than the inline // width will be inlined as lock-free operations. - if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 && - TypeWidth <= InlineWidth) + // Note: we do not need to check alignment since _Atomic(T) is always + // appropriately-aligned in clang. + if ((TypeWidth & (TypeWidth - 1)) == 0 && TypeWidth <= InlineWidth) return "2"; // "always lock free" // We cannot be certain what operations the lib calls might be // able to implement as lock-free on future processors. @@ -881,7 +881,6 @@ static void InitializePredefinedMacros(c #define DEFINE_LOCK_FREE_MACRO(TYPE, Type) \ Builder.defineMacro("__GCC_ATOMIC_" #TYPE "_LOCK_FREE", \ getLockFreeValue(TI.get##Type##Width(), \ - TI.get##Type##Align(), \ InlineWidthBits)); DEFINE_LOCK_FREE_MACRO(BOOL, Bool); DEFINE_LOCK_FREE_MACRO(CHAR, Char); @@ -894,7 +893,6 @@ static void InitializePredefinedMacros(c DEFINE_LOCK_FREE_MACRO(LLONG, LongLong); Builder.defineMacro("__GCC_ATOMIC_POINTER_LOCK_FREE", getLockFreeValue(TI.getPointerWidth(0), - TI.getPointerAlign(0), InlineWidthBits)); #undef DEFINE_LOCK_FREE_MACRO } Modified: cfe/trunk/test/Sema/atomic-ops.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/atomic-ops.c?rev=291477&r1=291476&r2=291477&view=diff == --- cfe/trunk/test/Sema/atomic-ops.c (original) +++ cfe/trunk/test/Sema/atomic-ops.c Mon Jan 9 14:54:20 2017 @@ -14,11 +14,7 @@ _Static_assert(__GCC_ATOMIC_WCHAR_T_LOCK _Static_assert(__GCC_ATOMIC_SHORT_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_INT_LOCK_FREE == 2, ""); _Static_assert(__GCC_ATOMIC_LONG_LOCK_FREE == 2, ""); -#ifdef __i386__ -_Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 1, ""); -#else _Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 2, ""); -#endif _Static_assert(__GCC_ATOMIC_POINTER_LOCK_FREE == 2, ""); _Static_assert(__c11_atomic_is_lock_free(1), ""); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291495 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Author: mgorny Date: Mon Jan 9 17:06:39 2017 New Revision: 291495 URL: http://llvm.org/viewvc/llvm-project?rev=291495&view=rev Log: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from llvm-config instead of reconstructing it locally. Differential Revision: https://reviews.llvm.org/D26900 Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=291495&r1=291494&r2=291495&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Mon Jan 9 17:06:39 2017 @@ -16,7 +16,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR "--libdir" "--includedir" "--prefix" - "--src-root") + "--src-root" + "--cmakedir") execute_process( COMMAND ${CONFIG_COMMAND} RESULT_VARIABLE HAD_ERROR @@ -41,6 +42,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR list(GET CONFIG_OUTPUT 3 INCLUDE_DIR) list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT) list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR) + list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH) if(NOT MSVC_IDE) set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS} @@ -58,7 +60,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) - set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake") if(EXISTS ${LLVMCONFIG_FILE}) list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r291505 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Author: mgorny Date: Mon Jan 9 17:27:04 2017 New Revision: 291505 URL: http://llvm.org/viewvc/llvm-project?rev=291505&view=rev Log: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from llvm-config. Fallback to local reconstruction if llvm-config does not support this option. Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=291505&r1=291504&r2=291505&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Mon Jan 9 17:27:04 2017 @@ -43,8 +43,19 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py") + +# --cmakedir is supported since llvm r291218 (4.0 release) +execute_process( + COMMAND ${LLVM_CONFIG_PATH} --cmakedir + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE CONFIG_OUTPUT) +if(NOT HAD_ERROR) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) +else() + set(LLVM_CMAKE_PATH + "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") +endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r291506 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Author: mgorny Date: Mon Jan 9 17:31:05 2017 New Revision: 291506 URL: http://llvm.org/viewvc/llvm-project?rev=291506&view=rev Log: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from llvm-config. Fallback to local reconstruction if llvm-config does not support this option. Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=291506&r1=291505&r2=291506&view=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Mon Jan 9 17:31:05 2017 @@ -49,8 +49,19 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py") + +# --cmakedir is supported since llvm r291218 (4.0 release) +execute_process( + COMMAND ${LLVM_CONFIG_PATH} --cmakedir + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE CONFIG_OUTPUT) +if(NOT HAD_ERROR) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) +else() + set(LLVM_CMAKE_PATH + "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") +endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " "Reconfigure with -DLLVM_CONFIG_PATH=path/to/llvm-config " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r291508 - [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Author: mgorny Date: Mon Jan 9 17:41:38 2017 New Revision: 291508 URL: http://llvm.org/viewvc/llvm-project?rev=291508&view=rev Log: [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from llvm-config. Fallback to local reconstruction if llvm-config does not support this option. Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=291508&r1=291507&r2=291508&view=diff == --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Mon Jan 9 17:41:38 2017 @@ -38,7 +38,18 @@ macro(find_llvm_parts) set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + +# --cmakedir is supported since llvm r291218 (4.0 release) +execute_process( + COMMAND ${LLVM_CONFIG_PATH} --cmakedir + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE CONFIG_OUTPUT) +if(NOT HAD_ERROR) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) +else() + set(LLVM_CMAKE_PATH + "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") +endif() else() set(LLVM_FOUND OFF) message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r297806 - [test] Fix test dependencies when using installed tools
Author: mgorny Date: Wed Mar 15 00:55:43 2017 New Revision: 297806 URL: http://llvm.org/viewvc/llvm-project?rev=297806&view=rev Log: [test] Fix test dependencies when using installed tools Use the LLVM_UTILS_PROVIDED variable to determine whether test tool dependencies should be exposed for clang-tools-extra tests. If clang is being built stand-alone and LLVM test tools (FileCheck, count and not) are installed, the top-level CMakeLists.txt of clang sets this variable to indicate that they will not be built as a part of this build, and therefore no dependencies should be emitted for them. This fixes the dependency errors when building clang stand-alone with tests enabled. Differential Revision: https://reviews.llvm.org/D29851 Modified: clang-tools-extra/trunk/test/CMakeLists.txt Modified: clang-tools-extra/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/CMakeLists.txt?rev=297806&r1=297805&r2=297806&view=diff == --- clang-tools-extra/trunk/test/CMakeLists.txt (original) +++ clang-tools-extra/trunk/test/CMakeLists.txt Wed Mar 15 00:55:43 2017 @@ -31,9 +31,6 @@ if(CLANG_TOOLS_TEST_USE_VG) endif() set(CLANG_TOOLS_TEST_DEPS - # Base line deps. - FileCheck count not - # clang-tidy tests require it. clang-headers @@ -58,6 +55,13 @@ set(CLANG_TOOLS_TEST_DEPS ExtraToolsUnitTests ) +if(NOT LLVM_UTILS_PROVIDED) + list(APPEND CLANG_TOOLS_TEST_DEPS +# Base line deps. +FileCheck count not +) +endif() + add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CLANG_TOOLS_TEST_DEPS} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r299813 - [cmake] Support Gentoo install for z3
Author: mgorny Date: Sat Apr 8 09:38:06 2017 New Revision: 299813 URL: http://llvm.org/viewvc/llvm-project?rev=299813&view=rev Log: [cmake] Support Gentoo install for z3 Add the 'z3' subdirectory to the list of possible path suffixes for libz3 header search. The z3 headers are installed in /usr/include/z3 on Gentoo. Differential Revision: https://reviews.llvm.org/D31756 Modified: cfe/trunk/cmake/modules/FindZ3.cmake Modified: cfe/trunk/cmake/modules/FindZ3.cmake URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/FindZ3.cmake?rev=299813&r1=299812&r2=299813&view=diff == --- cfe/trunk/cmake/modules/FindZ3.cmake (original) +++ cfe/trunk/cmake/modules/FindZ3.cmake Sat Apr 8 09:38:06 2017 @@ -1,5 +1,5 @@ find_path(Z3_INCLUDE_DIR NAMES z3.h - PATH_SUFFIXES libz3 + PATH_SUFFIXES libz3 z3 ) find_library(Z3_LIBRARIES NAMES z3 libz3 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r292018 - [cmake] Handle missing LIBUNWIND_* directories gracefully
Author: mgorny Date: Sat Jan 14 11:05:16 2017 New Revision: 292018 URL: http://llvm.org/viewvc/llvm-project?rev=292018&view=rev Log: [cmake] Handle missing LIBUNWIND_* directories gracefully Add LIBUNWIND_* directories to include path only if they were actually found, in order to fix the CMake error. Both of the directories are usually unnecessary since libcxxabi uses only the common part of unwind.h that is supplied both by GCC and Clang. Differential Revision: https://reviews.llvm.org/D25314 Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=292018&r1=292017&r2=292018&view=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Sat Jan 14 11:05:16 2017 @@ -479,8 +479,12 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_ set(LIBCXXABI_LIBUNWIND_SOURCES "") endif() - include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}") - include_directories("${LIBCXXABI_LIBUNWIND_SOURCES}") + if (NOT LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND") +include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}") + endif() + if (NOT LIBCXXABI_LIBUNWIND_SOURCES STREQUAL "") +include_directories("${LIBCXXABI_LIBUNWIND_SOURCES}") + endif() endif() # Add source code. This also contains all of the logic for deciding linker flags ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r293052 - [test] Port clang tests to canonicalized booleans
Author: mgorny Date: Wed Jan 25 07:11:45 2017 New Revision: 293052 URL: http://llvm.org/viewvc/llvm-project?rev=293052&view=rev Log: [test] Port clang tests to canonicalized booleans Use the new llvm_canonicalize_cmake_booleans() function to canonicalize booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables used to hold canonicalized values with in-place canonicalization. Use implicit logic in Python code to avoid overrelying on exact 0/1 values. Differential Revision: https://reviews.llvm.org/D28529 Modified: cfe/trunk/CMakeLists.txt cfe/trunk/test/ARCMT/lit.local.cfg cfe/trunk/test/Analysis/lit.local.cfg cfe/trunk/test/CMakeLists.txt cfe/trunk/test/Rewriter/lit.local.cfg cfe/trunk/test/Tooling/lit.local.cfg cfe/trunk/test/lit.cfg cfe/trunk/test/lit.site.cfg.in Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=293052&r1=293051&r2=293052&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Wed Jan 25 07:11:45 2017 @@ -364,18 +364,7 @@ option(CLANG_BUILD_TOOLS "Build the Clang tools. If OFF, just generate build targets." ON) option(CLANG_ENABLE_ARCMT "Build ARCMT." ON) -if (CLANG_ENABLE_ARCMT) - set(ENABLE_CLANG_ARCMT "1") -else() - set(ENABLE_CLANG_ARCMT "0") -endif() - option(CLANG_ENABLE_STATIC_ANALYZER "Build static analyzer." ON) -if (CLANG_ENABLE_STATIC_ANALYZER) - set(ENABLE_CLANG_STATIC_ANALYZER "1") -else() - set(ENABLE_CLANG_STATIC_ANALYZER "0") -endif() if (NOT CLANG_ENABLE_STATIC_ANALYZER AND CLANG_ENABLE_ARCMT) message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT") @@ -415,11 +404,6 @@ add_subdirectory(tools) add_subdirectory(runtime) option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF) -if (CLANG_BUILD_EXAMPLES) - set(ENABLE_CLANG_EXAMPLES "1") -else() - set(ENABLE_CLANG_EXAMPLES "0") -endif() add_subdirectory(examples) if(APPLE) Modified: cfe/trunk/test/ARCMT/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/lit.local.cfg?rev=293052&r1=293051&r2=293052&view=diff == --- cfe/trunk/test/ARCMT/lit.local.cfg (original) +++ cfe/trunk/test/ARCMT/lit.local.cfg Wed Jan 25 07:11:45 2017 @@ -1,2 +1,2 @@ -if config.root.clang_arcmt == 0: +if not config.root.clang_arcmt: config.unsupported = True Modified: cfe/trunk/test/Analysis/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lit.local.cfg?rev=293052&r1=293051&r2=293052&view=diff == --- cfe/trunk/test/Analysis/lit.local.cfg (original) +++ cfe/trunk/test/Analysis/lit.local.cfg Wed Jan 25 07:11:45 2017 @@ -1,2 +1,2 @@ -if config.root.clang_staticanalyzer == 0: +if not config.root.clang_staticanalyzer: config.unsupported = True Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=293052&r1=293051&r2=293052&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Wed Jan 25 07:11:45 2017 @@ -18,6 +18,12 @@ if(CLANG_BUILT_STANDALONE) endif() endif() +llvm_canonicalize_cmake_booleans( + CLANG_BUILD_EXAMPLES + CLANG_ENABLE_ARCMT + CLANG_ENABLE_STATIC_ANALYZER + ENABLE_BACKTRACES) + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg @@ -55,7 +61,7 @@ if (CLANG_ENABLE_ARCMT) ) endif () -if (ENABLE_CLANG_EXAMPLES) +if (CLANG_BUILD_EXAMPLES) list(APPEND CLANG_TEST_DEPS AnnotateFunctions clang-interpreter @@ -63,7 +69,7 @@ if (ENABLE_CLANG_EXAMPLES) ) endif () -if (ENABLE_CLANG_STATIC_ANALYZER AND ENABLE_CLANG_EXAMPLES) +if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES) list(APPEND CLANG_TEST_DEPS SampleAnalyzerPlugin ) Modified: cfe/trunk/test/Rewriter/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/lit.local.cfg?rev=293052&r1=293051&r2=293052&view=diff == --- cfe/trunk/test/Rewriter/lit.local.cfg (original) +++ cfe/trunk/test/Rewriter/lit.local.cfg Wed Jan 25 07:11:45 2017 @@ -1,3 +1,3 @@ # The Objective-C rewriters are currently grouped with ARCMT. -if config.root.clang_arcmt == 0: +if not config.root.clang_arcmt: config.unsupported = True Modified: cfe/trunk/test/Tooling/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/lit.local.cfg?rev=293052&r1=293051&r2=293052&view=diff == --- cfe/trunk/test/Tooling/lit.local.cfg (original) +++ cfe/trunk/test/Tooling/
r293053 - [test] Add HAVE_LIBZ to canonicalized booleans
Author: mgorny Date: Wed Jan 25 07:31:53 2017 New Revision: 293053 URL: http://llvm.org/viewvc/llvm-project?rev=293053&view=rev Log: [test] Add HAVE_LIBZ to canonicalized booleans Canonicalize HAVE_LIBZ as well to fix buildbot failures. Modified: cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=293053&r1=293052&r2=293053&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Wed Jan 25 07:31:53 2017 @@ -22,7 +22,8 @@ llvm_canonicalize_cmake_booleans( CLANG_BUILD_EXAMPLES CLANG_ENABLE_ARCMT CLANG_ENABLE_STATIC_ANALYZER - ENABLE_BACKTRACES) + ENABLE_BACKTRACES + HAVE_LIBZ) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r293632 - [cmake] Hint find_package() to prefer LLVM installed alongside clang
Author: mgorny Date: Tue Jan 31 08:15:40 2017 New Revision: 293632 URL: http://llvm.org/viewvc/llvm-project?rev=293632&view=rev Log: [cmake] Hint find_package() to prefer LLVM installed alongside clang Include a path hint for find_package() in ClangConfig.cmake to ensure that CMake prefers LLVM installed alongside clang over the default search path. If two versions of LLVM are installed in the system, and one of them is in PATH, CMake's find_package() magic prefers the CMake directory alongside that install by default. Adding a relative hint makes it possible to prioritize to the install from which find_package() is called. If you want to build e.g. LLDB against another install of LLVM, you can pass LLVM_CONFIG override. In this case, LLDB queries the prefix from llvm-config and uses the CMake files located there. However, when including ClangConfig, the implicit find_package() nevertheless prefers PATH-found LLVM over the one used previously by LLDB, and two versions of LLVMConfig end up being loaded. This could be fixed on LLDB end up by explicitly forcing custom package search location. However, it seems simpler and safer to add a hint to ClangConfig than to track every usage of ClangConfig. Differential Revision: https://reviews.llvm.org/D29304 Modified: cfe/trunk/cmake/modules/CMakeLists.txt cfe/trunk/cmake/modules/ClangConfig.cmake.in Modified: cfe/trunk/cmake/modules/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/CMakeLists.txt?rev=293632&r1=293631&r2=293632&view=diff == --- cfe/trunk/cmake/modules/CMakeLists.txt (original) +++ cfe/trunk/cmake/modules/CMakeLists.txt Tue Jan 31 08:15:40 2017 @@ -4,17 +4,23 @@ set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}") +# Keep this in sync with llvm/cmake/CMakeLists.txt! +set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake) # Generate ClangConfig.cmake for the build tree. set(CLANG_CONFIG_CMAKE_DIR "${clang_cmake_builddir}") +set(CLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}") set(CLANG_CONFIG_EXPORTS_FILE "${clang_cmake_builddir}/ClangTargets.cmake") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in ${clang_cmake_builddir}/ClangConfig.cmake @ONLY) set(CLANG_CONFIG_CMAKE_DIR) +set(CLANG_CONFIG_LLVM_CMAKE_DIR) set(CLANG_CONFIG_EXPORTS_FILE) # Generate ClangConfig.cmake for the install tree. @@ -29,6 +35,7 @@ foreach(p ${_count}) get_filename_component(CLANG_INSTALL_PREFIX \"\${CLANG_INSTALL_PREFIX}\" PATH)") endforeach(p) set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${CLANG_INSTALL_PACKAGE_DIR}") +set(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}") set(CLANG_CONFIG_EXPORTS_FILE "\${CLANG_CMAKE_DIR}/ClangTargets.cmake") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in Modified: cfe/trunk/cmake/modules/ClangConfig.cmake.in URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/ClangConfig.cmake.in?rev=293632&r1=293631&r2=293632&view=diff == --- cfe/trunk/cmake/modules/ClangConfig.cmake.in (original) +++ cfe/trunk/cmake/modules/ClangConfig.cmake.in Tue Jan 31 08:15:40 2017 @@ -1,9 +1,10 @@ # This file allows users to call find_package(Clang) and pick up our targets. -find_package(LLVM REQUIRED CONFIG) - @CLANG_CONFIG_CODE@ +find_package(LLVM REQUIRED CONFIG + HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@") + set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@") set(CLANG_CMAKE_DIR "@CLANG_CONFIG_CMAKE_DIR@") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r294431 - [test] Fix hard_link_count test to account for fs with dir nlink==1
Author: mgorny Date: Wed Feb 8 03:57:32 2017 New Revision: 294431 URL: http://llvm.org/viewvc/llvm-project?rev=294431&view=rev Log: [test] Fix hard_link_count test to account for fs with dir nlink==1 Filesystems are not required to maintain a hard link count consistent with number of subdirectories. For example, on btrfs all directories have nlink==1. Account for that in the test. Differential Revision: https://reviews.llvm.org/D29706 Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp?rev=294431&r1=294430&r2=294431&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp Wed Feb 8 03:57:32 2017 @@ -57,15 +57,19 @@ TEST_CASE(hard_link_count_for_directory) Dir3Expect = 3; // . .. file5 #endif TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect || - hard_link_count(StaticEnv::Dir) == DirExpectAlt); + hard_link_count(StaticEnv::Dir) == DirExpectAlt || + hard_link_count(StaticEnv::Dir) == 1); TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect || - hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt); + hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt || + hard_link_count(StaticEnv::Dir3) == 1); std::error_code ec; TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect || - hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt); + hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt || + hard_link_count(StaticEnv::Dir) == 1); TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect || - hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt); + hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt || + hard_link_count(StaticEnv::Dir3) == 1); } TEST_CASE(hard_link_count_increments_test) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r286952 - [test] Correctly include build llvm_shlib_dir in stand-alone builds
Author: mgorny Date: Tue Nov 15 06:54:10 2016 New Revision: 286952 URL: http://llvm.org/viewvc/llvm-project?rev=286952&view=rev Log: [test] Correctly include build llvm_shlib_dir in stand-alone builds Add the build llvm_shlib_dir into LD_LIBRARY_PATH before the directory specified as llvm_libs_dir, in order to fix stand-alone builds attempting to use installed clang libraries. In case of stand-alone builds llvm_libs_dir specifies the location of installed LLVM libraries which can also contain an older version (previous build) of clang libraries. Therefore, ensure to specify llvm_shlib_dir (which is always the build tree path) before the potentially-system llvm_libs_dir. Differential Revision: https://reviews.llvm.org/D26115 Modified: cfe/trunk/test/lit.cfg Modified: cfe/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=286952&r1=286951&r2=286952&view=diff == --- cfe/trunk/test/lit.cfg (original) +++ cfe/trunk/test/lit.cfg Tue Nov 15 06:54:10 2016 @@ -102,10 +102,15 @@ if clang_obj_root is not None: path = os.path.pathsep.join(( clang_tools_dir, llvm_tools_dir, config.environment['PATH'])) config.environment['PATH'] = path +# in stand-alone builds, llvm_shlib_dir is clang's build tree +# while llvm_libs_dir is installed LLVM (and possibly older clang) +llvm_shlib_dir = getattr(config, 'llvm_shlib_dir', None) +if not llvm_shlib_dir: +lit_config.fatal('No LLVM shlib dir set!') llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) if not llvm_libs_dir: lit_config.fatal('No LLVM libs dir set!') -path = os.path.pathsep.join((llvm_libs_dir, +path = os.path.pathsep.join((llvm_shlib_dir, llvm_libs_dir, config.environment.get('LD_LIBRARY_PATH',''))) config.environment['LD_LIBRARY_PATH'] = path ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r288060 - [Driver] Refactor distro detection & classification as a separate API
Author: mgorny Date: Mon Nov 28 15:11:14 2016 New Revision: 288060 URL: http://llvm.org/viewvc/llvm-project?rev=288060&view=rev Log: [Driver] Refactor distro detection & classification as a separate API Refactor the Distro enum along with helper functions into a full-fledged Distro class, inspired by llvm::Triple, and make it a public API. The new class wraps the enum with necessary comparison operators, adding the convenience Is*() methods and a constructor performing the detection. The public API is needed to run the unit tests (D25869). Differential Revision: https://reviews.llvm.org/D25949 Added: cfe/trunk/include/clang/Driver/Distro.h cfe/trunk/lib/Driver/Distro.cpp Modified: cfe/trunk/lib/Driver/CMakeLists.txt cfe/trunk/lib/Driver/ToolChains.cpp Added: cfe/trunk/include/clang/Driver/Distro.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Distro.h?rev=288060&view=auto == --- cfe/trunk/include/clang/Driver/Distro.h (added) +++ cfe/trunk/include/clang/Driver/Distro.h Mon Nov 28 15:11:14 2016 @@ -0,0 +1,122 @@ +//===--- Distro.h - Linux distribution detection support *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLVM_CLANG_DRIVER_DISTRO_H +#define LLVM_CLANG_DRIVER_DISTRO_H + +#include "clang/Basic/VirtualFileSystem.h" + +namespace clang { +namespace driver { + +/// Distro - Helper class for detecting and classifying Linux distributions. +/// +/// This class encapsulates the clang Linux distribution detection mechanism +/// as well as helper functions that match the specific (versioned) results +/// into wider distribution classes. +class Distro { +public: + enum DistroType { +// NB: Releases of a particular Linux distro should be kept together +// in this enum, because some tests are done by integer comparison against +// the first and last known member in the family, e.g. IsRedHat(). +ArchLinux, +DebianLenny, +DebianSqueeze, +DebianWheezy, +DebianJessie, +DebianStretch, +Exherbo, +RHEL5, +RHEL6, +RHEL7, +Fedora, +OpenSUSE, +UbuntuHardy, +UbuntuIntrepid, +UbuntuJaunty, +UbuntuKarmic, +UbuntuLucid, +UbuntuMaverick, +UbuntuNatty, +UbuntuOneiric, +UbuntuPrecise, +UbuntuQuantal, +UbuntuRaring, +UbuntuSaucy, +UbuntuTrusty, +UbuntuUtopic, +UbuntuVivid, +UbuntuWily, +UbuntuXenial, +UbuntuYakkety, +UbuntuZesty, +UnknownDistro + }; + +private: + /// The distribution, possibly with specific version. + DistroType DistroVal; + +public: + /// @name Constructors + /// @{ + + /// Default constructor leaves the distribution unknown. + Distro() : DistroVal() {} + + /// Constructs a Distro type for specific distribution. + Distro(DistroType D) : DistroVal(D) {} + + /// Detects the distribution using specified VFS. + explicit Distro(clang::vfs::FileSystem& VFS); + + bool operator==(const Distro &Other) const { +return DistroVal == Other.DistroVal; + } + + bool operator!=(const Distro &Other) const { +return DistroVal != Other.DistroVal; + } + + bool operator>=(const Distro &Other) const { +return DistroVal >= Other.DistroVal; + } + + bool operator<=(const Distro &Other) const { +return DistroVal <= Other.DistroVal; + } + + /// @} + /// @name Convenience Predicates + /// @{ + + bool IsRedhat() const { +return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7); + } + + bool IsOpenSUSE() const { +return DistroVal == OpenSUSE; + } + + bool IsDebian() const { +return DistroVal >= DebianLenny && DistroVal <= DebianStretch; + } + + bool IsUbuntu() const { +return DistroVal >= UbuntuHardy && DistroVal <= UbuntuZesty; + } + + /// @} +}; + +} // end namespace driver +} // end namespace clang + +#endif Modified: cfe/trunk/lib/Driver/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=288060&r1=288059&r2=288060&view=diff == --- cfe/trunk/lib/Driver/CMakeLists.txt (original) +++ cfe/trunk/lib/Driver/CMakeLists.txt Mon Nov 28 15:11:14 2016 @@ -12,6 +12,7 @@ add_clang_library(clangDriver Action.cpp Compilation.cpp CrossWindowsToolChain.cpp + Distro.cpp Driver.cpp DriverOptions.cpp Job.cpp Added: cfe/trunk/lib/Driver/Distro.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Distro.cpp?rev=288060&view=auto == --- cfe/trunk/lib/Driver/Distro.cpp (added) +++ cfe/trunk/lib/Driver/Distro.cpp Mon Nov 28 15:11:14 2016 @@ -0,0
r288061 - [Driver] Fix recognizing newer OpenSUSE versions
Author: mgorny Date: Mon Nov 28 15:11:18 2016 New Revision: 288061 URL: http://llvm.org/viewvc/llvm-project?rev=288061&view=rev Log: [Driver] Fix recognizing newer OpenSUSE versions Fix recognizing newer OpenSUSE versions that combine the two version components into 'VERSION = x.y'. The check was written against an older version that kept those two split as VERSION and PATCHLEVEL. Differential Revision: https://reviews.llvm.org/D26850 Modified: cfe/trunk/lib/Driver/Distro.cpp Modified: cfe/trunk/lib/Driver/Distro.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Distro.cpp?rev=288061&r1=288060&r2=288061&view=diff == --- cfe/trunk/lib/Driver/Distro.cpp (original) +++ cfe/trunk/lib/Driver/Distro.cpp Mon Nov 28 15:11:18 2016 @@ -108,11 +108,14 @@ static Distro::DistroType DetectDistro(v if (!Line.trim().startswith("VERSION")) continue; std::pair SplitLine = Line.split('='); + // Old versions have split VERSION and PATCHLEVEL + // Newer versions use VERSION = x.y + std::pair SplitVer = SplitLine.second.trim().split('.'); int Version; + // OpenSUSE/SLES 10 and older are not supported and not compatible // with our rules, so just treat them as Distro::UnknownDistro. - if (!SplitLine.second.trim().getAsInteger(10, Version) && - Version > 10) + if (!SplitVer.first.getAsInteger(10, Version) && Version > 10) return Distro::OpenSUSE; return Distro::UnknownDistro; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r288062 - [Driver] Add unit tests for Distro detection
Author: mgorny Date: Mon Nov 28 15:11:22 2016 New Revision: 288062 URL: http://llvm.org/viewvc/llvm-project?rev=288062&view=rev Log: [Driver] Add unit tests for Distro detection Add a set of unit tests for the distro detection code. The tests use an in-memory virtual filesystems resembling release files for various distributions supported. All release files are provided (not only the ones directly used) in order to guarantee that one of the rules will not mistakenly recognize the distribution incorrectly due to the additional files (e.g. Ubuntu as Debian). Differential Revision: https://reviews.llvm.org/D25869 Added: cfe/trunk/unittests/Driver/DistroTest.cpp Modified: cfe/trunk/unittests/Driver/CMakeLists.txt Modified: cfe/trunk/unittests/Driver/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/CMakeLists.txt?rev=288062&r1=288061&r2=288062&view=diff == --- cfe/trunk/unittests/Driver/CMakeLists.txt (original) +++ cfe/trunk/unittests/Driver/CMakeLists.txt Mon Nov 28 15:11:22 2016 @@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS ) add_clang_unittest(ClangDriverTests + DistroTest.cpp ToolChainTest.cpp MultilibTest.cpp ) Added: cfe/trunk/unittests/Driver/DistroTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/DistroTest.cpp?rev=288062&view=auto == --- cfe/trunk/unittests/Driver/DistroTest.cpp (added) +++ cfe/trunk/unittests/Driver/DistroTest.cpp Mon Nov 28 15:11:22 2016 @@ -0,0 +1,305 @@ +//===- unittests/Driver/DistroTest.cpp --- ToolChains tests ---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// +// +// Unit tests for Distro detection. +// +//===--===// + +#include "clang/Driver/Distro.h" +#include "clang/Basic/VirtualFileSystem.h" +#include "llvm/Support/raw_ostream.h" +#include "gtest/gtest.h" +using namespace clang; +using namespace clang::driver; + +namespace { + +// The tests include all release-related files for each distribution +// in the VFS, in order to make sure that earlier tests do not +// accidentally result in incorrect distribution guess. + +TEST(DistroTest, DetectUbuntu) { + vfs::InMemoryFileSystem UbuntuTrustyFileSystem; + // Ubuntu uses Debian Sid version. + UbuntuTrustyFileSystem.addFile("/etc/debian_version", 0, + llvm::MemoryBuffer::getMemBuffer("jessie/sid\n")); + UbuntuTrustyFileSystem.addFile("/etc/lsb-release", 0, + llvm::MemoryBuffer::getMemBuffer("DISTRIB_ID=Ubuntu\n" + "DISTRIB_RELEASE=14.04\n" + "DISTRIB_CODENAME=trusty\n" + "DISTRIB_DESCRIPTION=\"Ubuntu 14.04 LTS\"\n")); + UbuntuTrustyFileSystem.addFile("/etc/os-release", 0, + llvm::MemoryBuffer::getMemBuffer("NAME=\"Ubuntu\"\n" + "VERSION=\"14.04, Trusty Tahr\"\n" + "ID=ubuntu\n" + "ID_LIKE=debian\n" + "PRETTY_NAME=\"Ubuntu 14.04 LTS\"\n" + "VERSION_ID=\"14.04\"\n" + "HOME_URL=\"http://www.ubuntu.com/\"\n"; + "SUPPORT_URL=\"http://help.ubuntu.com/\"\n"; + "BUG_REPORT_URL=\"http://bugs.launchpad.net/ubuntu/\"\n";)); + + Distro UbuntuTrusty{UbuntuTrustyFileSystem}; + ASSERT_EQ(Distro(Distro::UbuntuTrusty), UbuntuTrusty); + ASSERT_TRUE(UbuntuTrusty.IsUbuntu()); + ASSERT_FALSE(UbuntuTrusty.IsRedhat()); + ASSERT_FALSE(UbuntuTrusty.IsOpenSUSE()); + ASSERT_FALSE(UbuntuTrusty.IsDebian()); + + vfs::InMemoryFileSystem UbuntuYakketyFileSystem; + UbuntuYakketyFileSystem.addFile("/etc/debian_version", 0, + llvm::MemoryBuffer::getMemBuffer("stretch/sid\n")); + UbuntuYakketyFileSystem.addFile("/etc/lsb-release", 0, + llvm::MemoryBuffer::getMemBuffer("DISTRIB_ID=Ubuntu\n" + "DISTRIB_RELEASE=16.10\n" + "DISTRIB_CODENAME=yakkety\n" + "DISTRIB_DESCRIPTION=\"Ubuntu 16.10\"\n")); + UbuntuYakketyFileSystem.addFile("/etc/os-release", 0, + llvm::MemoryBuffer::getMemBuffer("NAME=\"Ubuntu\"\n" + "VERSION=\"16.10 (Yakkety Yak)\"\n" + "ID=ubuntu\n" + "ID_LIKE=debian\n" + "PRETTY_NAME=\"Ubuntu 16.10\"\n" +
r289436 - [Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)
Author: mgorny Date: Mon Dec 12 09:07:43 2016 New Revision: 289436 URL: http://llvm.org/viewvc/llvm-project?rev=289436&view=rev Log: [Driver] Fix finding multilib gcc install on Gentoo (with gcc-config) Fix the gcc-config code to support multilib gcc installs properly. This solves two problems: -mx32 using the 64-bit gcc directory (due to matching installation triple), and -m32 not respecting gcc-config at all (due to mismatched installation triple). In order to fix the former issue, split the multilib scan out of Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple() (the code is otherwise unchanged), and call it for each installation found via gcc-config. In order to fix the latter issue, split the gcc-config processing out of Generic_GCC::GCCInstallationDetector::init() and repeat it for all triples, including extra and biarch triples. The only change in the gcc-config code itself is adding the call to multilib scan. Convert the gentoo_linux_gcc_multi_version_tree test input to multilib x86_64+32+x32 install, and add appropriate tests to linux-header-search and linux-ld. Differential Revision: https://reviews.llvm.org/D26887 Added: cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32/crtbegin.o cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32/crtbegin.o cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/32/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/32/crtbegin.o cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/x32/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/x32/crtbegin.o Modified: cfe/trunk/lib/Driver/ToolChains.cpp cfe/trunk/lib/Driver/ToolChains.h cfe/trunk/test/Driver/linux-header-search.cpp cfe/trunk/test/Driver/linux-ld.c Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=289436&r1=289435&r2=289436&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Dec 12 09:07:43 2016 @@ -1457,35 +1457,17 @@ void Generic_GCC::GCCInstallationDetecto // in /usr. This avoids accidentally enforcing the system GCC version // when using a custom toolchain. if (GCCToolchainDir == "" || GCCToolchainDir == D.SysRoot + "/usr") { +for (StringRef CandidateTriple : ExtraTripleAliases) { + if (ScanGentooGccConfig(TargetTriple, Args, CandidateTriple)) +return; +} for (StringRef CandidateTriple : CandidateTripleAliases) { - llvm::ErrorOr> File = - D.getVFS().getBufferForFile(D.SysRoot + "/etc/env.d/gcc/config-" + - CandidateTriple.str()); - if (File) { -SmallVector Lines; -File.get()->getBuffer().split(Lines, "\n"); -for (StringRef Line : Lines) { - // CURRENT=triple-version - if (Line.consume_front("CURRENT=")) { -const std::pair ActiveVersion = - Line.rsplit('-'); -// Note: Strictly speaking, we should be reading -// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't -// contain anything new or especially useful to us. -const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + - ActiveVersion.first.str() + "/" + - ActiveVersion.second.str(); -if (D.getVFS().exists(GentooPath + "/crtbegin.o")) { - Version = GCCVersion::Parse(ActiveVersion.second); - GCCInstallPath = GentooPath; - GCCParentLibPath = GentooPath + "/../../.."; - GCCTriple.setTriple(ActiveVersion.first); - IsValid = true; - return; -} - } -} - } + if (ScanGentooGccConfig(TargetTriple, Args, CandidateTriple)) +return; +} +for (StringRef CandidateTriple : CandidateBiarchTripleAliases) { + if (ScanGentooGccConfig(TargetTriple, Args, CandidateTriple, true)) +return; } } @@ -2716,6 +2698,33 @@ void Generic_GCC::GCCInstallationDetecto } } +bool Generic_GCC::GCCInstallationDetector::ScanGCCForMultilibs( +const llvm::Triple &TargetTriple, const ArgList &Args, +StringRef Path, bool NeedsBiarchSuffix) { + llvm::Triple::ArchType TargetArch = TargetTriple.getArch(); + DetectedMultilib
r289440 - [Driver] Attempt to fix new linux-ld tests on Windows
Author: mgorny Date: Mon Dec 12 10:04:37 2016 New Revision: 289440 URL: http://llvm.org/viewvc/llvm-project?rev=289440&view=rev Log: [Driver] Attempt to fix new linux-ld tests on Windows (broken by r289436) Modified: cfe/trunk/test/Driver/linux-ld.c Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=289440&r1=289439&r2=289440&view=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Mon Dec 12 10:04:37 2016 @@ -1674,7 +1674,7 @@ // CHECK-LD-GENTOO: "--eh-frame-hdr" // CHECK-LD-GENTOO: "-m" "elf_x86_64" // CHECK-LD-GENTOO: "-dynamic-linker" -// CHECK-LD-GENTOO: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o" +// CHECK-LD-GENTOO: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3{{/|}}crtbegin.o" // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3" // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib" // CHECK-LD-GENTOO: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.." @@ -1691,7 +1691,7 @@ // CHECK-LD-GENTOO-32: "--eh-frame-hdr" // CHECK-LD-GENTOO-32: "-m" "elf_i386" // CHECK-LD-GENTOO-32: "-dynamic-linker" -// CHECK-LD-GENTOO-32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32/crtbegin.o" +// CHECK-LD-GENTOO-32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32{{/|}}crtbegin.o" // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32" // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib" // CHECK-LD-GENTOO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.." @@ -1708,7 +1708,7 @@ // CHECK-LD-GENTOO-X32: "--eh-frame-hdr" // CHECK-LD-GENTOO-X32: "-m" "elf32_x86_64" // CHECK-LD-GENTOO-X32: "-dynamic-linker" -// CHECK-LD-GENTOO-X32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32/crtbegin.o" +// CHECK-LD-GENTOO-X32: "{{.*}}/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32{{/|}}crtbegin.o" // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/x32" // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib" // CHECK-LD-GENTOO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.." ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284403 - [Driver] Use VFS to perform all distribution checks
Author: mgorny Date: Mon Oct 17 13:07:15 2016 New Revision: 284403 URL: http://llvm.org/viewvc/llvm-project?rev=284403&view=rev Log: [Driver] Use VFS to perform all distribution checks Use the VFS provided by D.getVFS() for all distribution checks, including those performing read of the release file. Requested by @bruno on D24954. Differential Revision: https://reviews.llvm.org/D25641 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284403&r1=284402&r2=284403&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 13:07:15 2016 @@ -3844,7 +3844,7 @@ static bool IsUbuntu(enum Distro Distro) static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { llvm::ErrorOr> File = - llvm::MemoryBuffer::getFile("/etc/lsb-release"); + D.getVFS().getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector Lines; @@ -3876,7 +3876,7 @@ static Distro DetectDistro(const Driver return Version; } - File = llvm::MemoryBuffer::getFile("/etc/redhat-release"); + File = D.getVFS().getBufferForFile("/etc/redhat-release"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release")) @@ -3894,7 +3894,7 @@ static Distro DetectDistro(const Driver return UnknownDistro; } - File = llvm::MemoryBuffer::getFile("/etc/debian_version"); + File = D.getVFS().getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data[0] == '5') ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284493 - [solaris] Fix iswxdigit_l() support function prototype
Author: mgorny Date: Tue Oct 18 11:54:54 2016 New Revision: 284493 URL: http://llvm.org/viewvc/llvm-project?rev=284493&view=rev Log: [solaris] Fix iswxdigit_l() support function prototype Fix the iswxdigit_l() function prototype to take wint_t parameter instead of incorrect wchar_t. Differential Revision: https://reviews.llvm.org/D25431 Modified: libcxx/trunk/src/support/solaris/xlocale.c Modified: libcxx/trunk/src/support/solaris/xlocale.c URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/solaris/xlocale.c?rev=284493&r1=284492&r2=284493&view=diff == --- libcxx/trunk/src/support/solaris/xlocale.c (original) +++ libcxx/trunk/src/support/solaris/xlocale.c Tue Oct 18 11:54:54 2016 @@ -19,7 +19,7 @@ int isxdigit_l(int __c, locale_t __l) { return isxdigit(__c); } -int iswxdigit_l(wchar_t __c, locale_t __l) { +int iswxdigit_l(wint_t __c, locale_t __l) { return isxdigit(__c); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284494 - [solaris] Convert the support library to C++ to fix -std=c++11 build
Author: mgorny Date: Tue Oct 18 11:54:59 2016 New Revision: 284494 URL: http://llvm.org/viewvc/llvm-project?rev=284494&view=rev Log: [solaris] Convert the support library to C++ to fix -std=c++11 build Convert the Solaris xlocale.c compatibility library from plain C to C++ in order to fix the build failures caused by the addition of -std=c++11 to LIBCXX_COMPILE_FLAGS. The additional flag got propagated to the C file, resulting in error with strict compilers. Differential Revision: https://reviews.llvm.org/D25431 Added: libcxx/trunk/src/support/solaris/xlocale.cpp - copied, changed from r284493, libcxx/trunk/src/support/solaris/xlocale.c Removed: libcxx/trunk/src/support/solaris/xlocale.c Modified: libcxx/trunk/lib/CMakeLists.txt Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=284494&r1=284493&r2=284494&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Tue Oct 18 11:54:59 2016 @@ -6,7 +6,7 @@ if(WIN32) file(GLOB LIBCXX_WIN32_SOURCES ../src/support/win32/*.cpp) list(APPEND LIBCXX_SOURCES ${LIBCXX_WIN32_SOURCES}) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") - file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.c) + file(GLOB LIBCXX_SOLARIS_SOURCES ../src/support/solaris/*.cpp) list(APPEND LIBCXX_SOURCES ${LIBCXX_SOLARIS_SOURCES}) endif() Removed: libcxx/trunk/src/support/solaris/xlocale.c URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/solaris/xlocale.c?rev=284493&view=auto == --- libcxx/trunk/src/support/solaris/xlocale.c (original) +++ libcxx/trunk/src/support/solaris/xlocale.c (removed) @@ -1,66 +0,0 @@ -//===--===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===--===// - -#ifdef __sun__ - -#include "support/solaris/xlocale.h" -#include -#include -#include - - -int isxdigit_l(int __c, locale_t __l) { -return isxdigit(__c); -} - -int iswxdigit_l(wint_t __c, locale_t __l) { -return isxdigit(__c); -} - -// FIXME: This disregards the locale, which is Very Wrong -#define vsnprintf_l(__s, __n, __l, __format, __va) \ -vsnprintf(__s, __n, __format, __va) - -int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) -{ - va_list __va; - va_start(__va, __format); - int __res = vsnprintf_l(__s, __n , __l, __format, __va); - va_end(__va); - return __res; -} - -int asprintf_l(char **__s, locale_t __l, const char *__format, ...) { - va_list __va; - va_start(__va, __format); - // FIXME: - int __res = vasprintf(__s, __format, __va); - va_end(__va); - return __res; -} - -int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { - va_list __va; - va_start(__va, __format); - // FIXME: - int __res = vsscanf(__s, __format, __va); - va_end(__va); - return __res; -} - -size_t mbrtowc_l(wchar_t *__pwc, const char *__pmb, - size_t __max, mbstate_t *__ps, locale_t __loc) { - return mbrtowc(__pwc, __pmb, __max, __ps); -} - -struct lconv *localeconv_l(locale_t __l) { - return localeconv(); -} - -#endif // __sun__ Copied: libcxx/trunk/src/support/solaris/xlocale.cpp (from r284493, libcxx/trunk/src/support/solaris/xlocale.c) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/solaris/xlocale.cpp?p2=libcxx/trunk/src/support/solaris/xlocale.cpp&p1=libcxx/trunk/src/support/solaris/xlocale.c&r1=284493&r2=284494&rev=284494&view=diff == --- libcxx/trunk/src/support/solaris/xlocale.c (original) +++ libcxx/trunk/src/support/solaris/xlocale.cpp Tue Oct 18 11:54:59 2016 @@ -14,6 +14,7 @@ #include #include +extern "C" { int isxdigit_l(int __c, locale_t __l) { return isxdigit(__c); @@ -63,4 +64,6 @@ struct lconv *localeconv_l(locale_t __l) return localeconv(); } +}; + #endif // __sun__ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284496 - [cmake] Update lit search to match the one in LLVM
Author: mgorny Date: Tue Oct 18 12:07:30 2016 New Revision: 284496 URL: http://llvm.org/viewvc/llvm-project?rev=284496&view=rev Log: [cmake] Update lit search to match the one in LLVM Update the lit search logic to support all names supported in LLVM (since r283029). The search order (i.e. PATHS vs HINTS) does no really matter since the established path is not used, except for determining whether lit is available. Differential Revision: https://reviews.llvm.org/D23745 Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=284496&r1=284495&r2=284496&view=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Tue Oct 18 12:07:30 2016 @@ -124,6 +124,7 @@ Please install Python or specify the PYT endif() if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) + # Note: path not really used, except for checking if lit was found set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) if(NOT LLVM_UTILS_PROVIDED) add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/FileCheck utils/FileCheck) @@ -140,8 +141,10 @@ Please install Python or specify the PYT endif() else() # Seek installed Lit. - find_program(LLVM_LIT "lit.py" ${LLVM_MAIN_SRC_DIR}/utils/lit -DOC "Path to lit.py") + find_program(LLVM_LIT + NAMES llvm-lit lit.py lit + PATHS "${LLVM_MAIN_SRC_DIR}/utils/lit" + DOC "Path to lit.py") endif() if(LLVM_LIT) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284582 - [cmake] Use LLVM_CMAKE_PATH for GetSVN script
Author: mgorny Date: Wed Oct 19 07:21:39 2016 New Revision: 284582 URL: http://llvm.org/viewvc/llvm-project?rev=284582&view=rev Log: [cmake] Use LLVM_CMAKE_PATH for GetSVN script Use the LLVM_CMAKE_PATH variable to locate the GetSVN.cmake script. The variable was already available in stand-alone builds, and is also set by LLVM since r284581. Modified: cfe/trunk/lib/Basic/CMakeLists.txt Modified: cfe/trunk/lib/Basic/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=284582&r1=284581&r2=284582&view=diff == --- cfe/trunk/lib/Basic/CMakeLists.txt (original) +++ cfe/trunk/lib/Basic/CMakeLists.txt Wed Oct 19 07:21:39 2016 @@ -28,7 +28,7 @@ find_first_existing_vc_file(clang_vc "${ # The VC revision include that we want to generate. set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/SVNVersion.inc") -set(get_svn_script "${LLVM_MAIN_SRC_DIR}/cmake/modules/GetSVN.cmake") +set(get_svn_script "${LLVM_CMAKE_PATH}/GetSVN.cmake") if(DEFINED llvm_vc AND DEFINED clang_vc) # Create custom target to generate the VC revision include. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r284583 - [cmake] Allow testing against installed LLVM with no sources
Author: mgorny Date: Wed Oct 19 07:34:17 2016 New Revision: 284583 URL: http://llvm.org/viewvc/llvm-project?rev=284583&view=rev Log: [cmake] Allow testing against installed LLVM with no sources Adjust the stand-alone build files to accept either CMake files from LLVM_CMAKE_PATH or from LLVM_MAIN_SRC_DIR instead of requiring both. This makes it possible to run libcxx tests on top of installed LLVM and lit, without having to unpack a copy of LLVM sources. Furthermore, it avoids adding duplicate paths. Differential Revision: https://reviews.llvm.org/D25093 Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=284583&r1=284582&r2=284583&view=diff == --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Oct 19 07:34:17 2016 @@ -43,21 +43,16 @@ macro(find_llvm_parts) return() endif() - if (NOT EXISTS ${LLVM_MAIN_SRC_DIR}) + if (EXISTS "${LLVM_CMAKE_PATH}") +list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") + elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules") +list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") + else() set(LLVM_FOUND OFF) -message(WARNING "Not found: ${LLVM_MAIN_SRC_DIR}") +message(WARNING "Neither ${LLVM_CMAKE_PATH} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found") return() endif() - if(NOT EXISTS ${LLVM_CMAKE_PATH}) -set(LLVM_FOUND OFF) -message(WARNING "Not found: ${LLVM_CMAKE_PATH}") -return() - endif() - - list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") - list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") - set(LLVM_FOUND ON) endmacro(find_llvm_parts) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284770 - [Driver] Parse Debian version as integer when possible. NFC
Author: mgorny Date: Thu Oct 20 15:13:35 2016 New Revision: 284770 URL: http://llvm.org/viewvc/llvm-project?rev=284770&view=rev Log: [Driver] Parse Debian version as integer when possible. NFC Replace the string matching for /etc/debian_version with split integer/string matching algorithm. When the file contains 'major.minor' version number, parse the major version as integer and use a switch clause to match it. Otherwise, attempt 'codename/sid' matching using a StringSwitch. Differential Revision: https://reviews.llvm.org/D25696 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284770&r1=284769&r2=284770&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 20 15:13:35 2016 @@ -3905,17 +3905,30 @@ static Distro DetectDistro(const Driver File = D.getVFS().getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); -if (Data[0] == '5') - return DebianLenny; -else if (Data.startswith("squeeze/sid") || Data[0] == '6') - return DebianSqueeze; -else if (Data.startswith("wheezy/sid") || Data[0] == '7') - return DebianWheezy; -else if (Data.startswith("jessie/sid") || Data[0] == '8') - return DebianJessie; -else if (Data.startswith("stretch/sid") || Data[0] == '9') - return DebianStretch; -return UnknownDistro; +// Contents: < major.minor > or < codename/sid > +int MajorVersion; +if (!Data.split('.').first.getAsInteger(10, MajorVersion)) { + switch (MajorVersion) { + case 5: +return DebianLenny; + case 6: +return DebianSqueeze; + case 7: +return DebianWheezy; + case 8: +return DebianJessie; + case 9: +return DebianStretch; + default: +return UnknownDistro; + } +} +return llvm::StringSwitch(Data.split("\n").first) +.Case("squeeze/sid", DebianSqueeze) +.Case("wheezy/sid", DebianWheezy) +.Case("jessie/sid", DebianJessie) +.Case("stretch/sid", DebianStretch) +.Default(UnknownDistro); } if (D.getVFS().exists("/etc/SuSE-release")) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r284774 - [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC
Author: mgorny Date: Thu Oct 20 15:45:40 2016 New Revision: 284774 URL: http://llvm.org/viewvc/llvm-project?rev=284774&view=rev Log: [Driver] Refactor DetectDistro() parameters to take VFS ref only. NFC Refactor the DetectDistro() function to take a single vfs::FileSystem reference only, instead of Driver and llvm::Triple::ArchType. The ArchType parameter was not used anyway, and Driver was only used to obtain the VFS. Aside to making the API simpler and more transparent, it makes it easier to add unit tests for the function in the future -- since the tests would need only to provide an appropriate VFS. Differential Revision: https://reviews.llvm.org/D25819 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284774&r1=284773&r2=284774&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 20 15:45:40 2016 @@ -3850,9 +3850,9 @@ static bool IsUbuntu(enum Distro Distro) return Distro >= UbuntuHardy && Distro <= UbuntuYakkety; } -static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { +static Distro DetectDistro(vfs::FileSystem &VFS) { llvm::ErrorOr> File = - D.getVFS().getBufferForFile("/etc/lsb-release"); + VFS.getBufferForFile("/etc/lsb-release"); if (File) { StringRef Data = File.get()->getBuffer(); SmallVector Lines; @@ -3884,7 +3884,7 @@ static Distro DetectDistro(const Driver return Version; } - File = D.getVFS().getBufferForFile("/etc/redhat-release"); + File = VFS.getBufferForFile("/etc/redhat-release"); if (File) { StringRef Data = File.get()->getBuffer(); if (Data.startswith("Fedora release")) @@ -3902,7 +3902,7 @@ static Distro DetectDistro(const Driver return UnknownDistro; } - File = D.getVFS().getBufferForFile("/etc/debian_version"); + File = VFS.getBufferForFile("/etc/debian_version"); if (File) { StringRef Data = File.get()->getBuffer(); // Contents: < major.minor > or < codename/sid > @@ -3931,13 +3931,13 @@ static Distro DetectDistro(const Driver .Default(UnknownDistro); } - if (D.getVFS().exists("/etc/SuSE-release")) + if (VFS.exists("/etc/SuSE-release")) return OpenSUSE; - if (D.getVFS().exists("/etc/exherbo-release")) + if (VFS.exists("/etc/exherbo-release")) return Exherbo; - if (D.getVFS().exists("/etc/arch-release")) + if (VFS.exists("/etc/arch-release")) return ArchLinux; return UnknownDistro; @@ -4122,7 +4122,7 @@ Linux::Linux(const Driver &D, const llvm GCCInstallation.getTriple().str() + "/bin") .str()); - Distro Distro = DetectDistro(D, Arch); + Distro Distro = DetectDistro(D.getVFS()); if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { ExtraOpts.push_back("-z"); @@ -4326,7 +4326,7 @@ std::string Linux::getDynamicLinker(cons const llvm::Triple::ArchType Arch = getArch(); const llvm::Triple &Triple = getTriple(); - const enum Distro Distro = DetectDistro(getDriver(), Arch); + const enum Distro Distro = DetectDistro(getDriver().getVFS()); if (Triple.isAndroid()) return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker"; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r285074 - [Driver] Support obtaining active toolchain from gcc-config on Gentoo
Author: mgorny Date: Tue Oct 25 10:07:41 2016 New Revision: 285074 URL: http://llvm.org/viewvc/llvm-project?rev=285074&view=rev Log: [Driver] Support obtaining active toolchain from gcc-config on Gentoo Support using gcc-config to determine the correct GCC toolchain location on Gentoo. In order to do that, attempt to read gcc-config configuration form [[sysroot]]/etc/env.d/gcc, if no custom toolchain location is provided. Differential Revision: https://reviews.llvm.org/D25661 Added: cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/config-x86_64-pc-linux-gnu cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/x86_64-pc-linux-gnu-4.9.3 cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/gentoo-release cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/include/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/include/.keep cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/.keep cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/crtbegin.o cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5.4.0/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5.4.0/.keep cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/x86_64-pc-linux-gnu/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/x86_64-pc-linux-gnu/lib/ cfe/trunk/test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/x86_64-pc-linux-gnu/lib/.keep Modified: cfe/trunk/lib/Driver/ToolChains.cpp cfe/trunk/test/Driver/linux-header-search.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=285074&r1=285073&r2=285074&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 25 10:07:41 2016 @@ -1438,6 +1438,43 @@ void Generic_GCC::GCCInstallationDetecto } } + // Try to respect gcc-config on Gentoo. However, do that only + // if --gcc-toolchain is not provided or equal to the Gentoo install + // in /usr. This avoids accidentally enforcing the system GCC version + // when using a custom toolchain. + if (GCCToolchainDir == "" || GCCToolchainDir == D.SysRoot + "/usr") { +for (StringRef CandidateTriple : CandidateTripleAliases) { + llvm::ErrorOr> File = + D.getVFS().getBufferForFile(D.SysRoot + "/etc/env.d/gcc/config-" + + CandidateTriple.str()); + if (File) { +SmallVector Lines; +File.get()->getBuffer().split(Lines, "\n"); +for (StringRef Line : Lines) { + // CURRENT=triple-version + if (Line.consume_front("CURRENT=")) { +const std::pair ActiveVersion = + Line.rsplit('-'); +// Note: Strictly speaking, we should be reading +// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't +// contain anything new or especially useful to us. +const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + + ActiveVersion.first.str() + "/" + + ActiveVersion.second.str(); +if (D.getVFS().exists(GentooPath +
r285076 - [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
Author: mgorny Date: Tue Oct 25 10:33:32 2016 New Revision: 285076 URL: http://llvm.org/viewvc/llvm-project?rev=285076&view=rev Log: [Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older Disable the OpenSUSE rules for OpenSUSE versions older than 11 as they are incompatible with the old binutils on that distribution. Differential Revision: https://reviews.llvm.org/D24954 Modified: cfe/trunk/lib/Driver/ToolChains.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=285076&r1=285075&r2=285076&view=diff == --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 25 10:33:32 2016 @@ -3968,8 +3968,25 @@ static Distro DetectDistro(vfs::FileSyst .Default(UnknownDistro); } - if (VFS.exists("/etc/SuSE-release")) -return OpenSUSE; + File = VFS.getBufferForFile("/etc/SuSE-release"); + if (File) { +StringRef Data = File.get()->getBuffer(); +SmallVector Lines; +Data.split(Lines, "\n"); +for (const StringRef& Line : Lines) { + if (!Line.trim().startswith("VERSION")) +continue; + std::pair SplitLine = Line.split('='); + int Version; + // OpenSUSE/SLES 10 and older are not supported and not compatible + // with our rules, so just treat them as UnknownDistro. + if (!SplitLine.second.trim().getAsInteger(10, Version) && + Version > 10) +return OpenSUSE; + return UnknownDistro; +} +return UnknownDistro; + } if (VFS.exists("/etc/exherbo-release")) return Exherbo; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r285741 - [test] Fix detecting LLVM zlib support in stand-alone builds
Author: mgorny Date: Tue Nov 1 15:31:52 2016 New Revision: 285741 URL: http://llvm.org/viewvc/llvm-project?rev=285741&view=rev Log: [test] Fix detecting LLVM zlib support in stand-alone builds Fix the test run to declare missing HAVE_LIBZ value in stand-alone builds, using the LLVM_ENABLE_ZLIB that is exported in LLVMConfig.cmake. When using in-tree builds, HAVE_LIBZ is declared in cmake/config-ix.cmake as a result of LLVM's CMake checks. When building stand-alone, this value is not available and as a result caused clang to wrongly assume that LLVM was built without zlib support. To fix it, set it to the value of LLVM_ENABLE_ZLIB. While this variable is originally used to control the user preference, LLVM updates its value to 0 if zlib checks fail. Therefore, we can use it to reliably determine whether LLVM was built with zlib support or not. Differential Revision: https://reviews.llvm.org/D24869 Modified: cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=285741&r1=285740&r2=285741&view=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Tue Nov 1 15:31:52 2016 @@ -9,6 +9,15 @@ endif () string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) +if(CLANG_BUILT_STANDALONE) + # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This + # value is forced to 0 if zlib was not found, so it is fine to use it + # instead of HAVE_LIBZ (not recorded). + if(LLVM_ENABLE_ZLIB) +set(HAVE_LIBZ 1) + endif() +endif() + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits