diff options
author | John McCall <rjmccall@apple.com> | 2009-08-15 02:09:25 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-08-15 02:09:25 +0000 |
commit | 07a5c22bb6fb0674c95205ae189365bf8e1b695e (patch) | |
tree | 65165508917e7a1e73b1edf3238c547bc1818744 /lib/AST/Decl.cpp | |
parent | 2cff7d16fe58e6d6447ec9cad2af083beb20d6b5 (diff) |
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
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"); } |