Stop printing macro backtraces that don't help diagnostics.
authorRichard Trieu <rtrieu@google.com>
Wed, 12 Aug 2015 18:24:59 +0000 (18:24 +0000)
committerRichard Trieu <rtrieu@google.com>
Wed, 12 Aug 2015 18:24:59 +0000 (18:24 +0000)
commitecd36ee80b7a6ac73c84da19f8a75c4c025a7625
treec105096d236aad1b63d1db85f10bb4fbf9e27d98
parent19ac7d5b299af976ea25b5d257411e690c6e0438
Stop printing macro backtraces that don't help diagnostics.

When displaying the macro backtrace, ignore some of the backtraces that do not
provide extra information to the diagnostic.  Typically, if the problem is
entirely contained within a macro argument, the macro expansion is often not
needed.  Also take into account SourceRange's attached to the diagnostic when
selecting which backtraces to ignore.  Two previous test cases have also been
updated.

Patch by Zhengkai Wu, with minor formatting fixes.

Differential Revision: http://reviews.llvm.org/D11778

llvm-svn: 244788
clang/lib/Frontend/DiagnosticRenderer.cpp
clang/test/Misc/diag-presumed.c
clang/test/Misc/reduced-diags-macros-backtrace.cpp [new file with mode: 0644]
clang/test/Misc/reduced-diags-macros.cpp [new file with mode: 0644]
clang/test/Preprocessor/macro_arg_slocentry_merge.c