Skip to content

Commit f0facc9

Browse files
committed
merge main into amd-staging
Change-Id: Ief9e99db1dcd4ce2b12648106be21ae20e39bf7d
2 parents f8f4519 + 03229e7 commit f0facc9

File tree

141 files changed

+7544
-3264
lines changed

Some content is hidden

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

141 files changed

+7544
-3264
lines changed

.github/new-prs-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ PGO:
6969
- llvm/**/llvm-profdata/**/*
7070
- llvm/**/llvm-profgen/**/*
7171

72-
vectorization:
72+
vectorizers:
7373
- llvm/lib/Transforms/Vectorize/**/*
7474
- llvm/include/llvm/Transforms/Vectorize/**/*
7575

clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ void MoveConstArgCheck::check(const MatchFinder::MatchResult &Result) {
209209
}
210210

211211
if (const CXXRecordDecl *RecordDecl = ArgType->getAsCXXRecordDecl();
212-
RecordDecl && !(RecordDecl->hasMoveConstructor() &&
213-
RecordDecl->hasMoveAssignment())) {
212+
RecordDecl && RecordDecl->hasDefinition() &&
213+
!(RecordDecl->hasMoveConstructor() &&
214+
RecordDecl->hasMoveAssignment())) {
214215
const bool MissingMoveAssignment = !RecordDecl->hasMoveAssignment();
215216
const bool MissingMoveConstructor = !RecordDecl->hasMoveConstructor();
216217
const bool MissingBoth = MissingMoveAssignment && MissingMoveConstructor;

clang-tools-extra/clang-tidy/rename_check.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
#
99
# ===-----------------------------------------------------------------------===#
1010

11-
from __future__ import unicode_literals
12-
1311
import argparse
1412
import glob
1513
import io
1614
import os
1715
import re
16+
import sys
17+
from typing import List
1818

1919

20-
def replaceInFileRegex(fileName, sFrom, sTo):
20+
def replaceInFileRegex(fileName: str, sFrom: str, sTo: str) -> None:
2121
if sFrom == sTo:
2222
return
2323

@@ -35,7 +35,7 @@ def replaceInFileRegex(fileName, sFrom, sTo):
3535
f.write(txt)
3636

3737

38-
def replaceInFile(fileName, sFrom, sTo):
38+
def replaceInFile(fileName: str, sFrom: str, sTo: str) -> None:
3939
if sFrom == sTo:
4040
return
4141
txt = None
@@ -51,7 +51,7 @@ def replaceInFile(fileName, sFrom, sTo):
5151
f.write(txt)
5252

5353

54-
def generateCommentLineHeader(filename):
54+
def generateCommentLineHeader(filename: str) -> str:
5555
return "".join(
5656
[
5757
"//===--- ",
@@ -63,7 +63,7 @@ def generateCommentLineHeader(filename):
6363
)
6464

6565

66-
def generateCommentLineSource(filename):
66+
def generateCommentLineSource(filename: str) -> str:
6767
return "".join(
6868
[
6969
"//===--- ",
@@ -75,7 +75,7 @@ def generateCommentLineSource(filename):
7575
)
7676

7777

78-
def fileRename(fileName, sFrom, sTo):
78+
def fileRename(fileName: str, sFrom: str, sTo: str) -> str:
7979
if sFrom not in fileName or sFrom == sTo:
8080
return fileName
8181
newFileName = fileName.replace(sFrom, sTo)
@@ -84,7 +84,7 @@ def fileRename(fileName, sFrom, sTo):
8484
return newFileName
8585

8686

87-
def deleteMatchingLines(fileName, pattern):
87+
def deleteMatchingLines(fileName: str, pattern: str) -> bool:
8888
lines = None
8989
with io.open(fileName, "r", encoding="utf8") as f:
9090
lines = f.readlines()
@@ -101,7 +101,7 @@ def deleteMatchingLines(fileName, pattern):
101101
return True
102102

103103

104-
def getListOfFiles(clang_tidy_path):
104+
def getListOfFiles(clang_tidy_path: str) -> List[str]:
105105
files = glob.glob(os.path.join(clang_tidy_path, "**"), recursive=True)
106106
files += [
107107
os.path.normpath(os.path.join(clang_tidy_path, "../docs/ReleaseNotes.rst"))
@@ -124,7 +124,7 @@ def getListOfFiles(clang_tidy_path):
124124

125125
# Adapts the module's CMakelist file. Returns 'True' if it could add a new
126126
# entry and 'False' if the entry already existed.
127-
def adapt_cmake(module_path, check_name_camel):
127+
def adapt_cmake(module_path: str, check_name_camel: str) -> bool:
128128
filename = os.path.join(module_path, "CMakeLists.txt")
129129
with io.open(filename, "r", encoding="utf8") as f:
130130
lines = f.readlines()
@@ -153,7 +153,9 @@ def adapt_cmake(module_path, check_name_camel):
153153

154154

155155
# Modifies the module to include the new check.
156-
def adapt_module(module_path, module, check_name, check_name_camel):
156+
def adapt_module(
157+
module_path: str, module: str, check_name: str, check_name_camel: str
158+
) -> None:
157159
modulecpp = next(
158160
iter(
159161
filter(
@@ -204,7 +206,9 @@ def adapt_module(module_path, module, check_name, check_name_camel):
204206

205207

206208
# Adds a release notes entry.
207-
def add_release_notes(clang_tidy_path, old_check_name, new_check_name):
209+
def add_release_notes(
210+
clang_tidy_path: str, old_check_name: str, new_check_name: str
211+
) -> None:
208212
filename = os.path.normpath(
209213
os.path.join(clang_tidy_path, "../docs/ReleaseNotes.rst")
210214
)
@@ -262,7 +266,7 @@ def add_release_notes(clang_tidy_path, old_check_name, new_check_name):
262266
f.write(line)
263267

264268

265-
def main():
269+
def main() -> None:
266270
parser = argparse.ArgumentParser(description="Rename clang-tidy check.")
267271
parser.add_argument("old_check_name", type=str, help="Old check name.")
268272
parser.add_argument("new_check_name", type=str, help="New check name.")
@@ -311,7 +315,7 @@ def main():
311315
"Check name '%s' not found in %s. Exiting."
312316
% (check_name_camel, cmake_lists)
313317
)
314-
return 1
318+
sys.exit(1)
315319

316320
modulecpp = next(
317321
iter(

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ Changes in existing checks
210210
<clang-tidy/checks/performance/avoid-endl>` check to use ``std::endl`` as
211211
placeholder when lexer cannot get source text.
212212

213+
- Improved :doc:`performance-move-const-arg
214+
<clang-tidy/checks/performance/move-const-arg>` check to fix a crash when
215+
an argument type is declared but not defined.
216+
213217
- Improved :doc:`readability-container-contains
214218
<clang-tidy/checks/readability/container-contains>` check to let it work on
215219
any class that has a ``contains`` method.

clang-tools-extra/test/clang-tidy/checkers/performance/move-const-arg.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,3 +546,17 @@ void testAlsoNonMoveable() {
546546
}
547547

548548
} // namespace issue_62550
549+
550+
namespace GH111450 {
551+
struct Status;
552+
553+
struct Error {
554+
Error(const Status& S);
555+
};
556+
557+
struct Result {
558+
Error E;
559+
Result(Status&& S) : E(std::move(S)) {}
560+
// CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: passing result of std::move() as a const reference argument; no move will actually happen [performance-move-const-arg]
561+
};
562+
} // namespace GH111450

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ Bug Fixes to C++ Support
493493
- Fixed an assertion failure in debug mode, and potential crashes in release mode, when
494494
diagnosing a failed cast caused indirectly by a failed implicit conversion to the type of the constructor parameter.
495495
- Fixed an assertion failure by adjusting integral to boolean vector conversions (#GH108326)
496-
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
497496
- Fixed an issue deducing non-type template arguments of reference type. (#GH73460)
498497
- Fixed an issue in constraint evaluation, where type constraints on the lambda expression
499498
containing outer unexpanded parameters were not correctly expanded. (#GH101754)
@@ -503,9 +502,6 @@ Bug Fixes to C++ Support
503502
in certain friend declarations. (#GH93099)
504503
- Clang now instantiates the correct lambda call operator when a lambda's class type is
505504
merged across modules. (#GH110401)
506-
- Clang now uses the correct set of template argument lists when comparing the constraints of
507-
out-of-line definitions and member templates explicitly specialized for a given implicit instantiation of
508-
a class template. (#GH102320)
509505
- Fix a crash when parsing a pseudo destructor involving an invalid type. (#GH111460)
510506

511507
Bug Fixes to AST Handling

clang/include/clang/AST/Decl.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,13 +2299,6 @@ class FunctionDecl : public DeclaratorDecl,
22992299
FunctionDeclBits.IsLateTemplateParsed = ILT;
23002300
}
23012301

2302-
bool isInstantiatedFromMemberTemplate() const {
2303-
return FunctionDeclBits.IsInstantiatedFromMemberTemplate;
2304-
}
2305-
void setInstantiatedFromMemberTemplate(bool Val = true) {
2306-
FunctionDeclBits.IsInstantiatedFromMemberTemplate = Val;
2307-
}
2308-
23092302
/// Whether this function is "trivial" in some specialized C++ senses.
23102303
/// Can only be true for default constructors, copy constructors,
23112304
/// copy assignment operators, and destructors. Not meaningful until

clang/include/clang/AST/DeclBase.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,8 +1763,6 @@ class DeclContext {
17631763
uint64_t HasImplicitReturnZero : 1;
17641764
LLVM_PREFERRED_TYPE(bool)
17651765
uint64_t IsLateTemplateParsed : 1;
1766-
LLVM_PREFERRED_TYPE(bool)
1767-
uint64_t IsInstantiatedFromMemberTemplate : 1;
17681766

17691767
/// Kind of contexpr specifier as defined by ConstexprSpecKind.
17701768
LLVM_PREFERRED_TYPE(ConstexprSpecKind)
@@ -1815,7 +1813,7 @@ class DeclContext {
18151813
};
18161814

18171815
/// Number of inherited and non-inherited bits in FunctionDeclBitfields.
1818-
enum { NumFunctionDeclBits = NumDeclContextBits + 32 };
1816+
enum { NumFunctionDeclBits = NumDeclContextBits + 31 };
18191817

18201818
/// Stores the bits used by CXXConstructorDecl. If modified
18211819
/// NumCXXConstructorDeclBits and the accessor
@@ -1826,12 +1824,12 @@ class DeclContext {
18261824
LLVM_PREFERRED_TYPE(FunctionDeclBitfields)
18271825
uint64_t : NumFunctionDeclBits;
18281826

1829-
/// 19 bits to fit in the remaining available space.
1827+
/// 20 bits to fit in the remaining available space.
18301828
/// Note that this makes CXXConstructorDeclBitfields take
18311829
/// exactly 64 bits and thus the width of NumCtorInitializers
18321830
/// will need to be shrunk if some bit is added to NumDeclContextBitfields,
18331831
/// NumFunctionDeclBitfields or CXXConstructorDeclBitfields.
1834-
uint64_t NumCtorInitializers : 16;
1832+
uint64_t NumCtorInitializers : 17;
18351833
LLVM_PREFERRED_TYPE(bool)
18361834
uint64_t IsInheritingConstructor : 1;
18371835

@@ -1845,7 +1843,7 @@ class DeclContext {
18451843
};
18461844

18471845
/// Number of inherited and non-inherited bits in CXXConstructorDeclBitfields.
1848-
enum { NumCXXConstructorDeclBits = NumFunctionDeclBits + 19 };
1846+
enum { NumCXXConstructorDeclBits = NumFunctionDeclBits + 20 };
18491847

18501848
/// Stores the bits used by ObjCMethodDecl.
18511849
/// If modified NumObjCMethodDeclBits and the accessor

0 commit comments

Comments
 (0)