2015-02-08 08:29:29 +08:00
|
|
|
//===- PDBSymbolCompiland.cpp - compiland details --------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-02-14 11:53:56 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
|
2016-02-19 02:47:29 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
|
2015-02-14 11:53:56 +08:00
|
|
|
|
2015-02-23 06:03:38 +08:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
|
2015-02-14 11:53:56 +08:00
|
|
|
|
2015-02-13 17:09:03 +08:00
|
|
|
#include <utility>
|
2015-02-08 08:29:29 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
2016-05-05 04:32:13 +08:00
|
|
|
using namespace llvm::pdb;
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-02-09 06:53:53 +08:00
|
|
|
PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
|
2015-02-09 04:58:09 +08:00
|
|
|
std::unique_ptr<IPDBRawSymbol> Symbol)
|
|
|
|
: PDBSymbol(PDBSession, std::move(Symbol)) {}
|
2015-02-08 08:29:29 +08:00
|
|
|
|
2015-03-01 14:51:29 +08:00
|
|
|
void PDBSymbolCompiland::dump(PDBSymDumper &Dumper) const {
|
|
|
|
Dumper.dump(*this);
|
2015-02-08 08:29:29 +08:00
|
|
|
}
|
2016-02-19 02:47:29 +08:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|