From: Manna, Soumi Date: Wed, 31 May 2023 17:11:14 +0000 (-0700) Subject: [NFC][CLANG] Fix nullptr dereference issue in SetValueDataBasedOnQualType() X-Git-Tag: upstream/17.0.6~6597 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5bb06924657332cf35c11840c4a14acb86536fd4;p=platform%2Fupstream%2Fllvm.git [NFC][CLANG] Fix nullptr dereference issue in SetValueDataBasedOnQualType() 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 --- diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 82d4932..4e10452 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -768,7 +768,7 @@ static void SetValueDataBasedOnQualType(Value &V, unsigned long long Data) { if (const auto *ET = QT->getAs()) QT = ET->getDecl()->getIntegerType(); - switch (QT->getAs()->getKind()) { + switch (QT->castAs()->getKind()) { default: llvm_unreachable("unknown type kind!"); #define X(type, name) \