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/AST/Decl.cpp b/lib/AST/Decl.cpp
index 6d2f230..c91cb1d 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -414,8 +414,9 @@
     EndRangeLoc = B->getLocEnd();
 }
 
-bool FunctionDecl::isMain() const {
-  return getDeclContext()->getLookupContext()->isTranslationUnit() &&
+bool FunctionDecl::isMain(ASTContext &Context) const {
+  return !Context.getLangOptions().Freestanding &&
+    getDeclContext()->getLookupContext()->isTranslationUnit() &&
     getIdentifier() && getIdentifier()->isStr("main");
 }