summaryrefslogtreecommitdiffstats
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
commitfc7384d366544c6656c14409527c5948e5417372 (patch)
tree45d9e140b60a89654079b054713bbe3ac58cdb0a
parent7bea9a1672024457b195ccc440fb5e11f32da0e1 (diff)
downloadbcm5719-llvm-fc7384d366544c6656c14409527c5948e5417372.tar.gz
bcm5719-llvm-fc7384d366544c6656c14409527c5948e5417372.zip
Fix the OProfileJITEventListener for StringRef being returned from debug info.
llvm-svn: 90813
-rw-r--r--llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp b/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
index b45c71f4fd7..076e5a0ce7b 100644
--- a/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
+++ b/llvm/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();
}
};
OpenPOWER on IntegriCloud