aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Parse/ParseTentative.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2010-09-17 15:54:40 +0000
committerDimitry Andric <dim@FreeBSD.org>2010-09-17 15:54:40 +0000
commit3d1dcd9bfdb15c49ee34d576a065079ac5c4d29f (patch)
tree0bbe07708f7571f8b5291f6d7b96c102b7c99dee /lib/Parse/ParseTentative.cpp
parenta0482fa4e7fa27b01184f938097f0666b78016dd (diff)
downloadsrc-3d1dcd9bfdb15c49ee34d576a065079ac5c4d29f.tar.gz
src-3d1dcd9bfdb15c49ee34d576a065079ac5c4d29f.zip
Vendor import of clang r114020 (from the release_28 branch):vendor/clang/clang-r114020
Notes
Notes: svn path=/vendor/clang/dist/; revision=212795 svn path=/vendor/clang/clang-r114020/; revision=212796; tag=vendor/clang/clang-r114020
Diffstat (limited to 'lib/Parse/ParseTentative.cpp')
-rw-r--r--lib/Parse/ParseTentative.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index 5e64e6162b73..c22d99fa9d38 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -14,7 +14,7 @@
#include "clang/Parse/Parser.h"
#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Template.h"
+#include "clang/Sema/ParsedTemplate.h"
using namespace clang;
/// isCXXDeclarationStatement - C++-specialized function that disambiguates
@@ -172,14 +172,6 @@ Parser::TPResult Parser::TryParseSimpleDeclaration() {
/// '{' '}'
///
Parser::TPResult Parser::TryParseInitDeclaratorList() {
- // GCC only examines the first declarator for disambiguation:
- // i.e:
- // int(x), ++x; // GCC regards it as ill-formed declaration.
- //
- // Comeau and MSVC will regard the above statement as correct expression.
- // Clang examines all of the declarators and also regards the above statement
- // as correct expression.
-
while (1) {
// declarator
TPResult TPR = TryParseDeclarator(false/*mayBeAbstract*/);
@@ -196,15 +188,22 @@ Parser::TPResult Parser::TryParseInitDeclaratorList() {
ConsumeParen();
if (!SkipUntil(tok::r_paren))
return TPResult::Error();
- } else if (Tok.is(tok::equal)) {
- // MSVC won't examine the rest of declarators if '=' is encountered, it
- // will conclude that it is a declaration.
- // Comeau and Clang will examine the rest of declarators.
- // Note that "int(x) = {0}, ++x;" will be interpreted as ill-formed
- // expression.
+ } else if (Tok.is(tok::equal) || isTokIdentifier_in()) {
+ // MSVC and g++ won't examine the rest of declarators if '=' is
+ // encountered; they just conclude that we have a declaration.
+ // EDG parses the initializer completely, which is the proper behavior
+ // for this case.
//
- // Parse through the initializer-clause.
- SkipUntil(tok::comma, true/*StopAtSemi*/, true/*DontConsume*/);
+ // At present, Clang follows MSVC and g++, since the parser does not have
+ // the ability to parse an expression fully without recording the
+ // results of that parse.
+ // Also allow 'in' after on objective-c declaration as in:
+ // for (int (^b)(void) in array). Ideally this should be done in the
+ // context of parsing for-init-statement of a foreach statement only. But,
+ // in any other context 'in' is invalid after a declaration and parser
+ // issues the error regardless of outcome of this decision.
+ // FIXME. Change if above assumption does not hold.
+ return TPResult::True();
}
if (Tok.isNot(tok::comma))
@@ -758,6 +757,10 @@ Parser::TPResult Parser::isCXXDeclarationSpecifier() {
case tok::kw___ptr64:
case tok::kw___forceinline:
return TPResult::True();
+
+ // Borland
+ case tok::kw___pascal:
+ return TPResult::True();
// AltiVec
case tok::kw___vector: