summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-doc] Serialize child namespaces and recordsJulie Hockett2019-07-025-93/+176
| | | | | | | | | | | | Serialization of child namespaces and records is now handled. Namespaces can have child records and child namespaces. Records can only have child records. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D63911 llvm-svn: 364963
* [clang-doc] Fix segfault in comment sortingJulie Hockett2019-07-021-6/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D63962 llvm-svn: 364949
* [clang-tidy] Extend TransformerClangTidyCheck to support adding includes.Yitzhak Mandelbaum2019-07-023-0/+76
| | | | | | | | | | | | | | | | | Summary: This revision implements support for the `AddedIncludes` field in RewriteRule cases; that is, it supports specifying the addition of include directives in files modified by the clang tidy check. Reviewers: ilya-biryukov, gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63893 llvm-svn: 364922
* [clangd] Collect the refs when the main file is header.Haojian Wu2019-07-023-6/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we only collect refs of the symbols which are declared in the preamble and referenced in the main file, it works well when the main file is .cpp file. However, when the main file is .h file (when opening a .h file in the editor), we don't collect refs of the symbol declared in this file, so we miss these refs in our dynamic index. A typical scenario: 1. Open Foo.h (which contains class Foo) 2. Open Foo.cpp, call find references for Foo And we only get refs from Foo.cpp. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63818 llvm-svn: 364893
* Fixed two issues in clang-tidy -help.Alexander Kornienko2019-07-012-107/+107
| | | | | | HeaderFilter -> HeaderFilterRegex llvm-svn: 364837
* Summary: [Clangd] Added hidden command line option -tweaks to specify which ↵Shaurya Gupta2019-07-014-3/+20
| | | | | | | | | | | | | | | | tweaks to enable - Only for development purposes - Disabled tweaks in fixits-duplications test Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63989 llvm-svn: 364809
* [clangd] No longer getting template instantiations from header files in Main ↵Johan Vikstrom2019-07-012-1/+22
| | | | | | | | | | | | AST. Previous implementation to filter decls not in the main file did not work in the case where a template was instantiated from a header in the main file. It would than include that function/class in topLevelDecls. Differential Revision: https://reviews.llvm.org/D63817 llvm-svn: 364747
* [clangd] Fix unused var from r364735Sam McCall2019-07-011-5/+4
| | | | llvm-svn: 364741
* [clangd] Make PreambleStatusCache handle filenames more carefullySam McCall2019-07-012-6/+25
| | | | | | | | | | | | | | | | | | | | | Summary: - when we hit the cache, the reported filename should be that of the cache query, not that of the cache store. This matches behaviors of common FSes, and avoids triggering difficult edge cases in FileManager when files are being moved around concurrently. - filename comparisons (both cache queries and == mainfile checks) should fold away . and .. in paths. These can appear when relative paths occur in compile_commands.json. (gn does this). Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63931 llvm-svn: 364740
* [clangd] Show better message when we rename macros.Haojian Wu2019-07-016-64/+105
| | | | | | | | | | | | | | | | | | Summary: Previously, when we rename a macro, we get an error message of "there is no symbol found". This patch improves the message of this case (as we don't support macros). Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63922 llvm-svn: 364735
* [clangd] Make FixIt message be consistent with the clang-tidy diagnostic ↵Haojian Wu2019-07-012-6/+18
| | | | | | | | | | | | | | | | | | message. Summary: We strip the "[clang-tidy-check]" suffix from the clang-tidy diagnostics, we should be consistent with the message in FixIt (strip the suffix as well). Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63926 llvm-svn: 364731
* Cleanup: llvm::bsearch -> llvm::partition_point after r364719Fangrui Song2019-06-301-2/+2
| | | | llvm-svn: 364720
* [ADT] Implement llvm::bsearch() with std::partition_point()Fangrui Song2019-06-301-4/+4
| | | | | | | | | | | | | | | | | | | Summary: Delete the begin-end form because the standard std::partition_point can be easily used as a replacement. The ranges-style llvm::bsearch will be renamed to llvm::partition_point in the next clean-up patch. The name "bsearch" doesn't meet people's expectation because in C: > If two or more members compare equal, which member is returned is unspecified. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D63718 llvm-svn: 364719
* [clang-doc] Handle anonymous namespacesJulie Hockett2019-06-285-30/+88
| | | | | | | | Improves output for anonymous decls, and updates the '--public' flag to exclude everything under an anonymous namespace. Differential Revision: https://reviews.llvm.org/D52847 llvm-svn: 364674
* [clang-doc] De-duplicate comments and locationsJulie Hockett2019-06-283-2/+88
| | | | | | | | | | | | De-duplicate comments and declaration locations in reduce function. When two files include the same header file, this file's content is mapped twice causing comments and locations to be duplicated after the reduce stage. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D62970 llvm-svn: 364670
* Update CODE_OWNERS.txt for clang-docJulie Hockett2019-06-281-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D63734 llvm-svn: 364663
* [clangd] Emit semantic highlighting tokens when the main AST is built.Johan Vikstrom2019-06-273-7/+49
| | | | | | Differential Revision: https://reviews.llvm.org/D63821 llvm-svn: 364551
* [clangd] Fix a case where we fail to detect a header-declared symbol in rename.Haojian Wu2019-06-272-28/+38
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Failing case: ``` #include "foo.h" void fo^o() {} ``` getRenameDecl() returns the decl of the symbol under the cursor (which is in the current main file), instead, we use the canonical decl to determine whether a symbol is declared in #included header. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63872 llvm-svn: 364537
* [clang-tidy] Fix NDEBUG build [NFC]Mikael Holmen2019-06-271-0/+2
| | | | llvm-svn: 364535
* [clangd] No need to setTraversalScope in SemanticHighlighting.Haojian Wu2019-06-272-4/+3
| | | | | | | | | | | | | | | | Summary: We have already set it when the AST is being built, and setting TraversalScope is not free (it will clear the cache, which is expensive to build). Reviewers: jvikstrom Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63874 llvm-svn: 364528
* [clangd] Address limitations in SelectionTree:Sam McCall2019-06-272-51/+164
| | | | | | | | | | | | | | | | | | Summary: - nodes can have special-cased hit ranges including "holes" (FunctionTypeLoc in void foo()) - token conflicts between siblings (int a,b;) are resolved in favor of left sibling - parent/child overlap is handled statefully rather than explicitly by comparing parent/child ranges (this lets us share a mechanism with sibling conflicts) Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63760 llvm-svn: 364519
* BitStream reader: propagate errorsJF Bastien2019-06-267-36/+72
| | | | | | | | | | | | | | | | | | | | | | The bitstream reader handles errors poorly. This has two effects: * Bugs in file handling (especially modules) manifest as an "unexpected end of file" crash * Users of clang as a library end up aborting because the code unconditionally calls `report_fatal_error` The bitstream reader should be more resilient and return Expected / Error as soon as an error is encountered, not way late like it does now. This patch starts doing so and adopting the error handling where I think it makes sense. There's plenty more to do: this patch propagates errors to be minimally useful, and follow-ups will propagate them further and improve diagnostics. https://bugs.llvm.org/show_bug.cgi?id=42311 <rdar://problem/33159405> Differential Revision: https://reviews.llvm.org/D63518 llvm-svn: 364464
* [clang-tidy] Generalize TransformerClangTidyCheck to take a rule generator.Yitzhak Mandelbaum2019-06-263-15/+105
| | | | | | | | | | | | | | Summary: Tidy check behavior often depends on language and/or clang-tidy options. This revision allows a user of TranformerClangTidyCheck to pass rule _generator_ in place of a rule, where the generator takes both the language and clang-tidy options. Additionally, the generator returns an `Optional` to allow for the case where the check is deemed irrelevant/disable based on those options. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63288 llvm-svn: 364442
* [clang-tidy] Fix ClangTidyTest to initialize context before checks.Yitzhak Mandelbaum2019-06-261-21/+27
| | | | | | | | | | | | | | | | | | | | | Summary: Currently, `clang::tidy::test::runCheckOnCode()` constructs the check instances *before* initializing the ClangTidyContext. This ordering causes problems when the check's constructor accesses the context, for example, through `getLangOpts()`. This revision moves the construction to after the context initialization, which follows the pattern used in the clang tidy tool itself. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63784 llvm-svn: 364435
* [clangd] Added functionality for getting semantic highlights for variable ↵Johan Vikstrom2019-06-265-0/+186
| | | | | | and function declarations llvm-svn: 364421
* [clangd] Disable failing unittest on non-x86 platformsKadir Cetinkaya2019-06-261-0/+1
| | | | llvm-svn: 364413
* [clangd] Don't rename the namespace.Haojian Wu2019-06-263-10/+34
| | | | | | | | | | | | | | | | | Summary: Also fix a small bug -- the extra argument "-xc++" doesn't overwrite the language if the argument is present after the file name in the compiler command. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63759 llvm-svn: 364392
* [clangd] Add Value field to HoverInfoKadir Cetinkaya2019-06-263-3/+87
| | | | | | | | | | | | | | | | Summary: Put a symbols value information which is deduced from initializer expression into HoverInfo struct. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63330 llvm-svn: 364390
* [clangd] Enable extraction of system includes from custom toolchainsKadir Cetinkaya2019-06-267-1/+344
| | | | | | | | | | | | | | | | | | Summary: Some custom toolchains come with their own header files and compiler drivers. Those compiler drivers implicitly know about include search path for those headers. This patch aims to extract that information from drivers and add it to the command line when invoking clang frontend. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62804 llvm-svn: 364389
* [clangd] Link and initialize target infosKadir Cetinkaya2019-06-263-0/+37
| | | | llvm-svn: 364387
* [clang-tidy] Update documentation for Qt Creator integration.Nikolai Kosjar2019-06-251-2/+4
| | | | | | | | | | Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63763 llvm-svn: 364315
* [clangd] Fix NestedNameSpecifierLoc in SelectionTreeSam McCall2019-06-252-3/+9
| | | | | | | | | | | | Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63708 llvm-svn: 364284
* [clangd] Narrow rename to local symbols.Haojian Wu2019-06-254-9/+181
| | | | | | | | | | | | | | | | | | | Summary: Previously, we performed rename for all kinds of symbols (local, global). This patch narrows the scope by only renaming symbols not being used outside of the main file (with index asisitance). Renaming global symbols is not supported at the moment (return an error). Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63426 llvm-svn: 364283
* [clangd] Cleanup the duplicated getTokenRange.Haojian Wu2019-06-253-38/+48
| | | | | | | | | | | | | | | | Summary: Also lift it to SourceCode.h, so that it can be used in other places (semantic code highlighting). Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63714 llvm-svn: 364280
* [clang-doc] Add basic support for templates and typedefJulie Hockett2019-06-248-14/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | In serialize::parseBases(...), when a base record is a template specialization, the specialization was used as the parent. It should be the base template so there is only one file generated for this record. When the specialized template is implicitly declared the reference USR corresponded to the GlobalNamespace's USR, this will now be the base template's USR. More information about templates will be added later. In serialize::emiInfo(RecorDecl*, ...), typedef records were not handled and the name was empty. This is now handled and a IsTypeDef attribute is added to RecordInfo struct. In serialize::emitInfo(CXXMethodDecl*, ...), template specialization is handled like in serialize::parseBases(...). Bitcode writer and reader are modified to handle the new attribute of RecordInfo. Submitted on behalf of Diego Astiazarán (diegoaat97@gmail.com) Differential Revision: https://reviews.llvm.org/D63367 llvm-svn: 364222
* [clangd] Improve SelectionTree string representationSam McCall2019-06-241-1/+12
| | | | llvm-svn: 364180
* [NFC] Marking test added in r363975 as unsupported on Windows.Douglas Yung2019-06-221-0/+2
| | | | | | | | This test references a path that does not exist on Windows causing it to emit different output from what was expected leading to a failure when run on Windows. llvm-svn: 364120
* [clang-tidy] misc-unused-parameters: don't comment out parameter name for C codeMatthias Gehre2019-06-212-5/+10
| | | | | | | | | | | | | | Summary: The fixit `int square(int /*num*/)` yields `error: parameter name omitted` for C code. Enable it only for C++ code. Reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63088 llvm-svn: 364106
* Quote path to Python executable in case it has spacesReid Kleckner2019-06-211-3/+13
| | | | | | | | | These days Python 3 is typically installed into C:/Program Files, so cope with that. Similar to r364077 in compiler-rt. llvm-svn: 364087
* [clangd] Add include-mapping for C symbols.Haojian Wu2019-06-2111-192/+1198
| | | | | | | | | | | | | | | | | | | Summary: This resolves the issue of introducing c++-style includes for C files. - refactor the gen_std.py, make it reusable for parsing C symbols. - add a language mode to the mapping method to use different mapping for C and C++ files. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63270 llvm-svn: 364044
* [clang-tidy] Fix a typo in the doc.Haojian Wu2019-06-211-1/+1
| | | | llvm-svn: 364010
* [clang-tidy] Move test files of rL363975 into Inputs directoryKadir Cetinkaya2019-06-212-1/+1
| | | | llvm-svn: 364008
* [clang-tidy] Fail gracefully upon empty database fieldsSerge Guelton2019-06-202-0/+7
| | | | | | | | Fix bz#42281 Differential Revision: https://reviews.llvm.org/D63613 llvm-svn: 363975
* [clangd] Include the diagnostics's code when comparing diagnosticsNathan Ridge2019-06-192-4/+230
| | | | | | | | | | | | | | | | Summary: This fixes https://github.com/clangd/clangd/issues/60 Reviewers: kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63316 llvm-svn: 363889
* [clangd] Consume error returned by cleanupAndFormatIlya Biryukov2019-06-191-0/+2
| | | | | | | When called by ClangdServer::applyTweak. No idea how to actually trigger this in practice, so no tests. llvm-svn: 363844
* [clangd] Format changes produced by renameIlya Biryukov2019-06-191-0/+9
| | | | | | | | | | | | | | Reviewers: hokein, kadircet, sammccall Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63562 llvm-svn: 363843
* [clangd] Collect tokens of main files when building the ASTIlya Biryukov2019-06-196-4/+57
| | | | | | | | | | | | | | | | | | | | Summary: The first use of this is a code tweak to expand macro calls. Will later be used to build syntax trees. The memory overhead is small as we only store tokens of the main file. Reviewers: sammccall Reviewed By: sammccall Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62956 llvm-svn: 363803
* [clangd] Correct the MessageType enum values.Haojian Wu2019-06-191-3/+3
| | | | llvm-svn: 363798
* Revert "[clangd] Return vector<TextEdit> from applyTweak. NFC"Sam McCall2019-06-193-19/+5
| | | | | | This reverts commit r363691. llvm-svn: 363766
* [clangd] Add ClangdServer accessor for buffer contentsSam McCall2019-06-195-2/+26
| | | | llvm-svn: 363765
OpenPOWER on IntegriCloud