This is an archive of the discontinued LLVM Phabricator instance.

[analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__
ClosedPublic

Authored by Szelethus on Oct 8 2018, 7:57 AM.

Diff Detail

Event Timeline

Szelethus created this revision.Oct 8 2018, 7:57 AM

Rebased to part 3.

whisperity accepted this revision.Oct 16 2018, 11:04 PM
This revision is now accepted and ready to land.Oct 16 2018, 11:04 PM
NoQ accepted this revision.Nov 1 2018, 7:27 PM

haha!

:D

xazax.hun accepted this revision.Nov 2 2018, 5:01 AM

One question otherwise looks good.

lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
884

Is it possible to undef __VA_ARGS__? If so, can this cause problems? Should we use findDirectiveAtLoc instead?

Szelethus updated this revision to Diff 175718.EditedNov 28 2018, 10:08 AM
  • Fixed a crash where no arguments (not empty arguments) were supplied to __VA_ARGS__.
  • Rebased to master.
Szelethus marked 2 inline comments as done.Nov 28 2018, 10:16 AM
Szelethus added inline comments.
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
884

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.

Szelethus marked 2 inline comments as done.Nov 28 2018, 10:42 AM
Szelethus added inline comments.
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
884

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 :/

This revision was automatically updated to reflect the committed changes.