summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DebugInfo/PDB/PDBSymbolCompiland.cpp')
-rw-r--r--lib/DebugInfo/PDB/PDBSymbolCompiland.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
index 74369148e26e5..ebff08846cace 100644
--- a/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
+++ b/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
@@ -8,12 +8,14 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
#include <utility>
using namespace llvm;
+using namespace llvm::pdb;
PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
std::unique_ptr<IPDBRawSymbol> Symbol)
@@ -22,3 +24,21 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
void PDBSymbolCompiland::dump(PDBSymDumper &Dumper) const {
Dumper.dump(*this);
}
+
+std::string PDBSymbolCompiland::getSourceFileName() const
+{
+ std::string Result = RawSymbol->getSourceFileName();
+ if (!Result.empty())
+ return Result;
+ auto Envs = findAllChildren<PDBSymbolCompilandEnv>();
+ if (!Envs)
+ return std::string();
+ while (auto Env = Envs->getNext()) {
+ std::string Var = Env->getName();
+ if (Var != "src")
+ continue;
+ std::string Value = Env->getValue();
+ return Value;
+ }
+ return std::string();
+}