aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-09-09 15:08:12 +0000
committerMike Stump <mrs@apple.com>2009-09-09 15:08:12 +0000
commit1eb4433ac451dc16f4133a88af2d002ac26c58ef (patch)
tree07065b80cb7787bb7b9ffcb985196007a57e86f7 /lib/Parse
parent79d39f92590cf2e91bf81486b02cd1156d13ca54 (diff)
Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse')
-rw-r--r--lib/Parse/AttributeList.cpp18
-rw-r--r--lib/Parse/DeclSpec.cpp22
-rw-r--r--lib/Parse/ExtensionRAIIObject.h2
-rw-r--r--lib/Parse/MinimalAction.cpp44
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp18
-rw-r--r--lib/Parse/ParseDecl.cpp356
-rw-r--r--lib/Parse/ParseDeclCXX.cpp245
-rw-r--r--lib/Parse/ParseExpr.cpp104
-rw-r--r--lib/Parse/ParseExprCXX.cpp100
-rw-r--r--lib/Parse/ParseInit.cpp40
-rw-r--r--lib/Parse/ParseObjc.cpp272
-rw-r--r--lib/Parse/ParsePragma.cpp34
-rw-r--r--lib/Parse/ParsePragma.h18
-rw-r--r--lib/Parse/ParseStmt.cpp94
-rw-r--r--lib/Parse/ParseTemplate.cpp162
-rw-r--r--lib/Parse/ParseTentative.cpp14
-rw-r--r--lib/Parse/Parser.cpp92
17 files changed, 816 insertions, 819 deletions
diff --git a/lib/Parse/AttributeList.cpp b/lib/Parse/AttributeList.cpp
index 32ffba36dd..2ee41bc3eb 100644
--- a/lib/Parse/AttributeList.cpp
+++ b/lib/Parse/AttributeList.cpp
@@ -21,7 +21,7 @@ AttributeList::AttributeList(IdentifierInfo *aName, SourceLocation aLoc,
AttributeList *n, bool declspec)
: AttrName(aName), AttrLoc(aLoc), ParmName(pName), ParmLoc(pLoc),
NumArgs(numArgs), Next(n), DeclspecAttribute(declspec) {
-
+
if (numArgs == 0)
Args = 0;
else {
@@ -32,12 +32,12 @@ AttributeList::AttributeList(IdentifierInfo *aName, SourceLocation aLoc,
AttributeList::~AttributeList() {
if (Args) {
- // FIXME: before we delete the vector, we need to make sure the Expr's
+ // FIXME: before we delete the vector, we need to make sure the Expr's
// have been deleted. Since ActionBase::ExprTy is "void", we are dependent
// on the actions module for actually freeing the memory. The specific
- // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType,
- // ParseField, ParseTag. Once these routines have freed the expression,
- // they should zero out the Args slot (to indicate the memory has been
+ // hooks are ActOnDeclarator, ActOnTypeName, ActOnParamDeclaratorType,
+ // ParseField, ParseTag. Once these routines have freed the expression,
+ // they should zero out the Args slot (to indicate the memory has been
// freed). If any element of the vector is non-null, we should assert.
delete [] Args;
}
@@ -54,7 +54,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
Str += 2;
Len -= 4;
}
-
+
// FIXME: Hand generating this is neither smart nor efficient.
switch (Len) {
case 4:
@@ -103,7 +103,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
if (!memcmp(Str, "deprecated", 10)) return AT_deprecated;
if (!memcmp(Str, "visibility", 10)) return AT_visibility;
if (!memcmp(Str, "destructor", 10)) return AT_destructor;
- if (!memcmp(Str, "format_arg", 10)) return AT_format_arg;
+ if (!memcmp(Str, "format_arg", 10)) return AT_format_arg;
if (!memcmp(Str, "gnu_inline", 10)) return AT_gnu_inline;
break;
case 11:
@@ -136,13 +136,13 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
case 19:
if (!memcmp(Str, "ns_returns_retained", 19)) return AT_ns_returns_retained;
if (!memcmp(Str, "cf_returns_retained", 19)) return AT_cf_returns_retained;
- break;
+ break;
case 20:
if (!memcmp(Str, "reqd_work_group_size", 20)) return AT_reqd_wg_size;
case 22:
if (!memcmp(Str, "no_instrument_function", 22))
return AT_no_instrument_function;
break;
- }
+ }
return UnknownAttribute;
}
diff --git a/lib/Parse/DeclSpec.cpp b/lib/Parse/DeclSpec.cpp
index ceb19a3b3b..0342e39363 100644
--- a/lib/Parse/DeclSpec.cpp
+++ b/lib/Parse/DeclSpec.cpp
@@ -65,7 +65,7 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isVariadic,
// parameter list there (in an effort to avoid new/delete traffic). If it
// is already used (consider a function returning a function pointer) or too
// small (function taking too many arguments), go to the heap.
- if (!TheDeclarator.InlineParamsUsed &&
+ if (!TheDeclarator.InlineParamsUsed &&
NumArgs <= llvm::array_lengthof(TheDeclarator.InlineParams)) {
I.Fun.ArgInfo = TheDeclarator.InlineParams;
I.Fun.DeleteArgInfo = false;
@@ -98,10 +98,10 @@ unsigned DeclSpec::getParsedSpecifiers() const {
if (TypeQualifiers != TQ_unspecified)
Res |= PQ_TypeQualifier;
-
+
if (hasTypeSpecifier())
Res |= PQ_TypeSpecifier;
-
+
if (FS_inline_specified || FS_virtual_specified || FS_explicit_specified)
Res |= PQ_FunctionSpecifier;
return Res;
@@ -114,7 +114,7 @@ template <class T> static bool BadSpecifier(T TNew, T TPrev,
DiagID = (TNew == TPrev ? diag::ext_duplicate_declspec
: diag::err_invalid_decl_spec_combination);
return true;
-}
+}
const char *DeclSpec::getSpecifierName(DeclSpec::SCS S) {
switch (S) {
@@ -209,7 +209,7 @@ bool DeclSpec::SetStorageClassSpec(SCS S, SourceLocation Loc,
return false;
}
-bool DeclSpec::SetStorageClassSpecThread(SourceLocation Loc,
+bool DeclSpec::SetStorageClassSpecThread(SourceLocation Loc,
const char *&PrevSpec,
unsigned &DiagID) {
if (SCS_thread_specified) {
@@ -238,7 +238,7 @@ bool DeclSpec::SetTypeSpecWidth(TSW W, SourceLocation Loc,
return false;
}
-bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc,
+bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc,
const char *&PrevSpec,
unsigned &DiagID) {
if (TypeSpecComplex != TSC_unspecified)
@@ -248,7 +248,7 @@ bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc,
return false;
}
-bool DeclSpec::SetTypeSpecSign(TSS S, SourceLocation Loc,
+bool DeclSpec::SetTypeSpecSign(TSS S, SourceLocation Loc,
const char *&PrevSpec,
unsigned &DiagID) {
if (TypeSpecSign != TSS_unspecified)
@@ -287,7 +287,7 @@ bool DeclSpec::SetTypeQual(TQ T, SourceLocation Loc, const char *&PrevSpec,
if ((TypeQualifiers & T) && !Lang.C99)
return BadSpecifier(T, T, PrevSpec, DiagID);
TypeQualifiers |= T;
-
+
switch (T) {
default: assert(0 && "Unknown type qualifier!");
case TQ_const: TQ_constLoc = Loc; break;
@@ -380,7 +380,7 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
}
break;
}
-
+
// TODO: if the implementation does not implement _Complex or _Imaginary,
// disallow their use. Need information about the backend.
if (TypeSpecComplex != TSC_unspecified) {
@@ -419,9 +419,9 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
// Okay, now we can infer the real type.
-
+
// TODO: return "auto function" and other bad things based on the real type.
-
+
// 'data definition has no type or storage class'?
}
diff --git a/lib/Parse/ExtensionRAIIObject.h b/lib/Parse/ExtensionRAIIObject.h
index 2b2bd3b216..cc7c8e2170 100644
--- a/lib/Parse/ExtensionRAIIObject.h
+++ b/lib/Parse/ExtensionRAIIObject.h
@@ -30,7 +30,7 @@ namespace clang {
ExtensionRAIIObject(Diagnostic &diags) : Diags(diags) {
Diags.IncrementAllExtensionsSilenced();
}
-
+
~ExtensionRAIIObject() {
Diags.DecrementAllExtensionsSilenced();
}
diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp
index d89cc8c3ea..71b22cad6f 100644
--- a/lib/Parse/MinimalAction.cpp
+++ b/lib/Parse/MinimalAction.cpp
@@ -34,7 +34,7 @@ Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope,
SourceLocation IdentLoc,
IdentifierInfo *NamespcName,
AttributeList *AttrList) {
-
+
// FIXME: Parser seems to assume that Action::ActOn* takes ownership over
// passed AttributeList, however other actions don't free it, is it
// temporary state or bug?
@@ -52,7 +52,7 @@ Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope,
OverloadedOperatorKind Op,
AttributeList *AttrList,
bool IsTypeName) {
-
+
// FIXME: Parser seems to assume that Action::ActOn* takes ownership over
// passed AttributeList, however other actions don't free it, is it
// temporary state or bug?
@@ -67,11 +67,11 @@ void PrettyStackTraceActionsDecl::print(llvm::raw_ostream &OS) const {
OS << ": ";
}
OS << Message;
-
+
std::string Name = Actions.getDeclName(TheDecl);
if (!Name.empty())
OS << " '" << Name << '\'';
-
+
OS << '\n';
}
@@ -81,7 +81,7 @@ namespace {
struct TypeNameInfo {
TypeNameInfo *Prev;
bool isTypeName;
-
+
TypeNameInfo(bool istypename, TypeNameInfo *prev) {
isTypeName = istypename;
Prev = prev;
@@ -90,13 +90,13 @@ namespace {
struct TypeNameInfoTable {
llvm::RecyclingAllocator<llvm::BumpPtrAllocator, TypeNameInfo> Allocator;
-
+
void AddEntry(bool isTypename, IdentifierInfo *II) {
TypeNameInfo *TI = Allocator.Allocate<TypeNameInfo>();
new (TI) TypeNameInfo(isTypename, II->getFETokenInfo<TypeNameInfo>());
II->setFETokenInfo(TI);
}
-
+
void DeleteEntry(TypeNameInfo *Entry) {
Entry->~TypeNameInfo();
Allocator.Deallocate(Entry);
@@ -108,7 +108,7 @@ static TypeNameInfoTable *getTable(void *TP) {
return static_cast<TypeNameInfoTable*>(TP);
}
-MinimalAction::MinimalAction(Preprocessor &pp)
+MinimalAction::MinimalAction(Preprocessor &pp)
: Idents(pp.getIdentifierTable()), PP(pp) {
TypeNameInfoTablePtr = new TypeNameInfoTable();
}
@@ -127,9 +127,9 @@ void MinimalAction::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
TNIT.AddEntry(true, &Idents.get("__int128_t"));
TNIT.AddEntry(true, &Idents.get("__uint128_t"));
}
-
+
if (PP.getLangOptions().ObjC1) {
- // Recognize the ObjC built-in type identifiers as types.
+ // Recognize the ObjC built-in type identifiers as types.
TNIT.AddEntry(true, &Idents.get("id"));
TNIT.AddEntry(true, &Idents.get("SEL"));
TNIT.AddEntry(true, &Idents.get("Class"));
@@ -159,12 +159,12 @@ bool MinimalAction::isCurrentClassName(const IdentifierInfo &, Scope *,
return false;
}
-TemplateNameKind
+TemplateNameKind
MinimalAction::isTemplateName(Scope *S,
const IdentifierInfo &II,
SourceLocation IdLoc,
const CXXScopeSpec *SS,
- TypeTy *ObjectType,
+ TypeTy *ObjectType,
bool EnteringScope,
TemplateTy &TemplateDecl) {
return TNK_Non_template;
@@ -176,10 +176,10 @@ MinimalAction::isTemplateName(Scope *S,
Action::DeclPtrTy
MinimalAction::ActOnDeclarator(Scope *S, Declarator &D) {
IdentifierInfo *II = D.getIdentifier();
-
+
// If there is no identifier associated with this declarator, bail out.
if (II == 0) return DeclPtrTy();
-
+
TypeNameInfo *weCurrentlyHaveTypeInfo = II->getFETokenInfo<TypeNameInfo>();
bool isTypeName =
D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef;
@@ -190,10 +190,10 @@ MinimalAction::ActOnDeclarator(Scope *S, Declarator &D) {
if (weCurrentlyHaveTypeInfo || isTypeName) {
// Allocate and add the 'TypeNameInfo' "decl".
getTable(TypeNameInfoTablePtr)->AddEntry(isTypeName, II);
-
+
// Remember that this needs to be removed when the scope is popped.
S->AddDecl(DeclPtrTy::make(II));
- }
+ }
return DeclPtrTy();
}
@@ -212,15 +212,15 @@ MinimalAction::ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
return DeclPtrTy();
}
-/// ActOnForwardClassDeclaration -
-/// Scope will always be top level file scope.
+/// ActOnForwardClassDeclaration -
+/// Scope will always be top level file scope.
Action::DeclPtrTy
MinimalAction::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
IdentifierInfo **IdentList, unsigned NumElts) {
for (unsigned i = 0; i != NumElts; ++i) {
// Allocate and add the 'TypeNameInfo' "decl".
getTable(TypeNameInfoTablePtr)->AddEntry(true, IdentList[i]);
-
+
// Remember that this needs to be removed when the scope is popped.
TUScope->AddDecl(DeclPtrTy::make(IdentList[i]));
}
@@ -231,17 +231,17 @@ MinimalAction::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
/// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field.
void MinimalAction::ActOnPopScope(SourceLocation Loc, Scope *S) {
TypeNameInfoTable &Table = *getTable(TypeNameInfoTablePtr);
-
+
for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end();
I != E; ++I) {
IdentifierInfo &II = *(*I).getAs<IdentifierInfo>();
TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>();
assert(TI && "This decl didn't get pushed??");
-
+
if (TI) {
TypeNameInfo *Next = TI->Prev;
Table.DeleteEntry(TI);
-
+
II.setFETokenInfo(Next);
}
}
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index bfdbde6ddf..82b7da9f68 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -36,7 +36,7 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
// FIXME: Friend templates
FnD = Actions.ActOnFriendDecl(CurScope, &D, /*IsDefinition*/ true);
else // FIXME: pass template information through
- FnD = Actions.ActOnCXXMemberDeclarator(CurScope, AS, D,
+ FnD = Actions.ActOnCXXMemberDeclarator(CurScope, AS, D,
move(TemplateParams), 0, 0);
HandleMemberFunctionDefaultArgs(D, FnD);
@@ -44,7 +44,7 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
// Consume the tokens and store them for later parsing.
getCurrentClass().MethodDefs.push_back(LexedMethod(FnD));
- getCurrentClass().MethodDefs.back().TemplateScope
+ getCurrentClass().MethodDefs.back().TemplateScope
= CurScope->isTemplateParamScope();
CachedTokens &Toks = getCurrentClass().MethodDefs.back().Toks;
@@ -54,7 +54,7 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
// Consume everything up to (and including) the left brace.
if (!ConsumeAndStoreUntil(tok::l_brace, tok::unknown, Toks, tok::semi)) {
// We didn't find the left-brace we expected after the
- // constructor initializer.
+ // constructor initializer.
if (Tok.is(tok::semi)) {
// We found a semicolon; complain, consume the semicolon, and
// don't try to parse this method later.
@@ -66,7 +66,7 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
}
} else {
- // Begin by storing the '{' token.
+ // Begin by storing the '{' token.
Toks.push_back(Tok);
ConsumeBrace();
}
@@ -100,18 +100,18 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
for (; !Class.MethodDecls.empty(); Class.MethodDecls.pop_front()) {
LateParsedMethodDeclaration &LM = Class.MethodDecls.front();
-
+
// If this is a member template, introduce the template parameter scope.
ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
if (LM.TemplateScope)
Actions.ActOnReenterTemplateScope(CurScope, LM.Method);
-
+
// Start the delayed C++ method declaration
Actions.ActOnStartDelayedCXXMethodDeclaration(CurScope, LM.Method);
// Introduce the parameters into scope and parse their default
// arguments.
- ParseScope PrototypeScope(this,
+ ParseScope PrototypeScope(this,
Scope::FunctionPrototypeScope|Scope::DeclScope);
for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
// Introduce the parameter into scope.
@@ -169,7 +169,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
if (LM.TemplateScope)
Actions.ActOnReenterTemplateScope(CurScope, LM.D);
-
+
assert(!LM.Toks.empty() && "Empty body!");
// Append the current token at the end of the new token stream so that it
// doesn't get lost.
@@ -205,7 +205,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
/// ConsumeAndStoreUntil - Consume and store the token at the passed token
/// container until the token 'T' is reached (which gets
-/// consumed/stored too, if ConsumeFinalToken).
+/// consumed/stored too, if ConsumeFinalToken).
/// If EarlyAbortIf is specified, then we will stop early if we find that
/// token at the top level.
/// Returns true if token 'T1' or 'T2' was found.
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 25ff53ca9f..5d62c0c67e 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -69,10 +69,10 @@ Action::TypeResult Parser::ParseTypeName(SourceRange *Range) {
/// typespec
/// typequal
/// storageclass
-///
+///
/// FIXME: The GCC grammar/code for this construct implies we need two
-/// token lookahead. Comment from gcc: "If they start with an identifier
-/// which is followed by a comma or close parenthesis, then the arguments
+/// token lookahead. Comment from gcc: "If they start with an identifier
+/// which is followed by a comma or close parenthesis, then the arguments
/// start with that identifier; otherwise they are an expression list."
///
/// At the moment, I am not doing 2 token lookahead. I am also unaware of
@@ -82,9 +82,9 @@ Action::TypeResult Parser::ParseTypeName(SourceRange *Range) {
AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
assert(Tok.is(tok::kw___attribute) && "Not an attribute list!");
-
+
AttributeList *CurrAttr = 0;
-
+
while (Tok.is(tok::kw___attribute)) {
ConsumeToken();
if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
@@ -99,8 +99,8 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
// Parse the attribute-list. e.g. __attribute__(( weak, alias("__f") ))
while (Tok.is(tok::identifier) || isDeclarationSpecifier() ||
Tok.is(tok::comma)) {
-
- if (Tok.is(tok::comma)) {
+
+ if (Tok.is(tok::comma)) {
// allows for empty/non-empty attributes. ((__vector_size__(16),,,,))
ConsumeToken();
continue;
@@ -108,26 +108,26 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
// we have an identifier or declaration specifier (const, int, etc.)
IdentifierInfo *AttrName = Tok.getIdentifierInfo();
SourceLocation AttrNameLoc = ConsumeToken();
-
+
// check if we have a "paramterized" attribute
if (Tok.is(tok::l_paren)) {
ConsumeParen(); // ignore the left paren loc for now
-
+
if (Tok.is(tok::identifier)) {
IdentifierInfo *ParmName = Tok.getIdentifierInfo();
SourceLocation ParmLoc = ConsumeToken();
-
- if (Tok.is(tok::r_paren)) {
+
+ if (Tok.is(tok::r_paren)) {
// __attribute__(( mode(byte) ))
ConsumeParen(); // ignore the right paren loc for now
- CurrAttr = new AttributeList(AttrName, AttrNameLoc,
+ CurrAttr = new AttributeList(AttrName, AttrNameLoc,
ParmName, ParmLoc, 0, 0, CurrAttr);
} else if (Tok.is(tok::comma)) {
ConsumeToken();
// __attribute__(( format(printf, 1, 2) ))
ExprVector ArgExprs(Actions);
bool ArgExprsOk = true;
-
+
// now parse the non-empty comma separated list of expressions
while (1) {
OwningExprResult ArgExpr(ParseAssignmentExpression());
@@ -144,7 +144,7 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
}
if (ArgExprsOk && Tok.is(tok::r_paren)) {
ConsumeParen(); // ignore the right paren loc for now
- CurrAttr = new AttributeList(AttrName, AttrNameLoc, ParmName,
+ CurrAttr = new AttributeList(AttrName, AttrNameLoc, ParmName,
ParmLoc, ArgExprs.take(), ArgExprs.size(), CurrAttr);
}
}
@@ -154,7 +154,7 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
// parse a possibly empty comma separated list of expressions
// __attribute__(( nonnull() ))
ConsumeParen(); // ignore the right paren loc for now
- CurrAttr = new AttributeList(AttrName, AttrNameLoc,
+ CurrAttr = new AttributeList(AttrName, AttrNameLoc,
0, SourceLocation(), 0, 0, CurrAttr);
break;
case tok::kw_char:
@@ -174,7 +174,7 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
// If it's a builtin type name, eat it and expect a rparen
// __attribute__(( vec_type_hint(char) ))
ConsumeToken();
- CurrAttr = new AttributeList(AttrName, AttrNameLoc,
+ CurrAttr = new AttributeList(AttrName, AttrNameLoc,
0, SourceLocation(), 0, 0, CurrAttr);
if (Tok.is(tok::r_paren))
ConsumeParen();
@@ -183,7 +183,7 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
// __attribute__(( aligned(16) ))
ExprVector ArgExprs(Actions);
bool ArgExprsOk = true;
-
+
// now parse the list of expressions
while (1) {
OwningExprResult ArgExpr(ParseAssignmentExpression());
@@ -209,7 +209,7 @@ AttributeList *Parser::ParseAttributes(SourceLocation *EndLoc) {
}
}
} else {
- CurrAttr = new AttributeList(AttrName, AttrNameLoc,
+ CurrAttr = new AttributeList(AttrName, AttrNameLoc,
0, SourceLocation(), 0, 0, CurrAttr);
}
}
@@ -322,7 +322,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
default:
return ParseSimpleDeclaration(Context, DeclEnd);
}
-
+
// This routine returns a DeclGroup, if the thing we parsed only contains a
// single decl, convert it now.
return Actions.ConvertDeclToDeclGroup(SingleDecl);
@@ -341,7 +341,7 @@ Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
// Parse the common declaration-specifiers piece.
DeclSpec DS;
ParseDeclarationSpecifiers(DS);
-
+
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
if (Tok.is(tok::semi)) {
@@ -349,24 +349,24 @@ Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(CurScope, DS);
return Actions.ConvertDeclToDeclGroup(TheDecl);
}
-
+
Declarator DeclaratorInfo(DS, (Declarator::TheContext)Context);
ParseDeclarator(DeclaratorInfo);
-
+
DeclGroupPtrTy DG =
ParseInitDeclaratorListAfterFirstDeclarator(DeclaratorInfo);
DeclEnd = Tok.getLocation();
-
+
// If the client wants to check what comes after the declaration, just return
// immediately without checking anything!
if (!RequireSemi) return DG;
-
+
if (Tok.is(tok::semi)) {
ConsumeToken();
return DG;
}
-
+
Diag(Tok, diag::err_expected_semi_declaration);
// Skip to end of block or statement
SkipUntil(tok::r_brace, true, true);
@@ -406,27 +406,27 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
SkipUntil(tok::semi, true, true);
return DeclPtrTy();
}
-
+
D.setAsmLabel(AsmLabel.release());
D.SetRangeEnd(Loc);
}
-
+
// If attributes are present, parse them.
if (Tok.is(tok::kw___attribute)) {
SourceLocation Loc;
AttributeList *AttrList = ParseAttributes(&Loc);
D.AddAttributes(AttrList, Loc);
}
-
+
// Inform the current actions module that we just parsed this declarator.
- DeclPtrTy ThisDecl = TemplateInfo.TemplateParams?
+ DeclPtrTy ThisDecl = TemplateInfo.TemplateParams?
Actions.ActOnTemplateDeclarator(CurScope,
Action::MultiTemplateParamsArg(Actions,
TemplateInfo.TemplateParams->data(),
TemplateInfo.TemplateParams->size()),
D)
: Actions.ActOnDeclarator(CurScope, D);
-
+
// Parse declarator '=' initializer.
if (Tok.is(tok::equal)) {
ConsumeToken();
@@ -467,7 +467,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
CommaLocs.data(), RParenLoc);
}
} else {
- bool TypeContainsUndeducedAuto =
+ bool TypeContainsUndeducedAuto =
D.getDeclSpec().getTypeSpecType() == DeclSpec::TST_auto;
Actions.ActOnUninitializedDecl(ThisDecl, TypeContainsUndeducedAuto);
}
@@ -492,25 +492,25 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
// Declarators may be grouped together ("int X, *Y, Z();"). Remember the decls
// that we parse together here.
llvm::SmallVector<DeclPtrTy, 8> DeclsInGroup;
-
+
// At this point, we know that it is not a function definition. Parse the
// rest of the init-declarator-list.
while (1) {
DeclPtrTy ThisDecl = ParseDeclarationAfterDeclarator(D);
if (ThisDecl.get())
DeclsInGroup.push_back(ThisDecl);
-
+
// If we don't have a comma, it is either the end of the list (a ';') or an
// error, bail out.
if (Tok.isNot(tok::comma))
break;
-
+
// Consume the comma.
ConsumeToken();
-
+
// Parse the next declarator.
D.clear();
-
+
// Accept attributes in an init-declarator. In the first declarator in a
// declaration, these would be part of the declspec. In subsequent
// declarators, they become part of the declarator itself, so that they
@@ -523,10 +523,10 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
AttributeList *AttrList = ParseAttributes(&Loc);
D.AddAttributes(AttrList, Loc);
}
-
+
ParseDeclarator(D);
}
-
+
return Actions.FinalizeDeclaratorGroup(CurScope, D.getDeclSpec(),
DeclsInGroup.data(),
DeclsInGroup.size());
@@ -542,13 +542,13 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) {
/// specifier-qualifier-list is a subset of declaration-specifiers. Just
/// parse declaration-specifiers and complain about extra stuff.
ParseDeclarationSpecifiers(DS);
-
+
// Validate declspec for type-name.
unsigned Specs = DS.getParsedSpecifiers();
if (Specs == DeclSpec::PQ_None && !DS.getNumProtocolQualifiers() &&
!DS.getAttributes())
Diag(Tok, diag::err_typename_requires_specqual);
-
+
// Issue diagnostic and remove storage class if present.
if (Specs & DeclSpec::PQ_StorageClassSpecifier) {
if (DS.getStorageClassSpecLoc().isValid())
@@ -557,7 +557,7 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) {
Diag(DS.getThreadSpecLoc(), diag::err_typename_invalid_storageclass);
DS.ClearStorageClassSpecs();
}
-
+
// Issue diagnostic and remove function specfier if present.
if (Specs & DeclSpec::PQ_FunctionSpecifier) {
if (DS.isInlineSpecified())
@@ -608,7 +608,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
const ParsedTemplateInfo &TemplateInfo,
AccessSpecifier AS) {
assert(Tok.is(tok::identifier) && "should have identifier");
-
+
SourceLocation Loc = Tok.getLocation();
// If we see an identifier that is not a type name, we normally would
// parse it as the identifer being declared. However, when a typename
@@ -623,7 +623,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
// next token is obviously invalid for a type. Parse these as a case
// with an invalid type specifier.
assert(!DS.hasTypeSpecifier() && "Type specifier checked above");
-
+
// Since we know that this either implicit int (which is rare) or an
// error, we'd do lookahead to try to do better recovery.
if (isValidAfterIdentifierInDeclarator(NextToken())) {
@@ -632,7 +632,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
// identifier in the declarator.
return false;
}
-
+
// Otherwise, if we don't consume this token, we are going to emit an
// error anyway. Try to recover from various common problems. Check
// to see if this was a reference to a tag name without a tag specified.
@@ -642,7 +642,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
if (SS == 0) {
const char *TagName = 0;
tok::TokenKind TagKind = tok::unknown;
-
+
switch (Actions.isTagName(*Tok.getIdentifierInfo(), CurScope)) {
default: break;
case DeclSpec::TST_enum: TagName="enum" ;TagKind=tok::kw_enum ;break;
@@ -650,12 +650,12 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
case DeclSpec::TST_struct:TagName="struct";TagKind=tok::kw_struct;break;
case DeclSpec::TST_class: TagName="class" ;TagKind=tok::kw_class ;break;
}
-
+
if (TagName) {
Diag(Loc, diag::err_use_of_tag_name_without_tag)
<< Tok.getIdentifierInfo() << TagName
<< CodeModificationHint::CreateInsertion(Tok.getLocation(),TagName);
-
+
// Parse this as a tag as if the missing tag were present.
if (TagKind == tok::kw_enum)
ParseEnumSpecifier(Loc, DS, AS);
@@ -664,20 +664,20 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
return true;
}
}
-
+
// Since this is almost certainly an invalid type name, emit a
// diagnostic that says it, eat the token, and mark the declspec as
// invalid.
SourceRange R;
if (SS) R = SS->getRange();
-
+
Diag(Loc, diag::err_unknown_typename) << Tok.getIdentifierInfo() << R;
const char *PrevSpec;
unsigned DiagID;
DS.SetTypeSpecType(DeclSpec::TST_error, Loc, PrevSpec, DiagID);
DS.SetRangeEnd(Tok.getLocation());
ConsumeToken();
-
+
// TODO: Could inject an invalid typedef decl in an enclosing scope to
// avoid rippling error messages on subsequent uses of the same type,
// could be useful if #include was forgotten.
@@ -719,13 +719,13 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
SourceLocation Loc = Tok.getLocation();
switch (Tok.getKind()) {
- default:
+ default:
DoneWithDeclSpec:
// If this is not a declaration specifier token, we're done reading decl
// specifiers. First verify that DeclSpec's are consistent.
DS.Finish(Diags, PP);
return;
-
+
case tok::coloncolon: // ::foo::bar
// Annotate C++ scope specifiers. If we get one, loop.
if (TryAnnotateCXXScopeToken(true))
@@ -738,13 +738,13 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
// We are looking for a qualified typename.
Token Next = NextToken();
- if (Next.is(tok::annot_template_id) &&
+ if (Next.is(tok::annot_template_id) &&
static_cast<TemplateIdAnnotation *>(Next.getAnnotationValue())
->Kind == TNK_Type_template) {
// We have a qualified template-id, e.g., N::A<int>
CXXScopeSpec SS;
ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, true);
- assert(Tok.is(tok::annot_template_id) &&
+ assert(Tok.is(tok::annot_template_id) &&
"ParseOptionalCXXScopeSpecifier not working");
AnnotateTemplateIdTokenAsType(&SS);
continue;
@@ -771,26 +771,26 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
// If the referenced identifier is not a type, then this declspec is
// erroneous: We already checked about that it has no type specifier, and
// C++ doesn't have implicit int. Diagnose it as a typo w.r.t. to the
- // typename.
+ // typename.
if (TypeRep == 0) {
ConsumeToken(); // Eat the scope spec so the identifier is current.
if (ParseImplicitInt(DS, &SS, TemplateInfo, AS)) continue;
goto DoneWithDec