!11 Upgrade to latest version of clang

Merge pull request !11 from Shinwell_Hu/master
This commit is contained in:
openeuler-ci-bot 2020-07-07 14:19:48 +08:00 committed by Gitee
commit 9049b919ca
9 changed files with 29 additions and 365 deletions

View File

@ -1,52 +0,0 @@
From a1bccf89a02accab69b359ef004faa95257333c0 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Fri, 7 Sep 2018 18:27:16 +0000
Subject: [PATCH] Convert clang-format-diff.py to python3 using 2to3
---
tools/clang-format/clang-format-diff.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py
index ffa30e70dd..1525a3815c 100755
--- a/tools/clang-format/clang-format-diff.py
+++ b/tools/clang-format/clang-format-diff.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
#
@@ -27,7 +27,7 @@ import difflib
import re
import string
import subprocess
-import StringIO
+import io
import sys
@@ -89,9 +89,9 @@ def main():
['-lines', str(start_line) + ':' + str(end_line)])
# Reformat files containing changes in place.
- for filename, lines in lines_by_file.iteritems():
+ for filename, lines in lines_by_file.items():
if args.i and args.verbose:
- print 'Formatting', filename
+ print('Formatting', filename)
command = [args.binary, filename]
if args.i:
command.append('-i')
@@ -109,7 +109,7 @@ def main():
if not args.i:
with open(filename) as f:
code = f.readlines()
- formatted_code = StringIO.StringIO(stdout).readlines()
+ formatted_code = io.StringIO(stdout).readlines()
diff = difflib.unified_diff(code, formatted_code,
filename, filename,
'(before formatting)', '(after formatting)')
--
2.14.3

View File

