[PATCH] D151928: [NFC][CLANG] Fix nullptr dereference issue in ConvertQualTypeToKind()

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 13:42:04 PDT 2023


Manna created this revision.
Manna added a reviewer: erichkeane.
Herald added a project: All.
Manna requested review of this revision.
Herald added a project: clang.

This patch uses castAs instead of getAs which will assert if the type doesn't match in ConvertQualTypeToKind(clang::​ASTContext const &, clang::​QualType).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151928

Files:
  clang/lib/Interpreter/Value.cpp


Index: clang/lib/Interpreter/Value.cpp
===================================================================
--- clang/lib/Interpreter/Value.cpp
+++ clang/lib/Interpreter/Value.cpp
@@ -108,7 +108,7 @@
   if (!BT || BT->isNullPtrType())
     return Value::K_PtrOrObj;
 
-  switch (QT->getAs<BuiltinType>()->getKind()) {
+  switch (QT->castAs<BuiltinType>()->getKind()) {
   default:
     assert(false && "Type not supported");
     return Value::K_Unspecified;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151928.527593.patch
Type: text/x-patch
Size: 458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230601/85e5cd25/attachment.bin>


More information about the cfe-commits mailing list