[clang-tools-extra] r365756 - [clangd] Fix windows buildbots

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 11 03:41:58 PDT 2019


Author: kadircet
Date: Thu Jul 11 03:41:58 2019
New Revision: 365756

URL: http://llvm.org/viewvc/llvm-project?rev=365756&view=rev
Log:
[clangd] Fix windows buildbots

Modified:
    clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp

Modified: clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp?rev=365756&r1=365755&r2=365756&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/GlobalCompilationDatabaseTests.cpp Thu Jul 11 03:41:58 2019
@@ -234,6 +234,7 @@ TEST(GlobalCompilationDatabaseTest, Disc
   CleaningFS FS;
   FS.registerFile("compile_commands.json", CDBOuter);
   FS.registerFile("build/compile_commands.json", CDBInner);
+  llvm::SmallString<128> File;
 
   // Note that gen2.cc goes missing with our following model, not sure this
   // happens in practice though.
@@ -244,10 +245,16 @@ TEST(GlobalCompilationDatabaseTest, Disc
         DB.watch([&DiscoveredFiles](const std::vector<std::string> Changes) {
           DiscoveredFiles = Changes;
         });
-    DB.getCompileCommand((FS.Root + "/a.cc").str());
+
+    File = FS.Root;
+    llvm::sys::path::append(File, "a.cc");
+    DB.getCompileCommand(File.str());
     EXPECT_THAT(DiscoveredFiles, UnorderedElementsAre(EndsWith("a.cc")));
+    DiscoveredFiles.clear();
 
-    DB.getCompileCommand((FS.Root + "/build/gen.cc").str());
+    File = FS.Root;
+    llvm::sys::path::append(File, "build", "gen.cc");
+    DB.getCompileCommand(File.str());
     EXPECT_THAT(DiscoveredFiles, UnorderedElementsAre(EndsWith("gen.cc")));
   }
 
@@ -259,13 +266,18 @@ TEST(GlobalCompilationDatabaseTest, Disc
         DB.watch([&DiscoveredFiles](const std::vector<std::string> Changes) {
           DiscoveredFiles = Changes;
         });
-    DB.getCompileCommand((FS.Root + "/a.cc").str());
+
+    File = FS.Root;
+    llvm::sys::path::append(File, "a.cc");
+    DB.getCompileCommand(File.str());
     EXPECT_THAT(DiscoveredFiles,
                 UnorderedElementsAre(EndsWith("a.cc"), EndsWith("gen.cc"),
                                      EndsWith("gen2.cc")));
-
     DiscoveredFiles.clear();
-    DB.getCompileCommand((FS.Root + "/build/gen.cc").str());
+
+    File = FS.Root;
+    llvm::sys::path::append(File, "build", "gen.cc");
+    DB.getCompileCommand(File.str());
     EXPECT_THAT(DiscoveredFiles, IsEmpty());
   }
 }




More information about the cfe-commits mailing list