summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Remove raw string literals in macrosOliver Stannard2020-01-131-12/+16
| | | | | Older (but still supported) versions of GCC don't handle C++11 raw string literals in macro parameters correctly.
* [clangd] Publish xref for macros from Index and AST.Utkarsh Saxena2020-01-132-42/+106
| | | | | | | | | | | | | | | | | | | Summary: With this patch the `findReferences` API will return Xref for macros. If the symbol under the cursor is a macro then we collect the references to it from: 1. Main file by looking at the ParsedAST. (These were added to the ParsedAST in https://reviews.llvm.org/D70008) 2. Files other than the mainfile by looking at the: * static index (Added in https://reviews.llvm.org/D70489) * file index (Added in https://reviews.llvm.org/D71406) This patch collects all the xref from the above places and outputs it in `findReferences` API. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72395
* [clangd] Show template arguments in type hierarchy when possibleNathan Ridge2020-01-122-12/+117
| | | | | | | | | | | | Summary: Fixes https://github.com/clangd/clangd/issues/31 Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71533
* [clangd] Assert that the testcases in FindExplicitReferencesTest.All have no ↵Nathan Ridge2020-01-121-3/+7
| | | | | | | | | | | | diagnostics Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72355
* clang-tidy doc: unbreak the CISylvestre Ledru2020-01-101-0/+2
|
* clang-tidy doc: Refresh the list of checkers and polish the scriptSylvestre Ledru2020-01-102-33/+28
|
* MakeUniqueCheck.cpp: explicit the fact that there is an autofix for this checkerSylvestre Ledru2020-01-101-0/+2
|
* [clangd] Fix targetDecl() on certain usage of ObjC properties.Sam McCall2020-01-102-6/+12
| | | | | | | | | | | | | | | Summary: In particular there's a common chain: OpaqueValueExpr->PseudoObjectExpr->ObjCPropertyRefExpr->ObjCPropertyDecl and we weren't handling the first two edges Reviewers: dgoldman, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72494
* [clangd] Fix markdown rendering in VSCodeKadir Cetinkaya2020-01-102-11/+12
| | | | | | | | | | | | | | | Summary: Eventough it is OK to have a new line without any preceding spaces in some markdown specifications, VSCode requires two spaces before a new line to break a line inside a paragraph. Reviewers: sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72462
* [clangd] Improve type printing in hoverKadir Cetinkaya2020-01-102-15/+36
| | | | | | | | | | | | | | | | | | Summary: Do not include tag keywords when printing types for symbol names, as it will come from SymbolKind. Also suppress them while printing definitions to prevent them occuring in template arguments. Make use of `getAsString`, instead of `print` in all places to have a consistent style across the file. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72450
* Restore order in clang-tidy section of release notesHans Wennborg2020-01-101-49/+61
| | | | | | | | Major changes are introduction of subsubsections to prevent people putting new entries in wrong places. I also polished line length and highlighting. Patch by Eugene Zelenko!
* clang-tidy doc - remove the widthsSylvestre Ledru2020-01-101-2/+0
|
* [clangd] Handle DeducedTemplateSpecializationType in TargetFinderNathan Ridge2020-01-092-1/+40
| | | | | | | | | | | | | | Summary: This is a workaround for https://bugs.llvm.org/show_bug.cgi?id=42914. Once that is fixed, the handling in VisitDeducedTyped() should be sufficient. Fixes https://github.com/clangd/clangd/issues/242 Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72119
* [clang-tidy] Refresh the add_new_check.py now that we use a table + autofixSylvestre Ledru2020-01-091-12/+67
| | | | | | | | | | | | Reviewers: alexfh Reviewed By: alexfh Subscribers: njames93, xazax.hun, mgorny, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D72421
* [clangd] Adjust diagnostic range to be inside main fileKadir Cetinkaya2020-01-092-8/+43
| | | | | | | | | | | | | | | | | | | | | | | Summary: LSP requires diagnostics to lay inside main file. In clangd we keep diagnostics in three different cases: - already in main file - adjusted to a header included in main file - has a note covering some range in main file In the last case, we were not adjusting the diagnostics range to be in main file, therefore these diagnostics ended up pointing some arbitrary locations. This patch fixes that issue by adjusting the range of diagnostics to be the first note inside main file when converting to LSP. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72458
* [clangd] Respect `--sysroot` argument if it is setDavid Goldman2020-01-091-1/+3
| | | | | | | | | | | | | | Summary: - Since `--sysroot` is a superset of the `-isysroot` argument, we shouldn't add the `-isysroot` if we detect a `--sysroot` flag. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72415
* [clang-tidy] For checker `readability-misleading-indentation` update tests.Andi-Bogdan Postelnicu2020-01-091-1/+12
| | | | | | | | | | | | Summary: In D72333 we've introduced support for `if constexpr` but the test for uninstantiated template was not ready to land on windows platform since this target uses `-fdelayed-template-parsing` by default. This patch addresses this by passing `-fno-delayed-template-parsing` to the test. Reviewers: JonasToth Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72438
* [clangd] Refurbish HoverInfo::presentKadir Cetinkaya2020-01-093-32/+157
| | | | | | | | | | | | Summary: Improves basic hover presentation logic to include more info. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71555
* [APFloat] Fix checked error assert failuresEhud Katz2020-01-091-6/+8
| | | | | | | | | | | `APFLoat::convertFromString` returns `Expected` result, which must be "checked" if the LLVM_ENABLE_ABI_BREAKING_CHECKS preprocessor flag is set. To mark an `Expected` result as "checked" we must consume the `Error` within. In many cases, we are only interested in knowing if an error occured, without the need to examine the error info. This is achieved, easily, with the `errorToBool()` API.
* [clang-tidy] Remove broken test on Windows for ↵Andi-Bogdan Postelnicu2020-01-081-11/+0
| | | | | | | `readability-misleading-indentation`. Because Windows build uses by default `fdelayed-template-parsing` we cannot have a test where we don't instantiate the template. Please see D72333.
* [clang-tidy] Disable match on `if constexpr` statements in template ↵Andi-Bogdan Postelnicu2020-01-082-1/+82
| | | | | | | | | | | | | | instantiation for `readability-misleading-indentation` check. Summary: Fixes fixes `readability-misleading-identation` for `if constexpr`. This is very similar to D71980. Reviewers: alexfh Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72333
* [clangd] Add xref for macros to FileIndex.Utkarsh Saxena2020-01-085-3/+70
| | | | | | | | | | | | | | | Summary: Adds macro references to the dynamic index. Tests added. Also exposed a new API to convert path to URI in URI.h Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71406
* [clang-tidy] modernize-use-using uses AST and now supports struct defintions ↵Mitchell Balan2020-01-075-94/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and multiple types in a typedef Summary: It now handles `typedef`s that include comma-separated multiple types, and handles embedded struct definitions, which previously could not be automatically converted. For example, with this patch `modernize-use-using` now can convert: typedef struct { int a; } R_t, *R_p; to: using R_t = struct { int a; }; using R_p = R_t*; `-ast-dump` showed that the `CXXRecordDecl` definitions and multiple `TypedefDecl`s come consecutively in the tree, so `check()` stores information between calls to determine when it is receiving a second or additional `TypedefDecl` within a single `typedef`, or when the current `TypedefDecl` refers to an embedded `CXXRecordDecl` like a `struct`. Reviewers: alexfh, aaron.ballman Patch by: poelmanc Subscribers: riccibruno, sammccall, cfe-commits, aaron.ballman Tags: clang-tools-extra, clang Differential Revision: https://reviews.llvm.org/D70270
* Fix issues reported by -Wrange-loop-analysis when building with latest Clang ↵Alexandre Ganea2020-01-072-2/+2
| | | | | | (trunk). NFC. Fixes warning: loop variable 'E' of type 'const llvm::StringRef' creates a copy from type 'const llvm::StringRef' [-Wrange-loop-analysis]
* [clangd] Heuristically resolve dependent call through smart pointer typeNathan Ridge2020-01-072-17/+59
| | | | | | | | | | | | Summary: Fixes https://github.com/clangd/clangd/issues/227 Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71644
* [clangd] Assert that the testcases in LocateSymbol.All have no diagnosticsNathan Ridge2020-01-071-22/+62
| | | | | | | | | | Summary: Also fix some bugs in the testcases which this exposed. Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72066
* [clangd] Introduce bulletlistsKadir Cetinkaya2020-01-073-1/+125
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71422
* [clangd] Add path mappings functionalitySam McCall2020-01-078-1/+574
| | | | | | | | | | | | | | | | Summary: Add path mappings to clangd which translate file URIs on inbound and outbound LSP messages. This mapping allows clangd to run in a remote environment (e.g. docker), where the source files and dependencies may be at different locations than the host. See http://lists.llvm.org/pipermail/clangd-dev/2019-January/000231.htm for more. Patch by William Wagner! Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: usaxena95, ormris, mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64305
* [clang-tidy] new check: bugprone-signed-char-misuseTamás Zolnai2020-01-0611-0/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check searches for signed char -> integer conversions which might indicate programming error, because of the misinterpretation of char values. A signed char might store the non-ASCII characters as negative values. The human programmer probably expects that after an integer conversion the converted value matches with the character code (a value from [0..255]), however, the actual value is in [-128..127] interval. See also: STR34-C. Cast characters to unsigned char before converting to larger integer sizes <https://wiki.sei.cmu.edu/confluence/display/c/STR34-C.+Cast+characters+to+unsigned+char+before+converting+to+larger+integer+sizes> By now this check is limited to assignment / variable declarations. If we would catch all signed char -> integer conversion, then it would produce a lot of findings and also false positives. So I added only this use case now, but this check can be extended with additional use cases later. The CERT documentation mentions another use case when the char is used for array subscript. Next to that a third use case can be the signed char - unsigned char comparison, which also a use case where things happen unexpectedly because of conversion to integer. Reviewers: alexfh, hokein, aaron.ballman Reviewed By: aaron.ballman Subscribers: sylvestre.ledru, whisperity, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D71174
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2020-01-061-0/+1
|
* [APFloat] Fix compilation warningsEhud Katz2020-01-061-2/+6
|
* NFC: Fix trivial typos in commentsKazuaki Ishizaki2020-01-0468-80/+80
|
* [clang-tidy] fix linkage with clangSema for FixitHintUtils, undo previous ↵Jonas Toth2020-01-032-1/+1
| | | | wrong fix
* [clang-tidy] quickfix: add -fno-delayed-template-parsing as default argument ↵Jonas Toth2020-01-031-0/+1
| | | | for runCheckOnCode unit-tests to unbreak windows
* [clang-tidy] fix broken linking for AddConstTest with adding clangSema as ↵Jonas Toth2020-01-031-0/+1
| | | | dependency (DeclSpec)
* [clang-tidy] implement utility-function to add 'const' to variablesJonas Toth2020-01-039-15/+1339
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch extends the already existing facility to add 'const' to variables to be more flexible and correct. The previous version did not consider pointers as value AND pointee. For future automatic introduction for const-correctness this shortcoming needs to be fixed. It always allows configuration where the 'const' token is inserted, either on the left side (if possible) or the right side. It adds many unit-tests to the utility-function that did not exist before, as the function was implicitly tested through clang-tidy checks. These tests were not changed, as the API is still compatible. Reviewers: aaron.ballman, hokein, alexfh, shuaiwang, lebedev.ri Reviewed By: aaron.ballman Subscribers: jdoerfert, mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D54395
* [clangd] targetDecl() returns only NamedDecls.Sam McCall2020-01-036-48/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: While it's perfectly reasonable for non-named decls such as static_assert to resolve to themselves: - nothing else ever resolves to them - features based on references (hover, highlight, find refs etc) tend to be uninteresting where only trivial references are possible - returning NamedDecl is a more convenient API (we cast to it in many places) - this aligns closer to findExplicitReferences/explicitReferenceTargets This fixes a crash in explicitReferenceTargets: if the target is a non-named decl then there's an invalid unchecked cast to NamedDecl. In practice this means when hovering over e.g. a static_assert: - before ac3f9e4842, we would show a (boring) hover card - after ac3f9e4842, we would crash - after this patch, we will show nothing Reviewers: kadircet, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72163
* [clangd] Replace shortenNamespace with getQualificationKadir Cetinkaya2020-01-033-66/+79
| | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71652
* Fix trivial typos in comments; NFCKazuaki Ishizaki2020-01-027-7/+7
|
* Handle init statements in readability-else-after-returnNathan James2020-01-024-38/+351
| | | | | | | | | | Adds a new ASTMatcher condition called 'hasInitStatement()' that matches if, switch and range-for statements with an initializer. Reworked clang-tidy readability-else-after-return to handle variables in the if condition or init statements in c++17 ifs. Also checks if removing the else would affect object lifetimes in the else branch. Fixes PR44364.
* [clangd] Reorder FindTarget.h - group targetDecl() stuff and ↵Sam McCall2020-01-022-42/+45
| | | | findExplicitReferences(). NFC
* Revert "Revert "[clangd] Implement "textDocument/documentLink" protocol ↵Sam McCall2020-01-0211-0/+175
| | | | | | | | | | support"" This reverts commit 079ef783dd5530b5f87beefe624b9179547ded7e. The revert describes a test failure without details, after offline discussion this in in a private/unsupported build system and doesn't seem to reflect a real upstream bug.
* [docs] Update path to clang-tools-extraAlexander Lanin2020-01-023-40/+40
| | | | | | | | | | | | | | | | | | Summary: > tools/clang/tools/extra has become >clang-tools-extra which was not updated in all docs. Reviewers: alexfh, aaron.ballman, ilya-biryukov, juliehockett Reviewed By: aaron.ballman Subscribers: Jim, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D71982
* [NFC] Fixes -Wrange-loop-analysis warningsMark de Wever2020-01-016-6/+6
| | | | | | This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71857
* clang-tidy doc: Remove severities as they don't make consensusSylvestre Ledru2020-01-011-392/+388
| | | | | | | | | | | | Reviewers: jdoerfert, aaron.ballman Reviewed By: aaron.ballman Subscribers: whisperity, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72049
* clang-tidy doc: modernize-make-unique has an autofixSylvestre Ledru2019-12-311-1/+1
|
* Fix formatting in previous commitsStephen Kelly2019-12-291-6/+10
|
* Fix use of named values surrounded by newlines in clang-queryStephen Kelly2019-12-291-0/+19
|
* Fix newline handling in clang-query parserStephen Kelly2019-12-292-1/+9
| | | | Don't prematurely remove characters from the end of the string
* Fix handling of newlines in clang-queryStephen Kelly2019-12-291-0/+18
| | | | Replace assert with diagnostic for missing newline.
OpenPOWER on IntegriCloud