Fix compile error as debug interface changed.
authorNick Lewycky <nicholas@mxc.ca>
Wed, 30 Sep 2009 04:50:26 +0000 (04:50 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 30 Sep 2009 04:50:26 +0000 (04:50 +0000)
By the way, this code is buggy. You can't keep a map<MDNode *, something>
because the MDNode may be destroyed and reused for something else.

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

lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp

index 740dcfc6264a085d3c3ee068d8c5a130854a5953..69398be5080cfb821fea8600d738c70a5ee3c8db 100644 (file)
@@ -72,21 +72,19 @@ class FilenameCache {
   // Holds the filename of each CompileUnit, so that we can pass the
   // pointer into oprofile.  These char*s are freed in the destructor.
   DenseMap<MDNode*, char*> Filenames;
-  // Used as the scratch space in DICompileUnit::getFilename().
-  std::string TempFilename;
 
  public:
-  const chargetFilename(MDNode *CompileUnit) {
+  const char *getFilename(MDNode *CompileUnit) {
     char *&Filename = Filenames[CompileUnit];
     if (Filename == NULL) {
       DICompileUnit CU(CompileUnit);
-      Filename = strdup(CU.getFilename(TempFilename).c_str());
+      Filename = strdup(CU.getFilename());
     }
     return Filename;
   }
   ~FilenameCache() {
     for (DenseMap<MDNode*, char*>::iterator
-             I = Filenames.begin(), E = Filenames.end(); I != E;++I) {
+             I = Filenames.begin(), E = Filenames.end(); I != E; ++I) {
       free(I->second);
     }
   }
@@ -97,7 +95,7 @@ static debug_line_info LineStartToOProfileFormat(
     uintptr_t Address, DebugLoc Loc) {
   debug_line_info Result;
   Result.vma = Address;
-  const DebugLocTupletuple = MF.getDebugLocTuple(Loc);
+  const DebugLocTuple &tuple = MF.getDebugLocTuple(Loc);
   Result.lineno = tuple.Line;
   Result.filename = Filenames.getFilename(tuple.CompileUnit);
   DEBUG(errs() << "Mapping " << reinterpret_cast<void*>(Result.vma) << " to "