Skip to content

Commit a6eb443

Browse files
Merge remote-tracking branch 'upstream/main' into vinay-issue-128660-P3372-constexpr-map
2 parents a6c32e1 + 9490d58 commit a6eb443

26 files changed

+654
-274
lines changed

.github/workflows/gha-codeql.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Github Actions CodeQL
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '30 0 * * *'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
codeql:
19+
name: 'Github Actions CodeQL'
20+
runs-on: ubuntu-24.04
21+
permissions:
22+
security-events: write
23+
steps:
24+
- name: Checkout LLVM
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
with:
27+
sparse-checkout: |
28+
.github/
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3
31+
with:
32+
languages: actions
33+
queries: security-extended
34+
- name: Perform CodeQL Analysis
35+
uses: github/codeql-action/analyze@192325c86100d080feab897ff886c34abd4c83a3 # v3.30.3

clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Options
3737
.. option:: MakeSmartPtrFunctionHeader
3838

3939
A string specifying the corresponding header of make-shared-ptr function.
40-
Default is `memory`.
40+
Default is `<memory>`.
4141

4242
.. option:: IncludeStyle
4343

clang/lib/Basic/Targets/X86.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : public X86_32TargetInfo {
646646
: X86_32TargetInfo(Triple, Opts) {
647647
this->WCharType = TargetInfo::UnsignedShort;
648648
this->WIntType = TargetInfo::UnsignedInt;
649+
this->UseMicrosoftManglingForC = true;
649650
DoubleAlign = LongLongAlign = 64;
650651
resetDataLayout("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-"
651652
"i128:128-f80:32-n8:16:32-a:0:32-S32",
@@ -983,6 +984,7 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : public X86_64TargetInfo {
983984
: X86_64TargetInfo(Triple, Opts) {
984985
this->WCharType = TargetInfo::UnsignedShort;
985986
this->WIntType = TargetInfo::UnsignedInt;
987+
this->UseMicrosoftManglingForC = true;
986988
}
987989

988990
void getTargetDefines(const LangOptions &Opts,

clang/test/CodeGen/mangle-windows.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-win32 | FileCheck %s
2-
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | FileCheck %s
2+
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | FileCheck %s
3+
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-cygwin | FileCheck %s
34
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-pc-windows-msvc-elf | FileCheck %s --check-prefix=ELF32
45
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-win32 | FileCheck %s --check-prefix=X64
5-
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-mingw32 | FileCheck %s --check-prefix=X64
6+
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-mingw32 | FileCheck %s --check-prefix=X64
7+
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-cygwin | FileCheck %s --check-prefix=X64
68
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-windows-msvc-elf | FileCheck %s --check-prefix=ELF64
79

810
// CHECK: target datalayout = "e-m:x-{{.*}}"

clang/test/CodeGenCXX/mangle-windows.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-mingw32 | \
55
// RUN: FileCheck --check-prefix=ITANIUM %s
66

7+
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=i386-cygwin | \
8+
// RUN: FileCheck --check-prefix=ITANIUM %s
9+
710
void __stdcall f1(void) {}
811
// WIN: define dso_local x86_stdcallcc void @"?f1@@YGXXZ"
912
// ITANIUM: define dso_local x86_stdcallcc void @"\01__Z2f1v@0"
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// For the `CInlined` struct, where all member functions are inlined, we check the following cases:
2+
// - If the definition of its destructor is visible:
3+
// * The vtable is generated with a COMDAT specifier
4+
// * Its '_vtable$' is generated
5+
// - Otherwise:
6+
// * The vtable is declared
7+
// * Its '_vtable$' is NOT generated
8+
//
9+
// For the `CNoInline` strcut, where member functions are defined as non-inline, we check the following:
10+
// - Regardless of whether the definition of its destructor is visible or not:
11+
// * The vtable is generated
12+
// * Its '_vtable$' is generated
13+
//
14+
// For the `CNoFnDef` struct, where member functions are declared only, we check the following:
15+
// - Regardless of whether the definition of its destructor is visible or not:
16+
// # when non-optimized:
17+
// * The vtable is declared
18+
// * Its '_vtable$' is NOT generated
19+
// # when optimized even if no LLVM passes:
20+
// * The vtable is declared as `available_externally` (which is potentially turned into `external` by LLVM passes)
21+
// * Its '_vtable$' is generated
22+
23+
struct CInlined {
24+
virtual void f1() noexcept {}
25+
virtual void f2() noexcept {}
26+
virtual ~CInlined() noexcept;
27+
};
28+
#ifndef NO_DTOR_BODY
29+
inline CInlined::~CInlined() noexcept {}
30+
#endif
31+
32+
struct CNoInline {
33+
virtual void g1() noexcept;
34+
virtual void g2() noexcept;
35+
virtual ~CNoInline() noexcept;
36+
};
37+
38+
void CNoInline::g1() noexcept {}
39+
void CNoInline::g2() noexcept {}
40+
#ifndef NO_DTOR_BODY
41+
CNoInline::~CNoInline() noexcept {}
42+
#endif
43+
44+
struct CNoFnDef {
45+
virtual void h1() noexcept;
46+
virtual void h2() noexcept;
47+
virtual ~CNoFnDef() noexcept;
48+
};
49+
50+
#ifndef NO_DTOR_BODY
51+
CNoFnDef::~CNoFnDef() noexcept {}
52+
#endif
53+
54+
int main() {
55+
CInlined Inlined;
56+
CNoInline NoInline;
57+
CNoFnDef NoFnDef;
58+
59+
return 0;
60+
}
61+
62+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O0 -disable-llvm-passes %s -o - | FileCheck %s -check-prefixes CHECK-HAS-DTOR,CHECK-HAS-DTOR-O0
63+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O1 -disable-llvm-passes %s -o - | FileCheck %s -check-prefixes CHECK-HAS-DTOR,CHECK-HAS-DTOR-O1
64+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O0 -disable-llvm-passes -DNO_DTOR_BODY %s -o - | FileCheck %s -check-prefixes CHECK-NO-DTOR,CHECK-NO-DTOR-O0
65+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O1 -disable-llvm-passes -DNO_DTOR_BODY %s -o - | FileCheck %s -check-prefixes CHECK-NO-DTOR,CHECK-NO-DTOR-O1
66+
67+
// CHECK-HAS-DTOR: $_ZTV8CInlined = comdat any
68+
// CHECK-HAS-DTOR-NOT: $_ZTV9CNoInline
69+
// CHECK-HAS-DTOR-NOT: $_ZTV8CNoFnDef
70+
71+
// CHECK-HAS-DTOR-DAG: @_ZTV8CInlined = linkonce_odr {{.*}}constant {{{ \[[^]]*\] } { \[[^]]*\] \[[^]]*\] }}}, comdat, align 8, !dbg [[INLINED_VTABLE_VAR:![0-9]+]]
72+
// CHECK-HAS-DTOR-DAG: @_ZTV9CNoInline = {{.*}}constant {{{ \[[^]]*\] } { \[[^]]*\] \[[^]]*\] }}}, align 8, !dbg [[NOINLINE_VTABLE_VAR:![0-9]+]]
73+
// CHECK-HAS-DTOR-O0-DAG: @_ZTV8CNoFnDef = external {{.*}}constant {{{ \[[^]]*\] }}}, align 8{{$}}
74+
// CHECK-HAS-DTOR-O1-DAG: @_ZTV8CNoFnDef = available_externally {{.*}}constant {{{ \[[^]]*\] } { \[[^]]*\] \[[^]]*\] }}}, align 8, !dbg [[NOFNDEF_VTABLE_VAR:![0-9]+]]
75+
76+
// CHECK-HAS-DTOR: !llvm.dbg.cu
77+
78+
// CHECK-HAS-DTOR-DAG: [[INLINED_VTABLE:![0-9]+]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTV8CInlined"
79+
// CHECK-HAS-DTOR-DAG: [[INLINED_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[INLINED_VTABLE]], expr: !DIExpression())
80+
// CHECK-HAS-DTOR-DAG: [[INLINED:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CInlined"
81+
// CHECK-HAS-DTOR-DAG: !DIDerivedType(tag: DW_TAG_variable, name: "_vtable$", scope: [[INLINED]], file: {{.*}}, baseType: {{![0-9]+}}, flags: DIFlagPrivate | DIFlagArtificial | DIFlagStaticMember)
82+
83+
// CHECK-HAS-DTOR-DAG: [[NOINLINE_VTABLE:![0-9]+]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTV9CNoInline"
84+
// CHECK-HAS-DTOR-DAG: [[NOINLINE_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[NOINLINE_VTABLE]], expr: !DIExpression())
85+
// CHECK-HAS-DTOR-DAG: [[NOINLINE:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CNoInline"
86+
// CHECK-HAS-DTOR-DAG: !DIDerivedType(tag: DW_TAG_variable, name: "_vtable$", scope: [[NOINLINE]], file: {{.*}}, baseType: {{![0-9]+}}, flags: DIFlagPrivate | DIFlagArtificial | DIFlagStaticMember)
87+
88+
// CHECK-HAS-DTOR-O1-DAG: [[NOFNDEF_VTABLE:![0-9]+]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTV8CNoFnDef"
89+
// CHECK-HAS-DTOR-O1-DAG: [[NOFNDEF_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[NOFNDEF_VTABLE]], expr: !DIExpression())
90+
91+
// CHECK-NO-DTOR-NOT: $_ZTV8CInlined
92+
// CHECK-NO-DTOR-NOT: $_ZTV9CNoInline
93+
// CHECK-NO-DTOR-NOT: $_ZTV8CNoFnDef
94+
95+
// CHECK-NO-DTOR-DAG: @_ZTV8CInlined = external {{.*}}constant {{.*}}, align 8{{$}}
96+
// CHECK-NO-DTOR-DAG: @_ZTV9CNoInline = {{.*}}constant {{{ \[[^]]*\] } { \[[^]]*\] \[[^]]*\] }}}, align 8, !dbg [[NOINLINE_VTABLE_VAR:![0-9]+]]
97+
// CHECK-NO-DTOR-O0-DAG: @_ZTV8CNoFnDef = external {{.*}}constant {{{ \[[^]]*\] }}}, align 8{{$}}
98+
// CHECK-NO-DTOR-O1-DAG: @_ZTV8CNoFnDef = available_externally {{.*}}constant {{{ \[[^]]*\] } { \[[^]]*\] \[[^]]*\] }}}, align 8, !dbg [[NOFNDEF_VTABLE_VAR:![0-9]+]]
99+
100+
// CHECK-NO-DTOR: !llvm.dbg.cu
101+
102+
// CHECK-NO-DTOR-DAG: [[NOINLINE_VTABLE:![0-9]+]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTV9CNoInline"
103+
// CHECK-NO-DTOR-DAG: [[NOINLINE_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[NOINLINE_VTABLE]], expr: !DIExpression())
104+
// CHECK-NO-DTOR-DAG: [[NOINLINE:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "CNoInline"
105+
// CHECK-NO-DTOR-DAG: !DIDerivedType(tag: DW_TAG_variable, name: "_vtable$", scope: [[NOINLINE]], file: {{.*}}, baseType: {{![0-9]+}}, flags: DIFlagPrivate | DIFlagArtificial | DIFlagStaticMember)
106+
107+
// CHECK-NO-DTOR-O1-DAG: [[NOFNDEF_VTABLE:![0-9]+]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTV8CNoFnDef"
108+
// CHECK-NO-DTOR-O1-DAG: [[NOFNDEF_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[NOFNDEF_VTABLE]], expr: !DIExpression())

clang/test/DebugInfo/CXX/vtable-inheritance-diamond.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// REQUIRES: target={{x86_64.*-linux.*}}
2-
31
// Diamond inheritance case:
42
// For CBase, CLeft, CRight and CDerived we check:
53
// - Generation of their vtables (including attributes).
@@ -44,17 +42,18 @@ int main() {
4442
return 0;
4543
}
4644

47-
// RUN: %clang --target=x86_64-linux -Xclang -disable-O0-optnone -Xclang -disable-llvm-passes -emit-llvm -S -g %s -o - | FileCheck %s
45+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O0 -disable-llvm-passes %s -o - | FileCheck %s
46+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O1 -disable-llvm-passes %s -o - | FileCheck %s
4847

4948
// CHECK: $_ZTVN3NSP5CBaseE = comdat any
5049
// CHECK: $_ZTVN5NSP_15CLeftE = comdat any
5150
// CHECK: $_ZTVN5NSP_26CRightE = comdat any
5251
// CHECK: $_ZTV8CDerived = comdat any
5352

54-
// CHECK: @_ZTVN3NSP5CBaseE = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[BASE_VTABLE_VAR:![0-9]*]]
55-
// CHECK: @_ZTVN5NSP_15CLeftE = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[LEFT_VTABLE_VAR:![0-9]*]]
56-
// CHECK: @_ZTVN5NSP_26CRightE = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[RIGHT_VTABLE_VAR:![0-9]*]]
57-
// CHECK: @_ZTV8CDerived = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[DERIVED_VTABLE_VAR:![0-9]*]]
53+
// CHECK: @_ZTVN3NSP5CBaseE = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[BASE_VTABLE_VAR:![0-9]*]]
54+
// CHECK: @_ZTVN5NSP_15CLeftE = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[LEFT_VTABLE_VAR:![0-9]*]]
55+
// CHECK: @_ZTVN5NSP_26CRightE = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[RIGHT_VTABLE_VAR:![0-9]*]]
56+
// CHECK: @_ZTV8CDerived = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[DERIVED_VTABLE_VAR:![0-9]*]]
5857

5958
// CHECK: [[BASE_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[BASE_VTABLE:![0-9]*]], expr: !DIExpression())
6059
// CHECK-NEXT: [[BASE_VTABLE]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTVN3NSP5CBaseE"

clang/test/DebugInfo/CXX/vtable-inheritance-multiple.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// REQUIRES: target={{x86_64.*-linux.*}}
2-
31
// Multiple inheritance case:
42
// For CBaseOne, CBaseTwo and CDerived we check:
53
// - Generation of their vtables (including attributes).
@@ -38,15 +36,16 @@ int main() {
3836
return 0;
3937
}
4038

41-
// RUN: %clang --target=x86_64-linux -Xclang -disable-O0-optnone -Xclang -disable-llvm-passes -emit-llvm -S -g %s -o - | FileCheck %s
39+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O0 -disable-llvm-passes %s -o - | FileCheck %s
40+
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -debug-info-kind=limited -dwarf-version=5 -O1 -disable-llvm-passes %s -o - | FileCheck %s
4241

4342
// CHECK: $_ZTVN5NSP_18CBaseOneE = comdat any
4443
// CHECK: $_ZTVN5NSP_28CBaseTwoE = comdat any
4544
// CHECK: $_ZTV8CDerived = comdat any
4645

47-
// CHECK: @_ZTVN5NSP_18CBaseOneE = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[BASE_ONE_VTABLE_VAR:![0-9]*]]
48-
// CHECK: @_ZTVN5NSP_28CBaseTwoE = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[BASE_TWO_VTABLE_VAR:![0-9]*]]
49-
// CHECK: @_ZTV8CDerived = linkonce_odr {{dso_local|hidden}} unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[DERIVED_VTABLE_VAR:![0-9]*]]
46+
// CHECK: @_ZTVN5NSP_18CBaseOneE = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[BASE_ONE_VTABLE_VAR:![0-9]*]]
47+
// CHECK: @_ZTVN5NSP_28CBaseTwoE = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[BASE_TWO_VTABLE_VAR:![0-9]*]]
48+
// CHECK: @_ZTV8CDerived = linkonce_odr {{.*}}unnamed_addr constant {{.*}}, comdat, align 8, !dbg [[DERIVED_VTABLE_VAR:![0-9]*]]
5049

5150
// CHECK: [[BASE_ONE_VTABLE_VAR]] = !DIGlobalVariableExpression(var: [[BASE_ONE_VTABLE:![0-9]*]], expr: !DIExpression())
5251
// CHECK-NEXT: [[BASE_ONE_VTABLE]] = distinct !DIGlobalVariable(name: "_vtable$", linkageName: "_ZTVN5NSP_18CBaseOneE"

0 commit comments

Comments
 (0)