diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2018-12-05 11:57:15 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2018-12-05 11:57:15 +0000 |
commit | 6f9b20426163bc6daf6e3ac27f76843ac6b3216f (patch) | |
tree | ef1ace4963d461a0f39ce10d902adcb1fdf7315b /clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp | |
parent | [DAG] Add fshl/fshr tblgen opcodes (diff) | |
download | llvm-project-6f9b20426163bc6daf6e3ac27f76843ac6b3216f.tar.gz llvm-project-6f9b20426163bc6daf6e3ac27f76843ac6b3216f.tar.bz2 llvm-project-6f9b20426163bc6daf6e3ac27f76843ac6b3216f.zip |
[clangd] Dont provide locations for non-existent files.
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
Diffstat (limited to 'clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp b/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp index 8e99e590c12f..952fcbef1e93 100644 --- a/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp +++ b/clang-tools-extra/unittests/clangd/SymbolCollectorTests.cpp @@ -614,6 +614,18 @@ TEST_F(SymbolCollectorTest, SymbolFormedFromRegisteredSchemeFromMacro) { DeclURI(TestHeaderURI)))); } +TEST_F(SymbolCollectorTest, SymbolFormedByCLI) { + Annotations Header(R"( + #ifdef NAME + class $expansion[[NAME]] {}; + #endif + )"); + runSymbolCollector(Header.code(), /*Main=*/"", /*ExtraArgs=*/{"-DNAME=name"}); + EXPECT_THAT(Symbols, UnorderedElementsAre(AllOf( + QName("name"), DeclRange(Header.range("expansion")), + DeclURI(TestHeaderURI)))); +} + TEST_F(SymbolCollectorTest, IgnoreSymbolsInMainFile) { const std::string Header = R"( class Foo {}; |