diff options
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index f7608529d4..79c51aca31 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -255,6 +255,11 @@ Stmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const { return 0; } +bool FunctionDecl::isMain() const { + return getDeclContext()->getLookupContext()->isTranslationUnit() && + getIdentifier() && getIdentifier()->isStr("main"); +} + /// \brief Returns a value indicating whether this function /// corresponds to a builtin function. /// |