]> granicus.if.org Git - clang/commit
Implement -Wshift-op-parentheses for: a << b + c
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 5 Oct 2012 00:41:03 +0000 (00:41 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 5 Oct 2012 00:41:03 +0000 (00:41 +0000)
commitb3f55c5728aaf0d28579e67db3dd34c2934e7805
tree682d28a991b03af974adb6cf00ce5bee45e875c6
parent134d1e8a0b463d929ffeac5eefeae761707bf5d3
Implement -Wshift-op-parentheses for: a << b + c

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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165283 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp
test/Sema/parentheses.cpp