From: Chris Lattner Date: Tue, 9 Oct 2007 20:37:18 +0000 (+0000) Subject: avoid a noop virtual method call on the hot scope poping path. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90ae68aae98f12fe1950c63e2f6bd0fabce6cb1e;p=clang avoid a noop virtual method call on the hot scope poping path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42809 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp index 26835825d8..117afab5cf 100644 --- a/Parse/Parser.cpp +++ b/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();