[clang] Implement ElaboratedType sugaring for types written bare

Without this patch, clang will not wrap in an ElaboratedType node types written
without a keyword and nested name qualifier, which goes against the intent that
we should produce an AST which retains enough details to recover how things are
written.

The lack of this sugar is incompatible with the intent of the type printer
default policy, which is to print types as written, but to fall back and print
them fully qualified when they are desugared.

An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still
requires pointer alignment due to pre-existing bug in the TypeLoc buffer
handling.

---

Troubleshooting list to deal with any breakage seen with this patch:

1) The most likely effect one would see by this patch is a change in how
   a type is printed. The type printer will, by design and default,
   print types as written. There are customization options there, but
   not that many, and they mainly apply to how to print a type that we
   somehow failed to track how it was written. This patch fixes a
   problem where we failed to distinguish between a type
   that was written without any elaborated-type qualifiers,
   such as a 'struct'/'class' tags and name spacifiers such as 'std::',
   and one that has been stripped of any 'metadata' that identifies such,
   the so called canonical types.
   Example:
   ```
   namespace foo {
     struct A {};
     A a;
   };
   ```
   If one were to print the type of `foo::a`, prior to this patch, this
   would result in `foo::A`. This is how the type printer would have,
   by default, printed the canonical type of A as well.
   As soon as you add any name qualifiers to A, the type printer would
   suddenly start accurately printing the type as written. This patch
   will make it print it accurately even when written without
   qualifiers, so we will just print `A` for the initial example, as
   the user did not really write that `foo::` namespace qualifier.

2) This patch could expose a bug in some AST matcher. Matching types
   is harder to get right when there is sugar involved. For example,
   if you want to match a type against being a pointer to some type A,
   then you have to account for getting a type that is sugar for a
   pointer to A, or being a pointer to sugar to A, or both! Usually
   you would get the second part wrong, and this would work for a
   very simple test where you don't use any name qualifiers, but
   you would discover is broken when you do. The usual fix is to
   either use the matcher which strips sugar, which is annoying
   to use as for example if you match an N level pointer, you have
   to put N+1 such matchers in there, beginning to end and between
   all those levels. But in a lot of cases, if the property you want
   to match is present in the canonical type, it's easier and faster
   to just match on that... This goes with what is said in 1), if
   you want to match against the name of a type, and you want
   the name string to be something stable, perhaps matching on
   the name of the canonical type is the better choice.

3) This patch could expose a bug in how you get the source range of some
   TypeLoc. For some reason, a lot of code is using getLocalSourceRange(),
   which only looks at the given TypeLoc node. This patch introduces a new,
   and more common TypeLoc node which contains no source locations on itself.
   This is not an inovation here, and some other, more rare TypeLoc nodes could
   also have this property, but if you use getLocalSourceRange on them, it's not
   going to return any valid locations, because it doesn't have any. The right fix
   here is to always use getSourceRange() or getBeginLoc/getEndLoc which will dive
   into the inner TypeLoc to get the source range if it doesn't find it on the
   top level one. You can use getLocalSourceRange if you are really into
   micro-optimizations and you have some outside knowledge that the TypeLocs you are
   dealing with will always include some source location.

4) Exposed a bug somewhere in the use of the normal clang type class API, where you
   have some type, you want to see if that type is some particular kind, you try a
   `dyn_cast` such as `dyn_cast<TypedefType>` and that fails because now you have an
   ElaboratedType which has a TypeDefType inside of it, which is what you wanted to match.
   Again, like 2), this would usually have been tested poorly with some simple tests with
   no qualifications, and would have been broken had there been any other kind of type sugar,
   be it an ElaboratedType or a TemplateSpecializationType or a SubstTemplateParmType.
   The usual fix here is to use `getAs` instead of `dyn_cast`, which will look deeper
   into the type. Or use `getAsAdjusted` when dealing with TypeLocs.
   For some reason the API is inconsistent there and on TypeLocs getAs behaves like a dyn_cast.

5) It could be a bug in this patch perhaps.

Let me know if you need any help!

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D112374
This commit is contained in:
Matheus Izvekov 2021-10-11 18:15:36 +02:00
parent 7b70c2e75c
commit 15f3cd6bfc
No known key found for this signature in database
GPG Key ID: 22C080C6DC4E70F8
298 changed files with 2386 additions and 2192 deletions

View File

@ -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 =

View File

@ -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.

View File

@ -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())));

View File

@ -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)) {

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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() {

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}

View File

@ -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

View File

@ -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(

View File

@ -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(

View File

@ -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.";
}},

View File

@ -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 {

View File

@ -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() {

View File

@ -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

View File

@ -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

View File

@ -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; }

View File

@ -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"

View File

@ -58,7 +58,7 @@ class TestType(unittest.TestCase):
self.assertIsNotNone(fields[1].translation_unit)
self.assertEqual(fields[1].spelling, 'b')
self.assertFalse(fields[1].type.is_const_qualified())
self.assertEqual(fields[1].type.kind, TypeKind.TYPEDEF)
self.assertEqual(fields[1].type.kind, TypeKind.ELABORATED)
self.assertEqual(fields[1].type.get_canonical().kind, TypeKind.INT)
self.assertEqual(fields[1].type.get_declaration().spelling, 'I')
self.assertEqual(fields[1].type.get_typedef_name(), 'I')

View File

@ -2820,14 +2820,20 @@ public:
bool typesAreBlockPointerCompatible(QualType, QualType);
bool isObjCIdType(QualType T) const {
if (const auto *ET = dyn_cast<ElaboratedType>(T))
T = ET->getNamedType();
return T == getObjCIdType();
}
bool isObjCClassType(QualType T) const {
if (const auto *ET = dyn_cast<ElaboratedType>(T))
T = ET->getNamedType();
return T == getObjCClassType();
}
bool isObjCSelType(QualType T) const {
if (const auto *ET = dyn_cast<ElaboratedType>(T))
T = ET->getNamedType();
return T == getObjCSelType();
}

View File

@ -5569,9 +5569,6 @@ class ElaboratedType final
ElaboratedTypeBits.HasOwnedTagDecl = true;
*getTrailingObjects<TagDecl *>() = OwnedTagDecl;
}
assert(!(Keyword == ETK_None && NNS == nullptr) &&
"ElaboratedType cannot have elaborated type keyword "
"and name qualifier both null.");
}
public:

View File

