aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-09 20:37:18 +0000
committerChris Lattner <sabre@nondot.org>2007-10-09 20:37:18 +0000
commit87547e6c15ebdd35f930e4879911021ec9e5af47 (patch)
tree6850f36802bb9f4b4ef0947260dda7c62a74fc05
parentc1380400d5396eb1b527f8e72e78a87772fccd60 (diff)
downloadllvm-87547e6c15ebdd35f930e4879911021ec9e5af47.zip
llvm-87547e6c15ebdd35f930e4879911021ec9e5af47.tar.gz
llvm-87547e6c15ebdd35f930e4879911021ec9e5af47.tar.bz2
avoid a noop virtual method call on the hot scope poping path.
llvm-svn: 42809
-rw-r--r--clang/Parse/Parser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/Parse/Parser.cpp b/clang/Parse/Parser.cpp
index 2683582..117afab 100644
--- a/clang/Parse/Parser.cpp
+++ b/clang/Parse/Parser.cpp
@@ -189,8 +189,10 @@ void Parser::EnterScope(unsigned ScopeFlags) {
void Parser::ExitScope() {
assert(CurScope && "Scope imbalance!");
- // Inform the actions module that this scope is going away.
- Actions.PopScope(Tok.getLocation(), CurScope);
+ // Inform the actions module that this scope is going away if there are any
+ // decls in it.
+ if (!CurScope->decl_empty())
+ Actions.PopScope(Tok.getLocation(), CurScope);
Scope *OldScope = CurScope;
CurScope = OldScope->getParent();