summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy][NFC] Qualify `makeRule` call in test, for consistency with ↵Yitzhak Mandelbaum2019-08-261-2/+3
| | | | | | | | | | other calls. One call `makeRule` is unqualified (and unintentionally relying on ADL to resolve correctly). This revision qualifies that call for consistency and to drop use of ADL. llvm-svn: 369915
* [clang-tidy] TransformerClangTidyCheck: change choice of location for ↵Yitzhak Mandelbaum2019-08-262-15/+59
| | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message. Summary: This patch changes the location specified to the `ClangTidyCheck::diag()`. Currently, the beginning of the matched range is used. This patch uses the beginning of the first fix's range. This change both simplifies the code and (hopefully) gives a more intuitive result: the reported location aligns with the fix(es) provided, rather than the (arbitrary) range of the rule's match. N.B. this patch will break the line offset numbers in lit tests if the first fix is not at the beginning of the match. Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66676 llvm-svn: 369914
* [clangd] Handling text editor/document lifetimes in vscode extension.Johan Vikstrom2019-08-262-11/+36
| | | | | | | | | | | | | | | | Summary: Just reapplies highlightings for all files when visible text editors change. Could find the correct text editor that should be reapplied but going for a simple implementation instead. Removes the associated highlighting entry from the Colorizer when a text document is closed. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66735 llvm-svn: 369911
* [clangd] Added a colorizer to the vscode extension.Johan Vikstrom2019-08-263-9/+230
| | | | | | | | | | | | | | | | | | | | Summary: Adds the main colorizer component. It colorizes every time clangd sends a publishSemanticHighlighting notification. Every time it colorizes it does a full recolorization (removes all decorations from the editor and applies new ones). The reason for this is that all ranges for the same scope share a TextEditorDecorationType. This is due to TextEditorDecorationTypes being very expensive to create. The prototype used one DecorationType per range but that ran into very big performance problems (it took >100 ms to apply 600 lines of highlightings which froze the editor). This version does not share the problem of being extremly slow, but there is probably potential to optimize it even more. No document/texteditor lifecycle management code in this CL, that will come in the next one. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66219 llvm-svn: 369893
* [clangd] Send highlighting diff beyond the end of the file.Haojian Wu2019-08-268-45/+57
| | | | | | | | | | | | | | Summary: This would make the client life (tracking the changes) easier. Reviewers: jvikstrom Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66541 llvm-svn: 369884
* [clang-tidy] Manually enable exceptions in tesst that uses themBenjamin Kramer2019-08-241-1/+1
| | | | llvm-svn: 369853
* [clang-doc] Bump BitcodeWriter max line number to 32UJulie Hockett2019-08-231-1/+1
| | | | | | | | | PR43039 reports hitting the assert on a very large file, so bumping this to allow for larger files. Differential Revision: https://reviews.llvm.org/D66681 llvm-svn: 369811
* Fix clang-tidy warning in clang-tidyBenjamin Kramer2019-08-231-1/+1
| | | | | | | | argument name 'FixDescription' in comment does not match parameter name 'Description' Patch by Nils Barth! llvm-svn: 369783
* [clang-tidy] Possibility of displaying duplicate warningsKristof Umann2019-08-232-2/+18
| | | | | | | | | | | | | | | | | | Summary: In case a checker is registered multiple times as an alias, the emitted warnings are uniqued by the report message. However, it is random which checker name is included in the warning. When processing the output of clang-tidy this behavior caused some problems. In this commit the uniquing key contains the checker name too. Reviewers: alexfh, xazax.hun, Szelethus, aaron.ballman, lebedev.ri, JonasToth, gribozavr Reviewed By: alexfh Subscribers: dkrupp, whisperity, rnkovacs, mgrang, cfe-commits Patch by Tibor Brunner! Tags: #clang Differential Revision: https://reviews.llvm.org/D65065 llvm-svn: 369763
* [clangd] Link more clang-tidy modules to clangdHaojian Wu2019-08-232-5/+10
| | | | | | | | | | | | | | Summary: There are two new clang-tidy modules being added recently. Reviewers: sammccall, jdoerfert Subscribers: srhines, mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66632 llvm-svn: 369741
* [clang-tidy] Don't emit google-runtime-references warning for functions ↵Haojian Wu2019-08-232-0/+7
| | | | | | | | | | | | | | | | | | defined in macros. Summary: The macro are usually defined in the common/base headers which are hard for normal users to modify it. Reviewers: gribozavr, alexfh Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66631 llvm-svn: 369739
* Fight a bit against global initializers. NFC.Benjamin Kramer2019-08-222-658/+658
| | | | llvm-svn: 369695
* [clangd] Fold string copy into lambda capture. NFC.Benjamin Kramer2019-08-221-3/+2
| | | | llvm-svn: 369679
* [Clangd] Tweaktesting replace toString with consumeErrorShaurya Gupta2019-08-221-1/+1
| | | | llvm-svn: 369676
* Retire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.Benjamin Kramer2019-08-221-2/+2
| | | | llvm-svn: 369674
* Fixed Missing Expected error handlingShaurya Gupta2019-08-221-1/+3
| | | | llvm-svn: 369666
* [clangd] Send suppported codeActionKinds to the client.Haojian Wu2019-08-221-1/+11
| | | | | | | | | | | | | | | | | | | Summary: This would make client know which codeActionKinds that clangd may return. VSCode will add a new entry "Refactor..." (which shows all refactoring-kind code actions) in the right-click menu. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66592 llvm-svn: 369656
* Remove \brief commands from doxygen comments.Dmitri Gribenko2019-08-2269-355/+355
| | | | | | | | | | | | | | | | | | | | | | | Summary: We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done [This is analogous to LLVM r331272 and CFE r331834] Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66578 llvm-svn: 369643
* [clangd] The ClangdServer::EnableHiddenFeatures is not used any more.Haojian Wu2019-08-221-1/+0
| | | | | | Remove it. llvm-svn: 369631
* Fix documentation build after rL369568Yuanfang Chen2019-08-211-5/+5
| | | | llvm-svn: 369578
* [clang-tidy] Check for dynamically initialized statics in headers.Yuanfang Chen2019-08-218-1/+193
| | | | | | | | | | | | Finds instances where variables with static storage are initialized dynamically in header files. Reviewed By: aaron.ballman, alexfh Patch by Charles Zhang! Differential Revision: https://reviews.llvm.org/D62829 llvm-svn: 369568
* [clangd] Ignore implicit conversion-operator nodes in find refs.Haojian Wu2019-08-212-0/+17
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66478 llvm-svn: 369514
* [clangd] Fix one testcase in XRefsTests.Haojian Wu2019-08-202-20/+30
| | | | | | | | | | | | | | | | | | Summary: The test didn't test anything actually -- it used "[]" as annotation which should be "[[]]". This patch also fixes a bug in XRef where we may return duplicated refs. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66349 llvm-svn: 369387
* [clangd] Skip function bodies inside processed files while indexingIlya Biryukov2019-08-203-16/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This significantly improves performance of background indexing. We do not collect references and declarations inside the processed files, so this does not affect the final indexing results. The idea is borrowed from libclang, which has a similar optimization in its indexing functionality. Measurements show a nice decrease in indexing time, up to ~40% for building the whole index. These are not proper benchmarks, so one should not rely on these results too much. 1. Rebuilding the whole index for LLVM: - Before. Total time: 14m58s. ./bin/clangd -pch-storage=memory < ./clangd.input 23917.67s user 515.86s system 2718% cpu 14:58.68 total - After. Total time: 8m41s. ./bin/clangd -pch-storage=memory < ./clangd.input 13627.29s user 288.10s system 2672% cpu 8:40.67 total 2. Rebuilding index after removing shards matching '*clangd*' (case-insensitively): - Before. Total time: 30s. ./bin/clangd -pch-storage=memory < ./clangd.input 130.94s user 6.82s system 452% cpu 30.423 total - After. Total time: 26s. ./bin/clangd -pch-storage=memory < ./clangd.input 80.51s user 5.40s system 333% cpu 25.777 total Reviewers: kadircet, sammccall Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66226 llvm-svn: 369349
* Fix typo. "piont" => "point"Richard Trieu2019-08-202-10/+10
| | | | | | Found by Chris Morris (cwmorris). llvm-svn: 369316
* [clangd] Added highlighting for tokens that are macro arguments.Johan Vikstrom2019-08-192-8/+92
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds semantic highlighting for tokens that are a macro argument. Example: ``` D_V(SomeVar); ``` The "SomeVar" inside the macro is highlighted as a variable now. Tokens that are in a macro body expansion are ignored in this patch for three reasons. * The spelling loc is inside the macro "definition" meaning it would highlight inside the macro definition (could probably easily be fixed by using getExpansionLoc instead of getSpellingLoc?) * If wanting to highlight the macro definition this could create duplicate tokens. And if the tokens are of different types there would be conflicts (tokens in the same range but with different types). Say a macro defines some name and both a variable declaration and a function use this, there would be two tokens in the macro definition but one with Kind "Variable" and the other with Kind "Function". * Thirdly, macro body expansions could come from a file that is not the main file (easily fixed, just check that the Loc is in the main file and not even a problem if we wanted to highlight the actual macro "invocation") Reviewers: hokein, sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64741 llvm-svn: 369275
* [clangd] Added special HighlightingKind for function parameters.Johan Vikstrom2019-08-194-15/+31
| | | | | | | | | | | | | | Summary: This means that function parameters are no longer highlighted as variable.other.cpp but instead as variable.parameter.cpp which is the more "correct" TextMate scope for them. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66335 llvm-svn: 369238
* [clangd] Update features table in the docs with links to LSP extension proposalsNathan Ridge2019-08-191-51/+55
| | | | | | | | | | | | | | | Also update the semantic coloring entry to reflect it being supported in clangd now. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65373 llvm-svn: 369229
* [clang-doc] Fix casting not working in gcc 5.4.0Diego Astiazaran2019-08-171-4/+4
| | | | | | | | | An implicit cast of std::string to llvm::SmallString<> was breaking GCC 5.4.0 builder. A pair using llvm::SmallString<> now uses std::string. Differential Revision: https://reviews.llvm.org/D66378 llvm-svn: 369182
* [clang-doc] Redesign of generated HTML filesDiego Astiazaran2019-08-168-339/+1272
| | | | | | | | | | | | | The new design includes a header (contains the project name), a main section, and a footer. The main section is divided into three subsections. Left, middle, right. The left section contains the general index, the middle contains the info's data, and the right contains the index for the info's content. The CSS has been updated. A flag --project-name is added. The Attributes attribute of the TagNode struct is now a vector of pairs because these attributes should be rendered in the insertion order. The functions (cpp and js) that converts an Index tree structure into HTML were slightly modified; the first ul tag created is now a ol tag. The inner lists are still ul. Differential Revision: https://reviews.llvm.org/D66353 llvm-svn: 369139
* [clang-doc] Fix records in global namespaceDiego Astiazaran2019-08-163-42/+102
| | | | | | | | | | | | | When a Record is declared in the global namespace, clang-doc serializes it as a child of the global namespace, so the global namespace is now one if its parent namespaces. This namespace was not being included in the list of namespaces of the Info causing paths to be incorrect and the index rendered incorrectly. Affected tests have been fixed. Differential revision: https://reviews.llvm.org/D66298 llvm-svn: 369123
* [clangd] suppress -Wparentheses warning: suggest parentheses around ‘&&’ ↵Haojian Wu2019-08-161-1/+1
| | | | | | within ‘||’ llvm-svn: 369105
* [clangd] Simplify code of ClangdLSPServer::onCommandIlya Biryukov2019-08-161-41/+33
| | | | | | | | | | | | | | | | | | | | Summary: By inlining a complicated lambda into its single call-site. Also ensure we call Reply() exactly once even if tweaks return both ShowMessage and ApplyEdit effects. Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66343 llvm-svn: 369100
* [clangd] Added highlighting for non type templates.Johan Vikstrom2019-08-162-0/+57
| | | | | | | | | | | | | | | Summary: Non type templates were not being highlighted. This highlights them as TemplateParameters. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66221 llvm-svn: 369090
* [clangd] Remove Bind, use C++14 lambda captures instead. NFCIlya Biryukov2019-08-163-65/+15
| | | | llvm-svn: 369089
* [clang-tidy] Migrate objc-super-self to use isDerivedFrom 🚛Stephane Moore2019-08-161-30/+17
| | | | | | | | | | | | | | | | | | | | | Summary: This migrates objc-super-self to `isDerivedFrom` as it now supports matching Objective-C interface declarations. Test Notes: Ran clang tools tests. Reviewers: aaron.ballman, gribozavr Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66270 llvm-svn: 369081
* [analyzer] Analysis: Silence checkersCsaba Dabis2019-08-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces a new `analyzer-config` configuration: `-analyzer-config silence-checkers` which could be used to silence the given checkers. It accepts a semicolon separated list, packed into quotation marks, e.g: `-analyzer-config silence-checkers="core.DivideZero;core.NullDereference"` It could be used to "disable" core checkers, so they model the analysis as before, just if some of them are too noisy it prevents to emit reports. This patch also adds support for that new option to the scan-build. Passing the option `-disable-checker core.DivideZero` to the scan-build will be transferred to `-analyzer-config silence-checkers=core.DivideZero`. Reviewed By: NoQ, Szelethus Differential Revision: https://reviews.llvm.org/D66042 llvm-svn: 369078
* [clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛Stephane Moore2019-08-161-28/+1
| | | | | | | | | | | | | | | | | | | | | Summary: This migrates objc-forbidden-subclassing to `isDerivedFrom` as it now supports matching Objective-C interface declarations. Test Notes: Ran clang tools tests. Reviewers: aaron.ballman, gribozavr Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66269 llvm-svn: 369076
* [clang-doc] Serialize inherited attributes and methodsDiego Astiazaran2019-08-1613-47/+373
| | | | | | | | | | | clang-doc now serializes the inherited attributes and methods, not only the name of the base class. All inherited are tracked, if B:A and C:B, info of A is included in C. This data is stored in attribute Bases in a RecordInfo. Previously tracked inheritance data, stored in Parents and VParents, hasn't been removed to reduce review load. Differential revision: https://reviews.llvm.org/D66238 llvm-svn: 369075
* [clang-doc] Sort index elements case insensitiveDiego Astiazaran2019-08-153-2/+43
| | | | | | | | Implement logic to compare the references of the index case insensitive. Differential revision: https://reviews.llvm.org/D66299 llvm-svn: 369068
* [clang-doc] Fix use of source-root flagDiego Astiazaran2019-08-152-9/+7
| | | | | | | | | | The value, if any, of --source-root flag was not being used. This has been fixed and the logic was moved to the ClangDocContext contructor. Differential revision: https://reviews.llvm.org/D66268 llvm-svn: 369065
* [clang-doc] Fix bitcode writer for access specifiersDiego Astiazaran2019-08-1510-11/+41
| | | | | | | | | | | | | | | Bitcode writer was not emitting the corresponding record for the Access attribute of a FunctionInfo. This has been added. AS_none was being used as the default value for any AcesssSpecifier attribute (in FunctionInfo and MemberTypeInfo), this has been changed to AS_public because this is the enum value that evaluates to 0. The bitcode writer doesn't write values that are 0 so if an attribute was set to AS_public, this value is not written and after reading the bitcode it would have the default value which is AS_none. This is why the default value is now AS_public. Differential Revision: https://reviews.llvm.org/D66151 llvm-svn: 369063
* [clangd] Don't use Bind() where C++14 move capture worksBenjamin Kramer2019-08-155-255/+212
| | | | llvm-svn: 369005
* [clangd] llvm::integer_sequence -> std::integer_sequence.Benjamin Kramer2019-08-151-1/+1
| | | | llvm-svn: 368991
* Replace llvm::integer_sequence and friends with the C++14 standard versionBenjamin Kramer2019-08-152-4/+4
| | | | | | The implementation in libc++ takes O(1) compile time, ours was O(n). llvm-svn: 368990
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-1499-344/+344
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clang-doc] Add missing check in testsDiego Astiazaran2019-08-143-2/+10
| | | | | | | | Path is now checked when comparing two Infos in the unit tests. Differential Revision: https://reviews.llvm.org/D66124 llvm-svn: 368912
* [clangd][vscode] Surface the error when applying tweaks failsHaojian Wu2019-08-141-2/+19
| | | | | | | | | | | | | | | | | | | Summary: The current behavior for a failed request is just to log it in the output panel. When applyTweak fails for whatever reason, users usually don't get informed (unless they open the output panel and dig the log). this patch is to surface these errors by prompting up a message diag. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66211 llvm-svn: 368851
* [clangd] Print qualifiers of out-of-line definitions in document outlineIlya Biryukov2019-08-142-35/+128
| | | | | | | | | | | | | | | | Summary: To improve the UX around navigating and searching through the results. Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66215 llvm-svn: 368842
* [Clangd] NFC: Fixed comment typoShaurya Gupta2019-08-141-1/+1
| | | | llvm-svn: 368841
OpenPOWER on IntegriCloud