@ -1,93 +0,0 @@
From c760f8d703af0c67774681b5a259d5dd3a1e5a77 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Wed, 19 Sep 2018 08:53:10 -0700
Subject: [PATCH] Convert scan-view to python3 using 2to3
---
tools/scan-view/bin/scan-view | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tools/scan-view/bin/scan-view b/tools/scan-view/bin/scan-view
index 1b6e8ba..ca3dac5 100755
--- a/tools/scan-view/bin/scan-view
+++ b/tools/scan-view/bin/scan-view
@@ -7,9 +7,9 @@ import sys
import imp
import os
import posixpath
-import thread
+import _thread
import time
-import urllib
+import urllib.request, urllib.parse, urllib.error
import webbrowser
# How long to wait for server to start.
@@ -27,7 +27,7 @@ kMaxPortsToTry = 100
def url_is_up(url):
try:
- o = urllib.urlopen(url)
+ o = urllib.request.urlopen(url)
except IOError:
return False
o.close()
@@ -35,7 +35,7 @@ def url_is_up(url):
def start_browser(port, options):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
import webbrowser
url = 'http://%s:%d' % (options.host, port)
@@ -52,10 +52,10 @@ def start_browser(port, options):
sys.stderr.flush()
time.sleep(kSleepTimeout)
else:
- print >> sys.stderr, 'WARNING: Unable to detect that server started.'
+ print('WARNING: Unable to detect that server started.', file=sys.stderr)
if options.debug:
- print >> sys.stderr, '%s: Starting webbrowser...' % sys.argv[0]
+ print('%s: Starting webbrowser...' % sys.argv[0], file=sys.stderr)
webbrowser.open(url)
@@ -69,9 +69,9 @@ def run(port, options, root):
import ScanView
try:
- print 'Starting scan-view at: http://%s:%d' % (options.host,
- port)
- print ' Use Ctrl-C to exit.'
+ print('Starting scan-view at: http://%s:%d' % (options.host,
+ port))
+ print(' Use Ctrl-C to exit.')
httpd = ScanView.create_server((options.host, port),
options, root)
httpd.serve_forever()
@@ -80,9 +80,9 @@ def run(port, options, root):
def port_is_open(port):
- import SocketServer
+ import socketserver
try:
- t = SocketServer.TCPServer((kDefaultHost, port), None)
+ t = socketserver.TCPServer((kDefaultHost, port), None)
except:
return False
t.server_close()
@@ -135,7 +135,7 @@ def main():
# Kick off thread to wait for server and start web browser, if
# requested.
if args.startBrowser:
- t = thread.start_new_thread(start_browser, (port, args))
+ t = _thread.start_new_thread(start_browser, (port, args))
run(port, args, args.root)
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From d13bd5108e3471cc6f6203ba1c0c0e67323bbb12 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Wed, 5 Sep 2018 21:43:42 -0700
Subject: [PATCH] Don't prefer python2.7
---
CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52b8819..6f233fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,7 +109,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
if(LLVM_INCLUDE_TESTS)
- set(Python_ADDITIONAL_VERSIONS 2.7)
include(FindPythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR
--
1.8.3.1

View File

@ -1,120 +0,0 @@
From d84a971ba917569829b51fff6057e5fd0d85e402 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Thu, 18 Jan 2018 02:57:51 +0000
Subject: [PATCH] Driver: Prefer vendor supplied gcc toolchain
Summary:
This patch fixes an issue on Fedora where if you had the x86_64 cross
compiler installed on your x86_64 system, then clang would use that compiler
as the default toolchain. This was happening because the cross compiler
is installed to /usr/lib/gcc/x86_64-linux-gnu/ and this directory comes before
the default compiler directory (/usr/lib/gcc/x86_64-redhat-linux/) in the search
list.
This patch re-orders the search list so that vendor supplied gcc toolchains
are selected before toolchains with a generic target, which should prevent
these kind of issues on other OSes too.
Subscribers: srhines, cfe-commits
Differential Revision: https://reviews.llvm.org/D42608
---
lib/Driver/ToolChains/Gnu.cpp | 47 ++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index 3755673..5a49a6e 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -1811,18 +1811,19 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
// lifetime or initialization issues.
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
static const char *const AArch64Triples[] = {
- "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
- "aarch64-suse-linux"};
+ "aarch64-redhat-linux", "aarch64-suse-linux",
+ "aarch64-none-linux-gnu", "aarch64-linux-gnu"};
static const char *const AArch64beLibDirs[] = {"/lib"};
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
"aarch64_be-linux-gnu"};
static const char *const ARMLibDirs[] = {"/lib"};
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
- static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
- "armv7hl-redhat-linux-gnueabi",
+ static const char *const ARMHFTriples[] = {"armv7hl-redhat-linux-gnueabi",
"armv6hl-suse-linux-gnueabi",
- "armv7hl-suse-linux-gnueabi"};
+ "armv7hl-suse-linux-gnueabi",
+ "arm-linux-gnueabihf",
+ };
static const char *const ARMebLibDirs[] = {"/lib"};
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi"};
static const char *const ARMebHFTriples[] = {
@@ -1830,19 +1831,19 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const X86_64LibDirs[] = {"/lib64", "/lib"};
static const char *const X86_64Triples[] = {
- "x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
- "x86_64-pc-linux-gnu", "x86_64-redhat-linux6E",
- "x86_64-redhat-linux", "x86_64-suse-linux",
- "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
- "x86_64-slackware-linux", "x86_64-unknown-linux",
- "x86_64-amazon-linux"};
+ "x86_64-redhat-linux6E", "x86_64-redhat-linux",
+ "x86_64-suse-linux", "x86_64-slackware-linux",
+ "x86_64-manbo-linux-gnu", "x86_64-amazon-linux",
+ "x86_64-linux-gnu", "x86_64-unknown-linux-gnu",
+ "x86_64-pc-linux-gnu", "x86_64-linux-gnu",
+ "x86_64-unknown-linux"};
static const char *const X32LibDirs[] = {"/libx32"};
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
static const char *const X86Triples[] = {
- "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu",
- "i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux",
- "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
- "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu"};
+ "i386-redhat-linux6E", "i686-redhat-linux", "i586-redhat-linux",
+ "i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux",
+ "i686-montavista-linux", "i686-linux-gnu", "i686-pc-linux-gnu",
+ "i486-linux-gnu", "i386-linux-gnu", "i586-linux-gnu"};
static const char *const MIPSLibDirs[] = {"/lib"};
static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
@@ -1864,16 +1865,16 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const PPCLibDirs[] = {"/lib32", "/lib"};
static const char *const PPCTriples[] = {
- "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe",
- "powerpc-suse-linux", "powerpc-montavista-linuxspe"};
+ "powerpc-suse-linux", "powerpc-montavista-linuxspe",
+ "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe"};
static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
static const char *const PPC64Triples[] = {
- "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu",
- "powerpc64-suse-linux", "ppc64-redhat-linux"};
+ "powerpc64-suse-linux", "ppc64-redhat-linux",
+ "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu"};
static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
static const char *const PPC64LETriples[] = {
- "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
- "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+ "powerpc64le-suse-linux", "ppc64le-redhat-linux",
+ "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu"};
static const char *const RISCV32LibDirs[] = {"/lib", "/lib32"};
static const char *const RISCVTriples[] = {"riscv32-unknown-linux-gnu",
@@ -1889,8 +1890,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const SystemZLibDirs[] = {"/lib64", "/lib"};
static const char *const SystemZTriples[] = {
- "s390x-linux-gnu", "s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu",
- "s390x-suse-linux", "s390x-redhat-linux"};
+ "s390x-ibm-linux-gnu", "s390x-suse-linux", "s390x-redhat-linux",
+ "s390x-linux-gnu", "s390x-unknown-linux-gnu"};
using std::begin;
--
1.8.3.1

