mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
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
This commit is contained in:
parent
c59b33562c
commit
13027640e8
@ -69,24 +69,18 @@ OProfileJITEventListener::~OProfileJITEventListener() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FilenameCache {
|
class FilenameCache {
|
||||||
// Holds the filename of each Scope, so that we can pass the
|
// Holds the filename of each Scope, so that we can pass a null-terminated
|
||||||
// pointer into oprofile. These char*s are freed in the destructor.
|
// string into oprofile.
|
||||||
DenseMap<MDNode*, char*> Filenames;
|
DenseMap<MDNode*, std::string> Filenames;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const char *getFilename(MDNode *Scope) {
|
const char *getFilename(MDNode *Scope) {
|
||||||
char *&Filename = Filenames[Scope];
|
std::string &Filename = Filenames[Scope];
|
||||||
if (Filename == NULL) {
|
if (Filename == NULL) {
|
||||||
DIScope S(Scope);
|
DIScope S(Scope);
|
||||||
Filename = strdup(S.getFilename());
|
Filename = S.getFilename();
|
||||||
}
|
|
||||||
return Filename;
|
|
||||||
}
|
|
||||||
~FilenameCache() {
|
|
||||||
for (DenseMap<MDNode*, char*>::iterator
|
|
||||||
I = Filenames.begin(), E = Filenames.end(); I != E; ++I) {
|
|
||||||
free(I->second);
|
|
||||||
}
|
}
|
||||||
|
return Filename.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user