aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-31 16:35:03 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-31 16:35:03 +0000
commit8499f3f5ff8d5f95ece8047780030a3daad1b6fa (patch)
treeadfe701db4d6f289f3c9408a8b7441065c3a6889 /lib/AST/Decl.cpp
parent17f689f7f805be86bcafe0a8ecdef14269cb6442 (diff)
Implement -Wmissing-prototypes. Fixes PR3911.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 15a20bd050..f0d32c75de 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -341,6 +341,26 @@ bool FunctionDecl::isExternC(ASTContext &Context) const {
return false;
}
+bool FunctionDecl::isGlobal() const {
+ if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(this))
+ return Method->isStatic();
+
+ if (getStorageClass() == Static)
+ return false;
+
+ for (const DeclContext *DC = getDeclContext();
+ DC->isNamespace();
+ DC = DC->getParent()) {
+ if (const NamespaceDecl *Namespace = cast<NamespaceDecl>(DC)) {
+ if (!Namespace->getDeclName())
+ return false;
+ break;
+ }
+ }
+
+ return true;
+}
+
/// \brief Returns a value indicating whether this function
/// corresponds to a builtin function.
///