summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tidy] Fix typo in r373428Sam McCall2019-10-021-1/+0
| | | | llvm-svn: 373436
* [clangd] Always send file URIs to editorsKadir Cetinkaya2019-10-021-1/+1
| | | | | | | | | | | | | | | | Summary: Editors only know about file URIs, make sure we do not use any custom schemes while sending edits. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68324 llvm-svn: 373435
* [clang-tidy] Fix for commits rL372706 and rL372711Adam Balogh2019-10-023-10/+32
| | | | | | | | | The patch committed was not the accepted version but the previous one. This commit fixes this issue. Differential Revision: https://reviews.llvm.org/D64736 llvm-svn: 373428
* [clang-tidy] Rename objc-avoid-spinlock check to darwin-avoid-spinlockStephane Moore2019-10-0110-20/+23
| | | | | | | | | | | | | | | | | | | | | | | Summary: OSSpinLock* are Apple/Darwin functions, but were previously located with ObjC checks as those were most closely tied to Apple platforms before. Now that there's a specific Darwin module, relocating the check there. This change was prepared by running rename_check.py. Contributed By: mwyman Reviewers: stephanemoore, dmaclach Reviewed By: stephanemoore Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra, #clang, #llvm Differential Revision: https://reviews.llvm.org/D68148 llvm-svn: 373392
* [clangd] Implement getBeginning for overloaded operators.Haojian Wu2019-10-014-20/+113
| | | | | | | | | | | | | | | | Summary: This will fix some bugs where navigation doesn't work on cases like `std::cout <^< "hello"`. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67695 llvm-svn: 373323
* [clangd] Use the index-based API to do the header-source switch.Haojian Wu2019-10-016-9/+69
| | | | | | | | | | | | | | | | Summary: If the file heuristic fails, we try to use the index&AST to do the header/source inference. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68211 llvm-svn: 373320
* [clangd] Handle template arguments in findExplicitReferencesIlya Biryukov2019-10-012-2/+68
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68137 llvm-svn: 373318
* [clangd] Handle OverloadExpr in targetDeclIlya Biryukov2019-10-012-0/+30
| | | | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68119 llvm-svn: 373305
* [clang-tidy] Fix module registry name and description for Darwin clang-tidy ↵Dmitri Gribenko2019-10-011-1/+1
| | | | | | | | | | | | | | | | | | module. Summary: When creating the module, must have copy-pasted from the misc module, and forgotten to update the name/description of the module in the registry. Reviewers: stephanemoore, benhamilton, gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra, #llvm Differential Revision: https://reviews.llvm.org/D68251 llvm-svn: 373304
* [clangd] Implement a smart version of HeaderSource switch.Haojian Wu2019-09-303-0/+264
| | | | | | | | | | | | | | | | | | | Summary: This patch implements another version header-source switch by incorporating the AST and index, it will be used: - to improve the current header-source switch feature (layer with the existing file heuristic); - by the incoming define-outline code action; Reviewers: kadircet Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67907 llvm-svn: 373197
* [clangd] Fix template type aliases in findExplicitReferenceIlya Biryukov2019-09-272-21/+28
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68124 llvm-svn: 373104
* clang-tidy: Don't repeat list of all checks in three places.Nico Weber2019-09-276-102/+43
| | | | | | | | | | | | Instead, put all checks in a cmake variable and reference this. Also, make clangd use the the ClangTidyForceLinker.h header instead of duplicating the list of modules -- the duplicate copy was missing the new "darwin" checker added in r373065. Differential Revision: https://reviews.llvm.org/D68132 llvm-svn: 373082
* [clangd] Remove an unrelated comment, NFC.Haojian Wu2019-09-271-1/+0
| | | | llvm-svn: 373079
* Fixed indentation in a ClangTidy testDmitri Gribenko2019-09-271-1/+1
| | | | llvm-svn: 373068
* [clangd] Handle type template parameters in findExplicitReferencesIlya Biryukov2019-09-272-0/+25
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68120 llvm-svn: 373067
* Moved -fblocks from an individual test to check_clang_tidy.pyDmitri Gribenko2019-09-272-2/+3
| | | | | | | This way, all tests will benefit from it and will not have to worry about setting up language options properly. llvm-svn: 373066
* [clang-tidy] New check to warn when storing dispatch_once_t in non-static, ↵Dmitri Gribenko2019-09-2713-0/+235
| | | | | | | | | | | | | | | | | | | | | non-global storage. Summary: Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check. The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible. This is a re-land of https://reviews.llvm.org/D67567 Reviewers: thakis, gribozavr, stephanemoore Subscribers: Eugene.Zelenko, mgorny, xazax.hun, jkorous, arphaman, kadircet, usaxena95 Tags: #clang-tools-extra, #clang, #llvm Differential Revision: https://reviews.llvm.org/D68109 llvm-svn: 373065
* [clangd] Support OverloadExpr in findExplicitReferencesIlya Biryukov2019-09-272-1/+43
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68118 llvm-svn: 373057
* Revert "[clang-tidy] New check to warn when storing dispatch_once_t in ↵Dmitri Gribenko2019-09-2613-235/+0
| | | | | | | | non-static, non-global storage" This reverts commit r373028, because the new test fails on Linux. llvm-svn: 373032
* [clang-tidy] New check to warn when storing dispatch_once_t in non-static, ↵Stephane Moore2019-09-2613-0/+235
| | | | | | | | | | | | | | | | | | | | | | | non-global storage Summary: Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check. The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible. Contributed By: mwyman Reviewers: benhamilton, hokein, stephanemoore, aaron.ballman, gribozavr Reviewed By: stephanemoore, gribozavr Subscribers: jkorous, arphaman, kadircet, usaxena95, NoQ, xazax.hun, lebedev.ri, mgorny, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67567 llvm-svn: 373028
* [clangd] Bump vscode-clangd v0.0.18Haojian Wu2019-09-261-1/+1
| | | | | | | | CHANGELOG: - enable semantic highlighting by default - upgrade the LSP dependencies to pickup the incoming LSP v3.15.0 llvm-svn: 372981
* [clangd][vscode] Add npm helper commands to package/release the extension.Haojian Wu2019-09-262-3/+5
| | | | | | | | | | | | | | Summary: Help to fix https://github.com/clangd/clangd/issues/159. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68080 llvm-svn: 372980
* Return results by value from ClangTidyCheckFactories::createChecksDmitri Gribenko2019-09-264-14/+12
| | | | llvm-svn: 372979
* Use std::unique_ptr in ClangTidyCheckFactoriesDmitri Gribenko2019-09-265-4/+11
| | | | | | | I had to explicitly define some destructors that could only be defined in the corresponding .cpp files. llvm-svn: 372978
* [clangd][vscode] Update vscode lsp dependencies to pickup the new changes in ↵Haojian Wu2019-09-261-3/+3
| | | | | | | | | | | | | | | | LSP v3.15.0. Summary: This would enable the newly-added semantic selection feature in vscode. Reviewers: usaxena95 Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67964 llvm-svn: 372970
* [clangd][vscode] Turn on the semantic highlighting by default.Haojian Wu2019-09-261-1/+1
| | | | | | | | | | | | | | | | Summary: We have turned on the flag manually and used it for a while, and don't see any major issues, let's enable it by default. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68077 llvm-svn: 372969
* [clang-tidy] Make llvm-header-guard work on llvm git monorepoHaojian Wu2019-09-262-0/+16
| | | | | | | | | | | | | | Reviewers: gribozavr Reviewed By: gribozavr Subscribers: xazax.hun, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68026 llvm-svn: 372953
* [clangd] Add a helper for extracting nonlocal decls in a FunctionDeclKadir Cetinkaya2019-09-263-1/+103
| | | | | | | | | | | | | | | | | | | Summary: To be used by define-inline code action to determine whether the function/method body will still be valid in another context. Traverses clang-ast to find all decl nodes under the function decl and stores the non-local ones. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67748 llvm-svn: 372948
* [clangd] Change constness of parameters to findExplicitRefsKadir Cetinkaya2019-09-252-6/+6
| | | | | | | | | | | | | | | | | | Summary: Recursive AST requires non-const ast nodes, but it doesn't really mutate them. In addition to that, in clangd we mostly have const ast nodes. So it makes sense to move the const_cast into callee rather than having it at every caller in the future. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68027 llvm-svn: 372888
* [clangd] Fix parseNamespaceEvents to parse the last tokenKadir Cetinkaya2019-09-252-0/+13
| | | | | | | | | | | | Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68020 llvm-svn: 372875
* [clangd] Add missing header guard, NFC.Haojian Wu2019-09-252-0/+10
| | | | llvm-svn: 372860
* [clangd] A helper to find explicit references and their namesIlya Biryukov2019-09-253-1/+549
| | | | | | | | | | | | | | | | | | | | | | Summary: Allows to simplify pending code tweaks: - the upcoming DefineInline tweak (D66647) - remove using declaration (D56612) - qualify name under cursor (D56610) Another potential future application is simplifying semantic highlighting. Reviewers: kadircet Reviewed By: kadircet Subscribers: mgrang, jfb, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67826 llvm-svn: 372859
* [clangd] Move the existing heder-source-switch implemenation out of ↵Haojian Wu2019-09-257-130/+170
| | | | | | | | | | | | | | | | | | clangdServer. Summary: This is a NFC change. Reviewers: kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67960 llvm-svn: 372841
* [clangd] Fix the stale documentation about background indexing.Haojian Wu2019-09-251-17/+25
| | | | | | | | | | | | Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66937 llvm-svn: 372825
* [clangd] Add semantic selection to ClangdLSPServer.Utkarsh Saxena2019-09-246-0/+123
| | | | | | | | | | | | | | | | | | | | | | Summary: This adds semantic selection to the LSP Server. Adds support for serialization of input request and the output reply. Also adds regression tests for the feature. Currently we do not support multi cursor.The LSP Server only accepts single position in the request as opposed to many position in the spec. Spec: https://github.com/microsoft/language-server-protocol/blob/dbaeumer/3.15/specification.md#textDocument_selectionRange Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67720 llvm-svn: 372753
* [clangd] Save an unnecessary copy, NFC.Haojian Wu2019-09-241-1/+1
| | | | llvm-svn: 372752
* [clangd] Collect macros in the preamble region of the main fileHaojian Wu2019-09-249-113/+126
| | | | | | | | | | | | | | | | Summary: - store all macro references in the ParsedAST; - unify the two variants of CollectMainFileMacros; Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67496 llvm-svn: 372725
* [clang-tidy][test] Add -fexceptions to bugprone-infinite-loop.testFangrui Song2019-09-241-1/+1
| | | | | | | | This fixes llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast. -fexceptions is disabled by default on XCore and PS4. llvm-svn: 372715
* [modularize] Fix compilation warning after r372681Mikael Holmen2019-09-241-0/+2
| | | | | | | | | | | | | | | | In r372681 lang_cxx_11 and lang_cxx_14 were added to LanguageIDs but they were not handled in the switch in VisitLinkageSpecDecl in Modularize.cpp so at clang 8 complained with /data/repo/master/clang-tools-extra/modularize/Modularize.cpp:583:13: error: enumeration values 'lang_cxx_11' and 'lang_cxx_14' not handled in switch [-Werror,-Wswitch] switch (D->getLanguage()) { ^ 1 error generated. With this patch we now treat lang_cxx, lang_cxx_11 and lang_cxx_14 the same way in the switch in VisitLinkageSpecDecl. llvm-svn: 372714
* [clang-tidy] Add bugprone-infinite-loop.rst from D64736 to fix buildbotFangrui Song2019-09-241-0/+32
| | | | llvm-svn: 372711
* [clang-tidy] Add missing InfiniteLoopCheck.h, InfiniteLoopCheck.cpp and test ↵Fangrui Song2019-09-247-0/+533
| | | | | | from D64736 llvm-svn: 372706
* Revert rL372693 : [clang-tidy] New bugprone-infinite-loop check for ↵Simon Pilgrim2019-09-244-89/+0
| | | | | | | | | | | | | | | | | | detecting obvious infinite loops Finding infinite loops is well-known to be impossible (halting problem). However, it is possible to detect some obvious infinite loops, for example, if the loop condition is not changed. Detecting such loops is beneficial since the tests will hang on programs containing infinite loops so testing-time detection may be costly in large systems. Obvious cases are where the programmer forgets to increment/decrement the counter or increments/decrements the wrong variable. Differential Revision: https://reviews.llvm.org/D64736 ------- Broke some buildbots "No SOURCES given to target: obj.clangTidyBugproneModule" llvm-svn: 372704
* [clang-tidy] New bugprone-infinite-loop check for detecting obvious infinite ↵Adam Balogh2019-09-244-0/+89
| | | | | | | | | | | | | | | | loops Finding infinite loops is well-known to be impossible (halting problem). However, it is possible to detect some obvious infinite loops, for example, if the loop condition is not changed. Detecting such loops is beneficial since the tests will hang on programs containing infinite loops so testing-time detection may be costly in large systems. Obvious cases are where the programmer forgets to increment/decrement the counter or increments/decrements the wrong variable. Differential Revision: https://reviews.llvm.org/D64736 llvm-svn: 372693
* [Clang-doc] NFC: Fixed link to llvm bugs in documentationShaurya Gupta2019-09-231-1/+1
| | | | llvm-svn: 372627
* [clangd] Simplify the callside of URI::resolve, NFC.Haojian Wu2019-09-237-38/+27
| | | | | | | | | | | | | | | | Summary: - Add a overrloded URI::resolve, which accepts a string URI; - also fixed some callside that don't check the error; Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67916 llvm-svn: 372617
* Added a test for agreement between paths used in ClangTidy's diagnostics and ↵Dmitri Gribenko2019-09-231-0/+19
| | | | | | | | header filter This test would have been broken by r372388. llvm-svn: 372607
* Revert "[clang-tidy] Fix relative path in header-filter."Dmitri Gribenko2019-09-235-87/+3
| | | | | | | This reverts commit r372388. It made '-header-filter' inconsistent with paths printed in diagnostics. llvm-svn: 372601
* Removed an incorred namespace-end commentDmitri Gribenko2019-09-231-1/+1
| | | | llvm-svn: 372593
* [clang-tidy] Add check for classes missing -hash ⚠️Stephane Moore2019-09-218-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Apple documentation states that: "If two objects are equal, they must have the same hash value. This last point is particularly important if you define isEqual: in a subclass and intend to put instances of that subclass into a collection. Make sure you also define hash in your subclass." https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418795-isequal?language=objc In many or all versions of libobjc, -[NSObject isEqual:] is a pointer equality check and -[NSObject hash] returns the messaged object's pointer. A relatively common form of developer error is for a developer to override -isEqual: in a subclass without overriding -hash to ensure that hashes are equal for objects that are equal. It is assumed that an override of -isEqual: is a strong signal for changing the object's equality operator to something other than pointer equality which implies that a missing override of -hash could result in distinct objects being equal but having distinct hashes because they are independent instances. This added check flags classes that override -isEqual: but inherit NSObject's implementation of -hash to warn of the potential for unexpected behavior. The proper implementation of -hash is the responsibility of the developer and the check will only verify that the developer made an effort to properly implement -hash. Developers can set up unit tests to verify that their implementation of -hash is appropriate. Test Notes: Ran check-clang-tools. Reviewers: aaron.ballman, benhamilton Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67737 llvm-svn: 372445
* [clang-tidy] Fix relative path in header-filter.Dmitri Gribenko2019-09-205-3/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang-tidy supports output diagnostics from header files if user specifies --header-filter. But it can't handle relative path well. For example, the folder structure of a project is: ``` // a.h is in /src/a/a.h // b.h is in /src/b/b.h ... // c.cpp is in /src/c.cpp ``` Now, we set --header-filter as --header-filter=/a/. That means we only want to check header files under /src/a/ path, and ignore header files uder /src/b/ path, but in current implementation, clang-tidy will check /src/b/b.h also, because the name of b.h used in clang-tidy is /src/a/../b/b.h. This change tries to fix this issue. Reviewers: alexfh, hokein, aaron.ballman, gribozavr Reviewed By: gribozavr Subscribers: MyDeveloperDay, xazax.hun, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67501 Patch by Yubo Xie. llvm-svn: 372388
OpenPOWER on IntegriCloud