summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Update the test codeHaojian Wu2018-12-061-4/+0
| | | | | | I forgot to update it in the last round of code review. llvm-svn: 348478
* [clangd] C++ API for emitting file status.Haojian Wu2018-12-065-9/+177
| | | | | | Introduce clangd C++ API to emit the current status of file. llvm-svn: 348475
* [clangd] Fix a typo in TUSchedulerTestsHaojian Wu2018-12-061-1/+1
| | | | | | | | | | | | Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55312 llvm-svn: 348467
* Move detection of libc++ include dirs to Driver on MacOSIlya Biryukov2018-12-052-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The intention is to make the tools replaying compilations from 'compile_commands.json' (clang-tidy, clangd, etc.) find the same standard library as the original compiler specified in 'compile_commands.json'. Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied on the value of resource dir as an approximation of the compiler install dir. The new logic uses the actual compiler install dir and is performed in the driver. This is consistent with the C++ standard library detection on other platforms and allows to override the resource dir in the tools using the compile_commands.json without altering the standard library detection mechanism. The tools have to override the resource dir to make sure they use a consistent version of the builtin headers. There is still logic in InitHeaderSearch that attemps to add the absolute includes for the the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too, but it could potentially break the library detection on other systems, so we don't tackle it in this patch to keep its scope manageable. This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675. The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke the libc++ detection in clang itself, which caused LLDB tests to break. The LLDB tests pass with new fix. Reviewers: JDevlieghere, arphaman, EricWF Reviewed By: arphaman Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54630 llvm-svn: 348365
* [clangd] Dont provide locations for non-existent files.Kadir Cetinkaya2018-12-052-4/+19
| | | | | | | | | | | | | | Summary: We were getting assertion errors when we had bad file names, instead we should skip those. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55275 llvm-svn: 348359
* Fix compilation error when using clang 3.6.0Mikael Holmen2018-12-051-3/+3
| | | | llvm-svn: 348357
* Revert "[clang-tidy] new check: bugprone-branch-clone"Jonas Toth2018-12-058-1373/+0
| | | | | | | The patch broke on buildbot with assertion-failure. Revert until this is figured out. llvm-svn: 348344
* [clang-tidy] new check: bugprone-branch-cloneJonas Toth2018-12-058-0/+1373
| | | | | | | | | | | | | | | | | | | | | | Summary: Implement a check for detecting if/else if/else chains where two or more branches are Type I clones of each other (that is, they contain identical code) and for detecting switch statements where two or more consecutive branches are Type I clones of each other. Patch by donat.nagy. Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: JonasToth Subscribers: MTC, lebedev.ri, whisperity, xazax.hun, Eugene.Zelenko, mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54757 llvm-svn: 348343
* Fix a false positive in misplaced-widening-castJonas Toth2018-12-052-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: bugprone-misplaced-widening-cast check used to give a false warning to the following example. enum DaysEnum{ MON = 0, TUE = 1 }; day = (DaysEnum)(day + 1); //warning: either cast from 'int' to 'DaysEnum' is ineffective... But i think int to enum cast is not widening neither ineffective. Patch by dkrupp. Reviewers: JonasToth, alexfh Reviewed By: alexfh Subscribers: rnkovacs, Szelethus, gamesh411, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55255 llvm-svn: 348341
* [clang-tidy/checks] Update objc-property-declaration check to allow ↵Stephane Moore2018-12-056-179/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arbitrary acronyms and initialisms 🔧 Summary: §1 Description This changes the objc-property-declaration check to allow arbitrary acronyms and initialisms instead of using whitelisted acronyms. In Objective-C it is relatively common to use project prefixes in property names for the purposes of disambiguation. For example, the CIColor¹ and CGColor² properties on UIColor both represent symbol prefixes being used in proeprty names outside of Apple's accepted acronyms³. The union of Apple's accepted acronyms and all symbol prefixes that might be used for disambiguation in property declarations effectively allows for any arbitrary sequence of capital alphanumeric characters to be acceptable in property declarations. This change updates the check accordingly. The test variants with custom configurations are deleted as part of this change because their configurations no longer impact behavior. The acronym configurations are currently preserved for backwards compatibility of check configuration. [1] https://developer.apple.com/documentation/uikit/uicolor/1621951-cicolor?language=objc [2] https://developer.apple.com/documentation/uikit/uicolor/1621954-cgcolor?language=objc [3] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE §2 Test Notes Changes verified by: • Running clang-tidy unit tests. • Used check_clang_tidy.py to verify expected output of processing objc-property-declaration.m Reviewers: benhamilton, Wizard Reviewed By: benhamilton Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D51832 llvm-svn: 348331
* [clang-query] Continue if compilation command not found for some filesGeorge Karpenkov2018-12-051-2/+13
| | | | | | | | | | | | | | | | | When searching for a code pattern in an entire project with a compilation database it's tempting to run ``` clang-query **.cpp ``` And yet, that often breaks because some files are just not in the compilation database: tests, sample code, etc.. clang-query should not stop when encountering such cases. Differential Revision: https://reviews.llvm.org/D51183 llvm-svn: 348328
* [clang-tidy] Ignore namespaced and C++ member functions in ↵Stephane Moore2018-12-042-2/+33
| | | | | | | | | | | | | | | | google-objc-function-naming check 🙈 Summary: The google-objc-function-naming check applies to functions that are not namespaced and should not be applied to C++ member functions. Such function declarations should be ignored by the check to avoid false positives in Objective-C++ sources. Reviewers: benhamilton, aaron.ballman Reviewed By: aaron.ballman Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D55101 llvm-svn: 348317
* [Documentation] Make options section in Clang-tidy ↵Eugene Zelenko2018-12-041-6/+14
| | | | | | readability-uppercase-literal-suffix consistent with other checks. llvm-svn: 348302
* Fix "array must be initialized with a brace-enclosed initializer" build error.Simon Pilgrim2018-12-041-1/+1
| | | | | | Try to fix clang-bpf-build buildbot. llvm-svn: 348262
* [clangd] Partition include graph on auto-index.Kadir Cetinkaya2018-12-043-50/+129
| | | | | | | | | | | | | | Summary: Partitions include graphs in auto-index so that each shards contains only part of the include graph related to itself. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55062 llvm-svn: 348252
* [Documentation] Fix formatting and wrap up to 80 characters in Clang-tidy ↵Eugene Zelenko2018-12-031-9/+10
| | | | | | readability-uppercase-literal-suffix documentation. llvm-svn: 348202
* Fix compilation failure on Windows.Zachary Turner2018-12-031-1/+1
| | | | | | | This was introduced earlier but apparently used an incorrect class name so it doesn't compile on Windows. llvm-svn: 348176
* [clang-tidy] Fix unordered_map failure with specializing std::hash<> and ↵Jonas Toth2018-12-032-2/+20
| | | | | | remove previous wrong attempt at doing so llvm-svn: 348172
* [clang-tidy] Recommit: Add the abseil-duration-comparison checkJonas Toth2018-12-0312-93/+657
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples. This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks. Compilation is unbroken, because the hash-function is now directly specified for std::unordered_map, as 'enum class' does not compile as key (seamingly only on some compilers). Patch by hwright. Reviewers: aaron.ballman, JonasToth, alexfh, hokein Reviewed By: JonasToth Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54737 llvm-svn: 348169
* Revert "[clang-tidy] Add the abseil-duration-comparison check"Jonas Toth2018-12-0312-656/+93
| | | | | | This commit broke buildbots and needs adjustments. llvm-svn: 348165
* [clang-tidy] Add the abseil-duration-comparison checkJonas Toth2018-12-0312-93/+656
| | | | | | | | | | | | | | | | | | | | | Summary: This check finds instances where Duration values are being converted to a numeric value in a comparison expression, and suggests that the conversion happen on the other side of the expression to a Duration. See documentation for examples. This also shuffles some code around so that the new check may perform in sone step simplifications also caught by other checks. Patch by hwright. Reviewers: aaron.ballman, JonasToth, alexfh, hokein Reviewed By: JonasToth Subscribers: sammccall, Eugene.Zelenko, xazax.hun, cfe-commits, mgorny Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D54737 llvm-svn: 348161
* [clangd] Avoid memory-mapping files on WindowsIlya Biryukov2018-12-033-3/+87
| | | | | | | | | | | | | | | | | | Summary: Memory-mapping files on Windows leads to them being locked and prevents editors from saving changes to those files on disk. This is fine for the compiler, but not acceptable for an interactive tool like clangd. Therefore, we choose to avoid using memory-mapped files on Windows. Reviewers: hokein, kadircet Reviewed By: kadircet Subscribers: yvvan, zturner, nik, malaperle, mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55139 llvm-svn: 348147
* [clangd] Fix a stale comment, NFC.Haojian Wu2018-12-032-3/+2
| | | | llvm-svn: 348133
* [clangd] Get rid of AST matchers in CodeComplete, NFCHaojian Wu2018-12-031-9/+18
| | | | | | | | | | | | | | Summary: The isIndexedForCodeCompletion is called in the code patch of SymbolCollector. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55206 llvm-svn: 348130
* [clangd] Recommit the "AnyScope" changes in requests.json by rCTE347753 ↵Fangrui Song2018-12-011-7/+7
| | | | | | | | (reverted by rCTE347792) This fixes IndexBenchmark tests. llvm-svn: 348066
* [clangd] Populate include graph during static indexing action.Kadir Cetinkaya2018-11-307-14/+359
| | | | | | | | | | | | | | | Summary: This is the second part for introducing include hierarchy into index files produced by clangd. You can see the base patch that introduces structures and discusses the future of the patches in D54817 Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54999 llvm-svn: 348005
* [clangd] Penalize destructor and overloaded operators in code completion.Eric Liu2018-11-303-10/+55
| | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55061 llvm-svn: 347983
* [clangd] Drop injected class name when class scope is not explicitly specified.Eric Liu2018-11-302-3/+19
| | | | | | | | | | | | Summary: E.g. allow injected "A::A" in `using A::A^` but not in "A^". Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55065 llvm-svn: 347982
* [clangd] Bump vscode-clangd v0.0.8Haojian Wu2018-11-301-1/+1
| | | | llvm-svn: 347969
* [clangd] Fix junk output in clangd vscode pluginHaojian Wu2018-11-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When using the vscode clangd plugin, lots and lots of junk output is printed to the output window, which constantly reopens itself. Example output: I[11:13:17.733] <-- textDocument/codeAction(4) I[11:13:17.733] --> reply:textDocument/codeAction(4) 0 ms I[11:13:17.937] <-- textDocument/codeAction(5) I[11:13:17.937] --> reply:textDocument/codeAction(5) 0 ms I[11:13:18.557] <-- textDocument/hover(6) I[11:13:18.606] --> reply:textDocument/hover(6) 48 ms This should prevent that from happening. Patch by James Findley! Reviewers: ioeric, ilya-biryukov, hokein Reviewed By: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55052 llvm-svn: 347968
* Adding a FIXME test to document an area for improvement with the ↵Aaron Ballman2018-11-291-0/+12
| | | | | | cert-err58-cpp check; NFC. llvm-svn: 347860
* [Documentation] Try to fix build failure in ↵Eugene Zelenko2018-11-291-4/+4
| | | | | | cppcoreguidelines-narrowing-conversions documentation llvm-svn: 347825
* Ensure that test clang-tidy/export-relpath.cpp works with Windows path ↵Matthew Voss2018-11-281-1/+1
| | | | | | separators. llvm-svn: 347815
* Revert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark ↵Matthew Voss2018-11-283-11/+8
| | | | | | | | | in check-clangd" This revision was causing failures on the buildbots, and our internal CI. See: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20856 llvm-svn: 347792
* Fix false positive with lambda assignments in cert-err58-cpp.Aaron Ballman2018-11-282-3/+29
| | | | | | This check is about preventing exceptions from being thrown before main() executes, and assigning a lambda (rather than calling it) to a global object cannot throw any exceptions. llvm-svn: 347761
* [clang-tidy] Added a test -export-fixes with relative paths.Ilya Biryukov2018-11-281-0/+19
| | | | | | | | | | | | | | Summary: A test for D51864. Reviewers: ioeric, steveire Reviewed By: steveire Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D51865 llvm-svn: 347760
* Re-commit r347419 "Update call to EvaluateAsInt() to the new syntax."Hans Wennborg2018-11-283-16/+23
| | | | llvm-svn: 347757
* [clangd] Fix test broken in r347754.Eric Liu2018-11-281-1/+1
| | | | llvm-svn: 347755
* [clangd] Less penalty for cross-namespace completions.Eric Liu2018-11-281-2/+2
| | | | llvm-svn: 347754
* [clangd] Build and test IndexBenchmark in check-clangdHaojian Wu2018-11-283-8/+11
| | | | | | | | | | | | | | Summary: Include IndexBenchmark in check-clangd to make sure we won't forget to update it when doing breaking changes; also fix an out-of-date test input. Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54998 llvm-svn: 347753
* Fix a false-positive with cert-err58-cpp.Aaron Ballman2018-11-282-2/+15
| | | | | | If a variable is declared constexpr then its initializer needs to be a constant expression, and thus, cannot throw. This check is about not throwing exceptions before main() runs, and so it doesn't apply if the initializer cannot throw. This silences the diagnostic when initializing a constexpr variable and fixes PR35457. llvm-svn: 347745
* [clangd] Canonicalize file path in URIForFile.Eric Liu2018-11-2812-75/+169
| | | | | | | | | | | | | | | | | | | Summary: File paths in URIForFile can come from index or local AST. Path from index goes through URI transformation and the final path is resolved by URI scheme and could be potentially different from the original path. Hence, we should do the same transformation for all paths. We do this in URIForFile, which now converts a path to URI and back to a canonicalized path. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54845 llvm-svn: 347739
* [clangd] Fix backward-compatibility - follow-up to textDocument/SymbolInfoJan Korous2018-11-281-1/+2
| | | | | | Apparently clang 3.6 couldn't build the preceding patch. llvm-svn: 347738
* [clangd] Bump vscode-clangd v0.0.7Haojian Wu2018-11-281-1/+1
| | | | llvm-svn: 347737
* [clangd] textDocument/SymbolInfo extensionJan Korous2018-11-2711-0/+504
| | | | | | | | | | New method returning symbol info for given source position. Differential Revision: https://reviews.llvm.org/D54799 rdar://problem/46050281 llvm-svn: 347675
* [clangd][NFC] Move SymbolID to a separate fileJan Korous2018-11-276-77/+126
| | | | | | | | Prerequisity for textDocument/SymbolInfo Differential Revision: https://reviews.llvm.org/D54799 llvm-svn: 347674
* [clang-tidy] Ignore bool -> single bit bitfield conversion in ↵Malcolm Parsons2018-11-273-6/+26
| | | | | | | | | | | | | | | | readability-implicit-bool-conversion Summary: There is no ambiguity / information loss in this conversion Reviewers: alexfh, aaron.ballman, hokein Reviewed By: alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54941 llvm-svn: 347671
* [clangd] Put direct headers into srcs section.Kadir Cetinkaya2018-11-279-62/+148
| | | | | | | | | | | | | | | | | | | Summary: Currently, there's no way of knowing about header files using compilation database, since it doesn't contain header files as entries. Using this information, restoring from cache using compile commands becomes possible instead of doing directory traversal. Also, we can issue indexing actions for out-of-date headers even if source files depending on them haven't changed. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54817 llvm-svn: 347669
* Revert r347419 "Update call to EvaluateAsInt() to the new syntax."Hans Wennborg2018-11-273-23/+16
| | | | | | It's pre-requisite was reverted in r347656. llvm-svn: 347657
* [clangd] Prevent thread starvation in tests on loaded systems.Sam McCall2018-11-274-3/+20
| | | | | | | | | | | | | | Summary: Background index deliberately runs low-priority, but for tests this may stop them making progress. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D54938 llvm-svn: 347655
OpenPOWER on IntegriCloud