View File

@ -1,38 +0,0 @@
From 565b9633ee68b311c1a954022869d9e99fee7286 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Fri, 1 Feb 2019 06:39:13 +0000
Subject: [PATCH] Fix uninitialized value in ABIArgInfo
GCC-9 takes advantage of this uninitialized values to optimize stuff,
which ends up in failing validation when compiling clang.
---
include/clang/CodeGen/CGFunctionInfo.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h
index cf64e9f3ee..131eb38393 100644
--- a/include/clang/CodeGen/CGFunctionInfo.h
+++ b/include/clang/CodeGen/CGFunctionInfo.h
@@ -112,14 +112,13 @@ private:
}
ABIArgInfo(Kind K)
- : TheKind(K), PaddingInReg(false), InReg(false), SuppressSRet(false) {
- }
+ : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
+ TheKind(K), PaddingInReg(false), InAllocaSRet(false), IndirectByVal(false),
+ IndirectRealign(false), SRetAfterThis(false), InReg(false),
+ CanBeFlattened(false), SignExt(false), SuppressSRet(false) {}
public:
- ABIArgInfo()
- : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
- TheKind(Direct), PaddingInReg(false), InReg(false),
- SuppressSRet(false) {}
+ ABIArgInfo() : ABIArgInfo(Direct) {}
static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
llvm::Type *Padding = nullptr,
--
2.19.2

Binary file not shown.

Binary file not shown.

View File

