llvm-project/clang/test/SemaCXX
John McCall 99ce6bfe28 Improve the -Wsign-compare heuristics:
* If the unsigned type is smaller than the signed type, never warn, because
    its value will not change when zero-extended to the larger type.
  * If we're testing for (in)equality, and the unsigned value is an integer
    constant whose sign bit is not set, never warn, because even though the
    signed value might change, it can't affect the result of the equality.

Also make the comparison test cases much more rigorous, and have them expose
the subtle differences between C and C++ here.

llvm-svn: 86242
2009-11-06 08:49:08 +00:00
..
PR5086-ambig-resolution-enum.cpp Refixed pr5086 by letting Expr::isNullPointerConstant 2009-10-06 00:09:31 +00:00
__null.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
abstract.cpp It's OK for a pure virtual function to override another pure virtual function. Fixes PR5222. 2009-10-18 19:34:08 +00:00
access-base-class.cpp Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again. 2009-05-13 19:49:53 +00:00
access-control-check.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
access.cpp Set the access specifier for templates inside classes. 2009-03-26 01:24:28 +00:00
addr-of-overloaded-function.cpp Handle MemberExprs in ResolveAddressOfOverloadedFunction. 2009-10-07 22:26:29 +00:00
address-of.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
aggregate-initialization.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
ambig-user-defined-conversions.cpp Multiple conversions to the same type are ambiguous but for the 2009-09-28 19:06:58 +00:00
ambiguous-builtin-unary-operator.cpp Patch to clean up and improve visual display of 2009-10-16 23:25:02 +00:00
anonymous-union.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
arrow-operator.cpp Look for overloaded arrow operators in base classes. 2009-09-10 23:18:36 +00:00
attr-after-definition.cpp Make sure we actually found a redeclaration before complaining about attributes added to a redeclaration in C++ 2009-08-28 22:54:55 +00:00
attr-deprecated.cpp CXXMethodDecl::isVirtual needs to check the canonical declaration. Fixes PR4878. 2009-09-13 21:01:57 +00:00
attr-format.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
attr-unavailable.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
auto-cxx0x.cpp Fix a test. 2009-07-11 01:00:52 +00:00
auto-cxx98.cpp Implement enough of the 'auto' keyword so we can claim to support N2546. 2009-06-26 18:41:36 +00:00
blocks.cpp A block that returns a reference is an lvalue. 2009-05-26 02:03:20 +00:00
bool.cpp The result type of logical || and && is bool in C++. Fixes PR5206. 2009-10-16 01:44:21 +00:00
builtin-ptrtomember-ambig.cpp Patch to clean up and improve visual display of 2009-10-16 23:25:02 +00:00
builtin-ptrtomember-overload-1.cpp If built-in operators could not be selected because of ambiguity in 2009-10-12 17:51:19 +00:00
builtin-ptrtomember-overload.cpp Apply heuristics to cut back on number of candidate 2009-10-15 17:14:05 +00:00
c99.cpp Diagnose VLAs as an error in C++. 2009-09-11 00:18:58 +00:00
cast-conversion.cpp Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210 2009-11-06 05:48:00 +00:00
cast-explicit-ctor.cpp Fix this for real. 2009-08-28 16:57:08 +00:00
class-base-member-init.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
class-layout.cpp Temporary band-aid for handling empty classes somewhat better. 2009-09-17 04:42:56 +00:00
class-names.cpp Refactor the LookupResult API to simplify most common operations. Require users to 2009-10-09 21:13:30 +00:00
class.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
compare.cpp Improve the -Wsign-compare heuristics: 2009-11-06 08:49:08 +00:00
complex-overload.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
composite-pointer-type.cpp Implement support for equality comparisons (!=, ==) of member 2009-08-24 17:42:35 +00:00
condition.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
conditional-expr.cpp Turn off -Wsign-compare warnings by default 2009-11-06 05:24:12 +00:00
const-cast.cpp Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++. 2009-06-03 02:06:50 +00:00
constant-expression.cpp Add a big test case for I-C-Es in C++, and a fix to make it work. The fix might not be the right way to do it. 2009-05-27 19:34:06 +00:00
constructor-initializer.cpp Diagnose using a field to initialize itself. Patch by Brandon Pearcy! 2009-11-04 23:02:40 +00:00
constructor-recovery.cpp This is a pretty big cleanup for how invalid decl/type are handle. 2009-04-25 08:06:05 +00:00
constructor.cpp Introduce a new class, UnqualifiedId, that provides a parsed 2009-11-03 01:35:08 +00:00
conversion-delete-expr.cpp 1) don't do overload resolution in selecting conversion 2009-09-15 22:15:23 +00:00
conversion-function.cpp Issue a good diagnostics when attempt to select 2009-09-15 00:10:11 +00:00
convert-to-bool.cpp Create a new PrintingPolicy class, which we pass down through the AST 2009-05-29 20:38:28 +00:00
converting-constructor.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
copy-assignment.cpp When overload resolution fails for an overloaded operator, show the 2009-09-30 21:46:01 +00:00
copy-constructor-error.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
copy-initialization.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
cstyle-cast.cpp Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. 2009-07-25 15:41:38 +00:00
dcl_ambig_res.cpp Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. 2009-07-25 15:41:38 +00:00
dcl_init_aggr.cpp Improve handling of initialization by constructor, by ensuring that 2009-09-09 23:08:42 +00:00
decl-expr-ambiguity.cpp Ok, ok, I give in. Fix tests for unused result warning. 2009-08-01 06:07:15 +00:00
decl-init-ref.cpp If built-in operators could not be selected because of ambiguity in 2009-10-12 17:51:19 +00:00
decltype-crash.cpp Make having no RUN line a failure. 2009-07-25 12:47:38 +00:00
decltype-overloaded-functions.cpp Improvements to decltype. We now don't crash anymore when the expr is an overloaded function decl. 2009-06-29 22:58:55 +00:00
decltype-pr4444.cpp Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444. 2009-06-25 15:00:34 +00:00
decltype-pr4448.cpp Fix PR4448. 2009-06-26 03:02:18 +00:00
decltype-this.cpp Fix type of 'this' and add a decltype test. 2009-07-10 21:35:09 +00:00
default-argument-temporaries.cpp Add a BuildCXXTemporaryObjectExpr and use it so default arguments will be instantiated correctly for temporary object expressions. 2009-08-27 05:08:22 +00:00
default-assignment-operator.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
default-constructor-initializers.cpp Fix up error reporting when object cannot be constructed 2009-10-08 22:15:49 +00:00
default1.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
default2.cpp Cleanup and test C++ default arguments. Improvements include: 2009-09-11 18:44:32 +00:00
deleted-function.cpp Issue good diagnostics when initialization failes due to 2009-09-15 19:12:21 +00:00
dependent-types.cpp Don't allow definitions of array variables without some size information in C++. Fixed PR5401 2009-11-05 19:47:47 +00:00
derived-to-base-ambig.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
destructor.cpp Diagnose when a destructor uses a unrelated class type as its name. 2009-07-21 15:28:50 +00:00
direct-initializer.cpp 1) don't do overload resolution in selecting conversion 2009-09-15 22:15:23 +00:00
do-while-scope.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
dynamic-cast.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
elaborated-type-specifier.cpp Implement support for comparing pointers with <, >, <=, >=, ==, and != 2009-05-04 06:07:12 +00:00
empty-class-layout.cpp Start at NextOffset when laying out bases as well. 2009-09-26 01:29:10 +00:00
enum.cpp Add CheckCallReturnType and start using it for regular call expressions. This will improve error messages. For 2009-10-09 23:51:55 +00:00
exception-spec.cpp Add a DR437 testcase, but disable it for now, since it fails. 2009-10-17 18:31:05 +00:00
exceptions.cpp Track down return statements in the handlers of a function-try-block of constructors. Meh ... 2009-04-27 21:33:24 +00:00
expressions.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
fntype-decl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
friend-class-nodecl.cpp Ensure that the tag decls of friend decls aren't added to the friending class's 2009-09-02 00:55:30 +00:00
friend.cpp Friend declarations are only valid inside class definitions. 2009-05-11 22:55:49 +00:00
function-overloaded-redecl.cpp 13.1-p3 Overloadable declarations 2009-09-29 20:28:06 +00:00
function-redecl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
function-type-qual.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
functional-cast.cpp Make functional-style casts emit correct messages, and fix a crash-on-invalid. 2009-07-29 13:50:23 +00:00
i-c-e-cxx.cpp Eliminate some "default"s in CheckICE. 2009-09-10 23:31:45 +00:00
illegal-member-initialization.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
implicit-int.cpp Disabling some MS extensions which cause these tests to fail 2009-10-27 14:31:53 +00:00
incomplete-call.cpp Improve diagnostics and template instantiation behavior when calling 2009-10-21 06:18:39 +00:00
inherit.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
inline.cpp Diagnose uses of function specifiers on declarations which don't declare 2009-04-07 19:37:57 +00:00
invalid-member-expr.cpp Replace the code that parses member access expressions after "." or 2009-11-03 19:44:04 +00:00
invalid-template-specifier.cpp Implement support for parsing dependent template-ids that refer to 2009-11-04 00:56:37 +00:00
libstdcxx_is_pod_hack.cpp Introduce an egregious hack to fix PR4828. 2009-09-04 05:53:02 +00:00
linkage-spec.cpp Skip transparent contexts when performing C++ name lookup 2009-08-24 18:55:03 +00:00
member-expr-static.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
member-expr.cpp Rework the fix-it hint for code like 2009-11-06 06:30:47 +00:00
member-location.cpp PR4103: improve source location information for members of the current 2009-04-29 17:56:47 +00:00
member-name-lookup.cpp When performing unqualified name lookup into a DeclContext, also look into 2009-09-10 16:57:35 +00:00
member-operator-expr.cpp Support explicit C++ member operator syntax, from James Porter! 2009-08-31 19:52:13 +00:00
member-pointer-size.cpp Use the Itanium ABI for member pointers. Add a missing 'break' statement and a test case 2009-05-17 02:06:04 +00:00
member-pointer.cpp Implement [expr.mptr.oper]p6 for '->*' operator. 2009-10-08 18:00:39 +00:00
missing-members.cpp Unify our diagnostic printing for errors of the form, "we didn't like 2009-10-13 21:16:44 +00:00
ms-exception-spec.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
namespace-alias.cpp Check in test for namespace aliases+using directives. 2009-03-31 05:47:19 +00:00
namespace.cpp Improve diagnostics when the parser encounters a declarator with an 2009-10-13 23:27:22 +00:00
nested-name-spec.cpp Disabling some MS extensions which cause these tests to fail 2009-10-27 14:31:53 +00:00
new-delete.cpp Remove the Skip parameter from GetTypeForDeclarator and dependents. Take the opportunity to improve an error message and fix PR4498. 2009-10-25 21:45:37 +00:00
no-implicit-builtin-decls.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
nullptr.cpp Implement C++0x nullptr. 2009-05-10 18:38:11 +00:00
offsetof.cpp Fix/re-enable test. 2009-05-03 21:22:18 +00:00
overload-call-copycon.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overload-call.cpp When we encounter a derived-to-base conversion when performing an 2009-11-06 01:02:41 +00:00
overload-decl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overload-member-call.cpp Make sure to grab CVR qualifiers from the canonical type. ARGH! 2009-11-05 00:07:36 +00:00
overload-value-dep-arg.cpp When doing overload resolution, expressions that are value dependent but not type dependent and of integral type should not be treated as null pointer constants. 2009-08-28 15:55:56 +00:00
overloaded-builtin-operators.cpp Don't generate pointer types for void or base classes when finding 2009-10-21 22:01:30 +00:00
overloaded-operator-decl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overloaded-operator.cpp When collecting types for built-in candidates, make arrays decay to pointers. Otherwise, subscripting an array leads to no candidates at all. Fixes PR5360. 2009-11-05 16:36:20 +00:00
primary-base.cpp Fix 80-col violation. 2009-11-05 03:47:55 +00:00
pseudo-destructors.cpp If a destructor is referenced or a pseudo-destructor expression is 2009-09-04 18:29:40 +00:00
ptrtomember-badcall.cpp Diagnose use of data pointer member in a function call 2009-10-28 16:49:46 +00:00
ptrtomember-overload-resolution.cpp Patch implements ranking conversions between member pointers [over.ics.rank] 2009-10-20 20:04:46 +00:00
qual-id-test.cpp Improve template instantiation for member access expressions that 2009-09-03 21:38:09 +00:00
qualification-conversion.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
qualified-id-lookup.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
qualified-names-diag.cpp Give Type::getDesugaredType a "for-display" mode that can apply more 2009-04-01 15:47:24 +00:00
qualified-names-print.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
ref-init-ambiguous.cpp Handle ambiguity of reference initialization. 2009-10-14 00:52:43 +00:00
references.cpp Make C++ temporary-related expressions provide proper source-range information. 2009-09-23 22:51:26 +00:00
reinterpret-cast.cpp Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++. 2009-06-03 02:06:50 +00:00
reinterpret-fn-obj-pedantic.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
return-stack-addr.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
return.cpp When the return type of a function is dependent, don't perform any 2009-10-01 23:25:31 +00:00
rval-references.cpp Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously. 2009-04-12 17:16:29 +00:00
statements.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
static-array-member.cpp Allow a declaration of an array to complete a prior, incomplete 2009-09-09 01:45:28 +00:00
static-assert.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
static-cast-complete-type.cpp Check that the destination type of a static_cast expression is a complete type. 2009-09-07 18:25:47 +00:00
static-cast.cpp Try to instantiate templates before doing hierarchy checks in static_cast. Fixes PR5261. 2009-10-22 15:07:22 +00:00
static-initializers.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
struct-class-redecl.cpp In C++, warn when something previously declared as a "struct" is later 2009-05-14 16:41:31 +00:00
switch.cpp Fix for PR5190, Credit to Zhanyong Wan. 2009-10-17 19:32:54 +00:00
this.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
trivial-constructor.cpp Add support for the __has_trivial_destructor type trait. 2009-04-17 02:34:54 +00:00
trivial-destructor.cpp Add support for the __has_trivial_destructor type trait. 2009-04-17 02:34:54 +00:00
type-convert-construct.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
type-definition-in-specifier.cpp When we parse a tag specifier, keep track of whether that tag 2009-05-28 23:31:59 +00:00
type-dependent-exprs.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
type-traits-incomplete.cpp Some (most) type trait expressions require that the argument passed in is a complete type. 2009-07-07 19:06:02 +00:00
type-traits.cpp Implement __is_empty. Patch by Sean Hunt. 2009-08-15 21:55:26 +00:00
typedef-redecl.cpp Disabling some MS extensions which cause this test to fail 2009-10-27 14:58:27 +00:00
typeid.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
types_compatible_p.cpp Ban the use of __builtin_types_compatible_p in C++; g++ doesn't support it, 2009-05-19 22:28:02 +00:00
unknown-type-name.cpp Improve diagnostics when the parser encounters a declarator with an 2009-10-13 23:27:22 +00:00
unreachable-catch-clauses.cpp Check for identical types in C++ catch expression. Patch by Erik Verbruggen. 2009-07-29 17:15:45 +00:00
unused.cpp PR4103: Silence bogus unused expression warning. 2009-04-29 16:35:53 +00:00
user-defined-conversions.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
using-decl-1.cpp Teach Sema::isDeclInScope to handle overload sets constructed from 2009-09-28 00:47:05 +00:00
using-decl-pr4441.cpp Make it possible for using decls to point to operators. Fixes PR4441. 2009-06-27 00:27:47 +00:00
using-decl-pr4450.cpp When creating LookupResults, see through UsingDecls. Fixes PR4450. 2009-06-26 03:37:05 +00:00
using-decl-templates.cpp CreateDeclRefExprs that point to UnresolvedUsingDecls. 2009-08-29 01:06:32 +00:00
using-directive.cpp Parsing and AST support for using declarations, from John Thompson! 2009-06-20 00:51:54 +00:00
value-dependent-exprs.cpp Disable questionable code for handling isNullPointerConstant on value dependent 2009-09-18 08:46:16 +00:00
value-initialization.cpp Remove previous patch for pr5296 due to further clarification 2009-11-03 20:38:53 +00:00
vararg-non-pod.cpp Handle variadic constructors better. Share code between BuildCXXConstructExpr and BuildCXXTemporaryObjectExpr. 2009-09-08 01:48:42 +00:00
vector-casts.cpp Improve handling of vector casts in C++. 2009-09-16 19:19:43 +00:00
virtual-override.cpp Check that the function being overridden is virtual. 2009-05-14 22:15:41 +00:00
virtuals.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
warn-assignment-condition.cpp Implement -Wparentheses: warn about using assignments in contexts that require 2009-10-12 21:59:07 +00:00
warn-char-subscripts.cpp Add support for -Wchar-subscripts. Fixes PR4801. 2009-09-14 01:58:58 +00:00
warn-for-var-in-else.cpp Eliminate some false positives due to a thinko in the "'blah' is 2009-11-05 17:49:26 +00:00
warn-reorder-ctor-initialization.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
warn-unused-variables.cpp Implement support for -Wunused-variable, from Oscar Bonilla! 2009-10-08 21:35:42 +00:00
wchar_t.cpp Fix for PR4502: add calculation of the integer conversion rank for 2009-07-05 23:44:27 +00:00