Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra')
-rw-r--r--clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp14
-rw-r--r--clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp3
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp10
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp11
-rw-r--r--clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp7
-rw-r--r--clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp3
-rw-r--r--clang-tools-extra/clang-tidy/misc/MisplacedConstCheck.cpp13
-rw-r--r--clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp3
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp34
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp4
-rw-r--r--clang-tools-extra/clangd/FindTarget.cpp5
-rw-r--r--clang-tools-extra/clangd/unittests/ASTTests.cpp20
-rw-r--r--clang-tools-extra/clangd/unittests/DumpASTTests.cpp3
-rw-r--r--clang-tools-extra/clangd/unittests/FindTargetTests.cpp11
-rw-r--r--clang-tools-extra/clangd/unittests/HoverTests.cpp22
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/copy-constructor-init.cpp3
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/shared-ptr-array-mismatch.cpp2
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison-32bits.cpp2
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison.cpp22
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp4
-rw-r--r--clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp2
22 files changed, 109 insertions, 91 deletions
diff --git a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
index 59acc29e8ee9..26d31c669bcc 100644
--- a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
@@ -567,14 +567,12 @@ void ChangeNamespaceTool::run(
if (Loc.getTypeLocClass() == TypeLoc::Elaborated) {
NestedNameSpecifierLoc NestedNameSpecifier =
Loc.castAs<ElaboratedTypeLoc>().getQualifierLoc();
- // This happens for friend declaration of a base class with injected class
- // name.
- if (!NestedNameSpecifier.getNestedNameSpecifier())
- return;
- const Type *SpecifierType =
- NestedNameSpecifier.getNestedNameSpecifier()->getAsType();
- if (SpecifierType && SpecifierType->isRecordType())
- return;
+ // FIXME: avoid changing injected class names.
+ if (auto *NNS = NestedNameSpecifier.getNestedNameSpecifier()) {
+ const Type *SpecifierType = NNS->getAsType();
+ if (SpecifierType && SpecifierType->isRecordType())
+ return;
+ }
}
fixTypeLoc(Result, startLocationForType(Loc), endLocationForType(Loc), Loc);
} else if (const auto *VarRef =
diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp b/clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp
index 70d4d7cfdff3..e000eae999bd 100644
--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp
+++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp
@@ -215,7 +215,8 @@ void FindAllSymbols::registerMatchers(MatchFinder *MatchFinder) {
// Uses of most types: just look at what the typeLoc refers to.
MatchFinder->addMatcher(
typeLoc(isExpansionInMainFile(),
- loc(qualType(hasDeclaration(Types.bind("use"))))),
+ loc(qualType(allOf(unless(elaboratedType()),
+ hasDeclaration(Types.bind("use")))))),
this);
// Uses of typedefs: these are often transparent to hasDeclaration, so we need
// to handle them explicitly.
diff --git a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
index 4c537afd3347..e88b1846ef60 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
@@ -87,9 +87,9 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
const auto ConstantExpr = ignoringParenImpCasts(
anyOf(integerLiteral(), unaryOperator(hasUnaryOperand(IntegerExpr)),
binaryOperator(hasLHS(IntegerExpr), hasRHS(IntegerExpr))));
- const auto IntegerCallExpr = ignoringParenImpCasts(
- callExpr(anyOf(hasType(isInteger()), hasType(enumType())),
- unless(isInTemplateInstantiation())));
+ const auto IntegerCallExpr = ignoringParenImpCasts(callExpr(
+ anyOf(hasType(isInteger()), hasType(hasCanonicalType(enumType()))),
+ unless(isInTemplateInstantiation())));
const auto SizeOfExpr = sizeOfExpr(hasArgumentOfType(
hasUnqualifiedDesugaredType(type().bind("sizeof-arg-type"))));
const auto SizeOfZero =
@@ -147,8 +147,8 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
const auto StructAddrOfExpr = unaryOperator(
hasOperatorName("&"), hasUnaryOperand(ignoringParenImpCasts(
hasType(hasCanonicalType(recordType())))));
- const auto PointerToStructType =
- hasUnqualifiedDesugaredType(pointerType(pointee(recordType())));
+ const auto PointerToStructType = hasUnqualifiedDesugaredType(
+ pointerType(pointee(hasCanonicalType(recordType()))));
const auto PointerToStructExpr = ignoringParenImpCasts(expr(
hasType(hasCanonicalType(PointerToStructType)), unless(cxxThisExpr())));
diff --git a/clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp
index a706f6ce36b6..4b89f8291311 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp
@@ -67,10 +67,11 @@ void SmartPtrArrayMismatchCheck::registerMatchers(MatchFinder *Finder) {
auto FindConstructExpr =
cxxConstructExpr(
hasDeclaration(FindConstructor), argumentCountIs(1),
- hasArgument(
- 0, cxxNewExpr(isArray(), hasType(pointerType(pointee(
- equalsBoundNode(PointerTypeN)))))
- .bind(NewExprN)))
+ hasArgument(0,
+ cxxNewExpr(isArray(),
+ hasType(hasCanonicalType(pointerType(
+ pointee(equalsBoundNode(PointerTypeN))))))
+ .bind(NewExprN)))
.bind(ConstructExprN);
Finder->addMatcher(FindConstructExpr, this);
}
@@ -101,7 +102,7 @@ void SmartPtrArrayMismatchCheck::check(const MatchFinder::MatchResult &Result) {
SourceRange TemplateArgumentRange = TSTypeLoc.getArgLoc(0)
.getTypeSourceInfo()
->getTypeLoc()
- .getLocalSourceRange();
+ .getSourceRange();
D << TemplateArgumentRange;
if (isInSingleDeclStmt(VarOrField)) {
diff --git a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp b/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
index 82804a670959..f1514c868f85 100644
--- a/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
@@ -130,7 +130,12 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
// case of overloaded functions, so detection of redundant casts is trickier
// in this case. Don't emit "redundant cast" warnings for function
// pointer/reference types.
- if (SourceTypeAsWritten == DestTypeAsWritten) {
+ QualType Src = SourceTypeAsWritten, Dst = DestTypeAsWritten;
+ if (const auto *ElTy = dyn_cast<ElaboratedType>(Src))
+ Src = ElTy->getNamedType();
+ if (const auto *ElTy = dyn_cast<ElaboratedType>(Dst))
+ Dst = ElTy->getNamedType();
+ if (Src == Dst) {
diag(CastExpr->getBeginLoc(), "redundant cast to the same type")
<< FixItHint::CreateRemoval(ReplaceRange);
return;
diff --git a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
index 7feb0c73f4d1..8b99a1058079 100644
--- a/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
+++ b/clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
@@ -36,7 +36,8 @@ void MultiwayPathsCoveredCheck::registerMatchers(MatchFinder *Finder) {
// otherwise the matcher does not work correctly, because it
// will not explicitly ignore enum conditions.
unless(ignoringImpCasts(
- declRefExpr(hasType(enumType())).bind("enum-condition"))))))
+ declRefExpr(hasType(hasCanonicalType(enumType())))
+ .bind("enum-condition"))))))
.bind("switch"),
this);
diff --git a/clang-tools-extra/clang-tidy/misc/MisplacedConstCheck.cpp b/clang-tools-extra/clang-tidy/misc/MisplacedConstCheck.cpp
index 7a028df588ff..62df0884689f 100644
--- a/clang-tools-extra/clang-tidy/misc/MisplacedConstCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MisplacedConstCheck.cpp
@@ -21,12 +21,13 @@ void MisplacedConstCheck::registerMatchers(MatchFinder *Finder) {
pointee(anyOf(isConstQualified(), ignoringParens(functionType()))))));
Finder->addMatcher(
- valueDecl(
- hasType(isConstQualified()),
- hasType(typedefType(hasDeclaration(anyOf(
- typedefDecl(NonConstAndNonFunctionPointerType).bind("typedef"),
- typeAliasDecl(NonConstAndNonFunctionPointerType)
- .bind("typeAlias"))))))
+ valueDecl(hasType(qualType(
+ isConstQualified(),
+ elaboratedType(namesType(typedefType(hasDeclaration(
+ anyOf(typedefDecl(NonConstAndNonFunctionPointerType)
+ .bind("typedef"),
+ typeAliasDecl(NonConstAndNonFunctionPointerType)
+ .bind("typeAlias")))))))))
.bind("decl"),
this);
}
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
index accc95d126f8..679256839e43 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -400,7 +400,7 @@ static bool canBeModified(ASTContext *Context, const Expr *E) {
return true;
if (const auto *Cast = Parents[0].get<ImplicitCastExpr>()) {
if ((Cast->getCastKind() == CK_NoOp &&
- Cast->getType() == E->getType().withConst()) ||
+ Context->hasSameType(Cast->getType(), E->getType().withConst())) ||
(Cast->getCastKind() == CK_LValueToRValue &&
!Cast->getType().isNull() && Cast->getType()->isFundamentalType()))
return false;
diff --git a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
index cbfe528eaa7b..024a06bf3aa7 100644
--- a/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/PassByValueCheck.cpp
@@ -48,7 +48,8 @@ AST_MATCHER(CXXRecordDecl, isMoveConstructible) {
static TypeMatcher notTemplateSpecConstRefType() {
return lValueReferenceType(
- pointee(unless(templateSpecializationType()), isConstQualified()));
+ pointee(unless(elaboratedType(namesType(templateSpecializationType()))),
+ isConstQualified()));
}
static TypeMatcher nonConstValueType() {
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
index 0f10dd375a80..c3e3759af32f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -153,22 +153,24 @@ static bool isCopyAssignmentAndCanBeDefaulted(ASTContext *Context,
// ((Base*)this)->operator=((Base)Other);
//
// So we are looking for a member call that fulfills:
- if (match(traverse(TK_AsIs,
- compoundStmt(has(ignoringParenImpCasts(cxxMemberCallExpr(
- // - The object is an implicit cast of 'this' to a
- // pointer to
- // a base class.
- onImplicitObjectArgument(implicitCastExpr(
- hasImplicitDestinationType(
- pointsTo(type(equalsNode(Base)))),
- hasSourceExpression(cxxThisExpr()))),
- // - The called method is the operator=.
- callee(cxxMethodDecl(isCopyAssignmentOperator())),
- // - The argument is (an implicit cast to a Base of)
- // the argument taken by "Operator".
- argumentCountIs(1),
- hasArgument(0, declRefExpr(to(varDecl(
- equalsNode(Param)))))))))),
+ if (match(traverse(
+ TK_AsIs,
+ compoundStmt(has(ignoringParenImpCasts(cxxMemberCallExpr(
+ // - The object is an implicit cast of 'this' to a
+ // pointer to
+ // a base class.
+ onImplicitObjectArgument(implicitCastExpr(
+ hasImplicitDestinationType(hasCanonicalType(pointsTo(
+ type(equalsNode(Base->getCanonicalTypeInternal()
+ .getTypePtr()))))),
+ hasSourceExpression(cxxThisExpr()))),
+ // - The called method is the operator=.
+ callee(cxxMethodDecl(isCopyAssignmentOperator())),
+ // - The argument is (an implicit cast to a Base of)
+ // the argument taken by "Operator".
+ argumentCountIs(1),
+ hasArgument(
+ 0, declRefExpr(to(varDecl(equalsNode(Param)))))))))),
*Compound, *Context)
.empty())
return false;
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
index 8d6322563f79..a3908514d615 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
@@ -97,7 +97,9 @@ public:
if (TL.getQualifierLoc() &&
!TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()))
return false;
- return TraverseTypeLoc(TL.getNamedTypeLoc(), true);
+ const auto *T = TL.getTypePtr();
+ return TraverseTypeLoc(TL.getNamedTypeLoc(),
+ T->getKeyword() != ETK_None || T->getQualifier());
}
bool VisitDeclRefExpr(DeclRefExpr *S) {
diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp
index 408591589051..020f83b1a8fb 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -950,7 +950,10 @@ public:
// ElaboratedTypeLoc will reports information for its inner type loc.
// Otherwise we loose information about inner types loc's qualifier.
TypeLoc Inner = L.getNamedTypeLoc().getUnqualifiedLoc();
- TypeLocsToSkip.insert(Inner.getBeginLoc());
+ if (L.getBeginLoc() == Inner.getBeginLoc())
+ return RecursiveASTVisitor::TraverseTypeLoc(Inner);
+ else
+ TypeLocsToSkip.insert(Inner.getBeginLoc());
return RecursiveASTVisitor::TraverseElaboratedTypeLoc(L);
}
diff --git a/clang-tools-extra/clangd/unittests/ASTTests.cpp b/clang-tools-extra/clangd/unittests/ASTTests.cpp
index 69285d019117..4bb3e025b87a 100644
--- a/clang-tools-extra/clangd/unittests/ASTTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ASTTests.cpp
@@ -72,7 +72,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
template<typename T> class Foo {};
^auto v = Foo<X>();
)cpp",
- "Foo<class X>",
+ "Foo<X>",
},
{
R"cpp( // auto on initializer list.
@@ -93,7 +93,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return Foo();
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // decltype in trailing return type
@@ -102,7 +102,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return Foo();
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // auto in function return type
@@ -111,7 +111,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return Foo();
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // auto& in function return type
@@ -121,7 +121,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return x;
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // auto* in function return type
@@ -131,7 +131,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return x;
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // const auto& in function return type
@@ -141,7 +141,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return x;
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // decltype(auto) in function return (value)
@@ -150,7 +150,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return Foo();
}
)cpp",
- "struct Foo",
+ "Foo",
},
{
R"cpp( // decltype(auto) in function return (ref)
@@ -160,7 +160,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return (x);
}
)cpp",
- "struct Foo &",
+ "Foo &",
},
{
R"cpp( // decltype(auto) in function return (const ref)
@@ -170,7 +170,7 @@ TEST(GetDeducedType, KwAutoKwDecltypeExpansion) {
return (x);
}
)cpp",
- "const struct Foo &",
+ "const Foo &",
},
{
R"cpp( // auto on alias
diff --git a/clang-tools-extra/clangd/unittests/DumpASTTests.cpp b/clang-tools-extra/clangd/unittests/DumpASTTests.cpp
index e7b368fd2552..d1b8f21b82c6 100644
--- a/clang-tools-extra/clangd/unittests/DumpASTTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DumpASTTests.cpp
@@ -121,7 +121,8 @@ declaration: Var - root
expression: DeclRef - operator+
expression: MaterializeTemporary - lvalue
expression: CXXTemporaryObject - Foo
- type: Record - Foo
+ type: Elaborated
+ type: Record - Foo
expression: IntegerLiteral - 42
)"},
{R"cpp(
diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
index 51eae572ed90..6656ed984723 100644
--- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp
@@ -1612,13 +1612,14 @@ TEST_F(FindExplicitReferencesTest, All) {
{
R"cpp(
void foo() {
- class {} $0^x;
- int (*$1^fptr)(int $2^a, int) = nullptr;
+ $0^class {} $1^x;
+ int (*$2^fptr)(int $3^a, int) = nullptr;
}
)cpp",
- "0: targets = {x}, decl\n"
- "1: targets = {fptr}, decl\n"
- "2: targets = {a}, decl\n"},
+ "0: targets = {}\n"
+ "1: targets = {x}, decl\n"
+ "2: targets = {fptr}, decl\n"
+ "3: targets = {a}, decl\n"},
// Namespace aliases should be handled properly.
{
R"cpp(
diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp
index 949ddbae58b3..53e4f55c2e3a 100644
--- a/clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -427,7 +427,7 @@ class Foo final {})cpp";
[](HoverInfo &HI) {
HI.Name = "auto";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct S";
+ HI.Definition = "S";
}},
// undeduced auto
{R"cpp(
@@ -550,7 +550,7 @@ class Foo final {})cpp";
HI.NamespaceScope = "";
HI.Definition = "Color x = RED";
HI.Kind = index::SymbolKind::Variable;
- HI.Type = "enum Color";
+ HI.Type = "Color";
HI.Value = "RED (0xffffff85)"; // Symbolic on an expression.
}},
{R"cpp(
@@ -795,7 +795,7 @@ class Foo final {})cpp";
HI.Kind = index::SymbolKind::Variable;
HI.NamespaceScope = "";
HI.Definition = "X x";
- HI.Type = "struct X";
+ HI.Type = "X";
}},
{// Don't crash on null types.
R"cpp(auto [^[[x]]] = 1; /*error-ok*/)cpp",
@@ -1944,7 +1944,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "auto";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "auto function return with trailing type";
}},
{
@@ -1957,7 +1957,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "decltype";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "trailing return type";
}},
{
@@ -1970,7 +1970,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "auto";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "auto in function return";
}},
{
@@ -1984,7 +1984,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "auto";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "auto& in function return";
}},
{
@@ -1998,7 +1998,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "auto";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "auto* in function return";
}},
{
@@ -2012,7 +2012,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "auto";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "const auto& in function return";
}},
{
@@ -2025,7 +2025,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "decltype";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation = "decltype(auto) in function return";
}},
{
@@ -2115,7 +2115,7 @@ TEST(Hover, All) {
[](HoverInfo &HI) {
HI.Name = "decltype";
HI.Kind = index::SymbolKind::TypeAlias;
- HI.Definition = "struct Bar";
+ HI.Definition = "Bar";
HI.Documentation =
"decltype of function with trailing return type.";
}},
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/copy-constructor-init.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/copy-constructor-init.cpp
index 981d0b5af742..b42d3fcd2b62 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/copy-constructor-init.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/copy-constructor-init.cpp
@@ -144,7 +144,6 @@ class X11 : public Copyable5<int, float> {
class X12 : public CopyableAlias<float> {
X12(const X12 &other) {}
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
- // CHECK-FIXES: X12(const X12 &other) {}
};
template <typename T>
@@ -166,7 +165,7 @@ FROMMACRO
class X15 : public CopyableAlias2 {
X15(const X15 &other) {}
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
- // CHECK-FIXES: X15(const X15 &other) {}
+ // CHECK-FIXES: X15(const X15 &other) : Copyable5(other) {}
};
class X16 : public NonCopyable {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/shared-ptr-array-mismatch.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/shared-ptr-array-mismatch.cpp
index a232b854530c..70449e6bfc24 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/shared-ptr-array-mismatch.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/shared-ptr-array-mismatch.cpp
@@ -72,6 +72,8 @@ std::shared_ptr<int> f_ret() {
template <class T>
void f_tmpl() {
std::shared_ptr<T> P1{new T[10]};
+ // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: shared pointer to non-array is initialized with array [bugprone-shared-ptr-array-mismatch]
+ // CHECK-FIXES: std::shared_ptr<T[]> P1{new T[10]};
}
void f5() {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison-32bits.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison-32bits.cpp
index 1b70f79518dc..ebf96eebfb10 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison-32bits.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison-32bits.cpp
@@ -28,6 +28,6 @@ struct S {
void test() {
S a, b;
std::memcmp(&a, &b, sizeof(S));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'inner_padding::S' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'S' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace inner_padding
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison.cpp
index f4406b222eeb..cef9a1c595d7 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-memory-comparison.cpp
@@ -16,7 +16,7 @@ public:
void f(C &c1, C &c2) {
if (!std::memcmp(&c1, &c2, sizeof(C))) {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: comparing object representation of non-standard-layout type 'sei_cert_example_oop57_cpp::C'; consider using a comparison operator instead
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: comparing object representation of non-standard-layout type 'C'; consider using a comparison operator instead
}
}
} // namespace sei_cert_example_oop57_cpp
@@ -30,7 +30,7 @@ struct S {
void test() {
S a, b;
std::memcmp(&a, &b, sizeof(S));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'inner_padding_64bit_only::S' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'S' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace inner_padding_64bit_only
@@ -47,17 +47,17 @@ class Derived2 : public Derived {};
void testDerived() {
Derived a, b;
std::memcmp(&a, &b, sizeof(Base));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'padding_in_base::Derived' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'Derived' which does not have a unique object representation; consider comparing the members of the object manually
std::memcmp(&a, &b, sizeof(Derived));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'padding_in_base::Derived' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'Derived' which does not have a unique object representation; consider comparing the members of the object manually
}
void testDerived2() {
Derived2 a, b;
std::memcmp(&a, &b, sizeof(Base));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'padding_in_base::Derived2' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'Derived2' which does not have a unique object representation; consider comparing the members of the object manually
std::memcmp(&a, &b, sizeof(Derived2));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'padding_in_base::Derived2' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'Derived2' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace padding_in_base
@@ -97,7 +97,7 @@ public:
void test() {
C a, b;
std::memcmp(&a, &b, sizeof(C));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of non-standard-layout type 'non_standard_layout::C'; consider using a comparison operator instead
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of non-standard-layout type 'C'; consider using a comparison operator instead
}
} // namespace non_standard_layout
@@ -131,7 +131,7 @@ struct S {};
void test() {
S a, b;
std::memcmp(&a, &b, sizeof(S));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'empty_struct::S' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'S' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace empty_struct
@@ -144,7 +144,7 @@ struct S {
void test() {
S a, b;
std::memcmp(&a, &b, sizeof(S));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'empty_field::S' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'S' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace empty_field
@@ -173,7 +173,7 @@ struct S {
void test() {
S a, b;
std::memcmp(&a, &b, sizeof(S));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'no_unique_address_attribute::multiple_empties_same_type::S' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'S' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace multiple_empties_same_type
@@ -203,7 +203,7 @@ struct S {
void test() {
S a, b;
std::memcmp(&a, &b, sizeof(S));
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'alignment::S' which does not have a unique object representation; consider comparing the members of the object manually
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: comparing object representation of type 'S' which does not have a unique object representation; consider comparing the members of the object manually
}
} // namespace alignment
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp
index a8642746145b..4b59cafb9f66 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp
@@ -76,7 +76,7 @@ class Clazz {
};
const Strukt p6() {}
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Clazz::Strukt' i
+ // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Strukt' i
// CHECK-FIXES: Strukt p6() {}
// No warning is emitted here, because this is only the declaration. The
@@ -90,7 +90,7 @@ class Clazz {
// CHECK-FIXES: static int p8() {}
static const Strukt p9() {}
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Clazz::Strukt' i
+ // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Strukt' i
// CHECK-FIXES: static Strukt p9() {}
int n0() const { return 0; }
diff --git a/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp b/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp
index a8fbf3b7fe25..4a6352cd5975 100644
--- a/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp
+++ b/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp
@@ -2229,7 +2229,7 @@ TEST_F(ChangeNamespaceTest, InjectedClassNameInFriendDecl) {
"namespace e {\n"
"class D : public a::Base<D> {\n"
" private:\n"
- " friend class Base<D>;\n"
+ " friend class a::Base<D>;\n"
" void priv() {}\n"
" a::Base b;\n"
"};\n"