-fbasic-block-sections=list=: Suppress output if failed to open the file
Reviewed By: tmsriram Differential Revision: https://reviews.llvm.org/D90815
This commit is contained in:
parent
4b42757940
commit
e625f9c5d1
@ -446,7 +446,7 @@ static CodeGenFileType getCodeGenFileType(BackendAction Action) {
|
||||
}
|
||||
}
|
||||
|
||||
static void initTargetOptions(DiagnosticsEngine &Diags,
|
||||
static bool initTargetOptions(DiagnosticsEngine &Diags,
|
||||
llvm::TargetOptions &Options,
|
||||
const CodeGenOptions &CodeGenOpts,
|
||||
const clang::TargetOptions &TargetOpts,
|
||||
@ -517,11 +517,12 @@ static void initTargetOptions(DiagnosticsEngine &Diags,
|
||||
if (Options.BBSections == llvm::BasicBlockSection::List) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =
|
||||
MemoryBuffer::getFile(CodeGenOpts.BBSections.substr(5));
|
||||
if (!MBOrErr)
|
||||
if (!MBOrErr) {
|
||||
Diags.Report(diag::err_fe_unable_to_load_basic_block_sections_file)
|
||||
<< MBOrErr.getError().message();
|
||||
else
|
||||
Options.BBSectionsFuncListBuf = std::move(*MBOrErr);
|
||||
return false;
|
||||
}
|
||||
Options.BBSectionsFuncListBuf = std::move(*MBOrErr);
|
||||
}
|
||||
|
||||
Options.EnableMachineFunctionSplitter = CodeGenOpts.SplitMachineFunctions;
|
||||
@ -572,6 +573,8 @@ static void initTargetOptions(DiagnosticsEngine &Diags,
|
||||
Entry.IgnoreSysRoot ? Entry.Path : HSOpts.Sysroot + Entry.Path);
|
||||
Options.MCOptions.Argv0 = CodeGenOpts.Argv0;
|
||||
Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static Optional<GCOVOptions> getGCOVOptions(const CodeGenOptions &CodeGenOpts,
|
||||
@ -858,7 +861,9 @@ void EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
|
||||
CodeGenOpt::Level OptLevel = getCGOptLevel(CodeGenOpts);
|
||||
|
||||
llvm::TargetOptions Options;
|
||||
initTargetOptions(Diags, Options, CodeGenOpts, TargetOpts, LangOpts, HSOpts);
|
||||
if (!initTargetOptions(Diags, Options, CodeGenOpts, TargetOpts, LangOpts,
|
||||
HSOpts))
|
||||
return;
|
||||
TM.reset(TheTarget->createTargetMachine(Triple, TargetOpts.CPU, FeaturesStr,
|
||||
Options, RM, CM, OptLevel));
|
||||
}
|
||||
|
||||
@ -6,7 +6,9 @@
|
||||
// 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-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=ERROR
|
||||
// RUN: rm -f %t
|
||||
// RUN: not %clang_cc1 -fbasic-block-sections=list= -emit-obj -o %t %s 2>&1 | FileCheck %s --check-prefix=ERROR
|
||||
// RUN: not ls %t
|
||||
|
||||
int world(int a) {
|
||||
if (a > 10)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user