[cfe-commits] r94919 - /cfe/trunk/lib/Basic/Targets.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sat Jan 30 11:55:01 PST 2010
Author: d0k
Date: Sat Jan 30 13:55:01 2010
New Revision: 94919
URL: http://llvm.org/viewvc/llvm-project?rev=94919&view=rev
Log:
Simplify FreeBSD version parsing.
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=94919&r1=94918&r2=94919&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Jan 30 13:55:01 2010
@@ -195,16 +195,10 @@
// FreeBSD defines; list based off of gcc output
// FIXME: Move version number handling to llvm::Triple.
- const char *FreeBSD = strstr(Triple.getTriple().c_str(),
- "-freebsd");
- FreeBSD += strlen("-freebsd");
- char release[] = "X";
- release[0] = FreeBSD[0];
- char version[] = "X00001";
- version[0] = FreeBSD[0];
+ llvm::StringRef Release = Triple.getOSName().substr(strlen("freebsd"), 1);
- Builder.defineMacro("__FreeBSD__", release);
- Builder.defineMacro("__FreeBSD_cc_version", version);
+ Builder.defineMacro("__FreeBSD__", Release);
+ Builder.defineMacro("__FreeBSD_cc_version", Release + "00001");
Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
DefineStd(Builder, "unix", Opts);
Builder.defineMacro("__ELF__");
More information about the cfe-commits
mailing list