summaryrefslogtreecommitdiffstats
path: root/clang/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* [CMake] Use #cmakedefine01 for ↵NAKAMURA Takumi2017-10-181-2/+2
| | | | | | | | | | | | CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER) It'd be better that they are #cmakedefine01 rather than #cmakedefine. (#if FOO rather than #if defined(FOO)) Then we can find missing #include "clang/Config/config.h" in the future. Differential Revision: https://reviews.llvm.org/D35541 llvm-svn: 316061
* [libclang] Visit attributes for function and class templatesJonathan Coe2017-10-161-2/+4
| | | | | | | | | | | | | | | | | | Summary: Previously, `VisitAttributes` was not called for function and class templates and thus their attributes were not accessible using libclang. Reviewers: bkramer, arphaman, rsmith, jbcoe Reviewed By: jbcoe Subscribers: cfe-commits Tags: #clang Patch by jklaehn (Johann Klähn) Differential Revision: https://reviews.llvm.org/D36955 llvm-svn: 315958
* [refactor] allow the use of refactoring diagnosticsAlex Lorenz2017-10-165-16/+90
| | | | | | | | | This commit allows the refactoring library to use its own set of refactoring-specific diagnostics to reports things like initiation errors. Differential Revision: https://reviews.llvm.org/D38772 llvm-svn: 315924
* clang-refactor: Use llvm_unreachable in an unused overrideAlex Lorenz2017-10-161-1/+1
| | | | | | As suggested by David Blaikie! llvm-svn: 315923
* Recommit r315738 "[clang-refactor] Apply source replacements"Alex Lorenz2017-10-161-6/+88
| | | | | | | | | | | | | | | The fixed commit ensures that ParsedSourceRange works correctly with Windows paths. Original message: This commit actually brings clang-refactor to a usable state as it can now apply the refactoring changes to source files. The -selection option is now also fully supported. Differential Revision: https://reviews.llvm.org/D38402 llvm-svn: 315918
* Convert clang::LangAS to a strongly typed enumAlexander Richardson2017-10-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Convert clang::LangAS to a strongly typed enum Currently both clang AST address spaces and target specific address spaces are represented as unsigned which can lead to subtle errors if the wrong type is passed. It is especially confusing in the CodeGen files as it is not possible to see what kind of address space should be passed to a function without looking at the implementation. I originally made this change for our LLVM fork for the CHERI architecture where we make extensive use of address spaces to differentiate between capabilities and pointers. When merging the upstream changes I usually run into some test failures or runtime crashes because the wrong kind of address space is passed to a function. By converting the LangAS enum to a C++11 we can catch these errors at compile time. Additionally, it is now obvious from the function signature which kind of address space it expects. I found the following errors while writing this patch: - ItaniumRecordLayoutBuilder::LayoutField was passing a clang AST address space to TargetInfo::getPointer{Width,Align}() - TypePrinter::printAttributedAfter() prints the numeric value of the clang AST address space instead of the target address space. However, this code is not used so I kept the current behaviour - initializeForBlockHeader() in CGBlocks.cpp was passing LangAS::opencl_generic to TargetInfo::getPointer{Width,Align}() - CodeGenFunction::EmitBlockLiteral() was passing a AST address space to TargetInfo::getPointerWidth() - CGOpenMPRuntimeNVPTX::translateParameter() passed a target address space to Qualifiers::addAddressSpace() - CGOpenMPRuntimeNVPTX::getParameterAddress() was using llvm::Type::getPointerTo() with a AST address space - clang_getAddressSpace() returns either a LangAS or a target address space. As this is exposed to C I have kept the current behaviour and added a comment stating that it is probably not correct. Other than this the patch should not cause any functional changes. Reviewers: yaxunl, pcc, bader Reviewed By: yaxunl, bader Subscribers: jlebar, jholewinski, nhaehnle, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D38816 llvm-svn: 315871
* Revert r315738Alex Lorenz2017-10-131-88/+6
| | | | | | | The ParsedSourceRange class does not work correctly on Windows with the ':' drive separators llvm-svn: 315774
* Fix -Woverloaded-virtual warning in clang-refactorAlex Lorenz2017-10-131-0/+4
| | | | llvm-svn: 315755
* [clang-refactor] Apply source replacementsAlex Lorenz2017-10-131-6/+84
| | | | | | | | | | This commit actually brings clang-refactor to a usable state as it can now apply the refactoring changes to source files. The -selection option is now also fully supported. Differential Revision: https://reviews.llvm.org/D38402 llvm-svn: 315738
* Recommit r315087 "[refactor] add support for refactoring options"Alex Lorenz2017-10-131-7/+114
| | | | | | | | | | | | | | | | The recommit fixes a UB bug that occurred only on a small number of bots. Original message: This commit adds initial support for refactoring options. One can now use optional and required std::string options. This commit also adds a NewNameOption for the local-rename refactoring action to allow rename to work with custom names. Differential Revision: https://reviews.llvm.org/D37856 llvm-svn: 315661
* [cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.Matt Morehouse2017-10-123-5/+5
| | | | llvm-svn: 315630
* [clang-format] Allow building fuzzer with OSS-Fuzz flags.Matt Morehouse2017-10-122-3/+7
| | | | | | | | | | | | Reviewers: kcc, bogner Reviewed By: kcc Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38853 llvm-svn: 315603
* Update cc1as_main for MCCodeEmitter ownership change in r315531.Lang Hames2017-10-111-1/+1
| | | | llvm-svn: 315532
* [clang-fuzzer] Allow linking with any fuzzing engine.Matt Morehouse2017-10-111-1/+5
| | | | | | | | | | | | | | | | | Summary: Makes clang-[proto-]fuzzer compatible with flags specified by OSS-Fuzz. https://llvm.org/pr34314 Reviewers: vitalybuka, kcc Reviewed By: kcc Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38812 llvm-svn: 315486
* Reland "[clang-fuzzer] Allow building without coverage instrumentation."Matt Morehouse2017-10-113-54/+83
| | | | | | This relands r315336 after fixing bot breakage. llvm-svn: 315465
* [clang-fuzzer] Fix shared library dependencies.Matt Morehouse2017-10-113-3/+5
| | | | llvm-svn: 315463
* Update cc1as_main for MCAsmBackend ownership change in r315410.Lang Hames2017-10-111-2/+2
| | | | llvm-svn: 315411
* Revert "[clang-fuzzer] Allow building without coverage instrumentation."Matt Morehouse2017-10-103-82/+53
| | | | | | | This reverts r315336 due to build breakage with gcc. http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/2173 llvm-svn: 315355
* [clang-fuzzer] Build proto-to-cxx with fuzzer-no-link.Matt Morehouse2017-10-101-0/+1
| | | | | | Makes it possible to build with any sanitizer or none at all. llvm-svn: 315339
* [clang-fuzzer] Allow building without coverage instrumentation.Matt Morehouse2017-10-103-53/+81
| | | | | | | | | | | | | | | | | | Summary: Compile with DummyClangFuzzer.cpp as entry point rather than libFuzzer's main when coverage instrumentation is missing. https://llvm.org/pr34314 Reviewers: kcc, bogner, vitalybuka Reviewed By: vitalybuka Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38642 llvm-svn: 315336
* [clang-refactor] Fix clang-tidy misc-move-const-arg warning.Haojian Wu2017-10-101-2/+2
| | | | | | NFC llvm-svn: 315290
* Revert r315087Alex Lorenz2017-10-061-114/+7
| | | | | | clang-refactor crashes on some bots after this commit llvm-svn: 315095
* [refactor] add support for refactoring optionsAlex Lorenz2017-10-061-7/+114
| | | | | | | | | | | | This commit adds initial support for refactoring options. One can now use optional and required std::string options. This commit also adds a NewNameOption for the local-rename refactoring action to allow rename to work with custom names. Differential Revision: https://reviews.llvm.org/D37856 llvm-svn: 315087
* Dependent Address Space SupportAndrew Gozillon2017-10-021-0/+1
| | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. llvm-svn: 314649
* Add support for remembering origins to ExternalASTMergerSean Callanan2017-09-271-58/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExternalASTMerger has hitherto relied on being able to look up any Decl through its named DeclContext chain. This works for many cases, but causes problems for function-local structs, which cannot be looked up in their containing FunctionDecl. An example case is void f() { { struct S { int a; }; } { struct S { bool b; }; } } It is not possible to lookup either of the two Ses individually (or even to provide enough information to disambiguate) after parsing is over; and there is typically no need to, since they are invisible to the outside world. However, ExternalASTMerger needs to be able to complete either S on demand. This led to an XFAIL on test/Import/local-struct, which this patch removes. The way the patch works is: It defines a new data structure, ExternalASTMerger::OriginMap, which clients are expected to maintain (default-constructing if the origin does not have an ExternalASTMerger servicing it) As DeclContexts are imported, if they cannot be looked up by name they are placed in the OriginMap. This allows ExternalASTMerger to complete them later if necessary. As DeclContexts are imported from an origin that already has its own OriginMap, the origins are forwarded – but only for those DeclContexts that are actually used. This keeps the amount of stored data minimal. The patch also applies several improvements from review: - Thoroughly documents the interface to ExternalASTMerger; - Adds optional logging to help track what's going on; and - Cleans up a bunch of braces and dangling elses. Differential Revision: https://reviews.llvm.org/D38208 llvm-svn: 314336
* clang-format plugin: Add missing NL (new line) at EOF (end of file)Hans Wennborg2017-09-221-0/+6
| | | | | | | | | | | | clang-format.exe removes trailing new lines at end of file. However, if no NL is found at EOF one should be added. Patch by Teodor MICU! Differential Revision: https://reviews.llvm.org/D37732 llvm-svn: 314033
* [index] Generate class & metaclass manglings for objcDave Lee2017-09-223-4/+28
| | | | | | | | | | | | | | | | | | | | | | | Summary: ObjC classes have two associated symbols, one for the class and one for the metaclass. This change overloads `CodegenNameGenerator::getAllManglings` to produce both class and metaclass symbols. While this function is called by `clang_Cursor_getCXXManglings`, it's only called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is unchanged. Reviewers: arphaman, abdulras, alexshap, compnerd Reviewed By: compnerd Subscribers: compnerd Differential Revision: https://reviews.llvm.org/D37671 llvm-svn: 313997
* Add Cross Translation Unit support libraryGabor Horvath2017-09-224-0/+148
| | | | | | | | | | | | | | | | | | This patch introduces a class that can help to build tools that require cross translation unit facilities. This class allows function definitions to be loaded from external AST files based on an index. In order to use this functionality an index is required. The index format is a flat text file but it might be replaced with a different solution in the near future. USRs are used as names to look up the functions definitions. This class also does caching to avoid redundant loading of AST files. Right now only function defnitions can be loaded using this API because this is what the in progress cross translation unit feature of the Static Analyzer requires. In to future this might be extended to classes, types etc. Differential Revision: https://reviews.llvm.org/D34512 llvm-svn: 313975
* Put target deduced from executable name at the start of argument listSerge Pavlov2017-09-201-2/+9
| | | | | | | | | | When clang is called as 'target-clang', put deduced target option at the start of argument list so that option '--target=' specified in command line could override it. This change fixes PR34671. llvm-svn: 313760
* [refactor] Use CommonOptionsParser in clang-refactorAlex Lorenz2017-09-141-45/+13
| | | | | | | | | This commit ensures that CommonOptionsParser works with subcommands. This allows clang-refactor to use the CommonOptionsParser. Differential Revision: https://reviews.llvm.org/D37618 llvm-svn: 313260
* Link clang-refactor with clangFormatAlex Lorenz2017-09-141-0/+1
| | | | | | | This is an attempt to fix http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage after r313244. llvm-svn: 313252
* Link clang-refactor with clangAST and clangLexAlex Lorenz2017-09-141-0/+2
| | | | | | | This is an attempt to fix http://bb.pgr.jp/builders/clang-i686-linux-RA/ after r313244. llvm-svn: 313249
* [refactor] add clang-refactor tool with initial testing support andAlex Lorenz2017-09-145-0/+862
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | local-rename action This commit introduces the clang-refactor tool alongside the local-rename action which uses the existing renaming engine used by clang-rename. The tool doesn't actually perform the source transformations yet, it just provides testing support. This commit also moves only one test from clang-rename over to test/Refactor. I will continue to move the other tests throughout development of clang-refactor. The following options are supported by clang-refactor: -v: use verbose output -selection: The source range that corresponds to the portion of the source that's selected (currently only special command test:<file> is supported). Please note that a follow-up commit will migrate clang-refactor to libTooling's common option parser, so clang-refactor will be able to use the common interface with compilation database and options like -p, -extra-arg, etc. The testing support provided by clang-refactor is described below: When -selection=test:<file> is given, clang-refactor will parse the selection commands from that file. The selection commands are grouped and the specified refactoring action invoked by the tool. Each command in a group is expected to produce an identical result. The precise syntax for the selection commands is described in a comment in TestSupport.h. Differential Revision: https://reviews.llvm.org/D36574 llvm-svn: 313244
* libclang: expose `clang_getCursorTLSKind`Saleem Abdulrasool2017-09-132-0/+17
| | | | | | | | | | Introduce the 'TLS Kind' property of variable declarations through libclang. Additionally, provide a Python accessor for it, and test that functionality. Patch by Masud Rahman! llvm-svn: 313111
* clang-format-vs: Update the VSIX ID.Hans Wennborg2017-09-121-1/+1
| | | | | | | | We're moving the extension to a new account on the VS Marketplace, and apparently it's not possible to re-upload an extension with an existing ID on a new account. llvm-svn: 313060
* [Lexer] Report more precise skipped regions (PR34166)Vedant Kumar2017-09-111-1/+2
| | | | | | | | | | | | | | | | | | | | This patch teaches the preprocessor to report more precise source ranges for code that is skipped due to conditional directives. The new behavior includes the '#' from the opening directive and the full text of the line containing the closing directive in the skipped area. This matches up clang's behavior (we don't IRGen the code between the closing "endif" and the end of a line). This also affects the code coverage implementation. See llvm.org/PR34166 (this also happens to be rdar://problem/23224058). The old behavior (report the end of the skipped range as the end location of the 'endif' token) is preserved for indexing clients. Differential Revision: https://reviews.llvm.org/D36642 llvm-svn: 312947
* clang-rename: let -force handle multiple renamesMiklos Vajna2017-09-111-6/+0
| | | | | | | | | | | | | | | | | | | | | | | Summary: The use case is that renaming multiple symbols in a large enough codebase is much faster if all of these can be done with a single invocation, but there will be multiple translation units where one or more symbols are not found. Old behavior was to exit with an error (default) or exit without reporting an error (-force). New behavior is that -force results in a best-effort rename: rename symbols which are found and just ignore the rest. The existing help for -force sort of already implies this behavior. Reviewers: cfe-commits, klimek, arphaman Reviewed By: klimek Differential Revision: https://reviews.llvm.org/D37634 llvm-svn: 312942
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-1/+3
| | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. llvm-svn: 312794
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-3/+1
| | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. llvm-svn: 312784
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-1/+3
| | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 llvm-svn: 312781
* Update for llvm change.Rafael Espindola2017-09-082-2/+6
| | | | llvm-svn: 312766
* [diagtool] Change default tree behavior to print only flagsJonas Devlieghere2017-09-051-9/+27
| | | | | | | | | | | | | | This patch changes the default behavior of `diagtool tree` to only display warning flags and not the internal warnings flags. The latter is an implementation detail of the compiler and usually not what the users wants. Furthermore, flags that are enabled by default are now also printed in green. Originally, this was only the case for the diagnostic names. Differential revision: https://reviews.llvm.org/D37390 llvm-svn: 312546
* [NFC] Loop modernization in diagtoolJonas Devlieghere2017-09-055-62/+57
| | | | | | Precommit for https://reviews.llvm.org/D37390 llvm-svn: 312545
* [clang-format] Fix lines=all case in clang-format.pyKrasimir Georgiev2017-09-051-1/+1
| | | | llvm-svn: 312536
* [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*Erik Verbruggen2017-08-291-0/+6
| | | | | | | | | | | | | | | | | Looks like this one was forgotten for clang_parseTranslationUnit*, as LIBCLANG_NOTHREADS is checked for/in: clang_saveTranslationUnit() clang_reparseTranslationUnit() clang_codeCompleteAt() clang_indexTranslationUnit() clang_indexSourceFile() Patch by Nikolai Kosjar! Differential Revision: https://reviews.llvm.org/D36821 llvm-svn: 311990
* Use class to pass information about executable nameSerge Pavlov2017-08-291-18/+12
| | | | | | | | | | | | | Information about clang executable name components, such as target and driver mode, was passes in std::pair. With this change it is passed in a special structure. It improves readability and makes access to this information more convenient. NFC. Differential Revision: https://reviews.llvm.org/D36057 llvm-svn: 311981
* Fix ClangFormatFuzzer.George Karpenkov2017-08-241-2/+5
| | | | llvm-svn: 311621
* [clang-proto-fuzzer] Fix clang-proto-to-cxx build.Matt Morehouse2017-08-232-0/+2
| | | | llvm-svn: 311592
* [clang-diff] Properly clear the selection in HTML diffJohannes Altmanninger2017-08-231-2/+2
| | | | | | | | | | Reviewers: arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37072 llvm-svn: 311575
* [clang-diff] HTML diff navigationJohannes Altmanninger2017-08-231-9/+56
| | | | | | | | | | | | | | Summary: This adds shortcuts j and k to jump between changes. It is especially useful in diffs with few changes. Reviewers: arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36685 llvm-svn: 311570
OpenPOWER on IntegriCloud