summaryrefslogtreecommitdiffstats
path: root/clang/tools
Commit message (Collapse)AuthorAgeFilesLines
* [Driver] Fix style issues of --print-supported-cpus after D63105Fangrui Song2019-06-291-5/+4
| | | | | | | | Reviewed By: ziangwan Differential Revision: https://reviews.llvm.org/D63822 llvm-svn: 364704
* [clang-scan-deps] Introduce the DependencyScanning library with theAlex Lorenz2019-06-262-114/+23
| | | | | | | | | | | | | thread worker code and better error handling This commit extracts out the code that will powers the fast scanning worker into a new file in a new DependencyScanning library. The error and output handling is improved so that the clients can gather errors/results from the worker directly. Differential Revision: https://reviews.llvm.org/D63681 llvm-svn: 364474
* Print NULL as "(null)" in diagnostic messageXing Xue2019-06-261-4/+6
| | | | | | | | | | | | | | | | | | | Summary: Passing a null pointer to the printf family for a %s format specifier leads to undefined behaviour. The tests currently expect (null). Explicitly test for a null pointer and provide the expected string. Authored By: andusy Reviewers: hubert.reinterpretcast, xingxue, jasonliu, daltenty, cebowleratibm Reviewed By: hubert.reinterpretcast Subscribers: arphaman, jsji, cfe-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63786 llvm-svn: 364462
* [clang-scan-deps] print the dependencies to stdoutAlex Lorenz2019-06-211-7/+58
| | | | | | | | and remove the need to use -MD options in the CDB Differential Revision: https://reviews.llvm.org/D63579 llvm-svn: 364088
* [git-clang-format] recognize hxx as a C++ fileMiklos Vajna2019-06-211-1/+1
| | | | | | | | | | | clangd, clang-tidy, etc does that already, no reason why git-clang-format should skip hxx files. Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D63621 llvm-svn: 364014
* git-clang-format: Remove trailing whitespace in docstring. NFC.Sam Clegg2019-06-191-13/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D62915 llvm-svn: 363759
* [Clang] Rename -split-dwarf-file to -split-dwarf-outputAaron Puchert2019-06-151-6/+6
| | | | | | | | | | | | | | | | | | Summary: This is the first in a series of changes trying to align clang -cc1 flags for Split DWARF with those of llc. The unfortunate side effect of having -split-dwarf-output for single file Split DWARF will disappear again in a subsequent change. The change is the result of a discussion in D59673. Reviewers: dblaikie, echristo Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D63130 llvm-svn: 363494
* Add --print-supported-cpus flag for clang.Ziang Wan2019-06-141-0/+25
| | | | | | | | | | | | This patch allows clang users to print out a list of supported CPU models using clang [--target=<target triple>] --print-supported-cpus Then, users can select the CPU model to compile to using clang --target=<triple> -mcpu=<model> a.c It is a handy feature to help cross compilation. llvm-svn: 363464
* [clang-scan-deps] Fix -DBUILD_SHARED_LIBS=ON buildSam Clegg2019-06-131-0/+1
| | | | | | | | The -DBUILD_SHARED_LIBS=ON build was broken in rL363204 Differential Revision: https://reviews.llvm.org/D63245 llvm-svn: 363238
* clang-format extension: Widen the supported versions rangeHans Wennborg2019-06-131-1/+1
| | | | | | | | So that it covers also the latest VS 2019 version. By Antonio Maiorano! llvm-svn: 363230
* [clang-scan-deps] Include <mutex> in ClangScanDeps.cpp to ensure itAlex Lorenz2019-06-121-0/+1
| | | | | | builds on all platforms llvm-svn: 363208
* NFC, Update the ClangScanDeps.cpp file's license commentAlex Lorenz2019-06-121-5/+4
| | | | | | | The file ClangScanDeps.cpp from r363204 had the old outdated LLVM license comment at the top of the file that I committed by accident. llvm-svn: 363207
* NFC, fixup indentation in CMakeLists.txt from r363204 as requestedAlex Lorenz2019-06-121-3/+3
| | | | | | | | | in the review. I missed that review comment from https://reviews.llvm.org/D60233 in the original commit. llvm-svn: 363205
* [clang-scan-deps] initial outline of the tool that runs preprocessor to findAlex Lorenz2019-06-123-0/+245
| | | | | | | | | | | | | | | | | | | | | | | dependencies over a JSON compilation database This commit introduces an outline for the clang-scan-deps tool that will be used to implement fast dependency discovery phase using implicit modules for explicit module builds. The initial version of the tool works by computing non-modular header dependencies for files in the compilation database without any optimizations (i.e. without source minimization from r362459). The tool spawns a number of worker threads to run the clang compiler workers in parallel. The immediate goal for clang-scan-deps is to create a ClangScanDeps library which will be used to build up this tool to use the source minimization and caching multi-threaded filesystem to implement the optimized non-incremental dependency scanning phase for a non-modular build. This will allow us to do benchmarks and comparisons for performance that the minimization and caching give us Differential Revision: https://reviews.llvm.org/D60233 llvm-svn: 363204
* [libclang] Allow skipping warnings from all included filesNikolai Kosjar2019-06-114-5/+15
| | | | | | | | | | | | Depending on the included files and the used warning flags, e.g. - Weverything, a huge number of warnings can be reported for included files. As processing that many diagnostics comes with a performance impact and not all clients are interested in those diagnostics, add a flag to skip them. Differential Revision: https://reviews.llvm.org/D48116 llvm-svn: 363067
* Make sure a test from r363036 does not write into a working directoryIlya Biryukov2019-06-111-0/+2
| | | | | | | | | | It breaks if build directory is not writable. This change is required to fix our integrate. Also add a flush() call, otherwise time trace option does not produce the full output. llvm-svn: 363052
* [Support][Test] Time profiler: add regression testAnton Afanasyev2019-06-111-0/+5
| | | | | | | | | | | | | | | | | | Summary: Add output to `llvm::errs()` when `-ftime-trace` option is enabled, add regression test checking this option works as expected. Reviewers: thakis, aganea Subscribers: cfe-commits, llvm-commits Tags: #clang, #llvm This is recommit of r362821 Differential Revision: https://reviews.llvm.org/D61914 llvm-svn: 363036
* Revert "[Support][Test] Time profiler: add regression test"Anton Afanasyev2019-06-071-5/+0
| | | | | | | This reverts commit 44282a60c90fdded249d57d91b12c6c0907102ec. This breaks buildbot. llvm-svn: 362824
* [Support][Test] Time profiler: add regression testAnton Afanasyev2019-06-071-0/+5
| | | | | | | | | | | | | | | | | | Summary: Add output to `llvm::errs()` when `-ftime-trace` option is enabled, add regression test checking this option works as expected. Reviewers: thakis, aganea Subscribers: cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61914 > llvm-svn: 362792 llvm-svn: 362821
* Revert rL362792 : [Support][Test] Time profiler: add regression testSimon Pilgrim2019-06-071-5/+0
| | | | | | | | | | | | | | | | | | Summary: Add output to `llvm::errs()` when `-ftime-trace` option is enabled, add regression test checking this option works as expected. Reviewers: thakis, aganea Subscribers: cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61914 ........ Breaks buildbots - @anton-afanasyev please can you take a look? llvm-svn: 362816
* Build with _XOPEN_SOURCE defined on AIXDavid Tenty2019-06-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open and POSIX compatibility mode, to work around stray macros and other bugs in the headers provided by the system and build compiler. This patch adds the config to cmake to build with _XOPEN_SOURCE defined on AIX with a few exceptions. Google Test internals require access to platform specific thread info constructs on AIX so in that case we build with _ALL_SOURCE defined instead. Libclang also uses header which needs _ALL_SOURCE on AIX so we leave that as is as well. We also add building on AIX with the large file API and doing CMake header checks with X/OPEN definitions so the results are consistent with the environment that will be present in the build. Reviewers: hubert.reinterpretcast, xingxue, andusy Reviewed By: hubert.reinterpretcast Subscribers: mgorny, jsji, cfe-commits, llvm-commits Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D62533 llvm-svn: 362808
* [Support][Test] Time profiler: add regression testAnton Afanasyev2019-06-071-0/+5
| | | | | | | | | | | | | | | | Summary: Add output to `llvm::errs()` when `-ftime-trace` option is enabled, add regression test checking this option works as expected. Reviewers: thakis, aganea Subscribers: cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61914 llvm-svn: 362792
* Add Attribute NoThrow as an Exception Specifier TypeErich Keane2019-05-301-0/+2
| | | | | | | | | | | | | | | In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became clear that the current mechanism of hacking through checks for the exception specification of a function gets confused really quickly when there are alternate exception specifiers. This patch introcues EST_NoThrow, which is the equivilent of EST_noexcept when caused by EST_noThrow. The existing implementation is left in place to cover functions with no FunctionProtoType. Differential Revision: https://reviews.llvm.org/D62435 llvm-svn: 362119
* Rename clangToolingRefactor to clangToolingRefactoring for consistency with ↵Nico Weber2019-05-252-2/+2
| | | | | | | | | | its directory See "[cfe-dev] The name of clang/lib/Tooling/Refactoring". Differential Revision: https://reviews.llvm.org/D62420 llvm-svn: 361684
* Fix target property to make BUILD_SHARED_LIBS workChris Bieneman2019-05-211-1/+1
| | | | | | | | Public and Private link libraries get merged in the LINK_LIBRARIES property instead of being kept separate. With any luck this will get `BUILD_SHARED_LIBS` working again on Linux. llvm-svn: 361334
* [CMake] One more stab at fixing BUILD_SHARED_LIBSChris Bieneman2019-05-211-0/+1
| | | | | | If clang's libraries are build SHARED, we need to grab their `PRIVATE_LINK_LIBRARIES` properties and add those to clang_shared's interface. llvm-svn: 361275
* [libclang] visit c++14 lambda capture init expressionsNikolai Kosjar2019-05-211-2/+6
| | | | | | | | Patch by Milian Wolff. Differential Revision: https://reviews.llvm.org/D60672 llvm-svn: 361234
* [ClangFormat] Editor integrations inherit default style from clang-format binarySam McCall2019-05-174-8/+11
| | | | | | | | | | | | | | | | Summary: This allows downstream customizations to the default style to work without needing to also modify the editor integrations. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49719 llvm-svn: 360996
* Re-land: Add Clang shared library with C++ exportsChris Bieneman2019-05-173-0/+22
| | | | | | | | | Summary: This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two. This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries. llvm-svn: 360985
* Revert r360946 "Add Clang shared library with C++ exports"Nico Weber2019-05-173-17/+0
| | | | | | | | It breaks LLVM_ENABLE_PIC=OFF builds, and it's not clear if the object library approach doesn't impact the normal clang binary. llvm-svn: 360973
* Add Clang shared library with C++ exportsChris Bieneman2019-05-163-0/+17
| | | | | | | | | | | | | | | | | Summary: This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two. This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries. Reviewers: tstellar, winksaville Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61909 llvm-svn: 360946
* Implement __builtin_LINE() et. al. to support source location capture.Eric Fiselier2019-05-161-0/+1
| | | | | | | | | | | | | | | | | Summary: This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation). With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible. Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong Reviewed By: rsmith Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits Differential Revision: https://reviews.llvm.org/D37035 llvm-svn: 360937
* Recommit [Object] Change object::SectionRef::getContents() to return ↵Fangrui Song2019-05-161-4/+7
| | | | | | | | | | | | Expected<StringRef> r360876 didn't fix 2 call sites in clang. Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. llvm-svn: 360892
* Temporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI ↵Eric Christopher2019-05-141-1/+2
| | | | | | | | | | | | | compression (SHF_COMPRESSED)" This affects users of older (pre 2.26) binutils in such a way that they can't necessarily work around it as it doesn't support the compress option on the command line. Reverting to unblock them and we can revisit whether to make this change now or fix how we want to express the option. This reverts commit bdb21337e6e1732c9895966449c33c408336d295/r360403. llvm-svn: 360703
* Introduce the ability to dump the AST to JSON.Aaron Ballman2019-05-132-5/+6
| | | | | | This adds the -ast-dump=json cc1 flag (in addition to -ast-dump=default, which is the default if no dump format is specified), as well as some initial AST dumping functionality and tests. llvm-svn: 360622
* [libclang] Forward isInline for NamespaceDecl to libclangNikolai Kosjar2019-05-103-0/+16
| | | | llvm-svn: 360428
* Change -gz and -Wa,--compress-debug-sections to use gABI compression ↵Fangrui Song2019-05-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | (SHF_COMPRESSED) Since July 15, 2015 (binutils-gdb commit 19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas --compress-debug-sections=zlib (gcc -gz) means zlib-gabi: SHF_COMPRESSED. Before that it meant zlib-gnu (.zdebug). clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It is 2019 now and it is not unreasonable to assume users of the new feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661). Change clang's default accordingly to improve standard conformance. zlib-gnu becomes out of fashion and gets poorer toolchain support. Its mangled names confuse tools and are more likely to cause problems. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D61689 llvm-svn: 360403
* [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whoseRichard Smith2019-05-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308
* [clang-format] Fix the crash when formatting unsupported encodingsOwen Pan2019-05-081-0/+30
| | | | | | | | Fixes PR33946 Differential Revision: https://reviews.llvm.org/D61559 llvm-svn: 360257
* [libclang] PR41649: Remove pointless duplicate flag. NFC.Nikolai Kosjar2019-05-081-3/+2
| | | | llvm-svn: 360249
* Allow field offset lookups in types with incomplete arrays within libclang.Aaron Ballman2019-05-071-2/+10
| | | | | | Patch thanks to Jorn Vernee llvm-svn: 360147
* Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an ↵Leonard Chan2019-05-071-0/+4
| | | | | | | | attribute declaration" Updated with fix for read of uninitialized memory. llvm-svn: 360109
* [c++20] Implement P1009R2: allow omitting the array bound in an arrayRichard Smith2019-05-061-1/+1
| | | | | | | | | | new expression. This was voted into C++20 as a defect report resolution, so we retroactively apply it to all prior language modes (though it can never actually be used before C++11 mode). llvm-svn: 360006
* Revert "[Attribute/Diagnostics] Print macro if definition is an attribute ↵Leonard Chan2019-05-031-4/+0
| | | | | | | | declaration" This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d. llvm-svn: 359859
* [Attribute/Diagnostics] Print macro if definition is an attribute declarationLeonard Chan2019-05-021-0/+4
| | | | | | | | | | | | | If an address_space attribute is defined in a macro, print the macro instead when diagnosing a warning or error for incompatible pointers with different address_spaces. We allow this for all attributes (not just address_space), and for multiple attributes declared in the same macro. Differential Revision: https://reviews.llvm.org/D51329 llvm-svn: 359826
* [libclang] Add missing export for clang_Cursor_isAnonymousRecordDeclIvan Donchevskii2019-04-291-0/+1
| | | | | | Follow up for D61232 to fix build. llvm-svn: 359453
* [libclang] Restore old clang_Cursor_isAnonymous behaviourIvan Donchevskii2019-04-292-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | D54996 Changed the behaviour of clang_Cursor_isAnonymous, but there is no alternative available to get the old behaviour in some cases, which is essential for determining if a record is syntactically accessible, e.g. struct { int x; int y; } foo; struct { struct { int x; int y; }; } bar; void fun(struct { int x; int y; } *param); The only 'anonymous' struct here is the one nested in bar, since there is no way to reference the struct itself, only the fields within. Though the anonymity applies to the instance itself, not the type. To avoid confusion, I have added a new function called clang_Cursor_isAnonymousRecordDecl which has the old behaviour of clang_Cursor_isAnonymous (and updated the doc for the latter as well, which was seemingly forgotten). Patch by Jorn Vernee. Differential Revision: https://reviews.llvm.org/D61232 llvm-svn: 359448
* [NFC] test commit removing excess lineNikolai Kosjar2019-04-251-1/+0
| | | | llvm-svn: 359172
* Fix "-Wimplicit-fallthrough" warning. NFCI.Simon Pilgrim2019-04-231-0/+1
| | | | llvm-svn: 358973
* [analyzer][CrossTU] Extend CTU to VarDecls with initializerRafael Stahl2019-04-231-27/+33
| | | | | | | | | | | | | | | | | | | | | | Summary: The existing CTU mechanism imports `FunctionDecl`s where the definition is available in another TU. This patch extends that to VarDecls, to bind more constants. - Add VarDecl importing functionality to CrossTranslationUnitContext - Import Decls while traversing them in AnalysisConsumer - Add VarDecls to CTU external mappings generator - Name changes from "external function map" to "external definition map" Reviewers: NoQ, dcoughlin, xazax.hun, george.karpenkov, martong Reviewed By: xazax.hun Subscribers: Charusso, baloghadamsoftware, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, george.karpenkov, mgorny, whisperity, szepet, rnkovacs, a.sidorin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D46421 llvm-svn: 358968
OpenPOWER on IntegriCloud