summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-17 07:02:32 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-17 07:02:32 +0000
commita43942a48e585b7b7cd9e638ce6184bbded3ddc1 (patch)
tree81209e0ee34e52f553eedb7dd0d1f07934bee461 /clang/lib/AST/DeclBase.cpp
parentb0f2ea9e9ecb87ce0f4f59b8b49be5dc9391aa41 (diff)
downloadbcm5719-llvm-a43942a48e585b7b7cd9e638ce6184bbded3ddc1.tar.gz
bcm5719-llvm-a43942a48e585b7b7cd9e638ce6184bbded3ddc1.zip
De-virtualize Decl::isOutOfLine().
llvm-svn: 125730
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index e16bd22f336..a95ea3f6463 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -172,6 +172,15 @@ void PrettyStackTraceDecl::print(llvm::raw_ostream &OS) const {
// Out-of-line virtual method providing a home for Decl.
Decl::~Decl() { }
+bool Decl::isOutOfLine() const {
+ if (const VarDecl *VD = dyn_cast<VarDecl>(this))
+ return VD->isOutOfLine();
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
+ return FD->isOutOfLine();
+
+ return getLexicalDeclContext() != getDeclContext();
+}
+
void Decl::setDeclContext(DeclContext *DC) {
if (isOutOfSemaDC())
delete getMultipleDC();
OpenPOWER on IntegriCloud