[PATCH] D151469: [NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyType()

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 10:11:54 PDT 2023


erichkeane added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:11294
   QualType CanTy = T.getCanonicalType();
-  const BuiltinType *BT = dyn_cast<BuiltinType>(CanTy);
+  const BuiltinType *BT = cast<BuiltinType>(CanTy);
 
----------------
I don't think this is right.  BT is only dereferenced in the event that CanTy's type class is "Builtin".  We COULD introduce a scope around the Type::Builtin type and move this there, but this will now assert any time that CanTy is a Pointer, auto, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151469



More information about the cfe-commits mailing list