diff options
author | Kazu Hirata <kazu@google.com> | 2023-01-14 12:31:01 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-01-14 12:31:01 -0800 |
commit | 6ad0788c332bb2043142954d300c49ac3e537f34 (patch) | |
tree | a67542ce4ca8dbcc65ef3cd01e76ff9cb861208b /clang/lib/CodeGen/BackendUtil.cpp | |
parent | ff39b7ea89476c78177aff5cb0ddb441e74c8838 (diff) | |
download | llvm-6ad0788c332bb2043142954d300c49ac3e537f34.zip llvm-6ad0788c332bb2043142954d300c49ac3e537f34.tar.gz llvm-6ad0788c332bb2043142954d300c49ac3e537f34.tar.bz2 |
[clang] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<. I'll post
a separate patch to remove #include "llvm/ADT/Optional.h".
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 16b48c6..937a8dc 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -510,8 +510,8 @@ static bool initTargetOptions(DiagnosticsEngine &Diags, return true; } -static Optional<GCOVOptions> getGCOVOptions(const CodeGenOptions &CodeGenOpts, - const LangOptions &LangOpts) { +static std::optional<GCOVOptions> +getGCOVOptions(const CodeGenOptions &CodeGenOpts, const LangOptions &LangOpts) { if (!CodeGenOpts.EmitGcovArcs && !CodeGenOpts.EmitGcovNotes) return std::nullopt; // Not using 'GCOVOptions::getDefault' allows us to avoid exiting if @@ -527,7 +527,7 @@ static Optional<GCOVOptions> getGCOVOptions(const CodeGenOptions &CodeGenOpts, return Options; } -static Optional<InstrProfOptions> +static std::optional<InstrProfOptions> getInstrProfOptions(const CodeGenOptions &CodeGenOpts, const LangOptions &LangOpts) { if (!CodeGenOpts.hasProfileClangInstr()) @@ -980,12 +980,13 @@ void EmitAssemblyHelper::RunOptimizationPipeline( addKCFIPass(TargetTriple, LangOpts, PB); } - if (Optional<GCOVOptions> Options = getGCOVOptions(CodeGenOpts, LangOpts)) + if (std::optional<GCOVOptions> Options = + getGCOVOptions(CodeGenOpts, LangOpts)) PB.registerPipelineStartEPCallback( [Options](ModulePassManager &MPM, OptimizationLevel Level) { MPM.addPass(GCOVProfilerPass(*Options)); }); - if (Optional<InstrProfOptions> Options = + if (std::optional<InstrProfOptions> Options = getInstrProfOptions(CodeGenOpts, LangOpts)) PB.registerPipelineStartEPCallback( [Options](ModulePassManager &MPM, OptimizationLevel Level) { |