diff options
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Basic/TargetID.h')
-rw-r--r-- | contrib/llvm-project/clang/include/clang/Basic/TargetID.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Basic/TargetID.h b/contrib/llvm-project/clang/include/clang/Basic/TargetID.h index 1a9785574d06..cef9cb5f0fb2 100644 --- a/contrib/llvm-project/clang/include/clang/Basic/TargetID.h +++ b/contrib/llvm-project/clang/include/clang/Basic/TargetID.h @@ -6,12 +6,13 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_BASIC_TARGET_ID_H -#define LLVM_CLANG_BASIC_TARGET_ID_H +#ifndef LLVM_CLANG_BASIC_TARGETID_H +#define LLVM_CLANG_BASIC_TARGETID_H #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" -#include "llvm/ADT/Triple.h" +#include "llvm/TargetParser/Triple.h" +#include <optional> #include <set> namespace clang { @@ -21,7 +22,7 @@ namespace clang { /// postfixed by a plus or minus sign delimited by colons, e.g. /// gfx908:xnack+:sramecc-. Each processor have a limited /// number of predefined features when showing up in a target ID. -const llvm::SmallVector<llvm::StringRef, 4> +llvm::SmallVector<llvm::StringRef, 4> getAllPossibleTargetIDFeatures(const llvm::Triple &T, llvm::StringRef Processor); @@ -31,15 +32,15 @@ llvm::StringRef getProcessorFromTargetID(const llvm::Triple &T, llvm::StringRef OffloadArch); /// Parse a target ID to get processor and feature map. -/// Returns canonicalized processor name or None if the target ID is invalid. -/// Returns target ID features in \p FeatureMap if it is not null pointer. -/// This function assumes \p OffloadArch is a valid target ID. +/// Returns canonicalized processor name or std::nullopt if the target ID is +/// invalid. Returns target ID features in \p FeatureMap if it is not null +/// pointer. This function assumes \p OffloadArch is a valid target ID. /// If the target ID contains feature+, map it to true. /// If the target ID contains feature-, map it to false. /// If the target ID does not contain a feature (default), do not map it. -llvm::Optional<llvm::StringRef> -parseTargetID(const llvm::Triple &T, llvm::StringRef OffloadArch, - llvm::StringMap<bool> *FeatureMap); +std::optional<llvm::StringRef> parseTargetID(const llvm::Triple &T, + llvm::StringRef OffloadArch, + llvm::StringMap<bool> *FeatureMap); /// Returns canonical target ID, assuming \p Processor is canonical and all /// entries in \p Features are valid. @@ -48,9 +49,13 @@ std::string getCanonicalTargetID(llvm::StringRef Processor, /// Get the conflicted pair of target IDs for a compilation or a bundled code /// object, assuming \p TargetIDs are canonicalized. If there is no conflicts, -/// returns None. -llvm::Optional<std::pair<llvm::StringRef, llvm::StringRef>> +/// returns std::nullopt. +std::optional<std::pair<llvm::StringRef, llvm::StringRef>> getConflictTargetIDCombination(const std::set<llvm::StringRef> &TargetIDs); + +/// Check whether the provided target ID is compatible with the requested +/// target ID. +bool isCompatibleTargetID(llvm::StringRef Provided, llvm::StringRef Requested); } // namespace clang #endif |