Skip to content

Commit 8630c4c

Browse files
authored
Merge branch 'main' into facade-locations
2 parents 5001e68 + 2f9a458 commit 8630c4c

File tree

140 files changed

+3515
-1504
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+3515
-1504
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This file defines a workflow that runs the libc++ benchmarks when a comment is added to the PR.
2+
#
3+
# The comment is of the form:
4+
#
5+
# /libcxx-bot benchmark <path-to-benchmarks-to-run>
6+
#
7+
# That will cause the specified benchmarks to be run on the PR and on the pull-request target, and
8+
# their results to be compared.
9+
10+
name: Benchmark libc++
11+
12+
permissions:
13+
contents: read # Default everything to read-only
14+
15+
on:
16+
issue_comment:
17+
types:
18+
- created
19+
- edited
20+
21+
env:
22+
CC: clang-22
23+
CXX: clang++-22
24+
COMMENT_BODY: ${{ github.event.comment.body }}
25+
PULL_REQUEST_HEAD: ${{ github.event.issue.pull_request.head.sha }}
26+
PULL_REQUEST_BASE: ${{ github.event.issue.pull_request.base.sha }}
27+
28+
jobs:
29+
run-benchmarks:
30+
if: >-
31+
github.event.issue.pull_request &&
32+
contains(github.event.comment.body, '/libcxx-bot benchmark')
33+
34+
runs-on: llvm-premerge-libcxx-next-runners # TODO: This should run on a dedicated set of machines
35+
steps:
36+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37+
with:
38+
ref: ${PULL_REQUEST_HEAD}
39+
fetch-depth: 0
40+
fetch-tags: true # This job requires access to all the Git branches so it can diff against (usually) main
41+
42+
- uses: actions/setup-python@v6
43+
with:
44+
python-version: '3.10'
45+
46+
- name: Install dependencies
47+
run: |
48+
python3 -m venv .venv
49+
source .venv/bin/activate
50+
python -m pip install -r libcxx/utils/requirements.txt
51+
52+
- name: Run baseline
53+
run: |
54+
BENCHMARKS=$(echo "${COMMENT_BODY}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
55+
baseline_commit=$(git merge-base ${PULL_REQUEST_BASE} ${PULL_REQUEST_SHA})
56+
./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${BENCHMARKS}
57+
58+
- name: Run candidate
59+
run: |
60+
BENCHMARKS=$(echo "${COMMENT_BODY}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
61+
./libcxx/utils/test-at-commit --commit ${PULL_REQUEST_SHA} -B build/candidate -- -sv -j1 --param optimization=speed ${BENCHMARKS}
62+
63+
- name: Compare baseline and candidate runs
64+
run: ./libcxx/utils/compare-benchmarks <(./libcxx/utils/consolidate-benchmarks build/baseline) \
65+
<(./libcxx/utils/consolidate-benchmarks build/candidate)

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ bool tryToFindPtrOrigin(
9191
continue;
9292
}
9393
if (auto *call = dyn_cast<CallExpr>(E)) {
94+
if (auto *Callee = call->getCalleeDecl()) {
95+
if (Callee->hasAttr<CFReturnsRetainedAttr>() ||
96+
Callee->hasAttr<NSReturnsRetainedAttr>()) {
97+
return callback(E, true);
98+
}
99+
}
100+
94101
if (auto *memberCall = dyn_cast<CXXMemberCallExpr>(call)) {
95102
if (auto *decl = memberCall->getMethodDecl()) {
96103
std::optional<bool> IsGetterOfRefCt = isGetterOfSafePtr(decl);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,10 @@ class TrivialFunctionAnalysisVisitor
666666
return IsFunctionTrivial(Callee);
667667
}
668668

669+
bool VisitGCCAsmStmt(const GCCAsmStmt *AS) {
670+
return AS->getAsmString() == "brk #0xc471";
671+
}
672+
669673
bool
670674
VisitSubstNonTypeTemplateParmExpr(const SubstNonTypeTemplateParmExpr *E) {
671675
// Non-type template paramter is compile time constant and trivial.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %clang_analyze_cc1 -triple arm-darwin -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2+
// expected-no-diagnostics
3+
4+
void crash()
5+
{
6+
__asm__ volatile ("brk #0xc471");
7+
__builtin_unreachable();
8+
}
9+
10+
class SomeObj {
11+
public:
12+
void ref();
13+
void deref();
14+
15+
void someWork() { crash(); }
16+
};
17+
18+
SomeObj* provide();
19+
20+
void doSomeWork() {
21+
provide()->someWork();
22+
}

clang/test/Analysis/Checkers/WebKit/unretained-call-args.mm

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,32 @@ void use_const_local() {
438438

439439
} // namespace const_global
440440

441+
namespace ns_retained_return_value {
442+
443+
NSString *provideNS() NS_RETURNS_RETAINED;
444+
CFDictionaryRef provideCF() CF_RETURNS_RETAINED;
445+
void consumeNS(NSString *);
446+
void consumeCF(CFDictionaryRef);
447+
448+
void foo() {
449+
consumeNS(provideNS());
450+
consumeCF(provideCF());
451+
}
452+
453+
struct Base {
454+
NSString *provideStr() NS_RETURNS_RETAINED;
455+
};
456+
457+
struct Derived : Base {
458+
void consumeStr(NSString *);
459+
460+
void foo() {
461+
consumeStr(provideStr());
462+
}
463+
};
464+
465+
} // namespace ns_retained_return_value
466+
441467
@interface TestObject : NSObject
442468
- (void)doWork:(NSString *)msg, ...;
443469
- (void)doWorkOnSelf;

clang/test/Analysis/Checkers/WebKit/unretained-local-vars.mm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,21 @@ void use_const_local() {
408408

409409
} // namespace const_global
410410

411+
namespace ns_retained_return_value {
412+
413+
NSString *provideNS() NS_RETURNS_RETAINED;
414+
CFDictionaryRef provideCF() CF_RETURNS_RETAINED;
415+
void consumeNS(NSString *);
416+
void consumeCF(CFDictionaryRef);
417+
418+
unsigned foo() {
419+
auto *string = provideNS();
420+
auto *dictionary = provideCF();
421+
return string.length + CFDictionaryGetCount(dictionary);
422+
}
423+
424+
} // namespace ns_retained_return_value
425+
411426
bool doMoreWorkOpaque(OtherObj*);
412427
SomeObj* provide();
413428

libc/test/src/__support/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ add_libc_test(
123123
str_to_float_test.cpp
124124
str_to_double_test.cpp
125125
str_to_long_double_test.cpp
126+
HDRS
127+
str_to_fp_test.h
126128
DEPENDS
127129
libc.src.__support.integer_literals
128130
libc.src.__support.str_to_float

libc/test/src/__support/str_to_fp_test.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/__support/FPUtil/FPBits.h"
10-
#include "src/__support/libc_errno.h"
1110
#include "src/__support/macros/config.h"
1211
#include "src/__support/str_to_float.h"
1312
#include "src/__support/uint128.h"

libc/test/src/__support/str_to_integer_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/__support/libc_errno.h"
109
#include "src/__support/str_to_integer.h"
1110
#include <stddef.h>
1211

libc/test/src/__support/wcs_to_integer_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "src/__support/libc_errno.h"
109
#include "src/__support/wcs_to_integer.h"
1110
#include <stddef.h>
1211

0 commit comments

Comments
 (0)