diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -6653,6 +6653,9 @@ def warn_taking_address_of_packed_member : Warning< "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">, InGroup>; +def warn_param_mismatched_alignment : Warning< + "passing %0-byte aligned argument to %1-byte aligned parameter %2 of %3 may result in an unaligned pointer access">, + InGroup>; def err_objc_object_assignment : Error< "cannot assign to class object (%0 invalid)">; diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -5985,9 +5985,9 @@ ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl); bool CompleteConstructorCall(CXXConstructorDecl *Constructor, - MultiExprArg ArgsPtr, + QualType DeclInitType, MultiExprArg ArgsPtr, SourceLocation Loc, - SmallVectorImpl &ConvertedArgs, + SmallVectorImpl &ConvertedArgs, bool AllowExplicit = false, bool IsListInitialization = false); @@ -12352,10 +12352,12 @@ bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall, const FunctionProtoType *Proto); bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto); - void CheckConstructorCall(FunctionDecl *FDecl, + void CheckConstructorCall(FunctionDecl *FDecl, QualType ThisType, ArrayRef Args, - const FunctionProtoType *Proto, - SourceLocation Loc); + const FunctionProtoType *Proto, SourceLocation Loc); + + void CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl, + StringRef ParamName, QualType ArgTy, QualType ParamTy); void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, const Expr *ThisArg, ArrayRef Args, diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -4468,6 +4468,43 @@ } } +/// Warn if a pointer or reference argument passed to a function points to an +/// object that is less aligned than the parameter. This can happen when +/// creating a typedef with a lower alignment than the original type and then +/// calling functions defined in terms of the original type. +void Sema::CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl, + StringRef ParamName, QualType ArgTy, + QualType ParamTy) { + + // If a function accepts a pointer or reference type + if (!ParamTy->isPointerType() && !ParamTy->isReferenceType()) + return; + + // If the parameter is a pointer type, get the pointee type for the + // argument too. If the parameter is a reference type, don't try to get + // the pointee type for the argument. + if (ParamTy->isPointerType()) + ArgTy = ArgTy->getPointeeType(); + + // Remove reference or pointer + ParamTy = ParamTy->getPointeeType(); + + // Find expected alignment, and the actual alignment of the passed object. + // getTypeAlignInChars requires complete types + if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType()) + return; + + CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy); + CharUnits ArgAlign = Context.getTypeAlignInChars(ArgTy); + + // If the argument is less aligned than the parameter, there is a + // potential alignment issue. + if (ArgAlign < ParamAlign) + Diag(Loc, diag::warn_param_mismatched_alignment) + << (int)ArgAlign.getQuantity() << (int)ParamAlign.getQuantity() + << ParamName << FDecl; +}; + /// Handles the checks for format strings, non-POD arguments to vararg /// functions, NULL arguments passed to non-NULL parameters, and diagnose_if /// attributes. @@ -4522,6 +4559,28 @@ } } + // Check that passed arguments match the alignment of original arguments. + // Try to get the missing prototype from the declaration. + if (!Proto && FDecl) { + const auto *FT = FDecl->getFunctionType(); + if (isa_and_nonnull(FT)) + Proto = cast(FDecl->getFunctionType()); + } + if (Proto) { + // For variadic functions, we may have more args than parameters. + // For some K&R functions, we may have less args than parameters. + const auto N = std::min(Proto->getNumParams(), Args.size()); + for (unsigned ArgIdx = 0; ArgIdx < N; ++ArgIdx) { + // Args[ArgIdx] can be null in malformed code. + if (const Expr *Arg = Args[ArgIdx]) { + QualType ParamTy = Proto->getParamType(ArgIdx); + QualType ArgTy = Arg->getType(); + CheckArgAlignment(Arg->getExprLoc(), FDecl, std::to_string(ArgIdx + 1), + ArgTy, ParamTy); + } + } + } + if (FDecl && FDecl->hasAttr()) { auto *AA = FDecl->getAttr(); const Expr *Arg = Args[AA->getParamIndex().getASTIndex()]; @@ -4546,12 +4605,17 @@ /// CheckConstructorCall - Check a constructor call for correctness and safety /// properties not enforced by the C type system. -void Sema::CheckConstructorCall(FunctionDecl *FDecl, +void Sema::CheckConstructorCall(FunctionDecl *FDecl, QualType ThisType, ArrayRef Args, const FunctionProtoType *Proto, SourceLocation Loc) { VariadicCallType CallType = - Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply; + Proto->isVariadic() ? VariadicConstructor : VariadicDoesNotApply; + + auto *Ctor = cast(FDecl); + CheckArgAlignment(Loc, FDecl, "'this'", Context.getPointerType(ThisType), + Context.getPointerType(Ctor->getThisObjectType())); + checkCall(FDecl, Proto, /*ThisArg=*/nullptr, Args, /*IsMemberFunction=*/true, Loc, SourceRange(), CallType); } @@ -4581,6 +4645,22 @@ ImplicitThis = cast(TheCall)->getImplicitObjectArgument(); + if (ImplicitThis) { + // ImplicitThis may or may not be a pointer, depending on whether . or -> is + // used. + QualType ThisType = ImplicitThis->getType(); + if (!ThisType->isPointerType()) { + assert(!ThisType->isReferenceType()); + ThisType = Context.getPointerType(ThisType); + } + + QualType ThisTypeFromDecl = + Context.getPointerType(cast(FDecl)->getThisObjectType()); + + CheckArgAlignment(TheCall->getRParenLoc(), FDecl, "'this'", ThisType, + ThisTypeFromDecl); + } + checkCall(FDecl, Proto, ImplicitThis, llvm::makeArrayRef(Args, NumArgs), IsMemberFunction, TheCall->getRParenLoc(), TheCall->getCallee()->getSourceRange(), CallType); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -15213,13 +15213,12 @@ /// to form a proper call to this constructor. /// /// \returns true if an error occurred, false otherwise. -bool -Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, - MultiExprArg ArgsPtr, - SourceLocation Loc, - SmallVectorImpl &ConvertedArgs, - bool AllowExplicit, - bool IsListInitialization) { +bool Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor, + QualType DeclInitType, MultiExprArg ArgsPtr, + SourceLocation Loc, + SmallVectorImpl &ConvertedArgs, + bool AllowExplicit, + bool IsListInitialization) { // FIXME: This duplicates a lot of code from Sema::ConvertArgumentsForCall. unsigned NumArgs = ArgsPtr.size(); Expr **Args = ArgsPtr.data(); @@ -15246,7 +15245,7 @@ DiagnoseSentinelCalls(Constructor, Loc, AllArgs); - CheckConstructorCall(Constructor, + CheckConstructorCall(Constructor, DeclInitType, llvm::makeArrayRef(AllArgs.data(), AllArgs.size()), Proto, Loc); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3949,7 +3949,8 @@ diag::err_allocation_of_abstract_type)) return ExprError(); - if (S.CompleteConstructorCall(Constructor, From, CastLoc, ConstructorArgs)) + if (S.CompleteConstructorCall(Constructor, Ty, From, CastLoc, + ConstructorArgs)) return ExprError(); S.CheckConstructorAccess(CastLoc, Constructor, FoundDecl, @@ -4117,9 +4118,9 @@ assert(!ToType->isReferenceType()); if (SCS.Second == ICK_Derived_To_Base) { SmallVector ConstructorArgs; - if (CompleteConstructorCall(cast(SCS.CopyConstructor), - From, /*FIXME:ConstructLoc*/SourceLocation(), - ConstructorArgs)) + if (CompleteConstructorCall( + cast(SCS.CopyConstructor), ToType, From, + /*FIXME:ConstructLoc*/ SourceLocation(), ConstructorArgs)) return ExprError(); return BuildCXXConstructExpr( /*FIXME:ConstructLoc*/ SourceLocation(), ToType, diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -6319,7 +6319,8 @@ // Determine the arguments required to actually perform the // constructor call (we might have derived-to-base conversions, or // the copy constructor may have default arguments). - if (S.CompleteConstructorCall(Constructor, CurInitExpr, Loc, ConstructorArgs)) + if (S.CompleteConstructorCall(Constructor, T, CurInitExpr, Loc, + ConstructorArgs)) return ExprError(); // C++0x [class.copy]p32: @@ -6516,13 +6517,11 @@ // Determine the arguments required to actually perform the constructor // call. - if (S.CompleteConstructorCall(Constructor, Args, - Loc, ConstructorArgs, - AllowExplicitConv, + if (S.CompleteConstructorCall(Constructor, Step.Type, Args, Loc, + ConstructorArgs, AllowExplicitConv, IsListInitialization)) return ExprError(); - if (isExplicitTemporary(Entity, Kind, NumArgs)) { // An explicitly-constructed temporary, e.g., X(1, 2). if (S.DiagnoseUseOfDecl(Constructor, Loc)) @@ -8299,9 +8298,9 @@ // Determine the arguments required to actually perform the constructor // call. Expr *Arg = CurInit.get(); - if (S.CompleteConstructorCall(Constructor, - MultiExprArg(&Arg, 1), - Loc, ConstructorArgs)) + if (S.CompleteConstructorCall(Constructor, Step->Type, + MultiExprArg(&Arg, 1), Loc, + ConstructorArgs)) return ExprError(); // Build an expression that constructs a temporary. diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -13715,6 +13715,15 @@ if (Op == OO_Equal) DiagnoseSelfMove(Args[0], Args[1], OpLoc); + if (ImplicitThis) { + QualType ThisType = Context.getPointerType(ImplicitThis->getType()); + QualType ThisTypeFromDecl = Context.getPointerType( + cast(FnDecl)->getThisObjectType()); + + CheckArgAlignment(OpLoc, FnDecl, "'this'", ThisType, + ThisTypeFromDecl); + } + checkCall(FnDecl, nullptr, ImplicitThis, ArgsArray, isa(FnDecl), OpLoc, TheCall->getSourceRange(), VariadicDoesNotApply); diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -3136,8 +3136,9 @@ if (Constructor->isInheritingConstructor()) FoundCtor = Constructor->getInheritedConstructor().getConstructor(); - SmallVector ConvertedArgs; - if (getSema().CompleteConstructorCall(FoundCtor, Args, Loc, ConvertedArgs)) + SmallVector ConvertedArgs; + if (getSema().CompleteConstructorCall(FoundCtor, T, Args, Loc, + ConvertedArgs)) return ExprError(); return getSema().BuildCXXConstructExpr(Loc, T, Constructor, diff --git a/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp b/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/typedef_alignment_mismatch_warning.cpp @@ -0,0 +1,282 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -fdata-sections -fcolor-diagnostics + +// Warn for any function that +// * takes a pointer or a reference to an object (including "this" pointer), +// * that was defined for aligned object, +// * but is called with a pointer or reference to a less aligned object. +// Attributes on using declarations are ignored. + +typedef __attribute__((aligned(2))) int Aligned2Int; +typedef __attribute__((aligned(8))) int Aligned8Int; + +// Normal function calls +void f_takes_val(int i) {} +void f_takes_ptr(int *p) {} +void f_takes_ref(int &p) {} + +void test0() { + Aligned2Int xwarn; + Aligned8Int xok; + f_takes_val(xwarn); + f_takes_ptr(&xwarn); // expected-warning {{passing 2-byte aligned argument to 4-byte aligned parameter 1 of 'f_takes_ptr' may result in an unaligned pointer access}} + f_takes_ref(xwarn); // expected-warning {{passing 2-byte aligned argument to 4-byte aligned parameter 1 of 'f_takes_ref' may result in an unaligned pointer access}} + f_takes_val(xok); + f_takes_ptr(&xok); + f_takes_ref(xok); +} + +// Constructor expects to work on an 8 byte aligned type, but is called on a (potentially) 4 byte aligned object. +void test1() { + struct StructAligned8 { + Aligned8Int Aligned8Member; + StructAligned8(int whatever) : Aligned8Member(whatever) {} + }; + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + StructAligned8 SA8(11); + TypedefAligned4 TA4(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + UsingAligned4 UA4(11); +} + +// Same as above, should still trigger since passing by value is irrelevant +void test1_byvalue() { + struct StructAligned8 { + int __attribute__((aligned(8))) Aligned8Member; + int Irrelevant; + StructAligned8(Aligned8Int arg) : Aligned8Member(arg) {} + }; + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + Aligned8Int o{0}; + StructAligned8 SA8(o); + TypedefAligned4 TA4(o); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + UsingAligned4 UA4(o); +} + +// This example uses a function call trigger +void test2() { + struct StructAligned8 { + int __attribute__((aligned(8))) Aligned8Member; + int Irrelevant; + }; + auto assignment_function = [](StructAligned8 &S, Aligned8Int arg) { + S.Aligned8Member = arg; + }; + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + StructAligned8 SA8; + TypedefAligned4 TA4; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + assignment_function(TA4, 11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator()' may result in an unaligned pointer access}} + UsingAligned4 UA4; + assignment_function(UA4, 11); +} + +// Same as above, but should not trigger as passed by value +void test2_byvalue() { + struct StructAligned8 { + int __attribute__((aligned(8))) Aligned8Member; + int Irrelevant; + }; + auto assignment_function = [](StructAligned8 S, Aligned8Int arg) { + S.Aligned8Member = arg; + }; + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + Aligned8Int o{0}; + StructAligned8 SA8; + TypedefAligned4 TA4; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + assignment_function(TA4, o); + UsingAligned4 UA4; + assignment_function(UA4, o); +} + +void test4() { + struct StructWithPackedMember { + int PackedMember __attribute__((packed)); + } SWPM; + + // Explicitly taking the address of an unaligned member causes a warning + (void)&SWPM.PackedMember; // expected-warning {{taking address of packed member 'PackedMember' of class or structure 'StructWithPackedMember' may result in an unaligned pointer value}} +} + +// Aligned attribute on struct itself +void test5() { + struct __attribute__((aligned(8))) StructAligned8 { + int Aligned8Member; + int Irrelevant; + StructAligned8(int i) : Aligned8Member(i) {} + }; + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + StructAligned8 SA8(11); + TypedefAligned4 TA4(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + UsingAligned4 UA4(11); +} + +// Via function pointer +void test6() { + struct __attribute__((aligned(8))) StructAligned8 { + int Aligned8Member; + StructAligned8(int i) : Aligned8Member(i) {} + }; + + auto assignment_function_ref = [](StructAligned8 &S) { + S.Aligned8Member = 42; + }; + auto assignment_function_ptr = [](StructAligned8 *S) { + S->Aligned8Member = 42; + }; + + void (*RefFnPtr)(StructAligned8 &) = assignment_function_ref; + void (*PtrFnPtr)(StructAligned8 *) = assignment_function_ptr; + + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + StructAligned8 SA8(11); + RefFnPtr(SA8); + PtrFnPtr(&SA8); + TypedefAligned4 TA4(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + RefFnPtr(TA4); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'RefFnPtr' may result in an unaligned pointer access}} + PtrFnPtr(&TA4); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'PtrFnPtr' may result in an unaligned pointer access}} + UsingAligned4 UA4(11); + RefFnPtr(UA4); + PtrFnPtr(&UA4); +} + +// Member function +void test7() { + struct __attribute__((aligned(8))) StructAligned8 { + int Aligned8Member; + StructAligned8(int i) : Aligned8Member(i) {} + void memberFnAssignment() { + Aligned8Member = 42; + } + }; + + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + StructAligned8 SA8(11); + SA8.memberFnAssignment(); + TypedefAligned4 TA4(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + TA4.memberFnAssignment(); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'memberFnAssignment' may result in an unaligned pointer access}} + UsingAligned4 UA4(11); + UA4.memberFnAssignment(); + + // Check access through pointer + StructAligned8 *SA8ptr; + SA8ptr->memberFnAssignment(); + TypedefAligned4 *TA4ptr; + TA4ptr->memberFnAssignment(); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'memberFnAssignment' may result in an unaligned pointer access}} + UsingAligned4 *UA4ptr; + UA4ptr->memberFnAssignment(); +} + +// Member binary and unary operator +void test8() { + struct __attribute__((aligned(8))) StructAligned8 { + int Aligned8Member; + StructAligned8(int i) : Aligned8Member(i) {} + StructAligned8 operator+(StructAligned8 &other) { + return {other.Aligned8Member + Aligned8Member}; + } + StructAligned8 operator-(StructAligned8 *other) { + return {other->Aligned8Member + Aligned8Member}; + } + StructAligned8 &operator++() { + Aligned8Member++; + return *this; + } + StructAligned8 &operator--() { + Aligned8Member--; + return *this; + } + }; + + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + StructAligned8 SA8a(11); + StructAligned8 SA8b(11); + auto SA8c = SA8a + SA8b; + auto SA8d = SA8a - &SA8b; + ++SA8c; + --SA8d; + TypedefAligned4 TA8a(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + TypedefAligned4 TA8b(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + TypedefAligned4 TA8c = TA8a + TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator+' may result in an unaligned pointer access}} + // expected-warning@-1 {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator+' may result in an unaligned pointer access}} + // expected-warning@-2 {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + TypedefAligned4 TA8d = TA8a - &TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator-' may result in an unaligned pointer access}} + // expected-warning@-1 {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator-' may result in an unaligned pointer access}} + // expected-warning@-2 {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + ++TA8d; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator++' may result in an unaligned pointer access}} + --TA8c; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator--' may result in an unaligned pointer access}} + UsingAligned4 UA8a(11); + UsingAligned4 UA8b(11); + auto UA8c = UA8a + UA8b; + auto UA8d = UA8a - &UA8b; + ++UA8c; + --UA8d; + + // Bonus + auto bonus1 = TA8a + SA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator+' may result in an unaligned pointer access}} + auto bonus2 = SA8a + TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator+' may result in an unaligned pointer access}} + auto bonus3 = TA8a - &SA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'operator-' may result in an unaligned pointer access}} + auto bonus4 = SA8a - &TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator-' may result in an unaligned pointer access}} +} + +// Static binary operator +struct __attribute__((aligned(8))) test9Struct { + int Aligned8Member; + test9Struct(int i) : Aligned8Member(i) {} +}; +test9Struct operator+(test9Struct &a, test9Struct &b) { + return {a.Aligned8Member + b.Aligned8Member}; +} +void test9() { + + typedef __attribute__((aligned(4))) test9Struct TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) test9Struct; + + test9Struct SA8a(11); + test9Struct SA8b(11); + auto SA8c = SA8a + SA8b; + TypedefAligned4 TA8a(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'test9Struct' may result in an unaligned pointer access}} + TypedefAligned4 TA8b(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'test9Struct' may result in an unaligned pointer access}} + auto TA8c = TA8a + TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator+' may result in an unaligned pointer access}} + // expected-warning@-1 {{passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'operator+' may result in an unaligned pointer access}} + UsingAligned4 UA8a(11); + UsingAligned4 UA8b(11); + auto UA8c = UA8a + UA8b; + + // Bonus + auto bonus1 = TA8a + SA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'operator+' may result in an unaligned pointer access}} + auto bonus2 = SA8a + TA8b; // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'operator+' may result in an unaligned pointer access}} +} + +// Operator new and placement new +void test10() { + struct __attribute__((aligned(8))) StructAligned8 { + int Aligned8Member; + StructAligned8(int i) : Aligned8Member(i) {} + void *operator new(unsigned long long count) { return (void *)0x123456; } + void *operator new(unsigned long long count, void *p) { return p; } + }; + + typedef __attribute__((aligned(4))) StructAligned8 TypedefAligned4; + using UsingAligned4 = __attribute__((aligned(4))) StructAligned8; + + auto *SA8ptr = new StructAligned8(11); + new (SA8ptr) StructAligned8(12); + auto *TA4ptr = new TypedefAligned4(11); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + new (TA4ptr) TypedefAligned4(12); // expected-warning {{passing 4-byte aligned argument to 8-byte aligned parameter 'this' of 'StructAligned8' may result in an unaligned pointer access}} + auto *UA4ptr = new UsingAligned4(11); + new (UA4ptr) UsingAligned4(12); +} diff --git a/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp b/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp --- a/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp +++ b/clang/test/Layout/ms-x86-alias-avoidance-padding.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); __declspec(align(4096)) char buffer[4096]; @@ -45,15 +45,7 @@ } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AT3 +// CHECK-LABEL: 0 | struct AT3{{$}} // CHECK-NEXT: 0 | struct AT2 (base) // CHECK-NEXT: 0 | struct AT0 t // CHECK-NEXT: 0 | union AT0::(unnamed at {{.*}} x @@ -70,15 +62,7 @@ // CHECK-NEXT: 24 | int a // CHECK-NEXT: | [sizeof=28, align=4 // CHECK-NEXT: | nvsize=28, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AT3 +// CHECK-X64-LABEL: 0 | struct AT3{{$}} // CHECK-X64-NEXT: 0 | struct AT2 (base) // CHECK-X64-NEXT: 0 | struct AT0 t // CHECK-X64-NEXT: 0 | union AT0::(unnamed at {{.*}} x @@ -116,20 +100,14 @@ } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct BT3 +// CHECK-LABEL: 0 | struct BT3{{$}} // CHECK-NEXT: 0 | struct BT0 (base) (empty) // CHECK-NEXT: 1 | struct BT2 (base) // CHECK-NEXT: 1 | struct BT0 (base) (empty) // CHECK-NEXT: 1 | char BT2FieldName0 // CHECK-NEXT: | [sizeof=2, align=1 // CHECK-NEXT: | nvsize=2, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct BT3 +// CHECK-X64-LABEL: 0 | struct BT3{{$}} // CHECK-X64-NEXT: 0 | struct BT0 (base) (empty) // CHECK-X64-NEXT: 1 | struct BT2 (base) // CHECK-X64-NEXT: 1 | struct BT0 (base) (empty) @@ -165,11 +143,7 @@ } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct T3 +// CHECK-LABEL: 0 | struct T3{{$}} // CHECK-NEXT: 0 | (T3 vbtable pointer) // CHECK-NEXT: 4 | struct T1 (virtual base) // CHECK-NEXT: 4 | struct T0 (base) (empty) @@ -180,11 +154,7 @@ // CHECK-NEXT: 12 | char a // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct T3 +// CHECK-X64-LABEL: 0 | struct T3{{$}} // CHECK-X64-NEXT: 0 | (T3 vbtable pointer) // CHECK-X64-NEXT: 8 | struct T1 (virtual base) // CHECK-X64-NEXT: 8 | struct T0 (base) (empty) @@ -200,11 +170,7 @@ struct C { int a; }; struct D : B, virtual C { B b; }; struct E : D, B {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E{{$}} // CHECK-NEXT: 0 | struct D (base) // CHECK-NEXT: 4 | struct B (base) (empty) // CHECK-NEXT: 0 | (D vbtable pointer) @@ -214,11 +180,7 @@ // CHECK-NEXT: 8 | int a // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct E +// CHECK-X64-LABEL: 0 | struct E{{$}} // CHECK-X64-NEXT: 0 | struct D (base) // CHECK-X64-NEXT: 8 | struct B (base) (empty) // CHECK-X64-NEXT: 0 | (D vbtable pointer) @@ -230,8 +192,7 @@ // CHECK-X64-NEXT: | nvsize=16, nvalign=8] struct F : virtual D, virtual B {}; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F{{$}} // CHECK-NEXT: 0 | (F vbtable pointer) // CHECK-NEXT: 4 | struct C (virtual base) // CHECK-NEXT: 4 | int a @@ -242,8 +203,7 @@ // CHECK: 16 | struct B (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F +// CHECK-X64-LABEL: 0 | struct F{{$}} // CHECK-X64-NEXT: 0 | (F vbtable pointer) // CHECK-X64-NEXT: 8 | struct C (virtual base) // CHECK-X64-NEXT: 8 | int a @@ -269,11 +229,7 @@ JC4() { printf("JC4 : %d\n", (int)((char*)this - buffer)); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct JC4 +// CHECK-LABEL: 0 | struct JC4{{$}} // CHECK-NEXT: 0 | struct JC1 (primary base) // CHECK-NEXT: 0 | (JC1 vftable pointer) // CHECK-NEXT: 4 | struct JC0 (base) (empty) @@ -283,11 +239,7 @@ // CHECK-NEXT: 12 | struct JC0 (base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct JC4 +// CHECK-X64-LABEL: 0 | struct JC4{{$}} // CHECK-X64-NEXT: 0 | struct JC1 (primary base) // CHECK-X64-NEXT: 0 | (JC1 vftable pointer) // CHECK-X64-NEXT: 8 | struct JC0 (base) (empty) @@ -314,12 +266,7 @@ struct RX8 : RA, virtual RW {}; struct RZ0 : RX0, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ0 +// CHECK-LABEL: 0 | struct RZ0{{$}} // CHECK-NEXT: 0 | struct RX0 (base) // CHECK-NEXT: 0 | struct RB (base) // CHECK-NEXT: 0 | char c @@ -327,12 +274,7 @@ // CHECK-NEXT: 2 | struct RY (base) (empty) // CHECK-NEXT: | [sizeof=2, align=1 // CHECK-NEXT: | nvsize=2, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ0 +// CHECK-X64-LABEL: 0 | struct RZ0{{$}} // CHECK-X64-NEXT: 0 | struct RX0 (base) // CHECK-X64-NEXT: 0 | struct RB (base) // CHECK-X64-NEXT: 0 | char c @@ -342,9 +284,7 @@ // CHECK-X64-NEXT: | nvsize=2, nvalign=1] struct RZ1 : RX1, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ1 +// CHECK-LABEL: 0 | struct RZ1{{$}} // CHECK-NEXT: 0 | struct RX1 (base) // CHECK-NEXT: 0 | struct RA (base) (empty) // CHECK-NEXT: 0 | struct RB (base) @@ -352,9 +292,7 @@ // CHECK-NEXT: 1 | struct RY (base) (empty) // CHECK-NEXT: | [sizeof=1, align=1 // CHECK-NEXT: | nvsize=1, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ1 +// CHECK-X64-LABEL: 0 | struct RZ1{{$}} // CHECK-X64-NEXT: 0 | struct RX1 (base) // CHECK-X64-NEXT: 0 | struct RA (base) (empty) // CHECK-X64-NEXT: 0 | struct RB (base) @@ -364,18 +302,14 @@ // CHECK-X64-NEXT: | nvsize=1, nvalign=1] struct RZ2 : RX2, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ2 +// CHECK-LABEL: 0 | struct RZ2{{$}} // CHECK-NEXT: 0 | struct RX2 (base) // CHECK-NEXT: 0 | struct RA (base) (empty) // CHECK-NEXT: 0 | char a // CHECK-NEXT: 2 | struct RY (base) (empty) // CHECK-NEXT: | [sizeof=2, align=1 // CHECK-NEXT: | nvsize=2, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ2 +// CHECK-X64-LABEL: 0 | struct RZ2{{$}} // CHECK-X64-NEXT: 0 | struct RX2 (base) // CHECK-X64-NEXT: 0 | struct RA (base) (empty) // CHECK-X64-NEXT: 0 | char a @@ -384,9 +318,7 @@ // CHECK-X64-NEXT: | nvsize=2, nvalign=1] struct RZ3 : RX3, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ3 +// CHECK-LABEL: 0 | struct RZ3{{$}} // CHECK-NEXT: 0 | struct RX3 (base) // CHECK-NEXT: 0 | struct RA (base) (empty) // CHECK-NEXT: 0 | struct RB a @@ -394,9 +326,7 @@ // CHECK-NEXT: 1 | struct RY (base) (empty) // CHECK-NEXT: | [sizeof=1, align=1 // CHECK-NEXT: | nvsize=1, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ3 +// CHECK-X64-LABEL: 0 | struct RZ3{{$}} // CHECK-X64-NEXT: 0 | struct RX3 (base) // CHECK-X64-NEXT: 0 | struct RA (base) (empty) // CHECK-X64-NEXT: 0 | struct RB a @@ -406,18 +336,14 @@ // CHECK-X64-NEXT: | nvsize=1, nvalign=1] struct RZ4 : RX4, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ4 +// CHECK-LABEL: 0 | struct RZ4{{$}} // CHECK-NEXT: 0 | struct RX4 (base) // CHECK-NEXT: 0 | struct RA a (empty) // CHECK-NEXT: 1 | char b // CHECK-NEXT: 3 | struct RY (base) (empty) // CHECK-NEXT: | [sizeof=3, align=1 // CHECK-NEXT: | nvsize=3, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ4 +// CHECK-X64-LABEL: 0 | struct RZ4{{$}} // CHECK-X64-NEXT: 0 | struct RX4 (base) // CHECK-X64-NEXT: 0 | struct RA a (empty) // CHECK-X64-NEXT: 1 | char b @@ -426,9 +352,7 @@ // CHECK-X64-NEXT: | nvsize=3, nvalign=1] struct RZ5 : RX5, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ5 +// CHECK-LABEL: 0 | struct RZ5{{$}} // CHECK-NEXT: 0 | struct RX5 (base) // CHECK-NEXT: 0 | struct RA a (empty) // CHECK-NEXT: 1 | struct RB b @@ -436,9 +360,7 @@ // CHECK-NEXT: 2 | struct RY (base) (empty) // CHECK-NEXT: | [sizeof=2, align=1 // CHECK-NEXT: | nvsize=2, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ5 +// CHECK-X64-LABEL: 0 | struct RZ5{{$}} // CHECK-X64-NEXT: 0 | struct RX5 (base) // CHECK-X64-NEXT: 0 | struct RA a (empty) // CHECK-X64-NEXT: 1 | struct RB b @@ -448,10 +370,7 @@ // CHECK-X64-NEXT: | nvsize=2, nvalign=1] struct RZ6 : RX6, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ6 +// CHECK-LABEL: 0 | struct RZ6{{$}} // CHECK-NEXT: 0 | struct RX6 (base) // CHECK-NEXT: 0 | (RX6 vbtable pointer) // CHECK-NEXT: 4 | struct RB a @@ -460,10 +379,7 @@ // CHECK-NEXT: 12 | struct RV (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ6 +// CHECK-X64-LABEL: 0 | struct RZ6{{$}} // CHECK-X64-NEXT: 0 | struct RX6 (base) // CHECK-X64-NEXT: 0 | (RX6 vbtable pointer) // CHECK-X64-NEXT: 8 | struct RB a @@ -474,10 +390,7 @@ // CHECK-X64-NEXT: | nvsize=24, nvalign=8] struct RZ7 : RX7, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ7 +// CHECK-LABEL: 0 | struct RZ7{{$}} // CHECK-NEXT: 0 | struct RX7 (base) // CHECK-NEXT: 0 | (RX7 vbtable pointer) // CHECK-NEXT: 4 | struct RA a (empty) @@ -486,10 +399,7 @@ // CHECK-NEXT: 8 | char c // CHECK-NEXT: | [sizeof=9, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ7 +// CHECK-X64-LABEL: 0 | struct RZ7{{$}} // CHECK-X64-NEXT: 0 | struct RX7 (base) // CHECK-X64-NEXT: 0 | (RX7 vbtable pointer) // CHECK-X64-NEXT: 8 | struct RA a (empty) @@ -500,9 +410,7 @@ // CHECK-X64-NEXT: | nvsize=16, nvalign=8] struct RZ8 : RX8, RY {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RZ8 +// CHECK-LABEL: 0 | struct RZ8{{$}} // CHECK-NEXT: 0 | struct RX8 (base) // CHECK-NEXT: 4 | struct RA (base) (empty) // CHECK-NEXT: 0 | (RX8 vbtable pointer) @@ -511,9 +419,7 @@ // CHECK-NEXT: 4 | char c // CHECK-NEXT: | [sizeof=5, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RZ8 +// CHECK-X64-LABEL: 0 | struct RZ8{{$}} // CHECK-X64-NEXT: 0 | struct RX8 (base) // CHECK-X64-NEXT: 8 | struct RA (base) (empty) // CHECK-X64-NEXT: 0 | (RX8 vbtable pointer) @@ -528,11 +434,7 @@ struct JC : JA { virtual void f() {} }; struct JD : virtual JB, virtual JC { virtual void f() {} JD() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct JD +// CHECK-LABEL: 0 | struct JD{{$}} // CHECK-NEXT: 0 | (JD vbtable pointer) // CHECK-NEXT: 4 | struct JB (virtual base) (empty) // CHECK-NEXT: 4 | (vtordisp for vbase JC) @@ -541,11 +443,7 @@ // CHECK-NEXT: 12 | struct JA (base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct JD +// CHECK-X64-LABEL: 0 | struct JD{{$}} // CHECK-X64-NEXT: 0 | (JD vbtable pointer) // CHECK-X64-NEXT: 8 | struct JB (virtual base) (empty) // CHECK-X64-NEXT: 12 | (vtordisp for vbase JC) diff --git a/clang/test/Layout/ms-x86-aligned-tail-padding.cpp b/clang/test/Layout/ms-x86-aligned-tail-padding.cpp --- a/clang/test/Layout/ms-x86-aligned-tail-padding.cpp +++ b/clang/test/Layout/ms-x86-aligned-tail-padding.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -74,12 +74,7 @@ A() : a(0xf000000A) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A{{$}} // CHECK-NEXT: 0 | struct B1 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | struct B0 (base) @@ -92,12 +87,7 @@ // CHECK-NEXT: 64 | char a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct A +// CHECK-X64-LABEL: 0 | struct A{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 4 | struct B0 (base) @@ -116,8 +106,7 @@ B() : a(0xf000000B) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B{{$}} // CHECK-NEXT: 0 | struct B2 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 16 | struct B0 (base) @@ -130,8 +119,7 @@ // CHECK-NEXT: 64 | char a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct B +// CHECK-X64-LABEL: 0 | struct B{{$}} // CHECK-X64-NEXT: 0 | struct B2 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 16 | struct B0 (base) @@ -151,8 +139,7 @@ C() : a(0xf000000C), a1(0xf000000Cf000000Cll) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C{{$}} // CHECK-NEXT: 0 | struct B1 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | struct B0 (base) @@ -164,8 +151,7 @@ // CHECK-NEXT: 48 | char a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C +// CHECK-X64-LABEL: 0 | struct C{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 4 | struct B0 (base) @@ -183,8 +169,7 @@ D() : a(0xf000000D) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D{{$}} // CHECK-NEXT: 0 | struct B2 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 16 | struct B0 (base) @@ -195,8 +180,7 @@ // CHECK-NEXT: 48 | char a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D{{$}} // CHECK-X64-NEXT: 0 | struct B2 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 16 | struct B0 (base) @@ -213,9 +197,7 @@ E() : a(0xf000000E) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E{{$}} // CHECK-NEXT: 0 | struct B3 (base) // CHECK-NEXT: 0 | long long a1 // CHECK-NEXT: 8 | int a @@ -227,9 +209,7 @@ // CHECK-NEXT: 48 | char a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct E +// CHECK-X64-LABEL: 0 | struct E{{$}} // CHECK-X64-NEXT: 0 | struct B3 (base) // CHECK-X64-NEXT: 0 | long long a1 // CHECK-X64-NEXT: 8 | int a @@ -248,10 +228,7 @@ virtual void f() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F{{$}} // CHECK-NEXT: 0 | struct B0 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | (F vbtable pointer) @@ -262,10 +239,7 @@ // CHECK-NEXT: 128 | struct A16 (base) (empty) // CHECK-NEXT: | [sizeof=128, align=32 // CHECK-NEXT: | nvsize=48, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F +// CHECK-X64-LABEL: 0 | struct F{{$}} // CHECK-X64-NEXT: 0 | struct B0 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 8 | (F vbtable pointer) @@ -282,10 +256,7 @@ G() : a(0xf0000001) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct G +// CHECK-LABEL: 0 | struct G{{$}} // CHECK-NEXT: 0 | (G vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct V2 (virtual base) @@ -295,10 +266,7 @@ // CHECK-NEXT: 24 | int a // CHECK-NEXT: | [sizeof=28, align=8 // CHECK-NEXT: | nvsize=8, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct G +// CHECK-X64-LABEL: 0 | struct G{{$}} // CHECK-X64-NEXT: 0 | (G vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct V2 (virtual base) @@ -315,14 +283,12 @@ H() : a(0xf0000010), b(0xf0000010) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct H +// CHECK-LABEL: 0 | struct H{{$}} // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | int b // CHECK-NEXT: | [sizeof=16, align=16 // CHECK-NEXT: | nvsize=16, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct H +// CHECK-X64-LABEL: 0 | struct H{{$}} // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 4 | int b // CHECK-X64-NEXT: | [sizeof=16, align=16 @@ -334,15 +300,13 @@ I() : b(0xf0000010) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct I +// CHECK-LABEL: 0 | struct I{{$}} // CHECK-NEXT: 0 | struct B2 a // CHECK-NEXT: 0 | int a // CHECK: 16 | int b // CHECK-NEXT: | [sizeof=32, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct I +// CHECK-X64-LABEL: 0 | struct I{{$}} // CHECK-X64-NEXT: 0 | struct B2 a // CHECK-X64-NEXT: 0 | int a // CHECK-X64: 16 | int b @@ -356,12 +320,7 @@ virtual void g() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AX +// CHECK-LABEL: 0 | struct AX{{$}} // CHECK-NEXT: 0 | (AX vftable pointer) // CHECK-NEXT: 16 | struct B0X (base) // CHECK-NEXT: 16 | int a @@ -378,12 +337,7 @@ // CHECK-NEXT: 84 | int a // CHECK-NEXT: | [sizeof=96, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AX +// CHECK-X64-LABEL: 0 | struct AX{{$}} // CHECK-X64-NEXT: 0 | (AX vftable pointer) // CHECK-X64-NEXT: 16 | struct B0X (base) // CHECK-X64-NEXT: 16 | int a @@ -408,10 +362,7 @@ virtual void g() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct BX +// CHECK-LABEL: 0 | struct BX{{$}} // CHECK-NEXT: 0 | (BX vftable pointer) // CHECK-NEXT: 16 | struct B4X (base) // CHECK-NEXT: 16 | struct A16X (base) (empty) @@ -429,10 +380,7 @@ // CHECK-NEXT: 100 | int a // CHECK-NEXT: | [sizeof=112, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct BX +// CHECK-X64-LABEL: 0 | struct BX{{$}} // CHECK-X64-NEXT: 0 | (BX vftable pointer) // CHECK-X64-NEXT: 16 | struct B4X (base) // CHECK-X64-NEXT: 16 | struct A16X (base) (empty) @@ -458,9 +406,7 @@ virtual void g() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct CX +// CHECK-LABEL: 0 | struct CX{{$}} // CHECK-NEXT: 0 | (CX vftable pointer) // CHECK-NEXT: 16 | struct B5X (base) // CHECK-NEXT: 16 | (B5X vbtable pointer) @@ -478,9 +424,7 @@ // CHECK-NEXT: 68 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct CX +// CHECK-X64-LABEL: 0 | struct CX{{$}} // CHECK-X64-NEXT: 0 | (CX vftable pointer) // CHECK-X64-NEXT: 16 | struct B5X (base) // CHECK-X64-NEXT: 16 | (B5X vbtable pointer) @@ -505,14 +449,12 @@ virtual void f() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct DX +// CHECK-LABEL: 0 | struct DX{{$}} // CHECK-NEXT: 0 | (DX vftable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: | [sizeof=16, align=16 // CHECK-NEXT: | nvsize=8, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct DX +// CHECK-X64-LABEL: 0 | struct DX{{$}} // CHECK-X64-NEXT: 0 | (DX vftable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: | [sizeof=16, align=16 diff --git a/clang/test/Layout/ms-x86-basic-layout.cpp b/clang/test/Layout/ms-x86-basic-layout.cpp --- a/clang/test/Layout/ms-x86-basic-layout.cpp +++ b/clang/test/Layout/ms-x86-basic-layout.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -32,15 +32,125 @@ virtual void f() {printf("C16");} }; +struct TestF3 : A4, virtual C16 { + int a; + TestF3() : a(0xf00000f3) {} +}; + +// CHECK-LABEL: 0 | struct TestF3{{$}} +// CHECK-NEXT: 0 | struct A4 (base) +// CHECK-NEXT: 0 | int a +// CHECK-NEXT: 4 | (TestF3 vbtable pointer) +// CHECK-NEXT: 8 | int a +// CHECK-NEXT: 16 | struct C16 (virtual base) +// CHECK-NEXT: 16 | (C16 vftable pointer) +// CHECK-NEXT: 32 | int a +// CHECK-NEXT: | [sizeof=48, align=16 +// CHECK-NEXT: | nvsize=12, nvalign=16] +// CHECK-X64-LABEL: 0 | struct TestF3{{$}} +// CHECK-X64-NEXT: 0 | struct A4 (base) +// CHECK-X64-NEXT: 0 | int a +// CHECK-X64-NEXT: 8 | (TestF3 vbtable pointer) +// CHECK-X64-NEXT: 16 | int a +// CHECK-X64-NEXT: 32 | struct C16 (virtual base) +// CHECK-X64-NEXT: 32 | (C16 vftable pointer) +// CHECK-X64-NEXT: 48 | int a +// CHECK-X64-NEXT: | [sizeof=64, align=16 +// CHECK-X64-NEXT: | nvsize=24, nvalign=16] + +struct TestF7 : A4, virtual C16 { + int a; + TestF7() : a(0xf00000f7) {} + virtual void f() { printf("F7"); } +}; + +// CHECK-LABEL: 0 | struct TestF7{{$}} +// CHECK-NEXT: 0 | struct A4 (base) +// CHECK-NEXT: 0 | int a +// CHECK-NEXT: 4 | (TestF7 vbtable pointer) +// CHECK-NEXT: 8 | int a +// CHECK-NEXT: 28 | (vtordisp for vbase C16) +// CHECK-NEXT: 32 | struct C16 (virtual base) +// CHECK-NEXT: 32 | (C16 vftable pointer) +// CHECK-NEXT: 48 | int a +// CHECK-NEXT: | [sizeof=64, align=16 +// CHECK-NEXT: | nvsize=12, nvalign=16] +// CHECK-X64-LABEL: 0 | struct TestF7{{$}} +// CHECK-X64-NEXT: 0 | struct A4 (base) +// CHECK-X64-NEXT: 0 | int a +// CHECK-X64-NEXT: 8 | (TestF7 vbtable pointer) +// CHECK-X64-NEXT: 16 | int a +// CHECK-X64-NEXT: 44 | (vtordisp for vbase C16) +// CHECK-X64-NEXT: 48 | struct C16 (virtual base) +// CHECK-X64-NEXT: 48 | (C16 vftable pointer) +// CHECK-X64-NEXT: 64 | int a +// CHECK-X64-NEXT: | [sizeof=80, align=16 +// CHECK-X64-NEXT: | nvsize=24, nvalign=16] + +struct TestF9 : A4, virtual C16 { + int a; + TestF9() : a(0xf00000f9) {} + virtual void g() { printf("F9"); } +}; + +// CHECK-LABEL: 0 | struct TestF9{{$}} +// CHECK-NEXT: 0 | (TestF9 vftable pointer) +// CHECK-NEXT: 4 | struct A4 (base) +// CHECK-NEXT: 4 | int a +// CHECK-NEXT: 8 | (TestF9 vbtable pointer) +// CHECK-NEXT: 12 | int a +// CHECK-NEXT: 16 | struct C16 (virtual base) +// CHECK-NEXT: 16 | (C16 vftable pointer) +// CHECK-NEXT: 32 | int a +// CHECK-NEXT: | [sizeof=48, align=16 +// CHECK-NEXT: | nvsize=16, nvalign=16] +// CHECK-X64-LABEL: 0 | struct TestF9{{$}} +// CHECK-X64-NEXT: 0 | (TestF9 vftable pointer) +// CHECK-X64-NEXT: 8 | struct A4 (base) +// CHECK-X64-NEXT: 8 | int a +// CHECK-X64-NEXT: 16 | (TestF9 vbtable pointer) +// CHECK-X64-NEXT: 24 | int a +// CHECK-X64-NEXT: 32 | struct C16 (virtual base) +// CHECK-X64-NEXT: 32 | (C16 vftable pointer) +// CHECK-X64-NEXT: 48 | int a +// CHECK-X64-NEXT: | [sizeof=64, align=16 +// CHECK-X64-NEXT: | nvsize=32, nvalign=16] + +struct TestFB : A16, virtual C16 { + int a; + TestFB() : a(0xf00000fb) {} + virtual void g() { printf("Fb"); } +}; + +// CHECK-LABEL: 0 | struct TestFB{{$}} +// CHECK-NEXT: 0 | (TestFB vftable pointer) +// CHECK-NEXT: 16 | struct A16 (base) +// CHECK-NEXT: 16 | int a +// CHECK-NEXT: 32 | (TestFB vbtable pointer) +// CHECK-NEXT: 48 | int a +// CHECK-NEXT: 64 | struct C16 (virtual base) +// CHECK-NEXT: 64 | (C16 vftable pointer) +// CHECK-NEXT: 80 | int a +// CHECK-NEXT: | [sizeof=96, align=16 +// CHECK-NEXT: | nvsize=64, nvalign=16] +// CHECK-X64-LABEL: 0 | struct TestFB{{$}} +// CHECK-X64-NEXT: 0 | (TestFB vftable pointer) +// CHECK-X64-NEXT: 16 | struct A16 (base) +// CHECK-X64-NEXT: 16 | int a +// CHECK-X64-NEXT: 32 | (TestFB vbtable pointer) +// CHECK-X64-NEXT: 48 | int a +// CHECK-X64-NEXT: 64 | struct C16 (virtual base) +// CHECK-X64-NEXT: 64 | (C16 vftable pointer) +// CHECK-X64-NEXT: 80 | int a +// CHECK-X64-NEXT: | [sizeof=96, align=16 +// CHECK-X64-NEXT: | nvsize=64, nvalign=16] + struct TestF0 : A4, virtual B4 { int a; TestF0() : a(0xf00000F0) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF0 +// CHECK-LABEL: 0 | struct TestF0{{$}} // CHECK-NEXT: 0 | struct A4 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | (TestF0 vbtable pointer) @@ -49,10 +159,7 @@ // CHECK-NEXT: 12 | int a // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF0 +// CHECK-X64-LABEL: 0 | struct TestF0{{$}} // CHECK-X64-NEXT: 0 | struct A4 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 8 | (TestF0 vbtable pointer) @@ -67,9 +174,7 @@ TestF1() : a(0xf00000f1) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF1 +// CHECK-LABEL: 0 | struct TestF1{{$}} // CHECK-NEXT: 0 | struct A4 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | (TestF1 vbtable pointer) @@ -78,9 +183,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=32, align=16 // CHECK-NEXT: | nvsize=12, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF1 +// CHECK-X64-LABEL: 0 | struct TestF1{{$}} // CHECK-X64-NEXT: 0 | struct A4 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 8 | (TestF1 vbtable pointer) @@ -95,9 +198,7 @@ TestF2() : a(0xf00000f2) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF2 +// CHECK-LABEL: 0 | struct TestF2{{$}} // CHECK-NEXT: 0 | struct A4 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | (TestF2 vbtable pointer) @@ -107,9 +208,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF2 +// CHECK-X64-LABEL: 0 | struct TestF2{{$}} // CHECK-X64-NEXT: 0 | struct A4 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 8 | (TestF2 vbtable pointer) @@ -120,43 +219,12 @@ // CHECK-X64-NEXT: | [sizeof=40, align=8 // CHECK-X64-NEXT: | nvsize=24, nvalign=8] -struct TestF3 : A4, virtual C16 { - int a; - TestF3() : a(0xf00000f3) {} -}; - -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF3 -// CHECK-NEXT: 0 | struct A4 (base) -// CHECK-NEXT: 0 | int a -// CHECK-NEXT: 4 | (TestF3 vbtable pointer) -// CHECK-NEXT: 8 | int a -// CHECK-NEXT: 16 | struct C16 (virtual base) -// CHECK-NEXT: 16 | (C16 vftable pointer) -// CHECK-NEXT: 32 | int a -// CHECK-NEXT: | [sizeof=48, align=16 -// CHECK-NEXT: | nvsize=12, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF3 -// CHECK-X64-NEXT: 0 | struct A4 (base) -// CHECK-X64-NEXT: 0 | int a -// CHECK-X64-NEXT: 8 | (TestF3 vbtable pointer) -// CHECK-X64-NEXT: 16 | int a -// CHECK-X64-NEXT: 32 | struct C16 (virtual base) -// CHECK-X64-NEXT: 32 | (C16 vftable pointer) -// CHECK-X64-NEXT: 48 | int a -// CHECK-X64-NEXT: | [sizeof=64, align=16 -// CHECK-X64-NEXT: | nvsize=24, nvalign=16] - struct TestF4 : TestF3, A4 { int a; TestF4() : a(0xf00000f4) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF4 +// CHECK-LABEL: 0 | struct TestF4{{$}} // CHECK-NEXT: 0 | struct TestF3 (base) // CHECK-NEXT: 0 | struct A4 (base) // CHECK-NEXT: 0 | int a @@ -170,8 +238,7 @@ // CHECK-NEXT: 48 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF4 +// CHECK-X64-LABEL: 0 | struct TestF4{{$}} // CHECK-X64-NEXT: 0 | struct TestF3 (base) // CHECK-X64-NEXT: 0 | struct A4 (base) // CHECK-X64-NEXT: 0 | int a @@ -192,8 +259,7 @@ virtual void g() {printf("F5");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF5 +// CHECK-LABEL: 0 | struct TestF5{{$}} // CHECK-NEXT: 0 | (TestF5 vftable pointer) // CHECK-NEXT: 16 | struct TestF3 (base) // CHECK-NEXT: 16 | struct A4 (base) @@ -208,8 +274,7 @@ // CHECK-NEXT: 64 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF5 +// CHECK-X64-LABEL: 0 | struct TestF5{{$}} // CHECK-X64-NEXT: 0 | (TestF5 vftable pointer) // CHECK-X64-NEXT: 16 | struct TestF3 (base) // CHECK-X64-NEXT: 16 | struct A4 (base) @@ -231,8 +296,7 @@ virtual void f() {printf("F6");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF6 +// CHECK-LABEL: 0 | struct TestF6{{$}} // CHECK-NEXT: 0 | struct TestF3 (base) // CHECK-NEXT: 0 | struct A4 (base) // CHECK-NEXT: 0 | int a @@ -247,8 +311,7 @@ // CHECK-NEXT: 64 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF6 +// CHECK-X64-LABEL: 0 | struct TestF6{{$}} // CHECK-X64-NEXT: 0 | struct TestF3 (base) // CHECK-X64-NEXT: 0 | struct A4 (base) // CHECK-X64-NEXT: 0 | int a @@ -264,45 +327,13 @@ // CHECK-X64-NEXT: | [sizeof=80, align=16 // CHECK-X64-NEXT: | nvsize=32, nvalign=16] -struct TestF7 : A4, virtual C16 { - int a; - TestF7() : a(0xf00000f7) {} - virtual void f() {printf("F7");} -}; - -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF7 -// CHECK-NEXT: 0 | struct A4 (base) -// CHECK-NEXT: 0 | int a -// CHECK-NEXT: 4 | (TestF7 vbtable pointer) -// CHECK-NEXT: 8 | int a -// CHECK-NEXT: 28 | (vtordisp for vbase C16) -// CHECK-NEXT: 32 | struct C16 (virtual base) -// CHECK-NEXT: 32 | (C16 vftable pointer) -// CHECK-NEXT: 48 | int a -// CHECK-NEXT: | [sizeof=64, align=16 -// CHECK-NEXT: | nvsize=12, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF7 -// CHECK-X64-NEXT: 0 | struct A4 (base) -// CHECK-X64-NEXT: 0 | int a -// CHECK-X64-NEXT: 8 | (TestF7 vbtable pointer) -// CHECK-X64-NEXT: 16 | int a -// CHECK-X64-NEXT: 44 | (vtordisp for vbase C16) -// CHECK-X64-NEXT: 48 | struct C16 (virtual base) -// CHECK-X64-NEXT: 48 | (C16 vftable pointer) -// CHECK-X64-NEXT: 64 | int a -// CHECK-X64-NEXT: | [sizeof=80, align=16 -// CHECK-X64-NEXT: | nvsize=24, nvalign=16] - struct TestF8 : TestF7, A4 { int a; TestF8() : a(0xf00000f8) {} virtual void f() {printf("F8");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF8 +// CHECK-LABEL: 0 | struct TestF8{{$}} // CHECK-NEXT: 0 | struct TestF7 (base) // CHECK-NEXT: 0 | struct A4 (base) // CHECK-NEXT: 0 | int a @@ -317,8 +348,7 @@ // CHECK-NEXT: 64 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF8 +// CHECK-X64-LABEL: 0 | struct TestF8{{$}} // CHECK-X64-NEXT: 0 | struct TestF7 (base) // CHECK-X64-NEXT: 0 | struct A4 (base) // CHECK-X64-NEXT: 0 | int a @@ -334,45 +364,13 @@ // CHECK-X64-NEXT: | [sizeof=80, align=16 // CHECK-X64-NEXT: | nvsize=32, nvalign=16] -struct TestF9 : A4, virtual C16 { - int a; - TestF9() : a(0xf00000f9) {} - virtual void g() {printf("F9");} -}; - -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestF9 -// CHECK-NEXT: 0 | (TestF9 vftable pointer) -// CHECK-NEXT: 4 | struct A4 (base) -// CHECK-NEXT: 4 | int a -// CHECK-NEXT: 8 | (TestF9 vbtable pointer) -// CHECK-NEXT: 12 | int a -// CHECK-NEXT: 16 | struct C16 (virtual base) -// CHECK-NEXT: 16 | (C16 vftable pointer) -// CHECK-NEXT: 32 | int a -// CHECK-NEXT: | [sizeof=48, align=16 -// CHECK-NEXT: | nvsize=16, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestF9 -// CHECK-X64-NEXT: 0 | (TestF9 vftable pointer) -// CHECK-X64-NEXT: 8 | struct A4 (base) -// CHECK-X64-NEXT: 8 | int a -// CHECK-X64-NEXT: 16 | (TestF9 vbtable pointer) -// CHECK-X64-NEXT: 24 | int a -// CHECK-X64-NEXT: 32 | struct C16 (virtual base) -// CHECK-X64-NEXT: 32 | (C16 vftable pointer) -// CHECK-X64-NEXT: 48 | int a -// CHECK-X64-NEXT: | [sizeof=64, align=16 -// CHECK-X64-NEXT: | nvsize=32, nvalign=16] - struct TestFA : TestF9, A4 { int a; TestFA() : a(0xf00000fa) {} virtual void g() {printf("FA");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestFA +// CHECK-LABEL: 0 | struct TestFA{{$}} // CHECK-NEXT: 0 | struct TestF9 (primary base) // CHECK-NEXT: 0 | (TestF9 vftable pointer) // CHECK-NEXT: 4 | struct A4 (base) @@ -387,8 +385,7 @@ // CHECK-NEXT: 48 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestFA +// CHECK-X64-LABEL: 0 | struct TestFA{{$}} // CHECK-X64-NEXT: 0 | struct TestF9 (primary base) // CHECK-X64-NEXT: 0 | (TestF9 vftable pointer) // CHECK-X64-NEXT: 8 | struct A4 (base) @@ -404,45 +401,13 @@ // CHECK-X64-NEXT: | [sizeof=80, align=16 // CHECK-X64-NEXT: | nvsize=48, nvalign=16] -struct TestFB : A16, virtual C16 { - int a; - TestFB() : a(0xf00000fb) {} - virtual void g() {printf("Fb");} -}; - -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestFB -// CHECK-NEXT: 0 | (TestFB vftable pointer) -// CHECK-NEXT: 16 | struct A16 (base) -// CHECK-NEXT: 16 | int a -// CHECK-NEXT: 32 | (TestFB vbtable pointer) -// CHECK-NEXT: 48 | int a -// CHECK-NEXT: 64 | struct C16 (virtual base) -// CHECK-NEXT: 64 | (C16 vftable pointer) -// CHECK-NEXT: 80 | int a -// CHECK-NEXT: | [sizeof=96, align=16 -// CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestFB -// CHECK-X64-NEXT: 0 | (TestFB vftable pointer) -// CHECK-X64-NEXT: 16 | struct A16 (base) -// CHECK-X64-NEXT: 16 | int a -// CHECK-X64-NEXT: 32 | (TestFB vbtable pointer) -// CHECK-X64-NEXT: 48 | int a -// CHECK-X64-NEXT: 64 | struct C16 (virtual base) -// CHECK-X64-NEXT: 64 | (C16 vftable pointer) -// CHECK-X64-NEXT: 80 | int a -// CHECK-X64-NEXT: | [sizeof=96, align=16 -// CHECK-X64-NEXT: | nvsize=64, nvalign=16] - struct TestFC : TestFB, A4 { int a; TestFC() : a(0xf00000fc) {} virtual void g() {printf("FC");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct TestFC +// CHECK-LABEL: 0 | struct TestFC{{$}} // CHECK-NEXT: 0 | struct TestFB (primary base) // CHECK-NEXT: 0 | (TestFB vftable pointer) // CHECK-NEXT: 16 | struct A16 (base) @@ -457,8 +422,7 @@ // CHECK-NEXT: 96 | int a // CHECK-NEXT: | [sizeof=112, align=16 // CHECK-NEXT: | nvsize=80, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct TestFC +// CHECK-X64-LABEL: 0 | struct TestFC{{$}} // CHECK-X64-NEXT: 0 | struct TestFB (primary base) // CHECK-X64-NEXT: 0 | (TestFB vftable pointer) // CHECK-X64-NEXT: 16 | struct A16 (base) @@ -474,7 +438,6 @@ // CHECK-X64-NEXT: | [sizeof=112, align=16 // CHECK-X64-NEXT: | nvsize=80, nvalign=16] - struct A16f { __declspec(align(16)) int a; A16f() : a(0xf0000a16) {} @@ -495,12 +458,7 @@ virtual void g() {printf("F0");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F0 +// CHECK-LABEL: 0 | struct F0{{$}} // CHECK-NEXT: 0 | (F0 vftable pointer) // CHECK-NEXT: 16 | struct A4 (base) // CHECK-NEXT: 16 | int a @@ -518,12 +476,7 @@ // CHECK-NEXT: 96 | int a // CHECK-NEXT: | [sizeof=112, align=16 // CHECK-NEXT: | nvsize=80, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F0 +// CHECK-X64-LABEL: 0 | struct F0{{$}} // CHECK-X64-NEXT: 0 | (F0 vftable pointer) // CHECK-X64-NEXT: 16 | struct A4 (base) // CHECK-X64-NEXT: 16 | int a @@ -548,8 +501,7 @@ virtual void g() {printf("F1");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F1 +// CHECK-LABEL: 0 | struct F1{{$}} // CHECK-NEXT: 0 | (F1 vftable pointer) // CHECK-NEXT: 16 | struct B (base) // CHECK-NEXT: 16 | struct A4 (base) @@ -567,8 +519,7 @@ // CHECK-NEXT: 80 | int a // CHECK-NEXT: | [sizeof=96, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F1 +// CHECK-X64-LABEL: 0 | struct F1{{$}} // CHECK-X64-NEXT: 0 | (F1 vftable pointer) // CHECK-X64-NEXT: 16 | struct B (base) // CHECK-X64-NEXT: 16 | struct A4 (base) @@ -593,8 +544,7 @@ virtual void g() {printf("F2");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F2 +// CHECK-LABEL: 0 | struct F2{{$}} // CHECK-NEXT: 0 | (F2 vftable pointer) // CHECK-NEXT: 4 | struct A4 (base) // CHECK-NEXT: 4 | int a @@ -605,8 +555,7 @@ // CHECK-NEXT: 32 | int a // CHECK-NEXT: | [sizeof=48, align=16 // CHECK-NEXT: | nvsize=16, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F2 +// CHECK-X64-LABEL: 0 | struct F2{{$}} // CHECK-X64-NEXT: 0 | (F2 vftable pointer) // CHECK-X64-NEXT: 8 | struct A4 (base) // CHECK-X64-NEXT: 8 | int a @@ -624,8 +573,7 @@ virtual void g() {printf("F3");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F3 +// CHECK-LABEL: 0 | struct F3{{$}} // CHECK-NEXT: 0 | (F3 vftable pointer) // CHECK-NEXT: 16 | struct A4 (base) // CHECK-NEXT: 16 | int a @@ -636,8 +584,7 @@ // CHECK-NEXT: 80 | int a // CHECK-NEXT: | [sizeof=96, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F3 +// CHECK-X64-LABEL: 0 | struct F3{{$}} // CHECK-X64-NEXT: 0 | (F3 vftable pointer) // CHECK-X64-NEXT: 16 | struct A4 (base) // CHECK-X64-NEXT: 16 | int a @@ -655,8 +602,7 @@ virtual void g() {printf("F4");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F4 +// CHECK-LABEL: 0 | struct F4{{$}} // CHECK-NEXT: 0 | (F4 vftable pointer) // CHECK-NEXT: 16 | struct A4 (base) // CHECK-NEXT: 16 | int a @@ -674,8 +620,7 @@ // CHECK-NEXT: 96 | int a // CHECK-NEXT: | [sizeof=112, align=16 // CHECK-NEXT: | nvsize=80, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F4 +// CHECK-X64-LABEL: 0 | struct F4{{$}} // CHECK-X64-NEXT: 0 | (F4 vftable pointer) // CHECK-X64-NEXT: 16 | struct A4 (base) // CHECK-X64-NEXT: 16 | int a @@ -700,8 +645,7 @@ virtual void g() {printf("F5");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F5 +// CHECK-LABEL: 0 | struct F5{{$}} // CHECK-NEXT: 0 | struct A16f (primary base) // CHECK-NEXT: 0 | (A16f vftable pointer) // CHECK-NEXT: 16 | int a @@ -711,8 +655,7 @@ // CHECK-NEXT: 64 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F5 +// CHECK-X64-LABEL: 0 | struct F5{{$}} // CHECK-X64-NEXT: 0 | struct A16f (primary base) // CHECK-X64-NEXT: 0 | (A16f vftable pointer) // CHECK-X64-NEXT: 16 | int a @@ -729,8 +672,7 @@ virtual void g() {printf("F6");} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F6 +// CHECK-LABEL: 0 | struct F6{{$}} // CHECK-NEXT: 0 | (F6 vftable pointer) // CHECK-NEXT: 4 | struct A4 (base) // CHECK-NEXT: 4 | int a @@ -749,8 +691,7 @@ // CHECK-NEXT: 68 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=16, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F6 +// CHECK-X64-LABEL: 0 | struct F6{{$}} // CHECK-X64-NEXT: 0 | (F6 vftable pointer) // CHECK-X64-NEXT: 8 | struct A4 (base) // CHECK-X64-NEXT: 8 | int a @@ -774,13 +715,11 @@ A4 InlineElts[2]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct ArrayFieldOfRecords +// CHECK-LABEL: 0 | struct ArrayFieldOfRecords{{$}} // CHECK-NEXT: 0 | struct A4 [2] InlineElts // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct ArrayFieldOfRecords +// CHECK-X64-LABEL: 0 | struct ArrayFieldOfRecords{{$}} // CHECK-X64-NEXT: 0 | struct A4 [2] InlineElts // CHECK-X64-NEXT: | [sizeof=8, align=4 // CHECK-X64-NEXT: | nvsize=8, nvalign=4] @@ -789,13 +728,11 @@ A4 InlineElts[2][2]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct ArrayOfArrayFieldOfRecords +// CHECK-LABEL: 0 | struct ArrayOfArrayFieldOfRecords{{$}} // CHECK-NEXT: 0 | struct A4 [2][2] InlineElts // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct ArrayOfArrayFieldOfRecords +// CHECK-X64-LABEL: 0 | struct ArrayOfArrayFieldOfRecords{{$}} // CHECK-X64-NEXT: 0 | struct A4 [2][2] InlineElts // CHECK-X64-NEXT: | [sizeof=16, align=4 // CHECK-X64-NEXT: | nvsize=16, nvalign=4] @@ -805,13 +742,11 @@ ArrayTy InlineElts[2]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RecordArrayTypedef +// CHECK-LABEL: 0 | struct RecordArrayTypedef{{$}} // CHECK-NEXT: 0 | RecordArrayTypedef::ArrayTy [2] InlineElts // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RecordArrayTypedef +// CHECK-X64-LABEL: 0 | struct RecordArrayTypedef{{$}} // CHECK-X64-NEXT: 0 | RecordArrayTypedef::ArrayTy [2] InlineElts // CHECK-X64-NEXT: | [sizeof=16, align=4 // CHECK-X64-NEXT: | nvsize=16, nvalign=4] @@ -820,13 +755,11 @@ int FlexArrayMemb[0]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct EmptyIntMemb +// CHECK-LABEL: 0 | struct EmptyIntMemb{{$}} // CHECK-NEXT: 0 | int [0] FlexArrayMemb // CHECK-NEXT: | [sizeof=1, align=4 // CHECK-NEXT: | nvsize=0, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct EmptyIntMemb +// CHECK-X64-LABEL: 0 | struct EmptyIntMemb{{$}} // CHECK-X64-NEXT: 0 | int [0] FlexArrayMemb // CHECK-X64-NEXT: | [sizeof=4, align=4 // CHECK-X64-NEXT: | nvsize=0, nvalign=4] @@ -835,13 +768,11 @@ long long FlexArrayMemb[0]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct EmptyLongLongMemb +// CHECK-LABEL: 0 | struct EmptyLongLongMemb{{$}} // CHECK-NEXT: 0 | long long [0] FlexArrayMemb // CHECK-NEXT: | [sizeof=1, align=8 // CHECK-NEXT: | nvsize=0, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct EmptyLongLongMemb +// CHECK-X64-LABEL: 0 | struct EmptyLongLongMemb{{$}} // CHECK-X64-NEXT: 0 | long long [0] FlexArrayMemb // CHECK-X64-NEXT: | [sizeof=8, align=8 // CHECK-X64-NEXT: | nvsize=0, nvalign=8] diff --git a/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp b/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp --- a/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp +++ b/clang/test/Layout/ms-x86-empty-nonvirtual-bases.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -22,9 +22,7 @@ A() : a(0xf000000A) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A{{$}} // CHECK-NEXT: 0 | struct B0 (base) (empty) // CHECK-NEXT: 0 | int a // CHECK-NEXT: | [sizeof=8, align=8 @@ -36,8 +34,7 @@ B() : a(0xf000000B) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B{{$}} // CHECK-NEXT: 0 | struct B0 (base) (empty) // CHECK-NEXT: 0 | struct B0 b0 (empty) // CHECK: 8 | int a @@ -49,12 +46,7 @@ C() : a(0xf000000C) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C{{$}} // CHECK-NEXT: 0 | struct B0 (base) (empty) // CHECK-NEXT: 8 | struct B1 (base) (empty) // CHECK-NEXT: 16 | struct B2 (base) (empty) @@ -74,11 +66,7 @@ D() : a(0xf000000D) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D{{$}} // CHECK-NEXT: 0 | struct B0 b0 (empty) // CHECK: 8 | struct C0 c0 // CHECK-NEXT: 8 | int a @@ -96,8 +84,7 @@ E() : a(0xf000000E) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E{{$}} // CHECK-NEXT: 0 | struct B0 (base) (empty) // CHECK-NEXT: 0 | struct C0 (base) // CHECK-NEXT: 0 | int a @@ -115,8 +102,7 @@ F() : a(0xf000000F) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F{{$}} // CHECK-NEXT: 0 | struct C0 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 8 | struct B0 (base) (empty) @@ -132,8 +118,7 @@ G() : a(0xf0000011) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct G +// CHECK-LABEL: 0 | struct G{{$}} // CHECK-NEXT: 0 | struct B0 (base) (empty) // CHECK-NEXT: 8 | struct B1 (base) (empty) // CHECK-NEXT: 16 | struct B2 (base) (empty) @@ -148,8 +133,7 @@ H() : a(0xf0000011) {printf("X : %p\n", this);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct H +// CHECK-LABEL: 0 | struct H{{$}} // CHECK-NEXT: 0 | struct B0 (base) (empty) // CHECK-NEXT: 8 | struct B1 (base) (empty) // CHECK-NEXT: 16 | struct B2 (base) (empty) @@ -163,8 +147,7 @@ int i0[0]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct I +// CHECK-LABEL: 0 | struct I{{$}} // CHECK-NEXT: 0 | int [0] i0 // CHECK-NEXT: | [sizeof={{1|4}}, align=4, // CHECK-NEXT: | nvsize=0, nvalign=4] @@ -173,8 +156,7 @@ int j; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct J +// CHECK-LABEL: 0 | struct J{{$}} // CHECK-NEXT: 0 | struct I (base) // CHECK-NEXT: 0 | int [0] i0 // CHECK-NEXT: 0 | int j diff --git a/clang/test/Layout/ms-x86-empty-virtual-base.cpp b/clang/test/Layout/ms-x86-empty-virtual-base.cpp --- a/clang/test/Layout/ms-x86-empty-virtual-base.cpp +++ b/clang/test/Layout/ms-x86-empty-virtual-base.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -26,17 +26,13 @@ A() : a(0xf000000A) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A{{$}} // CHECK-NEXT: 0 | (A vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=8, align=8 // CHECK-NEXT: | nvsize=8, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct A +// CHECK-X64-LABEL: 0 | struct A{{$}} // CHECK-X64-NEXT: 0 | (A vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty) @@ -49,16 +45,14 @@ B() : a(0xf000000B) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B{{$}} // CHECK-NEXT: 0 | (B vbtable pointer) // CHECK-NEXT: 8 | struct B0 b0 (empty) // CHECK: 16 | int a // CHECK-NEXT: 24 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=24, align=8 // CHECK-NEXT: | nvsize=24, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct B +// CHECK-X64-LABEL: 0 | struct B{{$}} // CHECK-X64-NEXT: 0 | (B vbtable pointer) // CHECK-X64-NEXT: 8 | struct B0 b0 (empty) // CHECK-X64: 16 | int a @@ -71,12 +65,7 @@ C() : a(0xf000000C) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C{{$}} // CHECK-NEXT: 0 | (C vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct B0 (virtual base) (empty) @@ -86,12 +75,7 @@ // CHECK-NEXT: 40 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=40, align=8 // CHECK-NEXT: | nvsize=8, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C +// CHECK-X64-LABEL: 0 | struct C{{$}} // CHECK-X64-NEXT: 0 | (C vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty) @@ -112,11 +96,7 @@ D() : a(0xf000000D) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D{{$}} // CHECK-NEXT: 0 | struct B0 b0 (empty) // CHECK: 8 | struct C0 c0 // CHECK-NEXT: 8 | int a @@ -128,11 +108,7 @@ // CHECK: 32 | int a // CHECK-NEXT: | [sizeof=40, align=8 // CHECK-NEXT: | nvsize=40, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D{{$}} // CHECK-X64-NEXT: 0 | struct B0 b0 (empty) // CHECK-X64: 8 | struct C0 c0 // CHECK-X64-NEXT: 8 | int a @@ -150,8 +126,7 @@ E() : a(0xf000000E) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E{{$}} // CHECK-NEXT: 0 | (E vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct B0 (virtual base) (empty) @@ -164,8 +139,7 @@ // CHECK-NEXT: 24 | struct B1 (virtual base) (empty) // CHECK-NEXT: | [sizeof=24, align=8 // CHECK-NEXT: | nvsize=8, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct E +// CHECK-X64-LABEL: 0 | struct E{{$}} // CHECK-X64-NEXT: 0 | (E vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty) @@ -184,8 +158,7 @@ F() : a(0xf000000F) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F{{$}} // CHECK-NEXT: 0 | (F vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct C0 (virtual base) @@ -196,8 +169,7 @@ // CHECK-NEXT: 24 | int a // CHECK-NEXT: | [sizeof=32, align=8 // CHECK-NEXT: | nvsize=8, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F +// CHECK-X64-LABEL: 0 | struct F{{$}} // CHECK-X64-NEXT: 0 | (F vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct C0 (virtual base) @@ -215,9 +187,7 @@ virtual void f() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct G +// CHECK-LABEL: 0 | struct G{{$}} // CHECK-NEXT: 0 | struct D0 (primary base) // CHECK-NEXT: 0 | (D0 vftable pointer) // CHECK-NEXT: 4 | (G vbtable pointer) @@ -230,9 +200,7 @@ // CHECK-NEXT: 56 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct G +// CHECK-X64-LABEL: 0 | struct G{{$}} // CHECK-X64-NEXT: 0 | struct D0 (primary base) // CHECK-X64-NEXT: 0 | (D0 vftable pointer) // CHECK-X64-NEXT: 8 | (G vbtable pointer) @@ -252,8 +220,7 @@ virtual void f() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct H +// CHECK-LABEL: 0 | struct H{{$}} // CHECK-NEXT: 0 | (H vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct C0 (virtual base) @@ -267,8 +234,7 @@ // CHECK-NEXT: 52 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=8, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct H +// CHECK-X64-LABEL: 0 | struct H{{$}} // CHECK-X64-NEXT: 0 | (H vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct C0 (virtual base) @@ -288,8 +254,7 @@ I() : a(0xf0000012) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct I +// CHECK-LABEL: 0 | struct I{{$}} // CHECK-NEXT: 0 | (I vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B0 (virtual base) (empty) @@ -299,8 +264,7 @@ // CHECK-NEXT: 168 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=192, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct I +// CHECK-X64-LABEL: 0 | struct I{{$}} // CHECK-X64-NEXT: 0 | (I vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B0 (virtual base) (empty) @@ -316,8 +280,7 @@ J() : a(0xf0000012) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct J +// CHECK-LABEL: 0 | struct J{{$}} // CHECK-NEXT: 0 | (J vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct B0 (virtual base) (empty) @@ -327,8 +290,7 @@ // CHECK-NEXT: 136 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=160, align=32 // CHECK-NEXT: | nvsize=8, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct J +// CHECK-X64-LABEL: 0 | struct J{{$}} // CHECK-X64-NEXT: 0 | (J vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty) @@ -344,9 +306,7 @@ K() : a(0xf0000013) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct K +// CHECK-LABEL: 0 | struct K{{$}} // CHECK-NEXT: 0 | (K vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct D1 (virtual base) (empty) @@ -356,9 +316,7 @@ // CHECK-NEXT: 168 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=192, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct K +// CHECK-X64-LABEL: 0 | struct K{{$}} // CHECK-X64-NEXT: 0 | (K vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct D1 (virtual base) (empty) @@ -374,8 +332,7 @@ L() : a(0xf0000014) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct L +// CHECK-LABEL: 0 | struct L{{$}} // CHECK-NEXT: 0 | (L vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B1 (virtual base) (empty) @@ -385,8 +342,7 @@ // CHECK-NEXT: 168 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=192, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct L +// CHECK-X64-LABEL: 0 | struct L{{$}} // CHECK-X64-NEXT: 0 | (L vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty) @@ -402,8 +358,7 @@ M() : a(0xf0000015) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct M +// CHECK-LABEL: 0 | struct M{{$}} // CHECK-NEXT: 0 | (M vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B1 (virtual base) (empty) @@ -413,8 +368,7 @@ // CHECK-NEXT: 168 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=192, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct M +// CHECK-X64-LABEL: 0 | struct M{{$}} // CHECK-X64-NEXT: 0 | (M vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty) @@ -430,8 +384,7 @@ N() : a(0xf0000016) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct N +// CHECK-LABEL: 0 | struct N{{$}} // CHECK-NEXT: 0 | (N vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct C0 (virtual base) @@ -443,8 +396,7 @@ // CHECK-NEXT: 200 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=224, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct N +// CHECK-X64-LABEL: 0 | struct N{{$}} // CHECK-X64-NEXT: 0 | (N vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct C0 (virtual base) @@ -462,8 +414,7 @@ O() : a(0xf0000017) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct O +// CHECK-LABEL: 0 | struct O{{$}} // CHECK-NEXT: 0 | (O vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct C0 (virtual base) @@ -475,8 +426,7 @@ // CHECK-NEXT: 200 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=224, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct O +// CHECK-X64-LABEL: 0 | struct O{{$}} // CHECK-X64-NEXT: 0 | (O vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct C0 (virtual base) @@ -494,8 +444,7 @@ P() : a(0xf0000018) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct P +// CHECK-LABEL: 0 | struct P{{$}} // CHECK-NEXT: 0 | (P vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B1 (virtual base) (empty) @@ -507,8 +456,7 @@ // CHECK-NEXT: 168 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=192, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct P +// CHECK-X64-LABEL: 0 | struct P{{$}} // CHECK-X64-NEXT: 0 | (P vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty) @@ -526,8 +474,7 @@ Q() : a(0xf0000019) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct Q +// CHECK-LABEL: 0 | struct Q{{$}} // CHECK-NEXT: 0 | (Q vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B1 (virtual base) (empty) @@ -539,8 +486,7 @@ // CHECK-NEXT: 168 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=192, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct Q +// CHECK-X64-LABEL: 0 | struct Q{{$}} // CHECK-X64-NEXT: 0 | (Q vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B1 (virtual base) (empty) @@ -558,8 +504,7 @@ R() : a(0xf0000020) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct R +// CHECK-LABEL: 0 | struct R{{$}} // CHECK-NEXT: 0 | (R vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B0 (virtual base) (empty) @@ -571,8 +516,7 @@ // CHECK-NEXT: 136 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=160, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct R +// CHECK-X64-LABEL: 0 | struct R{{$}} // CHECK-X64-NEXT: 0 | (R vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B0 (virtual base) (empty) @@ -590,8 +534,7 @@ S() : a(0xf0000021) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct S +// CHECK-LABEL: 0 | struct S{{$}} // CHECK-NEXT: 0 | (S vbtable pointer) // CHECK-NEXT: 32 | int a // CHECK-NEXT: 64 | struct B0 (virtual base) (empty) @@ -603,8 +546,7 @@ // CHECK-NEXT: 136 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=160, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct S +// CHECK-X64-LABEL: 0 | struct S{{$}} // CHECK-X64-NEXT: 0 | (S vbtable pointer) // CHECK-X64-NEXT: 32 | int a // CHECK-X64-NEXT: 64 | struct B0 (virtual base) (empty) @@ -622,9 +564,7 @@ T() : a(0xf0000022) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct T +// CHECK-LABEL: 0 | struct T{{$}} // CHECK-NEXT: 0 | (T vbtable pointer) // CHECK-NEXT: 16 | int a // CHECK-NEXT: 32 | struct B0 (virtual base) (empty) @@ -638,9 +578,7 @@ // CHECK-NEXT: 104 | struct B4 (virtual base) (empty) // CHECK-NEXT: | [sizeof=112, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct T +// CHECK-X64-LABEL: 0 | struct T{{$}} // CHECK-X64-NEXT: 0 | (T vbtable pointer) // CHECK-X64-NEXT: 16 | int a // CHECK-X64-NEXT: 32 | struct B0 (virtual base) (empty) @@ -660,16 +598,14 @@ U() : a(0xf0000023) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct U +// CHECK-LABEL: 0 | struct U{{$}} // CHECK-NEXT: 0 | (U vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct B0 (virtual base) (empty) // CHECK-NEXT: 40 | struct B1 (virtual base) (empty) // CHECK-NEXT: | [sizeof=64, align=32 // CHECK-NEXT: | nvsize=8, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct U +// CHECK-X64-LABEL: 0 | struct U{{$}} // CHECK-X64-NEXT: 0 | (U vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B0 (virtual base) (empty) @@ -682,15 +618,13 @@ V() : a(0xf0000024) {printf("X : %3d\n", ((int)(__SIZE_TYPE__)this)&0xfff);} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct V +// CHECK-LABEL: 0 | struct V{{$}} // CHECK-NEXT: 0 | (V vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct D1 (virtual base) (empty) // CHECK-NEXT: | [sizeof=32, align=32 // CHECK-NEXT: | nvsize=8, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct V +// CHECK-X64-LABEL: 0 | struct V{{$}} // CHECK-X64-NEXT: 0 | (V vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct D1 (virtual base) (empty) @@ -701,10 +635,7 @@ struct T1 : T0 { char a; }; struct T3 : virtual T1, virtual T0 { long long a; }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct T3 +// CHECK-LABEL: 0 | struct T3{{$}} // CHECK-NEXT: 0 | (T3 vbtable pointer) // CHECK-NEXT: 8 | long long a // CHECK-NEXT: 16 | struct T1 (virtual base) @@ -713,10 +644,7 @@ // CHECK-NEXT: 24 | struct T0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=24, align=8 // CHECK-NEXT: | nvsize=16, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct T3 +// CHECK-X64-LABEL: 0 | struct T3{{$}} // CHECK-X64-NEXT: 0 | (T3 vbtable pointer) // CHECK-X64-NEXT: 8 | long long a // CHECK-X64-NEXT: 16 | struct T1 (virtual base) @@ -731,11 +659,7 @@ struct Q0C : virtual Q0A, virtual Q0B { char Q0CField; }; struct Q0D : Q0C, Q0A {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct Q0D +// CHECK-LABEL: 0 | struct Q0D{{$}} // CHECK-NEXT: 0 | struct Q0C (base) // CHECK-NEXT: 0 | (Q0C vbtable pointer) // CHECK-NEXT: 4 | char Q0CField @@ -745,11 +669,7 @@ // CHECK-NEXT: 8 | char Q0BField // CHECK-NEXT: | [sizeof=9, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct Q0D +// CHECK-X64-LABEL: 0 | struct Q0D{{$}} // CHECK-X64-NEXT: 0 | struct Q0C (base) // CHECK-X64-NEXT: 0 | (Q0C vbtable pointer) // CHECK-X64-NEXT: 8 | char Q0CField diff --git a/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp b/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp --- a/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp +++ b/clang/test/Layout/ms-x86-lazy-empty-nonvirtual-base.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -31,11 +31,7 @@ AA() : a(0x000000AA) { printf("AA = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AA +// CHECK-LABEL: 0 | struct AA{{$}} // CHECK-NEXT: 0 | struct B8 (base) // CHECK-NEXT: 0 | char [5] c // CHECK-NEXT: 13 | struct B1 (base) (empty) @@ -44,11 +40,7 @@ // CHECK-NEXT: 20 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AA +// CHECK-X64-LABEL: 0 | struct AA{{$}} // CHECK-X64-NEXT: 0 | struct B8 (base) // CHECK-X64-NEXT: 0 | char [5] c // CHECK-X64-NEXT: 17 | struct B1 (base) (empty) @@ -63,8 +55,7 @@ AB() : a(0x000000AB) { printf("AB = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AB +// CHECK-LABEL: 0 | struct AB{{$}} // CHECK-NEXT: 0 | struct B8 (base) // CHECK-NEXT: 0 | char [5] c // CHECK-NEXT: 13 | struct B1 (base) (empty) @@ -73,8 +64,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AB +// CHECK-X64-LABEL: 0 | struct AB{{$}} // CHECK-X64-NEXT: 0 | struct B8 (base) // CHECK-X64-NEXT: 0 | char [5] c // CHECK-X64-NEXT: 17 | struct B1 (base) (empty) @@ -89,8 +79,7 @@ AC() : a(0x000000AC) { printf("AC = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AC +// CHECK-LABEL: 0 | struct AC{{$}} // CHECK-NEXT: 0 | struct B8 (base) // CHECK-NEXT: 0 | char [5] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -99,8 +88,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AC +// CHECK-X64-LABEL: 0 | struct AC{{$}} // CHECK-X64-NEXT: 0 | struct B8 (base) // CHECK-X64-NEXT: 0 | char [5] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -114,8 +102,7 @@ AD() { printf("AD = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AD +// CHECK-LABEL: 0 | struct AD{{$}} // CHECK-NEXT: 0 | struct B8 (base) // CHECK-NEXT: 0 | char [5] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -123,8 +110,7 @@ // CHECK-NEXT: 12 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AD +// CHECK-X64-LABEL: 0 | struct AD{{$}} // CHECK-X64-NEXT: 0 | struct B8 (base) // CHECK-X64-NEXT: 0 | char [5] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -138,9 +124,7 @@ AA1() : a(0x00000AA1) { printf("AA1 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AA1 +// CHECK-LABEL: 0 | struct AA1{{$}} // CHECK-NEXT: 0 | struct B9 (base) // CHECK-NEXT: 0 | char [6] c // CHECK-NEXT: 14 | struct B1 (base) (empty) @@ -149,9 +133,7 @@ // CHECK-NEXT: 20 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AA1 +// CHECK-X64-LABEL: 0 | struct AA1{{$}} // CHECK-X64-NEXT: 0 | struct B9 (base) // CHECK-X64-NEXT: 0 | char [6] c // CHECK-X64-NEXT: 18 | struct B1 (base) (empty) @@ -166,8 +148,7 @@ AB1() : a(0x00000AB1) { printf("AB1 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AB1 +// CHECK-LABEL: 0 | struct AB1{{$}} // CHECK-NEXT: 0 | struct B9 (base) // CHECK-NEXT: 0 | char [6] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -176,8 +157,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AB1 +// CHECK-X64-LABEL: 0 | struct AB1{{$}} // CHECK-X64-NEXT: 0 | struct B9 (base) // CHECK-X64-NEXT: 0 | char [6] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -192,8 +172,7 @@ AC1() : a(0x000000C1) { printf("AC1 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AC1 +// CHECK-LABEL: 0 | struct AC1{{$}} // CHECK-NEXT: 0 | struct B9 (base) // CHECK-NEXT: 0 | char [6] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -202,8 +181,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AC1 +// CHECK-X64-LABEL: 0 | struct AC1{{$}} // CHECK-X64-NEXT: 0 | struct B9 (base) // CHECK-X64-NEXT: 0 | char [6] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -217,8 +195,7 @@ AD1() { printf("AD1 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AD1 +// CHECK-LABEL: 0 | struct AD1{{$}} // CHECK-NEXT: 0 | struct B9 (base) // CHECK-NEXT: 0 | char [6] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -226,8 +203,7 @@ // CHECK-NEXT: 12 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AD1 +// CHECK-X64-LABEL: 0 | struct AD1{{$}} // CHECK-X64-NEXT: 0 | struct B9 (base) // CHECK-X64-NEXT: 0 | char [6] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -241,9 +217,7 @@ AA2() : a(0x00000AA2) { printf("AA2 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AA2 +// CHECK-LABEL: 0 | struct AA2{{$}} // CHECK-NEXT: 0 | struct B10 (base) // CHECK-NEXT: 0 | char [7] c // CHECK-NEXT: 15 | struct B1 (base) (empty) @@ -252,9 +226,7 @@ // CHECK-NEXT: 20 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AA2 +// CHECK-X64-LABEL: 0 | struct AA2{{$}} // CHECK-X64-NEXT: 0 | struct B10 (base) // CHECK-X64-NEXT: 0 | char [7] c // CHECK-X64-NEXT: 19 | struct B1 (base) (empty) @@ -269,8 +241,7 @@ AB2() : a(0x00000AB2) { printf("AB2 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AB2 +// CHECK-LABEL: 0 | struct AB2{{$}} // CHECK-NEXT: 0 | struct B10 (base) // CHECK-NEXT: 0 | char [7] c // CHECK-NEXT: 13 | struct B1 (base) (empty) @@ -279,8 +250,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AB2 +// CHECK-X64-LABEL: 0 | struct AB2{{$}} // CHECK-X64-NEXT: 0 | struct B10 (base) // CHECK-X64-NEXT: 0 | char [7] c // CHECK-X64-NEXT: 17 | struct B1 (base) (empty) @@ -295,8 +265,7 @@ AC2() : a(0x000000C2) { printf("AC2 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AC2 +// CHECK-LABEL: 0 | struct AC2{{$}} // CHECK-NEXT: 0 | struct B10 (base) // CHECK-NEXT: 0 | char [7] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -305,8 +274,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AC2 +// CHECK-X64-LABEL: 0 | struct AC2{{$}} // CHECK-X64-NEXT: 0 | struct B10 (base) // CHECK-X64-NEXT: 0 | char [7] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -320,8 +288,7 @@ AD2() { printf("AD2 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AD2 +// CHECK-LABEL: 0 | struct AD2{{$}} // CHECK-NEXT: 0 | struct B10 (base) // CHECK-NEXT: 0 | char [7] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -329,8 +296,7 @@ // CHECK-NEXT: 12 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AD2 +// CHECK-X64-LABEL: 0 | struct AD2{{$}} // CHECK-X64-NEXT: 0 | struct B10 (base) // CHECK-X64-NEXT: 0 | char [7] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -344,9 +310,7 @@ AA3() : a(0x00000AA3) { printf("AA3 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AA3 +// CHECK-LABEL: 0 | struct AA3{{$}} // CHECK-NEXT: 0 | struct B11 (base) // CHECK-NEXT: 0 | char [8] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -355,9 +319,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AA3 +// CHECK-X64-LABEL: 0 | struct AA3{{$}} // CHECK-X64-NEXT: 0 | struct B11 (base) // CHECK-X64-NEXT: 0 | char [8] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -372,8 +334,7 @@ AB3() : a(0x00000AB3) { printf("AB3 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AB3 +// CHECK-LABEL: 0 | struct AB3{{$}} // CHECK-NEXT: 0 | struct B11 (base) // CHECK-NEXT: 0 | char [8] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -382,8 +343,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AB3 +// CHECK-X64-LABEL: 0 | struct AB3{{$}} // CHECK-X64-NEXT: 0 | struct B11 (base) // CHECK-X64-NEXT: 0 | char [8] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -398,8 +358,7 @@ AC3() : a(0x000000C3) { printf("AC3 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AC3 +// CHECK-LABEL: 0 | struct AC3{{$}} // CHECK-NEXT: 0 | struct B11 (base) // CHECK-NEXT: 0 | char [8] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -408,8 +367,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AC3 +// CHECK-X64-LABEL: 0 | struct AC3{{$}} // CHECK-X64-NEXT: 0 | struct B11 (base) // CHECK-X64-NEXT: 0 | char [8] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -423,8 +381,7 @@ AD3() { printf("AD3 = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AD3 +// CHECK-LABEL: 0 | struct AD3{{$}} // CHECK-NEXT: 0 | struct B11 (base) // CHECK-NEXT: 0 | char [8] c // CHECK-NEXT: 12 | struct B1 (base) (empty) @@ -432,8 +389,7 @@ // CHECK-NEXT: 12 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AD3 +// CHECK-X64-LABEL: 0 | struct AD3{{$}} // CHECK-X64-NEXT: 0 | struct B11 (base) // CHECK-X64-NEXT: 0 | char [8] c // CHECK-X64-NEXT: 16 | struct B1 (base) (empty) @@ -446,18 +402,14 @@ B() { printf("B = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B{{$}} // CHECK-NEXT: 0 | struct B1 (base) (empty) // CHECK-NEXT: 8 | struct B2 (base) (empty) // CHECK-NEXT: 4 | (B vbtable pointer) // CHECK-NEXT: 8 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct B +// CHECK-X64-LABEL: 0 | struct B{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) (empty) // CHECK-X64-NEXT: 16 | struct B2 (base) (empty) // CHECK-X64-NEXT: 8 | (B vbtable pointer) @@ -470,9 +422,7 @@ C() : a(0x0000000C) { printf("C = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C{{$}} // CHECK-NEXT: 0 | struct B1 (base) (empty) // CHECK-NEXT: 1 | struct B2 (base) (empty) // CHECK-NEXT: 8 | struct B3 (base) (empty) @@ -481,9 +431,7 @@ // CHECK-NEXT: 12 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C +// CHECK-X64-LABEL: 0 | struct C{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) (empty) // CHECK-X64-NEXT: 1 | struct B2 (base) (empty) // CHECK-X64-NEXT: 16 | struct B3 (base) (empty) @@ -498,10 +446,7 @@ D() : a(0x0000000D) { printf("D = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D{{$}} // CHECK-NEXT: 0 | struct B1 (base) (empty) // CHECK-NEXT: 1 | struct B2 (base) (empty) // CHECK-NEXT: 2 | struct B3 (base) (empty) @@ -512,10 +457,7 @@ // CHECK-NEXT: 12 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) (empty) // CHECK-X64-NEXT: 1 | struct B2 (base) (empty) // CHECK-X64-NEXT: 2 | struct B3 (base) (empty) @@ -532,9 +474,7 @@ E() : a(0x0000000E) { printf("E = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E{{$}} // CHECK-NEXT: 0 | struct B1 (base) (empty) // CHECK-NEXT: 2 | struct B6 (base) (empty) // CHECK-NEXT: 3 | struct B3 (base) (empty) @@ -545,9 +485,7 @@ // CHECK-NEXT: 20 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct E +// CHECK-X64-LABEL: 0 | struct E{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) (empty) // CHECK-X64-NEXT: 2 | struct B6 (base) (empty) // CHECK-X64-NEXT: 3 | struct B3 (base) (empty) @@ -564,8 +502,7 @@ F() : a(0x0000000F) { printf("&a = %p\n", &a); printf("F = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F{{$}} // CHECK-NEXT: 0 | struct B1 (base) (empty) // CHECK-NEXT: 2 | struct B6 (base) (empty) // CHECK-NEXT: 3 | struct B4 (base) (empty) @@ -577,8 +514,7 @@ // CHECK-NEXT: 16 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F +// CHECK-X64-LABEL: 0 | struct F{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) (empty) // CHECK-X64-NEXT: 2 | struct B6 (base) (empty) // CHECK-X64-NEXT: 3 | struct B4 (base) (empty) @@ -597,8 +533,7 @@ G() : a(0x00000010), a1(0xf0000010) { printf("G = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct G +// CHECK-LABEL: 0 | struct G{{$}} // CHECK-NEXT: 0 | struct B8 (base) // CHECK-NEXT: 0 | char [5] c // CHECK-NEXT: 21 | struct B1 (base) (empty) @@ -608,8 +543,7 @@ // CHECK-NEXT: 48 | struct B0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=48, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct G +// CHECK-X64-LABEL: 0 | struct G{{$}} // CHECK-X64-NEXT: 0 | struct B8 (base) // CHECK-X64-NEXT: 0 | char [5] c // CHECK-X64-NEXT: 21 | struct B1 (base) (empty) @@ -625,13 +559,7 @@ AX() : a(0x0000000A) { printf(" A = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AX +// CHECK-LABEL: 0 | struct AX{{$}} // CHECK-NEXT: 0 | struct B1X (base) (empty) // CHECK-NEXT: 16 | struct B2X (base) (empty) // CHECK-NEXT: 18 | struct B3X (base) (empty) @@ -641,13 +569,7 @@ // CHECK-NEXT: 48 | struct B0X (virtual base) (empty) // CHECK-NEXT: | [sizeof=48, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AX +// CHECK-X64-LABEL: 0 | struct AX{{$}} // CHECK-X64-NEXT: 0 | struct B1X (base) (empty) // CHECK-X64-NEXT: 16 | struct B2X (base) (empty) // CHECK-X64-NEXT: 18 | struct B3X (base) (empty) @@ -663,8 +585,7 @@ BX() : a(0x0000000B) { printf(" B = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct BX +// CHECK-LABEL: 0 | struct BX{{$}} // CHECK-NEXT: 0 | struct B2X (base) (empty) // CHECK-NEXT: 1 | struct B1X (base) (empty) // CHECK-NEXT: 2 | struct B3X (base) (empty) @@ -674,8 +595,7 @@ // CHECK-NEXT: 32 | struct B0X (virtual base) (empty) // CHECK-NEXT: | [sizeof=32, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct BX +// CHECK-X64-LABEL: 0 | struct BX{{$}} // CHECK-X64-NEXT: 0 | struct B2X (base) (empty) // CHECK-X64-NEXT: 1 | struct B1X (base) (empty) // CHECK-X64-NEXT: 2 | struct B3X (base) (empty) @@ -691,8 +611,7 @@ CX() : a(0x0000000C) { printf(" C = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct CX +// CHECK-LABEL: 0 | struct CX{{$}} // CHECK-NEXT: 0 | struct B1X (base) (empty) // CHECK-NEXT: 2 | struct B3X (base) (empty) // CHECK-NEXT: 32 | struct B2X (base) (empty) @@ -701,8 +620,7 @@ // CHECK-NEXT: 48 | struct B0X (virtual base) (empty) // CHECK-NEXT: | [sizeof=48, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct CX +// CHECK-X64-LABEL: 0 | struct CX{{$}} // CHECK-X64-NEXT: 0 | struct B1X (base) (empty) // CHECK-X64-NEXT: 2 | struct B3X (base) (empty) // CHECK-X64-NEXT: 32 | struct B2X (base) (empty) @@ -717,9 +635,7 @@ DX() : a(0x0000000D) { printf(" D = %p\n", this); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct DX +// CHECK-LABEL: 0 | struct DX{{$}} // CHECK-NEXT: 0 | struct B8X (base) // CHECK-NEXT: 0 | short a // CHECK-NEXT: 10 | struct B1X (base) (empty) @@ -728,9 +644,7 @@ // CHECK-NEXT: 16 | struct B0X (virtual base) (empty) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct DX +// CHECK-X64-LABEL: 0 | struct DX{{$}} // CHECK-X64-NEXT: 0 | struct B8X (base) // CHECK-X64-NEXT: 0 | short a // CHECK-X64-NEXT: 18 | struct B1X (base) (empty) @@ -740,25 +654,18 @@ // CHECK-X64-NEXT: | [sizeof=24, align=8 // CHECK-X64-NEXT: | nvsize=24, nvalign=8] - struct C0 {}; struct C1 : public C0 { int C1F0; }; struct C2 : public C1, public C0 {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C2 +// CHECK-LABEL: 0 | struct C2{{$}} // CHECK-NEXT: 0 | struct C1 (base) // CHECK-NEXT: 0 | struct C0 (base) (empty) // CHECK-NEXT: 0 | int C1F0 // CHECK-NEXT: 5 | struct C0 (base) (empty) // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C2 +// CHECK-X64-LABEL: 0 | struct C2{{$}} // CHECK-X64-NEXT: 0 | struct C1 (base) // CHECK-X64-NEXT: 0 | struct C0 (base) (empty) // CHECK-X64-NEXT: 0 | int C1F0 @@ -774,11 +681,7 @@ struct JC { char a; }; struct JD : JA, JB, virtual JC {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct JD +// CHECK-LABEL: 0 | struct JD{{$}} // CHECK-NEXT: 0 | struct JB (primary base) // CHECK-NEXT: 0 | (JB vftable pointer) // CHECK-NEXT: 4 | char a @@ -789,11 +692,7 @@ // CHECK-NEXT: 16 | char a // CHECK-NEXT: | [sizeof=17, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct JD +// CHECK-X64-LABEL: 0 | struct JD{{$}} // CHECK-X64-NEXT: 0 | struct JB (primary base) // CHECK-X64-NEXT: 0 | (JB vftable pointer) // CHECK-X64-NEXT: 8 | char a diff --git a/clang/test/Layout/ms-x86-pack-and-align.cpp b/clang/test/Layout/ms-x86-pack-and-align.cpp --- a/clang/test/Layout/ms-x86-pack-and-align.cpp +++ b/clang/test/Layout/ms-x86-pack-and-align.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only -Wno-inaccessible-base %s 2>&1 \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only -Wno-inaccessible-base %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); char buffer[419430400]; @@ -35,18 +35,14 @@ } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct X +// CHECK-LABEL: 0 | struct X{{$}} // CHECK-NEXT: 0 | struct B a // CHECK-NEXT: 0 | long long a // CHECK-NEXT: 8 | char b // CHECK-NEXT: 10 | int c // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=14, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct X +// CHECK-X64-LABEL: 0 | struct X{{$}} // CHECK-X64-NEXT: 0 | struct B a // CHECK-X64-NEXT: 0 | long long a // CHECK-X64-NEXT: 8 | char b @@ -64,9 +60,7 @@ } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct Y +// CHECK-LABEL: 0 | struct Y{{$}} // CHECK-NEXT: 0 | struct A (base) // CHECK-NEXT: 0 | char a // CHECK-NEXT: 4 | struct B (base) @@ -75,9 +69,7 @@ // CHECK-NEXT: 14 | int b // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=18, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct Y +// CHECK-X64-LABEL: 0 | struct Y{{$}} // CHECK-X64-NEXT: 0 | struct A (base) // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 4 | struct B (base) @@ -97,8 +89,7 @@ } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct Z +// CHECK-LABEL: 0 | struct Z{{$}} // CHECK-NEXT: 0 | (Z vbtable pointer) // CHECK-NEXT: 4 | char a // CHECK-NEXT: 6 | int b @@ -106,8 +97,7 @@ // CHECK-NEXT: 12 | long long a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=10, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct Z +// CHECK-X64-LABEL: 0 | struct Z{{$}} // CHECK-X64-NEXT: 0 | (Z vbtable pointer) // CHECK-X64-NEXT: 8 | char a // CHECK-X64-NEXT: 10 | int b @@ -124,10 +114,7 @@ #pragma pack(pop) struct C1 : B1 {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C1 +// CHECK-LABEL: 0 | struct C1{{$}} // CHECK-NEXT: 0 | struct B1 (base) // CHECK-NEXT: 0 | (B1 vbtable pointer) // CHECK-NEXT: 4 | char a @@ -135,10 +122,7 @@ // CHECK-NEXT: 8 | long long a // CHECK-NEXT: | [sizeof=16, align=8 // CHECK-NEXT: | nvsize=5, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C1 +// CHECK-X64-LABEL: 0 | struct C1{{$}} // CHECK-X64-NEXT: 0 | struct B1 (base) // CHECK-X64-NEXT: 0 | (B1 vbtable pointer) // CHECK-X64-NEXT: 8 | char a @@ -160,10 +144,7 @@ }; #pragma pack(pop) -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct CA2 +// CHECK-LABEL: 0 | struct CA2{{$}} // CHECK-NEXT: 0 | (CA2 vftable pointer) // CHECK-NEXT: 4 | struct CA1 (base) // CHECK-NEXT: 4 | (CA1 vbtable pointer) @@ -171,10 +152,7 @@ // CHECK-NEXT: 9 | struct CA0 (virtual base) (empty) // CHECK-NEXT: | [sizeof=9, align=1 // CHECK-NEXT: | nvsize=9, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct CA2 +// CHECK-X64-LABEL: 0 | struct CA2{{$}} // CHECK-X64-NEXT: 0 | (CA2 vftable pointer) // CHECK-X64-NEXT: 8 | struct CA1 (base) // CHECK-X64-NEXT: 8 | (CA1 vbtable pointer) @@ -187,13 +165,11 @@ struct YA { __declspec(align(32)) char : 1; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct YA +// CHECK-LABEL: 0 | struct YA{{$}} // CHECK-NEXT:0:0-0 | char // CHECK-NEXT: | [sizeof=32, align=32 // CHECK-NEXT: | nvsize=32, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct YA +// CHECK-X64-LABEL: 0 | struct YA{{$}} // CHECK-X64-NEXT:0:0-0 | char // CHECK-X64-NEXT: | [sizeof=32, align=32 // CHECK-X64-NEXT: | nvsize=32, nvalign=32] @@ -203,15 +179,13 @@ char a; YA b; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct YB +// CHECK-LABEL: 0 | struct YB{{$}} // CHECK-NEXT: 0 | char a // CHECK-NEXT: 1 | struct YA b // CHECK-NEXT:1:0-0 | char // CHECK-NEXT: | [sizeof=33, align=1 // CHECK-NEXT: | nvsize=33, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct YB +// CHECK-X64-LABEL: 0 | struct YB{{$}} // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 1 | struct YA b // CHECK-X64-NEXT:1:0-0 | char @@ -222,13 +196,11 @@ struct YC { __declspec(align(32)) char : 1; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct YC +// CHECK-LABEL: 0 | struct YC{{$}} // CHECK-NEXT:0:0-0 | char // CHECK-NEXT: | [sizeof=32, align=32 // CHECK-NEXT: | nvsize=32, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct YC +// CHECK-X64-LABEL: 0 | struct YC{{$}} // CHECK-X64-NEXT: 0:0-0 | char // CHECK-X64-NEXT: | [sizeof=8, align=32 // CHECK-X64-NEXT: | nvsize=8, nvalign=32] @@ -238,15 +210,13 @@ char a; YC b; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct YD +// CHECK-LABEL: 0 | struct YD{{$}} // CHECK-NEXT: 0 | char a // CHECK-NEXT: 1 | struct YC b // CHECK-NEXT:1:0-0 | char // CHECK-NEXT: | [sizeof=33, align=1 // CHECK-NEXT: | nvsize=33, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct YD +// CHECK-X64-LABEL: 0 | struct YD{{$}} // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 1 | struct YC b // CHECK-X64-NEXT:1:0-0 | char @@ -257,13 +227,11 @@ struct YE { __declspec(align(32)) char : 1; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct YE +// CHECK-LABEL: 0 | struct YE{{$}} // CHECK-NEXT: 0:0-0 | char // CHECK-NEXT: | [sizeof=4, align=32 // CHECK-NEXT: | nvsize=4, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct YE +// CHECK-X64-LABEL: 0 | struct YE{{$}} // CHECK-X64-NEXT: 0:0-0 | char // CHECK-X64-NEXT: | [sizeof=4, align=32 // CHECK-X64-NEXT: | nvsize=4, nvalign=32] @@ -273,15 +241,13 @@ char a; YE b; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct YF +// CHECK-LABEL: 0 | struct YF{{$}} // CHECK-NEXT: 0 | char a // CHECK-NEXT: 1 | struct YE b // CHECK-NEXT:1:0-0 | char // CHECK-NEXT: | [sizeof=5, align=1 // CHECK-NEXT: | nvsize=5, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct YF +// CHECK-X64-LABEL: 0 | struct YF{{$}} // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 1 | struct YE b // CHECK-X64-NEXT:1:0-0 | char @@ -295,10 +261,7 @@ #pragma pack(16) struct D2 : D1 { char a; }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D2 +// CHECK-LABEL: 0 | struct D2{{$}} // CHECK-NEXT: 0 | struct D1 (base) // CHECK-NEXT: 0 | struct D0 (base) // CHECK-NEXT: 0 | char a @@ -306,10 +269,7 @@ // CHECK-NEXT: 2 | char a // CHECK-NEXT: | [sizeof=16, align=16 // CHECK-NEXT: | nvsize=16, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D2 +// CHECK-X64-LABEL: 0 | struct D2{{$}} // CHECK-X64-NEXT: 0 | struct D1 (base) // CHECK-X64-NEXT: 0 | struct D0 (base) // CHECK-X64-NEXT: 0 | char a @@ -325,20 +285,14 @@ #pragma pack() struct JC : JB, JA { }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct JC +// CHECK-LABEL: 0 | struct JC{{$}} // CHECK-NEXT: 0 | struct JB (base) // CHECK-NEXT: 0 | char a // CHECK-NEXT: 1 | struct JA (base) // CHECK-NEXT: 1 | char a // CHECK-NEXT: | [sizeof=4, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct JC +// CHECK-X64-LABEL: 0 | struct JC{{$}} // CHECK-X64-NEXT: 0 | struct JB (base) // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 1 | struct JA (base) @@ -351,17 +305,13 @@ #pragma pack(1) struct KB : KA { __declspec(align(2)) char a; }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct KB +// CHECK-LABEL: 0 | struct KB{{$}} // CHECK-NEXT: 0 | struct KA (base) // CHECK-NEXT: 0 | char a // CHECK-NEXT: 2 | char a // CHECK-NEXT: | [sizeof=4, align=2 // CHECK-NEXT: | nvsize=3, nvalign=2] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct KB +// CHECK-X64-LABEL: 0 | struct KB{{$}} // CHECK-X64-NEXT: 0 | struct KA (base) // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 2 | char a @@ -374,14 +324,12 @@ __declspec(align(256)) int Field; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct L +// CHECK-LABEL: 0 | struct L{{$}} // CHECK-NEXT: 0 | (L vftable pointer) // CHECK-NEXT: 256 | int Field // CHECK-NEXT: | [sizeof=512, align=256 // CHECK-NEXT: | nvsize=260, nvalign=256] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct L +// CHECK-X64-LABEL: 0 | struct L{{$}} // CHECK-X64-NEXT: 0 | (L vftable pointer) // CHECK-X64-NEXT: 256 | int Field // CHECK-X64-NEXT: | [sizeof=512, align=256 @@ -394,17 +342,13 @@ __declspec(align(256)) int Field; }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct MB +// CHECK-LABEL: 0 | struct MB{{$}} // CHECK-NEXT: 0 | (MB vbtable pointer) // CHECK-NEXT: 256 | int Field // CHECK-NEXT: 260 | struct MA (virtual base) (empty) // CHECK-NEXT: | [sizeof=512, align=256 // CHECK-NEXT: | nvsize=260, nvalign=256] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct MB +// CHECK-X64-LABEL: 0 | struct MB{{$}} // CHECK-X64-NEXT: 0 | (MB vbtable pointer) // CHECK-X64-NEXT: 256 | int Field // CHECK-X64-NEXT: 260 | struct MA (virtual base) (empty) @@ -441,82 +385,68 @@ }; #pragma pack() -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RB0 +// CHECK-LABEL: 0 | struct RB0{{$}} // CHECK-NEXT:0:0-2 | int b // CHECK-NEXT: | [sizeof=8, align=1024 // CHECK-NEXT: | nvsize=4, nvalign=1024] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RB1 +// CHECK-LABEL: 0 | struct RB1{{$}} // CHECK-NEXT: 0 | (RB1 vftable pointer) // CHECK-NEXT: 1024:0-2 | int b // CHECK-NEXT: | [sizeof=1032, align=1024 // CHECK-NEXT: | nvsize=1028, nvalign=1024] -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RB2 +// CHECK-LABEL: 0 | struct RB2{{$}} // CHECK-NEXT: 0 | (RB2 vbtable pointer) // CHECK-NEXT: 1024:0-2 | int b // CHECK-NEXT: 1028 | struct RA (virtual base) (empty) // CHECK-NEXT: | [sizeof=1032, align=1024 // CHECK-NEXT: | nvsize=1028, nvalign=1024] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RB3 +// CHECK-LABEL: 0 | struct RB3{{$}} // CHECK-NEXT: 0 | (RB3 vftable pointer) // CHECK-NEXT: 1024 | (RB3 vbtable pointer) // CHECK-NEXT: 2048:0-2 | int b // CHECK-NEXT: 2052 | struct RA (virtual base) (empty) // CHECK-NEXT: | [sizeof=2056, align=1024 // CHECK-NEXT: | nvsize=2052, nvalign=1024] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RC +// CHECK-LABEL: 0 | struct RC{{$}} // CHECK-NEXT: 0 | char _ // CHECK-NEXT: 1024:0-2 | int c // CHECK-NEXT: | [sizeof=1028, align=1024 // CHECK-NEXT: | nvsize=1028, nvalign=1024] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct RE +// CHECK-LABEL: 0 | struct RE{{$}} // CHECK-NEXT: 0 | char _ // CHECK-NEXT: 1 | struct RC c // CHECK-NEXT: 1 | char _ // CHECK-NEXT: 1025:0-2 | int c // CHECK-NEXT: | [sizeof=1029, align=1 // CHECK-NEXT: | nvsize=1029, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RB0 +// CHECK-X64-LABEL: 0 | struct RB0{{$}} // CHECK-X64-NEXT: 0:0-2 | int b // CHECK-X64-NEXT: | [sizeof=8, align=1024 // CHECK-X64-NEXT: | nvsize=4, nvalign=1024] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RB1 +// CHECK-X64-LABEL: 0 | struct RB1{{$}} // CHECK-X64-NEXT: 0 | (RB1 vftable pointer) // CHECK-X64-NEXT: 1024:0-2 | int b // CHECK-X64-NEXT: | [sizeof=1032, align=1024 // CHECK-X64-NEXT: | nvsize=1028, nvalign=1024] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RB2 +// CHECK-X64-LABEL: 0 | struct RB2{{$}} // CHECK-X64-NEXT: 0 | (RB2 vbtable pointer) // CHECK-X64-NEXT: 1024:0-2 | int b // CHECK-X64-NEXT: 1028 | struct RA (virtual base) (empty) // CHECK-X64-NEXT: | [sizeof=1032, align=1024 // CHECK-X64-NEXT: | nvsize=1028, nvalign=1024] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RB3 +// CHECK-X64-LABEL: 0 | struct RB3{{$}} // CHECK-X64-NEXT: 0 | (RB3 vftable pointer) // CHECK-X64-NEXT: 1024 | (RB3 vbtable pointer) // CHECK-X64-NEXT: 2048:0-2 | int b // CHECK-X64-NEXT: 2052 | struct RA (virtual base) (empty) // CHECK-X64-NEXT: | [sizeof=2056, align=1024 // CHECK-X64-NEXT: | nvsize=2052, nvalign=1024] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RC +// CHECK-X64-LABEL: 0 | struct RC{{$}} // CHECK-X64-NEXT: 0 | char _ // CHECK-X64-NEXT: 1024:0-2 | int c // CHECK-X64-NEXT: | [sizeof=1028, align=1024 // CHECK-X64-NEXT: | nvsize=1028, nvalign=1024] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct RE +// CHECK-X64-LABEL: 0 | struct RE{{$}} // CHECK-X64-NEXT: 0 | char _ // CHECK-X64-NEXT: 1 | struct RC c // CHECK-X64-NEXT: 1 | char _ @@ -531,46 +461,38 @@ #pragma pack(pop) struct ND : NC {}; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct NA (empty) +// CHECK-LABEL: 0 | struct NA (empty){{$}} // CHECK-NEXT: | [sizeof=1, align=1 // CHECK-NEXT: | nvsize=0, nvalign=1] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct NB (empty) +// CHECK-LABEL: 0 | struct NB (empty){{$}} // CHECK-NEXT: | [sizeof=1, align=1 // CHECK-NEXT: | nvsize=0, nvalign=1] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct NC +// CHECK-LABEL: 0 | struct NC{{$}} // CHECK-NEXT: 0 | (NC vbtable pointer) // CHECK-NEXT: 4 | struct NA (virtual base) (empty) // CHECK-NEXT: 8 | struct NB (virtual base) (empty) // CHECK-NEXT: | [sizeof=8, align=1 // CHECK-NEXT: | nvsize=4, nvalign=1] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct ND +// CHECK-LABEL: 0 | struct ND{{$}} // CHECK-NEXT: 0 | struct NC (base) // CHECK-NEXT: 0 | (NC vbtable pointer) // CHECK-NEXT: 4 | struct NA (virtual base) (empty) // CHECK-NEXT: 8 | struct NB (virtual base) (empty) // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct NA (empty) +// CHECK-X64-LABEL: 0 | struct NA (empty){{$}} // CHECK-X64-NEXT: | [sizeof=1, align=1 // CHECK-X64-NEXT: | nvsize=0, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct NB (empty) +// CHECK-X64-LABEL: 0 | struct NB (empty){{$}} // CHECK-X64-NEXT: | [sizeof=1, align=1 // CHECK-X64-NEXT: | nvsize=0, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct NC +// CHECK-X64-LABEL: 0 | struct NC{{$}} // CHECK-X64-NEXT: 0 | (NC vbtable pointer) // CHECK-X64-NEXT: 8 | struct NA (virtual base) (empty) // CHECK-X64-NEXT: 12 | struct NB (virtual base) (empty) // CHECK-X64-NEXT: | [sizeof=12, align=1 // CHECK-X64-NEXT: | nvsize=8, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct ND +// CHECK-X64-LABEL: 0 | struct ND{{$}} // CHECK-X64-NEXT: 0 | struct NC (base) // CHECK-X64-NEXT: 0 | (NC vbtable pointer) // CHECK-X64-NEXT: 8 | struct NA (virtual base) (empty) @@ -585,46 +507,38 @@ struct OD : OC {}; #pragma pack(pop) -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct OA (empty) +// CHECK-LABEL: 0 | struct OA (empty){{$}} // CHECK-NEXT: | [sizeof=1, align=1 // CHECK-NEXT: | nvsize=0, nvalign=1] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct OB (empty) +// CHECK-LABEL: 0 | struct OB (empty){{$}} // CHECK-NEXT: | [sizeof=1, align=1 // CHECK-NEXT: | nvsize=0, nvalign=1] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct OC +// CHECK-LABEL: 0 | struct OC{{$}} // CHECK-NEXT: 0 | (OC vbtable pointer) // CHECK-NEXT: 4 | struct OA (virtual base) (empty) // CHECK-NEXT: 8 | struct OB (virtual base) (empty) // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct OD +// CHECK-LABEL: 0 | struct OD{{$}} // CHECK-NEXT: 0 | struct OC (base) // CHECK-NEXT: 0 | (OC vbtable pointer) // CHECK-NEXT: 4 | struct OA (virtual base) (empty) // CHECK-NEXT: 8 | struct OB (virtual base) (empty) // CHECK-NEXT: | [sizeof=8, align=1 // CHECK-NEXT: | nvsize=4, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct OA (empty) +// CHECK-X64-LABEL: 0 | struct OA (empty){{$}} // CHECK-X64-NEXT: | [sizeof=1, align=1 // CHECK-X64-NEXT: | nvsize=0, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct OB (empty) +// CHECK-X64-LABEL: 0 | struct OB (empty){{$}} // CHECK-X64-NEXT: | [sizeof=1, align=1 // CHECK-X64-NEXT: | nvsize=0, nvalign=1] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct OC +// CHECK-X64-LABEL: 0 | struct OC{{$}} // CHECK-X64-NEXT: 0 | (OC vbtable pointer) // CHECK-X64-NEXT: 8 | struct OA (virtual base) (empty) // CHECK-X64-NEXT: 12 | struct OB (virtual base) (empty) // CHECK-X64-NEXT: | [sizeof=16, align=8 // CHECK-X64-NEXT: | nvsize=8, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct OD +// CHECK-X64-LABEL: 0 | struct OD{{$}} // CHECK-X64-NEXT: 0 | struct OC (base) // CHECK-X64-NEXT: 0 | (OC vbtable pointer) // CHECK-X64-NEXT: 8 | struct OA (virtual base) (empty) @@ -645,14 +559,12 @@ }; #pragma pack(pop) -// CHECK: *** Dumping AST Record Layout // CHECK: 0 | struct PC // CHECK-NEXT: 0 | char a // CHECK-NEXT: 8 | struct PA x // CHECK-NEXT: 8 | int c // CHECK-NEXT: | [sizeof=16, align=8 // CHECK-NEXT: | nvsize=12, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout // CHECK-X64: 0 | struct PC // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 8 | struct PA x @@ -669,14 +581,12 @@ }; #pragma pack(pop) -// CHECK: *** Dumping AST Record Layout // CHECK: 0 | struct PE // CHECK-NEXT: 0 | char a // CHECK-NEXT: 8 | struct PA x // CHECK-NEXT: 8 | int c // CHECK-NEXT: | [sizeof=16, align=8 // CHECK-NEXT: | nvsize=12, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout // CHECK-X64: 0 | struct PE // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 8 | struct PA x @@ -692,14 +602,12 @@ }; #pragma pack(pop) -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct QB +// CHECK-LABEL: 0 | struct QB{{$}} // CHECK-NEXT: 0 | char a // CHECK-NEXT: 2 | QA b // CHECK-NEXT: | [sizeof=6, align=2 // CHECK-NEXT: | nvsize=6, nvalign=2] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct QB +// CHECK-X64-LABEL: 0 | struct QB{{$}} // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 2 | QA b // CHECK-X64-NEXT: | [sizeof=6, align=2 @@ -710,14 +618,12 @@ QA b; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct QC +// CHECK-LABEL: 0 | struct QC{{$}} // CHECK-NEXT: 0 | char a // CHECK-NEXT: 4 | QA b // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct QC +// CHECK-X64-LABEL: 0 | struct QC{{$}} // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT: 4 | QA b // CHECK-X64-NEXT: | [sizeof=8, align=4 @@ -728,14 +634,12 @@ QA b : 3; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct QD +// CHECK-LABEL: 0 | struct QD{{$}} // CHECK-NEXT: 0 | char a // CHECK-NEXT:4:0-2 | QA b // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct QD +// CHECK-X64-LABEL: 0 | struct QD{{$}} // CHECK-X64-NEXT: 0 | char a // CHECK-X64-NEXT:4:0-2 | QA b // CHECK-X64-NEXT: | [sizeof=8, align=4 @@ -745,13 +649,11 @@ long long FlexArrayMemb[0]; }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct EmptyAlignedLongLongMemb +// CHECK-LABEL: 0 | struct EmptyAlignedLongLongMemb{{$}} // CHECK-NEXT: 0 | long long [0] FlexArrayMemb // CHECK-NEXT: | [sizeof=8, align=8 // CHECK-NEXT: | nvsize=0, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct EmptyAlignedLongLongMemb +// CHECK-X64-LABEL: 0 | struct EmptyAlignedLongLongMemb{{$}} // CHECK-X64-NEXT: 0 | long long [0] FlexArrayMemb // CHECK-X64-NEXT: | [sizeof=8, align=8 // CHECK-X64-NEXT: | nvsize=0, nvalign=8] @@ -762,13 +664,11 @@ }; #pragma pack() -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct EmptyPackedAlignedLongLongMemb +// CHECK-LABEL: 0 | struct EmptyPackedAlignedLongLongMemb{{$}} // CHECK-NEXT: 0 | long long [0] FlexArrayMemb // CHECK-NEXT: | [sizeof=4, align=4 // CHECK-NEXT: | nvsize=0, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct EmptyPackedAlignedLongLongMemb +// CHECK-X64-LABEL: 0 | struct EmptyPackedAlignedLongLongMemb{{$}} // CHECK-X64-NEXT: 0 | long long [0] FlexArrayMemb // CHECK-X64-NEXT: | [sizeof=4, align=4 // CHECK-X64-NEXT: | nvsize=0, nvalign=4] diff --git a/clang/test/Layout/ms-x86-primary-bases.cpp b/clang/test/Layout/ms-x86-primary-bases.cpp --- a/clang/test/Layout/ms-x86-primary-bases.cpp +++ b/clang/test/Layout/ms-x86-primary-bases.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -15,18 +15,14 @@ struct A : virtual B0 { }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A // CHECK-NEXT: 0 | (A vbtable pointer) // CHECK-NEXT: 4 | struct B0 (virtual base) // CHECK-NEXT: 4 | (B0 vftable pointer) // CHECK-NEXT: 8 | int a // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct A +// CHECK-X64-LABEL: 0 | struct A // CHECK-X64-NEXT: 0 | (A vbtable pointer) // CHECK-X64-NEXT: 8 | struct B0 (virtual base) // CHECK-X64-NEXT: 8 | (B0 vftable pointer) @@ -38,16 +34,14 @@ virtual void f() { printf("B"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B // CHECK-NEXT: 0 | (B vbtable pointer) // CHECK-NEXT: 4 | struct B0 (virtual base) // CHECK-NEXT: 4 | (B0 vftable pointer) // CHECK-NEXT: 8 | int a // CHECK-NEXT: | [sizeof=12, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct B +// CHECK-X64-LABEL: 0 | struct B // CHECK-X64-NEXT: 0 | (B vbtable pointer) // CHECK-X64-NEXT: 8 | struct B0 (virtual base) // CHECK-X64-NEXT: 8 | (B0 vftable pointer) @@ -59,8 +53,7 @@ virtual void g() { printf("A"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C // CHECK-NEXT: 0 | (C vftable pointer) // CHECK-NEXT: 4 | (C vbtable pointer) // CHECK-NEXT: 8 | struct B0 (virtual base) @@ -68,8 +61,7 @@ // CHECK-NEXT: 12 | int a // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C +// CHECK-X64-LABEL: 0 | struct C // CHECK-X64-NEXT: 0 | (C vftable pointer) // CHECK-X64-NEXT: 8 | (C vbtable pointer) // CHECK-X64-NEXT: 16 | struct B0 (virtual base) @@ -83,9 +75,7 @@ virtual void g() { printf("D"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D // CHECK-NEXT: 0 | (D vftable pointer) // CHECK-NEXT: 4 | (D vbtable pointer) // CHECK-NEXT: 8 | struct B2 (virtual base) @@ -95,9 +85,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D // CHECK-X64-NEXT: 0 | (D vftable pointer) // CHECK-X64-NEXT: 8 | (D vbtable pointer) // CHECK-X64-NEXT: 16 | struct B2 (virtual base) @@ -113,9 +101,7 @@ virtual void g() { printf("E"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E // CHECK-NEXT: 0 | struct B0 (primary base) // CHECK-NEXT: 0 | (B0 vftable pointer) // CHECK-NEXT: 4 | int a @@ -125,9 +111,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct E +// CHECK-X64-LABEL: 0 | struct E // CHECK-X64-NEXT: 0 | struct B0 (primary base) // CHECK-X64-NEXT: 0 | (B0 vftable pointer) // CHECK-X64-NEXT: 8 | int a @@ -141,8 +125,7 @@ struct F : virtual B0, virtual B1 { }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F // CHECK-NEXT: 0 | (F vbtable pointer) // CHECK-NEXT: 4 | struct B0 (virtual base) // CHECK-NEXT: 4 | (B0 vftable pointer) @@ -152,8 +135,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F +// CHECK-X64-LABEL: 0 | struct F // CHECK-X64-NEXT: 0 | (F vbtable pointer) // CHECK-X64-NEXT: 8 | struct B0 (virtual base) // CHECK-X64-NEXT: 8 | (B0 vftable pointer) @@ -166,10 +148,7 @@ struct AX : B0X, B1X { int a; AX() : a(0xf000000A) {} virtual void f() { printf("A"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct AX +// CHECK-LABEL: 0 | struct AX // CHECK-NEXT: 0 | struct B1X (primary base) // CHECK-NEXT: 0 | (B1X vftable pointer) // CHECK-NEXT: 4 | int a @@ -178,10 +157,7 @@ // CHECK-NEXT: 12 | int a // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct AX +// CHECK-X64-LABEL: 0 | struct AX // CHECK-X64-NEXT: 0 | struct B1X (primary base) // CHECK-X64-NEXT: 0 | (B1X vftable pointer) // CHECK-X64-NEXT: 8 | int a @@ -193,8 +169,7 @@ struct BX : B0X, B1X { int a; BX() : a(0xf000000B) {} virtual void g() { printf("B"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct BX +// CHECK-LABEL: 0 | struct BX // CHECK-NEXT: 0 | struct B1X (primary base) // CHECK-NEXT: 0 | (B1X vftable pointer) // CHECK-NEXT: 4 | int a @@ -203,8 +178,7 @@ // CHECK-NEXT: 12 | int a // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=16, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct BX +// CHECK-X64-LABEL: 0 | struct BX // CHECK-X64-NEXT: 0 | struct B1X (primary base) // CHECK-X64-NEXT: 0 | (B1X vftable pointer) // CHECK-X64-NEXT: 8 | int a @@ -216,9 +190,7 @@ struct CX : B0X, B2X { int a; CX() : a(0xf000000C) {} virtual void g() { printf("C"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct CX +// CHECK-LABEL: 0 | struct CX // CHECK-NEXT: 0 | (CX vftable pointer) // CHECK-NEXT: 4 | struct B0X (base) // CHECK-NEXT: 4 | int a @@ -231,9 +203,7 @@ // CHECK-NEXT: 24 | int a // CHECK-NEXT: | [sizeof=28, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct CX +// CHECK-X64-LABEL: 0 | struct CX // CHECK-X64-NEXT: 0 | (CX vftable pointer) // CHECK-X64-NEXT: 8 | struct B0X (base) // CHECK-X64-NEXT: 8 | int a @@ -249,8 +219,7 @@ struct DX : virtual B1X { int a; DX() : a(0xf000000D) {} virtual void f() { printf("D"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct DX +// CHECK-LABEL: 0 | struct DX // CHECK-NEXT: 0 | (DX vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | (vtordisp for vbase B1X) @@ -259,8 +228,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct DX +// CHECK-X64-LABEL: 0 | struct DX // CHECK-X64-NEXT: 0 | (DX vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 20 | (vtordisp for vbase B1X) @@ -272,8 +240,7 @@ struct EX : virtual B1X { int a; EX() : a(0xf000000E) {} virtual void g() { printf("E"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct EX +// CHECK-LABEL: 0 | struct EX // CHECK-NEXT: 0 | (EX vftable pointer) // CHECK-NEXT: 4 | (EX vbtable pointer) // CHECK-NEXT: 8 | int a @@ -282,8 +249,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct EX +// CHECK-X64-LABEL: 0 | struct EX // CHECK-X64-NEXT: 0 | (EX vftable pointer) // CHECK-X64-NEXT: 8 | (EX vbtable pointer) // CHECK-X64-NEXT: 16 | int a @@ -295,8 +261,7 @@ struct FX : virtual B1X { int a; FX() : a(0xf000000F) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct FX +// CHECK-LABEL: 0 | struct FX // CHECK-NEXT: 0 | (FX vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | struct B1X (virtual base) @@ -304,8 +269,7 @@ // CHECK-NEXT: 12 | int a // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct FX +// CHECK-X64-LABEL: 0 | struct FX // CHECK-X64-NEXT: 0 | (FX vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B1X (virtual base) diff --git a/clang/test/Layout/ms-x86-vfvb-alignment.cpp b/clang/test/Layout/ms-x86-vfvb-alignment.cpp --- a/clang/test/Layout/ms-x86-vfvb-alignment.cpp +++ b/clang/test/Layout/ms-x86-vfvb-alignment.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>&1 \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -15,10 +15,7 @@ struct A : B0, virtual B1 { __declspec(align(16)) int a; A() : a(0xf000000A) {} virtual void f() { printf("A"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A // CHECK-NEXT: 0 | (A vftable pointer) // CHECK-NEXT: 16 | struct B0 (base) // CHECK-NEXT: 16 | int a @@ -28,10 +25,7 @@ // CHECK-NEXT: 64 | char a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct A +// CHECK-X64-LABEL: 0 | struct A // CHECK-X64-NEXT: 0 | (A vftable pointer) // CHECK-X64-NEXT: 16 | struct B0 (base) // CHECK-X64-NEXT: 16 | int a @@ -42,11 +36,53 @@ // CHECK-X64-NEXT: | [sizeof=80, align=16 // CHECK-X64-NEXT: | nvsize=64, nvalign=16] +struct C : B4 { + int a; + C() : a(0xf000000C) {} + virtual void f() { printf("C"); } +}; + +// CHECK-LABEL: 0 | struct C +// CHECK-NEXT: 0 | (C vftable pointer) +// CHECK-NEXT: 16 | struct B4 (base) +// CHECK-NEXT: 16 | (B4 vbtable pointer) +// CHECK-NEXT: 20 | int a +// CHECK-NEXT: 24 | int a +// CHECK-NEXT: 32 | struct B3 (virtual base) +// CHECK-NEXT: 32 | int a +// CHECK-NEXT: | [sizeof=48, align=16 +// CHECK-NEXT: | nvsize=32, nvalign=16] +// CHECK-X64-LABEL: 0 | struct C +// CHECK-X64-NEXT: 0 | (C vftable pointer) +// CHECK-X64-NEXT: 16 | struct B4 (base) +// CHECK-X64-NEXT: 16 | (B4 vbtable pointer) +// CHECK-X64-NEXT: 24 | int a +// CHECK-X64-NEXT: 32 | int a +// CHECK-X64-NEXT: 48 | struct B3 (virtual base) +// CHECK-X64-NEXT: 48 | int a +// CHECK-X64-NEXT: | [sizeof=64, align=16 +// CHECK-X64-NEXT: | nvsize=48, nvalign=16] + +struct K { + int a; + K() : a(0xf0000013) {} + virtual void f() { printf("K"); } +}; + +// CHECK-LABEL: 0 | struct K +// CHECK-NEXT: 0 | (K vftable pointer) +// CHECK-NEXT: 4 | int a +// CHECK-NEXT: | [sizeof=8, align=4 +// CHECK-NEXT: | nvsize=8, nvalign=4] +// CHECK-X64-LABEL: 0 | struct K +// CHECK-X64-NEXT: 0 | (K vftable pointer) +// CHECK-X64-NEXT: 8 | int a +// CHECK-X64-NEXT: | [sizeof=16, align=8 +// CHECK-X64-NEXT: | nvsize=16, nvalign=8] + struct B : A, B2 { int a; B() : a(0xf000000B) {} virtual void f() { printf("B"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B{{$}} // CHECK-NEXT: 0 | struct A (primary base) // CHECK-NEXT: 0 | (A vftable pointer) // CHECK-NEXT: 16 | struct B0 (base) @@ -61,9 +97,7 @@ // CHECK-NEXT: 80 | char a // CHECK-NEXT: | [sizeof=96, align=16 // CHECK-NEXT: | nvsize=80, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct B +// CHECK-X64-LABEL: 0 | struct B{{$}} // CHECK-X64-NEXT: 0 | struct A (primary base) // CHECK-X64-NEXT: 0 | (A vftable pointer) // CHECK-X64-NEXT: 16 | struct B0 (base) @@ -79,39 +113,9 @@ // CHECK-X64-NEXT: | [sizeof=112, align=16 // CHECK-X64-NEXT: | nvsize=96, nvalign=16] -struct C : B4 { int a; C() : a(0xf000000C) {} virtual void f() { printf("C"); } }; - -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C -// CHECK-NEXT: 0 | (C vftable pointer) -// CHECK-NEXT: 16 | struct B4 (base) -// CHECK-NEXT: 16 | (B4 vbtable pointer) -// CHECK-NEXT: 20 | int a -// CHECK-NEXT: 24 | int a -// CHECK-NEXT: 32 | struct B3 (virtual base) -// CHECK-NEXT: 32 | int a -// CHECK-NEXT: | [sizeof=48, align=16 -// CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C -// CHECK-X64-NEXT: 0 | (C vftable pointer) -// CHECK-X64-NEXT: 16 | struct B4 (base) -// CHECK-X64-NEXT: 16 | (B4 vbtable pointer) -// CHECK-X64-NEXT: 24 | int a -// CHECK-X64-NEXT: 32 | int a -// CHECK-X64-NEXT: 48 | struct B3 (virtual base) -// CHECK-X64-NEXT: 48 | int a -// CHECK-X64-NEXT: | [sizeof=64, align=16 -// CHECK-X64-NEXT: | nvsize=48, nvalign=16] - struct D : C { int a; D() : a(0xf000000D) {} virtual void f() { printf("D"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D // CHECK-NEXT: 0 | struct C (primary base) // CHECK-NEXT: 0 | (C vftable pointer) // CHECK-NEXT: 16 | struct B4 (base) @@ -123,8 +127,7 @@ // CHECK-NEXT: 48 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D // CHECK-X64-NEXT: 0 | struct C (primary base) // CHECK-X64-NEXT: 0 | (C vftable pointer) // CHECK-X64-NEXT: 16 | struct B4 (base) @@ -139,8 +142,7 @@ struct E : virtual C { int a; E() : a(0xf000000E) {} virtual void f() { printf("E"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct E +// CHECK-LABEL: 0 | struct E // CHECK-NEXT: 0 | (E vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 16 | struct B3 (virtual base) @@ -154,8 +156,7 @@ // CHECK-NEXT: 72 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=8, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct E +// CHECK-X64-LABEL: 0 | struct E // CHECK-X64-NEXT: 0 | (E vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 16 | struct B3 (virtual base) @@ -172,8 +173,7 @@ struct F : B3, virtual B0 { int a; F() : a(0xf000000F) {} virtual void f() { printf("F"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct F +// CHECK-LABEL: 0 | struct F // CHECK-NEXT: 0 | (F vftable pointer) // CHECK-NEXT: 16 | struct B3 (base) // CHECK-NEXT: 16 | int a @@ -183,8 +183,7 @@ // CHECK-NEXT: 64 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct F +// CHECK-X64-LABEL: 0 | struct F // CHECK-X64-NEXT: 0 | (F vftable pointer) // CHECK-X64-NEXT: 16 | struct B3 (base) // CHECK-X64-NEXT: 16 | int a @@ -197,9 +196,7 @@ struct G : B2, B6, virtual B1 { int a; G() : a(0xf0000010) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct G +// CHECK-LABEL: 0 | struct G // CHECK-NEXT: 0 | struct B6 (primary base) // CHECK-NEXT: 0 | (B6 vftable pointer) // CHECK-NEXT: 4 | int a @@ -211,9 +208,7 @@ // CHECK-NEXT: 20 | char a // CHECK-NEXT: | [sizeof=21, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct G +// CHECK-X64-LABEL: 0 | struct G // CHECK-X64-NEXT: 0 | struct B6 (primary base) // CHECK-X64-NEXT: 0 | (B6 vftable pointer) // CHECK-X64-NEXT: 8 | int a @@ -228,8 +223,7 @@ struct H : B6, B2, virtual B1 { int a; H() : a(0xf0000011) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct H +// CHECK-LABEL: 0 | struct H // CHECK-NEXT: 0 | struct B6 (primary base) // CHECK-NEXT: 0 | (B6 vftable pointer) // CHECK-NEXT: 4 | int a @@ -241,8 +235,7 @@ // CHECK-NEXT: 20 | char a // CHECK-NEXT: | [sizeof=21, align=4 // CHECK-NEXT: | nvsize=20, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct H +// CHECK-X64-LABEL: 0 | struct H // CHECK-X64-NEXT: 0 | struct B6 (primary base) // CHECK-X64-NEXT: 0 | (B6 vftable pointer) // CHECK-X64-NEXT: 8 | int a @@ -257,8 +250,7 @@ struct I : B0, virtual B1 { int a; int a1; __declspec(align(16)) int a2; I() : a(0xf0000011), a1(0xf0000011), a2(0xf0000011) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct I +// CHECK-LABEL: 0 | struct I // CHECK-NEXT: 0 | struct B0 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 4 | (I vbtable pointer) @@ -269,8 +261,7 @@ // CHECK-NEXT: 48 | char a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct I +// CHECK-X64-LABEL: 0 | struct I // CHECK-X64-NEXT: 0 | struct B0 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 8 | (I vbtable pointer) @@ -284,8 +275,7 @@ struct J : B0, B3, virtual B1 { int a; int a1; J() : a(0xf0000012), a1(0xf0000012) {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct J +// CHECK-LABEL: 0 | struct J // CHECK-NEXT: 0 | struct B0 (base) // CHECK-NEXT: 0 | int a // CHECK-NEXT: 16 | struct B3 (base) @@ -297,8 +287,7 @@ // CHECK-NEXT: 64 | char a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct J +// CHECK-X64-LABEL: 0 | struct J // CHECK-X64-NEXT: 0 | struct B0 (base) // CHECK-X64-NEXT: 0 | int a // CHECK-X64-NEXT: 16 | struct B3 (base) @@ -311,25 +300,9 @@ // CHECK-X64-NEXT: | [sizeof=80, align=16 // CHECK-X64-NEXT: | nvsize=64, nvalign=16] -struct K { int a; K() : a(0xf0000013) {} virtual void f() { printf("K"); } }; - -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct K -// CHECK-NEXT: 0 | (K vftable pointer) -// CHECK-NEXT: 4 | int a -// CHECK-NEXT: | [sizeof=8, align=4 -// CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct K -// CHECK-X64-NEXT: 0 | (K vftable pointer) -// CHECK-X64-NEXT: 8 | int a -// CHECK-X64-NEXT: | [sizeof=16, align=8 -// CHECK-X64-NEXT: | nvsize=16, nvalign=8] - struct L : virtual K { int a; L() : a(0xf0000014) {} virtual void g() { printf("L"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct L +// CHECK-LABEL: 0 | struct L // CHECK-NEXT: 0 | (L vftable pointer) // CHECK-NEXT: 4 | (L vbtable pointer) // CHECK-NEXT: 8 | int a @@ -338,8 +311,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=12, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct L +// CHECK-X64-LABEL: 0 | struct L // CHECK-X64-NEXT: 0 | (L vftable pointer) // CHECK-X64-NEXT: 8 | (L vbtable pointer) // CHECK-X64-NEXT: 16 | int a @@ -351,8 +323,7 @@ struct M : virtual K { int a; M() : a(0xf0000015) {} virtual void f() { printf("M"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct M +// CHECK-LABEL: 0 | struct M // CHECK-NEXT: 0 | (M vbtable pointer) // CHECK-NEXT: 4 | int a // CHECK-NEXT: 8 | (vtordisp for vbase K) @@ -361,8 +332,7 @@ // CHECK-NEXT: 16 | int a // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct M +// CHECK-X64-LABEL: 0 | struct M // CHECK-X64-NEXT: 0 | (M vbtable pointer) // CHECK-X64-NEXT: 8 | int a // CHECK-X64-NEXT: 20 | (vtordisp for vbase K) diff --git a/clang/test/Layout/ms-x86-vfvb-sharing.cpp b/clang/test/Layout/ms-x86-vfvb-sharing.cpp --- a/clang/test/Layout/ms-x86-vfvb-sharing.cpp +++ b/clang/test/Layout/ms-x86-vfvb-sharing.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>&1 \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace // RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple x86_64-pc-win32 -fms-extensions -fdump-record-layouts -fsyntax-only %s 2>/dev/null \ -// RUN: | FileCheck %s -check-prefix CHECK-X64 +// RUN: | FileCheck %s -check-prefix CHECK-X64 --strict-whitespace extern "C" int printf(const char *fmt, ...); @@ -17,10 +17,7 @@ virtual void f() { printf("A"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A // CHECK-NEXT: 0 | (A vftable pointer) // CHECK-NEXT: 16 | struct B0 (base) // CHECK-NEXT: 16 | int a @@ -30,10 +27,7 @@ // CHECK-NEXT: 64 | int a // CHECK-NEXT: | [sizeof=80, align=16 // CHECK-NEXT: | nvsize=64, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct A +// CHECK-X64-LABEL: 0 | struct A // CHECK-X64-NEXT: 0 | (A vftable pointer) // CHECK-X64-NEXT: 16 | struct B0 (base) // CHECK-X64-NEXT: 16 | int a @@ -50,9 +44,7 @@ virtual void f() { printf("B"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct B +// CHECK-LABEL: 0 | struct B{{$}} // CHECK-NEXT: 0 | struct B2 (primary base) // CHECK-NEXT: 0 | (B2 vftable pointer) // CHECK-NEXT: 4 | struct B0 (base) @@ -63,9 +55,7 @@ // CHECK-NEXT: 48 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct B +// CHECK-X64-LABEL: 0 | struct B{{$}} // CHECK-X64-NEXT: 0 | struct B2 (primary base) // CHECK-X64-NEXT: 0 | (B2 vftable pointer) // CHECK-X64-NEXT: 8 | struct B0 (base) @@ -83,9 +73,7 @@ virtual void f() { printf("C"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C // CHECK-NEXT: 0 | (C vftable pointer) // CHECK-NEXT: 16 | struct B3 (base) // CHECK-NEXT: 16 | (B3 vbtable pointer) @@ -96,9 +84,7 @@ // CHECK-NEXT: 48 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=48, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C +// CHECK-X64-LABEL: 0 | struct C // CHECK-X64-NEXT: 0 | (C vftable pointer) // CHECK-X64-NEXT: 16 | struct B3 (base) // CHECK-X64-NEXT: 16 | (B3 vbtable pointer) @@ -116,9 +102,7 @@ virtual void f() { printf("D"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D // CHECK-NEXT: 0 | struct B4 (primary base) // CHECK-NEXT: 0 | (B4 vftable pointer) // CHECK-NEXT: 4 | (B4 vbtable pointer) @@ -129,9 +113,7 @@ // CHECK-NEXT: 32 | int a // CHECK-NEXT: | [sizeof=48, align=16 // CHECK-NEXT: | nvsize=32, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D // CHECK-X64-NEXT: 0 | struct B4 (primary base) // CHECK-X64-NEXT: 0 | (B4 vftable pointer) // CHECK-X64-NEXT: 8 | (B4 vbtable pointer) diff --git a/clang/test/Layout/ms-x86-vtordisp.cpp b/clang/test/Layout/ms-x86-vtordisp.cpp --- a/clang/test/Layout/ms-x86-vtordisp.cpp +++ b/clang/test/Layout/ms-x86-vtordisp.cpp @@ -29,10 +29,7 @@ virtual void g() { printf("A"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct A +// CHECK-LABEL: 0 | struct A{{$}} // CHECK-NEXT: 0 | (A vftable pointer) // CHECK-NEXT: 4 | (A vbtable pointer) // CHECK-NEXT: 8 | int a @@ -46,10 +43,7 @@ // CHECK-NEXT: 52 | int a // CHECK-NEXT: | [sizeof=64, align=16 // CHECK-NEXT: | nvsize=12, nvalign=16] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct A +// CHECK-X64-LABEL: 0 | struct A{{$}} // CHECK-X64-NEXT: 0 | (A vftable pointer) // CHECK-X64-NEXT: 8 | (A vbtable pointer) // CHECK-X64-NEXT: 16 | int a @@ -71,10 +65,7 @@ virtual void g() { printf("C"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct C +// CHECK-LABEL: 0 | struct C{{$}} // CHECK-NEXT: 0 | (C vftable pointer) // CHECK-NEXT: 32 | struct VAlign32 (base) // CHECK-NEXT: 32 | (VAlign32 vbtable pointer) @@ -90,10 +81,7 @@ // CHECK-NEXT: 128 | struct Align32 (virtual base) (empty) // CHECK-NEXT: | [sizeof=128, align=32 // CHECK-NEXT: | nvsize=64, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct C +// CHECK-X64-LABEL: 0 | struct C{{$}} // CHECK-X64-NEXT: 0 | (C vftable pointer) // CHECK-X64-NEXT: 32 | struct VAlign32 (base) // CHECK-X64-NEXT: 32 | (VAlign32 vbtable pointer) @@ -117,8 +105,7 @@ virtual void g() { printf("D"); } }; -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct D +// CHECK-LABEL: 0 | struct D{{$}} // CHECK-NEXT: 0 | (D vftable pointer) // CHECK-NEXT: 4 | (D vbtable pointer) // CHECK-NEXT: 8 | int a @@ -132,8 +119,7 @@ // CHECK-NEXT: 84 | int a // CHECK-NEXT: | [sizeof=96, align=32 // CHECK-NEXT: | nvsize=12, nvalign=32] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct D +// CHECK-X64-LABEL: 0 | struct D{{$}} // CHECK-X64-NEXT: 0 | (D vftable pointer) // CHECK-X64-NEXT: 8 | (D vbtable pointer) // CHECK-X64-NEXT: 16 | int a @@ -156,17 +142,13 @@ }; CT::~CT(){} -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct CT +// CHECK-LABEL: 0 | struct CT{{$}} // CHECK-NEXT: 0 | (CT vbtable pointer) // CHECK-NEXT: 4 | struct AT (virtual base) // CHECK-NEXT: 4 | (AT vftable pointer) // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct CT +// CHECK-X64-LABEL: 0 | struct CT{{$}} // CHECK-X64-NEXT: 0 | (CT vbtable pointer) // CHECK-X64-NEXT: 8 | struct AT (virtual base) // CHECK-X64-NEXT: 8 | (AT vftable pointer) @@ -187,10 +169,7 @@ virtual void foo() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct XC +// CHECK-LABEL: 0 | struct XC{{$}} // CHECK-NEXT: 0 | (XC vbtable pointer) // CHECK-NEXT: 4 | (vtordisp for vbase XB) // CHECK-NEXT: 8 | struct XB (virtual base) @@ -200,10 +179,7 @@ // CHECK-NEXT: 24 | int b // CHECK-NEXT: | [sizeof=32, align=8 // CHECK-NEXT: | nvsize=4, nvalign=8] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct XC +// CHECK-X64-LABEL: 0 | struct XC{{$}} // CHECK-X64-NEXT: 0 | (XC vbtable pointer) // CHECK-X64-NEXT: 12 | (vtordisp for vbase XB) // CHECK-X64-NEXT: 16 | struct XB (virtual base) @@ -219,10 +195,7 @@ struct A { virtual ~A(); virtual void foo(); int a; }; struct B : virtual A { virtual ~B(); virtual void bar(); int b; }; struct C : virtual B { int c; }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct pragma_test1::C +// CHECK-LABEL: 0 | struct pragma_test1::C{{$}} // CHECK-NEXT: 0 | (C vbtable pointer) // CHECK-NEXT: 4 | int c // CHECK-NEXT: 8 | struct pragma_test1::A (virtual base) @@ -234,9 +207,6 @@ // CHECK-NEXT: 24 | int b // CHECK-NEXT: | [sizeof=28, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout } namespace pragma_test2 { @@ -245,10 +215,7 @@ struct B : virtual A { virtual ~B(); virtual void bar(); int b; }; struct C : virtual B { int c; }; #pragma vtordisp(pop) -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct pragma_test2::C +// CHECK-LABEL: 0 | struct pragma_test2::C{{$}} // CHECK-NEXT: 0 | (C vbtable pointer) // CHECK-NEXT: 4 | int c // CHECK-NEXT: 8 | (vtordisp for vbase A) @@ -263,9 +230,6 @@ // CHECK-NEXT: 32 | int b // CHECK-NEXT: | [sizeof=36, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout } namespace pragma_test3 { @@ -274,10 +238,7 @@ struct B : virtual A { virtual ~B(); virtual void foo(); int b; }; struct C : virtual B { int c; }; #pragma vtordisp(pop) -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct pragma_test3::C +// CHECK-LABEL: 0 | struct pragma_test3::C{{$}} // CHECK-NEXT: 0 | (C vbtable pointer) // CHECK-NEXT: 4 | int c // CHECK-NEXT: 8 | (vtordisp for vbase A) @@ -290,9 +251,6 @@ // CHECK-NEXT: 24 | int b // CHECK-NEXT: | [sizeof=28, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout } namespace pragma_test4 { @@ -315,10 +273,7 @@ #pragma vtordisp(pop) struct C : virtual B { int c; }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct pragma_test4::C +// CHECK-LABEL: 0 | struct pragma_test4::C{{$}} // CHECK-NEXT: 0 | (C vbtable pointer) // CHECK-NEXT: 4 | int c // Pragma applies to B, which has vbase A. @@ -333,9 +288,6 @@ // CHECK-NEXT: 28 | int b // CHECK-NEXT: | [sizeof=32, align=4 // CHECK-NEXT: | nvsize=8, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout } struct GA { @@ -348,11 +300,7 @@ }; struct GD: public virtual GC, public virtual GB {}; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct GD +// CHECK-LABEL: 0 | struct GD{{$}} // CHECK-NEXT: 0 | (GD vbtable pointer) // CHECK-NEXT: 4 | (vtordisp for vbase GA) // CHECK-NEXT: 8 | struct GA (virtual base) @@ -364,11 +312,7 @@ // CHECK-NEXT: 16 | (GA vftable pointer) // CHECK-NEXT: | [sizeof=20, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct GD +// CHECK-X64-LABEL: 0 | struct GD{{$}} // CHECK-X64-NEXT: 0 | (GD vbtable pointer) // CHECK-X64-NEXT: 12 | (vtordisp for vbase GA) // CHECK-X64-NEXT: 16 | struct GA (virtual base) @@ -391,10 +335,7 @@ struct HC : virtual HB {}; #pragma vtordisp(pop) -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct HC +// CHECK-LABEL: 0 | struct HC{{$}} // CHECK-NEXT: 0 | (HC vbtable pointer) // CHECK-NEXT: 4 | (vtordisp for vbase HA) // CHECK-NEXT: 8 | struct HA (virtual base) @@ -403,10 +344,7 @@ // CHECK-NEXT: 12 | (HB vbtable pointer) // CHECK-NEXT: | [sizeof=16, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct HC +// CHECK-X64-LABEL: 0 | struct HC{{$}} // CHECK-X64-NEXT: 0 | (HC vbtable pointer) // CHECK-X64-NEXT: 12 | (vtordisp for vbase HA) // CHECK-X64-NEXT: 16 | struct HA (virtual base) @@ -424,17 +362,13 @@ IB() {} }; -// CHECK: *** Dumping AST Record Layout -// CHECK: *** Dumping AST Record Layout -// CHECK-NEXT: 0 | struct IB +// CHECK-LABEL: 0 | struct IB{{$}} // CHECK-NEXT: 0 | (IB vbtable pointer) // CHECK-NEXT: 4 | struct IA (virtual base) // CHECK-NEXT: 4 | (IA vftable pointer) // CHECK-NEXT: | [sizeof=8, align=4 // CHECK-NEXT: | nvsize=4, nvalign=4] -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64: *** Dumping AST Record Layout -// CHECK-X64-NEXT: 0 | struct IB +// CHECK-X64-LABEL: 0 | struct IB{{$}} // CHECK-X64-NEXT: 0 | (IB vbtable pointer) // CHECK-X64-NEXT: 8 | struct IA (virtual base) // CHECK-X64-NEXT: 8 | (IA vftable pointer) diff --git a/clang/test/Sema/ms_class_layout.cpp b/clang/test/Sema/ms_class_layout.cpp --- a/clang/test/Sema/ms_class_layout.cpp +++ b/clang/test/Sema/ms_class_layout.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts %s 2>/dev/null \ -// RUN: | FileCheck %s +// RUN: | FileCheck %s --strict-whitespace #pragma pack(push, 8) @@ -160,25 +160,14 @@ return 0; } -// CHECK: 0 | class D -// CHECK-NEXT: 0 | (D vftable pointer) -// CHECK-NEXT: 8 | double a - -// CHECK-NEXT: sizeof=16, align=8 -// CHECK-NEXT: nvsize=16, nvalign=8 - -// CHECK: %class.D = type { i32 (...)**, double } - -// CHECK: 0 | class B +// CHECK-LABEL: 0 | class B{{$}} // CHECK-NEXT: 0 | (B vftable pointer) // CHECK-NEXT: 4 | int b_field // CHECK-NEXT: sizeof=8, align=4 // CHECK-NEXT: nvsize=8, nvalign=4 -// CHECK: %class.B = type { i32 (...)**, i32 } - -// CHECK: 0 | class A +// CHECK-LABEL: 0 | class A{{$}} // CHECK-NEXT: 0 | class B (primary base) // CHECK-NEXT: 0 | (B vftable pointer) // CHECK-NEXT: 4 | int b_field @@ -188,7 +177,14 @@ // CHECK-NEXT: sizeof=16, align=4 // CHECK-NEXT: nvsize=16, nvalign=4 -// CHECK: 0 | class C +// CHECK-LABEL: 0 | class D{{$}} +// CHECK-NEXT: 0 | (D vftable pointer) +// CHECK-NEXT: 8 | double a + +// CHECK-NEXT: sizeof=16, align=8 +// CHECK-NEXT: nvsize=16, nvalign=8 + +// CHECK-LABEL: 0 | class C{{$}} // CHECK-NEXT: 0 | class D (primary base) // CHECK-NEXT: 0 | (D vftable pointer) // CHECK-NEXT: 8 | double a @@ -210,12 +206,16 @@ // CHECK-NEXT: sizeof=80, align=8 // CHECK-NEXT: nvsize=64, nvalign=8 +// CHECK: %class.D = type { i32 (...)**, double } + +// CHECK: %class.B = type { i32 (...)**, i32 } + // CHECK: %class.A = type { %class.B, i32, i8 } // CHECK: %class.C = type { %class.D, %class.B, i32*, double, i32, double, i32, [4 x i8], %class.A } // CHECK: %class.C.base = type { %class.D, %class.B, i32*, double, i32, double, i32 } -// CHECK: 0 | struct BaseStruct +// CHECK-LABEL: 0 | struct BaseStruct{{$}} // CHECK-NEXT: 0 | double v0 // CHECK-NEXT: 8 | float v1 // CHECK-NEXT: 16 | class C fg @@ -241,7 +241,7 @@ // CHECK: %struct.BaseStruct = type { double, float, %class.C } -// CHECK: 0 | struct DerivedStruct +// CHECK-LABEL: 0 | struct DerivedStruct{{$}} // CHECK-NEXT: 0 | struct BaseStruct (base) // CHECK-NEXT: 0 | double v0 // CHECK-NEXT: 8 | float v1 @@ -269,12 +269,12 @@ // CHECK: %struct.DerivedStruct = type { %struct.BaseStruct, i32 } -// CHECK: 0 | struct G +// CHECK-LABEL:0 | struct G // CHECK-NEXT: 0 | int g_field // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 -// CHECK: 0 | struct H +// CHECK-LABEL: 0 | struct H{{$}} // CHECK-NEXT: 0 | struct G (base) // CHECK-NEXT: 0 | int g_field // CHECK-NEXT: 4 | (H vbtable pointer) @@ -286,7 +286,7 @@ // CHECK: %struct.H = type { %struct.G, i32*, %class.D } -// CHECK: 0 | struct I +// CHECK-LABEL: 0 | struct I{{$}} // CHECK-NEXT: 0 | (I vftable pointer) // CHECK-NEXT: 8 | (I vbtable pointer) // CHECK-NEXT: 16 | double q @@ -299,17 +299,17 @@ // CHECK: %struct.I = type { i32 (...)**, [4 x i8], i32*, double, %class.D } // CHECK: %struct.I.base = type { i32 (...)**, [4 x i8], i32*, double } -// CHECK: 0 | struct L +// CHECK-LABEL: 0 | struct L{{$}} // CHECK-NEXT: 0 | int l // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 -// CHECK: 0 | struct K +// CHECK-LABEL: 0 | struct K{{$}} // CHECK-NEXT: 0 | int k // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 -// CHECK: 0 | struct M +// CHECK-LABEL: 0 | struct M{{$}} // CHECK-NEXT: 0 | (M vbtable pointer) // CHECK-NEXT: 4 | int m // CHECK-NEXT: 8 | struct K (virtual base) @@ -319,7 +319,7 @@ //CHECK: %struct.M = type { i32*, i32, %struct.K } //CHECK: %struct.M.base = type { i32*, i32 } -// CHECK: 0 | struct N +// CHECK-LABEL: 0 | struct N{{$}} // CHECK-NEXT: 0 | (N vftable pointer) // CHECK-NEXT: 4 | struct L (base) // CHECK-NEXT: 4 | int l @@ -333,7 +333,7 @@ //CHECK: %struct.N = type { i32 (...)**, %struct.L, %struct.M.base, %struct.K } -// CHECK: 0 | struct O +// CHECK-LABEL: 0 | struct O{{$}} // CHECK-NEXT: 0 | (O vftable pointer) // CHECK-NEXT: 8 | struct H (base) // CHECK-NEXT: 8 | struct G (base) @@ -350,8 +350,7 @@ // CHECK: struct.O = type { i32 (...)**, [4 x i8], %struct.H.base, %struct.G, %class.D } // CHECK: struct.O.base = type { i32 (...)**, [4 x i8], %struct.H.base, %struct.G, [4 x i8] } - -// CHECK: 0 | struct P +// CHECK-LABEL: 0 | struct P{{$}} // CHECK-NEXT: 0 | struct M (base) // CHECK-NEXT: 0 | (M vbtable pointer) // CHECK-NEXT: 4 | int m @@ -365,18 +364,18 @@ //CHECK: %struct.P = type { %struct.M.base, i32, %struct.K, %struct.L } -// CHECK: 0 | struct R (empty) +// CHECK-LABEL: 0 | struct R (empty){{$}} // CHECK-NEXT: sizeof=1, align=1 // CHECK-NEXT: nvsize=0, nvalign=1 //CHECK: %struct.R = type { i8 } -// CHECK: 0 | struct f +// CHECK-LABEL: 0 | struct f{{$}} // CHECK-NEXT: 0 | (f vftable pointer) // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 -// CHECK: 0 | struct s +// CHECK-LABEL: 0 | struct s{{$}} // CHECK-NEXT: 0 | (s vftable pointer) // CHECK-NEXT: 4 | (s vbtable pointer) // CHECK-NEXT: 8 | int r @@ -386,12 +385,12 @@ // CHECK-NEXT: sizeof=20, align=4 // CHECK-NEXT: nvsize=12, nvalign=4 -// CHECK: 0 | class IA +// CHECK-LABEL: 0 | class IA{{$}} // CHECK-NEXT: 0 | (IA vftable pointer) // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 - -// CHECK: 0 | class ICh + +// CHECK-LABEL: 0 | class ICh{{$}} // CHECK-NEXT: 0 | (ICh vftable pointer) // CHECK-NEXT: 4 | (ICh vbtable pointer) // CHECK-NEXT: 8 | (vtordisp for vbase IA) @@ -400,7 +399,7 @@ // CHECK-NEXT: sizeof=16, align=4 // CHECK-NEXT: nvsize=8, nvalign=4 -// CHECK: 0 | struct sd +// CHECK-LABEL: 0 | struct sd{{$}} // CHECK-NEXT: 0 | (sd vbtable pointer) // CHECK-NEXT: 4 | int q // CHECK-NEXT: 8 | char y @@ -426,20 +425,18 @@ // CHECK: %class.ICh = type { i32 (...)**, i32*, i32, %class.IA } // CHECK: %struct.sd = type { i32*, i32, i8, i32, %struct.f, %struct.s.base, i32, %class.IA, %class.ICh.base } -// CHECK: 0 | struct AV +// CHECK-LABEL: 0 | struct AV{{$}} // CHECK-NEXT: 0 | (AV vftable pointer) // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 - -// CHECK: 0 | struct BV +// CHECK-LABEL: 0 | struct BV{{$}} // CHECK-NEXT: 0 | struct AV (primary base) // CHECK-NEXT: 0 | (AV vftable pointer) // CHECK-NEXT: sizeof=4, align=4 // CHECK-NEXT: nvsize=4, nvalign=4 - -// CHECK: 0 | struct CV +// CHECK-LABEL: 0 | struct CV{{$}} // CHECK-NEXT: 0 | (CV vbtable pointer) // CHECK-NEXT: 4 | (vtordisp for vbase BV) // CHECK-NEXT: 8 | struct BV (virtual base) @@ -453,7 +450,7 @@ // CHECK: %struct.CV = type { i32*, i32, %struct.BV } // CHECK: %struct.CV.base = type { i32* } -// CHECK: 0 | struct DV +// CHECK-LABEL: 0 | struct DV{{$}} // CHECK-NEXT: 0 | struct BV (primary base) // CHECK-NEXT: 0 | struct AV (primary base) // CHECK-NEXT: 0 | (AV vftable pointer) @@ -462,7 +459,7 @@ // CHECK: %struct.DV = type { %struct.BV } -// CHECK: 0 | struct EV +// CHECK-LABEL: 0 | struct EV{{$}} // CHECK-NEXT: 0 | struct DV (primary base) // CHECK-NEXT: 0 | struct BV (primary base) // CHECK-NEXT: 0 | struct AV (primary base) @@ -487,15 +484,15 @@ struct C : virtual A, virtual B { C(); virtual void foo(); }; void test() { C *c; } -// CHECK: 0 | struct test1::C -// CHECK-NEXT: 0 | (C vbtable pointer) -// CHECK-NEXT: 4 | (vtordisp for vbase A) -// CHECK-NEXT: 8 | struct test1::A (virtual base) -// CHECK-NEXT: 8 | (A vftable pointer) -// CHECK-NEXT: 12 | (vtordisp for vbase B) -// CHECK-NEXT: 16 | struct test1::B (virtual base) -// CHECK-NEXT: 16 | struct test1::A (primary base) -// CHECK-NEXT: 16 | (A vftable pointer) -// CHECK-NEXT: sizeof=20, align=4 -// CHECK-NEXT: nvsize=4, nvalign=4 + // CHECK-LABEL: 0 | struct test1::C{{$}} + // CHECK-NEXT: 0 | (C vbtable pointer) + // CHECK-NEXT: 4 | (vtordisp for vbase A) + // CHECK-NEXT: 8 | struct test1::A (virtual base) + // CHECK-NEXT: 8 | (A vftable pointer) + // CHECK-NEXT: 12 | (vtordisp for vbase B) + // CHECK-NEXT: 16 | struct test1::B (virtual base) + // CHECK-NEXT: 16 | struct test1::A (primary base) + // CHECK-NEXT: 16 | (A vftable pointer) + // CHECK-NEXT: sizeof=20, align=4 + // CHECK-NEXT: nvsize=4, nvalign=4 }