[clang] [clang][Tooling] Support relative directory in compilation database (PR #127734)

Keith Smiley via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 17:57:00 PST 2025


================
@@ -399,6 +399,32 @@ TEST(findCompileArgsInJsonDatabase, FindsEntry) {
   EXPECT_EQ("command4", FoundCommand.CommandLine[0]) << ErrorMessage;
 }
 
+TEST(findCompileArgsInJsonDatabase, FindsEntryRelativeDirectory) {
+  StringRef Directory(".");
+  StringRef FileName("file");
+  StringRef Command("command");
+  std::string JsonDatabase = "[";
+  JsonDatabase +=
+      ("{\"directory\":\"" + Directory + "\"," + "\"command\":\"" + Command +
+       "\","
+       "\"file\":\"" +
+       FileName + "\"}")
----------------
keith wrote:

clang-format fighting me on this one

https://github.com/llvm/llvm-project/pull/127734


More information about the cfe-commits mailing list