summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-04-06 14:26:30 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-04-06 14:26:30 +0000
commitad50feae0bd11d6109aa475ead52d147328ed2f8 (patch)
tree2801f35f684850e15355a2c44c54f5ca6980b9b3 /gnu
parent05b482601ab8d146eb75622c849d1d3b83604fa7 (diff)
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/llvm/tools/clang/lib/Basic/Targets/OSTargets.h113
1 files changed, 17 insertions, 96 deletions
diff --git a/gnu/llvm/tools/clang/lib/Basic/Targets/OSTargets.h b/gnu/llvm/tools/clang/lib/Basic/Targets/OSTargets.h
index 09867d82c38..5af63615dc5 100644
--- a/gnu/llvm/tools/clang/lib/Basic/Targets/OSTargets.h
+++ b/gnu/llvm/tools/clang/lib/Basic/Targets/OSTargets.h
@@ -95,22 +95,16 @@ public:
if (Triple.isMacOSX())
this->TLSSupported = !Triple.isMacOSXVersionLT(10, 7);
else if (Triple.isiOS()) {
- // 64-bit iOS supported it from 8 onwards, 32-bit device from 9 onwards,
- // 32-bit simulator from 10 onwards.
- if (Triple.isArch64Bit())
+ // 64-bit iOS supported it from 8 onwards, 32-bit from 9 onwards.
+ if (Triple.getArch() == llvm::Triple::x86_64 ||
+ Triple.getArch() == llvm::Triple::aarch64)
this->TLSSupported = !Triple.isOSVersionLT(8);
- else if (Triple.isArch32Bit()) {
- if (!Triple.isSimulatorEnvironment())
- this->TLSSupported = !Triple.isOSVersionLT(9);
- else
- this->TLSSupported = !Triple.isOSVersionLT(10);
- }
- } else if (Triple.isWatchOS()) {
- if (!Triple.isSimulatorEnvironment())
- this->TLSSupported = !Triple.isOSVersionLT(2);
- else
- this->TLSSupported = !Triple.isOSVersionLT(3);
- }
+ else if (Triple.getArch() == llvm::Triple::x86 ||
+ Triple.getArch() == llvm::Triple::arm ||
+ Triple.getArch() == llvm::Triple::thumb)
+ this->TLSSupported = !Triple.isOSVersionLT(9);
+ } else if (Triple.isWatchOS())
+ this->TLSSupported = !Triple.isOSVersionLT(2);
this->MCountName = "\01mcount";
}
@@ -133,15 +127,6 @@ public:
/// is very similar to ELF's "protected"; Darwin requires a "weak"
/// attribute on declarations that can be dynamically replaced.
bool hasProtectedVisibility() const override { return false; }
-
- TargetInfo::IntType getLeastIntTypeByWidth(unsigned BitWidth,
- bool IsSigned) const final {
- // Darwin uses `long long` for `int_least64_t` and `int_fast64_t`.
- return BitWidth == 64
- ? (IsSigned ? TargetInfo::SignedLongLong
- : TargetInfo::UnsignedLongLong)
- : TargetInfo::getLeastIntTypeByWidth(BitWidth, IsSigned);
- }
};
// DragonFlyBSD Target
@@ -266,8 +251,6 @@ protected:
Builder.defineMacro("__HAIKU__");
Builder.defineMacro("__ELF__");
DefineStd(Builder, "unix", Opts);
- if (this->HasFloat128)
- Builder.defineMacro("__FLOAT128__");
}
public:
@@ -278,40 +261,9 @@ public:
this->PtrDiffType = TargetInfo::SignedLong;
this->ProcessIDType = TargetInfo::SignedLong;
this->TLSSupported = false;
- switch (Triple.getArch()) {
- default:
- break;
- case llvm::Triple::x86:
- case llvm::Triple::x86_64:
- this->HasFloat128 = true;
- break;
- }
}
};
-// Hurd target
-template <typename Target>
-class LLVM_LIBRARY_VISIBILITY HurdTargetInfo : public OSTargetInfo<Target> {
-protected:
- void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
- MacroBuilder &Builder) const override {
- // Hurd defines; list based off of gcc output.
- DefineStd(Builder, "unix", Opts);
- Builder.defineMacro("__GNU__");
- Builder.defineMacro("__gnu_hurd__");
- Builder.defineMacro("__MACH__");
- Builder.defineMacro("__GLIBC__");
- Builder.defineMacro("__ELF__");
- if (Opts.POSIXThreads)
- Builder.defineMacro("_REENTRANT");
- if (Opts.CPlusPlus)
- Builder.defineMacro("_GNU_SOURCE");
- }
-public:
- HurdTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
- : OSTargetInfo<Target>(Triple, Opts) {}
-};
-
// Minix Target
template <typename Target>
class LLVM_LIBRARY_VISIBILITY MinixTargetInfo : public OSTargetInfo<Target> {
@@ -345,6 +297,7 @@ protected:
// Linux defines; list based off of gcc output
DefineStd(Builder, "unix", Opts);
DefineStd(Builder, "linux", Opts);
+ Builder.defineMacro("__gnu_linux__");
Builder.defineMacro("__ELF__");
if (Triple.isAndroid()) {
Builder.defineMacro("__ANDROID__", "1");
@@ -354,8 +307,6 @@ protected:
this->PlatformMinVersion = VersionTuple(Maj, Min, Rev);
if (Maj)
Builder.defineMacro("__ANDROID_API__", Twine(Maj));
- } else {
- Builder.defineMacro("__gnu_linux__");
}
if (Opts.POSIXThreads)
Builder.defineMacro("_REENTRANT");
@@ -384,6 +335,7 @@ public:
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
+ case llvm::Triple::systemz:
this->HasFloat128 = true;
break;
}
@@ -411,7 +363,7 @@ protected:
public:
NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
- this->MCountName = "__mcount";
+ this->MCountName = "_mcount";
}
};
@@ -439,7 +391,7 @@ public:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
this->HasFloat128 = true;
- LLVM_FALLTHROUGH;
+ // FALLTHROUGH
default:
this->MCountName = "__mcount";
break;
@@ -527,7 +479,6 @@ public:
default:
case llvm::Triple::x86_64:
this->MCountName = ".mcount";
- this->NewAlign = 256;
break;
}
}
@@ -593,24 +544,13 @@ protected:
Builder.defineMacro("_LARGEFILE_SOURCE");
Builder.defineMacro("_LARGEFILE64_SOURCE");
Builder.defineMacro("__EXTENSIONS__");
- if (Opts.POSIXThreads)
- Builder.defineMacro("_REENTRANT");
- if (this->HasFloat128)
- Builder.defineMacro("__FLOAT128__");
+ Builder.defineMacro("_REENTRANT");
}
public:
SolarisTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
// FIXME: WIntType should be SignedLong
- switch (Triple.getArch()) {
- default:
- break;
- case llvm::Triple::x86:
- case llvm::Triple::x86_64:
- this->HasFloat128 = true;
- break;
- }
}
};
@@ -659,10 +599,8 @@ protected:
Builder.defineMacro("_HAS_CHAR16_T_LANGUAGE_SUPPORT", Twine(1));
if (Opts.isCompatibleWithMSVC(LangOptions::MSVC2015)) {
- if (Opts.CPlusPlus2a)
- Builder.defineMacro("_MSVC_LANG", "201704L");
- else if (Opts.CPlusPlus17)
- Builder.defineMacro("_MSVC_LANG", "201703L");
+ if (Opts.CPlusPlus17)
+ Builder.defineMacro("_MSVC_LANG", "201403L");
else if (Opts.CPlusPlus14)
Builder.defineMacro("_MSVC_LANG", "201402L");
}
@@ -685,7 +623,6 @@ public:
WindowsTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
this->WCharType = TargetInfo::UnsignedShort;
- this->WIntType = TargetInfo::UnsignedShort;
}
};
@@ -764,9 +701,8 @@ public:
template <typename Target>
class LLVM_LIBRARY_VISIBILITY WebAssemblyOSTargetInfo
: public OSTargetInfo<Target> {
-protected:
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
- MacroBuilder &Builder) const {
+ MacroBuilder &Builder) const final {
// A common platform macro.
if (Opts.POSIXThreads)
Builder.defineMacro("_REENTRANT");
@@ -784,21 +720,6 @@ public:
}
};
-// WASI target
-template <typename Target>
-class LLVM_LIBRARY_VISIBILITY WASITargetInfo
- : public WebAssemblyOSTargetInfo<Target> {
- void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
- MacroBuilder &Builder) const final {
- WebAssemblyOSTargetInfo<Target>::getOSDefines(Opts, Triple, Builder);
- Builder.defineMacro("__wasi__");
- }
-
-public:
- explicit WASITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
- : WebAssemblyOSTargetInfo<Target>(Triple, Opts) {}
-};
-
} // namespace targets
} // namespace clang
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_OSTARGETS_H