Skip to content

Commit

Permalink
[NFC][CLANG] Fix nullptr dereference issue in SetValueDataBasedOnQual…
Browse files Browse the repository at this point in the history
…Type()

This patch uses castAs instead of getAs which will assert if the type doesn't match in SetValueDataBasedOnQualType(clang::Value &, unsigned long long).

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D151770
  • Loading branch information
smanna12 committed May 31, 2023
1 parent a5e5eea commit 5bb0692
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ static void SetValueDataBasedOnQualType(Value &V, unsigned long long Data) {
if (const auto *ET = QT->getAs<EnumType>())
QT = ET->getDecl()->getIntegerType();

switch (QT->getAs<BuiltinType>()->getKind()) {
switch (QT->castAs<BuiltinType>()->getKind()) {
default:
llvm_unreachable("unknown type kind!");
#define X(type, name) \
Expand Down

0 comments on commit 5bb0692

Please sign in to comment.