From bb6a5677fb8d1ed68c4facd90795aca28d197266 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Thu, 26 May 2011 20:49:16 +0000 Subject: [PATCH] Change the include stack of "instantiated from" notes to fall under the control of f/fno-diagnostics-show-note-include-stack flags. This should help with reducing diagnostic spew from macros instantiations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132143 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/TextDiagnosticPrinter.cpp | 2 +- test/Misc/Inputs/include.h | 2 ++ test/Misc/include-stack-for-note-flag.cpp | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 0d048a3030..1c47bf7bee 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -343,7 +343,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(Diagnostic::Level Level, // "included from" lines. if (LastWarningLoc != PLoc.getIncludeLoc()) { LastWarningLoc = PLoc.getIncludeLoc(); - PrintIncludeStack(Level, LastWarningLoc, SM); + PrintIncludeStack(Diagnostic::Note, LastWarningLoc, SM); } if (DiagOpts->ShowLocation) { diff --git a/test/Misc/Inputs/include.h b/test/Misc/Inputs/include.h index d325775691..72835e90a5 100644 --- a/test/Misc/Inputs/include.h +++ b/test/Misc/Inputs/include.h @@ -1 +1,3 @@ +#define EQUALS(a,b) a == b + int foo(int x) { return x; } diff --git a/test/Misc/include-stack-for-note-flag.cpp b/test/Misc/include-stack-for-note-flag.cpp index f8d0080f57..328999ded0 100644 --- a/test/Misc/include-stack-for-note-flag.cpp +++ b/test/Misc/include-stack-for-note-flag.cpp @@ -9,10 +9,20 @@ int test() { return foo(1, 1); } +bool macro(int x, int y) { + return EQUALS(&x, y); +} + // STACK: error: no matching function for call to 'foo' // STACK: In file included from // STACK: note: candidate function not viable +// STACK: error: comparison between pointer and integer +// STACK: In file included from +// STACK: note: instantiated from: // STACKLESS: error: no matching function for call to 'foo' // STACKLESS-NOT: In file included from // STACKLESS: note: candidate function not viable +// STACKLESS: error: comparison between pointer and integer +// STACKLESS-NOT: In file included from +// STACKLESS: note: instantiated from: -- 2.40.0