diff options
author | Eric Liu <ioeric@google.com> | 2017-10-10 13:09:40 +0000 |
---|---|---|
committer | Eric Liu <ioeric@google.com> | 2017-10-10 13:09:40 +0000 |
commit | f01516db8de1b7f7599b3e21f687adc6f2d71df2 (patch) | |
tree | 6c262dbcb89ffa76860da0f94690e83658de5fa4 /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | 8cd38554fbd1ff4a3dbece202d10e415aa892eac (diff) | |
download | bcm5719-llvm-f01516db8de1b7f7599b3e21f687adc6f2d71df2.tar.gz bcm5719-llvm-f01516db8de1b7f7599b3e21f687adc6f2d71df2.zip |
Revert "[Modules TS] Module ownership semantics for redeclarations."
This reverts commit r315251. See the original commit thread for reason.
llvm-svn: 315309
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 5ab9d80c00b..6b33f7c64ce 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -943,9 +943,8 @@ ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, assert(ClassName && "Missing class identifier"); // Check for another declaration kind with the same name. - NamedDecl *PrevDecl = - LookupSingleName(TUScope, ClassName, ClassLoc, LookupOrdinaryName, - forRedeclarationInCurContext()); + NamedDecl *PrevDecl = LookupSingleName(TUScope, ClassName, ClassLoc, + LookupOrdinaryName, ForRedeclaration); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName; @@ -1096,18 +1095,16 @@ Decl *Sema::ActOnCompatibilityAlias(SourceLocation AtLoc, IdentifierInfo *ClassName, SourceLocation ClassLocation) { // Look for previous declaration of alias name - NamedDecl *ADecl = - LookupSingleName(TUScope, AliasName, AliasLocation, LookupOrdinaryName, - forRedeclarationInCurContext()); + NamedDecl *ADecl = LookupSingleName(TUScope, AliasName, AliasLocation, + LookupOrdinaryName, ForRedeclaration); if (ADecl) { Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName; Diag(ADecl->getLocation(), diag::note_previous_declaration); return nullptr; } // Check for class declaration - NamedDecl *CDeclU = - LookupSingleName(TUScope, ClassName, ClassLocation, LookupOrdinaryName, - forRedeclarationInCurContext()); + NamedDecl *CDeclU = LookupSingleName(TUScope, ClassName, ClassLocation, + LookupOrdinaryName, ForRedeclaration); if (const TypedefNameDecl *TDecl = dyn_cast_or_null<TypedefNameDecl>(CDeclU)) { QualType T = TDecl->getUnderlyingType(); @@ -1115,8 +1112,7 @@ Decl *Sema::ActOnCompatibilityAlias(SourceLocation AtLoc, if (NamedDecl *IDecl = T->getAs<ObjCObjectType>()->getInterface()) { ClassName = IDecl->getIdentifier(); CDeclU = LookupSingleName(TUScope, ClassName, ClassLocation, - LookupOrdinaryName, - forRedeclarationInCurContext()); + LookupOrdinaryName, ForRedeclaration); } } } @@ -1178,7 +1174,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, // FIXME: Deal with AttrList. assert(ProtocolName && "Missing protocol identifier"); ObjCProtocolDecl *PrevDecl = LookupProtocol(ProtocolName, ProtocolLoc, - forRedeclarationInCurContext()); + ForRedeclaration); ObjCProtocolDecl *PDecl = nullptr; if (ObjCProtocolDecl *Def = PrevDecl? PrevDecl->getDefinition() : nullptr) { // If we already have a definition, complain. @@ -1734,7 +1730,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, for (const IdentifierLocPair &IdentPair : IdentList) { IdentifierInfo *Ident = IdentPair.first; ObjCProtocolDecl *PrevDecl = LookupProtocol(Ident, IdentPair.second, - forRedeclarationInCurContext()); + ForRedeclaration); ObjCProtocolDecl *PDecl = ObjCProtocolDecl::Create(Context, CurContext, Ident, IdentPair.second, AtProtocolLoc, @@ -1925,7 +1921,7 @@ Decl *Sema::ActOnStartClassImplementation( // Check for another declaration kind with the same name. NamedDecl *PrevDecl = LookupSingleName(TUScope, ClassName, ClassLoc, LookupOrdinaryName, - forRedeclarationInCurContext()); + ForRedeclaration); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName; Diag(PrevDecl->getLocation(), diag::note_previous_definition); @@ -3001,7 +2997,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, // Check for another declaration kind with the same name. NamedDecl *PrevDecl = LookupSingleName(TUScope, IdentList[i], IdentLocs[i], - LookupOrdinaryName, forRedeclarationInCurContext()); + LookupOrdinaryName, ForRedeclaration); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { // GCC apparently allows the following idiom: // @@ -4447,7 +4443,7 @@ Decl *Sema::ActOnMethodDeclaration( } LookupResult R(*this, ArgInfo[i].Name, ArgInfo[i].NameLoc, - LookupOrdinaryName, forRedeclarationInCurContext()); + LookupOrdinaryName, ForRedeclaration); LookupName(R, S); if (R.isSingleResult()) { NamedDecl *PrevDecl = R.getFoundDecl(); |