[PATCH] D137020: [clang][AST] Handle variable declaration with unknown typedef in C

Dilshod Urazov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 12:38:58 PST 2022


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 used in C and shows up in the same syntactic locations as in C++, and `[` seems like you're looking for `[[]]`-style attributes (perhaps?) but those also exist in C.
> 
> What about parens? e.g.,
> ```
> _BitNit(12) foo; // Oops, meant to type _BitInt(12)
> ```
> 
> 
For `_BitNit(12) foo;` clang gives diagnostics about implicit declaration of function `_BitNit'`. This patch preserves the behaviour. I think it's OK, wdyt?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137020/new/

https://reviews.llvm.org/D137020



More information about the cfe-commits mailing list