summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-03-27 20:00:08 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-03-27 20:00:08 +0000
commit24284afa2d97401743d664f39a5faf00db7d6afd (patch)
tree4350b92e9c5cf9fedc22676d6e3743100a21be76
parentb3b1e17645ba01ecae56a8f217aec96a690a014c (diff)
downloadbcm5719-llvm-24284afa2d97401743d664f39a5faf00db7d6afd.tar.gz
bcm5719-llvm-24284afa2d97401743d664f39a5faf00db7d6afd.zip
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. llvm-svn: 128390
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp8
-rw-r--r--clang/test/ASTMerge/var.c2
-rw-r--r--clang/test/Misc/Inputs/include.h1
-rw-r--r--clang/test/Misc/include-stack-for-note-flag.cpp18
-rw-r--r--clang/test/PCH/source-manager-stack.c4
5 files changed, 26 insertions, 7 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 431f5f4d2f4..4c7657e20dd 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/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/clang/test/ASTMerge/var.c b/clang/test/ASTMerge/var.c
index 7f23b9f5d26..e1dde6abd2a 100644
--- a/clang/test/ASTMerge/var.c
+++ b/clang/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/clang/test/Misc/Inputs/include.h b/clang/test/Misc/Inputs/include.h
new file mode 100644
index 00000000000..d325775691d
--- /dev/null
+++ b/clang/test/Misc/Inputs/include.h
@@ -0,0 +1 @@
+int foo(int x) { return x; }
diff --git a/clang/test/Misc/include-stack-for-note-flag.cpp b/clang/test/Misc/include-stack-for-note-flag.cpp
new file mode 100644
index 00000000000..f8d0080f57a
--- /dev/null
+++ b/clang/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/clang/test/PCH/source-manager-stack.c b/clang/test/PCH/source-manager-stack.c
index cc8555661a4..8f5da2f0e37 100644
--- a/clang/test/PCH/source-manager-stack.c
+++ b/clang/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
OpenPOWER on IntegriCloud