diff options
Diffstat (limited to 'lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp')
-rw-r--r-- | lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp b/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp index f17ff5bb01f2..2f6a5bc3d574 100644 --- a/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp +++ b/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp @@ -46,30 +46,31 @@ public: uint64_t getCodeByteSize() const override { return Entry.FileSize; } std::string getFileName() const override { - auto Name = Strings.getStringForID(Entry.FileNI); - assert(Name && "InjectedSourceStream should have rejected this"); - return *Name; + StringRef Ret = cantFail(Strings.getStringForID(Entry.FileNI), + "InjectedSourceStream should have rejected this"); + return Ret; } std::string getObjectFileName() const override { - auto ObjName = Strings.getStringForID(Entry.ObjNI); - assert(ObjName && "InjectedSourceStream should have rejected this"); - return *ObjName; + StringRef Ret = cantFail(Strings.getStringForID(Entry.ObjNI), + "InjectedSourceStream should have rejected this"); + return Ret; } std::string getVirtualFileName() const override { - auto VName = Strings.getStringForID(Entry.VFileNI); - assert(VName && "InjectedSourceStream should have rejected this"); - return *VName; + StringRef Ret = cantFail(Strings.getStringForID(Entry.VFileNI), + "InjectedSourceStream should have rejected this"); + return Ret; } uint32_t getCompression() const override { return Entry.Compression; } std::string getCode() const override { // Get name of stream storing the data. - auto VName = Strings.getStringForID(Entry.VFileNI); - assert(VName && "InjectedSourceStream should have rejected this"); - std::string StreamName = ("/src/files/" + *VName).str(); + StringRef VName = + cantFail(Strings.getStringForID(Entry.VFileNI), + "InjectedSourceStream should have rejected this"); + std::string StreamName = ("/src/files/" + VName).str(); // Find stream with that name and read its data. // FIXME: Consider validating (or even loading) all this in @@ -104,14 +105,14 @@ std::unique_ptr<IPDBInjectedSource> NativeEnumInjectedSources::getChildAtIndex(uint32_t N) const { if (N >= getChildCount()) return nullptr; - return make_unique<NativeInjectedSource>(std::next(Stream.begin(), N)->second, + return std::make_unique<NativeInjectedSource>(std::next(Stream.begin(), N)->second, File, Strings); } std::unique_ptr<IPDBInjectedSource> NativeEnumInjectedSources::getNext() { if (Cur == Stream.end()) return nullptr; - return make_unique<NativeInjectedSource>((Cur++)->second, File, Strings); + return std::make_unique<NativeInjectedSource>((Cur++)->second, File, Strings); } void NativeEnumInjectedSources::reset() { Cur = Stream.begin(); } |