From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- .../Tooling/InterpolatingCompilationDatabase.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'clang/lib/Tooling/InterpolatingCompilationDatabase.cpp') diff --git a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp index 0143b5f8df6b..ff9cb4b62073 100644 --- a/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp +++ b/clang/lib/Tooling/InterpolatingCompilationDatabase.cpp @@ -49,9 +49,7 @@ #include "clang/Tooling/CompilationDatabase.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/OptTable.h" #include "llvm/Support/Debug.h" @@ -59,6 +57,7 @@ #include "llvm/Support/StringSaver.h" #include "llvm/Support/raw_ostream.h" #include +#include namespace clang { namespace tooling { @@ -129,7 +128,7 @@ struct TransferableCommand { // Flags that should not apply to all files are stripped from CommandLine. CompileCommand Cmd; // Language detected from -x or the filename. Never TY_INVALID. - Optional Type; + std::optional Type; // Standard specified by -std. LangStandard::Kind Std = LangStandard::lang_unspecified; // Whether the command line is for the cl-compatible driver. @@ -148,7 +147,7 @@ struct TransferableCommand { TmpArgv.push_back(S.c_str()); ClangCLMode = !TmpArgv.empty() && driver::IsClangCL(driver::getDriverMode( - TmpArgv.front(), llvm::makeArrayRef(TmpArgv).slice(1))); + TmpArgv.front(), llvm::ArrayRef(TmpArgv).slice(1))); ArgList = {TmpArgv.begin(), TmpArgv.end()}; } @@ -165,8 +164,8 @@ struct TransferableCommand { const unsigned OldPos = Pos; std::unique_ptr Arg(OptTable.ParseOneArg( ArgList, Pos, - /* Include */ ClangCLMode ? CoreOption | CLOption : 0, - /* Exclude */ ClangCLMode ? 0 : CLOption)); + /* Include */ ClangCLMode ? CoreOption | CLOption | CLDXCOption : 0, + /* Exclude */ ClangCLMode ? 0 : CLOption | CLDXCOption)); if (!Arg) continue; @@ -208,7 +207,7 @@ struct TransferableCommand { Type = foldType(*Type); // The contract is to store None instead of TY_INVALID. if (Type == types::TY_INVALID) - Type = llvm::None; + Type = std::nullopt; } // Produce a CompileCommand for \p filename, based on this one. @@ -280,7 +279,7 @@ private: } // Try to interpret the argument as a type specifier, e.g. '-x'. - Optional tryParseTypeArg(const llvm::opt::Arg &Arg) { + std::optional tryParseTypeArg(const llvm::opt::Arg &Arg) { const llvm::opt::Option &Opt = Arg.getOption(); using namespace driver::options; if (ClangCLMode) { @@ -292,15 +291,15 @@ private: if (Opt.matches(driver::options::OPT_x)) return types::lookupTypeForTypeSpecifier(Arg.getValue()); } - return None; + return std::nullopt; } // Try to interpret the argument as '-std='. - Optional tryParseStdArg(const llvm::opt::Arg &Arg) { + std::optional tryParseStdArg(const llvm::opt::Arg &Arg) { using namespace driver::options; if (Arg.getOption().matches(ClangCLMode ? OPT__SLASH_std : OPT_std_EQ)) return LangStandard::getLangKind(Arg.getValue()); - return None; + return std::nullopt; } }; -- cgit v1.2.3