From f5dcd3885865c931fdbd16f36237af70743d53c6 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 30 May 2009 21:37:25 +0000 Subject: [PATCH] AddInitializerToDecl needs to take a full expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72640 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Parse/Action.h | 2 +- lib/Frontend/PrintParserCallbacks.cpp | 2 +- lib/Parse/ParseDecl.cpp | 2 +- lib/Sema/Sema.h | 2 +- lib/Sema/SemaDecl.cpp | 4 ++-- lib/Sema/SemaExprCXX.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 328de90036..2ef87be13b 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -271,7 +271,7 @@ public: /// This allows ActOnDeclarator to register "xx" prior to parsing the /// initializer. The declaration above should still result in a warning, /// since the reference to "xx" is uninitialized. - virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) { + virtual void AddInitializerToDecl(DeclPtrTy Dcl, FullExprArg Init) { return; } diff --git a/lib/Frontend/PrintParserCallbacks.cpp b/lib/Frontend/PrintParserCallbacks.cpp index ca13f3df29..fbac3c88aa 100644 --- a/lib/Frontend/PrintParserCallbacks.cpp +++ b/lib/Frontend/PrintParserCallbacks.cpp @@ -109,7 +109,7 @@ namespace { /// This allows ActOnDeclarator to register "xx" prior to parsing the /// initializer. The declaration above should still result in a warning, /// since the reference to "xx" is uninitialized. - virtual void AddInitializerToDecl(DeclPtrTy Dcl, ExprArg Init) { + virtual void AddInitializerToDecl(DeclPtrTy Dcl, FullExprArg Init) { Out << __FUNCTION__ << "\n"; } diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 36ebec33b3..4fc713c885 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -360,7 +360,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D) { SkipUntil(tok::semi, true, true); return DeclPtrTy(); } - Actions.AddInitializerToDecl(ThisDecl, move(Init)); + Actions.AddInitializerToDecl(ThisDecl, Actions.FullExpr(Init)); } } else if (Tok.is(tok::l_paren)) { // Parse C++ direct initializer: '(' expression-list ')' diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index ecb17755eb..9939781667 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -409,7 +409,7 @@ public: virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param, SourceLocation EqualLoc); virtual void ActOnParamDefaultArgumentError(DeclPtrTy param); - virtual void AddInitializerToDecl(DeclPtrTy dcl, ExprArg init); + virtual void AddInitializerToDecl(DeclPtrTy dcl, FullExprArg init); void AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit); void ActOnUninitializedDecl(DeclPtrTy dcl); virtual void SetDeclDeleted(DeclPtrTy dcl, SourceLocation DelLoc); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3ea0b41622..09ec071bb1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2468,8 +2468,8 @@ bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) { return true; } -void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init) { - AddInitializerToDecl(dcl, move(init), /*DirectInit=*/false); +void Sema::AddInitializerToDecl(DeclPtrTy dcl, FullExprArg init) { + AddInitializerToDecl(dcl, init.release(), /*DirectInit=*/false); } /// AddInitializerToDecl - Adds the initializer Init to the diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 641fcb7e10..18382bab21 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -744,7 +744,7 @@ Sema::ActOnCXXConditionDeclarationExpr(Scope *S, SourceLocation StartLoc, DeclPtrTy Dcl = ActOnDeclarator(S, D, DeclPtrTy()); if (!Dcl) return ExprError(); - AddInitializerToDecl(Dcl, move(AssignExprVal)); + AddInitializerToDecl(Dcl, move(AssignExprVal), /*DirectInit=*/false); // Mark this variable as one that is declared within a conditional. // We know that the decl had to be a VarDecl because that is the only type of -- 2.40.0