summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/self-referencing-lambda.cpp
diff options
context:
space:
mode:
authorVolodymyr Sapsai <vsapsai@apple.com>2018-03-21 21:28:54 +0000
committerVolodymyr Sapsai <vsapsai@apple.com>2018-03-21 21:28:54 +0000
commit8a5943f5691920cd1c2dfde975dc1951f7d8e5b4 (patch)
treec4f0f43bc3e06b9c29b3b4b6a677a42a4ae6676a /clang/test/Modules/self-referencing-lambda.cpp
parent1d0832d9a3ee4f7e19c000bd9adc11991d9dfe23 (diff)
downloadbcm5719-llvm-8a5943f5691920cd1c2dfde975dc1951f7d8e5b4.tar.gz
bcm5719-llvm-8a5943f5691920cd1c2dfde975dc1951f7d8e5b4.zip
[Modules] Fix creating fake definition data for lambdas.
During reading C++ definition data for lambda we can access CXXRecordDecl representing lambda before we finished reading the definition data. This can happen by reading a captured variable which is VarDecl, then reading its decl context which is CXXMethodDecl `operator()`, then trying to merge redeclarable methods and accessing enclosing CXXRecordDecl. The call stack looks roughly like VisitCXXRecordDecl ReadCXXRecordDefinition VisitVarDecl VisitCXXMethodDecl mergeRedeclarable getPrimaryContextForMerging If we add fake definition data at this point, later we'll hit the assertion Assertion failed: (!DD.IsLambda && !MergeDD.IsLambda && "faked up lambda definition?"), function MergeDefinitionData, file clang/lib/Serialization/ASTReaderDecl.cpp, line 1675. The fix is to assign definition data before reading it. Fixes PR32556. rdar://problem/37461072 Reviewers: rsmith, bruno Reviewed By: rsmith Subscribers: cfe-commits, jkorous-apple, aprantl Differential Revision: https://reviews.llvm.org/D43494 llvm-svn: 328153
Diffstat (limited to 'clang/test/Modules/self-referencing-lambda.cpp')
-rw-r--r--clang/test/Modules/self-referencing-lambda.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Modules/self-referencing-lambda.cpp b/clang/test/Modules/self-referencing-lambda.cpp
new file mode 100644
index 00000000000..ea9553fc438
--- /dev/null
+++ b/clang/test/Modules/self-referencing-lambda.cpp
@@ -0,0 +1,5 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/self-referencing-lambda %s -verify -emit-obj -o %t2.o
+// expected-no-diagnostics
+
+#include "a.h"
OpenPOWER on IntegriCloud