]> granicus.if.org Git - clang/commitdiff
avoid a noop virtual method call on the hot scope poping path.
authorChris Lattner <sabre@nondot.org>
Tue, 9 Oct 2007 20:37:18 +0000 (20:37 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Oct 2007 20:37:18 +0000 (20:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42809 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/Parser.cpp

index 26835825d82c0d0efda241f5d45a66994152d077..117afab5cfaffe02a00b2c63cbbbea46ee04eaed 100644 (file)
@@ -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();