]> granicus.if.org Git - clang/commitdiff
Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 4 Aug 2017 06:35:32 +0000 (06:35 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 4 Aug 2017 06:35:32 +0000 (06:35 +0000)
It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp is confused with the suffix ".pcm"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310030 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/CompilerInstance.cpp

index d0c1a974affcf47552feaf1f658b28a4acaf6970..bb6a665cb456599cca85b589e2e9207fb6c694e6 100644 (file)
@@ -759,13 +759,9 @@ std::unique_ptr<llvm::raw_pwrite_stream> CompilerInstance::createOutputFile(
 
   if (UseTemporary) {
     // Create a temporary file.
-    // Insert -%%%%%%%% before the extension (if any), so that tools doing
-    // things based on the file extension do the right thing.
-    StringRef OutputExtension = llvm::sys::path::extension(OutFile);
-    SmallString<128> TempPath =
-        StringRef(OutFile).drop_back(OutputExtension.size());
+    SmallString<128> TempPath;
+    TempPath = OutFile;
     TempPath += "-%%%%%%%%";
-    TempPath += OutputExtension;
     int fd;
     std::error_code EC =
         llvm::sys::fs::createUniqueFile(TempPath, fd, TempPath);