diff --git a/src/PolicyFile.cc b/src/PolicyFile.cc index 16f5f81..a846705 100644 --- a/src/PolicyFile.cc +++ b/src/PolicyFile.cc @@ -41,6 +41,7 @@ #include "NVSerializer.hh" #include "Strings.hh" +#include #include #include #include @@ -382,7 +383,11 @@ Policy::Directions PolicyFile::CallHooks(const llvm::Function &Fn) const { Policy::Directions PolicyFile::FnHooks(const llvm::Function &Fn) const { StringRef Name = Fn.getName(); - std::string FileName = Fn.getParent()->getSourceFileName(); + std::string FileName = ""; + DISubprogram* Sp = Fn.getSubprogram(); + if (Sp) { + FileName = Sp->getFilename(); + } std::string BaseFileName = FileName.substr(FileName.find_last_of("/\\") + 1); for (FnInstrumentation &F : Policy->Functions) {