urazoff added a comment.
@sammccall @aaron.ballman I am thinking about another solution with tentative
parsing as implemented for C++ in `Parser::isCXXSimpleDeclaration` (which is
eventually called from `isDeclarationStatement()`). This approach works well
for C++. So I want to update this
urazoff added inline comments.
Comment at: clang/lib/Parse/ParseStmt.cpp:184-185
+ case tok::ampamp:
+ case tok::kw___declspec:
+ case tok::l_square:
+return P.getLangOpts().CPlusPlus;
aaron.ballman wrote:
> Why are these pinned to C++? `__declspec` is
urazoff added inline comments.
Comment at: clang/lib/Parse/ParseStmt.cpp:177-178
+ case tok::kw___attribute:
+ case tok::kw_const:
+ case tok::kw_volatile:
+ case tok::star:
aaron.ballman wrote:
> What about other qualifiers? `_Nullable` and `restrict` and
urazoff updated this revision to Diff 478667.
urazoff added a comment.
Reasoning about invalid code is made now in specific parsing path not in
general decision-making method.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137020/new/
https://reviews.llvm.org/D137020
Files:
urazoff added inline comments.
Comment at: clang/test/Parser/recovery.c:105
+ unknown_t a; // expected-error {{unknown type name 'unknown_t'}}
+ unknown_t *b; // expected-error {{unknown type name 'unknown_t'}}
+ unknown_t const *c; // expected-error {{unknown type name
urazoff updated this revision to Diff 476766.
urazoff added a comment.
- Added test for AST dump of invalid C code
- Added testcase for diagnostics
- Some minor fixes
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137020/new/
https://reviews.llvm.org/D137020
Files:
urazoff updated this revision to Diff 475370.
urazoff added a comment.
Added test to show the advantage in AST dump.
Missing keywords are added in 'IsUnknownTypedefName', the function is static
now.
'DisambiguatingWithExpression' check is added to narrow down the effect of the
changes.
urazoff added inline comments.
Comment at: clang/lib/Parse/ParseDecl.cpp:5425
+// node in AST for such cases which is good for AST readers.
+if (IsUnknownTypedefName() && !getLangOpts().ObjC)
+ return true;
sammccall wrote:
> urazoff wrote:
> >
urazoff added inline comments.
Comment at: clang/lib/Parse/ParseDecl.cpp:5392-5394
+ case tok::amp:
+ case tok::ampamp:
+return getLangOpts().CPlusPlus;
aaron.ballman wrote:
> Looking for `*`, `&`, and `&&` will help catch some cases... but it's not
>
urazoff added a comment.
https://github.com/llvm/llvm-project/issues/58355 corresponding github issue
with current clang behavior.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137020/new/
https://reviews.llvm.org/D137020
urazoff created this revision.
urazoff added reviewers: sammccall, hokein, adamcz.
Herald added a project: All.
urazoff requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
With this patch, declarations containing unknown types are parsed
11 matches
Mail list logo