[cfe-commits] r152950 - /cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Fri Mar 16 14:43:45 PDT 2012


Author: fjahanian
Date: Fri Mar 16 16:43:45 2012
New Revision: 152950

URL: http://llvm.org/viewvc/llvm-project?rev=152950&view=rev
Log:
Minor clean up of my last patch.

Modified:
    cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp

Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=152950&r1=152949&r2=152950&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Fri Mar 16 16:43:45 2012
@@ -1716,16 +1716,14 @@
   buf += "try ";
   ReplaceText(rparenLoc, 1, buf);
   
-  SourceLocation startLBraceLoc = S->getSynchBody()->getLocEnd();
-  const char *startLBraceBuf = SM->getCharacterData(startLBraceLoc);
-
-  assert((*startLBraceBuf == '}') && "bogus @synchronized block");
-  
-  SourceLocation lastCurlyLoc = startLBraceLoc;
+  SourceLocation startRBraceLoc = S->getSynchBody()->getLocEnd();
+  const char *startRBraceBuf = SM->getCharacterData(startRBraceLoc);
+  assert((*startRBraceBuf == '}') && "bogus @synchronized block");
   
   buf = "} catch (id e) {_rethrow = e;}\n";
   Write_RethrowObject(buf);
   
+  // produce objc_sync_exit(expr);
   std::string syncBuf;
   syncBuf += "\n\tobjc_sync_exit(";
 
@@ -1748,7 +1746,7 @@
   buf += "}\n";
   buf += "}\n";
 
-  ReplaceText(lastCurlyLoc, 1, buf);
+  ReplaceText(startRBraceLoc, 1, buf);
 
   return 0;
 }





More information about the cfe-commits mailing list