Re: [PATCH] D62445: [test] Fix plugin tests
Just saw this. I'll take a look, and thanks for pointing it out... On Fri, Aug 2, 2019 at 6:24 PM Artem Dergachev via Phabricator < revi...@reviews.llvm.org> wrote: > NoQ added a comment. > > Ugh, there seems to be one more forgotten buildbot with plugins problems: > http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6406/consoleText > > FAIL: Clang :: Analysis/checker-plugins.c (467 of 14955) > TEST 'Clang :: Analysis/checker-plugins.c' FAILED > > Script: > -- > : 'RUN: at line 3'; > > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/lib/clang/9.0.0/include > -nostdsysteminc -analyze -analyzer-constraints=range -verify > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -load > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/./lib/SampleAnalyzerPlugin.dylib > -analyzer-checker='example.MainCallChecker' > : 'RUN: at line 15'; > > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/lib/clang/9.0.0/include > -nostdsysteminc -analyze -analyzer-constraints=range > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -load > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/./lib/CheckerDependencyHandlingAnalyzerPlugin.dylib > -analyzer-checker=example.DependendentChecker > -analyzer-list-enabled-checkers2>&1 | > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/FileCheck > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -check-prefix=CHECK-IMPLICITLY-ENABLED > : 'RUN: at line 24'; > > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/lib/clang/9.0.0/include > -nostdsysteminc -analyze -analyzer-constraints=range > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -load > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/./lib/CheckerDependencyHandlingAnalyzerPlugin.dylib > -analyzer-checker=example.DependendentChecker > -analyzer-disable-checker=example.Dependency > -analyzer-list-enabled-checkers2>&1 | > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/FileCheck > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -check-prefix=CHECK-IMPLICITLY-DISABLED > : 'RUN: at line 34'; > > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/lib/clang/9.0.0/include > -nostdsysteminc -analyze -analyzer-constraints=range > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -load > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/./lib/CheckerOptionHandlingAnalyzerPlugin.dylib > -analyzer-checker=example.MyChecker2>&1 | > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/FileCheck > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -check-prefix=CHECK-CHECKER-OPTION-OUTPUT > : 'RUN: at line 41'; > > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/lib/clang/9.0.0/include > -nostdsysteminc -analyze -analyzer-constraints=range > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -load > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/./lib/CheckerOptionHandlingAnalyzerPlugin.dylib > -analyzer-checker=example.MyChecker-analyzer-config > example.MyChecker:ExampleOption=true2>&1 | > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/FileCheck > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/llvm/tools/clang/test/Analysis/checker-plugins.c > -check-prefix=CHECK-CHECKER-OPTION-OUTPUT-TRUE > : 'RUN: at line 49'; > > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/bin/clang > -cc1 -internal-isystem > /Users/buildslave/jenkins/workspace/clang-stage2-cmake-RgSan/clang-build/lib/clang/9.0.0/include > -nostdsysteminc -analyze -analyzer-constraints=range >
[clang-tools-extra] r365675 - Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class."
Author: dhinton Date: Wed Jul 10 10:57:05 2019 New Revision: 365675 URL: http://llvm.org/viewvc/llvm-project?rev=365675=rev Log: Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class." Previously reverted in 364141 due to buildbot breakage, and fixed here by making GeneralCategory global a ManagedStatic. Summary: This change processes `OptionCategory`s and `SubCommand`s as they are seen instead of caching them in the Option class and processing them later. Doing so simplifies the work needed to be done by the Global parser and significantly reduces the size of the Option class to a mere 64 bytes. Removing the `OptionCategory` cache saved 24 bytes, and removing the `SubCommand` cache saved an additional 48 bytes, for a total of a 72 byte reduction. Reviewed By: serge-sans-paille Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D62105 Modified: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp Modified: clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp?rev=365675=365674=365675=diff == --- clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp (original) +++ clang-tools-extra/trunk/clangd/index/dex/dexp/Dexp.cpp Wed Jul 10 10:57:05 2019 @@ -77,7 +77,7 @@ class Command { // By resetting the parser options, we lost the standard -help flag. llvm::cl::opt> Help{ "help", llvm::cl::desc("Display available options"), - llvm::cl::ValueDisallowed, llvm::cl::cat(llvm::cl::GeneralCategory)}; + llvm::cl::ValueDisallowed}; virtual void run() = 0; protected: Modified: clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp?rev=365675=365674=365675=diff == --- clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp (original) +++ clang-tools-extra/trunk/clangd/indexer/IndexerMain.cpp Wed Jul 10 10:57:05 2019 @@ -110,7 +110,7 @@ int main(int argc, const char **argv) { )"; auto Executor = clang::tooling::createExecutorFromCommandLineArgs( - argc, argv, llvm::cl::GeneralCategory, Overview); + argc, argv, *llvm::cl::GeneralCategory, Overview); if (!Executor) { llvm::errs() << llvm::toString(Executor.takeError()) << "\n"; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r365675 - Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class."
Author: dhinton Date: Wed Jul 10 10:57:05 2019 New Revision: 365675 URL: http://llvm.org/viewvc/llvm-project?rev=365675=rev Log: Recommit "[CommandLine] Remove OptionCategory and SubCommand caches from the Option class." Previously reverted in 364141 due to buildbot breakage, and fixed here by making GeneralCategory global a ManagedStatic. Summary: This change processes `OptionCategory`s and `SubCommand`s as they are seen instead of caching them in the Option class and processing them later. Doing so simplifies the work needed to be done by the Global parser and significantly reduces the size of the Option class to a mere 64 bytes. Removing the `OptionCategory` cache saved 24 bytes, and removing the `SubCommand` cache saved an additional 48 bytes, for a total of a 72 byte reduction. Reviewed By: serge-sans-paille Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D62105 Modified: cfe/trunk/tools/clang-refactor/ClangRefactor.cpp Modified: cfe/trunk/tools/clang-refactor/ClangRefactor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-refactor/ClangRefactor.cpp?rev=365675=365674=365675=diff == --- cfe/trunk/tools/clang-refactor/ClangRefactor.cpp (original) +++ cfe/trunk/tools/clang-refactor/ClangRefactor.cpp Wed Jul 10 10:57:05 2019 @@ -38,11 +38,9 @@ namespace opts { static cl::OptionCategory CommonRefactorOptions("Refactoring options"); static cl::opt Verbose("v", cl::desc("Use verbose output"), - cl::cat(cl::GeneralCategory), cl::sub(*cl::AllSubCommands)); static cl::opt Inplace("i", cl::desc("Inplace edit s"), - cl::cat(cl::GeneralCategory), cl::sub(*cl::AllSubCommands)); } // end namespace opts @@ -611,7 +609,7 @@ int main(int argc, const char **argv) { ClangRefactorTool RefactorTool; CommonOptionsParser Options( - argc, argv, cl::GeneralCategory, cl::ZeroOrMore, + argc, argv, *cl::GeneralCategory, cl::ZeroOrMore, "Clang-based refactoring tool for C, C++ and Objective-C"); if (auto Err = RefactorTool.Init()) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r363521 - [docs] Fix another bot error by setting highlight language of objc code-block to objc instead of c++.
Author: dhinton Date: Sun Jun 16 12:15:04 2019 New Revision: 363521 URL: http://llvm.org/viewvc/llvm-project?rev=363521=rev Log: [docs] Fix another bot error by setting highlight language of objc code-block to objc instead of c++. Modified: cfe/trunk/docs/ReleaseNotes.rst Modified: cfe/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=363521=363520=363521=diff == --- cfe/trunk/docs/ReleaseNotes.rst (original) +++ cfe/trunk/docs/ReleaseNotes.rst Sun Jun 16 12:15:04 2019 @@ -127,7 +127,7 @@ Objective-C Language Changes in Clang - Fixed encoding of ObjC pointer types that are pointers to typedefs. -.. code-block:: c++ +.. code-block:: objc typedef NSArray MyArray; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r363520 - [docs] Fix another bot warning by adding a blank line to separate the `option::` command from the text below.
Author: dhinton Date: Sun Jun 16 11:41:31 2019 New Revision: 363520 URL: http://llvm.org/viewvc/llvm-project?rev=363520=rev Log: [docs] Fix another bot warning by adding a blank line to separate the `option::` command from the text below. Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst?rev=363520=363519=363520=diff == --- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.rst Sun Jun 16 11:41:31 2019 @@ -34,6 +34,7 @@ Options be important to not initialize fixed-size array members. Default is `0`. .. option:: UseAssignment + If set to non-zero, the check will provide fix-its with literal initializers \( ``int i = 0;`` \) instead of curly braces \( ``int i{};`` \). ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r363518 - [docs] Fix a few problems with clang-tool docs to get the bots green again.
Author: dhinton Date: Sun Jun 16 10:57:37 2019 New Revision: 363518 URL: http://llvm.org/viewvc/llvm-project?rev=363518=rev Log: [docs] Fix a few problems with clang-tool docs to get the bots green again. Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-pipe.rst Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=363518=363517=363518=diff == --- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original) +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Sun Jun 16 10:57:37 2019 @@ -192,11 +192,12 @@ Improvements to clang-tidy Rewrites function signatures to use a trailing return type. - The :doc:`misc-throw-by-value-catch-by-reference - ` now supports + ` now supports `WarnOnLargeObject` and `MaxSize` options to warn on any large trivial object caught by value. -- Added `UseAssignment` option to :doc:`cppcoreguidelines-pro-type-member-init` +- Added `UseAssignment` option to :doc:`cppcoreguidelines-pro-type-member-init + ` If set to true, the check will provide fix-its with literal initializers (``int i = 0;``) instead of curly braces (``int i{};``). Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-pipe.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-pipe.rst?rev=363518=363517=363518=diff == --- clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-pipe.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/android-cloexec-pipe.rst Sun Jun 16 10:57:37 2019 @@ -17,4 +17,5 @@ Examples: Suggested replacement: .. code-block:: c++ + pipe2(pipefd, O_CLOEXEC); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r363504 - Fix gcc-05.4 bot failures caused by in r363481 "[clangd] Index API and implementations for relations"
Author: dhinton Date: Sat Jun 15 18:09:41 2019 New Revision: 363504 URL: http://llvm.org/viewvc/llvm-project?rev=363504=rev Log: Fix gcc-05.4 bot failures caused by in r363481 "[clangd] Index API and implementations for relations" Use std::make_tuple instead of initializer list to make gcc-5.4 happy. See https://reviews.llvm.org/D62839 for details. Modified: clang-tools-extra/trunk/clangd/index/FileIndex.cpp Modified: clang-tools-extra/trunk/clangd/index/FileIndex.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/FileIndex.cpp?rev=363504=363503=363504=diff == --- clang-tools-extra/trunk/clangd/index/FileIndex.cpp (original) +++ clang-tools-extra/trunk/clangd/index/FileIndex.cpp Sat Jun 15 18:09:41 2019 @@ -72,7 +72,8 @@ static SlabTuple indexSymbols(ASTContext " relations slab: {7} relations, {8} bytes", FileName, IsIndexMainAST, Syms.size(), Syms.bytes(), Refs.size(), Refs.numRefs(), Refs.bytes(), Relations.size(), Relations.bytes()); - return {std::move(Syms), std::move(Refs), std::move(Relations)}; + return std::make_tuple(std::move(Syms), std::move(Refs), + std::move(Relations)); } SlabTuple indexMainDecls(ParsedAST ) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r363502 - Recommit r363298 "[lit] Disable test on darwin when building shared libs."
Author: dhinton Date: Sat Jun 15 13:09:54 2019 New Revision: 363502 URL: http://llvm.org/viewvc/llvm-project?rev=363502=rev Log: Recommit r363298 "[lit] Disable test on darwin when building shared libs." Was reverted in r363379 due to build breakage. Thanks to Nico Weber for reverting the original and suggesting the fix. Please see https://reviews.llvm.org/D61697 Modified: cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp cfe/trunk/test/lit.cfg.py 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=363502=363501=363502=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 Sat Jun 15 13:09:54 2019 @@ -16,5 +16,7 @@ // // ^ -ccc-install-dir passed to unbreak tests on *BSD where // getMainExecutable() relies on real argv[0] being passed +// +// UNSUPPORTED: enable_shared #include vector v; Modified: cfe/trunk/test/lit.cfg.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=363502=363501=363502=diff == --- cfe/trunk/test/lit.cfg.py (original) +++ cfe/trunk/test/lit.cfg.py Sat Jun 15 13:09:54 2019 @@ -183,3 +183,6 @@ if macOSSDKVersion is not None: if os.path.exists('/etc/gentoo-release'): config.available_features.add('gentoo') + +if config.enable_shared: +config.available_features.add("enable_shared") ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r363298 - [lit] Disable test on darwin when building shared libs.
Author: dhinton Date: Thu Jun 13 12:08:49 2019 New Revision: 363298 URL: http://llvm.org/viewvc/llvm-project?rev=363298=rev Log: [lit] Disable test on darwin when building shared libs. Summary: This test fails to link shared libraries because tries to run a copied version of clang-check to see if the mock version of libcxx in the same directory can be loaded dynamically. Since the test is specifically designed not to look in the default just-built lib directory, it must be disabled when building with BUILD_SHARED_LIBS=ON. Currently only disabling it on Darwin and basing it on the enable_shared flag. Reviewed By: ilya-biryukov Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61697 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=363298=363297=363298=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 Thu Jun 13 12:08:49 2019 @@ -16,5 +16,7 @@ // // ^ -ccc-install-dir passed to unbreak tests on *BSD where // getMainExecutable() relies on real argv[0] being passed +// +// UNSUPPORTED: enable_shared #include vector v; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362555 - [Analysis] Only build Analysis plugins when CLANG_ENABLE_STATIC_ANALYZER is enabled.
Author: dhinton Date: Tue Jun 4 15:07:40 2019 New Revision: 362555 URL: http://llvm.org/viewvc/llvm-project?rev=362555=rev Log: [Analysis] Only build Analysis plugins when CLANG_ENABLE_STATIC_ANALYZER is enabled. Fixes bug introduced in r362328. Thanks to Nathan Chancellor for reporting this! Modified: cfe/trunk/lib/Analysis/plugins/CMakeLists.txt Modified: cfe/trunk/lib/Analysis/plugins/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CMakeLists.txt?rev=362555=362554=362555=diff == --- cfe/trunk/lib/Analysis/plugins/CMakeLists.txt (original) +++ cfe/trunk/lib/Analysis/plugins/CMakeLists.txt Tue Jun 4 15:07:40 2019 @@ -1,4 +1,4 @@ -if(LLVM_ENABLE_PLUGINS) +if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS) add_subdirectory(SampleAnalyzer) add_subdirectory(CheckerDependencyHandling) add_subdirectory(CheckerOptionHandling) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362334 - Fix bug in r362328 -- append to dependency list instead of overwrite it.
Author: dhinton Date: Sun Jun 2 10:56:26 2019 New Revision: 362334 URL: http://llvm.org/viewvc/llvm-project?rev=362334=rev Log: Fix bug in r362328 -- append to dependency list instead of overwrite it. 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=362334=362333=362334=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Sun Jun 2 10:56:26 2019 @@ -121,7 +121,7 @@ endif() if (CLANG_ENABLE_STATIC_ANALYZER) if (LLVM_ENABLE_PLUGINS) -set(CLANG_TEST_DEPS +list(APPEND CLANG_TEST_DEPS SampleAnalyzerPlugin CheckerDependencyHandlingAnalyzerPlugin CheckerOptionHandlingAnalyzerPlugin ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362328 - [test] Fix plugin tests
Author: dhinton Date: Sun Jun 2 08:53:43 2019 New Revision: 362328 URL: http://llvm.org/viewvc/llvm-project?rev=362328=rev Log: [test] Fix plugin tests Recommit of r361790 that was temporarily reverted in r361793 due to bot breakage. Summary: The following changes were required to fix these tests: 1) Change LLVM_ENABLE_PLUGINS to an option and move it to llvm/CMakeLists.txt with an appropriate default -- which matches the original default behavior. 2) Move the plugins directory from clang/test/Analysis clang/lib/Analysis. It's not enough to add an exclude to the lit.local.cfg file because add_lit_testsuites recurses the tree and automatically adds the appropriate `check-` targets, which don't make sense for the plugins because they aren't tests and don't have `RUN` statements. Here's a list of the `clang-check-anlysis*` targets with this change: ``` $ ninja -t targets all| sed -n "s/.*\/\(check[^:]*\):.*/\1/p" | sort -u | grep clang-analysis check-clang-analysis check-clang-analysis-checkers check-clang-analysis-copypaste check-clang-analysis-diagnostics check-clang-analysis-engine check-clang-analysis-exploration_order check-clang-analysis-html_diagnostics check-clang-analysis-html_diagnostics-relevant_lines check-clang-analysis-inlining check-clang-analysis-objc check-clang-analysis-unified-sources check-clang-analysis-z3 ``` 3) Simplify the logic and only include the subdirectories under clang/lib/Analysis/plugins if LLVM_ENABLE_PLUGINS is set. Reviewed By: NoQ Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62445 Added: cfe/trunk/lib/Analysis/plugins/ cfe/trunk/lib/Analysis/plugins/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/ cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/ cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/ cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports Removed: cfe/trunk/test/Analysis/plugins/ Modified: cfe/trunk/lib/Analysis/CMakeLists.txt cfe/trunk/test/Analysis/lit.local.cfg cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/lib/Analysis/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CMakeLists.txt?rev=362328=362327=362328=diff == --- cfe/trunk/lib/Analysis/CMakeLists.txt (original) +++ cfe/trunk/lib/Analysis/CMakeLists.txt Sun Jun 2 08:53:43 2019 @@ -34,3 +34,5 @@ add_clang_library(clangAnalysis clangBasic clangLex ) + +add_subdirectory(plugins) Added: cfe/trunk/lib/Analysis/plugins/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CMakeLists.txt?rev=362328=auto == --- cfe/trunk/lib/Analysis/plugins/CMakeLists.txt (added) +++ cfe/trunk/lib/Analysis/plugins/CMakeLists.txt Sun Jun 2 08:53:43 2019 @@ -0,0 +1,5 @@ +if(LLVM_ENABLE_PLUGINS) + add_subdirectory(SampleAnalyzer) + add_subdirectory(CheckerDependencyHandling) + add_subdirectory(CheckerOptionHandling) +endif() Added: cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt?rev=362328=auto == --- cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt (added) +++ cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt Sun Jun 2 08:53:43 2019 @@ -0,0 +1,10 @@ +set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CheckerDependencyHandlingAnalyzerPlugin.exports) +add_llvm_library(CheckerDependencyHandlingAnalyzerPlugin MODULE CheckerDependencyHandling.cpp PLUGIN_TOOL clang) + +target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE + clangAnalysis + clangAST + clangStaticAnalyzerCore + clangStaticAnalyzerFrontend + LLVMSupport + ) Added: cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp?rev=362328=auto
r361793 - Revert [test] Fix plugin tests
Author: dhinton Date: Mon May 27 23:38:16 2019 New Revision: 361793 URL: http://llvm.org/viewvc/llvm-project?rev=361793=rev Log: Revert [test] Fix plugin tests This reverts r361790 (git commit fe5eaab2b5b4523886bd63aebcfea8cfce586fa1) It's causing buildbot breakage, so reverting while I investigate. Added: cfe/trunk/test/Analysis/plugins/ cfe/trunk/test/Analysis/plugins/CMakeLists.txt cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/ cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/ cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports cfe/trunk/test/Analysis/plugins/SampleAnalyzer/ cfe/trunk/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt cfe/trunk/test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp cfe/trunk/test/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports Removed: cfe/trunk/lib/Analysis/plugins/ Modified: cfe/trunk/lib/Analysis/CMakeLists.txt cfe/trunk/test/Analysis/lit.local.cfg cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/lib/Analysis/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CMakeLists.txt?rev=361793=361792=361793=diff == --- cfe/trunk/lib/Analysis/CMakeLists.txt (original) +++ cfe/trunk/lib/Analysis/CMakeLists.txt Mon May 27 23:38:16 2019 @@ -34,5 +34,3 @@ add_clang_library(clangAnalysis clangBasic clangLex ) - -add_subdirectory(plugins) Modified: cfe/trunk/test/Analysis/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lit.local.cfg?rev=361793=361792=361793=diff == --- cfe/trunk/test/Analysis/lit.local.cfg (original) +++ cfe/trunk/test/Analysis/lit.local.cfg Mon May 27 23:38:16 2019 @@ -18,5 +18,7 @@ config.substitutions.append(('%diff_plis config.substitutions.append(('%diff_sarif', '''diff -U1 -w -I ".*file:.*%basename_t" -I '"version":' -I "2\.0\.0\-csd\.[0-9]*\.beta\."''')) +config.excludes.add('plugins') + if not config.root.clang_staticanalyzer: config.unsupported = True Added: cfe/trunk/test/Analysis/plugins/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plugins/CMakeLists.txt?rev=361793=auto == --- cfe/trunk/test/Analysis/plugins/CMakeLists.txt (added) +++ cfe/trunk/test/Analysis/plugins/CMakeLists.txt Mon May 27 23:38:16 2019 @@ -0,0 +1,12 @@ +add_subdirectory(SampleAnalyzer) +add_subdirectory(CheckerDependencyHandling) +add_subdirectory(CheckerOptionHandling) + +set(CLANG_ANALYZER_PLUGIN_DEPS + SampleAnalyzerPlugin + CheckerDependencyHandlingAnalyzerPlugin + CheckerOptionHandlingAnalyzerPlugin + ) + +add_custom_target(clang-analyzer-plugin + DEPENDS ${CLANG_ANALYZER_PLUGIN_DEPS}) Added: cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt?rev=361793=auto == --- cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt (added) +++ cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt Mon May 27 23:38:16 2019 @@ -0,0 +1,11 @@ +set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CheckerDependencyHandlingAnalyzerPlugin.exports) +add_llvm_library(CheckerDependencyHandlingAnalyzerPlugin MODULE CheckerDependencyHandling.cpp PLUGIN_TOOL clang) + +if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) + target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE +clangAnalysis +clangAST +clangStaticAnalyzerCore +LLVMSupport +) +endif() Added: cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp?rev=361793=auto == --- cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp (added) +++ cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp Mon May 27 23:38:16 2019 @@ -0,0 +1,28 @@ +#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" +#include "clang/StaticAnalyzer/Core/Checker.h"
r361790 - [test] Fix plugin tests
Author: dhinton Date: Mon May 27 23:26:58 2019 New Revision: 361790 URL: http://llvm.org/viewvc/llvm-project?rev=361790=rev Log: [test] Fix plugin tests Summary: The following changes were required to fix these tests: 1) Change LLVM_ENABLE_PLUGINS to an option and move it to llvm/CMakeLists.txt with an appropriate default -- which matches the original default behavior. 2) Move the plugins directory from clang/test/Analysis clang/lib/Analysis. It's not enough to add an exclude to the lit.local.cfg file because add_lit_testsuites recurses the tree and automatically adds the appropriate `check-` targets, which don't make sense for the plugins because they aren't tests and don't have `RUN` statements. Here's a list of the `clang-check-anlysis*` targets with this change: ``` $ ninja -t targets all| sed -n "s/.*\/\(check[^:]*\):.*/\1/p" | sort -u | grep clang-analysis check-clang-analysis check-clang-analysis-checkers check-clang-analysis-copypaste check-clang-analysis-diagnostics check-clang-analysis-engine check-clang-analysis-exploration_order check-clang-analysis-html_diagnostics check-clang-analysis-html_diagnostics-relevant_lines check-clang-analysis-inlining check-clang-analysis-objc check-clang-analysis-unified-sources check-clang-analysis-z3 ``` 3) Simplify the logic and only include the subdirectories under clang/lib/Analysis/plugins if LLVM_ENABLE_PLUGINS is set. Reviewed By: NoQ Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62445 Added: cfe/trunk/lib/Analysis/plugins/ cfe/trunk/lib/Analysis/plugins/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/ cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/ cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp cfe/trunk/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/ cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp cfe/trunk/lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports Removed: cfe/trunk/test/Analysis/plugins/ Modified: cfe/trunk/lib/Analysis/CMakeLists.txt cfe/trunk/test/Analysis/lit.local.cfg cfe/trunk/test/CMakeLists.txt Modified: cfe/trunk/lib/Analysis/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CMakeLists.txt?rev=361790=361789=361790=diff == --- cfe/trunk/lib/Analysis/CMakeLists.txt (original) +++ cfe/trunk/lib/Analysis/CMakeLists.txt Mon May 27 23:26:58 2019 @@ -34,3 +34,5 @@ add_clang_library(clangAnalysis clangBasic clangLex ) + +add_subdirectory(plugins) Added: cfe/trunk/lib/Analysis/plugins/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CMakeLists.txt?rev=361790=auto == --- cfe/trunk/lib/Analysis/plugins/CMakeLists.txt (added) +++ cfe/trunk/lib/Analysis/plugins/CMakeLists.txt Mon May 27 23:26:58 2019 @@ -0,0 +1,5 @@ +if(LLVM_ENABLE_PLUGINS) + add_subdirectory(SampleAnalyzer) + add_subdirectory(CheckerDependencyHandling) + add_subdirectory(CheckerOptionHandling) +endif() Added: cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt?rev=361790=auto == --- cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt (added) +++ cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt Mon May 27 23:26:58 2019 @@ -0,0 +1,10 @@ +set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CheckerDependencyHandlingAnalyzerPlugin.exports) +add_llvm_library(CheckerDependencyHandlingAnalyzerPlugin MODULE CheckerDependencyHandling.cpp PLUGIN_TOOL clang) + +target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE + clangAnalysis + clangAST + clangStaticAnalyzerCore + clangStaticAnalyzerFrontend + LLVMSupport + ) Added: cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp?rev=361790=auto == ---
Re: r361340 - [Analysis] Link library dependencies to Analysis plugins
I've submitted a patch to fix this, https://reviews.llvm.org/D62445. Without it, non of the bots can build/test any plugins. On Fri, May 24, 2019 at 5:47 PM Akira Hatanaka via cfe-commits < cfe-commits@lists.llvm.org> wrote: > I reverted the patch in r361685 to make the bot green again. > > > On May 23, 2019, at 5:22 PM, Akira Hatanaka wrote: > > > > Hi Petr, > > > > This seems to have caused Analysis/checker-plugins.c to fail. Can you > investigate it or revert your commit? > > > > > http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/6381/consoleFull#-5275661368254eaf0-7326-4999-85b0-388101f2d404 > > > >> On May 21, 2019, at 5:47 PM, Petr Hosek via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> > >> Author: phosek > >> Date: Tue May 21 17:47:37 2019 > >> New Revision: 361340 > >> > >> URL: http://llvm.org/viewvc/llvm-project?rev=361340=rev > >> Log: > >> [Analysis] Link library dependencies to Analysis plugins > >> > >> These are needed to avoid undefined symbols which aren't satisfied > >> by Clang itself. > >> > >> Differential Revision: https://reviews.llvm.org/D62174 > >> > >> Modified: > >> > cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt > >> cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt > >> cfe/trunk/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt > >> > >> Modified: > cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt > >> URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt?rev=361340=361339=361340=diff > >> > == > >> --- > cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt > (original) > >> +++ > cfe/trunk/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt > Tue May 21 17:47:37 2019 > >> @@ -1,11 +1,12 @@ > >> set(LLVM_EXPORTED_SYMBOL_FILE > ${CMAKE_CURRENT_SOURCE_DIR}/CheckerDependencyHandlingAnalyzerPlugin.exports) > >> add_llvm_library(CheckerDependencyHandlingAnalyzerPlugin MODULE > CheckerDependencyHandling.cpp PLUGIN_TOOL clang) > >> > >> -if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) > >> +if(LLVM_ENABLE_PLUGINS) > >> target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE > >>clangAnalysis > >>clangAST > >>clangStaticAnalyzerCore > >> +clangStaticAnalyzerFrontend > >>LLVMSupport > >>) > >> endif() > >> > >> Modified: > cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt > >> URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt?rev=361340=361339=361340=diff > >> > == > >> --- > cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt > (original) > >> +++ > cfe/trunk/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt Tue > May 21 17:47:37 2019 > >> @@ -1,11 +1,12 @@ > >> set(LLVM_EXPORTED_SYMBOL_FILE > ${CMAKE_CURRENT_SOURCE_DIR}/CheckerOptionHandlingAnalyzerPlugin.exports) > >> add_llvm_library(CheckerOptionHandlingAnalyzerPlugin MODULE > CheckerOptionHandling.cpp PLUGIN_TOOL clang) > >> > >> -if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) > >> +if(LLVM_ENABLE_PLUGINS) > >> target_link_libraries(CheckerOptionHandlingAnalyzerPlugin PRIVATE > >>clangAnalysis > >>clangAST > >>clangStaticAnalyzerCore > >> +clangStaticAnalyzerFrontend > >>LLVMSupport > >>) > >> endif() > >> > >> Modified: cfe/trunk/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt > >> URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt?rev=361340=361339=361340=diff > >> > == > >> --- cfe/trunk/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt > (original) > >> +++ cfe/trunk/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt Tue > May 21 17:47:37 2019 > >> @@ -1,11 +1,12 @@ > >> set(LLVM_EXPORTED_SYMBOL_FILE > ${CMAKE_CURRENT_SOURCE_DIR}/SampleAnalyzerPlugin.exports) > >> add_llvm_library(SampleAnalyzerPlugin MODULE MainCallChecker.cpp > PLUGIN_TOOL clang) > >> > >> -if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) > >> +if(LLVM_ENABLE_PLUGINS) > >> target_link_libraries(SampleAnalyzerPlugin PRIVATE > >>clangAnalysis > >>clangAST > >>clangStaticAnalyzerCore > >> +clangStaticAnalyzerFrontend > >>LLVMSupport > >>) > >> endif() > >> > >> > >> ___ > >> cfe-commits mailing list > >> cfe-commits@lists.llvm.org > >> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list
r361663 - [cmake] Remove old unused version of FindZ3.cmake from clang [NFC]
Author: dhinton Date: Fri May 24 12:21:21 2019 New Revision: 361663 URL: http://llvm.org/viewvc/llvm-project?rev=361663=rev Log: [cmake] Remove old unused version of FindZ3.cmake from clang [NFC] Summary: This file was moved to llvm in D54978, r356929, but the old file was never removed. Reviewed By: beanz Tags: #clang Differential Revision: https://reviews.llvm.org/D62343 Removed: cfe/trunk/cmake/modules/FindZ3.cmake Removed: cfe/trunk/cmake/modules/FindZ3.cmake URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/FindZ3.cmake?rev=361662=auto == (empty) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r361344 - [clang-tidy] remove default header-filter for run-clang-tidy
Author: dhinton Date: Tue May 21 18:01:11 2019 New Revision: 361344 URL: http://llvm.org/viewvc/llvm-project?rev=361344=rev Log: [clang-tidy] remove default header-filter for run-clang-tidy Summary: run-clang-tidy.py was enforcing '-header-filter' parameter with an unfortunate default value when none was given. Thus, leading to overwritten clang-tidy configuration (e.g. from .clang-tidy). This change removes the default value for '-header-filter' resulting in the default behaviour of clang-tidy itself. Fixes PR#41426 Reviewed By: hintonda Patch by Torbjörn Klatt! Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61747 Modified: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py Modified: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py?rev=361344=361343=361344=diff == --- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py (original) +++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py Tue May 21 18:01:11 2019 @@ -84,9 +84,6 @@ def get_tidy_invocation(f, clang_tidy_bi start = [clang_tidy_binary] if header_filter is not None: start.append('-header-filter=' + header_filter) - else: -# Show warnings in all in-project headers by default. -start.append('-header-filter=^' + build_path + '/.*') if checks: start.append('-checks=' + checks) if tmpdir is not None: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r361343 - [Docs] Increase Doxygen cache size
Author: dhinton Date: Tue May 21 17:56:42 2019 New Revision: 361343 URL: http://llvm.org/viewvc/llvm-project?rev=361343=rev Log: [Docs] Increase Doxygen cache size Summary: When building Doxygen docs for llvm and clang, it helpfully prints a warning at the end noting that the `LOOKUP_CACHE_SIZE` value was too small to keep all symbols in memory. By increasing to the size it recommends, Doxygen builds have greatly improved performance. On my machine, time to run `doxygen-llvm` changes from 34 minutes to 22 minutes, which is a decent amount of time saved by changing a single number. Reviewed By: hintonda Patch by J. Ryan Stinnett! Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62138 Modified: cfe/trunk/docs/doxygen.cfg.in Modified: cfe/trunk/docs/doxygen.cfg.in URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/doxygen.cfg.in?rev=361343=361342=361343=diff == --- cfe/trunk/docs/doxygen.cfg.in (original) +++ cfe/trunk/docs/doxygen.cfg.in Tue May 21 17:56:42 2019 @@ -384,7 +384,7 @@ TYPEDEF_HIDES_STRUCT = NO # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. -LOOKUP_CACHE_SIZE = 2 +LOOKUP_CACHE_SIZE = 3 #--- # Build related configuration options ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r360788 - [clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" with correct attribution
Author: dhinton Date: Wed May 15 10:47:51 2019 New Revision: 360788 URL: http://llvm.org/viewvc/llvm-project?rev=360788=rev Log: [clang-tidy] Recommit r360785 "modernize-loop-convert: impl const cast iter" with correct attribution Summary: modernize-loop-convert was not detecting implicit casts to const_iterator as convertible to range-based loops: std::vector vec{1,2,3,4} for(std::vector::const_iterator i = vec.begin(); i != vec.end(); ++i) { } Thanks to Don Hinton for advice. As well, this change adds a note for this check's applicability to code targeting OpenMP prior version 5 as this check will continue breaking compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this out. Fixes PR#35082 Patch by Torbjörn Klatt! Reviewed By: hintonda Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61827 Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst clang-tools-extra/trunk/docs/clang-tidy/index.rst clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=360788=360787=360788=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Wed May 15 10:47:51 2019 @@ -791,11 +791,6 @@ bool LoopConvertCheck::isConvertible(AST CanonicalBeginType->getPointeeType(), CanonicalInitVarType->getPointeeType())) return false; -} else if (!Context->hasSameType(CanonicalInitVarType, - CanonicalBeginType)) { - // Check for qualified types to avoid conversions from non-const to const - // iterator types. - return false; } } else if (FixerKind == LFK_PseudoArray) { // This call is required to obtain the container. Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst?rev=360788=360787=360788=diff == --- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst Wed May 15 10:47:51 2019 @@ -253,3 +253,15 @@ below ends up being performed at the `sa flag = true; } } + +OpenMP +^^ + +As range-based for loops are only available since OpenMP 5, this check should +not been used on code with a compatibility requirements of OpenMP prior to +version 5. It is **intentional** that this check does not make any attempts to +exclude incorrect diagnostics on OpenMP for loops prior to OpenMP 5. + +To prevent this check to be applied (and to break) OpenMP for loops but still be +applied to non-OpenMP for loops the usage of ``NOLINT`` (see +:ref:`clang-tidy-nolint`) on the specific for loops is recommended. Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=360788=360787=360788=diff == --- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Wed May 15 10:47:51 2019 @@ -258,6 +258,8 @@ An overview of all the command-line opti value: 'some value' ... +.. _clang-tidy-nolint: + Suppressing Undesired Diagnostics = Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp?rev=360788=360787=360788=diff == --- clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp Wed May 15 10:47:51 2019 @@ -369,7 +369,7 @@ void f() { // CHECK-FIXES: for (auto Val_int_ptr : Val_int_ptrs) } - // This container uses an iterator where the derefence type is a typedef of + // This container uses an iterator where the dereference type is a typedef of // a reference type. Make sure non-const auto & is still used. A failure here // means canonical types aren't being tested. { @@ -431,19 +431,22 @@ void different_type() { // CHECK-FIXES: for
[clang-tools-extra] r360787 - Revert [clang-tidy] modernize-loop-convert: impl const cast iter
Author: dhinton Date: Wed May 15 10:36:54 2019 New Revision: 360787 URL: http://llvm.org/viewvc/llvm-project?rev=360787=rev Log: Revert [clang-tidy] modernize-loop-convert: impl const cast iter This reverts r360785 (git commit 42d28be802fe5beab18bc1a27f89894c0a290d44) Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst clang-tools-extra/trunk/docs/clang-tidy/index.rst clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=360787=360786=360787=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Wed May 15 10:36:54 2019 @@ -791,6 +791,11 @@ bool LoopConvertCheck::isConvertible(AST CanonicalBeginType->getPointeeType(), CanonicalInitVarType->getPointeeType())) return false; +} else if (!Context->hasSameType(CanonicalInitVarType, + CanonicalBeginType)) { + // Check for qualified types to avoid conversions from non-const to const + // iterator types. + return false; } } else if (FixerKind == LFK_PseudoArray) { // This call is required to obtain the container. Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst?rev=360787=360786=360787=diff == --- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst Wed May 15 10:36:54 2019 @@ -253,15 +253,3 @@ below ends up being performed at the `sa flag = true; } } - -OpenMP -^^ - -As range-based for loops are only available since OpenMP 5, this check should -not been used on code with a compatibility requirements of OpenMP prior to -version 5. It is **intentional** that this check does not make any attempts to -exclude incorrect diagnostics on OpenMP for loops prior to OpenMP 5. - -To prevent this check to be applied (and to break) OpenMP for loops but still be -applied to non-OpenMP for loops the usage of ``NOLINT`` (see -:ref:`clang-tidy-nolint`) on the specific for loops is recommended. Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=360787=360786=360787=diff == --- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Wed May 15 10:36:54 2019 @@ -258,8 +258,6 @@ An overview of all the command-line opti value: 'some value' ... -.. _clang-tidy-nolint: - Suppressing Undesired Diagnostics = Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp?rev=360787=360786=360787=diff == --- clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp Wed May 15 10:36:54 2019 @@ -369,7 +369,7 @@ void f() { // CHECK-FIXES: for (auto Val_int_ptr : Val_int_ptrs) } - // This container uses an iterator where the dereference type is a typedef of + // This container uses an iterator where the derefence type is a typedef of // a reference type. Make sure non-const auto & is still used. A failure here // means canonical types aren't being tested. { @@ -431,22 +431,19 @@ void different_type() { // CHECK-FIXES: for (auto P : *Ps) // CHECK-FIXES-NEXT: printf("s has value %d\n", P.X); + // V.begin() returns a user-defined type 'iterator' which, since it's + // different from const_iterator, disqualifies these loops from + // transformation. dependent V; for (dependent::const_iterator It = V.begin(), E = V.end(); It != E; ++It) { printf("Fibonacci number is %d\n", *It); } - // CHECK-MESSAGES: :[[@LINE-4]]:3: warning: use range-based for loop instead - // CHECK-FIXES: for (int It : V) - // CHECK-FIXES-NEXT: printf("Fibonacci number is %d\n", It); for (dependent::const_iterator
Re: [clang-tools-extra] r360785 - [clang-tidy] modernize-loop-convert: impl const cast iter
Just wanted to note that this patch was contributed by Torbjörn Klatt, and I failed to add the following line to the commit message: Patch by Torbjörn Klatt! Sorry about that Torbjörn. On Wed, May 15, 2019 at 9:56 AM Don Hinton via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: dhinton > Date: Wed May 15 09:58:58 2019 > New Revision: 360785 > > URL: http://llvm.org/viewvc/llvm-project?rev=360785=rev > Log: > [clang-tidy] modernize-loop-convert: impl const cast iter > > Summary: > modernize-loop-convert was not detecting implicit casts to > const_iterator as convertible to range-based loops: > > std::vector vec{1,2,3,4} > for(std::vector::const_iterator i = vec.begin(); > i != vec.end(); > ++i) { } > > Thanks to Don Hinton for advice. > > As well, this change adds a note for this check's applicability to code > targeting OpenMP prior to version 5 as this check will continue breaking > compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this > out. > > Fixes PR#35082 > > Reviewed By: hintonda > > Tags: #clang-tools-extra, #clang > > Differential Revision: https://reviews.llvm.org/D61827 > > Modified: > clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp > > clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst > clang-tools-extra/trunk/docs/clang-tidy/index.rst > > clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp > > clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp > > Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=360785=360784=360785=diff > > == > --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp > (original) > +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Wed > May 15 09:58:58 2019 > @@ -791,11 +791,6 @@ bool LoopConvertCheck::isConvertible(AST >CanonicalBeginType->getPointeeType(), >CanonicalInitVarType->getPointeeType())) > return false; > -} else if (!Context->hasSameType(CanonicalInitVarType, > - CanonicalBeginType)) { > - // Check for qualified types to avoid conversions from non-const to > const > - // iterator types. > - return false; > } >} else if (FixerKind == LFK_PseudoArray) { > // This call is required to obtain the container. > > Modified: > clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst?rev=360785=360784=360785=diff > > == > --- > clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst > (original) > +++ > clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst > Wed May 15 09:58:58 2019 > @@ -253,3 +253,15 @@ below ends up being performed at the `sa >flag = true; > } >} > + > +OpenMP > +^^ > + > +As range-based for loops are only available since OpenMP 5, this check > should > +not been used on code with a compatibility requirements of OpenMP prior to > +version 5. It is **intentional** that this check does not make any > attempts to > +exclude incorrect diagnostics on OpenMP for loops prior to OpenMP 5. > + > +To prevent this check to be applied (and to break) OpenMP for loops but > still be > +applied to non-OpenMP for loops the usage of ``NOLINT`` (see > +:ref:`clang-tidy-nolint`) on the specific for loops is recommended. > > Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=360785=360784=360785=diff > > == > --- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original) > +++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Wed May 15 09:58:58 > 2019 > @@ -258,6 +258,8 @@ An overview of all the command-line opti >value: 'some value' >... > > +.. _clang-tidy-nolint: > + > Suppressing Undesired Diagnostics > = > > > Modified: > clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp > URL: > http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/mode
[clang-tools-extra] r360785 - [clang-tidy] modernize-loop-convert: impl const cast iter
Author: dhinton Date: Wed May 15 09:58:58 2019 New Revision: 360785 URL: http://llvm.org/viewvc/llvm-project?rev=360785=rev Log: [clang-tidy] modernize-loop-convert: impl const cast iter Summary: modernize-loop-convert was not detecting implicit casts to const_iterator as convertible to range-based loops: std::vector vec{1,2,3,4} for(std::vector::const_iterator i = vec.begin(); i != vec.end(); ++i) { } Thanks to Don Hinton for advice. As well, this change adds a note for this check's applicability to code targeting OpenMP prior to version 5 as this check will continue breaking compilation with `-fopenmp`. Thanks to Roman Lebedev for pointing this out. Fixes PR#35082 Reviewed By: hintonda Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D61827 Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst clang-tools-extra/trunk/docs/clang-tidy/index.rst clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=360785=360784=360785=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Wed May 15 09:58:58 2019 @@ -791,11 +791,6 @@ bool LoopConvertCheck::isConvertible(AST CanonicalBeginType->getPointeeType(), CanonicalInitVarType->getPointeeType())) return false; -} else if (!Context->hasSameType(CanonicalInitVarType, - CanonicalBeginType)) { - // Check for qualified types to avoid conversions from non-const to const - // iterator types. - return false; } } else if (FixerKind == LFK_PseudoArray) { // This call is required to obtain the container. Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst?rev=360785=360784=360785=diff == --- clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst Wed May 15 09:58:58 2019 @@ -253,3 +253,15 @@ below ends up being performed at the `sa flag = true; } } + +OpenMP +^^ + +As range-based for loops are only available since OpenMP 5, this check should +not been used on code with a compatibility requirements of OpenMP prior to +version 5. It is **intentional** that this check does not make any attempts to +exclude incorrect diagnostics on OpenMP for loops prior to OpenMP 5. + +To prevent this check to be applied (and to break) OpenMP for loops but still be +applied to non-OpenMP for loops the usage of ``NOLINT`` (see +:ref:`clang-tidy-nolint`) on the specific for loops is recommended. Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=360785=360784=360785=diff == --- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Wed May 15 09:58:58 2019 @@ -258,6 +258,8 @@ An overview of all the command-line opti value: 'some value' ... +.. _clang-tidy-nolint: + Suppressing Undesired Diagnostics = Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp?rev=360785=360784=360785=diff == --- clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp Wed May 15 09:58:58 2019 @@ -369,7 +369,7 @@ void f() { // CHECK-FIXES: for (auto Val_int_ptr : Val_int_ptrs) } - // This container uses an iterator where the derefence type is a typedef of + // This container uses an iterator where the dereference type is a typedef of // a reference type. Make sure non-const auto & is still used. A failure here // means canonical types aren't being tested. { @@ -431,19 +431,22 @@ void different_type() { // CHECK-FIXES: for (auto P : *Ps) // CHECK-FIXES-NEXT: printf("s has value %d\n",
[clang-tools-extra] r360450 - [clang-tidy] Change the namespace for llvm checkers from 'llvm' to 'llvm_check'
Author: dhinton Date: Fri May 10 11:27:09 2019 New Revision: 360450 URL: http://llvm.org/viewvc/llvm-project?rev=360450=rev Log: [clang-tidy] Change the namespace for llvm checkers from 'llvm' to 'llvm_check' Summary: Change the namespace for llvm checkers from 'llvm' to 'llvm_check', and modify add_new_check.py and rename_check.py to support the new namespace. Checker, file, and directory names remain unchanged. Used new version of rename_check.py to make the change in existing llvm checkers, but had to fix LLVMTidyModule.cpp and LLVMModuleTest.cpp by hand. The changes made by rename_check.py are idempotent, so if accidentally run multiple times, it won't do anything. Reviewed By: aaron.ballman Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D60629 Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.h clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.cpp clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.h clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h clang-tools-extra/trunk/clang-tidy/rename_check.py clang-tools-extra/trunk/unittests/clang-tidy/LLVMModuleTest.cpp Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=360450=360449=360450=diff == --- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original) +++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Fri May 10 11:27:09 2019 @@ -46,7 +46,7 @@ def adapt_cmake(module_path, check_name_ # Adds a header for the new check. -def write_header(module_path, module, check_name, check_name_camel): +def write_header(module_path, module, namespace, check_name, check_name_camel): check_name_dashes = module + '-' + check_name filename = os.path.join(module_path, check_name_camel) + '.h' print('Creating %s...' % filename) @@ -73,7 +73,7 @@ def write_header(module_path, module, ch namespace clang { namespace tidy { -namespace %(module)s { +namespace %(namespace)s { /// FIXME: Write a short description. /// @@ -87,7 +87,7 @@ public: void check(const ast_matchers::MatchFinder::MatchResult ) override; }; -} // namespace %(module)s +} // namespace %(namespace)s } // namespace tidy } // namespace clang @@ -95,11 +95,12 @@ public: """ % {'header_guard': header_guard, 'check_name': check_name_camel, 'check_name_dashes': check_name_dashes, - 'module': module}) + 'module': module, + 'namespace': namespace}) # Adds the implementation of the new check. -def write_implementation(module_path, module, check_name_camel): +def write_implementation(module_path, module, namespace, check_name_camel): filename = os.path.join(module_path, check_name_camel) + '.cpp' print('Creating %s...' % filename) with open(filename, 'w') as f: @@ -124,7 +125,7 @@ using namespace clang::ast_matchers; namespace clang { namespace tidy { -namespace %(module)s { +namespace %(namespace)s { void %(check_name)s::registerMatchers(MatchFinder *Finder) { // FIXME: Add matchers. @@ -142,11 +143,12 @@ void %(check_name)s::check(const MatchFi << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_"); } -} // namespace %(module)s +} // namespace %(namespace)s } // namespace tidy } // namespace clang """ % {'check_name': check_name_camel, - 'module': module}) + 'module': module, + 'namespace': namespace}) # Modifies the module to include the new check. @@ -375,8 +377,15 @@ def main(): if not adapt_cmake(module_path, check_name_camel): return - write_header(module_path, module, check_name, check_name_camel) - write_implementation(module_path, module, check_name_camel) + + # Map module names to namespace names that don't conflict with widely used top-level namespaces. + if module == 'llvm': +namespace = module + '_check' + else: +namespace = module + + write_header(module_path, module, namespace, check_name, check_name_camel) + write_implementation(module_path, module, namespace, check_name_camel) adapt_module(module_path, module, check_name, check_name_camel) add_release_notes(module_path, module, check_name) test_extension = language_to_extension.get(args.language) Modified: clang-tools-extra/trunk/clang-tidy/llvm/HeaderGuardCheck.cpp URL:
r359909 - [CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5
Author: dhinton Date: Fri May 3 10:47:29 2019 New Revision: 359909 URL: http://llvm.org/viewvc/llvm-project?rev=359909=rev Log: [CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5 Summary: By default, `parseCommandLineOptions()` will accept either a `-` or `--` prefix for long options -- options with names longer than a single character. While this change does not affect behavior, it will be helpful with a subsequent change that requires long options use the `--` prefix. Reviewers: rnk, thopre Reviewed By: thopre Subscribers: thopre, cfe-commits, hiraditya, llvm-commits Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D61269 Modified: cfe/trunk/test/Driver/clang-offload-bundler.c Modified: cfe/trunk/test/Driver/clang-offload-bundler.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=359909=359908=359909=diff == --- cfe/trunk/test/Driver/clang-offload-bundler.c (original) +++ cfe/trunk/test/Driver/clang-offload-bundler.c Fri May 3 10:47:29 2019 @@ -74,10 +74,10 @@ // CK-ERR6: error: invalid file type specified. // RUN: not clang-offload-bundler 2>&1 | FileCheck %s --check-prefix CK-ERR7 -// CK-ERR7-DAG: clang-offload-bundler: for the -type option: must be specified at least once! -// CK-ERR7-DAG: clang-offload-bundler: for the -inputs option: must be specified at least once! -// CK-ERR7-DAG: clang-offload-bundler: for the -outputs option: must be specified at least once! -// CK-ERR7-DAG: clang-offload-bundler: for the -targets option: must be specified at least once! +// CK-ERR7-DAG: clang-offload-bundler: for the --type option: must be specified at least once! +// CK-ERR7-DAG: clang-offload-bundler: for the --inputs option: must be specified at least once! +// CK-ERR7-DAG: clang-offload-bundler: for the --outputs option: must be specified at least once! +// CK-ERR7-DAG: clang-offload-bundler: for the --targets option: must be specified at least once! // RUN: not clang-offload-bundler -type=i -targets=hxst-powerpcxxle-ibm-linux-gnu,openxp-pxxerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -inputs=%t.i,%t.tgt1,%t.tgt2 -outputs=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8 // CK-ERR8: error: invalid target 'hxst-powerpcxxle-ibm-linux-gnu', unknown offloading kind 'hxst', unknown target triple 'powerpcxxle-ibm-linux-gnu'. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r359142 - [clang-tidy] Add new checker: llvm-prefer-isa-or-dyn-cast-in-conditionals
Author: dhinton Date: Wed Apr 24 14:25:57 2019 New Revision: 359142 URL: http://llvm.org/viewvc/llvm-project?rev=359142=rev Log: [clang-tidy] Add new checker: llvm-prefer-isa-or-dyn-cast-in-conditionals Summary: Looks at conditionals and finds cases of ``cast<>``, which will assert rather than return a null pointer, and ``dyn_cast<>`` where the return value is not captured. Additionally, finds cases that match the pattern ``var.foo() && isa(var.foo())``, where the method is called twice and could be expensive. .. code-block:: c++ // Finds cases like these: if (auto x = cast(y)) <...> if (cast(y)) <...> // But not cases like these: if (auto f = cast(y)->foo()) <...> if (cast(y)->foo()) <...> Reviewers: alexfh, rjmccall, hokein, aaron.ballman, JonasToth Reviewed By: aaron.ballman Subscribers: xbolva00, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D59802 Added: clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-prefer-isa-or-dyn-cast-in-conditionals.rst clang-tools-extra/trunk/test/clang-tidy/llvm-prefer-isa-or-dyn-cast-in-conditionals.cpp Modified: clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt?rev=359142=359141=359142=diff == --- clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/llvm/CMakeLists.txt Wed Apr 24 14:25:57 2019 @@ -4,6 +4,7 @@ add_clang_library(clangTidyLLVMModule HeaderGuardCheck.cpp IncludeOrderCheck.cpp LLVMTidyModule.cpp + PreferIsaOrDynCastInConditionalsCheck.cpp TwineLocalCheck.cpp LINK_LIBS Modified: clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp?rev=359142=359141=359142=diff == --- clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/llvm/LLVMTidyModule.cpp Wed Apr 24 14:25:57 2019 @@ -12,6 +12,7 @@ #include "../readability/NamespaceCommentCheck.h" #include "HeaderGuardCheck.h" #include "IncludeOrderCheck.h" +#include "PreferIsaOrDynCastInConditionalsCheck.h" #include "TwineLocalCheck.h" namespace clang { @@ -25,6 +26,8 @@ public: CheckFactories.registerCheck("llvm-include-order"); CheckFactories.registerCheck( "llvm-namespace-comment"); +CheckFactories.registerCheck( +"llvm-prefer-isa-or-dyn-cast-in-conditionals"); CheckFactories.registerCheck("llvm-twine-local"); } }; Added: clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp?rev=359142=auto == --- clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp Wed Apr 24 14:25:57 2019 @@ -0,0 +1,135 @@ +//===--- PreferIsaOrDynCastInConditionalsCheck.cpp - clang-tidy +//-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "PreferIsaOrDynCastInConditionalsCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace ast_matchers { +AST_MATCHER(Expr, isMacroID) { return Node.getExprLoc().isMacroID(); } +} // namespace ast_matchers + +namespace tidy { +namespace llvm { + +void PreferIsaOrDynCastInConditionalsCheck::registerMatchers( +MatchFinder *Finder) { + if (!getLangOpts().CPlusPlus) +return; + + auto Condition = hasCondition(implicitCastExpr(has( + callExpr( + allOf(unless(isMacroID()), unless(cxxMemberCallExpr()), +anyOf(callee(namedDecl(hasName("cast"))), + callee(namedDecl(hasName("dyn_cast")).bind("dyn_cast") + .bind("call"; + + auto Any = anyOf( +
r358428 - [CommandLineParser] Add DefaultOption flag
Author: dhinton Date: Mon Apr 15 10:18:10 2019 New Revision: 358428 URL: http://llvm.org/viewvc/llvm-project?rev=358428=rev Log: [CommandLineParser] Add DefaultOption flag Summary: Add DefaultOption flag to CommandLineParser which provides a default option or alias, but allows users to override it for some other purpose as needed. Also, add `-h` as a default alias to `-help`, which can be seamlessly overridden by applications like llvm-objdump and llvm-readobj which use `-h` as an alias for other options. (relanding after revert, r358414) Added DefaultOptions.clear() to reset(). Reviewers: alexfh, klimek Reviewed By: klimek Subscribers: kristina, MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59746 Modified: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Modified: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CommonOptionsParser.cpp?rev=358428=358427=358428=diff == --- cfe/trunk/lib/Tooling/CommonOptionsParser.cpp (original) +++ cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Mon Apr 15 10:18:10 2019 @@ -83,8 +83,6 @@ std::vector ArgumentsAdj llvm::Error CommonOptionsParser::init( int , const char **argv, cl::OptionCategory , llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview) { - static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden, -cl::sub(*cl::AllSubCommands)); static cl::opt BuildPath("p", cl::desc("Build path"), cl::Optional, cl::cat(Category), ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358337 - [CommandLineParser] Add DefaultOption flag
Author: dhinton Date: Sat Apr 13 09:55:28 2019 New Revision: 358337 URL: http://llvm.org/viewvc/llvm-project?rev=358337=rev Log: [CommandLineParser] Add DefaultOption flag Summary: Add DefaultOption flag to CommandLineParser which provides a default option or alias, but allows users to override it for some other purpose as needed. Also, add `-h` as a default alias to `-help`, which can be seamlessly overridden by applications like llvm-objdump and llvm-readobj which use `-h` as an alias for other options. Reviewers: alexfh, klimek Reviewed By: klimek Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D59746 Modified: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Modified: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CommonOptionsParser.cpp?rev=358337=358336=358337=diff == --- cfe/trunk/lib/Tooling/CommonOptionsParser.cpp (original) +++ cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Sat Apr 13 09:55:28 2019 @@ -83,8 +83,6 @@ std::vector ArgumentsAdj llvm::Error CommonOptionsParser::init( int , const char **argv, cl::OptionCategory , llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview) { - static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden, -cl::sub(*cl::AllSubCommands)); static cl::opt BuildPath("p", cl::desc("Build path"), cl::Optional, cl::cat(Category), ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r356441 - Refactor cast<>'s in if conditionals, which can only assert on failure.
Author: dhinton Date: Mon Mar 18 23:14:14 2019 New Revision: 356441 URL: http://llvm.org/viewvc/llvm-project?rev=356441=rev Log: Refactor cast<>'s in if conditionals, which can only assert on failure. Summary: This patch refactors several instances of cast<> used in if conditionals. Since cast<> asserts on failure, the else branch can never be taken. In some cases, the fix is to replace cast<> with dyn_cast<>. While others required the removal of the conditional and some minor refactoring. A discussion can be seen here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190318/265044.html Differential Revision: https://reviews.llvm.org/D59529 Modified: cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/lib/AST/DeclBase.cpp cfe/trunk/lib/CodeGen/CGExprConstant.cpp cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=356441=356440=356441=diff == --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Mar 18 23:14:14 2019 @@ -8460,44 +8460,41 @@ Error ASTImporter::ImportDefinition_New( if (!To) return llvm::make_error(); - if (auto *FromDC = cast(From)) { -ASTNodeImporter Importer(*this); + auto *FromDC = cast(From); + ASTNodeImporter Importer(*this); -if (auto *ToRecord = dyn_cast(To)) { - if (!ToRecord->getDefinition()) { -return Importer.ImportDefinition( -cast(FromDC), ToRecord, -ASTNodeImporter::IDK_Everything); - } + if (auto *ToRecord = dyn_cast(To)) { +if (!ToRecord->getDefinition()) { + return Importer.ImportDefinition( + cast(FromDC), ToRecord, + ASTNodeImporter::IDK_Everything); } + } -if (auto *ToEnum = dyn_cast(To)) { - if (!ToEnum->getDefinition()) { -return Importer.ImportDefinition( -cast(FromDC), ToEnum, ASTNodeImporter::IDK_Everything); - } + if (auto *ToEnum = dyn_cast(To)) { +if (!ToEnum->getDefinition()) { + return Importer.ImportDefinition( + cast(FromDC), ToEnum, ASTNodeImporter::IDK_Everything); } + } -if (auto *ToIFace = dyn_cast(To)) { - if (!ToIFace->getDefinition()) { -return Importer.ImportDefinition( -cast(FromDC), ToIFace, -ASTNodeImporter::IDK_Everything); - } + if (auto *ToIFace = dyn_cast(To)) { +if (!ToIFace->getDefinition()) { + return Importer.ImportDefinition( + cast(FromDC), ToIFace, + ASTNodeImporter::IDK_Everything); } + } -if (auto *ToProto = dyn_cast(To)) { - if (!ToProto->getDefinition()) { -return Importer.ImportDefinition( -cast(FromDC), ToProto, -ASTNodeImporter::IDK_Everything); - } + if (auto *ToProto = dyn_cast(To)) { +if (!ToProto->getDefinition()) { + return Importer.ImportDefinition( + cast(FromDC), ToProto, + ASTNodeImporter::IDK_Everything); } - -return Importer.ImportDeclContext(FromDC, true); } - return Error::success(); + return Importer.ImportDeclContext(FromDC, true); } void ASTImporter::ImportDefinition(Decl *From) { Modified: cfe/trunk/lib/AST/DeclBase.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=356441=356440=356441=diff == --- cfe/trunk/lib/AST/DeclBase.cpp (original) +++ cfe/trunk/lib/AST/DeclBase.cpp Mon Mar 18 23:14:14 2019 @@ -1179,13 +1179,15 @@ DeclContext *DeclContext::getPrimaryCont return this; case Decl::ObjCInterface: -if (auto *Def = cast(this)->getDefinition()) - return Def; +if (auto *OID = dyn_cast(this)) + if (auto *Def = OID->getDefinition()) +return Def; return this; case Decl::ObjCProtocol: -if (auto *Def = cast(this)->getDefinition()) - return Def; +if (auto *OPD = dyn_cast(this)) + if (auto *Def = OPD->getDefinition()) +return Def; return this; case Decl::ObjCCategory: Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=356441=356440=356441=diff == --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original) +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Mon Mar 18 23:14:14 2019 @@ -1698,31 +1698,20 @@ ConstantLValueEmitter::tryEmitAbsolute(l auto offset = getOffset(); // If we're producing a pointer, this is easy. - if (auto destPtrTy = cast(destTy)) { -if (Value.isNullPointer()) { - // FIXME: integer offsets from non-zero null pointers. - return CGM.getNullPointer(destPtrTy, DestType); -} - -// Convert the integer to a pointer-sized
Re: r311065 - Further refactoring of the constant emitter. NFC.
Hi John: I found this investigating the cast assert noted here: http://lists.llvm.org/pipermail/cfe-dev/2019-March/061685.html I subsequently did quick grep and found a number of cases in clang+llvm (didn't find any in other projects) . I'm happy to fix these in mass, i.e., s/cast/dyn_cast/, but as you mentioned, some might require additional refactoring, e.g., removal of the conditional. In any case, here's what I've found -- perhaps a new llvm clang-tidy checker would be useful: $ find ./clang ./llvm -type f \( -name "*.h" -o -name "*.cpp" \) -exec grep -Hn "if *(auto.* *= *cast *<" \{\} \; ./clang/lib/Sema/SemaOpenMP.cpp:10904: else if (auto *DRD = cast(D)) ./clang/lib/CodeGen/CGExprConstant.cpp:1701: if (auto destPtrTy = cast(destTy)) { ./clang/lib/CodeGen/MicrosoftCXXABI.cpp:738: if (auto *Fn = cast(Throw.getCallee())) ./clang/lib/AST/ASTImporter.cpp:8463: if (auto *FromDC = cast(From)) { ./clang/lib/AST/DeclBase.cpp:1182:if (auto *Def = cast(this)->getDefinition()) ./clang/lib/AST/DeclBase.cpp:1187:if (auto *Def = cast(this)->getDefinition()) ./llvm/tools/llvm-objdump/llvm-objdump.cpp:802: if (auto *Elf64BEObj = cast(Obj)) ./llvm/tools/llvm-objdump/llvm-objdump.cpp:846: else if (auto *Elf64BEObj = cast(Obj)) ./llvm/lib/Target/X86/AsmParser/X86Operand.h:102:if (auto Imm = cast(Val)->getValue()) ./llvm/lib/Transforms/IPO/CalledValuePropagation.cpp:139: } else if (auto *F = cast(Key.getPointer())) ./llvm/lib/Transforms/Coroutines/CoroEarly.cpp:183:if (auto *CII = cast()) { thanks... don On Mon, Mar 18, 2019 at 12:07 PM John McCall wrote: > On 18 Mar 2019, at 14:39, Don Hinton wrote: > > It looks like this change introduced a small bug; Specifically, the > > following cast test: > > > > - if (auto PT = dyn_cast(DestTy)) { > > ... > > + // If we're producing a pointer, this is easy. > > + if (auto destPtrTy = cast(destTy)) { > > > > Since the cast can fail, shouldn't you prefer dyn_cast<>(), which can > > return nullptr, over cast<>(), which will assert? > > Yes, although if it hasn't caused a problem in the last year and a half, > maybe we should just change the code to be non-conditional. > > John. > ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r311065 - Further refactoring of the constant emitter. NFC.
It looks like this change introduced a small bug; Specifically, the following cast test: - if (auto PT = dyn_cast(DestTy)) { ... + // If we're producing a pointer, this is easy. + if (auto destPtrTy = cast(destTy)) { Since the cast can fail, shouldn't you prefer dyn_cast<>(), which can return nullptr, over cast<>(), which will assert? On Wed, Aug 16, 2017 at 11:04 PM John McCall via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rjmccall > Date: Wed Aug 16 22:03:55 2017 > New Revision: 311065 > > URL: http://llvm.org/viewvc/llvm-project?rev=311065=rev > Log: > Further refactoring of the constant emitter. NFC. > > Modified: > cfe/trunk/lib/CodeGen/CGExprConstant.cpp > > Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=311065=311064=311065=diff > > == > --- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Wed Aug 16 22:03:55 2017 > @@ -1044,120 +1044,6 @@ public: >llvm::Type *ConvertType(QualType T) { > return CGM.getTypes().ConvertType(T); >} > - > -public: > - ConstantAddress EmitLValue(APValue::LValueBase LVBase) { > -if (const ValueDecl *Decl = LVBase.dyn_cast()) { > - if (Decl->hasAttr()) > -return CGM.GetWeakRefReference(Decl); > - if (const FunctionDecl *FD = dyn_cast(Decl)) > -return ConstantAddress(CGM.GetAddrOfFunction(FD), > CharUnits::One()); > - if (const VarDecl* VD = dyn_cast(Decl)) { > -// We can never refer to a variable with local storage. > -if (!VD->hasLocalStorage()) { > - CharUnits Align = CGM.getContext().getDeclAlign(VD); > - if (VD->isFileVarDecl() || VD->hasExternalStorage()) > -return ConstantAddress(CGM.GetAddrOfGlobalVar(VD), Align); > - else if (VD->isLocalVarDecl()) { > -auto Ptr = CGM.getOrCreateStaticVarDecl( > -*VD, CGM.getLLVMLinkageVarDefinition(VD, > /*isConstant=*/false)); > -return ConstantAddress(Ptr, Align); > - } > -} > - } > - return ConstantAddress::invalid(); > -} > - > -Expr *E = const_cast(LVBase.get()); > -switch (E->getStmtClass()) { > -default: break; > -case Expr::CompoundLiteralExprClass: > - return tryEmitGlobalCompoundLiteral(CGM, Emitter.CGF, > - cast(E)); > -case Expr::StringLiteralClass: > - return > CGM.GetAddrOfConstantStringFromLiteral(cast(E)); > -case Expr::ObjCEncodeExprClass: > - return > CGM.GetAddrOfConstantStringFromObjCEncode(cast(E)); > -case Expr::ObjCStringLiteralClass: { > - ObjCStringLiteral* SL = cast(E); > - ConstantAddress C = > - CGM.getObjCRuntime().GenerateConstantString(SL->getString()); > - return C.getElementBitCast(ConvertType(E->getType())); > -} > -case Expr::PredefinedExprClass: { > - unsigned Type = cast(E)->getIdentType(); > - if (auto CGF = Emitter.CGF) { > -LValue Res = CGF->EmitPredefinedLValue(cast(E)); > -return cast(Res.getAddress()); > - } else if (Type == PredefinedExpr::PrettyFunction) { > -return CGM.GetAddrOfConstantCString("top level", ".tmp"); > - } > - > - return CGM.GetAddrOfConstantCString("", ".tmp"); > -} > -case Expr::AddrLabelExprClass: { > - assert(Emitter.CGF && > - "Invalid address of label expression outside function."); > - llvm::Constant *Ptr = > -Emitter.CGF->GetAddrOfLabel(cast(E)->getLabel()); > - Ptr = llvm::ConstantExpr::getBitCast(Ptr, > ConvertType(E->getType())); > - return ConstantAddress(Ptr, CharUnits::One()); > -} > -case Expr::CallExprClass: { > - CallExpr* CE = cast(E); > - unsigned builtin = CE->getBuiltinCallee(); > - if (builtin != > -Builtin::BI__builtin___CFStringMakeConstantString && > - builtin != > -Builtin::BI__builtin___NSStringMakeConstantString) > -break; > - const Expr *Arg = CE->getArg(0)->IgnoreParenCasts(); > - const StringLiteral *Literal = cast(Arg); > - if (builtin == > -Builtin::BI__builtin___NSStringMakeConstantString) { > -return CGM.getObjCRuntime().GenerateConstantString(Literal); > - } > - // FIXME: need to deal with UCN conversion issues. > - return CGM.GetAddrOfConstantCFString(Literal); > -} > -case Expr::BlockExprClass: { > - StringRef FunctionName; > - if (auto CGF = Emitter.CGF) > -FunctionName = CGF->CurFn->getName(); > - else > -FunctionName = "global"; > - > - // This is not really an l-value. > - llvm::Constant *Ptr = > -CGM.GetAddrOfGlobalBlock(cast(E), FunctionName); > - return ConstantAddress(Ptr, CGM.getPointerAlign()); > -} > -case
[libunwind] r323601 - [cmake] [libunwind] LLVM_FOUND isn't always set, so just test if
Author: dhinton Date: Sat Jan 27 11:31:44 2018 New Revision: 323601 URL: http://llvm.org/viewvc/llvm-project?rev=323601=rev Log: [cmake] [libunwind] LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is available instead. Modified: libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=323601=323600=323601=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Sat Jan 27 11:31:44 2018 @@ -108,7 +108,7 @@ set(LIBUNWIND_TARGETS) # Build the shared library. if (LIBUNWIND_ENABLE_SHARED) add_library(unwind_shared SHARED $) - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(unwind_shared) endif() target_link_libraries(unwind_shared ${libraries}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r323600 - [cmake] [libcxxabi] LLVM_FOUND isn't always set, so just test if
Author: dhinton Date: Sat Jan 27 11:18:04 2018 New Revision: 323600 URL: http://llvm.org/viewvc/llvm-project?rev=323600=rev Log: [cmake] [libcxxabi] LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is available instead. Modified: libcxxabi/trunk/src/CMakeLists.txt Modified: libcxxabi/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=323600=323599=323600=diff == --- libcxxabi/trunk/src/CMakeLists.txt (original) +++ libcxxabi/trunk/src/CMakeLists.txt Sat Jan 27 11:18:04 2018 @@ -127,7 +127,7 @@ set(LIBCXXABI_TARGETS) # Build the shared library. if (LIBCXXABI_ENABLE_SHARED) add_library(cxxabi_shared SHARED $) - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(cxxabi_shared) endif() target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r323599 - LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is
Author: dhinton Date: Sat Jan 27 10:55:30 2018 New Revision: 323599 URL: http://llvm.org/viewvc/llvm-project?rev=323599=rev Log: LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is available instead. 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=323599=323598=323599=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Sat Jan 27 10:55:30 2018 @@ -222,7 +222,7 @@ set(LIBCXX_TARGETS) # Build the shared library. if (LIBCXX_ENABLE_SHARED) add_library(cxx_shared SHARED $) - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(cxx_shared) endif() target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
On Thu, Jan 25, 2018 at 5:20 PM, Duncan P. N. Exon Smith < dexonsm...@apple.com> wrote: > > > On Jan 25, 2018, at 17:09, Don Hinton <hinto...@gmail.com> wrote: > > > > On Thu, Jan 25, 2018 at 4:21 PM, Duncan P. N. Exon Smith < > dexonsm...@apple.com> wrote: > >> >> >> On Jan 25, 2018, at 16:18, Duncan P. N. Exon Smith via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >> >> >> On Jan 25, 2018, at 13:07, Don Hinton <hinto...@gmail.com> wrote: >> >> On Thu, Jan 25, 2018 at 12:54 PM, Chris Bieneman <be...@apple.com> wrote: >> >>> Historically we have supported building libcxx without llvm-config >>> available on the system. >>> >>> In all likelihood the bots didn't fail because the bots do have >>> llvm-config because we usually require an llvm build or source checkout in >>> order to build and run the tests since tests depend on lit and gtest. >>> >> >> Ah, okay, but if the bots don't test/enforce this, does it make sense to >> continue to support building without llvm-config? >> >> >> I didn't realize we didn't have a bot enforcing this. I just made one: >> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master >> _cmake_standalone >> >> I don't want to break upstream users, but the alternative is to duplicate >> this logic across multiple sub-projects. (see http://lists.llvm.org/pip >> ermail/llvm-dev/2018-January/120707.html for a related rpath issue). >> >> >> It's temporary though. In the brave new world on GitHub with monorepo, >> the runtime libraries will be able to access a shared set of CMake >> configuration scripts. >> >> >> Note that there's other stuff duplicated in the runtime libraries, such >> as preprocessor definitions (LLVM_... => __LIBCXX_...), that we'll never >> really be able to collapse. >> > > Great, I've changed it to this: > > + if(LLVM_FOUND) > +llvm_setup_rpath(cxx_shared) > + endif() > > Which should work for both cases. Is that okay? > > > SGTM. > Turns out LLVM_FOUND doesn't cover all cases, i.e., it's only set by libcxx and libcxxabi when doing out-of-tree builds. A better solution is to check if the command is actually available: - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(cxx_shared) endif() > > > >> >> >> >> >>> >>> >>> -Chris >>> >>> >>> On Jan 25, 2018, at 12:51 PM, Don Hinton <hinto...@gmail.com> wrote: >>> >>> On Thu, Jan 25, 2018 at 12:29 PM, Duncan P. N. Exon Smith < >>> dexonsm...@apple.com> wrote: >>> >>>> I don't really understand why, but our bots seemed to survive this: >>>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master >>>> _cmake/2137/ >>>> >>>> Console output is here: >>>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master >>>> _cmake/2137/consoleFull >>>> >>>> That doesn't necessarily mean it's safe. Does anyone know why this >>>> might have "worked"? >>>> >>> >>> I'm not an expert, but llvm installs all of these cmake modules along >>> side llvm-config, so if you find llvm-config, you find these modules. >>> >>> So, unless I'm missing something, it looks like AddLLVM.cmake is always >>> available. >>> >>> >>>> >>>> On Jan 25, 2018, at 11:02, Shoaib Meenai <smee...@fb.com> wrote: >>>> >>>> This is going to break building libc++ standalone (i.e. without any >>>> LLVM repository or even its CMake modules), right? Some upstream users care >>>> a lot about that use case (CC beanz and Duncan). >>>> >>>> *From: *cfe-commits <cfe-commits-boun...@lists.llvm.org> on behalf of >>>> Don Hinton via cfe-commits <cfe-commits@lists.llvm.org> >>>> *Reply-To: *Don Hinton <hinto...@gmail.com> >>>> *Date: *Thursday, January 25, 2018 at 10:15 AM >>>> *To: *"cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org> >>>> *Subject: *[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() >>>> when adding shared libraries. >>>> >>>> Author: dhinton >>>> Date: Thu Jan 25 10:13:26 2018 >>>> New Revision: 323453 >>>> >>>> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llv >>>> m.org_v
[libunwind] r323496 - [cmake] [libunwind] Call llvm_setup_rpath() when adding shared libraries.
Author: dhinton Date: Thu Jan 25 20:01:50 2018 New Revision: 323496 URL: http://llvm.org/viewvc/llvm-project?rev=323496=rev Log: [cmake] [libunwind] Call llvm_setup_rpath() when adding shared libraries. Clang and llvm already use llvm_setup_rpath(), so this change will help standarize rpath usage across all projects. Differential Revision: https://reviews.llvm.org/D42461 Modified: libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=323496=323495=323496=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Thu Jan 25 20:01:50 2018 @@ -108,6 +108,9 @@ set(LIBUNWIND_TARGETS) # Build the shared library. if (LIBUNWIND_ENABLE_SHARED) add_library(unwind_shared SHARED $) + if(LLVM_FOUND) +llvm_setup_rpath(unwind_shared) + endif() target_link_libraries(unwind_shared ${libraries}) set_target_properties(unwind_shared PROPERTIES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r323495 - Reland:
Author: dhinton Date: Thu Jan 25 19:41:58 2018 New Revision: 323495 URL: http://llvm.org/viewvc/llvm-project?rev=323495=rev Log: Reland: [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries. Clang and llvm already use llvm_setup_rpath(), so this change will help standarize rpath usage across all projects. Differential Revision: https://reviews.llvm.org/D42460 Modified: libcxxabi/trunk/src/CMakeLists.txt Modified: libcxxabi/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=323495=323494=323495=diff == --- libcxxabi/trunk/src/CMakeLists.txt (original) +++ libcxxabi/trunk/src/CMakeLists.txt Thu Jan 25 19:41:58 2018 @@ -127,6 +127,9 @@ set(LIBCXXABI_TARGETS) # Build the shared library. if (LIBCXXABI_ENABLE_SHARED) add_library(cxxabi_shared SHARED $) + if(LLVM_FOUND) +llvm_setup_rpath(cxxabi_shared) + endif() target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES}) set_target_properties(cxxabi_shared PROPERTIES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
On Thu, Jan 25, 2018 at 4:21 PM, Duncan P. N. Exon Smith < dexonsm...@apple.com> wrote: > > > On Jan 25, 2018, at 16:18, Duncan P. N. Exon Smith via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > > On Jan 25, 2018, at 13:07, Don Hinton <hinto...@gmail.com> wrote: > > On Thu, Jan 25, 2018 at 12:54 PM, Chris Bieneman <be...@apple.com> wrote: > >> Historically we have supported building libcxx without llvm-config >> available on the system. >> >> In all likelihood the bots didn't fail because the bots do have >> llvm-config because we usually require an llvm build or source checkout in >> order to build and run the tests since tests depend on lit and gtest. >> > > Ah, okay, but if the bots don't test/enforce this, does it make sense to > continue to support building without llvm-config? > > > I didn't realize we didn't have a bot enforcing this. I just made one: > http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_ > master_cmake_standalone > > I don't want to break upstream users, but the alternative is to duplicate > this logic across multiple sub-projects. (see http://lists.llvm.org/ > pipermail/llvm-dev/2018-January/120707.html for a related rpath issue). > > > It's temporary though. In the brave new world on GitHub with monorepo, > the runtime libraries will be able to access a shared set of CMake > configuration scripts. > > > Note that there's other stuff duplicated in the runtime libraries, such as > preprocessor definitions (LLVM_... => __LIBCXX_...), that we'll never > really be able to collapse. > Great, I've changed it to this: + if(LLVM_FOUND) +llvm_setup_rpath(cxx_shared) + endif() Which should work for both cases. Is that okay? > > > > >> >> >> -Chris >> >> >> On Jan 25, 2018, at 12:51 PM, Don Hinton <hinto...@gmail.com> wrote: >> >> On Thu, Jan 25, 2018 at 12:29 PM, Duncan P. N. Exon Smith < >> dexonsm...@apple.com> wrote: >> >>> I don't really understand why, but our bots seemed to survive this: >>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master_cmake/2137/ >>> >>> Console output is here: >>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master >>> _cmake/2137/consoleFull >>> >>> That doesn't necessarily mean it's safe. Does anyone know why this >>> might have "worked"? >>> >> >> I'm not an expert, but llvm installs all of these cmake modules along >> side llvm-config, so if you find llvm-config, you find these modules. >> >> So, unless I'm missing something, it looks like AddLLVM.cmake is always >> available. >> >> >>> >>> On Jan 25, 2018, at 11:02, Shoaib Meenai <smee...@fb.com> wrote: >>> >>> This is going to break building libc++ standalone (i.e. without any LLVM >>> repository or even its CMake modules), right? Some upstream users care a >>> lot about that use case (CC beanz and Duncan). >>> >>> *From: *cfe-commits <cfe-commits-boun...@lists.llvm.org> on behalf of >>> Don Hinton via cfe-commits <cfe-commits@lists.llvm.org> >>> *Reply-To: *Don Hinton <hinto...@gmail.com> >>> *Date: *Thursday, January 25, 2018 at 10:15 AM >>> *To: *"cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org> >>> *Subject: *[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() >>> when adding shared libraries. >>> >>> Author: dhinton >>> Date: Thu Jan 25 10:13:26 2018 >>> New Revision: 323453 >>> >>> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llv >>> m.org_viewvc_llvm-2Dproject-3Frev-3D323453-26view-3Drev= >>> DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw= >>> zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8=LDCu89byjNdZWo >>> CIYHGHaPr3IamIdHLF0JwbnYE92vM= >>> Log: >>> [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries. >>> >>> Clang and llvm already use llvm_setup_rpath(), so this change will >>> help standarize rpath usage across all projects. >>> >>> Differential Revision: https://urldefense.p >>> roofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D42459=D >>> wIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=zw >>> vSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8=YCR-YJBua5p-4IK0 >>> 5GjHoZUU7aN8UJAFzL2xaz7byyw= >>> >>> Modified: >>> libcxx/trunk/lib/CMakeLists.txt >>> >>> Modified: libcxx/trunk/lib/CMakeLis
Re: [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
On Thu, Jan 25, 2018 at 12:54 PM, Chris Bieneman <be...@apple.com> wrote: > Historically we have supported building libcxx without llvm-config > available on the system. > > In all likelihood the bots didn't fail because the bots do have > llvm-config because we usually require an llvm build or source checkout in > order to build and run the tests since tests depend on lit and gtest. > Ah, okay, but if the bots don't test/enforce this, does it make sense to continue to support building without llvm-config? I don't want to break upstream users, but the alternative is to duplicate this logic across multiple sub-projects. (see http://lists.llvm.org/pipermail/llvm-dev/2018-January/120707.html for a related rpath issue). > > > -Chris > > > On Jan 25, 2018, at 12:51 PM, Don Hinton <hinto...@gmail.com> wrote: > > On Thu, Jan 25, 2018 at 12:29 PM, Duncan P. N. Exon Smith < > dexonsm...@apple.com> wrote: > >> I don't really understand why, but our bots seemed to survive this: >> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master_cmake/2137/ >> >> Console output is here: >> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master >> _cmake/2137/consoleFull >> >> That doesn't necessarily mean it's safe. Does anyone know why this might >> have "worked"? >> > > I'm not an expert, but llvm installs all of these cmake modules along side > llvm-config, so if you find llvm-config, you find these modules. > > So, unless I'm missing something, it looks like AddLLVM.cmake is always > available. > > >> >> On Jan 25, 2018, at 11:02, Shoaib Meenai <smee...@fb.com> wrote: >> >> This is going to break building libc++ standalone (i.e. without any LLVM >> repository or even its CMake modules), right? Some upstream users care a >> lot about that use case (CC beanz and Duncan). >> >> *From: *cfe-commits <cfe-commits-boun...@lists.llvm.org> on behalf of >> Don Hinton via cfe-commits <cfe-commits@lists.llvm.org> >> *Reply-To: *Don Hinton <hinto...@gmail.com> >> *Date: *Thursday, January 25, 2018 at 10:15 AM >> *To: *"cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org> >> *Subject: *[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() >> when adding shared libraries. >> >> Author: dhinton >> Date: Thu Jan 25 10:13:26 2018 >> New Revision: 323453 >> >> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__ >> llvm.org_viewvc_llvm-2Dproject-3Frev-3D323453-26view-3Drev& >> d=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw& >> m=zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8=LDCu89byjNdZ >> WoCIYHGHaPr3IamIdHLF0JwbnYE92vM= >> Log: >> [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries. >> >> Clang and llvm already use llvm_setup_rpath(), so this change will >> help standarize rpath usage across all projects. >> >> Differential Revision: https://urldefense.proofpoint.com/v2/url?u=https-3 >> A__reviews.llvm.org_D42459=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw >> =o3kDXzdBUE3ljQXKeTWOMw=zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H >> 2i_ICF6vsR8=YCR-YJBua5p-4IK05GjHoZUU7aN8UJAFzL2xaz7byyw= >> >> Modified: >> libcxx/trunk/lib/CMakeLists.txt >> >> Modified: libcxx/trunk/lib/CMakeLists.txt >> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__ >> llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_lib_CMakeLists. >> txt-3Frev-3D323453-26r1-3D323452-26r2-3D323453-26view- >> 3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKe >> TWOMw=zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8=Rd7xc2 >> GWS8oyDcm0QshNPTqM3BglPY5_aHMIuCRUt1s= >> >> == >> --- libcxx/trunk/lib/CMakeLists.txt (original) >> +++ libcxx/trunk/lib/CMakeLists.txt Thu Jan 25 10:13:26 2018 >> @@ -222,6 +222,7 @@ set(LIBCXX_TARGETS) >> # Build the shared library. >> if (LIBCXX_ENABLE_SHARED) >>add_library(cxx_shared SHARED $) >> + llvm_setup_rpath(cxx_shared) >>target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) >>set_target_properties(cxx_shared >> PROPERTIES >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.ll >> vm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ=5 >> VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw=zwvSmk9ZIfM >> ARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8=TPt8bk99XfmUCdi7MBx >> yguYV6hJg3PsXFCTXyDfGms8= >> >> >> >> > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
On Thu, Jan 25, 2018 at 12:29 PM, Duncan P. N. Exon Smith < dexonsm...@apple.com> wrote: > I don't really understand why, but our bots seemed to survive this: > http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master_cmake/2137/ > > Console output is here: > http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_ > master_cmake/2137/consoleFull > > That doesn't necessarily mean it's safe. Does anyone know why this might > have "worked"? > I'm not an expert, but llvm installs all of these cmake modules along side llvm-config, so if you find llvm-config, you find these modules. So, unless I'm missing something, it looks like AddLLVM.cmake is always available. > > On Jan 25, 2018, at 11:02, Shoaib Meenai <smee...@fb.com> wrote: > > This is going to break building libc++ standalone (i.e. without any LLVM > repository or even its CMake modules), right? Some upstream users care a > lot about that use case (CC beanz and Duncan). > > *From: *cfe-commits <cfe-commits-boun...@lists.llvm.org> on behalf of Don > Hinton via cfe-commits <cfe-commits@lists.llvm.org> > *Reply-To: *Don Hinton <hinto...@gmail.com> > *Date: *Thursday, January 25, 2018 at 10:15 AM > *To: *"cfe-commits@lists.llvm.org" <cfe-commits@lists.llvm.org> > *Subject: *[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() > when adding shared libraries. > > Author: dhinton > Date: Thu Jan 25 10:13:26 2018 > New Revision: 323453 > > URL: https://urldefense.proofpoint.com/v2/url?u=http- > 3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D323453-26view-3Drev=DwIGaQ= > 5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw= > zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8= > LDCu89byjNdZWoCIYHGHaPr3IamIdHLF0JwbnYE92vM= > Log: > [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries. > > Clang and llvm already use llvm_setup_rpath(), so this change will > help standarize rpath usage across all projects. > > Differential Revision: https://urldefense.proofpoint.com/v2/url?u=https- > 3A__reviews.llvm.org_D42459=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw= > o3kDXzdBUE3ljQXKeTWOMw=zwvSmk9ZIfMARYg3JvYvNuA0Iz- > PEq3H2i_ICF6vsR8=YCR-YJBua5p-4IK05GjHoZUU7aN8UJAFzL2xaz7byyw= > > Modified: > libcxx/trunk/lib/CMakeLists.txt > > Modified: libcxx/trunk/lib/CMakeLists.txt > URL: https://urldefense.proofpoint.com/v2/url?u=http- > 3A__llvm.org_viewvc_llvm-2Dproject_libcxx_trunk_lib_ > CMakeLists.txt-3Frev-3D323453-26r1-3D323452-26r2-3D323453- > 26view-3Ddiff=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw= > o3kDXzdBUE3ljQXKeTWOMw=zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8= > Rd7xc2GWS8oyDcm0QshNPTqM3BglPY5_aHMIuCRUt1s= > > == > --- libcxx/trunk/lib/CMakeLists.txt (original) > +++ libcxx/trunk/lib/CMakeLists.txt Thu Jan 25 10:13:26 2018 > @@ -222,6 +222,7 @@ set(LIBCXX_TARGETS) > # Build the shared library. > if (LIBCXX_ENABLE_SHARED) >add_library(cxx_shared SHARED $) > + llvm_setup_rpath(cxx_shared) >target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) >set_target_properties(cxx_shared > PROPERTIES > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists. > llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits=DwIGaQ= > 5VD0RTtNlTh3ycd41b3MUw=o3kDXzdBUE3ljQXKeTWOMw= > zwvSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8= > TPt8bk99XfmUCdi7MBxyguYV6hJg3PsXFCTXyDfGms8= > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Please subscribe "rUNW libunwind" to cfe-commits.
Ah, I think that's the issue. local:/Users/dhinton/projects/llvm_project/libcxxabi $ cat .arcconfig { "repository.callsign" : "CXXA", "conduit_uri" : "https://reviews.llvm.org/; } So, it should set repository to CXXA, not LLVM. On Thu, Jan 25, 2018 at 11:25 AM, Ben Hamiltonwrote: > Yes, that's currently a submit time feature built in to Phabricator which > i believe we'll have to fix upstream. > > Because both the top level LLVM SVN report and the sub repos see the same > files, Phabricator automatically subscribes both lists to the commits. > > I wasn't able to find an easy way to disable this feature. If you can find > one, please let me know! (I was punting in hopes the migration to git would > happen first.) > > On Thu, Jan 25, 2018 at 11:01 AM Don Hinton wrote: > >> Btw, I'm seeing other inconsistencies, e.g., I just committed >> https://reviews.llvm.org/D42460 and herald ended up adding both >> cfe-commits and llvm-commits to subscribers. >> >> When I created it, I left subscribers blank, so herald added cfe-commits >> -- which seems to be correct. >> Then, when I committed it, herald added llvm-commits -- which doesn't >> seem correct. >> >> >> >> On Thu, Jan 25, 2018 at 10:04 AM, Don Hinton wrote: >> >>> Thanks Ben... >>> >>> On Thu, Jan 25, 2018 at 9:53 AM, Ben Hamilton >>> wrote: >>> Ah, I see from http://bcain-llvm.readthedocs.io/projects/ libunwind/en/latest/ that libunwind review discussion does take place on cfe-commits. Added. Sorry about not doing that earlier! Ben On Thu, Jan 25, 2018 at 8:37 AM Ben Hamilton wrote: > Great question. Is there an existing separate list for libunwind? > > If libunwind discussion already happens on cfe-commits, then I'll make > reviews for libunwind subscribe that list. > > On Tue, Jan 23, 2018, 21:40 Don Hinton wrote: > >> Currently, herald doesn't subscribe libunwind to any group. Should >> it be added to cfe-commits? >> >> https://reviews.llvm.org/H268 >> > >>> >> ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r323459 - Revert [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
Author: dhinton Date: Thu Jan 25 11:22:23 2018 New Revision: 323459 URL: http://llvm.org/viewvc/llvm-project?rev=323459=rev Log: Revert [libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries. Shoaib Meenai pointed out this will break standalone builds when built without llvm. Differential Revision: https://reviews.llvm.org/D42459 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=323459=323458=323459=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Thu Jan 25 11:22:23 2018 @@ -222,7 +222,6 @@ set(LIBCXX_TARGETS) # Build the shared library. if (LIBCXX_ENABLE_SHARED) add_library(cxx_shared SHARED $) - llvm_setup_rpath(cxx_shared) target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) set_target_properties(cxx_shared PROPERTIES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r323458 - Revert [libcxxabi] r323455 - [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries.
Author: dhinton Date: Thu Jan 25 11:18:51 2018 New Revision: 323458 URL: http://llvm.org/viewvc/llvm-project?rev=323458=rev Log: Revert [libcxxabi] r323455 - [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries. Shoaib Meenai pointed out this will break standalone builds can be built without llvm. Differential Revision: https://reviews.llvm.org/D42460 Modified: libcxxabi/trunk/src/CMakeLists.txt Modified: libcxxabi/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=323458=323457=323458=diff == --- libcxxabi/trunk/src/CMakeLists.txt (original) +++ libcxxabi/trunk/src/CMakeLists.txt Thu Jan 25 11:18:51 2018 @@ -127,7 +127,6 @@ set(LIBCXXABI_TARGETS) # Build the shared library. if (LIBCXXABI_ENABLE_SHARED) add_library(cxxabi_shared SHARED $) - llvm_setup_rpath(cxxabi_shared) target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES}) set_target_properties(cxxabi_shared PROPERTIES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Please subscribe "rUNW libunwind" to cfe-commits.
Btw, I'm seeing other inconsistencies, e.g., I just committed https://reviews.llvm.org/D42460 and herald ended up adding both cfe-commits and llvm-commits to subscribers. When I created it, I left subscribers blank, so herald added cfe-commits -- which seems to be correct. Then, when I committed it, herald added llvm-commits -- which doesn't seem correct. On Thu, Jan 25, 2018 at 10:04 AM, Don Hintonwrote: > Thanks Ben... > > On Thu, Jan 25, 2018 at 9:53 AM, Ben Hamilton > wrote: > >> Ah, I see from http://bcain-llvm.readthedocs.io/projects/libunwind/en/ >> latest/ that libunwind review discussion does take place on cfe-commits. >> >> Added. Sorry about not doing that earlier! >> >> Ben >> >> On Thu, Jan 25, 2018 at 8:37 AM Ben Hamilton >> wrote: >> >>> Great question. Is there an existing separate list for libunwind? >>> >>> If libunwind discussion already happens on cfe-commits, then I'll make >>> reviews for libunwind subscribe that list. >>> >>> On Tue, Jan 23, 2018, 21:40 Don Hinton wrote: >>> Currently, herald doesn't subscribe libunwind to any group. Should it be added to cfe-commits? https://reviews.llvm.org/H268 >>> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r323455 - [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries.
Author: dhinton Date: Thu Jan 25 10:43:18 2018 New Revision: 323455 URL: http://llvm.org/viewvc/llvm-project?rev=323455=rev Log: [cmake] [libcxxabi] Call llvm_setup_rpath() when adding shared libraries. Clang and llvm already use llvm_setup_rpath(), so this change will help standarize rpath usage across all projects. Differential Revision: https://reviews.llvm.org/D42460 Modified: libcxxabi/trunk/src/CMakeLists.txt Modified: libcxxabi/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=323455=323454=323455=diff == --- libcxxabi/trunk/src/CMakeLists.txt (original) +++ libcxxabi/trunk/src/CMakeLists.txt Thu Jan 25 10:43:18 2018 @@ -127,6 +127,7 @@ set(LIBCXXABI_TARGETS) # Build the shared library. if (LIBCXXABI_ENABLE_SHARED) add_library(cxxabi_shared SHARED $) + llvm_setup_rpath(cxxabi_shared) target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES}) set_target_properties(cxxabi_shared PROPERTIES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
Author: dhinton Date: Thu Jan 25 10:13:26 2018 New Revision: 323453 URL: http://llvm.org/viewvc/llvm-project?rev=323453=rev Log: [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries. Clang and llvm already use llvm_setup_rpath(), so this change will help standarize rpath usage across all projects. Differential Revision: https://reviews.llvm.org/D42459 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=323453=323452=323453=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Thu Jan 25 10:13:26 2018 @@ -222,6 +222,7 @@ set(LIBCXX_TARGETS) # Build the shared library. if (LIBCXX_ENABLE_SHARED) add_library(cxx_shared SHARED $) + llvm_setup_rpath(cxx_shared) target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) set_target_properties(cxx_shared PROPERTIES ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: Please subscribe "rUNW libunwind" to cfe-commits.
Thanks Ben... On Thu, Jan 25, 2018 at 9:53 AM, Ben Hamiltonwrote: > Ah, I see from http://bcain-llvm.readthedocs.io/projects/ > libunwind/en/latest/ that libunwind review discussion does take place on > cfe-commits. > > Added. Sorry about not doing that earlier! > > Ben > > On Thu, Jan 25, 2018 at 8:37 AM Ben Hamilton > wrote: > >> Great question. Is there an existing separate list for libunwind? >> >> If libunwind discussion already happens on cfe-commits, then I'll make >> reviews for libunwind subscribe that list. >> >> On Tue, Jan 23, 2018, 21:40 Don Hinton wrote: >> >>> Currently, herald doesn't subscribe libunwind to any group. Should it >>> be added to cfe-commits? >>> >>> https://reviews.llvm.org/H268 >>> >> ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Please subscribe "rUNW libunwind" to cfe-commits.
Currently, herald doesn't subscribe libunwind to any group. Should it be added to cfe-commits? https://reviews.llvm.org/H268 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r323171 - [cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.
Author: dhinton Date: Mon Jan 22 19:30:23 2018 New Revision: 323171 URL: http://llvm.org/viewvc/llvm-project?rev=323171=rev Log: [cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones. * Previously part of https://reviews.llvm.org/D41622. Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=323171=323170=323171=diff == --- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original) +++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Mon Jan 22 19:30:23 2018 @@ -9,7 +9,7 @@ INCLUDE(CheckCXXSourceCompiles) function(check_cxx_atomics varname) set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include") if (${LIBCXX_GCC_TOOLCHAIN}) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}") endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r323145 - [cmake] [libcxxabi] Fix find_path() problems when cross compiling
Author: dhinton Date: Mon Jan 22 11:41:05 2018 New Revision: 323145 URL: http://llvm.org/viewvc/llvm-project?rev=323145=rev Log: [cmake] [libcxxabi] Fix find_path() problems when cross compiling When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY globally which means find_path() always prepends CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH to all paths used in the search. However, these find_path() invocations are looking for paths in the libcxx and libunwind projects on the host system, not the target system, which can be done by passing NO_CMAKE_FIND_ROOT_PATH. Differential Revision: https://reviews.llvm.org/D41623 Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=323145=323144=323145=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Mon Jan 22 11:41:05 2018 @@ -115,6 +115,7 @@ find_path( ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES} ${LIBCXXABI_LIBCXX_INCLUDE_DIRS} ${LLVM_INCLUDE_DIR}/c++/v1 + NO_CMAKE_FIND_ROOT_PATH ) set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH @@ -127,6 +128,7 @@ find_path( ${LIBCXXABI_LIBCXX_INCLUDES}/../ ${LIBCXXABI_LIBCXX_SRC_DIRS} NO_DEFAULT_PATH + NO_CMAKE_FIND_ROOT_PATH ) if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND") @@ -425,6 +427,7 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_ ${LLVM_MAIN_SRC_DIR}/projects/libunwind/include ${LLVM_MAIN_SRC_DIR}/runtimes/libunwind/include NO_DEFAULT_PATH +NO_CMAKE_FIND_ROOT_PATH ) if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r323143 - [cmake] [libcxx] Fix find_path() problems when cross compiling.
Author: dhinton Date: Mon Jan 22 11:26:38 2018 New Revision: 323143 URL: http://llvm.org/viewvc/llvm-project?rev=323143=rev Log: [cmake] [libcxx] Fix find_path() problems when cross compiling. When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY globally which means find_path() always prepends CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH to all paths used in the search. However, this find_path() invocation is looking for a path in the libcxxabi project on the host system, not the target system, which can be done by passing NO_CMAKE_FIND_ROOT_PATH. Differential Revision: https://reviews.llvm.org/D41622 Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=323143=323142=323143=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Mon Jan 22 11:26:38 2018 @@ -123,6 +123,7 @@ if (LIBCXX_CXX_ABI STREQUAL "default") ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include NO_DEFAULT_PATH +NO_CMAKE_FIND_ROOT_PATH ) if (LIBCXX_TARGETING_MSVC) # FIXME: Figure out how to configure the ABI library on Windows. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r323141 - [cmake] [libunwind] Fix find_path() problems when cross compiling
Author: dhinton Date: Mon Jan 22 11:15:06 2018 New Revision: 323141 URL: http://llvm.org/viewvc/llvm-project?rev=323141=rev Log: [cmake] [libunwind] Fix find_path() problems when cross compiling When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY globally which means find_path() always prepends CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH to all paths used in the search. However, this find_path() invocation is looking for a path in the libcxx project on the host system, not the target system, which can be done by passing NO_CMAKE_FIND_ROOT_PATH. Differential Revision: https://reviews.llvm.org/D41621 Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=323141=323140=323141=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Mon Jan 22 11:15:06 2018 @@ -329,7 +329,8 @@ find_path( PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include NO_DEFAULT_PATH -) + NO_CMAKE_FIND_ROOT_PATH + ) if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}") set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r322977 - [cmake] Also pass CMAKE_ASM_COMPILER_ID to next stage when bootstrapping
Author: dhinton Date: Fri Jan 19 10:31:12 2018 New Revision: 322977 URL: http://llvm.org/viewvc/llvm-project?rev=322977=rev Log: [cmake] Also pass CMAKE_ASM_COMPILER_ID to next stage when bootstrapping Summary: When setting CMAKE_ASM_COMPILER=clang, we also need to set CMAKE_ASM_COMPILER_ID=Clang. This is needed because cmake won't set CMAKE_ASM_COMPILER_ID if CMAKE_ASM_COMPILER is already set. Without CMAKE_ASM_COMPILER_ID, cmake can't set CMAKE_ASM_COMPILER_OPTIONS_TARGET either, which means CMAKE_ASM_COMPILER_TARGET is ignored, causing cross compiling to fail, i.e., `--target=${CMAKE_ASM_COMPILER_TARGET}` isn't passed. Differential Revision: https://reviews.llvm.org/D42232 Modified: cfe/trunk/CMakeLists.txt Modified: cfe/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=322977=322976=322977=diff == --- cfe/trunk/CMakeLists.txt (original) +++ cfe/trunk/CMakeLists.txt Fri Jan 19 10:31:12 2018 @@ -624,7 +624,8 @@ if (CLANG_ENABLE_BOOTSTRAP) set(COMPILER_OPTIONS -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${CXX_COMPILER} -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER} --DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER}) +-DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/${C_COMPILER} +-DCMAKE_ASM_COMPILER_ID=Clang) if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED) add_dependencies(clang-bootstrap-deps llvm-profdata) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r322870 - [cmake] [libcxxabi] Don't print warning when tests are disabled.
Author: dhinton Date: Thu Jan 18 10:29:36 2018 New Revision: 322870 URL: http://llvm.org/viewvc/llvm-project?rev=322870=rev Log: [cmake] [libcxxabi] Don't print warning when tests are disabled. Summary: Don't print, possibly erroneous, warning if LIBCXXABI_INCLUDE_TESTS is false. This patch fixes a problem introduced in r291367. Differential Revision: https://reviews.llvm.org/D42229 Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=322870=322869=322870=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Thu Jan 18 10:29:36 2018 @@ -440,18 +440,21 @@ endif() # soname, etc... add_subdirectory(src) -if (NOT LIBCXXABI_INCLUDE_TESTS OR (LIBCXXABI_STANDALONE_BUILD AND NOT LIBCXXABI_ENABLE_SHARED)) - # We can't reasonably test the system C++ library with a static libc++abi. - # We either need to be able to replace libc++abi at run time (with a shared - # libc++abi), or we need to be able to replace the C++ runtime (with a non- - # standalone build). - message(WARNING "The libc++abi tests aren't valid when libc++abi is built " - "standalone (i.e. outside of llvm/projects/libcxxabi ) and " - "is built without a shared library. Either build a shared " - "library, build libc++abi at the same time as you build " - "libc++, or do without testing. No check target will be " - "available!") -else() - add_subdirectory(test) - add_subdirectory(fuzz) +if (LIBCXXABI_INCLUDE_TESTS) + if (LIBCXXABI_STANDALONE_BUILD AND NOT LIBCXXABI_ENABLE_SHARED) +# We can't reasonably test the system C++ library with a static +# libc++abi. We either need to be able to replace libc++abi at +# run time (with a shared libc++abi), or we need to be able to +# replace the C++ runtime (with a non- standalone build). +message(WARNING "The libc++abi tests aren't valid when libc++abi " +"is built standalone (i.e. outside of " +"llvm/projects/libcxxabi ) and is built without " +"a shared library. Either build a shared " +"library, build libc++abi at the same time as " +"you build libc++, or do without testing. No " +"check target will be available!") + else() +add_subdirectory(test) +add_subdirectory(fuzz) + endif() endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r322147 - [cmake] Delete redundant install command for clang-refactor.
Author: dhinton Date: Tue Jan 9 17:00:28 2018 New Revision: 322147 URL: http://llvm.org/viewvc/llvm-project?rev=322147=rev Log: [cmake] Delete redundant install command for clang-refactor. Summary: Install targets for clang tools are controlled by CLANG_BUILD_TOOLS, and when OFF, cmake issues the following warning: WARNING: Target "clang-refactor" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case. Differential Revision: https://reviews.llvm.org/D41807 Modified: cfe/trunk/tools/clang-refactor/CMakeLists.txt Modified: cfe/trunk/tools/clang-refactor/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-refactor/CMakeLists.txt?rev=322147=322146=322147=diff == --- cfe/trunk/tools/clang-refactor/CMakeLists.txt (original) +++ cfe/trunk/tools/clang-refactor/CMakeLists.txt Tue Jan 9 17:00:28 2018 @@ -20,5 +20,3 @@ target_link_libraries(clang-refactor clangToolingCore clangToolingRefactor ) - -install(TARGETS clang-refactor RUNTIME DESTINATION bin) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libunwind] r321440 - [libunwind] Avoid using C++ headers.
On Mon, Dec 25, 2017 at 1:10 PM, whitequarkwrote: > On 2017-12-25 20:54, Don Hinton wrote: > >> On Mon, Dec 25, 2017 at 12:43 PM, whitequark >> wrote: >> >>> On 2017-12-25 20:32, Don Hinton wrote: >>> It should also assert for non-integral types. >>> >>> True, but I do not know enough C++ magic to implement that. AIUI >>> std::numeric_limits implements this by specializing a template for >>> every >>> integral type, which is not something I will do here. Of course >>> there's a standard template for checking whether a type is integral, >>> but that also lives in libcxx. >>> >> >> Why not just use static_cast(~0) and avoid all these issues? >> > > r321448. Thanks for the review! > LGTM, thanks... > > >> You might have a point that this doesn't apply in your case, but it's >> a good habit to get into. >> >> On Mon, Dec 25, 2017 at 12:06 PM, whitequark >>> wrote: >>> >>> On 2017-12-25 19:43, Don Hinton wrote: >>> >>> Here's the patch I applied locally. >>> >>> hth... >>> don >>> [snip] >>> >>> I've committed a slightly beautified version of the patch (below) >>> as r321446. Cheers! >>> >>> From 8a4760bafc1123f09438587ee5432eabdec3d33d Mon Sep 17 00:00:00 >>> 2001 >>> From: whitequark >>> Date: Mon, 25 Dec 2017 20:03:40 + >>> Subject: [PATCH] [libunwind] Unbreak debug builds after r321440. >>> >>> --- >>> src/DwarfParser.hpp | 11 +++ >>> 1 file changed, 7 insertions(+), 4 deletions(-) >>> >>> diff --git a/src/DwarfParser.hpp b/src/DwarfParser.hpp >>> index 518101e..645ac21 100644 >>> --- a/src/DwarfParser.hpp >>> +++ b/src/DwarfParser.hpp >>> @@ -17,7 +17,6 @@ >>> #include >>> #include >>> #include >>> -#include >>> >>> #include "libunwind.h" >>> #include "dwarf2.h" >>> @@ -26,6 +25,10 @@ >>> >>> namespace libunwind { >>> >>> +// Avoid relying on C++ headers. >>> +template >>> +static constexpr T pint_max_value() { return ~0; } >>> + >>> /// CFI_Parser does basic parsing of a CFI (Call Frame Information) >>> records. >>> /// See DWARF Spec for details: >>> /// >>> >> >> http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB >> -Core-generic/ehframechpt.html >> [5] >> >> >> [1] >>> >>> @@ -540,7 +543,7 @@ bool CFI_Parser::parseInstructions(A >>> , pint_t instructions, >>> results->cfaRegister = 0; >>> results->cfaExpression = (int64_t)p; >>> length = addressSpace.getULEB128(p, instructionsEnd); >>> - assert(length < std::numeric_limits::max() && >>> "pointer overflow"); >>> + assert(length < pint_max_value() && "pointer >>> overflow"); >>> p += static_cast(length); >>> >>> _LIBUNWIND_TRACE_DWARF("DW_CFA_def_cfa_expression(expression=0x%" >>> PRIx64 >>> ", length=%" PRIu64 ")\n", >>> @@ -556,7 +559,7 @@ bool CFI_Parser::parseInstructions(A >>> , pint_t instructions, >>> results->savedRegisters[reg].location = >>> kRegisterAtExpression; >>> results->savedRegisters[reg].value = (int64_t)p; >>> length = addressSpace.getULEB128(p, instructionsEnd); >>> - assert(length < std::numeric_limits::max() && >>> "pointer overflow"); >>> + assert(length < pint_max_value() && "pointer >>> overflow"); >>> p += static_cast(length); >>> _LIBUNWIND_TRACE_DWARF("DW_CFA_expression(reg=%" PRIu64 ", " >>> "expression=0x%" PRIx64 ", " >>> @@ -642,7 +645,7 @@ bool CFI_Parser::parseInstructions(A >>> , pint_t instructions, >>> results->savedRegisters[reg].location = >>> kRegisterIsExpression; >>> results->savedRegisters[reg].value = (int64_t)p; >>> length = addressSpace.getULEB128(p, instructionsEnd); >>> - assert(length < std::numeric_limits::max() && >>> "pointer overflow"); >>> + assert(length < pint_max_value() && "pointer >>> overflow"); >>> p += static_cast(length); >>> _LIBUNWIND_TRACE_DWARF("DW_CFA_val_expression(reg=%" PRIu64 >>> ", " >>> "expression=0x%" PRIx64 ", length=%" >>> PRIu64 ")\n", >>> -- >>> 2.11.0 >>> >>> On Mon, Dec 25, 2017 at 11:26 AM, Don Hinton >>> wrote: >>> >>> On Mon, Dec 25, 2017 at 11:09 AM, whitequark >>> wrote: >>> On 2017-12-25 19:04, Don Hinton wrote: >>> Hi: >>> >>> This change breaks in a local debug build, e.g.,: >>> >> /Users/dhinton/projects/llvm_project/libunwind/src/DwarfPar >> ser.hpp:559:28: >> >> error: no member named 'numeric_limits' in namespace 'std' >>> assert(length < std::numeric_limits::max() && "pointer >>> overflow"); >>> ~^ >>> >>> Sorry, I missed this. Any idea on reformulating the assert in a way >>> that does not require libcxx headers? Not having them significantly >>> simplifies bare-metal builds... >>> >>> Well, assuming pint_t is some unsigned integer type, the max can be >>> found like this: >>> >>> pint_t max_pint_t = ~0; >>> >>> So, that could be used in a pinch. >>> >>> thanks... >>> don >>> >>> On Mon, Dec 25, 2017 at 5:06 AM, whitequark via cfe-commits >>> wrote: >>> >>> Author: whitequark >>> Date: Mon Dec 25
Re: [libunwind] r321440 - [libunwind] Avoid using C++ headers.
On Mon, Dec 25, 2017 at 12:43 PM, whitequarkwrote: > On 2017-12-25 20:32, Don Hinton wrote: > >> While beauty is in the eye of the beholder, I'm not sure introducing a >> new template function in a header that's only used in that header is a >> good idea. Every file that includes DwarfParser.hpp is going to get >> that template function -- and someone may try to use it someday. >> > > That header is a header private to the libunwind implementation, > and the template function is confined to `namespace libunwind`. Smaller universe, but still the same issue. > > > However, if you did want to do that, you should handle signed types as >> well, which pint_max_value doesn't do. >> > > `pint_t` is an unsigned type in libunwind, the signed counterpart is > `sint_t` The point is that a template can take any type. Once you introduce it, it can be used by anyone with any type. > . > > It should also assert for non-integral types. >> > > True, but I do not know enough C++ magic to implement that. AIUI > std::numeric_limits implements this by specializing a template for every > integral type, which is not something I will do here. Of course > there's a standard template for checking whether a type is integral, > but that also lives in libcxx. > Why not just use static_cast(~0) and avoid all these issues? You might have a point that this doesn't apply in your case, but it's a good habit to get into. > > >> On Mon, Dec 25, 2017 at 12:06 PM, whitequark >> wrote: >> >> On 2017-12-25 19:43, Don Hinton wrote: >>> >>> Here's the patch I applied locally. hth... don [snip] >>> >>> I've committed a slightly beautified version of the patch (below) >>> as r321446. Cheers! >>> >>> From 8a4760bafc1123f09438587ee5432eabdec3d33d Mon Sep 17 00:00:00 >>> 2001 >>> From: whitequark >>> Date: Mon, 25 Dec 2017 20:03:40 + >>> Subject: [PATCH] [libunwind] Unbreak debug builds after r321440. >>> >>> --- >>> src/DwarfParser.hpp | 11 +++ >>> 1 file changed, 7 insertions(+), 4 deletions(-) >>> >>> diff --git a/src/DwarfParser.hpp b/src/DwarfParser.hpp >>> index 518101e..645ac21 100644 >>> --- a/src/DwarfParser.hpp >>> +++ b/src/DwarfParser.hpp >>> @@ -17,7 +17,6 @@ >>> #include >>> #include >>> #include >>> -#include >>> >>> #include "libunwind.h" >>> #include "dwarf2.h" >>> @@ -26,6 +25,10 @@ >>> >>> namespace libunwind { >>> >>> +// Avoid relying on C++ headers. >>> +template >>> +static constexpr T pint_max_value() { return ~0; } >>> + >>> /// CFI_Parser does basic parsing of a CFI (Call Frame Information) >>> records. >>> /// See DWARF Spec for details: >>> /// >>> >>> http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB >> -Core-generic/ehframechpt.html >> >>> [1] >>> >>> @@ -540,7 +543,7 @@ bool CFI_Parser::parseInstructions(A >>> , pint_t instructions, >>> results->cfaRegister = 0; >>> results->cfaExpression = (int64_t)p; >>> length = addressSpace.getULEB128(p, instructionsEnd); >>> - assert(length < std::numeric_limits::max() && >>> "pointer overflow"); >>> + assert(length < pint_max_value() && "pointer >>> overflow"); >>> p += static_cast(length); >>> >>> _LIBUNWIND_TRACE_DWARF("DW_CFA_def_cfa_expression(expression=0x%" >>> PRIx64 >>> ", length=%" PRIu64 ")\n", >>> @@ -556,7 +559,7 @@ bool CFI_Parser::parseInstructions(A >>> , pint_t instructions, >>> results->savedRegisters[reg].location = >>> kRegisterAtExpression; >>> results->savedRegisters[reg].value = (int64_t)p; >>> length = addressSpace.getULEB128(p, instructionsEnd); >>> - assert(length < std::numeric_limits::max() && >>> "pointer overflow"); >>> + assert(length < pint_max_value() && "pointer >>> overflow"); >>> p += static_cast(length); >>> _LIBUNWIND_TRACE_DWARF("DW_CFA_expression(reg=%" PRIu64 ", " >>> "expression=0x%" PRIx64 ", " >>> @@ -642,7 +645,7 @@ bool CFI_Parser::parseInstructions(A >>> , pint_t instructions, >>> results->savedRegisters[reg].location = >>> kRegisterIsExpression; >>> results->savedRegisters[reg].value = (int64_t)p; >>> length = addressSpace.getULEB128(p, instructionsEnd); >>> - assert(length < std::numeric_limits::max() && >>> "pointer overflow"); >>> + assert(length < pint_max_value() && "pointer >>> overflow"); >>> p += static_cast(length); >>> _LIBUNWIND_TRACE_DWARF("DW_CFA_val_expression(reg=%" PRIu64 >>> ", " >>> "expression=0x%" PRIx64 ", length=%" >>> PRIu64 ")\n", >>> -- >>> 2.11.0 >>> >>> On Mon, Dec 25, 2017 at 11:26 AM, Don Hinton >>> wrote: >>> >>> On Mon, Dec 25, 2017 at 11:09 AM, whitequark >>> wrote: >>> On 2017-12-25 19:04, Don Hinton wrote: >>> Hi: >>> >>> This change breaks in a local debug build, e.g.,: >>> >>> >>> /Users/dhinton/projects/llvm_project/libunwind/src/DwarfPars >> er.hpp:559:28: >> >>> error: no member named 'numeric_limits' in namespace 'std' >>> assert(length < std::numeric_limits::max()
Re: [libunwind] r321440 - [libunwind] Avoid using C++ headers.
While beauty is in the eye of the beholder, I'm not sure introducing a new template function in a header that's only used in that header is a good idea. Every file that includes DwarfParser.hpp is going to get that template function -- and someone may try to use it someday. However, if you did want to do that, you should handle signed types as well, which pint_max_value doesn't do. It should also assert for non-integral types. On Mon, Dec 25, 2017 at 12:06 PM, whitequarkwrote: > On 2017-12-25 19:43, Don Hinton wrote: > >> Here's the patch I applied locally. >> >> hth... >> don >> [snip] >> > > I've committed a slightly beautified version of the patch (below) > as r321446. Cheers! > > From 8a4760bafc1123f09438587ee5432eabdec3d33d Mon Sep 17 00:00:00 2001 > From: whitequark > Date: Mon, 25 Dec 2017 20:03:40 + > Subject: [PATCH] [libunwind] Unbreak debug builds after r321440. > > --- > src/DwarfParser.hpp | 11 +++ > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/src/DwarfParser.hpp b/src/DwarfParser.hpp > index 518101e..645ac21 100644 > --- a/src/DwarfParser.hpp > +++ b/src/DwarfParser.hpp > @@ -17,7 +17,6 @@ > #include > #include > #include > -#include > > #include "libunwind.h" > #include "dwarf2.h" > @@ -26,6 +25,10 @@ > > namespace libunwind { > > +// Avoid relying on C++ headers. > +template > +static constexpr T pint_max_value() { return ~0; } > + > /// CFI_Parser does basic parsing of a CFI (Call Frame Information) > records. > /// See DWARF Spec for details: > ///http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB > -Core-generic/ehframechpt.html > @@ -540,7 +543,7 @@ bool CFI_Parser::parseInstructions(A > , pint_t instructions, >results->cfaRegister = 0; >results->cfaExpression = (int64_t)p; >length = addressSpace.getULEB128(p, instructionsEnd); > - assert(length < std::numeric_limits::max() && "pointer > overflow"); > + assert(length < pint_max_value() && "pointer overflow"); >p += static_cast(length); >_LIBUNWIND_TRACE_DWARF("DW_CFA_def_cfa_expression(expression=0x%" > PRIx64 > ", length=%" PRIu64 ")\n", > @@ -556,7 +559,7 @@ bool CFI_Parser::parseInstructions(A > , pint_t instructions, >results->savedRegisters[reg].location = kRegisterAtExpression; >results->savedRegisters[reg].value = (int64_t)p; >length = addressSpace.getULEB128(p, instructionsEnd); > - assert(length < std::numeric_limits::max() && "pointer > overflow"); > + assert(length < pint_max_value() && "pointer overflow"); >p += static_cast(length); >_LIBUNWIND_TRACE_DWARF("DW_CFA_expression(reg=%" PRIu64 ", " > "expression=0x%" PRIx64 ", " > @@ -642,7 +645,7 @@ bool CFI_Parser::parseInstructions(A > , pint_t instructions, >results->savedRegisters[reg].location = kRegisterIsExpression; >results->savedRegisters[reg].value = (int64_t)p; >length = addressSpace.getULEB128(p, instructionsEnd); > - assert(length < std::numeric_limits::max() && "pointer > overflow"); > + assert(length < pint_max_value() && "pointer overflow"); >p += static_cast(length); >_LIBUNWIND_TRACE_DWARF("DW_CFA_val_expression(reg=%" PRIu64 ", " > "expression=0x%" PRIx64 ", length=%" PRIu64 > ")\n", > -- > 2.11.0 > > >> On Mon, Dec 25, 2017 at 11:26 AM, Don Hinton >> wrote: >> >> On Mon, Dec 25, 2017 at 11:09 AM, whitequark >>> wrote: >>> On 2017-12-25 19:04, Don Hinton wrote: >>> Hi: >>> >>> This change breaks in a local debug build, e.g.,: >>> >>> >>> /Users/dhinton/projects/llvm_project/libunwind/src/DwarfPars >> er.hpp:559:28: >> >>> error: no member named 'numeric_limits' in namespace 'std' >>> assert(length < std::numeric_limits::max() && "pointer >>> overflow"); >>> ~^ >>> >>> Sorry, I missed this. Any idea on reformulating the assert in a way >>> that does not require libcxx headers? Not having them significantly >>> simplifies bare-metal builds... >>> >> >> Well, assuming pint_t is some unsigned integer type, the max can be >> found like this: >> >> pint_t max_pint_t = ~0; >> >> So, that could be used in a pinch. >> >> thanks... >>> don >>> >>> On Mon, Dec 25, 2017 at 5:06 AM, whitequark via cfe-commits >>> wrote: >>> >>> Author: whitequark >>> Date: Mon Dec 25 05:06:09 2017 >>> New Revision: 321440 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=321440=rev [1] >>> [1] >>> Log: >>> [libunwind] Avoid using C++ headers. >>> >>> This is useful for building libunwind on libcxx-free systems. >>> >>> Modified: >>> libunwind/trunk/src/DwarfParser.hpp >>> >>> Modified: libunwind/trunk/src/DwarfParser.hpp >>> URL: >>> >>> >>> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >> fParser.hpp?rev=321440=321439=321440=diff
Re: [libunwind] r321440 - [libunwind] Avoid using C++ headers.
Here's the patch I applied locally. hth... don diff --git a/src/DwarfParser.hpp b/src/DwarfParser.hpp index 518101e..ac4f1c4 100644 --- a/src/DwarfParser.hpp +++ b/src/DwarfParser.hpp @@ -540,7 +540,7 @@ bool CFI_Parser::parseInstructions(A , pint_t instructions, results->cfaRegister = 0; results->cfaExpression = (int64_t)p; length = addressSpace.getULEB128(p, instructionsEnd); - assert(length < std::numeric_limits::max() && "pointer overflow"); + assert(length < static_cast(~0) && "pointer overflow"); p += static_cast(length); _LIBUNWIND_TRACE_DWARF("DW_CFA_def_cfa_expression(expression=0x%" PRIx64 ", length=%" PRIu64 ")\n", @@ -556,7 +556,7 @@ bool CFI_Parser::parseInstructions(A , pint_t instructions, results->savedRegisters[reg].location = kRegisterAtExpression; results->savedRegisters[reg].value = (int64_t)p; length = addressSpace.getULEB128(p, instructionsEnd); - assert(length < std::numeric_limits::max() && "pointer overflow"); + assert(length < static_cast(~0) && "pointer overflow"); p += static_cast(length); _LIBUNWIND_TRACE_DWARF("DW_CFA_expression(reg=%" PRIu64 ", " "expression=0x%" PRIx64 ", " @@ -642,7 +642,7 @@ bool CFI_Parser::parseInstructions(A , pint_t instructions, results->savedRegisters[reg].location = kRegisterIsExpression; results->savedRegisters[reg].value = (int64_t)p; length = addressSpace.getULEB128(p, instructionsEnd); - assert(length < std::numeric_limits::max() && "pointer overflow"); + assert(length < static_cast(~0) && "pointer overflow"); p += static_cast(length); _LIBUNWIND_TRACE_DWARF("DW_CFA_val_expression(reg=%" PRIu64 ", " "expression=0x%" PRIx64 ", length=%" PRIu64 ")\n", On Mon, Dec 25, 2017 at 11:26 AM, Don Hintonwrote: > > On Mon, Dec 25, 2017 at 11:09 AM, whitequark > wrote: > >> On 2017-12-25 19:04, Don Hinton wrote: >> >>> Hi: >>> >>> This change breaks in a local debug build, e.g.,: >>> >>> /Users/dhinton/projects/llvm_project/libunwind/src/DwarfPars >>> er.hpp:559:28: >>> error: no member named 'numeric_limits' in namespace 'std' >>> assert(length < std::numeric_limits::max() && "pointer >>> overflow"); >>> ~^ >>> >> >> Sorry, I missed this. Any idea on reformulating the assert in a way >> that does not require libcxx headers? Not having them significantly >> simplifies bare-metal builds... >> > > Well, assuming pint_t is some unsigned integer type, the max can be found > like this: > > pint_t max_pint_t = ~0; > > So, that could be used in a pinch. > > >> >> >>> thanks... >>> don >>> >>> On Mon, Dec 25, 2017 at 5:06 AM, whitequark via cfe-commits >>> wrote: >>> >>> Author: whitequark Date: Mon Dec 25 05:06:09 2017 New Revision: 321440 URL: http://llvm.org/viewvc/llvm-project?rev=321440=rev [1] Log: [libunwind] Avoid using C++ headers. This is useful for building libunwind on libcxx-free systems. Modified: libunwind/trunk/src/DwarfParser.hpp Modified: libunwind/trunk/src/DwarfParser.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >>> fParser.hpp?rev=321440=321439=321440=diff >>> [2] >>> == >>> --- libunwind/trunk/src/DwarfParser.hpp (original) +++ libunwind/trunk/src/DwarfParser.hpp Mon Dec 25 05:06:09 2017 @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "libunwind.h" #include "dwarf2.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits [3] >>> >>> >>> >>> Links: >>> -- >>> [1] http://llvm.org/viewvc/llvm-project?rev=321440view=rev >>> [2] >>> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >>> fParser.hpp?rev=321440r1=321439r2=321440view=diff >>> [3] http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> >> -- >> whitequark >> > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libunwind] r321440 - [libunwind] Avoid using C++ headers.
On Mon, Dec 25, 2017 at 11:09 AM, whitequarkwrote: > On 2017-12-25 19:04, Don Hinton wrote: > >> Hi: >> >> This change breaks in a local debug build, e.g.,: >> >> /Users/dhinton/projects/llvm_project/libunwind/src/DwarfPars >> er.hpp:559:28: >> error: no member named 'numeric_limits' in namespace 'std' >> assert(length < std::numeric_limits::max() && "pointer >> overflow"); >> ~^ >> > > Sorry, I missed this. Any idea on reformulating the assert in a way > that does not require libcxx headers? Not having them significantly > simplifies bare-metal builds... > Well, assuming pint_t is some unsigned integer type, the max can be found like this: pint_t max_pint_t = ~0; So, that could be used in a pinch. > > >> thanks... >> don >> >> On Mon, Dec 25, 2017 at 5:06 AM, whitequark via cfe-commits >> wrote: >> >> Author: whitequark >>> Date: Mon Dec 25 05:06:09 2017 >>> New Revision: 321440 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=321440=rev [1] >>> Log: >>> [libunwind] Avoid using C++ headers. >>> >>> This is useful for building libunwind on libcxx-free systems. >>> >>> Modified: >>> libunwind/trunk/src/DwarfParser.hpp >>> >>> Modified: libunwind/trunk/src/DwarfParser.hpp >>> URL: >>> >>> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >> fParser.hpp?rev=321440=321439=321440=diff >> >>> [2] >>> >>> >> == >> >>> --- libunwind/trunk/src/DwarfParser.hpp (original) >>> +++ libunwind/trunk/src/DwarfParser.hpp Mon Dec 25 05:06:09 2017 >>> @@ -17,7 +17,7 @@ >>> #include >>> #include >>> #include >>> -#include >>> +#include >>> >>> #include "libunwind.h" >>> #include "dwarf2.h" >>> >>> ___ >>> cfe-commits mailing list >>> cfe-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits [3] >>> >> >> >> >> Links: >> -- >> [1] http://llvm.org/viewvc/llvm-project?rev=321440view=rev >> [2] >> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >> fParser.hpp?rev=321440r1=321439r2=321440view=diff >> [3] http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > > -- > whitequark > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libunwind] r321440 - [libunwind] Avoid using C++ headers.
Hi: This change breaks in a local debug build, e.g.,: /Users/dhinton/projects/llvm_project/libunwind/src/DwarfParser.hpp:559:28: error: no member named 'numeric_limits' in namespace 'std' assert(length < std::numeric_limits::max() && "pointer overflow"); ~^ thanks... don On Mon, Dec 25, 2017 at 5:06 AM, whitequark via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: whitequark > Date: Mon Dec 25 05:06:09 2017 > New Revision: 321440 > > URL: http://llvm.org/viewvc/llvm-project?rev=321440=rev > Log: > [libunwind] Avoid using C++ headers. > > This is useful for building libunwind on libcxx-free systems. > > Modified: > libunwind/trunk/src/DwarfParser.hpp > > Modified: libunwind/trunk/src/DwarfParser.hpp > URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/ > DwarfParser.hpp?rev=321440=321439=321440=diff > > == > --- libunwind/trunk/src/DwarfParser.hpp (original) > +++ libunwind/trunk/src/DwarfParser.hpp Mon Dec 25 05:06:09 2017 > @@ -17,7 +17,7 @@ > #include > #include > #include > -#include > +#include > > #include "libunwind.h" > #include "dwarf2.h" > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321435 - [libcxx] Suppress unused warning on apple.
Author: dhinton Date: Sun Dec 24 21:33:42 2017 New Revision: 321435 URL: http://llvm.org/viewvc/llvm-project?rev=321435=rev Log: [libcxx] Suppress unused warning on apple. Summary: This warning is already suppressed on non-apple platforms, so this change just suppresses it on apple as well. Reviewers: EricWF, lichray Reviewed By: lichray Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41248 Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=321435=321434=321435=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sun Dec 24 21:33:42 2017 @@ -512,6 +512,7 @@ using StatT = struct stat; #if defined(__APPLE__) TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; } +__attribute__((unused)) // Suppress warning TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; } #else TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r320751 - [debuginfo] Remove temporary FIXME.
Author: dhinton Date: Thu Dec 14 14:12:46 2017 New Revision: 320751 URL: http://llvm.org/viewvc/llvm-project?rev=320751=rev Log: [debuginfo] Remove temporary FIXME. Summary: Now that r320495, "[debuginfo-tests] Support moving debuginfo-tests to llvm/projects," has landed, remove temporary FIXME that supported the old mechanism. Reviewers: zturner, aprantl Reviewed By: aprantl Subscribers: JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D41259 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=320751=320750=320751=diff == --- cfe/trunk/test/lit.cfg.py (original) +++ cfe/trunk/test/lit.cfg.py Thu Dec 14 14:12:46 2017 @@ -31,7 +31,7 @@ config.suffixes = ['.c', '.cpp', '.cppm' # excludes: A list of directories to exclude from the testsuite. The 'Inputs' # subdirectories contain auxiliary inputs for various tests in their parent # directories. -config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt'] +config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt', 'debuginfo-tests'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) @@ -62,16 +62,6 @@ tools = [ 'clang-func-mapping'), unresolved='ignore'), ] -# FIXME: This logic can be removed once all buildbots have moved -# debuginfo-test from clang/test to llvm/projects or monorepo. -if os.path.exists(os.path.join(config.test_source_root, 'debuginfo-tests')): - if os.path.isfile( - os.path.join(config.test_source_root, 'debuginfo-tests', 'lit.cfg.py')): -config.excludes.append('debuginfo-tests') - else: -tools.append(ToolSubst('%test_debuginfo', command=os.path.join( - config.llvm_src_root, 'utils', 'test_debuginfo.pl'))) - if config.clang_examples: tools.append('clang-interpreter') ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r320519 - [cmake] Follow-up to rL320494.
Author: dhinton Date: Tue Dec 12 11:47:40 2017 New Revision: 320519 URL: http://llvm.org/viewvc/llvm-project?rev=320519=rev Log: [cmake] Follow-up to rL320494. EXISTS requires full paths. 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=320519=320518=320519=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Tue Dec 12 11:47:40 2017 @@ -134,9 +134,9 @@ set_target_properties(clang-test PROPERT # FIXME: This logic can be removed once all buildbots have moved # debuginfo-test from clang/test to llvm/projects or monorepo. -if(EXISTS debuginfo-tests) +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests) message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.") - if(EXISTS debuginfo-tests/CMakeLists.txt) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt) add_subdirectory(debuginfo-tests) endif() endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r320494 - [debuginfo-tests] Add support for moving debuginfo-tests from clang/test to llvm/projects or monorepo.
Author: dhinton Date: Tue Dec 12 08:48:35 2017 New Revision: 320494 URL: http://llvm.org/viewvc/llvm-project?rev=320494=rev Log: [debuginfo-tests] Add support for moving debuginfo-tests from clang/test to llvm/projects or monorepo. Summary: The new version of debuginfo-tests will have it's own lit.cfg.py file which is incompatible with the one in clang/test. This change supports both the old and new versions, and can be used until the bots actually move debuginfo-tests to either clang/test or the monorepo. This is a prerequisite for D40971. Reviewers: zturner, aprantl Subscribers: mgorny, JDevlieghere, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D41055 Modified: cfe/trunk/test/CMakeLists.txt cfe/trunk/test/lit.cfg.py Modified: cfe/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=320494=320493=320494=diff == --- cfe/trunk/test/CMakeLists.txt (original) +++ cfe/trunk/test/CMakeLists.txt Tue Dec 12 08:48:35 2017 @@ -131,3 +131,12 @@ add_lit_testsuites(CLANG ${CMAKE_CURRENT add_custom_target(clang-test) add_dependencies(clang-test check-clang) set_target_properties(clang-test PROPERTIES FOLDER "Clang tests") + +# FIXME: This logic can be removed once all buildbots have moved +# debuginfo-test from clang/test to llvm/projects or monorepo. +if(EXISTS debuginfo-tests) + message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.") + if(EXISTS debuginfo-tests/CMakeLists.txt) +add_subdirectory(debuginfo-tests) + endif() +endif() Modified: cfe/trunk/test/lit.cfg.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg.py?rev=320494=320493=320494=diff == --- cfe/trunk/test/lit.cfg.py (original) +++ cfe/trunk/test/lit.cfg.py Tue Dec 12 08:48:35 2017 @@ -58,12 +58,20 @@ tool_dirs = [config.clang_tools_dir, con tools = [ 'c-index-test', 'clang-check', 'clang-diff', 'clang-format', 'opt', -ToolSubst('%test_debuginfo', command=os.path.join( -config.llvm_src_root, 'utils', 'test_debuginfo.pl')), ToolSubst('%clang_func_map', command=FindTool( 'clang-func-mapping'), unresolved='ignore'), ] +# FIXME: This logic can be removed once all buildbots have moved +# debuginfo-test from clang/test to llvm/projects or monorepo. +if os.path.exists(os.path.join(config.test_source_root, 'debuginfo-tests')): + if os.path.isfile( + os.path.join(config.test_source_root, 'debuginfo-tests', 'lit.cfg.py')): +config.excludes.append('debuginfo-tests') + else: +tools.append(ToolSubst('%test_debuginfo', command=os.path.join( + config.llvm_src_root, 'utils', 'test_debuginfo.pl'))) + if config.clang_examples: tools.append('clang-interpreter') ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r318722 - Re-revert "Refactor debuginfo-tests."
On Mon, Nov 20, 2017 at 5:20 PM, Zachary Turner via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: zturner > Date: Mon Nov 20 17:20:28 2017 > New Revision: 318722 > > URL: http://llvm.org/viewvc/llvm-project?rev=318722=rev > Log: > Re-revert "Refactor debuginfo-tests." > > This is still breaking greendragon. > > At this point I give up until someone can fix the greendragon > bots, and I will probably abandon this effort in favor of using > a private github repository. > > Modified: > cfe/trunk/test/CMakeLists.txt > cfe/trunk/test/lit.cfg.py > > Modified: cfe/trunk/test/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > CMakeLists.txt?rev=318722=318721=318722=diff > > == > --- cfe/trunk/test/CMakeLists.txt (original) > +++ cfe/trunk/test/CMakeLists.txt Mon Nov 20 17:20:28 2017 > @@ -88,14 +88,6 @@ set(CLANG_TEST_PARAMS >clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg >) > > -if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt") > - # This is a hack to keep existing build build infrastructure working > while we > - # can migrate to the new standard workflow of checking out > debuginfo-tests into > - # llvm/projects or using it in a mono-repo > - set(DEBUGINFO_TESTS_EXCLUDE_FROM_ALL ON) > - add_subdirectory(debuginfo-tests) > -endif() > - > I think this is your problem. Essentially, you are adding the tests twice, once by recursing tree (this is the original behavior and picks up all the tests in the new test subdir), and once explicitly by including the debuginfo-tests subdirectory, which has a CMakeLists.txt file that adds the tests again. > if( NOT CLANG_BUILT_STANDALONE ) >list(APPEND CLANG_TEST_DEPS > llvm-config > > Modified: cfe/trunk/test/lit.cfg.py > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit. > cfg.py?rev=318722=318721=318722=diff > > == > --- cfe/trunk/test/lit.cfg.py (original) > +++ cfe/trunk/test/lit.cfg.py Mon Nov 20 17:20:28 2017 > @@ -58,6 +58,8 @@ tool_dirs = [config.clang_tools_dir, con > > tools = [ > 'c-index-test', 'clang-check', 'clang-diff', 'clang-format', 'opt', > +ToolSubst('%test_debuginfo', command=os.path.join( > +config.llvm_src_root, 'utils', 'test_debuginfo.pl')), > ToolSubst('%clang_func_map', command=FindTool( > 'clang-func-mapping'), unresolved='ignore'), > ] > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r313643 - Resubmit "Fix llvm-lit script generation in libcxx."
Hi Zachery: I'm seeing a breakage when cross-compiling and including libcxx in the runtimes directory. The problem is that `include(AddLLVM)`, guarded by LIBCXX_INCLUDE_TESTS, comes after your change to call `configure_lit_site_cfg`. I've fixed this locally by adding `include(AddLLVM)` to the top of libcxx/test/CMakeLists.txt, but don't believe this is the correct fix. Could you take a look? thanks... don On Tue, Sep 19, 2017 at 10:19 AM, Zachary Turner via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: zturner > Date: Tue Sep 19 10:19:10 2017 > New Revision: 313643 > > URL: http://llvm.org/viewvc/llvm-project?rev=313643=rev > Log: > Resubmit "Fix llvm-lit script generation in libcxx." > > After speaking with the libcxx owners, they agreed that this is > a bug in the bot that needs to be fixed by the bot owners, and > the CMake changes are correct. > > Modified: > libcxx/trunk/CMakeLists.txt > libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake > libcxx/trunk/test/CMakeLists.txt > > Modified: libcxx/trunk/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/ > CMakeLists.txt?rev=313643=313642=313643=diff > > == > --- libcxx/trunk/CMakeLists.txt (original) > +++ libcxx/trunk/CMakeLists.txt Tue Sep 19 10:19:10 2017 > @@ -653,6 +653,7 @@ endif() > # > # However, since some submission systems strip test/ subdirectories, > check for > # it before adding it. > + > if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test") >add_subdirectory(test) > endif() > @@ -660,6 +661,15 @@ if (LIBCXX_INCLUDE_TESTS) >add_subdirectory(lib/abi) > endif() > > +if (LIBCXX_STANDALONE_BUILD AND EXISTS "${LLVM_MAIN_SRC_DIR}/utils/ > llvm-lit") > + # Make sure the llvm-lit script is generated into the bin directory, > and do > + # it after adding all tests, since the generated script will only work > + # correctly discovered tests against test locations from the source > tree that > + # have already been discovered. > + add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit > + ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit) > +endif() > + > if (LIBCXX_INCLUDE_DOCS) >add_subdirectory(docs) > endif() > > Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/ > Modules/HandleOutOfTreeLLVM.cmake?rev=313643=313642=313643=diff > > == > --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) > +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Tue Sep 19 > 10:19:10 2017 > @@ -106,6 +106,11 @@ macro(configure_out_of_tree_llvm) > set(LLVM_ENABLE_SPHINX OFF) >endif() > > + # In a standalone build, we don't have llvm to automatically generate > the > + # llvm-lit script for us. So we need to provide an explicit directory > that > + # the configurator should write the script into. > + set(LLVM_LIT_OUTPUT_DIR "${libcxx_BINARY_DIR}/bin") > + ># Required LIT Configuration -- > -- ># Define the default arguments to use with 'lit', and an option for the > user ># to override. > > Modified: libcxx/trunk/test/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/ > CMakeLists.txt?rev=313643=313642=313643=diff > > == > --- libcxx/trunk/test/CMakeLists.txt (original) > +++ libcxx/trunk/test/CMakeLists.txt Tue Sep 19 10:19:10 2017 > @@ -49,10 +49,9 @@ set(LIBCXX_EXECUTOR "None" CACHE STRING > > set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not > edit!") > > -configure_file( > +configure_lit_site_cfg( >${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg > - @ONLY) > + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) > > set(LIBCXX_TEST_DEPS "") > > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r316773 - New lldb python module for managing diagnostic breakpoints
Author: dhinton Date: Fri Oct 27 10:02:33 2017 New Revision: 316773 URL: http://llvm.org/viewvc/llvm-project?rev=316773=rev Log: New lldb python module for managing diagnostic breakpoints Summary: Can be used to set breakpoints for either the diagnostics actually emitted for the current compilation, a particular DiagID, or all DiagIDs for a particular warning. Differential Revision: https://reviews.llvm.org/D36347 Added: cfe/trunk/utils/clangdiag.py (with props) Added: cfe/trunk/utils/clangdiag.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/clangdiag.py?rev=316773=auto == --- cfe/trunk/utils/clangdiag.py (added) +++ cfe/trunk/utils/clangdiag.py Fri Oct 27 10:02:33 2017 @@ -0,0 +1,192 @@ +#!/usr/bin/python + +#-- +# Be sure to add the python path that points to the LLDB shared library. +# +# # To use this in the embedded python interpreter using "lldb" just +# import it with the full path using the "command script import" +# command +# (lldb) command script import /path/to/clandiag.py +#-- + +import lldb +import argparse +import commands +import shlex +import os +import re +import subprocess + +class MyParser(argparse.ArgumentParser): +def format_help(self): +return ''' Commands for managing clang diagnostic breakpoints + +Syntax: clangdiag enable [|] +clangdiag disable +clangdiag diagtool [|reset] + +The following subcommands are supported: + + enable -- Enable clang diagnostic breakpoints. + disable -- Disable all clang diagnostic breakpoints. + diagtool -- Return, set, or reset diagtool path. + +This command sets breakpoints in clang, and clang based tools, that +emit diagnostics. When a diagnostic is emitted, and clangdiag is +enabled, it will use the appropriate diagtool application to determine +the name of the DiagID, and set breakpoints in all locations that +'diag::name' appears in the source. Since the new breakpoints are set +after they are encountered, users will need to launch the executable a +second time in order to hit the new breakpoints. + +For in-tree builds, the diagtool application, used to map DiagID's to +names, is found automatically in the same directory as the target +executable. However, out-or-tree builds must use the 'diagtool' +subcommand to set the appropriate path for diagtool in the clang debug +bin directory. Since this mapping is created at build-time, it's +important for users to use the same version that was generated when +clang was compiled, or else the id's won't match. + +Notes: +- Substrings can be passed for both and . +- If is passed, only enable the DiagID(s) for that warning. +- If is passed, only enable that DiagID. +- Rerunning enable clears existing breakpoints. +- diagtool is used in breakpoint callbacks, so it can be changed + without the need to rerun enable. +- Adding this to your ~.lldbinit file makes clangdiag available at startup: + "command script import /path/to/clangdiag.py" + +''' + +def create_diag_options(): +parser = MyParser(prog='clangdiag') +subparsers = parser.add_subparsers( +title='subcommands', +dest='subcommands', +metavar='') +disable_parser = subparsers.add_parser('disable') +enable_parser = subparsers.add_parser('enable') +enable_parser.add_argument('id', nargs='?') +diagtool_parser = subparsers.add_parser('diagtool') +diagtool_parser.add_argument('path', nargs='?') +return parser + +def getDiagtool(target, diagtool = None): +id = target.GetProcess().GetProcessID() +if 'diagtool' not in getDiagtool.__dict__: +getDiagtool.diagtool = {} +if diagtool: +if diagtool == 'reset': +getDiagtool.diagtool[id] = None +elif os.path.exists(diagtool): +getDiagtool.diagtool[id] = diagtool +else: +print('clangdiag: %s not found.' % diagtool) +if not id in getDiagtool.diagtool or not getDiagtool.diagtool[id]: +getDiagtool.diagtool[id] = None +exe = target.GetExecutable() +if not exe.Exists(): +print('clangdiag: Target (%s) not set.' % exe.GetFilename()) +else: +diagtool = os.path.join(exe.GetDirectory(), 'diagtool') +if os.path.exists(diagtool): +getDiagtool.diagtool[id] = diagtool +else: +print('clangdiag: diagtool not found along side %s' % exe) + +return getDiagtool.diagtool[id] + +def setDiagBreakpoint(frame, bp_loc, dict): +id = frame.FindVariable("DiagID").GetValue() +if id is None: +print('clangdiag: id is None') +return False + +# Don't need to test this time, since we did that in enable. +target = frame.GetThread().GetProcess().GetTarget() +diagtool =
Re: [PATCH] D36347: New lldb python module for adding diagnostic breakpoints
On Thu, Oct 26, 2017 at 5:44 PM, Zachary Turnerwrote: > > > On Thu, Oct 26, 2017 at 3:18 PM Don Hinton wrote: > >> On Thu, Oct 26, 2017 at 2:48 PM, Zachary Turner >> wrote: >> >>> Seems fine, it would be nice if the workflow could be improved a little >>> bit so that all you have to do is say `clangdiag break >>> —error=“-Wcovered-switch”` or something . I think that gives the most >>> intuitive usage for people, even it’s a bit harder to implement. >>> >> >> The idea was to break on actual diagnostics emitted, but if you want to >> break on diagnostic usage, i.e., when it was checked but not emitted, I >> suppose that's possible as well. diagtool doesn't produce a mapping for >> this, but it could be added -- assuming tablegen produced enough info in >> the .inc files to support it. I added the feature I'm using here a few >> months ago, which was an extension to what Alex added earlier. >> > > That was my idea too. But still, wouldn't it be possible to say > `clangdiag break --error="-Wcovered-switch"` and then have it break only > when the -Wcovered-switch diagnostic is *emitted*? > Please give it a try, e.g., here are a few I tried: clangdiag enable covered-switch-default clangdiag enable c++11-compat You can't pass the "-W" part since argparse thinks it's an option (can probably fix that if it's a problem), and you must provide the entire name. You can get the available names from diagtool, e.g.: diagtool list-warnings Please let me know what you think, and thanks for suggesting it. > > The reason I keep using this syntax though is because clang developers > always think in terms of the warning names. If you want to find out why a > warning is being emitted amidst a spew of other warnings and errors, you > really want to be able to specify the name of the warning. > > Don't get me wrong though, I do think this is a nice feature, I'm just > thinking of ways to make it more compelling by looking at it from the clang > developer's perspective and how they will most likely want to use it. > > Also, I still think it should go in lldb, not in clang. That's kind of > exactly what the lldb/examples folder is for. > > That said, lgtm, but I'm still interested to see if the workflow can be > streamlined down the line. Perhaps after it gets checked in you can make a > PSA on cfe-dev@ and mention that you want people to try it out and offer > feedback ;-) > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D36347: New lldb python module for adding diagnostic breakpoints
On Thu, Oct 26, 2017 at 2:48 PM, Zachary Turnerwrote: > Seems fine, it would be nice if the workflow could be improved a little > bit so that all you have to do is say `clangdiag break > —error=“-Wcovered-switch”` or something . I think that gives the most > intuitive usage for people, even it’s a bit harder to implement. > The idea was to break on actual diagnostics emitted, but if you want to break on diagnostic usage, i.e., when it was checked but not emitted, I suppose that's possible as well. diagtool doesn't produce a mapping for this, but it could be added -- assuming tablegen produced enough info in the .inc files to support it. I added the feature I'm using here a few months ago, which was an extension to what Alex added earlier. > > I also think user shouldn’t really have to concern themselves with > diagtool, it should all just be magic. I get why it’s easier to do this > way, but from the users perspective, having the commands map as closely as > possible to the thing the person wants to do and hiding implementation > details is a big win from a usability standpoint. > For the normal use case, i.e., clang/llvm developers that build both together, it will just work by magic, i.e., you just run enable/disable. The only problem is when you build out-of-tree. If you can suggest a way to find the correct location by examining the executable, I'd be happy to add it. > > We can iterate on it later though > I'm happy to keep hacking on it -- got plenty of time on my hands right now... And I get to learn more about lldb... > On Thu, Oct 26, 2017 at 2:38 PM Don Hinton via Phabricator < > revi...@reviews.llvm.org> wrote: > >> hintonda updated this revision to Diff 120492. >> hintonda added a comment. >> >> - Remove debugging print statement, and enhance help message. >> >> >> https://reviews.llvm.org/D36347 >> >> Files: >> utils/clangdiag.py >> >> ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D36347: New lldb python module for adding diagnostic breakpoints
On Thu, Oct 26, 2017 at 3:00 PM, Greg Clayton via Phabricator < revi...@reviews.llvm.org> wrote: > clayborg added a comment. > > Each lldb.SBValue has accessors for the stuff in an execution context: > > `` > > lldb::SBTarget GetTarget(); > lldb::SBProcess GetProcess(); > lldb::SBThread GetThread(); > lldb::SBFrame GetFrame(); > > You could keep a global map of process ID to diagtool if you want? > > What are you thinking of using this for? > Part of the rational for using exe_ctx was to allow debugging multiple targets as the same time, but if these use different versions of clang, the diagtool map won't match. I'll try moving it from the function __dict__ to the exe_ctx and see if that works. thanks... > > > https://reviews.llvm.org/D36347 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r309955 - [diagtool] Add ability to pass in the id and return the name for a
Author: dhinton Date: Thu Aug 3 09:13:13 2017 New Revision: 309955 URL: http://llvm.org/viewvc/llvm-project?rev=309955=rev Log: [diagtool] Add ability to pass in the id and return the name for a particular diagnostic. Differential Revision: https://reviews.llvm.org/D36252 Modified: cfe/trunk/test/Misc/find-diagnostic-id.c cfe/trunk/tools/diagtool/FindDiagnosticID.cpp Modified: cfe/trunk/test/Misc/find-diagnostic-id.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/find-diagnostic-id.c?rev=309955=309954=309955=diff == --- cfe/trunk/test/Misc/find-diagnostic-id.c (original) +++ cfe/trunk/test/Misc/find-diagnostic-id.c Thu Aug 3 09:13:13 2017 @@ -1,5 +1,7 @@ -// RUN: diagtool find-diagnostic-id warn_unused_variable | FileCheck %s +// RUN: diagtool find-diagnostic-id warn_unused_variable > %t; FileCheck %s < %t +// RUN: cat %t | xargs diagtool find-diagnostic-id | FileCheck %s --check-prefix=INVERSE // RUN: not diagtool find-diagnostic-id warn_unused_vars 2>&1 | FileCheck --check-prefix=ERROR %s // CHECK: {{^[0-9]+$}} +// INVERSE: warn_unused_variable // ERROR: error: invalid diagnostic 'warn_unused_vars' Modified: cfe/trunk/tools/diagtool/FindDiagnosticID.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/diagtool/FindDiagnosticID.cpp?rev=309955=309954=309955=diff == --- cfe/trunk/tools/diagtool/FindDiagnosticID.cpp (original) +++ cfe/trunk/tools/diagtool/FindDiagnosticID.cpp Thu Aug 3 09:13:13 2017 @@ -18,6 +18,15 @@ DEF_DIAGTOOL("find-diagnostic-id", "Prin using namespace clang; using namespace diagtool; +static StringRef getNameFromID(StringRef Name) { + int DiagID; + if(!Name.getAsInteger(0, DiagID)) { +const DiagnosticRecord = getDiagnosticForID(DiagID); +return Diag.getName(); + } + return StringRef(); +} + static Optional findDiagnostic(ArrayRef Diagnostics, StringRef Name) { for (const auto : Diagnostics) { @@ -38,7 +47,7 @@ int FindDiagnosticID::run(unsigned int a llvm::cl::Required, llvm::cl::cat(FindDiagnosticIDOptions)); std::vector Args; - Args.push_back("find-diagnostic-id"); + Args.push_back("diagtool find-diagnostic-id"); for (const char *A : llvm::makeArrayRef(argv, argc)) Args.push_back(A); @@ -50,6 +59,13 @@ int FindDiagnosticID::run(unsigned int a Optional Diag = findDiagnostic(AllDiagnostics, DiagnosticName); if (!Diag) { +// Name to id failed, so try id to name. +auto Name = getNameFromID(DiagnosticName); +if (!Name.empty()) { + OS << Name << '\n'; + return 0; +} + llvm::errs() << "error: invalid diagnostic '" << DiagnosticName << "'\n"; return 1; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r306783 - Remove test commit.
Author: dhinton Date: Thu Jun 29 20:03:28 2017 New Revision: 306783 URL: http://llvm.org/viewvc/llvm-project?rev=306783=rev Log: Remove test commit. Modified: cfe/trunk/README.txt Modified: cfe/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/README.txt?rev=306783=306782=306783=diff == --- cfe/trunk/README.txt (original) +++ cfe/trunk/README.txt Thu Jun 29 20:03:28 2017 @@ -24,4 +24,3 @@ on the Clang development mailing list: If you find a bug in Clang, please file it in the LLVM bug tracker: http://llvm.org/bugs/ - ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r306782 - Test Commit
Author: dhinton Date: Thu Jun 29 19:57:34 2017 New Revision: 306782 URL: http://llvm.org/viewvc/llvm-project?rev=306782=rev Log: Test Commit Modified: cfe/trunk/README.txt Modified: cfe/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/README.txt?rev=306782=306781=306782=diff == --- cfe/trunk/README.txt (original) +++ cfe/trunk/README.txt Thu Jun 29 19:57:34 2017 @@ -24,3 +24,4 @@ on the Clang development mailing list: If you find a bug in Clang, please file it in the LLVM bug tracker: http://llvm.org/bugs/ + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D17143: [Sema] PR25156 Crash when parsing dtor call on incomplete type
On Sat, Jun 10, 2017 at 8:55 PM John McCall via Phabricator < revi...@reviews.llvm.org> wrote: > rjmccall accepted this revision. > rjmccall added a comment. > This revision is now accepted and ready to land. > > Thanks, looks great. Great, thanks. > > > If you're going to be submitting multiple patches, you should really ask > for commit access; it's not an arduous process. Sure, I'll look into it this week. In the meantime, would you mind commiting this one for me? Thanks again... don > > > https://reviews.llvm.org/D17143 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [clang-tools-extra] r304977 - [clang-tidy] New checker to replace dynamic exception specifications
Thanks Alex... On Fri, Jun 9, 2017 at 1:02 AM, Alexander Kornienko via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Fixes committed in r305024 and r305057. > > On Fri, Jun 9, 2017 at 12:07 AM, Alexander Kornienko> wrote: > >> It looks like the buildbots have exceptions turned off by default, so the >> tests need to use `-fexceptions` explicitly. Testing a fix... >> >> On Thu, Jun 8, 2017 at 11:26 PM, Galina Kistanova >> wrote: >> >>> Hello Alexander, >>> >>> Couple of our builders do not like this commit: >>> >>> Failing Tests: >>> >>> Clang Tools :: clang-tidy/modernize-use-noexcept-opt.cpp >>> Clang Tools :: clang-tidy/modernize-use-noexcept.cpp >>> >>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei >>> -ps4-ubuntu-fast/builds/12431 >>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei >>> -ps4-windows10pro-fast >>> >>> Please have a look at this? >>> >>> Thanks >>> >>> Galina >>> >>> On Thu, Jun 8, 2017 at 7:04 AM, Alexander Kornienko via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> Author: alexfh Date: Thu Jun 8 09:04:16 2017 New Revision: 304977 URL: http://llvm.org/viewvc/llvm-project?rev=304977=rev Log: [clang-tidy] New checker to replace dynamic exception specifications Summary: New checker to replace dynamic exception specifications This is an alternative to D18575 which relied on reparsing the decl to find the location of dynamic exception specifications, but couldn't deal with preprocessor conditionals correctly without reparsing the entire file. This approach uses D20428 to find dynamic exception specification locations and handles all cases correctly. Reviewers: aaron.ballman, alexfh Reviewed By: aaron.ballman, alexfh Subscribers: xazax.hun, mgehre, malcolm.parsons, mgorny, JDevlieghere, cfe-commits, Eugene.Zelenko, etienneb Patch by Don Hinton! Differential Revision: https://reviews.llvm.org/D20693 Added: clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.cpp clang-tools-extra/trunk/clang-tidy/modernize/UseNoexceptCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use -noexcept.rst clang-tools-extra/trunk/test/clang-tidy/modernize-use-noexce pt-macro.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-use-noexce pt-opt.cpp clang-tools-extra/trunk/test/clang-tidy/modernize-use-noexcept.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyMo dule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/ clang-tidy/modernize/CMakeLists.txt?rev=304977=304976= 304977=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/CMakeLists.txt Thu Jun 8 09:04:16 2017 @@ -22,6 +22,7 @@ add_clang_library(clangTidyModernizeModu UseEmplaceCheck.cpp UseEqualsDefaultCheck.cpp UseEqualsDeleteCheck.cpp + UseNoexceptCheck.cpp UseNullptrCheck.cpp UseOverrideCheck.cpp UseTransparentFunctorsCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyMo dule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/ clang-tidy/modernize/ModernizeTidyModule.cpp?rev=304977=3 04976=304977=diff == --- clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/modernize/ModernizeTidyModule.cpp Thu Jun 8 09:04:16 2017 @@ -28,6 +28,7 @@ #include "UseEmplaceCheck.h" #include "UseEqualsDefaultCheck.h" #include "UseEqualsDeleteCheck.h" +#include "UseNoexceptCheck.h" #include "UseNullptrCheck.h" #include "UseOverrideCheck.h" #include "UseTransparentFunctorsCheck.h" @@ -69,6 +70,7 @@ public: CheckFactories.registerCheck("modern ize-use-equals-default"); CheckFactories.registerCheck( "modernize-use-equals-delete"); +CheckFactories.registerCheck("modernize-us e-noexcept"); CheckFactories.registerCheck("modernize-us e-nullptr"); CheckFactories.registerCheck("modernize-u se-override"); CheckFactories.registerCheck( Added:
Re: [libcxx] r294127 - filesystem: fix n4100 conformance for `temp_directory_path`
Minor nit: your diff is much bigger than it should have been due to whitespace changes. On Sun, Feb 5, 2017 at 9:21 AM, Saleem Abdulrasool via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: compnerd > Date: Sun Feb 5 11:21:52 2017 > New Revision: 294127 > > URL: http://llvm.org/viewvc/llvm-project?rev=294127=rev > Log: > filesystem: fix n4100 conformance for `temp_directory_path` > > N4100 states that an error shall be reported if > `!exists(p) || !is_directory(p)`. We were missing the first half of the > conditional. Invert the error and normal code paths to make the code > easier to follow. > > Modified: > libcxx/trunk/src/experimental/filesystem/operations.cpp > libcxx/trunk/test/std/experimental/filesystem/fs.op. > funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp > > Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/ > experimental/filesystem/operations.cpp?rev=294127= > 294126=294127=diff > > == > --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) > +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sun Feb 5 > 11:21:52 2017 > @@ -886,23 +886,28 @@ path __system_complete(const path& p, st > return absolute(p, current_path()); > } > > -path __temp_directory_path(std::error_code *ec) { > -const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"}; > -const char* ret = nullptr; > -for (auto & ep : env_paths) { > -if ((ret = std::getenv(ep))) > -break; > -} > -path p(ret ? ret : "/tmp"); > -std::error_code m_ec; > -if (is_directory(p, m_ec)) { > -if (ec) ec->clear(); > -return p; > -} > +path __temp_directory_path(std::error_code* ec) { > + const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"}; > + const char* ret = nullptr; > + > + for (auto& ep : env_paths) > +if ((ret = std::getenv(ep))) > + break; > + if (ret == nullptr) > +ret = "/tmp"; > + > + path p(ret); > + std::error_code m_ec; > + if (!exists(p, m_ec) || !is_directory(p, m_ec)) { > if (!m_ec || m_ec == make_error_code(errc::no_such_ > file_or_directory)) > -m_ec = make_error_code(errc::not_a_directory); > + m_ec = make_error_code(errc::not_a_directory); > set_or_throw(m_ec, ec, "temp_directory_path"); > return {}; > + } > + > + if (ec) > +ec->clear(); > + return p; > } > > // An absolute path is composed according to the table in > [fs.op.absolute]. > > Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op. > funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ > experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/ > temp_directory_path.pass.cpp?rev=294127=294126=294127=diff > > == > --- libcxx/trunk/test/std/experimental/filesystem/fs.op. > funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp (original) > +++ libcxx/trunk/test/std/experimental/filesystem/fs.op. > funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp Sun Feb 5 > 11:21:52 2017 > @@ -97,6 +97,14 @@ TEST_CASE(basic_tests) > TEST_CHECK(ec == std::make_error_code(std:: > errc::permission_denied)); > TEST_CHECK(ret == ""); > > +// Set the env variable to point to a non-existent dir > +PutEnv(TC.name, TC.p / "does_not_exist"); > +ec = GetTestEC(); > +ret = temp_directory_path(ec); > +TEST_CHECK(ec != GetTestEC()); > +TEST_CHECK(ec); > +TEST_CHECK(ret == ""); > + > // Finally erase this env variable > UnsetEnv(TC.name); > } > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added a comment. The comment says to rebuild TypeSourceInfo, but isn't that what this does? if (TSInfo->getType() != FD->getType()) Updated = getFunctionTypeWithExceptionSpec(*this, TSInfo->getType(), ESI); TSInfo->overrideType(Updated); If so, could you fix this by either removing the assert or moving it below TSInfo->overrideType(Updated); http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20687: [ASTMatchers] Make isNoThrow and hasDynamicExceptionSpec polymorphic for use with both functionDecl and functionProtoType
hintonda added a comment. Thanks Aaron. If you could commit for me, I'd appreciate it. Thanks again... http://reviews.llvm.org/D20687 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20687: [ASTMatchers] Make isNoThrow and hasDynamicExceptionSpec polymorphic for use with both functionDecl and functionProtoType
hintonda updated this revision to Diff 59747. hintonda added a comment. Use FunctionProtoType instead of auto for clarity. http://reviews.llvm.org/D20687 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h include/clang/ASTMatchers/ASTMatchersInternal.h unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -845,6 +845,13 @@ notMatches("void f() noexcept(false);", functionDecl(isNoThrow(; EXPECT_TRUE(matches("void f() throw();", functionDecl(isNoThrow(; EXPECT_TRUE(matches("void f() noexcept;", functionDecl(isNoThrow(; + + EXPECT_TRUE(notMatches("void f();", functionProtoType(isNoThrow(; + EXPECT_TRUE(notMatches("void f() throw(int);", functionProtoType(isNoThrow(; + EXPECT_TRUE( +notMatches("void f() noexcept(false);", functionProtoType(isNoThrow(; + EXPECT_TRUE(matches("void f() throw();", functionProtoType(isNoThrow(; + EXPECT_TRUE(matches("void f() noexcept;", functionProtoType(isNoThrow(; } TEST(isConstexpr, MatchesConstexprDeclarations) { @@ -1396,6 +1403,20 @@ matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec(; EXPECT_TRUE( matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec(; + + EXPECT_TRUE(notMatches("void f();", functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void g() noexcept;", + functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void h() noexcept(true);", + functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void i() noexcept(false);", + functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE( + matches("void j() throw();", functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE( + matches("void k() throw(int);", functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE( + matches("void l() throw(...);", functionProtoType(hasDynamicExceptionSpec(; } TEST(HasObjectExpression, DoesNotMatchMember) { Index: include/clang/ASTMatchers/ASTMatchersInternal.h === --- include/clang/ASTMatchers/ASTMatchersInternal.h +++ include/clang/ASTMatchers/ASTMatchersInternal.h @@ -106,6 +106,17 @@ return Node.getUnderlyingType(); } +/// \brief Unifies obtaining the FunctionProtoType pointer from both +/// FunctionProtoType and FunctionDecl nodes.. +inline const FunctionProtoType * +getFunctionProtoType(const FunctionProtoType ) { + return +} + +inline const FunctionProtoType *getFunctionProtoType(const FunctionDecl ) { + return Node.getType()->getAs(); +} + /// \brief Internal version of BoundNodes. Holds all the bound nodes. class BoundNodesMap { public: Index: include/clang/ASTMatchers/ASTMatchers.h === --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3245,10 +3245,13 @@ /// void k() throw(int); /// void l() throw(...); /// \endcode -/// functionDecl(hasDynamicExceptionSpec()) -/// matches the declarations of j, k, and l, but not f, g, h, or i. -AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) { - if (const auto *FnTy = Node.getType()->getAs()) +/// functionDecl(hasDynamicExceptionSpec()) and +/// functionProtoType(hasDynamicExceptionSpec()) +/// match the declarations of j, k, and l, but not f, g, h, or i. +AST_POLYMORPHIC_MATCHER(hasDynamicExceptionSpec, +AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, +FunctionProtoType)) { + if (const FunctionProtoType *FnTy = internal::getFunctionProtoType(Node)) return FnTy->hasDynamicExceptionSpec(); return false; } @@ -3263,10 +3266,12 @@ /// void i() throw(int); /// void j() noexcept(false); /// \endcode -/// functionDecl(isNoThrow()) -/// matches the declarations of g, and h, but not f, i or j. -AST_MATCHER(FunctionDecl, isNoThrow) { - const auto *FnTy = Node.getType()->getAs(); +/// functionDecl(isNoThrow()) and functionProtoType(isNoThrow()) +/// match the declarations of g, and h, but not f, i or j. +AST_POLYMORPHIC_MATCHER(isNoThrow, +AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, +FunctionProtoType)) { + const FunctionProtoType *FnTy = internal::getFunctionProtoType(Node); // If the function does not have a prototype, then it is assumed to be a // throwing function (as it would if the function did not have any exception @@ -3278,7 +3283,7 @@ if (isUnresolvedExceptionSpec(FnTy->getExceptionSpecType()))
Re: [PATCH] D20687: [ASTMatchers] Make isNoThrow and hasDynamicExceptionSpec polymorphic for use with both functionDecl and functionProtoType
hintonda updated this revision to Diff 59726. hintonda added a comment. Update narrowing matchers, isNoThrow and hasDynamicExceptionSpec, to work with both functionDecl and functionProtoType matchers. Update tests and regenerate documentation. Since FunctionDecl and FunctionProtoType are not polymorphically related, an overloaded helper function, getFunctionProtoType(), was added that takes either a FunctionDecl node or FunctionProtoType node and returns a FunctionProtoType pointer. This is based on the getUnderlyingType() implementation. http://reviews.llvm.org/D20687 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h include/clang/ASTMatchers/ASTMatchersInternal.h unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -845,6 +845,13 @@ notMatches("void f() noexcept(false);", functionDecl(isNoThrow(; EXPECT_TRUE(matches("void f() throw();", functionDecl(isNoThrow(; EXPECT_TRUE(matches("void f() noexcept;", functionDecl(isNoThrow(; + + EXPECT_TRUE(notMatches("void f();", functionProtoType(isNoThrow(; + EXPECT_TRUE(notMatches("void f() throw(int);", functionProtoType(isNoThrow(; + EXPECT_TRUE( +notMatches("void f() noexcept(false);", functionProtoType(isNoThrow(; + EXPECT_TRUE(matches("void f() throw();", functionProtoType(isNoThrow(; + EXPECT_TRUE(matches("void f() noexcept;", functionProtoType(isNoThrow(; } TEST(isConstexpr, MatchesConstexprDeclarations) { @@ -1396,6 +1403,20 @@ matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec(; EXPECT_TRUE( matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec(; + + EXPECT_TRUE(notMatches("void f();", functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void g() noexcept;", + functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void h() noexcept(true);", + functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void i() noexcept(false);", + functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE( + matches("void j() throw();", functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE( + matches("void k() throw(int);", functionProtoType(hasDynamicExceptionSpec(; + EXPECT_TRUE( + matches("void l() throw(...);", functionProtoType(hasDynamicExceptionSpec(; } TEST(HasObjectExpression, DoesNotMatchMember) { Index: include/clang/ASTMatchers/ASTMatchersInternal.h === --- include/clang/ASTMatchers/ASTMatchersInternal.h +++ include/clang/ASTMatchers/ASTMatchersInternal.h @@ -106,6 +106,17 @@ return Node.getUnderlyingType(); } +/// \brief Unifies obtaining the FunctionProtoType pointer from both +/// FunctionProtoType and FunctionDecl nodes.. +inline const FunctionProtoType * +getFunctionProtoType(const FunctionProtoType ) { + return +} + +inline const FunctionProtoType *getFunctionProtoType(const FunctionDecl ) { + return Node.getType()->getAs(); +} + /// \brief Internal version of BoundNodes. Holds all the bound nodes. class BoundNodesMap { public: Index: include/clang/ASTMatchers/ASTMatchers.h === --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3245,10 +3245,13 @@ /// void k() throw(int); /// void l() throw(...); /// \endcode -/// functionDecl(hasDynamicExceptionSpec()) -/// matches the declarations of j, k, and l, but not f, g, h, or i. -AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) { - if (const auto *FnTy = Node.getType()->getAs()) +/// functionDecl(hasDynamicExceptionSpec()) and +/// functionProtoType(hasDynamicExceptionSpec()) +/// match the declarations of j, k, and l, but not f, g, h, or i. +AST_POLYMORPHIC_MATCHER(hasDynamicExceptionSpec, +AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl, +FunctionProtoType)) { + if (const auto *FnTy = internal::getFunctionProtoType(Node)) return FnTy->hasDynamicExceptionSpec(); return false; } @@ -3263,10 +3266,12 @@ /// void i() throw(int); /// void j() noexcept(false); /// \endcode -/// functionDecl(isNoThrow()) -/// matches the declarations of g, and h, but not f, i or j. -AST_MATCHER(FunctionDecl, isNoThrow) { - const auto *FnTy = Node.getType()->getAs(); +/// functionDecl(isNoThrow()) and functionProtoType(isNoThrow()) +/// match the declarations of g, and h, but not f, i or j. +AST_POLYMORPHIC_MATCHER(isNoThrow, +
Re: [PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.
hintonda added a comment. This marcher was recently added, and has never been in a release. Specifically, it was added by me in support of a checker that has now been abandoned in lieu of a better approach -- the new approach requires this change -- so I doubt it would break anything. That said, I will look into polymorphic matchers if that is the preferred solution. http://reviews.llvm.org/D20687 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.
hintonda added a comment. Ping... http://reviews.llvm.org/D20687 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda abandoned this revision. hintonda added a comment. This revision is OBE. http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } hintonda wrote: > aaron.ballman wrote: > > hintonda wrote: > > > The range for a single token is a single location. The problem is your > > > test. The range for "throw()" ends at the start of the ')' token. For > > > "noexcept", the beginning and end are the same location, e.g., here's how > > > "int" is tested: > > > > > > ``` > > > TEST(MatchVerifier, ParseError) { > > > LocationVerifier Verifier; > > > Verifier.expectLocation(1, 1); > > > EXPECT_FALSE(Verifier.match("int i", varDecl())); > > > } > > > ``` > > > > > > I think you should use this instead: > > > > > > ``` > > > SourceRange NoexceptRange(Tok.getLocation()); > > > ``` > > Ah, how interesting; I would have assumed the range would be the full range > > of the source involved, but I forgot, that's what char ranges are for. > Pasted the wrong test -- this one does the range: > > ``` > TEST(RangeVerifier, WrongRange) { > RangeVerifier Verifier; > Verifier.expectRange(1, 1, 1, 1); > EXPECT_FALSE(Verifier.match("int i;", varDecl())); > } > ``` Sorry, looked at wrong tests -- should have looked at multi-character ending tokens. ``` NoexceptRange = SourceRange( Tok.getLocation(), Tok.getLocation().getLocWithOffset(Tok.getLength())); ``` http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } hintonda wrote: > The range for a single token is a single location. The problem is your test. > The range for "throw()" ends at the start of the ')' token. For "noexcept", > the beginning and end are the same location, e.g., here's how "int" is tested: > > ``` > TEST(MatchVerifier, ParseError) { > LocationVerifier Verifier; > Verifier.expectLocation(1, 1); > EXPECT_FALSE(Verifier.match("int i", varDecl())); > } > ``` > > I think you should use this instead: > > ``` > SourceRange NoexceptRange(Tok.getLocation()); > ``` Pasted the wrong test -- this one does the range: ``` TEST(RangeVerifier, WrongRange) { RangeVerifier Verifier; Verifier.expectRange(1, 1, 1, 1); EXPECT_FALSE(Verifier.match("int i;", varDecl())); } ``` http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added inline comments. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3428 @@ -3402,6 +3402,7 @@ // If we already had a dynamic specification, parse the noexcept for, // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3424,6 +3425,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } The range for a single token is a single location. The problem is your test. The range for "throw()" ends at the start of the ')' token. For "noexcept", the beginning and end are the same location, e.g., here's how "int" is tested: ``` TEST(MatchVerifier, ParseError) { LocationVerifier Verifier; Verifier.expectLocation(1, 1); EXPECT_FALSE(Verifier.match("int i", varDecl())); } ``` I think you should use this instead: ``` SourceRange NoexceptRange(Tok.getLocation()); ``` http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda added a comment. Please see http://reviews.llvm.org/D20693 for an alternative approach. http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20693: New checker to replace dynamic exception specifications
hintonda created this revision. hintonda added reviewers: alexfh, aaron.ballman. hintonda added subscribers: etienneb, Eugene.Zelenko, cfe-commits. [clang-tidy] New checker to replace dynamic exception specifications This is an alternative to D18575 which relied on reparsing the decl to find the location of dynamic exception specifications, but couldn't deal with preprocessor conditionals correctly without reparsing the entire file. This approach uses D20428 to find dynamic exception specifiaction locations and handles all cases correctly. http://reviews.llvm.org/D20693 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,56 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void k() throw(int(int)); +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int))' [modernize-use-noexcept] +// CHECK-FIXES: void k() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void baz(int = (throw A(), 0)) throw(A, B) {} +// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {} + +void g(void (*fp)(void) throw()); +// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void g(void (*fp)(void) noexcept); + +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-MESSAGES: :[[@LINE-2]]:34: warning: found dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false); + +void j() throw(int(int) throw(void(void) throw(int))); +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept] +// CHECK-FIXES: void j() noexcept(false); + +class Y { + Y() throw() = default; +}; +// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: Y() noexcept = default; + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} + +// Should not trigger a replacement. +void bad() +#if !__has_feature(cxx_noexcept) +throw() +#endif +; Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept + +modernize-use-noexcept +== + +The check converts dynamic exception specifications, e.g.,
[PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.
hintonda created this revision. hintonda added a reviewer: aaron.ballman. hintonda added a subscriber: cfe-commits. Herald added a subscriber: klimek. Update hasDynamicExceptionSpec to use functionType instead of functionDecl. http://reviews.llvm.org/D20687 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -1383,19 +1383,19 @@ } TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) { - EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void f();", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void g() noexcept;", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void h() noexcept(true);", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void i() noexcept(false);", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE( - matches("void j() throw();", functionDecl(hasDynamicExceptionSpec(; + matches("void j() throw();", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE( - matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec(; + matches("void k() throw(int);", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE( - matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec(; + matches("void l() throw(...);", functionType(hasDynamicExceptionSpec(; } TEST(HasObjectExpression, DoesNotMatchMember) { Index: include/clang/ASTMatchers/ASTMatchers.h === --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3245,10 +3245,10 @@ /// void k() throw(int); /// void l() throw(...); /// \endcode -/// functionDecl(hasDynamicExceptionSpec()) +/// functionType(hasDynamicExceptionSpec()) /// matches the declarations of j, k, and l, but not f, g, h, or i. -AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) { - if (const auto *FnTy = Node.getType()->getAs()) +AST_MATCHER(FunctionType, hasDynamicExceptionSpec) { + if (const auto *FnTy = dyn_cast()) return FnTy->hasDynamicExceptionSpec(); return false; } Index: docs/LibASTMatchersReference.html === --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -2403,22 +2403,6 @@ -Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasDynamicExceptionSpec -Matches functions that have a dynamic exception specification. - -Given: - void f(); - void g() noexcept; - void h() noexcept(true); - void i() noexcept(false); - void j() throw(); - void k() throw(int); - void l() throw(...); -functionDecl(hasDynamicExceptionSpec()) - matches the declarations of j, k, and l, but not f, g, h, or i. - - - Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasOverloadedOperatorNameStringRef Name Matches overloaded operator names. @@ -2616,6 +2600,22 @@ +Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionType.html;>FunctionTypehasDynamicExceptionSpec +Matches functions that have a dynamic exception specification. + +Given: + void f(); + void g() noexcept; + void h() noexcept(true); + void i() noexcept(false); + void j() throw(); + void k() throw(int); + void l() throw(...); +functionType(hasDynamicExceptionSpec()) + matches the declarations of j, k, and l, but not f, g, h, or i. + + + Matcherhttp://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html;>IntegerLiteralequalsValueT Value Matches literals that are equal to the given value. Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -1383,19 +1383,19 @@ } TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) { - EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void f();", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void g() noexcept;", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void h()
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda added a comment. Actually, this will never work correctly -- in fact, raw lexing will always be problematic. Consider: void foo() #if !__has_feature(cxx_noexcept) throw(std::bad_alloc) #endif {} In this case we *could* figure out if __has_feature(cxx_noexcept) evaluated to true or false, but what if it was a macro instead? We can't reliably handle it without reparsing the whole thing. I'll leave it as is for now, but once http://reviews.llvm.org/D20428 is available, I'll start a new diff using it. http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda added a comment. In http://reviews.llvm.org/D18575#435388, @alexfh wrote: > Let's wait for http://reviews.llvm.org/D20428 No worries. http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda updated this revision to Diff 58151. hintonda added a comment. Fixed matcher -- added 'unless(isImplicit())'. Thanks to Aaron Ballman for the suggestion. http://reviews.llvm.org/D18575 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h clang-tidy/modernize/UseOverrideCheck.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,59 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void baz(int = (throw A(), 0)) throw(A, B) {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'baz' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {} + +// We can fix this one because the matcher finds the trailing throw(). +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false); + +// FIXME: We can't fix this one -- need help developing an appropriate matcher. +void g(void (*fp)(void) throw()); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'g' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void g(void (*fp)(void) noexcept); + +void j() throw(int(int) throw(void(void) throw(int))); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'j' uses dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept] +// CHECK-FIXES: void j() noexcept(false); + +void k() throw(int(int)); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'k' uses dynamic exception specification 'throw(int(int))' [modernize-use-noexcept] +// CHECK-FIXES: void k() noexcept(false); + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} + + +class Y { + Y() throw() = default; +}; +// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: function 'Y' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: Y() noexcept = default; + +// We can't find this +#define xxx X() throw() = default +class X { + xxx; +}; + Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept + +modernize-use-noexcept +== + +The check converts dynamic exception specifications, e.g.,
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added a comment. Sure that sounds good to me. However, I would like to learn how to write better ASTMatchers. In any case, this has been a great learning experience. http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda added a comment. Btw, this version can successfully check libcxx. http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
hintonda added a comment. I can already catch all of these cases, but I can't catch this one, will this catch it too? void g(void (*fp)(void) throw()) throw(); ^^^ http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda updated this revision to Diff 57686. hintonda added a comment. Improved matcher logic and add better range handling to try to deal with multiple asserts concerning bad ranges when running checker again real code, e.g., libcxx. Even so, still seeing some asserts in Lexer::getSourceLocation(), e.g.: Assertion failed: (Loc >= BufferStart && Loc <= BufferEnd && "Location out of range for this buffer!"), function getSourceLocation, file /Users/dhinton/projects/clang/llvm/tools/clang/lib/Lex/Lexer.cpp, l ine 1073. in a call to Sources.isBeforeInTranslationUnit(Range.getEnd(), Tok.getLocation()) in parseDeclTokens(). Looks like my matcher is returning stuff that doesn't parse correctly. Investigating. http://reviews.llvm.org/D18575 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h clang-tidy/modernize/UseOverrideCheck.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,43 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void baz(int = (throw A(), 0)) throw(A, B) {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'baz' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {} + +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false); + +void g(void (*fp)(void) throw()); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'g' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void g(void (*fp)(void) noexcept); + +void j() throw(int(int) throw(void(void) throw(int))); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'j' uses dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept] +// CHECK-FIXES: void j() noexcept(false); + +void k() throw(int(int)); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'k' uses dynamic exception specification 'throw(int(int))' [modernize-use-noexcept] +// CHECK-FIXES: void k() noexcept(false); + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept +
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda updated this revision to Diff 57555. hintonda added a comment. - Added another test. http://reviews.llvm.org/D18575 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h clang-tidy/modernize/UseOverrideCheck.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,43 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void baz(int = (throw A(), 0)) throw(A, B) {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'baz' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {} + +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false); + +void g(void (*fp)(void) throw()); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'g' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void g(void (*fp)(void) noexcept); + +void j() throw(int(int) throw(void(void) throw(int))); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'j' uses dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept] +// CHECK-FIXES: void j() noexcept(false); + +void k() throw(int(int)); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'k' uses dynamic exception specification 'throw(int(int))' [modernize-use-noexcept] +// CHECK-FIXES: void k() noexcept(false); + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept + +modernize-use-noexcept +== + +The check converts dynamic exception specifications, e.g., ``throw()``, +``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``, +or a user defined macro. + +Example +--- + +.. code-block:: c++ + + void foo() throw(); + void bar() throw(int) {} + +transforms to: + +.. code-block:: c++ + + void foo() noexcept; + void bar() noexcept(false) {} + + +User defined macros +--- + +By default this check will only replace ``throw()`` with ``noexcept``, +and ``throw([,...])`` or ``throw(...)`` with +``noexcept(false)``. Additionally, users can also use
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda updated this revision to Diff 57547. hintonda added a comment. - First cut on a simple parser for decls. Successfully parses all the examples I've been given so far. Please help me break it. http://reviews.llvm.org/D18575 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h clang-tidy/modernize/UseOverrideCheck.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,39 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false); + +void g(void (*fp)(void) throw()); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'g' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void g(void (*fp)(void) noexcept); + +void j() throw(int(int) throw(void(void) throw(int))); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'j' uses dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept] +// CHECK-FIXES: void j() noexcept(false); + +void k() throw(int(int)); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'k' uses dynamic exception specification 'throw(int(int))' [modernize-use-noexcept] +// CHECK-FIXES: void k() noexcept(false); + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept + +modernize-use-noexcept +== + +The check converts dynamic exception specifications, e.g., ``throw()``, +``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``, +or a user defined macro. + +Example +--- + +.. code-block:: c++ + + void foo() throw(); + void bar() throw(int) {} + +transforms to: + +.. code-block:: c++ + + void foo() noexcept; + void bar() noexcept(false) {} + + +User defined macros +--- + +By default this check will only replace ``throw()`` with ``noexcept``, +and ``throw([,...])`` or ``throw(...)`` with +``noexcept(false)``. Additionally, users can also use +:option:`ReplacementString` to specify a macro to use instead of +``noexcept``. This is useful when maintaining source code that must +be
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda added inline comments. Comment at: clang-tidy/modernize/UseNoexceptCheck.cpp:39 @@ +38,3 @@ + + // FIXME: Add paren matching so we can parse more complex throw statements, + // e.g., (examples provided by Aaron Ballman): aaron.ballman wrote: > @alexfh, what are your feelings on this FIXME? I am a bit concerned because > these examples will cause the replacement range to be incorrect, which will > turn working code into ill-formed code. The alternative, as I see it, is to > instead properly track the exception specification source range information > as part of the FunctionDecl (akin to > `FunctionDecl::getReturnTypeSourceRange()`). Btw, I'm working on a fix I believe will handle all cases -- plan to checkin later today. However, it won't be that efficient unless I can find a way to match params that contain dynamic exception specifications. If they are only legal for function pointers -- which I think is the case -- that would make it easy and efficient, i.e., I wouldn't have to match all FunctionDecl's with one or more parameter and test them. Is it possible to match a parameter that is a function pointer? Comment at: docs/clang-tidy/checks/modernize-use-noexcept.rst:40 @@ +39,3 @@ +``noexcept(false)`` not ``noexcept``, this check will detect, but not +provide a FixItHint in that case. + aaron.ballman wrote: > This seems to run contrary to one of the examples below where a fixit is > provided for ``throw(A, B)``. If I understood properly, this statement is > only true when using a ReplacementString. Perhaps it should instead say, > "this check will detect, but not > provide a FixItHint for this case when a :option:`ReplacementString` is > provided." This is only applicable when the user provided a replacement string other than noexcept. I'll try to make it clearer, however, there is a FIXME in the code concerning this. Specifically, should we allow replacement options for both noexcept and noexcept(false). http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda updated this revision to Diff 57432. hintonda added a comment. - Address additional comments. http://reviews.llvm.org/D18575 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h clang-tidy/modernize/UseOverrideCheck.cpp clang-tidy/utils/LexerUtils.cpp clang-tidy/utils/LexerUtils.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,29 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'f' uses dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) throw()) noexcept(false); + +// FIXME: We can't match parameters yet. +void g(void (*fp)(void) throw()); + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar' uses dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foobar' uses dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept + +modernize-use-noexcept +== + +The check converts dynamic exception specifications, e.g., ``throw()``, +``throw([,...])``, or ``throw(...)`` to ``noexcept``, ``noexcept(false)``, +or a user defined macro. + +Example +--- + +.. code-block:: c++ + + void foo() throw(); + void bar() throw(int) {} + +transforms to: + +.. code-block:: c++ + + void foo() noexcept; + void bar() noexcept(false) {} + + +User defined macros +--- + +By default this check will only replace ``throw()`` with ``noexcept``, +and ``throw([,...])`` or ``throw(...)`` with +``noexcept(false)``. Additionally, users can also use +:option:`ReplacementString` to specify a macro to use instead of +``noexcept``. This is useful when maintaining source code that must +be compiled with older compilers that don't support the ``noexcept`` +keyword. Users can define the macro to be ``noexcept`` or ``throw()`` +depending on whether or not noexcept is supported. + +Please note that since ``throw(int)`` is equivelent to +``noexcept(false)`` not ``noexcept``, this check will detect, but not +provide a FixItHint in that case. + +Example +^^^ + +.. code-block:: c++ + + void foo() throw() {} + +transforms to: + +.. code-block:: c++ + + void foo() NOEXCEPT {} + +if the :option:`ReplacementString` option is set to `NOEXCEPT`. Index: docs/ReleaseNotes.rst === --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -191,6 +191,11 @@ Selectively replaces string literals containing escaped characters with raw string literals. +- New