mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
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
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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 **'
|
||||
|
||||
1
clang/test/Misc/Inputs/include.h
Normal file
1
clang/test/Misc/Inputs/include.h
Normal file
@@ -0,0 +1 @@
|
||||
int foo(int x) { return x; }
|
||||
18
clang/test/Misc/include-stack-for-note-flag.cpp
Normal file
18
clang/test/Misc/include-stack-for-note-flag.cpp
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user