]> granicus.if.org Git - clang/commitdiff
Factor a complex predicate out to a helper method.
authorChris Lattner <sabre@nondot.org>
Fri, 25 Jan 2008 19:25:00 +0000 (19:25 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 25 Jan 2008 19:25:00 +0000 (19:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46365 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/ParseObjc.cpp
include/clang/Parse/Parser.h

index 1bebe250af910a68f084ca4a1c0329f95d076096..e100c259f9f523f37486251330f6337684f3603d 100644 (file)
@@ -1267,9 +1267,7 @@ Parser::ExprResult Parser::ParseObjCMessageExpression() {
   SourceLocation LBracLoc = ConsumeBracket(); // consume '['
 
   // Parse receiver
-  if (Tok.is(tok::identifier) &&
-      (Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope)
-       || Tok.isNamedIdentifier("super"))) {
+  if (isTokObjCMessageIdentifierReceiver()) {
     IdentifierInfo *ReceiverName = Tok.getIdentifierInfo();
     ConsumeToken();
     return ParseObjCMessageExpressionBody(LBracLoc, ReceiverName, 0);
index ba1597d3f890b00ab0273fbe180fdf2cd21dda23..379148b76d66fa8013b3d5cebb35009bb02b5491 100644 (file)
@@ -362,6 +362,17 @@ private:
   
   //===--------------------------------------------------------------------===//
   // Objective-C Expressions
+  
+  bool isTokObjCMessageIdentifierReceiver() const {
+    if (!Tok.is(tok::identifier))
+      return false;
+    
+    if (Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope))
+      return true;
+    
+    return Tok.isNamedIdentifier("super");
+  }
+  
   ExprResult ParseObjCAtExpression(SourceLocation AtLocation);
   ExprResult ParseObjCStringLiteral(SourceLocation AtLoc);
   ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc);