From: Chandler Carruth Date: Sun, 27 Mar 2011 20:00:08 +0000 (+0000) Subject: Flip the default for showing include stacks on notes to false. This X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34b8e6889a12c90e8053fba8a1ea49b17c05ac51;p=clang Flip the default for showing include stacks on notes to false. This required modifying a few tests that specifically use note include stacks to check the source manager's view of include stacks. I've simply added the flag to these tests for now, they may have to be more substantially changed if we decide to remove support for note include stacks altogether. Also, add a test for include stacks on notes that was supposed to go in with the previous commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128390 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 431f5f4d2f..4c7657e20d 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -989,12 +989,12 @@ static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location); Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option); - // Default behavior is to show note include stacks. - Opts.ShowNoteIncludeStack = true; + // Default behavior is to not to show note include stacks. + Opts.ShowNoteIncludeStack = false; if (Arg *A = Args.getLastArg(OPT_fdiagnostics_show_note_include_stack, OPT_fno_diagnostics_show_note_include_stack)) - if (A->getOption().matches(OPT_fno_diagnostics_show_note_include_stack)) - Opts.ShowNoteIncludeStack = false; + if (A->getOption().matches(OPT_fdiagnostics_show_note_include_stack)) + Opts.ShowNoteIncludeStack = true; llvm::StringRef ShowOverloads = Args.getLastArgValue(OPT_fshow_overloads_EQ, "all"); diff --git a/test/ASTMerge/var.c b/test/ASTMerge/var.c index 7f23b9f5d2..e1dde6abd2 100644 --- a/test/ASTMerge/var.c +++ b/test/ASTMerge/var.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/var1.c // RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/var2.c -// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s // CHECK: var2.c:2:9: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **') // CHECK: var1.c:2:9: note: declared here with type 'float **' diff --git a/test/Misc/Inputs/include.h b/test/Misc/Inputs/include.h new file mode 100644 index 0000000000..d325775691 --- /dev/null +++ b/test/Misc/Inputs/include.h @@ -0,0 +1 @@ +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 new file mode 100644 index 0000000000..f8d0080f57 --- /dev/null +++ b/test/Misc/include-stack-for-note-flag.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACK +// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACKLESS +// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-note-include-stack -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACK +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -fno-diagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACKLESS +// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -check-prefix=STACKLESS + +#include "Inputs/include.h" +int test() { + return foo(1, 1); +} + +// STACK: error: no matching function for call to 'foo' +// STACK: In file included from +// STACK: note: candidate function not viable + +// STACKLESS: error: no matching function for call to 'foo' +// STACKLESS-NOT: In file included from +// STACKLESS: note: candidate function not viable diff --git a/test/PCH/source-manager-stack.c b/test/PCH/source-manager-stack.c index cc8555661a..8f5da2f0e3 100644 --- a/test/PCH/source-manager-stack.c +++ b/test/PCH/source-manager-stack.c @@ -2,9 +2,9 @@ // when using PCH. // RUN: echo 'int x;' > %t.prefix.h -// RUN: not %clang_cc1 -fsyntax-only -include %t.prefix.h %s 2> %t.diags.no_pch.txt +// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -include %t.prefix.h %s 2> %t.diags.no_pch.txt // RUN: %clang_cc1 -emit-pch -o %t.prefix.pch %t.prefix.h -// RUN: not %clang_cc1 -fsyntax-only -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt +// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt // RUN: diff %t.diags.no_pch.txt %t.diags.pch.txt // XFAIL: * // PR5662