[clang] 2009f24 - Remove a bogus assertion.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 17:57:26 PST 2023


Author: Richard Smith
Date: 2023-01-12T17:57:14-08:00
New Revision: 2009f2450532450a99c1a03d5e2c30f478121839

URL: https://github.com/llvm/llvm-project/commit/2009f2450532450a99c1a03d5e2c30f478121839
DIFF: https://github.com/llvm/llvm-project/commit/2009f2450532450a99c1a03d5e2c30f478121839.diff

LOG: Remove a bogus assertion.

The result of recomputing the type of an LValue may be different from
the type we find serialized with that LValue, either due to differing
type sugar in a redeclaration, or more significantly due to a later
declaration of a variable having an array bound that a prior declaration
did not have. Therefore this assertion was attempting to verify a
property that isn't necessarily true.

Added: 
    

Modified: 
    clang/include/clang/AST/PropertiesBase.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/PropertiesBase.td b/clang/include/clang/AST/PropertiesBase.td
index ff0fb01813127..d713b8649019b 100644
--- a/clang/include/clang/AST/PropertiesBase.td
+++ b/clang/include/clang/AST/PropertiesBase.td
@@ -517,20 +517,16 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
   def : Creator<[{
     (void)ctx;
     APValue::LValueBase base;
-    QualType elemTy;
     if (hasBase) {
       if (isTypeInfo) {
         base = APValue::LValueBase::getTypeInfo(
             TypeInfoLValue(typeInfo->getTypePtr()), *type);
-        elemTy = base.getTypeInfoType();
       } else if (isExpr) {
         base = APValue::LValueBase(cast<Expr>(*stmt),
                                    *callIndex, *version);
-        elemTy = base.get<const Expr *>()->getType();
       } else {
         base = APValue::LValueBase(cast<ValueDecl>(*decl),
                                    *callIndex, *version);
-        elemTy = base.get<const ValueDecl *>()->getType();
       }
     }
     CharUnits offset = CharUnits::fromQuantity(offsetQuantity);
@@ -543,7 +539,6 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
     auto pathLength = lvaluePath->Path.size();
     APValue::LValuePathEntry *path = result.setLValueUninit(
         base, offset, pathLength, isLValueOnePastTheEnd, isNullPtr).data();
-    assert(lvaluePath->getType() == elemTy && "Unexpected type reference!");
     llvm::copy(lvaluePath->Path, path);
     return result;
   }]>;


        


More information about the cfe-commits mailing list