[clang] [clang] Fix crash when compiling error with invalid decl (PR #77893)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 18:13:52 PST 2024


================
@@ -40,7 +40,11 @@ static_assert(
     "Type is insufficiently aligned");
 
 APValue::LValueBase::LValueBase(const ValueDecl *P, unsigned I, unsigned V)
-    : Ptr(P ? cast<ValueDecl>(P->getCanonicalDecl()) : nullptr), Local{I, V} {}
+    : Ptr(P ? cast<ValueDecl>(P->getCanonicalDecl()->isInvalidDecl()
----------------
shafik wrote:

Not clear to me why we check `isInvalidDecl()` here

https://github.com/llvm/llvm-project/pull/77893


More information about the cfe-commits mailing list