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

Eduard Zingerman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 17:14:05 PDT 2023


eddyz87 added inline comments.


================
Comment at: clang/lib/CodeGen/CGExpr.cpp:3701
+  QualType PointeeType = E->getType()->getPointeeType();
+  if (PointeeType.isNull())
+    return false;
----------------
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?


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