diff options
author | Ishaan Gandhi <ishaangandhi@gmail.com> | 2022-04-25 20:15:15 +0200 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2022-04-25 20:40:56 +0200 |
commit | 87468e85fcdcf1bd5055466e34d17436a79017a2 (patch) | |
tree | 6e7835b0efbd7df166c3f1cdb7357135fa66e9f7 /clang/unittests/Tooling/CompilationDatabaseTest.cpp | |
parent | e59e580116b055bd2057de0da5cc35fffd16a590 (diff) | |
download | llvm-87468e85fcdcf1bd5055466e34d17436a79017a2.zip llvm-87468e85fcdcf1bd5055466e34d17436a79017a2.tar.gz llvm-87468e85fcdcf1bd5055466e34d17436a79017a2.tar.bz2 |
compile commands header to source heuristic lower-cases filenames before inferring file types
This leads to ".C" files being rewritten as ".c" files and being inferred to be "c" files as opposed to "c++" files.
Fixes https://github.com/clangd/clangd/issues/1108
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D124262
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index adb9de0..8194dd3 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -836,6 +836,14 @@ TEST_F(InterpolateTest, Case) { EXPECT_EQ(getProxy("foo/bar/baz/shout.C"), "FOO/BAR/BAZ/SHOUT.cc"); } +TEST_F(InterpolateTest, LanguagePreference) { + add("foo/bar/baz/exact.C"); + add("foo/bar/baz/exact.c"); + add("other/random/path.cpp"); + // Proxies for ".H" files are ".C" files, and not ".c files". + EXPECT_EQ(getProxy("foo/bar/baz/exact.H"), "foo/bar/baz/exact.C"); +} + TEST_F(InterpolateTest, Aliasing) { add("foo.cpp", "-faligned-new"); |