[PATCH] D133361: [BPF] Attribute preserve_static_offset for structs

Eduard Zingerman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 06:56:57 PDT 2023


eddyz87 marked 3 inline comments as done.
eddyz87 added inline comments.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3701
+  QualType PointeeType = E->getType()->getPointeeType();
+  if (PointeeType.isNull())
+    return false;
----------------
erichkeane wrote:
> eddyz87 wrote:
> > erichkeane wrote:
> > > We override `operator bool` to make this work.
> > Sorry, just to clarify, currently such modification fails with the following error:
> > 
> > ```
> > lang=c++
> > clang/lib/CodeGen/CGExpr.cpp:3710:7: error: invalid argument type 'QualType' to unary expression
> >   if (!PointeeType)
> >       ^~~~~~~~~~~~
> > 1 error generated.
> > ```
> > 
> > And you want me to modify `QualType` as follows:
> > 
> > ```
> > --- a/clang/include/clang/AST/Type.h
> > +++ b/clang/include/clang/AST/Type.h
> > @@ -796,6 +796,8 @@ public:
> >      return getTypePtr();
> >    }
> >  
> > +  explicit operator bool() const { return isNull(); }
> > +
> >    bool isCanonical() const;
> >    bool isCanonicalAsParam() const;
> > ```
> > 
> > Right?
> No, don't do that, you can leave it just checking isNull.  I could have sworn we already had that operator, but perhaps it was removed at one point.
Understood.
Thank you for the review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133361



More information about the cfe-commits mailing list