From bf809cd165f4ea1b8ef6aabc8e41e29747b4d2c7 Mon Sep 17 00:00:00 2001 From: Esme-Yi Date: Wed, 26 May 2021 08:47:53 +0000 Subject: [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 --- llvm/lib/Object/COFFObjectFile.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/COFFObjectFile.cpp') 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 SectionNameOrErr = getSectionName(Ref); + if (!SectionNameOrErr) { + // TODO: Report the error message properly. + consumeError(SectionNameOrErr.takeError()); + return false; + } + StringRef SectionName = SectionNameOrErr.get(); return SectionName.startswith(".debug"); } -- cgit v1.1