[cfe-commits] r91081 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/Sema/Sema.h lib/Sema/SemaLookup.cpp test/Index/complete-objc-message.m test/SemaObjCXX/category-lookup.mm
Fariborz Jahanian
fjahanian at apple.com
Thu Dec 10 16:26:36 PST 2009
Author: fjahanian
Date: Thu Dec 10 18:26:36 2009
New Revision: 91081
URL: http://llvm.org/viewvc/llvm-project?rev=91081&view=rev
Log:
Patch to fix a crash trying to access a category name in
objective-c++ mode and also removed dead-code in this area.
(fixes radar 7456710).
Added:
cfe/trunk/test/SemaObjCXX/category-lookup.mm
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/Index/complete-objc-message.m
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=91081&r1=91080&r2=91081&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Thu Dec 10 18:26:36 2009
@@ -91,7 +91,7 @@
IDNS_Ordinary = 0x8,
IDNS_ObjCProtocol = 0x10,
IDNS_ObjCImplementation = 0x20,
- IDNS_ObjCCategoryImpl = 0x40,
+ IDNS_ObjCCategoryName = 0x40,
IDNS_OrdinaryFriend = 0x80,
IDNS_TagFriend = 0x100,
IDNS_Using = 0x200
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=91081&r1=91080&r2=91081&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Dec 10 18:26:36 2009
@@ -198,7 +198,6 @@
case NonTypeTemplateParm:
case ObjCMethod:
case ObjCContainer:
- case ObjCCategory:
case ObjCInterface:
case ObjCProperty:
case ObjCCompatibleAlias:
@@ -220,8 +219,9 @@
case ObjCImplementation:
return IDNS_ObjCImplementation;
+ case ObjCCategory:
case ObjCCategoryImpl:
- return IDNS_ObjCCategoryImpl;
+ return IDNS_ObjCCategoryName;
case Field:
case ObjCAtDefsField:
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=91081&r1=91080&r2=91081&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Dec 10 18:26:36 2009
@@ -1136,9 +1136,7 @@
/// Look up the name of an Objective-C protocol.
LookupObjCProtocolName,
/// Look up the name of an Objective-C implementation
- LookupObjCImplementationName,
- /// Look up the name of an Objective-C category implementation
- LookupObjCCategoryImplName
+ LookupObjCImplementationName
};
enum RedeclarationKind {
@@ -1162,7 +1160,6 @@
case Sema::LookupUsingDeclName:
case Sema::LookupObjCProtocolName:
case Sema::LookupObjCImplementationName:
- case Sema::LookupObjCCategoryImplName:
return D->isInIdentifierNamespace(IDNS);
case Sema::LookupOperatorName:
@@ -1198,7 +1195,6 @@
bool EnteringContext = false);
ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II);
- ObjCCategoryImplDecl *LookupObjCCategoryImpl(IdentifierInfo *II);
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
QualType T1, QualType T2,
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=91081&r1=91080&r2=91081&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu Dec 10 18:26:36 2009
@@ -234,10 +234,6 @@
case Sema::LookupObjCImplementationName:
IDNS = Decl::IDNS_ObjCImplementation;
break;
-
- case Sema::LookupObjCCategoryImplName:
- IDNS = Decl::IDNS_ObjCCategoryImpl;
- break;
}
return IDNS;
}
@@ -640,9 +636,6 @@
IDNS = Decl::IDNS_ObjCImplementation;
break;
- case Sema::LookupObjCCategoryImplName:
- IDNS = Decl::IDNS_ObjCCategoryImpl;
- break;
}
// Scan up the scope chain looking for a decl that matches this
@@ -942,7 +935,6 @@
case LookupNamespaceName:
case LookupObjCProtocolName:
case LookupObjCImplementationName:
- case LookupObjCCategoryImplName:
// These lookups will never find a member in a C++ class (or base class).
return false;
@@ -1592,13 +1584,6 @@
return cast_or_null<ObjCProtocolDecl>(D);
}
-/// \brief Find the Objective-C category implementation with the given
-/// name, if any.
-ObjCCategoryImplDecl *Sema::LookupObjCCategoryImpl(IdentifierInfo *II) {
- Decl *D = LookupSingleName(TUScope, II, LookupObjCCategoryImplName);
- return cast_or_null<ObjCCategoryImplDecl>(D);
-}
-
void Sema::LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
QualType T1, QualType T2,
FunctionSet &Functions) {
Modified: cfe/trunk/test/Index/complete-objc-message.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-objc-message.m?rev=91081&r1=91080&r2=91081&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-objc-message.m (original)
+++ cfe/trunk/test/Index/complete-objc-message.m Thu Dec 10 18:26:36 2009
@@ -137,7 +137,6 @@
// CHECK-CCA: {TypedText self}
// CHECK-CCA: TypedefDecl:{TypedText Class}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo}
-// CHECK-CCA: ObjCCategoryDecl:{TypedText FooTestCategory}
// CHECK-CCA: FunctionDecl:{TypedText func}{LeftParen (}{RightParen )}
// CHECK-CCA: TypedefDecl:{TypedText id}
// CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass}
Added: cfe/trunk/test/SemaObjCXX/category-lookup.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/category-lookup.mm?rev=91081&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/category-lookup.mm (added)
+++ cfe/trunk/test/SemaObjCXX/category-lookup.mm Thu Dec 10 18:26:36 2009
@@ -0,0 +1,10 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+ at interface NSObject @end
+
+ at interface NSObject (NSScriptClassDescription)
+ at end
+
+void f() {
+ NSScriptClassDescription *f; // expected-error {{use of undeclared identifier 'NSScriptClassDescription'}}
+}
More information about the cfe-commits
mailing list