Skip to content

Commit b6a5aea

Browse files
committed
[NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyType()
This patch uses cast instead of dyn_cast which will assert if the type doesn't match. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D151469
1 parent fbb241c commit b6a5aea

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11290,7 +11290,6 @@ EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts) {
1129011290
assert(!T->isDependentType() && "unexpected dependent type");
1129111291

1129211292
QualType CanTy = T.getCanonicalType();
11293-
const BuiltinType *BT = dyn_cast<BuiltinType>(CanTy);
1129411293

1129511294
switch (CanTy->getTypeClass()) {
1129611295
#define TYPE(ID, BASE)
@@ -11303,7 +11302,7 @@ EvaluateBuiltinClassifyType(QualType T, const LangOptions &LangOpts) {
1130311302
llvm_unreachable("unexpected non-canonical or dependent type");
1130411303

1130511304
case Type::Builtin:
11306-
switch (BT->getKind()) {
11305+
switch (cast<BuiltinType>(CanTy)->getKind()) {
1130711306
#define BUILTIN_TYPE(ID, SINGLETON_ID)
1130811307
#define SIGNED_TYPE(ID, SINGLETON_ID) \
1130911308
case BuiltinType::ID: return GCCTypeClass::Integer;

0 commit comments

Comments
 (0)