Commit Graph

12 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis d6eb2b9f4d [SemaCXX] Silence -Wconstant-logical-operand if the operand is a 0/1 from a macro.
Libraries specify enabled/disabled features using macro defs of 0/1, in such cases the -Wconstant-logical-operand
is noise.

rdar://15410291

llvm-svn: 207386
2014-04-28 00:20:16 +00:00
Serge Pavlov b620b9d0db Fixed error recovery if sizeof is used without parenthesis
Changes made in r192200 fixed PR16992, which requested fixit suggesting
parenthesis if sizeof is followed by type-id. However expression in form
T() followed by ')' was incorrectly considered as a type-id if 'T' is
typedef name. This change fixes this case.

Differential Revision: http://llvm-reviews.chandlerc.com/D2440

llvm-svn: 199284
2014-01-15 01:53:39 +00:00
David Blaikie 7555b6a4e5 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.

llvm-svn: 156826
2012-05-15 16:56:36 +00:00
Matt Beaumont-Gay 0a0ba9d883 Add fixit notes for -Wconstant-logical-operand.
llvm-svn: 137620
2011-08-15 17:50:06 +00:00
Richard Trieu cfe3926ae9 Remove warnings of constant operands of logical operators from template instantiations. Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like:
template<unsigned int A, unsigned int B> struct S {
  int foo() {
    int x = A && B;
  }
}

will not warn on A && B on every instantiation.  This will still warn on other cases inside templates, which will be caught on checking the template definition.

llvm-svn: 135222
2011-07-15 00:00:51 +00:00
Chandler Carruth e54ff6cc3e Expand the coverage of the warning for constants on the RHS of logical operands:
return f() || -1;

where the user meant to write '|'.

This bootstraps without any additional warnings.

Patch by Richard Trieu.

llvm-svn: 132327
2011-05-31 05:41:42 +00:00
John McCall 5627fd71c8 Flesh out test.
llvm-svn: 116292
2010-10-12 03:38:33 +00:00
John McCall 01cbf2de0f I just do what the comments tell me to do.
llvm-svn: 116289
2010-10-12 02:19:57 +00:00
Fariborz Jahanian f4677b201e Move the test for radar 8018252 to
SemaCXX/expressions.cpp.

llvm-svn: 111988
2010-08-24 22:55:33 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Sebastian Redl 634b6581ec Add missing test case for operator ! result type.
llvm-svn: 62532
2009-01-19 21:37:51 +00:00