Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 1928ca4

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:631bcbe9de13e160d427ad7452a7ef2ca67911ab into amd-gfx:c94dc53f6a77
Local branch amd-gfx c94dc53 Merged main:09cd5a86733a362f12542a11ffd834cac885eb32 into amd-gfx:a6a072505de2 Remote branch main 631bcbe [llvm][cmake] Properly place clang runtime directory on linker command line when WinMsvc.cmake is involved (llvm#110084)
2 parents c94dc53 + 631bcbe commit 1928ca4

38 files changed

+1487
-310
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ std::optional<bool> isUncounted(const QualType T) {
155155
std::optional<bool> isUncounted(const CXXRecordDecl* Class)
156156
{
157157
// Keep isRefCounted first as it's cheaper.
158-
if (isRefCounted(Class))
158+
if (!Class || isRefCounted(Class))
159159
return false;
160160

161161
std::optional<bool> IsRefCountable = isRefCountable(Class);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class UncountedCallArgsChecker
8686
return;
8787
}
8888
auto *E = MemberCallExpr->getImplicitObjectArgument();
89-
QualType ArgType = MemberCallExpr->getObjectType();
89+
QualType ArgType = MemberCallExpr->getObjectType().getCanonicalType();
9090
std::optional<bool> IsUncounted = isUncounted(ArgType);
9191
if (IsUncounted && *IsUncounted && !isPtrOriginSafe(E))
9292
reportBugOnThis(E);
@@ -102,12 +102,13 @@ class UncountedCallArgsChecker
102102
// if ((*P)->hasAttr<SafeRefCntblRawPtrAttr>())
103103
// continue;
104104

105-
const auto *ArgType = (*P)->getType().getTypePtrOrNull();
106-
if (!ArgType)
105+
QualType ArgType = (*P)->getType().getCanonicalType();
106+
const auto *TypePtr = ArgType.getTypePtrOrNull();
107+
if (!TypePtr)
107108
continue; // FIXME? Should we bail?
108109

109110
// FIXME: more complex types (arrays, references to raw pointers, etc)
110-
std::optional<bool> IsUncounted = isUncountedPtr(ArgType);
111+
std::optional<bool> IsUncounted = isUncountedPtr(TypePtr);
111112
if (!IsUncounted || !(*IsUncounted))
112113
continue;
113114

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
2+
3+
#include "mock-types.h"
4+
5+
class Object {
6+
public:
7+
void ref() const;
8+
void deref() const;
9+
10+
bool constFunc() const;
11+
void mutableFunc();
12+
};
13+
14+
class Caller {
15+
void someFunction();
16+
void otherFunction();
17+
private:
18+
RefPtr<Object> m_obj;
19+
};
20+
21+
void Caller::someFunction()
22+
{
23+
m_obj->constFunc();
24+
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
25+
m_obj->mutableFunc();
26+
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
27+
}

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ set(files
2323
__algorithm/find_if.h
2424
__algorithm/find_if_not.h
2525
__algorithm/find_segment_if.h
26-
__algorithm/fold.h
2726
__algorithm/for_each.h
2827
__algorithm/for_each_n.h
2928
__algorithm/for_each_segment.h
@@ -98,6 +97,7 @@ set(files
9897
__algorithm/ranges_find_if.h
9998
__algorithm/ranges_find_if_not.h
10099
__algorithm/ranges_find_last.h
100+
__algorithm/ranges_fold.h
101101
__algorithm/ranges_for_each.h
102102
__algorithm/ranges_for_each_n.h
103103
__algorithm/ranges_generate.h

libcxx/include/__algorithm/fold.h renamed to libcxx/include/__algorithm/ranges_fold.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef _LIBCPP___ALGORITHM_FOLD_H
11-
#define _LIBCPP___ALGORITHM_FOLD_H
10+
#ifndef _LIBCPP___ALGORITHM_RANGES_FOLD_H
11+
#define _LIBCPP___ALGORITHM_RANGES_FOLD_H
1212

1313
#include <__concepts/assignable.h>
1414
#include <__concepts/constructible.h>
@@ -126,4 +126,4 @@ _LIBCPP_END_NAMESPACE_STD
126126

127127
_LIBCPP_POP_MACROS
128128

129-
#endif // _LIBCPP___ALGORITHM_FOLD_H
129+
#endif // _LIBCPP___ALGORITHM_RANGES_FOLD_H

libcxx/include/algorithm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,10 +2020,10 @@ template <class BidirectionalIterator, class Compare>
20202020
#endif
20212021

20222022
#if _LIBCPP_STD_VER >= 23
2023-
# include <__algorithm/fold.h>
20242023
# include <__algorithm/ranges_contains_subrange.h>
20252024
# include <__algorithm/ranges_ends_with.h>
20262025
# include <__algorithm/ranges_find_last.h>
2026+
# include <__algorithm/ranges_fold.h>
20272027
# include <__algorithm/ranges_starts_with.h>
20282028
#endif // _LIBCPP_STD_VER >= 23
20292029

libcxx/include/module.modulemap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ module std [system] {
412412
module find_if { header "__algorithm/find_if.h" }
413413
module find_segment_if { header "__algorithm/find_segment_if.h" }
414414
module find { header "__algorithm/find.h" }
415-
module fold { header "__algorithm/fold.h" }
416415
module for_each_n { header "__algorithm/for_each_n.h" }
417416
module for_each_segment { header "__algorithm/for_each_segment.h" }
418417
module for_each { header "__algorithm/for_each.h" }
@@ -529,6 +528,7 @@ module std [system] {
529528
module ranges_find_if { header "__algorithm/ranges_find_if.h" }
530529
module ranges_find_last { header "__algorithm/ranges_find_last.h" }
531530
module ranges_find { header "__algorithm/ranges_find.h" }
531+
module ranges_fold { header "__algorithm/ranges_fold.h" }
532532
module ranges_for_each_n {
533533
header "__algorithm/ranges_for_each_n.h"
534534
export std.algorithm.in_fun_result

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ function(append value)
324324
endforeach(variable)
325325
endfunction()
326326

327+
function(prepend value)
328+
foreach(variable ${ARGN})
329+
set(${variable} "${value} ${${variable}}" PARENT_SCOPE)
330+
endforeach(variable)
331+
endfunction()
332+
327333
function(append_if condition value)
328334
if (${condition})
329335
foreach(variable ${ARGN})
@@ -1198,7 +1204,7 @@ if (CLANG_CL AND (LLVM_BUILD_INSTRUMENTED OR LLVM_USE_SANITIZER))
11981204
endif()
11991205
file(TO_CMAKE_PATH "${clang_compiler_rt_file}" clang_compiler_rt_file)
12001206
get_filename_component(clang_runtime_dir "${clang_compiler_rt_file}" DIRECTORY)
1201-
append("/libpath:\"${clang_runtime_dir}\""
1207+
prepend("/libpath:\"${clang_runtime_dir}\""
12021208
CMAKE_EXE_LINKER_FLAGS
12031209
CMAKE_MODULE_LINKER_FLAGS
12041210
CMAKE_SHARED_LINKER_FLAGS)

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 513234
19+
#define LLVM_MAIN_REVISION 513241
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,20 +447,20 @@ class AArch64MCInstrAnalysis : public MCInstrAnalysis {
447447
const MCRegisterClass &FPR128RC =
448448
MRI.getRegClass(AArch64::FPR128RegClassID);
449449

450-
auto ClearsSuperReg = [=](unsigned RegID) {
450+
auto ClearsSuperReg = [=](MCRegister Reg) {
451451
// An update to the lower 32 bits of a 64 bit integer register is
452452
// architecturally defined to zero extend the upper 32 bits on a write.
453-
if (GPR32RC.contains(RegID))
453+
if (GPR32RC.contains(Reg))
454454
return true;
455455
// SIMD&FP instructions operating on scalar data only acccess the lower
456456
// bits of a register, the upper bits are zero extended on a write. For
457457
// SIMD vector registers smaller than 128-bits, the upper 64-bits of the
458458
// register are zero extended on a write.
459459
// When VL is higher than 128 bits, any write to a SIMD&FP register sets
460460
// bits higher than 128 to zero.
461-
return FPR8RC.contains(RegID) || FPR16RC.contains(RegID) ||
462-
FPR32RC.contains(RegID) || FPR64RC.contains(RegID) ||
463-
FPR128RC.contains(RegID);
461+
return FPR8RC.contains(Reg) || FPR16RC.contains(Reg) ||
462+
FPR32RC.contains(Reg) || FPR64RC.contains(Reg) ||
463+
FPR128RC.contains(Reg);
464464
};
465465

466466
Mask.clearAllBits();

0 commit comments

Comments
 (0)