llvm_unreachable("bad ABI kind");
}
- /// Try to parse an ABI name, returning false on error.
- bool tryParse(llvm::StringRef name);
-
friend bool operator==(const TargetCXXABI &left, const TargetCXXABI &right) {
return left.getKind() == right.getKind();
}
return false;
}
- /// \brief Use this specified C++ ABI.
- ///
- /// \return False on error (invalid C++ ABI name).
- bool setCXXABI(llvm::StringRef name) {
- TargetCXXABI ABI;
- if (!ABI.tryParse(name)) return false;
- return setCXXABI(ABI);
- }
-
- /// \brief Set the C++ ABI to be used by this implementation.
- ///
- /// \return False on error (ABI not valid on this target)
- virtual bool setCXXABI(TargetCXXABI ABI) {
- TheCXXABI = ABI;
- return true;
- }
-
/// \brief Enable or disable a specific target feature;
/// the feature name must be valid.
virtual void setFeatureEnabled(llvm::StringMap<bool> &Features,
return true;
}
-
-bool TargetCXXABI::tryParse(llvm::StringRef name) {
- const Kind unknown = static_cast<Kind>(-1);
- Kind kind = llvm::StringSwitch<Kind>(name)
- .Case("arm", GenericARM)
- .Case("ios", iOS)
- .Case("itanium", GenericItanium)
- .Case("microsoft", Microsoft)
- .Case("mips", GenericMIPS)
- .Default(unknown);
- if (kind == unknown) return false;
-
- set(kind);
- return true;
-}