diff options
author | Esme-Yi <esme.yi@ibm.com> | 2021-05-26 08:47:53 +0000 |
---|---|---|
committer | Esme-Yi <esme.yi@ibm.com> | 2021-05-26 08:47:53 +0000 |
commit | bf809cd165f4ea1b8ef6aabc8e41e29747b4d2c7 (patch) | |
tree | 01c0924d6303cfa730baa0d5bbf89560e0dfdfbc /llvm/lib/Object/COFFObjectFile.cpp | |
parent | 2cf0e52b8548716d8534470db1ce4bbb3571eea9 (diff) | |
download | llvm-bf809cd165f4ea1b8ef6aabc8e41e29747b4d2c7.zip llvm-bf809cd165f4ea1b8ef6aabc8e41e29747b4d2c7.tar.gz llvm-bf809cd165f4ea1b8ef6aabc8e41e29747b4d2c7.tar.bz2 |
[NFC][object] Change the input parameter of the method isDebugSection.
Summary: This is a NFC patch to change the input parameter of the method SectionRef::isDebugSection(), by replacing the StringRef SectionName with DataRefImpl Sec. This allows us to determine if a section is debug type in more ways than just by section name.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D102601
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index 6e9a8eb..354b3c0 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"); } |