Move the darwin define static function to be close to the OS define.

llvm-svn: 248539
This commit is contained in:
Eric Christopher 2015-09-24 21:17:04 +00:00
parent d8eb961b0f
commit 7d0c7255c5
1 changed files with 23 additions and 24 deletions

View File

@ -84,6 +84,28 @@ public:
}; };
// CloudABI Target
template <typename Target>
class CloudABITargetInfo : public OSTargetInfo<Target> {
protected:
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
MacroBuilder &Builder) const override {
Builder.defineMacro("__CloudABI__");
Builder.defineMacro("__ELF__");
// CloudABI uses ISO/IEC 10646:2012 for wchar_t, char16_t and char32_t.
Builder.defineMacro("__STDC_ISO_10646__", "201206L");
Builder.defineMacro("__STDC_UTF_16__");
Builder.defineMacro("__STDC_UTF_32__");
}
public:
CloudABITargetInfo(const llvm::Triple &Triple)
: OSTargetInfo<Target>(Triple) {
this->UserLabelPrefix = "";
}
};
static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
const llvm::Triple &Triple, const llvm::Triple &Triple,
StringRef &PlatformName, StringRef &PlatformName,
@ -148,8 +170,7 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
Str[3] = '0' + (Rev / 10); Str[3] = '0' + (Rev / 10);
Str[4] = '0' + (Rev % 10); Str[4] = '0' + (Rev % 10);
Str[5] = '\0'; Str[5] = '\0';
Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", Builder.defineMacro("__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__", Str);
Str);
} else if (Triple.isMacOSX()) { } else if (Triple.isMacOSX()) {
// Note that the Driver allows versions which aren't representable in the // Note that the Driver allows versions which aren't representable in the
// define (because we only get a single digit for the minor and micro // define (because we only get a single digit for the minor and micro
@ -183,28 +204,6 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
PlatformMinVersion = VersionTuple(Maj, Min, Rev); PlatformMinVersion = VersionTuple(Maj, Min, Rev);
} }
// CloudABI Target
template <typename Target>
class CloudABITargetInfo : public OSTargetInfo<Target> {
protected:
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
MacroBuilder &Builder) const override {
Builder.defineMacro("__CloudABI__");
Builder.defineMacro("__ELF__");
// CloudABI uses ISO/IEC 10646:2012 for wchar_t, char16_t and char32_t.
Builder.defineMacro("__STDC_ISO_10646__", "201206L");
Builder.defineMacro("__STDC_UTF_16__");
Builder.defineMacro("__STDC_UTF_32__");
}
public:
CloudABITargetInfo(const llvm::Triple &Triple)
: OSTargetInfo<Target>(Triple) {
this->UserLabelPrefix = "";
}
};
template<typename Target> template<typename Target>
class DarwinTargetInfo : public OSTargetInfo<Target> { class DarwinTargetInfo : public OSTargetInfo<Target> {
protected: protected: