Skip to content

Commit b019753

Browse files
authored
Merge branch 'main' into p/libc-hdrgen-merge
2 parents 8a61fc5 + 50b1763 commit b019753

File tree

6 files changed

+141
-78
lines changed

6 files changed

+141
-78
lines changed

.github/workflows/premerge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
145145
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
146146
147-
permerge-check-macos:
147+
premerge-check-macos:
148148
runs-on: macos-14
149149
if: >-
150150
github.repository_owner == 'llvm' &&

clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,19 @@ class TrivialFunctionAnalysisVisitor
594594
return Visit(BTE->getSubExpr());
595595
}
596596

597+
bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *AILE) {
598+
return Visit(AILE->getCommonExpr()) && Visit(AILE->getSubExpr());
599+
}
600+
601+
bool VisitArrayInitIndexExpr(const ArrayInitIndexExpr *AIIE) {
602+
return true; // The current array index in VisitArrayInitLoopExpr is always
603+
// trivial.
604+
}
605+
606+
bool VisitOpaqueValueExpr(const OpaqueValueExpr *OVE) {
607+
return Visit(OVE->getSourceExpr());
608+
}
609+
597610
bool VisitExprWithCleanups(const ExprWithCleanups *EWC) {
598611
return Visit(EWC->getSubExpr());
599612
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2+
3+
typedef unsigned long size_t;
4+
template<typename T, size_t N>
5+
struct Obj {
6+
constexpr static size_t Size = N;
7+
8+
constexpr T& operator[](size_t i) { return components[i]; }
9+
constexpr const T& operator[](size_t i) const { return components[i]; }
10+
11+
constexpr size_t size() const { return Size; }
12+
13+
T components[N];
14+
};
15+
16+
template<typename T, size_t N>
17+
constexpr bool operator==(const Obj<T, N>& a, const Obj<T, N>& b)
18+
{
19+
for (size_t i = 0; i < N; ++i) {
20+
if (a[i] == b[i])
21+
continue;
22+
return false;
23+
}
24+
25+
return true;
26+
}
27+
28+
struct NonTrivial {
29+
NonTrivial();
30+
NonTrivial(const NonTrivial&);
31+
bool operator==(const NonTrivial& other) const { return value == other.value; }
32+
float value;
33+
};
34+
35+
class Component {
36+
public:
37+
void ref() const;
38+
void deref() const;
39+
40+
Obj<float, 4> unresolvedComponents() const { return m_components; }
41+
Obj<NonTrivial, 4> unresolvedNonTrivialComponents() const { return m_nonTrivialComponents; }
42+
43+
bool isEqual(const Component& other) const {
44+
return unresolvedComponents() == other.unresolvedComponents();
45+
}
46+
47+
bool isNonTrivialEqual(const Component& other) const {
48+
return unresolvedNonTrivialComponents() == other.unresolvedNonTrivialComponents();
49+
}
50+
51+
private:
52+
Obj<float, 4> m_components;
53+
Obj<NonTrivial, 4> m_nonTrivialComponents;
54+
};
55+
56+
Component* provide();
57+
bool someFunction(Component* other) {
58+
return provide()->isEqual(*other);
59+
}
60+
61+
bool otherFunction(Component* other) {
62+
return provide()->isNonTrivialEqual(*other);
63+
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
64+
}

llvm/test/ThinLTO/X86/memprof-recursive.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
; RUN: -pass-remarks=memprof-context-disambiguation \
2121
; RUN: -memprof-allow-recursive-callsites=true \
2222
; RUN: -o %t.out 2>&1 | FileCheck %s \
23-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
23+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
2424
; RUN: --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
2525

2626
;; Skipping recursive callsites should result in no cloning.
@@ -35,7 +35,7 @@
3535
; RUN: -pass-remarks=memprof-context-disambiguation \
3636
; RUN: -memprof-allow-recursive-callsites=false \
3737
; RUN: -o %t.out 2>&1 | FileCheck %s --allow-empty \
38-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
38+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
3939
; RUN: --implicit-check-not="created clone" \
4040
; RUN: --implicit-check-not="marked with memprof allocation attribute cold"
4141

@@ -50,7 +50,7 @@
5050
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
5151
; RUN: -pass-remarks=memprof-context-disambiguation \
5252
; RUN: -o %t.out 2>&1 | FileCheck %s \
53-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
53+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
5454
; RUN: --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
5555

5656
;; Skipping recursive contexts should prevent spurious call to cloned version of
@@ -68,7 +68,7 @@
6868
; RUN: -memprof-allow-recursive-callsites=true \
6969
; RUN: -memprof-allow-recursive-contexts=false \
7070
; RUN: -o %t.out 2>&1 | FileCheck %s \
71-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
71+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
7272
; RUN: --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=SKIP-RECUR-CONTEXTS
7373

7474
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:4:0: created clone _Z1Dv.memprof.1

llvm/test/Transforms/MemProfContextDisambiguation/recursive.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
; RUN: -pass-remarks=memprof-context-disambiguation \
4444
; RUN: -memprof-allow-recursive-callsites=true \
4545
; RUN: %s -S 2>&1 | FileCheck %s \
46-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
46+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
4747
; RUN: --check-prefix=ALL --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
4848

4949
;; Skipping recursive callsites should result in no cloning.
@@ -52,7 +52,7 @@
5252
; RUN: -pass-remarks=memprof-context-disambiguation \
5353
; RUN: -memprof-allow-recursive-callsites=false \
5454
; RUN: %s -S 2>&1 | FileCheck %s \
55-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
55+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
5656
; RUN: --implicit-check-not="created clone" \
5757
; RUN: --implicit-check-not="marked with memprof allocation attribute cold" \
5858
; RUN: --check-prefix=ALL
@@ -62,7 +62,7 @@
6262
; RUN: -memprof-verify-ccg -memprof-verify-nodes \
6363
; RUN: -pass-remarks=memprof-context-disambiguation \
6464
; RUN: %s -S 2>&1 | FileCheck %s \
65-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
65+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
6666
; RUN: --check-prefix=ALL --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=ALLOW-RECUR-CONTEXTS
6767

6868
;; Skipping recursive contexts should prevent spurious call to cloned version of
@@ -74,7 +74,7 @@
7474
; RUN: -memprof-allow-recursive-callsites=true \
7575
; RUN: -memprof-allow-recursive-contexts=false \
7676
; RUN: %s -S 2>&1 | FileCheck %s \
77-
; RUN: --implicit-check-not "memprof_recursive3.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
77+
; RUN: --implicit-check-not "memprof_recursive.cc:12:10: call in clone _Z1Ci.memprof.1 assigned" \
7878
; RUN: --check-prefix=ALL --check-prefix=ALLOW-RECUR-CALLSITES --check-prefix=SKIP-RECUR-CONTEXTS
7979

8080
; ALLOW-RECUR-CALLSITES: memprof_recursive.cc:4:0: created clone _Z1Dv.memprof.1

0 commit comments

Comments
 (0)