Skip to content

Commit 3a6cd08

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:724b91b46783 into amd-gfx:2b7d47b51c4b
Local branch amd-gfx 2b7d47b Merged main:7de64925da9f into amd-gfx:c36a128a410e Remote branch main 724b91b [flang-rt] Fixed freestanding memmove. (llvm#128604)
2 parents 2b7d47b + 724b91b commit 3a6cd08

File tree

401 files changed

+38165
-10132
lines changed

Some content is hidden

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

401 files changed

+38165
-10132
lines changed

bolt/test/binary-analysis/AArch64/gs-pacret-autiasp.s

Lines changed: 25 additions & 99 deletions
Large diffs are not rendered by default.

bolt/test/binary-analysis/AArch64/gs-pacret-multi-bb.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ f_crossbb1:
1515
1:
1616
ret
1717
.size f_crossbb1, .-f_crossbb1
18-
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_crossbb1, basic block .L{{[^,]+}}, at address
18+
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_crossbb1, basic block {{[^,]+}}, at address
1919
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: ret
2020
// CHECK-NEXT: The 2 instructions that write to the return register after any authentication are:
2121
// CHECK-NEXT: 1. {{[0-9a-f]+}}: ldp x29, x30, [sp], #0x10
@@ -37,7 +37,7 @@ f_mergebb1:
3737
1:
3838
ret
3939
.size f_mergebb1, .-f_mergebb1
40-
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_mergebb1, basic block .L{{[^,]+}}, at address
40+
// CHECK-LABEL: GS-PACRET: non-protected ret found in function f_mergebb1, basic block {{[^,]+}}, at address
4141
// CHECK-NEXT: The return instruction is {{[0-9a-f]+}}: ret
4242
// CHECK-NEXT: The 1 instructions that write to the return register after any authentication are:
4343
// CHECK-NEXT: 1. {{[0-9a-f]+}}: ldp x29, x30, [sp], #0x10

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ ClangTidyASTConsumerFactory::createASTConsumer(
462462
std::unique_ptr<ento::AnalysisASTConsumer> AnalysisConsumer =
463463
ento::CreateAnalysisConsumer(Compiler);
464464
AnalysisConsumer->AddDiagnosticConsumer(
465-
new AnalyzerDiagnosticConsumer(Context));
465+
std::make_unique<AnalyzerDiagnosticConsumer>(Context));
466466
Consumers.push_back(std::move(AnalysisConsumer));
467467
}
468468
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER

clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ clang_target_link_libraries(clangTidyBugproneModule
117117
clangASTMatchers
118118
clangBasic
119119
clangLex
120+
clangSema
120121
clangTooling
121122
clangTransformer
122123
)

