[llvm-commits] [llvm] r83141 - /llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp

Nick Lewycky nicholas at mxc.ca
Tue Sep 29 21:50:27 PDT 2009


Author: nicholas
Date: Tue Sep 29 23:50:26 2009
New Revision: 83141

URL: http://llvm.org/viewvc/llvm-project?rev=83141&view=rev
Log:
Fix compile error as debug interface changed.

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.

Modified:
    llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp?rev=83141&r1=83140&r2=83141&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp Tue Sep 29 23:50:26 2009
@@ -72,21 +72,19 @@
   // 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 char* getFilename(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 @@
     uintptr_t Address, DebugLoc Loc) {
   debug_line_info Result;
   Result.vma = Address;
-  const DebugLocTuple& tuple = 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 "





More information about the llvm-commits mailing list