Commit Graph

23 Commits

Author SHA1 Message Date
Richard Smith 6c6ef822b0 PR19558: don't produce an "unused variable" warning for a variable template partial specialization.
llvm-svn: 207260
2014-04-25 19:21:40 +00:00
Richard Smith c392617cff PR19305: Don't issue -Wunused-variable warnings on variable templates. It's not
meaningful to odr-use the VarDecl inside a variable template. (Separately, it'd
be nice to track referenced-ness for templates, and warn on unused ones, but
that's really a distinct issue...)

Move a test that generates and tests a warning-suppressing error out to its own
test file, so it doesn't have weird effects on the other tests in the same file.

llvm-svn: 205448
2014-04-02 18:28:36 +00:00
Richard Smith a3e01cf822 PR8455: Handle an attribute between a goto label and a variable declaration per
the GNU documentation: the attribute only appertains to the label if it is
followed by a semicolon. Based on a patch by Aaron Ballman!

llvm-svn: 194869
2013-11-15 22:45:29 +00:00
Matt Beaumont-Gay e1368a107a Suppress -Wunused-variable for variables declared in headers, which may in
fact be defined and used in another TU.

Reshuffle some test cases because we suppress -Wunused-variable after we've
emitted an error.

This fixes PR15558.

llvm-svn: 179138
2013-04-10 00:47:10 +00:00
David Blaikie a9d4a936a8 Fix false positive in -Wunused-variable when a ctor call make involve cleanups.
llvm-svn: 166625
2012-10-24 21:29:06 +00:00
David Blaikie eae04111d0 Fix a crash-on-invalid when parsing a reference to an invalid auto declaration
auto x((unknown));
  int& y = x;

would crash because we were not flagging 'x' as an invalid declaration here.

llvm-svn: 165675
2012-10-10 23:15:05 +00:00
Rafael Espindola 7c23b0891b Improvements to the uninitialized variable warning: Check if the constructor
call is elidable or if the constructor is trivial instead of checking if it
is user declared.

llvm-svn: 147652
2012-01-06 04:54:01 +00:00
Richard Smith 2602a683e0 Fix PR10168: don't warn for unused non-dependent variables in both the template definition and each instantiation.
llvm-svn: 133580
2011-06-21 23:42:09 +00:00
Chandler Carruth d05b352b0e Clean up the tests for warning about unused function results given the
appropriate attribute. Add a bit more testing that finds a pretty bad
regression (since ~forever) in this warning. Fix it with a nice 2 line
change. =]

llvm-svn: 126098
2011-02-21 00:56:56 +00:00
Douglas Gregor ba57154614 Make #pragma unused work for static local variables.
llvm-svn: 118500
2010-11-09 14:57:47 +00:00
Argyrios Kyrtzidis 40cec8326c Revert r114316, -Wunused-value enabled by default was intended.
llvm-svn: 114318
2010-09-19 23:03:35 +00:00
Argyrios Kyrtzidis 3698bf1c6d Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.
llvm-svn: 114316
2010-09-19 21:21:44 +00:00
Douglas Gregor 747eb7840a Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.

llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Douglas Gregor e182370eda Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.

llvm-svn: 107837
2010-07-07 23:37:33 +00:00
Douglas Gregor 442612c285 Do not use CXXZeroValueInitExpr for class types. Instead, use
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.

llvm-svn: 107827
2010-07-07 22:35:13 +00:00
Douglas Gregor 19defcd6f5 Don't look into incomplete types when trying to warn about unused
variables. Fixes PR6948.

llvm-svn: 102436
2010-04-27 16:20:13 +00:00
Douglas Gregor 50dc219e8b When we have a dependent direct initializer but not a dependent
variable type, we can (and should) still check for completeness of the
variable's type. Do so, to work around an assertion that shows up in
Boost's shared_ptr.

llvm-svn: 95934
2010-02-11 22:55:30 +00:00
Nuno Lopes c095b5361a support the warn_unused_result in C++ class methods
llvm-svn: 92095
2009-12-24 00:28:18 +00:00
Daniel Dunbar 5618e98f33 Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Anders Carlsson 6aa503900f Fix PR5531.
llvm-svn: 89106
2009-11-17 17:11:23 +00:00
Anders Carlsson d3569efb5a Add bug number.
llvm-svn: 86357
2009-11-07 08:24:59 +00:00
Anders Carlsson f5dc6fa252 Don't treat variables with non-trivial ctors or dtors as unused. Fixes PR5407.
llvm-svn: 86352
2009-11-07 07:26:56 +00:00
Douglas Gregor 3beaf9bbcd Implement support for -Wunused-variable, from Oscar Bonilla!
llvm-svn: 83577
2009-10-08 21:35:42 +00:00