Move AsmLabel into Declarator instead of just a parameter to
ActOnDeclarator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54353 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp
index 3529255..cb130c3 100644
--- a/lib/Parse/MinimalAction.cpp
+++ b/lib/Parse/MinimalAction.cpp
@@ -63,8 +63,7 @@
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
/// popped.
Action::DeclTy *
-MinimalAction::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup,
- ExprTy *AsmLabel) {
+MinimalAction::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
IdentifierInfo *II = D.getIdentifier();
// If there is no identifier associated with this declarator, bail out.
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 33482c5..1cf3317 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -256,13 +256,14 @@
// rest of the init-declarator-list.
while (1) {
// If a simple-asm-expr is present, parse it.
- ExprResult AsmLabel;
if (Tok.is(tok::kw_asm)) {
- AsmLabel = ParseSimpleAsm();
+ ExprResult AsmLabel = ParseSimpleAsm();
if (AsmLabel.isInvalid) {
SkipUntil(tok::semi);
return 0;
}
+
+ D.setAsmLabel(AsmLabel.Val);
}
// If attributes are present, parse them.
@@ -271,8 +272,7 @@
// Inform the current actions module that we just parsed this declarator.
// FIXME: pass asm & attributes.
- LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup,
- AsmLabel.Val);
+ LastDeclInGroup = Actions.ActOnDeclarator(CurScope, D, LastDeclInGroup);
// Parse declarator '=' initializer.
if (Tok.is(tok::equal)) {
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index b18c7eb..0079701 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1222,7 +1222,7 @@
ParseDeclarator(DeclaratorInfo);
if (DeclaratorInfo.getIdentifier()) {
DeclTy *aBlockVarDecl = Actions.ActOnDeclarator(CurScope,
- DeclaratorInfo, 0, 0);
+ DeclaratorInfo, 0);
StmtResult stmtResult =
Actions.ActOnDeclStmt(aBlockVarDecl,
DS.getSourceRange().getBegin(),
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 864b464..0fda782 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -211,8 +211,7 @@
// Symbol table / Decl tracking callbacks: SemaDecl.cpp.
//
virtual TypeTy *isTypeName(const IdentifierInfo &II, Scope *S);
- virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup,
- ExprTy *AsmLabel);
+ virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
virtual DeclTy *ActOnParamDeclarator(Scope *S, Declarator &D);
virtual void ActOnParamDefaultArgument(DeclTy *param,
SourceLocation EqualLoc,
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 64e6236..19a2c28 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -609,7 +609,7 @@
}
Sema::DeclTy *
-Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl, ExprTy *AsmLabel) {
+Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
ScopedDecl *LastDeclarator = dyn_cast_or_null<ScopedDecl>((Decl *)lastDecl);
IdentifierInfo *II = D.getIdentifier();
@@ -701,7 +701,7 @@
ProcessDeclAttributes(NewFD, D);
// Handle GNU asm-label extension (encoded as an attribute).
- if (Expr *E = (Expr*) AsmLabel) {
+ if (Expr *E = (Expr*) D.getAsmLabel()) {
// The parser guarantees this is a string.
StringLiteral *SE = cast<StringLiteral>(E);
NewFD->addAttr(new AsmLabelAttr(std::string(SE->getStrData(),
@@ -1577,7 +1577,7 @@
}
return ActOnStartOfFunctionDef(FnBodyScope,
- ActOnDeclarator(GlobalScope, D, 0, 0));
+ ActOnDeclarator(GlobalScope, D, 0));
}
Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) {
@@ -1669,7 +1669,7 @@
CurContext = Context.getTranslationUnitDecl();
FunctionDecl *FD =
- dyn_cast<FunctionDecl>(static_cast<Decl*>(ActOnDeclarator(TUScope, D, 0, 0)));
+ dyn_cast<FunctionDecl>(static_cast<Decl*>(ActOnDeclarator(TUScope, D, 0)));
FD->setImplicit();
CurContext = PrevDC;
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index d560316..9dc62dc 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -371,7 +371,7 @@
if (isInstField)
Member = static_cast<Decl*>(ActOnField(S, Loc, D, BitWidth));
else
- Member = static_cast<Decl*>(ActOnDeclarator(S, D, LastInGroup, 0));
+ Member = static_cast<Decl*>(ActOnDeclarator(S, D, LastInGroup));
if (!Member) return LastInGroup;