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

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 12:30:33 PDT 2021


erichkeane added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:754
     break;
+  case tok::pp_elifdef:
+  case tok::pp_elifndef:
----------------
Just looking through this, so forgive me if I there is something I don't understand... Why is this not doing something like `parsePPIf(/*IfDef=*/true)` like above?  


================
Comment at: clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp:924
     case pp_elif:
+    case pp_elifdef:
+    case pp_elifndef:
----------------
Hrmph, not sure I understand this part either.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:642
+
+          CheckEndOfDirective(IsElifDef ? "elifdef" : "elifndef");
+
----------------
Can you just pass 'Directive' here?


================
Comment at: clang/lib/Lex/PPDirectives.cpp:3265
+  if (CurPPLexer->popConditionalLevel(CI)) {
+    Diag(DirectiveTok, diag::pp_err_elif_without_if); // FIXME: wrong error
+    return;
----------------
Oh? What is the 'right' error here?


================
Comment at: clang/lib/Lex/PPDirectives.cpp:3274
+  if (CI.FoundElse)
+    Diag(DirectiveTok, diag::pp_err_elif_after_else); // FIXME: wrong error
+
----------------
Same here:)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101192



More information about the cfe-commits mailing list