clang-tools-extra/clang-tidy/bugprone/StandaloneEmptyCheck.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "clang/Basic/Diagnostic.h"
2121
#include "clang/Basic/SourceLocation.h"
2222
#include "clang/Lex/Lexer.h"
23+
#include "clang/Sema/HeuristicResolver.h"
2324
#include "llvm/ADT/STLExtras.h"
2425
#include "llvm/ADT/SmallVector.h"
2526
#include "llvm/Support/Casting.h"
@@ -125,8 +126,8 @@ void StandaloneEmptyCheck::check(const MatchFinder::MatchResult &Result) {
125126
DeclarationName Name =
126127
Context.DeclarationNames.getIdentifier(&Context.Idents.get("clear"));
127128

128-
auto Candidates = MemberCall->getRecordDecl()->lookupDependentName(
129-
Name, [](const NamedDecl *ND) {
129+
auto Candidates = HeuristicResolver(Context).lookupDependentName(
130+
MemberCall->getRecordDecl(), Name, [](const NamedDecl *ND) {
130131
return isa<CXXMethodDecl>(ND) &&
131132
llvm::cast<CXXMethodDecl>(ND)->getMinRequiredArguments() ==
132133
0 &&
@@ -174,8 +175,8 @@ void StandaloneEmptyCheck::check(const MatchFinder::MatchResult &Result) {
174175
DeclarationName Name =
175176
Context.DeclarationNames.getIdentifier(&Context.Idents.get("clear"));
176177

177-
auto Candidates =
178-
ArgRecordDecl->lookupDependentName(Name, [](const NamedDecl *ND) {
178+
auto Candidates = HeuristicResolver(Context).lookupDependentName(
179+
ArgRecordDecl, Name, [](const NamedDecl *ND) {
179180
return isa<CXXMethodDecl>(ND) &&
180181
llvm::cast<CXXMethodDecl>(ND)->getMinRequiredArguments() ==
181182
0 &&

clang/docs/analyzer/checkers.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,51 @@ Here are some examples of situations that we warn about as they *might* be poten
36683668
RefCountable* uncounted = counted.get(); // warn
36693669
}
36703670
3671+
alpha.webkit.UnretainedLocalVarsChecker
3672+
"""""""""""""""""""""""""""""""""""""""
3673+
The goal of this rule is to make sure that any NS or CF local variable is backed by a RetainPtr with lifetime that is strictly larger than the scope of the unretained local variable. To be on the safe side we require the scope of an unretained variable to be embedded in the scope of Retainptr object that backs it.
3674+
3675+
The rules of when to use and not to use RetainPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
3676+
3677+
These are examples of cases that we consider safe:
3678+
3679+
.. code-block:: cpp
3680+
3681+
void foo1() {
3682+
RetainPtr<NSObject> retained;
3683+
// The scope of unretained is EMBEDDED in the scope of retained.
3684+
{
3685+
NSObject* unretained = retained.get(); // ok
3686+
}
3687+
}
3688+
3689+
void foo2(RetainPtr<NSObject> retained_param) {
3690+
NSObject* unretained = retained_param.get(); // ok
3691+
}
3692+
3693+
void FooClass::foo_method() {
3694+
NSObject* unretained = this; // ok
3695+
}
3696+
3697+
Here are some examples of situations that we warn about as they *might* be potentially unsafe. The logic is that either we're able to guarantee that a local variable is safe or it's considered unsafe.
3698+
3699+
.. code-block:: cpp
3700+
3701+
void foo1() {
3702+
NSObject* unretained = [[NSObject alloc] init]; // warn
3703+
}
3704+
3705+
NSObject* global_unretained;
3706+
void foo2() {
3707+
NSObject* unretained = global_unretained; // warn
3708+
}
3709+
3710+
void foo3() {
3711+
RetainPtr<NSObject> retained;
3712+
// The scope of unretained is not EMBEDDED in the scope of retained.
3713+
NSObject* unretained = retained.get(); // warn
3714+
}
3715+
36713716
Debug Checkers
36723717
---------------
36733718

clang/include/clang/AST/DeclCXX.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,14 +1720,6 @@ class CXXRecordDecl : public RecordDecl {
17201720
/// static analysis, or similar.
17211721
bool hasMemberName(DeclarationName N) const;
17221722

1723-
/// Performs an imprecise lookup of a dependent name in this class.
1724-
///
1725-
/// This function does not follow strict semantic rules and should be used
1726-
/// only when lookup rules can be relaxed, e.g. indexing.
1727-
std::vector<const NamedDecl *>
1728-
lookupDependentName(DeclarationName Name,
1729-
llvm::function_ref<bool(const NamedDecl *ND)> Filter);
1730-
17311723
/// Renders and displays an inheritance diagram
17321724
/// for this C++ class and all of its base classes (transitively) using
17331725
/// GraphViz.

clang/include/clang/Basic/BuiltinsSPIRV.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ def SPIRVLength : Builtin {
1919
let Attributes = [NoThrow, Const];
2020
let Prototype = "void(...)";
2121
}
22+
23+
def SPIRVReflect : Builtin {
24+
let Spellings = ["__builtin_spirv_reflect"];
25+
let Attributes = [NoThrow, Const];
26+
let Prototype = "void(...)";
27+
}

clang/include/clang/Basic/LangOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ class LangOptions : public LangOptionsBase {
816816
VisibilityForcedKinds::ForceHidden;
817817
}
818818

819+
bool allowArrayReturnTypes() const { return HLSL; }
820+
819821
/// Remap path prefix according to -fmacro-prefix-path option.
820822
void remapPathPrefix(SmallVectorImpl<char> &Path) const;
821823

clang/include/clang/CIR/Passes.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file exposes the entry points to create compiler passes for ClangIR.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef CLANG_CIR_PASSES_H
14+
#define CLANG_CIR_PASSES_H
15+
16+
#include "mlir/Pass/Pass.h"
17+
18+
#include <memory>
19+
20+
namespace cir {
21+
namespace direct {
22+
/// Create a pass that fully lowers CIR to the LLVMIR dialect.
23+
std::unique_ptr<mlir::Pass> createConvertCIRToLLVMPass();
24+
25+
/// Adds passes that fully lower CIR to the LLVMIR dialect.
26+
void populateCIRToLLVMPasses(mlir::OpPassManager &pm);
27+
28+
} // namespace direct
29+
} // end namespace cir
30+
31+
#endif // CLANG_CIR_PASSES_H

0 commit comments

Comments
 (0)