diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-12-20 01:50:37 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-12-20 01:50:37 +0000 |
commit | 9490ab433deef70105d817616928d700f87642d9 (patch) | |
tree | b961290509ffb8890db42d28bcaf81c0766db455 /include/clang | |
parent | 9c7a925d93ff4a7b753f4fe0ba097abf82ba68f4 (diff) |
Fix tentative parsing so it knows how to handle an ambiguous for-range-declaration. PR11601.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Parse/Parser.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 07d21bfeed..e4318375af 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1683,13 +1683,13 @@ private: return isDeclarationSpecifier(true); } - /// isSimpleDeclaration - Disambiguates between a declaration or an - /// expression, mainly used for the C 'clause-1' or the C++ + /// isForInitDeclaration - Disambiguates between a declaration or an + /// expression in the context of the C 'clause-1' or the C++ // 'for-init-statement' part of a 'for' statement. /// Returns true for declaration, false for expression. - bool isSimpleDeclaration() { + bool isForInitDeclaration() { if (getLang().CPlusPlus) - return isCXXSimpleDeclaration(); + return isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true); return isDeclarationSpecifier(true); } @@ -1734,7 +1734,7 @@ private: /// If during the disambiguation process a parsing error is encountered, /// the function returns true to let the declaration parsing code handle it. /// Returns false if the statement is disambiguated as expression. - bool isCXXSimpleDeclaration(); + bool isCXXSimpleDeclaration(bool AllowForRangeDecl); /// isCXXFunctionDeclarator - Disambiguates between a function declarator or /// a constructor-style initializer, when parsing declaration statements. @@ -1808,7 +1808,7 @@ private: // They all consume tokens, so backtracking should be used after calling them. TPResult TryParseDeclarationSpecifier(); - TPResult TryParseSimpleDeclaration(); + TPResult TryParseSimpleDeclaration(bool AllowForRangeDecl); TPResult TryParseTypeofSpecifier(); TPResult TryParseProtocolQualifiers(); TPResult TryParseInitDeclaratorList(); |