diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 6 | ||||
-rw-r--r-- | clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 15a2ab99fda..e9b7b369513 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -335,7 +335,11 @@ ObjectFilePCHContainerReader::ExtractPCH(llvm::MemoryBufferRef Buffer) const { // Find the clang AST section in the container. for (auto &Section : OF->sections()) { StringRef Name; - Section.getName(Name); + if (Expected<StringRef> NameOrErr = Section.getName()) + Name = *NameOrErr; + else + consumeError(NameOrErr.takeError()); + if ((!IsCOFF && Name == "__clangast") || (IsCOFF && Name == "clangast")) { if (Expected<StringRef> E = Section.getContents()) return *E; diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp index 2a31f673a07..a4ee282c4bd 100644 --- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -390,7 +390,10 @@ class ObjectFileHandler final : public FileHandler { static bool IsOffloadSection(SectionRef CurSection, StringRef &OffloadTriple) { StringRef SectionName; - CurSection.getName(SectionName); + if (Expected<StringRef> NameOrErr = CurSection.getName()) + SectionName = *NameOrErr; + else + consumeError(NameOrErr.takeError()); if (SectionName.empty()) return false; |