modern objc rewriter: fixes a bug writing 
a const qualified static c-function. 
// rdar://11314329


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155564 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index 9cefa5e..705a046 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -4133,7 +4133,9 @@
 }
 
 void RewriteModernObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
-  SourceLocation FunLocStart = getFunctionSourceLocation(*this, FD);
+  SourceLocation FunLocStart = 
+    (!Blocks.empty()) ? getFunctionSourceLocation(*this, FD)
+                      : FD->getTypeSpecStartLoc();
   StringRef FuncName = FD->getName();
 
   SynthesizeBlockLiterals(FunLocStart, FuncName);
diff --git a/test/Rewriter/rewrite-modern-extern-c-func-decl.mm b/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
index 1c8fbfb..590a4d4 100644
--- a/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
+++ b/test/Rewriter/rewrite-modern-extern-c-func-decl.mm
@@ -68,3 +68,5 @@
     });
 }
 
+// rdar://11314329
+static inline const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; }