components/llvm/patches/009-InitPreprocessor.patch
changeset 6512 92717ce71105
parent 6511 d283aa33e131
child 6513 ea2097ba7d67
--- a/components/llvm/patches/009-InitPreprocessor.patch	Thu Jul 28 16:15:45 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-# 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) {