[cfe-dev] Branding of Clang binary on FreeBSD

Ed Schouten ed at 80386.nl
Thu Jun 10 05:57:45 PDT 2010


* Ed Schouten <ed at 80386.nl> wrote:
> $ clang -v
> clang r104832 20100610 [FreeBSD]
> clang version 2.0 (trunk)

Ideally I'd like to have something like:

FreeBSD clang version 2.0 (trunk 104832) [20100610]

Where we just have the option to add our own keywords at the end of the
version string. I've attached a patch that allows you to both prepend
and append version info. Comments?

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
Index: lib/Basic/Version.cpp
===================================================================
--- lib/Basic/Version.cpp	(revision 105787)
+++ lib/Basic/Version.cpp	(working copy)
@@ -65,11 +65,14 @@
 std::string getClangFullVersion() {
   std::string buf;
   llvm::raw_string_ostream OS(buf);
-#ifdef CLANG_VENDOR
-  OS << CLANG_VENDOR;
+#ifdef CLANG_VENDOR_PREFIX
+  OS << CLANG_VENDOR_PREFIX;
 #endif
   OS << "clang version " CLANG_VERSION_STRING " ("
      << getClangFullRepositoryVersion() << ')';
+#ifdef CLANG_VENDOR_SUFFIX
+  OS << CLANG_VENDOR_SUFFIX;
+#endif
   return OS.str();
 }
 
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp	(revision 105787)
+++ lib/CodeGen/CGDebugInfo.cpp	(working copy)
@@ -182,10 +182,14 @@
   }
 
   const char *Producer =
-#ifdef CLANG_VENDOR
-    CLANG_VENDOR
+#ifdef CLANG_VENDOR_PREFIX
+    CLANG_VENDOR_PREFIX
 #endif
-    "clang " CLANG_VERSION_STRING;
+    "clang " CLANG_VERSION_STRING
+#ifdef CLANG_VENDOR_SUFFIX
+    CLANG_VENDOR_SUFFIX
+#endif
+    ;
 
   // Figure out which version of the ObjC runtime we have.
   unsigned RuntimeVers = 0;
Index: Makefile
===================================================================
--- Makefile	(revision 105787)
+++ Makefile	(working copy)
@@ -34,9 +34,12 @@
 
 # Set common Clang build flags.
 CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
-ifdef CLANG_VENDOR
-CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
+ifdef CLANG_VENDOR_PREFIX
+CPP.Flags += -DCLANG_VENDOR_PREFIX='"$(CLANG_VENDOR_PREFIX) "'
 endif
+ifdef CLANG_VENDOR_SUFFIX
+CPP.Flags += -DCLANG_VENDOR_SUFFIX='"$(CLANG_VENDOR_SUFFIX) "'
+endif
 
 # Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
 # work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100610/b7de9be7/attachment.sig>


More information about the cfe-dev mailing list