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