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

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 14:15:41 PDT 2023


================
@@ -787,6 +794,11 @@ class XCOFFSymbolRef {
 
   uint64_t getValue64() const { return Entry64->Value; }
 
+  uint64_t getSize() const {
+    return cast<XCOFFObjectFile>(BasicSymbolRef::getObject())
+        ->getSymbolSize(getRawDataRefImpl());
----------------
diggerlin wrote:

in the PR, the constructor of XCOFFSymbolRef do not initiate the  SymbolPimpl of BasicSymbolRef  (it will be initiated by BasicSymbolRef() = default;)
the getRawDataRefImpl() will be always zero ?

if you initiate the SymbolPimpl. the  content of data member of 

```
class BasicSymbolRef {
  DataRefImpl SymbolPimpl;
  const SymbolicFile *OwningObject = nullptr;
```
  
  is duplicated with 
  
```
  class XCOFFSymbolRef { 
  
   private:
  const XCOFFObjectFile *OwningObjectPtr;
  const XCOFFSymbolEntry32 *Entry32 = nullptr;
  const XCOFFSymbolEntry64 *Entry64 = nullptr;
```


  you need to get remove of  data member 
    ```
const XCOFFObjectFile *OwningObjectPtr;
  const XCOFFSymbolEntry32 *Entry32 = nullptr;
  const XCOFFSymbolEntry64 *Entry64 = nullptr;
```
  and re_implment of the API of XCOFFSymbolRef 

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


More information about the llvm-commits mailing list