Index: clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp =================================================================== --- clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp +++ clang-tools-extra/trunk/clangd/GlobalCompilationDatabase.cpp @@ -173,6 +173,7 @@ std::lock_guard Lock(Mutex); Cmd.CommandLine.insert(Cmd.CommandLine.end(), FallbackFlags.begin(), FallbackFlags.end()); + adjustArguments(Cmd, ResourceDir); return Cmd; } Index: clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp =================================================================== --- clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp +++ clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp @@ -21,6 +21,7 @@ using ::testing::ElementsAre; using ::testing::EndsWith; using ::testing::Not; +using ::testing::StartsWith; TEST(GlobalCompilationDatabaseTest, FallbackCommand) { DirectoryBasedGlobalCompilationDatabase DB(None); @@ -85,7 +86,8 @@ TEST_F(OverlayCDBTest, GetFallbackCommand) { OverlayCDB CDB(Base.get(), {"-DA=4"}); EXPECT_THAT(CDB.getFallbackCommand(testPath("bar.cc")).CommandLine, - ElementsAre("clang", "-DA=2", testPath("bar.cc"), "-DA=4")); + ElementsAre("clang", "-DA=2", testPath("bar.cc"), "-DA=4", + "-fsyntax-only", StartsWith("-resource-dir"))); } TEST_F(OverlayCDBTest, NoBase) { @@ -97,7 +99,8 @@ Contains("-DA=5")); EXPECT_THAT(CDB.getFallbackCommand(testPath("foo.cc")).CommandLine, - ElementsAre(EndsWith("clang"), testPath("foo.cc"), "-DA=6")); + ElementsAre(EndsWith("clang"), testPath("foo.cc"), "-DA=6", + "-fsyntax-only")); } TEST_F(OverlayCDBTest, Watch) {