diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-09-11 23:08:39 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-09-11 23:08:39 +0000 |
commit | 47f9865182624e8dcaca7bbfb75e53b614fa5c00 (patch) | |
tree | c6077e949b583f5332ae0a002a495e0309b9f76a /clang/lib/Parse/ParseStmt.cpp | |
parent | eff71f29539910d5b2e5951fda18eea7e2dce214 (diff) | |
download | bcm5719-llvm-47f9865182624e8dcaca7bbfb75e53b614fa5c00.tar.gz bcm5719-llvm-47f9865182624e8dcaca7bbfb75e53b614fa5c00.zip |
Add comments about C++ clause 3.3.2p4 that mentions that the condition declaration should be local to an if/switch/while/for statement.
llvm-svn: 56134
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index c776bb6c15a..4082c6c1b4f 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -439,6 +439,10 @@ Parser::StmtResult Parser::ParseIfStatement() { // A name introduced by a declaration in a condition is in scope from its // point of declaration until the end of the substatements controlled by the // condition. + // C++ 3.3.2p4: + // Names declared in the for-init-statement, and in the condition of if, + // while, for, and switch statements are local to the if, while, for, or + // switch statement (including the controlled statement). // if (C99orCXX) EnterScope(Scope::DeclScope | Scope::ControlScope); @@ -563,6 +567,10 @@ Parser::StmtResult Parser::ParseSwitchStatement() { // A name introduced by a declaration in a condition is in scope from its // point of declaration until the end of the substatements controlled by the // condition. + // C++ 3.3.2p4: + // Names declared in the for-init-statement, and in the condition of if, + // while, for, and switch statements are local to the if, while, for, or + // switch statement (including the controlled statement). // if (C99orCXX) EnterScope(Scope::BreakScope | Scope::DeclScope | Scope::ControlScope); @@ -640,6 +648,10 @@ Parser::StmtResult Parser::ParseWhileStatement() { // A name introduced by a declaration in a condition is in scope from its // point of declaration until the end of the substatements controlled by the // condition. + // C++ 3.3.2p4: + // Names declared in the for-init-statement, and in the condition of if, + // while, for, and switch statements are local to the if, while, for, or + // switch statement (including the controlled statement). // if (C99orCXX) EnterScope(Scope::BreakScope | Scope::ContinueScope | @@ -775,6 +787,10 @@ Parser::StmtResult Parser::ParseForStatement() { // A name introduced by a declaration in a condition is in scope from its // point of declaration until the end of the substatements controlled by the // condition. + // C++ 3.3.2p4: + // Names declared in the for-init-statement, and in the condition of if, + // while, for, and switch statements are local to the if, while, for, or + // switch statement (including the controlled statement). // C++ 6.5.3p1: // Names declared in the for-init-statement are in the same declarative-region // as those declared in the condition. |