33 std::string SourceFileFullPath;
44 if (RecordedResult.empty()) {
45 if (
auto Envs = findAllChildren<PDBSymbolCompilandEnv>()) {
46 std::string EnvWorkingDir, EnvSrc;
48 while (
auto Env = Envs->getNext()) {
49 std::string Var = Env->getName();
51 EnvWorkingDir = Env->getValue();
55 EnvSrc = Env->getValue();
58 RecordedResult = EnvSrc;
62 if (!EnvWorkingDir.empty() && !EnvSrc.empty()) {
63 auto Len = EnvWorkingDir.length();
64 if (EnvWorkingDir[Len - 1] !=
'/' && EnvWorkingDir[Len - 1] !=
'\\') {
65 std::string
Path = EnvWorkingDir +
"\\" + EnvSrc;
66 std::replace(
Path.begin(),
Path.end(),
'/',
'\\');
69 SourceFileFullPath =
Path;
75 if (!RecordedResult.empty()) {
77 return RecordedResult;
83 return OneSrcFile->getFileName();
89 auto Details = findOneChild<PDBSymbolCompilandDetails>();
90 PDB_Lang Lang = Details ? Details->getLanguage() : PDB_Lang::Cpp;
93 while (
auto File = SrcFiles->getNext()) {
94 std::string FileName = File->getFileName();
97 .
Case(
".cpp", Lang == PDB_Lang::Cpp)
98 .
Case(
".cc", Lang == PDB_Lang::Cpp)
99 .
Case(
".cxx", Lang == PDB_Lang::Cpp)
100 .
Case(
".c", Lang == PDB_Lang::C)
101 .
Case(
".asm", Lang == PDB_Lang::Masm)
102 .
Case(
".swift", Lang == PDB_Lang::Swift)
103 .
Case(
".rs", Lang == PDB_Lang::Rust)
104 .
Case(
".m", Lang == PDB_Lang::ObjC)
105 .
Case(
".mm", Lang == PDB_Lang::ObjCpp)
107 return File->getFileName();
111 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.