]> granicus.if.org Git - clang/commitdiff
handle :: in selectors in objc++ mode, rdar://8366474
authorChris Lattner <sabre@nondot.org>
Fri, 27 Aug 2010 22:32:41 +0000 (22:32 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 27 Aug 2010 22:32:41 +0000 (22:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112307 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
test/SemaObjCXX/expr-objcxx.mm [new file with mode: 0644]

index 914d52ea38d54e310e9f9667741a237f62b5702f..c36f09c881a205a9424c63808c65692b75d61b9d 100644 (file)
@@ -2204,17 +2204,21 @@ ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
   }
   
   IdentifierInfo *SelIdent = ParseObjCSelectorPiece(sLoc);
-  if (!SelIdent && Tok.isNot(tok::colon)) // missing selector name.
+  if (!SelIdent &&  // missing selector name.
+      Tok.isNot(tok::colon) && Tok.isNot(tok::coloncolon))
     return ExprError(Diag(Tok, diag::err_expected_ident));
 
   KeyIdents.push_back(SelIdent);
   unsigned nColons = 0;
   if (Tok.isNot(tok::r_paren)) {
     while (1) {
-      if (Tok.isNot(tok::colon))
+      if (Tok.is(tok::coloncolon)) { // Handle :: in C++.
+        ++nColons;
+        KeyIdents.push_back(0);
+      } else if (Tok.isNot(tok::colon))
         return ExprError(Diag(Tok, diag::err_expected_colon));
 
-      nColons++;
+      ++nColons;
       ConsumeToken(); // Eat the ':'.
       if (Tok.is(tok::r_paren))
         break;
diff --git a/test/SemaObjCXX/expr-objcxx.mm b/test/SemaObjCXX/expr-objcxx.mm
new file mode 100644 (file)
index 0000000..e70a001
--- /dev/null
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+// rdar://8366474
+void *P =  @selector(foo::bar::);