diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2015-09-19 05:32:57 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2015-09-19 05:32:57 +0000 |
commit | c4e04a29640335082eec854bbfdcf3d3a1f897c3 (patch) | |
tree | b969eed8446a32911bea64ca2705fe4dbc01f7b6 /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 0510cd5161bf66747bccf09dbbe6728029efa83c (diff) | |
download | bcm5719-llvm-c4e04a29640335082eec854bbfdcf3d3a1f897c3.tar.gz bcm5719-llvm-c4e04a29640335082eec854bbfdcf3d3a1f897c3.zip |
[Modules] More descriptive diagnostics for misplaced import directive
If an import directive was put into wrong context, the error message was obscure,
complaining on misbalanced braces. To get more descriptive messages, annotation
tokens related to modules are processed where they must not be seen.
Differential Revision: http://reviews.llvm.org/D11844
llvm-svn: 248085
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 1a0d262279f..5e59d5dba28 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -210,7 +210,8 @@ void Parser::ParseInnerNamespace(std::vector<SourceLocation> &IdentLoc, ParsedAttributes &attrs, BalancedDelimiterTracker &Tracker) { if (index == Ident.size()) { - while (Tok.isNot(tok::r_brace) && !isEofOrEom()) { + while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) && + !tryParseMisplacedModuleImport()) { ParsedAttributesWithRange attrs(AttrFactory); MaybeParseCXX11Attributes(attrs); MaybeParseMicrosoftAttributes(attrs); @@ -3063,11 +3064,12 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, if (TagDecl) { // While we still have something to read, read the member-declarations. - while (Tok.isNot(tok::r_brace) && !isEofOrEom()) + while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof) && + !tryParseMisplacedModuleImport()) { // Each iteration of this loop reads one member-declaration. ParseCXXClassMemberDeclarationWithPragmas( CurAS, AccessAttrs, static_cast<DeclSpec::TST>(TagType), TagDecl); - + } T.consumeClose(); } else { SkipUntil(tok::r_brace); |