[PATCH] D101192: Add support for #elifdef and #elifndef

Bjorn Pettersson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 1 08:37:25 PDT 2021


bjope added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:594
+        if (CondInfo.FoundElse)
+          Diag(Tok, diag::pp_err_elif_after_else) << PED_Elif;
 
----------------
Hi @aaron.ballman 

This change is missing from https://reviews.llvm.org/rG8edd3464afbff65d7d5945b3a8b20009d6ff5deb , while you instead got it when doing the pp_err_else_after_else diagnostic a couple of lines above this.

It causes asserts (in DIagnostic::getArgKind) for me in test cases verifying the "elif after else" scenario using a test case basically doing
```
#if 1
#else
#elif
#endif
```
So maybe such a test case should be added as well?

But it seems like the patch you committed doesn't match with the reviewed patch. So maybe you can look into this and fix it?
(let me know if you need some additional help)


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

https://reviews.llvm.org/D101192



More information about the cfe-commits mailing list