]> granicus.if.org Git - clang/commit
Don't warn when NULL is used within a macro but its conversion is outside a macro.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 15 May 2012 21:57:38 +0000 (21:57 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 15 May 2012 21:57:38 +0000 (21:57 +0000)
commit9fb1ac520d1806ba2b069f6087f40fc9c704b067
tree993e3c060a814a23d450e5c0786b3e29c027d04c
parent7514db27036372f209e5e14d3ed021f7cbc23f51
Don't warn when NULL is used within a macro but its conversion is outside a macro.

This fixes the included test case & was reported by Nico Weber.

It's a little bit nasty using the difference in the conversion context, but
seems to me like a not unreasonable solution. I did have to fix up the
conversion context for conditional operators (it seems correct to me to include
the context for which we're actually doing the comparison - across all the
nested conditionals, rather than the innermost conditional which might not
actually have the problematic implicit conversion at all) and template default
arguments (this is a bit of a hack, since we don't have the source location of
the '=' anymore, so I just used the start of the parameter - open to
suggestions there)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156861 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaChecking.cpp
lib/Sema/SemaExpr.cpp
test/SemaCXX/conversion.cpp