ClangTool output cleanup

Information messages sent to stdout by ClangTool now only happen when the
-debug flag is set.

Error messages that used to go to stdout now go to stderr.

Author: Ariel J Bernal <ariel.j.bernal@intel.com>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177177 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor template diffing to store an enum that records which type of
difference is stored inside a DiffNode.  This should not change any
diagnostic messages.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177180 91177308-0d34-0410-b5e6-96231b3b80d8
c: perform integer overflow check on all binary
operations. // rdar://13423975


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177181 91177308-0d34-0410-b5e6-96231b3b80d8
[AST] Add a fast path to ConstantArrayType::getNumAddressingBits().

 - This fast path is almost 100% effective on real code, and lets us avoid
   multiple allocations of 128-bit APSInt objects in the common case.

 - As with any overflow-check-skipping-code, I'd appreciate someone double
   checking my logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177183 91177308-0d34-0410-b5e6-96231b3b80d8
Remove unnecessary default in covered switch over enum

This cleans up the Clang -Werror build that was broken by r177180.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177184 91177308-0d34-0410-b5e6-96231b3b80d8
Add some assertions to appease the static analyzer.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177185 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Look through ExprWhenCleanups when trying to track a NULL.

Silences a few false positives in LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177186 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Include opcode in dumping a SymSymExpr.

For debugging use only; no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177187 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Collect stats on the max # of bug reports in an equivalence class.

We discovered that sqlite3.c currently has 2600 reports in a single
equivalence class; it would be good to know if this is a recent
development or what.

(For the curious, the different reports in an equivalence class represent
the same bug found along different paths. When we're suppressing false
positives, we need to go through /every/ path to make sure there isn't a
valid path to a bug. This is a flaw in our after-the-fact suppression,
made worse by the fact that that function isn't particularly optimized.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177188 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Make GRBugReporter::generatePathDiagnostic iterative, not recursive.

The previous generatePathDiagnostic() was intended to be tail-recursive,
restarting and trying again if a report was marked invalid. However:
 (1) this leaked all the cloned visitors, which weren't being deleted, and
 (2) this wasn't actually tail-recursive because some local variables had
     non-trivial destructors.

This was causing us to overflow the stack on inputs with large numbers of
reports in the same equivalence class, such as sqlite3.c. Being iterative
at least prevents us from blowing out the stack, but doesn't solve the
performance issue: suppressing thousands (yes, thousands) of paths in the
same equivalence class is expensive. I'm looking into that now.

<rdar://problem/13423498>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177189 91177308-0d34-0410-b5e6-96231b3b80d8
Enhance -Wtautological-constant-out-of-range-compare to include the name of the enum constant.

This is QoI.  Fixes <rdar://problem/13076064>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177190 91177308-0d34-0410-b5e6-96231b3b80d8
Simplify print logic, per feedback from Jordan Rose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177193 91177308-0d34-0410-b5e6-96231b3b80d8
<rdar://problem/13426257> Introduce SDKSettings.plist as an input file dependency for PCH/modules.

When we're building a precompiled header or module against an SDK on
Darwin, there will be a file SDKSettings.plist in the sysroot. Since
stat()'ing every system header on which a module or PCH file depends
is performance suicide, we instead stat() just SDKSettings.plist. This
hack works well on Darwin; it's unclear how we want to handle this on
other platforms. If there is a canonical file, we should use it; if
not, we either have to take the performance hit of stat()'ing system
headers repeatedly or roll the dice by not checking anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177194 91177308-0d34-0410-b5e6-96231b3b80d8
[modules] Don't record the macros from the predefines buffer.

These will be available in the current translation unit anyway, for
modules they only waste space and deserialization time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177197 91177308-0d34-0410-b5e6-96231b3b80d8
Fix buffer underrun (invalid read) triggered during diagnostic rendering.  The test would overflow when computing '0 - 1'.

I don't have a good testcase for this that does not depend on system headers.
It did not trigger with preprocessed output, and I had trouble reducing the example.

Fixes <rdar://problem/13324594>.

Thanks to Michael Greiner for reporting this issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177201 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Address Jordan’s review of r177138 (a micro optimization)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177204 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] BugReporterVisitors: handle the case where a ternary operator is wrapped in a cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177205 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Use isLiveRegion to determine when SymbolRegionValue is dead.

Fixes a FIXME, improves dead symbol collection, suppresses a false positive,
which resulted from reusing the same symbol twice for simulation of 2 calls to the same function.

Fixing this lead to 2 possible false negatives in CString checker. Since the checker is still alpha and
the solution will not require revert of this commit, move the tests to a FIXME section.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177206 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Address a TODO in the StreamChecker; otherwise the output is non-deterministic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177207 91177308-0d34-0410-b5e6-96231b3b80d8
Improve template diffing handling of default integer values.

When the template argument is both default and value dependent, the expression
retrieved for the default argument cannot be evaluated, thus never matching
any argument value.  To get the proper value, get the template argument
from the desugared template specialization.  Also, output the original
expression to provide more information about the argument mismatch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177209 91177308-0d34-0410-b5e6-96231b3b80d8