summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2009-12-07 22:32:38 +0000
committerJeffrey Yasskin <jyasskin@google.com>2009-12-07 22:32:38 +0000
commit13027640e85b92e60b765a326f18630328d8897d (patch)
treeaefc1c8ed448850318d74af6c1b0e6706ae5745f
parentc59b33562c84cb627e456fa979df2242f81b5a87 (diff)
downloadllvm-13027640e85b92e60b765a326f18630328d8897d.tar.gz
llvm-13027640e85b92e60b765a326f18630328d8897d.tar.bz2
llvm-13027640e85b92e60b765a326f18630328d8897d.tar.xz
Fix the OProfileJITEventListener for StringRef being returned from debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90813 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp b/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
index b45c71f4fd..076e5a0ce7 100644
--- a/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
+++ b/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
@@ -69,24 +69,18 @@ OProfileJITEventListener::~OProfileJITEventListener() {
}
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();
}
};