diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-04 17:40:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-04 17:40:10 +0000 |
commit | b61e809b42156161b17ff1bf805da01499d73b9f (patch) | |
tree | 8ba6525146ef29d9df85510ea7d9b6f8b5c1119e /clang/lib/AST/ExprCXX.cpp | |
parent | f18c03e49e1867db55c5f641e3b53f4521cb5db8 (diff) | |
download | bcm5719-llvm-b61e809b42156161b17ff1bf805da01499d73b9f.tar.gz bcm5719-llvm-b61e809b42156161b17ff1bf805da01499d73b9f.zip |
Move the computation of the lambda mangling information (mangling
number + context) to the point where we initially start defining the
lambda, so that the linkage won't change when that information is made
available. Fixes the assertion in <rdar://problem/11182962>.
Plus, actually mangle the context of lambdas properly.
llvm-svn: 154029
Diffstat (limited to 'clang/lib/AST/ExprCXX.cpp')
-rw-r--r-- | clang/lib/AST/ExprCXX.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index 039d70cfc56..8cf519c93dc 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -796,9 +796,7 @@ LambdaExpr::LambdaExpr(QualType T, ArrayRef<Expr *> CaptureInits, ArrayRef<VarDecl *> ArrayIndexVars, ArrayRef<unsigned> ArrayIndexStarts, - SourceLocation ClosingBrace, - unsigned ManglingNumber, - Decl *ContextDecl) + SourceLocation ClosingBrace) : Expr(LambdaExprClass, T, VK_RValue, OK_Ordinary, T->isDependentType(), T->isDependentType(), T->isDependentType(), /*ContainsUnexpandedParameterPack=*/false), @@ -819,8 +817,6 @@ LambdaExpr::LambdaExpr(QualType T, ASTContext &Context = Class->getASTContext(); Data.NumCaptures = NumCaptures; Data.NumExplicitCaptures = 0; - Data.ManglingNumber = ManglingNumber; - Data.ContextDecl = ContextDecl; Data.Captures = (Capture *)Context.Allocate(sizeof(Capture) * NumCaptures); Capture *ToCapture = Data.Captures; for (unsigned I = 0, N = Captures.size(); I != N; ++I) { @@ -848,9 +844,6 @@ LambdaExpr::LambdaExpr(QualType T, sizeof(unsigned) * Captures.size()); getArrayIndexStarts()[Captures.size()] = ArrayIndexVars.size(); } - - if (ManglingNumber) - Class->ClearLinkageCache(); } LambdaExpr *LambdaExpr::Create(ASTContext &Context, @@ -863,9 +856,7 @@ LambdaExpr *LambdaExpr::Create(ASTContext &Context, ArrayRef<Expr *> CaptureInits, ArrayRef<VarDecl *> ArrayIndexVars, ArrayRef<unsigned> ArrayIndexStarts, - SourceLocation ClosingBrace, - unsigned ManglingNumber, - Decl *ContextDecl) { + SourceLocation ClosingBrace) { // Determine the type of the expression (i.e., the type of the // function object we're creating). QualType T = Context.getTypeDeclType(Class); @@ -878,7 +869,7 @@ LambdaExpr *LambdaExpr::Create(ASTContext &Context, return new (Mem) LambdaExpr(T, IntroducerRange, CaptureDefault, Captures, ExplicitParams, ExplicitResultType, CaptureInits, ArrayIndexVars, ArrayIndexStarts, - ClosingBrace, ManglingNumber, ContextDecl); + ClosingBrace); } LambdaExpr *LambdaExpr::CreateDeserialized(ASTContext &C, unsigned NumCaptures, |