aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2004-12-07 14:41:12 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2004-12-07 14:41:12 +0000
commit5423d7ebe17465199c4c9c35167c8042dd47b911 (patch)
tree08743b308347d01799cfe54f96f7b0b77b686d4c /gcc
parent5f679db991eb87c35817657879a35cfe7c62a6fd (diff)
downloadgcc-5423d7ebe17465199c4c9c35167c8042dd47b911.zip
gcc-5423d7ebe17465199c4c9c35167c8042dd47b911.tar.gz
gcc-5423d7ebe17465199c4c9c35167c8042dd47b911.tar.bz2
name-lookup.c (leave_scope): We only need to update class_binding_level when leaving a class scope.
* name-lookup.c (leave_scope): We only need to update class_binding_level when leaving a class scope. From-SVN: r91807
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/name-lookup.c15
2 files changed, 15 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8569e18..dd41800 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-07 Roger Sayle <roger@eyesopen.com>
+
+ * name-lookup.c (leave_scope): We only need to update
+ class_binding_level when leaving a class scope.
+
2004-12-06 Ziemowit Laski <zlaski@apple.com>
* cp-tree.h (struct lang_type_class): Add 'objc_protocols' field.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 6d5d00d..cfd3890 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1329,11 +1329,16 @@ leave_scope (void)
/* Find the innermost enclosing class scope, and reset
CLASS_BINDING_LEVEL appropriately. */
- for (scope = current_binding_level;
- scope && scope->kind != sk_class;
- scope = scope->level_chain)
- ;
- class_binding_level = scope && scope->kind == sk_class ? scope : NULL;
+ if (scope->kind == sk_class)
+ {
+ class_binding_level = NULL;
+ for (scope = current_binding_level; scope; scope = scope->level_chain)
+ if (scope->kind == sk_class)
+ {
+ class_binding_level = scope;
+ break;
+ }
+ }
return current_binding_level;
}