34 std::string SourceFileFullPath;
45 if (RecordedResult.empty()) {
46 if (
auto Envs = findAllChildren<PDBSymbolCompilandEnv>()) {
47 std::string EnvWorkingDir, EnvSrc;
49 while (
auto Env = Envs->getNext()) {
50 std::string Var = Env->getName();
52 EnvWorkingDir = Env->getValue();
56 EnvSrc = Env->getValue();
59 RecordedResult = EnvSrc;
63 if (!EnvWorkingDir.empty() && !EnvSrc.empty()) {
64 auto Len = EnvWorkingDir.length();
65 if (EnvWorkingDir[Len - 1] !=
'/' && EnvWorkingDir[Len - 1] !=
'\\') {
66 std::string
Path = EnvWorkingDir +
"\\" + EnvSrc;
67 std::replace(
Path.begin(),
Path.end(),
'/',
'\\');
70 SourceFileFullPath =
Path;
76 if (!RecordedResult.empty()) {
78 return RecordedResult;
84 return OneSrcFile->getFileName();
90 auto Details = findOneChild<PDBSymbolCompilandDetails>();
91 PDB_Lang Lang = Details ? Details->getLanguage() : PDB_Lang::Cpp;
94 while (
auto File = SrcFiles->getNext()) {
95 std::string FileName = File->getFileName();
98 .
Case(
".cpp", Lang == PDB_Lang::Cpp)
99 .
Case(
".cc", Lang == PDB_Lang::Cpp)
100 .
Case(
".cxx", Lang == PDB_Lang::Cpp)
101 .
Case(
".c", Lang == PDB_Lang::C)
102 .
Case(
".asm", Lang == PDB_Lang::Masm)
103 .
Case(
".swift", Lang == PDB_Lang::Swift)
104 .
Case(
".rs", Lang == PDB_Lang::Rust)
105 .
Case(
".m", Lang == PDB_Lang::ObjC)
106 .
Case(
".mm", Lang == PDB_Lang::ObjCpp)
108 return File->getFileName();
112 return SourceFileFullPath;
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
std::string str() const
str - Get the contents as an std::string.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
virtual std::string getSourceFileName() const =0
virtual std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const =0
virtual std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const =0
virtual void dump(const PDBSymbolAnnotation &Symbol)
std::string getSourceFileName() const
std::string getSourceFileFullPath() const
void dump(PDBSymDumper &Dumper) const override
Dumps the contents of a symbol a raw_ostream.
const IPDBSession & Session
IPDBRawSymbol * RawSymbol
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration in the Microsoft Debug Interface Access SDK,...
StringRef filename(StringRef path, Style style=Style::native)
Get filename.
bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
StringRef extension(StringRef path, Style style=Style::native)
Get extension.
This is an optimization pass for GlobalISel generic memory operations.