#define EVENT_LISTENER_COMMON_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/DebugInfo.h"
+#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Path.h"
-#include "llvm/Support/ValueHandle.h"
namespace llvm {
class FilenameCache {
// Holds the filename of each Scope, so that we can pass a null-terminated
- // string into oprofile. Use an AssertingVH rather than a ValueMap because we
- // shouldn't be modifying any MDNodes while this map is alive.
- DenseMap<AssertingVH<MDNode>, std::string> Filenames;
- DenseMap<AssertingVH<MDNode>, std::string> Paths;
+ // string into oprofile.
+ DenseMap<const MDNode *, std::string> Filenames;
+ DenseMap<const MDNode *, std::string> Paths;
public:
const char *getFilename(MDNode *Scope) {
+ assert(Scope->isResolved() && "Expected Scope to be resolved");
std::string &Filename = Filenames[Scope];
if (Filename.empty()) {
DIScope DIScope(Scope);
}
const char *getFullPath(MDNode *Scope) {
+ assert(Scope->isResolved() && "Expected Scope to be resolved");
std::string &P = Paths[Scope];
if (P.empty()) {
DIScope DIScope(Scope);