When evaluating a VarDecl as a constant or determining whether it is
an integral constant expression, maintain a cache of the value and the
is-an-ICE flag within the VarDecl itself. This eliminates
exponential-time behavior of the Fibonacci template metaprogram.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72428 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 22bdc79..4149fa4 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2581,7 +2581,7 @@
// };
// Attach the initializer
- VDecl->setInit(Init);
+ VDecl->setInit(Context, Init);
// C++ [class.mem]p4:
// A member-declarator can contain a constant-initializer only
@@ -2644,7 +2644,7 @@
}
// Attach the initializer to the decl.
- VDecl->setInit(Init);
+ VDecl->setInit(Context, Init);
// If the previous declaration of VDecl was a tentative definition,
// remove it from the set of tentative definitions.
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index feb9456..ebe3406 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1776,7 +1776,7 @@
Expr **Exprs, unsigned NumExprs) {
Expr *Temp = CXXConstructExpr::Create(Context, VD, DeclInitType, Constructor,
false, Exprs, NumExprs);
- VD->setInit(Temp);
+ VD->setInit(Context, Temp);
}
/// AddCXXDirectInitializerToDecl - This action is called immediately after