[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:41:10 PDT 2021


erichkeane added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:642
+
+          CheckEndOfDirective(IsElifDef ? "elifdef" : "elifndef");
+
----------------
aaron.ballman wrote:
> erichkeane wrote:
> > Can you just pass 'Directive' here?
> I think I'd have to pass `Directive.str().c_str()` to ensure I get a null terminated string to pass (`CheckEndOfDirective()` takes a `const char *`), and that involves an allocation, so I think this form may be better? I don't have a strong opinion though.
Ugh, gross.  Didn't realize it took a const char*.  This is the better of the two, ugly, but at least non-allocating.


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