components/llvm/patches/009-InitPreprocessor.patch
author Stefan Teleman <stefan.teleman@oracle.com>
Wed, 10 Feb 2016 11:54:12 -0800
changeset 5434 9f55c805ce9d
permissions -rw-r--r--
PSARC/2013/188 Clang/LLVM 15777690 clang/llvm compiler infrastructure in Solaris 21851513 severe memory corruption in the LLVM command-line parsing module 22031298 toxic bugs in LLVM ilist/plist end up eliminating entire MachineBasicBlocks 22065707 LLVM SPARC assembler generator emits wrong ELF Section flags 22346218 LLVM's assembler printer on SPARC needs a lot of work 21870061 partial template specializations in CommandLine.h are buggy 21874261 the Google Test Harness doesn't know how to count threads in Solaris 21697459 memory corruption in LLVM IR Code Generator 21341968 llc on SPARC should not need to be passed -march=sparc or -march=sparcv9 21870103 TableGen makes incorrect assumptions about anonymous namespace instantiation 21870087 naming convention for the InputFile key is inconsistent across LLVM utilities 21870099 128 bytes for a filesystem path is definitely not enough 21870067 lli makes incorrect assumptions about anonymous namespace instantiation order 21870065 llc makes incorrect assumptions about anonymous namespace instantiation order 21870283 llvm::sys::Process::GetArgumentVector should overload for std::vector 21874221 clang C++ does not properly initialize the C++ Standard Library's iostreams

# The anonymous std::string temporary created by getClangFullRepositoryVersion
# goes out-of-scope in C++11 because COW std::string is not allowed.
# I.e. the std::string buffer of the anonymous temporary goes out of scope.
# Because of this, the buffer referenced by the underlying StringRef in
# llvm::Twine is invalid as soon as the std::string temporary expires.
# The tagged clang version string must be created as a data segment global
# constant via macro, just like all the other clang version macro identifiers.
# https://llvm.org/bugs/show_bug.cgi?id=24684
--- tools/clang/include/clang/Basic/Version.inc.in	2010-06-25 13:33:46.000000000 -0400
+++ tools/clang/include/clang/Basic/Version.inc.in	2015-07-05 14:20:27.771128865 -0400
@@ -4,3 +4,4 @@
 #if @CLANG_HAS_VERSION_PATCHLEVEL@
 #define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@
 #endif
+#define CLANG_VERSION_TAGGED_STRING @CLANG_VERSION_TAGGED_STRING@
--- tools/clang/include/clang/Basic/Makefile	2014-03-31 09:14:44.000000000 -0400
+++ tools/clang/include/clang/Basic/Makefile	2015-07-05 14:19:58.972485543 -0400
@@ -16,8 +16,18 @@
 
 INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
 
+SVN_OR_RC :=
+
 # Compute the Clang version from the LLVM version, unless specified explicitly.
 ifndef CLANG_VERSION
+ifeq ($(LLVMVersion), $(findstring svn, $(LLVMVersion)), svn)
+  SVN_OR_RC := "svn"
+endif
+
+ifeq ($(LLVMVersion), $(findstring rc, $(LLVMVersion)), rc)
+  SVN_OR_RC := "rc"
+endif
+
 CLANG_VERSION := $(subst svn,,$(LLVMVersion))
 CLANG_VERSION := $(subst rc,,$(CLANG_VERSION))
 endif
@@ -26,6 +36,14 @@
 CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS))
 CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS))
 CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS))
+CLANG_VERSION_TAGGED_STRING :=
+
+ifeq ($(SVN_OR_RC),)
+CLANG_VERSION_TAGGED_STRING := "\"\(tags/RELEASE_$(CLANG_VERSION_MAJOR)$(CLANG_VERSION_MINOR)$(CLANG_VERSION_PATCHLEVEL)/final\)\""
+else
+CLANG_VERSION_TAGGED_STRING := "\"\(tags/RELEASE_$(CLANG_VERSION_MAJOR)$(CLANG_VERSION_MINOR)$(CLANG_VERSION_PATCHLEVEL)/$(SVN_OR_RC)\)\""
+endif
+
 ifeq ($(CLANG_VERSION_PATCHLEVEL),)
 CLANG_HAS_VERSION_PATCHLEVEL := 0
 else
@@ -67,4 +85,5 @@
 	           -e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \
 	           -e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \
 	           -e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
+	           -e "s#@CLANG_VERSION_TAGGED_STRING@#$(CLANG_VERSION_TAGGED_STRING:' '='')#g" \
 	           $< > $@
--- tools/clang/lib/Frontend/InitPreprocessor.cpp	2015-04-27 04:12:42.000000000 -0400
+++ tools/clang/lib/Frontend/InitPreprocessor.cpp	2015-07-05 14:24:20.804334574 -0400
@@ -470,8 +470,7 @@
   Builder.defineMacro("__clang_patchlevel__", "0");
 #endif
   Builder.defineMacro("__clang_version__", 
-                      "\"" CLANG_VERSION_STRING " "
-                      + getClangFullRepositoryVersion() + "\"");
+                      "\"" CLANG_VERSION_STRING " " CLANG_VERSION_TAGGED_STRING "\"");
 #undef TOSTR
 #undef TOSTR2
   if (!LangOpts.MSVCCompat) {