r190048 - Fix bug #17104 - Target info for GNU/kFreeBSD were missing.
Sylvestre Ledru
sylvestre at debian.org
Thu Sep 5 06:47:07 PDT 2013
Author: sylvestre
Date: Thu Sep 5 08:47:07 2013
New Revision: 190048
URL: http://llvm.org/viewvc/llvm-project?rev=190048&view=rev
Log:
Fix bug #17104 - Target info for GNU/kFreeBSD were missing.
As a result, Clang doesn't define the pre-processor macros that are expected
on this platform.
Thanks to Robert Millan for the patch
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=190048&r1=190047&r2=190048&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Sep 5 08:47:07 2013
@@ -278,6 +278,30 @@ public:
}
};
+// GNU/kFreeBSD Target
+template<typename Target>
+class KFreeBSDTargetInfo : public OSTargetInfo<Target> {
+protected:
+ virtual void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+ MacroBuilder &Builder) const {
+ // GNU/kFreeBSD defines; list based off of gcc output
+
+ DefineStd(Builder, "unix", Opts);
+ Builder.defineMacro("__FreeBSD_kernel__");
+ Builder.defineMacro("__GLIBC__");
+ Builder.defineMacro("__ELF__");
+ if (Opts.POSIXThreads)
+ Builder.defineMacro("_REENTRANT");
+ if (Opts.CPlusPlus)
+ Builder.defineMacro("_GNU_SOURCE");
+ }
+public:
+ KFreeBSDTargetInfo(const std::string &triple)
+ : OSTargetInfo<Target>(triple) {
+ this->UserLabelPrefix = "";
+ }
+};
+
// Minix Target
template<typename Target>
class MinixTargetInfo : public OSTargetInfo<Target> {
@@ -5470,6 +5494,8 @@ static TargetInfo *AllocateTarget(const
return new BitrigI386TargetInfo(Triple);
case llvm::Triple::FreeBSD:
return new FreeBSDTargetInfo<X86_32TargetInfo>(Triple);
+ case llvm::Triple::KFreeBSD:
+ return new KFreeBSDTargetInfo<X86_32TargetInfo>(Triple);
case llvm::Triple::Minix:
return new MinixTargetInfo<X86_32TargetInfo>(Triple);
case llvm::Triple::Solaris:
@@ -5509,6 +5535,8 @@ static TargetInfo *AllocateTarget(const
return new BitrigX86_64TargetInfo(Triple);
case llvm::Triple::FreeBSD:
return new FreeBSDTargetInfo<X86_64TargetInfo>(Triple);
+ case llvm::Triple::KFreeBSD:
+ return new KFreeBSDTargetInfo<X86_64TargetInfo>(Triple);
case llvm::Triple::Solaris:
return new SolarisTargetInfo<X86_64TargetInfo>(Triple);
case llvm::Triple::MinGW32:
More information about the cfe-commits
mailing list