r323589 - [ASTImporter] Add support to import some AST nodes:
Author: xazax Date: Sat Jan 27 08:11:45 2018 New Revision: 323589 URL: http://llvm.org/viewvc/llvm-project?rev=323589&view=rev Log: [ASTImporter] Add support to import some AST nodes: * CXXOperatorCallExpr * SizeOfPackExpr * DependentTemplateSpecializationType * DependentSizedArray * CXXTypeidExpr * Fix importing CXXTemporaryObjectExpr Some of the changes are based on https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp Differential Revision: https://reviews.llvm.org/D42335 Modified: cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/unittests/AST/ASTImporterTest.cpp Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=323589&r1=323588&r2=323589&view=diff == --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Sat Jan 27 08:11:45 2018 @@ -52,7 +52,7 @@ namespace clang { QualType VisitConstantArrayType(const ConstantArrayType *T); QualType VisitIncompleteArrayType(const IncompleteArrayType *T); QualType VisitVariableArrayType(const VariableArrayType *T); -// FIXME: DependentSizedArrayType +QualType VisitDependentSizedArrayType(const DependentSizedArrayType *T); // FIXME: DependentSizedExtVectorType QualType VisitVectorType(const VectorType *T); QualType VisitExtVectorType(const ExtVectorType *T); @@ -78,7 +78,8 @@ namespace clang { QualType VisitElaboratedType(const ElaboratedType *T); // FIXME: DependentNameType QualType VisitPackExpansionType(const PackExpansionType *T); -// FIXME: DependentTemplateSpecializationType +QualType VisitDependentTemplateSpecializationType( +const DependentTemplateSpecializationType *T); QualType VisitObjCInterfaceType(const ObjCInterfaceType *T); QualType VisitObjCObjectType(const ObjCObjectType *T); QualType VisitObjCObjectPointerType(const ObjCObjectPointerType *T); @@ -294,6 +295,7 @@ namespace clang { Expr *VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *CE); Expr *VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E); Expr *VisitPackExpansionExpr(PackExpansionExpr *E); +Expr *VisitSizeOfPackExpr(SizeOfPackExpr *E); Expr *VisitCXXNewExpr(CXXNewExpr *CE); Expr *VisitCXXDeleteExpr(CXXDeleteExpr *E); Expr *VisitCXXConstructExpr(CXXConstructExpr *E); @@ -315,6 +317,7 @@ namespace clang { Expr *VisitCXXNamedCastExpr(CXXNamedCastExpr *E); Expr *VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E); Expr *VisitTypeTraitExpr(TypeTraitExpr *E); +Expr *VisitCXXTypeidExpr(CXXTypeidExpr *E); template @@ -527,6 +530,24 @@ QualType ASTNodeImporter::VisitVariableA Brackets); } +QualType ASTNodeImporter::VisitDependentSizedArrayType( +const DependentSizedArrayType *T) { + QualType ToElementType = Importer.Import(T->getElementType()); + if (ToElementType.isNull()) +return QualType(); + + // SizeExpr may be null if size is not specified directly. + // For example, 'int a[]'. + Expr *Size = Importer.Import(T->getSizeExpr()); + if (!Size && T->getSizeExpr()) +return QualType(); + + SourceRange Brackets = Importer.Import(T->getBracketsRange()); + return Importer.getToContext().getDependentSizedArrayType( + ToElementType, Size, T->getSizeModifier(), T->getIndexTypeCVRQualifiers(), + Brackets); +} + QualType ASTNodeImporter::VisitVectorType(const VectorType *T) { QualType ToElementType = Importer.Import(T->getElementType()); if (ToElementType.isNull()) @@ -827,6 +848,25 @@ QualType ASTNodeImporter::VisitPackExpan T->getNumExpansions()); } +QualType ASTNodeImporter::VisitDependentTemplateSpecializationType( +const DependentTemplateSpecializationType *T) { + NestedNameSpecifier *Qualifier = Importer.Import(T->getQualifier()); + if (!Qualifier && T->getQualifier()) +return QualType(); + + IdentifierInfo *Name = Importer.Import(T->getIdentifier()); + if (!Name && T->getIdentifier()) +return QualType(); + + SmallVector ToPack; + ToPack.reserve(T->getNumArgs()); + if (ImportTemplateArguments(T->getArgs(), T->getNumArgs(), ToPack)) +return QualType(); + + return Importer.getToContext().getDependentTemplateSpecializationType( +T->getKeyword(), Qualifier, Name, ToPack); +} + QualType ASTNodeImporter::VisitObjCInterfaceType(const ObjCInterfaceType *T) { ObjCInterfaceDecl *Class = dyn_cast_or_null(Importer.Import(T->getDecl())); @@ -5709,6 +5749,11 @@ Expr *ASTNodeImporter::VisitCXXTemporary if (T.isNull()) return nullptr; + + TypeSourceInfo *TInfo = Importer.Import(CE->getTypeSourceInfo()); + if (!TInfo) +return nullptr; + SmallVector Args(CE->getNumArgs()); if (ImportContainerChecked(CE->arguments(), Args)) retu
[PATCH] D42335: [ASTImporter] Supporting CXXOperatorCallExpr, SizeOfPackExpr, DependentTemplateSpecializationType, DependentSizedArray, CXXTypeidExpr importing.
This revision was automatically updated to reflect the committed changes. Closed by commit rC323589: [ASTImporter] Add support to import some AST nodes: (authored by xazax, committed by ). Changed prior to commit: https://reviews.llvm.org/D42335?vs=131406&id=131684#toc Repository: rC Clang https://reviews.llvm.org/D42335 Files: lib/AST/ASTImporter.cpp unittests/AST/ASTImporterTest.cpp Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -52,7 +52,7 @@ QualType VisitConstantArrayType(const ConstantArrayType *T); QualType VisitIncompleteArrayType(const IncompleteArrayType *T); QualType VisitVariableArrayType(const VariableArrayType *T); -// FIXME: DependentSizedArrayType +QualType VisitDependentSizedArrayType(const DependentSizedArrayType *T); // FIXME: DependentSizedExtVectorType QualType VisitVectorType(const VectorType *T); QualType VisitExtVectorType(const ExtVectorType *T); @@ -78,7 +78,8 @@ QualType VisitElaboratedType(const ElaboratedType *T); // FIXME: DependentNameType QualType VisitPackExpansionType(const PackExpansionType *T); -// FIXME: DependentTemplateSpecializationType +QualType VisitDependentTemplateSpecializationType( +const DependentTemplateSpecializationType *T); QualType VisitObjCInterfaceType(const ObjCInterfaceType *T); QualType VisitObjCObjectType(const ObjCObjectType *T); QualType VisitObjCObjectPointerType(const ObjCObjectPointerType *T); @@ -294,6 +295,7 @@ Expr *VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *CE); Expr *VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E); Expr *VisitPackExpansionExpr(PackExpansionExpr *E); +Expr *VisitSizeOfPackExpr(SizeOfPackExpr *E); Expr *VisitCXXNewExpr(CXXNewExpr *CE); Expr *VisitCXXDeleteExpr(CXXDeleteExpr *E); Expr *VisitCXXConstructExpr(CXXConstructExpr *E); @@ -315,6 +317,7 @@ Expr *VisitCXXNamedCastExpr(CXXNamedCastExpr *E); Expr *VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E); Expr *VisitTypeTraitExpr(TypeTraitExpr *E); +Expr *VisitCXXTypeidExpr(CXXTypeidExpr *E); template @@ -527,6 +530,24 @@ Brackets); } +QualType ASTNodeImporter::VisitDependentSizedArrayType( +const DependentSizedArrayType *T) { + QualType ToElementType = Importer.Import(T->getElementType()); + if (ToElementType.isNull()) +return QualType(); + + // SizeExpr may be null if size is not specified directly. + // For example, 'int a[]'. + Expr *Size = Importer.Import(T->getSizeExpr()); + if (!Size && T->getSizeExpr()) +return QualType(); + + SourceRange Brackets = Importer.Import(T->getBracketsRange()); + return Importer.getToContext().getDependentSizedArrayType( + ToElementType, Size, T->getSizeModifier(), T->getIndexTypeCVRQualifiers(), + Brackets); +} + QualType ASTNodeImporter::VisitVectorType(const VectorType *T) { QualType ToElementType = Importer.Import(T->getElementType()); if (ToElementType.isNull()) @@ -827,6 +848,25 @@ T->getNumExpansions()); } +QualType ASTNodeImporter::VisitDependentTemplateSpecializationType( +const DependentTemplateSpecializationType *T) { + NestedNameSpecifier *Qualifier = Importer.Import(T->getQualifier()); + if (!Qualifier && T->getQualifier()) +return QualType(); + + IdentifierInfo *Name = Importer.Import(T->getIdentifier()); + if (!Name && T->getIdentifier()) +return QualType(); + + SmallVector ToPack; + ToPack.reserve(T->getNumArgs()); + if (ImportTemplateArguments(T->getArgs(), T->getNumArgs(), ToPack)) +return QualType(); + + return Importer.getToContext().getDependentTemplateSpecializationType( +T->getKeyword(), Qualifier, Name, ToPack); +} + QualType ASTNodeImporter::VisitObjCInterfaceType(const ObjCInterfaceType *T) { ObjCInterfaceDecl *Class = dyn_cast_or_null(Importer.Import(T->getDecl())); @@ -5709,6 +5749,11 @@ if (T.isNull()) return nullptr; + + TypeSourceInfo *TInfo = Importer.Import(CE->getTypeSourceInfo()); + if (!TInfo) +return nullptr; + SmallVector Args(CE->getNumArgs()); if (ImportContainerChecked(CE->arguments(), Args)) return nullptr; @@ -5718,18 +5763,11 @@ if (!Ctor) return nullptr; - return CXXTemporaryObjectExpr::Create( -Importer.getToContext(), T, -Importer.Import(CE->getLocStart()), -Ctor, -CE->isElidable(), -Args, -CE->hadMultipleCandidates(), -CE->isListInitialization(), -CE->isStdInitListInitialization(), -CE->requiresZeroInitialization(), -CE->getConstructionKind(), -Importer.Import(CE->getParenOrBraceRange())); + return new (Importer.getToContext()) CXXTemporaryObjectExpr( + Importer.getToContex
r323590 - Attempt to make the PS4 build bot happy.
Author: xazax Date: Sat Jan 27 08:38:56 2018 New Revision: 323590 URL: http://llvm.org/viewvc/llvm-project?rev=323590&view=rev Log: Attempt to make the PS4 build bot happy. Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=323590&r1=323589&r2=323590&view=diff == --- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original) +++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Sat Jan 27 08:38:56 2018 @@ -40,10 +40,10 @@ static RunOptions getRunOptionsForLangua BasicArgs = {"-x", "c", "-std=c89"}; break; case Lang_CXX: -BasicArgs = {"-std=c++98"}; +BasicArgs = {"-std=c++98", "-frtti"}; break; case Lang_CXX11: -BasicArgs = {"-std=c++11"}; +BasicArgs = {"-std=c++11", "-frtti"}; break; case Lang_OpenCL: case Lang_OBJCXX: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41677: Change memcpy/memove/memset to have dest and source alignment attributes.
dneilson updated this revision to Diff 131685. dneilson added a comment. Herald added subscribers: niosHD, sabuasal, apazos, jordy.potman.lists, simoncook, johnrusso, rbar, asb. Rebaseline Repository: rC Clang https://reviews.llvm.org/D41677 Files: lib/CodeGen/CGBuilder.h test/CodeGen/arm-arguments.c test/CodeGen/arm64-be-bitfield.c test/CodeGen/block-byref-aggr.c test/CodeGen/builtin-memfns.c test/CodeGen/c11atomics-ios.c test/CodeGen/c11atomics.c test/CodeGen/packed-nest-unpacked.c test/CodeGen/ppc64-align-struct.c test/CodeGen/ppc64-soft-float.c test/CodeGen/ppc64le-aggregates.c test/CodeGen/riscv32-abi.c test/CodeGen/riscv64-abi.c test/CodeGen/x86_32-arguments-realign.c test/CodeGen/x86_64-arguments.c test/CodeGenCXX/alignment.cpp test/CodeGenCXX/assign-construct-memcpy.cpp test/CodeGenCXX/copy-constructor-elim.cpp test/CodeGenCXX/eh.cpp test/OpenMP/parallel_reduction_codegen.cpp Index: test/OpenMP/parallel_reduction_codegen.cpp === --- test/OpenMP/parallel_reduction_codegen.cpp +++ test/OpenMP/parallel_reduction_codegen.cpp @@ -737,7 +737,7 @@ // CHECK: [[UP:%.+]] = call dereferenceable(4) [[S_INT_TY]]* @{{.+}}([[S_INT_TY]]* [[VAR_REF]], [[S_INT_TY]]* dereferenceable(4) [[VAR_PRIV]]) // CHECK: [[BC1:%.+]] = bitcast [[S_INT_TY]]* [[VAR_REF]] to i8* // CHECK: [[BC2:%.+]] = bitcast [[S_INT_TY]]* [[UP]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) // var1 = var1.operator &&(var1_reduction); // CHECK: [[TO_INT:%.+]] = call i{{[0-9]+}} @{{.+}}([[S_INT_TY]]* [[VAR1_REF]]) @@ -752,7 +752,7 @@ // CHECK: call void @{{.+}}([[S_INT_TY]]* [[COND_LVALUE:%.+]], i32 [[CONV]]) // CHECK: [[BC1:%.+]] = bitcast [[S_INT_TY]]* [[VAR1_REF]] to i8* // CHECK: [[BC2:%.+]] = bitcast [[S_INT_TY]]* [[COND_LVALUE]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) // t_var1 = min(t_var1, t_var1_reduction); // CHECK: [[T_VAR1_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[T_VAR1_REF]], @@ -778,7 +778,7 @@ // CHECK: [[UP:%.+]] = call dereferenceable(4) [[S_INT_TY]]* @{{.+}}([[S_INT_TY]]* [[VAR_REF]], [[S_INT_TY]]* dereferenceable(4) [[VAR_PRIV]]) // CHECK: [[BC1:%.+]] = bitcast [[S_INT_TY]]* [[VAR_REF]] to i8* // CHECK: [[BC2:%.+]] = bitcast [[S_INT_TY]]* [[UP]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) // CHECK: call void @__kmpc_end_critical( // var1 = var1.operator &&(var1_reduction); @@ -796,7 +796,7 @@ // CHECK: call void @{{.+}}([[S_INT_TY]]* [[COND_LVALUE:%.+]], i32 [[CONV]]) // CHECK: [[BC1:%.+]] = bitcast [[S_INT_TY]]* [[VAR1_REF]] to i8* // CHECK: [[BC2:%.+]] = bitcast [[S_INT_TY]]* [[COND_LVALUE]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) // CHECK: call void @__kmpc_end_critical( // t_var1 = min(t_var1, t_var1_reduction); @@ -864,7 +864,7 @@ // CHECK: [[UP:%.+]] = call dereferenceable(4) [[S_INT_TY]]* @{{.+}}([[S_INT_TY]]* [[VAR_LHS]], [[S_INT_TY]]* dereferenceable(4) [[VAR_RHS]]) // CHECK: [[BC1:%.+]] = bitcast [[S_INT_TY]]* [[VAR_LHS]] to i8* // CHECK: [[BC2:%.+]] = bitcast [[S_INT_TY]]* [[UP]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) // var1_lhs = var1_lhs.operator &&(var1_rhs); // CHECK: [[TO_INT:%.+]] = call i{{[0-9]+}} @{{.+}}([[S_INT_TY]]* [[VAR1_LHS]]) @@ -880,7 +880,7 @@ // CHECK: call void @{{.+}}([[S_INT_TY]]* [[COND_LVALUE:%.+]], i32 [[CONV]]) // CHECK: [[BC1:%.+]] = bitcast [[S_INT_TY]]* [[VAR1_LHS]] to i8* // CHECK: [[BC2:%.+]] = bitcast [[S_INT_TY]]* [[COND_LVALUE]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC1]], i8* align 4 [[BC2]], i64 4, i1 false) // t_var1_lhs = min(t_var1_lhs, t_var1_rhs); // CHECK: [[T_VAR1_LHS_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[T_VAR1_LHS]], Index: test/CodeGenCXX/eh.cpp === --- test/CodeGenCXX/eh.cpp +++ test/CodeGenCXX/eh.cpp @@ -13,7 +13,7 @@ // CHECK: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8) // CHECK-NEXT: [[EXN:%.*
[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI
compnerd created this revision. compnerd added a reviewer: rjmccall. Herald added a subscriber: cfe-commits. Add support for Objective C lifetime qualifiers in MS ABI. Because there is no formal way to add a custom extension on a pointer qualifier, re-use C++/CX (which is deprecated) and C++/CLI manglings to provide a decoration. We map the lifetimes as the following: - none/explicitly none (__unsafe_unretained) as having no extended qualifier - strong (__strong) as having cli::pin_ptr - weak (__weak) as a C++/CX tracking ref - autorealeasing (__autoreleasing) as having a C++/CX ref One side effect of this change is that the decoration of normal functions is altered with the implicit lifetime qualifier (__strong) where it is not needed since functions cannot be overloaded on just the lifetime qualifier. Repository: rC Clang https://reviews.llvm.org/D42614 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm test/CodeGenObjCXX/msabi-objc-lifetimes.mm Index: test/CodeGenObjCXX/msabi-objc-lifetimes.mm === --- /dev/null +++ test/CodeGenObjCXX/msabi-objc-lifetimes.mm @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple thumbv7-windows-msvc -fobjc-arc -fobjc-runtime=ios-6.0 -o - -emit-llvm %s | FileCheck %s + +template +struct S {}; + +void f(S<__unsafe_unretained id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@PAUobjc_object@Z" + +void f(S<__autoreleasing id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@P$AAUobjc_object@Z" + +void f(S<__strong id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@P$BAUobjc_object@Z" + +void f(S<__weak id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@P$CAUobjc_object@Z" + Index: test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm === --- test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm +++ test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm @@ -9,9 +9,9 @@ // Verify that we destruct things from left to right in the MS C++ ABI: a, b, c, d. // -// CHECK-LABEL: define void @"\01?test_arc_order@@YAXUA@@PAUobjc_object@@01@Z" +// CHECK-LABEL: define void @"\01?test_arc_order@@YAXUA@@P$BAUobjc_object@@01@Z" // CHECK: (<{ %struct.A, i8*, %struct.A, i8* }>* inalloca) -void test_arc_order(A a, id __attribute__((ns_consumed)) b , A c, id __attribute__((ns_consumed)) d) { +void test_arc_order(A a, id __attribute__((__ns_consumed__)) b, A c, id __attribute__((__ns_consumed__)) d) { // CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %{{.*}}) // CHECK: call void @objc_storeStrong(i8** %{{.*}}, i8* null) // CHECK: call x86_thiscallcc void @"\01??1A@@QAE@XZ"(%struct.A* %{{.*}}) Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -1569,6 +1569,21 @@ if (Quals.hasUnaligned() || (!PointeeType.isNull() && PointeeType.getLocalQualifiers().hasUnaligned())) Out << 'F'; + + switch (Quals.getObjCLifetime()) { + case Qualifiers::OCL_None: + case Qualifiers::OCL_ExplicitNone: +break; + case Qualifiers::OCL_Autoreleasing: +Out << "$A"; // C++/CX Ref Parameter +break; + case Qualifiers::OCL_Strong: +Out << "$B"; // C++/CLI cli::pin_ptr +break; + case Qualifiers::OCL_Weak: +Out << "$C"; // C++/CX Tracking Ref Parameter +break; + } } void MicrosoftCXXNameMangler::manglePointerCVQualifiers(Qualifiers Quals) { Index: test/CodeGenObjCXX/msabi-objc-lifetimes.mm === --- /dev/null +++ test/CodeGenObjCXX/msabi-objc-lifetimes.mm @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple thumbv7-windows-msvc -fobjc-arc -fobjc-runtime=ios-6.0 -o - -emit-llvm %s | FileCheck %s + +template +struct S {}; + +void f(S<__unsafe_unretained id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@PAUobjc_object@Z" + +void f(S<__autoreleasing id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@P$AAUobjc_object@Z" + +void f(S<__strong id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@P$BAUobjc_object@Z" + +void f(S<__weak id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@P$CAUobjc_object@Z" + Index: test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm === --- test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm +++ test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm @@ -9,9 +9,9 @@ // Verify that we destruct things from left to right in the MS C++ ABI: a, b, c, d. // -// CHECK-LABEL: define void @"\01?test_arc_order@@YAXUA@@PAUobjc_object@@01@Z" +// CHECK-LABEL: define void @"\01?test_arc_order@@YAXUA@@P$BAUobjc_object@@01@Z" // CHECK: (<{ %struct.A, i8*, %struct.A, i8* }>* inalloca) -void test_arc_order(A a, id __attribute__((ns_consumed)) b , A c, id __attribute__((ns_consumed)) d) { +void test_arc_order(A a, id __attribute__((__ns_consum
[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI
smeenai added a comment. pin_ptr is technically not supposed to appear as a function parameter, and having it in that position can screw up demangling. Considering __strong is the default, it's probably not a good idea to map that one to pin_ptr; whichever qualifier is least likely to appear as a function parameter (though I don't know which one that is) should map to pin_ptr. The other lifetimes seem to demangle fine wherever you place them. Do you want to add some tests for the mangling of qualifiers on function parameters themselves? That would also demonstrate the potential demangling issue. Repository: rC Clang https://reviews.llvm.org/D42614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r323599 - LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is
Author: dhinton Date: Sat Jan 27 10:55:30 2018 New Revision: 323599 URL: http://llvm.org/viewvc/llvm-project?rev=323599&view=rev Log: LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is available instead. Modified: libcxx/trunk/lib/CMakeLists.txt Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=323599&r1=323598&r2=323599&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Sat Jan 27 10:55:30 2018 @@ -222,7 +222,7 @@ set(LIBCXX_TARGETS) # Build the shared library. if (LIBCXX_ENABLE_SHARED) add_library(cxx_shared SHARED $) - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(cxx_shared) endif() target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r323600 - [cmake] [libcxxabi] LLVM_FOUND isn't always set, so just test if
Author: dhinton Date: Sat Jan 27 11:18:04 2018 New Revision: 323600 URL: http://llvm.org/viewvc/llvm-project?rev=323600&view=rev Log: [cmake] [libcxxabi] LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is available instead. Modified: libcxxabi/trunk/src/CMakeLists.txt Modified: libcxxabi/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=323600&r1=323599&r2=323600&view=diff == --- libcxxabi/trunk/src/CMakeLists.txt (original) +++ libcxxabi/trunk/src/CMakeLists.txt Sat Jan 27 11:18:04 2018 @@ -127,7 +127,7 @@ set(LIBCXXABI_TARGETS) # Build the shared library. if (LIBCXXABI_ENABLE_SHARED) add_library(cxxabi_shared SHARED $) - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(cxxabi_shared) endif() target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r323601 - [cmake] [libunwind] LLVM_FOUND isn't always set, so just test if
Author: dhinton Date: Sat Jan 27 11:31:44 2018 New Revision: 323601 URL: http://llvm.org/viewvc/llvm-project?rev=323601&view=rev Log: [cmake] [libunwind] LLVM_FOUND isn't always set, so just test if llvm_setup_rpath() is available instead. Modified: libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=323601&r1=323600&r2=323601&view=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Sat Jan 27 11:31:44 2018 @@ -108,7 +108,7 @@ set(LIBUNWIND_TARGETS) # Build the shared library. if (LIBUNWIND_ENABLE_SHARED) add_library(unwind_shared SHARED $) - if(LLVM_FOUND) + if(COMMAND llvm_setup_rpath) llvm_setup_rpath(unwind_shared) endif() target_link_libraries(unwind_shared ${libraries}) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42170: Fixit for 'typedef' instead of 'typename' typo
jkorous-apple added a comment. I got rid of backslashes in test and added member of the type parameter with typo. Thanks for these suggestions. https://reviews.llvm.org/D42170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42170: Fixit for 'typedef' instead of 'typename' typo
jkorous-apple updated this revision to Diff 131693. jkorous-apple added a comment. I got rid of backslashes in test and added member of the type parameter with typo. Thanks for suggestions. https://reviews.llvm.org/D42170 Files: FixIt/fixit-typedef-instead-of-typename-typo.cpp Parse/ParseTemplate.cpp clang/Basic/DiagnosticParseKinds.td Index: FixIt/fixit-typedef-instead-of-typename-typo.cpp === --- /dev/null +++ FixIt/fixit-typedef-instead-of-typename-typo.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -verify %s + +template struct Foo { + // Should not produce error about type since parsing speculatively with fixit applied. + B member; + // Let's just check that other errors get reported. + a +}; +// CHECK: expected-error@-6 {{expected template parameter}} +// CHECK: expected-note@-7 {{did you mean to use 'typename'?}} +// CHECK: fix-it:{{.*}}:{4:23-4:30}:"typename" +// Check that we are speculatively (with fixit applied) trying to parse the rest. +// CHECK: expected-error@-6 {{unknown type name 'a'}} +// CHECK: expected-error@-6 {{expected member name or ';' after declaration specifiers}} Index: Parse/ParseTemplate.cpp === --- Parse/ParseTemplate.cpp +++ Parse/ParseTemplate.cpp @@ -488,6 +488,20 @@ if (Tok.is(tok::kw_template)) return ParseTemplateTemplateParameter(Depth, Position); + // Is there just a typo in the input code? ('typedef' instead of 'typename') + if (Tok.is(tok::kw_typedef)) { +Diag(Tok.getLocation(), diag::err_expected_template_parameter); + +Diag(Tok.getLocation(), diag::note_meant_to_use_typename) +<< FixItHint::CreateReplacement(CharSourceRange::getCharRange( +Tok.getLocation(), Tok.getEndLoc()), +"typename"); + +Tok.setKind(tok::kw_typename); + +return ParseTypeParameter(Depth, Position); + } + // If it's none of the above, then it must be a parameter declaration. // NOTE: This will pick up errors in the closure of the template parameter // list (e.g., template < ; Check here to implement >> style closures. Index: clang/Basic/DiagnosticParseKinds.td === --- clang/Basic/DiagnosticParseKinds.td +++ clang/Basic/DiagnosticParseKinds.td @@ -1162,6 +1162,9 @@ def err_objc_type_args_after_protocols : Error< "protocol qualifiers must precede type arguments">; + +def note_meant_to_use_typename : Note< + "did you mean to use 'typename'?">; } let CategoryName = "Coroutines Issue" in { Index: FixIt/fixit-typedef-instead-of-typename-typo.cpp === --- /dev/null +++ FixIt/fixit-typedef-instead-of-typename-typo.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -verify %s + +template struct Foo { + // Should not produce error about type since parsing speculatively with fixit applied. + B member; + // Let's just check that other errors get reported. + a +}; +// CHECK: expected-error@-6 {{expected template parameter}} +// CHECK: expected-note@-7 {{did you mean to use 'typename'?}} +// CHECK: fix-it:{{.*}}:{4:23-4:30}:"typename" +// Check that we are speculatively (with fixit applied) trying to parse the rest. +// CHECK: expected-error@-6 {{unknown type name 'a'}} +// CHECK: expected-error@-6 {{expected member name or ';' after declaration specifiers}} Index: Parse/ParseTemplate.cpp === --- Parse/ParseTemplate.cpp +++ Parse/ParseTemplate.cpp @@ -488,6 +488,20 @@ if (Tok.is(tok::kw_template)) return ParseTemplateTemplateParameter(Depth, Position); + // Is there just a typo in the input code? ('typedef' instead of 'typename') + if (Tok.is(tok::kw_typedef)) { +Diag(Tok.getLocation(), diag::err_expected_template_parameter); + +Diag(Tok.getLocation(), diag::note_meant_to_use_typename) +<< FixItHint::CreateReplacement(CharSourceRange::getCharRange( +Tok.getLocation(), Tok.getEndLoc()), +"typename"); + +Tok.setKind(tok::kw_typename); + +return ParseTypeParameter(Depth, Position); + } + // If it's none of the above, then it must be a parameter declaration. // NOTE: This will pick up errors in the closure of the template parameter // list (e.g., template < ; Check here to implement >> style closures. Index: clang/Basic/DiagnosticParseKinds.td === --- clang/Basic/DiagnosticParseKinds.td +++ clang/Basic/DiagnosticParseKinds.td @@ -1162,6 +1162,9 @@ def err_objc_type_args_after_protocols : Error< "protocol qualifiers must precede type arguments">; + +def note_meant_
[PATCH] D42354: Fix libcxx MSVC C++17 redefinition of 'align_val_t'
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. I think that if we can remove the `__zero` and `__max`, we should do that, but that is better done as a separate change. Repository: rCXX libc++ https://reviews.llvm.org/D42354 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41677: Change memcpy/memove/memset to have dest and source alignment attributes.
rjmccall accepted this revision. rjmccall added a comment. Still LGTM. Repository: rC Clang https://reviews.llvm.org/D41677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI
rjmccall added a comment. It's not just that functions can't be overloaded on the parameter-variable type qualifier — it's not part of the function type at all, just like making a parameter 'const int' instead of 'int' is not part of the function type. I understand that MSVC mangles some things that really shouldn't be mangled, but I would greatly prefer if you could make an exception for this. Separately, re-using existing manglings like this seems *really* sketchy. Is this 100% necessary? There's no way to just fake something up? Repository: rC Clang https://reviews.llvm.org/D42614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits