addr2line updated this revision to Diff 482418. addr2line added a comment. finally
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139919/new/ https://reviews.llvm.org/D139919 Files: clang-tools-extra/clang-tidy/ClangTidyCheck.cpp clang-tools-extra/clang-tidy/ClangTidyCheck.h clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h llvm/include/llvm/Support/YAMLParser.h llvm/lib/Support/YAMLParser.cpp llvm/lib/Support/YAMLTraits.cpp
Index: llvm/lib/Support/YAMLTraits.cpp =================================================================== --- llvm/lib/Support/YAMLTraits.cpp +++ llvm/lib/Support/YAMLTraits.cpp @@ -25,6 +25,7 @@ #include <cassert> #include <cstdint> #include <cstring> +#include <optional> #include <string> #include <vector> @@ -886,7 +887,7 @@ } StringRef ScalarTraits<bool>::input(StringRef Scalar, void *, bool &Val) { - if (llvm::Optional<bool> Parsed = parseBool(Scalar)) { + if (std::optional<bool> Parsed = parseBool(Scalar)) { Val = *Parsed; return StringRef(); } Index: llvm/lib/Support/YAMLParser.cpp =================================================================== --- llvm/lib/Support/YAMLParser.cpp +++ llvm/lib/Support/YAMLParser.cpp @@ -31,6 +31,7 @@ #include <cstdint> #include <map> #include <memory> +#include <optional> #include <string> #include <system_error> #include <utility> @@ -760,7 +761,7 @@ return EscapedInput; } -llvm::Optional<bool> yaml::parseBool(StringRef S) { +std::optional<bool> yaml::parseBool(StringRef S) { switch (S.size()) { case 1: switch (S.front()) { Index: llvm/include/llvm/Support/YAMLParser.h =================================================================== --- llvm/include/llvm/Support/YAMLParser.h +++ llvm/include/llvm/Support/YAMLParser.h @@ -45,6 +45,7 @@ #include <iterator> #include <map> #include <memory> +#include <optional> #include <string> #include <system_error> @@ -78,7 +79,7 @@ std::string escape(StringRef Input, bool EscapePrintable = true); /// Parse \p S as a bool according to https://yaml.org/type/bool.html. -llvm::Optional<bool> parseBool(StringRef S); +std::optional<bool> parseBool(StringRef S); /// This class represents a YAML stream potentially containing multiple /// documents. Index: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h =================================================================== --- clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h +++ clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h @@ -10,7 +10,8 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_IDENTIFIERNAMINGCHECK_H #include "../utils/RenamerClangTidyCheck.h" -#include "llvm/ADT/Optional.h" +#include <optional> + namespace clang { namespace tidy { namespace readability { Index: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -424,7 +424,7 @@ if (Iter == StrMap.end()) return false; - llvm::Optional<bool> Parsed = llvm::yaml::parseBool(Iter->getValue()); + std::optional<bool> Parsed = llvm::yaml::parseBool(Iter->getValue()); return *Parsed; } Index: clang-tools-extra/clang-tidy/ClangTidyCheck.h =================================================================== --- clang-tools-extra/clang-tidy/ClangTidyCheck.h +++ clang-tools-extra/clang-tidy/ClangTidyCheck.h @@ -13,7 +13,7 @@ #include "ClangTidyOptions.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/Diagnostic.h" -#include "llvm/ADT/Optional.h" +#include <optional> #include <type_traits> #include <utility> #include <vector> @@ -155,7 +155,7 @@ /// Reads the option with the check-local name \p LocalName from the /// ``CheckOptions``. If the corresponding key is not present, return /// ``std::nullopt``. - llvm::Optional<StringRef> get(StringRef LocalName) const; + std::optional<StringRef> get(StringRef LocalName) const; /// Read a named option from the ``Context``. /// @@ -170,7 +170,7 @@ /// global ``CheckOptions``. Gets local option first. If local is not /// present, falls back to get global option. If global option is not /// present either, return ``std::nullopt``. - llvm::Optional<StringRef> getLocalOrGlobal(StringRef LocalName) const; + std::optional<StringRef> getLocalOrGlobal(StringRef LocalName) const; /// Read a named option from the ``Context``. /// @@ -190,9 +190,9 @@ /// If the corresponding key can't be parsed as a ``T``, emit a /// diagnostic and return ``std::nullopt``. template <typename T> - std::enable_if_t<std::is_integral<T>::value, llvm::Optional<T>> + std::enable_if_t<std::is_integral<T>::value, std::optional<T>> get(StringRef LocalName) const { - if (llvm::Optional<StringRef> Value = get(LocalName)) { + if (std::optional<StringRef> Value = get(LocalName)) { T Result{}; if (!StringRef(*Value).getAsInteger(10, Result)) return Result; @@ -227,9 +227,9 @@ /// If the corresponding key can't be parsed as a ``T``, emit a /// diagnostic and return ``std::nullopt``. template <typename T> - std::enable_if_t<std::is_integral<T>::value, llvm::Optional<T>> + std::enable_if_t<std::is_integral<T>::value, std::optional<T>> getLocalOrGlobal(StringRef LocalName) const { - llvm::Optional<StringRef> ValueOr = get(LocalName); + std::optional<StringRef> ValueOr = get(LocalName); bool IsGlobal = false; if (!ValueOr) { IsGlobal = true; @@ -274,9 +274,9 @@ /// \ref clang::tidy::OptionEnumMapping must be specialized for ``T`` to /// supply the mapping required to convert between ``T`` and a string. template <typename T> - std::enable_if_t<std::is_enum<T>::value, llvm::Optional<T>> + std::enable_if_t<std::is_enum<T>::value, std::optional<T>> get(StringRef LocalName, bool IgnoreCase = false) const { - if (llvm::Optional<int64_t> ValueOr = + if (std::optional<int64_t> ValueOr = getEnumInt(LocalName, typeEraseMapping<T>(), false, IgnoreCase)) return static_cast<T>(*ValueOr); return std::nullopt; @@ -314,9 +314,9 @@ /// \ref clang::tidy::OptionEnumMapping must be specialized for ``T`` to /// supply the mapping required to convert between ``T`` and a string. template <typename T> - std::enable_if_t<std::is_enum<T>::value, llvm::Optional<T>> + std::enable_if_t<std::is_enum<T>::value, std::optional<T>> getLocalOrGlobal(StringRef LocalName, bool IgnoreCase = false) const { - if (llvm::Optional<int64_t> ValueOr = + if (std::optional<int64_t> ValueOr = getEnumInt(LocalName, typeEraseMapping<T>(), true, IgnoreCase)) return static_cast<T>(*ValueOr); return std::nullopt; @@ -378,9 +378,9 @@ private: using NameAndValue = std::pair<int64_t, StringRef>; - llvm::Optional<int64_t> getEnumInt(StringRef LocalName, - ArrayRef<NameAndValue> Mapping, - bool CheckGlobal, bool IgnoreCase) const; + std::optional<int64_t> getEnumInt(StringRef LocalName, + ArrayRef<NameAndValue> Mapping, + bool CheckGlobal, bool IgnoreCase) const; template <typename T> std::enable_if_t<std::is_enum<T>::value, std::vector<NameAndValue>> @@ -433,7 +433,7 @@ /// If the corresponding key can't be parsed as a bool, emit a /// diagnostic and return ``std::nullopt``. template <> -llvm::Optional<bool> +std::optional<bool> ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName) const; /// Read a named option from the ``Context`` and parse it as a bool. @@ -445,7 +445,7 @@ /// If the corresponding key can't be parsed as a bool, emit a /// diagnostic and return \p Default. template <> -llvm::Optional<bool> +std::optional<bool> ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName) const; /// Stores an option with the check-local name \p LocalName with Index: clang-tools-extra/clang-tidy/ClangTidyCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/ClangTidyCheck.cpp +++ clang-tools-extra/clang-tidy/ClangTidyCheck.cpp @@ -51,7 +51,7 @@ : NamePrefix((CheckName + ".").str()), CheckOptions(CheckOptions), Context(Context) {} -llvm::Optional<StringRef> +std::optional<StringRef> ClangTidyCheck::OptionsView::get(StringRef LocalName) const { if (Context->getOptionsCollector()) Context->getOptionsCollector()->insert((NamePrefix + LocalName).str()); @@ -80,7 +80,7 @@ return IterGlobal; } -llvm::Optional<StringRef> +std::optional<StringRef> ClangTidyCheck::OptionsView::getLocalOrGlobal(StringRef LocalName) const { auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName, Context->getOptionsCollector()); @@ -89,10 +89,10 @@ return std::nullopt; } -static Optional<bool> getAsBool(StringRef Value, - const llvm::Twine &LookupName) { +static std::optional<bool> getAsBool(StringRef Value, + const llvm::Twine &LookupName) { - if (llvm::Optional<bool> Parsed = llvm::yaml::parseBool(Value)) + if (std::optional<bool> Parsed = llvm::yaml::parseBool(Value)) return *Parsed; // To maintain backwards compatability, we support parsing numbers as // booleans, even though its not supported in YAML. @@ -103,9 +103,9 @@ } template <> -llvm::Optional<bool> +std::optional<bool> ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName) const { - if (llvm::Optional<StringRef> ValueOr = get(LocalName)) { + if (std::optional<StringRef> ValueOr = get(LocalName)) { if (auto Result = getAsBool(*ValueOr, NamePrefix + LocalName)) return Result; diagnoseBadBooleanOption(NamePrefix + LocalName, *ValueOr); @@ -114,7 +114,7 @@ } template <> -llvm::Optional<bool> +std::optional<bool> ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName) const { auto Iter = findPriorityOption(CheckOptions, NamePrefix, LocalName, Context->getOptionsCollector()); @@ -145,7 +145,7 @@ store(Options, LocalName, Value ? StringRef("true") : StringRef("false")); } -llvm::Optional<int64_t> ClangTidyCheck::OptionsView::getEnumInt( +std::optional<int64_t> ClangTidyCheck::OptionsView::getEnumInt( StringRef LocalName, ArrayRef<NameAndValue> Mapping, bool CheckGlobal, bool IgnoreCase) const { if (!CheckGlobal && Context->getOptionsCollector())
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits