[asan] add -asan-coverage=3: instrument all blocks and critical edges.
[oota-llvm.git] / lib / Transforms / Instrumentation / DebugIR.cpp
index 56e60e69849b690e2677a3e208fb9919b3ab7815..5234341b32edc8a156fc16afe9af382890df0170 100644 (file)
@@ -352,12 +352,14 @@ private:
   }
 
   std::string getTypeName(Type *T) {
-    string_ostream OS;
+    std::string TypeName;
+    raw_string_ostream TypeStream(TypeName);
     if (T)
-      T->print(OS);
+      T->print(TypeStream);
     else
-      OS << "Printing <null> Type";
-    return OS.str();
+      TypeStream << "Printing <null> Type";
+    TypeStream.flush();
+    return TypeName;
   }
 
   /// Returns the MDNode that represents type T if it is already created, or 0
@@ -394,7 +396,7 @@ private:
         Elements.push_back(getOrCreateType(T->getStructElementType(i)));
 
       // set struct elements
-      StructDescriptor.setTypeArray(Builder.getOrCreateArray(Elements));
+      StructDescriptor.setArrays(Builder.getOrCreateArray(Elements));
     } else if (T->isPointerTy()) {
       Type *PointeeTy = T->getPointerElementType();
       if (!(N = getType(PointeeTy)))
@@ -438,7 +440,7 @@ private:
       Params.push_back(getOrCreateType(T));
     }
 
-    DIArray ParamArray = Builder.getOrCreateArray(Params);
+    DITypeArray ParamArray = Builder.getOrCreateTypeArray(Params);
     return Builder.createSubroutineType(DIFile(FileNode), ParamArray);
   }
 
@@ -523,11 +525,11 @@ std::string DebugIR::getPath() {
 
 void DebugIR::writeDebugBitcode(const Module *M, int *fd) {
   std::unique_ptr<raw_fd_ostream> Out;
-  std::string error;
+  std::error_code EC;
 
   if (!fd) {
     std::string Path = getPath();
-    Out.reset(new raw_fd_ostream(Path.c_str(), error, sys::fs::F_Text));
+    Out.reset(new raw_fd_ostream(Path, EC, sys::fs::F_Text));
     DEBUG(dbgs() << "WRITING debug bitcode from Module " << M << " to file "
                  << Path << "\n");
   } else {