[cfe-commits] r159693 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/SemaObjC/delay-parsing-cfunctions.m test/SemaObjCXX/delay-parsing-cfunctions.mm
Fariborz Jahanian
fjahanian at apple.com
Tue Jul 3 16:22:14 PDT 2012
Author: fjahanian
Date: Tue Jul 3 18:22:13 2012
New Revision: 159693
URL: http://llvm.org/viewvc/llvm-project?rev=159693&view=rev
Log:
Obj-C++11 parser: handle a fall out of delayed
c-function parsing when a declaration with
C++0x braced-init-list is inside an @implementation.
Added:
cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/SemaObjC/delay-parsing-cfunctions.m
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=159693&r1=159692&r2=159693&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Jul 3 18:22:13 2012
@@ -1614,7 +1614,7 @@
/*DirectInit=*/true, TypeContainsAuto);
}
} else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace) &&
- !CurParsedObjCImpl) {
+ (!CurParsedObjCImpl || !D.isFunctionDeclarator())) {
// Parse C++0x braced-init-list.
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
Modified: cfe/trunk/test/SemaObjC/delay-parsing-cfunctions.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/delay-parsing-cfunctions.m?rev=159693&r1=159692&r2=159693&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/delay-parsing-cfunctions.m (original)
+++ cfe/trunk/test/SemaObjC/delay-parsing-cfunctions.m Tue Jul 3 18:22:13 2012
@@ -1,6 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -Werror -verify -Wno-objc-root-class %s
-// RUN: %clang_cc1 -x objective-c++ -std=c++11 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
// rdar://10387088
@interface MyClass
Added: cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm?rev=159693&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm (added)
+++ cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm Tue Jul 3 18:22:13 2012
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -x objective-c++ -std=c++11 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
+// rdar://10387088
+
+struct X {
+X();
+};
+
+ at interface MyClass
+- (void)someMethod;
+ at end
+
+ at implementation MyClass
+- (void)someMethod {
+ [self privateMethod]; // clang already does not warn here
+}
+
+int bar(MyClass * myObject) {
+ [myObject privateMethod];
+ return gorfbar(myObject);
+}
+- (void)privateMethod { }
+
+int gorfbar(MyClass * myObject) {
+ [myObject privateMethod];
+ [myObject privateMethod1];
+ return getMe + bar(myObject);
+}
+
+- (void)privateMethod1 {
+ getMe = getMe+1;
+}
+
+static int getMe;
+
+static int test() {
+ return 0;
+}
+
+int x{17};
+
+X::X() = default;
+
+ at end
More information about the cfe-commits
mailing list