summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/parentheses.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix warning text: lower -> higherRichard Trieu2014-10-281-2/+2
| | | | llvm-svn: 220763
* Fix a bad location in -Wparentheses fix-it hintRichard Trieu2014-08-231-0/+102
| | | | | | | The code used getLocStart() instead of getLocEnd(). This works for single token expressions, but breaks if the expression is longer. llvm-svn: 216306
* Switch the note order for -Woverloaded-shift-op-parentheses so that the noteRichard Trieu2013-04-181-8/+12
| | | | | | | with the silence fix-it comes first. This is more consistent with the rest of the warnings in -Wparentheses. llvm-svn: 179742
* Update the -Wparentheses tests to check that fix-its are in the correct place.Richard Trieu2013-04-181-14/+49
| | | | llvm-svn: 179740
* Add warning group -Woverloaded-shift-op-parentheses to -Wparentheses. ThisRichard Trieu2013-04-171-0/+6
| | | | | | | | | | | | | | | will fire on code such as: cout << x == 0; which the compiler will intrepret as (cout << x) == 0; This warning comes with two fixits attached to notes, one for parentheses to silence the warning, and another to evaluate the comparison first. llvm-svn: 179662
* Remove outdated run lines from tests.Richard Trieu2013-04-091-1/+0
| | | | | | | | | | These run lines originally tested that the fix-its were properly applied. Originally, the fixits were attached to warnings and were applied by -fixit. Now, the fixits are attached to notes, so nothing happens. These run lines still manage to pass since Clang will produce an empty output which gets piped back to Clang. Then Clang produces no error on an empty input. llvm-svn: 179131
* Sema: Don't crash when trying to emit a precedence warning on postinc/decrement.Benjamin Kramer2013-03-301-0/+12
| | | | | | | | | Post-Inc can occur as a binary call (the infamous dummy int argument), but it's not really a binary operator. Fixes PR15628. llvm-svn: 178412
* Clarify wording of -Wshift-op-parentheses.David Blaikie2012-10-191-3/+3
| | | | | | Suggestion from Matt Beaumont-Gay reviewing r165283. llvm-svn: 166296
* Implement -Wshift-op-parentheses for: a << b + cDavid Blaikie2012-10-051-0/+12
| | | | | | | | | | | | This appears to be consistent with GCC's implementation of the same warning under -Wparentheses. Suppressing a << b + c for cases where 'a' is a user defined type for compatibility with C++ stream IO. Otherwise suggest parentheses around the addition or subtraction subexpression. (this came up when MSVC was complaining (incorrectly, so far as I can tell) about a perceived violation of this within the LLVM codebase, PR14001) llvm-svn: 165283
* Silence ?: precendence warning when parenthesis are present.Hans Wennborg2011-09-121-0/+2
| | | | | | | Fixes PR10898. The warning should be silent when there are parenthesis around the condition expression. llvm-svn: 139492
* Fix a crash when a pointer-to-member function is called in the conditionChandler Carruth2011-06-211-0/+14
| | | | | | | expression of '?:'. Add a test case for this pattern, and also test the code that led to the crash in a "working" case as well. llvm-svn: 133523
* Make the presentation of the warnings on 'x + y ? 1 : 0' a bit moreChandler Carruth2011-06-161-12/+12
| | | | | | | | | | | | | pretty. In particular this makes it much easier for me to read messages such as: x.cc:42: ?: has lower ... Where I'm inclined to associate the third ':' with a missing column number, but in fact column numbers have been turned off. Similar punctuation collisions happened elsewhere as well. llvm-svn: 133121
* Handle overloaded operators in ?: precedence warningHans Wennborg2011-06-091-0/+13
| | | | | | | | | | | | | | This is a follow-up to r132565, and should address the rest of PR9969: Warn about cases such as int foo(A a, bool b) { return a + b ? 1 : 2; // user probably meant a + (b ? 1 : 2); } also when + is an overloaded operator call. llvm-svn: 132784
* Warn about missing parentheses for conditional operator.Hans Wennborg2011-06-031-0/+18
Warn in cases such as "x + someCondition ? 42 : 0;", where the condition expression looks arithmetic, and has a right-hand side that looks boolean. This (partly) addresses http://llvm.org/bugs/show_bug.cgi?id=9969 llvm-svn: 132565
OpenPOWER on IntegriCloud