@ -1,28 +1,23 @@
%global maj_ver 7 %global maj_ver 10
%global min_ver 0 %global min_ver 0
%global patch_ver 0 %global patch_ver 0
%global clang_srcdir cfe-%{version}.src %global clang_srcdir clang-%{version}.src
%global clang_tools_srcdir clang-tools-extra-%{version}.src %global clang_tools_srcdir clang-tools-extra-%{version}.src
Name: clang Name: clang
Version: %{maj_ver}.%{min_ver}.%{patch_ver} Version: 10.0.0
Release: 7 Release: 0
License: NCSA License: NCSA
Summary: An "LLVM native" C/C++/Objective-C compiler Summary: An "LLVM native" C/C++/Objective-C compiler
URL: http://llvm.org URL: http://llvm.org
Source0: http://releases.llvm.org/%{version}/%{clang_srcdir}.tar.xz Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_srcdir}.tar.xz
Source1: http://llvm.org/releases/%{version}/%{clang_tools_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_tools_srcdir}.tar.xz
Source100: clang-config.h Source100: clang-config.h
Patch0: 0001-lit.cfg-Add-hack-so-lit-can-find-not-and-FileCheck.patch Patch0: 0001-lit.cfg-Add-hack-so-lit-can-find-not-and-FileCheck.patch
Patch1: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch Patch1: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch
Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch Patch2: 0001-gtest-reorg.patch
Patch4: 0001-gtest-reorg.patch
Patch5: 0001-Don-t-prefer-python2.7.patch
Patch6: 0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch
Patch7: 0001-Convert-scan-view-to-python3-using-2to3.patch
Patch8: 0001-Fix-uninitialized-value-in-ABIArgInfo.patch
BuildRequires: cmake gcc-c++ python-sphinx git BuildRequires: cmake gcc-c++ python-sphinx git
BuildRequires: llvm-devel = %{version} BuildRequires: llvm-devel = %{version}
@ -30,7 +25,7 @@ BuildRequires: compiler-rt = %{version}
BuildRequires: llvm-static = %{version} BuildRequires: llvm-static = %{version}
BuildRequires: llvm-googletest = %{version} BuildRequires: llvm-googletest = %{version}
BuildRequires: libxml2-devel perl-generators ncurses-devel emacs libatomic BuildRequires: libxml2-devel perl-generators ncurses-devel emacs libatomic
BuildRequires: python2-lit python3-lit python2-rpm-macros python3-sphinx python3-devel BuildRequires: python3-lit python3-sphinx python3-devel
Requires: libstdc++-devel gcc-c++ emacs-filesystem Requires: libstdc++-devel gcc-c++ emacs-filesystem
Provides: clang(major) = %{maj_ver} Provides: clang(major) = %{maj_ver}
@ -83,24 +78,14 @@ A set of extra tools built using Clang's tooling API.
Summary: clang-format integration for git Summary: clang-format integration for git
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: git Requires: git
Requires: python2
%description -n git-clang-format %description -n git-clang-format
clang-format integration for git. clang-format integration for git.
%package -n python2-clang
Summary: Python2 bindings for clang
Requires: %{name}-libs = %{version}-%{release}
Requires: python2
%description -n python2-clang
%{summary}.
%prep %prep
%setup -T -q -b 1 -n %{clang_tools_srcdir} %setup -T -q -b 1 -n %{clang_tools_srcdir}
pathfix.py -i %{__python3} -pn \ pathfix.py -i %{__python3} -pn \
clang-tidy/tool/*.py clang-tidy/tool/*.py
pathfix.py -i %{__python2} -pn \
include-fixer/find-all-symbols/tool/run-find-all-symbols.py
%autosetup -n %{clang_srcdir} -p1 -Sgit %autosetup -n %{clang_srcdir} -p1 -Sgit
pathfix.py -i %{__python3} -pn \ pathfix.py -i %{__python3} -pn \
@ -152,9 +137,6 @@ cd _build
%install %install
%make_install -C _build %make_install -C _build
mkdir -p %{buildroot}%{python2_sitelib}/clang/
install -p -m644 bindings/python/clang/* %{buildroot}%{python2_sitelib}/clang/
mv -v %{buildroot}%{_includedir}/clang/Config/config{,-%{__isa_bits}}.h mv -v %{buildroot}%{_includedir}/clang/Config/config{,-%{__isa_bits}}.h
install -m 0644 %{SOURCE100} %{buildroot}%{_includedir}/clang/Config/config.h install -m 0644 %{SOURCE100} %{buildroot}%{_includedir}/clang/Config/config.h
@ -173,13 +155,16 @@ rm -vf %{buildroot}%{_datadir}/clang/bash-autocomplete.sh
ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver} ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver}
%check %check
cd _build # Checking is disabled because we don't pack libLLVMTestingSupport.a, which makes
PATH=%{_libdir}/llvm:$PATH make %{?_smp_mflags} check-clang || \ # standalone build of clang impossible.
%ifarch %{arm}
: #cd _build
%else #PATH=%{_libdir}/llvm:$PATH make %{?_smp_mflags} check-clang || \
false #%ifarch %{arm}
%endif #:
#%else
#false
#%endif
%files %files
%{_bindir}/clang %{_bindir}/clang
@ -190,7 +175,12 @@ false
%{_bindir}/clang-cl %{_bindir}/clang-cl
%{_bindir}/clang-cpp %{_bindir}/clang-cpp
%{_bindir}/clang-format %{_bindir}/clang-format
%{_bindir}/clang-func-mapping %{_bindir}/clang-doc
%{_bindir}/clang-extdef-mapping
%{_bindir}/clang-move
%{_bindir}/clang-offload-wrapper
%{_bindir}/clang-scan-deps
%{_bindir}/pp-trace
%{_bindir}/clang-import-test %{_bindir}/clang-import-test
%{_bindir}/clang-offload-bundler %{_bindir}/clang-offload-bundler
%{_bindir}/diagtool %{_bindir}/diagtool
@ -216,7 +206,6 @@ false
%files analyzer %files analyzer
%{_bindir}/scan-view %{_bindir}/scan-view
%{_bindir}/scan-build %{_bindir}/scan-build
%{_bindir}/scan-build
%{_libexecdir}/ccc-analyzer %{_libexecdir}/ccc-analyzer
%{_libexecdir}/c++-analyzer %{_libexecdir}/c++-analyzer
%{_datadir}/scan-view/ %{_datadir}/scan-view/
@ -242,14 +231,16 @@ false
%{_datadir}/clang/run-clang-tidy.py* %{_datadir}/clang/run-clang-tidy.py*
%{_datadir}/clang/run-find-all-symbols.py* %{_datadir}/clang/run-find-all-symbols.py*
%{_datadir}/clang/clang-rename.py* %{_datadir}/clang/clang-rename.py*
%{_datadir}/clang/index.js
%{_datadir}/clang/clang-doc-default-stylesheet.css
%files -n git-clang-format %files -n git-clang-format
%{_bindir}/git-clang-format %{_bindir}/git-clang-format
%files -n python2-clang
%{python2_sitelib}/clang/
%changelog %changelog
* Sat Jun 06 2020 Shinwell Hu <huxinwei@huawei.com> - 10.0.0-0
- Upgrade to 10.0.0
* Thu May 28 2020 leiju <leiju4@huawei.com> - 7.0.0-7 * Thu May 28 2020 leiju <leiju4@huawei.com> - 7.0.0-7
- Fix uninitialized value in ABIArgInfo - Fix uninitialized value in ABIArgInfo