[llvm] [XCOFF][OBJECT] get symbol size by calling XCOFF interfaces (PR #67304)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 10:25:22 PDT 2023


================
@@ -822,11 +833,29 @@ class XCOFFSymbolRef {
   Expected<XCOFFCsectAuxRef> getXCOFFCsectAuxRef() const;
 
 private:
-  const XCOFFObjectFile *OwningObjectPtr;
+  const XCOFFObjectFile *getObject() const {
+    return cast<XCOFFObjectFile>(BasicSymbolRef::getObject());
+  }
+
   const XCOFFSymbolEntry32 *Entry32 = nullptr;
----------------
diggerlin wrote:

since you make the XCOFFSymbolRef as derived class of  SymbolRef  and using the iterator to go thorough the symbols, 
the value of Entry32(Entry64) maybe not be initiated  , it will caused getValue() crashed.

the purpose of the pull request is to getSize of symbol . 

we do not to derive XCOFFSymbolRef  from SymbolRef  
you can look example of XCOFFDumper::printSymbols in  XCOFFDumper.cpp 


https://github.com/llvm/llvm-project/pull/67304


More information about the llvm-commits mailing list