summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2019-11-17 02:09:25 -0500
committerNico Weber <thakis@chromium.org>2019-11-17 02:09:25 -0500
commitc9276fbfdf0c7caf1576b2db562286d7cec7e53b (patch)
treeb584cd30cae5f36372ed6fd48cb2cc4abec54dfa /clang/lib/AST/ASTContext.cpp
parentcc6b85390170725d2341416af2b2ab8ea6c25d83 (diff)
downloadbcm5719-llvm-c9276fbfdf0c7caf1576b2db562286d7cec7e53b.tar.gz
bcm5719-llvm-c9276fbfdf0c7caf1576b2db562286d7cec7e53b.zip
Revert "[NFC] Refactor representation of materialized temporaries"
This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982. It broke ./ClangdTests/FindExplicitReferencesTest.All on the bots, see comments on https://reviews.llvm.org/D69360
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 752c100aab2..cda51ec755a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -875,6 +875,10 @@ ASTContext::~ASTContext() {
A != AEnd; ++A)
A->second->~AttrVec();
+ for (std::pair<const MaterializeTemporaryExpr *, APValue *> &MTVPair :
+ MaterializedTemporaryValues)
+ MTVPair.second->~APValue();
+
for (const auto &Value : ModuleInitializers)
Value.second->~PerModuleInitializers();
@@ -10320,6 +10324,21 @@ unsigned ASTContext::getParameterIndex(const ParmVarDecl *D) const {
return I->second;
}
+APValue *
+ASTContext::getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E,
+ bool MayCreate) {
+ assert(E && E->getStorageDuration() == SD_Static &&
+ "don't need to cache the computed value for this temporary");
+ if (MayCreate) {
+ APValue *&MTVI = MaterializedTemporaryValues[E];
+ if (!MTVI)
+ MTVI = new (*this) APValue;
+ return MTVI;
+ }
+
+ return MaterializedTemporaryValues.lookup(E);
+}
+
QualType ASTContext::getStringLiteralArrayType(QualType EltTy,
unsigned Length) const {
// A C++ string literal has a const-qualified element type (C++ 2.13.4p1).
OpenPOWER on IntegriCloud