[PATCH] D52986: [analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 28 10:42:32 PST 2018


Szelethus marked 2 inline comments as done.
Szelethus added inline comments.


================
Comment at: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:884
+  // even if we lex a tok::comma and ParanthesesDepth == 1.
+  const IdentifierInfo *__VA_ARGS__II = PP.getIdentifierInfo("__VA_ARGS__");
+
----------------
Szelethus wrote:
> xazax.hun wrote:
> > Is it possible to undef `__VA_ARGS__`? If so, can this cause problems? Should we use `findDirectiveAtLoc` instead?
> Luckily, no :)
> 
> But, even if you could, we're not looking for a `MacroInfo` (through `MacroDirective`), but rather an `IdentifierInfo`, and those won't disappear even if you undef a macro.
Hmmm, simply acquiring the range of tokens `__VA_ARGS__` is defined to in the expansion context would be neat, but it doesn't seem to be possible. It seems like `__VA_ARGS__` just doesn't have a `MacroDirective`.

In fact, if you CTRL+F "variadic" on `Preprocessor`'s doxygen page, you get basically nothing (if you look for `__VA_ARGS__`, you get //literally// nothing). Sooooo working with the most primitive tools available is the best I can do here, I'm afraid :/


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

https://reviews.llvm.org/D52986





More information about the cfe-commits mailing list