diff options
Diffstat (limited to 'clang/lib/Tooling/InterpolatingCompilationDatabase.cpp')
-rw-r--r-- | clang/lib/Tooling/InterpolatingCompilationDatabase.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
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 <memory> +#include <optional> 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<types::ID> Type; + std::optional<types::ID> 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<llvm::opt::Arg> 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<types::ID> tryParseTypeArg(const llvm::opt::Arg &Arg) { + std::optional<types::ID> 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<LangStandard::Kind> tryParseStdArg(const llvm::opt::Arg &Arg) { + std::optional<LangStandard::Kind> 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; } }; |