[cfe-commits] r161692 - in /cfe/trunk: lib/Parse/ParseObjc.cpp test/SemaObjCXX/delay-parsing-func-tryblock.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Aug 10 13:34:17 PDT 2012
Author: fjahanian
Date: Fri Aug 10 15:34:17 2012
New Revision: 161692
URL: http://llvm.org/viewvc/llvm-project?rev=161692&view=rev
Log:
objective-C++: delay parsing of ctor with try block
with member initializer list defined inside
an objc implementation block. wip.
Modified:
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/test/SemaObjCXX/delay-parsing-func-tryblock.mm
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=161692&r1=161691&r2=161692&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Aug 10 15:34:17 2012
@@ -1931,6 +1931,16 @@
Toks.push_back(Tok);
if (Tok.is(tok::kw_try)) {
ConsumeToken();
+ if (Tok.is(tok::colon)) {
+ Toks.push_back(Tok);
+ ConsumeToken();
+ while (Tok.isNot(tok::l_brace)) {
+ ConsumeAndStoreUntil(tok::l_paren, Toks, /*StopAtSemi=*/false);
+ ConsumeAndStoreUntil(tok::r_paren, Toks, /*StopAtSemi=*/false);
+ }
+ }
+ assert(Tok.is(tok::l_brace)
+ && "StashAwayMethodOrFunctionBodyTokens - '{' not found");
Toks.push_back(Tok); // also store '{'
}
ConsumeBrace();
Modified: cfe/trunk/test/SemaObjCXX/delay-parsing-func-tryblock.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/delay-parsing-func-tryblock.mm?rev=161692&r1=161691&r2=161692&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/delay-parsing-func-tryblock.mm (original)
+++ cfe/trunk/test/SemaObjCXX/delay-parsing-func-tryblock.mm Fri Aug 10 15:34:17 2012
@@ -8,7 +8,9 @@
struct BadReturn {
BadReturn(MyClass * myObject);
int bar(MyClass * myObject);
+ void MemFunc(MyClass * myObject);
int i;
+ MyClass *CObj;
};
@implementation MyClass
@@ -21,12 +23,29 @@
return 0;
}
-BadReturn::BadReturn(MyClass * myObject) try {
+BadReturn::BadReturn(MyClass * myObject) try : CObj(myObject) {
} catch(...) {
try {
[myObject privateMethod];
[myObject privateMethod1];
getMe = bar(myObject);
+ [CObj privateMethod1];
+ } catch(int ei) {
+ i = ei;
+ } catch(...) {
+ {
+ i = 0;
+ }
+ }
+}
+
+void BadReturn::MemFunc(MyClass * myObject) try {
+} catch(...) {
+ try {
+ [myObject privateMethod];
+ [myObject privateMethod1];
+ getMe = bar(myObject);
+ [CObj privateMethod1];
} catch(int ei) {
i = ei;
} catch(...) {
More information about the cfe-commits
mailing list