[PATCH] Don't replace macro usage if macro body has NULL

Manuel Klimek klimek at google.com
Thu Mar 21 03:13:20 PDT 2013


On Wed, Mar 20, 2013 at 5:16 PM, Tareq A. Siraj <tareq.a.siraj at intel.com>wrote:

>
>
> ================
> Comment at: cpp11-migrate/UseNullptr/NullptrActions.cpp:125
> @@ +124,3 @@
> +    // coming from a macro called NULL.
> +    if (SM.isMacroArgExpansion(StartLoc) &&
> SM.isMacroArgExpansion(EndLoc)) {
> +      StartLoc = SM.getFileLoc(StartLoc);
> ----------------
> Manuel Klimek wrote:
> > I assume we don't care that those can both be true, but start and end
> can still be produced from different macro expansions? Or do we check that
> somewhere else?
> Can you provide an example for start/end coming from different macro
> expansions in case of ImplicitCastNodes? I don't think we do this check but
> is it really necessary for ImplicitCastNodes? Thanks.
>

Well, I'm not sure. What about:
#define B(X) X ## .742

void f(int i) {
  f(B(3));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130321/04f7b0da/attachment.html>


More information about the cfe-commits mailing list