[PATCH] D103465: [OpaquePtr] Track pointee types in Clang

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 7 16:03:47 PDT 2021


craig.topper added inline comments.


================
Comment at: clang/lib/CodeGen/Address.h:31
+      : Address(pointer, nullptr, alignment) {}
+  Address(llvm::Value *pointer, llvm::Type *PointeeType, CharUnits alignment)
+      : Pointer(pointer), PointeeType(PointeeType), Alignment(alignment) {
----------------
Is PointeeType expected to be non-null when pointer is non-null?


================
Comment at: clang/lib/CodeGen/Address.h:58
   /// store it in Address instead for the convenience of writing code.
-  llvm::Type *getElementType() const {
-    return getType()->getElementType();
-  }
+  llvm::Type *getElementType() const { return PointeeType; }
 
----------------
Should this assert isValid() since it no longer goes through getType() and getPointer() which would have asserted previously?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103465/new/

https://reviews.llvm.org/D103465



More information about the cfe-commits mailing list