80 cols
[oota-llvm.git] / lib / Transforms / Instrumentation / DebugIR.cpp
index f4109eff4f55f9a745d469779eab39acf5b504a7..651381d88b5e3705e45c87dc7ec62e822b09edf4 100644 (file)
@@ -220,7 +220,7 @@ public:
         DICompileUnit(CUNode), F.getName(), MangledName, DIFile(FileNode), Line,
         Sig, Local, IsDefinition, ScopeLine, FuncFlags, IsOptimized, &F);
     assert(Sub.isSubprogram());
-    DEBUG(dbgs() << "create subprogram mdnode " << Sub << ": "
+    DEBUG(dbgs() << "create subprogram mdnode " << *Sub << ": "
                  << "\n");
 
     SubprogramDescriptors.insert(std::make_pair(&F, Sub));
@@ -289,9 +289,9 @@ private:
           "LLVM Version " STR(LLVM_VERSION_MAJOR) "." STR(LLVM_VERSION_MINOR);
     }
 
-    Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory, Producer,
-                              IsOptimized, Flags, RuntimeVersion);
-    CUNode = Builder.getCU();
+    CUNode =
+        Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory,
+                                  Producer, IsOptimized, Flags, RuntimeVersion);
 
     if (CUToReplace)
       CUToReplace->replaceAllUsesWith(const_cast<MDNode *>(CUNode));
@@ -504,10 +504,9 @@ bool DebugIR::updateExtension(StringRef NewExtension) {
 }
 
 void DebugIR::generateFilename(OwningPtr<int> &fd) {
-  StringRef FileModel("debug-ir-%s%s%s%s.ll");
   SmallVector<char, 16> PathVec;
   fd.reset(new int);
-  sys::fs::unique_file(FileModel, *fd, PathVec);
+  sys::fs::createTemporaryFile("debug-ir", "ll", *fd, PathVec);
   StringRef Path(PathVec.data(), PathVec.size());
   Filename = sys::path::filename(Path);
   sys::path::remove_filename(PathVec);