[PATCH] D52790: [analyzer][PlistMacroExpansion] New flag to convert macro expansions to events

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 18:53:49 PDT 2018


NoQ accepted this revision.
NoQ added a comment.

Looks great, let's land? Not sure if i already asked - am i understanding correctly that this is a "poor-man's" support for macro expansions for tools that read plists but do not support those new plist macro dictionaries yet? Also i wanted to have `-analyzer-output=text` tests in order to easily see how exactly macro expansions turn into events, but i guess it doesn't make sense because this feature is only for `-analyzer-output=plist` because other outputs have their own mechanisms for handling macros so nvm^^

I wonder how expansions of huge macros will look as events.



================
Comment at: lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:287-288
+    ReportEvent(o, PathDiagnosticEventPiece(P.getLocation(),
+                     llvm::Twine("Expanding macro '" + EI.MacroName + "' to '" +
+                                 EI.Expansion + "'").str()),
+                FM, PP, indent, depth);
----------------
I think the proper way of using `Twine` is to only wrap the first value with it. Otherwise string concatenation is done normally and then a single string is converted into a `Twine`, which doesn't give any benefits.


https://reviews.llvm.org/D52790





More information about the cfe-commits mailing list