diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index f955db637ca7526b9dd24ec3b2bf98c364e4b0d9..cd738f0b3856d1c1e83e4ed875ae553a94f359f4 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -863,8 +863,8 @@ public:
     /// \brief Force the emission of cleanups now, instead of waiting
     /// until this object is destroyed.
     void ForceCleanup() {
-      endLexicalScope();
       RunCleanupsScope::ForceCleanup();
+      endLexicalScope();
     }
 
   private: