summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Add fallbackFlags initialization extension.Sam McCall2018-11-023-3/+9
| | | | | | | | | | | | | | Summary: This allows customizing the flags used when no compile database is available. It addresses some uses of the old extraFlags extension. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53688 llvm-svn: 345973
* Reapply Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-022-2/+1
| | | | | | | | | | | | The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. This also moves the OSLog and other FormatString helpers from libclangAnalysis to libclangAST to avoid a circular dependency. llvm-svn: 345971
* [clangd] Make in-memory CDB always available as an overlay, refactor.Sam McCall2018-11-026-96/+118
| | | | | | | | | | | | | | | | | | | | | | | Summary: The new implementation is a GlobalCompilationDatabase that overlays a base. Normally this is the directory-based CDB. To preserve the behavior of compile_args_from=LSP, the base may be null. The OverlayCDB is always present, and so the extensions to populate it are always supported. It also allows overriding the flags of the fallback command. This is just unit-tested for now, but the plan is to expose this as an extension on the initialize message. This addresses use cases like https://github.com/thomasjo/atom-ide-cpp/issues/16 Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53687 llvm-svn: 345970
* [clangd] Remove didOpen extraFlags extension.Sam McCall2018-11-027-131/+2
| | | | | | | | | | | | | | | | | | | | Summary: This was added in D34947 to support YCM, but YCM actually provides *all* args, and this was never actually used. Meanwhile, we grew another extension that allows specifying all args. I did find one user of this extension: https://github.com/thomasjo/atom-ide-cpp. I'll reach out, there are multiple good alternatives: - compile_commands.txt can serve the same purpose as .clang_complete there - we can add an extension to support setting the fallback command Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53641 llvm-svn: 345969
* [clangd] Only log ignored diagnostics with -log=verbose.Sam McCall2018-11-021-1/+2
| | | | | | | | | | Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53648 llvm-svn: 345968
* [clang-tidy] Get ClangTidyContext out of the business of storing ↵Sam McCall2018-11-027-44/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. NFC Summary: Currently ClangTidyContext::diag() sends the diagnostics to a DiagnosticsEngine, which probably delegates to a ClangTidyDiagnosticsConsumer, which is supposed to go back and populate ClangTidyContext::Errors. After this patch, the diagnostics are stored in the ClangTidyDiagnosticsConsumer itself and can be retrieved from there. Why? - the round-trip from context -> engine -> consumer -> context is confusing and makes it harder to establish layering between these things. - context does too many things, and makes it hard to use clang-tidy as a library - everyone who actually wants the diagnostics has access to the ClangTidyDiagnosticsConsumer The most natural implementation (ClangTidyDiagnosticsConsumer::take() finalizes diagnostics) causes a test failure: clang-tidy-run-with-database.cpp asserts that clang-tidy exits successfully when trying to process a file that doesn't exist. In clang-tidy today, this happens because finish() is never called, so the diagnostic is never flushed. This looks like a bug to me. For now, this patch carefully preserves that behavior, but I'll ping the authors to see whether it's deliberate and worth preserving. Reviewers: hokein Subscribers: xazax.hun, cfe-commits, alexfh Differential Revision: https://reviews.llvm.org/D53953 llvm-svn: 345961
* [clangd] Really fix clang -Wimplicit-fallthroughFangrui Song2018-11-021-1/+4
| | | | | | | | The intention was to fall through to Function case in LLVM_ENABLE_ASSERTIONS=Off builds. Use #ifndef NDEBUG to fix -Wimplicit-fallthrough llvm-svn: 345953
* [clangd] Fix clang -Wimplicit-fallthroughFangrui Song2018-11-021-1/+1
| | | | llvm-svn: 345952
* Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off buildsFangrui Song2018-11-021-2/+2
| | | | llvm-svn: 345951
* Fix clang -Wimplicit-fallthrough warnings across llvm, NFCReid Kleckner2018-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 llvm-svn: 345882
* Fix the issue that not recognizing single acronym with prefix as ObjC ↵Yan Zhang2018-11-012-5/+5
| | | | | | | | | | | | | | | | property name. Summary: This will make clang-tidy accept property names like xyz_URL (URL is a common acronym). Reviewers: benhamilton, hokein Reviewed By: benhamilton Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D53955 llvm-svn: 345858
* Removing a reliance on system headers from this test; NFC.Aaron Ballman2018-10-311-2/+9
| | | | llvm-svn: 345766
* Implement the readability-const-return-type check.Aaron Ballman2018-10-3110-0/+463
| | | | | | | | This check flags function top-level const-qualified return types and suggests removing the mostly-superfluous const qualifier where possible. Patch by Yitzhak Mandelbaum. llvm-svn: 345764
* [clang-tidy] add missing '--' in RUN-line, unbreak buildbotJonas Toth2018-10-311-1/+1
| | | | llvm-svn: 345742
* [clang-tidy] add -fexceptions to failing unit-test, unbreak buildbotJonas Toth2018-10-311-1/+1
| | | | llvm-svn: 345738
* [clang-tools-extra] fix broken link in release notesJonas Toth2018-10-311-1/+1
| | | | llvm-svn: 345736
* [clang-tidy] new check 'readability-isolate-declaration'Jonas Toth2018-10-3113-0/+1139
| | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces a new clang-tidy check that matches on all `declStmt` that declare more then one variable and transform them into one statement per declaration if possible. It currently only focusses on variable declarations but should be extended to cover more kinds of declarations in the future. It is related to https://reviews.llvm.org/D27621 and does use it's extensive test-suite. Thank you to firolino for his work! Reviewers: rsmith, aaron.ballman, alexfh, hokein, kbobyrev Reviewed By: aaron.ballman Subscribers: ZaMaZaN4iK, mgehre, nemanjai, kbarton, lebedev.ri, Eugene.Zelenko, mgorny, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D51949 llvm-svn: 345735
* Delete dependency on config.hKadir Cetinkaya2018-10-311-3/+2
| | | | | | | | | | | | | | | | Summary: Since llvm/Config/config.h is not available on standalone builds, use __USE_POSIX instead of HAVE_PTHREAD_H and get rid of the include. Reviewers: sammccall Reviewed By: sammccall Subscribers: lebedev.ri, krytarowski, ilya-biryukov, ioeric, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D53935 llvm-svn: 345729
* [clang-tidy] Remove false decoupling in ClangTidyContext. NFCSam McCall2018-10-313-21/+4
| | | | | | | These getters/setters don't encapsulate any behavior, and can only be called by friends. llvm-svn: 345716
* [clangd] fix non linux buildDavid Carlier2018-10-311-1/+1
| | | | | | | | | | | | There is no SCHED_IDLE semantic equivalent in BSD systems. Reviewers: kadircet, sammccall Revieweed By: sammccall Differential Revision: https://reviews.llvm.org/D53922 llvm-svn: 345700
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-306-11/+10
| | | | | | | | | | We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 llvm-svn: 345637
* [clang-tidy] cppcoreguidelines-macro-usage: print macro namesRoman Lebedev2018-10-307-28/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The macro may not have location (or more generally, the location may not exist), e.g. if it originates from compiler's command-line. The check complains on all the macros, even those without the location info. Which means, it only says it does not like it. What is 'it'? I have no idea. If we don't print the name, then there is no way to deal with that situation. And in general, not printing name here forces the user to try to understand, given, the macro definition location, what is the macro name? This isn't fun. Also, ignores-by-default the macros originating from command-line, with an option to not ignore those. I suspect some more issues may crop up later. Reviewers: JonasToth, aaron.ballman, hokein, xazax.hun, alexfh Reviewed By: JonasToth, aaron.ballman Subscribers: nemanjai, kbarton, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D53817 llvm-svn: 345610
* [clangd] Use thread pool for background indexing.Kadir Cetinkaya2018-10-304-7/+44
| | | | | | | | | | | | Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D53651 llvm-svn: 345590
* [clang-query] Add non-exclusive output APIStephen Kelly2018-10-296-10/+118
| | | | | | | | | | | | | | | | | | | | Summary: Add granular options for AST dumping, text printing and diagnostics. This makes it possible to * Have both diag and dump active at once * Extend the output with other queryable content in the future. Reviewers: aaron.ballman, pcc, ioeric, ilya-biryukov, klimek, sammccall Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52857 llvm-svn: 345522
* [AST] Refactor PredefinedExprBruno Ricci2018-10-271-3/+3
| | | | | | | | | | | | | | | | | | Make the following changes to PredefinedExpr: 1. Move PredefinedExpr below StringLiteral so that it can use its definition. 2. Rename IdentType to IdentKind to be more in line with clang's conventions, and propagate the change to its users. 3. Move the location and the IdentKind into the newly available space of the bit-fields of Stmt. 4. Only store the function name when needed. When parsing all of Boost, of the 1357 PredefinedExpr 919 have no function name. Differential Revision: https://reviews.llvm.org/D53605 Reviewed By: rjmccall llvm-svn: 345460
* [clang-doc] Switch to default to all-TUs executorJulie Hockett2018-10-263-3/+3
| | | | | | | | Since we generally want to document a whole project, not just one file. Differential Revision: https://reviews.llvm.org/D53170 llvm-svn: 345418
* [clang-tidy] Re-commit: Add new 'readability-uppercase-literal-suffix' check ↵Roman Lebedev2018-10-2624-19/+1479
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4) Summary: Detects when the integral literal or floating point (decimal or hexadecimal) literal has non-uppercase suffix, and suggests to make the suffix uppercase, with fix-it. All valid combinations of suffixes are supported. ``` auto x = 1; // OK, no suffix. auto x = 1u; // warning: integer literal suffix 'u' is not upper-case auto x = 1U; // OK, suffix is uppercase. ... ``` This is a re-commit, the original was reverted by me in rL345305 due to discovered bugs. (implicit code, template instantiation) Tests were added, and the bugs were fixed. I'm unable to find any further bugs, hopefully there aren't any.. References: * [[ https://wiki.sei.cmu.edu/confluence/pages/viewpage.action?pageId=87152241 | CERT DCL16-C ]] * MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix * MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case Reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun Reviewed By: aaron.ballman Subscribers: Eugene.Zelenko, mgorny, rnkovacs, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D52670 llvm-svn: 345381
* [clang-tidy] Revert my readability-uppercase-literal-suffix check.Roman Lebedev2018-10-2524-1454/+19
| | | | | | | | | | There are some lurking issues with the handling of the SourceManager. Somehow sometimes we end up extracting completely wrong portions of the source buffer. Reverts r344772, r44760, r344758, r344755. llvm-svn: 345305
* [clangd] workspace/symbol should be async, it reads from the index.Sam McCall2018-10-254-2/+30
| | | | | | | | | | | | | | Summary: To enable this, TUScheduler has to provide a way to run async tasks without needing a preamble or AST! Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53644 llvm-svn: 345268
* [clangd] Clean up LSP structs around configuration. NFC, no protocol changes.Sam McCall2018-10-254-49/+45
| | | | | | | | | - align struct names/comments with LSP, remove redundant "clangd" prefixes. - don't map config structs as Optional<> when their presence/absence doesn't signal anything and all fields must have sensible "absent" values - be more lax around parsing of 'any'-typed messages llvm-svn: 345235
* [clangd] Remove unused CDB function. NFCSam McCall2018-10-252-9/+0
| | | | llvm-svn: 345233
* [clangd] Fix -compile-commands-dir flag, broken in r345031Sam McCall2018-10-252-2/+4
| | | | llvm-svn: 345232
* [clangd] Don't invalidate LSP-set compile commands when closing a file.Sam McCall2018-10-254-18/+0
| | | | | | | | | | | | | | | | Summary: It doesn't make much sense: setting them is not coupled to opening the file, it's an asynchronous notification. I don't think this is a breaking change - this behavior is hard to observe! Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53642 llvm-svn: 345231
* Fix test to work on Windows.Douglas Yung2018-10-251-1/+7
| | | | llvm-svn: 345229
* [clang-query] Refactor Output settings to booleansStephen Kelly2018-10-246-19/+45
| | | | | | | | | | | | Summary: This will make it possible to add non-exclusive mode output. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53501 llvm-svn: 345194
* [clang-query] Add 'detailed-ast' output as an alias for 'dump'Stephen Kelly2018-10-245-10/+20
| | | | | | | | | | | | Summary: Future development can then dump other content than AST. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53500 llvm-svn: 345193
* [clang-query] Re-word command helpStephen Kelly2018-10-241-5/+11
| | | | | | | | | | | | | | | | Summary: This will make it possible to easily * Add new commands which accept <feature> parameters * Extend the list of features Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53498 llvm-svn: 345192
* [clant-tidy] abseil: Add clangTooling to CMakeLists.txtHeejin Ahn2018-10-241-0/+1
| | | | | | Without this, builds with `-DBUILD_SHARED_LIBS=ON` fail. llvm-svn: 345191
* Fix MSVC "truncation from 'double' to 'float'" warnings. NFCI.Simon Pilgrim2018-10-241-3/+3
| | | | llvm-svn: 345184
* [clang-tidy] Add the abseil-duration-factory-float checkJonas Toth2018-10-248-0/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This check finds cases where calls to an absl::Duration factory could use the more efficient integer overload. For example: // Original - Providing a floating-point literal. absl::Duration d = absl::Seconds(10.0); // Suggested - Use an integer instead. absl::Duration d = absl::Seconds(10); Patch by hwright. Reviewers: alexfh, hokein, aaron.ballman, JonasToth Reviewed By: hokein, JonasToth Subscribers: zturner, xazax.hun, Eugene.Zelenko, mgorny, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D53339 llvm-svn: 345167
* [clangd] Do not query index for new name completions.Kadir Cetinkaya2018-10-243-5/+16
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53192 llvm-svn: 345153
* [clangd] When replying, log the method name and latency.Sam McCall2018-10-242-25/+18
| | | | | | | | | | | | | | Summary: This information is strictly available in the log (you can find the original call) but it makes the log easier to follow in practice. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53647 llvm-svn: 345150
* [clangd] Ensure that we reply to each call exactly once. NFC (I think!)Sam McCall2018-10-242-31/+77
| | | | | | | | | | | | | | | | | | Summary: In debug builds, getting this wrong will trigger asserts. In production builds, it will send an error reply if none was sent, and drop redundant replies. (And log). No tests because this is always a programming error. (We did have some cases of this, but I fixed them with the new dispatcher). Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53399 llvm-svn: 345144
* [clangd] Don't show base class versions of members as completions.Sam McCall2018-10-242-6/+9
| | | | | | | | | | | | | | Summary: These are available via qualifiers, but signal to noise level is low. Keep required quailifier machinery around though, for cross-ns completion. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53571 llvm-svn: 345141
* [clangd] Downrank members from base classEric Liu2018-10-243-1/+17
| | | | | | | | | | | | Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53638 llvm-svn: 345140
* [clangd] Hide position line and column fields.Haojian Wu2018-10-241-2/+1
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53577 llvm-svn: 345134
* [clangd] Simplify auto hoverIlya Biryukov2018-10-242-27/+16
| | | | | | | | | | | | | | | | Summary: Use helper from clang. Also fixes some weird corner cases, e.g. auto (*foo)() = bar; Reviewers: kadircet, hokein Reviewed By: kadircet, hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53347 llvm-svn: 345128
* [clangd] Remove outdated comment-out code. NFCIlya Biryukov2018-10-241-1/+0
| | | | llvm-svn: 345126
* [clangd] Fix a link in documentation. NFCIlya Biryukov2018-10-241-1/+1
| | | | llvm-svn: 345125
* [clangd] Embed fixes as CodeAction, instead of clangd_fixes. Clean up ↵Sam McCall2018-10-247-58/+65
| | | | | | | | | | | | | | | | | | | serialization. Summary: CodeAction provides us with a standard way of representing fixes inline, so use it, replacing our existing ad-hoc extension. After this, it's easy to serialize diagnostics using the structured toJSON/Protocol.h mechanism rather than assembling JSON ad-hoc. Reviewers: hokein, arphaman Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53391 llvm-svn: 345119
OpenPOWER on IntegriCloud