summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/CanonicalIncludes.cpp
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Fix trivial typos in commentsKazuaki Ishizaki2020-01-041-1/+1
|
* [clangd] Attempt to fix failing Windows buildbots.Ilya Biryukov2019-09-091-3/+6
| | | | | | | | | The assertion is failing on Windows, probably because path separator is different. For the failure see: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/28072/steps/test/logs/stdio llvm-svn: 371422
* [clangd] Use pre-populated mappings for standard symbolsIlya Biryukov2019-09-091-37/+44
| | | | | | | | | | | | | | | | | | | | Summary: This takes ~5% of time when running clangd unit tests. To achieve this, move mapping of system includes out of CanonicalIncludes and into a separate class Reviewers: sammccall, hokein Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67172 llvm-svn: 371408
* Fight a bit against global initializers. NFC.Benjamin Kramer2019-08-221-657/+656
| | | | llvm-svn: 369695
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clangd] Add include-mapping for C symbols.Haojian Wu2019-06-211-5/+14
| | | | | | | | | | | | | | | | | | | Summary: This resolves the issue of introducing c++-style includes for C files. - refactor the gen_std.py, make it reusable for parsing C symbols. - add a language mode to the mapping method to use different mapping for C and C++ files. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63270 llvm-svn: 364044
* [clangd] Fix buildbot error.Haojian Wu2019-05-291-0/+4
| | | | llvm-svn: 361960
* [clangd] Remove the whitelist std symbols in CanonicalIncludes.Haojian Wu2019-05-291-17/+0
| | | | | | | | | | | | | | Summary: These symbols have been included via StdSymbolMap.inc. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62527 llvm-svn: 361952
* [clangd] Include insertion: require header guards, drop other heuristics, ↵Sam McCall2019-04-171-21/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | treat .def like .inc. Summary: We do have some reports of include insertion behaving badly in some codebases. Requiring header guards both makes sense in principle, and is likely to disable this "nice-to-have" feature in codebases where headers don't follow the expected pattern. With this we can drop some other heuristics, such as looking at file extensions to detect known non-headers - implementation files have no guards. One wrinkle here is #import - objc headers may not have guards because they're intended to be used via #import. If the header is the main file or is #included, we won't collect locations - merge should take care of this if we see the file #imported somewhere. Seems likely to be OK. Headers which have a canonicalization (stdlib, IWYU) are exempt from this check. *.inc files continue to be handled by looking up to the including file. This patch also adds *.def here - tablegen wants this pattern too. In terms of code structure, the division between SymbolCollector and CanonicalIncludes has shifted: SymbolCollector is responsible for more. This is because SymbolCollector has all the SourceManager/HeaderSearch access needed for checking for guards, and we interleave these checks with the *.def checks in a loop (potentially). We could hand all the info into CanonicalIncludes and put the logic there if that's preferable. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60316 llvm-svn: 358571
* [clangd] Using symbol name to map includes for STL symbols.Haojian Wu2019-03-141-35/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Using suffix path mapping relies on the STL implementations, and it is not portable. This patch is using symbol name mapping, which should work with different STL implementations, fix clangd/clangd#9. To generate the symbol mapping, we parse the cppreference symbol index page to build a lookup table. The mapping is not completed, a few TODOs: - support symbols from different headers (e.g. std::move) - support STL macros - support symbols from std's sub-namespaces (e.g. chrono) Reviewers: ioeric, jfb, serge-sans-paille Reviewed By: ioeric Subscribers: sammccall, klimek, ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, kadircet, jfb, jdoerfert, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D58345 llvm-svn: 356134
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clangd] Remove 'using namespace llvm' from .cpp files. NFCIlya Biryukov2019-01-071-15/+17
| | | | | | | | The new guideline is to qualify with 'llvm::' explicitly both in '.h' and '.cpp' files. This simplifies moving the code between header and source files and is easier to keep consistent. llvm-svn: 350531
* [clangd] Namespace style cleanup in cpp files. NFC.Sam McCall2018-10-201-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Standardize on the most common namespace setup in our *.cpp files: using namespace llvm; namespace clang { namespace clangd { void foo(StringRef) { ... } And remove redundant llvm:: qualifiers. (Except for cases like make_unique where this causes problems with std:: and ADL). This choice is pretty arbitrary, but some broad consistency is nice. This is going to conflict with everything. Sorry :-/ Squash the other configurations: A) using namespace llvm; using namespace clang; using namespace clangd; void clangd::foo(StringRef); This is in some of the older files. (It prevents accidentally defining a new function instead of one in the header file, for what that's worth). B) namespace clang { namespace clangd { void foo(llvm::StringRef) { ... } This is fine, but in practice the using directive often gets added over time. C) namespace clang { namespace clangd { using namespace llvm; // inside the namespace This was pretty common, but is a bit misleading: name lookup preferrs clang::clangd::foo > clang::foo > llvm:: foo (no matter where the using directive is). llvm-svn: 344850
* [clangd] NFC: Migrate to LLVM STLExtras API where possibleKirill Bobyrev2018-10-071-6/+5
| | | | | | | | | | | | | | This patch improves readability by migrating `std::function(ForwardIt start, ForwardIt end, ...)` to LLVM's STLExtras range-based equivalent `llvm::function(RangeT &&Range, ...)`. Similar change in Clang: D52576. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D52650 llvm-svn: 343937
* [clangd] Fix header mapping for std::string. NFCEric Liu2018-10-011-0/+1
| | | | | | Some implementation has std::string declared in <iosfwd>. llvm-svn: 343448
* [clangd] Canonicalize include paths in clangd.Eric Liu2018-09-071-1/+1
| | | | | | Get rid of "../" and "../../". llvm-svn: 341645
* [clangd] Get rid of regexes in CanonicalIncludesIlya Biryukov2018-08-221-667/+675
| | | | | | | | | | | | | | Summary: Replace them with suffix mappings. Reviewers: ioeric, kbobyrev Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51088 llvm-svn: 340410
* [clangd] Skip .inc headers when canonicalizing header #include.Eric Liu2018-05-241-4/+26
| | | | | | | | | | | | | | | | Summary: This assumes that .inc files are supposed to be included via headers that include them. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47187 llvm-svn: 333188
* [clangd] Correctly handle IWYU prama with verbatim #include header.Eric Liu2018-05-221-2/+3
| | | | llvm-svn: 332959
* [clangd] Minor fixes for C++ standard library header mapping.Eric Liu2018-04-251-7/+24
| | | | llvm-svn: 330803
* [clangd] Make symbol name a required parameter for CanonicalIncludes::mapHeaderEric Liu2018-03-011-5/+3
| | | | llvm-svn: 326458
* [clangd] Support include canonicalization in symbol leve.Eric Liu2018-03-011-1/+60
| | | | | | | | | | | | | | | | | Summary: Symbols with different canonical includes might be defined in the same header (e.g. symbols defined in STL <iosfwd>). This patch adds support for mapping from qualified symbol names to canonical headers and special mapping for symbols in <iosfwd> Reviewers: sammccall, hokein Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43869 llvm-svn: 326456
* [clangd] A few more fixes for STL header mapping.Eric Liu2018-02-281-1/+7
| | | | llvm-svn: 326325
* [clangd] A few minor fixes for STL internal header mapping.Eric Liu2018-02-281-4/+4
| | | | llvm-svn: 326310
* [clangd] Update canonical header mapping for STLEric Liu2018-02-211-0/+4
| | | | llvm-svn: 325694
* [clangd] Fixes for #include insertion.Eric Liu2018-02-191-0/+1
| | | | | | | | | | | | | | | | | | Summary: o Avoid inserting a header include into the header itself. o Avoid inserting non-header files (by not indexing symbols in main files at all). o Canonicalize include paths for symbols in dynamic index. Reviewers: sammccall, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43462 llvm-svn: 325523
* [clangd] Try to fix build bot failure caused by r325343: escape regex string.Eric Liu2018-02-191-1/+2
| | | | llvm-svn: 325482
* [clangd] remove redundant ';' introduced in r325343Eric Liu2018-02-161-1/+1
| | | | llvm-svn: 325346
* [clangd] collect symbol #include & insert #include in global code completion.Eric Liu2018-02-161-0/+704
Summary: o Collect suitable #include paths for index symbols. This also does smart mapping for STL symbols and IWYU pragma (code borrowed from include-fixer). o For global code completion, add a command for inserting new #include in each code completion item. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, mgorny, ilya-biryukov, jkorous-apple, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D42640 llvm-svn: 325343
OpenPOWER on IntegriCloud