P0305R1: Parsing support for init-statements in 'if' and 'switch' statements.
No semantic analysis yet. This is a pain to disambiguate correctly, because the parsing rules for the declaration form of a condition and of an init-statement are quite different -- for a token sequence that looks like a declaration, we frequently need to disambiguate all the way to the ')' or ';'. We could do better here in some cases by stopping disambiguation once we've decided whether we've got an expression or not (rather than keeping going until we know whether it's an init-statement declaration or a condition declaration), by unifying our parsing code for the two types of declaration and moving the syntactic checks into Sema; if this has a measurable impact on parsing performance, I'll look into that. llvm-svn: 274169
Showing
- clang/include/clang/Basic/DiagnosticSemaKinds.td 3 additions, 0 deletionsclang/include/clang/Basic/DiagnosticSemaKinds.td
- clang/include/clang/Parse/Parser.h 16 additions, 7 deletionsclang/include/clang/Parse/Parser.h
- clang/include/clang/Sema/DeclSpec.h 6 additions, 0 deletionsclang/include/clang/Sema/DeclSpec.h
- clang/include/clang/Sema/Sema.h 2 additions, 0 deletionsclang/include/clang/Sema/Sema.h
- clang/lib/Parse/ParseDecl.cpp 2 additions, 1 deletionclang/lib/Parse/ParseDecl.cpp
- clang/lib/Parse/ParseExprCXX.cpp 30 additions, 5 deletionsclang/lib/Parse/ParseExprCXX.cpp
- clang/lib/Parse/ParseStmt.cpp 18 additions, 10 deletionsclang/lib/Parse/ParseStmt.cpp
- clang/lib/Parse/ParseTentative.cpp 113 additions, 32 deletionsclang/lib/Parse/ParseTentative.cpp
- clang/lib/Sema/SemaStmt.cpp 10 additions, 3 deletionsclang/lib/Sema/SemaStmt.cpp
- clang/lib/Sema/SemaType.cpp 4 additions, 0 deletionsclang/lib/Sema/SemaType.cpp
- clang/lib/Sema/TreeTransform.h 3 additions, 2 deletionsclang/lib/Sema/TreeTransform.h
- clang/test/Parser/cxx1z-init-statement.cpp 47 additions, 0 deletionsclang/test/Parser/cxx1z-init-statement.cpp
- clang/test/Parser/extra-semi.cpp 0 additions, 1 deletionclang/test/Parser/extra-semi.cpp
Loading
Please register or sign in to comment