summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Add missing braces to completion tests. NFCIlya Biryukov2019-08-011-0/+4
| | | | llvm-svn: 367541
* [clangd] Fix buildbot failure from ambigous ArrayRef ctorJohan Vikstrom2019-08-011-2/+2
| | | | llvm-svn: 367529
* [clangd] Duplicate lines of semantic highlightings sent removed.Johan Vikstrom2019-08-018-42/+334
| | | | | | | | | | | | | | Summary: Added a class for diffing highlightings and removing duplicate lines. Integrated into the highlighting generation flow. Only works correctly if all tokens are on a single line. Also returns empty lines if the IDE should remove previous highlightings on a line. Reviewers: hokein, sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64475 llvm-svn: 367521
* [clangd] Ignore semicolons, whitespace, and comments in SelectionTree.Sam McCall2019-07-314-73/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Whitespace and comments are a clear bugfix: selecting some comments/space near a statement doesn't mean you're selecting the surrounding block. Semicolons are less obvious, but for similar reasons: these tokens aren't actually claimed by any AST node (usually), so an AST-based model like SelectionTree shouldn't take them into account. Callers may still sometimes care about semis of course: - when the selection is an expr with a non-expr parent, selection of the semicolon indicates intent to select the statement. - when a statement with a trailing semi is selected, we need to know its range to ensure it can be removed. SelectionTree may or may not play a role here, but these are separate questions from its core function of describing which AST nodes were selected. The mechanism here is the TokenBuffer from syntax-trees. We use it in a fairly low-level way (just to get boundaries of raw spelled tokens). The actual mapping of AST nodes to coordinates continues to use the (fairly mature) SourceLocation based logic. TokenBuffer/Syntax trees don't currently offer an alternative to getFileRange(), I think. Reviewers: SureYeaah, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D65486 llvm-svn: 367453
* [Clangd] NFC: Added FIXME in ExtractVariable testsShaurya Gupta2019-07-311-2/+7
| | | | llvm-svn: 367406
* [NFC] Remove LLVM_ALIGNASJF Bastien2019-07-311-1/+1
| | | | | | | | | | | | | | Summary: The minimum compilers support all have alignas, and we don't use LLVM_ALIGNAS anywhere anymore. This also removes an MSVC diagnostic which, according to the comment above, isn't relevant anymore. Reviewers: rnk Subscribers: mgorny, jkorous, dexonsmith, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65458 llvm-svn: 367383
* [clangd][NFC] Fix typo in commentJan Korous2019-07-301-1/+1
| | | | llvm-svn: 367361
* [clangd][NFC] Typo in commentJan Korous2019-07-301-1/+1
| | | | llvm-svn: 367354
* [clang-tidy] Fix the documentation for linuxkernel-must-use-errs.Tom Roeder2019-07-302-17/+11
| | | | | | | | | | | | | | | | | | | Summary: This changes ReleaseNotes.txt to have the first sentence of the full documentation from linuxkernel-must-use-errs.rst. This addresses a comment from the review of rL367071 in https://reviews.llvm.org/D59963. Reviewers: Eugene.Zelenko Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65343 llvm-svn: 367333
* [clangd] Fix a regression in rL366996.Haojian Wu2019-07-302-7/+16
| | | | | | | | | | | | | | Summary: That patch made the tweak always annotate the whole file by accident. Reviewers: jvikstrom Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65443 llvm-svn: 367313
* [clangd] Ignore diags from builtin filesKadir Cetinkaya2019-07-303-15/+37
| | | | | | | | | | | | | | | | | | Summary: This fixes a case where we show diagnostics on arbitrary lines, in an internal codebase. Open for ideas on unittesting this. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64863 llvm-svn: 367303
* [clang-doc] Fix expected output in testsDiego Astiazaran2019-07-301-8/+2
| | | | | | | | | Removes conversion of html paths in output. These will always be in posix-style paths. Differential Revision: https://reviews.llvm.org/D65425 llvm-svn: 367279
* [clang-doc] Fix failing tests on WindowsDiego Astiazaran2019-07-291-0/+2
| | | | | | | | | Tests on Windows were failing due to path separator differences. Links in HTML should use posix-style paths. Differential Revision: https://reviews.llvm.org/D65419 llvm-svn: 367264
* [clang-tidy]: Google: new check 'google-upgrade-googletest-case'Eric Fiselier2019-07-2912-0/+1616
| | | | | | | | | | | Introduce a new check to upgrade user code based on API changes in Googletest. The check finds uses of old Googletest APIs with "case" in their name and replaces them with the new APIs named with "suite". Patch by Alex Strelnikov (strel@google.com) Reviewed as D62977. llvm-svn: 367263
* [clangd] Fix NDEBUG build problem introduced by rL366698Bjorn Pettersson2019-07-271-1/+8
| | | | | | | | | | | | Sprinkled some #ifndef NDEBUG in Selection.cpp to make it possible to build with NDEBUG defined. The problem was introduced in rL366698 when using dlog for some debug printouts. The dlog macro expands to DEBUG_WITH_TYPE, which isn't using it's arguments in optimized builds (when NDEBUG is defined). llvm-svn: 367178
* [clang-format] Fix style of css file pathsDiego Astiazaran2019-07-262-14/+5
| | | | | | | | | CSS files included in HTML should have a path in posix style, it should not be different for Windows. Differential Revision: https://reviews.llvm.org/D65309 llvm-svn: 367137
* [clangd] Support extraction of binary "subexpressions" like a + [[b + c]].Sam McCall2019-07-265-17/+254
| | | | | | | | | | | | | | | | | | | | | Summary: These aren't formally subexpressions in C++, in this case + is left-associative. However informally +, *, etc are usually (mathematically) associative and users consider these subexpressions. We detect these and in simple cases support extracting the partial expression. As well as builtin associative operators, we assume that overloads of them are associative and support those too. Reviewers: SureYeaah Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65139 llvm-svn: 367121
* [Clangd] Disable ExtractVariable for all types of assignmentsShaurya Gupta2019-07-262-1/+3
| | | | | | | | | | | | Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65332 llvm-svn: 367113
* [clangd] Fix background index not triggering on windows due to case mismatch.Sam McCall2019-07-262-37/+61
| | | | | | | | | | | | | | Summary: This isn't a general fix to all paths where we assume case-sensitivity, it's a minimally-invasive fix targeting the llvm 9 branch. Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65320 llvm-svn: 367112
* [clang-doc] Fix failing tests on WindowsDiego Astiazaran2019-07-251-1/+6
| | | | | | | | | Tests on Windows were failing due to path separator differences. '/' was being used as separator in the expected output, paths in expected output are now changed to their native form before comparing them to the actual output. Differential Revision: https://reviews.llvm.org/D65306 llvm-svn: 367074
* [clang-doc] Add option for user provided stylesheetsDiego Astiazaran2019-07-259-50/+104
| | | | | | | | | | An option has been added to clang-doc to provide a list of css stylesheets that the user wants to use for the generated html docs. Depends on D64539. Differential Revision: https://reviews.llvm.org/D64938 llvm-svn: 367072
* [clang-tidy] Add a module for the Linux kernel.Tom Roeder2019-07-2512-1/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that clang is going to be able to build the Linux kernel again on x86, and we have gen_compile_commands.py upstream for generating compile_commands.json, clang-tidy can be used on the Linux kernel source. To that end, this commit adds a new clang-tidy module to be used for checks specific to Linux kernel source. The Linux kernel follows its own style of C, and it will be useful to separate those checks into their own module. This also adds an initial check that makes sure that return values from the kernel error functions like PTR_ERR and ERR_PTR are checked. It also makes sure that any functions that directly return values from these functions are checked. Subscribers: xazax.hun, gribozavr, Eugene.Zelenko, lebedev.ri, mgorny, jdoerfert, cfe-commits Tags: #clang, #clang-tools-extra Reviewers: aaron.ballman, alexfh, hokein, JonasToth Differential Revision: https://reviews.llvm.org/D59963 llvm-svn: 367071
* [clang-doc] Add stylesheet to generated html docsDiego Astiazaran2019-07-2510-4/+267
| | | | | | | | A default css stylesheet is included for docs generated in html format. Differential Revision: https://reviews.llvm.org/D64539 llvm-svn: 367056
* [clang-doc] Fix output format of htmlDiego Astiazaran2019-07-252-71/+31
| | | | | | | | | The children of a TagNode are rendered in the same line as the parent only if they are all TextNodes. When children are not inline; two text nodes that are adjacent won't have a new line between them, each tag node is rendered in its own line. Differential Revision: https://reviews.llvm.org/D65005 llvm-svn: 367050
* [clang-doc] Fix html entities in rendered textDiego Astiazaran2019-07-252-1/+14
| | | | | | | | | Replace &, <, >, ", and ' with their corresponding html entities in text rendered by HTML generator. Differential Revision: https://reviews.llvm.org/D65107 llvm-svn: 367045
* [clangd] Fix the annotate tweak after rL366893Haojian Wu2019-07-252-17/+34
| | | | | | | | | | | | | | | | | | Summary: After rL366893, the annoate tweak is not activated when we select the whole file (the commonAncestor is TUDecl but we intend to return null). This patch fixes this, and also avoid traversing the TUDecl. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65210 llvm-svn: 366996
* [clangd] Provide help text to users who run `clangd` in a terminal.Sam McCall2019-07-251-0/+5
| | | | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65201 llvm-svn: 366992
* [clangd] Also accept flags from CLANGD_FLAGS variable.Sam McCall2019-07-253-10/+26
| | | | | | | | | | | | | | | | This simplifies various workflows, particularly in debugging/development. e.g. editors will tend to propagate flags, so you can run `env CLANGD_FLAGS=-input-mirror-file=/tmp/mirror vim foo.cc` rather than change the configuration in a persistent way. (This also gives us a generic lever when we don't know how to customize the flags in some particular LSP client). While here, add a test for this and other startup logging, and fix a couple of direct writes to errs() that should have been logs. Differential Revision: https://reviews.llvm.org/D65153 llvm-svn: 366991
* [clangd] Add categories to help options, and only show clangd options.Sam McCall2019-07-241-190/+232
| | | | | | | | | | | | | | | | | | | Summary: Restricting the categories prevents extra unwanted options from creeping into help (D60663), and removes a bunch of noise from --help-hidden. While here, remove `static` from the opts in favor of an anon namespace, to reduce the noise level. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65200 llvm-svn: 366900
* [clangd] SelectionTree treats TranslationUnitDecl (mostly) consistently with ↵Sam McCall2019-07-245-35/+48
| | | | | | | | | | | | | | | | | | | | | | | other containers. Summary: Previously TranslationUnitDecl would never be selected. This means root() is never null, and returns a reference. commonAncestor() is in principle never null also, but returning TUDecl here requires tweaks to be careful not to traverse it (this was already possible when selecting multiple top-level decls, and there are associated bugs!) Instead, never allow commonAncestor() to return TUDecl, return null instead. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65101 llvm-svn: 366893
* [clangd] Fix SelectionTree traversal of qualified typesSam McCall2019-07-243-20/+39
| | | | | | | | | | | | | | | | | | | | | Summary: QualifiedTypeLoc isn't treated like a regular citizen by RecursiveASTVisitor. This meant we weren't intercepting the traversal of its inner TypeLoc. Most of the changes here are about exposing kind() so we can improve the precision of our tests. This should fix the issue raised in D65067. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65100 llvm-svn: 366882
* [clangd] Reformat use of cl::opt: use unqualified name and don't bin-pack ↵Sam McCall2019-07-241-175/+225
| | | | | | | | | | | | | | attributes. NFC Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65154 llvm-svn: 366880
* [clangd] Bump vscode-clangd v0.0.16Haojian Wu2019-07-242-345/+376
| | | | | | | | CHANGELOG: - detect C++ language based on some well-known file paths - upgrade the lsp-client and lsp-server dependencies llvm-svn: 366877
* [clangd] Update a stale comment, NFC.Haojian Wu2019-07-241-1/+1
| | | | llvm-svn: 366875
* [clangd] Implement "prepareRename"Haojian Wu2019-07-248-15/+98
| | | | | | | | | | | | | | | | | | Summary: - "prepareRename" request is added in LSP v3.12.0 - also update the vscode-client dependency to pick-up the rename bug fix[1] [1]: https://github.com/microsoft/vscode-languageserver-node/issues/447 Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63126 llvm-svn: 366873
* [Clangd] Fixed ExtractVariable for certain types of ExprsShaurya Gupta2019-07-242-57/+148
| | | | | | | | | | | | | | | | | | Summary: - Modified ExtractVariable for extraction of MemberExpr, DeclRefExpr and Assignment Expr - Removed extraction from label statements. - Fixed unittests Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64717 llvm-svn: 366869
* [clangd] Log version, cwd, args, and transport on startup. NFCSam McCall2019-07-231-0/+13
| | | | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65146 llvm-svn: 366811
* [clangd] Add dlog()s for SelectionTree, enabling -debug-only=SelectionTree.cppSam McCall2019-07-222-29/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: SelectionTree is a RecursiveASTVisitor which processes getSourceRange() for every node. This is a lot of surface area with the AST, as getSourceRange() is specialized for *many* node types. And the resulting SelectionTree depends on the source ranges of many visited nodes, and the order of traversal. Put together, this means we really need a traversal log to debug when we get an unexpected SelectionTree. I've built this ad-hoc a few times, now it's time to check it in. Example output: ``` D[14:07:44.184] Computing selection for </usr/local/google/home/sammccall/test.cc:1:7, col:8> D[14:07:44.184] push: VarDecl const auto x = 42 D[14:07:44.184] claimRange: </usr/local/google/home/sammccall/test.cc:1:12, col:13> D[14:07:44.184] push: NestedNameSpecifierLoc (empty NestedNameSpecifierLoc) D[14:07:44.184] pop: NestedNameSpecifierLoc (empty NestedNameSpecifierLoc) D[14:07:44.184] push: QualifiedTypeLoc const auto D[14:07:44.184] pop: QualifiedTypeLoc const auto D[14:07:44.184] claimRange: </usr/local/google/home/sammccall/test.cc:1:7, col:11> D[14:07:44.184] hit selection: </usr/local/google/home/sammccall/test.cc:1:7, col:8> D[14:07:44.184] skip: IntegerLiteral 42 D[14:07:44.184] skipped range = </usr/local/google/home/sammccall/test.cc:1:16> D[14:07:44.184] pop: VarDecl const auto x = 42 D[14:07:44.184] claimRange: </usr/local/google/home/sammccall/test.cc:1:1, col:18> D[14:07:44.184] skip: VarDecl int y = 43 D[14:07:44.184] skipped range = </usr/local/google/home/sammccall/test.cc:2:1, col:9> D[14:07:44.184] Built selection tree TranslationUnitDecl VarDecl const auto x = 42 .QualifiedTypeLoc const auto ``` Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65073 llvm-svn: 366698
* Update documentation for all CERT checks that correspond to a recommendation.Aaron Ballman2019-07-224-5/+31
| | | | | | CERT removed their C++ secure coding recommendations from public view and so the links within that documentation are stale. This updates various pieces of documentation to make this more clear, and to help add substance where our docs deferred to CERT's wiki. llvm-svn: 366687
* [clangd] Set buffer name for main file. NFCISam McCall2019-07-221-5/+6
| | | | llvm-svn: 366675
* [clangd] Log input code of failed highlighting tests. NFCIlya Biryukov2019-07-221-1/+2
| | | | llvm-svn: 366674
* [clangd] Provide a way to publish highlightings in non-racy mannerIlya Biryukov2019-07-194-47/+77
| | | | | | | | | | | | | | | | | | Summary: By exposing a callback that can guard code publishing results of 'onMainAST' callback in the same manner we guard diagnostics. Reviewers: sammccall Reviewed By: sammccall Subscribers: javed.absar, MaskRay, jkorous, arphaman, kadircet, hokein, jvikstrom, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64985 llvm-svn: 366577
* [clangd] Disable background-index on lit-tests by defaultKadir Cetinkaya2019-07-191-1/+5
| | | | | | | | | | | | | | | | Summary: Since background-index can perform disk writes, we don't want to turn it on tests that won't clear it. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64990 llvm-svn: 366575
* [Clangd] Fixed ExtractVariable testShaurya Gupta2019-07-191-9/+15
| | | | llvm-svn: 366568
* [Clangd] Fixed SelectionTree bug for macrosShaurya Gupta2019-07-193-26/+45
| | | | | | | | | | | | | | | | | | Summary: Fixed SelectionTree bug for macros - Fixed SelectionTree claimRange for macros and template instantiations - Fixed SelectionTree unit tests - Changed a breaking test in TweakTests Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64329 llvm-svn: 366566
* Revert "Revert r366458, r366467 and r366468"Kadir Cetinkaya2019-07-1915-225/+359
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 9c377105da0be7c2c9a3c70035ce674c71b846af. [clangd][BackgroundIndexLoader] Directly store DependentTU while loading shard Summary: We were deferring the population of DependentTU field in LoadedShard until BackgroundIndexLoader was consumed. This actually triggers a use after free since the shards FileToTU was pointing at could've been moved while consuming the Loader. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64980 llvm-svn: 366559
* Revert r366458, r366467 and r366468Azharuddin Mohammed2019-07-1915-367/+225
| | | | | | | | | | | r366458 is causing test failures. r366467 and r366468 had to be reverted as they were casuing conflict while reverting r366458. r366468 [clangd] Remove dead code from BackgroundIndex r366467 [clangd] BackgroundIndex stores shards to the closest project r366458 [clangd] Refactor background-index shard loading llvm-svn: 366551
* [clangd] Handle windows line endings in QueryDriverKadir Cetinkaya2019-07-192-3/+5
| | | | | | | | | | | | | | | | | | | | Summary: The previous patch did not fix the end mark. D64789 fixes second case of https://github.com/clangd/clangd/issues/93 Patch by @lh123 ! Reviewers: sammccall, kadircet Reviewed By: kadircet Subscribers: MaskRay, ilya-biryukov, jkorous, arphaman, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D64970 llvm-svn: 366545
* [clangd] cleanup: unify the implemenation of checking a location is inside ↵Haojian Wu2019-07-1912-21/+54
| | | | | | | | | | | | | | | | main file. Summary: We have variant implementations in the codebase, this patch unifies them. Reviewers: ilya-biryukov, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64915 llvm-svn: 366541
* [clangd] Remove dead code from BackgroundIndexKadir Cetinkaya2019-07-181-3/+0
| | | | llvm-svn: 366468
OpenPOWER on IntegriCloud