зеркало из https://github.com/microsoft/clang-1.git
Two changes to Sema::LookupDecl() interface.
(1) Remove IdLoc (it's never used). (2) Add a bool to enable/disable lazy builtin creaation (defaults to true). This enables us to use LookupDecl() in Sema::isTypeName(), which is also part of this commit. To make this work, I changed isTypeName() to be a non-const member function. I'm not happy with this, however I fiddled with making LookupDecl() and friends const and it got ugly pretty quickly. We can certainly add it back if/when someone has time to fiddle with it. For now, I thought this simplification was more important than retaining the const-ness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
dd5981177b
Коммит
b327ce0295
|
@ -94,7 +94,7 @@ public:
|
||||||
|
|
||||||
/// isTypeName - Return non-null if the specified identifier is a typedef name
|
/// isTypeName - Return non-null if the specified identifier is a typedef name
|
||||||
/// in the current scope.
|
/// in the current scope.
|
||||||
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const = 0;
|
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) = 0;
|
||||||
|
|
||||||
/// ActOnDeclarator - This callback is invoked when a declarator is parsed and
|
/// ActOnDeclarator - This callback is invoked when a declarator is parsed and
|
||||||
/// 'Init' specifies the initializer if any. This is for things like:
|
/// 'Init' specifies the initializer if any. This is for things like:
|
||||||
|
@ -730,7 +730,7 @@ public:
|
||||||
|
|
||||||
/// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to
|
/// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to
|
||||||
/// determine whether the name is a typedef or not in this scope.
|
/// determine whether the name is a typedef or not in this scope.
|
||||||
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
|
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S);
|
||||||
|
|
||||||
/// ActOnDeclarator - If this is a typedef declarator, we modify the
|
/// ActOnDeclarator - If this is a typedef declarator, we modify the
|
||||||
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
|
/// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is
|
||||||
|
|
|
@ -52,7 +52,7 @@ void MinimalAction:: ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
|
||||||
/// determine whether the name is a type name (objc class name or typedef) or
|
/// determine whether the name is a type name (objc class name or typedef) or
|
||||||
/// not in this scope.
|
/// not in this scope.
|
||||||
Action::DeclTy *
|
Action::DeclTy *
|
||||||
MinimalAction::isTypeName(const IdentifierInfo &II, Scope *S) const {
|
MinimalAction::isTypeName(const IdentifierInfo &II, Scope *S) {
|
||||||
if (TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>())
|
if (TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>())
|
||||||
if (TI->isTypeName)
|
if (TI->isTypeName)
|
||||||
return TI;
|
return TI;
|
||||||
|
|
|
@ -198,7 +198,7 @@ private:
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Symbol table / Decl tracking callbacks: SemaDecl.cpp.
|
// Symbol table / Decl tracking callbacks: SemaDecl.cpp.
|
||||||
//
|
//
|
||||||
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
|
virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S);
|
||||||
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
|
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
|
||||||
void AddInitializerToDecl(DeclTy *dcl, ExprTy *init);
|
void AddInitializerToDecl(DeclTy *dcl, ExprTy *init);
|
||||||
virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
|
virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
|
||||||
|
@ -249,10 +249,11 @@ private:
|
||||||
/// More parsing and symbol table subroutines...
|
/// More parsing and symbol table subroutines...
|
||||||
ParmVarDecl *ActOnParamDeclarator(struct DeclaratorChunk::ParamInfo &PI,
|
ParmVarDecl *ActOnParamDeclarator(struct DeclaratorChunk::ParamInfo &PI,
|
||||||
Scope *FnBodyScope);
|
Scope *FnBodyScope);
|
||||||
Decl *LookupDecl(IdentifierInfo *II, unsigned NSI,
|
Decl *LookupDecl(const IdentifierInfo *II, unsigned NSI, Scope *S,
|
||||||
SourceLocation IdLoc, Scope *S);
|
bool enableLazyBuiltinCreation = true);
|
||||||
ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id);
|
ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *Id);
|
||||||
ScopedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S);
|
ScopedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
|
||||||
|
Scope *S);
|
||||||
ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
|
||||||
Scope *S);
|
Scope *S);
|
||||||
// Decl attributes - this routine is the top level dispatcher.
|
// Decl attributes - this routine is the top level dispatcher.
|
||||||
|
|
|
@ -32,24 +32,10 @@
|
||||||
#include "llvm/ADT/DenseSet.h"
|
#include "llvm/ADT/DenseSet.h"
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) const {
|
Sema::DeclTy *Sema::isTypeName(const IdentifierInfo &II, Scope *S) {
|
||||||
Decl *IIDecl = II.getFETokenInfo<Decl>();
|
Decl *IIDecl = LookupDecl(&II, Decl::IDNS_Ordinary, S, false);
|
||||||
// Find first occurance of none-tagged declaration
|
|
||||||
while (IIDecl && IIDecl->getIdentifierNamespace() != Decl::IDNS_Ordinary)
|
if (IIDecl && (isa<TypedefDecl>(IIDecl) || isa<ObjCInterfaceDecl>(IIDecl)))
|
||||||
IIDecl = cast<ScopedDecl>(IIDecl)->getNext();
|
|
||||||
|
|
||||||
if (!IIDecl) {
|
|
||||||
if (getLangOptions().ObjC1) {
|
|
||||||
// @interface and @compatibility_alias result in new type references.
|
|
||||||
// Creating a class alias is *extremely* rare.
|
|
||||||
ObjCAliasTy::const_iterator I = ObjCAliasDecls.find(&II);
|
|
||||||
if (I != ObjCAliasDecls.end())
|
|
||||||
return I->second->getClassInterface();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// FIXME: remove ObjCInterfaceDecl check when we make it a named decl.
|
|
||||||
if (isa<TypedefDecl>(IIDecl) || isa<ObjCInterfaceDecl>(IIDecl))
|
|
||||||
return IIDecl;
|
return IIDecl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -113,13 +99,13 @@ ObjCInterfaceDecl *Sema::getObjCInterfaceDecl(IdentifierInfo *Id) {
|
||||||
if (ObjCCompatibleAliasDecl *ADecl =
|
if (ObjCCompatibleAliasDecl *ADecl =
|
||||||
dyn_cast_or_null<ObjCCompatibleAliasDecl>(IDecl))
|
dyn_cast_or_null<ObjCCompatibleAliasDecl>(IDecl))
|
||||||
return ADecl->getClassInterface();
|
return ADecl->getClassInterface();
|
||||||
return cast_or_null<ObjCInterfaceDecl>(IDecl);
|
return dyn_cast_or_null<ObjCInterfaceDecl>(IDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// LookupDecl - Look up the inner-most declaration in the specified
|
/// LookupDecl - Look up the inner-most declaration in the specified
|
||||||
/// namespace.
|
/// namespace.
|
||||||
Decl *Sema::LookupDecl(IdentifierInfo *II, unsigned NSI,
|
Decl *Sema::LookupDecl(const IdentifierInfo *II, unsigned NSI,
|
||||||
SourceLocation IdLoc, Scope *S) {
|
Scope *S, bool enableLazyBuiltinCreation) {
|
||||||
if (II == 0) return 0;
|
if (II == 0) return 0;
|
||||||
Decl::IdentifierNamespace NS = (Decl::IdentifierNamespace)NSI;
|
Decl::IdentifierNamespace NS = (Decl::IdentifierNamespace)NSI;
|
||||||
|
|
||||||
|
@ -134,10 +120,11 @@ Decl *Sema::LookupDecl(IdentifierInfo *II, unsigned NSI,
|
||||||
// corresponds to a compiler builtin, create the decl object for the builtin
|
// corresponds to a compiler builtin, create the decl object for the builtin
|
||||||
// now, injecting it into translation unit scope, and return it.
|
// now, injecting it into translation unit scope, and return it.
|
||||||
if (NS == Decl::IDNS_Ordinary) {
|
if (NS == Decl::IDNS_Ordinary) {
|
||||||
// If this is a builtin on this (or all) targets, create the decl.
|
if (enableLazyBuiltinCreation) {
|
||||||
if (unsigned BuiltinID = II->getBuiltinID())
|
// If this is a builtin on this (or all) targets, create the decl.
|
||||||
return LazilyCreateBuiltin(II, BuiltinID, S);
|
if (unsigned BuiltinID = II->getBuiltinID())
|
||||||
|
return LazilyCreateBuiltin((IdentifierInfo *)II, BuiltinID, S);
|
||||||
|
}
|
||||||
if (getLangOptions().ObjC1) {
|
if (getLangOptions().ObjC1) {
|
||||||
// @interface and @compatibility_alias introduce typedef-like names.
|
// @interface and @compatibility_alias introduce typedef-like names.
|
||||||
// Unlike typedef's, they can only be introduced at file-scope (and are
|
// Unlike typedef's, they can only be introduced at file-scope (and are
|
||||||
|
@ -157,8 +144,7 @@ void Sema::InitBuiltinVaListType()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");
|
IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");
|
||||||
Decl *VaDecl = LookupDecl(VaIdent, Decl::IDNS_Ordinary,
|
Decl *VaDecl = LookupDecl(VaIdent, Decl::IDNS_Ordinary, TUScope);
|
||||||
SourceLocation(), TUScope);
|
|
||||||
TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);
|
TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);
|
||||||
Context.setBuiltinVaListType(Context.getTypedefType(VaTypedef));
|
Context.setBuiltinVaListType(Context.getTypedefType(VaTypedef));
|
||||||
}
|
}
|
||||||
|
@ -716,7 +702,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
|
||||||
S = S->getParent();
|
S = S->getParent();
|
||||||
|
|
||||||
// See if this is a redefinition of a variable in the same scope.
|
// See if this is a redefinition of a variable in the same scope.
|
||||||
Decl *PrevDecl = LookupDecl(II, Decl::IDNS_Ordinary, D.getIdentifierLoc(), S);
|
Decl *PrevDecl = LookupDecl(II, Decl::IDNS_Ordinary, S);
|
||||||
ScopedDecl *New;
|
ScopedDecl *New;
|
||||||
bool InvalidDecl = false;
|
bool InvalidDecl = false;
|
||||||
|
|
||||||
|
@ -988,8 +974,7 @@ Sema::ActOnParamDeclarator(struct DeclaratorChunk::ParamInfo &PI,
|
||||||
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
|
// TODO: CHECK FOR CONFLICTS, multiple decls with same name in one scope.
|
||||||
// Can this happen for params? We already checked that they don't conflict
|
// Can this happen for params? We already checked that they don't conflict
|
||||||
// among each other. Here they can only shadow globals, which is ok.
|
// among each other. Here they can only shadow globals, which is ok.
|
||||||
if (/*Decl *PrevDecl = */LookupDecl(II, Decl::IDNS_Ordinary,
|
if (/*Decl *PrevDecl = */LookupDecl(II, Decl::IDNS_Ordinary, FnScope)) {
|
||||||
PI.IdentLoc, FnScope)) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,7 +1054,7 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
|
||||||
|
|
||||||
// See if this is a redefinition.
|
// See if this is a redefinition.
|
||||||
Decl *PrevDcl = LookupDecl(D.getIdentifier(), Decl::IDNS_Ordinary,
|
Decl *PrevDcl = LookupDecl(D.getIdentifier(), Decl::IDNS_Ordinary,
|
||||||
D.getIdentifierLoc(), GlobalScope);
|
GlobalScope);
|
||||||
if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(PrevDcl)) {
|
if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(PrevDcl)) {
|
||||||
if (FD->getBody()) {
|
if (FD->getBody()) {
|
||||||
Diag(D.getIdentifierLoc(), diag::err_redefinition,
|
Diag(D.getIdentifierLoc(), diag::err_redefinition,
|
||||||
|
@ -1224,8 +1209,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagType, TagKind TK,
|
||||||
// If this is a named struct, check to see if there was a previous forward
|
// If this is a named struct, check to see if there was a previous forward
|
||||||
// declaration or definition.
|
// declaration or definition.
|
||||||
if (TagDecl *PrevDecl =
|
if (TagDecl *PrevDecl =
|
||||||
dyn_cast_or_null<TagDecl>(LookupDecl(Name, Decl::IDNS_Tag,
|
dyn_cast_or_null<TagDecl>(LookupDecl(Name, Decl::IDNS_Tag, S))) {
|
||||||
NameLoc, S))) {
|
|
||||||
|
|
||||||
// If this is a use of a previous tag, or if the tag is already declared in
|
// If this is a use of a previous tag, or if the tag is already declared in
|
||||||
// the same scope (so that the definition/declaration completes or
|
// the same scope (so that the definition/declaration completes or
|
||||||
|
@ -1548,7 +1532,7 @@ Sema::DeclTy *Sema::ActOnEnumConstant(Scope *S, DeclTy *theEnumDecl,
|
||||||
|
|
||||||
// Verify that there isn't already something declared with this name in this
|
// Verify that there isn't already something declared with this name in this
|
||||||
// scope.
|
// scope.
|
||||||
if (Decl *PrevDecl = LookupDecl(Id, Decl::IDNS_Ordinary, IdLoc, S)) {
|
if (Decl *PrevDecl = LookupDecl(Id, Decl::IDNS_Ordinary, S)) {
|
||||||
if (S->isDeclScope(PrevDecl)) {
|
if (S->isDeclScope(PrevDecl)) {
|
||||||
if (isa<EnumConstantDecl>(PrevDecl))
|
if (isa<EnumConstantDecl>(PrevDecl))
|
||||||
Diag(IdLoc, diag::err_redefinition_of_enumerator, Id->getName());
|
Diag(IdLoc, diag::err_redefinition_of_enumerator, Id->getName());
|
||||||
|
|
|
@ -79,7 +79,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface(
|
||||||
assert(ClassName && "Missing class identifier");
|
assert(ClassName && "Missing class identifier");
|
||||||
|
|
||||||
// Check for another declaration kind with the same name.
|
// Check for another declaration kind with the same name.
|
||||||
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, ClassLoc,TUScope);
|
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
|
||||||
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
||||||
Diag(ClassLoc, diag::err_redefinition_different_kind,
|
Diag(ClassLoc, diag::err_redefinition_different_kind,
|
||||||
ClassName->getName());
|
ClassName->getName());
|
||||||
|
@ -112,7 +112,7 @@ Sema::DeclTy *Sema::ActOnStartClassInterface(
|
||||||
if (SuperName) {
|
if (SuperName) {
|
||||||
ObjCInterfaceDecl* SuperClassEntry = 0;
|
ObjCInterfaceDecl* SuperClassEntry = 0;
|
||||||
// Check if a different kind of symbol declared in this scope.
|
// Check if a different kind of symbol declared in this scope.
|
||||||
PrevDecl = LookupDecl(SuperName, Decl::IDNS_Ordinary, SuperLoc, TUScope);
|
PrevDecl = LookupDecl(SuperName, Decl::IDNS_Ordinary, TUScope);
|
||||||
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
||||||
Diag(SuperLoc, diag::err_redefinition_different_kind,
|
Diag(SuperLoc, diag::err_redefinition_different_kind,
|
||||||
SuperName->getName());
|
SuperName->getName());
|
||||||
|
@ -158,8 +158,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||||
IdentifierInfo *ClassName,
|
IdentifierInfo *ClassName,
|
||||||
SourceLocation ClassLocation) {
|
SourceLocation ClassLocation) {
|
||||||
// Look for previous declaration of alias name
|
// Look for previous declaration of alias name
|
||||||
Decl *ADecl = LookupDecl(AliasName, Decl::IDNS_Ordinary,
|
Decl *ADecl = LookupDecl(AliasName, Decl::IDNS_Ordinary, TUScope);
|
||||||
AliasLocation, TUScope);
|
|
||||||
if (ADecl) {
|
if (ADecl) {
|
||||||
if (isa<ObjCCompatibleAliasDecl>(ADecl)) {
|
if (isa<ObjCCompatibleAliasDecl>(ADecl)) {
|
||||||
Diag(AliasLocation, diag::warn_previous_alias_decl);
|
Diag(AliasLocation, diag::warn_previous_alias_decl);
|
||||||
|
@ -173,8 +172,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Check for class declaration
|
// Check for class declaration
|
||||||
Decl *CDeclU = LookupDecl(ClassName, Decl::IDNS_Ordinary,
|
Decl *CDeclU = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
|
||||||
ClassLocation, TUScope);
|
|
||||||
ObjCInterfaceDecl *CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDeclU);
|
ObjCInterfaceDecl *CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDeclU);
|
||||||
if (CDecl == 0) {
|
if (CDecl == 0) {
|
||||||
Diag(ClassLocation, diag::warn_undef_interface, ClassName->getName());
|
Diag(ClassLocation, diag::warn_undef_interface, ClassName->getName());
|
||||||
|
@ -347,7 +345,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
|
||||||
SourceLocation SuperClassLoc) {
|
SourceLocation SuperClassLoc) {
|
||||||
ObjCInterfaceDecl* IDecl = 0;
|
ObjCInterfaceDecl* IDecl = 0;
|
||||||
// Check for another declaration kind with the same name.
|
// Check for another declaration kind with the same name.
|
||||||
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, ClassLoc,TUScope);
|
Decl *PrevDecl = LookupDecl(ClassName, Decl::IDNS_Ordinary, TUScope);
|
||||||
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
||||||
Diag(ClassLoc, diag::err_redefinition_different_kind,
|
Diag(ClassLoc, diag::err_redefinition_different_kind,
|
||||||
ClassName->getName());
|
ClassName->getName());
|
||||||
|
@ -364,8 +362,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation(
|
||||||
ObjCInterfaceDecl* SDecl = 0;
|
ObjCInterfaceDecl* SDecl = 0;
|
||||||
if (SuperClassname) {
|
if (SuperClassname) {
|
||||||
// Check if a different kind of symbol declared in this scope.
|
// Check if a different kind of symbol declared in this scope.
|
||||||
PrevDecl = LookupDecl(SuperClassname, Decl::IDNS_Ordinary,
|
PrevDecl = LookupDecl(SuperClassname, Decl::IDNS_Ordinary, TUScope);
|
||||||
SuperClassLoc, TUScope);
|
|
||||||
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
||||||
Diag(SuperClassLoc, diag::err_redefinition_different_kind,
|
Diag(SuperClassLoc, diag::err_redefinition_different_kind,
|
||||||
SuperClassname->getName());
|
SuperClassname->getName());
|
||||||
|
@ -590,8 +587,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
|
||||||
|
|
||||||
for (unsigned i = 0; i != NumElts; ++i) {
|
for (unsigned i = 0; i != NumElts; ++i) {
|
||||||
// Check for another declaration kind with the same name.
|
// Check for another declaration kind with the same name.
|
||||||
Decl *PrevDecl = LookupDecl(IdentList[i], Decl::IDNS_Ordinary,
|
Decl *PrevDecl = LookupDecl(IdentList[i], Decl::IDNS_Ordinary, TUScope);
|
||||||
AtClassLoc, TUScope);
|
|
||||||
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
|
||||||
Diag(AtClassLoc, diag::err_redefinition_different_kind,
|
Diag(AtClassLoc, diag::err_redefinition_different_kind,
|
||||||
IdentList[i]->getName());
|
IdentList[i]->getName());
|
||||||
|
|
|
@ -75,7 +75,7 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
|
||||||
IdentifierInfo &II,
|
IdentifierInfo &II,
|
||||||
bool HasTrailingLParen) {
|
bool HasTrailingLParen) {
|
||||||
// Could be enum-constant, value decl, instance variable, etc.
|
// Could be enum-constant, value decl, instance variable, etc.
|
||||||
Decl *D = LookupDecl(&II, Decl::IDNS_Ordinary, Loc, S);
|
Decl *D = LookupDecl(&II, Decl::IDNS_Ordinary, S);
|
||||||
|
|
||||||
// If this reference is in an Objective-C method, then ivar lookup happens as
|
// If this reference is in an Objective-C method, then ivar lookup happens as
|
||||||
// well.
|
// well.
|
||||||
|
|
|
@ -52,8 +52,7 @@ Sema::ExprResult Sema::ParseObjCStringLiteral(SourceLocation *AtLocs,
|
||||||
// Initialize the constant string interface lazily. This assumes
|
// Initialize the constant string interface lazily. This assumes
|
||||||
// the NSConstantString interface is seen in this translation unit.
|
// the NSConstantString interface is seen in this translation unit.
|
||||||
IdentifierInfo *NSIdent = &Context.Idents.get("NSConstantString");
|
IdentifierInfo *NSIdent = &Context.Idents.get("NSConstantString");
|
||||||
Decl *IFace = LookupDecl(NSIdent, Decl::IDNS_Ordinary,
|
Decl *IFace = LookupDecl(NSIdent, Decl::IDNS_Ordinary, TUScope);
|
||||||
SourceLocation(), TUScope);
|
|
||||||
ObjCInterfaceDecl *strIFace = dyn_cast_or_null<ObjCInterfaceDecl>(IFace);
|
ObjCInterfaceDecl *strIFace = dyn_cast_or_null<ObjCInterfaceDecl>(IFace);
|
||||||
if (!strIFace)
|
if (!strIFace)
|
||||||
return Diag(S->getLocStart(), diag::err_undef_interface,
|
return Diag(S->getLocStart(), diag::err_undef_interface,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче