diff options
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 6d2f2301ba..c91cb1dba2 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -414,8 +414,9 @@ void FunctionDecl::setBody(Stmt *B) { 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"); } |