summaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-07-29 20:15:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-07-29 20:15:26 +0000
commit344a3780b2e33f6ca763666c380202b18aab72a3 (patch)
treef0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/lib/Object/COFFObjectFile.cpp
parentb60736ec1405bb0a8dd40989f67ef4c93da068ab (diff)
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 6e9a8eb35dcf..354b3c0d5577 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -328,7 +328,14 @@ bool COFFObjectFile::isSectionBSS(DataRefImpl Ref) const {
// The .debug sections are the only debug sections for COFF
// (\see MCObjectFileInfo.cpp).
-bool COFFObjectFile::isDebugSection(StringRef SectionName) const {
+bool COFFObjectFile::isDebugSection(DataRefImpl Ref) const {
+ Expected<StringRef> SectionNameOrErr = getSectionName(Ref);
+ if (!SectionNameOrErr) {
+ // TODO: Report the error message properly.
+ consumeError(SectionNameOrErr.takeError());
+ return false;
+ }
+ StringRef SectionName = SectionNameOrErr.get();
return SectionName.startswith(".debug");
}