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