[cfe-commits] r128390 - in /cfe/trunk: lib/Frontend/CompilerInvocation.cpp test/ASTMerge/var.c test/Misc/Inputs/include.h test/Misc/include-stack-for-note-flag.cpp test/PCH/source-manager-stack.c

Chandler Carruth chandlerc at gmail.com
Sun Mar 27 13:00:09 PDT 2011


Author: chandlerc
Date: Sun Mar 27 15:00:08 2011
New Revision: 128390

URL: http://llvm.org/viewvc/llvm-project?rev=128390&view=rev
Log:
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.

Added:
    cfe/trunk/test/Misc/Inputs/include.h
    cfe/trunk/test/Misc/include-stack-for-note-flag.cpp
Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/test/ASTMerge/var.c
    cfe/trunk/test/PCH/source-manager-stack.c

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=128390&r1=128389&r2=128390&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sun Mar 27 15:00:08 2011
@@ -989,12 +989,12 @@
   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");

Modified: cfe/trunk/test/ASTMerge/var.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ASTMerge/var.c?rev=128390&r1=128389&r2=128390&view=diff
==============================================================================
--- cfe/trunk/test/ASTMerge/var.c (original)
+++ cfe/trunk/test/ASTMerge/var.c Sun Mar 27 15:00:08 2011
@@ -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 **'

Added: cfe/trunk/test/Misc/Inputs/include.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/Inputs/include.h?rev=128390&view=auto
==============================================================================
--- cfe/trunk/test/Misc/Inputs/include.h (added)
+++ cfe/trunk/test/Misc/Inputs/include.h Sun Mar 27 15:00:08 2011
@@ -0,0 +1 @@
+int foo(int x) { return x; }

Added: cfe/trunk/test/Misc/include-stack-for-note-flag.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/include-stack-for-note-flag.cpp?rev=128390&view=auto
==============================================================================
--- cfe/trunk/test/Misc/include-stack-for-note-flag.cpp (added)
+++ cfe/trunk/test/Misc/include-stack-for-note-flag.cpp Sun Mar 27 15:00:08 2011
@@ -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

Modified: cfe/trunk/test/PCH/source-manager-stack.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/source-manager-stack.c?rev=128390&r1=128389&r2=128390&view=diff
==============================================================================
--- cfe/trunk/test/PCH/source-manager-stack.c (original)
+++ cfe/trunk/test/PCH/source-manager-stack.c Sun Mar 27 15:00:08 2011
@@ -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





More information about the cfe-commits mailing list