forked from OSchip/llvm-project
Move the "current scope" state from the Parser into Action. This
allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
This commit is contained in:
parent
9b7755fbc6
commit
0be31a2eb7
|
@ -64,7 +64,21 @@ namespace clang {
|
||||||
/// parse to complete accurately. The MinimalAction class does this
|
/// parse to complete accurately. The MinimalAction class does this
|
||||||
/// bare-minimum of tracking to implement this functionality.
|
/// bare-minimum of tracking to implement this functionality.
|
||||||
class Action : public ActionBase {
|
class Action : public ActionBase {
|
||||||
|
/// \brief The parser's current scope.
|
||||||
|
///
|
||||||
|
/// The parser maintains this state here so that is accessible to \c Action
|
||||||
|
/// subclasses via \c getCurScope().
|
||||||
|
Scope *CurScope;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class Parser;
|
||||||
|
|
||||||
|
/// \brief Retrieve the parser's current scope.
|
||||||
|
Scope *getCurScope() const { return CurScope; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Action() : CurScope(0) { }
|
||||||
|
|
||||||
/// Out-of-line virtual destructor to provide home for this class.
|
/// Out-of-line virtual destructor to provide home for this class.
|
||||||
virtual ~Action();
|
virtual ~Action();
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,6 @@ class Parser {
|
||||||
/// and SemaActions for those uses that don't matter.
|
/// and SemaActions for those uses that don't matter.
|
||||||
Action &Actions;
|
Action &Actions;
|
||||||
|
|
||||||
Scope *CurScope;
|
|
||||||
Diagnostic &Diags;
|
Diagnostic &Diags;
|
||||||
|
|
||||||
/// ScopeCache - Cache scopes to reduce malloc traffic.
|
/// ScopeCache - Cache scopes to reduce malloc traffic.
|
||||||
|
@ -141,7 +140,8 @@ public:
|
||||||
Action &getActions() const { return Actions; }
|
Action &getActions() const { return Actions; }
|
||||||
|
|
||||||
const Token &getCurToken() const { return Tok; }
|
const Token &getCurToken() const { return Tok; }
|
||||||
|
Scope *getCurScope() const { return Actions.getCurScope(); }
|
||||||
|
|
||||||
// Type forwarding. All of these are statically 'void*', but they may all be
|
// Type forwarding. All of these are statically 'void*', but they may all be
|
||||||
// different actual classes based on the actions in place.
|
// different actual classes based on the actions in place.
|
||||||
typedef Action::ExprTy ExprTy;
|
typedef Action::ExprTy ExprTy;
|
||||||
|
@ -1347,14 +1347,14 @@ private:
|
||||||
CreatedScope = true;
|
CreatedScope = true;
|
||||||
P.EnterScope(0); // Not a decl scope.
|
P.EnterScope(0); // Not a decl scope.
|
||||||
|
|
||||||
if (!P.Actions.ActOnCXXEnterDeclaratorScope(P.CurScope, SS))
|
if (!P.Actions.ActOnCXXEnterDeclaratorScope(P.getCurScope(), SS))
|
||||||
EnteredScope = true;
|
EnteredScope = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
~DeclaratorScopeObj() {
|
~DeclaratorScopeObj() {
|
||||||
if (EnteredScope) {
|
if (EnteredScope) {
|
||||||
assert(SS.isSet() && "C++ scope was cleared ?");
|
assert(SS.isSet() && "C++ scope was cleared ?");
|
||||||
P.Actions.ActOnCXXExitDeclaratorScope(P.CurScope, SS);
|
P.Actions.ActOnCXXExitDeclaratorScope(P.getCurScope(), SS);
|
||||||
}
|
}
|
||||||
if (CreatedScope)
|
if (CreatedScope)
|
||||||
P.ExitScope();
|
P.ExitScope();
|
||||||
|
|
|
@ -35,10 +35,10 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||||
DeclPtrTy FnD;
|
DeclPtrTy FnD;
|
||||||
if (D.getDeclSpec().isFriendSpecified())
|
if (D.getDeclSpec().isFriendSpecified())
|
||||||
// FIXME: Friend templates
|
// FIXME: Friend templates
|
||||||
FnD = Actions.ActOnFriendFunctionDecl(CurScope, D, true,
|
FnD = Actions.ActOnFriendFunctionDecl(getCurScope(), D, true,
|
||||||
move(TemplateParams));
|
move(TemplateParams));
|
||||||
else // FIXME: pass template information through
|
else // FIXME: pass template information through
|
||||||
FnD = Actions.ActOnCXXMemberDeclarator(CurScope, AS, D,
|
FnD = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS, D,
|
||||||
move(TemplateParams), 0, 0,
|
move(TemplateParams), 0, 0,
|
||||||
/*IsDefinition*/true);
|
/*IsDefinition*/true);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Declarator &D,
|
||||||
|
|
||||||
getCurrentClass().MethodDefs.push_back(LexedMethod(FnD));
|
getCurrentClass().MethodDefs.push_back(LexedMethod(FnD));
|
||||||
getCurrentClass().MethodDefs.back().TemplateScope
|
getCurrentClass().MethodDefs.back().TemplateScope
|
||||||
= CurScope->isTemplateParamScope();
|
= getCurScope()->isTemplateParamScope();
|
||||||
CachedTokens &Toks = getCurrentClass().MethodDefs.back().Toks;
|
CachedTokens &Toks = getCurrentClass().MethodDefs.back().Toks;
|
||||||
|
|
||||||
tok::TokenKind kind = Tok.getKind();
|
tok::TokenKind kind = Tok.getKind();
|
||||||
|
@ -95,7 +95,7 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
|
||||||
bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
|
bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
|
||||||
ParseScope TemplateScope(this, Scope::TemplateParamScope, HasTemplateScope);
|
ParseScope TemplateScope(this, Scope::TemplateParamScope, HasTemplateScope);
|
||||||
if (HasTemplateScope)
|
if (HasTemplateScope)
|
||||||
Actions.ActOnReenterTemplateScope(CurScope, Class.TagOrTemplate);
|
Actions.ActOnReenterTemplateScope(getCurScope(), Class.TagOrTemplate);
|
||||||
|
|
||||||
// The current scope is still active if we're the top-level class.
|
// The current scope is still active if we're the top-level class.
|
||||||
// Otherwise we'll need to push and enter a new scope.
|
// Otherwise we'll need to push and enter a new scope.
|
||||||
|
@ -103,7 +103,7 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
|
||||||
ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
|
ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
|
||||||
HasClassScope);
|
HasClassScope);
|
||||||
if (HasClassScope)
|
if (HasClassScope)
|
||||||
Actions.ActOnStartDelayedMemberDeclarations(CurScope, Class.TagOrTemplate);
|
Actions.ActOnStartDelayedMemberDeclarations(getCurScope(), Class.TagOrTemplate);
|
||||||
|
|
||||||
for (; !Class.MethodDecls.empty(); Class.MethodDecls.pop_front()) {
|
for (; !Class.MethodDecls.empty(); Class.MethodDecls.pop_front()) {
|
||||||
LateParsedMethodDeclaration &LM = Class.MethodDecls.front();
|
LateParsedMethodDeclaration &LM = Class.MethodDecls.front();
|
||||||
|
@ -111,10 +111,10 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
|
||||||
// If this is a member template, introduce the template parameter scope.
|
// If this is a member template, introduce the template parameter scope.
|
||||||
ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
|
ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
|
||||||
if (LM.TemplateScope)
|
if (LM.TemplateScope)
|
||||||
Actions.ActOnReenterTemplateScope(CurScope, LM.Method);
|
Actions.ActOnReenterTemplateScope(getCurScope(), LM.Method);
|
||||||
|
|
||||||
// Start the delayed C++ method declaration
|
// Start the delayed C++ method declaration
|
||||||
Actions.ActOnStartDelayedCXXMethodDeclaration(CurScope, LM.Method);
|
Actions.ActOnStartDelayedCXXMethodDeclaration(getCurScope(), LM.Method);
|
||||||
|
|
||||||
// Introduce the parameters into scope and parse their default
|
// Introduce the parameters into scope and parse their default
|
||||||
// arguments.
|
// arguments.
|
||||||
|
@ -122,7 +122,7 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
|
||||||
Scope::FunctionPrototypeScope|Scope::DeclScope);
|
Scope::FunctionPrototypeScope|Scope::DeclScope);
|
||||||
for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
|
for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
|
||||||
// Introduce the parameter into scope.
|
// Introduce the parameter into scope.
|
||||||
Actions.ActOnDelayedCXXMethodParameter(CurScope, LM.DefaultArgs[I].Param);
|
Actions.ActOnDelayedCXXMethodParameter(getCurScope(), LM.DefaultArgs[I].Param);
|
||||||
|
|
||||||
if (CachedTokens *Toks = LM.DefaultArgs[I].Toks) {
|
if (CachedTokens *Toks = LM.DefaultArgs[I].Toks) {
|
||||||
// Save the current token position.
|
// Save the current token position.
|
||||||
|
@ -161,14 +161,14 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
|
||||||
PrototypeScope.Exit();
|
PrototypeScope.Exit();
|
||||||
|
|
||||||
// Finish the delayed C++ method declaration.
|
// Finish the delayed C++ method declaration.
|
||||||
Actions.ActOnFinishDelayedCXXMethodDeclaration(CurScope, LM.Method);
|
Actions.ActOnFinishDelayedCXXMethodDeclaration(getCurScope(), LM.Method);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned I = 0, N = Class.NestedClasses.size(); I != N; ++I)
|
for (unsigned I = 0, N = Class.NestedClasses.size(); I != N; ++I)
|
||||||
ParseLexedMethodDeclarations(*Class.NestedClasses[I]);
|
ParseLexedMethodDeclarations(*Class.NestedClasses[I]);
|
||||||
|
|
||||||
if (HasClassScope)
|
if (HasClassScope)
|
||||||
Actions.ActOnFinishDelayedMemberDeclarations(CurScope, Class.TagOrTemplate);
|
Actions.ActOnFinishDelayedMemberDeclarations(getCurScope(), Class.TagOrTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseLexedMethodDefs - We finished parsing the member specification of a top
|
/// ParseLexedMethodDefs - We finished parsing the member specification of a top
|
||||||
|
@ -178,7 +178,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
|
||||||
bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
|
bool HasTemplateScope = !Class.TopLevelClass && Class.TemplateScope;
|
||||||
ParseScope TemplateScope(this, Scope::TemplateParamScope, HasTemplateScope);
|
ParseScope TemplateScope(this, Scope::TemplateParamScope, HasTemplateScope);
|
||||||
if (HasTemplateScope)
|
if (HasTemplateScope)
|
||||||
Actions.ActOnReenterTemplateScope(CurScope, Class.TagOrTemplate);
|
Actions.ActOnReenterTemplateScope(getCurScope(), Class.TagOrTemplate);
|
||||||
|
|
||||||
bool HasClassScope = !Class.TopLevelClass;
|
bool HasClassScope = !Class.TopLevelClass;
|
||||||
ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
|
ParseScope ClassScope(this, Scope::ClassScope|Scope::DeclScope,
|
||||||
|
@ -190,7 +190,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
|
||||||
// If this is a member template, introduce the template parameter scope.
|
// If this is a member template, introduce the template parameter scope.
|
||||||
ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
|
ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
|
||||||
if (LM.TemplateScope)
|
if (LM.TemplateScope)
|
||||||
Actions.ActOnReenterTemplateScope(CurScope, LM.D);
|
Actions.ActOnReenterTemplateScope(getCurScope(), LM.D);
|
||||||
|
|
||||||
// Save the current token position.
|
// Save the current token position.
|
||||||
SourceLocation origLoc = Tok.getLocation();
|
SourceLocation origLoc = Tok.getLocation();
|
||||||
|
@ -209,7 +209,7 @@ void Parser::ParseLexedMethodDefs(ParsingClass &Class) {
|
||||||
// Parse the method body. Function body parsing code is similar enough
|
// Parse the method body. Function body parsing code is similar enough
|
||||||
// to be re-used for method bodies as well.
|
// to be re-used for method bodies as well.
|
||||||
ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope);
|
ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope);
|
||||||
Actions.ActOnStartOfFunctionDef(CurScope, LM.D);
|
Actions.ActOnStartOfFunctionDef(getCurScope(), LM.D);
|
||||||
|
|
||||||
if (Tok.is(tok::kw_try)) {
|
if (Tok.is(tok::kw_try)) {
|
||||||
ParseFunctionTryBlock(LM.D);
|
ParseFunctionTryBlock(LM.D);
|
||||||
|
|
|
@ -42,7 +42,7 @@ Action::TypeResult Parser::ParseTypeName(SourceRange *Range) {
|
||||||
if (DeclaratorInfo.isInvalidType())
|
if (DeclaratorInfo.isInvalidType())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return Actions.ActOnTypeName(CurScope, DeclaratorInfo);
|
return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseGNUAttributes - Parse a non-empty attributes list.
|
/// ParseGNUAttributes - Parse a non-empty attributes list.
|
||||||
|
@ -366,7 +366,7 @@ Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
|
||||||
// declaration-specifiers init-declarator-list[opt] ';'
|
// declaration-specifiers init-declarator-list[opt] ';'
|
||||||
if (Tok.is(tok::semi)) {
|
if (Tok.is(tok::semi)) {
|
||||||
if (RequireSemi) ConsumeToken();
|
if (RequireSemi) ConsumeToken();
|
||||||
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(CurScope, AS_none,
|
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS_none,
|
||||||
DS);
|
DS);
|
||||||
DS.complete(TheDecl);
|
DS.complete(TheDecl);
|
||||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||||
|
@ -466,7 +466,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Actions.FinalizeDeclaratorGroup(CurScope, DS,
|
return Actions.FinalizeDeclaratorGroup(getCurScope(), DS,
|
||||||
DeclsInGroup.data(),
|
DeclsInGroup.data(),
|
||||||
DeclsInGroup.size());
|
DeclsInGroup.size());
|
||||||
}
|
}
|
||||||
|
@ -518,12 +518,12 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||||
DeclPtrTy ThisDecl;
|
DeclPtrTy ThisDecl;
|
||||||
switch (TemplateInfo.Kind) {
|
switch (TemplateInfo.Kind) {
|
||||||
case ParsedTemplateInfo::NonTemplate:
|
case ParsedTemplateInfo::NonTemplate:
|
||||||
ThisDecl = Actions.ActOnDeclarator(CurScope, D);
|
ThisDecl = Actions.ActOnDeclarator(getCurScope(), D);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ParsedTemplateInfo::Template:
|
case ParsedTemplateInfo::Template:
|
||||||
case ParsedTemplateInfo::ExplicitSpecialization:
|
case ParsedTemplateInfo::ExplicitSpecialization:
|
||||||
ThisDecl = Actions.ActOnTemplateDeclarator(CurScope,
|
ThisDecl = Actions.ActOnTemplateDeclarator(getCurScope(),
|
||||||
Action::MultiTemplateParamsArg(Actions,
|
Action::MultiTemplateParamsArg(Actions,
|
||||||
TemplateInfo.TemplateParams->data(),
|
TemplateInfo.TemplateParams->data(),
|
||||||
TemplateInfo.TemplateParams->size()),
|
TemplateInfo.TemplateParams->size()),
|
||||||
|
@ -532,7 +532,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||||
|
|
||||||
case ParsedTemplateInfo::ExplicitInstantiation: {
|
case ParsedTemplateInfo::ExplicitInstantiation: {
|
||||||
Action::DeclResult ThisRes
|
Action::DeclResult ThisRes
|
||||||
= Actions.ActOnExplicitInstantiation(CurScope,
|
= Actions.ActOnExplicitInstantiation(getCurScope(),
|
||||||
TemplateInfo.ExternLoc,
|
TemplateInfo.ExternLoc,
|
||||||
TemplateInfo.TemplateLoc,
|
TemplateInfo.TemplateLoc,
|
||||||
D);
|
D);
|
||||||
|
@ -555,11 +555,11 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||||
} else {
|
} else {
|
||||||
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
||||||
EnterScope(0);
|
EnterScope(0);
|
||||||
Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl);
|
Actions.ActOnCXXEnterDeclInitializer(getCurScope(), ThisDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteInitializer(CurScope, ThisDecl);
|
Actions.CodeCompleteInitializer(getCurScope(), ThisDecl);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
SkipUntil(tok::comma, true, true);
|
SkipUntil(tok::comma, true, true);
|
||||||
return ThisDecl;
|
return ThisDecl;
|
||||||
|
@ -568,7 +568,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||||
OwningExprResult Init(ParseInitializer());
|
OwningExprResult Init(ParseInitializer());
|
||||||
|
|
||||||
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
||||||
Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
|
Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl);
|
||||||
ExitScope();
|
ExitScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,14 +586,14 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||||
|
|
||||||
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
||||||
EnterScope(0);
|
EnterScope(0);
|
||||||
Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl);
|
Actions.ActOnCXXEnterDeclInitializer(getCurScope(), ThisDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ParseExpressionList(Exprs, CommaLocs)) {
|
if (ParseExpressionList(Exprs, CommaLocs)) {
|
||||||
SkipUntil(tok::r_paren);
|
SkipUntil(tok::r_paren);
|
||||||
|
|
||||||
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
||||||
Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
|
Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl);
|
||||||
ExitScope();
|
ExitScope();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -604,7 +604,7 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D,
|
||||||
"Unexpected number of commas!");
|
"Unexpected number of commas!");
|
||||||
|
|
||||||
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
|
||||||
Actions.ActOnCXXExitDeclInitializer(CurScope, ThisDecl);
|
Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl);
|
||||||
ExitScope();
|
ExitScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
|
||||||
const char *TagName = 0;
|
const char *TagName = 0;
|
||||||
tok::TokenKind TagKind = tok::unknown;
|
tok::TokenKind TagKind = tok::unknown;
|
||||||
|
|
||||||
switch (Actions.isTagName(*Tok.getIdentifierInfo(), CurScope)) {
|
switch (Actions.isTagName(*Tok.getIdentifierInfo(), getCurScope())) {
|
||||||
default: break;
|
default: break;
|
||||||
case DeclSpec::TST_enum: TagName="enum" ;TagKind=tok::kw_enum ;break;
|
case DeclSpec::TST_enum: TagName="enum" ;TagKind=tok::kw_enum ;break;
|
||||||
case DeclSpec::TST_union: TagName="union" ;TagKind=tok::kw_union ;break;
|
case DeclSpec::TST_union: TagName="union" ;TagKind=tok::kw_union ;break;
|
||||||
|
@ -758,7 +758,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
|
||||||
// diagnostic and attempt to recover.
|
// diagnostic and attempt to recover.
|
||||||
Action::TypeTy *T = 0;
|
Action::TypeTy *T = 0;
|
||||||
if (Actions.DiagnoseUnknownTypeName(*Tok.getIdentifierInfo(), Loc,
|
if (Actions.DiagnoseUnknownTypeName(*Tok.getIdentifierInfo(), Loc,
|
||||||
CurScope, SS, T)) {
|
getCurScope(), SS, T)) {
|
||||||
// The action emitted a diagnostic, so we don't have to.
|
// The action emitted a diagnostic, so we don't have to.
|
||||||
if (T) {
|
if (T) {
|
||||||
// The action has suggested that the type T could be used. Set that as
|
// The action has suggested that the type T could be used. Set that as
|
||||||
|
@ -847,7 +847,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
else if (ObjCImpDecl)
|
else if (ObjCImpDecl)
|
||||||
CCC = Action::CCC_ObjCImplementation;
|
CCC = Action::CCC_ObjCImplementation;
|
||||||
|
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, CCC);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), CCC);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
if ((DSContext == DSC_top_level ||
|
if ((DSContext == DSC_top_level ||
|
||||||
(DSContext == DSC_class && DS.isFriendSpecified())) &&
|
(DSContext == DSC_class && DS.isFriendSpecified())) &&
|
||||||
TemplateId->Name &&
|
TemplateId->Name &&
|
||||||
Actions.isCurrentClassName(*TemplateId->Name, CurScope, &SS)) {
|
Actions.isCurrentClassName(*TemplateId->Name, getCurScope(), &SS)) {
|
||||||
if (isConstructorDeclarator()) {
|
if (isConstructorDeclarator()) {
|
||||||
// The user meant this to be an out-of-line constructor
|
// The user meant this to be an out-of-line constructor
|
||||||
// definition, but template arguments are not allowed
|
// definition, but template arguments are not allowed
|
||||||
|
@ -963,7 +963,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
// check whether this is a constructor declaration.
|
// check whether this is a constructor declaration.
|
||||||
if ((DSContext == DSC_top_level ||
|
if ((DSContext == DSC_top_level ||
|
||||||
(DSContext == DSC_class && DS.isFriendSpecified())) &&
|
(DSContext == DSC_class && DS.isFriendSpecified())) &&
|
||||||
Actions.isCurrentClassName(*Next.getIdentifierInfo(), CurScope,
|
Actions.isCurrentClassName(*Next.getIdentifierInfo(), getCurScope(),
|
||||||
&SS)) {
|
&SS)) {
|
||||||
if (isConstructorDeclarator())
|
if (isConstructorDeclarator())
|
||||||
goto DoneWithDeclSpec;
|
goto DoneWithDeclSpec;
|
||||||
|
@ -979,7 +979,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeTy *TypeRep = Actions.getTypeName(*Next.getIdentifierInfo(),
|
TypeTy *TypeRep = Actions.getTypeName(*Next.getIdentifierInfo(),
|
||||||
Next.getLocation(), CurScope, &SS);
|
Next.getLocation(), getCurScope(), &SS);
|
||||||
|
|
||||||
// If the referenced identifier is not a type, then this declspec is
|
// If the referenced identifier is not a type, then this declspec is
|
||||||
// erroneous: We already checked about that it has no type specifier, and
|
// erroneous: We already checked about that it has no type specifier, and
|
||||||
|
@ -1063,7 +1063,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
|
|
||||||
// It has to be available as a typedef too!
|
// It has to be available as a typedef too!
|
||||||
TypeTy *TypeRep = Actions.getTypeName(*Tok.getIdentifierInfo(),
|
TypeTy *TypeRep = Actions.getTypeName(*Tok.getIdentifierInfo(),
|
||||||
Tok.getLocation(), CurScope);
|
Tok.getLocation(), getCurScope());
|
||||||
|
|
||||||
// If this is not a typedef name, don't parse it as part of the declspec,
|
// If this is not a typedef name, don't parse it as part of the declspec,
|
||||||
// it must be an implicit int or an error.
|
// it must be an implicit int or an error.
|
||||||
|
@ -1075,7 +1075,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
// If we're in a context where the identifier could be a class name,
|
// If we're in a context where the identifier could be a class name,
|
||||||
// check whether this is a constructor declaration.
|
// check whether this is a constructor declaration.
|
||||||
if (getLang().CPlusPlus && DSContext == DSC_class &&
|
if (getLang().CPlusPlus && DSContext == DSC_class &&
|
||||||
Actions.isCurrentClassName(*Tok.getIdentifierInfo(), CurScope) &&
|
Actions.isCurrentClassName(*Tok.getIdentifierInfo(), getCurScope()) &&
|
||||||
isConstructorDeclarator())
|
isConstructorDeclarator())
|
||||||
goto DoneWithDeclSpec;
|
goto DoneWithDeclSpec;
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
|
||||||
// constructor name or specialization, check whether this is a
|
// constructor name or specialization, check whether this is a
|
||||||
// constructor declaration.
|
// constructor declaration.
|
||||||
if (getLang().CPlusPlus && DSContext == DSC_class &&
|
if (getLang().CPlusPlus && DSContext == DSC_class &&
|
||||||
Actions.isCurrentClassName(*TemplateId->Name, CurScope) &&
|
Actions.isCurrentClassName(*TemplateId->Name, getCurScope()) &&
|
||||||
isConstructorDeclarator())
|
isConstructorDeclarator())
|
||||||
goto DoneWithDeclSpec;
|
goto DoneWithDeclSpec;
|
||||||
|
|
||||||
|
@ -1686,7 +1686,7 @@ ParseStructDeclaration(DeclSpec &DS, FieldCallback &Fields) {
|
||||||
// If there are no declarators, this is a free-standing declaration
|
// If there are no declarators, this is a free-standing declaration
|
||||||
// specifier. Let the actions module cope with it.
|
// specifier. Let the actions module cope with it.
|
||||||
if (Tok.is(tok::semi)) {
|
if (Tok.is(tok::semi)) {
|
||||||
Actions.ParsedFreeStandingDeclSpec(CurScope, AS_none, DS);
|
Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS_none, DS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1762,7 +1762,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||||
SourceLocation LBraceLoc = ConsumeBrace();
|
SourceLocation LBraceLoc = ConsumeBrace();
|
||||||
|
|
||||||
ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope);
|
ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope);
|
||||||
Actions.ActOnTagStartDefinition(CurScope, TagDecl);
|
Actions.ActOnTagStartDefinition(getCurScope(), TagDecl);
|
||||||
|
|
||||||
// Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in
|
// Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in
|
||||||
// C++.
|
// C++.
|
||||||
|
@ -1800,7 +1800,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||||
|
|
||||||
virtual DeclPtrTy invoke(FieldDeclarator &FD) {
|
virtual DeclPtrTy invoke(FieldDeclarator &FD) {
|
||||||
// Install the declarator into the current TagDecl.
|
// Install the declarator into the current TagDecl.
|
||||||
DeclPtrTy Field = P.Actions.ActOnField(P.CurScope, TagDecl,
|
DeclPtrTy Field = P.Actions.ActOnField(P.getCurScope(), TagDecl,
|
||||||
FD.D.getDeclSpec().getSourceRange().getBegin(),
|
FD.D.getDeclSpec().getSourceRange().getBegin(),
|
||||||
FD.D, FD.BitfieldSize);
|
FD.D, FD.BitfieldSize);
|
||||||
FieldDecls.push_back(Field);
|
FieldDecls.push_back(Field);
|
||||||
|
@ -1824,7 +1824,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
llvm::SmallVector<DeclPtrTy, 16> Fields;
|
llvm::SmallVector<DeclPtrTy, 16> Fields;
|
||||||
Actions.ActOnDefs(CurScope, TagDecl, Tok.getLocation(),
|
Actions.ActOnDefs(getCurScope(), TagDecl, Tok.getLocation(),
|
||||||
Tok.getIdentifierInfo(), Fields);
|
Tok.getIdentifierInfo(), Fields);
|
||||||
FieldDecls.insert(FieldDecls.end(), Fields.begin(), Fields.end());
|
FieldDecls.insert(FieldDecls.end(), Fields.begin(), Fields.end());
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
|
@ -1852,12 +1852,12 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||||
if (Tok.is(tok::kw___attribute))
|
if (Tok.is(tok::kw___attribute))
|
||||||
AttrList.reset(ParseGNUAttributes());
|
AttrList.reset(ParseGNUAttributes());
|
||||||
|
|
||||||
Actions.ActOnFields(CurScope,
|
Actions.ActOnFields(getCurScope(),
|
||||||
RecordLoc, TagDecl, FieldDecls.data(), FieldDecls.size(),
|
RecordLoc, TagDecl, FieldDecls.data(), FieldDecls.size(),
|
||||||
LBraceLoc, RBraceLoc,
|
LBraceLoc, RBraceLoc,
|
||||||
AttrList.get());
|
AttrList.get());
|
||||||
StructScope.Exit();
|
StructScope.Exit();
|
||||||
Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc);
|
Actions.ActOnTagFinishDefinition(getCurScope(), TagDecl, RBraceLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1879,7 +1879,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||||
// Parse the tag portion of this.
|
// Parse the tag portion of this.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
// Code completion for an enum name.
|
// Code completion for an enum name.
|
||||||
Actions.CodeCompleteTag(CurScope, DeclSpec::TST_enum);
|
Actions.CodeCompleteTag(getCurScope(), DeclSpec::TST_enum);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1953,7 +1953,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||||
SourceLocation TSTLoc = NameLoc.isValid()? NameLoc : StartLoc;
|
SourceLocation TSTLoc = NameLoc.isValid()? NameLoc : StartLoc;
|
||||||
const char *PrevSpec = 0;
|
const char *PrevSpec = 0;
|
||||||
unsigned DiagID;
|
unsigned DiagID;
|
||||||
DeclPtrTy TagDecl = Actions.ActOnTag(CurScope, DeclSpec::TST_enum, TUK,
|
DeclPtrTy TagDecl = Actions.ActOnTag(getCurScope(), DeclSpec::TST_enum, TUK,
|
||||||
StartLoc, SS, Name, NameLoc, Attr.get(),
|
StartLoc, SS, Name, NameLoc, Attr.get(),
|
||||||
AS,
|
AS,
|
||||||
Action::MultiTemplateParamsArg(Actions),
|
Action::MultiTemplateParamsArg(Actions),
|
||||||
|
@ -1967,7 +1967,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeResult Type = Actions.ActOnDependentTag(CurScope, DeclSpec::TST_enum,
|
TypeResult Type = Actions.ActOnDependentTag(getCurScope(), DeclSpec::TST_enum,
|
||||||
TUK, SS, Name, StartLoc,
|
TUK, SS, Name, StartLoc,
|
||||||
NameLoc);
|
NameLoc);
|
||||||
if (Type.isInvalid()) {
|
if (Type.isInvalid()) {
|
||||||
|
@ -2017,7 +2017,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
|
||||||
void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
||||||
// Enter the scope of the enum body and start the definition.
|
// Enter the scope of the enum body and start the definition.
|
||||||
ParseScope EnumScope(this, Scope::DeclScope);
|
ParseScope EnumScope(this, Scope::DeclScope);
|
||||||
Actions.ActOnTagStartDefinition(CurScope, EnumDecl);
|
Actions.ActOnTagStartDefinition(getCurScope(), EnumDecl);
|
||||||
|
|
||||||
SourceLocation LBraceLoc = ConsumeBrace();
|
SourceLocation LBraceLoc = ConsumeBrace();
|
||||||
|
|
||||||
|
@ -2044,7 +2044,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install the enumerator constant into EnumDecl.
|
// Install the enumerator constant into EnumDecl.
|
||||||
DeclPtrTy EnumConstDecl = Actions.ActOnEnumConstant(CurScope, EnumDecl,
|
DeclPtrTy EnumConstDecl = Actions.ActOnEnumConstant(getCurScope(), EnumDecl,
|
||||||
LastEnumConstDecl,
|
LastEnumConstDecl,
|
||||||
IdentLoc, Ident,
|
IdentLoc, Ident,
|
||||||
EqualLoc,
|
EqualLoc,
|
||||||
|
@ -2073,10 +2073,10 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclPtrTy EnumDecl) {
|
||||||
|
|
||||||
Actions.ActOnEnumBody(StartLoc, LBraceLoc, RBraceLoc, EnumDecl,
|
Actions.ActOnEnumBody(StartLoc, LBraceLoc, RBraceLoc, EnumDecl,
|
||||||
EnumConstantDecls.data(), EnumConstantDecls.size(),
|
EnumConstantDecls.data(), EnumConstantDecls.size(),
|
||||||
CurScope, Attr.get());
|
getCurScope(), Attr.get());
|
||||||
|
|
||||||
EnumScope.Exit();
|
EnumScope.Exit();
|
||||||
Actions.ActOnTagFinishDefinition(CurScope, EnumDecl, RBraceLoc);
|
Actions.ActOnTagFinishDefinition(getCurScope(), EnumDecl, RBraceLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isTypeSpecifierQualifier - Return true if the current token could be the
|
/// isTypeSpecifierQualifier - Return true if the current token could be the
|
||||||
|
@ -2361,7 +2361,7 @@ bool Parser::isConstructorDeclarator() {
|
||||||
|
|
||||||
// If we need to, enter the specified scope.
|
// If we need to, enter the specified scope.
|
||||||
DeclaratorScopeObj DeclScopeObj(*this, SS);
|
DeclaratorScopeObj DeclScopeObj(*this, SS);
|
||||||
if (SS.isSet() && Actions.ShouldEnterDeclaratorScope(CurScope, SS))
|
if (SS.isSet() && Actions.ShouldEnterDeclaratorScope(getCurScope(), SS))
|
||||||
DeclScopeObj.EnterDeclaratorScope();
|
DeclScopeObj.EnterDeclaratorScope();
|
||||||
|
|
||||||
// Check whether the next token(s) are part of a declaration
|
// Check whether the next token(s) are part of a declaration
|
||||||
|
@ -2650,7 +2650,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (D.getCXXScopeSpec().isValid()) {
|
if (D.getCXXScopeSpec().isValid()) {
|
||||||
if (Actions.ShouldEnterDeclaratorScope(CurScope, D.getCXXScopeSpec()))
|
if (Actions.ShouldEnterDeclaratorScope(getCurScope(), D.getCXXScopeSpec()))
|
||||||
// Change the declaration context for name lookup, until this function
|
// Change the declaration context for name lookup, until this function
|
||||||
// is exited (and the declarator has been parsed).
|
// is exited (and the declarator has been parsed).
|
||||||
DeclScopeObj.EnterDeclaratorScope();
|
DeclScopeObj.EnterDeclaratorScope();
|
||||||
|
@ -2709,7 +2709,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
|
||||||
// scope when parsing the parenthesized declarator, then exited
|
// scope when parsing the parenthesized declarator, then exited
|
||||||
// the scope already. Re-enter the scope, if we need to.
|
// the scope already. Re-enter the scope, if we need to.
|
||||||
if (D.getCXXScopeSpec().isSet()) {
|
if (D.getCXXScopeSpec().isSet()) {
|
||||||
if (Actions.ShouldEnterDeclaratorScope(CurScope, D.getCXXScopeSpec()))
|
if (Actions.ShouldEnterDeclaratorScope(getCurScope(), D.getCXXScopeSpec()))
|
||||||
// Change the declaration context for name lookup, until this function
|
// Change the declaration context for name lookup, until this function
|
||||||
// is exited (and the declarator has been parsed).
|
// is exited (and the declarator has been parsed).
|
||||||
DeclScopeObj.EnterDeclaratorScope();
|
DeclScopeObj.EnterDeclaratorScope();
|
||||||
|
@ -3046,7 +3046,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
|
||||||
|
|
||||||
// Inform the actions module about the parameter declarator, so it gets
|
// Inform the actions module about the parameter declarator, so it gets
|
||||||
// added to the current scope.
|
// added to the current scope.
|
||||||
DeclPtrTy Param = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
|
DeclPtrTy Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
|
||||||
|
|
||||||
// Parse the default argument, if any. We parse the default
|
// Parse the default argument, if any. We parse the default
|
||||||
// arguments in all dialects; the semantic analysis in
|
// arguments in all dialects; the semantic analysis in
|
||||||
|
@ -3204,7 +3204,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc,
|
||||||
IdentifierInfo *ParmII = Tok.getIdentifierInfo();
|
IdentifierInfo *ParmII = Tok.getIdentifierInfo();
|
||||||
|
|
||||||
// Reject 'typedef int y; int test(x, y)', but continue parsing.
|
// Reject 'typedef int y; int test(x, y)', but continue parsing.
|
||||||
if (Actions.getTypeName(*ParmII, Tok.getLocation(), CurScope))
|
if (Actions.getTypeName(*ParmII, Tok.getLocation(), getCurScope()))
|
||||||
Diag(Tok, diag::err_unexpected_typedef_ident) << ParmII;
|
Diag(Tok, diag::err_unexpected_typedef_ident) << ParmII;
|
||||||
|
|
||||||
// Verify that the argument identifier has not already been mentioned.
|
// Verify that the argument identifier has not already been mentioned.
|
||||||
|
|
|
@ -49,7 +49,7 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||||
SourceLocation NamespaceLoc = ConsumeToken(); // eat the 'namespace'.
|
SourceLocation NamespaceLoc = ConsumeToken(); // eat the 'namespace'.
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteNamespaceDecl(CurScope);
|
Actions.CodeCompleteNamespaceDecl(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +87,9 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||||
|
|
||||||
SourceLocation LBrace = ConsumeBrace();
|
SourceLocation LBrace = ConsumeBrace();
|
||||||
|
|
||||||
if (CurScope->isClassScope() || CurScope->isTemplateParamScope() ||
|
if (getCurScope()->isClassScope() || getCurScope()->isTemplateParamScope() ||
|
||||||
CurScope->isInObjcMethodScope() || CurScope->getBlockParent() ||
|
getCurScope()->isInObjcMethodScope() || getCurScope()->getBlockParent() ||
|
||||||
CurScope->getFnParent()) {
|
getCurScope()->getFnParent()) {
|
||||||
Diag(LBrace, diag::err_namespace_nonnamespace_scope);
|
Diag(LBrace, diag::err_namespace_nonnamespace_scope);
|
||||||
SkipUntil(tok::r_brace, false);
|
SkipUntil(tok::r_brace, false);
|
||||||
return DeclPtrTy();
|
return DeclPtrTy();
|
||||||
|
@ -99,7 +99,7 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context,
|
||||||
ParseScope NamespaceScope(this, Scope::DeclScope);
|
ParseScope NamespaceScope(this, Scope::DeclScope);
|
||||||
|
|
||||||
DeclPtrTy NamespcDecl =
|
DeclPtrTy NamespcDecl =
|
||||||
Actions.ActOnStartNamespaceDef(CurScope, IdentLoc, Ident, LBrace,
|
Actions.ActOnStartNamespaceDef(getCurScope(), IdentLoc, Ident, LBrace,
|
||||||
AttrList.get());
|
AttrList.get());
|
||||||
|
|
||||||
PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
|
PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
|
||||||
|
@ -135,7 +135,7 @@ Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||||
ConsumeToken(); // eat the '='.
|
ConsumeToken(); // eat the '='.
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteNamespaceAliasDecl(CurScope);
|
Actions.CodeCompleteNamespaceAliasDecl(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc,
|
||||||
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_namespace_name,
|
ExpectAndConsume(tok::semi, diag::err_expected_semi_after_namespace_name,
|
||||||
"", tok::semi);
|
"", tok::semi);
|
||||||
|
|
||||||
return Actions.ActOnNamespaceAliasDef(CurScope, NamespaceLoc, AliasLoc, Alias,
|
return Actions.ActOnNamespaceAliasDef(getCurScope(), NamespaceLoc, AliasLoc, Alias,
|
||||||
SS, IdentLoc, Ident);
|
SS, IdentLoc, Ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||||
|
|
||||||
ParseScope LinkageScope(this, Scope::DeclScope);
|
ParseScope LinkageScope(this, Scope::DeclScope);
|
||||||
DeclPtrTy LinkageSpec
|
DeclPtrTy LinkageSpec
|
||||||
= Actions.ActOnStartLinkageSpecification(CurScope,
|
= Actions.ActOnStartLinkageSpecification(getCurScope(),
|
||||||
/*FIXME: */SourceLocation(),
|
/*FIXME: */SourceLocation(),
|
||||||
Loc, Lang,
|
Loc, Lang,
|
||||||
Tok.is(tok::l_brace)? Tok.getLocation()
|
Tok.is(tok::l_brace)? Tok.getLocation()
|
||||||
|
@ -197,7 +197,7 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||||
|
|
||||||
if (Tok.isNot(tok::l_brace)) {
|
if (Tok.isNot(tok::l_brace)) {
|
||||||
ParseDeclarationOrFunctionDefinition(DS, Attr.AttrList);
|
ParseDeclarationOrFunctionDefinition(DS, Attr.AttrList);
|
||||||
return Actions.ActOnFinishLinkageSpecification(CurScope, LinkageSpec,
|
return Actions.ActOnFinishLinkageSpecification(getCurScope(), LinkageSpec,
|
||||||
SourceLocation());
|
SourceLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceLocation RBrace = MatchRHSPunctuation(tok::r_brace, LBrace);
|
SourceLocation RBrace = MatchRHSPunctuation(tok::r_brace, LBrace);
|
||||||
return Actions.ActOnFinishLinkageSpecification(CurScope, LinkageSpec, RBrace);
|
return Actions.ActOnFinishLinkageSpecification(getCurScope(), LinkageSpec, RBrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseUsingDirectiveOrDeclaration - Parse C++ using using-declaration or
|
/// ParseUsingDirectiveOrDeclaration - Parse C++ using using-declaration or
|
||||||
|
@ -230,7 +230,7 @@ Parser::DeclPtrTy Parser::ParseUsingDirectiveOrDeclaration(unsigned Context,
|
||||||
SourceLocation UsingLoc = ConsumeToken();
|
SourceLocation UsingLoc = ConsumeToken();
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteUsing(CurScope);
|
Actions.CodeCompleteUsing(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context,
|
||||||
SourceLocation NamespcLoc = ConsumeToken();
|
SourceLocation NamespcLoc = ConsumeToken();
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteUsingDirective(CurScope);
|
Actions.CodeCompleteUsingDirective(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context,
|
||||||
GNUAttr ? diag::err_expected_semi_after_attribute_list :
|
GNUAttr ? diag::err_expected_semi_after_attribute_list :
|
||||||
diag::err_expected_semi_after_namespace_name, "", tok::semi);
|
diag::err_expected_semi_after_namespace_name, "", tok::semi);
|
||||||
|
|
||||||
return Actions.ActOnUsingDirective(CurScope, UsingLoc, NamespcLoc, SS,
|
return Actions.ActOnUsingDirective(getCurScope(), UsingLoc, NamespcLoc, SS,
|
||||||
IdentLoc, NamespcName, Attr);
|
IdentLoc, NamespcName, Attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ Parser::DeclPtrTy Parser::ParseUsingDeclaration(unsigned Context,
|
||||||
AttrList ? "attributes list" : "using declaration",
|
AttrList ? "attributes list" : "using declaration",
|
||||||
tok::semi);
|
tok::semi);
|
||||||
|
|
||||||
return Actions.ActOnUsingDeclaration(CurScope, AS, true, UsingLoc, SS, Name,
|
return Actions.ActOnUsingDeclaration(getCurScope(), AS, true, UsingLoc, SS, Name,
|
||||||
AttrList.get(), IsTypeName, TypenameLoc);
|
AttrList.get(), IsTypeName, TypenameLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation,
|
||||||
// template-name was wrong. Try to fix that.
|
// template-name was wrong. Try to fix that.
|
||||||
TemplateNameKind TNK = TNK_Type_template;
|
TemplateNameKind TNK = TNK_Type_template;
|
||||||
TemplateTy Template;
|
TemplateTy Template;
|
||||||
if (!Actions.DiagnoseUnknownTemplateName(*Id, IdLoc, CurScope,
|
if (!Actions.DiagnoseUnknownTemplateName(*Id, IdLoc, getCurScope(),
|
||||||
SS, Template, TNK)) {
|
SS, Template, TNK)) {
|
||||||
Diag(IdLoc, diag::err_unknown_template_name)
|
Diag(IdLoc, diag::err_unknown_template_name)
|
||||||
<< Id;
|
<< Id;
|
||||||
|
@ -542,7 +542,7 @@ Parser::TypeResult Parser::ParseClassName(SourceLocation &EndLocation,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have an identifier; check whether it is actually a type.
|
// We have an identifier; check whether it is actually a type.
|
||||||
TypeTy *Type = Actions.getTypeName(*Id, IdLoc, CurScope, SS, true);
|
TypeTy *Type = Actions.getTypeName(*Id, IdLoc, getCurScope(), SS, true);
|
||||||
if (!Type) {
|
if (!Type) {
|
||||||
Diag(IdLoc, diag::err_expected_class_name);
|
Diag(IdLoc, diag::err_expected_class_name);
|
||||||
return true;
|
return true;
|
||||||
|
@ -609,7 +609,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
// Code completion for a struct, class, or union name.
|
// Code completion for a struct, class, or union name.
|
||||||
Actions.CodeCompleteTag(CurScope, TagType);
|
Actions.CodeCompleteTag(getCurScope(), TagType);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||||
TUK == Action::TUK_Declaration) {
|
TUK == Action::TUK_Declaration) {
|
||||||
// This is an explicit instantiation of a class template.
|
// This is an explicit instantiation of a class template.
|
||||||
TagOrTempResult
|
TagOrTempResult
|
||||||
= Actions.ActOnExplicitInstantiation(CurScope,
|
= Actions.ActOnExplicitInstantiation(getCurScope(),
|
||||||
TemplateInfo.ExternLoc,
|
TemplateInfo.ExternLoc,
|
||||||
TemplateInfo.TemplateLoc,
|
TemplateInfo.TemplateLoc,
|
||||||
TagType,
|
TagType,
|
||||||
|
@ -885,7 +885,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||||
|
|
||||||
// Build the class template specialization.
|
// Build the class template specialization.
|
||||||
TagOrTempResult
|
TagOrTempResult
|
||||||
= Actions.ActOnClassTemplateSpecialization(CurScope, TagType, TUK,
|
= Actions.ActOnClassTemplateSpecialization(getCurScope(), TagType, TUK,
|
||||||
StartLoc, SS,
|
StartLoc, SS,
|
||||||
TemplateTy::make(TemplateId->Template),
|
TemplateTy::make(TemplateId->Template),
|
||||||
TemplateId->TemplateNameLoc,
|
TemplateId->TemplateNameLoc,
|
||||||
|
@ -906,7 +906,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||||
// template struct Outer<int>::Inner;
|
// template struct Outer<int>::Inner;
|
||||||
//
|
//
|
||||||
TagOrTempResult
|
TagOrTempResult
|
||||||
= Actions.ActOnExplicitInstantiation(CurScope,
|
= Actions.ActOnExplicitInstantiation(getCurScope(),
|
||||||
TemplateInfo.ExternLoc,
|
TemplateInfo.ExternLoc,
|
||||||
TemplateInfo.TemplateLoc,
|
TemplateInfo.TemplateLoc,
|
||||||
TagType, StartLoc, SS, Name,
|
TagType, StartLoc, SS, Name,
|
||||||
|
@ -920,7 +920,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||||
bool IsDependent = false;
|
bool IsDependent = false;
|
||||||
|
|
||||||
// Declaration or definition of a class type
|
// Declaration or definition of a class type
|
||||||
TagOrTempResult = Actions.ActOnTag(CurScope, TagType, TUK, StartLoc, SS,
|
TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, TUK, StartLoc, SS,
|
||||||
Name, NameLoc, AttrList, AS,
|
Name, NameLoc, AttrList, AS,
|
||||||
Action::MultiTemplateParamsArg(Actions,
|
Action::MultiTemplateParamsArg(Actions,
|
||||||
TemplateParams? &(*TemplateParams)[0] : 0,
|
TemplateParams? &(*TemplateParams)[0] : 0,
|
||||||
|
@ -930,7 +930,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
||||||
// If ActOnTag said the type was dependent, try again with the
|
// If ActOnTag said the type was dependent, try again with the
|
||||||
// less common call.
|
// less common call.
|
||||||
if (IsDependent)
|
if (IsDependent)
|
||||||
TypeResult = Actions.ActOnDependentTag(CurScope, TagType, TUK,
|
TypeResult = Actions.ActOnDependentTag(getCurScope(), TagType, TUK,
|
||||||
SS, Name, StartLoc, NameLoc);
|
SS, Name, StartLoc, NameLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1172,7 +1172,7 @@ void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo,
|
||||||
getCurrentClass().MethodDecls.push_back(
|
getCurrentClass().MethodDecls.push_back(
|
||||||
LateParsedMethodDeclaration(ThisDecl));
|
LateParsedMethodDeclaration(ThisDecl));
|
||||||
LateMethod = &getCurrentClass().MethodDecls.back();
|
LateMethod = &getCurrentClass().MethodDecls.back();
|
||||||
LateMethod->TemplateScope = CurScope->isTemplateParamScope();
|
LateMethod->TemplateScope = getCurScope()->isTemplateParamScope();
|
||||||
|
|
||||||
// Add all of the parameters prior to this one (they don't
|
// Add all of the parameters prior to this one (they don't
|
||||||
// have default arguments).
|
// have default arguments).
|
||||||
|
@ -1249,7 +1249,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||||
tok::semi))
|
tok::semi))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Actions.ActOnUsingDeclaration(CurScope, AS,
|
Actions.ActOnUsingDeclaration(getCurScope(), AS,
|
||||||
false, SourceLocation(),
|
false, SourceLocation(),
|
||||||
SS, Name,
|
SS, Name,
|
||||||
/* AttrList */ 0,
|
/* AttrList */ 0,
|
||||||
|
@ -1327,7 +1327,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||||
|
|
||||||
if (Tok.is(tok::semi)) {
|
if (Tok.is(tok::semi)) {
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
Actions.ParsedFreeStandingDeclSpec(CurScope, AS, DS);
|
Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,11 +1448,11 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||||
DeclPtrTy ThisDecl;
|
DeclPtrTy ThisDecl;
|
||||||
if (DS.isFriendSpecified()) {
|
if (DS.isFriendSpecified()) {
|
||||||
// TODO: handle initializers, bitfields, 'delete'
|
// TODO: handle initializers, bitfields, 'delete'
|
||||||
ThisDecl = Actions.ActOnFriendFunctionDecl(CurScope, DeclaratorInfo,
|
ThisDecl = Actions.ActOnFriendFunctionDecl(getCurScope(), DeclaratorInfo,
|
||||||
/*IsDefinition*/ false,
|
/*IsDefinition*/ false,
|
||||||
move(TemplateParams));
|
move(TemplateParams));
|
||||||
} else {
|
} else {
|
||||||
ThisDecl = Actions.ActOnCXXMemberDeclarator(CurScope, AS,
|
ThisDecl = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS,
|
||||||
DeclaratorInfo,
|
DeclaratorInfo,
|
||||||
move(TemplateParams),
|
move(TemplateParams),
|
||||||
BitfieldSize.release(),
|
BitfieldSize.release(),
|
||||||
|
@ -1504,7 +1504,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actions.FinalizeDeclaratorGroup(CurScope, DS, DeclsInGroup.data(),
|
Actions.FinalizeDeclaratorGroup(getCurScope(), DS, DeclsInGroup.data(),
|
||||||
DeclsInGroup.size());
|
DeclsInGroup.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1528,7 +1528,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
// classes are *not* considered to be nested classes.
|
// classes are *not* considered to be nested classes.
|
||||||
bool NonNestedClass = true;
|
bool NonNestedClass = true;
|
||||||
if (!ClassStack.empty()) {
|
if (!ClassStack.empty()) {
|
||||||
for (const Scope *S = CurScope; S; S = S->getParent()) {
|
for (const Scope *S = getCurScope(); S; S = S->getParent()) {
|
||||||
if (S->isClassScope()) {
|
if (S->isClassScope()) {
|
||||||
// We're inside a class scope, so this is a nested class.
|
// We're inside a class scope, so this is a nested class.
|
||||||
NonNestedClass = false;
|
NonNestedClass = false;
|
||||||
|
@ -1555,7 +1555,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
ParsingClassDefinition ParsingDef(*this, TagDecl, NonNestedClass);
|
ParsingClassDefinition ParsingDef(*this, TagDecl, NonNestedClass);
|
||||||
|
|
||||||
if (TagDecl)
|
if (TagDecl)
|
||||||
Actions.ActOnTagStartDefinition(CurScope, TagDecl);
|
Actions.ActOnTagStartDefinition(getCurScope(), TagDecl);
|
||||||
|
|
||||||
if (Tok.is(tok::colon)) {
|
if (Tok.is(tok::colon)) {
|
||||||
ParseBaseClause(TagDecl);
|
ParseBaseClause(TagDecl);
|
||||||
|
@ -1564,7 +1564,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
Diag(Tok, diag::err_expected_lbrace_after_base_specifiers);
|
Diag(Tok, diag::err_expected_lbrace_after_base_specifiers);
|
||||||
|
|
||||||
if (TagDecl)
|
if (TagDecl)
|
||||||
Actions.ActOnTagDefinitionError(CurScope, TagDecl);
|
Actions.ActOnTagDefinitionError(getCurScope(), TagDecl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1574,7 +1574,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
SourceLocation LBraceLoc = ConsumeBrace();
|
SourceLocation LBraceLoc = ConsumeBrace();
|
||||||
|
|
||||||
if (TagDecl)
|
if (TagDecl)
|
||||||
Actions.ActOnStartCXXMemberDeclarations(CurScope, TagDecl, LBraceLoc);
|
Actions.ActOnStartCXXMemberDeclarations(getCurScope(), TagDecl, LBraceLoc);
|
||||||
|
|
||||||
// C++ 11p3: Members of a class defined with the keyword class are private
|
// C++ 11p3: Members of a class defined with the keyword class are private
|
||||||
// by default. Members of a class defined with the keywords struct or union
|
// by default. Members of a class defined with the keywords struct or union
|
||||||
|
@ -1631,7 +1631,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
AttrList.reset(ParseGNUAttributes());
|
AttrList.reset(ParseGNUAttributes());
|
||||||
|
|
||||||
if (TagDecl)
|
if (TagDecl)
|
||||||
Actions.ActOnFinishCXXMemberSpecification(CurScope, RecordLoc, TagDecl,
|
Actions.ActOnFinishCXXMemberSpecification(getCurScope(), RecordLoc, TagDecl,
|
||||||
LBraceLoc, RBraceLoc,
|
LBraceLoc, RBraceLoc,
|
||||||
AttrList.get());
|
AttrList.get());
|
||||||
|
|
||||||
|
@ -1653,7 +1653,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TagDecl)
|
if (TagDecl)
|
||||||
Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc);
|
Actions.ActOnTagFinishDefinition(getCurScope(), TagDecl, RBraceLoc);
|
||||||
|
|
||||||
// Leave the class scope.
|
// Leave the class scope.
|
||||||
ParsingDef.Pop();
|
ParsingDef.Pop();
|
||||||
|
@ -1766,7 +1766,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclPtrTy ConstructorDecl) {
|
||||||
|
|
||||||
SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
|
SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
|
||||||
|
|
||||||
return Actions.ActOnMemInitializer(ConstructorDecl, CurScope, SS, II,
|
return Actions.ActOnMemInitializer(ConstructorDecl, getCurScope(), SS, II,
|
||||||
TemplateTypeTy, IdLoc,
|
TemplateTypeTy, IdLoc,
|
||||||
LParenLoc, ArgExprs.take(),
|
LParenLoc, ArgExprs.take(),
|
||||||
ArgExprs.size(), CommaLocs.data(),
|
ArgExprs.size(), CommaLocs.data(),
|
||||||
|
@ -1880,9 +1880,9 @@ void Parser::PopParsingClass() {
|
||||||
// This nested class has some members that will need to be processed
|
// This nested class has some members that will need to be processed
|
||||||
// after the top-level class is completely defined. Therefore, add
|
// after the top-level class is completely defined. Therefore, add
|
||||||
// it to the list of nested classes within its parent.
|
// it to the list of nested classes within its parent.
|
||||||
assert(CurScope->isClassScope() && "Nested class outside of class scope?");
|
assert(getCurScope()->isClassScope() && "Nested class outside of class scope?");
|
||||||
ClassStack.top()->NestedClasses.push_back(Victim);
|
ClassStack.top()->NestedClasses.push_back(Victim);
|
||||||
Victim->TemplateScope = CurScope->getParent()->isTemplateParamScope();
|
Victim->TemplateScope = getCurScope()->getParent()->isTemplateParamScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseCXX0XAttributes - Parse a C++0x attribute-specifier. Currently only
|
/// ParseCXX0XAttributes - Parse a C++0x attribute-specifier. Currently only
|
||||||
|
|
|
@ -210,7 +210,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
|
||||||
if (LHS.isInvalid()) return move(LHS);
|
if (LHS.isInvalid()) return move(LHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
LHS = Actions.ActOnUnaryOp(CurScope, ExtLoc, tok::kw___extension__,
|
LHS = Actions.ActOnUnaryOp(getCurScope(), ExtLoc, tok::kw___extension__,
|
||||||
move(LHS));
|
move(LHS));
|
||||||
if (LHS.isInvalid()) return move(LHS);
|
if (LHS.isInvalid()) return move(LHS);
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
|
||||||
///
|
///
|
||||||
Parser::OwningExprResult Parser::ParseAssignmentExpression() {
|
Parser::OwningExprResult Parser::ParseAssignmentExpression() {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Expression);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_Expression);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
|
||||||
// Code completion for the right-hand side of an assignment expression
|
// Code completion for the right-hand side of an assignment expression
|
||||||
// goes through a special hook that takes the left-hand side into account.
|
// goes through a special hook that takes the left-hand side into account.
|
||||||
if (Tok.is(tok::code_completion) && NextTokPrec == prec::Assignment) {
|
if (Tok.is(tok::code_completion) && NextTokPrec == prec::Assignment) {
|
||||||
Actions.CodeCompleteAssignmentRHS(CurScope, LHS.get());
|
Actions.CodeCompleteAssignmentRHS(getCurScope(), LHS.get());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
return ExprError();
|
return ExprError();
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
|
||||||
SourceRange(Actions.getExprRange(LHS.get()).getBegin(),
|
SourceRange(Actions.getExprRange(LHS.get()).getBegin(),
|
||||||
Actions.getExprRange(RHS.get()).getEnd()));
|
Actions.getExprRange(RHS.get()).getEnd()));
|
||||||
|
|
||||||
LHS = Actions.ActOnBinOp(CurScope, OpToken.getLocation(),
|
LHS = Actions.ActOnBinOp(getCurScope(), OpToken.getLocation(),
|
||||||
OpToken.getKind(), move(LHS), move(RHS));
|
OpToken.getKind(), move(LHS), move(RHS));
|
||||||
} else
|
} else
|
||||||
LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
|
LHS = Actions.ActOnConditionalOp(OpToken.getLocation(), ColonLoc,
|
||||||
|
@ -647,9 +647,9 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
|
|
||||||
// Support 'Class.property' and 'super.property' notation.
|
// Support 'Class.property' and 'super.property' notation.
|
||||||
if (getLang().ObjC1 && Tok.is(tok::period) &&
|
if (getLang().ObjC1 && Tok.is(tok::period) &&
|
||||||
(Actions.getTypeName(II, ILoc, CurScope) ||
|
(Actions.getTypeName(II, ILoc, getCurScope()) ||
|
||||||
// Allow the base to be 'super' if in an objc-method.
|
// Allow the base to be 'super' if in an objc-method.
|
||||||
(&II == Ident_super && CurScope->isInObjcMethodScope()))) {
|
(&II == Ident_super && getCurScope()->isInObjcMethodScope()))) {
|
||||||
SourceLocation DotLoc = ConsumeToken();
|
SourceLocation DotLoc = ConsumeToken();
|
||||||
|
|
||||||
if (Tok.isNot(tok::identifier)) {
|
if (Tok.isNot(tok::identifier)) {
|
||||||
|
@ -671,7 +671,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
UnqualifiedId Name;
|
UnqualifiedId Name;
|
||||||
CXXScopeSpec ScopeSpec;
|
CXXScopeSpec ScopeSpec;
|
||||||
Name.setIdentifier(&II, ILoc);
|
Name.setIdentifier(&II, ILoc);
|
||||||
Res = Actions.ActOnIdExpression(CurScope, ScopeSpec, Name,
|
Res = Actions.ActOnIdExpression(getCurScope(), ScopeSpec, Name,
|
||||||
Tok.is(tok::l_paren), false);
|
Tok.is(tok::l_paren), false);
|
||||||
|
|
||||||
// These can be followed by postfix-expr pieces.
|
// These can be followed by postfix-expr pieces.
|
||||||
|
@ -708,7 +708,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
SourceLocation SavedLoc = ConsumeToken();
|
SourceLocation SavedLoc = ConsumeToken();
|
||||||
Res = ParseCastExpression(true);
|
Res = ParseCastExpression(true);
|
||||||
if (!Res.isInvalid())
|
if (!Res.isInvalid())
|
||||||
Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, move(Res));
|
Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
|
||||||
return move(Res);
|
return move(Res);
|
||||||
}
|
}
|
||||||
case tok::amp: { // unary-expression: '&' cast-expression
|
case tok::amp: { // unary-expression: '&' cast-expression
|
||||||
|
@ -716,7 +716,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
SourceLocation SavedLoc = ConsumeToken();
|
SourceLocation SavedLoc = ConsumeToken();
|
||||||
Res = ParseCastExpression(false, true);
|
Res = ParseCastExpression(false, true);
|
||||||
if (!Res.isInvalid())
|
if (!Res.isInvalid())
|
||||||
Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, move(Res));
|
Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
|
||||||
return move(Res);
|
return move(Res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
SourceLocation SavedLoc = ConsumeToken();
|
SourceLocation SavedLoc = ConsumeToken();
|
||||||
Res = ParseCastExpression(false);
|
Res = ParseCastExpression(false);
|
||||||
if (!Res.isInvalid())
|
if (!Res.isInvalid())
|
||||||
Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, move(Res));
|
Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
|
||||||
return move(Res);
|
return move(Res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
SourceLocation SavedLoc = ConsumeToken();
|
SourceLocation SavedLoc = ConsumeToken();
|
||||||
Res = ParseCastExpression(false);
|
Res = ParseCastExpression(false);
|
||||||
if (!Res.isInvalid())
|
if (!Res.isInvalid())
|
||||||
Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, move(Res));
|
Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, move(Res));
|
||||||
return move(Res);
|
return move(Res);
|
||||||
}
|
}
|
||||||
case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression
|
case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression
|
||||||
|
@ -915,7 +915,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
||||||
case tok::caret:
|
case tok::caret:
|
||||||
return ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
|
return ParsePostfixExpressionSuffix(ParseBlockLiteralExpression());
|
||||||
case tok::code_completion:
|
case tok::code_completion:
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Expression);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_Expression);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
return ParseCastExpression(isUnaryExpression, isAddressOfOperand,
|
return ParseCastExpression(isUnaryExpression, isAddressOfOperand,
|
||||||
NotCastExpr, TypeOfCast);
|
NotCastExpr, TypeOfCast);
|
||||||
|
@ -977,7 +977,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
SourceLocation RLoc = Tok.getLocation();
|
SourceLocation RLoc = Tok.getLocation();
|
||||||
|
|
||||||
if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
|
if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
|
||||||
LHS = Actions.ActOnArraySubscriptExpr(CurScope, move(LHS), Loc,
|
LHS = Actions.ActOnArraySubscriptExpr(getCurScope(), move(LHS), Loc,
|
||||||
move(Idx), RLoc);
|
move(Idx), RLoc);
|
||||||
} else
|
} else
|
||||||
LHS = ExprError();
|
LHS = ExprError();
|
||||||
|
@ -999,7 +999,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteCall(CurScope, LHS.get(), 0, 0);
|
Actions.CodeCompleteCall(getCurScope(), LHS.get(), 0, 0);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1020,7 +1020,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
if (!LHS.isInvalid()) {
|
if (!LHS.isInvalid()) {
|
||||||
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
|
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
|
||||||
"Unexpected number of commas!");
|
"Unexpected number of commas!");
|
||||||
LHS = Actions.ActOnCallExpr(CurScope, move(LHS), Loc,
|
LHS = Actions.ActOnCallExpr(getCurScope(), move(LHS), Loc,
|
||||||
move_arg(ArgExprs), CommaLocs.data(),
|
move_arg(ArgExprs), CommaLocs.data(),
|
||||||
Tok.getLocation());
|
Tok.getLocation());
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1039,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
Action::TypeTy *ObjectType = 0;
|
Action::TypeTy *ObjectType = 0;
|
||||||
bool MayBePseudoDestructor = false;
|
bool MayBePseudoDestructor = false;
|
||||||
if (getLang().CPlusPlus && !LHS.isInvalid()) {
|
if (getLang().CPlusPlus && !LHS.isInvalid()) {
|
||||||
LHS = Actions.ActOnStartCXXMemberReference(CurScope, move(LHS),
|
LHS = Actions.ActOnStartCXXMemberReference(getCurScope(), move(LHS),
|
||||||
OpLoc, OpKind, ObjectType,
|
OpLoc, OpKind, ObjectType,
|
||||||
MayBePseudoDestructor);
|
MayBePseudoDestructor);
|
||||||
if (LHS.isInvalid())
|
if (LHS.isInvalid())
|
||||||
|
@ -1053,7 +1053,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
// Code completion for a member access expression.
|
// Code completion for a member access expression.
|
||||||
Actions.CodeCompleteMemberReferenceExpr(CurScope, LHS.get(),
|
Actions.CodeCompleteMemberReferenceExpr(getCurScope(), LHS.get(),
|
||||||
OpLoc, OpKind == tok::arrow);
|
OpLoc, OpKind == tok::arrow);
|
||||||
|
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
|
@ -1080,7 +1080,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
return ExprError();
|
return ExprError();
|
||||||
|
|
||||||
if (!LHS.isInvalid())
|
if (!LHS.isInvalid())
|
||||||
LHS = Actions.ActOnMemberAccessExpr(CurScope, move(LHS), OpLoc,
|
LHS = Actions.ActOnMemberAccessExpr(getCurScope(), move(LHS), OpLoc,
|
||||||
OpKind, SS, Name, ObjCImpDecl,
|
OpKind, SS, Name, ObjCImpDecl,
|
||||||
Tok.is(tok::l_paren));
|
Tok.is(tok::l_paren));
|
||||||
break;
|
break;
|
||||||
|
@ -1088,7 +1088,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
|
||||||
case tok::plusplus: // postfix-expression: postfix-expression '++'
|
case tok::plusplus: // postfix-expression: postfix-expression '++'
|
||||||
case tok::minusminus: // postfix-expression: postfix-expression '--'
|
case tok::minusminus: // postfix-expression: postfix-expression '--'
|
||||||
if (!LHS.isInvalid()) {
|
if (!LHS.isInvalid()) {
|
||||||
LHS = Actions.ActOnPostfixUnaryOp(CurScope, Tok.getLocation(),
|
LHS = Actions.ActOnPostfixUnaryOp(getCurScope(), Tok.getLocation(),
|
||||||
Tok.getKind(), move(LHS));
|
Tok.getKind(), move(LHS));
|
||||||
}
|
}
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
|
@ -1336,7 +1336,7 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
|
||||||
} else if (Ty.isInvalid()) {
|
} else if (Ty.isInvalid()) {
|
||||||
Res = ExprError();
|
Res = ExprError();
|
||||||
} else {
|
} else {
|
||||||
Res = Actions.ActOnBuiltinOffsetOf(CurScope, StartLoc, TypeLoc,
|
Res = Actions.ActOnBuiltinOffsetOf(getCurScope(), StartLoc, TypeLoc,
|
||||||
Ty.get(), &Comps[0],
|
Ty.get(), &Comps[0],
|
||||||
Comps.size(), ConsumeParen());
|
Comps.size(), ConsumeParen());
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1478,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
|
||||||
// Reject the cast of super idiom in ObjC.
|
// Reject the cast of super idiom in ObjC.
|
||||||
if (Tok.is(tok::identifier) && getLang().ObjC1 &&
|
if (Tok.is(tok::identifier) && getLang().ObjC1 &&
|
||||||
Tok.getIdentifierInfo() == Ident_super &&
|
Tok.getIdentifierInfo() == Ident_super &&
|
||||||
CurScope->isInObjcMethodScope() &&
|
getCurScope()->isInObjcMethodScope() &&
|
||||||
GetLookAheadToken(1).isNot(tok::period)) {
|
GetLookAheadToken(1).isNot(tok::period)) {
|
||||||
Diag(Tok.getLocation(), diag::err_illegal_super_cast)
|
Diag(Tok.getLocation(), diag::err_illegal_super_cast)
|
||||||
<< SourceRange(OpenLoc, RParenLoc);
|
<< SourceRange(OpenLoc, RParenLoc);
|
||||||
|
@ -1489,7 +1489,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
|
||||||
// TODO: For cast expression with CastTy.
|
// TODO: For cast expression with CastTy.
|
||||||
Result = ParseCastExpression(false, false, CastTy);
|
Result = ParseCastExpression(false, false, CastTy);
|
||||||
if (!Result.isInvalid())
|
if (!Result.isInvalid())
|
||||||
Result = Actions.ActOnCastExpr(CurScope, OpenLoc, CastTy, RParenLoc,
|
Result = Actions.ActOnCastExpr(getCurScope(), OpenLoc, CastTy, RParenLoc,
|
||||||
move(Result));
|
move(Result));
|
||||||
return move(Result);
|
return move(Result);
|
||||||
}
|
}
|
||||||
|
@ -1588,7 +1588,7 @@ bool Parser::ParseExpressionList(ExprListTy &Exprs, CommaLocsTy &CommaLocs,
|
||||||
while (1) {
|
while (1) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
if (Completer)
|
if (Completer)
|
||||||
(Actions.*Completer)(CurScope, Data, Exprs.data(), Exprs.size());
|
(Actions.*Completer)(getCurScope(), Data, Exprs.data(), Exprs.size());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1630,7 +1630,7 @@ void Parser::ParseBlockId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform sema that we are starting a block.
|
// Inform sema that we are starting a block.
|
||||||
Actions.ActOnBlockArguments(DeclaratorInfo, CurScope);
|
Actions.ActOnBlockArguments(DeclaratorInfo, getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseBlockLiteralExpression - Parse a block literal, which roughly looks
|
/// ParseBlockLiteralExpression - Parse a block literal, which roughly looks
|
||||||
|
@ -1658,7 +1658,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
|
||||||
Scope::DeclScope);
|
Scope::DeclScope);
|
||||||
|
|
||||||
// Inform sema that we are starting a block.
|
// Inform sema that we are starting a block.
|
||||||
Actions.ActOnBlockStart(CaretLoc, CurScope);
|
Actions.ActOnBlockStart(CaretLoc, getCurScope());
|
||||||
|
|
||||||
// Parse the return type if present.
|
// Parse the return type if present.
|
||||||
DeclSpec DS;
|
DeclSpec DS;
|
||||||
|
@ -1681,7 +1681,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
|
||||||
// If there was an error parsing the arguments, they may have
|
// If there was an error parsing the arguments, they may have
|
||||||
// tried to use ^(x+y) which requires an argument list. Just
|
// tried to use ^(x+y) which requires an argument list. Just
|
||||||
// skip the whole block literal.
|
// skip the whole block literal.
|
||||||
Actions.ActOnBlockError(CaretLoc, CurScope);
|
Actions.ActOnBlockError(CaretLoc, getCurScope());
|
||||||
return ExprError();
|
return ExprError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1692,7 +1692,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform sema that we are starting a block.
|
// Inform sema that we are starting a block.
|
||||||
Actions.ActOnBlockArguments(ParamInfo, CurScope);
|
Actions.ActOnBlockArguments(ParamInfo, getCurScope());
|
||||||
} else if (!Tok.is(tok::l_brace)) {
|
} else if (!Tok.is(tok::l_brace)) {
|
||||||
ParseBlockId();
|
ParseBlockId();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1713,7 +1713,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform sema that we are starting a block.
|
// Inform sema that we are starting a block.
|
||||||
Actions.ActOnBlockArguments(ParamInfo, CurScope);
|
Actions.ActOnBlockArguments(ParamInfo, getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1721,14 +1721,14 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
|
||||||
if (!Tok.is(tok::l_brace)) {
|
if (!Tok.is(tok::l_brace)) {
|
||||||
// Saw something like: ^expr
|
// Saw something like: ^expr
|
||||||
Diag(Tok, diag::err_expected_expression);
|
Diag(Tok, diag::err_expected_expression);
|
||||||
Actions.ActOnBlockError(CaretLoc, CurScope);
|
Actions.ActOnBlockError(CaretLoc, getCurScope());
|
||||||
return ExprError();
|
return ExprError();
|
||||||
}
|
}
|
||||||
|
|
||||||
OwningStmtResult Stmt(ParseCompoundStatementBody());
|
OwningStmtResult Stmt(ParseCompoundStatementBody());
|
||||||
if (!Stmt.isInvalid())
|
if (!Stmt.isInvalid())
|
||||||
Result = Actions.ActOnBlockStmtExpr(CaretLoc, move(Stmt), CurScope);
|
Result = Actions.ActOnBlockStmtExpr(CaretLoc, move(Stmt), getCurScope());
|
||||||
else
|
else
|
||||||
Actions.ActOnBlockError(CaretLoc, CurScope);
|
Actions.ActOnBlockError(CaretLoc, getCurScope());
|
||||||
return move(Result);
|
return move(Result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
// '::' - Global scope qualifier.
|
// '::' - Global scope qualifier.
|
||||||
SourceLocation CCLoc = ConsumeToken();
|
SourceLocation CCLoc = ConsumeToken();
|
||||||
SS.setBeginLoc(CCLoc);
|
SS.setBeginLoc(CCLoc);
|
||||||
SS.setScopeRep(Actions.ActOnCXXGlobalScopeSpecifier(CurScope, CCLoc));
|
SS.setScopeRep(Actions.ActOnCXXGlobalScopeSpecifier(getCurScope(), CCLoc));
|
||||||
SS.setEndLoc(CCLoc);
|
SS.setEndLoc(CCLoc);
|
||||||
HasScopeSpecifier = true;
|
HasScopeSpecifier = true;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
// Code completion for a nested-name-specifier, where the code
|
// Code completion for a nested-name-specifier, where the code
|
||||||
// code completion token follows the '::'.
|
// code completion token follows the '::'.
|
||||||
Actions.CodeCompleteQualifiedId(CurScope, SS, EnteringContext);
|
Actions.CodeCompleteQualifiedId(getCurScope(), SS, EnteringContext);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
// Commit to parsing the template-id.
|
// Commit to parsing the template-id.
|
||||||
TPA.Commit();
|
TPA.Commit();
|
||||||
TemplateTy Template;
|
TemplateTy Template;
|
||||||
if (TemplateNameKind TNK = Actions.ActOnDependentTemplateName(CurScope,
|
if (TemplateNameKind TNK = Actions.ActOnDependentTemplateName(getCurScope(),
|
||||||
TemplateKWLoc,
|
TemplateKWLoc,
|
||||||
SS,
|
SS,
|
||||||
TemplateName,
|
TemplateName,
|
||||||
|
@ -214,7 +214,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
|
|
||||||
if (TypeToken.getAnnotationValue())
|
if (TypeToken.getAnnotationValue())
|
||||||
SS.setScopeRep(
|
SS.setScopeRep(
|
||||||
Actions.ActOnCXXNestedNameSpecifier(CurScope, SS,
|
Actions.ActOnCXXNestedNameSpecifier(getCurScope(), SS,
|
||||||
TypeToken.getAnnotationValue(),
|
TypeToken.getAnnotationValue(),
|
||||||
TypeToken.getAnnotationRange(),
|
TypeToken.getAnnotationRange(),
|
||||||
CCLoc));
|
CCLoc));
|
||||||
|
@ -244,7 +244,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
// If we get foo:bar, this is almost certainly a typo for foo::bar. Recover
|
// If we get foo:bar, this is almost certainly a typo for foo::bar. Recover
|
||||||
// and emit a fixit hint for it.
|
// and emit a fixit hint for it.
|
||||||
if (Next.is(tok::colon) && !ColonIsSacred) {
|
if (Next.is(tok::colon) && !ColonIsSacred) {
|
||||||
if (Actions.IsInvalidUnlessNestedName(CurScope, SS, II, ObjectType,
|
if (Actions.IsInvalidUnlessNestedName(getCurScope(), SS, II, ObjectType,
|
||||||
EnteringContext) &&
|
EnteringContext) &&
|
||||||
// If the token after the colon isn't an identifier, it's still an
|
// If the token after the colon isn't an identifier, it's still an
|
||||||
// error, but they probably meant something else strange so don't
|
// error, but they probably meant something else strange so don't
|
||||||
|
@ -260,7 +260,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
|
|
||||||
if (Next.is(tok::coloncolon)) {
|
if (Next.is(tok::coloncolon)) {
|
||||||
if (CheckForDestructor && GetLookAheadToken(2).is(tok::tilde) &&
|
if (CheckForDestructor && GetLookAheadToken(2).is(tok::tilde) &&
|
||||||
!Actions.isNonTypeNestedNameSpecifier(CurScope, SS, Tok.getLocation(),
|
!Actions.isNonTypeNestedNameSpecifier(getCurScope(), SS, Tok.getLocation(),
|
||||||
II, ObjectType)) {
|
II, ObjectType)) {
|
||||||
*MayBePseudoDestructor = true;
|
*MayBePseudoDestructor = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -280,7 +280,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
|
|
||||||
if (!SS.isInvalid())
|
if (!SS.isInvalid())
|
||||||
SS.setScopeRep(
|
SS.setScopeRep(
|
||||||
Actions.ActOnCXXNestedNameSpecifier(CurScope, SS, IdLoc, CCLoc, II,
|
Actions.ActOnCXXNestedNameSpecifier(getCurScope(), SS, IdLoc, CCLoc, II,
|
||||||
ObjectType, EnteringContext));
|
ObjectType, EnteringContext));
|
||||||
SS.setEndLoc(CCLoc);
|
SS.setEndLoc(CCLoc);
|
||||||
continue;
|
continue;
|
||||||
|
@ -293,7 +293,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
UnqualifiedId TemplateName;
|
UnqualifiedId TemplateName;
|
||||||
TemplateName.setIdentifier(&II, Tok.getLocation());
|
TemplateName.setIdentifier(&II, Tok.getLocation());
|
||||||
bool MemberOfUnknownSpecialization;
|
bool MemberOfUnknownSpecialization;
|
||||||
if (TemplateNameKind TNK = Actions.isTemplateName(CurScope, SS,
|
if (TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
|
||||||
TemplateName,
|
TemplateName,
|
||||||
ObjectType,
|
ObjectType,
|
||||||
EnteringContext,
|
EnteringContext,
|
||||||
|
@ -323,7 +323,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
|
||||||
<< FixItHint::CreateInsertion(Tok.getLocation(), "template ");
|
<< FixItHint::CreateInsertion(Tok.getLocation(), "template ");
|
||||||
|
|
||||||
if (TemplateNameKind TNK
|
if (TemplateNameKind TNK
|
||||||
= Actions.ActOnDependentTemplateName(CurScope,
|
= Actions.ActOnDependentTemplateName(getCurScope(),
|
||||||
Tok.getLocation(), SS,
|
Tok.getLocation(), SS,
|
||||||
TemplateName, ObjectType,
|
TemplateName, ObjectType,
|
||||||
EnteringContext, Template)) {
|
EnteringContext, Template)) {
|
||||||
|
@ -431,7 +431,7 @@ Parser::OwningExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Actions.ActOnIdExpression(CurScope, SS, Name, Tok.is(tok::l_paren),
|
return Actions.ActOnIdExpression(getCurScope(), SS, Name, Tok.is(tok::l_paren),
|
||||||
isAddressOfOperand);
|
isAddressOfOperand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,7 @@ Parser::ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
|
||||||
/*TemplateKWLoc*/SourceLocation()))
|
/*TemplateKWLoc*/SourceLocation()))
|
||||||
return ExprError();
|
return ExprError();
|
||||||
|
|
||||||
return Actions.ActOnPseudoDestructorExpr(CurScope, move(Base), OpLoc, OpKind,
|
return Actions.ActOnPseudoDestructorExpr(getCurScope(), move(Base), OpLoc, OpKind,
|
||||||
SS, FirstTypeName, CCLoc,
|
SS, FirstTypeName, CCLoc,
|
||||||
TildeLoc, SecondTypeName,
|
TildeLoc, SecondTypeName,
|
||||||
Tok.is(tok::l_paren));
|
Tok.is(tok::l_paren));
|
||||||
|
@ -678,7 +678,7 @@ Parser::OwningExprResult Parser::ParseCXXThis() {
|
||||||
Parser::OwningExprResult
|
Parser::OwningExprResult
|
||||||
Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
|
Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
|
||||||
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
|
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
|
||||||
TypeTy *TypeRep = Actions.ActOnTypeName(CurScope, DeclaratorInfo).get();
|
TypeTy *TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
|
||||||
|
|
||||||
assert(Tok.is(tok::l_paren) && "Expected '('!");
|
assert(Tok.is(tok::l_paren) && "Expected '('!");
|
||||||
SourceLocation LParenLoc = ConsumeParen();
|
SourceLocation LParenLoc = ConsumeParen();
|
||||||
|
@ -733,7 +733,7 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
|
||||||
SourceLocation Loc,
|
SourceLocation Loc,
|
||||||
bool ConvertToBoolean) {
|
bool ConvertToBoolean) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Condition);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_Condition);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
|
||||||
// If required, convert to a boolean value.
|
// If required, convert to a boolean value.
|
||||||
if (ConvertToBoolean)
|
if (ConvertToBoolean)
|
||||||
ExprResult
|
ExprResult
|
||||||
= Actions.ActOnBooleanCondition(CurScope, Loc, move(ExprResult));
|
= Actions.ActOnBooleanCondition(getCurScope(), Loc, move(ExprResult));
|
||||||
return ExprResult.isInvalid();
|
return ExprResult.isInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type-check the declaration itself.
|
// Type-check the declaration itself.
|
||||||
Action::DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(CurScope,
|
Action::DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
|
||||||
DeclaratorInfo);
|
DeclaratorInfo);
|
||||||
DeclResult = Dcl.get();
|
DeclResult = Dcl.get();
|
||||||
ExprResult = ExprError();
|
ExprResult = ExprError();
|
||||||
|
@ -1016,14 +1016,14 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
||||||
case UnqualifiedId::IK_OperatorFunctionId:
|
case UnqualifiedId::IK_OperatorFunctionId:
|
||||||
case UnqualifiedId::IK_LiteralOperatorId:
|
case UnqualifiedId::IK_LiteralOperatorId:
|
||||||
if (AssumeTemplateId) {
|
if (AssumeTemplateId) {
|
||||||
TNK = Actions.ActOnDependentTemplateName(CurScope, TemplateKWLoc, SS,
|
TNK = Actions.ActOnDependentTemplateName(getCurScope(), TemplateKWLoc, SS,
|
||||||
Id, ObjectType, EnteringContext,
|
Id, ObjectType, EnteringContext,
|
||||||
Template);
|
Template);
|
||||||
if (TNK == TNK_Non_template)
|
if (TNK == TNK_Non_template)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
bool MemberOfUnknownSpecialization;
|
bool MemberOfUnknownSpecialization;
|
||||||
TNK = Actions.isTemplateName(CurScope, SS, Id, ObjectType,
|
TNK = Actions.isTemplateName(getCurScope(), SS, Id, ObjectType,
|
||||||
EnteringContext, Template,
|
EnteringContext, Template,
|
||||||
MemberOfUnknownSpecialization);
|
MemberOfUnknownSpecialization);
|
||||||
|
|
||||||
|
@ -1046,7 +1046,7 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
||||||
Diag(Id.StartLocation, diag::err_missing_dependent_template_keyword)
|
Diag(Id.StartLocation, diag::err_missing_dependent_template_keyword)
|
||||||
<< Name
|
<< Name
|
||||||
<< FixItHint::CreateInsertion(Id.StartLocation, "template ");
|
<< FixItHint::CreateInsertion(Id.StartLocation, "template ");
|
||||||
TNK = Actions.ActOnDependentTemplateName(CurScope, TemplateKWLoc,
|
TNK = Actions.ActOnDependentTemplateName(getCurScope(), TemplateKWLoc,
|
||||||
SS, Id, ObjectType,
|
SS, Id, ObjectType,
|
||||||
EnteringContext, Template);
|
EnteringContext, Template);
|
||||||
if (TNK == TNK_Non_template)
|
if (TNK == TNK_Non_template)
|
||||||
|
@ -1059,7 +1059,7 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
||||||
UnqualifiedId TemplateName;
|
UnqualifiedId TemplateName;
|
||||||
bool MemberOfUnknownSpecialization;
|
bool MemberOfUnknownSpecialization;
|
||||||
TemplateName.setIdentifier(Name, NameLoc);
|
TemplateName.setIdentifier(Name, NameLoc);
|
||||||
TNK = Actions.isTemplateName(CurScope, SS, TemplateName, ObjectType,
|
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateName, ObjectType,
|
||||||
EnteringContext, Template,
|
EnteringContext, Template,
|
||||||
MemberOfUnknownSpecialization);
|
MemberOfUnknownSpecialization);
|
||||||
break;
|
break;
|
||||||
|
@ -1070,13 +1070,13 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
||||||
bool MemberOfUnknownSpecialization;
|
bool MemberOfUnknownSpecialization;
|
||||||
TemplateName.setIdentifier(Name, NameLoc);
|
TemplateName.setIdentifier(Name, NameLoc);
|
||||||
if (ObjectType) {
|
if (ObjectType) {
|
||||||
TNK = Actions.ActOnDependentTemplateName(CurScope, TemplateKWLoc, SS,
|
TNK = Actions.ActOnDependentTemplateName(getCurScope(), TemplateKWLoc, SS,
|
||||||
TemplateName, ObjectType,
|
TemplateName, ObjectType,
|
||||||
EnteringContext, Template);
|
EnteringContext, Template);
|
||||||
if (TNK == TNK_Non_template)
|
if (TNK == TNK_Non_template)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
TNK = Actions.isTemplateName(CurScope, SS, TemplateName, ObjectType,
|
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateName, ObjectType,
|
||||||
EnteringContext, Template,
|
EnteringContext, Template,
|
||||||
MemberOfUnknownSpecialization);
|
MemberOfUnknownSpecialization);
|
||||||
|
|
||||||
|
@ -1273,7 +1273,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext,
|
||||||
|
|
||||||
case tok::code_completion: {
|
case tok::code_completion: {
|
||||||
// Code completion for the operator name.
|
// Code completion for the operator name.
|
||||||
Actions.CodeCompleteOperatorName(CurScope);
|
Actions.CodeCompleteOperatorName(getCurScope());
|
||||||
|
|
||||||
// Consume the operator token.
|
// Consume the operator token.
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
|
@ -1334,7 +1334,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext,
|
||||||
ParseDeclaratorInternal(D, /*DirectDeclParser=*/0);
|
ParseDeclaratorInternal(D, /*DirectDeclParser=*/0);
|
||||||
|
|
||||||
// Finish up the type.
|
// Finish up the type.
|
||||||
Action::TypeResult Ty = Actions.ActOnTypeName(CurScope, D);
|
Action::TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
|
||||||
if (Ty.isInvalid())
|
if (Ty.isInvalid())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1406,9 +1406,9 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AllowConstructorName &&
|
if (AllowConstructorName &&
|
||||||
Actions.isCurrentClassName(*Id, CurScope, &SS)) {
|
Actions.isCurrentClassName(*Id, getCurScope(), &SS)) {
|
||||||
// We have parsed a constructor name.
|
// We have parsed a constructor name.
|
||||||
Result.setConstructorName(Actions.getTypeName(*Id, IdLoc, CurScope,
|
Result.setConstructorName(Actions.getTypeName(*Id, IdLoc, getCurScope(),
|
||||||
&SS, false),
|
&SS, false),
|
||||||
IdLoc, IdLoc);
|
IdLoc, IdLoc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1433,7 +1433,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
|
||||||
|
|
||||||
// If the template-name names the current class, then this is a constructor
|
// If the template-name names the current class, then this is a constructor
|
||||||
if (AllowConstructorName && TemplateId->Name &&
|
if (AllowConstructorName && TemplateId->Name &&
|
||||||
Actions.isCurrentClassName(*TemplateId->Name, CurScope, &SS)) {
|
Actions.isCurrentClassName(*TemplateId->Name, getCurScope(), &SS)) {
|
||||||
if (SS.isSet()) {
|
if (SS.isSet()) {
|
||||||
// C++ [class.qual]p2 specifies that a qualified template-name
|
// C++ [class.qual]p2 specifies that a qualified template-name
|
||||||
// is taken as the constructor name where a constructor can be
|
// is taken as the constructor name where a constructor can be
|
||||||
|
@ -1446,7 +1446,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
|
||||||
SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc));
|
SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc));
|
||||||
Result.setConstructorName(Actions.getTypeName(*TemplateId->Name,
|
Result.setConstructorName(Actions.getTypeName(*TemplateId->Name,
|
||||||
TemplateId->TemplateNameLoc,
|
TemplateId->TemplateNameLoc,
|
||||||
CurScope,
|
getCurScope(),
|
||||||
&SS, false),
|
&SS, false),
|
||||||
TemplateId->TemplateNameLoc,
|
TemplateId->TemplateNameLoc,
|
||||||
TemplateId->RAngleLoc);
|
TemplateId->RAngleLoc);
|
||||||
|
@ -1519,7 +1519,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
|
||||||
|
|
||||||
// Note that this is a destructor name.
|
// Note that this is a destructor name.
|
||||||
Action::TypeTy *Ty = Actions.getDestructorName(TildeLoc, *ClassName,
|
Action::TypeTy *Ty = Actions.getDestructorName(TildeLoc, *ClassName,
|
||||||
ClassNameLoc, CurScope,
|
ClassNameLoc, getCurScope(),
|
||||||
SS, ObjectType,
|
SS, ObjectType,
|
||||||
EnteringContext);
|
EnteringContext);
|
||||||
if (!Ty)
|
if (!Ty)
|
||||||
|
@ -1895,7 +1895,7 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
|
||||||
|
|
||||||
// Result is what ParseCastExpression returned earlier.
|
// Result is what ParseCastExpression returned earlier.
|
||||||
if (!Result.isInvalid())
|
if (!Result.isInvalid())
|
||||||
Result = Actions.ActOnCastExpr(CurScope, LParenLoc, CastTy, RParenLoc,
|
Result = Actions.ActOnCastExpr(getCurScope(), LParenLoc, CastTy, RParenLoc,
|
||||||
move(Result));
|
move(Result));
|
||||||
return move(Result);
|
return move(Result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
|
||||||
if (getLang().ObjC1 && getLang().CPlusPlus) {
|
if (getLang().ObjC1 && getLang().CPlusPlus) {
|
||||||
// Send to 'super'.
|
// Send to 'super'.
|
||||||
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
|
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
|
||||||
NextToken().isNot(tok::period) && CurScope->isInObjcMethodScope()) {
|
NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope()) {
|
||||||
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
|
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
|
||||||
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
|
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
|
||||||
ConsumeToken(), 0,
|
ConsumeToken(), 0,
|
||||||
|
@ -184,7 +184,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
|
||||||
// This is a message send to super: [super foo]
|
// This is a message send to super: [super foo]
|
||||||
// This is a message sent to an expr: [super.bar foo]
|
// This is a message sent to an expr: [super.bar foo]
|
||||||
switch (Action::ObjCMessageKind Kind
|
switch (Action::ObjCMessageKind Kind
|
||||||
= Actions.getObjCMessageKind(CurScope, II, IILoc,
|
= Actions.getObjCMessageKind(getCurScope(), II, IILoc,
|
||||||
II == Ident_super,
|
II == Ident_super,
|
||||||
NextToken().is(tok::period),
|
NextToken().is(tok::period),
|
||||||
ReceiverType)) {
|
ReceiverType)) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtDirectives() {
|
||||||
SourceLocation AtLoc = ConsumeToken(); // the "@"
|
SourceLocation AtLoc = ConsumeToken(); // the "@"
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCAtDirective(CurScope, ObjCImpDecl, false);
|
Actions.CodeCompleteObjCAtDirective(getCurScope(), ObjCImpDecl, false);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||||
|
|
||||||
// Code completion after '@interface'.
|
// Code completion after '@interface'.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCInterfaceDecl(CurScope);
|
Actions.CodeCompleteObjCInterfaceDecl(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||||
SourceLocation categoryLoc, rparenLoc;
|
SourceLocation categoryLoc, rparenLoc;
|
||||||
IdentifierInfo *categoryId = 0;
|
IdentifierInfo *categoryId = 0;
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCInterfaceCategory(CurScope, nameId, nameLoc);
|
Actions.CodeCompleteObjCInterfaceCategory(getCurScope(), nameId, nameLoc);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtInterfaceDeclaration(
|
||||||
|
|
||||||
// Code completion of superclass names.
|
// Code completion of superclass names.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCSuperclass(CurScope, nameId, nameLoc);
|
Actions.CodeCompleteObjCSuperclass(getCurScope(), nameId, nameLoc);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ struct Parser::ObjCPropertyCallback : FieldCallback {
|
||||||
FD.D.getIdentifier());
|
FD.D.getIdentifier());
|
||||||
bool isOverridingProperty = false;
|
bool isOverridingProperty = false;
|
||||||
DeclPtrTy Property =
|
DeclPtrTy Property =
|
||||||
P.Actions.ActOnProperty(P.CurScope, AtLoc, FD, OCDS,
|
P.Actions.ActOnProperty(P.getCurScope(), AtLoc, FD, OCDS,
|
||||||
GetterSel, SetterSel, IDecl,
|
GetterSel, SetterSel, IDecl,
|
||||||
&isOverridingProperty,
|
&isOverridingProperty,
|
||||||
MethodImplKind);
|
MethodImplKind);
|
||||||
|
@ -347,7 +347,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||||
|
|
||||||
// Code completion within an Objective-C interface.
|
// Code completion within an Objective-C interface.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope,
|
Actions.CodeCompleteOrdinaryName(getCurScope(),
|
||||||
ObjCImpDecl? Action::CCC_ObjCImplementation
|
ObjCImpDecl? Action::CCC_ObjCImplementation
|
||||||
: Action::CCC_ObjCInterface);
|
: Action::CCC_ObjCInterface);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
|
@ -370,7 +370,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||||
// Otherwise, we have an @ directive, eat the @.
|
// Otherwise, we have an @ directive, eat the @.
|
||||||
SourceLocation AtLoc = ConsumeToken(); // the "@"
|
SourceLocation AtLoc = ConsumeToken(); // the "@"
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCAtDirective(CurScope, ObjCImpDecl, true);
|
Actions.CodeCompleteObjCAtDirective(getCurScope(), ObjCImpDecl, true);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||||
// We break out of the big loop in two cases: when we see @end or when we see
|
// We break out of the big loop in two cases: when we see @end or when we see
|
||||||
// EOF. In the former case, eat the @end. In the later case, emit an error.
|
// EOF. In the former case, eat the @end. In the later case, emit an error.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCAtDirective(CurScope, ObjCImpDecl, true);
|
Actions.CodeCompleteObjCAtDirective(getCurScope(), ObjCImpDecl, true);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
} else if (Tok.isObjCAtKeyword(tok::objc_end))
|
} else if (Tok.isObjCAtKeyword(tok::objc_end))
|
||||||
ConsumeToken(); // the "end" identifier
|
ConsumeToken(); // the "end" identifier
|
||||||
|
@ -446,7 +446,7 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl,
|
||||||
|
|
||||||
// Insert collected methods declarations into the @interface object.
|
// Insert collected methods declarations into the @interface object.
|
||||||
// This passes in an invalid SourceLocation for AtEndLoc when EOF is hit.
|
// This passes in an invalid SourceLocation for AtEndLoc when EOF is hit.
|
||||||
Actions.ActOnAtEnd(CurScope, AtEnd, interfaceDecl,
|
Actions.ActOnAtEnd(getCurScope(), AtEnd, interfaceDecl,
|
||||||
allMethods.data(), allMethods.size(),
|
allMethods.data(), allMethods.size(),
|
||||||
allProperties.data(), allProperties.size(),
|
allProperties.data(), allProperties.size(),
|
||||||
allTUVariables.data(), allTUVariables.size());
|
allTUVariables.data(), allTUVariables.size());
|
||||||
|
@ -476,7 +476,7 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl,
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCPropertyFlags(CurScope, DS);
|
Actions.CodeCompleteObjCPropertyFlags(getCurScope(), DS);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
const IdentifierInfo *II = Tok.getIdentifierInfo();
|
const IdentifierInfo *II = Tok.getIdentifierInfo();
|
||||||
|
@ -509,10 +509,10 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, DeclPtrTy ClassDecl,
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
if (II->getNameStart()[0] == 's')
|
if (II->getNameStart()[0] == 's')
|
||||||
Actions.CodeCompleteObjCPropertySetter(CurScope, ClassDecl,
|
Actions.CodeCompleteObjCPropertySetter(getCurScope(), ClassDecl,
|
||||||
Methods, NumMethods);
|
Methods, NumMethods);
|
||||||
else
|
else
|
||||||
Actions.CodeCompleteObjCPropertyGetter(CurScope, ClassDecl,
|
Actions.CodeCompleteObjCPropertyGetter(getCurScope(), ClassDecl,
|
||||||
Methods, NumMethods);
|
Methods, NumMethods);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||||
ParsingDeclRAIIObject PD(*this);
|
ParsingDeclRAIIObject PD(*this);
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCMethodDecl(CurScope, mType == tok::minus,
|
Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
|
||||||
/*ReturnType=*/0, IDecl);
|
/*ReturnType=*/0, IDecl);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||||
MethodAttrs.reset(ParseGNUAttributes());
|
MethodAttrs.reset(ParseGNUAttributes());
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCMethodDecl(CurScope, mType == tok::minus,
|
Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
|
||||||
ReturnType, IDecl);
|
ReturnType, IDecl);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc,
|
||||||
Declarator ParmDecl(DS, Declarator::PrototypeContext);
|
Declarator ParmDecl(DS, Declarator::PrototypeContext);
|
||||||
ParseDeclarator(ParmDecl);
|
ParseDeclarator(ParmDecl);
|
||||||
IdentifierInfo *ParmII = ParmDecl.getIdentifier();
|
IdentifierInfo *ParmII = ParmDecl.getIdentifier();
|
||||||
DeclPtrTy Param = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
|
DeclPtrTy Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
|
||||||
CParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
|
CParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
|
||||||
ParmDecl.getIdentifierLoc(),
|
ParmDecl.getIdentifierLoc(),
|
||||||
Param,
|
Param,
|
||||||
|
@ -1025,7 +1025,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||||
ConsumeToken(); // eat the @ sign
|
ConsumeToken(); // eat the @ sign
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCAtVisibility(CurScope);
|
Actions.CodeCompleteObjCAtVisibility(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope,
|
Actions.CodeCompleteOrdinaryName(getCurScope(),
|
||||||
Action::CCC_ObjCInstanceVariableList);
|
Action::CCC_ObjCInstanceVariableList);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
@ -1063,7 +1063,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||||
DeclPtrTy invoke(FieldDeclarator &FD) {
|
DeclPtrTy invoke(FieldDeclarator &FD) {
|
||||||
// Install the declarator into the interface decl.
|
// Install the declarator into the interface decl.
|
||||||
DeclPtrTy Field
|
DeclPtrTy Field
|
||||||
= P.Actions.ActOnIvar(P.CurScope,
|
= P.Actions.ActOnIvar(P.getCurScope(),
|
||||||
FD.D.getDeclSpec().getSourceRange().getBegin(),
|
FD.D.getDeclSpec().getSourceRange().getBegin(),
|
||||||
IDecl, FD.D, FD.BitfieldSize, visibility);
|
IDecl, FD.D, FD.BitfieldSize, visibility);
|
||||||
if (Field)
|
if (Field)
|
||||||
|
@ -1087,7 +1087,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclPtrTy interfaceDecl,
|
||||||
SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
|
SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
|
||||||
// Call ActOnFields() even if we don't have any decls. This is useful
|
// Call ActOnFields() even if we don't have any decls. This is useful
|
||||||
// for code rewriting tools that need to be aware of the empty list.
|
// for code rewriting tools that need to be aware of the empty list.
|
||||||
Actions.ActOnFields(CurScope, atLoc, interfaceDecl,
|
Actions.ActOnFields(getCurScope(), atLoc, interfaceDecl,
|
||||||
AllIvarDecls.data(), AllIvarDecls.size(),
|
AllIvarDecls.data(), AllIvarDecls.size(),
|
||||||
LBraceLoc, RBraceLoc, 0);
|
LBraceLoc, RBraceLoc, 0);
|
||||||
return;
|
return;
|
||||||
|
@ -1116,7 +1116,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
|
||||||
ConsumeToken(); // the "protocol" identifier
|
ConsumeToken(); // the "protocol" identifier
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCProtocolDecl(CurScope);
|
Actions.CodeCompleteObjCProtocolDecl(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1202,7 +1202,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||||
|
|
||||||
// Code completion after '@implementation'.
|
// Code completion after '@implementation'.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCImplementationDecl(CurScope);
|
Actions.CodeCompleteObjCImplementationDecl(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1221,7 +1221,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtImplementationDeclaration(
|
||||||
IdentifierInfo *categoryId = 0;
|
IdentifierInfo *categoryId = 0;
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCImplementationCategory(CurScope, nameId, nameLoc);
|
Actions.CodeCompleteObjCImplementationCategory(getCurScope(), nameId, nameLoc);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,7 +1277,7 @@ Parser::DeclPtrTy Parser::ParseObjCAtEndDeclaration(SourceRange atEnd) {
|
||||||
DeclPtrTy Result = ObjCImpDecl;
|
DeclPtrTy Result = ObjCImpDecl;
|
||||||
ConsumeToken(); // the "end" identifier
|
ConsumeToken(); // the "end" identifier
|
||||||
if (ObjCImpDecl) {
|
if (ObjCImpDecl) {
|
||||||
Actions.ActOnAtEnd(CurScope, atEnd, ObjCImpDecl);
|
Actions.ActOnAtEnd(getCurScope(), atEnd, ObjCImpDecl);
|
||||||
ObjCImpDecl = DeclPtrTy();
|
ObjCImpDecl = DeclPtrTy();
|
||||||
PendingObjCImpDecl.pop_back();
|
PendingObjCImpDecl.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1292,7 @@ Parser::DeclGroupPtrTy Parser::RetrievePendingObjCImpDecl() {
|
||||||
if (PendingObjCImpDecl.empty())
|
if (PendingObjCImpDecl.empty())
|
||||||
return Actions.ConvertDeclToDeclGroup(DeclPtrTy());
|
return Actions.ConvertDeclToDeclGroup(DeclPtrTy());
|
||||||
DeclPtrTy ImpDecl = PendingObjCImpDecl.pop_back_val();
|
DeclPtrTy ImpDecl = PendingObjCImpDecl.pop_back_val();
|
||||||
Actions.ActOnAtEnd(CurScope, SourceRange(), ImpDecl);
|
Actions.ActOnAtEnd(getCurScope(), SourceRange(), ImpDecl);
|
||||||
return Actions.ConvertDeclToDeclGroup(ImpDecl);
|
return Actions.ConvertDeclToDeclGroup(ImpDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1341,7 +1341,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCPropertyDefinition(CurScope, ObjCImpDecl);
|
Actions.CodeCompleteObjCPropertyDefinition(getCurScope(), ObjCImpDecl);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1359,7 +1359,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||||
ConsumeToken(); // consume '='
|
ConsumeToken(); // consume '='
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCPropertySynthesizeIvar(CurScope, propertyId,
|
Actions.CodeCompleteObjCPropertySynthesizeIvar(getCurScope(), propertyId,
|
||||||
ObjCImpDecl);
|
ObjCImpDecl);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
@ -1371,7 +1371,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) {
|
||||||
propertyIvar = Tok.getIdentifierInfo();
|
propertyIvar = Tok.getIdentifierInfo();
|
||||||
ConsumeToken(); // consume ivar-name
|
ConsumeToken(); // consume ivar-name
|
||||||
}
|
}
|
||||||
Actions.ActOnPropertyImplDecl(CurScope, atLoc, propertyLoc, true, ObjCImpDecl,
|
Actions.ActOnPropertyImplDecl(getCurScope(), atLoc, propertyLoc, true, ObjCImpDecl,
|
||||||
propertyId, propertyIvar);
|
propertyId, propertyIvar);
|
||||||
if (Tok.isNot(tok::comma))
|
if (Tok.isNot(tok::comma))
|
||||||
break;
|
break;
|
||||||
|
@ -1399,7 +1399,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
||||||
SourceLocation loc = ConsumeToken(); // consume dynamic
|
SourceLocation loc = ConsumeToken(); // consume dynamic
|
||||||
while (true) {
|
while (true) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCPropertyDefinition(CurScope, ObjCImpDecl);
|
Actions.CodeCompleteObjCPropertyDefinition(getCurScope(), ObjCImpDecl);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1411,7 +1411,7 @@ Parser::DeclPtrTy Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
|
||||||
|
|
||||||
IdentifierInfo *propertyId = Tok.getIdentifierInfo();
|
IdentifierInfo *propertyId = Tok.getIdentifierInfo();
|
||||||
SourceLocation propertyLoc = ConsumeToken(); // consume property name
|
SourceLocation propertyLoc = ConsumeToken(); // consume property name
|
||||||
Actions.ActOnPropertyImplDecl(CurScope, atLoc, propertyLoc, false, ObjCImpDecl,
|
Actions.ActOnPropertyImplDecl(getCurScope(), atLoc, propertyLoc, false, ObjCImpDecl,
|
||||||
propertyId, 0);
|
propertyId, 0);
|
||||||
|
|
||||||
if (Tok.isNot(tok::comma))
|
if (Tok.isNot(tok::comma))
|
||||||
|
@ -1442,7 +1442,7 @@ Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
|
||||||
}
|
}
|
||||||
// consume ';'
|
// consume ';'
|
||||||
ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@throw");
|
ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@throw");
|
||||||
return Actions.ActOnObjCAtThrowStmt(atLoc, move(Res), CurScope);
|
return Actions.ActOnObjCAtThrowStmt(atLoc, move(Res), getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// objc-synchronized-statement:
|
/// objc-synchronized-statement:
|
||||||
|
@ -1536,7 +1536,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
|
||||||
|
|
||||||
// Inform the actions module about the declarator, so it
|
// Inform the actions module about the declarator, so it
|
||||||
// gets added to the current scope.
|
// gets added to the current scope.
|
||||||
FirstPart = Actions.ActOnObjCExceptionDecl(CurScope, ParmDecl);
|
FirstPart = Actions.ActOnObjCExceptionDecl(getCurScope(), ParmDecl);
|
||||||
} else
|
} else
|
||||||
ConsumeToken(); // consume '...'
|
ConsumeToken(); // consume '...'
|
||||||
|
|
||||||
|
@ -1633,7 +1633,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() {
|
||||||
|
|
||||||
// Tell the actions module that we have entered a method definition with the
|
// Tell the actions module that we have entered a method definition with the
|
||||||
// specified Declarator for the method.
|
// specified Declarator for the method.
|
||||||
Actions.ActOnStartOfObjCMethodDef(CurScope, MDecl);
|
Actions.ActOnStartOfObjCMethodDef(getCurScope(), MDecl);
|
||||||
|
|
||||||
OwningStmtResult FnBody(ParseCompoundStatementBody());
|
OwningStmtResult FnBody(ParseCompoundStatementBody());
|
||||||
|
|
||||||
|
@ -1653,7 +1653,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDefinition() {
|
||||||
|
|
||||||
Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
|
Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCAtStatement(CurScope);
|
Actions.CodeCompleteObjCAtStatement(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
return StmtError();
|
return StmtError();
|
||||||
}
|
}
|
||||||
|
@ -1684,7 +1684,7 @@ Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
|
||||||
Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
|
Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
|
||||||
switch (Tok.getKind()) {
|
switch (Tok.getKind()) {
|
||||||
case tok::code_completion:
|
case tok::code_completion:
|
||||||
Actions.CodeCompleteObjCAtExpression(CurScope);
|
Actions.CodeCompleteObjCAtExpression(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
return ExprError();
|
return ExprError();
|
||||||
|
|
||||||
|
@ -1784,7 +1784,7 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) {
|
||||||
// typename-specifier we parsed into a type and parse the
|
// typename-specifier we parsed into a type and parse the
|
||||||
// remainder of the class message.
|
// remainder of the class message.
|
||||||
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
|
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
|
||||||
TypeResult Type = Actions.ActOnTypeName(CurScope, DeclaratorInfo);
|
TypeResult Type = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
|
||||||
if (Type.isInvalid())
|
if (Type.isInvalid())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1819,7 +1819,7 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
|
||||||
SourceLocation LBracLoc = ConsumeBracket(); // consume '['
|
SourceLocation LBracLoc = ConsumeBracket(); // consume '['
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteObjCMessageReceiver(CurScope);
|
Actions.CodeCompleteObjCMessageReceiver(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
SkipUntil(tok::r_square);
|
SkipUntil(tok::r_square);
|
||||||
return ExprError();
|
return ExprError();
|
||||||
|
@ -1833,7 +1833,7 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
|
||||||
// FIXME: This doesn't benefit from the same typo-correction we
|
// FIXME: This doesn't benefit from the same typo-correction we
|
||||||
// get in Objective-C.
|
// get in Objective-C.
|
||||||
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
|
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
|
||||||
NextToken().isNot(tok::period) && CurScope->isInObjcMethodScope())
|
NextToken().isNot(tok::period) && getCurScope()->isInObjcMethodScope())
|
||||||
return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), 0,
|
return ParseObjCMessageExpressionBody(LBracLoc, ConsumeToken(), 0,
|
||||||
ExprArg(Actions));
|
ExprArg(Actions));
|
||||||
|
|
||||||
|
@ -1857,7 +1857,7 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
|
||||||
IdentifierInfo *Name = Tok.getIdentifierInfo();
|
IdentifierInfo *Name = Tok.getIdentifierInfo();
|
||||||
SourceLocation NameLoc = Tok.getLocation();
|
SourceLocation NameLoc = Tok.getLocation();
|
||||||
TypeTy *ReceiverType;
|
TypeTy *ReceiverType;
|
||||||
switch (Actions.getObjCMessageKind(CurScope, Name, NameLoc,
|
switch (Actions.getObjCMessageKind(getCurScope(), Name, NameLoc,
|
||||||
Name == Ident_super,
|
Name == Ident_super,
|
||||||
NextToken().is(tok::period),
|
NextToken().is(tok::period),
|
||||||
ReceiverType)) {
|
ReceiverType)) {
|
||||||
|
@ -1939,11 +1939,11 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
ExprArg ReceiverExpr) {
|
ExprArg ReceiverExpr) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
if (SuperLoc.isValid())
|
if (SuperLoc.isValid())
|
||||||
Actions.CodeCompleteObjCSuperMessage(CurScope, SuperLoc, 0, 0);
|
Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc, 0, 0);
|
||||||
else if (ReceiverType)
|
else if (ReceiverType)
|
||||||
Actions.CodeCompleteObjCClassMessage(CurScope, ReceiverType, 0, 0);
|
Actions.CodeCompleteObjCClassMessage(getCurScope(), ReceiverType, 0, 0);
|
||||||
else
|
else
|
||||||
Actions.CodeCompleteObjCInstanceMessage(CurScope, ReceiverExpr.get(),
|
Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr.get(),
|
||||||
0, 0);
|
0, 0);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
@ -1988,15 +1988,15 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
// Code completion after each argument.
|
// Code completion after each argument.
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
if (SuperLoc.isValid())
|
if (SuperLoc.isValid())
|
||||||
Actions.CodeCompleteObjCSuperMessage(CurScope, SuperLoc,
|
Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc,
|
||||||
KeyIdents.data(),
|
KeyIdents.data(),
|
||||||
KeyIdents.size());
|
KeyIdents.size());
|
||||||
else if (ReceiverType)
|
else if (ReceiverType)
|
||||||
Actions.CodeCompleteObjCClassMessage(CurScope, ReceiverType,
|
Actions.CodeCompleteObjCClassMessage(getCurScope(), ReceiverType,
|
||||||
KeyIdents.data(),
|
KeyIdents.data(),
|
||||||
KeyIdents.size());
|
KeyIdents.size());
|
||||||
else
|
else
|
||||||
Actions.CodeCompleteObjCInstanceMessage(CurScope, ReceiverExpr.get(),
|
Actions.CodeCompleteObjCInstanceMessage(getCurScope(), ReceiverExpr.get(),
|
||||||
KeyIdents.data(),
|
KeyIdents.data(),
|
||||||
KeyIdents.size());
|
KeyIdents.size());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
|
@ -2054,18 +2054,18 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
|
||||||
Selector Sel = PP.getSelectorTable().getSelector(nKeys, &KeyIdents[0]);
|
Selector Sel = PP.getSelectorTable().getSelector(nKeys, &KeyIdents[0]);
|
||||||
|
|
||||||
if (SuperLoc.isValid())
|
if (SuperLoc.isValid())
|
||||||
return Actions.ActOnSuperMessage(CurScope, SuperLoc, Sel,
|
return Actions.ActOnSuperMessage(getCurScope(), SuperLoc, Sel,
|
||||||
LBracLoc, SelectorLoc, RBracLoc,
|
LBracLoc, SelectorLoc, RBracLoc,
|
||||||
Action::MultiExprArg(Actions,
|
Action::MultiExprArg(Actions,
|
||||||
KeyExprs.take(),
|
KeyExprs.take(),
|
||||||
KeyExprs.size()));
|
KeyExprs.size()));
|
||||||
else if (ReceiverType)
|
else if (ReceiverType)
|
||||||
return Actions.ActOnClassMessage(CurScope, ReceiverType, Sel,
|
return Actions.ActOnClassMessage(getCurScope(), ReceiverType, Sel,
|
||||||
LBracLoc, SelectorLoc, RBracLoc,
|
LBracLoc, SelectorLoc, RBracLoc,
|
||||||
Action::MultiExprArg(Actions,
|
Action::MultiExprArg(Actions,
|
||||||
KeyExprs.take(),
|
KeyExprs.take(),
|
||||||
KeyExprs.size()));
|
KeyExprs.size()));
|
||||||
return Actions.ActOnInstanceMessage(CurScope, move(ReceiverExpr), Sel,
|
return Actions.ActOnInstanceMessage(getCurScope(), move(ReceiverExpr), Sel,
|
||||||
LBracLoc, SelectorLoc, RBracLoc,
|
LBracLoc, SelectorLoc, RBracLoc,
|
||||||
Action::MultiExprArg(Actions,
|
Action::MultiExprArg(Actions,
|
||||||
KeyExprs.take(),
|
KeyExprs.take(),
|
||||||
|
|
|
@ -227,7 +227,7 @@ void PragmaUnusedHandler::HandlePragma(Preprocessor &PP, Token &UnusedTok) {
|
||||||
|
|
||||||
// Perform the action to handle the pragma.
|
// Perform the action to handle the pragma.
|
||||||
Actions.ActOnPragmaUnused(Identifiers.data(), Identifiers.size(),
|
Actions.ActOnPragmaUnused(Identifiers.data(), Identifiers.size(),
|
||||||
parser.CurScope, UnusedLoc, LParenLoc, RParenLoc);
|
parser.getCurScope(), UnusedLoc, LParenLoc, RParenLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma weak identifier
|
// #pragma weak identifier
|
||||||
|
|
|
@ -98,7 +98,7 @@ Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case tok::code_completion:
|
case tok::code_completion:
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Statement);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_Statement);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
return ParseStatementOrDeclaration(OnlyStatement);
|
return ParseStatementOrDeclaration(OnlyStatement);
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
|
||||||
SourceLocation CaseLoc = ConsumeToken(); // eat the 'case'.
|
SourceLocation CaseLoc = ConsumeToken(); // eat the 'case'.
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteCase(CurScope);
|
Actions.CodeCompleteCase(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ Parser::OwningStmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
return Actions.ActOnDefaultStmt(DefaultLoc, ColonLoc,
|
return Actions.ActOnDefaultStmt(DefaultLoc, ColonLoc,
|
||||||
move(SubStmt), CurScope);
|
move(SubStmt), getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
|
||||||
// If required, convert to a boolean value.
|
// If required, convert to a boolean value.
|
||||||
if (!ExprResult.isInvalid() && ConvertToBoolean)
|
if (!ExprResult.isInvalid() && ConvertToBoolean)
|
||||||
ExprResult
|
ExprResult
|
||||||
= Actions.ActOnBooleanCondition(CurScope, Loc, move(ExprResult));
|
= Actions.ActOnBooleanCondition(getCurScope(), Loc, move(ExprResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the parser was confused by the condition and we don't have a ')', try to
|
// If the parser was confused by the condition and we don't have a ')', try to
|
||||||
|
@ -670,10 +670,10 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
|
||||||
// Regardless of whether or not InnerScope actually pushed a scope, set the
|
// Regardless of whether or not InnerScope actually pushed a scope, set the
|
||||||
// ElseScope flag for the innermost scope so we can diagnose use of the if
|
// ElseScope flag for the innermost scope so we can diagnose use of the if
|
||||||
// condition variable in C++.
|
// condition variable in C++.
|
||||||
unsigned OldFlags = CurScope->getFlags();
|
unsigned OldFlags = getCurScope()->getFlags();
|
||||||
CurScope->setFlags(OldFlags | Scope::ElseScope);
|
getCurScope()->setFlags(OldFlags | Scope::ElseScope);
|
||||||
ElseStmt = ParseStatement();
|
ElseStmt = ParseStatement();
|
||||||
CurScope->setFlags(OldFlags);
|
getCurScope()->setFlags(OldFlags);
|
||||||
|
|
||||||
// Pop the 'else' scope if needed.
|
// Pop the 'else' scope if needed.
|
||||||
InnerScope.Exit();
|
InnerScope.Exit();
|
||||||
|
@ -999,7 +999,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
|
||||||
DeclPtrTy SecondVar;
|
DeclPtrTy SecondVar;
|
||||||
|
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope,
|
Actions.CodeCompleteOrdinaryName(getCurScope(),
|
||||||
C99orCXXorObjC? Action::CCC_ForInit
|
C99orCXXorObjC? Action::CCC_ForInit
|
||||||
: Action::CCC_Expression);
|
: Action::CCC_Expression);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
|
@ -1063,7 +1063,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
|
||||||
else {
|
else {
|
||||||
Second = ParseExpression();
|
Second = ParseExpression();
|
||||||
if (!Second.isInvalid())
|
if (!Second.isInvalid())
|
||||||
Second = Actions.ActOnBooleanCondition(CurScope, ForLoc,
|
Second = Actions.ActOnBooleanCondition(getCurScope(), ForLoc,
|
||||||
move(Second));
|
move(Second));
|
||||||
}
|
}
|
||||||
SecondPartIsInvalid = Second.isInvalid();
|
SecondPartIsInvalid = Second.isInvalid();
|
||||||
|
@ -1172,7 +1172,7 @@ Parser::OwningStmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
|
||||||
delete Attr;
|
delete Attr;
|
||||||
|
|
||||||
SourceLocation ContinueLoc = ConsumeToken(); // eat the 'continue'.
|
SourceLocation ContinueLoc = ConsumeToken(); // eat the 'continue'.
|
||||||
return Actions.ActOnContinueStmt(ContinueLoc, CurScope);
|
return Actions.ActOnContinueStmt(ContinueLoc, getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseBreakStatement
|
/// ParseBreakStatement
|
||||||
|
@ -1186,7 +1186,7 @@ Parser::OwningStmtResult Parser::ParseBreakStatement(AttributeList *Attr) {
|
||||||
delete Attr;
|
delete Attr;
|
||||||
|
|
||||||
SourceLocation BreakLoc = ConsumeToken(); // eat the 'break'.
|
SourceLocation BreakLoc = ConsumeToken(); // eat the 'break'.
|
||||||
return Actions.ActOnBreakStmt(BreakLoc, CurScope);
|
return Actions.ActOnBreakStmt(BreakLoc, getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseReturnStatement
|
/// ParseReturnStatement
|
||||||
|
@ -1202,7 +1202,7 @@ Parser::OwningStmtResult Parser::ParseReturnStatement(AttributeList *Attr) {
|
||||||
OwningExprResult R(Actions);
|
OwningExprResult R(Actions);
|
||||||
if (Tok.isNot(tok::semi)) {
|
if (Tok.isNot(tok::semi)) {
|
||||||
if (Tok.is(tok::code_completion)) {
|
if (Tok.is(tok::code_completion)) {
|
||||||
Actions.CodeCompleteReturn(CurScope);
|
Actions.CodeCompleteReturn(getCurScope());
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
SkipUntil(tok::semi, false, true);
|
SkipUntil(tok::semi, false, true);
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
@ -1597,7 +1597,7 @@ Parser::OwningStmtResult Parser::ParseCXXCatchBlock() {
|
||||||
return StmtError();
|
return StmtError();
|
||||||
Declarator ExDecl(DS, Declarator::CXXCatchContext);
|
Declarator ExDecl(DS, Declarator::CXXCatchContext);
|
||||||
ParseDeclarator(ExDecl);
|
ParseDeclarator(ExDecl);
|
||||||
ExceptionDecl = Actions.ActOnExceptionDeclarator(CurScope, ExDecl);
|
ExceptionDecl = Actions.ActOnExceptionDeclarator(getCurScope(), ExDecl);
|
||||||
} else
|
} else
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ Parser::ParseSingleDeclarationAfterTemplate(
|
||||||
|
|
||||||
if (Tok.is(tok::semi)) {
|
if (Tok.is(tok::semi)) {
|
||||||
DeclEnd = ConsumeToken();
|
DeclEnd = ConsumeToken();
|
||||||
DeclPtrTy Decl = Actions.ParsedFreeStandingDeclSpec(CurScope, AS, DS);
|
DeclPtrTy Decl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||||
DS.complete(Decl);
|
DS.complete(Decl);
|
||||||
return Decl;
|
return Decl;
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
|
||||||
DefaultArg = ParseTypeName().get();
|
DefaultArg = ParseTypeName().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Actions.ActOnTypeParameter(CurScope, TypenameKeyword, Ellipsis,
|
return Actions.ActOnTypeParameter(getCurScope(), TypenameKeyword, Ellipsis,
|
||||||
EllipsisLoc, KeyLoc, ParamName, NameLoc,
|
EllipsisLoc, KeyLoc, ParamName, NameLoc,
|
||||||
Depth, Position, EqualLoc, DefaultArg);
|
Depth, Position, EqualLoc, DefaultArg);
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Actions.ActOnTemplateTemplateParameter(CurScope, TemplateLoc,
|
return Actions.ActOnTemplateTemplateParameter(getCurScope(), TemplateLoc,
|
||||||
ParamList, ParamName,
|
ParamList, ParamName,
|
||||||
NameLoc, Depth, Position,
|
NameLoc, Depth, Position,
|
||||||
EqualLoc, DefaultArg);
|
EqualLoc, DefaultArg);
|
||||||
|
@ -612,7 +612,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the parameter.
|
// Create the parameter.
|
||||||
return Actions.ActOnNonTypeTemplateParameter(CurScope, ParamDecl,
|
return Actions.ActOnNonTypeTemplateParameter(getCurScope(), ParamDecl,
|
||||||
Depth, Position, EqualLoc,
|
Depth, Position, EqualLoc,
|
||||||
move(DefaultArg));
|
move(DefaultArg));
|
||||||
}
|
}
|
||||||
|
@ -906,7 +906,7 @@ ParsedTemplateArgument Parser::ParseTemplateTemplateArgument() {
|
||||||
// template argument.
|
// template argument.
|
||||||
TemplateTy Template;
|
TemplateTy Template;
|
||||||
if (isEndOfTemplateArgument(Tok) &&
|
if (isEndOfTemplateArgument(Tok) &&
|
||||||
Actions.ActOnDependentTemplateName(CurScope, TemplateLoc, SS, Name,
|
Actions.ActOnDependentTemplateName(getCurScope(), TemplateLoc, SS, Name,
|
||||||
/*ObjectType=*/0,
|
/*ObjectType=*/0,
|
||||||
/*EnteringContext=*/false,
|
/*EnteringContext=*/false,
|
||||||
Template))
|
Template))
|
||||||
|
@ -921,7 +921,7 @@ ParsedTemplateArgument Parser::ParseTemplateTemplateArgument() {
|
||||||
|
|
||||||
if (isEndOfTemplateArgument(Tok)) {
|
if (isEndOfTemplateArgument(Tok)) {
|
||||||
bool MemberOfUnknownSpecialization;
|
bool MemberOfUnknownSpecialization;
|
||||||
TemplateNameKind TNK = Actions.isTemplateName(CurScope, SS, Name,
|
TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS, Name,
|
||||||
/*ObjectType=*/0,
|
/*ObjectType=*/0,
|
||||||
/*EnteringContext=*/false,
|
/*EnteringContext=*/false,
|
||||||
Template,
|
Template,
|
||||||
|
|
|
@ -26,7 +26,7 @@ Parser::Parser(Preprocessor &pp, Action &actions)
|
||||||
GreaterThanIsOperator(true), ColonIsSacred(false),
|
GreaterThanIsOperator(true), ColonIsSacred(false),
|
||||||
TemplateParameterDepth(0) {
|
TemplateParameterDepth(0) {
|
||||||
Tok.setKind(tok::eof);
|
Tok.setKind(tok::eof);
|
||||||
CurScope = 0;
|
Actions.CurScope = 0;
|
||||||
NumCachedScopes = 0;
|
NumCachedScopes = 0;
|
||||||
ParenCount = BracketCount = BraceCount = 0;
|
ParenCount = BracketCount = BraceCount = 0;
|
||||||
ObjCImpDecl = DeclPtrTy();
|
ObjCImpDecl = DeclPtrTy();
|
||||||
|
@ -270,25 +270,25 @@ bool Parser::SkipUntil(const tok::TokenKind *Toks, unsigned NumToks,
|
||||||
void Parser::EnterScope(unsigned ScopeFlags) {
|
void Parser::EnterScope(unsigned ScopeFlags) {
|
||||||
if (NumCachedScopes) {
|
if (NumCachedScopes) {
|
||||||
Scope *N = ScopeCache[--NumCachedScopes];
|
Scope *N = ScopeCache[--NumCachedScopes];
|
||||||
N->Init(CurScope, ScopeFlags);
|
N->Init(getCurScope(), ScopeFlags);
|
||||||
CurScope = N;
|
Actions.CurScope = N;
|
||||||
} else {
|
} else {
|
||||||
CurScope = new Scope(CurScope, ScopeFlags);
|
Actions.CurScope = new Scope(getCurScope(), ScopeFlags);
|
||||||
}
|
}
|
||||||
CurScope->setNumErrorsAtStart(Diags.getNumErrors());
|
getCurScope()->setNumErrorsAtStart(Diags.getNumErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ExitScope - Pop a scope off the scope stack.
|
/// ExitScope - Pop a scope off the scope stack.
|
||||||
void Parser::ExitScope() {
|
void Parser::ExitScope() {
|
||||||
assert(CurScope && "Scope imbalance!");
|
assert(getCurScope() && "Scope imbalance!");
|
||||||
|
|
||||||
// Inform the actions module that this scope is going away if there are any
|
// Inform the actions module that this scope is going away if there are any
|
||||||
// decls in it.
|
// decls in it.
|
||||||
if (!CurScope->decl_empty())
|
if (!getCurScope()->decl_empty())
|
||||||
Actions.ActOnPopScope(Tok.getLocation(), CurScope);
|
Actions.ActOnPopScope(Tok.getLocation(), getCurScope());
|
||||||
|
|
||||||
Scope *OldScope = CurScope;
|
Scope *OldScope = getCurScope();
|
||||||
CurScope = OldScope->getParent();
|
Actions.CurScope = OldScope->getParent();
|
||||||
|
|
||||||
if (NumCachedScopes == ScopeCacheSize)
|
if (NumCachedScopes == ScopeCacheSize)
|
||||||
delete OldScope;
|
delete OldScope;
|
||||||
|
@ -305,8 +305,9 @@ void Parser::ExitScope() {
|
||||||
|
|
||||||
Parser::~Parser() {
|
Parser::~Parser() {
|
||||||
// If we still have scopes active, delete the scope tree.
|
// If we still have scopes active, delete the scope tree.
|
||||||
delete CurScope;
|
delete getCurScope();
|
||||||
|
Actions.CurScope = 0;
|
||||||
|
|
||||||
// Free the scope cache.
|
// Free the scope cache.
|
||||||
for (unsigned i = 0, e = NumCachedScopes; i != e; ++i)
|
for (unsigned i = 0, e = NumCachedScopes; i != e; ++i)
|
||||||
delete ScopeCache[i];
|
delete ScopeCache[i];
|
||||||
|
@ -329,9 +330,9 @@ void Parser::Initialize() {
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
|
|
||||||
// Create the translation unit scope. Install it as the current scope.
|
// Create the translation unit scope. Install it as the current scope.
|
||||||
assert(CurScope == 0 && "A scope is already active?");
|
assert(getCurScope() == 0 && "A scope is already active?");
|
||||||
EnterScope(Scope::DeclScope);
|
EnterScope(Scope::DeclScope);
|
||||||
Actions.ActOnTranslationUnitScope(Tok.getLocation(), CurScope);
|
Actions.ActOnTranslationUnitScope(Tok.getLocation(), getCurScope());
|
||||||
|
|
||||||
if (Tok.is(tok::eof) &&
|
if (Tok.is(tok::eof) &&
|
||||||
!getLang().CPlusPlus) // Empty source file is an extension in C
|
!getLang().CPlusPlus) // Empty source file is an extension in C
|
||||||
|
@ -384,7 +385,7 @@ void Parser::ParseTranslationUnit() {
|
||||||
/*parse them all*/;
|
/*parse them all*/;
|
||||||
|
|
||||||
ExitScope();
|
ExitScope();
|
||||||
assert(CurScope == 0 && "Scope imbalance!");
|
assert(getCurScope() == 0 && "Scope imbalance!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseExternalDeclaration:
|
/// ParseExternalDeclaration:
|
||||||
|
@ -466,7 +467,7 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr)
|
||||||
SingleDecl = ParseObjCMethodDefinition();
|
SingleDecl = ParseObjCMethodDefinition();
|
||||||
break;
|
break;
|
||||||
case tok::code_completion:
|
case tok::code_completion:
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope,
|
Actions.CodeCompleteOrdinaryName(getCurScope(),
|
||||||
ObjCImpDecl? Action::CCC_ObjCImplementation
|
ObjCImpDecl? Action::CCC_ObjCImplementation
|
||||||
: Action::CCC_Namespace);
|
: Action::CCC_Namespace);
|
||||||
ConsumeCodeCompletionToken();
|
ConsumeCodeCompletionToken();
|
||||||
|
@ -560,7 +561,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS,
|
||||||
// declaration-specifiers init-declarator-list[opt] ';'
|
// declaration-specifiers init-declarator-list[opt] ';'
|
||||||
if (Tok.is(tok::semi)) {
|
if (Tok.is(tok::semi)) {
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(CurScope, AS, DS);
|
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, DS);
|
||||||
DS.complete(TheDecl);
|
DS.complete(TheDecl);
|
||||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||||
}
|
}
|
||||||
|
@ -671,12 +672,12 @@ Parser::DeclPtrTy Parser::ParseFunctionDefinition(ParsingDeclarator &D,
|
||||||
// Tell the actions module that we have entered a function definition with the
|
// Tell the actions module that we have entered a function definition with the
|
||||||
// specified Declarator for the function.
|
// specified Declarator for the function.
|
||||||
DeclPtrTy Res = TemplateInfo.TemplateParams?
|
DeclPtrTy Res = TemplateInfo.TemplateParams?
|
||||||
Actions.ActOnStartOfFunctionTemplateDef(CurScope,
|
Actions.ActOnStartOfFunctionTemplateDef(getCurScope(),
|
||||||
Action::MultiTemplateParamsArg(Actions,
|
Action::MultiTemplateParamsArg(Actions,
|
||||||
TemplateInfo.TemplateParams->data(),
|
TemplateInfo.TemplateParams->data(),
|
||||||
TemplateInfo.TemplateParams->size()),
|
TemplateInfo.TemplateParams->size()),
|
||||||
D)
|
D)
|
||||||
: Actions.ActOnStartOfFunctionDef(CurScope, D);
|
: Actions.ActOnStartOfFunctionDef(getCurScope(), D);
|
||||||
|
|
||||||
// Break out of the ParsingDeclarator context before we parse the body.
|
// Break out of the ParsingDeclarator context before we parse the body.
|
||||||
D.complete(Res);
|
D.complete(Res);
|
||||||
|
@ -762,7 +763,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
|
||||||
|
|
||||||
// Ask the actions module to compute the type for this declarator.
|
// Ask the actions module to compute the type for this declarator.
|
||||||
Action::DeclPtrTy Param =
|
Action::DeclPtrTy Param =
|
||||||
Actions.ActOnParamDeclarator(CurScope, ParmDeclarator);
|
Actions.ActOnParamDeclarator(getCurScope(), ParmDeclarator);
|
||||||
|
|
||||||
if (Param &&
|
if (Param &&
|
||||||
// A missing identifier has already been diagnosed.
|
// A missing identifier has already been diagnosed.
|
||||||
|
@ -818,7 +819,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The actions module must verify that all arguments were declared.
|
// The actions module must verify that all arguments were declared.
|
||||||
Actions.ActOnFinishKNRParamDeclarations(CurScope, D, Tok.getLocation());
|
Actions.ActOnFinishKNRParamDeclarations(getCurScope(), D, Tok.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -930,7 +931,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
|
||||||
TypeResult Ty;
|
TypeResult Ty;
|
||||||
if (Tok.is(tok::identifier)) {
|
if (Tok.is(tok::identifier)) {
|
||||||
// FIXME: check whether the next token is '<', first!
|
// FIXME: check whether the next token is '<', first!
|
||||||
Ty = Actions.ActOnTypenameType(CurScope, TypenameLoc, SS,
|
Ty = Actions.ActOnTypenameType(getCurScope(), TypenameLoc, SS,
|
||||||
*Tok.getIdentifierInfo(),
|
*Tok.getIdentifierInfo(),
|
||||||
Tok.getLocation());
|
Tok.getLocation());
|
||||||
} else if (Tok.is(tok::annot_template_id)) {
|
} else if (Tok.is(tok::annot_template_id)) {
|
||||||
|
@ -946,7 +947,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
|
||||||
assert(Tok.is(tok::annot_typename) &&
|
assert(Tok.is(tok::annot_typename) &&
|
||||||
"AnnotateTemplateIdTokenAsType isn't working properly");
|
"AnnotateTemplateIdTokenAsType isn't working properly");
|
||||||
if (Tok.getAnnotationValue())
|
if (Tok.getAnnotationValue())
|
||||||
Ty = Actions.ActOnTypenameType(CurScope, TypenameLoc, SS,
|
Ty = Actions.ActOnTypenameType(getCurScope(), TypenameLoc, SS,
|
||||||
SourceLocation(),
|
SourceLocation(),
|
||||||
Tok.getAnnotationValue());
|
Tok.getAnnotationValue());
|
||||||
else
|
else
|
||||||
|
@ -977,7 +978,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
|
||||||
if (Tok.is(tok::identifier)) {
|
if (Tok.is(tok::identifier)) {
|
||||||
// Determine whether the identifier is a type name.
|
// Determine whether the identifier is a type name.
|
||||||
if (TypeTy *Ty = Actions.getTypeName(*Tok.getIdentifierInfo(),
|
if (TypeTy *Ty = Actions.getTypeName(*Tok.getIdentifierInfo(),
|
||||||
Tok.getLocation(), CurScope, &SS)) {
|
Tok.getLocation(), getCurScope(), &SS)) {
|
||||||
// This is a typename. Replace the current token in-place with an
|
// This is a typename. Replace the current token in-place with an
|
||||||
// annotation type token.
|
// annotation type token.
|
||||||
Tok.setKind(tok::annot_typename);
|
Tok.setKind(tok::annot_typename);
|
||||||
|
@ -1006,7 +1007,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) {
|
||||||
TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
|
TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
|
||||||
bool MemberOfUnknownSpecialization;
|
bool MemberOfUnknownSpecialization;
|
||||||
if (TemplateNameKind TNK
|
if (TemplateNameKind TNK
|
||||||
= Actions.isTemplateName(CurScope, SS, TemplateName,
|
= Actions.isTemplateName(getCurScope(), SS, TemplateName,
|
||||||
/*ObjectType=*/0, EnteringContext,
|
/*ObjectType=*/0, EnteringContext,
|
||||||
Template, MemberOfUnknownSpecialization)) {
|
Template, MemberOfUnknownSpecialization)) {
|
||||||
// Consume the identifier.
|
// Consume the identifier.
|
||||||
|
@ -1097,19 +1098,19 @@ bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::CodeCompletionRecovery() {
|
void Parser::CodeCompletionRecovery() {
|
||||||
for (Scope *S = CurScope; S; S = S->getParent()) {
|
for (Scope *S = getCurScope(); S; S = S->getParent()) {
|
||||||
if (S->getFlags() & Scope::FnScope) {
|
if (S->getFlags() & Scope::FnScope) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_RecoveryInFunction);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_RecoveryInFunction);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S->getFlags() & Scope::ClassScope) {
|
if (S->getFlags() & Scope::ClassScope) {
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Class);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_Class);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Namespace);
|
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::CCC_Namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anchor the Parser::FieldCallback vtable to this translation unit.
|
// Anchor the Parser::FieldCallback vtable to this translation unit.
|
||||||
|
|
|
@ -385,6 +385,31 @@ Sema::Diag(SourceLocation Loc, const PartialDiagnostic& PD) {
|
||||||
return Builder;
|
return Builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief Determines the active Scope associated with the given declaration
|
||||||
|
/// context.
|
||||||
|
///
|
||||||
|
/// This routine maps a declaration context to the active Scope object that
|
||||||
|
/// represents that declaration context in the parser. It is typically used
|
||||||
|
/// from "scope-less" code (e.g., template instantiation, lazy creation of
|
||||||
|
/// declarations) that injects a name for name-lookup purposes and, therefore,
|
||||||
|
/// must update the Scope.
|
||||||
|
///
|
||||||
|
/// \returns The scope corresponding to the given declaraion context, or NULL
|
||||||
|
/// if no such scope is open.
|
||||||
|
Scope *Sema::getScopeForContext(DeclContext *Ctx) {
|
||||||
|
|
||||||
|
if (!Ctx)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
Ctx = Ctx->getPrimaryContext();
|
||||||
|
for (Scope *S = getCurScope(); S; S = S->getParent()) {
|
||||||
|
if (DeclContext *Entity = static_cast<DeclContext *> (S->getEntity()))
|
||||||
|
if (Ctx == Entity->getPrimaryContext())
|
||||||
|
return S;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Enter a new function scope
|
/// \brief Enter a new function scope
|
||||||
void Sema::PushFunctionScope() {
|
void Sema::PushFunctionScope() {
|
||||||
|
|
|
@ -674,6 +674,8 @@ public:
|
||||||
|
|
||||||
virtual void ActOnEndOfTranslationUnit();
|
virtual void ActOnEndOfTranslationUnit();
|
||||||
|
|
||||||
|
Scope *getScopeForContext(DeclContext *Ctx);
|
||||||
|
|
||||||
void PushFunctionScope();
|
void PushFunctionScope();
|
||||||
void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
|
void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
|
||||||
void PopFunctionOrBlockScope();
|
void PopFunctionOrBlockScope();
|
||||||
|
@ -2223,14 +2225,11 @@ public:
|
||||||
|
|
||||||
/// \brief Declare the implicit default constructor for the given class.
|
/// \brief Declare the implicit default constructor for the given class.
|
||||||
///
|
///
|
||||||
/// \param S The scope of the class, which may be NULL if this is a
|
|
||||||
/// template instantiation.
|
|
||||||
///
|
|
||||||
/// \param ClassDecl The class declaration into which the implicit
|
/// \param ClassDecl The class declaration into which the implicit
|
||||||
/// default constructor will be added.
|
/// default constructor will be added.
|
||||||
///
|
///
|
||||||
/// \returns The implicitly-declared default constructor.
|
/// \returns The implicitly-declared default constructor.
|
||||||
CXXConstructorDecl *DeclareImplicitDefaultConstructor(Scope *S,
|
CXXConstructorDecl *DeclareImplicitDefaultConstructor(
|
||||||
CXXRecordDecl *ClassDecl);
|
CXXRecordDecl *ClassDecl);
|
||||||
|
|
||||||
/// DefineImplicitDefaultConstructor - Checks for feasibility of
|
/// DefineImplicitDefaultConstructor - Checks for feasibility of
|
||||||
|
@ -2240,15 +2239,11 @@ public:
|
||||||
|
|
||||||
/// \brief Declare the implicit destructor for the given class.
|
/// \brief Declare the implicit destructor for the given class.
|
||||||
///
|
///
|
||||||
/// \param S The scope of the class, which may be NULL if this is a
|
|
||||||
/// template instantiation.
|
|
||||||
///
|
|
||||||
/// \param ClassDecl The class declaration into which the implicit
|
/// \param ClassDecl The class declaration into which the implicit
|
||||||
/// destructor will be added.
|
/// destructor will be added.
|
||||||
///
|
///
|
||||||
/// \returns The implicitly-declared destructor.
|
/// \returns The implicitly-declared destructor.
|
||||||
CXXDestructorDecl *DeclareImplicitDestructor(Scope *S,
|
CXXDestructorDecl *DeclareImplicitDestructor(CXXRecordDecl *ClassDecl);
|
||||||
CXXRecordDecl *ClassDecl);
|
|
||||||
|
|
||||||
/// DefineImplicitDestructor - Checks for feasibility of
|
/// DefineImplicitDestructor - Checks for feasibility of
|
||||||
/// defining this destructor as the default destructor.
|
/// defining this destructor as the default destructor.
|
||||||
|
@ -2264,8 +2259,7 @@ public:
|
||||||
/// copy constructor will be added.
|
/// copy constructor will be added.
|
||||||
///
|
///
|
||||||
/// \returns The implicitly-declared copy constructor.
|
/// \returns The implicitly-declared copy constructor.
|
||||||
CXXConstructorDecl *DeclareImplicitCopyConstructor(Scope *S,
|
CXXConstructorDecl *DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl);
|
||||||
CXXRecordDecl *ClassDecl);
|
|
||||||
|
|
||||||
/// DefineImplicitCopyConstructor - Checks for feasibility of
|
/// DefineImplicitCopyConstructor - Checks for feasibility of
|
||||||
/// defining this constructor as the copy constructor.
|
/// defining this constructor as the copy constructor.
|
||||||
|
@ -2282,8 +2276,7 @@ public:
|
||||||
/// copy-assignment operator will be added.
|
/// copy-assignment operator will be added.
|
||||||
///
|
///
|
||||||
/// \returns The implicitly-declared copy assignment operator.
|
/// \returns The implicitly-declared copy assignment operator.
|
||||||
CXXMethodDecl *DeclareImplicitCopyAssignment(Scope *S,
|
CXXMethodDecl *DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl);
|
||||||
CXXRecordDecl *ClassDecl);
|
|
||||||
|
|
||||||
/// \brief Defined an implicitly-declared copy assignment operator.
|
/// \brief Defined an implicitly-declared copy assignment operator.
|
||||||
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
|
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
|
||||||
|
@ -2682,14 +2675,14 @@ public:
|
||||||
/// \returns true if any work was done, false otherwise.
|
/// \returns true if any work was done, false otherwise.
|
||||||
bool DefineUsedVTables();
|
bool DefineUsedVTables();
|
||||||
|
|
||||||
void AddImplicitlyDeclaredMembersToClass(Scope *S, CXXRecordDecl *ClassDecl);
|
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl);
|
||||||
|
|
||||||
virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
|
virtual void ActOnMemInitializers(DeclPtrTy ConstructorDecl,
|
||||||
SourceLocation ColonLoc,
|
SourceLocation ColonLoc,
|
||||||
MemInitTy **MemInits, unsigned NumMemInits,
|
MemInitTy **MemInits, unsigned NumMemInits,
|
||||||
bool AnyErrors);
|
bool AnyErrors);
|
||||||
|
|
||||||
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record);
|
void CheckCompletedCXXClass(CXXRecordDecl *Record);
|
||||||
virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
virtual void ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
||||||
DeclPtrTy TagDecl,
|
DeclPtrTy TagDecl,
|
||||||
SourceLocation LBrac,
|
SourceLocation LBrac,
|
||||||
|
|
|
@ -2460,12 +2460,12 @@ namespace {
|
||||||
/// \brief Perform semantic checks on a class definition that has been
|
/// \brief Perform semantic checks on a class definition that has been
|
||||||
/// completing, introducing implicitly-declared members, checking for
|
/// completing, introducing implicitly-declared members, checking for
|
||||||
/// abstract types, etc.
|
/// abstract types, etc.
|
||||||
void Sema::CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record) {
|
void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
|
||||||
if (!Record || Record->isInvalidDecl())
|
if (!Record || Record->isInvalidDecl())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Record->isDependentType())
|
if (!Record->isDependentType())
|
||||||
AddImplicitlyDeclaredMembersToClass(S, Record);
|
AddImplicitlyDeclaredMembersToClass(Record);
|
||||||
|
|
||||||
if (Record->isInvalidDecl())
|
if (Record->isInvalidDecl())
|
||||||
return;
|
return;
|
||||||
|
@ -2584,8 +2584,8 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
|
||||||
(DeclPtrTy*)FieldCollector->getCurFields(),
|
(DeclPtrTy*)FieldCollector->getCurFields(),
|
||||||
FieldCollector->getCurNumFields(), LBrac, RBrac, AttrList);
|
FieldCollector->getCurNumFields(), LBrac, RBrac, AttrList);
|
||||||
|
|
||||||
CheckCompletedCXXClass(S,
|
CheckCompletedCXXClass(
|
||||||
dyn_cast_or_null<CXXRecordDecl>(TagDecl.getAs<Decl>()));
|
dyn_cast_or_null<CXXRecordDecl>(TagDecl.getAs<Decl>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -2652,21 +2652,18 @@ namespace {
|
||||||
/// constructor, or destructor, to the given C++ class (C++
|
/// constructor, or destructor, to the given C++ class (C++
|
||||||
/// [special]p1). This routine can only be executed just before the
|
/// [special]p1). This routine can only be executed just before the
|
||||||
/// definition of the class is complete.
|
/// definition of the class is complete.
|
||||||
///
|
void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) {
|
||||||
/// The scope, if provided, is the class scope.
|
|
||||||
void Sema::AddImplicitlyDeclaredMembersToClass(Scope *S,
|
|
||||||
CXXRecordDecl *ClassDecl) {
|
|
||||||
if (!ClassDecl->hasUserDeclaredConstructor())
|
if (!ClassDecl->hasUserDeclaredConstructor())
|
||||||
DeclareImplicitDefaultConstructor(S, ClassDecl);
|
DeclareImplicitDefaultConstructor(ClassDecl);
|
||||||
|
|
||||||
if (!ClassDecl->hasUserDeclaredCopyConstructor())
|
if (!ClassDecl->hasUserDeclaredCopyConstructor())
|
||||||
DeclareImplicitCopyConstructor(S, ClassDecl);
|
DeclareImplicitCopyConstructor(ClassDecl);
|
||||||
|
|
||||||
if (!ClassDecl->hasUserDeclaredCopyAssignment())
|
if (!ClassDecl->hasUserDeclaredCopyAssignment())
|
||||||
DeclareImplicitCopyAssignment(S, ClassDecl);
|
DeclareImplicitCopyAssignment(ClassDecl);
|
||||||
|
|
||||||
if (!ClassDecl->hasUserDeclaredDestructor())
|
if (!ClassDecl->hasUserDeclaredDestructor())
|
||||||
DeclareImplicitDestructor(S, ClassDecl);
|
DeclareImplicitDestructor(ClassDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
|
void Sema::ActOnReenterTemplateScope(Scope *S, DeclPtrTy TemplateD) {
|
||||||
|
@ -4135,8 +4132,8 @@ namespace {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(Scope *S,
|
CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
|
||||||
CXXRecordDecl *ClassDecl) {
|
CXXRecordDecl *ClassDecl) {
|
||||||
// C++ [class.ctor]p5:
|
// C++ [class.ctor]p5:
|
||||||
// A default constructor for a class X is a constructor of class X
|
// A default constructor for a class X is a constructor of class X
|
||||||
// that can be called without an argument. If there is no
|
// that can be called without an argument. If there is no
|
||||||
|
@ -4206,7 +4203,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(Scope *S,
|
||||||
DefaultCon->setAccess(AS_public);
|
DefaultCon->setAccess(AS_public);
|
||||||
DefaultCon->setImplicit();
|
DefaultCon->setImplicit();
|
||||||
DefaultCon->setTrivial(ClassDecl->hasTrivialConstructor());
|
DefaultCon->setTrivial(ClassDecl->hasTrivialConstructor());
|
||||||
if (S)
|
if (Scope *S = getScopeForContext(ClassDecl))
|
||||||
PushOnScopeChains(DefaultCon, S, true);
|
PushOnScopeChains(DefaultCon, S, true);
|
||||||
else
|
else
|
||||||
ClassDecl->addDecl(DefaultCon);
|
ClassDecl->addDecl(DefaultCon);
|
||||||
|
@ -4235,8 +4232,7 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXDestructorDecl *Sema::DeclareImplicitDestructor(Scope *S,
|
CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) {
|
||||||
CXXRecordDecl *ClassDecl) {
|
|
||||||
// C++ [class.dtor]p2:
|
// C++ [class.dtor]p2:
|
||||||
// If a class has no user-declared destructor, a destructor is
|
// If a class has no user-declared destructor, a destructor is
|
||||||
// declared implicitly. An implicitly-declared destructor is an
|
// declared implicitly. An implicitly-declared destructor is an
|
||||||
|
@ -4298,7 +4294,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(Scope *S,
|
||||||
Destructor->setAccess(AS_public);
|
Destructor->setAccess(AS_public);
|
||||||
Destructor->setImplicit();
|
Destructor->setImplicit();
|
||||||
Destructor->setTrivial(ClassDecl->hasTrivialDestructor());
|
Destructor->setTrivial(ClassDecl->hasTrivialDestructor());
|
||||||
if (S)
|
if (Scope *S = getScopeForContext(ClassDecl))
|
||||||
PushOnScopeChains(Destructor, S, true);
|
PushOnScopeChains(Destructor, S, true);
|
||||||
else
|
else
|
||||||
ClassDecl->addDecl(Destructor);
|
ClassDecl->addDecl(Destructor);
|
||||||
|
@ -4536,8 +4532,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
|
||||||
Loc, move(Copy));
|
Loc, move(Copy));
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(Scope *S,
|
CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
|
||||||
CXXRecordDecl *ClassDecl) {
|
|
||||||
// Note: The following rules are largely analoguous to the copy
|
// Note: The following rules are largely analoguous to the copy
|
||||||
// constructor rules. Note that virtual bases are not taken into account
|
// constructor rules. Note that virtual bases are not taken into account
|
||||||
// for determining the argument type of the operator. Note also that
|
// for determining the argument type of the operator. Note also that
|
||||||
|
@ -4655,7 +4650,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(Scope *S,
|
||||||
|
|
||||||
// Don't call addedAssignmentOperator. The class does not need to know about
|
// Don't call addedAssignmentOperator. The class does not need to know about
|
||||||
// the implicitly-declared copy assignment operator.
|
// the implicitly-declared copy assignment operator.
|
||||||
if (S)
|
if (Scope *S = getScopeForContext(ClassDecl))
|
||||||
PushOnScopeChains(CopyAssignment, S, true);
|
PushOnScopeChains(CopyAssignment, S, true);
|
||||||
else
|
else
|
||||||
ClassDecl->addDecl(CopyAssignment);
|
ClassDecl->addDecl(CopyAssignment);
|
||||||
|
@ -4964,8 +4959,8 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
|
||||||
CopyAssignOperator->setBody(Body.takeAs<Stmt>());
|
CopyAssignOperator->setBody(Body.takeAs<Stmt>());
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(Scope *S,
|
CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(
|
||||||
CXXRecordDecl *ClassDecl) {
|
CXXRecordDecl *ClassDecl) {
|
||||||
// C++ [class.copy]p4:
|
// C++ [class.copy]p4:
|
||||||
// If the class definition does not explicitly declare a copy
|
// If the class definition does not explicitly declare a copy
|
||||||
// constructor, one is declared implicitly.
|
// constructor, one is declared implicitly.
|
||||||
|
@ -5108,7 +5103,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(Scope *S,
|
||||||
VarDecl::None,
|
VarDecl::None,
|
||||||
VarDecl::None, 0);
|
VarDecl::None, 0);
|
||||||
CopyConstructor->setParams(&FromParam, 1);
|
CopyConstructor->setParams(&FromParam, 1);
|
||||||
if (S)
|
if (Scope *S = getScopeForContext(ClassDecl))
|
||||||
PushOnScopeChains(CopyConstructor, S, true);
|
PushOnScopeChains(CopyConstructor, S, true);
|
||||||
else
|
else
|
||||||
ClassDecl->addDecl(CopyConstructor);
|
ClassDecl->addDecl(CopyConstructor);
|
||||||
|
|
|
@ -1216,7 +1216,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
|
||||||
ActOnFields(0, Instantiation->getLocation(), DeclPtrTy::make(Instantiation),
|
ActOnFields(0, Instantiation->getLocation(), DeclPtrTy::make(Instantiation),
|
||||||
Fields.data(), Fields.size(), SourceLocation(), SourceLocation(),
|
Fields.data(), Fields.size(), SourceLocation(), SourceLocation(),
|
||||||
0);
|
0);
|
||||||
CheckCompletedCXXClass(/*Scope=*/0, Instantiation);
|
CheckCompletedCXXClass(Instantiation);
|
||||||
if (Instantiation->isInvalidDecl())
|
if (Instantiation->isInvalidDecl())
|
||||||
Invalid = true;
|
Invalid = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue