From 1235e5421563217713beb9d68f29a085cad25c40 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 6 Aug 2015 22:11:54 +0000 Subject: [PATCH] Continue the work from r243908 by adding a Features field to Builtin::Info so that we can populate it on a per-target basis with required features. Future commits will start using this information for warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244286 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Builtins.h | 5 +++++ lib/Basic/Targets.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index c5cf10ccf0..554143d6be 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -51,6 +51,7 @@ enum ID { struct Info { const char *Name, *Type, *Attributes, *HeaderName; LanguageID Langs; + const char *Features; }; /// \brief Holds information about both target-independent and @@ -166,6 +167,10 @@ public: return strchr(getRecord(ID).Attributes, 'e') != nullptr; } + const char *getRequiredFeatures(unsigned ID) const { + return getRecord(ID).Features; + } + private: const Info &getRecord(unsigned ID) const; diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index d85e28b753..993f48ded3 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -2001,8 +2001,10 @@ void AMDGPUTargetInfo::getGCCRegNames(const char * const *&Names, // Namespace for x86 abstract base class const Builtin::Info BuiltinInfo[] = { #define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES }, -#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\ - ALL_LANGUAGES }, +#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \ + { #ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES }, +#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \ + { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES, FEATURE }, #include "clang/Basic/BuiltinsX86.def" }; -- 2.40.0