Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
Show All 40 Lines | public: | ||||
NativeInjectedSource(const SrcHeaderBlockEntry &Entry, | NativeInjectedSource(const SrcHeaderBlockEntry &Entry, | ||||
PDBFile &File, const PDBStringTable &Strings) | PDBFile &File, const PDBStringTable &Strings) | ||||
: Entry(Entry), Strings(Strings), File(File) {} | : Entry(Entry), Strings(Strings), File(File) {} | ||||
uint32_t getCrc32() const override { return Entry.CRC; } | uint32_t getCrc32() const override { return Entry.CRC; } | ||||
uint64_t getCodeByteSize() const override { return Entry.FileSize; } | uint64_t getCodeByteSize() const override { return Entry.FileSize; } | ||||
std::string getFileName() const override { | std::string getFileName() const override { | ||||
StringRef Ret = cantFail(Strings.getStringForID(Entry.FileNI), | StringRef Ret = llvm_cantFail(Strings.getStringForID(Entry.FileNI), | ||||
"InjectedSourceStream should have rejected this"); | "InjectedSourceStream should have rejected this"); | ||||
return Ret; | return Ret; | ||||
} | } | ||||
std::string getObjectFileName() const override { | std::string getObjectFileName() const override { | ||||
StringRef Ret = cantFail(Strings.getStringForID(Entry.ObjNI), | StringRef Ret = llvm_cantFail(Strings.getStringForID(Entry.ObjNI), | ||||
"InjectedSourceStream should have rejected this"); | "InjectedSourceStream should have rejected this"); | ||||
return Ret; | return Ret; | ||||
} | } | ||||
std::string getVirtualFileName() const override { | std::string getVirtualFileName() const override { | ||||
StringRef Ret = cantFail(Strings.getStringForID(Entry.VFileNI), | StringRef Ret = llvm_cantFail(Strings.getStringForID(Entry.VFileNI), | ||||
"InjectedSourceStream should have rejected this"); | "InjectedSourceStream should have rejected this"); | ||||
return Ret; | return Ret; | ||||
} | } | ||||
uint32_t getCompression() const override { return Entry.Compression; } | uint32_t getCompression() const override { return Entry.Compression; } | ||||
std::string getCode() const override { | std::string getCode() const override { | ||||
// Get name of stream storing the data. | // Get name of stream storing the data. | ||||
StringRef VName = | StringRef VName = | ||||
cantFail(Strings.getStringForID(Entry.VFileNI), | llvm_cantFail(Strings.getStringForID(Entry.VFileNI), | ||||
"InjectedSourceStream should have rejected this"); | "InjectedSourceStream should have rejected this"); | ||||
std::string StreamName = ("/src/files/" + VName).str(); | std::string StreamName = ("/src/files/" + VName).str(); | ||||
// Find stream with that name and read its data. | // Find stream with that name and read its data. | ||||
// FIXME: Consider validating (or even loading) all this in | // FIXME: Consider validating (or even loading) all this in | ||||
// InjectedSourceStream so that no error can happen here. | // InjectedSourceStream so that no error can happen here. | ||||
auto ExpectedFileStream = File.safelyCreateNamedStream(StreamName); | auto ExpectedFileStream = File.safelyCreateNamedStream(StreamName); | ||||
if (!ExpectedFileStream) { | if (!ExpectedFileStream) { | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |