Disable all recognition of main() in -ffreestanding.  Addresses bug #4720.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79070 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index ab5578b..d75f322 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2766,7 +2766,7 @@
     return NewFD->setInvalidDecl();
   }
 
-  if (NewFD->isMain()) CheckMain(NewFD);
+  if (NewFD->isMain(Context)) CheckMain(NewFD);
 
   // Semantic checking for this function declaration (in isolation).
   if (getLangOptions().CPlusPlus) {
@@ -3542,7 +3542,7 @@
   //   definition itself provides a prototype. The aim is to detect
   //   global functions that fail to be declared in header files.
   if (!FD->isInvalidDecl() && FD->isGlobal() && !isa<CXXMethodDecl>(FD) &&
-      !FD->isMain()) {
+      !FD->isMain(Context)) {
     bool MissingPrototype = true;
     for (const FunctionDecl *Prev = FD->getPreviousDeclaration();
          Prev; Prev = Prev->getPreviousDeclaration()) {
@@ -3608,7 +3608,7 @@
   Stmt *Body = BodyArg.takeAs<Stmt>();
   if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(dcl)) {
     FD->setBody(Body);
-    if (FD->isMain())
+    if (FD->isMain(Context))
       // C and C++ allow for main to automagically return 0.
       // Implements C++ [basic.start.main]p5 and C99 5.1.2.2.3.
       FD->setHasImplicitReturnZero(true);