diff --git a/.gitignore b/.gitignore index a367288..74ca0fd 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,7 @@ /clang-tools-extra-9.0.0.src.tar.xz /clang-9.0.1.src.tar.xz /clang-tools-extra-9.0.1.src.tar.xz +/clang-10.0.0rc1.src.tar.xz +/clang-tools-extra-10.0.0rc1.src.tar.xz +/clang-10.0.0rc1.src.tar.xz.sig +/clang-tools-extra-10.0.0rc1.src.tar.xz.sig diff --git a/0001-BPF-annotate-DIType-metadata-for-builtin-preseve_arr.patch b/0001-BPF-annotate-DIType-metadata-for-builtin-preseve_arr.patch deleted file mode 100644 index 2062f00..0000000 --- a/0001-BPF-annotate-DIType-metadata-for-builtin-preseve_arr.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 5eb29c8b23b652b8dd8988621f5c91191b13ffe3 Mon Sep 17 00:00:00 2001 -From: Yonghong Song -Date: Fri, 2 Aug 2019 21:28:28 +0000 -Subject: [PATCH] [BPF] annotate DIType metadata for builtin - preseve_array_access_index() - -Previously, debuginfo types are annotated to -IR builtin preserve_struct_access_index() and -preserve_union_access_index(), but not -preserve_array_access_index(). The debug info -is useful to identify the root type name which -later will be used for type comparison. - -For user access without explicit type conversions, -the previous scheme works as we can ignore intermediate -compiler generated type conversions (e.g., from union types to -union members) and still generate correct access index string. - -The issue comes with user explicit type conversions, e.g., -converting an array to a structure like below: - struct t { int a; char b[40]; }; - struct p { int c; int d; }; - struct t *var = ...; - ... __builtin_preserve_access_index(&(((struct p *)&(var->b[0]))->d)) ... -Although BPF backend can derive the type of &(var->b[0]), -explicit type annotation make checking more consistent -and less error prone. - -Another benefit is for multiple dimension array handling. -For example, - struct p { int c; int d; } g[8][9][10]; - ... __builtin_preserve_access_index(&g[2][3][4].d) ... -It would be possible to calculate the number of "struct p"'s -before accessing its member "d" if array debug info is -available as it contains each dimension range. - -This patch enables to annotate IR builtin preserve_array_access_index() -with proper debuginfo type. The unit test case and language reference -is updated as well. - -Signed-off-by: Yonghong Song - -Differential Revision: https://reviews.llvm.org/D65664 - -llvm-svn: 367724 -(cherry picked from commit d0ea05d5eff475a27a5d3bbe4d9fd389935f9cb2) ---- - clang/lib/CodeGen/CGExpr.cpp | 12 ++++++++--- - .../CodeGen/builtin-preserve-access-index-array.c | 18 +++++++++++++++++ - clang/test/CodeGen/builtin-preserve-access-index.c | 23 +++++++++++----------- - llvm/docs/LangRef.rst | 4 ++++ - llvm/include/llvm/IR/IRBuilder.h | 10 +++++++--- - llvm/test/CodeGen/BPF/CORE/intrinsic-array.ll | 2 +- - 6 files changed, 51 insertions(+), 18 deletions(-) - create mode 100644 clang/test/CodeGen/builtin-preserve-access-index-array.c - -diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp -index b6c2567..21c4103 100644 ---- a/clang/lib/CodeGen/CGExpr.cpp -+++ b/clang/lib/CodeGen/CGExpr.cpp -@@ -3405,6 +3405,7 @@ static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr, - ArrayRef indices, - QualType eltType, bool inbounds, - bool signedIndices, SourceLocation loc, -+ QualType *arrayType = nullptr, - const llvm::Twine &name = "arrayidx") { - // All the indices except that last must be zero. - #ifndef NDEBUG -@@ -3433,9 +3434,12 @@ static Address emitArraySubscriptGEP(CodeGenFunction &CGF, Address addr, - } else { - // Remember the original array subscript for bpf target - unsigned idx = LastIndex->getZExtValue(); -+ llvm::DIType *DbgInfo = nullptr; -+ if (arrayType) -+ DbgInfo = CGF.getDebugInfo()->getOrCreateStandaloneType(*arrayType, loc); - eltPtr = CGF.Builder.CreatePreserveArrayAccessIndex(addr.getPointer(), - indices.size() - 1, -- idx); -+ idx, DbgInfo); - } - - return Address(eltPtr, eltAlign); -@@ -3572,19 +3576,21 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, - auto *Idx = EmitIdxAfterBase(/*Promote*/true); - - // Propagate the alignment from the array itself to the result. -+ QualType arrayType = Array->getType(); - Addr = emitArraySubscriptGEP( - *this, ArrayLV.getAddress(), {CGM.getSize(CharUnits::Zero()), Idx}, - E->getType(), !getLangOpts().isSignedOverflowDefined(), SignedIndices, -- E->getExprLoc()); -+ E->getExprLoc(), &arrayType); - EltBaseInfo = ArrayLV.getBaseInfo(); - EltTBAAInfo = CGM.getTBAAInfoForSubobject(ArrayLV, E->getType()); - } else { - // The base must be a pointer; emit it with an estimate of its alignment. - Addr = EmitPointerWithAlignment(E->getBase(), &EltBaseInfo, &EltTBAAInfo); - auto *Idx = EmitIdxAfterBase(/*Promote*/true); -+ QualType ptrType = E->getBase()->getType(); - Addr = emitArraySubscriptGEP(*this, Addr, Idx, E->getType(), - !getLangOpts().isSignedOverflowDefined(), -- SignedIndices, E->getExprLoc()); -+ SignedIndices, E->getExprLoc(), &ptrType); - } - - LValue LV = MakeAddrLValue(Addr, E->getType(), EltBaseInfo, EltTBAAInfo); -diff --git a/clang/test/CodeGen/builtin-preserve-access-index-array.c b/clang/test/CodeGen/builtin-preserve-access-index-array.c -new file mode 100644 -index 0000000..a449b28 ---- /dev/null -+++ b/clang/test/CodeGen/builtin-preserve-access-index-array.c -@@ -0,0 +1,18 @@ -+// RUN: %clang -target x86_64 -emit-llvm -S -g %s -o - | FileCheck %s -+ -+#define _(x) (__builtin_preserve_access_index(x)) -+ -+struct s1 { -+ char a; -+ int b[4]; -+}; -+ -+const void *unit1(struct s1 *arg) { -+ return _(&arg->b[2]); -+} -+// CHECK: define dso_local i8* @unit1 -+// CHECK: call [4 x i32]* @llvm.preserve.struct.access.index.p0a4i32.p0s_struct.s1s(%struct.s1* %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S1:[0-9]+]] -+// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[ARRAY:[0-9]+]] -+// -+// CHECK: ![[ARRAY]] = !DICompositeType(tag: DW_TAG_array_type -+// CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1" -diff --git a/clang/test/CodeGen/builtin-preserve-access-index.c b/clang/test/CodeGen/builtin-preserve-access-index.c -index 954a3b8..1084416 100644 ---- a/clang/test/CodeGen/builtin-preserve-access-index.c -+++ b/clang/test/CodeGen/builtin-preserve-access-index.c -@@ -31,16 +31,16 @@ const void *unit4(const int *arg) { - } - // CHECK: define dso_local i8* @unit4 - // CHECK-NOT: getelementptr --// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0i32(i32* %{{[0-9a-z]+}}, i32 0, i32 1) -+// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0i32(i32* %{{[0-9a-z]+}}, i32 0, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[POINTER:[0-9]+]] - - const void *unit5(const int *arg[5]) { - return _(&arg[1][2]); - } - // CHECK: define dso_local i8* @unit5 - // CHECK-NOT: getelementptr --// CHECK: call i32** @llvm.preserve.array.access.index.p0p0i32.p0p0i32(i32** %{{[0-9a-z]+}}, i32 0, i32 1) -+// CHECK: call i32** @llvm.preserve.array.access.index.p0p0i32.p0p0i32(i32** %{{[0-9a-z]+}}, i32 0, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index !{{[0-9]+}} - // CHECK-NOT: getelementptr --// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0i32(i32* %{{[0-9a-z]+}}, i32 0, i32 2) -+// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0i32(i32* %{{[0-9a-z]+}}, i32 0, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[POINTER:[0-9]+]] - - struct s1 { - char a; -@@ -141,7 +141,7 @@ const void *unit13(struct s4 *arg) { - // CHECK: define dso_local i8* @unit13 - // CHECK: call %union.u* @llvm.preserve.struct.access.index.p0s_union.us.p0s_struct.s4s(%struct.s4* %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S4:[0-9]+]] - // CHECK: call %union.u* @llvm.preserve.union.access.index.p0s_union.us.p0s_union.us(%union.u* %{{[0-9a-z]+}}, i32 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[UNION_I_U:[0-9]+]] --// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2) -+// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index !{{[0-9]+}} - - const void *unit14(union u3 *arg) { - return _(&arg->c.b[2]); -@@ -149,13 +149,13 @@ const void *unit14(union u3 *arg) { - // CHECK: define dso_local i8* @unit14 - // CHECK: call %union.u3* @llvm.preserve.union.access.index.p0s_union.u3s.p0s_union.u3s(%union.u3* %{{[0-9a-z]+}}, i32 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[UNION_U3:[0-9]+]] - // CHECK: call [4 x i32]* @llvm.preserve.struct.access.index.p0a4i32.p0s_struct.ss(%struct.s* %{{[0-9a-z]+}}, i32 0, i32 0), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_I_S:[0-9]+]] --// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2) -+// CHECK: call i32* @llvm.preserve.array.access.index.p0i32.p0a4i32([4 x i32]* %{{[0-9a-z]+}}, i32 1, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index !{{[0-9]+}} - - const void *unit15(struct s4 *arg) { - return _(&arg[2].c.a); - } - // CHECK: define dso_local i8* @unit15 --// CHECK: call %struct.s4* @llvm.preserve.array.access.index.p0s_struct.s4s.p0s_struct.s4s(%struct.s4* %{{[0-9a-z]+}}, i32 0, i32 2) -+// CHECK: call %struct.s4* @llvm.preserve.array.access.index.p0s_struct.s4s.p0s_struct.s4s(%struct.s4* %{{[0-9a-z]+}}, i32 0, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index !{{[0-9]+}} - // CHECK: call %union.u* @llvm.preserve.struct.access.index.p0s_union.us.p0s_struct.s4s(%struct.s4* %{{[0-9a-z]+}}, i32 1, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[STRUCT_S4]] - // CHECK: call %union.u* @llvm.preserve.union.access.index.p0s_union.us.p0s_union.us(%union.u* %{{[0-9a-z]+}}, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[UNION_I_U]] - -@@ -163,15 +163,16 @@ const void *unit16(union u3 *arg) { - return _(&arg[2].a); - } - // CHECK: define dso_local i8* @unit16 --// CHECK: call %union.u3* @llvm.preserve.array.access.index.p0s_union.u3s.p0s_union.u3s(%union.u3* %{{[0-9a-z]+}}, i32 0, i32 2) -+// CHECK: call %union.u3* @llvm.preserve.array.access.index.p0s_union.u3s.p0s_union.u3s(%union.u3* %{{[0-9a-z]+}}, i32 0, i32 2), !dbg !{{[0-9]+}}, !llvm.preserve.access.index !{{[0-9]+}} - // CHECK: call %union.u3* @llvm.preserve.union.access.index.p0s_union.u3s.p0s_union.u3s(%union.u3* %{{[0-9a-z]+}}, i32 1), !dbg !{{[0-9]+}}, !llvm.preserve.access.index ![[UNION_U3]] - -+// CHECK: ![[POINTER]] = !DIDerivedType(tag: DW_TAG_pointer_type -+// CHECK: ![[STRUCT_S4]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s4" -+// CHECK: ![[UNION_I_U]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u" -+// CHECK: ![[UNION_U3]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u3" -+// CHECK: ![[STRUCT_I_S]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s" - // CHECK: ![[STRUCT_S1]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1" - // CHECK: ![[STRUCT_S2]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s2" - // CHECK: ![[STRUCT_S3]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s3" - // CHECK: ![[UNION_U1]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u1" - // CHECK: ![[UNION_U2]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u2" --// CHECK: ![[STRUCT_S4]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s4" --// CHECK: ![[UNION_I_U]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u" --// CHECK: ![[UNION_U3]] = distinct !DICompositeType(tag: DW_TAG_union_type, name: "u3" --// CHECK: ![[STRUCT_I_S]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s" --- -1.8.3.1 - diff --git a/0001-Fix-isInSystemMacro-to-handle-pasted-macros.patch b/0001-Fix-isInSystemMacro-to-handle-pasted-macros.patch deleted file mode 100644 index 9480f42..0000000 --- a/0001-Fix-isInSystemMacro-to-handle-pasted-macros.patch +++ /dev/null @@ -1,137 +0,0 @@ -From cb7fd3caeee52fe94461b717294c4db4056853e3 Mon Sep 17 00:00:00 2001 -From: Serge Guelton -Date: Fri, 1 Feb 2019 06:11:44 +0000 -Subject: [PATCH 1/3] Fix isInSystemMacro to handle pasted macros - -Token pasted by the preprocessor (through ##) have a Spelling pointing to scratch buffer. -As a result they are not recognized at system macro, even though the pasting happened in -a system macro. Fix that by looking into the parent macro if the original lookup finds a -scratch buffer. - -Differential Revision: https://reviews.llvm.org/D55782 - -This effectively fixes https://bugs.llvm.org/show_bug.cgi?id=35268, - -git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352838 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - include/clang/Basic/SourceManager.h | 18 +++++++++++++++++- - test/Misc/no-warn-in-system-macro.c | 13 +++++++++++++ - test/Misc/no-warn-in-system-macro.c.inc | 9 +++++++++ - test/Misc/warn-in-system-macro-def.c | 21 +++++++++++++++++++++ - test/Misc/warn-in-system-macro-def.c.inc | 4 ++++ - 5 files changed, 64 insertions(+), 1 deletion(-) - create mode 100644 test/Misc/no-warn-in-system-macro.c - create mode 100644 test/Misc/no-warn-in-system-macro.c.inc - create mode 100644 test/Misc/warn-in-system-macro-def.c - create mode 100644 test/Misc/warn-in-system-macro-def.c.inc - -diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h -index dcc4a37e23..c6b92f9000 100644 ---- a/include/clang/Basic/SourceManager.h -+++ b/include/clang/Basic/SourceManager.h -@@ -1441,6 +1441,12 @@ public: - return Filename.equals(""); - } - -+ /// Returns whether \p Loc is located in a file. -+ bool isWrittenInScratchSpace(SourceLocation Loc) const { -+ StringRef Filename(getPresumedLoc(Loc).getFilename()); -+ return Filename.equals(""); -+ } -+ - /// Returns if a SourceLocation is in a system header. - bool isInSystemHeader(SourceLocation Loc) const { - return isSystem(getFileCharacteristic(Loc)); -@@ -1453,7 +1459,17 @@ public: - - /// Returns whether \p Loc is expanded from a macro in a system header. - bool isInSystemMacro(SourceLocation loc) const { -- return loc.isMacroID() && isInSystemHeader(getSpellingLoc(loc)); -+ if(!loc.isMacroID()) -+ return false; -+ -+ // This happens when the macro is the result of a paste, in that case -+ // its spelling is the scratch memory, so we take the parent context. -+ if (isWrittenInScratchSpace(getSpellingLoc(loc))) { -+ return isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc))); -+ } -+ else { -+ return isInSystemHeader(getSpellingLoc(loc)); -+ } - } - - /// The size of the SLocEntry that \p FID represents. -diff --git a/test/Misc/no-warn-in-system-macro.c b/test/Misc/no-warn-in-system-macro.c -new file mode 100644 -index 0000000000..a319b14c9c ---- /dev/null -+++ b/test/Misc/no-warn-in-system-macro.c -@@ -0,0 +1,13 @@ -+// RUN: %clang_cc1 -isystem %S -Wdouble-promotion -fsyntax-only %s 2>&1 | FileCheck -allow-empty %s -+// CHECK-NOT: warning: -+ -+#include -+ -+int main(void) -+{ -+ double foo = 1.0; -+ -+ if (isnan(foo)) -+ return 1; -+ return 0; -+} -diff --git a/test/Misc/no-warn-in-system-macro.c.inc b/test/Misc/no-warn-in-system-macro.c.inc -new file mode 100644 -index 0000000000..3cbe7dfc16 ---- /dev/null -+++ b/test/Misc/no-warn-in-system-macro.c.inc -@@ -0,0 +1,9 @@ -+extern int __isnanf(float f); -+extern int __isnan(double f); -+extern int __isnanl(long double f); -+#define isnan(x) \ -+ (sizeof (x) == sizeof (float) \ -+ ? __isnanf (x) \ -+ : sizeof (x) == sizeof (double) \ -+ ? __isnan (x) : __isnanl (x)) -+ -diff --git a/test/Misc/warn-in-system-macro-def.c b/test/Misc/warn-in-system-macro-def.c -new file mode 100644 -index 0000000000..b295130702 ---- /dev/null -+++ b/test/Misc/warn-in-system-macro-def.c -@@ -0,0 +1,21 @@ -+// RUN: %clang_cc1 -isystem %S -Wdouble-promotion -fsyntax-only %s 2>&1 | FileCheck -allow-empty %s -+// CHECK: warning: -+// CHECK: expanded from macro 'ISNAN' -+// CHECK: expanded from macro 'isnan' -+ -+#include -+ -+#define isnan(x) \ -+ (sizeof (x) == sizeof (float) \ -+ ? __isnanf (x) \ -+ : sizeof (x) == sizeof (double) \ -+ ? __isnan (x) : __isnanl (x)) -+ -+int main(void) -+{ -+ double foo = 1.0; -+ -+ if (ISNAN(foo)) -+ return 1; -+ return 0; -+} -diff --git a/test/Misc/warn-in-system-macro-def.c.inc b/test/Misc/warn-in-system-macro-def.c.inc -new file mode 100644 -index 0000000000..5c7e60275a ---- /dev/null -+++ b/test/Misc/warn-in-system-macro-def.c.inc -@@ -0,0 +1,4 @@ -+extern int __isnanf(float f); -+extern int __isnan(double f); -+extern int __isnanl(long double f); -+#define ISNAN isnan --- -2.20.1 - diff --git a/0002-Format-isInSystemMacro-after-D55782.patch b/0002-Format-isInSystemMacro-after-D55782.patch deleted file mode 100644 index e5004fb..0000000 --- a/0002-Format-isInSystemMacro-after-D55782.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 49b29ff9feafd8b9041e2a76cbe843115d263ced Mon Sep 17 00:00:00 2001 -From: Fangrui Song -Date: Mon, 11 Feb 2019 13:30:04 +0000 -Subject: [PATCH 2/3] Format isInSystemMacro after D55782 - -git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353697 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - include/clang/Basic/SourceManager.h | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h -index c6b92f9000..f44239d9ce 100644 ---- a/include/clang/Basic/SourceManager.h -+++ b/include/clang/Basic/SourceManager.h -@@ -1459,17 +1459,15 @@ public: - - /// Returns whether \p Loc is expanded from a macro in a system header. - bool isInSystemMacro(SourceLocation loc) const { -- if(!loc.isMacroID()) -+ if (!loc.isMacroID()) - return false; - - // This happens when the macro is the result of a paste, in that case - // its spelling is the scratch memory, so we take the parent context. -- if (isWrittenInScratchSpace(getSpellingLoc(loc))) { -+ if (isWrittenInScratchSpace(getSpellingLoc(loc))) - return isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc))); -- } -- else { -- return isInSystemHeader(getSpellingLoc(loc)); -- } -+ -+ return isInSystemHeader(getSpellingLoc(loc)); - } - - /// The size of the SLocEntry that \p FID represents. --- -2.20.1 - diff --git a/0003-Fix-isInSystemMacro-in-presence-of-macro-and-pasted-.patch b/0003-Fix-isInSystemMacro-in-presence-of-macro-and-pasted-.patch deleted file mode 100644 index c27dfd9..0000000 --- a/0003-Fix-isInSystemMacro-in-presence-of-macro-and-pasted-.patch +++ /dev/null @@ -1,63 +0,0 @@ -From a6b7f0946df82ca207b27f1931d4b430ab77e5e0 Mon Sep 17 00:00:00 2001 -From: Serge Guelton -Date: Thu, 16 May 2019 12:40:00 +0000 -Subject: [PATCH 3/3] Fix isInSystemMacro in presence of macro and pasted token - -When a warning is raised from the expansion of a system macro that -involves pasted token, there was still situations were they were not -skipped, as showcased by this issue: -https://bugzilla.redhat.com/show_bug.cgi?id=1472437 - -Differential Revision: https://reviews.llvm.org/D59413 - -git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360885 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - include/clang/Basic/SourceManager.h | 9 +++++++-- - test/Misc/no-warn-in-system-macro.c | 7 ++++++- - 2 files changed, 13 insertions(+), 3 deletions(-) - -diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h -index f44239d9ce..c964c64faf 100644 ---- a/include/clang/Basic/SourceManager.h -+++ b/include/clang/Basic/SourceManager.h -@@ -1464,8 +1464,13 @@ public: - - // This happens when the macro is the result of a paste, in that case - // its spelling is the scratch memory, so we take the parent context. -- if (isWrittenInScratchSpace(getSpellingLoc(loc))) -- return isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc))); -+ // There can be several level of token pasting. -+ if (isWrittenInScratchSpace(getSpellingLoc(loc))) { -+ do { -+ loc = getImmediateMacroCallerLoc(loc); -+ } while (isWrittenInScratchSpace(getSpellingLoc(loc))); -+ return isInSystemMacro(loc); -+ } - - return isInSystemHeader(getSpellingLoc(loc)); - } -diff --git a/test/Misc/no-warn-in-system-macro.c b/test/Misc/no-warn-in-system-macro.c -index a319b14c9c..a351b89256 100644 ---- a/test/Misc/no-warn-in-system-macro.c -+++ b/test/Misc/no-warn-in-system-macro.c -@@ -3,11 +3,16 @@ - - #include - -+#define MACRO(x) x -+ - int main(void) - { - double foo = 1.0; - - if (isnan(foo)) - return 1; -- return 0; -+ -+ MACRO(isnan(foo)); -+ -+ return 0; - } --- -2.20.1 - diff --git a/clang.spec b/clang.spec index 6af31c0..e88f8ca 100644 --- a/clang.spec +++ b/clang.spec @@ -1,38 +1,41 @@ %global compat_build 0 -%global maj_ver 9 +%global maj_ver 10 %global min_ver 0 -%global patch_ver 1 -#%%global rc_ver 3 -%global baserelease 3 +%global patch_ver 0 +%global rc_ver 1 +%global baserelease 0.1 %global clang_tools_binaries \ - %{_bindir}/clangd \ %{_bindir}/clang-apply-replacements \ %{_bindir}/clang-change-namespace \ + %{_bindir}/clang-check \ %{_bindir}/clang-doc \ + %{_bindir}/clang-extdef-mapping \ + %{_bindir}/clang-format \ + %{_bindir}/clang-import-test \ %{_bindir}/clang-include-fixer \ + %{_bindir}/clang-move \ + %{_bindir}/clang-offload-bundler \ + %{_bindir}/clang-offload-wrapper \ %{_bindir}/clang-query \ %{_bindir}/clang-refactor \ - %{_bindir}/clang-reorder-fields \ %{_bindir}/clang-rename \ - %{_bindir}/clang-tidy + %{_bindir}/clang-reorder-fields \ + %{_bindir}/clang-scan-deps \ + %{_bindir}/clang-tidy \ + %{_bindir}/clangd \ + %{_bindir}/diagtool \ + %{_bindir}/hmaptool \ + %{_bindir}/pp-trace %global clang_binaries \ %{_bindir}/clang \ %{_bindir}/clang++ \ %{_bindir}/clang-%{maj_ver} \ %{_bindir}/clang++-%{maj_ver} \ - %{_bindir}/clang-check \ %{_bindir}/clang-cl \ %{_bindir}/clang-cpp \ - %{_bindir}/clang-extdef-mapping \ - %{_bindir}/clang-format \ - %{_bindir}/clang-import-test \ - %{_bindir}/clang-offload-bundler \ - %{_bindir}/clang-scan-deps \ - %{_bindir}/diagtool \ - %{_bindir}/hmaptool %if 0%{?compat_build} %global pkg_name clang%{maj_ver}.%{min_ver} @@ -77,13 +80,14 @@ URL: http://llvm.org Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{clang_srcdir}.tar.xz %if !0%{?compat_build} Source1: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz +Source2: https://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig %endif +Source3: https://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig +Source4: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc Patch4: 0002-gtest-reorg.patch Patch11: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch Patch13: 0001-Make-funwind-tables-the-default-for-all-archs.patch -# Fix crash with kernel bpf self-tests -Patch14: 0001-BPF-annotate-DIType-metadata-for-builtin-preseve_arr.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -226,7 +230,7 @@ pathfix.py -i %{__python3} -pn \ %patch4 -p1 -b .gtest %patch11 -p1 -b .libcxx-fix -%patch14 -p2 -b .bpf-fix +%patch13 -p2 -b .unwind-all mv ../%{clang_tools_srcdir} tools/extra @@ -264,8 +268,8 @@ cd _build -DPYTHON_EXECUTABLE=%{__python3} \ -DCMAKE_INSTALL_RPATH:BOOL=";" \ %ifarch s390 s390x %{arm} %ix86 ppc64le - -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ + -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif %if 0%{?compat_build} -DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}.%{min_ver}-%{__isa_bits} \ @@ -341,6 +345,8 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py* # TODO: Package html docs rm -Rvf %{buildroot}%{_pkgdocdir} +rm -Rvf %{buildroot}%{install_prefix}/share/clang/clang-doc-default-stylesheet.css +rm -Rvf %{buildroot}%{install_prefix}/share/clang/index.js # TODO: What are the Fedora guidelines for packaging bash autocomplete files? rm -vf %{buildroot}%{_datadir}/clang/bash-autocomplete.sh @@ -442,6 +448,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ %endif %changelog +* Fri Jan 31 2020 sguelton@redhat.com - 10.0.0-0.1.rc1 +- 10.0.0 rc1 + * Tue Jan 28 2020 Fedora Release Engineering - 9.0.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/hans-gpg-key.asc b/hans-gpg-key.asc new file mode 100644 index 0000000..4b3cdde --- /dev/null +++ b/hans-gpg-key.asc @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFS+1SABEACnmkESkY7eZq0GhDjbkWpKmURGk9+ycsfAhA44NqUvf4tk1GPM +5SkJ/fYedYZJaDVhIp98fHgucD0O+vjOzghtgwtITusYjiPHPFBd/MN+MQqSEAP+ +LUa/kjHLjgyXxKhFUIDGVaDWL5tKOA7/AQKl1TyJ8lz89NHQoUHFsF/hu10+qhJe +V65d32MXFehIUSvegh8DrPuExrliSiORO4HOhuc6151dWA4YBWVg4rX5kfKrGMMT +pTWnSSZtgoRhkKW2Ey8cmZUqPuUJIfWyeNVu1e4SFtAivLvu/Ymz2WBJcNA1ZlTr +RCOR5SIRgZ453pQnI/Bzna2nnJ/TV1gGJIGRahj/ini0cs2x1CILfS/YJQ3rWGGo +OxwG0BVmPk0cmLVtyTq8gUPwxcPUd6WcBKhot3TDMlrffZACnQwQjlVjk5S1dEEz +atUfpEuNitU9WOM4jr/gjv36ZNCOWm95YwLhsuci/NddBN8HXhyvs+zYTVZEXa2W +l/FqOdQsQqZBcJjjWckGKhESdd7934+cesGD3O8KaeSGxww7slJrS0+6QJ8oBoAB +P/WCn/y2AiY2syEKp3wYIGJyAbsm542zMZ4nc7pYfSu49mcyhQQICmqN5QvOyYUx +OSqwbAOUNtlOyeRLZNIKoXtTqWDEu5aEiDROTw6Rkq+dIcxPNgOLdeQ3HwARAQAB +tCFIYW5zIFdlbm5ib3JnIDxoYW5zQGNocm9taXVtLm9yZz6JAlUEEwECAD8CGwMG +CwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAFiEEtsj5goK5ROOw1cJTD8MELjRa0F0F +Alpd+i0FCQ8FJo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pV0GhL+3i077gTYfZBRwLzjFdhm9xUKEaZ6rN1BX9lzix4eSNK5nln0jUq1 +67H2IH//2sf8dw== +=ADVe +-----END PGP PUBLIC KEY BLOCK----- diff --git a/sources b/sources index 6339267..2b412f4 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (clang-9.0.1.src.tar.xz) = 3bcdcfd1ebb20a2cb15d57c608106b6e6e9c2eda4b781f573e84e0600b775bb7609f6df9edcf819ee5d91cc01a28ee089353c29fd57c23b867afbf6ad2f5cd13 -SHA512 (clang-tools-extra-9.0.1.src.tar.xz) = 4a671596460809f314ed96b0cc0be7f2498692275d0a7bd08266f9cdf4b85fb39cb4eea4131602e9a170a75eb5d9623449960f873e25b999e06c016387a1918d +SHA512 (clang-10.0.0rc1.src.tar.xz.sig) = 995562054873a948dbd44b812238f9799f6920c25075bc7c94419afde4fc5adf0b545f9201c38841f727137c2e50c1cb156bc394f9cc197dd8a1c5660f9673b1 +SHA512 (clang-tools-extra-10.0.0rc1.src.tar.xz.sig) = 51b4d5f4f314422418073e40f4848268e88994bafa6bb7d668384678fcc8bf92953c4de5a93a38c068a3e1426f70f0a9f4d5093a38be320755edf23ef55186c4