Fix PR2042.  One remaining issue: we don't currently diagnose

 int foobar(int);
 int foobar() {}

which requires ifdef'ing out a testcase in predefined-function.c.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47236 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 24013cd..6a718ae 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1010,10 +1010,11 @@
         FTI.ArgInfo[i].TypeInfo = Context.IntTy.getAsOpaquePtr();
       }
     }
-   
+
     // Since this is a function definition, act as though we have information
     // about the arguments.
-    FTI.hasPrototype = true;
+    if (FTI.NumArgs)
+      FTI.hasPrototype = true;
   } else {
     // FIXME: Diagnose arguments without names in C.