[llvm-commits] [llvm] r90813 - /llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
Jeffrey Yasskin
jyasskin at google.com
Mon Dec 7 14:32:38 PST 2009
Author: jyasskin
Date: Mon Dec 7 16:32:38 2009
New Revision: 90813
URL: http://llvm.org/viewvc/llvm-project?rev=90813&view=rev
Log:
Fix the OProfileJITEventListener for StringRef being returned from debug info.
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=90813&r1=90812&r2=90813&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp Mon Dec 7 16:32:38 2009
@@ -69,24 +69,18 @@
}
class FilenameCache {
- // Holds the filename of each Scope, so that we can pass the
- // pointer into oprofile. These char*s are freed in the destructor.
- DenseMap<MDNode*, char*> Filenames;
+ // Holds the filename of each Scope, so that we can pass a null-terminated
+ // string into oprofile.
+ DenseMap<MDNode*, std::string> Filenames;
public:
const char *getFilename(MDNode *Scope) {
- char *&Filename = Filenames[Scope];
+ std::string &Filename = Filenames[Scope];
if (Filename == NULL) {
DIScope S(Scope);
- Filename = strdup(S.getFilename());
- }
- return Filename;
- }
- ~FilenameCache() {
- for (DenseMap<MDNode*, char*>::iterator
- I = Filenames.begin(), E = Filenames.end(); I != E; ++I) {
- free(I->second);
+ Filename = S.getFilename();
}
+ return Filename.c_str();
}
};
More information about the llvm-commits
mailing list