eddyz87 added inline comments.

================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3700
+    return false;
+  if (auto *BaseDecl = E->getType()->getPointeeType()->getAsRecordDecl())
+    return hasBPFPreserveStaticOffset(BaseDecl);
----------------
erichkeane wrote:
> getPointeeType can also return nullptr, so unless you have a test elsewhere 
> to ensure it isn't, you likely have to do a little more work here (and if so, 
> I'd need an assert).
Is it? I actually double-checked this before pushing an update, clangd jumps to 
the following definition:

```
lang=cpp
QualType Type::getPointeeType() const {
  if (const auto *PT = getAs<PointerType>())
    return PT->getPointeeType();
  ...
  return {};
}
```

The `getAsRecordDecl()` can return null indeed, but that null is checked.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133361

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to