History log of /external/clang/test/SemaCXX/conversion.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
896c7dd62801c0aacf14b05183c3c471c1fe9f7a 16-Feb-2013 David Blaikie <dblaikie@gmail.com> Don't warn on conversion from NULL to nullptr_t

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175331 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
28a5f0cdfcc927a94c1bda6a225200762df22411 21-Jun-2012 David Blaikie <dblaikie@gmail.com> PR13165: False positive when initializing member data pointers with NULL.

This now correctly covers, I believe, all the pointer types:
* 'any' pointers (both function and data normal pointers and ObjC object pointers)
* member pointers (both function and data)
* block pointers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
b26331b4ff419b22861b0823daf83bc8f22a6803 19-Jun-2012 David Blaikie <dblaikie@gmail.com> Enable -Wnull-conversion for non-integral target types (eg: double).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
def07624ecc535431e0c814b4b5b842de8a06997 16-May-2012 David Blaikie <dblaikie@gmail.com> Include the correct conversion context locations for condition expressions.

This improves the conversion diagnostics (by correctly pointing to the loop
construct for conversions that may've been caused by the contextual conversion
to bool caused by a condition expression) and also causes the NULL conversion
warnings to be correctly suppressed when crossing a macro boundary in such a
context. (previously, since the conversion context location was incorrect, the
suppression could not be performed)

Reported by Nico Weber as feedback to r156826.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
9fb1ac520d1806ba2b069f6087f40fc9c704b067 15-May-2012 David Blaikie <dblaikie@gmail.com> 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
/external/clang/test/SemaCXX/conversion.cpp
be0ee875d8a91c031a085cbbd73ad9e8dc1aa8ff 15-May-2012 David Blaikie <dblaikie@gmail.com> Improve some of the conversion warnings to fire on conversion to bool.

Moves the bool bail-out down a little in SemaChecking - so now
-Wnull-conversion and -Wliteral-conversion can fire when the target type is
bool.

Also improve the wording/details in the -Wliteral-conversion warning to match
the -Wconstant-conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
ca2e1b7990230c5088eb2f280cea9db5f516ad69 01-May-2012 David Blaikie <dblaikie@gmail.com> Workaround a miscompile in 483.xalancbmk while we figure it out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
5729672524865f212cbadb51170dca0694e79a71 01-May-2012 David Blaikie <dblaikie@gmail.com> PR12710 - broken default argument handling for templates.

I broke this in r155838 by not actually instantiating non-dependent default arg
expressions. The motivation for that change was to avoid producing duplicate
conversion warnings for such default args (we produce them once when we parse
the template - there's no need to produce them at each instantiation) but
without actually instantiating the default arg, things break in weird ways.

Technically, I think we could still get the right diagnostic experience without
the bugs if we instantiated the non-dependent args (for non-dependent params
only) immediately, rather than lazily. But I'm not sure if such a refactoring/
change would be desirable so here's the conservative fix for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
c1c0725978ed31253af5ef4849a124e8fc13ebbb 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Fix PR12378: provide conversion warnings on default args of function templates

Apparently we weren't checking default arguments when they were instantiated.
This adds the check, fixes the lack of instantiation caching (which seems like
it was mostly implemented but just missed the last step), and avoids
implementing non-dependent default args (for non-dependent parameter types) as
uninstantiated default arguments (so that we don't warn once for every
instantiation when it's not instantiation dependent).

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
b1360498b0c0794fd7925f4bdac68ae91ff7493b 16-Mar-2012 David Blaikie <dblaikie@gmail.com> Suppress macro expansion of NULL in NULL warnings.

For "int i = NULL;" we would produce:

null.cpp:5:11: warning: implicit conversion of NULL constant to integer [-Wconversion]
int i = NULL;
~ ^~~~
null.cpp:1:14: note: expanded from macro 'NULL'
\#define NULL __null
^~~~~~

But we really shouldn't trace that macro expansion back into the header, yet we
still want macro back traces for code like this:

\#define FOO NULL
int i = FOO;

or

\#define FOO int i = NULL;
FOO

While providing appropriate tagging at different levels of the expansion, etc.

The included test case exercises these cases & does some basic validation (to
ensure we don't have macro expansion notes where we shouldn't, and do where we
should) - but doesn't go as far as to validate the source location/ranges
used in those notes and warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
2b2bbee3071cee1b03520d9bf0c80c4f0bbe60eb 15-Mar-2012 David Blaikie <dblaikie@gmail.com> Provide the specific target type in the -Wnull-conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152835 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
95187bdd5c955c8edf3527eae41f1e4f80377f27 15-Mar-2012 David Blaikie <dblaikie@gmail.com> Reapply r152745 (reverted in 152765) now that compiler-rt is fixed.

Original commit message:

Provide -Wnull-conversion separately from -Wconversion.

Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
9ca33fd56720112bcc4bccb8aa6107abbb68cae3 15-Mar-2012 Chad Rosier <mcrosier@apple.com> Revert r152745 as it's breaking the internal buildbots.

Abbreviated commit message:
Provide -Wnull-conversion separately from -Wconversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
47bfaf19ddc980a9eb48f2978f4da9b7861b9cda 14-Mar-2012 David Blaikie <dblaikie@gmail.com> Provide -Wnull-conversion separately from -Wconversion.

Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
1838ca5618bc6c84ca3d13d84717bf32d9862bb3 29-May-2011 Richard Trieu <rtrieu@google.com> Add a new warning on NULL pointer constant to integer conversion.

This path was reviewed by Chandler Carruth at http://codereview.appspot.com/4538074/



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
15d7d12226f83de24f96f4bf4e27ebba30fef51e 11-Nov-2010 John McCall <rjmccall@apple.com> Extend the bitfield-truncation warning to initializations.
rdar://problem/8652606



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp
ecda6fb71288b1dc3b70ade0c8c75db26ceb1426 13-Jul-2010 John McCall <rjmccall@apple.com> Check in this -Wconversion C++ test case that's been sitting on my machine
for awhile.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/test/SemaCXX/conversion.cpp