Page MenuHomePhabricator

[Analyzer] GNU named variadic macros in Plister

Authored by chrish_ericsson_atx on Sep 18 2020, 2:12 PM.



Added support for GNU named variadic macros in
macro expansion for plist generation.

Fix for

Diff Detail

Unit TestsFailed

340 mswindows > Clang.Analysis::plist-macros-with-expansion.cpp
Script: -- : 'RUN: at line 1'; c:\ws\w32-1\llvm-project\premerge-checks\build\bin\clang.exe -cc1 -internal-isystem c:\ws\w32-1\llvm-project\premerge-checks\build\lib\clang\12.0.0\include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -std=c++14 -analyzer-checker=core C:\ws\w32-1\llvm-project\premerge-checks\clang\test\Analysis\plist-macros-with-expansion.cpp -analyzer-output=plist -o C:\ws\w32-1\llvm-project\premerge-checks\build\tools\clang\test\Analysis\Output\plist-macros-with-expansion.cpp.tmp.plist -analyzer-config expand-macros=true

Event Timeline

chrish_ericsson_atx requested review of this revision.Sep 18 2020, 2:12 PM
Ka-Ka added a subscriber: Ka-Ka.Sep 18 2020, 11:10 PM

Seems the do {} while (0) idiom is a problem, because the plist output gets formatted differently on windows than it does on Linux. (Extra space).

The fix is great, thank you so much! The test seems to be annoying, it might be worth looking into it some other time, but that is definitely orthogonal to this patch.


That looks so much better.


These FileCheck lines are great, because the plist file on its own is not very readable, could you include them for the new test as well? Side note, we're already thinking that removing the plist file might be a good idea (its a mess to keep up-to-date, and doesn't test all that much).


Oh that is a real shame, we absolutely shouldn't do that! Can we somehow provoke a warning through some other way? (null pointer dereference)

Addressed feedback from @Szelethus

chrish_ericsson_atx marked 2 inline comments as done.Sep 21 2020, 6:30 AM

Thanks for the quick feedback, Kristof! I changed the macro to be just a decrement operator, and triggered DBZ with that. Added the checks as you suggested.

Szelethus accepted this revision.Sep 21 2020, 11:41 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Sep 21 2020, 11:41 AM
This revision was landed with ongoing or failed builds.Sep 21 2020, 1:39 PM
This revision was automatically updated to reflect the committed changes.