@ -430,7 +430,7 @@ protected:
unsigned size = sizeof(LocalData);
unsigned extraAlign = asDerived()->getExtraLocalDataAlignment();
size = llvm::alignTo(size, extraAlign);
return reinterpret_cast<char*>(Base::Data) + size;
return reinterpret_cast<char *>(Base::Data) + size;
}
void *getNonLocalData() const {
@ -2263,22 +2263,31 @@ class ElaboratedTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
ElaboratedLocInfo> {
public:
SourceLocation getElaboratedKeywordLoc() const {
return this->getLocalData()->ElaboratedKWLoc;
return !isEmpty() ? getLocalData()->ElaboratedKWLoc : SourceLocation();
}
void setElaboratedKeywordLoc(SourceLocation Loc) {
this->getLocalData()->ElaboratedKWLoc = Loc;
if (isEmpty()) {
assert(Loc.isInvalid());
return;
}
getLocalData()->ElaboratedKWLoc = Loc;
}
NestedNameSpecifierLoc getQualifierLoc() const {
return NestedNameSpecifierLoc(getTypePtr()->getQualifier(),
getLocalData()->QualifierData);
return !isEmpty() ? NestedNameSpecifierLoc(getTypePtr()->getQualifier(),
getLocalData()->QualifierData)
: NestedNameSpecifierLoc();
}
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc) {
assert(QualifierLoc.getNestedNameSpecifier()
== getTypePtr()->getQualifier() &&
assert(QualifierLoc.getNestedNameSpecifier() ==
getTypePtr()->getQualifier() &&
"Inconsistent nested-name-specifier pointer");
if (isEmpty()) {
assert(!QualifierLoc.hasQualifier());
return;
}
getLocalData()->QualifierData = QualifierLoc.getOpaqueData();
}
@ -2295,12 +2304,24 @@ public:
void initializeLocal(ASTContext &Context, SourceLocation Loc);
TypeLoc getNamedTypeLoc() const {
return getInnerTypeLoc();
TypeLoc getNamedTypeLoc() const { return getInnerTypeLoc(); }
QualType getInnerType() const { return getTypePtr()->getNamedType(); }
bool isEmpty() const {
return getTypePtr()->getKeyword() == ElaboratedTypeKeyword::ETK_None &&
!getTypePtr()->getQualifier();
}
QualType getInnerType() const {
return getTypePtr()->getNamedType();
unsigned getLocalDataAlignment() const {
// FIXME: We want to return 1 here in the empty case, but
// there are bugs in how alignment is handled in TypeLocs
// that prevent this from working.
return ConcreteTypeLoc::getLocalDataAlignment();
}
unsigned getLocalDataSize() const {
return !isEmpty() ? ConcreteTypeLoc::getLocalDataSize() : 0;
}
void copy(ElaboratedTypeLoc Loc) {

View File

@ -505,7 +505,7 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter,
if (LParenAdded)
PropertyString += ')';
QualType RT = Getter->getReturnType();
if (!isa<TypedefType>(RT)) {
if (!RT->getAs<TypedefType>()) {
// strip off any ARC lifetime qualifier.
QualType CanResultTy = Context.getCanonicalType(RT);
if (CanResultTy.getQualifiers().hasObjCLifetime()) {
@ -1053,7 +1053,7 @@ static bool TypeIsInnerPointer(QualType T) {
// Also, typedef-of-pointer-to-incomplete-struct is something that we assume
// is not an innter pointer type.
QualType OrigT = T;
while (const TypedefType *TD = dyn_cast<TypedefType>(T.getTypePtr()))
while (const auto *TD = T->getAs<TypedefType>())
T = TD->getDecl()->getUnderlyingType();
if (OrigT == T || !T->isPointerType())
return true;
@ -1356,9 +1356,6 @@ static bool IsVoidStarType(QualType Ty) {
if (!Ty->isPointerType())
return false;
while (const TypedefType *TD = dyn_cast<TypedefType>(Ty.getTypePtr()))
Ty = TD->getDecl()->getUnderlyingType();
// Is the type void*?
const PointerType* PT = Ty->castAs<PointerType>();
if (PT->getPointeeType().getUnqualifiedType()->isVoidType())

View File

@ -7816,7 +7816,7 @@ ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
/// 'l' or 'L' , but not always. For typedefs, we need to use
/// 'i' or 'I' instead if encoding a struct field, or a pointer!
void ASTContext::getLegacyIntegralTypeEncoding (QualType &PointeeTy) const {
if (isa<TypedefType>(PointeeTy.getTypePtr())) {
if (PointeeTy->getAs<TypedefType>()) {
if (const auto *BT = PointeeTy->getAs<BuiltinType>()) {
if (BT->getKind() == BuiltinType::ULong && getIntWidth(PointeeTy) == 32)
PointeeTy = UnsignedIntTy;
@ -8104,7 +8104,7 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string &S,
// pointee gets emitted _before_ the '^'. The read-only qualifier of
// the pointer itself gets ignored, _unless_ we are looking at a typedef!
// Also, do not emit the 'r' for anything but the outermost type!
if (isa<TypedefType>(T.getTypePtr())) {
if (T->getAs<TypedefType>()) {
if (Options.IsOutermostType() && T.isConstQualified()) {
isReadOnly = true;
S += 'r';

View File

@ -1684,9 +1684,24 @@ class TemplateDiff {
: FromType.getAsString(Policy);
std::string ToTypeStr = ToType.isNull() ? "(no argument)"
: ToType.getAsString(Policy);
// Switch to canonical typename if it is better.
// Print without ElaboratedType sugar if it is better.
// TODO: merge this with other aka printing above.
if (FromTypeStr == ToTypeStr) {
const auto *FromElTy = dyn_cast<ElaboratedType>(FromType),
*ToElTy = dyn_cast<ElaboratedType>(ToType);
if (FromElTy || ToElTy) {
std::string FromNamedTypeStr =
FromElTy ? FromElTy->getNamedType().getAsString(Policy)
: FromTypeStr;
std::string ToNamedTypeStr =
ToElTy ? ToElTy->getNamedType().getAsString(Policy) : ToTypeStr;
if (FromNamedTypeStr != ToNamedTypeStr) {
FromTypeStr = FromNamedTypeStr;
ToTypeStr = ToNamedTypeStr;
goto PrintTypes;
}
}
// Switch to canonical typename if it is better.
std::string FromCanTypeStr =
FromType.getCanonicalType().getAsString(Policy);
std::string ToCanTypeStr = ToType.getCanonicalType().getAsString(Policy);
@ -1696,6 +1711,7 @@ class TemplateDiff {
}
}
PrintTypes:
if (PrintTree) OS << '[';
OS << (FromDefault ? "(default) " : "");
Bold();

View File

@ -2566,7 +2566,7 @@ SourceLocation CXXCtorInitializer::getSourceLocation() const {
return getMemberLocation();
if (const auto *TSInfo = Initializee.get<TypeSourceInfo *>())
return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();
return TSInfo->getTypeLoc().getBeginLoc();
return {};
}

View File

@ -314,7 +314,7 @@ QualType CXXDeleteExpr::getDestroyedType() const {
// CXXPseudoDestructorExpr
PseudoDestructorTypeStorage::PseudoDestructorTypeStorage(TypeSourceInfo *Info)
: Type(Info) {
Location = Info->getTypeLoc().getLocalSourceRange().getBegin();
Location = Info->getTypeLoc().getBeginLoc();
}
CXXPseudoDestructorExpr::CXXPseudoDestructorExpr(
@ -341,7 +341,7 @@ QualType CXXPseudoDestructorExpr::getDestroyedType() const {
SourceLocation CXXPseudoDestructorExpr::getEndLoc() const {
SourceLocation End = DestroyedType.getLocation();
if (TypeSourceInfo *TInfo = DestroyedType.getTypeSourceInfo())
End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
End = TInfo->getTypeLoc().getSourceRange().getEnd();
return End;
}

View File

@ -981,10 +981,9 @@ Optional<LengthModifier> FormatSpecifier::getCorrectedLengthModifier() const {
bool FormatSpecifier::namedTypeToLengthModifier(QualType QT,
LengthModifier &LM) {
assert(isa<TypedefType>(QT) && "Expected a TypedefType");
const TypedefNameDecl *Typedef = cast<TypedefType>(QT)->getDecl();
for (;;) {
for (/**/; const auto *TT = QT->getAs<TypedefType>();
QT = TT->getDecl()->getUnderlyingType()) {
const TypedefNameDecl *Typedef = TT->getDecl();
const IdentifierInfo *Identifier = Typedef->getIdentifier();
if (Identifier->getName() == "size_t") {
LM.setKind(LengthModifier::AsSizeT);
@ -1003,12 +1002,6 @@ bool FormatSpecifier::namedTypeToLengthModifier(QualType QT,
LM.setKind(LengthModifier::AsPtrDiff);
return true;
}
QualType T = Typedef->getUnderlyingType();
if (!isa<TypedefType>(T))
break;
Typedef = cast<TypedefType>(T)->getDecl();
}
return false;
}

View File

@ -844,7 +844,7 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
}
// Handle size_t, ptrdiff_t, etc. that have dedicated length modifiers in C99.
if (isa<TypedefType>(QT) && (LangOpt.C99 || LangOpt.CPlusPlus11))
if (LangOpt.C99 || LangOpt.CPlusPlus11)
namedTypeToLengthModifier(QT, LM);
// If fixing the length modifier was enough, we might be done.
@ -874,7 +874,7 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
// Set conversion specifier and disable any flags which do not apply to it.
// Let typedefs to char fall through to int, as %c is silly for uint8_t.
if (!isa<TypedefType>(QT) && QT->isCharType()) {
if (!QT->getAs<TypedefType>() && QT->isCharType()) {
CS.setKind(ConversionSpecifier::cArg);
LM.setKind(LengthModifier::None);
Precision.setHowSpecified(OptionalAmount::NotSpecified);
@ -885,12 +885,10 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt,
// Test for Floating type first as LongDouble can pass isUnsignedIntegerType
else if (QT->isRealFloatingType()) {
CS.setKind(ConversionSpecifier::fArg);
}
else if (QT->isSignedIntegerType()) {
} else if (QT->isSignedIntegerType()) {
CS.setKind(ConversionSpecifier::dArg);
HasAlternativeForm = false;
}
else if (QT->isUnsignedIntegerType()) {
} else if (QT->isUnsignedIntegerType()) {
CS.setKind(ConversionSpecifier::uArg);
HasAlternativeForm = false;
HasPlusPrefix = false;

View File

@ -422,13 +422,6 @@ QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
return QT;
}
// We don't consider the alias introduced by `using a::X` as a new type.
// The qualified name is still a::X.
if (isa<UsingType>(QT.getTypePtr())) {
return getFullyQualifiedType(QT.getSingleStepDesugaredType(Ctx), Ctx,
WithGlobalNsPrefix);
}
// Remove the part of the type related to the type being a template
// parameter (we won't report it as part of the 'type name' and it
// is actually make the code below to be more complex (to handle
@ -455,6 +448,14 @@ QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
assert(!QT.hasLocalQualifiers());
Keyword = ETypeInput->getKeyword();
}
// We don't consider the alias introduced by `using a::X` as a new type.
// The qualified name is still a::X.
if (const auto *UT = QT->getAs<UsingType>()) {
return getFullyQualifiedType(UT->getUnderlyingType(), Ctx,
WithGlobalNsPrefix);
}
// Create a nested name specifier if needed.
Prefix = createNestedNameSpecifierForScopeOf(Ctx, QT.getTypePtr(),
true /*FullyQualified*/,

View File

@ -500,7 +500,7 @@ bool ScanfSpecifier::fixType(QualType QT, QualType RawQT,
}
// Handle size_t, ptrdiff_t, etc. that have dedicated length modifiers in C99.
if (isa<TypedefType>(PT) && (LangOpt.C99 || LangOpt.CPlusPlus11))
if (LangOpt.C99 || LangOpt.CPlusPlus11)
namedTypeToLengthModifier(PT, LM);
// If fixing the length modifier was enough, we are done.

View File

@ -4320,20 +4320,13 @@ bool Type::isObjCARCImplicitlyUnretainedType() const {
}
bool Type::isObjCNSObjectType() const {
const Type *cur = this;
while (true) {
if (const auto *typedefType = dyn_cast<TypedefType>(cur))
return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
// Single-step desugar until we run out of sugar.
QualType next = cur->getLocallyUnqualifiedSingleStepDesugaredType();
if (next.getTypePtr() == cur) return false;
cur = next.getTypePtr();
}
if (const auto *typedefType = getAs<TypedefType>())
return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>();
return false;
}
bool Type::isObjCIndependentClassType() const {
if (const auto *typedefType = dyn_cast<TypedefType>(this))
if (const auto *typedefType = getAs<TypedefType>())
return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>();
return false;
}

View File

@ -194,8 +194,14 @@ SourceLocation TypeLoc::getBeginLoc() const {
while (true) {
switch (Cur.getTypeLocClass()) {
case Elaborated:
LeftMost = Cur;
break;
if (Cur.getLocalSourceRange().getBegin().isValid()) {
LeftMost = Cur;
break;
}
Cur = Cur.getNextTypeLoc();
if (Cur.isNull())
break;
continue;
case FunctionProto:
if (Cur.castAs<FunctionProtoTypeLoc>().getTypePtr()
->hasTrailingReturn()) {
@ -530,6 +536,8 @@ void UnaryTransformTypeLoc::initializeLocal(ASTContext &Context,
void ElaboratedTypeLoc::initializeLocal(ASTContext &Context,
SourceLocation Loc) {
if (isEmpty())
return;
setElaboratedKeywordLoc(Loc);
NestedNameSpecifierLocBuilder Builder;
Builder.MakeTrivial(Context, getTypePtr()->getQualifier(), Loc);

View File

@ -892,7 +892,7 @@ RetainSummaryManager::getRetEffectFromAnnotations(QualType RetTy,
/// has a typedef with a given name @c Name.
static bool hasTypedefNamed(QualType QT,
StringRef Name) {
while (auto *T = dyn_cast<TypedefType>(QT)) {
while (auto *T = QT->getAs<TypedefType>()) {
const auto &Context = T->getDecl()->getASTContext();
if (T->getDecl()->getIdentifier() == &Context.Idents.get(Name))
return true;

View File

@ -2860,7 +2860,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
// Set `align` attribute if any.
const auto *AVAttr = PVD->getAttr<AlignValueAttr>();
if (!AVAttr)
if (const auto *TOTy = dyn_cast<TypedefType>(OTy))
if (const auto *TOTy = OTy->getAs<TypedefType>())
AVAttr = TOTy->getDecl()->getAttr<AlignValueAttr>();
if (AVAttr && !SanOpts.has(SanitizerKind::Alignment)) {
// If alignment-assumption sanitizer is enabled, we do *not* add

View File

@ -255,7 +255,7 @@ public:
if (VD->getType()->isReferenceType()) {
if (const auto *TTy =
dyn_cast<TypedefType>(VD->getType().getNonReferenceType()))
VD->getType().getNonReferenceType()->getAs<TypedefType>())
AVAttr = TTy->getDecl()->getAttr<AlignValueAttr>();
} else {
// Assumptions for function parameters are emitted at the start of the
@ -271,8 +271,7 @@ public:
}
if (!AVAttr)
if (const auto *TTy =
dyn_cast<TypedefType>(E->getType()))
if (const auto *TTy = E->getType()->getAs<TypedefType>())
AVAttr = TTy->getDecl()->getAttr<AlignValueAttr>();
if (!AVAttr)

View File

@ -2214,7 +2214,6 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) {
case Type::ConstantMatrix:
case Type::Record:
case Type::Enum:
case Type::Elaborated:
case Type::Using:
case Type::TemplateSpecialization:
case Type::ObjCTypeParam:
@ -2224,6 +2223,10 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) {
case Type::BitInt:
llvm_unreachable("type class is never variably-modified!");
case Type::Elaborated:
type = cast<ElaboratedType>(ty)->getNamedType();
break;
case Type::Adjusted:
type = cast<AdjustedType>(ty)->getAdjustedType();
break;

View File

@ -1765,7 +1765,7 @@ void CodeGenModule::GenKernelArgMetadata(llvm::Function *Fn,
// Get image and pipe access qualifier:
if (ty->isImageType() || ty->isPipeType()) {
const Decl *PDecl = parm;
if (auto *TD = dyn_cast<TypedefType>(ty))
if (const auto *TD = ty->getAs<TypedefType>())
PDecl = TD->getDecl();
const OpenCLAccessAttr *A = PDecl->getAttr<OpenCLAccessAttr>();
if (A && A->isWriteOnly())

View File

@ -853,7 +853,7 @@ RewriteModernObjC::getIvarAccessString(ObjCIvarDecl *D) {
if (D->isBitField())
IvarT = GetGroupRecordTypeForObjCIvarBitfield(D);
if (!isa<TypedefType>(IvarT) && IvarT->isRecordType()) {
if (!IvarT->getAs<TypedefType>() && IvarT->isRecordType()) {
RecordDecl *RD = IvarT->castAs<RecordType>()->getDecl();
RD = RD->getDefinition();
if (RD && !RD->getDeclName().getAsIdentifierInfo()) {
@ -3629,7 +3629,7 @@ bool RewriteModernObjC::IsTagDefinedInsideClass(ObjCContainerDecl *IDecl,
/// It handles elaborated types, as well as enum types in the process.
bool RewriteModernObjC::RewriteObjCFieldDeclType(QualType &Type,
std::string &Result) {
if (isa<TypedefType>(Type)) {
if (Type->getAs<TypedefType>()) {
Result += "\t";
return false;
}
@ -3724,7 +3724,7 @@ void RewriteModernObjC::RewriteObjCFieldDecl(FieldDecl *fieldDecl,
void RewriteModernObjC::RewriteLocallyDefinedNamedAggregates(FieldDecl *fieldDecl,
std::string &Result) {
QualType Type = fieldDecl->getType();
if (isa<TypedefType>(Type))
if (Type->getAs<TypedefType>())
return;
if (Type->isArrayType())
Type = Context->getBaseElementType(Type);
@ -7496,7 +7496,7 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
if (D->isBitField())
IvarT = GetGroupRecordTypeForObjCIvarBitfield(D);
if (!isa<TypedefType>(IvarT) && IvarT->isRecordType()) {
if (!IvarT->getAs<TypedefType>() && IvarT->isRecordType()) {
RecordDecl *RD = IvarT->castAs<RecordType>()->getDecl();
RD = RD->getDefinition();
if (RD && !RD->getDeclName().getAsIdentifierInfo()) {

View File

@ -10236,7 +10236,7 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
// We extract the name from the typedef because we don't want to show
// the underlying type in the diagnostic.
StringRef Name;
if (const TypedefType *TypedefTy = dyn_cast<TypedefType>(ExprTy))
if (const auto *TypedefTy = ExprTy->getAs<TypedefType>())
Name = TypedefTy->getDecl()->getName();
else
Name = CastTyName;
@ -15858,7 +15858,7 @@ static bool IsTailPaddedMemberArray(Sema &S, const llvm::APInt &Size,
while (TInfo) {
TypeLoc TL = TInfo->getTypeLoc();
// Look through typedefs.
if (TypedefTypeLoc TTL = TL.getAs<TypedefTypeLoc>()) {
if (TypedefTypeLoc TTL = TL.getAsAdjusted<TypedefTypeLoc>()) {
const TypedefNameDecl *TDL = TTL.getTypedefNameDecl();
TInfo = TDL->getTypeSourceInfo();
continue;

View File

@ -2783,7 +2783,7 @@ static void findTypeLocationForBlockDecl(const TypeSourceInfo *TSInfo,
while (true) {
// Look through typedefs.
if (!SuppressBlock) {
if (TypedefTypeLoc TypedefTL = TL.getAs<TypedefTypeLoc>()) {
if (TypedefTypeLoc TypedefTL = TL.getAsAdjusted<TypedefTypeLoc>()) {
if (TypeSourceInfo *InnerTSInfo =
TypedefTL.getTypedefNameDecl()->getTypeSourceInfo()) {
TL = InnerTSInfo->getTypeLoc().getUnqualifiedLoc();

View File

@ -275,6 +275,45 @@ static ParsedType recoverFromTypeInKnownDependentBase(Sema &S,
return S.CreateParsedType(T, Builder.getTypeSourceInfo(Context, T));
}
/// Build a ParsedType for a simple-type-specifier with a nested-name-specifier.
static ParsedType buildNamedType(Sema &S, const CXXScopeSpec *SS, QualType T,
SourceLocation NameLoc,
bool WantNontrivialTypeSourceInfo = true) {
switch (T->getTypeClass()) {
case Type::DeducedTemplateSpecialization:
case Type::Enum:
case Type::InjectedClassName:
case Type::Record:
case Type::Typedef:
case Type::UnresolvedUsing:
case Type::Using:
break;
// These can never be qualified so an ElaboratedType node
// would carry no additional meaning.
case Type::ObjCInterface:
case Type::ObjCTypeParam:
case Type::TemplateTypeParm:
return ParsedType::make(T);
default:
llvm_unreachable("Unexpected Type Class");
}
if (!SS || SS->isEmpty())
return ParsedType::make(
S.Context.getElaboratedType(ETK_None, nullptr, T, nullptr));
QualType ElTy = S.getElaboratedType(ETK_None, *SS, T);
if (!WantNontrivialTypeSourceInfo)
return ParsedType::make(ElTy);
TypeLocBuilder Builder;
Builder.pushTypeSpec(T).setNameLoc(NameLoc);
ElaboratedTypeLoc ElabTL = Builder.push<ElaboratedTypeLoc>(ElTy);
ElabTL.setElaboratedKeywordLoc(SourceLocation());
ElabTL.setQualifierLoc(SS->getWithLocInContext(S.Context));
return S.CreateParsedType(ElTy, Builder.getTypeSourceInfo(S.Context, ElTy));
}
/// If the identifier refers to a type name within this scope,
/// return the declaration of that type.
///
@ -500,8 +539,7 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,
} else if (auto *UD = dyn_cast<UnresolvedUsingIfExistsDecl>(IIDecl)) {
(void)DiagnoseUseOfDecl(UD, NameLoc);
// Recover with 'int'
T = Context.IntTy;
FoundUsingShadow = nullptr;
return ParsedType::make(Context.IntTy);
} else if (AllowDeducedTemplate) {
if (auto *TD = getAsTypeTemplateDecl(IIDecl)) {
assert(!FoundUsingShadow || FoundUsingShadow->getTargetDecl() == TD);
@ -523,27 +561,7 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,
if (FoundUsingShadow)
T = Context.getUsingType(FoundUsingShadow, T);
// NOTE: avoid constructing an ElaboratedType(Loc) if this is a
// constructor or destructor name (in such a case, the scope specifier
// will be attached to the enclosing Expr or Decl node).
if (SS && SS->isNotEmpty() && !IsCtorOrDtorName &&
!isa<ObjCInterfaceDecl, UnresolvedUsingIfExistsDecl>(IIDecl)) {
if (WantNontrivialTypeSourceInfo) {
// Construct a type with type-source information.
TypeLocBuilder Builder;
Builder.pushTypeSpec(T).setNameLoc(NameLoc);
T = getElaboratedType(ETK_None, *SS, T);
ElaboratedTypeLoc ElabTL = Builder.push<ElaboratedTypeLoc>(T);
ElabTL.setElaboratedKeywordLoc(SourceLocation());
ElabTL.setQualifierLoc(SS->getWithLocInContext(Context));
return CreateParsedType(T, Builder.getTypeSourceInfo(Context, T));
} else {
T = getElaboratedType(ETK_None, *SS, T);
}
}
return ParsedType::make(T);
return buildNamedType(*this, SS, T, NameLoc, WantNontrivialTypeSourceInfo);
}
// Builds a fake NNS for the given decl context.
@ -1147,17 +1165,7 @@ Corrected:
QualType T = Context.getTypeDeclType(Type);
if (const auto *USD = dyn_cast<UsingShadowDecl>(Found))
T = Context.getUsingType(USD, T);
if (SS.isEmpty()) // No elaborated type, trivial location info
return ParsedType::make(T);
TypeLocBuilder Builder;
Builder.pushTypeSpec(T).setNameLoc(NameLoc);
T = getElaboratedType(ETK_None, SS, T);
ElaboratedTypeLoc ElabTL = Builder.push<ElaboratedTypeLoc>(T);
ElabTL.setElaboratedKeywordLoc(SourceLocation());
ElabTL.setQualifierLoc(SS.getWithLocInContext(Context));
return CreateParsedType(T, Builder.getTypeSourceInfo(Context, T));
return buildNamedType(*this, &SS, T, NameLoc);
};
NamedDecl *FirstDecl = (*Result.begin())->getUnderlyingDecl();

View File

@ -4362,17 +4362,13 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
}
if (BaseType.isNull()) {
BaseType = Context.getTypeDeclType(TyD);
BaseType = getElaboratedType(ETK_None, SS, Context.getTypeDeclType(TyD));
MarkAnyDeclReferenced(TyD->getLocation(), TyD, /*OdrUse=*/false);
if (SS.isSet()) {
BaseType = Context.getElaboratedType(ETK_None, SS.getScopeRep(),
BaseType);
TInfo = Context.CreateTypeSourceInfo(BaseType);
ElaboratedTypeLoc TL = TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>();
TL.getNamedTypeLoc().castAs<TypeSpecTypeLoc>().setNameLoc(IdLoc);
TL.setElaboratedKeywordLoc(SourceLocation());
TL.setQualifierLoc(SS.getWithLocInContext(Context));
}
TInfo = Context.CreateTypeSourceInfo(BaseType);
ElaboratedTypeLoc TL = TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>();
TL.getNamedTypeLoc().castAs<TypeSpecTypeLoc>().setNameLoc(IdLoc);
TL.setElaboratedKeywordLoc(SourceLocation());
TL.setQualifierLoc(SS.getWithLocInContext(Context));
}
}
@ -4468,10 +4464,10 @@ Sema::BuildMemberInitializer(ValueDecl *Member, Expr *Init,
MemInitResult
Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init,
CXXRecordDecl *ClassDecl) {
SourceLocation NameLoc = TInfo->getTypeLoc().getLocalSourceRange().getBegin();
SourceLocation NameLoc = TInfo->getTypeLoc().getSourceRange().getBegin();
if (!LangOpts.CPlusPlus11)
return Diag(NameLoc, diag::err_delegating_ctor)
<< TInfo->getTypeLoc().getLocalSourceRange();
<< TInfo->getTypeLoc().getSourceRange();
Diag(NameLoc, diag::warn_cxx98_compat_delegating_ctor);
bool InitList = true;
@ -4532,12 +4528,11 @@ MemInitResult
Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
Expr *Init, CXXRecordDecl *ClassDecl,
SourceLocation EllipsisLoc) {
SourceLocation BaseLoc
= BaseTInfo->getTypeLoc().getLocalSourceRange().getBegin();
SourceLocation BaseLoc = BaseTInfo->getTypeLoc().getBeginLoc();
if (!BaseType->isDependentType() && !BaseType->isRecordType())
return Diag(BaseLoc, diag::err_base_init_does_not_name_class)
<< BaseType << BaseTInfo->getTypeLoc().getLocalSourceRange();
<< BaseType << BaseTInfo->getTypeLoc().getSourceRange();
// C++ [class.base.init]p2:
// [...] Unless the mem-initializer-id names a nonstatic data
@ -4595,8 +4590,8 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
Dependent = true;
else
return Diag(BaseLoc, diag::err_not_direct_base_or_virtual)
<< BaseType << Context.getTypeDeclType(ClassDecl)
<< BaseTInfo->getTypeLoc().getLocalSourceRange();
<< BaseType << Context.getTypeDeclType(ClassDecl)
<< BaseTInfo->getTypeLoc().getSourceRange();
}
}
@ -11044,7 +11039,7 @@ void Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
bool AcceptableReturnType = false;
bool MightInstantiateToSpecialization = false;
if (auto RetTST =
TSI->getTypeLoc().getAs<TemplateSpecializationTypeLoc>()) {
TSI->getTypeLoc().getAsAdjusted<TemplateSpecializationTypeLoc>()) {
TemplateName SpecifiedName = RetTST.getTypePtr()->getTemplateName();
bool TemplateMatches =
Context.hasSameTemplateName(SpecifiedName, GuidedTemplate);
@ -16650,7 +16645,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation LocStart,
assert(TSInfo && "NULL TypeSourceInfo for friend type declaration");
QualType T = TSInfo->getType();
SourceRange TypeRange = TSInfo->getTypeLoc().getLocalSourceRange();
SourceRange TypeRange = TSInfo->getTypeLoc().getSourceRange();
// C++03 [class.friend]p2:
// An elaborated-type-specifier shall be used in a friend declaration

View File

@ -4504,7 +4504,6 @@ static void captureVariablyModifiedType(ASTContext &Context, QualType T,
case Type::ConstantMatrix:
case Type::Record:
case Type::Enum:
case Type::Elaborated:
case Type::TemplateSpecialization:
case Type::ObjCObject:
case Type::ObjCInterface:
@ -4513,6 +4512,9 @@ static void captureVariablyModifiedType(ASTContext &Context, QualType T,
case Type::Pipe:
case Type::BitInt:
llvm_unreachable("type class is never variably-modified!");
case Type::Elaborated:
T = cast<ElaboratedType>(Ty)->getNamedType();
break;
case Type::Adjusted:
T = cast<AdjustedType>(Ty)->getOriginalType();
break;

View File

@ -241,7 +241,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc,
if (IsAcceptableResult(Type)) {
QualType T = Context.getTypeDeclType(Type);
MarkAnyDeclReferenced(Type->getLocation(), Type, /*OdrUse=*/false);
return CreateParsedType(T,
return CreateParsedType(Context.getElaboratedType(ETK_None, nullptr, T),
Context.getTrivialTypeSourceInfo(T, NameLoc));
}
}
@ -7713,8 +7713,8 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
// designated by the pseudo-destructor-name shall be the same type.
if (DestructedTypeInfo) {
QualType DestructedType = DestructedTypeInfo->getType();
SourceLocation DestructedTypeStart
= DestructedTypeInfo->getTypeLoc().getLocalSourceRange().getBegin();
SourceLocation DestructedTypeStart =
DestructedTypeInfo->getTypeLoc().getBeginLoc();
if (!DestructedType->isDependentType() && !ObjectType->isDependentType()) {
if (!Context.hasSameUnqualifiedType(DestructedType, ObjectType)) {
// Detect dot pseudo destructor calls on pointer objects, e.g.:
@ -7739,7 +7739,7 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
} else {
Diag(DestructedTypeStart, diag::err_pseudo_dtor_type_mismatch)
<< ObjectType << DestructedType << Base->getSourceRange()
<< DestructedTypeInfo->getTypeLoc().getLocalSourceRange();
<< DestructedTypeInfo->getTypeLoc().getSourceRange();
// Recover by setting the destructed type to the object type.
DestructedType = ObjectType;
@ -7755,8 +7755,8 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
// type.
} else {
Diag(DestructedTypeStart, diag::err_arc_pseudo_dtor_inconstant_quals)
<< ObjectType << DestructedType << Base->getSourceRange()
<< DestructedTypeInfo->getTypeLoc().getLocalSourceRange();
<< ObjectType << DestructedType << Base->getSourceRange()
<< DestructedTypeInfo->getTypeLoc().getSourceRange();
}
// Recover by setting the destructed type to the object type.
@ -7780,10 +7780,10 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
if (!ScopeType->isDependentType() && !ObjectType->isDependentType() &&
!Context.hasSameUnqualifiedType(ScopeType, ObjectType)) {
Diag(ScopeTypeInfo->getTypeLoc().getLocalSourceRange().getBegin(),
Diag(ScopeTypeInfo->getTypeLoc().getSourceRange().getBegin(),
diag::err_pseudo_dtor_type_mismatch)
<< ObjectType << ScopeType << Base->getSourceRange()
<< ScopeTypeInfo->getTypeLoc().getLocalSourceRange();
<< ObjectType << ScopeType << Base->getSourceRange()
<< ScopeTypeInfo->getTypeLoc().getSourceRange();
ScopeType = QualType();
ScopeTypeInfo = nullptr;

View File

@ -3860,7 +3860,7 @@ static inline T *getObjCBridgeAttr(const TypedefType *TD) {
static ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttrFromType(QualType T,
TypedefNameDecl *&TDNDecl) {
while (const TypedefType *TD = dyn_cast<TypedefType>(T.getTypePtr())) {
while (const auto *TD = T->getAs<TypedefType>()) {
TDNDecl = TD->getDecl();
if (ObjCBridgeRelatedAttr *ObjCBAttr =
getObjCBridgeAttr<ObjCBridgeRelatedAttr>(TD))
@ -4007,7 +4007,7 @@ static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr,
bool &HadTheAttribute, bool warn) {
QualType T = castExpr->getType();
HadTheAttribute = false;
while (const TypedefType *TD = dyn_cast<TypedefType>(T.getTypePtr())) {
while (const auto *TD = T->getAs<TypedefType>()) {
TypedefNameDecl *TDNDecl = TD->getDecl();
if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
@ -4070,7 +4070,7 @@ static bool CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr,
bool &HadTheAttribute, bool warn) {
QualType T = castType;
HadTheAttribute = false;
while (const TypedefType *TD = dyn_cast<TypedefType>(T.getTypePtr())) {
while (const auto *TD = T->getAs<TypedefType>()) {
TypedefNameDecl *TDNDecl = TD->getDecl();
if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {

View File

@ -4034,14 +4034,14 @@ TypeResult Sema::ActOnTemplateIdType(
return CreateParsedType(T, TLB.getTypeSourceInfo(Context, T));
}
QualType Result = CheckTemplateIdType(Template, TemplateIILoc, TemplateArgs);
if (Result.isNull())
QualType SpecTy = CheckTemplateIdType(Template, TemplateIILoc, TemplateArgs);
if (SpecTy.isNull())
return true;
// Build type-source information.
TypeLocBuilder TLB;
TemplateSpecializationTypeLoc SpecTL
= TLB.push<TemplateSpecializationTypeLoc>(Result);
TemplateSpecializationTypeLoc SpecTL =
TLB.push<TemplateSpecializationTypeLoc>(SpecTy);
SpecTL.setTemplateKeywordLoc(TemplateKWLoc);
SpecTL.setTemplateNameLoc(TemplateIILoc);
SpecTL.setLAngleLoc(LAngleLoc);
@ -4049,18 +4049,14 @@ TypeResult Sema::ActOnTemplateIdType(
for (unsigned i = 0, e = SpecTL.getNumArgs(); i != e; ++i)
SpecTL.setArgLocInfo(i, TemplateArgs[i].getLocInfo());
// NOTE: avoid constructing an ElaboratedTypeLoc if this is a
// constructor or destructor name (in such a case, the scope specifier
// will be attached to the enclosing Decl or Expr node).
if (SS.isNotEmpty() && !IsCtorOrDtorName) {
// Create an elaborated-type-specifier containing the nested-name-specifier.
Result = Context.getElaboratedType(ETK_None, SS.getScopeRep(), Result);
ElaboratedTypeLoc ElabTL = TLB.push<ElaboratedTypeLoc>(Result);
ElabTL.setElaboratedKeywordLoc(SourceLocation());
// Create an elaborated-type-specifier containing the nested-name-specifier.
QualType ElTy = getElaboratedType(
ETK_None, !IsCtorOrDtorName ? SS : CXXScopeSpec(), SpecTy);
ElaboratedTypeLoc ElabTL = TLB.push<ElaboratedTypeLoc>(ElTy);
ElabTL.setElaboratedKeywordLoc(SourceLocation());
if (!ElabTL.isEmpty())
ElabTL.setQualifierLoc(SS.getWithLocInContext(Context));
}
return CreateParsedType(Result, TLB.getTypeSourceInfo(Context, Result));
return CreateParsedType(ElTy, TLB.getTypeSourceInfo(Context, ElTy));
}
TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,

View File

@ -5538,7 +5538,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
// in ClsType; hence we wrap ClsType into an ElaboratedType.
// NOTE: in particular, no wrap occurs if ClsType already is an
// Elaborated, DependentName, or DependentTemplateSpecialization.
if (NNSPrefix && isa<TemplateSpecializationType>(NNS->getAsType()))
if (isa<TemplateSpecializationType>(NNS->getAsType()))
ClsType = Context.getElaboratedType(ETK_None, NNSPrefix, ClsType);
break;
}
@ -6090,19 +6090,19 @@ namespace {
}
}
void VisitElaboratedTypeLoc(ElaboratedTypeLoc TL) {
ElaboratedTypeKeyword Keyword
= TypeWithKeyword::getKeywordForTypeSpec(DS.getTypeSpecType());
if (DS.getTypeSpecType() == TST_typename) {
TypeSourceInfo *TInfo = nullptr;
Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
if (TInfo) {
TL.copy(TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>());
return;
}
if (TInfo)
if (auto ETL = TInfo->getTypeLoc().getAs<ElaboratedTypeLoc>()) {
TL.copy(ETL);
return;
}
}
TL.setElaboratedKeywordLoc(Keyword != ETK_None
? DS.getTypeSpecTypeLoc()
: SourceLocation());
const ElaboratedType *T = TL.getTypePtr();
TL.setElaboratedKeywordLoc(T->getKeyword() != ETK_None
? DS.getTypeSpecTypeLoc()
: SourceLocation());
const CXXScopeSpec& SS = DS.getTypeSpecScope();
TL.setQualifierLoc(SS.getWithLocInContext(Context));
Visit(TL.getNextTypeLoc().getUnqualifiedLoc());
@ -9100,15 +9100,8 @@ QualType Sema::getElaboratedType(ElaboratedTypeKeyword Keyword,
TagDecl *OwnedTagDecl) {
if (T.isNull())
return T;
NestedNameSpecifier *NNS;
if (SS.isValid())
NNS = SS.getScopeRep();
else {
if (Keyword == ETK_None)
return T;
NNS = nullptr;
}
return Context.getElaboratedType(Keyword, NNS, T, OwnedTagDecl);
return Context.getElaboratedType(
Keyword, SS.isValid() ? SS.getScopeRep() : nullptr, T, OwnedTagDecl);
}
QualType Sema::BuildTypeofExprType(Expr *E) {

View File

@ -1069,15 +1069,11 @@ public:
// Otherwise, make an elaborated type wrapping a non-dependent
// specialization.
QualType T =
getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
if (T.isNull()) return QualType();
if (Keyword == ETK_None && QualifierLoc.getNestedNameSpecifier() == nullptr)
return T;
return SemaRef.Context.getElaboratedType(Keyword,
QualifierLoc.getNestedNameSpecifier(),
T);
getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
if (T.isNull())
return QualType();
return SemaRef.Context.getElaboratedType(
Keyword, QualifierLoc.getNestedNameSpecifier(), T);
}
/// Build a new typename type that refers to an identifier.
@ -4196,7 +4192,7 @@ NestedNameSpecifierLoc TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
}
// If the nested-name-specifier is an invalid type def, don't emit an
// error because a previous error should have already been emitted.
TypedefTypeLoc TTL = TL.getAs<TypedefTypeLoc>();
TypedefTypeLoc TTL = TL.getAsAdjusted<TypedefTypeLoc>();
if (!TTL || !TTL.getTypedefNameDecl()->isInvalidDecl()) {
SemaRef.Diag(TL.getBeginLoc(), diag::err_nested_name_spec_non_tag)
<< TL.getType() << SS.getRange();

View File

@ -85,7 +85,7 @@ TypeLoc TypeLocBuilder::pushImpl(QualType T, size_t LocalSize, unsigned LocalAli
// FIXME: 4 and 8 are sufficient at the moment, but it's pretty ugly to
// hardcode them.
if (LocalAlignment == 4) {
if (NumBytesAtAlign8 == 0) {
if (!AtAlign8) {
NumBytesAtAlign4 += LocalSize;
} else {
unsigned Padding = NumBytesAtAlign4 % 8;
@ -114,7 +114,7 @@ TypeLoc TypeLocBuilder::pushImpl(QualType T, size_t LocalSize, unsigned LocalAli
NumBytesAtAlign4 += LocalSize;
}
} else if (LocalAlignment == 8) {
if (NumBytesAtAlign8 == 0) {
if (!AtAlign8) {
// We have not seen any 8-byte aligned element yet. We insert a padding
// only if the new Index is not 8-byte-aligned.
if ((Index - LocalSize) % 8 != 0) {
@ -149,7 +149,7 @@ TypeLoc TypeLocBuilder::pushImpl(QualType T, size_t LocalSize, unsigned LocalAli
// Forget about any padding.
NumBytesAtAlign4 = 0;
NumBytesAtAlign8 += LocalSize;
AtAlign8 = true;
} else {
assert(LocalSize == 0);
}

View File

@ -40,12 +40,13 @@ class TypeLocBuilder {
/// The inline buffer.
enum { BufferMaxAlignment = alignof(void *) };
alignas(BufferMaxAlignment) char InlineBuffer[InlineCapacity];
unsigned NumBytesAtAlign4, NumBytesAtAlign8;
unsigned NumBytesAtAlign4;
bool AtAlign8;
public:
TypeLocBuilder()
: Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity),
NumBytesAtAlign4(0), NumBytesAtAlign8(0) {}
NumBytesAtAlign4(0), AtAlign8(false) {}
~TypeLocBuilder() {
if (Buffer != InlineBuffer)
@ -77,7 +78,8 @@ public:
LastTy = QualType();
#endif
Index = Capacity;
NumBytesAtAlign4 = NumBytesAtAlign8 = 0;
NumBytesAtAlign4 = 0;
AtAlign8 = false;
}
/// Tell the TypeLocBuilder that the type it is storing has been

View File

@ -109,17 +109,20 @@ bool NonnullGlobalConstantsChecker::isGlobalConstString(SVal V) const {
// Look through the typedefs.
while (const Type *T = Ty.getTypePtr()) {
if (const auto *TT = dyn_cast<TypedefType>(T)) {
if (const auto *AT = dyn_cast<AttributedType>(T)) {
if (AT->getAttrKind() == attr::TypeNonNull)
return true;
Ty = AT->getModifiedType();
} else if (const auto *ET = dyn_cast<ElaboratedType>(T)) {
const auto *TT = dyn_cast<TypedefType>(ET->getNamedType());
if (!TT)
return false;
Ty = TT->getDecl()->getUnderlyingType();
// It is sufficient for any intermediate typedef
// to be classified const.
HasConst = HasConst || Ty.isConstQualified();
if (isNonnullType(Ty) && HasConst)
return true;
} else if (const auto *AT = dyn_cast<AttributedType>(T)) {
if (AT->getAttrKind() == attr::TypeNonNull)
return true;
Ty = AT->getModifiedType();
} else {
return false;
}
@ -136,7 +139,7 @@ bool NonnullGlobalConstantsChecker::isNonnullType(QualType Ty) const {
if (auto *T = dyn_cast<ObjCObjectPointerType>(Ty)) {
return T->getInterfaceDecl() &&
T->getInterfaceDecl()->getIdentifier() == NSStringII;
} else if (auto *T = dyn_cast<TypedefType>(Ty)) {
} else if (auto *T = Ty->getAs<TypedefType>()) {
IdentifierInfo* II = T->getDecl()->getIdentifier();
return II == CFStringRefII || II == CFBooleanRefII || II == CFNullRefII;
}

View File

@ -196,12 +196,10 @@ void NumberObjectConversionChecker::checkASTCodeBody(const Decl *D,
AnalysisManager &AM,
BugReporter &BR) const {
// Currently this matches CoreFoundation opaque pointer typedefs.
auto CSuspiciousNumberObjectExprM =
expr(ignoringParenImpCasts(
expr(hasType(
typedefType(hasDeclaration(anyOf(
typedefDecl(hasName("CFNumberRef")),
typedefDecl(hasName("CFBooleanRef")))))))
auto CSuspiciousNumberObjectExprM = expr(ignoringParenImpCasts(
expr(hasType(elaboratedType(namesType(typedefType(
hasDeclaration(anyOf(typedefDecl(hasName("CFNumberRef")),
typedefDecl(hasName("CFBooleanRef")))))))))
.bind("c_object")));
// Currently this matches XNU kernel number-object pointers.
@ -240,8 +238,9 @@ void NumberObjectConversionChecker::checkASTCodeBody(const Decl *D,
// The .bind here is in order to compose the error message more accurately.
auto ObjCSuspiciousScalarBooleanTypeM =
qualType(typedefType(hasDeclaration(
typedefDecl(hasName("BOOL"))))).bind("objc_bool_type");
qualType(elaboratedType(namesType(
typedefType(hasDeclaration(typedefDecl(hasName("BOOL")))))))
.bind("objc_bool_type");
// The .bind here is in order to compose the error message more accurately.
auto SuspiciousScalarBooleanTypeM =
@ -253,9 +252,9 @@ void NumberObjectConversionChecker::checkASTCodeBody(const Decl *D,
// for storing pointers.
auto SuspiciousScalarNumberTypeM =
qualType(hasCanonicalType(isInteger()),
unless(typedefType(hasDeclaration(
typedefDecl(matchesName("^::u?intptr_t$"))))))
.bind("int_type");
unless(elaboratedType(namesType(typedefType(hasDeclaration(
typedefDecl(matchesName("^::u?intptr_t$"))))))))
.bind("int_type");
auto SuspiciousScalarTypeM =
qualType(anyOf(SuspiciousScalarBooleanTypeM,

View File

@ -161,7 +161,7 @@ CaptureMethods(std::string TypeString, const clang::CXXRecordDecl *ASTClass,
optionally(
isDerivedFrom(cxxRecordDecl(hasName("clang::TypeLoc"))
.bind("typeLocBase"))))),
returns(asString(TypeString)))
returns(hasCanonicalType(asString(TypeString))))
.bind("classMethod")),
*ASTClass, *Result.Context);

View File

@ -30,23 +30,23 @@ union U1 {
void Test() {
constexpr S0 s0{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0':'const S0' constexpr listinit
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | `-field: Union .i Int 42
constexpr U0 u0a{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0a 'const U0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0a 'const U0':'const U0' constexpr listinit
// CHECK-NEXT: | |-value: Union None
constexpr U0 u0b{3.1415f};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0b 'const U0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0b 'const U0':'const U0' constexpr listinit
// CHECK-NEXT: | |-value: Union . Union .f Float 3.141500e+00
constexpr U1 u1a{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1a 'const U1' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1a 'const U1':'const U1' constexpr listinit
// CHECK-NEXT: | |-value: Union . Union .f Float 0.000000e+00
constexpr U1 u1b{3.1415f};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1b 'const U1' constexpr listinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1b 'const U1':'const U1' constexpr listinit
// CHECK-NEXT: |-value: Union . Union .f Float 3.141500e+00
}

View File

@ -60,12 +60,12 @@ struct S5 : S4 {
void Test() {
constexpr S0 s0{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s0 'const S0':'const S0' constexpr listinit
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | `-fields: Int 0, Union .j Int 0
constexpr S1 s1{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s1 'const S1' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s1 'const S1':'const S1' constexpr listinit
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | |-field: Int 0
// CHECK-NEXT: | | `-field: Union .s
@ -73,12 +73,12 @@ void Test() {
// CHECK-NEXT: | | `-field: Int 0
constexpr S2 s2{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s2 'const S2' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s2 'const S2':'const S2' constexpr listinit
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | `-fields: Int 0, Union .u Union .j Int 0
constexpr S3 s3{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s3 'const S3' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s3 'const S3':'const S3' constexpr listinit
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | |-field: Int 0
// CHECK-NEXT: | | `-field: Union .u
@ -87,7 +87,7 @@ void Test() {
// CHECK-NEXT: | | `-field: Int 0
constexpr S4 s4{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s4 'const S4' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s4 'const S4':'const S4' constexpr listinit
// CHECK-NEXT: | |-value: Struct
// CHECK-NEXT: | | |-base: Struct
// CHECK-NEXT: | | | `-fields: Int 0, Union .j Int 0
@ -96,7 +96,7 @@ void Test() {
// CHECK-NEXT: | | `-fields: Int 4, Int 5, Int 6
constexpr S5 s5{};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s5 'const S5' constexpr listinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} s5 'const S5':'const S5' constexpr listinit
// CHECK-NEXT: |-value: Struct
// CHECK-NEXT: | |-base: Struct
// CHECK-NEXT: | | |-base: Struct

View File

@ -39,25 +39,25 @@ union U3 {
void Test() {
constexpr U0 u0{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0 'const U0' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0 'const U0':'const U0' constexpr listinit
// CHECK-NEXT: | |-value: Union .i Int 42
constexpr U1 u1{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1 'const U1' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u1 'const U1':'const U1' constexpr listinit
// CHECK-NEXT: | |-value: Union .uinner Union .f Float 3.141500e+00
constexpr U2 u2{};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u2 'const U2' constexpr listinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u2 'const U2':'const U2' constexpr listinit
// CHECK-NEXT: | |-value: Union .uinner
// CHECK-NEXT: | | `-Union .arr
// CHECK-NEXT: | | `-Array size=2
// CHECK-NEXT: | | `-elements: Int 1, Int 2
constexpr U3 u3a = {.f = 3.1415};
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3a 'const U3' constexpr cinit
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3a 'const U3':'const U3' constexpr cinit
// CHECK-NEXT: | |-value: Union .f Float 3.141500e+00
constexpr U3 u3b = {.uinner = {}};
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3b 'const U3' constexpr cinit
// CHECK: `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u3b 'const U3':'const U3' constexpr cinit
// CHECK-NEXT: |-value: Union .uinner Union .d Float 3.141500e+00
}

View File

@ -30,7 +30,7 @@ namespace testVarDeclNRVO {
return TestVarDeclNRVO;
}
}
// CHECK: VarDecl{{.*}} TestVarDeclNRVO 'testVarDeclNRVO::A' nrvo
// CHECK: VarDecl{{.*}} TestVarDeclNRVO 'A':'testVarDeclNRVO::A' nrvo
void testParmVarDeclInit(int TestParmVarDeclInit = 0);
// CHECK: ParmVarDecl{{.*}} TestParmVarDeclInit 'int'
@ -107,8 +107,8 @@ namespace testCXXRecordDecl {
// CHECK-NEXT: CopyAssignment simple non_trivial has_const_param
// CHECK-NEXT: MoveAssignment exists simple non_trivial
// CHECK-NEXT: Destructor simple irrelevant trivial
// CHECK-NEXT: virtual private 'testCXXRecordDecl::A'
// CHECK-NEXT: public 'testCXXRecordDecl::B'
// CHECK-NEXT: virtual private 'A':'testCXXRecordDecl::A'
// CHECK-NEXT: public 'B':'testCXXRecordDecl::B'
// CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDecl
// CHECK-NEXT: FieldDecl
@ -228,7 +228,7 @@ namespace testFunctionTemplateDecl {
// CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::A':'testFunctionTemplateDecl::A'
// CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
// CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testFunctionTemplateDecl::B)'
// CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (B)'
// CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)'
// CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::C'
// CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::C'
@ -241,11 +241,11 @@ namespace testFunctionTemplateDecl {
// CHECK-NEXT: |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::D':'testFunctionTemplateDecl::D'
// CHECK-NEXT: `-CompoundStmt 0x{{.+}} <col:53, col:55>
// CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)'
// CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, col:41> col:19 TestFunctionTemplate 'void (B)'
// CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::B'
// CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::B'
// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
// CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:40> col:41 'testFunctionTemplateDecl::B'
// CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:40> col:41 'B':'testFunctionTemplateDecl::B'
namespace testClassTemplateDecl {

View File

@ -325,6 +325,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "isUsed": true,
// CHECK-NEXT: "name": "obj1",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: },
@ -461,6 +462,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -469,6 +471,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "obj1",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -730,6 +733,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -738,6 +742,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "obj1",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2534,6 +2539,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "isUsed": true,
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: },
@ -2666,6 +2672,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -2674,6 +2681,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2984,6 +2992,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -2992,6 +3001,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -3159,6 +3169,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -3167,6 +3178,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -3235,6 +3247,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -3243,6 +3256,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -3486,6 +3500,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -3494,6 +3509,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -3521,6 +3537,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "typeArg": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: },
@ -3545,9 +3562,11 @@ void TestNonADLCall3() {
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "typeArg": {
// CHECK-NEXT: "desugaredQualType": "const volatile S",
// CHECK-NEXT: "qualType": "const volatile S"
// CHECK-NEXT: },
// CHECK-NEXT: "adjustedTypeArg": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -7911,7 +7930,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (*)(NS::X)"
// CHECK-NEXT: "qualType": "void (*)(X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "castKind": "FunctionToPointerDecay",
@ -7932,7 +7951,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "referencedDecl": {
@ -7940,7 +7959,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -7962,7 +7981,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "ctorType": {
@ -8348,7 +8368,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (*)(NS::X)"
// CHECK-NEXT: "qualType": "void (*)(X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "castKind": "FunctionToPointerDecay",
@ -8369,7 +8389,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "referencedDecl": {
@ -8377,7 +8397,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -8399,7 +8419,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "ctorType": {
@ -8670,7 +8691,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (*)(NS::X)"
// CHECK-NEXT: "qualType": "void (*)(X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "castKind": "FunctionToPointerDecay",
@ -8691,7 +8712,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "referencedDecl": {
@ -8699,7 +8720,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "foundReferencedDecl": {
@ -8726,7 +8747,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "ctorType": {
@ -9040,7 +9062,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: "isUsed": true,
// CHECK-NEXT: "name": "x",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "init": "call",
// CHECK-NEXT: "inner": [
@ -9060,7 +9083,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "ctorType": {
@ -9110,7 +9134,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (*)(NS::X)"
// CHECK-NEXT: "qualType": "void (*)(X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "castKind": "FunctionToPointerDecay",
@ -9131,7 +9155,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "referencedDecl": {
@ -9139,7 +9163,7 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (NS::X)"
// CHECK-NEXT: "qualType": "void (X)"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -9161,7 +9185,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
// CHECK-NEXT: "ctorType": {
@ -9207,7 +9232,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
// CHECK-NEXT: "referencedDecl": {
@ -9215,7 +9241,8 @@ void TestNonADLCall3() {
// CHECK-NEXT: "kind": "VarDecl",
// CHECK-NEXT: "name": "x",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "NS::X"
// CHECK-NEXT: "desugaredQualType": "NS::X",
// CHECK-NEXT: "qualType": "X"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }

View File

@ -59,7 +59,7 @@ void Throw() {
void PointerToMember(S obj1, S *obj2, int S::* data, void (S::*call)(int)) {
obj1.*data;
// CHECK: BinaryOperator 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9> 'int' lvalue '.*'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S' lvalue ParmVar 0x{{[^ ]*}} 'obj1' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'obj1' 'S':'S'
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:9> 'int S::*' lvalue ParmVar 0x{{[^ ]*}} 'data' 'int S::*'
@ -74,7 +74,7 @@ void PointerToMember(S obj1, S *obj2, int S::* data, void (S::*call)(int)) {
// CHECK: CXXMemberCallExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:18> 'void'
// CHECK-NEXT: ParenExpr 0x{{[^ ]*}} <col:3, col:14> '<bound member function type>'
// CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:4, col:10> '<bound member function type>' '.*'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:4> 'S' lvalue ParmVar 0x{{[^ ]*}} 'obj1' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:4> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'obj1' 'S':'S'
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> 'void (S::*)(int)' lvalue ParmVar 0x{{[^ ]*}} 'call' 'void (S::*)(int)'
// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:16> 'int' 12
@ -91,20 +91,18 @@ void PointerToMember(S obj1, S *obj2, int S::* data, void (S::*call)(int)) {
}
void Casting(const S *s) {
// FIXME: The cast expressions contain "struct S" instead of "S".
const_cast<S *>(s);
// CHECK: CXXConstCastExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:20> 'S *' const_cast<struct S *> <NoOp>
// CHECK: CXXConstCastExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:20> 'S *' const_cast<S *> <NoOp>
// CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} <col:19> 'const S *' <LValueToRValue> part_of_explicit_cast
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:19> 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *'
static_cast<const T *>(s);
// CHECK: CXXStaticCastExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:27> 'const T *' static_cast<const struct T *> <BaseToDerived (S)>
// CHECK: CXXStaticCastExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:27> 'const T *' static_cast<const T *> <BaseToDerived (S)>
// CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} <col:26> 'const S *' <LValueToRValue> part_of_explicit_cast
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:26> 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *'
dynamic_cast<const T *>(s);
// CHECK: CXXDynamicCastExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:28> 'const T *' dynamic_cast<const struct T *> <Dynamic>
// CHECK: CXXDynamicCastExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:28> 'const T *' dynamic_cast<const T *> <Dynamic>
// CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}} <col:27> 'const S *' <LValueToRValue> part_of_explicit_cast
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:27> 'const S *' lvalue ParmVar 0x{{[^ ]*}} 's' 'const S *'
@ -180,7 +178,7 @@ void PostfixExpressions(S a, S *p, U<int> *r) {
a.func(0);
// CHECK: CXXMemberCallExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:11> 'void'
// CHECK-NEXT: MemberExpr 0x{{[^ ]*}} <col:3, col:5> '<bound member function type>' .func 0x{{[^ ]*}}
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S':'S'
// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:10> 'int' 0
p->func(0);
@ -201,7 +199,7 @@ void PostfixExpressions(S a, S *p, U<int> *r) {
a.template foo<float>();
// CHECK: CXXMemberCallExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:25> 'float':'float'
// CHECK-NEXT: MemberExpr 0x{{[^ ]*}} <col:3, col:23> '<bound member function type>' .foo 0x{{[^ ]*}}
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S':'S'
p->~S();
// CHECK: CXXMemberCallExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:9> 'void'
@ -212,14 +210,14 @@ void PostfixExpressions(S a, S *p, U<int> *r) {
a.~S();
// CHECK: CXXMemberCallExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:8> 'void'
// CHECK-NEXT: MemberExpr 0x{{[^ ]*}} <col:3, col:6> '<bound member function type>' .~S 0x{{[^ ]*}}
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S':'S'
// FIXME: there seems to be no way to distinguish the construct below from
// the construct above.
a.~decltype(a)();
// CHECK: CXXMemberCallExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:18> 'void'
// CHECK-NEXT: MemberExpr 0x{{[^ ]*}} <col:3, col:5> '<bound member function type>' .~S 0x{{[^ ]*}}
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:3> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S':'S'
// FIXME: similarly, there is no way to distinguish the construct below from
// the p->~S() case.
@ -238,7 +236,7 @@ void PostfixExpressions(S a, S *p, U<int> *r) {
typeid(a);
// CHECK: CXXTypeidExpr 0x{{[^ ]*}} <line:[[@LINE-1]]:3, col:11> 'const std::type_info' lvalue
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> 'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:10> 'S':'S' lvalue ParmVar 0x{{[^ ]*}} 'a' 'S':'S'
// FIXME: no type information is printed for the argument.
typeid(S);

View File

@ -32,7 +32,7 @@ struct S {
// CHECK-NEXT: CXXCtorInitializer Field 0x{{[^ ]*}} 'j' 'int'
// CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}} <col:17> 'int' 0
// CHECK-NEXT: CXXCtorInitializer Field 0x{{[^ ]*}} 'r' 'R'
// CHECK-NEXT: CXXConstructExpr 0x{{[^ ]*}} <col:3> 'R' 'void () noexcept'
// CHECK-NEXT: CXXConstructExpr 0x{{[^ ]*}} <col:3> 'R':'R' 'void () noexcept'
// CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} <col:20, col:21>
void a();

View File

@ -114,7 +114,7 @@ int test() {
// CHECK-NEXT: | | |-DeclStmt [[ADDR_44:0x[a-z0-9]*]] <line:18:3, col:11>
// CHECK-NEXT: | | | `-VarDecl [[ADDR_45:0x[a-z0-9]*]] <col:3, col:10> col:10 referenced t 'double'
// CHECK-NEXT: | | |-DeclStmt [[ADDR_46:0x[a-z0-9]*]] <line:19:3, col:16>
// CHECK-NEXT: | | | `-VarDecl [[ADDR_47:0x[a-z0-9]*]] <col:3, col:15> col:8 q 'S<T>' callinit
// CHECK-NEXT: | | | `-VarDecl [[ADDR_47:0x[a-z0-9]*]] <col:3, col:15> col:8 q 'S<T>':'S<T>' callinit
// CHECK-NEXT: | | | `-ParenListExpr [[ADDR_48:0x[a-z0-9]*]] <col:9, col:15> 'NULL TYPE'
// CHECK-NEXT: | | | |-IntegerLiteral [[ADDR_49:0x[a-z0-9]*]] <col:10> 'int' 1
// CHECK-NEXT: | | | `-UnaryOperator [[ADDR_50:0x[a-z0-9]*]] <col:13, col:14> 'double *' prefix '&' cannot overflow
@ -149,7 +149,7 @@ int test() {
// CHECK-NEXT: | | |-DeclStmt [[ADDR_72:0x[a-z0-9]*]] <line:24:3, col:6>
// CHECK-NEXT: | | | `-VarDecl [[ADDR_73:0x[a-z0-9]*]] <col:3, col:5> col:5 referenced t 'T'
// CHECK-NEXT: | | |-DeclStmt [[ADDR_74:0x[a-z0-9]*]] <line:25:3, col:16>
// CHECK-NEXT: | | | `-VarDecl [[ADDR_75:0x[a-z0-9]*]] <col:3, col:15> col:8 q 'S<T>' callinit
// CHECK-NEXT: | | | `-VarDecl [[ADDR_75:0x[a-z0-9]*]] <col:3, col:15> col:8 q 'S<T>':'S<T>' callinit
// CHECK-NEXT: | | | `-ParenListExpr [[ADDR_76:0x[a-z0-9]*]] <col:9, col:15> 'NULL TYPE'
// CHECK-NEXT: | | | |-IntegerLiteral [[ADDR_77:0x[a-z0-9]*]] <col:10> 'int' 0
// CHECK-NEXT: | | | `-UnaryOperator [[ADDR_78:0x[a-z0-9]*]] <col:13, col:14> '<dependent type>' prefix '&' cannot overflow
@ -185,7 +185,7 @@ int test() {
// CHECK-NEXT: | |-DeclStmt [[ADDR_101:0x[a-z0-9]*]] <line:31:3, col:11>
// CHECK-NEXT: | | `-VarDecl [[ADDR_102:0x[a-z0-9]*]] <col:3, col:10> col:10 referenced t 'double'
// CHECK-NEXT: | |-DeclStmt [[ADDR_103:0x[a-z0-9]*]] <line:32:3, col:18>
// CHECK-NEXT: | | `-VarDecl [[ADDR_104:0x[a-z0-9]*]] <col:3, col:17> col:8 q 'S<T>' callinit
// CHECK-NEXT: | | `-VarDecl [[ADDR_104:0x[a-z0-9]*]] <col:3, col:17> col:8 q 'S<T>':'S<T>' callinit
// CHECK-NEXT: | | `-ParenListExpr [[ADDR_105:0x[a-z0-9]*]] <col:9, col:17> 'NULL TYPE'
// CHECK-NEXT: | | |-FloatingLiteral [[ADDR_106:0x[a-z0-9]*]] <col:10> 'double' 2.000000e+00
// CHECK-NEXT: | | `-UnaryOperator [[ADDR_107:0x[a-z0-9]*]] <col:15, col:16> 'double *' prefix '&' cannot overflow

View File

@ -31,17 +31,17 @@ void test() {
// CHECK-NEXT: | |-CXXOperatorCallExpr {{.*}} <line:16:3, col:7> 'void' '+'
// CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} <col:5> 'void (*)(E, E)' <FunctionToPointerDecay>
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <col:5> 'void (E, E)' lvalue Function {{.*}} 'operator+' 'void (E, E)'
// CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} <col:3> 'E' <LValueToRValue>
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <col:3> 'E' lvalue Var {{.*}} 'e' 'E'
// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} <col:7> 'E' <LValueToRValue>
// CHECK-NEXT: | | `-DeclRefExpr {{.*}} <col:7> 'E' lvalue Var {{.*}} 'e' 'E'
// CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} <col:3> 'E':'E' <LValueToRValue>
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <col:3> 'E':'E' lvalue Var {{.*}} 'e' 'E':'E'
// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} <col:7> 'E':'E' <LValueToRValue>
// CHECK-NEXT: | | `-DeclRefExpr {{.*}} <col:7> 'E':'E' lvalue Var {{.*}} 'e' 'E':'E'
// CHECK-NEXT: | `-CXXOperatorCallExpr {{.*}} <line:17:3, col:7> 'void' ','
// CHECK-NEXT: | |-ImplicitCastExpr {{.*}} <col:5> 'void (*)(E, E)' <FunctionToPointerDecay>
// CHECK-NEXT: | | `-DeclRefExpr {{.*}} <col:5> 'void (E, E)' lvalue Function {{.*}} 'operator,' 'void (E, E)'
// CHECK-NEXT: | |-ImplicitCastExpr {{.*}} <col:3> 'E' <LValueToRValue>
// CHECK-NEXT: | | `-DeclRefExpr {{.*}} <col:3> 'E' lvalue Var {{.*}} 'e' 'E'
// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} <col:7> 'E' <LValueToRValue>
// CHECK-NEXT: | `-DeclRefExpr {{.*}} <col:7> 'E' lvalue Var {{.*}} 'e' 'E'
// CHECK-NEXT: | |-ImplicitCastExpr {{.*}} <col:3> 'E':'E' <LValueToRValue>
// CHECK-NEXT: | | `-DeclRefExpr {{.*}} <col:3> 'E':'E' lvalue Var {{.*}} 'e' 'E':'E'
// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} <col:7> 'E':'E' <LValueToRValue>
// CHECK-NEXT: | `-DeclRefExpr {{.*}} <col:7> 'E':'E' lvalue Var {{.*}} 'e' 'E':'E'
namespace a {
void operator-(E, E);

View File

@ -3266,6 +3266,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: {
// CHECK-NEXT: "access": "public",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base1",
// CHECK-NEXT: "qualType": "Base1"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "none"
@ -3377,6 +3378,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: {
// CHECK-NEXT: "access": "private",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base1",
// CHECK-NEXT: "qualType": "Base1"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "private"
@ -3477,6 +3479,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: "access": "public",
// CHECK-NEXT: "isVirtual": true,
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base1",
// CHECK-NEXT: "qualType": "Base1"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "none"
@ -3715,6 +3718,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: {
// CHECK-NEXT: "access": "public",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base1",
// CHECK-NEXT: "qualType": "Base1"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "none"
@ -3723,6 +3727,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: "access": "public",
// CHECK-NEXT: "isVirtual": true,
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base2",
// CHECK-NEXT: "qualType": "Base2"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "none"
@ -3730,6 +3735,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: {
// CHECK-NEXT: "access": "protected",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base3",
// CHECK-NEXT: "qualType": "Base3"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "protected"
@ -3969,6 +3975,7 @@ struct Derived6 : virtual public Bases... {
// CHECK-NEXT: "access": "protected",
// CHECK-NEXT: "isVirtual": true,
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Base1",
// CHECK-NEXT: "qualType": "Base1"
// CHECK-NEXT: },
// CHECK-NEXT: "writtenAccess": "protected"

View File

@ -145,7 +145,7 @@ void test2(Foo2 f) {
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'f'
// CHECK-NEXT: `-IntegerLiteral {{.*}} 'int' 1
f.func(1);
// CHECK: RecoveryExpr {{.*}} 'Foo2::ForwardClass'
// CHECK: RecoveryExpr {{.*}} 'ForwardClass':'Foo2::ForwardClass'
// CHECK-NEXT: `-MemberExpr {{.*}} '<bound member function type>' .createFwd
// CHECK-NEXT: `-DeclRefExpr {{.*}} 'f'
f.createFwd();
@ -202,27 +202,27 @@ void InvalidInitalizer(int x) {
// CHECK-NEXT: `-InitListExpr
Bar b2 = {1};
// CHECK: `-VarDecl {{.*}} b3 'Bar'
// CHECK-NEXT: `-RecoveryExpr {{.*}} 'Bar' contains-errors
// CHECK-NEXT: `-RecoveryExpr {{.*}} 'Bar':'Bar' contains-errors
// CHECK-NEXT: `-DeclRefExpr {{.*}} 'x' 'int'
Bar b3 = Bar(x);
// CHECK: `-VarDecl {{.*}} b4 'Bar'
// CHECK-NEXT: `-RecoveryExpr {{.*}} 'Bar' contains-errors
// CHECK-NEXT: `-RecoveryExpr {{.*}} 'Bar':'Bar' contains-errors
// CHECK-NEXT: `-InitListExpr {{.*}} 'void'
// CHECK-NEXT: `-DeclRefExpr {{.*}} 'x' 'int'
Bar b4 = Bar{x};
// CHECK: `-VarDecl {{.*}} b5 'Bar'
// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} 'Bar' contains-errors 'Bar'
// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} 'Bar':'Bar' contains-errors 'Bar'
// CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
// CHECK-NEXT: `-UnresolvedLookupExpr {{.*}} 'invalid'
Bar b5 = Bar(invalid());
// CHECK: `-VarDecl {{.*}} b6 'Bar'
// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} 'Bar' contains-errors 'Bar'
// CHECK-NEXT: `-CXXUnresolvedConstructExpr {{.*}} 'Bar':'Bar' contains-errors 'Bar'
// CHECK-NEXT: `-InitListExpr {{.*}} contains-errors
// CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
// CHECK-NEXT: `-UnresolvedLookupExpr {{.*}} 'invalid'
Bar b6 = Bar{invalid()};
// CHECK: RecoveryExpr {{.*}} 'Bar' contains-errors
// CHECK: RecoveryExpr {{.*}} 'Bar':'Bar' contains-errors
// CHECK-NEXT: `-IntegerLiteral {{.*}} 'int' 1
Bar(1);
@ -326,7 +326,7 @@ void CtorInitializer() {
// CHECK-NEXT: | `-RecoveryExpr {{.*}} '<dependent type>'
// CHECK-NEXT: | `-UnresolvedLookupExpr {{.*}} '<overloaded function type>'
// CHECK-NEXT: |-CXXCtorInitializer Field {{.*}} 's' 'S'
// CHECK-NEXT: | `-RecoveryExpr {{.*}} 'S' contains-errors
// CHECK-NEXT: | `-RecoveryExpr {{.*}} 'S':'S' contains-errors
// CHECK-NEXT: | |-IntegerLiteral {{.*}} 1
// CHECK-NEXT: | `-IntegerLiteral {{.*}} 2
};

View File

@ -2257,6 +2257,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "obj",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2322,6 +2323,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -2330,6 +2332,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "kind": "VarDecl",
// CHECK-NEXT: "name": "obj",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2418,6 +2421,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -2426,6 +2430,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "kind": "VarDecl",
// CHECK-NEXT: "name": "obj",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2580,6 +2585,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -2588,6 +2594,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "kind": "VarDecl",
// CHECK-NEXT: "name": "obj",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "DependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2764,6 +2771,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "obj",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "OtherDependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "OtherDependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -2851,6 +2859,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "OtherDependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "OtherDependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -2859,6 +2868,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "kind": "VarDecl",
// CHECK-NEXT: "name": "obj",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "OtherDependentScopeMemberExprWrapper<T>",
// CHECK-NEXT: "qualType": "OtherDependentScopeMemberExprWrapper<T>"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -3019,6 +3029,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "U",
// CHECK-NEXT: "qualType": "U"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
@ -3047,6 +3058,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "U",
// CHECK-NEXT: "qualType": "U"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
@ -5140,6 +5152,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "isUsed": true,
// CHECK-NEXT: "name": "C",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Container",
// CHECK-NEXT: "qualType": "Container"
// CHECK-NEXT: },
// CHECK-NEXT: "init": "call",
@ -5160,6 +5173,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Container",
// CHECK-NEXT: "qualType": "Container"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
@ -5253,6 +5267,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Container",
// CHECK-NEXT: "qualType": "Container"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -5261,6 +5276,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: "kind": "VarDecl",
// CHECK-NEXT: "name": "C",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Container",
// CHECK-NEXT: "qualType": "Container"
// CHECK-NEXT: }
// CHECK-NEXT: }
@ -5394,6 +5410,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Container",
// CHECK-NEXT: "qualType": "Container"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -5541,6 +5558,7 @@ void TestDependentGenericSelectionExpr(Ty T) {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Container",
// CHECK-NEXT: "qualType": "Container"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",

View File

@ -99,8 +99,8 @@ void TestUnionInitList()
U us[3] = {1};
// CHECK: VarDecl {{.+}} <col:3, col:15> col:5 us 'U[3]' cinit
// CHECK-NEXT: `-InitListExpr {{.+}} <col:13, col:15> 'U[3]'
// CHECK-NEXT: |-array_filler: InitListExpr {{.+}} <col:15> 'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT: `-InitListExpr {{.+}} <col:14> 'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT: |-array_filler: InitListExpr {{.+}} <col:15> 'U':'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT: `-InitListExpr {{.+}} <col:14> 'U':'U' field Field {{.+}} 'i' 'int'
// CHECK-NEXT: `-IntegerLiteral {{.+}} <col:14> 'int' 1
}
@ -229,19 +229,19 @@ void TestIteration() {
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:16> col:16 implicit used __range1 'Container &' cinit
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:16> 'Container' lvalue Var 0x{{[^ ]*}} 'C' 'Container'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:16> 'Container':'Container' lvalue Var 0x{{[^ ]*}} 'C' 'Container':'Container'
// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:14> col:14 implicit used __begin1 'int *':'int *' cinit
// CHECK-NEXT: CXXMemberCallExpr 0x{{[^ ]*}} <col:14> 'int *'
// CHECK-NEXT: MemberExpr 0x{{[^ ]*}} <col:14> '<bound member function type>' .begin 0x{{[^ ]*}}
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> 'Container' lvalue Var 0x{{[^ ]*}} '__range1' 'Container &'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> 'Container':'Container' lvalue Var 0x{{[^ ]*}} '__range1' 'Container &'
// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl 0x{{[^ ]*}} <col:14> col:14 implicit used __end1 'int *':'int *' cinit
// CHECK-NEXT: CXXMemberCallExpr 0x{{[^ ]*}} <col:14> 'int *'
// CHECK-NEXT: MemberExpr 0x{{[^ ]*}} <col:14> '<bound member function type>' .end 0x{{[^ ]*}}
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> 'Container' lvalue Var 0x{{[^ ]*}} '__range1' 'Container &'
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> 'Container':'Container' lvalue Var 0x{{[^ ]*}} '__range1' 'Container &'
// CHECK-NEXT: BinaryOperator 0x{{[^ ]*}} <col:14> 'bool' '!='
// CHECK-NEXT: ImplicitCastExpr
// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}} <col:14> 'int *':'int *' lvalue Var 0x{{[^ ]*}} '__begin1' 'int *':'int *'

View File

@ -826,6 +826,7 @@ void i();
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "Uy<Ty>",
// CHECK-NEXT: "qualType": "Uy<Ty>"
// CHECK-NEXT: }
// CHECK-NEXT: }

View File

@ -36,6 +36,7 @@ void MaterializeTemp() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "const S",
// CHECK-NEXT: "qualType": "const S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -57,6 +58,7 @@ void MaterializeTemp() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "const S",
// CHECK-NEXT: "qualType": "const S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "lvalue",
@ -87,6 +89,7 @@ void MaterializeTemp() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "const S",
// CHECK-NEXT: "qualType": "const S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
@ -108,6 +111,7 @@ void MaterializeTemp() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",
@ -137,6 +141,7 @@ void MaterializeTemp() {
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "desugaredQualType": "S",
// CHECK-NEXT: "qualType": "S"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "prvalue",

View File

@ -16,20 +16,23 @@ using ns::S;
template<typename T>
using A = S<T>;
// CHECK: TypeAliasDecl
// CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'S<T>' dependent using S
// CHECK-NEXT: `-ElaboratedType {{.*}} 'S<T>' sugar dependent
// CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'S<T>' dependent using S
// TemplateName in TemplateArgument.
template <template <typename> class T> class X {};
using B = X<S>;
// CHECK: TypeAliasDecl
// CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'X<ns::S>' sugar X
// CHECK-NEXT: |-TemplateArgument using template S
// CHECK-NEXT: `-RecordType {{.*}} 'X<ns::S>'
// CHECK-NEXT: `-ClassTemplateSpecialization {{.*}} 'X'
// CHECK-NEXT: `-ElaboratedType {{.*}} 'X<ns::S>' sugar
// CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'X<ns::S>' sugar X
// CHECK-NEXT: |-TemplateArgument using template S
// CHECK-NEXT: `-RecordType {{.*}} 'X<ns::S>'
// CHECK-NEXT: `-ClassTemplateSpecialization {{.*}} 'X'
// TemplateName in DeducedTemplateSpecializationType.
S DeducedTemplateSpecializationT(123);
using C = decltype(DeducedTemplateSpecializationT);
// CHECK: DecltypeType {{.*}}
// CHECK-NEXT: |-DeclRefExpr {{.*}}
// CHECK-NEXT: `-DeducedTemplateSpecializationType {{.*}} 'ns::S<int>' sugar using
// CHECK-NEXT: `-ElaboratedType {{.*}} 'S<int>' sugar
// CHECK-NEXT: `-DeducedTemplateSpecializationType {{.*}} 'ns::S<int>' sugar using

View File

@ -10,7 +10,8 @@ using a::S;
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
typedef S f; // to dump the introduced type
// CHECK: TypedefDecl
// CHECK-NEXT: `-UsingType {{.*}} 'a::S' sugar
// CHECK-NEXT: |-UsingShadow {{.*}} 'S'
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
// CHECK-NEXT: `-ElaboratedType {{.*}} 'S' sugar
// CHECK-NEXT: `-UsingType {{.*}} 'a::S' sugar
// CHECK-NEXT: |-UsingShadow {{.*}} 'S'
// CHECK-NEXT: `-RecordType {{.*}} 'a::S'
}

View File

@ -85,8 +85,8 @@ Task bar() {
// CHECK: CaseStmt
// CHECK: ExprWithCleanups {{.*}} 'void'
// CHECK-NEXT: CoawaitExpr
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Task::Awaiter':'Task::Awaiter'
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task':'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Awaiter':'Task::Awaiter'
// CHECK: ExprWithCleanups {{.*}} 'bool'
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'bool'
// CHECK-NEXT: MemberExpr {{.*}} .await_ready
@ -98,8 +98,8 @@ Task bar() {
// CHECK: CaseStmt
// CHECK: ExprWithCleanups {{.*}} 'void'
// CHECK-NEXT: CoawaitExpr
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Task::Awaiter':'Task::Awaiter'
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task':'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Awaiter':'Task::Awaiter'
// CHECK: ExprWithCleanups {{.*}} 'bool'
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'bool'
// CHECK-NEXT: MemberExpr {{.*}} .await_ready

View File

@ -85,8 +85,8 @@ Task bar() {
// CHECK: CaseStmt
// CHECK: ExprWithCleanups {{.*}} 'void'
// CHECK-NEXT: CoawaitExpr
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Task::Awaiter':'Task::Awaiter'
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task':'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Awaiter':'Task::Awaiter'
// CHECK: ExprWithCleanups {{.*}} 'bool'
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'bool'
// CHECK-NEXT: MemberExpr {{.*}} .await_ready
@ -98,8 +98,8 @@ Task bar() {
// CHECK: CaseStmt
// CHECK: ExprWithCleanups {{.*}} 'void'
// CHECK-NEXT: CoawaitExpr
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Task::Awaiter':'Task::Awaiter'
// CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'Task':'Task' (CXXTemporary {{.*}})
// CHECK: MaterializeTemporaryExpr {{.*}} 'Awaiter':'Task::Awaiter'
// CHECK: ExprWithCleanups {{.*}} 'bool'
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'bool'
// CHECK-NEXT: MemberExpr {{.*}} .await_ready

View File

@ -223,8 +223,8 @@ int main(void) {
//CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000977e+00
C1 c1(f1l);
//CHECK: | `-VarDecl{{.*}} used c1 'C1' callinit
//CHECK-NEXT: | `-CXXConstructExpr {{.*}} 'C1' 'void (_Float16)
//CHECK: | `-VarDecl{{.*}} used c1 'C1':'C1' callinit
//CHECK-NEXT: | `-CXXConstructExpr {{.*}} 'C1':'C1' 'void (_Float16)
//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
//CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var 0x{{.*}} 'f1l' '_Float16'
@ -255,13 +255,13 @@ int main(void) {
//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
//CHECK-NEXT: | | | | | | `-CXXMemberCallExpr {{.*}} '_Float16'
//CHECK-NEXT: | | | | | | |-MemberExpr {{.*}} '<bound member function type>' .func1c {{.*}}
//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} 'C1' lvalue Var {{.*}} 'c1' 'C1'
//CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} 'C1':'C1' lvalue Var {{.*}} 'c1' 'C1':'C1'
//CHECK-NEXT: | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
//CHECK-NEXT: | | | | | `-CallExpr {{.*}} '_Float16'
//CHECK-NEXT: | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
//CHECK-NEXT: | | | | | | `-MemberExpr {{.*}} '_Float16 (_Float16)' lvalue .func2c {{.*}}
//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} 'C1' lvalue Var {{.*}} 'c1' 'C1'
//CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} 'C1':'C1' lvalue Var {{.*}} 'c1' 'C1':'C1'
//CHECK-NEXT: | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
//CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
//CHECK-NEXT: | | | | `-CallExpr {{.*}} '_Float16':'_Float16'

View File

@ -47,9 +47,9 @@ struct D {
void construct() {
using namespace foo;
A a = A(12);
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'A':'foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
D d = D(12);
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
// CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'D':'D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
}
namespace PR38987 {
@ -174,7 +174,7 @@ namespace in_class_init {
// CHECK-1Z: CXXRecordDecl {{.*}} struct B definition
struct B {
// CHECK-1Z: FieldDecl {{.*}} a 'in_class_init::A'
// CHECK-1Z: FieldDecl {{.*}} a 'A':'in_class_init::A'
// CHECK-1Z-NEXT: InitListExpr {{.*}} <col:11, col:12
A a = {};
};
@ -192,7 +192,7 @@ namespace delegating_constructor_init {
// CHECK-1Z: CXXRecordDecl {{.*}} struct C definition
struct C : B {
// CHECK-1Z: CXXConstructorDecl {{.*}} C
// CHECK-1Z-NEXT: CXXCtorInitializer 'delegating_constructor_init::B'
// CHECK-1Z-NEXT: CXXCtorInitializer 'B':'delegating_constructor_init::B'
// CHECK-1Z-NEXT: CXXConstructExpr {{.*}} <col:11, col:15
// CHECK-1Z-NEXT: InitListExpr {{.*}} <col:13, col:14
C() : B({}) {};

View File

@ -466,7 +466,7 @@
<key>type</key><string>Double free</string>
<key>check_name</key><string>cplusplus.NewDelete</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>8bf1a5b9fdae9d86780aa6c4cdce2605</string>
<key>issue_hash_content_of_line_in_context</key><string>f3139fe330e830526fe60a2e19266627</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test</string>
<key>issue_hash_function_offset</key><string>3</string>

View File

@ -935,7 +935,7 @@
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>f53792d63dffe6176babc00ee455a3e0</string>
<key>issue_hash_content_of_line_in_context</key><string>988b3441112848444b50d572900b0c5f</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>get</string>
<key>issue_hash_function_offset</key><string>2</string>

View File

@ -538,7 +538,7 @@
<key>type</key><string>Called C++ object pointer is null</string>
<key>check_name</key><string>core.CallAndMessage</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>c5bd8e35fb6da070914016804720ae4d</string>
<key>issue_hash_content_of_line_in_context</key><string>f15e85d881c87a35df8a4d30e1db5ed7</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test_ic_null</string>
<key>issue_hash_function_offset</key><string>2</string>
@ -815,7 +815,7 @@
<key>type</key><string>Called C++ object pointer is null</string>
<key>check_name</key><string>core.CallAndMessage</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>e23397f9f2eff1b08593c2b2db137494</string>
<key>issue_hash_content_of_line_in_context</key><string>8efb5c75089d50fcdc228e06741f4ab5</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test_cast</string>
<key>issue_hash_function_offset</key><string>2</string>

View File

@ -27,4 +27,4 @@ namespace ns {
// CHECK: analyzer-display-progress.cpp SomeOtherStruct::f() : {{[0-9]+}}
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(int) : {{[0-9]+}}
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(float, ::SomeStruct) : {{[0-9]+}}
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(float, struct ns::SomeStruct) : {{[0-9]+}}
// CHECK: analyzer-display-progress.cpp ns::SomeStruct::f(float, SomeStruct) : {{[0-9]+}}

View File

@ -49,16 +49,16 @@ extern const bool UV;
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 5: const A &b = a;
// WARNINGS-NEXT: 6: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.9], class A)
// WARNINGS-NEXT: 6: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.9], A)
// CHECK-NEXT: 7: [B1.6] (BindTemporary)
// CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 9: [B1.8]
// CHECK: 10: const A &c = A();
// CHECK: 11: [B1.10].~A() (Implicit destructor)
@ -76,9 +76,9 @@ void test_const_ref() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, class A)
// CXX98-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], class A)
// CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.3], class A)
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
// CXX98-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], A)
// CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.3], A)
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CXX98-NEXT: 3: [B1.2].x
// CXX98-NEXT: 4: [B1.3]
@ -100,9 +100,9 @@ void test_const_ref_to_field() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, class A)
// CXX98-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], class A)
// CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.3], class A)
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
// CXX98-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], A)
// CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.3], A)
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CXX98-NEXT: 3: A::x
// CXX98-NEXT: 4: &[B1.3]
@ -129,23 +129,23 @@ void test_pointer_to_member() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.4], class A)
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.4], A)
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 4: [B1.3]
// CHECK-NEXT: 5: {[B1.4]}
// CHECK-NEXT: 6: B b = {A()};
// WARNINGS-NEXT: 7: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 7: A() (CXXConstructExpr, [B1.10], class A)
// WARNINGS-NEXT: 7: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 7: A() (CXXConstructExpr, [B1.10], A)
// CHECK-NEXT: 8: [B1.7] (BindTemporary)
// CHECK-NEXT: 9: [B1.8] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 9: [B1.8] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 10: [B1.9]
// CHECK-NEXT: 11: {[B1.10]}
// WARNINGS-NEXT: 12: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 12: A() (CXXConstructExpr, [B1.15], class A)
// WARNINGS-NEXT: 12: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 12: A() (CXXConstructExpr, [B1.15], A)
// CHECK-NEXT: 13: [B1.12] (BindTemporary)
// CHECK-NEXT: 14: [B1.13] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 14: [B1.13] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 15: [B1.14]
// CHECK-NEXT: 16: {[B1.15]}
// CHECK-NEXT: 17: {[B1.10], [B1.15]}
@ -169,18 +169,18 @@ void test_aggregate_lifetime_extension() {
// CXX11: [B2 (ENTRY)]
// CXX11-NEXT: Succs (1): B1
// CXX11: [B1]
// CXX11-WARNINGS-NEXT: 1: A() (CXXConstructExpr, class A)
// CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], [B1.4], class A)
// CXX11-WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
// CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], [B1.4], A)
// CXX11-NEXT: 2: [B1.1] (BindTemporary)
// CXX11-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A)
// CXX11-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const A)
// CXX11-NEXT: 4: [B1.3]
// CXX11-NEXT: 5: [B1.4] (CXXConstructExpr, const class A)
// CXX11-WARNINGS-NEXT: 6: A() (CXXConstructExpr, class A)
// CXX11-ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.7], [B1.9], class A)
// CXX11-NEXT: 5: [B1.4] (CXXConstructExpr, const A)
// CXX11-WARNINGS-NEXT: 6: A() (CXXConstructExpr, A)
// CXX11-ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.7], [B1.9], A)
// CXX11-NEXT: 7: [B1.6] (BindTemporary)
// CXX11-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
// CXX11-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
// CXX11-NEXT: 9: [B1.8]
// CXX11-NEXT: 10: [B1.9] (CXXConstructExpr, const class A)
// CXX11-NEXT: 10: [B1.9] (CXXConstructExpr, const A)
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CXX11-NEXT: 11: {[B1.2], [B1.7]}
// CXX11-NEXT: 12: [B1.11] (BindTemporary)
@ -190,35 +190,35 @@ void test_aggregate_lifetime_extension() {
// CXX11-NEXT: 15: C c = {{[{][{]}}A(), A(){{[}][}]}};
// CXX11-NEXT: 16: ~A() (Temporary object destructor)
// CXX11-NEXT: 17: ~A() (Temporary object destructor)
// CXX11-WARNINGS-NEXT: 18: A() (CXXConstructExpr, class A)
// CXX11-ANALYZER-NEXT: 18: A() (CXXConstructExpr, [B1.19], [B1.21], class A)
// CXX11-WARNINGS-NEXT: 18: A() (CXXConstructExpr, A)
// CXX11-ANALYZER-NEXT: 18: A() (CXXConstructExpr, [B1.19], [B1.21], A)
// CXX11-NEXT: 19: [B1.18] (BindTemporary)
// CXX11-NEXT: 20: [B1.19] (ImplicitCastExpr, NoOp, const class A)
// CXX11-NEXT: 20: [B1.19] (ImplicitCastExpr, NoOp, const A)
// CXX11-NEXT: 21: [B1.20]
// CXX11-NEXT: 22: [B1.21] (CXXConstructExpr, const class A)
// CXX11-WARNINGS-NEXT: 23: A() (CXXConstructExpr, class A)
// CXX11-ANALYZER-NEXT: 23: A() (CXXConstructExpr, [B1.24], [B1.26], class A)
// CXX11-NEXT: 22: [B1.21] (CXXConstructExpr, const A)
// CXX11-WARNINGS-NEXT: 23: A() (CXXConstructExpr, A)
// CXX11-ANALYZER-NEXT: 23: A() (CXXConstructExpr, [B1.24], [B1.26], A)
// CXX11-NEXT: 24: [B1.23] (BindTemporary)
// CXX11-NEXT: 25: [B1.24] (ImplicitCastExpr, NoOp, const class A)
// CXX11-NEXT: 25: [B1.24] (ImplicitCastExpr, NoOp, const A)
// CXX11-NEXT: 26: [B1.25]
// CXX11-NEXT: 27: [B1.26] (CXXConstructExpr, const class A)
// CXX11-NEXT: 27: [B1.26] (CXXConstructExpr, const A)
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CXX11-NEXT: 28: {[B1.19], [B1.24]}
// CXX11-NEXT: 29: [B1.28] (BindTemporary)
// CXX11-NEXT: 30: [B1.29]
// CXX11-NEXT: 31: {[B1.30]}
// CXX11-WARNINGS-NEXT: 32: A() (CXXConstructExpr, class A)
// CXX11-ANALYZER-NEXT: 32: A() (CXXConstructExpr, [B1.33], [B1.35], class A)
// CXX11-WARNINGS-NEXT: 32: A() (CXXConstructExpr, A)
// CXX11-ANALYZER-NEXT: 32: A() (CXXConstructExpr, [B1.33], [B1.35], A)
// CXX11-NEXT: 33: [B1.32] (BindTemporary)
// CXX11-NEXT: 34: [B1.33] (ImplicitCastExpr, NoOp, const class A)
// CXX11-NEXT: 34: [B1.33] (ImplicitCastExpr, NoOp, const A)
// CXX11-NEXT: 35: [B1.34]
// CXX11-NEXT: 36: [B1.35] (CXXConstructExpr, const class A)
// CXX11-WARNINGS-NEXT: 37: A() (CXXConstructExpr, class A)
// CXX11-ANALYZER-NEXT: 37: A() (CXXConstructExpr, [B1.38], [B1.40], class A)
// CXX11-NEXT: 36: [B1.35] (CXXConstructExpr, const A)
// CXX11-WARNINGS-NEXT: 37: A() (CXXConstructExpr, A)
// CXX11-ANALYZER-NEXT: 37: A() (CXXConstructExpr, [B1.38], [B1.40], A)
// CXX11-NEXT: 38: [B1.37] (BindTemporary)
// CXX11-NEXT: 39: [B1.38] (ImplicitCastExpr, NoOp, const class A)
// CXX11-NEXT: 39: [B1.38] (ImplicitCastExpr, NoOp, const A)
// CXX11-NEXT: 40: [B1.39]
// CXX11-NEXT: 41: [B1.40] (CXXConstructExpr, const class A)
// CXX11-NEXT: 41: [B1.40] (CXXConstructExpr, const A)
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CXX11-NEXT: 42: {[B1.33], [B1.38]}
// CXX11-NEXT: 43: [B1.42] (BindTemporary)
@ -254,24 +254,24 @@ void test_aggregate_array_lifetime_extension() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], [B1.4], class A)
// WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], [B1.4], A)
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 4: [B1.3]
// CHECK-NEXT: 5: [B1.4] (CXXConstructExpr, class A)
// WARNINGS-NEXT: 6: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.7], [B1.9], class A)
// CHECK-NEXT: 5: [B1.4] (CXXConstructExpr, A)
// WARNINGS-NEXT: 6: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.7], [B1.9], A)
// CHECK-NEXT: 7: [B1.6] (BindTemporary)
// CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 9: [B1.8]
// CHECK-NEXT: 10: [B1.9] (CXXConstructExpr, class A)
// WARNINGS-NEXT: 11: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 11: A() (CXXConstructExpr, [B1.12], [B1.14], class A)
// CHECK-NEXT: 10: [B1.9] (CXXConstructExpr, A)
// WARNINGS-NEXT: 11: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 11: A() (CXXConstructExpr, [B1.12], [B1.14], A)
// CHECK-NEXT: 12: [B1.11] (BindTemporary)
// CHECK-NEXT: 13: [B1.12] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 13: [B1.12] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 14: [B1.13]
// CHECK-NEXT: 15: [B1.14] (CXXConstructExpr, class A)
// CHECK-NEXT: 15: [B1.14] (CXXConstructExpr, A)
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CHECK-NEXT: 16: {[B1.7], [B1.12]}
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
@ -280,46 +280,46 @@ void test_aggregate_array_lifetime_extension() {
// CHECK-NEXT: 19: ~A() (Temporary object destructor)
// CHECK-NEXT: 20: ~A() (Temporary object destructor)
// CHECK-NEXT: 21: ~A() (Temporary object destructor)
// WARNINGS-NEXT: 22: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 22: A() (CXXConstructExpr, [B1.23], [B1.25], class A)
// WARNINGS-NEXT: 22: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 22: A() (CXXConstructExpr, [B1.23], [B1.25], A)
// CHECK-NEXT: 23: [B1.22] (BindTemporary)
// CHECK-NEXT: 24: [B1.23] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 24: [B1.23] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 25: [B1.24]
// CHECK-NEXT: 26: [B1.25] (CXXConstructExpr, class A)
// WARNINGS-NEXT: 27: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 27: A() (CXXConstructExpr, [B1.28], [B1.30], class A)
// CHECK-NEXT: 26: [B1.25] (CXXConstructExpr, A)
// WARNINGS-NEXT: 27: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 27: A() (CXXConstructExpr, [B1.28], [B1.30], A)
// CHECK-NEXT: 28: [B1.27] (BindTemporary)
// CHECK-NEXT: 29: [B1.28] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 29: [B1.28] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 30: [B1.29]
// CHECK-NEXT: 31: [B1.30] (CXXConstructExpr, class A)
// WARNINGS-NEXT: 32: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 32: A() (CXXConstructExpr, [B1.33], [B1.35], class A)
// CHECK-NEXT: 31: [B1.30] (CXXConstructExpr, A)
// WARNINGS-NEXT: 32: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 32: A() (CXXConstructExpr, [B1.33], [B1.35], A)
// CHECK-NEXT: 33: [B1.32] (BindTemporary)
// CHECK-NEXT: 34: [B1.33] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 34: [B1.33] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 35: [B1.34]
// CHECK-NEXT: 36: [B1.35] (CXXConstructExpr, class A)
// CHECK-NEXT: 36: [B1.35] (CXXConstructExpr, A)
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CHECK-NEXT: 37: {[B1.28], [B1.33]}
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CHECK-NEXT: 38: {[B1.23], {[B1.28], [B1.33]}}
// WARNINGS-NEXT: 39: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 39: A() (CXXConstructExpr, [B1.40], [B1.42], class A)
// WARNINGS-NEXT: 39: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 39: A() (CXXConstructExpr, [B1.40], [B1.42], A)
// CHECK-NEXT: 40: [B1.39] (BindTemporary)
// CHECK-NEXT: 41: [B1.40] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 41: [B1.40] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 42: [B1.41]
// CHECK-NEXT: 43: [B1.42] (CXXConstructExpr, class A)
// WARNINGS-NEXT: 44: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 44: A() (CXXConstructExpr, [B1.45], [B1.47], class A)
// CHECK-NEXT: 43: [B1.42] (CXXConstructExpr, A)
// WARNINGS-NEXT: 44: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 44: A() (CXXConstructExpr, [B1.45], [B1.47], A)
// CHECK-NEXT: 45: [B1.44] (BindTemporary)
// CHECK-NEXT: 46: [B1.45] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 46: [B1.45] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 47: [B1.46]
// CHECK-NEXT: 48: [B1.47] (CXXConstructExpr, class A)
// WARNINGS-NEXT: 49: A() (CXXConstructExpr, class A)
// ANALYZER-NEXT: 49: A() (CXXConstructExpr, [B1.50], [B1.52], class A)
// CHECK-NEXT: 48: [B1.47] (CXXConstructExpr, A)
// WARNINGS-NEXT: 49: A() (CXXConstructExpr, A)
// ANALYZER-NEXT: 49: A() (CXXConstructExpr, [B1.50], [B1.52], A)
// CHECK-NEXT: 50: [B1.49] (BindTemporary)
// CHECK-NEXT: 51: [B1.50] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 51: [B1.50] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 52: [B1.51]
// CHECK-NEXT: 53: [B1.52] (CXXConstructExpr, class A)
// CHECK-NEXT: 53: [B1.52] (CXXConstructExpr, A)
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
// CHECK-NEXT: 54: {[B1.45], [B1.50]}
// FIXME: Why does it look as if the initializer list consumes uncopied objects?
@ -357,11 +357,11 @@ void test_aggregate_with_nontrivial_own_destructor() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A[2])
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], class A[2])
// WARNINGS-NEXT: 1: (CXXConstructExpr, A[2])
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A[2])
// CHECK-NEXT: 2: A a[2];
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A[0])
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], class A[0])
// WARNINGS-NEXT: 3: (CXXConstructExpr, A[0])
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A[0])
// CHECK-NEXT: 4: A b[0];
// CHECK-NEXT: 5: [B1.2].~A[2]() (Implicit destructor)
// CHECK-NEXT: Preds (1): B2
@ -376,19 +376,19 @@ void test_array() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
// CHECK-NEXT: 2: A a;
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], class A)
// WARNINGS-NEXT: 3: (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A)
// CHECK-NEXT: 4: A c;
// WARNINGS-NEXT: 5: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 5: (CXXConstructExpr, [B1.6], class A)
// WARNINGS-NEXT: 5: (CXXConstructExpr, A)
// ANALYZER-NEXT: 5: (CXXConstructExpr, [B1.6], A)
// CHECK-NEXT: 6: A d;
// CHECK-NEXT: 7: [B1.6].~A() (Implicit destructor)
// CHECK-NEXT: 8: [B1.4].~A() (Implicit destructor)
// WARNINGS-NEXT: 9: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 9: (CXXConstructExpr, [B1.10], class A)
// WARNINGS-NEXT: 9: (CXXConstructExpr, A)
// ANALYZER-NEXT: 9: (CXXConstructExpr, [B1.10], A)
// CHECK: 10: A b;
// CHECK: 11: [B1.10].~A() (Implicit destructor)
// CHECK: 12: [B1.2].~A() (Implicit destructor)
@ -407,8 +407,8 @@ void test_scope() {
// CHECK: [B4 (ENTRY)]
// CHECK-NEXT: Succs (1): B3
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B3.4].~A() (Implicit destructor)
@ -422,11 +422,11 @@ void test_scope() {
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B0
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A a;
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B3.4], class A)
// WARNINGS-NEXT: 3: (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B3.4], A)
// CHECK-NEXT: 4: A b;
// CHECK-NEXT: 5: UV
// CHECK-NEXT: 6: [B3.5] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -446,8 +446,8 @@ void test_return() {
// CHECK-NEXT: Succs (1): B7
// CHECK: [B1]
// CHECK: l1:
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B6.2].~A() (Implicit destructor)
@ -455,8 +455,8 @@ void test_return() {
// CHECK-NEXT: Preds (2): B2 B3
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
// CHECK-NEXT: 2: A b;
// CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B6.4].~A() (Implicit destructor)
@ -481,11 +481,11 @@ void test_return() {
// CHECK-NEXT: Succs (1): B6
// CHECK: [B6]
// CHECK: l0:
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B6.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B6.2], A)
// CHECK-NEXT: 2: A b;
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B6.4], class A)
// WARNINGS-NEXT: 3: (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B6.4], A)
// CHECK-NEXT: 4: A a;
// CHECK-NEXT: 5: UV
// CHECK-NEXT: 6: [B6.5] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -493,8 +493,8 @@ void test_return() {
// CHECK-NEXT: Preds (2): B7 B5
// CHECK-NEXT: Succs (2): B5 B4
// CHECK: [B7]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B7.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B7.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B8
// CHECK-NEXT: Succs (1): B6
@ -521,27 +521,27 @@ l1:
// CHECK-NEXT: Preds (2): B2 B3
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B4]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B4.3] (ImplicitCastExpr, NoOp, const class A)
// WARNINGS-NEXT: 5: [B4.4] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 5: [B4.4] (CXXConstructExpr, [B4.6], class A)
// WARNINGS-NEXT: 5: [B4.4] (CXXConstructExpr, A)
// ANALYZER-NEXT: 5: [B4.4] (CXXConstructExpr, [B4.6], A)
// CHECK-NEXT: 6: A b = a;
// CHECK-NEXT: 7: b
// CHECK-NEXT: 8: [B4.7] (ImplicitCastExpr, NoOp, const class A)
@ -565,16 +565,16 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Succs (1): B8
// CHECK: [B1]
// CHECK-NEXT: 1: [B8.6].~A() (Implicit destructor)
// WARNINGS-NEXT: 2: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], class A)
// WARNINGS-NEXT: 2: (CXXConstructExpr, A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
// CHECK-NEXT: 3: A e;
// CHECK-NEXT: 4: [B1.3].~A() (Implicit destructor)
// CHECK-NEXT: 5: [B8.2].~A() (Implicit destructor)
// CHECK-NEXT: Preds (2): B2 B5
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B4.2].~A() (Implicit destructor)
@ -588,8 +588,8 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B0
// CHECK: [B4]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -597,8 +597,8 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B8
// CHECK-NEXT: Succs (2): B3 B2
// CHECK: [B5]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B5.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B7.2].~A() (Implicit destructor)
@ -612,8 +612,8 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B7
// CHECK-NEXT: Succs (1): B0
// CHECK: [B7]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B7.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B7.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B7.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -621,13 +621,13 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B8
// CHECK-NEXT: Succs (2): B6 B5
// CHECK: [B8]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B8.3] (ImplicitCastExpr, NoOp, const class A)
// WARNINGS-NEXT: 5: [B8.4] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 5: [B8.4] (CXXConstructExpr, [B8.6], class A)
// WARNINGS-NEXT: 5: [B8.4] (CXXConstructExpr, A)
// ANALYZER-NEXT: 5: [B8.4] (CXXConstructExpr, [B8.6], A)
// CHECK-NEXT: 6: A b = a;
// CHECK-NEXT: 7: b
// CHECK-NEXT: 8: [B8.7] (ImplicitCastExpr, NoOp, const class A)
@ -665,8 +665,8 @@ void test_if_jumps() {
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B4
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B4.4].~A() (Implicit destructor)
@ -675,8 +675,8 @@ void test_if_jumps() {
// CHECK: [B4]
// CHECK-NEXT: 1: a
// CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
// WARNINGS-NEXT: 3: [B4.2] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: [B4.2] (CXXConstructExpr, [B4.4], class A)
// WARNINGS-NEXT: 3: [B4.2] (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: [B4.2] (CXXConstructExpr, [B4.4], A)
// CHECK-NEXT: 4: A b = a;
// CHECK-NEXT: 5: b
// CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
@ -688,8 +688,8 @@ void test_if_jumps() {
// CHECK-NEXT: Preds (2): B2 B5
// CHECK-NEXT: Succs (2): B3 B1
// CHECK: [B5]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B6
// CHECK-NEXT: Succs (1): B4
@ -705,8 +705,8 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Succs (1): B11
// CHECK: [B1]
// CHECK-NEXT: 1: [B10.4].~A() (Implicit destructor)
// WARNINGS-NEXT: 2: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], class A)
// WARNINGS-NEXT: 2: (CXXConstructExpr, A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
// CHECK-NEXT: 3: A e;
// CHECK-NEXT: 4: [B1.3].~A() (Implicit destructor)
// CHECK-NEXT: 5: [B11.2].~A() (Implicit destructor)
@ -716,8 +716,8 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Preds (2): B3 B6
// CHECK-NEXT: Succs (1): B10
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B9.2].~A() (Implicit destructor)
@ -755,8 +755,8 @@ void test_while_implicit_scope() {
// CHECK: Preds (1): B9
// CHECK-NEXT: Succs (1): B1
// CHECK: [B9]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -766,8 +766,8 @@ void test_while_implicit_scope() {
// CHECK: [B10]
// CHECK-NEXT: 1: a
// CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
// WARNINGS-NEXT: 3: [B10.2] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: [B10.2] (CXXConstructExpr, [B10.4], class A)
// WARNINGS-NEXT: 3: [B10.2] (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: [B10.2] (CXXConstructExpr, [B10.4], A)
// CHECK-NEXT: 4: A b = a;
// CHECK-NEXT: 5: b
// CHECK-NEXT: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
@ -779,8 +779,8 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Preds (2): B2 B11
// CHECK-NEXT: Succs (2): B9 B1
// CHECK: [B11]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B12
// CHECK-NEXT: Succs (1): B10
@ -807,8 +807,8 @@ void test_while_jumps() {
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (2): B3 B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
// CHECK-NEXT: Preds (2): B3 B4
@ -826,8 +826,8 @@ void test_do_implicit_scope() {
// CHECK: [B12 (ENTRY)]
// CHECK-NEXT: Succs (1): B11
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B11.2].~A() (Implicit destructor)
@ -840,8 +840,8 @@ void test_do_implicit_scope() {
// CHECK-NEXT: Preds (2): B3 B6
// CHECK-NEXT: Succs (2): B10 B1
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B9.2].~A() (Implicit destructor)
@ -876,8 +876,8 @@ void test_do_implicit_scope() {
// CHECK: Preds (1): B9
// CHECK-NEXT: Succs (1): B1
// CHECK: [B9]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], A)
// CHECK-NEXT: 2: A b;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -888,8 +888,8 @@ void test_do_implicit_scope() {
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B9
// CHECK: [B11]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B12
// CHECK-NEXT: Succs (1): B9
@ -915,12 +915,12 @@ void test_do_jumps() {
// CHECK-NEXT: Preds (2): B3 B2
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B2.3] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 5: [B2.4] (CXXConstructExpr, class A)
// CHECK-NEXT: 5: [B2.4] (CXXConstructExpr, A)
// CHECK-NEXT: 6: A b = a;
// CHECK-NEXT: 7: b
// CHECK-NEXT: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
@ -931,8 +931,8 @@ void test_do_jumps() {
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: Succs (1): B1
@ -948,20 +948,20 @@ void test_switch_implicit_scope() {
// CHECK-NEXT: Succs (1): B2
// CHECK: [B1]
// CHECK-NEXT: 1: [B2.6].~A() (Implicit destructor)
// WARNINGS-NEXT: 2: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], class A)
// WARNINGS-NEXT: 2: (CXXConstructExpr, A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
// CHECK-NEXT: 3: A g;
// CHECK-NEXT: 4: [B1.3].~A() (Implicit destructor)
// CHECK-NEXT: 5: [B2.2].~A() (Implicit destructor)
// CHECK-NEXT: Preds (3): B3 B7 B2
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B2.3] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 5: [B2.4] (CXXConstructExpr, class A)
// CHECK-NEXT: 5: [B2.4] (CXXConstructExpr, A)
// CHECK-NEXT: 6: A b = a;
// CHECK-NEXT: 7: b
// CHECK-NEXT: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
@ -977,8 +977,8 @@ void test_switch_implicit_scope() {
// CHECK: Preds (2): B2 B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B4]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], A)
// CHECK-NEXT: 2: A f;
// CHECK-NEXT: 3: [B4.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B8.2].~A() (Implicit destructor)
@ -1004,8 +1004,8 @@ void test_switch_implicit_scope() {
// CHECK-NEXT: Succs (1): B1
// CHECK: [B8]
// CHECK: case 0:
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B8.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -1040,8 +1040,8 @@ void test_switch_jumps() {
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B4
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B4.4].~A() (Implicit destructor)
@ -1050,8 +1050,8 @@ void test_switch_jumps() {
// CHECK: [B4]
// CHECK-NEXT: 1: a
// CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
// WARNINGS-NEXT: 3: [B4.2] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: [B4.2] (CXXConstructExpr, [B4.4], class A)
// WARNINGS-NEXT: 3: [B4.2] (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: [B4.2] (CXXConstructExpr, [B4.4], A)
// CHECK-NEXT: 4: A b = a;
// CHECK-NEXT: 5: b
// CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
@ -1063,8 +1063,8 @@ void test_switch_jumps() {
// CHECK-NEXT: Preds (2): B2 B5
// CHECK-NEXT: Succs (2): B3 B1
// CHECK: [B5]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B6
// CHECK-NEXT: Succs (1): B4
@ -1099,8 +1099,8 @@ void test_for_implicit_scope() {
// CHECK-NEXT: 3: *[B3.2]
// CHECK-NEXT: 4: [B3.3] (ImplicitCastExpr, LValueToRValue, int)
// CHECK-NEXT: 5: int n
// WARNINGS-NEXT: 6: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 6: (CXXConstructExpr, [B3.7], class A)
// WARNINGS-NEXT: 6: (CXXConstructExpr, A)
// ANALYZER-NEXT: 6: (CXXConstructExpr, [B3.7], A)
// CHECK-NEXT: 7: A c;
// CHECK-NEXT: 8: [B3.7].~A() (Implicit destructor)
// CHECK-NEXT: Preds (1): B1
@ -1133,8 +1133,8 @@ void test_for_range_implicit_scope() {
// CHECK: [B1]
// CHECK-NEXT: 1: [B10.4].~A() (Implicit destructor)
// CHECK-NEXT: 2: [B11.4].~A() (Implicit destructor)
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], class A)
// WARNINGS-NEXT: 3: (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A)
// CHECK-NEXT: 4: A f;
// CHECK-NEXT: 5: [B1.4].~A() (Implicit destructor)
// CHECK-NEXT: 6: [B11.2].~A() (Implicit destructor)
@ -1144,8 +1144,8 @@ void test_for_range_implicit_scope() {
// CHECK-NEXT: Preds (2): B3 B6
// CHECK-NEXT: Succs (1): B10
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
// CHECK-NEXT: 2: A e;
// CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
// CHECK-NEXT: 4: [B9.2].~A() (Implicit destructor)
@ -1183,8 +1183,8 @@ void test_for_range_implicit_scope() {
// CHECK: Preds (1): B9
// CHECK-NEXT: Succs (1): B1
// CHECK: [B9]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -1194,8 +1194,8 @@ void test_for_range_implicit_scope() {
// CHECK: [B10]
// CHECK-NEXT: 1: b
// CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
// WARNINGS-NEXT: 3: [B10.2] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: [B10.2] (CXXConstructExpr, [B10.4], class A)
// WARNINGS-NEXT: 3: [B10.2] (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: [B10.2] (CXXConstructExpr, [B10.4], A)
// CHECK-NEXT: 4: A c = b;
// CHECK-NEXT: 5: c
// CHECK-NEXT: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
@ -1207,11 +1207,11 @@ void test_for_range_implicit_scope() {
// CHECK-NEXT: Preds (2): B2 B11
// CHECK-NEXT: Succs (2): B9 B1
// CHECK: [B11]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], A)
// CHECK-NEXT: 2: A a;
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B11.4], class A)
// WARNINGS-NEXT: 3: (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B11.4], A)
// CHECK-NEXT: 4: A b;
// CHECK-NEXT: Preds (1): B12
// CHECK-NEXT: Succs (1): B10

View File

@ -52,8 +52,8 @@ void testBlockWithCopyExpression(StructWithCopyConstructor s) {
// CHECK: [B1]
// CHECK-NEXT: 1: s
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, NoOp, const struct StructWithCopyConstructor)
// CHECK-NEXT: 3: [B1.2] (CXXConstructExpr, const struct StructWithCopyConstructor)
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, NoOp, const StructWithCopyConstructor)
// CHECK-NEXT: 3: [B1.2] (CXXConstructExpr, const StructWithCopyConstructor)
// CHECK-NEXT: 4: ^{ }
// CHECK-NEXT: 5: (void)([B1.4]) (CStyleCastExpr, ToVoid, void)
// CHECK-NEXT: Preds (1): B2
@ -76,8 +76,8 @@ void testBlockWithCaptureByReference() {
// CHECK: [B1]
// CHECK-NEXT: 1: 5
// WARNINGS-NEXT: 2: [B1.1] (CXXConstructExpr, struct StructWithCopyConstructor)
// ANALYZER-NEXT: 2: [B1.1] (CXXConstructExpr, [B1.3], struct StructWithCopyConstructor)
// WARNINGS-NEXT: 2: [B1.1] (CXXConstructExpr, StructWithCopyConstructor)
// ANALYZER-NEXT: 2: [B1.1] (CXXConstructExpr, [B1.3], StructWithCopyConstructor)
// CHECK-NEXT: 3: StructWithCopyConstructor s(5) __attribute__((blocks("byref")));
// CHECK-NEXT: 4: ^{ }
// CHECK-NEXT: 5: (void)([B1.4]) (CStyleCastExpr, ToVoid, void)

View File

@ -43,7 +43,7 @@ class X {
void OutOfLine();
X &operator=(int) {
clang_analyzer_hashDump(5); // expected-warning {{debug.ExprInspection$class AA::X & AA::X::operator=(int)$29$clang_analyzer_hashDump(5);$Category}}
clang_analyzer_hashDump(5); // expected-warning {{debug.ExprInspection$X & AA::X::operator=(int)$29$clang_analyzer_hashDump(5);$Category}}
return *this;
}

View File

@ -86,7 +86,7 @@ void evalReferences_addrspace(const Shape &S) {
const auto &C = dyn_cast<DEVICE Circle>(S);
clang_analyzer_printState();
// X86-CHECK-SUPPRESSED: "dynamic_types": [
// X86-CHECK-SUPPRESSED-NEXT: { "region": "SymRegion{reg_$0<const struct clang::Shape & S>}", "dyn_type": "const __attribute__((address_space(3))) class clang::Circle &", "sub_classable": true }
// X86-CHECK-SUPPRESSED-NEXT: { "region": "SymRegion{reg_$0<const Shape & S>}", "dyn_type": "const __attribute__((address_space(3))) class clang::Circle &", "sub_classable": true }
(void)C;
}
#endif
@ -98,7 +98,7 @@ void evalReferences_addrspace(const Shape &S) {
// expected-warning@-3 {{Dereference of null pointer}}
clang_analyzer_printState();
// X86-CHECK: "dynamic_types": [
// X86-CHECK-NEXT: { "region": "SymRegion{reg_$0<const struct clang::Shape & S>}", "dyn_type": "const __attribute__((address_space(3))) class clang::Circle &", "sub_classable": true }
// X86-CHECK-NEXT: { "region": "SymRegion{reg_$0<const Shape & S>}", "dyn_type": "const __attribute__((address_space(3))) class clang::Circle &", "sub_classable": true }
(void)C;
}
#endif

View File

@ -31,10 +31,10 @@ void evalNonNullParamNonNullReturn(const Shape *S) {
clang_analyzer_printState();
// CHECK: "dynamic_types": [
// CHECK-NEXT: { "region": "SymRegion{reg_$0<const struct clang::Shape * S>}", "dyn_type": "const class clang::Circle", "sub_classable": true }
// CHECK-NEXT: { "region": "SymRegion{reg_$0<const Shape * S>}", "dyn_type": "const class clang::Circle", "sub_classable": true }
// CHECK-NEXT: ],
// CHECK-NEXT: "dynamic_casts": [
// CHECK: { "region": "SymRegion{reg_$0<const struct clang::Shape * S>}", "casts": [
// CHECK: { "region": "SymRegion{reg_$0<const Shape * S>}", "casts": [
// CHECK-NEXT: { "from": "struct clang::Shape", "to": "class clang::Circle", "kind": "success" },
// CHECK-NEXT: { "from": "struct clang::Shape", "to": "class clang::Square", "kind": "fail" }
// CHECK-NEXT: ] }

File diff suppressed because it is too large Load Diff

View File

@ -21,18 +21,18 @@ public:
// CHECK: void passArgumentIntoMessage(E *e)
// CHECK: 1: e
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, E *)
// CXX11-ELIDE-NEXT: 3: D() (CXXConstructExpr, [B1.4], [B1.6], [B1.7], class D)
// CXX11-NOELIDE-NEXT: 3: D() (CXXConstructExpr, [B1.4], [B1.6], class D)
// CXX11-ELIDE-NEXT: 3: D() (CXXConstructExpr, [B1.4], [B1.6], [B1.7], D)
// CXX11-NOELIDE-NEXT: 3: D() (CXXConstructExpr, [B1.4], [B1.6], D)
// CXX11-NEXT: 4: [B1.3] (BindTemporary)
// CXX11-NEXT: 5: [B1.4] (ImplicitCastExpr, NoOp, const class D)
// CXX11-NEXT: 5: [B1.4] (ImplicitCastExpr, NoOp, const D)
// CXX11-NEXT: 6: [B1.5]
// CXX11-NEXT: 7: [B1.6] (CXXConstructExpr, [B1.8], [B1.9]+0, class D)
// CXX11-NEXT: 7: [B1.6] (CXXConstructExpr, [B1.8], [B1.9]+0, D)
// CXX11-NEXT: 8: [B1.7] (BindTemporary)
// Double brackets trigger FileCheck variables, escape.
// CXX11-NEXT: 9: {{\[}}[B1.2] foo:[B1.8]]
// CXX11-NEXT: 10: ~D() (Temporary object destructor)
// CXX11-NEXT: 11: ~D() (Temporary object destructor)
// CXX17-NEXT: 3: D() (CXXConstructExpr, [B1.4], [B1.5]+0, class D)
// CXX17-NEXT: 3: D() (CXXConstructExpr, [B1.4], [B1.5]+0, D)
// CXX17-NEXT: 4: [B1.3] (BindTemporary)
// Double brackets trigger FileCheck variables, escape.
// CXX17-NEXT: 5: {{\[}}[B1.2] foo:[B1.4]]
@ -49,9 +49,9 @@ void passArgumentIntoMessage(E *e) {
// CXX11-ELIDE-NEXT: 3: {{\[}}[B1.2] bar] (CXXRecordTypedCall, [B1.4], [B1.6], [B1.7])
// CXX11-NOELIDE-NEXT: 3: {{\[}}[B1.2] bar] (CXXRecordTypedCall, [B1.4], [B1.6])
// CXX11-NEXT: 4: [B1.3] (BindTemporary)
// CXX11-NEXT: 5: [B1.4] (ImplicitCastExpr, NoOp, const class D)
// CXX11-NEXT: 5: [B1.4] (ImplicitCastExpr, NoOp, const D)
// CXX11-NEXT: 6: [B1.5]
// CXX11-NEXT: 7: [B1.6] (CXXConstructExpr, [B1.8], class D)
// CXX11-NEXT: 7: [B1.6] (CXXConstructExpr, [B1.8], D)
// CXX11-NEXT: 8: D d = [e bar];
// CXX11-NEXT: 9: ~D() (Temporary object destructor)
// CXX11-NEXT: 10: [B1.8].~D() (Implicit destructor)

View File

@ -53,7 +53,7 @@ void checkDeclStmts() {
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: e
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, enum EmptyE)
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, EmptyE)
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, IntegralCast, int)
// CHECK-NEXT: T: switch [B1.3]
// CHECK-NEXT: Preds (1): B2
@ -93,12 +93,12 @@ public:
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: CFGNewAllocator(A *)
// WARNINGS-NEXT: 2: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], class A)
// WARNINGS-NEXT: 2: (CXXConstructExpr, A)
// ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
// CHECK-NEXT: 3: new A([B1.2])
// CHECK-NEXT: 4: A *a = new A();
// CHECK-NEXT: 5: a
// CHECK-NEXT: 6: [B1.5] (ImplicitCastExpr, LValueToRValue, class A *)
// CHECK-NEXT: 6: [B1.5] (ImplicitCastExpr, LValueToRValue, A *)
// CHECK-NEXT: 7: [B1.6]->~A() (Implicit destructor)
// CHECK-NEXT: 8: delete [B1.6]
// CHECK-NEXT: Preds (1): B2
@ -116,12 +116,12 @@ void test_deletedtor() {
// CHECK: [B1]
// CHECK-NEXT: 1: 5
// CHECK-NEXT: 2: CFGNewAllocator(A *)
// WARNINGS-NEXT: 3: (CXXConstructExpr, class A[5])
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], class A[5])
// WARNINGS-NEXT: 3: (CXXConstructExpr, A[5])
// ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A[5])
// CHECK-NEXT: 4: new A {{\[\[}}B1.1]]
// CHECK-NEXT: 5: A *a = new A [5];
// CHECK-NEXT: 6: a
// CHECK-NEXT: 7: [B1.6] (ImplicitCastExpr, LValueToRValue, class A *)
// CHECK-NEXT: 7: [B1.6] (ImplicitCastExpr, LValueToRValue, A *)
// CHECK-NEXT: 8: [B1.7]->~A() (Implicit destructor)
// CHECK-NEXT: 9: delete [] [B1.7]
// CHECK-NEXT: Preds (1): B2
@ -148,7 +148,7 @@ namespace NoReturnSingleSuccessor {
// CHECK-LABEL: int test1(int *x)
// CHECK: 1: 1
// CHECK-NEXT: 2: return
// CHECK-NEXT: ~NoReturnSingleSuccessor::B() (Implicit destructor)
// CHECK-NEXT: ~B() (Implicit destructor)
// CHECK-NEXT: Preds (1)
// CHECK-NEXT: Succs (1): B0
int test1(int *x) {
@ -309,8 +309,8 @@ int test_enum_with_extension_default(enum MyEnum value) {
// CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, ArrayToPointerDecay, int *)
// CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, BitCast, void *)
// CHECK-NEXT: 5: CFGNewAllocator(MyClass *)
// WARNINGS-NEXT: 6: (CXXConstructExpr, class MyClass)
// ANALYZER-NEXT: 6: (CXXConstructExpr, [B1.7], class MyClass)
// WARNINGS-NEXT: 6: (CXXConstructExpr, MyClass)
// ANALYZER-NEXT: 6: (CXXConstructExpr, [B1.7], MyClass)
// CHECK-NEXT: 7: new ([B1.4]) MyClass([B1.6])
// CHECK-NEXT: 8: MyClass *obj = new (buffer) MyClass();
// CHECK-NEXT: Preds (1): B2
@ -342,8 +342,8 @@ void test_placement_new() {
// CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, BitCast, void *)
// CHECK-NEXT: 5: 5
// CHECK-NEXT: 6: CFGNewAllocator(MyClass *)
// WARNINGS-NEXT: 7: (CXXConstructExpr, class MyClass[5])
// ANALYZER-NEXT: 7: (CXXConstructExpr, [B1.8], class MyClass[5])
// WARNINGS-NEXT: 7: (CXXConstructExpr, MyClass[5])
// ANALYZER-NEXT: 7: (CXXConstructExpr, [B1.8], MyClass[5])
// CHECK-NEXT: 8: new ([B1.4]) MyClass {{\[\[}}B1.5]]
// CHECK-NEXT: 9: MyClass *obj = new (buffer) MyClass [5];
// CHECK-NEXT: Preds (1): B2
@ -418,10 +418,10 @@ void test_lifetime_extended_temporaries() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, struct pr37688_deleted_union_destructor::A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], struct pr37688_deleted_union_destructor::A)
// CHECK-NEXT: 2: pr37688_deleted_union_destructor::A a;
// CHECK-NEXT: 3: [B1.2].~pr37688_deleted_union_destructor::A() (Implicit destructor)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B0
// CHECK: [B0 (EXIT)]
@ -577,13 +577,13 @@ int vla_evaluate(int x) {
// CHECK-LABEL: void CommaTemp::f()
// CHECK: [B1]
// CHECK-NEXT: 1: CommaTemp::A() (CXXConstructExpr,
// CHECK-NEXT: 1: A() (CXXConstructExpr,
// CHECK-NEXT: 2: [B1.1] (BindTemporary)
// CHECK-NEXT: 3: CommaTemp::B() (CXXConstructExpr,
// CHECK-NEXT: 3: B() (CXXConstructExpr,
// CHECK-NEXT: 4: [B1.3] (BindTemporary)
// CHECK-NEXT: 5: ... , [B1.4]
// CHECK-NEXT: 6: ~CommaTemp::B() (Temporary object destructor)
// CHECK-NEXT: 7: ~CommaTemp::A() (Temporary object destructor)
// CHECK-NEXT: 6: ~B() (Temporary object destructor)
// CHECK-NEXT: 7: ~A() (Temporary object destructor)
namespace CommaTemp {
struct A { ~A(); };
struct B { ~B(); };
@ -611,8 +611,8 @@ void CommaTemp::f() {
// CHECK-NEXT: Preds (2): B3 B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B3]
// WARNINGS-NEXT: 1: (CXXConstructExpr, struct ClassWithDtor)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], struct ClassWithDtor)
// WARNINGS-NEXT: 1: (CXXConstructExpr, ClassWithDtor)
// ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], ClassWithDtor)
// CHECK-NEXT: 2: thread_local ClassWithDtor a;
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B2

View File

@ -156,19 +156,19 @@ public:
ClassWithoutDestructor make1(AddressVector<ClassWithoutDestructor> &v) {
return ClassWithoutDestructor(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithoutDestructor' is still \
object of type 'ClassWithoutDestructor' is still \
referred to by the stack variable 'v' upon returning to the caller}}
}
ClassWithoutDestructor make2(AddressVector<ClassWithoutDestructor> &v) {
return make1(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithoutDestructor' is still \
object of type 'ClassWithoutDestructor' is still \
referred to by the stack variable 'v' upon returning to the caller}}
}
ClassWithoutDestructor make3(AddressVector<ClassWithoutDestructor> &v) {
return make2(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithoutDestructor' is still \
object of type 'ClassWithoutDestructor' is still \
referred to by the stack variable 'v' upon returning to the caller}}
}
@ -265,7 +265,7 @@ struct TestCtorInitializer {
TestCtorInitializer(AddressVector<ClassWithDestructor> &v)
: c(ClassWithDestructor(v)) {}
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithDestructor' is still referred \
object of type 'ClassWithDestructor' is still referred \
to by the stack variable 'v' upon returning to the caller}}
};
@ -301,19 +301,19 @@ void testCtorInitializer() {
ClassWithDestructor make1(AddressVector<ClassWithDestructor> &v) {
return ClassWithDestructor(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithDestructor' is still referred \
object of type 'ClassWithDestructor' is still referred \
to by the stack variable 'v' upon returning to the caller}}
}
ClassWithDestructor make2(AddressVector<ClassWithDestructor> &v) {
return make1(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithDestructor' is still referred \
object of type 'ClassWithDestructor' is still referred \
to by the stack variable 'v' upon returning to the caller}}
}
ClassWithDestructor make3(AddressVector<ClassWithDestructor> &v) {
return make2(v);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::ClassWithDestructor' is still referred \
object of type 'ClassWithDestructor' is still referred \
to by the stack variable 'v' upon returning to the caller}}
}
@ -406,7 +406,7 @@ struct Foo {
Foo make1(Foo **r) {
return Foo(r);
// no-elide-warning@-1 {{Address of stack memory associated with temporary \
object of type 'address_vector_tests::Foo' is still referred to by the stack \
object of type 'Foo' is still referred to by the stack \
variable 'z' upon returning to the caller}}
}

View File

@ -783,7 +783,7 @@ void fVirtualDiamondInheritanceTest3() {
struct DynTBase1 {};
struct DynTDerived1 : DynTBase1 {
int y; // expected-note{{uninitialized field 'static_cast<struct DynTDerived1 *>(this->bptr)->y'}}
int y; // expected-note{{uninitialized field 'static_cast<DynTDerived1 *>(this->bptr)->y'}}
};
struct DynamicTypeTest1 {
@ -799,10 +799,10 @@ void fDynamicTypeTest1() {
};
struct DynTBase2 {
int x; // expected-note{{uninitialized field 'static_cast<struct DynTDerived2 *>(this->bptr)->DynTBase2::x'}}
int x; // expected-note{{uninitialized field 'static_cast<DynTDerived2 *>(this->bptr)->DynTBase2::x'}}
};
struct DynTDerived2 : DynTBase2 {
int y; // expected-note{{uninitialized field 'static_cast<struct DynTDerived2 *>(this->bptr)->y'}}
int y; // expected-note{{uninitialized field 'static_cast<DynTDerived2 *>(this->bptr)->y'}}
};
struct DynamicTypeTest2 {

View File

@ -23,5 +23,5 @@ void foo() {
// CHECK: \"cluster\": \"t\", \"pointer\": \"{{0x[0-9a-f]+}}\", \"items\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"kind\": \"Default\", \"offset\": 0, \"value\": \"conj_$2\{int, LC5, no stmt, #1\}\"
// CHECK: \"dynamic_types\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"region\": \"HeapSymRegion\{conj_$1\{struct S *, LC1, S{{[0-9]+}}, #1\}\}\", \"dyn_type\": \"struct S\", \"sub_classable\": false \}\l
// CHECK: \"dynamic_types\": [\l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\{ \"region\": \"HeapSymRegion\{conj_$1\{S *, LC1, S{{[0-9]+}}, #1\}\}\", \"dyn_type\": \"S\", \"sub_classable\": false \}\l

View File

@ -9,9 +9,9 @@ struct S {};
void test() {
// CHECK: Dynamic Types:
// CHECK-SAME: <tr><td align="left"><table border="0"><tr>
// CHECK-SAME: <td align="left">HeapSymRegion\{conj_$1\{struct S *, LC1,
// CHECK-SAME: <td align="left">HeapSymRegion\{conj_$1\{S *, LC1,
// CHECK-SAME: S{{[0-9]*}}, #1\}\}</td>
// CHECK-SAME: <td align="left">struct S</td>
// CHECK-SAME: <td align="left">S</td>
// CHECK-SAME: </tr></table></td></tr>
new S;
}

View File

@ -33,8 +33,8 @@ public:
// CHECK: [B3 (ENTRY)]
// CHECK-NEXT: Succs (1): B2
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, A() (Base initializer), class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, A() (Base initializer), A)
// CHECK-NEXT: 2: A([B1.1]) (Base initializer)
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B0
@ -52,8 +52,8 @@ public:
// CHECK: [B1]
// CHECK-NEXT: 1: i
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, int)
// WARNINGS-NEXT: 3: [B1.2] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: [B1.2] (CXXConstructExpr, A([B1.2]) (Base initializer), class A)
// WARNINGS-NEXT: 3: [B1.2] (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: [B1.2] (CXXConstructExpr, A([B1.2]) (Base initializer), A)
// CHECK-NEXT: 4: A([B1.3]) (Base initializer)
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B0
@ -72,8 +72,8 @@ public:
// CHECK: [B3 (ENTRY)]
// CHECK-NEXT: Succs (1): B2
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, A() (Base initializer), class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, A() (Base initializer), A)
// CHECK-NEXT: 2: A([B1.1]) (Base initializer)
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B0
@ -91,8 +91,8 @@ public:
// CHECK: [B1]
// CHECK-NEXT: 1: i
// CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, int)
// WARNINGS-NEXT: 3: [B1.2] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 3: [B1.2] (CXXConstructExpr, A([B1.2]) (Base initializer), class A)
// WARNINGS-NEXT: 3: [B1.2] (CXXConstructExpr, A)
// ANALYZER-NEXT: 3: [B1.2] (CXXConstructExpr, A([B1.2]) (Base initializer), A)
// CHECK-NEXT: 4: A([B1.3]) (Base initializer)
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B0
@ -117,27 +117,27 @@ public:
// CHECK: [B4 (ENTRY)]
// CHECK-NEXT: Succs (1): B3
// CHECK: [B1]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class C)
// ANALYZER-NEXT: 1: (CXXConstructExpr, C() (Base initializer), class C)
// WARNINGS-NEXT: 1: (CXXConstructExpr, C)
// ANALYZER-NEXT: 1: (CXXConstructExpr, C() (Base initializer), C)
// CHECK-NEXT: 2: C([B1.1]) (Base initializer)
// WARNINGS-NEXT: 3: (CXXConstructExpr, class B)
// ANALYZER-NEXT: 3: (CXXConstructExpr, B() (Base initializer), class B)
// WARNINGS-NEXT: 3: (CXXConstructExpr, B)
// ANALYZER-NEXT: 3: (CXXConstructExpr, B() (Base initializer), B)
// CHECK-NEXT: 4: B([B1.3]) (Base initializer)
// WARNINGS-NEXT: 5: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 5: (CXXConstructExpr, A() (Base initializer), class A)
// WARNINGS-NEXT: 5: (CXXConstructExpr, A)
// ANALYZER-NEXT: 5: (CXXConstructExpr, A() (Base initializer), A)
// CHECK-NEXT: 6: A([B1.5]) (Base initializer)
// CHECK-NEXT: 7: i(/*implicit*/(int)0) (Member initializer)
// CHECK-NEXT: 8: this
// CHECK-NEXT: 9: [B1.8]->i
// CHECK-NEXT: 10: r([B1.9]) (Member initializer)
// WARNINGS-NEXT: 11: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 11: (CXXConstructExpr, [B1.12], class A)
// WARNINGS-NEXT: 11: (CXXConstructExpr, A)
// ANALYZER-NEXT: 11: (CXXConstructExpr, [B1.12], A)
// CHECK-NEXT: 12: A a;
// CHECK-NEXT: Preds (2): B2 B3
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// WARNINGS-NEXT: 1: (CXXConstructExpr, class A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, A() (Base initializer), class A)
// WARNINGS-NEXT: 1: (CXXConstructExpr, A)
// ANALYZER-NEXT: 1: (CXXConstructExpr, A() (Base initializer), A)
// CHECK-NEXT: 2: A([B2.1]) (Base initializer)
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B1
@ -244,8 +244,8 @@ public:
// CHECK-NEXT: Succs (1): B9
// CHECK: [B1]
// CHECK-NEXT: 1: [B4.2] ? [B2.1] : [B3.1]
// WARNINGS-NEXT: 2: [B1.1] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 2: [B1.1] (CXXConstructExpr, a([B1.1]) (Member initializer), class A)
// WARNINGS-NEXT: 2: [B1.1] (CXXConstructExpr, A)
// ANALYZER-NEXT: 2: [B1.1] (CXXConstructExpr, a([B1.1]) (Member initializer), A)
// CHECK-NEXT: 3: a([B1.2]) (Member initializer)
// CHECK-NEXT: Preds (2): B2 B3
// CHECK-NEXT: Succs (1): B0
@ -265,8 +265,8 @@ public:
// CHECK-NEXT: Succs (2): B2 B3
// CHECK: [B5]
// CHECK-NEXT: 1: [B8.2] ? [B6.1] : [B7.1]
// WARNINGS-NEXT: 2: [B5.1] (CXXConstructExpr, class A)
// ANALYZER-NEXT: 2: [B5.1] (CXXConstructExpr, A([B5.1]) (Base initializer), class A)
// WARNINGS-NEXT: 2: [B5.1] (CXXConstructExpr, A)
// ANALYZER-NEXT: 2: [B5.1] (CXXConstructExpr, A([B5.1]) (Base initializer), A)
// CHECK-NEXT: 3: A([B5.2]) (Base initializer)
// CHECK-NEXT: Preds (2): B6 B7
// CHECK-NEXT: Succs (1): B4

View File

@ -1384,7 +1384,7 @@
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>675157873c1414a885eb1f429b26f389</string>
<key>issue_hash_content_of_line_in_context</key><string>9261b182b35fa6b6f1d0c750c41f4933</string>
<key>issue_hash_function_offset</key><string>1</string>
<key>location</key>
<dict>
@ -1714,7 +1714,7 @@
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>aff5e83726a1ce1144580e4c80bde47c</string>
<key>issue_hash_content_of_line_in_context</key><string>a073d3adfe741b2e3d871c7442446e3b</string>
<key>issue_hash_function_offset</key><string>1</string>
<key>location</key>
<dict>
@ -2046,7 +2046,7 @@
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>9484c73e190dfe4b8c6c5bdfad9700c1</string>
<key>issue_hash_content_of_line_in_context</key><string>37a2ac98868b90fdc54ac673daab004f</string>
<key>issue_context_kind</key><string>C++ method</string>
<key>issue_context</key><string>operator=</string>
<key>issue_hash_function_offset</key><string>1</string>
@ -2381,7 +2381,7 @@
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>a0f0ac76cf282b61236bfac7eb2eca62</string>
<key>issue_hash_content_of_line_in_context</key><string>350efb59f475dca2427e8ac4c72f33f1</string>
<key>issue_context_kind</key><string>C++ method</string>
<key>issue_context</key><string>operator=</string>
<key>issue_hash_function_offset</key><string>1</string>
@ -4188,7 +4188,7 @@
<key>type</key><string>Dereference of null pointer</string>
<key>check_name</key><string>core.NullDereference</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>749bda64658e48896477213e90176f5e</string>
<key>issue_hash_content_of_line_in_context</key><string>59af00b5ddf4849d000d583bb5722c8a</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>test</string>
<key>issue_hash_function_offset</key><string>2</string>
@ -4750,7 +4750,7 @@
<key>type</key><string>Called C++ object pointer is null</string>
<key>check_name</key><string>core.CallAndMessage</string>
<!-- This hash is experimental and going to change! -->
<key>issue_hash_content_of_line_in_context</key><string>8b577b362ffa5a7290d00d03635c1fca</string>
<key>issue_hash_content_of_line_in_context</key><string>f5a1486363a2814a8268d71daf54a2f8</string>
<key>issue_context_kind</key><string>function</string>
<key>issue_context</key><string>testDeclRefExprToReferenceInGetDerefExpr</string>
<key>issue_hash_function_offset</key><string>8</string>

View File

@ -399,8 +399,8 @@ int f() {
// CHECK: Succs (1): B1
// CHECK: [B1]
// CHECK: 1: x
// CHECK: 2: [B1.1] (ImplicitCastExpr, NoOp, const struct X)
// CHECK: 3: [B1.2] (CXXConstructExpr[B1.4]+0, struct X)
// CHECK: 2: [B1.1] (ImplicitCastExpr, NoOp, const X)
// CHECK: 3: [B1.2] (CXXConstructExpr[B1.4]+0, X)
// CHECK: 4: [x] {
// CHECK: }
// CHECK: 5: (void)[B1.4] (CStyleCastExpr, ToVoid, void)

View File

@ -58,14 +58,14 @@ public:
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 5: const A &b = a;
// CHECK-NEXT: 6: A() (CXXConstructExpr, class A)
// CHECK-NEXT: 6: A() (CXXConstructExpr, A)
// CHECK-NEXT: 7: [B1.6] (BindTemporary)
// CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
// CHECK-NEXT: 9: [B1.8]
// CHECK-NEXT: 10: const A &c = A();
// CHECK-NEXT: 11: [B1.10] (Lifetime ends)
@ -84,9 +84,9 @@ void test_const_ref() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: (CXXConstructExpr, class A[2])
// CHECK-NEXT: 1: (CXXConstructExpr, A[2])
// CHECK-NEXT: 2: A a[2];
// CHECK-NEXT: 3: (CXXConstructExpr, class A[0])
// CHECK-NEXT: 3: (CXXConstructExpr, A[0])
// CHECK-NEXT: 4: A b[0];
// lifetime of a ends when its destructors are run
// CHECK-NEXT: 5: [B1.2] (Lifetime ends)
@ -104,15 +104,15 @@ void test_array() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: (CXXConstructExpr, class A)
// CHECK-NEXT: 3: (CXXConstructExpr, A)
// CHECK-NEXT: 4: A c;
// CHECK-NEXT: 5: (CXXConstructExpr, class A)
// CHECK-NEXT: 5: (CXXConstructExpr, A)
// CHECK-NEXT: 6: A d;
// CHECK-NEXT: 7: [B1.6] (Lifetime ends)
// CHECK-NEXT: 8: [B1.4] (Lifetime ends)
// CHECK-NEXT: 9: (CXXConstructExpr, class A)
// CHECK-NEXT: 9: (CXXConstructExpr, A)
// CHECK-NEXT: 10: A b;
// CHECK-NEXT: 11: [B1.10] (Lifetime ends)
// CHECK-NEXT: 12: [B1.2] (Lifetime ends)
@ -132,7 +132,7 @@ void test_scope() {
// CHECK: [B4 (ENTRY)]
// CHECK-NEXT: Succs (1): B3
// CHECK: [B1]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B1.2] (Lifetime ends)
// CHECK-NEXT: 4: [B3.4] (Lifetime ends)
@ -146,9 +146,9 @@ void test_scope() {
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B0
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: (CXXConstructExpr, class A)
// CHECK-NEXT: 3: (CXXConstructExpr, A)
// CHECK-NEXT: 4: A b;
// CHECK-NEXT: 5: UV
// CHECK-NEXT: 6: [B3.5] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -174,23 +174,23 @@ void test_return() {
// CHECK-NEXT: Preds (2): B2 B3
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B2.2] (Lifetime ends)
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2] (Lifetime ends)
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B1
// CHECK: [B4]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B4.3] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 5: [B4.4] (CXXConstructExpr, class A)
// CHECK-NEXT: 5: [B4.4] (CXXConstructExpr, A)
// CHECK-NEXT: 6: A b = a;
// CHECK-NEXT: 7: b
// CHECK-NEXT: 8: [B4.7] (ImplicitCastExpr, NoOp, const class A)
@ -215,14 +215,14 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Succs (1): B8
// CHECK: [B1]
// CHECK-NEXT: 1: [B8.6] (Lifetime ends)
// CHECK-NEXT: 2: (CXXConstructExpr, class A)
// CHECK-NEXT: 2: (CXXConstructExpr, A)
// CHECK-NEXT: 3: A e;
// CHECK-NEXT: 4: [B1.3] (Lifetime ends)
// CHECK-NEXT: 5: [B8.2] (Lifetime ends)
// CHECK-NEXT: Preds (2): B2 B5
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B2.2] (Lifetime ends)
// CHECK-NEXT: 4: [B4.2] (Lifetime ends)
@ -236,7 +236,7 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B4
// CHECK-NEXT: Succs (1): B0
// CHECK: [B4]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -244,7 +244,7 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B8
// CHECK-NEXT: Succs (2): B3 B2
// CHECK: [B5]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B5.2] (Lifetime ends)
// CHECK-NEXT: 4: [B7.2] (Lifetime ends)
@ -258,7 +258,7 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B7
// CHECK-NEXT: Succs (1): B0
// CHECK: [B7]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B7.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -266,11 +266,11 @@ void test_if_implicit_scope() {
// CHECK-NEXT: Preds (1): B8
// CHECK-NEXT: Succs (2): B6 B5
// CHECK: [B8]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: a
// CHECK-NEXT: 4: [B8.3] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 5: [B8.4] (CXXConstructExpr, class A)
// CHECK-NEXT: 5: [B8.4] (CXXConstructExpr, A)
// CHECK-NEXT: 6: A b = a;
// CHECK-NEXT: 7: b
// CHECK-NEXT: 8: [B8.7] (ImplicitCastExpr, NoOp, const class A)
@ -310,7 +310,7 @@ void test_if_jumps() {
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B4
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2] (Lifetime ends)
// CHECK-NEXT: 4: [B4.4] (Lifetime ends)
@ -319,7 +319,7 @@ void test_if_jumps() {
// CHECK: [B4]
// CHECK-NEXT: 1: a
// CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 3: [B4.2] (CXXConstructExpr, class A)
// CHECK-NEXT: 3: [B4.2] (CXXConstructExpr, A)
// CHECK-NEXT: 4: A b = a;
// CHECK-NEXT: 5: b
// CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
@ -331,7 +331,7 @@ void test_if_jumps() {
// CHECK-NEXT: Preds (2): B2 B5
// CHECK-NEXT: Succs (2): B3 B1
// CHECK: [B5]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B6
// CHECK-NEXT: Succs (1): B4
@ -347,7 +347,7 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Succs (1): B11
// CHECK: [B1]
// CHECK-NEXT: 1: [B10.4] (Lifetime ends)
// CHECK-NEXT: 2: (CXXConstructExpr, class A)
// CHECK-NEXT: 2: (CXXConstructExpr, A)
// CHECK-NEXT: 3: A e;
// CHECK-NEXT: 4: [B1.3] (Lifetime ends)
// CHECK-NEXT: 5: [B11.2] (Lifetime ends)
@ -357,7 +357,7 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Preds (2): B3 B6
// CHECK-NEXT: Succs (1): B10
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B3.2] (Lifetime ends)
// CHECK-NEXT: 4: [B9.2] (Lifetime ends)
@ -395,7 +395,7 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Preds (1): B9
// CHECK-NEXT: Succs (1): B1
// CHECK: [B9]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -405,7 +405,7 @@ void test_while_implicit_scope() {
// CHECK: [B10]
// CHECK-NEXT: 1: a
// CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 3: [B10.2] (CXXConstructExpr, class A)
// CHECK-NEXT: 3: [B10.2] (CXXConstructExpr, A)
// CHECK-NEXT: 4: A b = a;
// CHECK-NEXT: 5: b
// CHECK-NEXT: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
@ -417,7 +417,7 @@ void test_while_implicit_scope() {
// CHECK-NEXT: Preds (2): B2 B11
// CHECK-NEXT: Succs (2): B9 B1
// CHECK: [B11]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B12
// CHECK-NEXT: Succs (1): B10
@ -441,7 +441,7 @@ void test_while_jumps() {
// CHECK: [B12 (ENTRY)]
// CHECK-NEXT: Succs (1): B11
// CHECK: [B1]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: [B1.2] (Lifetime ends)
// CHECK-NEXT: 4: [B11.2] (Lifetime ends)
@ -454,7 +454,7 @@ void test_while_jumps() {
// CHECK-NEXT: Preds (2): B3 B6
// CHECK-NEXT: Succs (2): B10 B1
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2] (Lifetime ends)
// CHECK-NEXT: 4: [B9.2] (Lifetime ends)
@ -489,7 +489,7 @@ void test_while_jumps() {
// CHECK-NEXT: Preds (1): B9
// CHECK-NEXT: Succs (1): B1
// CHECK: [B9]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A b;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -500,7 +500,7 @@ void test_while_jumps() {
// CHECK-NEXT: Preds (1): B2
// CHECK-NEXT: Succs (1): B9
// CHECK: [B11]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B12
// CHECK-NEXT: Succs (1): B9
@ -532,7 +532,7 @@ void test_do_jumps() {
// CHECK-NEXT: Preds (1): B3
// CHECK-NEXT: Succs (1): B4
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A c;
// CHECK-NEXT: 3: [B3.2] (Lifetime ends)
// CHECK-NEXT: 4: [B4.4] (Lifetime ends)
@ -541,7 +541,7 @@ void test_do_jumps() {
// CHECK: [B4]
// CHECK-NEXT: 1: a
// CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 3: [B4.2] (CXXConstructExpr, class A)
// CHECK-NEXT: 3: [B4.2] (CXXConstructExpr, A)
// CHECK-NEXT: 4: A b = a;
// CHECK-NEXT: 5: b
// CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
@ -553,7 +553,7 @@ void test_do_jumps() {
// CHECK-NEXT: Preds (2): B2 B5
// CHECK-NEXT: Succs (2): B3 B1
// CHECK: [B5]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: Preds (1): B6
// CHECK-NEXT: Succs (1): B4
@ -569,7 +569,7 @@ void test_for_implicit_scope() {
// CHECK: [B1]
// CHECK-NEXT: 1: [B10.4] (Lifetime ends)
// CHECK-NEXT: 2: [B11.4] (Lifetime ends)
// CHECK-NEXT: 3: (CXXConstructExpr, class A)
// CHECK-NEXT: 3: (CXXConstructExpr, A)
// CHECK-NEXT: 4: A f;
// CHECK-NEXT: 5: [B1.4] (Lifetime ends)
// CHECK-NEXT: 6: [B11.2] (Lifetime ends)
@ -579,7 +579,7 @@ void test_for_implicit_scope() {
// CHECK-NEXT: Preds (2): B3 B6
// CHECK-NEXT: Succs (1): B10
// CHECK: [B3]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A e;
// CHECK-NEXT: 3: [B3.2] (Lifetime ends)
// CHECK-NEXT: 4: [B9.2] (Lifetime ends)
@ -617,7 +617,7 @@ void test_for_implicit_scope() {
// CHECK-NEXT: Preds (1): B9
// CHECK-NEXT: Succs (1): B1
// CHECK: [B9]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A d;
// CHECK-NEXT: 3: UV
// CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
@ -627,7 +627,7 @@ void test_for_implicit_scope() {
// CHECK: [B10]
// CHECK-NEXT: 1: b
// CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
// CHECK-NEXT: 3: [B10.2] (CXXConstructExpr, class A)
// CHECK-NEXT: 3: [B10.2] (CXXConstructExpr, A)
// CHECK-NEXT: 4: A c = b;
// CHECK-NEXT: 5: c
// CHECK-NEXT: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
@ -639,9 +639,9 @@ void test_for_implicit_scope() {
// CHECK-NEXT: Preds (2): B2 B11
// CHECK-NEXT: Succs (2): B9 B1
// CHECK: [B11]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: (CXXConstructExpr, class A)
// CHECK-NEXT: 3: (CXXConstructExpr, A)
// CHECK-NEXT: 4: A b;
// CHECK-NEXT: Preds (1): B12
// CHECK-NEXT: Succs (1): B10
@ -665,7 +665,7 @@ void test_for_jumps() {
// CHECK: [B2 (ENTRY)]
// CHECK-NEXT: Succs (1): B1
// CHECK: [B1]
// CHECK-NEXT: 1: (CXXConstructExpr, class A)
// CHECK-NEXT: 1: (CXXConstructExpr, A)
// CHECK-NEXT: 2: A a;
// CHECK-NEXT: 3: int n;
// CHECK-NEXT: 4: n
@ -762,7 +762,7 @@ struct B {
// CHECK-NEXT: Succs (1): B0
// CHECK: [B2]
// CHECK-NEXT: label:
// CHECK-NEXT: 1: (CXXConstructExpr, struct B)
// CHECK-NEXT: 1: (CXXConstructExpr, B)
// CHECK-NEXT: 2: B b;
// CHECK-NEXT: 3: [B2.2] (Lifetime ends)
// CHECK-NEXT: T: goto label;

View File

@ -12,12 +12,12 @@ struct B {};
void foo(unsigned int unsignedInt, unsigned int readSize) {
// Verify the checker is working as expected.
A* a = static_cast<A*>(malloc(sizeof(int))); // expected-warning {{Result of 'malloc' is converted to a pointer of type 'struct A', which is incompatible with sizeof operand type 'int'}}
A* a = static_cast<A*>(malloc(sizeof(int))); // expected-warning {{Result of 'malloc' is converted to a pointer of type 'A', which is incompatible with sizeof operand type 'int'}}
free(a);
}
void bar() {
A *x = static_cast<A*>(calloc(10, sizeof(void*))); // expected-warning {{Result of 'calloc' is converted to a pointer of type 'struct A', which is incompatible with sizeof operand type 'void *'}}
A *x = static_cast<A*>(calloc(10, sizeof(void*))); // expected-warning {{Result of 'calloc' is converted to a pointer of type 'A', which is incompatible with sizeof operand type 'void *'}}
// sizeof(void*) is compatible with any pointer.
A **y = static_cast<A**>(calloc(10, sizeof(void*))); // no-warning
free(x);

Some files were not shown because too many files have changed in this diff Show More