forked from OSchip/llvm-project
Improve file doesnt exist error with -fbasic-block-sections=
With -fbasicblock-sections=, let the front-end handle the case where the file doesnt exist. The driver only checks if the option syntax is right. Differential Revision: https://reviews.llvm.org/D89500
This commit is contained in:
parent
1d78e2101a
commit
f88785460e
|
@ -4924,7 +4924,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
if (Triple.isX86() && Triple.isOSBinFormatELF()) {
|
||||
StringRef Val = A->getValue();
|
||||
if (Val != "all" && Val != "labels" && Val != "none" &&
|
||||
!(Val.startswith("list=") && llvm::sys::fs::exists(Val.substr(5))))
|
||||
!Val.startswith("list="))
|
||||
D.Diag(diag::err_drv_invalid_value)
|
||||
<< A->getAsString(Args) << A->getValue();
|
||||
else
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
// RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=all -o - < %s | FileCheck %s --check-prefix=BB_WORLD --check-prefix=BB_ALL
|
||||
// RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=list=%S/Inputs/basic-block-sections.funcnames -o - < %s | FileCheck %s --check-prefix=BB_WORLD --check-prefix=BB_LIST
|
||||
// RUN: %clang_cc1 -triple x86_64 -S -fbasic-block-sections=all -funique-basic-block-section-names -o - < %s | FileCheck %s --check-prefix=UNIQUE
|
||||
// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj %s 2>&1 | FileCheck %s --check-prefix=ERROR
|
||||
|
||||
int world(int a) {
|
||||
if (a > 10)
|
||||
|
@ -38,3 +39,4 @@ int another(int a) {
|
|||
//
|
||||
// UNIQUE: .section .text.world.world.1,
|
||||
// UNIQUE: .section .text.another.another.1,
|
||||
// ERROR: error: unable to load basic block sections function list: 'No such file or directory'
|
||||
|
|
|
@ -4,9 +4,14 @@
|
|||
// RUN: %clang -### -target x86_64 -fbasic-block-sections=labels %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-LABELS %s
|
||||
// RUN: not %clang -c -target arm-unknown-linux -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s
|
||||
// RUN: not %clang -c -target x86_64-apple-darwin10 -fbasic-block-sections=all %s -S 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s
|
||||
// RUN: %clang -### -target x86_64 -fbasic-block-sections=alll %s -S 2>&1 | FileCheck -check-prefix=CHECK-INVALID-VALUE %s
|
||||
// RUN: %clang -### -target x86_64 -fbasic-block-sections=list %s -S 2>&1 | FileCheck -check-prefix=CHECK-INVALID-VALUE %s
|
||||
// RUN: %clang -### -target x86_64 -fbasic-block-sections=list= %s -S 2>&1 | FileCheck -check-prefix=CHECK-OPT-NULL-LIST %s
|
||||
//
|
||||
// CHECK-OPT-NONE: "-fbasic-block-sections=none"
|
||||
// CHECK-OPT-ALL: "-fbasic-block-sections=all"
|
||||
// CHECK-OPT-LIST: "-fbasic-block-sections={{[^ ]*}}fbasic-block-sections.c"
|
||||
// CHECK-OPT-LABELS: "-fbasic-block-sections=labels"
|
||||
// CHECK-TRIPLE: error: unsupported option '-fbasic-block-sections=all' for target
|
||||
// CHECK-INVALID-VALUE: error: invalid value {{[^ ]*}} in '-fbasic-block-sections={{.*}}'
|
||||
// CHECK-OPT-NULL-LIST: "-fbasic-block-sections=list="
|
||||
|
|
Loading…
Reference in New Issue