summaryrefslogtreecommitdiff
path: root/test/Tooling
Commit message (Collapse)AuthorAgeFilesLines
* Recommit r363298 "[lit] Disable test on darwin when building shared libs."Don Hinton2019-06-151-0/+2
| | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363502 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r363298 "[lit] Disable test on darwin when building shared libs."Nico Weber2019-06-141-2/+0
| | | | | | It broke running check-lld on mac, see https://reviews.llvm.org/D61697 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363379 91177308-0d34-0410-b5e6-96231b3b80d8
* [lit] Disable test on darwin when building shared libs.Don Hinton2019-06-131-0/+2
| | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363298 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a bogus sed option in test.Alexander Kornienko2019-04-081-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357922 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a useless assertion in clang-check.Alexander Kornienko2019-04-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-commit r357915 with a fix for windows. The assertion prevents it from applying fixes when used along with compilation databases with relative paths. Added a test that demonstrates the assertion failure. An example of the assertion: input.cpp:11:14: error: expected ';' after top level declarator typedef int T ^ ; input.cpp:11:14: note: FIX-IT applied suggested code changes clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed. #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13 #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18 #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1 #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0) #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf) #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa) #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37) #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2) #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type) #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*) #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++() #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357921 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert rL357915 from cfe/trunk: Remove a useless assertion in clang-check.Simon Pilgrim2019-04-081-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertion prevents it from applying fixes when used along with compilation databases with relative paths. Added a test that demonstrates the assertion failure. An example of the assertion: input.cpp:11:14: error: expected ';' after top level declarator typedef int T ^ ; input.cpp:11:14: note: FIX-IT applied suggested code changes clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed. #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13 #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18 #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1 #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0) #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf) #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa) #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37) #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2) #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type) #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*) #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++() #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15 ........ Breaks windows buildbots git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357918 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a useless assertion in clang-check.Alexander Kornienko2019-04-081-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertion prevents it from applying fixes when used along with compilation databases with relative paths. Added a test that demonstrates the assertion failure. An example of the assertion: input.cpp:11:14: error: expected ';' after top level declarator typedef int T ^ ; input.cpp:11:14: note: FIX-IT applied suggested code changes clang-check: clang/tools/clang-check/ClangCheck.cpp:94: virtual std::string (anonymous namespace)::FixItOptions::RewriteFilename(const std::string &, int &): Assertion `llvm::sys::path::is_absolute(filename) && "clang-fixit expects absolute paths only."' failed. #0 llvm::sys::PrintStackTrace(llvm::raw_ostream&) llvm/lib/Support/Unix/Signals.inc:494:13 #1 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:69:18 #2 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:357:1 #3 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x110c0) #4 raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fcf) #5 abort (/lib/x86_64-linux-gnu/libc.so.6+0x343fa) #6 (/lib/x86_64-linux-gnu/libc.so.6+0x2be37) #7 (/lib/x86_64-linux-gnu/libc.so.6+0x2bee2) #8 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) #9 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char*>(char*, char*, std::__false_type) #10 void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*) #11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) #12 (anonymous namespace)::FixItOptions::RewriteFilename(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&) clang/tools/clang-check/ClangCheck.cpp:101:0 #13 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const #14 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_is_local() const #15 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose() #16 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() #17 clang::FixItRewriter::WriteFixedFiles(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*) clang/lib/Frontend/Rewrite/FixItRewriter.cpp:98:0 #18 std::__shared_ptr<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2>::get() const #19 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const #20 std::__shared_ptr_access<clang::CompilerInvocation, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const #21 clang::CompilerInstance::getFrontendOpts() clang/include/clang/Frontend/CompilerInstance.h:290:0 #22 clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:966:0 #23 __gnu_cxx::__normal_iterator<clang::FrontendInputFile*, std::vector<clang::FrontendInputFile, std::allocator<clang::FrontendInputFile> > >::operator++() #24 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:943:0 #25 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) clang/lib/Tooling/Tooling.cpp:369:33 #26 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) clang/lib/Tooling/Tooling.cpp:344:18 #27 clang::tooling::ToolInvocation::run() clang/lib/Tooling/Tooling.cpp:329:10 #28 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) clang/lib/Tooling/Tooling.cpp:518:11 #29 main clang/tools/clang-check/ClangCheck.cpp:187:15 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357915 91177308-0d34-0410-b5e6-96231b3b80d8
* [test] Pass -ccc-install-dir in mac compilation db testMichal Gorny2019-01-211-1/+6
| | | | | | | | | | | | Pass -ccc-install-dir explicitly as the compilation database code does not pass argv[0] to getMainExecutable(), while some systems require it to return the correct path. Since the relevant code is apparently only applicable to Darwin, just pass correct -ccc-install-dir to make the tests pass on *BSD systems. Differential Revision: https://reviews.llvm.org/D56976 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351752 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix libc++ mac driver test to pass on WindowsReid Kleckner2019-01-161-4/+3
| | | | | | | There is a substitution for 'clang-check' to absolutize it, so the '$(which clang-check)' is unnecessary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351383 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a REQUIRES: darwin line for a mac test.Jeremy Morse2019-01-161-1/+1
| | | | | | | | | This test, apparently for macs, fails on Windows as lit can't emulate the shell subprocess $(which...) correctly. Some other netbsd and linux buildbots also fail here. Limit to macs as a temporary workaround. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351360 91177308-0d34-0410-b5e6-96231b3b80d8
* Set '-target' flag in the test checking the MacOS include dirIlya Biryukov2019-01-161-1/+1
| | | | | | | | | | | To fix a buildbot failure on PS4, see http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/42251 The test was added in r351222 and aims to check only a particular Mac configuration. However it relied on the default compiler target by default, therefore unintentionally failing on PS4. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351334 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply [Tooling] Make clang-tool find libc++ dir on mac when running on a ↵Sam McCall2019-01-161-0/+16
| | | | | | | | | file without compilation database. This reverts commit r351282, and re-lands r351222 and r351229 with the use-after-free fixed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351316 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Tooling] Make clang-tool find libc++ dir on mac when running on a ↵Vlad Tsyrklevich2019-01-161-16/+0
| | | | | | | | | file without compilation database." This reverts commits r351222 and r351229, they were causing ASan/MSan failures on the sanitizer bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351282 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] Make clang-tool find libc++ dir on mac when running on a file ↵Haojian Wu2019-01-151-0/+16
| | | | | | | | | | | | | | | | | | | | | | without compilation database. Summary: This is a regression of r348365. When clang-tools run on a file without a complation database (`clang-check /tmp/t.cc`), we will use fixed compilation database as a fallback. However the actual compiler path in the fallback complation command is just `clang-tool` which is insufficient to detect the libc++ dir. Reviewers: ilya-biryukov, EricWF Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56680 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351222 91177308-0d34-0410-b5e6-96231b3b80d8
* [Driver] Fix libcxx detection on Darwin with clang run as ./clangIlya Biryukov2019-01-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: By using '..' instead of fs::parent_path. The intention of the code was to go from 'path/to/clang/bin' to 'path/to/clang/include'. In most cases parent_path works, however it would fail when clang is run as './clang'. This was noticed in Chromium's bug tracker, see https://bugs.chromium.org/p/chromium/issues/detail?id=919761 Reviewers: arphaman, thakis, EricWF Reviewed By: arphaman, thakis Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D56446 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350714 91177308-0d34-0410-b5e6-96231b3b80d8
* Move detection of libc++ include dirs to Driver on MacOSIlya Biryukov2018-12-053-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The intention is to make the tools replaying compilations from 'compile_commands.json' (clang-tidy, clangd, etc.) find the same standard library as the original compiler specified in 'compile_commands.json'. Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied on the value of resource dir as an approximation of the compiler install dir. The new logic uses the actual compiler install dir and is performed in the driver. This is consistent with the C++ standard library detection on other platforms and allows to override the resource dir in the tools using the compile_commands.json without altering the standard library detection mechanism. The tools have to override the resource dir to make sure they use a consistent version of the builtin headers. There is still logic in InitHeaderSearch that attemps to add the absolute includes for the the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too, but it could potentially break the library detection on other systems, so we don't tackle it in this patch to keep its scope manageable. This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675. The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke the libc++ detection in clang itself, which caused LLDB tests to break. The LLDB tests pass with new fix. Reviewers: JDevlieghere, arphaman, EricWF Reviewed By: arphaman Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54630 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348365 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] - Simplify tools::SplitDebugName.George Rimar2018-12-051-0/+4
| | | | | | | | | | | | | | | | | | This is an updated version of the D54576, which was reverted. Problem was that SplitDebugName calls the InputInfo::getFilename which asserts if InputInfo given is not of type Filename: const char *getFilename() const { assert(isFilename() && "Invalid accessor."); return Data.Filename; } At the same time at that point, it can be of type Nothing and we need to use getBaseInput(), like original code did. Differential revision: https://reviews.llvm.org/D55006 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348352 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Make clang-based tools find libc++ on MacOS"Jonas Devlieghere2018-11-123-35/+0
| | | | | | This breaks the LLDB bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346675 91177308-0d34-0410-b5e6-96231b3b80d8
* Make clang-based tools find libc++ on MacOSIlya Biryukov2018-11-123-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When they read compiler args from compile_commands.json. This change allows to run clang-based tools, like clang-tidy or clangd, built from head using the compile_commands.json file produced for XCode toolchains. On MacOS clang can find the C++ standard library relative to the compiler installation dir. The logic to do this was based on resource dir as an approximation of where the compiler is installed. This broke the tools that read 'compile_commands.json' and don't ship with the compiler, as they typically change resource dir. To workaround this, we now use compiler install dir detected by the driver to better mimic the behavior of the original compiler when replaying the compilations using other tools. Reviewers: sammccall, arphaman, EricWF Reviewed By: sammccall Subscribers: ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54310 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346652 91177308-0d34-0410-b5e6-96231b3b80d8
* Compound literals, enums, et al require const exprBill Wendling2018-11-091-1/+2
| | | | | | | | | | | | | | | | | | Summary: Compound literals, enums, file-scoped arrays, etc. require their initializers and size specifiers to be constant. Wrap the initializer expressions in a ConstantExpr so that we can easily check for this later on. Reviewers: rsmith, shafik Reviewed By: rsmith Subscribers: cfe-commits, jyknight, nickdesaulniers Differential Revision: https://reviews.llvm.org/D53921 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346455 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] JSONCompilationDatabasePlugin infers compile commands for missing ↵Sam McCall2018-09-141-3/+7
| | | | | | | | | | | | | | | | files Summary: See the existing InterpolatingCompilationDatabase for details on how this works. We've been using this in clangd for a while, the heuristics seem to work well. Reviewers: bkramer Subscribers: ilya-biryukov, ioeric, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51729 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342228 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] Allow -flto flags and filter out -Wa, flagsChih-Hung Hsieh2018-08-221-0/+3
| | | | | | | | | | | | | | This change fixes the problem in https://bugs.llvm.org/show_bug.cgi?id=38332 by allowing driver::Action::BackendJobClass to run with the analyzer. Otherwise, such jobs will look up the non-existing compilation database and then run without flags. Also filter out the -Wa,* flags that could be passed to and ignored by the clang compiler. Clang-tidy gives warnings about unused -Wa,* flags. Differential Revision: http://reviews.llvm.org/D51002 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340421 91177308-0d34-0410-b5e6-96231b3b80d8
* [lit, python] Always add quotes around the python path in litStella Stamenova2018-08-061-3/+3
| | | | | | | | | | | | | | | Summary: The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes. This is a companion change to: https://reviews.llvm.org/D50206 Reviewers: asmith, zturner Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50281 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339074 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix test clang-diff-json.cppAaron Smith2018-02-101-3/+3
| | | | | | | | | | | | | | | Summary: This test would fail if the python path had spaces. Add a quote around the path to fix this problem and update some test values changed by the addition of quotes around the path. Tested on Windows and Linux with Python 3.x Reviewers: zturner, llvm-commits Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43164 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324824 91177308-0d34-0410-b5e6-96231b3b80d8
* [tooling] Make compile_flags.txt negative test more hermeticSam McCall2017-11-141-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318154 91177308-0d34-0410-b5e6-96231b3b80d8
* [Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.Sam McCall2017-11-092-0/+19
| | | | | | | | | | | | | | | | | | | | | Summary: This is an alternative to JSONCompilationDatabase for simple projects that don't use a build system such as CMake. (You can also drop one in ~, to make your tools use e.g. C++11 by default) There's no facility for varying flags per-source-file or per-machine. Possibly this could be accommodated backwards-compatibly using cpp, but even if not the simplicity seems worthwhile for the cases that are addressed. Tested with clangd, works great! (requires clangd restart) Reviewers: klimek Subscribers: ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D39799 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317777 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Treat CXXCtorInitializer as a nodeJohannes Altmanninger2017-08-271-5/+11
| | | | | | | | | | Reviewers: arphaman Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37002 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311865 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Reformat test, NFCJohannes Altmanninger2017-08-231-36/+36
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311571 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Refactor stop-after command-line flagJacob Gravelle2017-08-221-1/+1
| | | | | | | | | | | | | | | Summary: Rename stop-after to stop-diff-after. When building LLVM with -DLLVM_BUILD_LLVM_DYLIB=ON, stop-after collides with the stop-after already present in LLVM. Reviewers: johannes, arphaman Subscribers: klimek, aheejin, cfe-commits Differential Revision: https://reviews.llvm.org/D36989 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311476 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Use the relative name for NamedDeclJohannes Altmanninger2017-08-224-12/+47
| | | | | | | | | | | | | | Summary: If a node referring to a name is within a class or namespace, do not use the full qualified name, but strip the namespace prefix. Reviewers: arphaman, bkramer Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36681 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311433 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow thiscall attribute in test/Tooling/clang-diff-ast.cppJohannes Altmanninger2017-08-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311301 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Improve and test getNodeValueJohannes Altmanninger2017-08-206-16/+31
| | | | | | | | | | | | Summary: Use qualified names if available. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36186 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311292 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Fix similarity computationJohannes Altmanninger2017-08-203-0/+131
| | | | | | | | | | | | | | Summary: Add separate tests for the top-down and the bottom-up phase, as well as one for the optimal matching. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36185 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311284 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Filter AST nodesJohannes Altmanninger2017-08-202-2/+24
| | | | | | | | | | | | | | Summary: Ignore macros and implicit AST nodes, as well as anything outside of the main source file. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36184 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311280 91177308-0d34-0410-b5e6-96231b3b80d8
* clang/test/Tooling/clang-diff-ast.cpp: Satisfy thiscall.NAKAMURA Takumi2017-08-201-1/+1
| | | | | | | | | | | | | | clang/test/Tooling/clang-diff-ast.cpp:45:12: error: expected string not found in input // CHECK: CXXConstructorDecl: X(void (char, int)) ^ <stdin>:43:25: note: scanning from here AccessSpecDecl: public(42) ^ <stdin>:44:2: note: possible intended match here CXXConstructorDecl: X(void (char, int) __attribute__((thiscall)))(43) ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311270 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Simplify mappingJohannes Altmanninger2017-08-192-2/+10
| | | | | | | | | | | | | | | | | | | Summary: Until we find a decent heuristic on how to choose between multiple identical trees, there is no point in supporting multiple mappings. This also enables matching of nodes with parents of different types, because there are many instances where this is appropriate. For example for and foreach statements; functions in the global or other namespaces. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36183 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311251 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Add HTML side-by-side diff outputJohannes Altmanninger2017-08-193-38/+68
| | | | | | | | | | Reviewers: arphaman Subscribers: mgorny Differential Revision: https://reviews.llvm.org/D36182 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311241 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Make printing of matches optionalJohannes Altmanninger2017-08-192-1/+5
| | | | | | | | | | Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36181 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311237 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Fix testJohannes Altmanninger2017-08-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311233 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Add option to dump the AST, one node per lineJohannes Altmanninger2017-08-192-3/+53
| | | | | | | | | | | | Summary: This is done with -ast-dump; the JSON variant has been renamed to -ast-dump-json. Reviewers: arphaman Differential Revision: https://reviews.llvm.org/D36180 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311232 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "[clang-diff] Move printing of matches and changes to ↵Johannes Altmanninger2017-08-191-4/+14
| | | | | | | | | | clang-diff"" Fix build by renaming ChangeKind -> Change This reverts commit 0c78c5729f29315d7945988efd048c0cb86c07ce. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311222 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Fix test for python 3Johannes Altmanninger2017-08-191-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311220 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "[clang-diff] Move the JSON export function to clang-diff""Johannes Altmanninger2017-08-191-0/+27
| | | | | | | This reverts commit eac4c13ac9ea8f12bc049e040c7b9c8a517f54e7, the original commit *should* not have caused the build failure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311216 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[clang-diff] Move the JSON export function to clang-diff"Vlad Tsyrklevich2017-08-181-27/+0
| | | | | | This reverts commit r311199, it was causing widespread build failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311211 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[clang-diff] Move printing of matches and changes to clang-diff"Vlad Tsyrklevich2017-08-181-14/+4
| | | | | | This reverts commit r311200, it was causing widespread build failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311210 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Move printing of matches and changes to clang-diffJohannes Altmanninger2017-08-181-4/+14
| | | | | | | | | | | | | | | Summary: This also changes the output order of the changes. Now the matches are printed in pre-order, intertwined with insertions, updates, and moves. Deletions are printed afterwards. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311200 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Move the JSON export function to clang-diffJohannes Altmanninger2017-08-181-0/+27
| | | | | | | | | | Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36178 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311199 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Add commandline arguments.Johannes Altmanninger2017-08-182-4/+11
| | | | | | | | | | | | | | | | Summary: Support command line options for build path and extra arguments This emulates the options accepted by clang tools that use CommonOptionsParser. Add a flag for controlling the maximum size parameter for bottom up matching. Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36177 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311173 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Get rid of "%T" expansionsKuba Mracek2017-08-151-3/+4
| | | | | | | | | | | | The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in clang. Differential Revision: https://reviews.llvm.org/D36437 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310950 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-diff] Add initial implementationAlex Lorenz2017-07-211-0/+78
| | | | | | | | | | | | | | | This is the first commit for the "Clang-based C/C++ diff tool" GSoC project. ASTDiff is a new library that computes a structural AST diff between two ASTs using the gumtree algorithm. Clang-diff is a new Clang tool that will show the structural code changes between different ASTs. Patch by Johannes Altmanninger! Differential Revision: https://reviews.llvm.org/D34329 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308731 91177308-0d34-0410-b5e6-96231b3b80d8