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

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 10:30:53 PDT 2023


Manna updated this revision to Diff 525697.
Manna added a comment.

Thank you @erichkeane for reviews! I have updated patch to avoid the regression.


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

https://reviews.llvm.org/D151469

Files:
  clang/lib/AST/ExprConstant.cpp


Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -11291,7 +11291,6 @@
   assert(!T->isDependentType() && "unexpected dependent type");
 
   QualType CanTy = T.getCanonicalType();
-  const BuiltinType *BT = dyn_cast<BuiltinType>(CanTy);
 
   switch (CanTy->getTypeClass()) {
 #define TYPE(ID, BASE)
@@ -11304,7 +11303,7 @@
       llvm_unreachable("unexpected non-canonical or dependent type");
 
   case Type::Builtin:
-    switch (BT->getKind()) {
+    switch (cast<BuiltinType>(CanTy)->getKind()) {
 #define BUILTIN_TYPE(ID, SINGLETON_ID)
 #define SIGNED_TYPE(ID, SINGLETON_ID) \
     case BuiltinType::ID: return GCCTypeClass::Integer;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151469.525697.patch
Type: text/x-patch
Size: 768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230525/1872b128/attachment.bin>


More information about the cfe-commits mailing list