]> granicus.if.org Git - clang/commitdiff
objc- checking for objc decl context range is unreliable and
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 22 Aug 2011 17:13:51 +0000 (17:13 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 22 Aug 2011 17:13:51 +0000 (17:13 +0000)
subject to change. Check for equality instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138238 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h

index dfe43f40863b9bf80c10231b8985226eab986427..b407701a7e0155fd9494a4680a3ab354a3726af2 100644 (file)
@@ -894,8 +894,15 @@ public:
   }
 
   bool isObjCContainer() const {
-    return (DeclKind >= (int)Decl::ObjCCategory &&
-            DeclKind <= (int)Decl::ObjCProtocol);
+    switch (DeclKind) {
+        case Decl::ObjCCategory:
+        case Decl::ObjCCategoryImpl:
+        case Decl::ObjCImplementation:
+        case Decl::ObjCInterface:
+        case Decl::ObjCProtocol:
+            return true;
+    }
+    return false;
   }
 
   bool isFunctionOrMethod() const {