Skip to content

Commit 1aa5640

Browse files
Merge from 'main' to 'sycl-web' (74 commits)
CONFLICT (content): Merge conflict in clang/lib/Sema/SemaChecking.cpp
2 parents 81cf910 + 3ad2fe9 commit 1aa5640

File tree

304 files changed

+7247
-5446
lines changed

Some content is hidden

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

304 files changed

+7247
-5446
lines changed

clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "UseEqualsDefaultCheck.h"
1010
#include "../utils/LexerUtils.h"
11+
#include "../utils/Matchers.h"
1112
#include "clang/AST/ASTContext.h"
1213
#include "clang/ASTMatchers/ASTMatchFinder.h"
1314
#include "clang/Lex/Lexer.h"
@@ -247,7 +248,12 @@ void UseEqualsDefaultCheck::registerMatchers(MatchFinder *Finder) {
247248
// isCopyAssignmentOperator() allows the parameter to be
248249
// passed by value, and in this case it cannot be
249250
// defaulted.
250-
hasParameter(0, hasType(lValueReferenceType())))
251+
hasParameter(0, hasType(lValueReferenceType())),
252+
// isCopyAssignmentOperator() allows non lvalue reference
253+
// return types, and in this case it cannot be defaulted.
254+
returns(qualType(hasCanonicalType(
255+
allOf(lValueReferenceType(pointee(type())),
256+
unless(matchers::isReferenceToConst()))))))
251257
.bind(SpecialFunction),
252258
this);
253259
}

clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class UseEqualsDefaultCheck : public ClangTidyCheck {
3838
public:
3939
UseEqualsDefaultCheck(StringRef Name, ClangTidyContext *Context);
4040
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
41-
return LangOpts.CPlusPlus;
41+
return LangOpts.CPlusPlus11;
4242
}
4343
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
4444
void registerMatchers(ast_matchers::MatchFinder *Finder) override;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ Changes in existing checks
145145
check.
146146

147147
The check now skips unions since in this case a default constructor with empty body
148-
is not equivalent to the explicitly defaulted one.
148+
is not equivalent to the explicitly defaulted one. The check also skips copy assignment
149+
operators with nonstandard return types. The check is restricted to c++11-or-later.
149150

150151
Removed checks
151152
^^^^^^^^^^^^^^

clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,13 @@ IL &WRT::operator=(const WRT &Other) {
444444
return *this;
445445
}
446446

447+
// Wrong return type.
448+
struct WRTConstRef {
449+
const WRTConstRef &operator = (const WRTConstRef &) {
450+
return *this;
451+
}
452+
};
453+
447454
// Try-catch.
448455
struct ITC {
449456
ITC(const ITC &Other)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %check_clang_tidy -std=c++98 %s modernize-use-equals-default %t
2+
3+
struct S {
4+
S() {}
5+
// CHECK-FIXES: S() {}
6+
~S() {}
7+
// CHECK-FIXES: ~S() {}
8+
};

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ Bug Fixes
8989
- Fix a crash when attempting to default a virtual constexpr non-special member
9090
function in a derived class. This fixes
9191
`Issue 57431 <https://github.com/llvm/llvm-project/issues/57431>`_
92+
- Fix a crash where we attempt to define a deleted destructor. This fixes
93+
`Issue 57516 <https://github.com/llvm/llvm-project/issues/57516>`_
9294

9395

9496
Improvements to Clang's diagnostics

clang/include/clang/AST/DeclCXX.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class CXXRecordDecl : public RecordDecl {
260260
friend class ASTWriter;
261261
friend class DeclContext;
262262
friend class LambdaExpr;
263+
friend class ODRDiagsEmitter;
263264

264265
friend void FunctionDecl::setPure(bool);
265266
friend void TagDecl::startDefinition();

clang/include/clang/Basic/Builtins.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ BUILTIN(__builtin_va_start, "vA.", "nt")
546546
BUILTIN(__builtin_va_end, "vA", "n")
547547
BUILTIN(__builtin_va_copy, "vAA", "n")
548548
BUILTIN(__builtin_stdarg_start, "vA.", "nt")
549-
BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc")
549+
BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nct")
550550
BUILTIN(__builtin_bcmp, "ivC*vC*z", "Fn")
551551
BUILTIN(__builtin_bcopy, "vv*v*z", "n")
552552
BUILTIN(__builtin_bzero, "vv*z", "nF")

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6257,7 +6257,6 @@ def stack_protector : Separate<["-"], "stack-protector">,
62576257
def stack_protector_buffer_size : Separate<["-"], "stack-protector-buffer-size">,
62586258
HelpText<"Lower bound for a buffer to be considered for stack protection">,
62596259
MarshallingInfoInt<CodeGenOpts<"SSPBufferSize">, "8">;
6260-
def : Separate<["-"], "fvisibility">, Alias<fvisibility_EQ>;
62616260
def ftype_visibility : Joined<["-"], "ftype-visibility=">,
62626261
HelpText<"Default type visibility">,
62636262
MarshallingInfoVisibility<LangOpts<"TypeVisibilityMode">, fvisibility_EQ.KeyPath>;

clang/include/clang/Serialization/ASTReader.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,10 +1845,6 @@ class ASTReader
18451845
/// if the declaration is not from a module file.
18461846
ModuleFile *getOwningModuleFile(const Decl *D);
18471847

1848-
/// Get the best name we know for the module that owns the given
1849-
/// declaration, or an empty string if the declaration is not from a module.
1850-
std::string getOwningModuleNameForDiagnostic(const Decl *D);
1851-
18521848
/// Returns the source location for the decl \p ID.
18531849
SourceLocation getSourceLocationForDeclID(serialization::GlobalDeclID ID);
18541850

0 commit comments

Comments
 (0)