summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-05-04 16:12:48 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-05-04 16:12:48 +0000
commit8aaf5818a64e9f7687798852af5945b053c68a54 (patch)
treed6a70c3518b8dea8be7062438d7e8676820ed17f /test
parent71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (diff)
downloadFreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.zip
FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.tar.gz
Update clang to r103004.
Diffstat (limited to 'test')
-rw-r--r--test/ASTMerge/category.m2
-rw-r--r--test/ASTMerge/enum.c2
-rw-r--r--test/ASTMerge/function.c2
-rw-r--r--test/ASTMerge/interface.m2
-rw-r--r--test/ASTMerge/property.m2
-rw-r--r--test/ASTMerge/struct.c2
-rw-r--r--test/ASTMerge/typedef.c2
-rw-r--r--test/ASTMerge/var.c2
-rw-r--r--test/Analysis/inline.c4
-rw-r--r--test/Analysis/inline2.c3
-rw-r--r--test/Analysis/inline3.c4
-rw-r--r--test/Analysis/inline4.c4
-rw-r--r--test/Analysis/method-call.cpp18
-rw-r--r--test/Analysis/misc-ps-region-store.m59
-rw-r--r--test/Analysis/misc-ps.m24
-rw-r--r--test/Analysis/new.cpp14
-rw-r--r--test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m6
-rw-r--r--test/Analysis/null-deref-ps.c4
-rw-r--r--test/Analysis/override-werror.c2
-rw-r--r--test/Analysis/unix-fns.c37
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp15
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp60
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp4
-rw-r--r--test/CXX/class.access/class.access.base/p1.cpp2
-rw-r--r--test/CXX/class.access/class.access.base/p5.cpp2
-rw-r--r--test/CXX/class.access/class.access.nest/p1.cpp2
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp97
-rw-r--r--test/CXX/class.access/class.friend/p2-cxx03.cpp13
-rw-r--r--test/CXX/class.access/class.friend/p3-cxx0x.cpp29
-rw-r--r--test/CXX/class.access/class.protected/p1.cpp387
-rw-r--r--test/CXX/class.access/p4.cpp99
-rw-r--r--test/CXX/class.access/p6.cpp69
-rw-r--r--test/CXX/class/class.friend/p2.cpp4
-rw-r--r--test/CXX/class/class.local/p2.cpp2
-rw-r--r--test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp2
-rw-r--r--test/CXX/conv/conv.mem/p4.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp12
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp7
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp50
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp61
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp8
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp16
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp3
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp1
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp6
-rw-r--r--test/CXX/except/except.handle/p16.cpp4
-rw-r--r--test/CXX/expr/expr.unary/expr.delete/p5.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.new/p19.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.new/p20-0x.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.new/p20.cpp2
-rw-r--r--test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp14
-rw-r--r--test/CXX/stmt.stmt/stmt.select/p3.cpp8
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp38
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p1.cpp83
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p3.cpp3
-rw-r--r--test/CXX/temp/temp.decls/temp.mem/p1.cpp6
-rw-r--r--test/CXX/temp/temp.param/p3.cpp12
-rw-r--r--test/CXX/temp/temp.res/temp.local/p3.cpp32
-rw-r--r--test/CXX/temp/temp.spec/p5.cpp17
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p3.cpp16
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p4.cpp22
-rw-r--r--test/CXX/temp/temp.spec/temp.inst/p11.cpp15
-rw-r--r--test/CodeCompletion/call.cpp1
-rw-r--r--test/CodeCompletion/macros.c4
-rw-r--r--test/CodeCompletion/ordinary-name.cpp18
-rw-r--r--test/CodeGen/2009-10-20-GlobalDebug.c8
-rw-r--r--test/CodeGen/arm-arguments.c30
-rw-r--r--test/CodeGen/arm_asm_clobber.c21
-rw-r--r--test/CodeGen/asm-errors.c8
-rw-r--r--test/CodeGen/asm.c21
-rw-r--r--test/CodeGen/asm_arm.c32
-rw-r--r--test/CodeGen/bitfield-2.c368
-rw-r--r--test/CodeGen/blocks.c2
-rw-r--r--test/CodeGen/builtins-ppc-altivec.c332
-rw-r--r--test/CodeGen/catch-undef-behavior.c7
-rw-r--r--test/CodeGen/const-unordered-compare.c7
-rw-r--r--test/CodeGen/decl.c32
-rw-r--r--test/CodeGen/designated-initializers.c37
-rw-r--r--test/CodeGen/functions.c12
-rw-r--r--test/CodeGen/global-init.c30
-rw-r--r--test/CodeGen/init.c6
-rw-r--r--test/CodeGen/libcalls.c50
-rw-r--r--test/CodeGen/palignr.c19
-rw-r--r--test/CodeGen/struct-passing.c4
-rw-r--r--test/CodeGen/union-init2.c11
-rw-r--r--test/CodeGen/x86_32-arguments.c126
-rw-r--r--test/CodeGen/x86_64-arguments.c81
-rw-r--r--test/CodeGenCXX/PR6747.cpp11
-rw-r--r--test/CodeGenCXX/address-of-fntemplate.cpp14
-rw-r--r--test/CodeGenCXX/anonymous-union-member-initializer.cpp26
-rw-r--r--test/CodeGenCXX/arm.cpp20
-rw-r--r--test/CodeGenCXX/assign-operator.cpp14
-rw-r--r--test/CodeGenCXX/bitfield-layout.cpp43
-rw-r--r--test/CodeGenCXX/block-destruct.cpp9
-rw-r--r--test/CodeGenCXX/c-linkage.cpp13
-rw-r--r--test/CodeGenCXX/constructor-init-reference.cpp2
-rw-r--r--test/CodeGenCXX/constructors.cpp14
-rw-r--r--test/CodeGenCXX/default-arg-temps.cpp50
-rw-r--r--test/CodeGenCXX/default-destructor-nested.cpp2
-rw-r--r--test/CodeGenCXX/delete.cpp26
-rw-r--r--test/CodeGenCXX/destructor-debug-info.cpp21
-rw-r--r--test/CodeGenCXX/eh.cpp87
-rw-r--r--test/CodeGenCXX/empty-classes.cpp69
-rw-r--r--test/CodeGenCXX/exceptions-no-rtti.cpp48
-rw-r--r--test/CodeGenCXX/field-access-debug-info.cpp11
-rw-r--r--test/CodeGenCXX/implicit-copy-assign-operator.cpp56
-rw-r--r--test/CodeGenCXX/instantiate-init-list.cpp2
-rw-r--r--test/CodeGenCXX/mangle-template.cpp40
-rw-r--r--test/CodeGenCXX/mangle.cpp11
-rw-r--r--test/CodeGenCXX/member-function-pointer-calls.cpp11
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp37
-rw-r--r--test/CodeGenCXX/member-initializers.cpp2
-rw-r--r--test/CodeGenCXX/namespace-aliases.cpp6
-rw-r--r--test/CodeGenCXX/new-operator-phi.cpp2
-rw-r--r--test/CodeGenCXX/new.cpp12
-rw-r--r--test/CodeGenCXX/operator-new.cpp1
-rw-r--r--test/CodeGenCXX/reference-in-blocks.cpp21
-rw-r--r--test/CodeGenCXX/rtti-fundamental.cpp4
-rw-r--r--test/CodeGenCXX/static-init.cpp11
-rw-r--r--test/CodeGenCXX/static-local-in-local-class.cpp21
-rw-r--r--test/CodeGenCXX/template-anonymous-union-member-initializer.cpp1
-rw-r--r--test/CodeGenCXX/template-instantiation.cpp1
-rw-r--r--test/CodeGenCXX/temporaries.cpp19
-rw-r--r--test/CodeGenCXX/value-init.cpp26
-rw-r--r--test/CodeGenCXX/virt-template-vtable.cpp1
-rw-r--r--test/CodeGenCXX/virt.cpp696
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp334
-rw-r--r--test/CodeGenCXX/x86_32-arguments.cpp4
-rw-r--r--test/CodeGenObjC/atomic-aggregate-property.m28
-rw-r--r--test/CodeGenObjC/blocks.m2
-rw-r--r--test/CodeGenObjC/encode-cstyle-method.m11
-rw-r--r--test/CodeGenObjC/exceptions.m18
-rw-r--r--test/CodeGenObjC/image-info.m10
-rw-r--r--test/CodeGenObjC/metadata-symbols-64.m2
-rw-r--r--test/CodeGenObjC/metadata_symbols.m51
-rw-r--r--test/CodeGenObjC/next-objc-dispatch.m73
-rw-r--r--test/CodeGenObjC/non-lazy-classes.m2
-rw-r--r--test/CodeGenObjC/ns-constant-strings.m33
-rw-r--r--test/CodeGenObjC/objc-gc-aggr-assign.m46
-rw-r--r--test/CodeGenObjC/objc2-legacy-dispatch.m4
-rw-r--r--test/CodeGenObjC/x86_64-struct-return-gc.m2
-rw-r--r--test/CodeGenObjCXX/ivar-objects.mm71
-rw-r--r--test/CodeGenObjCXX/mangle.mm12
-rw-r--r--test/Coverage/ast-printing.cpp2
-rw-r--r--test/Driver/darwin-ld.c2
-rw-r--r--test/Driver/darwin-objc-defaults.m88
-rw-r--r--test/Driver/darwin-objc-gc.m19
-rw-r--r--test/Driver/darwin-objc-options.m19
-rw-r--r--test/FixIt/fixit-at.c5
-rw-r--r--test/FixIt/fixit-c90.c8
-rw-r--r--test/FixIt/fixit-cxx0x.cpp10
-rw-r--r--test/FixIt/fixit-errors-1.c5
-rw-r--r--test/FixIt/fixit-errors.c5
-rw-r--r--test/FixIt/fixit-objc.m7
-rw-r--r--test/FixIt/fixit-pmem.cpp5
-rw-r--r--test/FixIt/fixit-suffix.c5
-rw-r--r--test/FixIt/fixit-unrecoverable.c10
-rw-r--r--test/FixIt/fixit-unrecoverable.cpp11
-rw-r--r--test/FixIt/fixit.c19
-rw-r--r--test/FixIt/fixit.cpp15
-rw-r--r--test/FixIt/typo.c4
-rw-r--r--test/FixIt/typo.cpp5
-rw-r--r--test/FixIt/typo.m60
-rw-r--r--test/Index/Inputs/complete-pch.h10
-rw-r--r--test/Index/annotate-tokens.m18
-rw-r--r--test/Index/complete-at-directives.m4
-rw-r--r--test/Index/complete-at-exprstmt.m4
-rw-r--r--test/Index/complete-exprs.c15
-rw-r--r--test/Index/complete-method-decls.m82
-rw-r--r--test/Index/complete-objc-message-id.m42
-rw-r--r--test/Index/complete-objc-message.m78
-rw-r--r--test/Index/complete-pch.m26
-rw-r--r--test/Index/invalid-code-rdar_7833619.m4
-rw-r--r--test/Index/load-exprs.c39
-rw-r--r--test/Index/local-symbols.m26
-rw-r--r--test/Index/print-usrs.c4
-rw-r--r--test/Index/usrs.m87
-rw-r--r--test/Lexer/gnu_keywords.c12
-rw-r--r--test/Lexer/utf-16.c6
-rw-r--r--test/Lexer/utf-16.c.txtbin0 -> 48 bytes
-rw-r--r--test/Misc/message-length.c16
-rw-r--r--test/Misc/tabstop.c3
-rw-r--r--test/Misc/verify.c14
-rw-r--r--test/PCH/exprs.c4
-rw-r--r--test/PCH/exprs.h13
-rw-r--r--test/PCH/functions.c4
-rw-r--r--test/PCH/functions.h5
-rw-r--r--test/PCH/objc_stmts.h22
-rw-r--r--test/PCH/objc_stmts.m12
-rw-r--r--test/PCH/pr4489.c7
-rw-r--r--test/PCH/types.c2
-rw-r--r--test/Parser/altivec.c8
-rw-r--r--test/Parser/attributes.c4
-rw-r--r--test/Parser/builtin_types_compatible.c2
-rw-r--r--test/Parser/check-syntax-1.m4
-rw-r--r--test/Parser/cxx-altivec.cpp9
-rw-r--r--test/Parser/cxx-casting.cpp9
-rw-r--r--test/Parser/cxx-class.cpp2
-rw-r--r--test/Parser/cxx-friend.cpp6
-rw-r--r--test/Parser/cxx-template-decl.cpp2
-rw-r--r--test/Parser/declarators.c2
-rw-r--r--test/Parser/implicit-casts.c2
-rw-r--r--test/Parser/objc-init.m3
-rw-r--r--test/Parser/objc-quirks.m18
-rw-r--r--test/Preprocessor/expr_usual_conversions.c5
-rw-r--r--test/Preprocessor/if_warning.c6
-rw-r--r--test/Preprocessor/init.c10
-rw-r--r--test/Preprocessor/line-directive-output.c71
-rw-r--r--test/Preprocessor/non_fragile_feature.m4
-rw-r--r--test/Preprocessor/output_paste_avoid.c5
-rw-r--r--test/Rewriter/dllimport-typedef.c4
-rw-r--r--test/Rewriter/missing-dllimport.c4
-rw-r--r--test/Rewriter/rewrite-super-message.mm2
-rw-r--r--test/Sema/address_spaces.c2
-rw-r--r--test/Sema/altivec-init.c4
-rw-r--r--test/Sema/anonymous-struct-union.c12
-rw-r--r--test/Sema/arm-layout.c49
-rw-r--r--test/Sema/array-constraint.c4
-rw-r--r--test/Sema/array-init.c14
-rw-r--r--test/Sema/attr-format.c2
-rw-r--r--test/Sema/attr-noreturn.c2
-rw-r--r--test/Sema/attr-section.c2
-rw-r--r--test/Sema/bitfield.c4
-rw-r--r--test/Sema/block-call.c12
-rw-r--r--test/Sema/block-misc.c12
-rw-r--r--test/Sema/block-return.c14
-rw-r--r--test/Sema/builtin-prefetch.c4
-rw-r--r--test/Sema/builtin-stackaddress.c4
-rw-r--r--test/Sema/builtins.c2
-rw-r--r--test/Sema/cast-to-union.c2
-rw-r--r--test/Sema/compare.c5
-rw-r--r--test/Sema/compound-literal.c2
-rw-r--r--test/Sema/conditional-expr.c8
-rw-r--r--test/Sema/conditional.c4
-rw-r--r--test/Sema/decl-invalid.c12
-rw-r--r--test/Sema/declspec.c2
-rw-r--r--test/Sema/enum.c3
-rw-r--r--test/Sema/exprs.c8
-rw-r--r--test/Sema/ext_vector_casts.c2
-rw-r--r--test/Sema/format-strings.c4
-rw-r--r--test/Sema/function-ptr.c6
-rw-r--r--test/Sema/function-redecl.c2
-rw-r--r--test/Sema/incompatible-sign.c4
-rw-r--r--test/Sema/invalid-init-diag.c2
-rw-r--r--test/Sema/offsetof.c13
-rw-r--r--test/Sema/parentheses.c12
-rw-r--r--test/Sema/pointer-conversion.c6
-rw-r--r--test/Sema/predef.c2
-rw-r--r--test/Sema/predefined-function.c5
-rw-r--r--test/Sema/return.c2
-rw-r--r--test/Sema/statements.c12
-rw-r--r--test/Sema/struct-compat.c2
-rw-r--r--test/Sema/transparent-union.c2
-rw-r--r--test/Sema/typedef-retain.c4
-rw-r--r--test/Sema/unused-expr.c6
-rw-r--r--test/Sema/vector-assign.c44
-rw-r--r--test/Sema/vector-cast.c4
-rw-r--r--test/Sema/warn-missing-braces.c2
-rw-r--r--test/Sema/warn-unused-function.c7
-rw-r--r--test/Sema/warn-unused-parameters.c15
-rw-r--r--test/Sema/warn-unused-value.c15
-rw-r--r--test/Sema/warn-write-strings.c2
-rw-r--r--test/Sema/x86-builtin-palignr.c10
-rw-r--r--test/SemaCXX/abstract.cpp9
-rw-r--r--test/SemaCXX/access-base-class.cpp2
-rw-r--r--test/SemaCXX/access-control-check.cpp2
-rw-r--r--test/SemaCXX/addr-of-overloaded-function.cpp32
-rw-r--r--test/SemaCXX/aggregate-initialization.cpp17
-rw-r--r--test/SemaCXX/anonymous-union.cpp2
-rw-r--r--test/SemaCXX/bitfield-layout.cpp30
-rw-r--r--test/SemaCXX/class-base-member-init.cpp23
-rw-r--r--test/SemaCXX/class.cpp2
-rw-r--r--test/SemaCXX/conditional-expr.cpp10
-rw-r--r--test/SemaCXX/constant-expression.cpp10
-rw-r--r--test/SemaCXX/constructor-initializer.cpp48
-rw-r--r--test/SemaCXX/conversion-function.cpp88
-rw-r--r--test/SemaCXX/copy-assignment.cpp2
-rw-r--r--test/SemaCXX/copy-initialization.cpp21
-rw-r--r--test/SemaCXX/cstyle-cast.cpp2
-rw-r--r--test/SemaCXX/default-assignment-operator.cpp22
-rw-r--r--test/SemaCXX/default-constructor-initializers.cpp6
-rw-r--r--test/SemaCXX/default1.cpp9
-rw-r--r--test/SemaCXX/default2.cpp3
-rw-r--r--test/SemaCXX/derived-to-base-ambig.cpp4
-rw-r--r--test/SemaCXX/direct-initializer.cpp2
-rw-r--r--test/SemaCXX/elaborated-type-specifier.cpp2
-rw-r--r--test/SemaCXX/exceptions.cpp23
-rw-r--r--test/SemaCXX/functional-cast.cpp2
-rw-r--r--test/SemaCXX/illegal-member-initialization.cpp6
-rw-r--r--test/SemaCXX/implicit-member-functions.cpp35
-rw-r--r--test/SemaCXX/inc-decrement-qualifiers.cpp9
-rw-r--r--test/SemaCXX/libstdcxx_is_pod_hack.cpp6
-rw-r--r--test/SemaCXX/libstdcxx_map_base_hack.cpp25
-rw-r--r--test/SemaCXX/local-classes.cpp9
-rw-r--r--test/SemaCXX/member-expr.cpp22
-rw-r--r--test/SemaCXX/member-location.cpp5
-rw-r--r--test/SemaCXX/member-pointer.cpp16
-rw-r--r--test/SemaCXX/missing-header.cpp9
-rw-r--r--test/SemaCXX/namespace-alias.cpp10
-rw-r--r--test/SemaCXX/nested-name-spec.cpp16
-rw-r--r--test/SemaCXX/new-delete.cpp23
-rw-r--r--test/SemaCXX/no-exceptions.cpp21
-rw-r--r--test/SemaCXX/offsetof.cpp37
-rw-r--r--test/SemaCXX/overload-call.cpp30
-rw-r--r--test/SemaCXX/overloaded-operator.cpp30
-rw-r--r--test/SemaCXX/qual-id-test.cpp6
-rw-r--r--test/SemaCXX/qualified-id-lookup.cpp22
-rw-r--r--test/SemaCXX/ref-init-ambiguous.cpp2
-rw-r--r--test/SemaCXX/references.cpp4
-rw-r--r--test/SemaCXX/static-cast.cpp2
-rw-r--r--test/SemaCXX/storage-class.cpp4
-rw-r--r--test/SemaCXX/typedef-redecl.cpp13
-rw-r--r--test/SemaCXX/typeid-ref.cpp12
-rw-r--r--test/SemaCXX/typeid.cpp1
-rw-r--r--test/SemaCXX/unused-functions.cpp8
-rw-r--r--test/SemaCXX/user-defined-conversions.cpp15
-rw-r--r--test/SemaCXX/value-initialization.cpp6
-rw-r--r--test/SemaCXX/virtual-override.cpp2
-rw-r--r--test/SemaCXX/warn-assignment-condition.cpp49
-rw-r--r--test/SemaCXX/warn-missing-noreturn.cpp14
-rw-r--r--test/SemaCXX/warn-reorder-ctor-initialization.cpp57
-rw-r--r--test/SemaCXX/warn-unused-parameters.cpp26
-rw-r--r--test/SemaCXX/warn-unused-variables.cpp8
-rw-r--r--test/SemaCXX/warn-weak-vtables.cpp2
-rw-r--r--test/SemaObjC/argument-checking.m19
-rw-r--r--test/SemaObjC/block-type-safety.m18
-rw-r--r--test/SemaObjC/blocks.m12
-rw-r--r--test/SemaObjC/call-super-2.m2
-rw-r--r--test/SemaObjC/catch-stmt.m4
-rw-r--r--test/SemaObjC/class-bitfield.m2
-rw-r--r--test/SemaObjC/class-method-lookup.m2
-rw-r--r--test/SemaObjC/class-method-self.m6
-rw-r--r--test/SemaObjC/compatible-protocol-qualified-types.m4
-rw-r--r--test/SemaObjC/compound-init.m7
-rw-r--r--test/SemaObjC/comptypes-1.m12
-rw-r--r--test/SemaObjC/comptypes-3.m18
-rw-r--r--test/SemaObjC/comptypes-6.m2
-rw-r--r--test/SemaObjC/comptypes-7.m32
-rw-r--r--test/SemaObjC/comptypes-legal.m4
-rw-r--r--test/SemaObjC/conditional-expr-2.m2
-rw-r--r--test/SemaObjC/conditional-expr-3.m4
-rw-r--r--test/SemaObjC/conditional-expr-4.m2
-rw-r--r--test/SemaObjC/conditional-expr.m4
-rw-r--r--test/SemaObjC/continuation-class-err.m6
-rw-r--r--test/SemaObjC/default-synthesize.m24
-rw-r--r--test/SemaObjC/ibaction.m15
-rw-r--r--test/SemaObjC/id.m4
-rw-r--r--test/SemaObjC/incompatible-protocol-qualified-types.m8
-rw-r--r--test/SemaObjC/invalid-code.m7
-rw-r--r--test/SemaObjC/invalid-objc-decls-1.m4
-rw-r--r--test/SemaObjC/invalid-receiver.m2
-rw-r--r--test/SemaObjC/ivar-in-class-extension-error.m8
-rw-r--r--test/SemaObjC/ivar-in-class-extension.m6
-rw-r--r--test/SemaObjC/ivar-lookup.m19
-rw-r--r--test/SemaObjC/message.m2
-rw-r--r--test/SemaObjC/method-arg-qualifier-warning.m6
-rw-r--r--test/SemaObjC/method-bad-param.m12
-rw-r--r--test/SemaObjC/objc-cstyle-args-in-methods.m20
-rw-r--r--test/SemaObjC/pedantic-dynamic-test.m16
-rw-r--r--test/SemaObjC/property-9.m4
-rw-r--r--test/SemaObjC/property-typecheck-1.m6
-rw-r--r--test/SemaObjC/protocol-id-test-3.m14
-rw-r--r--test/SemaObjC/protocol-typecheck.m4
-rw-r--r--test/SemaObjC/protocol-warn.m2
-rw-r--r--test/SemaObjC/stmts.m4
-rw-r--r--test/SemaObjC/super-class-protocol-conformance.m47
-rw-r--r--test/SemaObjC/super.m47
-rw-r--r--test/SemaObjC/synthesized-ivar.m3
-rw-r--r--test/SemaObjC/transparent-union.m22
-rw-r--r--test/SemaObjC/unused.m4
-rw-r--r--test/SemaObjC/warn-incompatible-builtin-types.m20
-rw-r--r--test/SemaObjC/warn-selector-selection.m2
-rw-r--r--test/SemaObjC/warn-superclass-method-mismatch.m2
-rw-r--r--test/SemaObjC/warn-unused-exception-param.m4
-rw-r--r--test/SemaObjC/warn-write-strings.m2
-rw-r--r--test/SemaObjCXX/blocks.mm4
-rw-r--r--test/SemaObjCXX/instantiate-expr.mm73
-rw-r--r--test/SemaObjCXX/instantiate-message.mm50
-rw-r--r--test/SemaObjCXX/instantiate-stmt.mm77
-rw-r--r--test/SemaObjCXX/ivar-lookup.mm18
-rw-r--r--test/SemaObjCXX/ivar-reference-type.mm5
-rw-r--r--test/SemaObjCXX/linkage-spec.mm8
-rw-r--r--test/SemaObjCXX/message.mm77
-rw-r--r--test/SemaObjCXX/objc-pointer-conv.mm4
-rw-r--r--test/SemaObjCXX/overload-1.mm25
-rw-r--r--test/SemaObjCXX/parameters.mm12
-rw-r--r--test/SemaObjCXX/void_to_obj.mm2
-rw-r--r--test/SemaTemplate/class-template-decl.cpp5
-rw-r--r--test/SemaTemplate/constructor-template.cpp15
-rw-r--r--test/SemaTemplate/default-expr-arguments-2.cpp19
-rw-r--r--test/SemaTemplate/default-expr-arguments.cpp30
-rw-r--r--test/SemaTemplate/dependent-names.cpp4
-rw-r--r--test/SemaTemplate/destructor-template.cpp8
-rw-r--r--test/SemaTemplate/elaborated-type-specifier.cpp36
-rw-r--r--test/SemaTemplate/explicit-specialization-member.cpp2
-rw-r--r--test/SemaTemplate/friend-template.cpp80
-rw-r--r--test/SemaTemplate/friend.cpp19
-rw-r--r--test/SemaTemplate/fun-template-def.cpp2
-rw-r--r--test/SemaTemplate/injected-class-name.cpp12
-rw-r--r--test/SemaTemplate/instantiate-complete.cpp20
-rw-r--r--test/SemaTemplate/instantiate-default-assignment-operator.cpp8
-rw-r--r--test/SemaTemplate/instantiate-expr-2.cpp19
-rw-r--r--test/SemaTemplate/instantiate-expr-5.cpp36
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp5
-rw-r--r--test/SemaTemplate/instantiate-function-params.cpp41
-rw-r--r--test/SemaTemplate/instantiate-local-class.cpp4
-rw-r--r--test/SemaTemplate/instantiate-member-class.cpp9
-rw-r--r--test/SemaTemplate/instantiate-member-expr.cpp2
-rw-r--r--test/SemaTemplate/instantiate-member-initializers.cpp5
-rw-r--r--test/SemaTemplate/instantiate-member-template.cpp2
-rw-r--r--test/SemaTemplate/instantiate-method.cpp60
-rw-r--r--test/SemaTemplate/instantiate-non-type-template-parameter.cpp24
-rw-r--r--test/SemaTemplate/instantiate-typedef.cpp3
-rw-r--r--test/SemaTemplate/instantiate-using-decl.cpp2
-rw-r--r--test/SemaTemplate/instantiation-depth.cpp10
-rw-r--r--test/SemaTemplate/nested-name-spec-template.cpp13
-rw-r--r--test/SemaTemplate/qualified-id.cpp1
-rw-r--r--test/SemaTemplate/temp_arg.cpp3
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp39
-rw-r--r--test/SemaTemplate/temp_arg_type.cpp24
-rw-r--r--test/SemaTemplate/template-decl-fail.cpp4
-rw-r--r--test/SemaTemplate/typename-specifier-4.cpp2
-rw-r--r--test/SemaTemplate/typename-specifier.cpp15
426 files changed, 6995 insertions, 1662 deletions
diff --git a/test/ASTMerge/category.m b/test/ASTMerge/category.m
index bf0d11b..6ba2292 100644
--- a/test/ASTMerge/category.m
+++ b/test/ASTMerge/category.m
@@ -6,4 +6,4 @@
// CHECK: category1.m:16:1: note: instance method 'method2' also declared here
// CHECK: category2.m:26:1: error: instance method 'method3' has incompatible result types in different translation units ('float' vs. 'int')
// CHECK: category1.m:24:1: note: instance method 'method3' also declared here
-// CHECK: 4 diagnostics generated.
+// CHECK: 2 errors generated.
diff --git a/test/ASTMerge/enum.c b/test/ASTMerge/enum.c
index 9b78fd1..4380d19 100644
--- a/test/ASTMerge/enum.c
+++ b/test/ASTMerge/enum.c
@@ -22,4 +22,4 @@
// CHECK: enum1.c:30:6: note: no corresponding enumerator here
// CHECK: enum2.c:34:3: error: external variable 'x5' declared with incompatible types in different translation units ('enum E5' vs. 'enum E5')
// CHECK: enum1.c:34:3: note: declared here with type 'enum E5'
-// CHECK: 20 diagnostics generated
+// CHECK: 4 warnings and 4 errors generated
diff --git a/test/ASTMerge/function.c b/test/ASTMerge/function.c
index 581b6ec..f97ecee 100644
--- a/test/ASTMerge/function.c
+++ b/test/ASTMerge/function.c
@@ -6,4 +6,4 @@
// CHECK: function1.c:2:6: note: declared here with type 'void (int, float)'
// CHECK: function2.c:5:6: error: external function 'f3' declared with incompatible types in different translation units ('void (int)' vs. 'void (void)')
// CHECK: function1.c:4:6: note: declared here with type 'void (void)'
-// CHECK: 4 diagnostics generated
+// CHECK: 2 errors generated
diff --git a/test/ASTMerge/interface.m b/test/ASTMerge/interface.m
index 47e4e05..420ae38 100644
--- a/test/ASTMerge/interface.m
+++ b/test/ASTMerge/interface.m
@@ -15,5 +15,5 @@
// CHECK: interface1.m:46:1: note: class method 'bar:' also declared here
// CHECK: interface2.m:57:20: error: instance method 'bar:' has a parameter with a different types in different translation units ('double' vs. 'float')
// CHECK: interface1.m:58:19: note: declared here with type 'float'
-// CHECK: 13 diagnostics generated
+// CHECK: 6 errors generated
diff --git a/test/ASTMerge/property.m b/test/ASTMerge/property.m
index 0fd7e48..5f7a730 100644
--- a/test/ASTMerge/property.m
+++ b/test/ASTMerge/property.m
@@ -6,4 +6,4 @@
// CHECK: property1.m:10:28: note: declared here with type 'float'
// CHECK: property2.m:12:26: error: instance method 'Prop1' has incompatible result types in different translation units ('int' vs. 'float')
// CHECK: property1.m:10:28: note: instance method 'Prop1' also declared here
-// CHECK: 4 diagnostics generated.
+// CHECK: 2 errors generated.
diff --git a/test/ASTMerge/struct.c b/test/ASTMerge/struct.c
index e72b93b..7217222 100644
--- a/test/ASTMerge/struct.c
+++ b/test/ASTMerge/struct.c
@@ -39,4 +39,4 @@
// CHECK: struct2.c:53:43: note: field 'Deeper' has type 'struct DeeperError *' here
// CHECK: struct2.c:54:3: error: external variable 'xDeep' declared with incompatible types in different translation units ('struct DeepError' vs. 'struct DeepError')
// CHECK: struct1.c:57:3: note: declared here with type 'struct DeepError'
-// CHECK: 37 diagnostics
+// CHECK: 8 warnings and 7 errors generated
diff --git a/test/ASTMerge/typedef.c b/test/ASTMerge/typedef.c
index 4498864..6f91129 100644
--- a/test/ASTMerge/typedef.c
+++ b/test/ASTMerge/typedef.c
@@ -4,4 +4,4 @@
// CHECK: typedef2.c:4:10: error: external variable 'x2' declared with incompatible types in different translation units ('Typedef2' (aka 'double') vs. 'Typedef2' (aka 'int'))
// CHECK: typedef1.c:4:10: note: declared here with type 'Typedef2' (aka 'int')
-// CHECK: 2 diagnostics
+// CHECK: 1 error
diff --git a/test/ASTMerge/var.c b/test/ASTMerge/var.c
index fd30794..7f23b9f 100644
--- a/test/ASTMerge/var.c
+++ b/test/ASTMerge/var.c
@@ -9,4 +9,4 @@
// CHECK: var1.h:1:8: note: declared here with type 'double'
// CHECK: error: external variable 'xarray3' declared with incompatible types in different translation units ('int [17]' vs. 'int [18]')
// CHECK: var1.c:7:5: note: declared here with type 'int [18]'
-// CHECK: 6 diagnostics
+// CHECK: 3 errors
diff --git a/test/Analysis/inline.c b/test/Analysis/inline.c
index 952de73..acaf74d 100644
--- a/test/Analysis/inline.c
+++ b/test/Analysis/inline.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s
-
+// RUN: false
+// XFAIL: *
int f1() {
int y = 1;
y++;
diff --git a/test/Analysis/inline2.c b/test/Analysis/inline2.c
index e2758c1..ec965a6 100644
--- a/test/Analysis/inline2.c
+++ b/test/Analysis/inline2.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s
+// RUN: false
+// XFAIL: *
// Test parameter 'a' is registered to LiveVariables analysis data although it
// is not referenced in the function body.
diff --git a/test/Analysis/inline3.c b/test/Analysis/inline3.c
index 3661263..8f45858 100644
--- a/test/Analysis/inline3.c
+++ b/test/Analysis/inline3.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s
-
+// RUN: false
+// XFAIL: *
// Test when entering f1(), we set the right AnalysisContext to Environment.
// Otherwise, block-level expr '1 && a' would not be block-level.
diff --git a/test/Analysis/inline4.c b/test/Analysis/inline4.c
index dd2379f..b2b3c34 100644
--- a/test/Analysis/inline4.c
+++ b/test/Analysis/inline4.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f -verify %s
-
+// RUN: false
+// XFAIL: *
int g(int a) {
return a;
}
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
new file mode 100644
index 0000000..dd89159
--- /dev/null
+++ b/test/Analysis/method-call.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+struct A {
+ int x;
+ A(int a) { x = a; }
+ int getx() { return x; }
+};
+
+void f1() {
+ A x(3);
+ if (x.getx() == 3) {
+ int *p = 0;
+ *p = 3; // expected-warning{{Dereference of null pointer}}
+ } else {
+ int *p = 0;
+ *p = 3; // no-warning
+ }
+}
+
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m
index d10b9fa..4255141 100644
--- a/test/Analysis/misc-ps-region-store.m
+++ b/test/Analysis/misc-ps-region-store.m
@@ -955,3 +955,62 @@ void pr6288_b(void) {
*(px[0]) = 0; // no-warning
}
+// <rdar://problem/7817800> - A bug in RemoveDeadBindings was causing instance variable bindings
+// to get prematurely pruned from the state.
+@interface Rdar7817800 {
+ char *x;
+}
+- (void) rdar7817800_baz;
+@end
+
+char *rdar7817800_foobar();
+void rdar7817800_qux(void*);
+
+@implementation Rdar7817800
+- (void) rdar7817800_baz {
+ if (x)
+ rdar7817800_qux(x);
+ x = rdar7817800_foobar();
+ // Previously this triggered a bogus null dereference warning.
+ x[1] = 'a'; // no-warning
+}
+@end
+
+// PR 6036 - This test case triggered a crash inside StoreManager::CastRegion because the size
+// of 'unsigned long (*)[0]' is 0.
+struct pr6036_a { int pr6036_b; };
+struct pr6036_c;
+void u132monitk (struct pr6036_c *pr6036_d) {
+ (void) ((struct pr6036_a *) (unsigned long (*)[0]) ((char *) pr6036_d - 1))->pr6036_b; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}}
+}
+
+// <rdar://problem/7813989> - ?-expressions used as a base of a member expression should be treated as an lvalue
+typedef struct rdar7813989_NestedVal { int w; } rdar7813989_NestedVal;
+typedef struct rdar7813989_Val { rdar7813989_NestedVal nv; } rdar7813989_Val;
+
+int rdar7813989(int x, rdar7813989_Val *a, rdar7813989_Val *b) {
+ // This previously crashed with an assertion failure.
+ int z = (x ? a->nv : b->nv).w;
+ return z + 1;
+}
+
+// PR 6844 - Don't crash on vaarg expression.
+typedef __builtin_va_list va_list;
+void map(int srcID, ...) {
+ va_list ap;
+ int i;
+ for (i = 0; i < srcID; i++) {
+ int v = __builtin_va_arg(ap, int);
+ }
+}
+
+// PR 6854 - crash when casting symbolic memory address to a float
+// Handle casting from a symbolic region to a 'float'. This isn't
+// really all that intelligent, but previously this caused a crash
+// in SimpleSValuator.
+void pr6854(void * arg) {
+ void * a = arg;
+ *(void**)a = arg;
+ float f = *(float*) a;
+}
+
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index fa05f6f..2b21eec 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -933,3 +933,27 @@ void foo_rev95547_b(struct s_rev95547 w) {
struct s_rev95547 w2 = w;
w2.z1.x += 20.0; // no-warning
}
+
+//===----------------------------------------------------------------------===//
+// Test handling statement expressions that don't populate a CFG block that
+// is used to represent the computation of the RHS of a logical operator.
+// This previously triggered a crash.
+//===----------------------------------------------------------------------===//
+
+void pr6938() {
+ if (1 && ({
+ while (0);
+ 0;
+ }) == 0) {
+ }
+}
+
+void pr6938_b() {
+ if (1 && *({ // expected-warning{{Dereference of null pointer}}
+ while (0) {}
+ ({
+ (int *) 0;
+ });
+ }) == 0) {
+ }
+}
diff --git a/test/Analysis/new.cpp b/test/Analysis/new.cpp
new file mode 100644
index 0000000..f26eecd
--- /dev/null
+++ b/test/Analysis/new.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+
+void f1() {
+ int *n = new int;
+ if (*n) { // expected-warning {{Branch condition evaluates to a garbage value}}
+ }
+}
+
+void f2() {
+ int *n = new int(3);
+ if (*n) { // no-warning
+ }
+}
+
diff --git a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
index 5722a04..5f51871 100644
--- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
+++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
@@ -72,11 +72,11 @@ int handleVoidInComma() {
int marker(void) { // control reaches end of non-void function
}
+// CHECK-darwin8: control reaches end of non-void function
// CHECK-darwin8: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
// CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
// CHECK-darwin8: warning: The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage
// CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
-// CHECK-darwin8: control reaches end of non-void function
-// CHECK-darwin8: 5 diagnostics generated
+// CHECK-darwin8: 5 warnings generated
// CHECK-darwin9: control reaches end of non-void function
-// CHECK-darwin9: 1 diagnostic generated
+// CHECK-darwin9: 1 warning generated
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 5376ca0..5a1049c 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -62,8 +62,8 @@ int f4(int *p) {
int f4_b() {
short array[2];
- uintptr_t x = array; // expected-warning{{incompatible pointer to integer conversion initializing}}
- short *p = x; // expected-warning{{incompatible integer to pointer conversion initializing}}
+ uintptr_t x = array; // expected-warning{{incompatible pointer to integer conversion}}
+ short *p = x; // expected-warning{{incompatible integer to pointer conversion}}
// The following branch should be infeasible.
if (!(p = &array[0])) {
diff --git a/test/Analysis/override-werror.c b/test/Analysis/override-werror.c
index 522b9dc..f4854bb 100644
--- a/test/Analysis/override-werror.c
+++ b/test/Analysis/override-werror.c
@@ -6,7 +6,7 @@
// analyzer results.
char* f(int *p) {
- return p; // expected-warning{{incompatible pointer types returning 'int *', expected 'char *'}}
+ return p; // expected-warning{{incompatible pointer types}}
}
void g(int *p) {
diff --git a/test/Analysis/unix-fns.c b/test/Analysis/unix-fns.c
index 777ad19..9d036ac 100644
--- a/test/Analysis/unix-fns.c
+++ b/test/Analysis/unix-fns.c
@@ -1,11 +1,24 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem %s -analyzer-store=region
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem %s -analyzer-store=basic
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem %s -analyzer-store=region -fblocks -verify
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem %s -analyzer-store=basic -fblocks -verify
+
+struct _opaque_pthread_once_t {
+ long __sig;
+ char __opaque[8];
+};
+typedef struct _opaque_pthread_once_t __darwin_pthread_once_t;
+typedef __darwin_pthread_once_t pthread_once_t;
+int pthread_once(pthread_once_t *, void (*)(void));
+
+typedef void (^dispatch_block_t)(void);
+typedef long dispatch_once_t;
+void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block);
#ifndef O_CREAT
#define O_CREAT 0x0200
#define O_RDONLY 0x0000
#endif
int open(const char *, int, ...);
+int close(int fildes);
void test_open(const char *path) {
int fd;
@@ -17,3 +30,23 @@ void test_open(const char *path) {
if (!fd)
close(fd);
}
+
+void test_dispatch_once() {
+ dispatch_once_t pred = 0;
+ do { if (__builtin_expect(*(&pred), ~0l) != ~0l) dispatch_once((&pred), (^() {})); } while (0); // expected-warning{{Call to 'dispatch_once' uses the local variable 'pred' for the predicate value}}
+}
+void test_dispatch_once_neg() {
+ static dispatch_once_t pred = 0;
+ do { if (__builtin_expect(*(&pred), ~0l) != ~0l) dispatch_once((&pred), (^() {})); } while (0); // no-warning
+}
+
+void test_pthread_once_aux();
+
+void test_pthread_once() {
+ pthread_once_t pred = {0x30B1BCBA, {0}};
+ pthread_once(&pred, test_pthread_once_aux); // expected-warning{{Call to 'pthread_once' uses the local variable 'pred' for the "control" value}}
+}
+void test_pthread_once_neg() {
+ static pthread_once_t pred = {0x30B1BCBA, {0}};
+ pthread_once(&pred, test_pthread_once_aux); // no-warning
+}
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
index ee01416..0e262f3 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
@@ -71,3 +71,18 @@ namespace O {
}
}
+extern "C" {
+ struct L { };
+}
+
+void h(L); // expected-note{{candidate function}}
+
+namespace P {
+ void h(L); // expected-note{{candidate function}}
+ void test_transparent_context_adl(L l) {
+ {
+ h(l); // expected-error {{call to 'h' is ambiguous}}
+ }
+ }
+}
+
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp
new file mode 100644
index 0000000..004d1e4
--- /dev/null
+++ b/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace test0 {
+ struct A {
+ static int foo;
+ };
+
+ namespace i0 {
+ typedef int A; // expected-note {{declared here}}
+
+ int test() {
+ struct A a; // expected-error {{elaborated type refers to a typedef}}
+ return a.foo;
+ }
+ }
+
+ namespace i1 {
+ template <class> class A; // expected-note {{declared here}}
+
+ int test() {
+ struct A a; // expected-error {{elaborated type refers to a template}}
+ return a.foo;
+ }
+ }
+
+ namespace i2 {
+ int A;
+
+ int test() {
+ struct A a;
+ return a.foo;
+ }
+ }
+
+ namespace i3 {
+ void A();
+
+ int test() {
+ struct A a;
+ return a.foo;
+ }
+ }
+
+ namespace i4 {
+ template <class T> void A();
+
+ int test() {
+ struct A a;
+ return a.foo;
+ }
+ }
+
+ // This should magically be okay; see comment in SemaDecl.cpp.
+ // rdar://problem/7898108
+ typedef struct A A;
+ int test() {
+ struct A a;
+ return a.foo;
+ }
+}
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
index f9bac40..3039396 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
@@ -36,7 +36,7 @@ namespace Numbers {
double d;
};
Number zero(0.0f);
- void g(Number);
+ void g(Number); // expected-note 2{{passing argument to parameter here}}
}
void test2() {
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
index e579546..d2afd5d 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp
@@ -32,6 +32,6 @@ namespace test1 {
// Test that we don't find the injected class name when parsing base
// specifiers.
namespace test2 {
- template <class T> struct bar {}; // expected-note {{template parameter is declared here}}
- template <class T> struct foo : bar<foo> {}; // expected-error {{template argument for template type parameter must be a type}}
+ template <class T> struct bar {};
+ template <class T> struct foo : bar<foo> {}; // expected-error {{use of class template foo requires template arguments}} expected-note {{template is declared here}}
}
diff --git a/test/CXX/class.access/class.access.base/p1.cpp b/test/CXX/class.access/class.access.base/p1.cpp
index 1bbcedb..0988431 100644
--- a/test/CXX/class.access/class.access.base/p1.cpp
+++ b/test/CXX/class.access/class.access.base/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x [class.access.base]p1(a):
// If a class is declared to be a base class for another class using
diff --git a/test/CXX/class.access/class.access.base/p5.cpp b/test/CXX/class.access/class.access.base/p5.cpp
index 96037e7..938d9fb 100644
--- a/test/CXX/class.access/class.access.base/p5.cpp
+++ b/test/CXX/class.access/class.access.base/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -faccess-control -verify %s
+// RUN: %clang_cc1 -verify %s
namespace test0 {
struct A {
diff --git a/test/CXX/class.access/class.access.nest/p1.cpp b/test/CXX/class.access/class.access.nest/p1.cpp
index d2644c6..eceffcf 100644
--- a/test/CXX/class.access/class.access.nest/p1.cpp
+++ b/test/CXX/class.access/class.access.nest/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// Derived from GNU's std::string
namespace test0 {
diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp
index 22266cd..991698d 100644
--- a/test/CXX/class.access/class.friend/p1.cpp
+++ b/test/CXX/class.access/class.friend/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++'0x [class.friend] p1:
// A friend of a class is a function or class that is given permission to use
@@ -192,3 +192,98 @@ namespace test4 {
return a == b; // expected-note {{requested here}}
}
}
+
+
+// PR6174
+namespace test5 {
+ namespace ns {
+ class A;
+ }
+
+ class ns::A {
+ private: int x;
+ friend class B;
+ };
+
+ namespace ns {
+ class B {
+ int test(A *p) { return p->x; }
+ };
+ }
+}
+
+// PR6207
+namespace test6 {
+ struct A {};
+
+ struct B {
+ friend A::A();
+ friend A::~A();
+ friend A &A::operator=(const A&);
+ };
+}
+
+namespace test7 {
+ template <class T> struct X {
+ X();
+ ~X();
+ void foo();
+ void bar();
+ };
+
+ class A {
+ friend void X<int>::foo();
+ friend X<int>::X();
+ friend X<int>::X(const X&);
+
+ private:
+ A(); // expected-note 2 {{declared private here}}
+ };
+
+ template<> void X<int>::foo() {
+ A a;
+ }
+
+ template<> void X<int>::bar() {
+ A a; // expected-error {{calling a private constructor}}
+ }
+
+ template<> X<int>::X() {
+ A a;
+ }
+
+ template<> X<int>::~X() {
+ A a; // expected-error {{calling a private constructor}}
+ }
+}
+
+// Return types, parameters and default arguments to friend functions.
+namespace test8 {
+ class A {
+ typedef int I; // expected-note 4 {{declared private here}}
+ static const I x = 0;
+ friend I f(I i);
+ template<typename T> friend I g(I i);
+ };
+
+ // FIXME: This should be on line 264.
+ const A::I A::x; // expected-note {{declared private here}}
+ A::I f(A::I i = A::x) {}
+ template<typename T> A::I g(A::I i) {
+ T t;
+ }
+ template A::I g<A::I>(A::I i);
+
+ A::I f2(A::I i = A::x) {} // expected-error 3 {{is a private member of}}
+ template<typename T> A::I g2(A::I i) { // expected-error 2 {{is a private member of}}
+ T t;
+ }
+ template A::I g2<A::I>(A::I i);
+}
+
+// PR6885
+namespace test9 {
+ class B {
+ friend class test9;
+ };
+}
diff --git a/test/CXX/class.access/class.friend/p2-cxx03.cpp b/test/CXX/class.access/class.friend/p2-cxx03.cpp
new file mode 100644
index 0000000..0391c4b
--- /dev/null
+++ b/test/CXX/class.access/class.friend/p2-cxx03.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<typename T>
+class X0 {
+ friend T; // expected-warning{{non-class type 'T' cannot be a friend}}
+};
+
+class X1 { };
+enum E1 { };
+X0<X1> x0a;
+X0<X1 *> x0b;
+X0<int> x0c;
+X0<E1> x0d;
+
diff --git a/test/CXX/class.access/class.friend/p3-cxx0x.cpp b/test/CXX/class.access/class.friend/p3-cxx0x.cpp
new file mode 100644
index 0000000..4f55e53
--- /dev/null
+++ b/test/CXX/class.access/class.friend/p3-cxx0x.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+template<typename T>
+class X0 {
+ friend T;
+};
+
+class Y1 { };
+enum E1 { };
+X0<Y1> x0a;
+X0<Y1 *> x0b;
+X0<int> x0c;
+X0<E1> x0d;
+
+template<typename T>
+class X1 {
+ friend typename T::type; // expected-error{{no type named 'type' in 'Y1'}}
+};
+
+struct Y2 {
+ struct type { };
+};
+
+struct Y3 {
+ typedef int type;
+};
+
+X1<Y2> x1a;
+X1<Y3> x1b;
+X1<Y1> x1c; // expected-note{{in instantiation of template class 'X1<Y1>' requested here}}
diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp
new file mode 100644
index 0000000..6ff630c
--- /dev/null
+++ b/test/CXX/class.access/class.protected/p1.cpp
@@ -0,0 +1,387 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace test0 {
+ class A {
+ protected: int x; // expected-note 3 {{declared}}
+ static int sx; // expected-note 3 {{declared}}
+ };
+ class B : public A {
+ };
+ class C : protected A { // expected-note {{declared}}
+ };
+ class D : private B { // expected-note 3 {{constrained}}
+ };
+
+ void test(A &a) {
+ (void) a.x; // expected-error {{'x' is a protected member}}
+ (void) a.sx; // expected-error {{'sx' is a protected member}}
+ }
+ void test(B &b) {
+ (void) b.x; // expected-error {{'x' is a protected member}}
+ (void) b.sx; // expected-error {{'sx' is a protected member}}
+ }
+ void test(C &c) {
+ (void) c.x; // expected-error {{'x' is a protected member}} expected-error {{protected base class}}
+ (void) c.sx; // expected-error {{'sx' is a protected member}}
+ }
+ void test(D &d) {
+ (void) d.x; // expected-error {{'x' is a private member}} expected-error {{private base class}}
+ (void) d.sx; // expected-error {{'sx' is a private member}}
+ }
+}
+
+namespace test1 {
+ class A {
+ protected: int x;
+ static int sx;
+ static void test(A&);
+ };
+ class B : public A {
+ static void test(B&);
+ };
+ class C : protected A {
+ static void test(C&);
+ };
+ class D : private B {
+ static void test(D&);
+ };
+
+ void A::test(A &a) {
+ (void) a.x;
+ (void) a.sx;
+ }
+ void B::test(B &b) {
+ (void) b.x;
+ (void) b.sx;
+ }
+ void C::test(C &c) {
+ (void) c.x;
+ (void) c.sx;
+ }
+ void D::test(D &d) {
+ (void) d.x;
+ (void) d.sx;
+ }
+}
+
+namespace test2 {
+ class A {
+ protected: int x; // expected-note 3 {{declared}}
+ static int sx;
+ static void test(A&);
+ };
+ class B : public A {
+ static void test(A&);
+ };
+ class C : protected A {
+ static void test(A&);
+ };
+ class D : private B {
+ static void test(A&);
+ };
+
+ void A::test(A &a) {
+ (void) a.x;
+ (void) a.sx;
+ }
+ void B::test(A &a) {
+ (void) a.x; // expected-error {{'x' is a protected member}}
+ (void) a.sx;
+ }
+ void C::test(A &a) {
+ (void) a.x; // expected-error {{'x' is a protected member}}
+ (void) a.sx;
+ }
+ void D::test(A &a) {
+ (void) a.x; // expected-error {{'x' is a protected member}}
+ (void) a.sx;
+ }
+}
+
+namespace test3 {
+ class B;
+ class A {
+ protected: int x; // expected-note {{declared}}
+ static int sx;
+ static void test(B&);
+ };
+ class B : public A {
+ static void test(B&);
+ };
+ class C : protected A {
+ static void test(B&);
+ };
+ class D : private B {
+ static void test(B&);
+ };
+
+ void A::test(B &b) {
+ (void) b.x;
+ (void) b.sx;
+ }
+ void B::test(B &b) {
+ (void) b.x;
+ (void) b.sx;
+ }
+ void C::test(B &b) {
+ (void) b.x; // expected-error {{'x' is a protected member}}
+ (void) b.sx;
+ }
+ void D::test(B &b) {
+ (void) b.x;
+ (void) b.sx;
+ }
+}
+
+namespace test4 {
+ class C;
+ class A {
+ protected: int x; // expected-note 2 {{declared}}
+ static int sx;
+ static void test(C&);
+ };
+ class B : public A {
+ static void test(C&);
+ };
+ class C : protected A { // expected-note 4 {{constrained}} expected-note 3 {{declared}}
+ static void test(C&);
+ };
+ class D : private B {
+ static void test(C&);
+ };
+
+ void A::test(C &c) {
+ (void) c.x; // expected-error {{'x' is a protected member}} \
+ // expected-error {{protected base class}}
+ (void) c.sx; // expected-error {{'sx' is a protected member}}
+ }
+ void B::test(C &c) {
+ (void) c.x; // expected-error {{'x' is a protected member}} \
+ // expected-error {{protected base class}}
+ (void) c.sx; // expected-error {{'sx' is a protected member}}
+ }
+ void C::test(C &c) {
+ (void) c.x;
+ (void) c.sx;
+ }
+ void D::test(C &c) {
+ (void) c.x; // expected-error {{'x' is a protected member}} \
+ // expected-error {{protected base class}}
+ (void) c.sx; // expected-error {{'sx' is a protected member}}
+ }
+}
+
+namespace test5 {
+ class D;
+ class A {
+ protected: int x;
+ static int sx;
+ static void test(D&);
+ };
+ class B : public A {
+ static void test(D&);
+ };
+ class C : protected A {
+ static void test(D&);
+ };
+ class D : private B { // expected-note 9 {{constrained}}
+ static void test(D&);
+ };
+
+ void A::test(D &d) {
+ (void) d.x; // expected-error {{'x' is a private member}} \
+ // expected-error {{cannot cast}}
+ (void) d.sx; // expected-error {{'sx' is a private member}}
+ }
+ void B::test(D &d) {
+ (void) d.x; // expected-error {{'x' is a private member}} \
+ // expected-error {{cannot cast}}
+ (void) d.sx; // expected-error {{'sx' is a private member}}
+ }
+ void C::test(D &d) {
+ (void) d.x; // expected-error {{'x' is a private member}} \
+ // expected-error {{cannot cast}}
+ (void) d.sx; // expected-error {{'sx' is a private member}}
+ }
+ void D::test(D &d) {
+ (void) d.x;
+ (void) d.sx;
+ }
+}
+
+namespace test6 {
+ class Static {};
+ class A {
+ protected:
+ void foo(int); // expected-note 3 {{declared}}
+ void foo(long);
+ static void foo(Static);
+
+ static void test(A&);
+ };
+ class B : public A {
+ static void test(A&);
+ };
+ class C : protected A {
+ static void test(A&);
+ };
+ class D : private B {
+ static void test(A&);
+ };
+
+ void A::test(A &a) {
+ a.foo(10);
+ a.foo(Static());
+ }
+ void B::test(A &a) {
+ a.foo(10); // expected-error {{'foo' is a protected member}}
+ a.foo(Static());
+ }
+ void C::test(A &a) {
+ a.foo(10); // expected-error {{'foo' is a protected member}}
+ a.foo(Static());
+ }
+ void D::test(A &a) {
+ a.foo(10); // expected-error {{'foo' is a protected member}}
+ a.foo(Static());
+ }
+}
+
+namespace test7 {
+ class Static {};
+ class A {
+ protected:
+ void foo(int); // expected-note 3 {{declared}}
+ void foo(long);
+ static void foo(Static);
+
+ static void test();
+ };
+ class B : public A {
+ static void test();
+ };
+ class C : protected A {
+ static void test();
+ };
+ class D : private B {
+ static void test();
+ };
+
+ void A::test() {
+ void (A::*x)(int) = &A::foo;
+ void (*sx)(Static) = &A::foo;
+ }
+ void B::test() {
+ void (A::*x)(int) = &A::foo; // expected-error {{'foo' is a protected member}}
+ void (*sx)(Static) = &A::foo;
+ }
+ void C::test() {
+ void (A::*x)(int) = &A::foo; // expected-error {{'foo' is a protected member}}
+ void (*sx)(Static) = &A::foo;
+ }
+ void D::test() {
+ void (A::*x)(int) = &A::foo; // expected-error {{'foo' is a protected member}}
+ void (*sx)(Static) = &A::foo;
+ }
+}
+
+namespace test8 {
+ class Static {};
+ class A {
+ protected:
+ void foo(int); // expected-note 3 {{declared}}
+ void foo(long);
+ static void foo(Static);
+
+ static void test();
+ };
+ class B : public A {
+ static void test();
+ };
+ class C : protected A {
+ static void test();
+ };
+ class D : private B {
+ static void test();
+ };
+ void call(void (A::*)(int));
+ void calls(void (*)(Static));
+
+ void A::test() {
+ call(&A::foo);
+ calls(&A::foo);
+ }
+ void B::test() {
+ call(&A::foo); // expected-error {{'foo' is a protected member}}
+ calls(&A::foo);
+ }
+ void C::test() {
+ call(&A::foo); // expected-error {{'foo' is a protected member}}
+ calls(&A::foo);
+ }
+ void D::test() {
+ call(&A::foo); // expected-error {{'foo' is a protected member}}
+ calls(&A::foo);
+ }
+}
+
+namespace test9 {
+ class A {
+ protected: int foo(); // expected-note 8 {{declared}}
+ };
+
+ class B : public A {
+ friend class D;
+ };
+
+ class C : protected B { // expected-note {{declared}} \
+ // expected-note 6 {{constrained}}
+ };
+
+ class D : public A {
+ static void test(A &a) {
+ a.foo(); // expected-error {{'foo' is a protected member}}
+ a.A::foo(); // expected-error {{'foo' is a protected member}}
+ a.B::foo();
+ a.C::foo(); // expected-error {{'foo' is a protected member}}
+ }
+
+ static void test(B &b) {
+ b.foo();
+ b.A::foo(); // expected-error {{'foo' is a protected member}}
+ b.B::foo();
+ b.C::foo(); // expected-error {{'foo' is a protected member}}
+ }
+
+ static void test(C &c) {
+ c.foo(); // expected-error {{'foo' is a protected member}} \
+ // expected-error {{cannot cast}}
+ c.A::foo(); // expected-error {{'foo' is a protected member}} \
+ // expected-error {{'A' is a protected member}} \
+ // expected-error {{cannot cast}}
+ c.B::foo(); // expected-error {{'B' is a protected member}} \
+ // expected-error {{cannot cast}}
+ c.C::foo(); // expected-error {{'foo' is a protected member}} \
+ // expected-error {{cannot cast}}
+ }
+
+ static void test(D &d) {
+ d.foo();
+ d.A::foo();
+ d.B::foo();
+ d.C::foo(); // expected-error {{'foo' is a protected member}}
+ }
+ };
+}
+
+namespace test10 {
+ template<typename T> class A {
+ protected:
+ int foo();
+ int foo() const;
+
+ ~A() { foo(); }
+ };
+
+ template class A<int>;
+}
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index 3bbdbab8..1cd8966 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x [class.access]p4:
@@ -88,13 +88,24 @@ namespace test1 {
namespace test2 {
class A {
private:
- A(); // expected-note {{declared private here}}
+ A(); // expected-note 3 {{declared private here}}
static A foo;
};
A a; // expected-error {{calling a private constructor}}
A A::foo; // okay
+
+ class B : A { }; // expected-error {{base class 'test2::A' has private constructor}}
+ B b;
+
+ class C : virtual A {
+ public:
+ C();
+ };
+
+ class D : C { }; // expected-error {{inherited virtual base class 'test2::A' has private constructor}}
+ D d;
}
// Implicit destructor calls.
@@ -191,13 +202,13 @@ namespace test5 {
void operator=(const A &); // expected-note 2 {{declared private here}}
};
- class Test1 { A a; }; // expected-error {{field of type 'test5::A' has private copy assignment operator}}
+ class Test1 { A a; }; // expected-error {{private member}}
void test1() {
Test1 a;
a = Test1();
}
- class Test2 : A {}; // expected-error {{base class 'test5::A' has private copy assignment operator}}
+ class Test2 : A {}; // expected-error {{private member}}
void test2() {
Test2 a;
a = Test2();
@@ -327,3 +338,83 @@ namespace test13 {
(void) d->x;
}
}
+
+// Destructors for temporaries.
+namespace test14 {
+ class A {
+ private: ~A(); // expected-note {{declared private here}}
+ };
+ A foo();
+
+ void test() {
+ foo(); // expected-error {{temporary of type 'test14::A' has private destructor}}
+ }
+
+ class X {
+ ~X(); // expected-note {{declared private here}}
+ };
+
+ struct Y1 {
+ operator X();
+ };
+
+ void g() {
+ const X &xr = Y1(); // expected-error{{temporary of type 'test14::X' has private destructor}}
+ }
+}
+
+// PR 7024
+namespace test15 {
+ template <class T> class A {
+ private:
+ int private_foo; // expected-note {{declared private here}}
+ static int private_sfoo; // expected-note {{declared private here}}
+ protected:
+ int protected_foo; // expected-note 4 {{declared protected here}}
+ static int protected_sfoo; // expected-note 3 {{declared protected here}}
+
+ int test1(A<int> &a) {
+ return a.private_foo; // expected-error {{private member}}
+ }
+
+ int test2(A<int> &a) {
+ return a.private_sfoo; // expected-error {{private member}}
+ }
+
+ int test3(A<int> &a) {
+ return a.protected_foo; // expected-error {{protected member}}
+ }
+
+ int test4(A<int> &a) {
+ return a.protected_sfoo; // expected-error {{protected member}}
+ }
+ };
+
+ template class A<int>;
+ template class A<long>; // expected-note 4 {{in instantiation}}
+
+ template <class T> class B : public A<T> {
+ // TODO: These first two accesses can be detected as ill-formed at
+ // definition time because they're member accesses and A<int> can't
+ // be a subclass of B<T> for any T.
+
+ int test1(A<int> &a) {
+ return a.protected_foo; // expected-error 2 {{protected member}}
+ }
+
+ int test2(A<int> &a) {
+ return a.protected_sfoo; // expected-error {{protected member}}
+ }
+
+ int test3(B<int> &b) {
+ return b.protected_foo; // expected-error {{protected member}}
+ }
+
+ int test4(B<int> &b) {
+ return b.protected_sfoo; // expected-error {{protected member}}
+ }
+ };
+
+ template class B<int>; // expected-note {{in instantiation}}
+ template class B<long>; // expected-note 4 {{in instantiation}}
+}
diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp
index aaf510a..734a4d8 100644
--- a/test/CXX/class.access/p6.cpp
+++ b/test/CXX/class.access/p6.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x [class.access]p6:
// All access controls in [class.access] affect the ability to
@@ -52,3 +52,70 @@ namespace test1 {
A apriv = priv; // expected-error {{private constructor}}
}
}
+
+// PR6967
+namespace test2 {
+ class A {
+ public:
+ template <class T> static void set(T &t, typename T::type v) {
+ t.value = v;
+ }
+ template <class T> static typename T::type get(const T &t) {
+ return t.value;
+ }
+ };
+
+ class B {
+ friend class A;
+
+ private:
+ typedef int type;
+ type value;
+ };
+
+ int test() {
+ B b;
+ A::set(b, 0);
+ return A::get(b);
+ }
+}
+
+namespace test3 {
+ class Green {}; class Blue {};
+
+ // We have to wrap this in a class because a partial specialization
+ // isn't actually in the context of the template.
+ struct Outer {
+ template <class T, class Nat> class A {
+ };
+ };
+
+ template <class T> class Outer::A<T, typename T::nature> {
+ public:
+ static void foo();
+ };
+
+ class B {
+ private: typedef Green nature;
+ friend class Outer;
+ };
+
+ void test() {
+ Outer::A<B, Green>::foo();
+ Outer::A<B, Blue>::foo(); // expected-error {{no member named 'foo'}}
+ }
+}
+
+namespace test4 {
+ template <class T> class A {
+ private: typedef int type;
+ template <class U> friend void foo(U &, typename U::type);
+ };
+
+ template <class U> void foo(U &, typename U::type) {}
+
+ void test() {
+ A<int> a;
+ foo(a, 0);
+ }
+}
diff --git a/test/CXX/class/class.friend/p2.cpp b/test/CXX/class/class.friend/p2.cpp
index 9fe2b17..eb5036f 100644
--- a/test/CXX/class/class.friend/p2.cpp
+++ b/test/CXX/class/class.friend/p2.cpp
@@ -4,7 +4,7 @@ struct B0;
class A {
friend class B {}; // expected-error {{cannot define a type in a friend declaration}}
- friend int; // expected-error {{friends can only be classes or functions}}
- friend B0; // expected-error {{must specify 'struct' to befriend}}
+ friend int; // expected-warning {{non-class type 'int' cannot be a friend}}
+ friend B0; // expected-warning {{must specify 'struct' to befriend}}
friend class C; // okay
};
diff --git a/test/CXX/class/class.local/p2.cpp b/test/CXX/class/class.local/p2.cpp
index 2b1359c..db4c90f 100644
--- a/test/CXX/class/class.local/p2.cpp
+++ b/test/CXX/class/class.local/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -faccess-control
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A { };
diff --git a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp
index f5fbf7a..c81e4ef 100644
--- a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp
+++ b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp
@@ -50,7 +50,7 @@ namespace test1 {
}
namespace test2 {
- class Unrelated {
+ struct Unrelated {
void foo();
};
diff --git a/test/CXX/conv/conv.mem/p4.cpp b/test/CXX/conv/conv.mem/p4.cpp
index 42f6343..e0748d8 100644
--- a/test/CXX/conv/conv.mem/p4.cpp
+++ b/test/CXX/conv/conv.mem/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct Base {
int data;
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
index a5f314d..ddcbe78 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
@@ -53,4 +53,16 @@ struct Y {
friend union X1;
};
+namespace N {
+ namespace M {
+ template<typename T> class X;
+ }
+}
+
+namespace N3 {
+ class Y {
+ template<typename T> friend class N::M::X;
+ };
+}
+
// FIXME: Woefully inadequate for testing
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
index 89e9c89..bb1d67f 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// We have to avoid ADL for this test.
@@ -12,7 +12,8 @@ namespace Test0 {
test<1> foo(class foo);
namespace A {
- test<2> foo(class ::foo); // expected-note {{candidate}}
+ test<2> foo(class ::foo); // expected-note {{candidate}} \
+ // expected-note{{passing argument to parameter here}}
void test0() {
using ::foo;
@@ -38,7 +39,7 @@ namespace Test0 {
test<2> _1 = (foo)(a);
class Test0::foo b;
- test<2> _2 = (foo)(b); // expected-error {{no viable conversion from 'class Test0::foo' to 'class foo' is possible}}
+ test<2> _2 = (foo)(b); // expected-error {{no viable conversion from 'class Test0::foo' to 'class ::foo' is possible}}
}
}
}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
index 23da98c..a43d9e0 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p4.cpp
@@ -166,7 +166,7 @@ namespace test3 {
template <class T> struct C : A<T> {
using typename A<T>::type;
- using typename A<T>::hiding; // expected-note {{declared at}} \
+ using typename A<T>::hiding; // expected-note {{declared here}} \
// expected-error {{'typename' keyword used on a non-type}}
using typename A<T>::union_member; // expected-error {{'typename' keyword used on a non-type}}
using typename A<T>::enumerator; // expected-error {{'typename' keyword used on a non-type}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
index c530311..b04e869 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p3.cpp
@@ -13,7 +13,7 @@ class A1 {
friend union A; // expected-error {{use of 'A' with tag type that does not match previous declaration}}
friend enum A; // expected-error {{ISO C++ forbids forward references to 'enum' types}} \
- // expected-error {{enum types cannot be friends}}
+ // expected-warning {{cannot be a friend}}
};
template <class T> struct B { // expected-note {{previous use is here}}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
new file mode 100644
index 0000000..5a342d4
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p16-cxx0x-no-extra-copy.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+// C++03 requires that we check for a copy constructor when binding a
+// reference to a reference-compatible rvalue, since we are allowed to
+// make a copy. C++0x does not permit the copy, so ensure that we
+// don't diagnose cases where the copy constructor is unavailable.
+
+struct X1 {
+ X1();
+ explicit X1(const X1&);
+};
+
+struct X2 {
+ X2();
+
+private:
+ X2(const X2&);
+};
+
+struct X3 {
+ X3();
+
+private:
+ X3(X3&);
+};
+
+template<typename T>
+T get_value_badly() {
+ double *dp = 0;
+ T *tp = dp;
+ return T();
+}
+
+template<typename T>
+struct X4 {
+ X4();
+ X4(const X4&, T = get_value_badly<T>());
+};
+
+void g1(const X1&);
+void g2(const X2&);
+void g3(const X3&);
+void g4(const X4<int>&);
+
+void test() {
+ g1(X1());
+ g2(X2());
+ g3(X3());
+ g4(X4<int>());
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
new file mode 100644
index 0000000..1639411
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// C++03 requires that we check for a copy constructor when binding a
+// reference to a temporary, since we are allowed to make a copy, Even
+// though we don't actually make that copy, make sure that we diagnose
+// cases where that copy constructor is somehow unavailable.
+
+struct X1 {
+ X1();
+ explicit X1(const X1&);
+};
+
+struct X2 {
+ X2();
+
+private:
+ X2(const X2&); // expected-note{{declared private here}}
+};
+
+struct X3 {
+ X3();
+
+private:
+ X3(X3&); // expected-note{{candidate constructor not viable: no known conversion from 'X3' to 'X3 &' for 1st argument}}
+};
+
+// Check for instantiation of default arguments
+template<typename T>
+T get_value_badly() {
+ double *dp = 0;
+ T *tp = dp; // expected-error{{ cannot initialize a variable of type 'int *' with an lvalue of type 'double *'}}
+ return T();
+}
+
+template<typename T>
+struct X4 {
+ X4();
+ X4(const X4&, T = get_value_badly<T>()); // expected-note{{in instantiation of}}
+};
+
+// Check for "dangerous" default arguments that could cause recursion.
+struct X5 {
+ X5();
+ X5(const X5&, const X5& = X5()); // expected-error{{no viable constructor copying parameter of type 'X5'}}
+};
+
+void g1(const X1&);
+void g2(const X2&);
+void g3(const X3&);
+void g4(const X4<int>&);
+void g5(const X5&);
+
+void test() {
+ g1(X1()); // expected-error{{no viable constructor copying parameter of type 'X1'}}
+ g2(X2()); // expected-error{{calling a private constructor of class 'X2'}}
+ g3(X3()); // expected-error{{no viable constructor copying parameter of type 'X3'}}
+ g4(X4<int>());
+ g5(X5()); // expected-error{{no viable constructor copying parameter of type 'X5'}}
+}
+
+// Check for dangerous recursion in default arguments.
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
index d757adf..9b39259 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
@@ -17,11 +17,11 @@ struct B : A { } b;
// CHECK: example1
void example1() {
// CHECK: A &ra =
- // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase> lvalue
+ // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)> lvalue
A &ra = b;
// CHECK: A const &rca =
// CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
- // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase>
+ // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
const A& rca = b;
}
@@ -35,12 +35,12 @@ struct X {
void example2() {
// CHECK: A const &rca =
// CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
- // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase>
+ // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
// CHECK: CallExpr{{.*}}B
const A &rca = f();
// CHECK: A const &r =
// CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
- // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase>
+ // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
// CHECK: CXXMemberCallExpr{{.*}}'struct B'
const A& r = x;
}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
index 4c7ee94..51d61a5 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5.cpp
@@ -22,3 +22,19 @@ namespace PR6264 {
T bar = S();
}
}
+
+namespace PR6066 {
+ struct B { };
+ struct A : B {
+ operator B*();
+ operator B&(); // expected-warning{{conversion function converting 'PR6066::A' to its base class 'PR6066::B' will never be used}}
+ };
+
+ void f(B&); // no rvalues accepted
+ void f(B*);
+
+ int g() {
+ f(A()); // calls f(B*)
+ return 0;
+ }
+}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
index 7ee052c..3100e56 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p5.cpp
@@ -2,7 +2,8 @@
float global_f;
-void f0(int *ip = &global_f); // expected-error{{cannot initialize}}
+void f0(int *ip = &global_f); // expected-error{{cannot initialize}} \
+// expected-note{{passing argument to parameter 'ip' here}}
// Example from C++03 standard
int a = 1;
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp
index 00234ac..9ab0b48 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p6.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
class C {
+public:
void f(int i = 3); // expected-note{{here}}
void g(int i, int j = 99);
};
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp
index 17fd712..aaf7451 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp
@@ -9,10 +9,10 @@
typedef int &intref;
typedef intref &intrefref;
-template <class T> class RefMem {
+template <class T> class RefMem { // expected-warning{{class 'RefMem<int &>' does not declare any constructor to initialize its non-modifiable members}}
T
&
- member;
+ member; // expected-note{{ reference member 'member' will never be initialized}}
};
struct RefRef {
@@ -34,7 +34,7 @@ struct RefRef {
int
&
>
- refref3; // collapses
+ refref3; // collapses expected-note{{in instantiation of template class 'RefMem<int &>' requested here}}
};
diff --git a/test/CXX/except/except.handle/p16.cpp b/test/CXX/except/except.handle/p16.cpp
index 87972f5..4950a2f 100644
--- a/test/CXX/except/except.handle/p16.cpp
+++ b/test/CXX/except/except.handle/p16.cpp
@@ -11,12 +11,12 @@ class X {
public:
X(const X<T> &) {
int *ip = 0;
- ptr = ip; // expected-error{{incompatible type assigning 'int *', expected 'float *'}}
+ ptr = ip; // expected-error{{assigning to 'float *' from incompatible type 'int *'}}
}
~X() {
float *fp = 0;
- ptr = fp; // expected-error{{incompatible type assigning 'float *', expected 'int *'}}
+ ptr = fp; // expected-error{{assigning to 'int *' from incompatible type 'float *'}}
}
};
diff --git a/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
index 4b2b5ae..2fa30e5 100644
--- a/test/CXX/expr/expr.unary/expr.delete/p5.cpp
+++ b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
@@ -11,7 +11,7 @@ class T0 { ~T0(); };
// The trivial case, inside a template instantiation.
template<typename T>
-class T1_A { T *x; ~T1_A() { delete x; } }; // expected-warning {{deleting pointer to incomplete type}}
+struct T1_A { T *x; ~T1_A() { delete x; } }; // expected-warning {{deleting pointer to incomplete type}}
class T1_B; // expected-note {{forward declaration}}
void f0() { T1_A<T1_B> x; } // expected-note {{in instantiation of member function}}
diff --git a/test/CXX/expr/expr.unary/expr.new/p19.cpp b/test/CXX/expr/expr.unary/expr.new/p19.cpp
index 6134779..bb69fd5 100644
--- a/test/CXX/expr/expr.unary/expr.new/p19.cpp
+++ b/test/CXX/expr/expr.unary/expr.new/p19.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s
typedef __SIZE_TYPE__ size_t;
// Operator delete template for placement new with global lookup
diff --git a/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp b/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
index c188e1e..4c924b1 100644
--- a/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
+++ b/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -fexceptions %s
typedef __SIZE_TYPE__ size_t;
struct S {
diff --git a/test/CXX/expr/expr.unary/expr.new/p20.cpp b/test/CXX/expr/expr.unary/expr.new/p20.cpp
index 71e584e..8cbe2b9 100644
--- a/test/CXX/expr/expr.unary/expr.new/p20.cpp
+++ b/test/CXX/expr/expr.unary/expr.new/p20.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s
typedef __SIZE_TYPE__ size_t;
// Overloaded operator delete with two arguments
diff --git a/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
new file mode 100644
index 0000000..d9e0ff8
--- /dev/null
+++ b/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+namespace PR6285 {
+ template<typename T> struct identity
+ { typedef T type; };
+
+ struct D {
+ template<typename T = short>
+ operator typename identity<T>::type(); // expected-note{{candidate}}
+ };
+
+ int f() { return D(); } // expected-error{{no viable conversion}}
+}
+
diff --git a/test/CXX/stmt.stmt/stmt.select/p3.cpp b/test/CXX/stmt.stmt/stmt.select/p3.cpp
index e674f97..31de685 100644
--- a/test/CXX/stmt.stmt/stmt.select/p3.cpp
+++ b/test/CXX/stmt.stmt/stmt.select/p3.cpp
@@ -9,3 +9,11 @@ void g() {
int x; // expected-error{{redefinition of 'x'}}
}
}
+
+
+void h() {
+ if (int x = f()) // expected-note 2{{previous definition}}
+ int x; // expected-error{{redefinition of 'x'}}
+ else
+ int x; // expected-error{{redefinition of 'x'}}
+} \ No newline at end of file
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
index cfa14f9..97457ea 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/temp.class.order/p2.cpp
@@ -1,16 +1,48 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<int I, int J, class T> class X {
+template<int I, int J, class T> struct X {
static const int value = 0;
};
-template<int I, int J> class X<I, J, int> {
+template<int I, int J> struct X<I, J, int> {
static const int value = 1;
};
-template<int I> class X<I, I, int> {
+template<int I> struct X<I, I, int> {
static const int value = 2;
};
int array0[X<0, 0, float>::value == 0? 1 : -1];
int array1[X<0, 1, int>::value == 1? 1 : -1];
int array2[X<0, 0, int>::value == 2? 1 : -1];
+
+namespace DependentSubstPartialOrdering {
+ template<typename T, typename U = void, typename V = void>
+ struct X {
+ static const unsigned value = 1;
+ };
+
+ template<typename T, typename U>
+ struct X<T, U, typename T::is_b> {
+ static const unsigned value = 2;
+ };
+
+ template<typename T>
+ struct X<T, typename T::is_a, typename T::is_b> {
+ static const unsigned value = 3;
+ };
+
+ struct X1 { };
+
+ struct X2 {
+ typedef void is_b;
+ };
+
+ struct X3 {
+ typedef void is_a;
+ typedef void is_b;
+ };
+
+ int check_X1[X<X1, void, void>::value == 1? 1 : -1];
+ int check_X2[X<X2, void, void>::value == 2? 1 : -1];
+ int check_X3[X<X3, void, void>::value == 3? 1 : -1];
+}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
index c9dc546..073b2a1 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -faccess-control -verify -emit-llvm-only %s
+// RUN: %clang_cc1 -verify -emit-llvm-only %s
namespace test0 {
template <typename T> struct Num {
@@ -155,7 +155,7 @@ namespace Dependent {
}
namespace test7 {
- template <class T> class A { // expected-note {{previous definition is here}}
+ template <class T> class A { // expected-note {{declared here}}
friend class B;
int x; // expected-note {{declared private here}}
};
@@ -174,7 +174,7 @@ namespace test7 {
// This shouldn't crash.
template <class T> class D {
- friend class A; // expected-error {{redefinition of 'A' as different kind of symbol}}
+ friend class A; // expected-error {{elaborated type refers to a template}}
};
template class D<int>;
}
@@ -216,3 +216,80 @@ namespace test9 {
template class A<int>; // expected-note {{in instantiation}}
}
+
+namespace test10 {
+ template <class T> class A;
+ template <class T> A<T> bar(const T*, const A<T>&);
+ template <class T> class A {
+ private:
+ void foo(); // expected-note {{declared private here}}
+ friend A bar<>(const T*, const A<T>&);
+ };
+
+ template <class T> A<T> bar(const T *l, const A<T> &r) {
+ A<T> l1;
+ l1.foo();
+
+ A<char> l2;
+ l2.foo(); // expected-error {{'foo' is a private member of 'test10::A<char>'}}
+
+ return l1;
+ }
+
+ template A<int> bar<int>(const int *, const A<int> &); // expected-note {{in instantiation}}
+}
+
+// PR6752: this shouldn't crash.
+namespace test11 {
+ struct Foo {
+ template<class A>
+ struct IteratorImpl {
+ template<class T> friend class IteratorImpl;
+ };
+ };
+
+ template struct Foo::IteratorImpl<int>;
+ template struct Foo::IteratorImpl<long>;
+}
+
+// PR6827
+namespace test12 {
+ template <typename T> class Foo;
+ template <typename T> Foo<T> foo(T* t){ return Foo<T>(t, true); }
+
+ template <typename T> class Foo {
+ public:
+ Foo(T*);
+ friend Foo<T> foo<T>(T*);
+ private:
+ Foo(T*, bool); // expected-note {{declared private here}}
+ };
+
+ // Should work.
+ int globalInt;
+ Foo<int> f = foo(&globalInt);
+
+ // Shouldn't work.
+ long globalLong;
+ template <> Foo<long> foo(long *t) {
+ Foo<int> s(&globalInt, false); // expected-error {{calling a private constructor}}
+ return Foo<long>(t, true);
+ }
+}
+
+// PR6514
+namespace test13 {
+ template <int N, template <int> class Temp>
+ class Role : public Temp<N> {
+ friend class Temp<N>;
+ int x;
+ };
+
+ template <int N> class Foo {
+ void foo(Role<N, test13::Foo> &role) {
+ (void) role.x;
+ }
+ };
+
+ template class Foo<0>;
+}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p3.cpp b/test/CXX/temp/temp.decls/temp.friend/p3.cpp
index 17d8c85..d116e01 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p3.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p3.cpp
@@ -8,6 +8,5 @@ class B {
template <class T> friend class A;
template <class T> friend class Undeclared;
- // FIXME: Diagnostic below could be (and was) better.
- template <class T> friend typename A<T>::Member; // expected-error {{classes or functions}}
+ template <class T> friend typename A<T>::Member; // expected-warning {{non-class type 'typename A<T>::Member' cannot be a friend}}
};
diff --git a/test/CXX/temp/temp.decls/temp.mem/p1.cpp b/test/CXX/temp/temp.decls/temp.mem/p1.cpp
index b057eed..f5f1205 100644
--- a/test/CXX/temp/temp.decls/temp.mem/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.mem/p1.cpp
@@ -19,17 +19,17 @@ namespace PR6376 {
template<typename T>
struct X {
template<typename Y>
- struct Y { };
+ struct Y1 { }; //
};
template<>
struct X<float> {
template<typename Y>
- struct Y { };
+ struct Y1 { };
};
template<typename T, typename U>
- struct Z : public X<T>::template Y<U> { };
+ struct Z : public X<T>::template Y1<U> { };
Z<float, int> z0;
}
diff --git a/test/CXX/temp/temp.param/p3.cpp b/test/CXX/temp/temp.param/p3.cpp
index 8fcc2dc..dc40c4b 100644
--- a/test/CXX/temp/temp.param/p3.cpp
+++ b/test/CXX/temp/temp.param/p3.cpp
@@ -26,3 +26,15 @@ template<class T, T i> struct X2 {
// expected-error{{no viable conversion}}
}
};
+
+namespace PR6831 {
+ namespace NA { struct S; }
+ namespace NB { struct S; }
+
+ using namespace NA;
+ using namespace NB;
+
+ template <typename S> void foo();
+ template <int S> void bar();
+ template <template<typename> class S> void baz();
+}
diff --git a/test/CXX/temp/temp.res/temp.local/p3.cpp b/test/CXX/temp/temp.res/temp.local/p3.cpp
new file mode 100644
index 0000000..88f8963
--- /dev/null
+++ b/test/CXX/temp/temp.res/temp.local/p3.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -verify %s
+
+template <class T> struct Base { // expected-note 4 {{member found by ambiguous name lookup}}
+ static void f();
+};
+
+struct X0 { };
+
+template <class T> struct Derived: Base<int>, Base<char> {
+ typename Derived::Base b; // expected-error{{member 'Base' found in multiple base classes of different types}}
+ typename Derived::Base<double> d; // OK
+
+ void g(X0 *t) {
+ t->Derived::Base<T>::f();
+ t->Base<T>::f();
+ t->Base::f(); // expected-error{{member 'Base' found in multiple base classes of different types}} \
+ // expected-error{{no member named 'f' in 'X0'}} \
+ // expected-error{{expected a class or namespace}}
+ }
+};
+
+namespace PR6717 {
+ template <typename T>
+ class WebVector {
+ }
+
+ WebVector(const WebVector<T>& other) { }
+
+ template <typename C>
+ WebVector<T>& operator=(const C& other) { } // expected-error{{unknown type name 'WebVector'}} \
+ // expected-error{{unqualified-id}}
+}
diff --git a/test/CXX/temp/temp.spec/p5.cpp b/test/CXX/temp/temp.spec/p5.cpp
index c37817c..ba99dd7 100644
--- a/test/CXX/temp/temp.spec/p5.cpp
+++ b/test/CXX/temp/temp.spec/p5.cpp
@@ -27,3 +27,20 @@ template union X0<float>::Inner; // expected-error{{duplicate explicit instantia
template float X0<float>::value; // expected-note{{previous explicit instantiation}}
template float X0<float>::value; // expected-error{{duplicate explicit instantiation}}
+
+// Make sure that we don't get tricked by redeclarations of nested classes.
+namespace NestedClassRedecls {
+ template<typename T>
+ struct X {
+ struct Nested;
+ friend struct Nested;
+
+ struct Nested {
+ Nested() {}
+ } nested;
+ };
+
+ X<int> xi;
+
+ template struct X<int>;
+}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
index e30f046..e9758bc 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp
@@ -8,12 +8,11 @@ template void f0(int); // okay
// A definition of the class or class template containing a member function
// template shall be in scope at the point of the explicit instantiation of
// the member function template.
-struct X0; // expected-note 3{{forward declaration}}
-template<typename> struct X1; // expected-note 8{{declared here}}
+struct X0; // expected-note {{forward declaration}}
+template<typename> struct X1; // expected-note 5{{declared here}}
-// FIXME: Repeated diagnostics here!
-template void X0::f0<int>(int); // expected-error 3{{incomplete type}} // expected-error{{invalid token after top level declarator}}
-template void X1<int>::f0<int>(int); // expected-error 3{{implicit instantiation of undefined template}} // expected-error{{invalid token after top level declarator}}
+template void X0::f0<int>(int); // expected-error {{incomplete type}}
+template void X1<int>::f0<int>(int); // expected-error {{implicit instantiation of undefined template}}
// A definition of a class template or class member template shall be in scope
// at the point of the explicit instantiation of the class template or class
@@ -33,11 +32,10 @@ template struct X2<int>::Inner<float>; // expected-error{{explicit instantiation
// A definition of a class template shall be in scope at the point of an
// explicit instantiation of a member function or a static data member of the
// class template.
-template void X1<int>::f1(int); // expected-error 2{{undefined template}} \
- // expected-error{{does not refer}}
+template void X1<int>::f1(int); // expected-error {{undefined template}}
+template void X1<int>::f1<int>(int); // expected-error {{undefined template}}
-template int X1<int>::member; // expected-error 2{{undefined template}} \
- // expected-error{{does not refer}}
+template int X1<int>::member; // expected-error {{undefined template}}
// A definition of a member class of a class template shall be in scope at the
// point of an explicit instantiation of the member class.
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p4.cpp b/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
index 2b85213..d304374 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
template<typename T> void f0(T); // expected-note{{here}}
template void f0(int); // expected-error{{explicit instantiation of undefined function template}}
@@ -16,20 +16,20 @@ template void X0<int>::f1(); // expected-error{{explicit instantiation of undefi
template int X0<int>::value; // expected-error{{explicit instantiation of undefined static data member}}
-template<> void f0(long);
-template void f0(long); // okay
+template<> void f0(long); // expected-note{{previous template specialization is here}}
+template void f0(long); // expected-warning{{explicit instantiation of 'f0<long>' that occurs after an explicit specialization will be ignored}}
-template<> void X0<long>::f1();
-template void X0<long>::f1();
+template<> void X0<long>::f1(); // expected-note{{previous template specialization is here}}
+template void X0<long>::f1(); // expected-warning{{explicit instantiation of 'f1' that occurs after an explicit specialization will be ignored}}
-template<> struct X0<long>::Inner;
-template struct X0<long>::Inner;
+template<> struct X0<long>::Inner; // expected-note{{previous template specialization is here}}
+template struct X0<long>::Inner; // expected-warning{{explicit instantiation of 'Inner' that occurs after an explicit specialization will be ignored}}
-template<> long X0<long>::value;
-template long X0<long>::value;
+template<> long X0<long>::value; // expected-note{{previous template specialization is here}}
+template long X0<long>::value; // expected-warning{{explicit instantiation of 'value' that occurs after an explicit specialization will be ignored}}
-template<> struct X0<double>;
-template struct X0<double>;
+template<> struct X0<double>; // expected-note{{previous template specialization is here}}
+template struct X0<double>; // expected-warning{{explicit instantiation of 'X0<double>' that occurs after an explicit specialization will be ignored}}
// PR 6458
namespace test0 {
diff --git a/test/CXX/temp/temp.spec/temp.inst/p11.cpp b/test/CXX/temp/temp.spec/temp.inst/p11.cpp
new file mode 100644
index 0000000..8184071
--- /dev/null
+++ b/test/CXX/temp/temp.spec/temp.inst/p11.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -verify -emit-llvm-only %s
+
+// rdar://problem/7838962
+namespace test0 {
+ template<typename T> unsigned f0() {
+ return T::MaxSize; // expected-error {{'int' cannot be used prior to '::'}}
+ };
+ template<typename T> struct A {
+ void Allocate(unsigned Alignment
+ = f0<T>()) // expected-note {{in instantiation}}
+ {}
+ };
+ void f1(A<int> x) { x.Allocate(); }
+
+}
diff --git a/test/CodeCompletion/call.cpp b/test/CodeCompletion/call.cpp
index 04d2a2f..1df958e 100644
--- a/test/CodeCompletion/call.cpp
+++ b/test/CodeCompletion/call.cpp
@@ -18,6 +18,7 @@ void f();
void test() {
f(Y(), 0, 0);
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
+ // CHECK-CC1: COMPLETION: Pattern : dynamic_cast<<#type-id#>>(<#expression#>)
// CHECK-CC1: f(N::Y y, <#int ZZ#>)
// CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
// CHECK-CC1-NEXT: f(float x, <#float y#>)
diff --git a/test/CodeCompletion/macros.c b/test/CodeCompletion/macros.c
index 6330d25..0758bbf 100644
--- a/test/CodeCompletion/macros.c
+++ b/test/CodeCompletion/macros.c
@@ -19,11 +19,7 @@ void test(struct Point *p) {
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s
- // CC1: BAR(<#X#>, <#Y#>)
// CC1: color
- // CC1: FOO
- // CC1: IDENTITY(<#X#>)
- // CC1: WIBBLE
// CC1: x
// CC1: y
// CC1: z
diff --git a/test/CodeCompletion/ordinary-name.cpp b/test/CodeCompletion/ordinary-name.cpp
index d938c79..699b01d 100644
--- a/test/CodeCompletion/ordinary-name.cpp
+++ b/test/CodeCompletion/ordinary-name.cpp
@@ -21,7 +21,7 @@ void foo() {
// CHECK-CC1-NEXT: COMPLETION: float
// CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
// CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){<#statements#>
- // CHECK-CC1: COMPLETION: Pattern : goto <#identifier#>;
+ // CHECK-CC1: COMPLETION: Pattern : goto <#identifier#>
// CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
// CHECK-CC1: COMPLETION: int
// CHECK-CC1-NEXT: COMPLETION: long
@@ -29,7 +29,7 @@ void foo() {
// CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type-id#>[<#size#>](<#expressions#>)
// CHECK-CC1-NEXT: COMPLETION: operator
// CHECK-CC1-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type-id#>>(<#expression#>)
- // CHECK-CC1-NEXT: COMPLETION: Pattern : return;
+ // CHECK-CC1-NEXT: COMPLETION: Pattern : return
// CHECK-CC1-NEXT: COMPLETION: short
// CHECK-CC1-NEXT: COMPLETION: signed
// CHECK-CC1-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>)
@@ -48,7 +48,7 @@ void foo() {
// CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>)
// CHECK-CC1-NEXT: COMPLETION: union
// CHECK-CC1-NEXT: COMPLETION: unsigned
- // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
+ // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
// CHECK-CC1-NEXT: COMPLETION: void
// CHECK-CC1-NEXT: COMPLETION: volatile
// CHECK-CC1-NEXT: COMPLETION: wchar_t
@@ -58,7 +58,7 @@ void foo() {
// CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
- // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>);
+ // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
// CHECK-CC2-NEXT: COMPLETION: bool
// CHECK-CC2-NEXT: COMPLETION: char
// CHECK-CC2-NEXT: COMPLETION: class
@@ -71,14 +71,14 @@ void foo() {
// CHECK-CC2-NEXT: COMPLETION: int
// CHECK-CC2-NEXT: COMPLETION: long
// CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#>{<#declarations#>
- // CHECK-CC2: COMPLETION: Pattern : namespace <#identifier#> = <#identifier#>;
+ // CHECK-CC2: COMPLETION: Pattern : namespace <#identifier#> = <#identifier#>
// CHECK-CC2-NEXT: COMPLETION: operator
// CHECK-CC2-NEXT: COMPLETION: short
// CHECK-CC2-NEXT: COMPLETION: signed
// CHECK-CC2-NEXT: COMPLETION: static
// CHECK-CC2-NEXT: COMPLETION: struct
// CHECK-CC2-NEXT: COMPLETION: t : t
- // CHECK-CC2-NEXT: COMPLETION: Pattern : template <#declaration#>;
+ // CHECK-CC2-NEXT: COMPLETION: Pattern : template <#declaration#>
// CHECK-CC2-NEXT: COMPLETION: Pattern : template<<#parameters#>>
// CHECK-CC2-NEXT: COMPLETION: TYPEDEF : TYPEDEF
// CHECK-CC2-NEXT: COMPLETION: typedef
@@ -86,8 +86,8 @@ void foo() {
// CHECK-CC2-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>)
// CHECK-CC2-NEXT: COMPLETION: union
// CHECK-CC2-NEXT: COMPLETION: unsigned
- // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>;
- // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualified-id#>;
+ // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
+ // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualified-id#>
// CHECK-CC2-NEXT: COMPLETION: void
// CHECK-CC2-NEXT: COMPLETION: volatile
// CHECK-CC2-NEXT: COMPLETION: wchar_t
@@ -122,7 +122,7 @@ void foo() {
// CHECK-CC3-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>)
// CHECK-CC3-NEXT: COMPLETION: union
// CHECK-CC3-NEXT: COMPLETION: unsigned
- // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualified-id#>;
+ // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualified-id#>
// CHECK-CC3-NEXT: COMPLETION: virtual
// CHECK-CC3-NEXT: COMPLETION: void
// CHECK-CC3-NEXT: COMPLETION: volatile
diff --git a/test/CodeGen/2009-10-20-GlobalDebug.c b/test/CodeGen/2009-10-20-GlobalDebug.c
index 99be469..1db37de 100644
--- a/test/CodeGen/2009-10-20-GlobalDebug.c
+++ b/test/CodeGen/2009-10-20-GlobalDebug.c
@@ -1,4 +1,8 @@
// RUN: %clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
int global;
-// CHECK: asciz "global" ## External Name
-int main() { return 0;}
+// CHECK: asciz "global" ## External Name
+// CHECK: asciz "localstatic" ## External Name
+int main() {
+ static int localstatic;
+ return 0;
+}
diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c
index d313a9b..72fd7c3 100644
--- a/test/CodeGen/arm-arguments.c
+++ b/test/CodeGen/arm-arguments.c
@@ -28,13 +28,13 @@ struct s4 { struct s4_0 { int f0; } f0; };
struct s4 f4(void) {}
// APCS-GNU: define arm_apcscc void @f5(
-// APCS-GNU: struct.s5* noalias sret
+// APCS-GNU: struct.s5* sret
// AAPCS: define arm_aapcscc i32 @f5()
struct s5 { struct { } f0; int f1; };
struct s5 f5(void) {}
// APCS-GNU: define arm_apcscc void @f6(
-// APCS-GNU: struct.s6* noalias sret
+// APCS-GNU: struct.s6* sret
// AAPCS: define arm_aapcscc i32 @f6()
struct s6 { int f0[1]; };
struct s6 f6(void) {}
@@ -45,7 +45,7 @@ struct s7 { struct { int : 0; } f0; };
struct s7 f7(void) {}
// APCS-GNU: define arm_apcscc void @f8(
-// APCS-GNU: struct.s8* noalias sret
+// APCS-GNU: struct.s8* sret
// AAPCS: define arm_aapcscc void @f8()
struct s8 { struct { int : 0; } f0[1]; };
struct s8 f8(void) {}
@@ -61,7 +61,7 @@ struct s10 { int f0; int : 0; int : 0; };
struct s10 f10(void) {}
// APCS-GNU: define arm_apcscc void @f11(
-// APCS-GNU: struct.s10* noalias sret
+// APCS-GNU: struct.s10* sret
// AAPCS: define arm_aapcscc i32 @f11()
struct s11 { int : 0; int f0; };
struct s11 f11(void) {}
@@ -72,7 +72,7 @@ union u12 { char f0; short f1; int f2; };
union u12 f12(void) {}
// APCS-GNU: define arm_apcscc void @f13(
-// APCS-GNU: struct.s13* noalias sret
+// APCS-GNU: struct.s13* sret
// FIXME: This should return a float.
// AAPCS-FIXME: define arm_aapcscc float @f13()
@@ -80,7 +80,7 @@ struct s13 { float f0; };
struct s13 f13(void) {}
// APCS-GNU: define arm_apcscc void @f14(
-// APCS-GNU: struct.s13* noalias sret
+// APCS-GNU: struct.s13* sret
// AAPCS: define arm_aapcscc i32 @f14()
union u14 { float f0; };
union u14 f14(void) {}
@@ -104,18 +104,18 @@ struct s18 { short f0; char f1 : 4; };
struct s18 f18(void) {}
// APCS-GNU: define arm_apcscc void @f19(
-// APCS-GNU: struct.s19* noalias sret
+// APCS-GNU: struct.s19* sret
// AAPCS: define arm_aapcscc i32 @f19()
struct s19 { int f0; struct s8 f1; };
struct s19 f19(void) {}
// APCS-GNU: define arm_apcscc void @f20(
-// APCS-GNU: struct.s20* noalias sret
+// APCS-GNU: struct.s20* sret
// AAPCS: define arm_aapcscc i32 @f20()
struct s20 { struct s8 f1; int f0; };
struct s20 f20(void) {}
-// APCS-GNU: define arm_apcscc i32 @f21()
+// APCS-GNU: define arm_apcscc i8 @f21()
// AAPCS: define arm_aapcscc i32 @f21()
struct s21 { struct {} f1; int f0 : 4; };
struct s21 f21(void) {}
@@ -128,10 +128,10 @@ struct s21 f21(void) {}
// APCS-GNU: define arm_apcscc i128 @f27()
// AAPCS: define arm_aapcscc i16 @f22()
// AAPCS: define arm_aapcscc i32 @f23()
-// AAPCS: define arm_aapcscc void @f24({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f25({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f26({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f27({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f24({{.*}} sret
+// AAPCS: define arm_aapcscc void @f25({{.*}} sret
+// AAPCS: define arm_aapcscc void @f26({{.*}} sret
+// AAPCS: define arm_aapcscc void @f27({{.*}} sret
_Complex char f22(void) {}
_Complex short f23(void) {}
_Complex int f24(void) {}
@@ -149,7 +149,7 @@ struct s28 f28() {}
struct s29 { _Complex short f0; };
struct s29 f29() {}
-// APCS-GNU: define arm_apcscc void @f30({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret
+// APCS-GNU: define arm_apcscc void @f30({{.*}} sret
+// AAPCS: define arm_aapcscc void @f30({{.*}} sret
struct s30 { _Complex int f0; };
struct s30 f30() {}
diff --git a/test/CodeGen/arm_asm_clobber.c b/test/CodeGen/arm_asm_clobber.c
deleted file mode 100644
index a7ca0b5..0000000
--- a/test/CodeGen/arm_asm_clobber.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// RUN: %clang_cc1 -triple armv6-unknown-unknown -emit-llvm -o %t %s
-
-void test0(void) {
- asm volatile("mov r0, r0" :: );
-}
-void test1(void) {
- asm volatile("mov r0, r0" :::
- "cc", "memory" );
-}
-void test2(void) {
- asm volatile("mov r0, r0" :::
- "r0", "r1", "r2", "r3");
- asm volatile("mov r0, r0" :::
- "r4", "r5", "r6", "r8");
-}
-void test3(void) {
- asm volatile("mov r0, r0" :::
- "a1", "a2", "a3", "a4");
- asm volatile("mov r0, r0" :::
- "v1", "v2", "v3", "v5");
-}
diff --git a/test/CodeGen/asm-errors.c b/test/CodeGen/asm-errors.c
new file mode 100644
index 0000000..7323e61
--- /dev/null
+++ b/test/CodeGen/asm-errors.c
@@ -0,0 +1,8 @@
+// RUN: not %clang_cc1 -triple i386-apple-darwin10 -emit-obj %s > %t 2>&1
+// RUN: FileCheck %s < %t
+
+int test1(int X) {
+// CHECK: error: unrecognized instruction
+ __asm__ ("abc incl %0" : "+r" (X));
+ return X;
+}
diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c
index ace0db9..5077028 100644
--- a/test/CodeGen/asm.c
+++ b/test/CodeGen/asm.c
@@ -147,3 +147,24 @@ int t19(unsigned data) {
// CHECK: = call {{.*}}asm "x$(abc$|def$|ghi$)z"
}
+
+// PR6845 - Mismatching source/dest fp types.
+double t20(double x) {
+ register long double result;
+ __asm __volatile ("frndint" : "=t" (result) : "0" (x));
+ return result;
+
+ // CHECK: @t20
+ // CHECK: fpext double {{.*}} to x86_fp80
+ // CHECK-NEXT: call x86_fp80 asm sideeffect "frndint"
+ // CHECK: fptrunc x86_fp80 {{.*}} to double
+}
+
+float t21(long double x) {
+ register float result;
+ __asm __volatile ("frndint" : "=t" (result) : "0" (x));
+ return result;
+ // CHECK: @t21
+ // CHECK: call x86_fp80 asm sideeffect "frndint"
+ // CHECK-NEXT: fptrunc x86_fp80 {{.*}} to float
+}
diff --git a/test/CodeGen/asm_arm.c b/test/CodeGen/asm_arm.c
new file mode 100644
index 0000000..aac47d5
--- /dev/null
+++ b/test/CodeGen/asm_arm.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple armv6-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+
+void test0(void) {
+ asm volatile("mov r0, r0" :: );
+}
+void test1(void) {
+ asm volatile("mov r0, r0" :::
+ "cc", "memory" );
+}
+void test2(void) {
+ asm volatile("mov r0, r0" :::
+ "r0", "r1", "r2", "r3");
+ asm volatile("mov r0, r0" :::
+ "r4", "r5", "r6", "r8");
+}
+void test3(void) {
+ asm volatile("mov r0, r0" :::
+ "a1", "a2", "a3", "a4");
+ asm volatile("mov r0, r0" :::
+ "v1", "v2", "v3", "v5");
+}
+
+
+// {} should not be treated as asm variants.
+void test4(float *a, float *b) {
+ // CHECK: @test4
+ // CHECK: call void asm sideeffect "vld1.32 {d8[],d9[]},
+ __asm__ volatile (
+ "vld1.32 {d8[],d9[]}, [%1,:32] \n\t"
+ "vst1.32 {q4}, [%0,:128] \n\t"
+ :: "r"(a), "r"(b));
+}
diff --git a/test/CodeGen/bitfield-2.c b/test/CodeGen/bitfield-2.c
new file mode 100644
index 0000000..e91859f
--- /dev/null
+++ b/test/CodeGen/bitfield-2.c
@@ -0,0 +1,368 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64 -O3 -o %t.opt.ll %s \
+// RUN: -fdump-record-layouts 2> %t.dump.txt
+// RUN: FileCheck -check-prefix=CHECK-RECORD < %t.dump.txt %s
+// RUN: FileCheck -check-prefix=CHECK-OPT < %t.opt.ll %s
+
+/****/
+
+// Check that we don't read off the end a packed 24-bit structure.
+// PR6176
+
+// CHECK-RECORD: *** Dumping IRgen Record Layout
+// CHECK-RECORD: Record: struct s0
+// CHECK-RECORD: Layout: <CGRecordLayout
+// CHECK-RECORD: LLVMType:<{ [3 x i8] }>
+// CHECK-RECORD: ContainsPointerToDataMember:0
+// CHECK-RECORD: BitFields:[
+// CHECK-RECORD: <CGBitFieldInfo Size:24 IsSigned:1
+// CHECK-RECORD: NumComponents:2 Components: [
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:0 FieldBitStart:0 AccessWidth:16
+// CHECK-RECORD: AccessAlignment:1 TargetBitOffset:0 TargetBitWidth:16>
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:2 FieldBitStart:0 AccessWidth:8
+// CHECK-RECORD: AccessAlignment:1 TargetBitOffset:16 TargetBitWidth:8>
+struct __attribute((packed)) s0 {
+ int f0 : 24;
+};
+
+struct s0 g0 = { 0xdeadbeef };
+
+int f0_load(struct s0 *a0) {
+ int size_check[sizeof(struct s0) == 3 ? 1 : -1];
+ return a0->f0;
+}
+int f0_store(struct s0 *a0) {
+ return (a0->f0 = 1);
+}
+int f0_reload(struct s0 *a0) {
+ return (a0->f0 += 1);
+}
+
+// CHECK-OPT: define i64 @test_0()
+// CHECK-OPT: ret i64 1
+// CHECK-OPT: }
+unsigned long long test_0() {
+ struct s0 g0 = { 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g0.f0;
+ res ^= f0_load(&g0) ^ f0_store(&g0) ^ f0_reload(&g0);
+ res ^= g0.f0;
+ return res;
+}
+
+/****/
+
+// PR5591
+
+// CHECK-RECORD: *** Dumping IRgen Record Layout
+// CHECK-RECORD: Record: struct s1
+// CHECK-RECORD: Layout: <CGRecordLayout
+// CHECK-RECORD: LLVMType:<{ [2 x i8], i8 }>
+// CHECK-RECORD: ContainsPointerToDataMember:0
+// CHECK-RECORD: BitFields:[
+// CHECK-RECORD: <CGBitFieldInfo Size:10 IsSigned:1
+// CHECK-RECORD: NumComponents:1 Components: [
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:0 FieldBitStart:0 AccessWidth:16
+// CHECK-RECORD: AccessAlignment:1 TargetBitOffset:0 TargetBitWidth:10>
+// CHECK-RECORD: ]>
+// CHECK-RECORD: <CGBitFieldInfo Size:10 IsSigned:1
+// CHECK-RECORD: NumComponents:2 Components: [
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:0 FieldBitStart:10 AccessWidth:16
+// CHECK-RECORD: AccessAlignment:1 TargetBitOffset:0 TargetBitWidth:6>
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:2 FieldBitStart:0 AccessWidth:8
+// CHECK-RECORD: AccessAlignment:1 TargetBitOffset:6 TargetBitWidth:4>
+
+#pragma pack(push)
+#pragma pack(1)
+struct __attribute((packed)) s1 {
+ signed f0 : 10;
+ signed f1 : 10;
+};
+#pragma pack(pop)
+
+struct s1 g1 = { 0xdeadbeef, 0xdeadbeef };
+
+int f1_load(struct s1 *a0) {
+ int size_check[sizeof(struct s1) == 3 ? 1 : -1];
+ return a0->f1;
+}
+int f1_store(struct s1 *a0) {
+ return (a0->f1 = 1234);
+}
+int f1_reload(struct s1 *a0) {
+ return (a0->f1 += 1234);
+}
+
+// CHECK-OPT: define i64 @test_1()
+// CHECK-OPT: ret i64 210
+// CHECK-OPT: }
+unsigned long long test_1() {
+ struct s1 g1 = { 0xdeadbeef, 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g1.f0 ^ g1.f1;
+ res ^= f1_load(&g1) ^ f1_store(&g1) ^ f1_reload(&g1);
+ res ^= g1.f0 ^ g1.f1;
+ return res;
+}
+
+/****/
+
+// Check that we don't access beyond the bounds of a union.
+//
+// PR5567
+
+// CHECK-RECORD: *** Dumping IRgen Record Layout
+// CHECK-RECORD: Record: union u2
+// CHECK-RECORD: Layout: <CGRecordLayout
+// CHECK-RECORD: LLVMType:<{ i8 }>
+// CHECK-RECORD: ContainsPointerToDataMember:0
+// CHECK-RECORD: BitFields:[
+// CHECK-RECORD: <CGBitFieldInfo Size:3 IsSigned:0
+// CHECK-RECORD: NumComponents:1 Components: [
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:0 FieldBitStart:0 AccessWidth:8
+// CHECK-RECORD: AccessAlignment:1 TargetBitOffset:0 TargetBitWidth:3>
+
+union __attribute__((packed)) u2 {
+ unsigned long long f0 : 3;
+};
+
+union u2 g2 = { 0xdeadbeef };
+
+int f2_load(union u2 *a0) {
+ return a0->f0;
+}
+int f2_store(union u2 *a0) {
+ return (a0->f0 = 1234);
+}
+int f2_reload(union u2 *a0) {
+ return (a0->f0 += 1234);
+}
+
+// CHECK-OPT: define i64 @test_2()
+// CHECK-OPT: ret i64 2
+// CHECK-OPT: }
+unsigned long long test_2() {
+ union u2 g2 = { 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g2.f0;
+ res ^= f2_load(&g2) ^ f2_store(&g2) ^ f2_reload(&g2);
+ res ^= g2.f0;
+ return res;
+}
+
+/***/
+
+// PR5039
+
+struct s3 {
+ long long f0 : 32;
+ long long f1 : 32;
+};
+
+struct s3 g3 = { 0xdeadbeef, 0xdeadbeef };
+
+int f3_load(struct s3 *a0) {
+ a0->f0 = 1;
+ return a0->f0;
+}
+int f3_store(struct s3 *a0) {
+ a0->f0 = 1;
+ return (a0->f0 = 1234);
+}
+int f3_reload(struct s3 *a0) {
+ a0->f0 = 1;
+ return (a0->f0 += 1234);
+}
+
+// CHECK-OPT: define i64 @test_3()
+// CHECK-OPT: ret i64 -559039940
+// CHECK-OPT: }
+unsigned long long test_3() {
+ struct s3 g3 = { 0xdeadbeef, 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g3.f0 ^ g3.f1;
+ res ^= f3_load(&g3) ^ f3_store(&g3) ^ f3_reload(&g3);
+ res ^= g3.f0 ^ g3.f1;
+ return res;
+}
+
+/***/
+
+// This is a case where the bitfield access will straddle an alignment boundary
+// of its underlying type.
+
+struct s4 {
+ unsigned f0 : 16;
+ unsigned f1 : 28 __attribute__ ((packed));
+};
+
+struct s4 g4 = { 0xdeadbeef, 0xdeadbeef };
+
+int f4_load(struct s4 *a0) {
+ return a0->f0 ^ a0->f1;
+}
+int f4_store(struct s4 *a0) {
+ return (a0->f0 = 1234) ^ (a0->f1 = 5678);
+}
+int f4_reload(struct s4 *a0) {
+ return (a0->f0 += 1234) ^ (a0->f1 += 5678);
+}
+
+// CHECK-OPT: define i64 @test_4()
+// CHECK-OPT: ret i64 4860
+// CHECK-OPT: }
+unsigned long long test_4() {
+ struct s4 g4 = { 0xdeadbeef, 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g4.f0 ^ g4.f1;
+ res ^= f4_load(&g4) ^ f4_store(&g4) ^ f4_reload(&g4);
+ res ^= g4.f0 ^ g4.f1;
+ return res;
+}
+
+/***/
+
+struct s5 {
+ unsigned f0 : 2;
+ _Bool f1 : 1;
+ _Bool f2 : 1;
+};
+
+struct s5 g5 = { 0xdeadbeef, 0xdeadbeef };
+
+int f5_load(struct s5 *a0) {
+ return a0->f0 ^ a0->f1;
+}
+int f5_store(struct s5 *a0) {
+ return (a0->f0 = 0xF) ^ (a0->f1 = 0xF) ^ (a0->f2 = 0xF);
+}
+int f5_reload(struct s5 *a0) {
+ return (a0->f0 += 0xF) ^ (a0->f1 += 0xF) ^ (a0->f2 += 0xF);
+}
+
+// CHECK-OPT: define i64 @test_5()
+// CHECK-OPT: ret i64 2
+// CHECK-OPT: }
+unsigned long long test_5() {
+ struct s5 g5 = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g5.f0 ^ g5.f1 ^ g5.f2;
+ res ^= f5_load(&g5) ^ f5_store(&g5) ^ f5_reload(&g5);
+ res ^= g5.f0 ^ g5.f1 ^ g5.f2;
+ return res;
+}
+
+/***/
+
+struct s6 {
+ _Bool f0 : 2;
+};
+
+struct s6 g6 = { 0xF };
+
+int f6_load(struct s6 *a0) {
+ return a0->f0;
+}
+int f6_store(struct s6 *a0) {
+ return a0->f0 = 0x0;
+}
+int f6_reload(struct s6 *a0) {
+ return (a0->f0 += 0xF);
+}
+
+// CHECK-OPT: define zeroext i1 @test_6()
+// CHECK-OPT: ret i1 true
+// CHECK-OPT: }
+_Bool test_6() {
+ struct s6 g6 = { 0xF };
+ unsigned long long res = 0;
+ res ^= g6.f0;
+ res ^= f6_load(&g6);
+ res ^= g6.f0;
+ return res;
+}
+
+/***/
+
+// Check that we compute the best alignment possible for each access.
+//
+// CHECK-RECORD: *** Dumping IRgen Record Layout
+// CHECK-RECORD: Record: struct s7
+// CHECK-RECORD: Layout: <CGRecordLayout
+// CHECK-RECORD: LLVMType:{ i32, i32, i32, i8, [3 x i8], [4 x i8], [12 x i8] }
+// CHECK-RECORD: ContainsPointerToDataMember:0
+// CHECK-RECORD: BitFields:[
+// CHECK-RECORD: <CGBitFieldInfo Size:5 IsSigned:1
+// CHECK-RECORD: NumComponents:1 Components: [
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:12 FieldBitStart:0 AccessWidth:32
+// CHECK-RECORD: AccessAlignment:4 TargetBitOffset:0 TargetBitWidth:5>
+// CHECK-RECORD: ]>
+// CHECK-RECORD: <CGBitFieldInfo Size:29 IsSigned:1
+// CHECK-RECORD: NumComponents:1 Components: [
+// CHECK-RECORD: <AccessInfo FieldIndex:0 FieldByteOffset:16 FieldBitStart:0 AccessWidth:32
+// CHECK-RECORD: AccessAlignment:16 TargetBitOffset:0 TargetBitWidth:29>
+
+struct __attribute__((aligned(16))) s7 {
+ int a, b, c;
+ int f0 : 5;
+ int f1 : 29;
+};
+
+int f7_load(struct s7 *a0) {
+ return a0->f0;
+}
+
+/***/
+
+// This is a case where we narrow the access width immediately.
+
+struct __attribute__((packed)) s8 {
+ char f0 : 4;
+ char f1;
+ int f2 : 4;
+ char f3 : 4;
+};
+
+struct s8 g8 = { 0xF };
+
+int f8_load(struct s8 *a0) {
+ return a0->f0 ^ a0 ->f2 ^ a0->f3;
+}
+int f8_store(struct s8 *a0) {
+ return (a0->f0 = 0xFD) ^ (a0->f2 = 0xFD) ^ (a0->f3 = 0xFD);
+}
+int f8_reload(struct s8 *a0) {
+ return (a0->f0 += 0xFD) ^ (a0->f2 += 0xFD) ^ (a0->f3 += 0xFD);
+}
+
+// CHECK-OPT: define i32 @test_8()
+// CHECK-OPT: ret i32 -3
+// CHECK-OPT: }
+unsigned test_8() {
+ struct s8 g8 = { 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef };
+ unsigned long long res = 0;
+ res ^= g8.f0 ^ g8.f2 ^ g8.f3;
+ res ^= f8_load(&g8) ^ f8_store(&g8) ^ f8_reload(&g8);
+ res ^= g8.f0 ^ g8.f2 ^ g8.f3;
+ return res;
+}
+
+/***/
+
+// This is another case where we narrow the access width immediately.
+//
+// <rdar://problem/7893760>
+
+struct __attribute__((packed)) s9 {
+ unsigned f0 : 7;
+ unsigned f1 : 7;
+ unsigned f2 : 7;
+ unsigned f3 : 7;
+ unsigned f4 : 7;
+ unsigned f5 : 7;
+ unsigned f6 : 7;
+ unsigned f7 : 7;
+};
+
+int f9_load(struct s9 *a0) {
+ return a0->f7;
+}
diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c
index 0ef10c1..e7625b1 100644
--- a/test/CodeGen/blocks.c
+++ b/test/CodeGen/blocks.c
@@ -12,7 +12,7 @@ struct s0 {
int a[64];
};
-// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* noalias sret .*, .*, .* byval .*)' %t
+// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* sret .*, .*, .* byval .*)' %t
struct s0 f2(struct s0 a0) {
return ^(struct s0 a1){ return a1; }(a0);
}
diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c
new file mode 100644
index 0000000..04249cc
--- /dev/null
+++ b/test/CodeGen/builtins-ppc-altivec.c
@@ -0,0 +1,332 @@
+// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+#include "altivec.h"
+
+int main ()
+{
+ vector signed char vsc = { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16 };
+ vector unsigned char vuc = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ vector short vs = { -1, 2, -3, 4, -5, 6, -7, 8 };
+ vector unsigned short vus = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ vector int vi = { -1, 2, -3, 4 };
+ vector unsigned int vui = { 1, 2, 3, 4 };
+ vector float vf = { -1.5, 2.5, -3.5, 4.5 };
+
+ vector signed char res_vsc;
+ vector unsigned char res_vuc;
+ vector short res_vs;
+ vector unsigned short res_vus;
+ vector int res_vi;
+ vector unsigned int res_vui;
+ vector float res_vf;
+
+ int param_i;
+ int res_i;
+
+ /* vec_abs */
+ vsc = vec_abs(vsc); // CHECK: sub <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.vmaxsb
+
+ vs = __builtin_vec_abs(vs); // CHECK: sub <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.vmaxsh
+
+ vi = vec_abs(vi); // CHECK: sub <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.vmaxsw
+
+ vf = vec_abs(vf); // CHECK: store <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
+ // CHECK: and <4 x i32>
+
+ /* vec_abs */
+ vsc = vec_abss(vsc); // CHECK: @llvm.ppc.altivec.vsubsbs
+ // CHECK: @llvm.ppc.altivec.vmaxsb
+
+ vs = __builtin_vec_abss(vs); // CHECK: @llvm.ppc.altivec.vsubshs
+ // CHECK: @llvm.ppc.altivec.vmaxsh
+
+ vi = vec_abss(vi); // CHECK: @llvm.ppc.altivec.vsubsws
+ // CHECK: @llvm.ppc.altivec.vmaxsw
+
+ /* vec_add */
+ res_vsc = vec_add(vsc, vsc); // CHECK: add nsw <16 x i8>
+ res_vuc = vec_vaddubm(vuc, vuc); // CHECK: add <16 x i8>
+ res_vs = __builtin_altivec_vadduhm(vs, vs); // CHECK: add nsw <8 x i16>
+ res_vus = vec_vadduhm(vus, vus); // CHECK: add <8 x i16>
+ res_vi = __builtin_vec_vadduwm(vi, vi); // CHECK: add nsw <4 x i32>
+ res_vui = vec_vadduwm(vui, vui); // CHECK: add <4 x i32>
+ res_vf = __builtin_vec_vaddfp(vf, vf); // CHECK: fadd <4 x float>
+
+ /* vec_addc */
+ res_vui = vec_vaddcuw(vui, vui); // HECK: @llvm.ppc.altivec.vaddcuw
+
+ /* vec_adds */
+ res_vsc = vec_adds(vsc, vsc); // CHECK: @llvm.ppc.altivec.vaddsbs
+ res_vuc = vec_vaddubs(vuc, vuc); // CHECK: @llvm.ppc.altivec.vaddubs
+ res_vs = __builtin_vec_vaddshs(vs, vs); // CHECK: @llvm.ppc.altivec.vaddshs
+ res_vus = vec_vadduhs(vus, vus); // CHECK: @llvm.ppc.altivec.vadduhs
+ res_vi = __builtin_vec_vaddsws(vi, vi); // CHECK: @llvm.ppc.altivec.vaddsws
+ res_vui = vec_vadduws(vui, vui); // CHECK: @llvm.ppc.altivec.vadduws
+
+ /* vec_sub */
+ res_vsc = vec_sub(vsc, vsc); // CHECK: sub nsw <16 x i8>
+ res_vuc = vec_vsububm(vuc, vuc); // CHECK: sub <16 x i8>
+ res_vs = __builtin_altivec_vsubuhm(vs, vs); // CHECK: sub nsw <8 x i16>
+ res_vus = vec_vsubuhm(vus, vus); // CHECK: sub <8 x i16>
+ res_vi = __builtin_vec_vsubuwm(vi, vi); // CHECK: sub nsw <4 x i32>
+ res_vui = vec_vsubuwm(vui, vui); // CHECK: sub <4 x i32>
+ res_vf = __builtin_vec_vsubfp(vf, vf); // CHECK: fsub <4 x float>
+
+ /* vec_subs */
+ res_vsc = vec_subs(vsc, vsc); // CHECK: @llvm.ppc.altivec.vsubsbs
+ res_vuc = vec_vsububs(vuc, vuc); // CHECK: @llvm.ppc.altivec.vsububs
+ res_vs = __builtin_vec_vsubshs(vs, vs); // CHECK: @llvm.ppc.altivec.vsubshs
+ res_vus = vec_vsubuhs(vus, vus); // CHECK: @llvm.ppc.altivec.vsubuhs
+ res_vi = __builtin_vec_vsubsws(vi, vi); // CHECK: @llvm.ppc.altivec.vsubsws
+ res_vui = vec_vsubuws(vui, vui); // CHECK: @llvm.ppc.altivec.vsubuws
+
+ /* vec_avg */
+ res_vsc = vec_avg(vsc, vsc); // CHECK: @llvm.ppc.altivec.vavgsb
+ res_vuc = __builtin_vec_vavgub(vuc, vuc); // CHECK: @llvm.ppc.altivec.vavgub
+ res_vs = vec_vavgsh(vs, vs); // CHECK: @llvm.ppc.altivec.vavgsh
+ res_vus = __builtin_vec_vavguh(vus, vus); // CHECK: @llvm.ppc.altivec.vavguh
+ res_vi = vec_vavgsw(vi, vi); // CHECK: @llvm.ppc.altivec.vavgsw
+ res_vui = __builtin_vec_vavguw(vui, vui); // CHECK: @llvm.ppc.altivec.vavguw
+
+ /* vec_st */
+ param_i = 5;
+ vec_st(vsc, 0, &res_vsc); // CHECK: @llvm.ppc.altivec.stvx
+ __builtin_vec_st(vuc, param_i, &res_vuc); // CHECK: @llvm.ppc.altivec.stvx
+ vec_stvx(vs, 1, &res_vs); // CHECK: @llvm.ppc.altivec.stvx
+ vec_st(vus, 1000, &res_vus); // CHECK: @llvm.ppc.altivec.stvx
+ vec_st(vi, 0, &res_vi); // CHECK: @llvm.ppc.altivec.stvx
+ vec_st(vui, 0, &res_vui); // CHECK: @llvm.ppc.altivec.stvx
+ vec_st(vf, 0, &res_vf); // CHECK: @llvm.ppc.altivec.stvx
+
+ /* vec_stl */
+ param_i = 10000;
+ vec_stl(vsc, param_i, &res_vsc); // CHECK: @llvm.ppc.altivec.stvxl
+ __builtin_vec_stl(vuc, 1, &res_vuc); // CHECK: @llvm.ppc.altivec.stvxl
+ vec_stvxl(vs, 0, &res_vs); // CHECK: @llvm.ppc.altivec.stvxl
+ vec_stl(vus, 0, &res_vus); // CHECK: @llvm.ppc.altivec.stvxl
+ vec_stl(vi, 0, &res_vi); // CHECK: @llvm.ppc.altivec.stvxl
+ vec_stl(vui, 0, &res_vui); // CHECK: @llvm.ppc.altivec.stvxl
+ vec_stl(vf, 0, &res_vf); // CHECK: @llvm.ppc.altivec.stvxl
+
+ /* vec_ste */
+ param_i = 10000;
+ vec_ste(vsc, param_i, &res_vsc); // CHECK: @llvm.ppc.altivec.stvebx
+ vec_stvebx(vuc, 1, &res_vuc); // CHECK: @llvm.ppc.altivec.stvebx
+ __builtin_vec_stvehx(vs, 0, &res_vs); // CHECK: @llvm.ppc.altivec.stvehx
+ vec_stvehx(vus, 0, &res_vus); // CHECK: @llvm.ppc.altivec.stvehx
+ vec_stvewx(vi, 0, &res_vi); // CHECK: @llvm.ppc.altivec.stvewx
+ __builtin_vec_stvewx(vui, 0, &res_vui); // CHECK: @llvm.ppc.altivec.stvewx
+ vec_stvewx(vf, 0, &res_vf); // CHECK: @llvm.ppc.altivec.stvewx
+
+ /* vec_cmpb */
+ res_vi = vec_vcmpbfp(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpbfp
+
+ /* vec_cmpeq */
+ res_vi = vec_cmpeq(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpequb
+ res_vi = __builtin_vec_cmpeq(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpequb
+ res_vi = vec_cmpeq(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpequh
+ res_vi = vec_cmpeq(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpequh
+ res_vi = vec_cmpeq(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpequw
+ res_vi = vec_cmpeq(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpequw
+ res_vi = vec_cmpeq(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp
+
+ /* vec_cmpge */
+ res_vi = __builtin_vec_cmpge(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgefp
+
+ /* vec_cmpgt */
+ res_vi = vec_cmpgt(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb
+ res_vi = vec_vcmpgtub(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub
+ res_vi = __builtin_vec_vcmpgtsh(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh
+ res_vi = vec_cmpgt(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh
+ res_vi = vec_cmpgt(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw
+ res_vi = vec_cmpgt(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw
+ res_vi = vec_cmpgt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp
+
+ /* vec_cmple */
+ res_vi = __builtin_vec_cmple(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgefp
+
+ /* vec_cmplt */
+ res_vi = vec_cmplt(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb
+ res_vi = __builtin_vec_cmplt(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub
+ res_vi = vec_cmplt(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh
+ res_vi = vec_cmplt(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh
+ res_vi = vec_cmplt(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw
+ res_vi = vec_cmplt(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw
+ res_vi = vec_cmplt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp
+
+ /* vec_max */
+ res_vsc = vec_max(vsc, vsc); // CHECK: @llvm.ppc.altivec.vmaxsb
+ res_vuc = __builtin_vec_vmaxub(vuc, vuc); // CHECK: @llvm.ppc.altivec.vmaxub
+ res_vs = vec_vmaxsh(vs, vs); // CHECK: @llvm.ppc.altivec.vmaxsh
+ res_vus = vec_max(vus, vus); // CHECK: @llvm.ppc.altivec.vmaxuh
+ res_vi = __builtin_vec_vmaxsw(vi, vi); // CHECK: @llvm.ppc.altivec.vmaxsw
+ res_vui = vec_vmaxuw(vui, vui); // CHECK: @llvm.ppc.altivec.vmaxuw
+ res_vf = __builtin_vec_max(vf, vf); // CHECK: @llvm.ppc.altivec.vmaxfp
+
+ /* vec_mfvscr */
+ vf = vec_mfvscr(); // CHECK: @llvm.ppc.altivec.mfvscr
+
+ /* vec_min */
+ res_vsc = vec_min(vsc, vsc); // CHECK: @llvm.ppc.altivec.vminsb
+ res_vuc = __builtin_vec_vminub(vuc, vuc); // CHECK: @llvm.ppc.altivec.vminub
+ res_vs = vec_vminsh(vs, vs); // CHECK: @llvm.ppc.altivec.vminsh
+ res_vus = vec_min(vus, vus); // CHECK: @llvm.ppc.altivec.vminuh
+ res_vi = __builtin_vec_vminsw(vi, vi); // CHECK: @llvm.ppc.altivec.vminsw
+ res_vui = vec_vminuw(vui, vui); // CHECK: @llvm.ppc.altivec.vminuw
+ res_vf = __builtin_vec_min(vf, vf); // CHECK: @llvm.ppc.altivec.vminfp
+
+ /* vec_mtvscr */
+ vec_mtvscr(vsc); // CHECK: @llvm.ppc.altivec.mtvscr
+
+ /* ------------------------------ predicates -------------------------------------- */
+
+ res_i = __builtin_vec_vcmpeq_p(__CR6_EQ, vsc, vui); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+ res_i = __builtin_vec_vcmpge_p(__CR6_EQ, vs, vi); // CHECK: @llvm.ppc.altivec.vcmpgefp.p
+ res_i = __builtin_vec_vcmpgt_p(__CR6_EQ, vuc, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_all_eq */
+ res_i = vec_all_eq(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_all_eq(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_all_eq(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_all_eq(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_all_eq(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_all_eq(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_all_eq(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_all_ge */
+ res_i = vec_all_ge(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_all_ge(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_all_ge(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_all_ge(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_all_ge(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_all_ge(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_all_ge(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_all_gt */
+ res_i = vec_all_gt(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_all_gt(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_all_gt(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_all_gt(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_all_gt(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_all_gt(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_all_gt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_all_in */
+ res_i = vec_all_in(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpbfp.p
+
+ /* vec_all_le */
+ res_i = vec_all_le(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_all_le(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_all_le(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_all_le(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_all_le(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_all_le(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_all_le(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_all_nan */
+ res_i = vec_all_nan(vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_all_ne */
+ res_i = vec_all_ne(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_all_ne(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_all_ne(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_all_ne(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_all_ne(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_all_ne(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_all_ne(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_all_nge */
+ res_i = vec_all_nge(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgefp.p
+
+ /* vec_all_ngt */
+ res_i = vec_all_ngt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_all_nle */
+ res_i = vec_all_nle(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgefp.p
+
+ /* vec_all_nlt */
+ res_i = vec_all_nlt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_all_numeric */
+ res_i = vec_all_numeric(vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_any_eq */
+ res_i = vec_any_eq(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_any_eq(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_any_eq(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_any_eq(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_any_eq(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_any_eq(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_any_eq(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_any_ge */
+ res_i = vec_any_ge(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_any_ge(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_any_ge(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_any_ge(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_any_ge(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_any_ge(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_any_ge(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_any_gt */
+ res_i = vec_any_gt(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_any_gt(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_any_gt(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_any_gt(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_any_gt(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_any_gt(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_any_gt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_any_le */
+ res_i = vec_any_le(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_any_le(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_any_le(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_any_le(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_any_le(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_any_le(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_any_le(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_any_lt */
+ res_i = vec_any_lt(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p
+ res_i = vec_any_lt(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpgtub.p
+ res_i = vec_any_lt(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p
+ res_i = vec_any_lt(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p
+ res_i = vec_any_lt(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p
+ res_i = vec_any_lt(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p
+ res_i = vec_any_lt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_any_nan */
+ res_i = vec_any_nan(vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_any_ne */
+ res_i = vec_any_ne(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_any_ne(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
+ res_i = vec_any_ne(vs, vs); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_any_ne(vus, vus); // CHECK: @llvm.ppc.altivec.vcmpequh.p
+ res_i = vec_any_ne(vi, vi); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_any_ne(vui, vui); // CHECK: @llvm.ppc.altivec.vcmpequw.p
+ res_i = vec_any_ne(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_any_nge */
+ res_i = vec_any_nge(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgefp.p
+
+ /* vec_any_ngt */
+ res_i = vec_any_ngt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_any_nle */
+ res_i = vec_any_nle(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgefp.p
+
+ /* vec_any_nlt */
+ res_i = vec_any_nlt(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p
+
+ /* vec_any_numeric */
+ res_i = vec_any_numeric(vf); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p
+
+ /* vec_any_out */
+ res_i = vec_any_out(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpbfp.p
+
+ return 0;
+}
diff --git a/test/CodeGen/catch-undef-behavior.c b/test/CodeGen/catch-undef-behavior.c
new file mode 100644
index 0000000..fef1587
--- /dev/null
+++ b/test/CodeGen/catch-undef-behavior.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fcatch-undefined-behavior -emit-llvm-only %s
+
+// PR6805
+void foo() {
+ union { int i; } u;
+ u.i=1;
+}
diff --git a/test/CodeGen/const-unordered-compare.c b/test/CodeGen/const-unordered-compare.c
new file mode 100644
index 0000000..ac7d35b
--- /dev/null
+++ b/test/CodeGen/const-unordered-compare.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// Checks folding of an unordered comparison
+int nan_ne_check() {
+ // CHECK: store i32 1
+ return (__builtin_nanf("") != __builtin_nanf("")) ? 1 : 0;
+}
diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c
index 6d06813..7ffb700 100644
--- a/test/CodeGen/decl.c
+++ b/test/CodeGen/decl.c
@@ -1,10 +1,14 @@
-// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -w -emit-llvm < %s | FileCheck %s
// CHECK: @test1.x = internal constant [12 x i32] [i32 1
// CHECK: @test2.x = internal constant [13 x i32] [i32 1,
// CHECK: @test5w = global %0 { i32 2, [4 x i8] undef }
// CHECK: @test5y = global %union.test5u { double 7.300000e+0{{[0]*}}1 }
+// CHECK: @test6.x = internal constant %struct.SelectDest { i8 1, i8 2, i32 3, i32 0 }
+
+// CHECK: @test7 = global [2 x %struct.test7s] [%struct.test7s { i32 1, i32 2 }, %struct.test7s { i32 4, i32 0 }]
+
void test1() {
// This should codegen as a "@test1.x" global.
const int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23 };
@@ -59,3 +63,29 @@ void test5() {
union test5u test5w = (union test5u)2;
union test5u test5y = (union test5u)73.0;
+
+
+// PR6660 - sqlite miscompile
+struct SelectDest {
+ unsigned char eDest;
+ unsigned char affinity;
+ int iParm;
+ int iMem;
+};
+
+void test6() {
+ struct SelectDest x = {1, 2, 3};
+ test6f(&x);
+}
+
+// rdar://7657600
+struct test7s { int a; int b; } test7[] = {
+ {1, 2},
+ {4},
+};
+
+// rdar://7872531
+#pragma pack(push, 2)
+struct test8s { int f0; char f1; } test8g = {};
+
+
diff --git a/test/CodeGen/designated-initializers.c b/test/CodeGen/designated-initializers.c
index 652238f..49f57ad 100644
--- a/test/CodeGen/designated-initializers.c
+++ b/test/CodeGen/designated-initializers.c
@@ -1,22 +1,37 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t
-// RUN: grep "{ i8\* null, i32 1024 }" %t
-// RUN: grep "i32 0, i32 22" %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
struct foo {
void *a;
int b;
};
+// CHECK: @u = global %union.anon zeroinitializer
union { int i; float f; } u = { };
-int main(int argc, char **argv)
-{
- union { int i; float f; } u2 = { };
- static struct foo foo = {
- .b = 1024,
- };
-}
+// CHECK: @u2 = global %0 { i32 0, [4 x i8] undef }
+union { int i; double f; } u2 = { };
+// CHECK: @u3 = global %1 zeroinitializer
+union { double f; int i; } u3 = { };
+
+// CHECK: @b = global [2 x i32] [i32 0, i32 22]
int b[2] = {
- [1] 22
+ [1] = 22
};
+
+int main(int argc, char **argv)
+{
+ // CHECK: internal global %struct.foo { i8* null, i32 1024 }
+ static struct foo foo = {
+ .b = 1024,
+ };
+
+ // CHECK: bitcast %union.anon* %u2
+ // CHECK: call void @llvm.memset
+ union { int i; float f; } u2 = { };
+
+ // CHECK-NOT: call void @llvm.memset
+ union { int i; float f; } u3;
+
+ // CHECK: ret i32
+}
diff --git a/test/CodeGen/functions.c b/test/CodeGen/functions.c
index 5629ef5..a2c692d 100644
--- a/test/CodeGen/functions.c
+++ b/test/CodeGen/functions.c
@@ -47,3 +47,15 @@ void f7(float f, float g) {
// CHECK: define void @f7(float{{.*}}, float{{.*}})
// CHECK: call void @f6(float{{.*}}, float{{.*}})
}
+
+// PR6911 - incomplete function types
+struct Incomplete;
+void f8_callback(struct Incomplete);
+void f8_user(void (*callback)(struct Incomplete));
+void f8_test() {
+ f8_user(&f8_callback);
+// CHECK: define void @f8_test()
+// CHECK: call void @f8_user({{.*}}* bitcast (void ()* @f8_callback to {{.*}}*))
+// CHECK: declare void @f8_user({{.*}}*)
+// CHECK: declare void @f8_callback()
+}
diff --git a/test/CodeGen/global-init.c b/test/CodeGen/global-init.c
index e166fb4..351ca9e 100644
--- a/test/CodeGen/global-init.c
+++ b/test/CodeGen/global-init.c
@@ -12,19 +12,41 @@ int c __attribute__((weak))= 0;
// CHECK: @c = weak global i32 0
-
// Since this is marked const, it should get weak_odr linkage, since all
// definitions have to be the same.
// CHECK: @d = weak_odr constant i32 0
const int d __attribute__((weak))= 0;
+// PR6168 "too many undefs"
+struct ManyFields {
+ int a;
+ int b;
+ int c;
+ char d;
+ int e;
+ int f;
+};
+
+// CHECK: global %0 { i32 1, i32 2, i32 0, i8 0, i32 0, i32 0 }
+struct ManyFields FewInits = {1, 2};
+
+
+// PR6766
+// CHECK: @l = global %1 { [24 x i8] c"f\00\00\00o\00\00\00o\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 1 }
+typedef __WCHAR_TYPE__ wchar_t;
+struct K {
+ wchar_t L[6];
+ int M;
+} l = { { L"foo" }, 1 };
+
+
+// CHECK: @yuv_types = global [4 x [6 x i8]] {{\[}}[6 x i8] c"4:0:0\00", [6 x i8] c"4:2:0\00", [6 x i8] c"4:2:2\00", [6 x i8] c"4:4:4\00"]
+char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};
// NOTE: tentative definitions are processed at the end of the translation unit.
// This shouldn't be emitted as common because it has an explicit section.
// rdar://7119244
-int b __attribute__((section("foo")));
-
// CHECK: @b = global i32 0, section "foo"
-
+int b __attribute__((section("foo")));
diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c
index 13ffad1..d48e723 100644
--- a/test/CodeGen/init.c
+++ b/test/CodeGen/init.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
void f1() {
// Scalars in braces.
@@ -22,8 +22,8 @@ void f3() {
}
// Constants
-// RUN: grep '@g3 = constant i32 10' %t
-// RUN: grep '@f4.g4 = internal constant i32 12' %t
+// CHECK: @g3 = constant i32 10
+// CHECK: @f4.g4 = internal constant i32 12
const int g3 = 10;
int f4() {
static const int g4 = 12;
diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c
index a96176a..828d7de 100644
--- a/test/CodeGen/libcalls.c
+++ b/test/CodeGen/libcalls.c
@@ -1,22 +1,52 @@
-// RUN: %clang_cc1 -fmath-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
-// RUN: grep "declare " %t | count 6
-// RUN: grep "declare " %t | grep "@llvm." | count 1
-// RUN: %clang_cc1 -emit-llvm -o %t %s -triple i386-unknown-unknown
-// RUN: grep "declare " %t | count 6
-// RUN: grep "declare " %t | grep -v "@llvm." | count 0
-
-// IRgen only pays attention to const; it should always call llvm for
-// this.
-float sqrtf(float) __attribute__((const));
+// RUN: %clang_cc1 -fmath-errno -emit-llvm -o - %s -triple i386-unknown-unknown | FileCheck -check-prefix YES %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -triple i386-unknown-unknown | FileCheck -check-prefix NO %s
+// CHECK-YES: define void @test_sqrt
+// CHECK-NO: define void @test_sqrt
void test_sqrt(float a0, double a1, long double a2) {
+ // Following llvm-gcc's lead, we never emit these as intrinsics;
+ // no-math-errno isn't good enough. We could probably use intrinsics
+ // with appropriate guards if it proves worthwhile.
+
+ // CHECK-YES: call float @sqrtf
+ // CHECK-NO: call float @sqrtf
float l0 = sqrtf(a0);
+
+ // CHECK-YES: call double @sqrt
+ // CHECK-NO: call double @sqrt
double l1 = sqrt(a1);
+
+ // CHECK-YES: call x86_fp80 @sqrtl
+ // CHECK-NO: call x86_fp80 @sqrtl
long double l2 = sqrtl(a2);
}
+// CHECK-YES: declare float @sqrtf(float)
+// CHECK-YES: declare double @sqrt(double)
+// CHECK-YES: declare x86_fp80 @sqrtl(x86_fp80)
+// CHECK-NO: declare float @sqrtf(float) readnone
+// CHECK-NO: declare double @sqrt(double) readnone
+// CHECK-NO: declare x86_fp80 @sqrtl(x86_fp80) readnone
+
+// CHECK-YES: define void @test_pow
+// CHECK-NO: define void @test_pow
void test_pow(float a0, double a1, long double a2) {
+ // CHECK-YES: call float @powf
+ // CHECK-NO: call float @llvm.pow.f32
float l0 = powf(a0, a0);
+
+ // CHECK-YES: call double @pow
+ // CHECK-NO: call double @llvm.pow.f64
double l1 = pow(a1, a1);
+
+ // CHECK-YES: call x86_fp80 @powl
+ // CHECK-NO: call x86_fp80 @llvm.pow.f80
long double l2 = powl(a2, a2);
}
+
+// CHECK-YES: declare float @powf(float, float)
+// CHECK-YES: declare double @pow(double, double)
+// CHECK-YES: declare x86_fp80 @powl(x86_fp80, x86_fp80)
+// CHECK-NO: declare float @llvm.pow.f32(float, float) nounwind readonly
+// CHECK-NO: declare double @llvm.pow.f64(double, double) nounwind readonly
+// CHECK-NO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) nounwind readonly
diff --git a/test/CodeGen/palignr.c b/test/CodeGen/palignr.c
index 627e309..6297b2e 100644
--- a/test/CodeGen/palignr.c
+++ b/test/CodeGen/palignr.c
@@ -1,13 +1,9 @@
// RUN: %clang_cc1 %s -triple=i686-apple-darwin -target-feature +ssse3 -O1 -S -o - | FileCheck %s
#define _mm_alignr_epi8(a, b, n) (__builtin_ia32_palignr128((a), (b), (n)))
-#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n*8)))
-typedef __attribute__((vector_size(8))) int int2;
typedef __attribute__((vector_size(16))) int int4;
// CHECK: palignr
-int2 mmx_align1(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 7); }
-// CHECK: palignr
int4 align1(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 15); }
// CHECK: ret
// CHECK: ret
@@ -17,3 +13,18 @@ int4 align2(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 16); }
int4 align3(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 17); }
// CHECK: xor
int4 align4(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 32); }
+
+#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n)))
+typedef __attribute__((vector_size(8))) int int2;
+
+// CHECK-NOT: palignr
+int2 align5(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 8); }
+
+// CHECK: psrlq
+int2 align6(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 9); }
+
+// CHECK: xor
+int2 align7(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 16); }
+
+// CHECK: palignr
+int2 align8(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 7); } \ No newline at end of file
diff --git a/test/CodeGen/struct-passing.c b/test/CodeGen/struct-passing.c
index b351d81..409d14e 100644
--- a/test/CodeGen/struct-passing.c
+++ b/test/CodeGen/struct-passing.c
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
// RUN: grep 'declare i32 @f0() readnone$' %t
// RUN: grep 'declare i32 @f1() readonly$' %t
-// RUN: grep 'declare void @f2(.* noalias sret)$' %t
-// RUN: grep 'declare void @f3(.* noalias sret)$' %t
+// RUN: grep 'declare void @f2(.* sret)$' %t
+// RUN: grep 'declare void @f3(.* sret)$' %t
// RUN: grep 'declare void @f4(.* byval)$' %t
// RUN: grep 'declare void @f5(.* byval)$' %t
// PR3835
diff --git a/test/CodeGen/union-init2.c b/test/CodeGen/union-init2.c
index ac469cd..1386c27 100644
--- a/test/CodeGen/union-init2.c
+++ b/test/CodeGen/union-init2.c
@@ -1,4 +1,13 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | grep "bitcast (%0\* @r to %union.x\*), \[4 x i8\] undef"
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple i686-pc-linux-gnu | FileCheck %s
// Make sure we generate something sane instead of a ptrtoint
+// CHECK: bitcast (%0* @r to %union.x*), [4 x i8] undef
union x {long long b;union x* a;} r = {.a = &r};
+
+
+// CHECK: global %1 { [3 x i8] zeroinitializer, [5 x i8] undef }
+union z {
+ char a[3];
+ long long b;
+};
+union z y = {};
diff --git a/test/CodeGen/x86_32-arguments.c b/test/CodeGen/x86_32-arguments.c
index eb98e1a..01c3e23 100644
--- a/test/CodeGen/x86_32-arguments.c
+++ b/test/CodeGen/x86_32-arguments.c
@@ -1,45 +1,45 @@
// RUN: %clang_cc1 -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep 'define signext i8 @f0()' %t
-// RUN: grep 'define signext i16 @f1()' %t
-// RUN: grep 'define i32 @f2()' %t
-// RUN: grep 'define float @f3()' %t
-// RUN: grep 'define double @f4()' %t
-// RUN: grep 'define x86_fp80 @f5()' %t
-// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t
-// RUN: grep 'define void @f7(i32 %a0)' %t
-// RUN: grep 'define i64 @f8_1()' %t
-// RUN: grep 'define void @f8_2(i32 %a0.0, i32 %a0.1)' %t
+// RUN: FileCheck < %t %s
+// CHECK: define signext i8 @f0()
char f0(void) {
return 0;
}
+// CHECK: define signext i16 @f1()
short f1(void) {
return 0;
}
+// CHECK: define i32 @f2()
int f2(void) {
return 0;
}
+// CHECK: define float @f3()
float f3(void) {
return 0;
}
+// CHECK: define double @f4()
double f4(void) {
return 0;
}
+// CHECK: define x86_fp80 @f5()
long double f5(void) {
return 0;
}
+// CHECK: define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8* %a4)
void f6(char a0, short a1, int a2, long long a3, void *a4) {}
-typedef enum { A, B, C } E;
-
-void f7(E a0) {}
+// CHECK: define void @f7(i32 %a0)
+typedef enum { A, B, C } e7;
+void f7(e7 a0) {}
+// CHECK: define i64 @f8_1()
+// CHECK: define void @f8_2(i32 %a0.0, i32 %a0.1)
struct s8 {
int a;
int b;
@@ -49,11 +49,11 @@ void f8_2(struct s8 a0) {}
// This should be passed just as s8.
-// RUN: grep 'define i64 @f9_1()' %t
+// CHECK: define i64 @f9_1()
// FIXME: llvm-gcc expands this, this may have some value for the
// backend in terms of optimization but doesn't change the ABI.
-// RUN: grep 'define void @f9_2(%.truct.s9\* byval %a0)' %t
+// CHECK: define void @f9_2(%struct.s9* byval %a0)
struct s9 {
int a : 17;
int b;
@@ -63,7 +63,7 @@ void f9_2(struct s9 a0) {}
// Return of small structures and unions
-// RUN: grep 'float @f10()' %t
+// CHECK: float @f10()
struct s10 {
union { };
float f;
@@ -71,12 +71,12 @@ struct s10 {
// Small vectors and 1 x {i64,double} are returned in registers
-// RUN: grep 'i32 @f11()' %t
-// RUN: grep -F 'void @f12(<2 x i32>* noalias sret %agg.result)' %t
-// RUN: grep 'i64 @f13()' %t
-// RUN: grep 'i64 @f14()' %t
-// RUN: grep '<2 x i64> @f15()' %t
-// RUN: grep '<2 x i64> @f16()' %t
+// CHECK: i32 @f11()
+// CHECK: void @f12(<2 x i32>* sret %agg.result)
+// CHECK: i64 @f13()
+// CHECK: i64 @f14()
+// CHECK: <2 x i64> @f15()
+// CHECK: <2 x i64> @f16()
typedef short T11 __attribute__ ((vector_size (4)));
T11 f11(void) { while (1) {} }
typedef int T12 __attribute__ ((vector_size (8)));
@@ -93,12 +93,12 @@ T16 f16(void) { while (1) {} }
// And when the single element in a struct (but not for 64 and
// 128-bits).
-// RUN: grep 'i32 @f17()' %t
-// RUN: grep -F 'void @f18(%2* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f19(%3* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f20(%4* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f21(%5* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f22(%6* noalias sret %agg.result)' %t
+// CHECK: i32 @f17()
+// CHECK: void @f18(%2* sret %agg.result)
+// CHECK: void @f19(%3* sret %agg.result)
+// CHECK: void @f20(%4* sret %agg.result)
+// CHECK: void @f21(%5* sret %agg.result)
+// CHECK: void @f22(%6* sret %agg.result)
struct { T11 a; } f17(void) { while (1) {} }
struct { T12 a; } f18(void) { while (1) {} }
struct { T13 a; } f19(void) { while (1) {} }
@@ -108,97 +108,109 @@ struct { T16 a; } f22(void) { while (1) {} }
// Single element structures are handled specially
-// RUN: grep -F 'float @f23()' %t
-// RUN: grep -F 'float @f24()' %t
-// RUN: grep -F 'float @f25()' %t
+// CHECK: float @f23()
+// CHECK: float @f24()
+// CHECK: float @f25()
struct { float a; } f23(void) { while (1) {} }
struct { float a[1]; } f24(void) { while (1) {} }
struct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} }
// Small structures are handled recursively
-// RUN: grep -F 'i32 @f26()' %t
-// RUN: grep 'void @f27(%.truct.s27\* noalias sret %agg.result)' %t
+// CHECK: i32 @f26()
+// CHECK: void @f27(%struct.s27* sret %agg.result)
struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} }
struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} }
-// RUN: grep 'void @f28(%.truct.s28\* noalias sret %agg.result)' %t
+// CHECK: void @f28(%struct.s28* sret %agg.result)
struct s28 { int a; int b[]; } f28(void) { while (1) {} }
-// RUN: grep 'define i16 @f29()' %t
+// CHECK: define i16 @f29()
struct s29 { struct { } a[1]; char b; char c; } f29(void) { while (1) {} }
-// RUN: grep 'define i16 @f30()' %t
+// CHECK: define i16 @f30()
struct s30 { char a; char b : 4; } f30(void) { while (1) {} }
-// RUN: grep 'define float @f31()' %t
+// CHECK: define float @f31()
struct s31 { char : 0; float b; char : 0; } f31(void) { while (1) {} }
-// RUN: grep 'define i32 @f32()' %t
+// CHECK: define i32 @f32()
struct s32 { char a; unsigned : 0; } f32(void) { while (1) {} }
-// RUN: grep 'define float @f33()' %t
+// CHECK: define float @f33()
struct s33 { float a; long long : 0; } f33(void) { while (1) {} }
-// RUN: grep 'define float @f34()' %t
+// CHECK: define float @f34()
struct s34 { struct { int : 0; } a; float b; } f34(void) { while (1) {} }
-// RUN: grep 'define i16 @f35()' %t
+// CHECK: define i16 @f35()
struct s35 { struct { int : 0; } a; char b; char c; } f35(void) { while (1) {} }
-// RUN: grep 'define i16 @f36()' %t
+// CHECK: define i16 @f36()
struct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while (1) {} }
-// RUN: grep 'define float @f37()' %t
+// CHECK: define float @f37()
struct s37 { float c[1][1]; } f37(void) { while (1) {} }
-// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t
+// CHECK: define void @f38(%struct.s38* sret %agg.result)
struct s38 { char a[3]; short b; } f38(void) { while (1) {} }
-// RUN: grep 'define void @f39(.struct.s39. byval align 16 .x)' %t
+// CHECK: define void @f39(%struct.s39* byval align 16 %x)
typedef int v39 __attribute((vector_size(16)));
struct s39 { v39 x; };
void f39(struct s39 x) {}
// <rdar://problem/7247671>
-// RUN: grep 'define i32 @f40()' %t
+// CHECK: define i32 @f40()
enum e40 { ec0 = 0 };
enum e40 f40(void) { }
-// RUN: grep 'define void ()\* @f41()' %t
+// CHECK: define void ()* @f41()
typedef void (^vvbp)(void);
vvbp f41(void) { }
-// RUN: grep 'define i32 @f42()' %t
+// CHECK: define i32 @f42()
struct s42 { enum e40 f0; } f42(void) { }
-// RUN: grep 'define i64 @f43()' %t
+// CHECK: define i64 @f43()
struct s43 { enum e40 f0; int f1; } f43(void) { }
-// RUN: grep 'define i32 @f44()' %t
+// CHECK: define i32 @f44()
struct s44 { vvbp f0; } f44(void) { }
-// RUN: grep 'define i64 @f45()' %t
+// CHECK: define i64 @f45()
struct s45 { vvbp f0; int f1; } f45(void) { }
-// RUN: grep 'define void @f46(i32 %a0)' %t
+// CHECK: define void @f46(i32 %a0)
void f46(enum e40 a0) { }
-// RUN: grep 'define void @f47(void ()\* %a1)' %t
+// CHECK: define void @f47(void ()* %a1)
void f47(vvbp a1) { }
-// RUN: grep 'define void @f48(i32 %a0.0)' %t
+// CHECK: define void @f48(i32 %a0.0)
struct s48 { enum e40 f0; };
void f48(struct s48 a0) { }
-// RUN: grep 'define void @f49(i32 %a0.0, i32 %a0.1)' %t
+// CHECK: define void @f49(i32 %a0.0, i32 %a0.1)
struct s49 { enum e40 f0; int f1; };
void f49(struct s49 a0) { }
-// RUN: grep 'define void @f50(void ()\* %a0.0)' %t
+// CHECK: define void @f50(void ()* %a0.0)
struct s50 { vvbp f0; };
void f50(struct s50 a0) { }
-// RUN: grep 'define void @f51(void ()\* %a0.0, i32 %a0.1)' %t
+// CHECK: define void @f51(void ()* %a0.0, i32 %a0.1)
struct s51 { vvbp f0; int f1; };
void f51(struct s51 a0) { }
+// CHECK: define void @f52(%struct.s52* byval align 16 %x)
+struct s52 {
+ long double a;
+};
+void f52(struct s52 x) {}
+
+// CHECK: define void @f53(%struct.s53* byval align 32 %x)
+struct __attribute__((aligned(32))) s53 {
+ int x;
+ int y;
+};
+void f53(struct s53 x) {}
diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c
index d6b9b29..47b2eb1 100644
--- a/test/CodeGen/x86_64-arguments.c
+++ b/test/CodeGen/x86_64-arguments.c
@@ -1,49 +1,51 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o %t %s
-// RUN: grep 'define signext i8 @f0()' %t
-// RUN: grep 'define signext i16 @f1()' %t
-// RUN: grep 'define i32 @f2()' %t
-// RUN: grep 'define float @f3()' %t
-// RUN: grep 'define double @f4()' %t
-// RUN: grep 'define x86_fp80 @f5()' %t
-// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t
-// RUN: grep 'define void @f7(i32 %a0)' %t
-// RUN: grep '.0 = type { i64, double }' %t
-// RUN: grep 'define .0 @f8_1()' %t
-// RUN: grep 'define void @f8_2(.0)' %t
+// RUN: FileCheck < %t %s
+// CHECK: %0 = type { i64, double }
+
+// CHECK: define signext i8 @f0()
char f0(void) {
return 0;
}
+// CHECK: define signext i16 @f1()
short f1(void) {
return 0;
}
+// CHECK: define i32 @f2()
int f2(void) {
return 0;
}
+// CHECK: define float @f3()
float f3(void) {
return 0;
}
+// CHECK: define double @f4()
double f4(void) {
return 0;
}
+// CHECK: define x86_fp80 @f5()
long double f5(void) {
return 0;
}
+// CHECK: define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8* %a4)
void f6(char a0, short a1, int a2, long long a3, void *a4) {
}
-typedef enum { A, B, C } E;
-
-void f7(E a0) {
+// CHECK: define void @f7(i32 %a0)
+typedef enum { A, B, C } e7;
+void f7(e7 a0) {
}
// Test merging/passing of upper eightbyte with X87 class.
+//
+// CHECK: define %0 @f8_1()
+// CHECK: define void @f8_2(%0)
union u8 {
long double a;
int b;
@@ -51,48 +53,63 @@ union u8 {
union u8 f8_1() { while (1) {} }
void f8_2(union u8 a0) {}
-// RUN: grep 'define i64 @f9()' %t
+// CHECK: define i64 @f9()
struct s9 { int a; int b; int : 0; } f9(void) { while (1) {} }
-// RUN: grep 'define void @f10(i64)' %t
+// CHECK: define void @f10(i64)
struct s10 { int a; int b; int : 0; };
void f10(struct s10 a0) {}
-// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t
+// CHECK: define void @f11(%struct.s19* sret %agg.result)
union { long double a; float b; } f11() { while (1) {} }
-// RUN: grep 'define i64 @f12_0()' %t
-// RUN: grep 'define void @f12_1(i64)' %t
+// CHECK: define i64 @f12_0()
+// CHECK: define void @f12_1(i64)
struct s12 { int a __attribute__((aligned(16))); };
struct s12 f12_0(void) { while (1) {} }
void f12_1(struct s12 a0) {}
// Check that sret parameter is accounted for when checking available integer
// registers.
-// RUN: grep 'define void @f13(.struct.s13_0. noalias sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t
+// CHECK: define void @f13(%struct.s13_0* sret %agg.result, i32 %a, i32 %b, i32 %c, i32 %d, %struct.s13_1* byval %e, i32 %f)
struct s13_0 { long long f0[3]; };
struct s13_1 { long long f0[2]; };
-struct s13_0 f13(int a, int b, int c, int d,
+struct s13_0 f13(int a, int b, int c, int d,
struct s13_1 e, int f) { while (1) {} }
-// RUN: grep 'define void @f14(.*, i8 signext .X)' %t
-void f14(int a, int b, int c, int d, int e, int f,
- char X) {}
-// RUN: grep 'define void @f15(.*, i8\* .X)' %t
-void f15(int a, int b, int c, int d, int e, int f,
- void *X) {}
-// RUN: grep 'define void @f16(.*, float .X)' %t
+// CHECK: define void @f14({{.*}}, i8 signext %X)
+void f14(int a, int b, int c, int d, int e, int f, char X) {}
+
+// CHECK: define void @f15({{.*}}, i8* %X)
+void f15(int a, int b, int c, int d, int e, int f, void *X) {}
+
+// CHECK: define void @f16({{.*}}, float %X)
void f16(float a, float b, float c, float d, float e, float f, float g, float h,
float X) {}
-// RUN: grep 'define void @f17(.*, x86_fp80 .X)' %t
+
+// CHECK: define void @f17({{.*}}, x86_fp80 %X)
void f17(float a, float b, float c, float d, float e, float f, float g, float h,
long double X) {}
// Check for valid coercion.
-// RUN: grep '.. = bitcast i64. .* to .struct.f18_s0.' %t
-// RUN: grep '.. = load .struct.f18_s0. .., align 1' %t
-// RUN: grep 'store .struct.f18_s0 .., .struct.f18_s0. .f18_arg1' %t
+// CHECK: [[f18_t0:%.*]] = bitcast i64* {{.*}} to %struct.f18_s0*
+// CHECK: [[f18_t1:%.*]] = load %struct.f18_s0* [[f18_t0]], align 1
+// CHECK: store %struct.f18_s0 [[f18_t1]], %struct.f18_s0* %f18_arg1
struct f18_s0 { int f0; };
void f18(int a, struct f18_s0 f18_arg1) { while (1) {} }
+// Check byval alignment.
+
+// CHECK: define void @f19(%struct.s19* byval align 16 %x)
+struct s19 {
+ long double a;
+};
+void f19(struct s19 x) {}
+
+// CHECK: define void @f20(%struct.s20* byval align 32 %x)
+struct __attribute__((aligned(32))) s20 {
+ int x;
+ int y;
+};
+void f20(struct s20 x) {}
diff --git a/test/CodeGenCXX/PR6747.cpp b/test/CodeGenCXX/PR6747.cpp
new file mode 100644
index 0000000..5a07ce6
--- /dev/null
+++ b/test/CodeGenCXX/PR6747.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+struct foo {
+ virtual void bar();
+// CHECK: define available_externally void @_ZN3foo3bazEv
+ virtual void baz() {}
+};
+void zed() {
+ foo b;
+ b.baz();
+}
diff --git a/test/CodeGenCXX/address-of-fntemplate.cpp b/test/CodeGenCXX/address-of-fntemplate.cpp
index c5fa89d..162c6e5 100644
--- a/test/CodeGenCXX/address-of-fntemplate.cpp
+++ b/test/CodeGenCXX/address-of-fntemplate.cpp
@@ -11,3 +11,17 @@ void test() {
}
// CHECK: define linkonce_odr void @_Z1fIiEvT_
// CHECK: define linkonce_odr void @_Z1fIiEvv
+
+namespace PR6973 {
+ template<typename T>
+ struct X {
+ void f(const T&);
+ };
+
+ template<typename T>
+ int g();
+
+ void h(X<int (*)()> xf) {
+ xf.f(&g<int>);
+ }
+}
diff --git a/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
index ea3eafc..adb3950 100644
--- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s
struct A {
union {
@@ -10,3 +10,27 @@ struct A {
};
A a;
+
+namespace PR7021 {
+ struct X
+ {
+ union { long l; };
+ };
+
+ // CHECK: define void @_ZN6PR70211fENS_1XES0_
+ void f(X x, X z) {
+ X x1;
+
+ // CHECK: store i64 1, i64
+ x1.l = 1;
+
+ // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64
+ X x2(x1);
+
+ X x3;
+ // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64
+ x3 = x1;
+
+ // CHECK: ret void
+ }
+}
diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp
new file mode 100644
index 0000000..5cca788
--- /dev/null
+++ b/test/CodeGenCXX/arm.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 %s -triple=thumbv7-apple-darwin3.0.0-iphoneos -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - | FileCheck %s
+
+class foo {
+public:
+ foo();
+ virtual ~foo();
+};
+
+class bar : public foo {
+public:
+ bar();
+};
+
+// The global dtor needs the right calling conv with -fno-use-cxa-atexit
+// rdar://7817590
+bar baz;
+
+// CHECK: @_GLOBAL__D_a()
+// CHECK: call arm_apcscc void @_ZN3barD1Ev(%class.bar* @baz)
+
diff --git a/test/CodeGenCXX/assign-operator.cpp b/test/CodeGenCXX/assign-operator.cpp
index cb8867f..c4b64e6 100644
--- a/test/CodeGenCXX/assign-operator.cpp
+++ b/test/CodeGenCXX/assign-operator.cpp
@@ -1,9 +1,19 @@
-// RUN: %clang_cc1 %s -emit-llvm-only -verify
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -verify -o - |FileCheck %s
class x {
-int operator=(int);
+public: int operator=(int);
};
void a() {
x a;
a = 1u;
}
+
+void f(int i, int j) {
+ // CHECK: load i32
+ // CHECK: load i32
+ // CHECK: add nsw i32
+ // CHECK: store i32
+ // CHECK: store i32 17, i32
+ // CHECK: ret
+ (i += j) = 17;
+}
diff --git a/test/CodeGenCXX/bitfield-layout.cpp b/test/CodeGenCXX/bitfield-layout.cpp
new file mode 100644
index 0000000..15f33d2
--- /dev/null
+++ b/test/CodeGenCXX/bitfield-layout.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix LP64 %s
+// RUN: %clang_cc1 %s -triple=i386-apple-darwin10 -emit-llvm -o - -O3 | FileCheck -check-prefix LP32 %s
+
+// CHECK-LP64: %union.Test1 = type { i32, [4 x i8] }
+union Test1 {
+ int a;
+ int b: 39;
+} t1;
+
+// CHECK-LP64: %union.Test2 = type { i8 }
+union Test2 {
+ int : 6;
+} t2;
+
+// CHECK-LP64: %union.Test3 = type { [2 x i8] }
+union Test3 {
+ int : 9;
+} t3;
+
+
+#define CHECK(x) if (!(x)) return __LINE__
+
+int f() {
+ struct {
+ int a;
+
+ unsigned long long b : 65;
+
+ int c;
+ } c;
+
+ c.a = 0;
+ c.b = (unsigned long long)-1;
+ c.c = 0;
+
+ CHECK(c.a == 0);
+ CHECK(c.b == (unsigned long long)-1);
+ CHECK(c.c == 0);
+
+// CHECK-LP64: ret i32 0
+// CHECK-LP32: ret i32 0
+ return 0;
+}
diff --git a/test/CodeGenCXX/block-destruct.cpp b/test/CodeGenCXX/block-destruct.cpp
new file mode 100644
index 0000000..f809ca2
--- /dev/null
+++ b/test/CodeGenCXX/block-destruct.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+
+struct A { ~A(); };
+
+void f() {
+ __block A a;
+}
+
+// CHECK: call void @_ZN1AD1Ev
diff --git a/test/CodeGenCXX/c-linkage.cpp b/test/CodeGenCXX/c-linkage.cpp
new file mode 100644
index 0000000..b1f07b7
--- /dev/null
+++ b/test/CodeGenCXX/c-linkage.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// pr6644
+
+extern "C" {
+ namespace N {
+ struct X {
+ virtual void f();
+ };
+ void X::f() { }
+ }
+}
+
+// CHECK: define void @_ZN1N1X1fEv
diff --git a/test/CodeGenCXX/constructor-init-reference.cpp b/test/CodeGenCXX/constructor-init-reference.cpp
index c2f41e1..5e75159 100644
--- a/test/CodeGenCXX/constructor-init-reference.cpp
+++ b/test/CodeGenCXX/constructor-init-reference.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -emit-llvm -o - %s | grep "store i32\* @x, i32\*\*"
int x;
-class A {
+struct A {
int& y;
A() : y(x) {}
};
diff --git a/test/CodeGenCXX/constructors.cpp b/test/CodeGenCXX/constructors.cpp
index 2c95c91..a8dc7fc 100644
--- a/test/CodeGenCXX/constructors.cpp
+++ b/test/CodeGenCXX/constructors.cpp
@@ -12,7 +12,7 @@ struct ValueClass {
/* Test basic functionality. */
-class A {
+struct A {
A(struct Undeclared &);
A(ValueClass);
Member mem;
@@ -92,3 +92,15 @@ D::D(int x, ...) : A(ValueClass(x, x+1)), mem(x*x) {}
// CHECK: call void @_ZN10ValueClassC1Eii(
// CHECK: call void @_ZN1AC2E10ValueClass(
// CHECK: call void @_ZN6MemberC1Ei(
+
+
+// PR6622: this shouldn't crash
+namespace test0 {
+ struct A {};
+ struct B : virtual A { int x; };
+ struct C : B {};
+
+ void test(C &in) {
+ C tmp = in;
+ }
+}
diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp
index e523eb0..e4a0677 100644
--- a/test/CodeGenCXX/default-arg-temps.cpp
+++ b/test/CodeGenCXX/default-arg-temps.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t -triple=x86_64-apple-darwin9
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct T {
T();
@@ -13,20 +13,62 @@ public:
X(const X&, const T& t = T());
};
+// CHECK: define void @_Z1gv()
void g() {
- // RUN: grep "call void @_ZN1TC1Ev" %t | count 4
- // RUN: grep "call void @_ZN1TD1Ev" %t | count 4
+ // CHECK: call void @_ZN1TC1Ev([[T:%.*]]* [[AGG1:%.*]])
+ // CHECK-NEXT: call void @_Z1fRK1T([[T]]* [[AGG1]])
+ // CHECK-NEXT: call void @_ZN1TD1Ev([[T]]* [[AGG1]])
f();
+
+ // CHECK-NEXT: call void @_ZN1TC1Ev([[T:%.*]]* [[AGG2:%.*]])
+ // CHECK-NEXT: call void @_Z1fRK1T([[T]]* [[AGG2]])
+ // CHECK-NEXT: call void @_ZN1TD1Ev([[T]]* [[AGG2]])
f();
+ // CHECK-NEXT: call void @_ZN1XC1Ev(
X a;
+
+ // CHECK-NEXT: call void @_ZN1TC1Ev(
+ // CHECK-NEXT: call void @_ZN1XC1ERKS_RK1T(
+ // CHECK-NEXT: call void @_ZN1TD1Ev(
X b(a);
+
+ // CHECK-NEXT: call void @_ZN1TC1Ev(
+ // CHECK-NEXT: call void @_ZN1XC1ERKS_RK1T(
+ // CHECK-NEXT: call void @_ZN1TD1Ev(
X c = a;
}
-// RUN: grep memset %t
class obj{ int a; float b; double d; };
+// CHECK: define void @_Z1hv()
void h() {
+ // CHECK: call void @llvm.memset.p0i8.i64(
+ // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(
obj o = obj();
}
+
+// PR7028 - mostly this shouldn't crash
+namespace test1 {
+ struct A { A(); };
+ struct B { B(); ~B(); };
+
+ struct C {
+ C(const B &file = B());
+ };
+ C::C(const B &file) {}
+
+ struct D {
+ C c;
+ A a;
+
+ // CHECK: define linkonce_odr void @_ZN5test11DC2Ev(
+ // CHECK: call void @_ZN5test11BC1Ev(
+ // CHECK-NEXT: call void @_ZN5test11CC1ERKNS_1BE(
+ // CHECK-NEXT: call void @_ZN5test11BD1Ev(
+ // CHECK: call void @_ZN5test11AC1Ev(
+ D() : c(), a() {}
+ };
+
+ D d;
+}
diff --git a/test/CodeGenCXX/default-destructor-nested.cpp b/test/CodeGenCXX/default-destructor-nested.cpp
index 8694274..565a727 100644
--- a/test/CodeGenCXX/default-destructor-nested.cpp
+++ b/test/CodeGenCXX/default-destructor-nested.cpp
@@ -2,7 +2,7 @@
// PR6294
class A {
- virtual ~A();
+public: virtual ~A();
};
class B {
class C;
diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp
index 7cc264f..87f8698 100644
--- a/test/CodeGenCXX/delete.cpp
+++ b/test/CodeGenCXX/delete.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
void t1(int *a) {
delete a;
@@ -19,8 +19,11 @@ struct T {
int a;
};
+// CHECK: define void @_Z2t4P1T
void t4(T *t) {
- // RUN: grep "call void @_ZN1TD1Ev" %t | count 1
+ // CHECK: call void @_ZN1TD1Ev
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: call void @_ZdlPv
delete t;
}
@@ -35,3 +38,22 @@ void f() {
delete a;
}
+
+namespace test0 {
+ struct A {
+ void *operator new(__SIZE_TYPE__ sz);
+ void operator delete(void *p) { ::operator delete(p); }
+ ~A() {}
+ };
+
+ // CHECK: define void @_ZN5test04testEPNS_1AE(
+ void test(A *a) {
+ // CHECK: call void @_ZN5test01AD1Ev
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: call void @_ZN5test01AdlEPv
+ delete a;
+ }
+
+ // CHECK: define linkonce_odr void @_ZN5test01AD1Ev
+ // CHECK: define linkonce_odr void @_ZN5test01AdlEPv
+}
diff --git a/test/CodeGenCXX/destructor-debug-info.cpp b/test/CodeGenCXX/destructor-debug-info.cpp
new file mode 100644
index 0000000..9e32275
--- /dev/null
+++ b/test/CodeGenCXX/destructor-debug-info.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -g -S -emit-llvm -o %t %s
+// RUN: grep "i32 20, i32 3, metadata" %t | count 1
+// Check there is a line number entry for line 20 where b1 is destructed.
+class A { int a; };
+class B {
+public:
+ B() { a = new A; }
+ ~B() { delete a; }
+private:
+ A *a;
+};
+
+void fn(B b);
+
+int i;
+void foo() {
+ if (i) {
+ B b1;
+ fn (b1);
+ }
+}
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index afd9da6..f2629d1 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
+// RUN: %clang_cc1 -fexceptions -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
// RUN: FileCheck --input-file=%t.ll %s
struct test1_D {
@@ -9,14 +9,18 @@ void test1() {
throw d1;
}
-// CHECK: define void @_Z5test1v() nounwind {
-// CHECK: %{{exception.ptr|1}} = alloca i8*
-// CHECK-NEXT: %{{exception|2}} = call i8* @__cxa_allocate_exception(i64 8)
-// CHECK-NEXT: store i8* %{{exception|2}}, i8** %{{exception.ptr|1}}
-// CHECK-NEXT: %{{0|3}} = bitcast i8* %{{exception|2}} to %struct.test1_D*
-// CHECK-NEXT: %{{tmp|4}} = bitcast %struct.test1_D* %{{0|3}} to i8*
-// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{tmp|4}}, i8* bitcast (%struct.test1_D* @d1 to i8*), i64 8, i32 8, i1 false)
-// CHECK-NEXT: call void @__cxa_throw(i8* %{{exception|2}}, i8* bitcast (%0* @_ZTI7test1_D to i8*), i8* null) noreturn
+// CHECK: define void @_Z5test1v()
+// CHECK: [[FREEVAR:%.*]] = alloca i1
+// CHECK-NEXT: [[EXNOBJVAR:%.*]] = alloca i8*
+// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
+// CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8)
+// CHECK-NEXT: store i8* [[EXNOBJ]], i8** [[EXNOBJVAR]]
+// CHECK-NEXT: store i1 true, i1* [[FREEVAR]]
+// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]]
+// CHECK-NEXT: [[EXN2:%.*]] = bitcast [[DSTAR]] [[EXN]] to i8*
+// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[EXN2]], i8* bitcast ([[DSTAR]] @d1 to i8*), i64 8, i32 8, i1 false)
+// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
+// CHECK-NEXT: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%0* @_ZTI7test1_D to i8*), i8* null) noreturn
// CHECK-NEXT: unreachable
@@ -31,14 +35,19 @@ void test2() {
throw d2;
}
-// CHECK: define void @_Z5test2v() nounwind {
-// CHECK: %{{exception.ptr|1}} = alloca i8*
-// CHECK-NEXT: %{{exception|2}} = call i8* @__cxa_allocate_exception(i64 16)
-// CHECK-NEXT: store i8* %{{exception|2}}, i8** %{{\1}}
-// CHECK-NEXT: %{{0|3}} = bitcast i8* %{{exception|2}} to %struct.test2_D*
-// CHECK: invoke void @_ZN7test2_DC1ERKS_(%struct.test2_D* %{{0|3}}, %struct.test2_D* @d2)
-// CHECK-NEXT: to label %{{invoke.cont|8}} unwind label %{{terminate.handler|4}}
-// CHECK: call void @__cxa_throw(i8* %{{exception|2}}, i8* bitcast (%{{0|3}}* @_ZTI7test2_D to i8*), i8* null) noreturn
+// CHECK: define void @_Z5test2v()
+// CHECK: [[FREEVAR:%.*]] = alloca i1
+// CHECK-NEXT: [[EXNOBJVAR:%.*]] = alloca i8*
+// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
+// CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 16)
+// CHECK-NEXT: store i8* [[EXNOBJ]], i8** [[EXNOBJVAR]]
+// CHECK-NEXT: store i1 true, i1* [[FREEVAR]]
+// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]]
+// CHECK-NEXT: invoke void @_ZN7test2_DC1ERKS_([[DSTAR]] [[EXN]], [[DSTAR]] @d2)
+// CHECK-NEXT: to label %[[CONT:.*]] unwind label %{{.*}}
+// : [[CONT]]: (can't check this in Release-Asserts builds)
+// CHECK: store i1 false, i1* [[FREEVAR]]
+// CHECK-NEXT: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%{{.*}}* @_ZTI7test2_D to i8*), i8* null) noreturn
// CHECK-NEXT: unreachable
@@ -52,20 +61,46 @@ void test3() {
throw (volatile test3_D *)0;
}
-// CHECK: define void @_Z5test3v() nounwind {
-// CHECK: %{{exception.ptr|1}} = alloca i8*
-// CHECK-NEXT: %{{exception|2}} = call i8* @__cxa_allocate_exception(i64 8)
-// CHECK-NEXT: store i8* %{{exception|2}}, i8** %{{exception.ptr|1}}
-// CHECK-NEXT: %{{0|3}} = bitcast i8* %{{exception|2}} to %struct.test3_D**
-// CHECK-NEXT: store %struct.test3_D* null, %struct.test3_D**
-// CHECK-NEXT: call void @__cxa_throw(i8* %{{exception|2}}, i8* bitcast (%1* @_ZTIPV7test3_D to i8*), i8* null) noreturn
-// CHECK-NEXT: unreachable
+// CHECK: define void @_Z5test3v()
+// CHECK: [[FREEVAR:%.*]] = alloca i1
+// CHECK-NEXT: [[EXNOBJVAR:%.*]] = alloca i8*
+// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
+// CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8)
+// CHECK-NEXT: store i8* [[EXNOBJ]], i8** [[EXNOBJVAR]]
+// CHECK-NEXT: store i1 true, i1* [[FREEVAR]]
+// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSS:%[^*]*\*]]*
+// CHECK-NEXT: store [[DSS]] null, [[DSS]]* [[EXN]]
+// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
+// CHECK-NEXT: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%1* @_ZTIPV7test3_D to i8*), i8* null) noreturn
+// CHECK-NEXT: unreachable
void test4() {
throw;
}
-// CHECK: define void @_Z5test4v() nounwind {
+// CHECK: define void @_Z5test4v()
// CHECK: call void @__cxa_rethrow() noreturn
// CHECK-NEXT: unreachable
+
+
+// rdar://problem/7696549
+namespace test5 {
+ struct A {
+ A();
+ A(const A&);
+ ~A();
+ };
+
+ void test() {
+ try { throw A(); } catch (A &x) {}
+ }
+// CHECK: define void @_ZN5test54testEv()
+// CHECK: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 1)
+// CHECK: [[EXNCAST:%.*]] = bitcast i8* [[EXNOBJ]] to [[A:%[^*]*]]*
+// CHECK-NEXT: invoke void @_ZN5test51AC1Ev([[A]]* [[EXNCAST]])
+// CHECK: invoke void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast ({{%.*}}* @_ZTIN5test51AE to i8*), i8* bitcast (void ([[A]]*)* @_ZN5test51AD1Ev to i8*)) noreturn
+// CHECK-NEXT: to label {{%.*}} unwind label %[[HANDLER:[^ ]*]]
+// : [[HANDLER]]: (can't check this in Release-Asserts builds)
+// CHECK: {{%.*}} = call i32 @llvm.eh.typeid.for(i8* bitcast ({{%.*}}* @_ZTIN5test51AE to i8*))
+}
diff --git a/test/CodeGenCXX/empty-classes.cpp b/test/CodeGenCXX/empty-classes.cpp
new file mode 100644
index 0000000..59124e3
--- /dev/null
+++ b/test/CodeGenCXX/empty-classes.cpp
@@ -0,0 +1,69 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
+
+struct Empty { };
+
+struct A {
+ explicit A(unsigned a = 0xffffffff) : a(a) { }
+
+ unsigned a;
+};
+
+struct B : A, Empty {
+ B() : A(), Empty() { }
+};
+
+struct C : A, Empty {
+ C() : A(), Empty() { }
+ C(const C& other) : A(0x12345678), Empty(other) { }
+};
+
+struct D : A, Empty {
+ D& operator=(const D& other) {
+ a = 0x87654321;
+ Empty::operator=(other);
+
+ return *this;
+ }
+};
+
+#define CHECK(x) if (!(x)) return __LINE__
+
+// PR7012
+// CHECK: define i32 @_Z1fv()
+int f() {
+ B b1;
+
+ // Check that A::a is not overwritten by the Empty default constructor.
+ CHECK(b1.a == 0xffffffff);
+
+ C c1;
+ C c2(c1);
+
+ // Check that A::a has the value set in the C::C copy constructor.
+ CHECK(c2.a == 0x12345678);
+
+ D d1, d2;
+ d2 = d1;
+
+ // Check that A::as has the value set in the D copy assignment operator.
+ CHECK(d2.a == 0x87654321);
+
+ // Success!
+ // CHECK: ret i32 0
+ return 0;
+}
+
+#ifdef HARNESS
+extern "C" void printf(const char *, ...);
+
+int main() {
+ int result = f();
+
+ if (result == 0)
+ printf("success!\n");
+ else
+ printf("test on line %d failed!\n", result);
+
+ return result;
+}
+#endif
diff --git a/test/CodeGenCXX/exceptions-no-rtti.cpp b/test/CodeGenCXX/exceptions-no-rtti.cpp
new file mode 100644
index 0000000..c26abb2
--- /dev/null
+++ b/test/CodeGenCXX/exceptions-no-rtti.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -fno-rtti -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: @_ZTIN5test11AE = weak_odr constant
+// CHECK: @_ZTIN5test11BE = weak_odr constant
+// CHECK: @_ZTIN5test11CE = weak_odr constant
+// CHECK: @_ZTIN5test11DE = weak_odr constant
+// CHECK: @_ZTIPN5test11DE = weak_odr constant {{.*}} @_ZTIN5test11DE
+
+// PR6974: this shouldn't crash
+namespace test0 {
+ class err {};
+
+ void f(void) {
+ try {
+ } catch (err &) {
+ }
+ }
+}
+
+namespace test1 {
+ // These classes have key functions defined out-of-line.
+ // Under normal circumstances, we wouldn't generate RTTI for them;
+ // under -fno-rtti, we generate RTTI only when required by EH.
+ class A { virtual void foo(); };
+ class B { virtual void foo(); };
+ class C { virtual void foo(); };
+ class D { virtual void foo(); };
+
+ void opaque();
+
+ void test0() {
+ throw A();
+ }
+
+ void test1() throw(B) {
+ opaque();
+ }
+
+ void test2() {
+ try {
+ opaque();
+ } catch (C&) {}
+ }
+
+ void test3(D *ptr) {
+ throw ptr;
+ };
+}
diff --git a/test/CodeGenCXX/field-access-debug-info.cpp b/test/CodeGenCXX/field-access-debug-info.cpp
new file mode 100644
index 0000000..907fe04
--- /dev/null
+++ b/test/CodeGenCXX/field-access-debug-info.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -g -S -masm-verbose -o %t %s
+// RUN: grep DW_AT_accessibility %t
+
+class A {
+public:
+ int p;
+private:
+ int pr;
+};
+
+A a;
diff --git a/test/CodeGenCXX/implicit-copy-assign-operator.cpp b/test/CodeGenCXX/implicit-copy-assign-operator.cpp
new file mode 100644
index 0000000..0ec89fc
--- /dev/null
+++ b/test/CodeGenCXX/implicit-copy-assign-operator.cpp
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s
+struct A {
+ A &operator=(const A&);
+ A &operator=(A&);
+};
+
+struct B {
+ B &operator=(B&);
+};
+
+struct C {
+ virtual C& operator=(const C&);
+};
+
+struct POD {
+ int array[3][4];
+};
+
+struct CopyByValue {
+ CopyByValue(const CopyByValue&);
+ CopyByValue &operator=(CopyByValue);
+};
+
+struct D : A, B, virtual C {
+ int scalar;
+ int scalar_array[2][3];
+ B class_member;
+ C class_member_array[2][3];
+ POD pod_array[2][3];
+
+ union {
+ int x;
+ float f[3];
+ };
+
+ CopyByValue by_value;
+};
+
+void test_D(D d1, D d2) {
+ d1 = d2;
+}
+
+// CHECK: define linkonce_odr %struct.D* @_ZN1DaSERS_
+// CHECK: {{call.*_ZN1AaSERS_}}
+// CHECK: {{call.*_ZN1BaSERS_}}
+// CHECK: {{call.*_ZN1CaSERKS_}}
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 24}}
+// CHECK: {{call.*_ZN1BaSERS_}}
+// CHECK: br
+// CHECK: {{call.*_ZN1CaSERKS_}}
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 288}}
+// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}}
+// CHECK: call void @_ZN11CopyByValueC1ERKS_
+// CHECK: {{call.*_ZN11CopyByValueaSES_}}
+// CHECK: ret
+
diff --git a/test/CodeGenCXX/instantiate-init-list.cpp b/test/CodeGenCXX/instantiate-init-list.cpp
index 676d299..49c6f51 100644
--- a/test/CodeGenCXX/instantiate-init-list.cpp
+++ b/test/CodeGenCXX/instantiate-init-list.cpp
@@ -5,7 +5,7 @@ struct F {
};
void G();
template<class T> class A {
- A();
+public: A();
};
template<class T> A<T>::A() {
static F f = { G };
diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp
index 22949da..6a29944 100644
--- a/test/CodeGenCXX/mangle-template.cpp
+++ b/test/CodeGenCXX/mangle-template.cpp
@@ -104,3 +104,43 @@ namespace test8 {
// CHECK: define weak_odr void @_ZN5test81fIiEEvNS_5int_cIXsrNS_4metaIT_E4typeE5valueEEE
template void f<int>(int_c<sizeof(int)>);
}
+
+namespace test9 {
+ template<typename T>
+ struct supermeta {
+ template<typename U>
+ struct apply {
+ typedef T U::*type;
+ };
+ };
+
+ struct X { };
+
+ template<typename T, typename U>
+ typename supermeta<T>::template apply<U>::type f();
+
+ void test_f() {
+ // CHECK: @_ZN5test91fIiNS_1XEEENS_9supermetaIT_E5applyIT0_E4typeEv()
+ // Note: GCC incorrectly mangles this as
+ // _ZN5test91fIiNS_1XEEENS_9supermetaIT_E5apply4typeEv, while EDG
+ // gets it right.
+ f<int, X>();
+ }
+}
+
+namespace test10 {
+ template<typename T>
+ struct X {
+ template<typename U>
+ struct definition {
+ };
+ };
+
+ // CHECK: _ZN6test101fIidEENS_1XIT_E10definitionIT0_EES2_S5_
+ template<typename T, typename U>
+ typename X<T>::template definition<U> f(T, U) { }
+
+ void g(int i, double d) {
+ f(i, d);
+ }
+}
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index ec9c08c..8f3d356 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -450,7 +450,7 @@ namespace test7 {
// CHECK: define weak_odr void @_ZN5test81AILZNS_1B5valueEEE3incEv
namespace test8 {
template <int &counter> class A { void inc() { counter++; } };
- class B { static int value; };
+ class B { public: static int value; };
template class A<B::value>;
}
// CHECK: declare void @_ZN5test91fIiNS_3barEEEvRKNT0_3baz1XE
@@ -468,3 +468,12 @@ namespace test9 {
f<int, bar>( 0);
}
}
+
+// <rdar://problem/7825453>
+namespace test10 {
+ template <char P1> struct S {};
+ template <char P2> void f(struct S<false ? 'a' : P2> ) {}
+
+ // CHECK: define weak_odr void @_ZN6test101fILc3EEEvNS_1SIXquLb0ELc97ET_EEE(
+ template void f<(char) 3>(struct S<3>);
+}
diff --git a/test/CodeGenCXX/member-function-pointer-calls.cpp b/test/CodeGenCXX/member-function-pointer-calls.cpp
index e1f2eb7..6f0ef81 100644
--- a/test/CodeGenCXX/member-function-pointer-calls.cpp
+++ b/test/CodeGenCXX/member-function-pointer-calls.cpp
@@ -9,18 +9,17 @@ int f(A* a, int (A::*fp)()) {
}
// CHECK: define i32 @_Z2g1v()
+// CHECK-NEXT: {{.*}}:
+// CHECK-NEXT: ret i32 1
int g1() {
A a;
-
- // CHECK: call i32 @_ZN1A3vf1Ev
- // CHECK-NEXT: ret i32
return f(&a, &A::vf1);
}
+// CHECK: define i32 @_Z2g2v()
+// CHECK-NEXT: {{.*}}:
+// CHECK-NEXT: ret i32 2
int g2() {
A a;
-
- // CHECK: call i32 @_ZN1A3vf2Ev
- // CHECK-NEXT: ret i32
return f(&a, &A::vf2);
}
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp
index f7c445b..e4beee1 100644
--- a/test/CodeGenCXX/member-function-pointers.cpp
+++ b/test/CodeGenCXX/member-function-pointers.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-apple-darwin9 | FileCheck -check-prefix LP32 %s
struct A { int a; void f(); virtual void vf1(); virtual void vf2(); };
struct B { int b; virtual void g(); };
@@ -12,10 +13,12 @@ void (C::*pc)();
// CHECK: @pa2 = global %0 { i64 ptrtoint (void (%struct.A*)* @_ZN1A1fEv to i64), i64 0 }, align 8
void (A::*pa2)() = &A::f;
-// CHECK: @pa3 = global %0 { i64 1, i64 0 }, align 8
+// CHECK: @pa3 = global %0 { i64 1, i64 0 }, align 8
+// CHECK-LP32: @pa3 = global %0 { i32 1, i32 0 }, align 4
void (A::*pa3)() = &A::vf1;
-// CHECK: @pa4 = global %0 { i64 9, i64 0 }, align 8
+// CHECK: @pa4 = global %0 { i64 9, i64 0 }, align 8
+// CHECK-LP32: @pa4 = global %0 { i32 5, i32 0 }, align 4
void (A::*pa4)() = &A::vf2;
// CHECK: @pc2 = global %0 { i64 ptrtoint (void (%struct.A*)* @_ZN1A1fEv to i64), i64 16 }, align 8
@@ -51,16 +54,24 @@ void f2() {
// CHECK: store i64 0, i64* [[pa2adj]]
void (A::*pa2)() = &A::f;
- // CHECK: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0
- // CHECK: store i64 1, i64* [[pa3ptr]]
- // CHECK: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1
- // CHECK: store i64 0, i64* [[pa3adj]]
+ // CHECK: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0
+ // CHECK: store i64 1, i64* [[pa3ptr]]
+ // CHECK: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1
+ // CHECK: store i64 0, i64* [[pa3adj]]
+ // CHECK-LP32: [[pa3ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 0
+ // CHECK-LP32: store i32 1, i32* [[pa3ptr]]
+ // CHECK-LP32: [[pa3adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa3, i32 0, i32 1
+ // CHECK-LP32: store i32 0, i32* [[pa3adj]]
void (A::*pa3)() = &A::vf1;
- // CHECK: [[pa4ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 0
- // CHECK: store i64 9, i64* [[pa4ptr]]
- // CHECK: [[pa4adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 1
- // CHECK: store i64 0, i64* [[pa4adj]]
+ // CHECK: [[pa4ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 0
+ // CHECK: store i64 9, i64* [[pa4ptr]]
+ // CHECK: [[pa4adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 1
+ // CHECK: store i64 0, i64* [[pa4adj]]
+ // CHECK-LP32: [[pa4ptr:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 0
+ // CHECK-LP32: store i32 5, i32* [[pa4ptr]]
+ // CHECK-LP32: [[pa4adj:%[a-zA-Z0-9\.]+]] = getelementptr inbounds %0* %pa4, i32 0, i32 1
+ // CHECK-LP32: store i32 0, i32* [[pa4adj]]
void (A::*pa4)() = &A::vf2;
}
@@ -173,3 +184,9 @@ namespace PR6258 {
void (A::*pf)(bool) = &A::f;
}
}
+
+// PR7027
+namespace PR7027 {
+ struct X { void test( ); };
+ void testX() { &X::test; }
+}
diff --git a/test/CodeGenCXX/member-initializers.cpp b/test/CodeGenCXX/member-initializers.cpp
index 81dcee7..244a164 100644
--- a/test/CodeGenCXX/member-initializers.cpp
+++ b/test/CodeGenCXX/member-initializers.cpp
@@ -16,7 +16,7 @@ struct B : A {
int f() {
B b;
- // CHECK: call i32 @_ZN1B1fEv
+ // CHECK: ret i32 2
return b.i;
}
diff --git a/test/CodeGenCXX/namespace-aliases.cpp b/test/CodeGenCXX/namespace-aliases.cpp
index 74b8eba..8624eb7 100644
--- a/test/CodeGenCXX/namespace-aliases.cpp
+++ b/test/CodeGenCXX/namespace-aliases.cpp
@@ -1,3 +1,9 @@
// RUN: %clang_cc1 -emit-llvm-only %s
namespace A { }
namespace B = A;
+
+namespace b {}
+
+void foo() {
+ namespace a = b;
+}
diff --git a/test/CodeGenCXX/new-operator-phi.cpp b/test/CodeGenCXX/new-operator-phi.cpp
index 38467ad..49859ac 100644
--- a/test/CodeGenCXX/new-operator-phi.cpp
+++ b/test/CodeGenCXX/new-operator-phi.cpp
@@ -2,7 +2,7 @@
// PR5454
#include <stddef.h>
-class X {static void * operator new(size_t size) throw(); X(int); };
+struct X {static void * operator new(size_t size) throw(); X(int); };
int a(), b();
void b(int x)
{
diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp
index ca7c52f..885158f 100644
--- a/test/CodeGenCXX/new.cpp
+++ b/test/CodeGenCXX/new.cpp
@@ -90,9 +90,19 @@ A* t10() {
return new(1, 2, 3.45, 100) A;
}
-struct B { };
+struct B { int a; };
void t11() {
// CHECK: call noalias i8* @_Znwm
// CHECK: call void @llvm.memset.p0i8.i64(
B* b = new B();
}
+
+struct Empty { };
+
+// We don't need to initialize an empty class.
+void t12() {
+ // CHECK: define void @_Z3t12v
+ // CHECK-NOT: br label
+ // CHECK: ret void
+ (void)new Empty[10];
+}
diff --git a/test/CodeGenCXX/operator-new.cpp b/test/CodeGenCXX/operator-new.cpp
index da64fc1..f718fae 100644
--- a/test/CodeGenCXX/operator-new.cpp
+++ b/test/CodeGenCXX/operator-new.cpp
@@ -6,6 +6,7 @@
class teste {
int A;
+public:
teste() : A(2) {}
};
diff --git a/test/CodeGenCXX/reference-in-blocks.cpp b/test/CodeGenCXX/reference-in-blocks.cpp
new file mode 100644
index 0000000..c020bab
--- /dev/null
+++ b/test/CodeGenCXX/reference-in-blocks.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fblocks %s -emit-llvm -o %t
+
+extern "C" int printf(const char*, ...);
+
+template<typename T> class range {
+public:
+T _i;
+ range(T i) {_i = i;};
+ T get() {return _i;};
+};
+
+int main() {
+
+ // works
+ void (^bl)(range<int> ) = ^(range<int> i){printf("Hello Blocks %d\n", i.get()); };
+
+ //crashes in godegen?
+ void (^bl2)(range<int>& ) = ^(range<int>& i){printf("Hello Blocks %d\n", i.get()); };
+ return 0;
+}
+
diff --git a/test/CodeGenCXX/rtti-fundamental.cpp b/test/CodeGenCXX/rtti-fundamental.cpp
index 473f48d..6826321 100644
--- a/test/CodeGenCXX/rtti-fundamental.cpp
+++ b/test/CodeGenCXX/rtti-fundamental.cpp
@@ -8,8 +8,10 @@ std::type_info foo() {
namespace __cxxabiv1 {
struct __fundamental_type_info {
- virtual ~__fundamental_type_info() {}
+ virtual ~__fundamental_type_info();
};
+
+ __fundamental_type_info::~__fundamental_type_info() { }
}
// CHECK: @_ZTIv = weak_odr constant
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index a67d137..750da02 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -34,3 +34,14 @@ inline void h2() {
void h3() {
h2();
}
+
+// PR6980: this shouldn't crash
+namespace test0 {
+ struct A { A(); };
+ __attribute__((noreturn)) int throw_exception();
+
+ void test() {
+ throw_exception();
+ static A r;
+ }
+}
diff --git a/test/CodeGenCXX/static-local-in-local-class.cpp b/test/CodeGenCXX/static-local-in-local-class.cpp
new file mode 100644
index 0000000..d9e044c
--- /dev/null
+++ b/test/CodeGenCXX/static-local-in-local-class.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -emit-llvm -o %t %s
+// PR6769
+
+struct X {
+ static void f();
+};
+
+void X::f() {
+ static int *i;
+ {
+ struct Y {
+ static void g() {
+ i = new int();
+ *i = 100;
+ (*i) = (*i) +1;
+ }
+ };
+ (void)Y::g();
+ }
+ (void)i;
+}
diff --git a/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp b/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp
index 921113a..41ae084 100644
--- a/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/template-anonymous-union-member-initializer.cpp
@@ -4,6 +4,7 @@ class A
{
union { void *d; };
+public:
A() : d(0) { }
};
diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp
index 416c0a1..4a38575 100644
--- a/test/CodeGenCXX/template-instantiation.cpp
+++ b/test/CodeGenCXX/template-instantiation.cpp
@@ -40,6 +40,7 @@ namespace test1 {
namespace test2 {
template<typename T1>
class C {
+ public:
virtual ~C();
void zedbar(double) {
}
diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp
index 4aad3c0..eb543cb 100644
--- a/test/CodeGenCXX/temporaries.cpp
+++ b/test/CodeGenCXX/temporaries.cpp
@@ -301,3 +301,22 @@ namespace PR6648 {
zed(foo);
}
}
+
+namespace UserConvertToValue {
+ struct X {
+ X(int);
+ X(const X&);
+ ~X();
+ };
+
+ void f(X);
+
+ // CHECK: void @_ZN18UserConvertToValue1gEv()
+ void g() {
+ // CHECK: call void @_ZN18UserConvertToValue1XC1Ei
+ // CHECK: call void @_ZN18UserConvertToValue1fENS_1XE
+ // CHECK: call void @_ZN18UserConvertToValue1XD1Ev
+ // CHECK: ret void
+ f(1);
+ }
+}
diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp
index 37891bd..35be159 100644
--- a/test/CodeGenCXX/value-init.cpp
+++ b/test/CodeGenCXX/value-init.cpp
@@ -23,3 +23,29 @@ void test_value_init() {
C c = { 17 } ;
// CHECK: call void @_ZN1CD1Ev
}
+
+enum enum_type { negative_number = -1, magic_number = 42 };
+
+class enum_holder
+{
+ enum_type m_enum;
+
+public:
+ enum_holder() : m_enum(magic_number) { }
+};
+
+struct enum_holder_and_int
+{
+ enum_holder e;
+ int i;
+};
+
+// CHECK: _Z24test_enum_holder_and_intv()
+void test_enum_holder_and_int() {
+ // CHECK: alloca
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: call void @llvm.memset
+ // CHECK-NEXT: call void @_ZN19enum_holder_and_intC1Ev
+ enum_holder_and_int();
+ // CHECK-NEXT: ret void
+}
diff --git a/test/CodeGenCXX/virt-template-vtable.cpp b/test/CodeGenCXX/virt-template-vtable.cpp
index 76a1240..b968f38 100644
--- a/test/CodeGenCXX/virt-template-vtable.cpp
+++ b/test/CodeGenCXX/virt-template-vtable.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
template<class T> class A {
+public:
A() {}
virtual void a() {}
};
diff --git a/test/CodeGenCXX/virt.cpp b/test/CodeGenCXX/virt.cpp
deleted file mode 100644
index 874ffb1..0000000
--- a/test/CodeGenCXX/virt.cpp
+++ /dev/null
@@ -1,696 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t-64.ll
-// RUN: FileCheck -check-prefix LPLL64 --input-file=%t-64.ll %s
-
-
-// CHECK-LP64: main:
-// CHECK-LP64: movl $1, 12(%rax)
-// CHECK-LP64: movl $2, 8(%rax)
-
-struct B {
- virtual void bar1();
- virtual void bar2();
- int b;
-};
-void B::bar1() { }
-void B::bar2() { }
-
-// CHECK-LPLL64:@_ZTV1B = constant [4 x i8*] [i8* null, i8* bitcast (%0* @_ZTI1B to i8*), i8* bitcast (void (%struct.B*)* @_ZN1B4bar1Ev to i8*), i8* bitcast (void (%struct.B*)* @_ZN1B4bar2Ev to i8*)]
-
-struct C {
- virtual void bee1();
- virtual void bee2();
-};
-void C::bee1() { }
-void C::bee2() { }
-
-struct D {
- virtual void boo();
-};
-void D::boo() { }
-
-struct D1 {
- virtual void bar();
- virtual void bar2();
- virtual void bar3();
- virtual void bar4();
- virtual void bar5();
- void *d1;
-};
-void D1::bar() { }
-
-class F : virtual public D1, virtual public D {
-public:
- virtual void foo();
- void *f;
-};
-void F::foo() { }
-
-// CHECK-LPLL64:@_ZTV1F = constant [19 x i8*] [i8* null, i8* inttoptr (i64 16 to i8*), i8* null, i8* null, i8* bitcast (%1* @_ZTI1F to i8*), i8* bitcast (void (%class.test14*)* @_ZN1D3booEv to i8*), i8* bitcast (void (%class.F*)* @_ZN1F3fooEv to i8*), i8* null, i8* null, i8* null, i8* null, i8* null, i8* inttoptr (i64 -16 to i8*), i8* bitcast (%1* @_ZTI1F to i8*), i8* bitcast (void (%struct.D1*)* @_ZN2D13barEv to i8*), i8* bitcast (void (%struct.D1*)* @_ZN2D14bar2Ev to i8*), i8* bitcast (void (%struct.D1*)* @_ZN2D14bar3Ev to i8*), i8* bitcast (void (%struct.D1*)* @_ZN2D14bar4Ev to i8*), i8* bitcast (void (%struct.D1*)* @_ZN2D14bar5Ev to i8*)]
-
-
-struct E {
- int e;
-};
-
-static_assert (sizeof (C) == (sizeof(void *)), "vtable pointer layout");
-
-class A : public E, public B, public C {
-public:
- virtual void foo1();
- virtual void foo2();
- A() { }
- int a;
-} *ap;
-void A::foo1() { }
-void A::foo2() { }
-
-// CHECK-LPLL64:@_ZTV1A = constant [10 x i8*] [i8* null, i8* bitcast (%2* @_ZTI1A to i8*), i8* bitcast (void (%struct.B*)* @_ZN1B4bar1Ev to i8*), i8* bitcast (void (%struct.B*)* @_ZN1B4bar2Ev to i8*), i8* bitcast (void (%class.A*)* @_ZN1A4foo1Ev to i8*), i8* bitcast (void (%class.A*)* @_ZN1A4foo2Ev to i8*), i8* inttoptr (i64 -16 to i8*), i8* bitcast (%2* @_ZTI1A to i8*), i8* bitcast (void (%class.test14*)* @_ZN1C4bee1Ev to i8*), i8* bitcast (void (%class.test14*)* @_ZN1C4bee2Ev to i8*)]
-
-int main() {
- A a;
- B b;
- ap->e = 1;
- ap->b = 2;
-}
-
-
-struct test12_A {
- virtual void foo0() { }
- virtual void foo();
-} *test12_pa;
-
-struct test12_B : public test12_A {
- virtual void foo() { }
-} *test12_pb;
-
-struct test12_D : public test12_B {
-} *test12_pd;
-
-
-struct test6_B2 { virtual void funcB2(); char b[1000]; };
-struct test6_B1 : virtual test6_B2 { virtual void funcB1(); };
-
-struct test6_D : test6_B2, virtual test6_B1 {
-};
-
-// CHECK-LP64: .zerofill __DATA,__common,_d6,2024,4
-
-struct test7_B2 { virtual void funcB2(); };
-struct test7_B1 : virtual test7_B2 { virtual void funcB1(); };
-
-struct test7_D : test7_B2, virtual test7_B1 {
-};
-
-// FIXME: we were checking for an alignment of 3 (?)
-// CHECK-LP64: .zerofill __DATA,__common,_d7,16,
-
-
-struct test3_B3 { virtual void funcB3(); };
-struct test3_B2 : virtual test3_B3 { virtual void funcB2(); };
-struct test3_B1 : virtual test3_B2 { virtual void funcB1(); };
-
-struct test3_D : virtual test3_B1 {
- virtual void funcD() { }
-};
-
-// CHECK-LPLL64:@_ZTV7test3_D = weak_odr constant [12 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* bitcast (%3* @_ZTI7test3_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test3_B36funcB3Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test3_B26funcB2Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test3_B16funcB1Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN7test3_D5funcDEv to i8*)]
-
-
-struct test4_D : virtual B, virtual C {
-};
-
-// CHECK-LPLL64:@_ZTV7test4_D = weak_odr constant [14 x i8*] [i8* null, i8* inttoptr (i64 8 to i8*), i8* null, i8* null, i8* null, i8* bitcast (%1* @_ZTI7test4_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN1C4bee1Ev to i8*), i8* bitcast (void (%class.test14*)* @_ZN1C4bee2Ev to i8*), i8* null, i8* null, i8* inttoptr (i64 -8 to i8*), i8* bitcast (%1* @_ZTI7test4_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN1B4bar1Ev to i8*), i8* bitcast (void (%struct.B*)* @_ZN1B4bar2Ev to i8*)]
-
-
-struct test5_B3 { virtual void funcB3(); };
-struct test5_B2 : virtual test5_B3 { virtual void funcB2(); };
-struct test5_B1 : virtual test5_B2 { virtual void funcB1(); };
-
-struct test5_B23 { virtual void funcB23(); };
-struct test5_B22 : virtual test5_B23 { virtual void funcB22(); };
-struct test5_B21 : virtual test5_B22 { virtual void funcB21(); };
-
-
-struct B232 { virtual void funcB232(); };
-struct B231 { virtual void funcB231(); };
-
-struct test5_B33 { virtual void funcB33(); };
-struct test5_B32 : virtual test5_B33, virtual B232 { virtual void funcB32(); };
-struct test5_B31 : virtual test5_B32, virtual B231 { virtual void funcB31(); };
-
-struct test5_D : virtual test5_B1, virtual test5_B21, virtual test5_B31 {
- virtual void funcD() { }
-};
-
-// CHECK-LPLL64:@_ZTV7test5_D = weak_odr constant [50 x i8*] [i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 24 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 8 to i8*), i8* inttoptr (i64 8 to i8*), i8* inttoptr (i64 8 to i8*), i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* bitcast (%2* @_ZTI7test5_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test5_B36funcB3Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test5_B26funcB2Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test5_B16funcB1Ev to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN7test5_D5funcDEv to i8*), i8* null, i8* null, i8* null, i8* null, i8* null, i8* inttoptr (i64 -8 to i8*), i8* bitcast (%2* @_ZTI7test5_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test5_B237funcB23Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test5_B227funcB22Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test5_B217funcB21Ev to i8*), i8* null, i8* inttoptr (i64 16 to i8*), i8* null, i8* null, i8* inttoptr (i64 8 to i8*), i8* null, i8* null, i8* inttoptr (i64 -16 to i8*), i8* bitcast (%2* @_ZTI7test5_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test5_B337funcB33Ev to i8*), i8* bitcast (void (%class.test20_D*)* @_ZN9test5_B327funcB32Ev to i8*), i8* bitcast (void (%class.test23_D*)* @_ZN9test5_B317funcB31Ev to i8*), i8* null, i8* inttoptr (i64 -24 to i8*), i8* bitcast (%2* @_ZTI7test5_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN4B2328funcB232Ev to i8*), i8* null, i8* inttoptr (i64 -32 to i8*), i8* bitcast (%2* @_ZTI7test5_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN4B2318funcB231Ev to i8*)]
-
-struct test8_B1 {
- virtual void ftest8_B1() { }
-};
-struct test8_B2aa {
- virtual void ftest8_B2aa() { }
- int i;
-};
-struct test8_B2ab {
- virtual void ftest8_B2ab() { }
- int i;
-};
-struct test8_B2a : virtual test8_B2aa, virtual test8_B2ab {
- virtual void ftest8_B2a() { }
-};
-struct test8_B2b {
- virtual void ftest8_B2b() { }
-};
-struct test8_B2 : test8_B2a, test8_B2b {
- virtual void ftest8_B2() { }
-};
-struct test8_B3 {
- virtual void ftest8_B3() { }
-};
-class test8_D : test8_B1, test8_B2, test8_B3 {
-};
-
-// CHECK-LPLL64:@_ZTV7test8_D = weak_odr constant [25 x i8*] [i8* inttoptr (i64 48 to i8*), i8* inttoptr (i64 32 to i8*), i8* null, i8* bitcast (%2* @_ZTI7test8_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test8_B19ftest8_B1Ev to i8*), i8* inttoptr (i64 40 to i8*), i8* inttoptr (i64 24 to i8*), i8* inttoptr (i64 -8 to i8*), i8* bitcast (%2* @_ZTI7test8_D to i8*), i8* bitcast (void (%struct.test10_B2a*)* @_ZN9test8_B2a10ftest8_B2aEv to i8*), i8* bitcast (void (%struct.test15_D*)* @_ZN8test8_B29ftest8_B2Ev to i8*), i8* inttoptr (i64 -16 to i8*), i8* bitcast (%2* @_ZTI7test8_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test8_B2b10ftest8_B2bEv to i8*), i8* inttoptr (i64 -24 to i8*), i8* bitcast (%2* @_ZTI7test8_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test8_B39ftest8_B3Ev to i8*), i8* null, i8* inttoptr (i64 -32 to i8*), i8* bitcast (%2* @_ZTI7test8_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test8_B2aa11ftest8_B2aaEv to i8*), i8* null, i8* inttoptr (i64 -48 to i8*), i8* bitcast (%2* @_ZTI7test8_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test8_B2ab11ftest8_B2abEv to i8*)]
-
-// CHECK-LPLL64:@_ZTC7test8_D8_8test8_B2 = internal constant [14 x i8*] [i8* inttoptr (i64 40 to i8*), i8* inttoptr (i64 24 to i8*), i8* null, i8* bitcast (%1* @_ZTI8test8_B2 to i8*), i8* bitcast (void (%struct.test10_B2a*)* @_ZN9test8_B2a10ftest8_B2aEv to i8*), i8* bitcast (void (%struct.test15_D*)* @_ZN8test8_B29ftest8_B2Ev to i8*), i8* null, i8* inttoptr (i64 -24 to i8*), i8* bitcast (%1* @_ZTI8test8_B2 to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test8_B2aa11ftest8_B2aaEv to i8*), i8* null, i8* inttoptr (i64 -40 to i8*), i8* bitcast (%1* @_ZTI8test8_B2 to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test8_B2ab11ftest8_B2abEv to i8*)] ; <[14 x i8*]*> [#uses=3]
-
-// CHECK-LPLL64:@_ZTC7test8_D8_9test8_B2a = internal constant [13 x i8*] [i8* inttoptr (i64 40 to i8*), i8* inttoptr (i64 24 to i8*), i8* null, i8* bitcast (%1* @_ZTI9test8_B2a to i8*), i8* bitcast (void (%struct.test10_B2a*)* @_ZN9test8_B2a10ftest8_B2aEv to i8*), i8* null, i8* inttoptr (i64 -24 to i8*), i8* bitcast (%1* @_ZTI9test8_B2a to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test8_B2aa11ftest8_B2aaEv to i8*), i8* null, i8* inttoptr (i64 -40 to i8*), i8* bitcast (%1* @_ZTI9test8_B2a to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test8_B2ab11ftest8_B2abEv to i8*)] ; <[13 x i8*]*> [#uses=3]
-
-// CHECK-LPLL64:@_ZTT7test8_D = weak_odr constant [10 x i8*] [i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTV7test8_D, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTC7test8_D8_8test8_B2, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([13 x i8*]* @_ZTC7test8_D8_9test8_B2a, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([13 x i8*]* @_ZTC7test8_D8_9test8_B2a, i64 0, i64 8) to i8*), i8* bitcast (i8** getelementptr inbounds ([13 x i8*]* @_ZTC7test8_D8_9test8_B2a, i64 0, i64 12) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTC7test8_D8_8test8_B2, i64 0, i64 9) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTC7test8_D8_8test8_B2, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTV7test8_D, i64 0, i64 9) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTV7test8_D, i64 0, i64 20) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTV7test8_D, i64 0, i64 24) to i8*)]
-
-
-struct test9_B3 { virtual void funcB3(); int i; };
-struct test9_B2 : virtual test9_B3 { virtual void funcB2(); int i; };
-struct test9_B1 : virtual test9_B2 { virtual void funcB1(); int i; };
-
-struct test9_B23 { virtual void funcB23(); int i; };
-struct test9_B22 : virtual test9_B23 { virtual void funcB22(); int i; };
-struct test9_B21 : virtual test9_B22 { virtual void funcB21(); int i; };
-
-
-struct test9_B232 { virtual void funcB232(); int i; };
-struct test9_B231 { virtual void funcB231(); int i; };
-
-struct test9_B33 { virtual void funcB33(); int i; };
-struct test9_B32 : virtual test9_B33, virtual test9_B232 { virtual void funcB32(); int i; };
-struct test9_B31 : virtual test9_B32, virtual test9_B231 { virtual void funcB31(); int i; };
-
-struct test9_D : virtual test9_B1, virtual test9_B21, virtual test9_B31 {
- virtual void funcD() { }
-};
-
-// CHECK-LPLL64:@_ZTV7test9_D = weak_odr constant [70 x i8*] [i8* inttoptr (i64 168 to i8*), i8* inttoptr (i64 152 to i8*), i8* inttoptr (i64 136 to i8*), i8* inttoptr (i64 120 to i8*), i8* inttoptr (i64 104 to i8*), i8* inttoptr (i64 88 to i8*), i8* inttoptr (i64 72 to i8*), i8* inttoptr (i64 56 to i8*), i8* inttoptr (i64 40 to i8*), i8* inttoptr (i64 24 to i8*), i8* inttoptr (i64 8 to i8*), i8* null, i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test9_D*)* @_ZN7test9_D5funcDEv to i8*), i8* null, i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -8 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test9_B1*)* @_ZN8test9_B16funcB1Ev to i8*), i8* null, i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -24 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZN8test9_B26funcB2Ev to i8*), i8* null, i8* inttoptr (i64 -40 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN8test9_B36funcB3Ev to i8*), i8* null, i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -56 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test9_B1*)* @_ZN9test9_B217funcB21Ev to i8*), i8* null, i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -72 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZN9test9_B227funcB22Ev to i8*), i8* null, i8* inttoptr (i64 -88 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN9test9_B237funcB23Ev to i8*), i8* null, i8* inttoptr (i64 64 to i8*), i8* inttoptr (i64 48 to i8*), i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -104 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test9_B31*)* @_ZN9test9_B317funcB31Ev to i8*), i8* null, i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -120 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.test9_B1*)* @_ZN9test9_B327funcB32Ev to i8*), i8* null, i8* inttoptr (i64 -136 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN9test9_B337funcB33Ev to i8*), i8* null, i8* inttoptr (i64 -152 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test9_B2328funcB232Ev to i8*), i8* null, i8* inttoptr (i64 -168 to i8*), i8* bitcast (%2* @_ZTI7test9_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test9_B2318funcB231Ev to i8*)] ; <[70 x i8*]*> [#uses=12]
-
-
-struct test10_O { int i; };
-
-struct test10_B1 : virtual test10_O {
- virtual void ftest10_B1() { }
-};
-
-struct test10_B2aa : virtual test10_O {
- int i;
-};
-struct test10_B2ab : virtual test10_O {
- int i;
-};
-struct test10_B2a : virtual test10_B2aa, virtual test10_B2ab,virtual test10_O {
- virtual void ftest10_B2a() { }
-};
-struct test10_B2b : virtual test10_O {
- virtual void ftest10_B2b() { }
-};
-struct test10_B2 : test10_B2a {
- virtual void ftest10_B2() { }
-};
-class test10_D : test10_B1, test10_B2 {
-
- void ftest10_B2aa() { }
-};
-
-// CHECK-LPLL64:@_ZTV8test10_D = weak_odr constant [19 x i8*] [i8* inttoptr (i64 40 to i8*), i8* inttoptr (i64 24 to i8*), i8* inttoptr (i64 16 to i8*), i8* null, i8* bitcast (%1* @_ZTI8test10_D to i8*), i8* bitcast (void (%struct.test10_B1*)* @_ZN9test10_B110ftest10_B1Ev to i8*), i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 8 to i8*), i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -8 to i8*), i8* bitcast (%1* @_ZTI8test10_D to i8*), i8* bitcast (void (%struct.test10_B2a*)* @_ZN10test10_B2a11ftest10_B2aEv to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN9test10_B210ftest10_B2Ev to i8*), i8* inttoptr (i64 -8 to i8*), i8* inttoptr (i64 -24 to i8*), i8* bitcast (%1* @_ZTI8test10_D to i8*), i8* inttoptr (i64 -24 to i8*), i8* inttoptr (i64 -40 to i8*), i8* bitcast (%1* @_ZTI8test10_D to i8*)] ; <[19 x i8*]*> [#uses=4]
-
-
-struct test11_B {
- virtual void B1() { }
- virtual void D() { }
- virtual void B2() { }
-};
-
-struct test11_D : test11_B {
- virtual void D1() { }
- virtual void D() { }
- virtual void D2() { }
-};
-
-// CHECK-LPLL64:@_ZTV8test11_D = weak_odr constant [7 x i8*] [i8* null, i8* bitcast (%4* @_ZTI8test11_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test11_B2B1Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test11_D1DEv to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test11_B2B2Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test11_D2D1Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test11_D2D2Ev to i8*)]
-
-
-struct test13_B {
- virtual void B1() { }
- virtual void D() { }
- virtual void Da();
- virtual void Db() { }
- virtual void Dc() { }
- virtual void B2() { }
- int i;
-};
-
-
-struct test13_NV1 {
- virtual void fooNV1() { }
- virtual void D() { }
-};
-
-
-struct test13_B2 : /* test13_NV1, */ virtual test13_B {
- virtual void B2a() { }
- virtual void B2() { }
- virtual void D() { }
- virtual void Da();
- virtual void Dd() { }
- virtual void B2b() { }
- int i;
-};
-
-
-struct test13_D : test13_NV1, virtual test13_B2 {
- virtual void D1() { }
- virtual void D() { }
- virtual void Db() { }
- virtual void Dd() { }
- virtual void D2() { }
- virtual void fooNV1() { }
-};
-
-// CHECK-LPLL64:@_ZTV8test13_D = weak_odr constant [39 x i8*] [i8* inttoptr (i64 24 to i8*), i8* inttoptr (i64 8 to i8*), i8* null, i8* bitcast (%1* @_ZTI8test13_D to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN8test13_D6fooNV1Ev to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN8test13_D1DEv to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN8test13_D2D1Ev to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN8test13_D2DbEv to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN8test13_D2DdEv to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZN8test13_D2D2Ev to i8*), i8* null, i8* inttoptr (i64 -8 to i8*), i8* null, i8* inttoptr (i64 -8 to i8*), i8* null, i8* null, i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -8 to i8*), i8* bitcast (%1* @_ZTI8test13_D to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZN9test13_B23B2aEv to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZN9test13_B22B2Ev to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZTv0_n48_N8test13_D1DEv to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZN9test13_B22DaEv to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZTv0_n64_N8test13_D2DdEv to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZN9test13_B23B2bEv to i8*), i8* inttoptr (i64 -16 to i8*), i8* null, i8* inttoptr (i64 -24 to i8*), i8* inttoptr (i64 -16 to i8*), i8* inttoptr (i64 -24 to i8*), i8* null, i8* inttoptr (i64 -24 to i8*), i8* bitcast (%1* @_ZTI8test13_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN8test13_B2B1Ev to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZTv0_n32_N8test13_D1DEv to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZTv0_n40_N9test13_B22DaEv to i8*), i8* bitcast (void (%struct.test10_B2*)* @_ZTv0_n48_N8test13_D2DbEv to i8*), i8* bitcast (void (%struct.B*)* @_ZN8test13_B2DcEv to i8*), i8* bitcast (void (%struct.test13_B2*)* @_ZTv0_n64_N9test13_B22B2Ev to i8*)]
-
-
-class test14 {
-public:
- virtual void initWithInt(int a);
- static test14 *withInt(int a);
-};
-
-void test14::initWithInt(int a) { }
-
-test14 *test14::withInt(int a) {
- test14 *me = new test14;
- me->initWithInt(a);
- return me;
-}
-
-
-struct test15_B {
- virtual test15_B *foo1() { return 0; }
- virtual test15_B *foo2() { return 0; }
- virtual test15_B *foo3() { return 0; }
- int i;
-};
-
-struct test15_NV1 {
- virtual void fooNV1() { }
- int i;
-};
-
-struct test15_B2 : test15_NV1, virtual test15_B {
- virtual test15_B2 *foo1() { return 0; }
- virtual test15_B2 *foo2() { return 0; }
- int i;
-};
-
-struct test15_D : test15_NV1, virtual test15_B2 {
- virtual test15_D *foo1() { return 0; }
-};
-
-// CHECK-LPLL64:@_ZTV8test15_D = weak_odr constant [23 x i8*] [i8* inttoptr (i64 32 to i8*), i8* inttoptr (i64 16 to i8*), i8* null, i8* bitcast (%1* @_ZTI8test15_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test15_NV16fooNV1Ev to i8*), i8* bitcast (%struct.test15_D* (%struct.test15_D*)* @_ZN8test15_D4foo1Ev to i8*), i8* null, i8* inttoptr (i64 -16 to i8*), i8* null, i8* inttoptr (i64 16 to i8*), i8* inttoptr (i64 -16 to i8*), i8* bitcast (%1* @_ZTI8test15_D to i8*), i8* bitcast (void (%struct.B*)* @_ZN10test15_NV16fooNV1Ev to i8*), i8* bitcast (%struct.test15_D* (%struct.test15_D*)* @_ZTcv0_n40_v0_n24_N8test15_D4foo1Ev to i8*), i8* bitcast (%struct.test15_B2* (%struct.test15_B2*)* @_ZN9test15_B24foo2Ev to i8*), i8* null, i8* inttoptr (i64 -16 to i8*), i8* inttoptr (i64 -32 to i8*), i8* inttoptr (i64 -32 to i8*), i8* bitcast (%1* @_ZTI8test15_D to i8*), i8* bitcast (%struct.test15_D* (%struct.test15_D*)* @_ZTcv0_n24_v0_n32_N8test15_D4foo1Ev to i8*), i8* bitcast (%struct.test15_B2* (%struct.test15_B2*)* @_ZTcv0_n32_v0_n24_N9test15_B24foo2Ev to i8*), i8* bitcast (%struct.B* (%struct.B*)* @_ZN8test15_B4foo3Ev to i8*)]
-
-
-struct test16_NV1 {
- virtual void fooNV1() { }
-virtual void foo_NV1() { }
- int i;
-};
-
-struct test16_NV2 {
- virtual test16_NV2* foo1() { return 0; }
-virtual void foo_NV2() { }
-virtual void foo_NV2b() { }
- int i;
-};
-
-struct test16_B : public test16_NV1, test16_NV2 {
- virtual test16_B *foo1() { return 0; }
- virtual test16_B *foo2() { return 0; }
- virtual test16_B *foo3() { return 0; }
-virtual void foo_B() { }
- int i;
-};
-
-struct test16_B2 : test16_NV1, virtual test16_B {
- virtual test16_B2 *foo1() { return 0; }
- virtual test16_B2 *foo2() { return 0; }
-virtual void foo_B2() { }
- int i;
-};
-
-struct test16_D : test16_NV1, virtual test16_B2 {
- virtual void bar() { }
- virtual test16_D *foo1() { return 0; }
-};
-
-// FIXME:
-// CHECK-LP64: __ZTV8test16_D:
-// CHECK-LP64-NEXT: .quad 32
-// CHECK-LP64-NEXT: .quad 16
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad __ZTI8test16_D
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV16fooNV1Ev
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV17foo_NV1Ev
-// CHECK-LP64-NEXT: .quad __ZN8test16_D3barEv
-// CHECK-LP64-NEXT: .quad __ZN8test16_D4foo1Ev
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad -16
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 16
-// CHECK-LP64-NEXT: .quad -16
-// CHECK-LP64-NEXT: .quad __ZTI8test16_D
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV16fooNV1Ev
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV17foo_NV1Ev
-// CHECK-LP64-NEXT: .quad __ZTcv0_n48_v0_n24_N8test16_D4foo1Ev
-// CHECK-LP64-NEXT: .quad __ZN9test16_B24foo2Ev
-// CHECK-LP64-NEXT: .quad __ZN9test16_B26foo_B2Ev
-// CHECK-LP64-NEXT: .quad 16
-// CHECK-LP64-NEXT: .quad 16
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad -16
-// CHECK-LP64-NEXT: .quad -32
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad -32
-// CHECK-LP64-NEXT: .quad __ZTI8test16_D
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV16fooNV1Ev
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV17foo_NV1Ev
-// CHECK-LP64-NEXT: .quad __ZTcv0_n40_v0_n32_N8test16_D4foo1Ev
-// CHECK-LP64-NEXT: .quad __ZTcv0_n48_v0_n24_N9test16_B24foo2Ev
-// CHECK-LP64-NEXT: .quad __ZN8test16_B4foo3Ev
-// CHECK-LP64-NEXT: .quad __ZN8test16_B5foo_BEv
-// CHECK-LP64-NEXT: .quad -48
-// CHECK-LP64-NEXT: .quad __ZTI8test16_D
-// CHECK-LP64-NEXT: .quad __ZTcvn16_n40_v16_n32_N8test16_D4foo1Ev
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV27foo_NV2Ev
-// CHECK-LP64-NEXT: .quad __ZN10test16_NV28foo_NV2bEv
-
-
-
-
-class test17_B1 {
- virtual void foo() = 0;
- virtual void bar() { }
-};
-
-class test17_B2 : public test17_B1 {
- void foo() { }
- virtual void bar() = 0;
-};
-
-class test17_D : public test17_B2 {
- void bar() { }
-};
-
-
-// CHECK-LPLL64:@_ZTV8test17_D = weak_odr constant [4 x i8*] [i8* null, i8* bitcast (%4* @_ZTI8test17_D to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test17_B23fooEv to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN8test17_D3barEv to i8*)]
-
-// CHECK-LPLL64:@_ZTV9test17_B2 = weak_odr constant [4 x i8*] [i8* null, i8* bitcast (%4* @_ZTI9test17_B2 to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test17_B23fooEv to i8*), i8* bitcast (void ()* @__cxa_pure_virtual to i8*)]
-
-// CHECK-LPLL64:@_ZTV9test17_B1 = weak_odr constant [4 x i8*] [i8* null, i8* bitcast (%0* @_ZTI9test17_B1 to i8*), i8* bitcast (void ()* @__cxa_pure_virtual to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test17_B13barEv to i8*)]
-
-
-struct test18_NV1 {
- virtual void fooNV1() { }
-virtual void foo_NV1() { }
- int i;
-};
-
-struct test18_NV2 {
- virtual test18_NV2& foo1() { return *this; }
-virtual void foo_NV2() { }
-virtual void foo_NV2b() { }
- int i;
-};
-
-struct test18_B : public test18_NV1, test18_NV2 {
- virtual test18_B& foo1() { return *this; }
- virtual test18_B *foo2() { return 0; }
- virtual test18_B *foo3() { return 0; }
-virtual void foo_B() { }
- int i;
-};
-
-struct test18_B2 : test18_NV1, virtual test18_B {
- virtual test18_B2& foo1() { return *this; }
- virtual test18_B2 *foo2() { return 0; }
-virtual void foo_B2() { }
- int i;
-};
-
-struct test18_D : test18_NV1, virtual test18_B2 {
- virtual test18_D& foo1() { return *this; }
-};
-
-
-struct test19_VB1 { };
-struct test19_B1 : public virtual test19_VB1 {
- virtual void fB1() { }
- virtual void foB1B2() { }
- virtual void foB1B3() { }
- virtual void foB1B4() { }
-};
-
-struct test19_VB2 { };
-struct test19_B2: public test19_B1, public virtual test19_VB2 {
- virtual void foB1B2() { }
- virtual void foB1B3() { }
- virtual void foB1B4() { }
-
- virtual void fB2() { }
- virtual void foB2B3() { }
- virtual void foB2B4() { }
-};
-
-struct test19_VB3 { };
-struct test19_B3: virtual public test19_B2, public virtual test19_VB3 {
- virtual void foB1B3() { }
- virtual void foB1B4() { }
-
- virtual void foB2B3() { }
- virtual void foB2B4() { }
-
- virtual void fB3() { }
- virtual void foB3B4() { }
-};
-
-struct test19_VB4 { };
-struct test19_B4: public test19_B3, public virtual test19_VB4 {
- virtual void foB1B4() { }
-
- virtual void foB2B4() { }
-
- virtual void foB3B4() { }
-
- virtual void fB4() { }
-};
-
-struct test19_D : virtual test19_B4 {
-};
-
-
-// CHECK-LPLL64:@_ZTV8test19_D = weak_odr constant [28 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* bitcast (%3* @_ZTI8test19_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test19_B13fB1Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B26foB1B2Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B36foB1B3Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B46foB1B4Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B23fB2Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B36foB2B3Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B46foB2B4Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B33fB3Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B46foB3B4Ev to i8*), i8* bitcast (void (%class.test17_B2*)* @_ZN9test19_B43fB4Ev to i8*)]
-
-// FIXME:
-// CHECK-LP64: __ZTT8test19_D:
-// CHECK-LP64-NEXT: .quad __ZTV8test19_D+144
-// CHECK-LP64-NEXT: .quad __ZTV8test19_D+144
-// CHECK-LP64-NEXT .quad __ZTV8test19_D+144
-// CHECK-LP64-NEXT .quad __ZTC8test19_D0_9test19_B4+136
-// CHECK-LP64-NEXT .quad __ZTC8test19_D0_9test19_B3+104
-// CHECK-LP64-NEXT .quad __ZTC8test19_D0_9test19_B3+104
-// CHECK-LP64-NEXT .quad __ZTC8test19_D0_9test19_B4+136
-// CHECK-LP64-NEXT .quad __ZTC8test19_D0_9test19_B2+88
-// CHECK-LP64-NEXT .quad __ZTC8test19_D0_9test19_B1+24
-
-class test20_V {
- virtual void foo1();
-};
-class test20_V1 {
- virtual void foo2();
-};
-class test20_B : virtual test20_V {
-} b;
-class test20_B1 : virtual test20_V1 {
-};
-class test20_D : public test20_B, public test20_B1 {
-};
-
-// CHECK-LPLL64:@_ZTV8test20_D = weak_odr constant [11 x i8*] [i8* inttoptr (i64 8 to i8*), i8* null, i8* null, i8* null, i8* bitcast (%1* @_ZTI8test20_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test20_V4foo1Ev to i8*), i8* null, i8* null, i8* inttoptr (i64 -8 to i8*), i8* bitcast (%1* @_ZTI8test20_D to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test20_V14foo2Ev to i8*)]
-
-// CHECK-LPLL64:@_ZTC8test20_D0_8test20_B = internal constant [5 x i8*] [i8* null, i8* null, i8* null, i8* bitcast (%3* @_ZTI8test20_B to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test20_V4foo1Ev to i8*)]
-
-// CHECK-LPLL64:@_ZTC8test20_D8_9test20_B1 = internal constant [5 x i8*] [i8* null, i8* null, i8* null, i8* bitcast (%3* @_ZTI9test20_B1 to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test20_V14foo2Ev to i8*)] ; <[5 x i8*]*> [#uses=1]
-
-// FIXME:
-// CHECK-LP64: __ZTT8test20_D:
-// CHECK-LP64-NEXT: .quad __ZTV8test20_D+40
-// CHECK-LP64-NEXT: .quad __ZTC8test20_D0_8test20_B+32
-// CHECK-LP64-NEXT: .quad __ZTC8test20_D0_8test20_B+32
-// CHECK-LP64-NEXT: .quad __ZTC8test20_D8_9test20_B1+32
-// CHECK-LP64-NEXT: .quad __ZTC8test20_D8_9test20_B1+32
-// CHECK-LP64-NEXT .quad __ZTV8test20_D+40
-// CHECK-LP64-NEXT .quad __ZTV8test20_D+80
-// CHECK-LP64-NEXT .quad __ZTV8test20_D+80
-
-
-class test21_V {
- virtual void foo() { }
-};
-class test21_V1 {
- virtual void foo() { }
-};
-class test21_B : virtual test21_V {
-};
-class test21_B1 : virtual test21_V1 {
-};
-class test21_D : public test21_B, public test21_B1 {
- void foo() { }
-};
-
-// CHECK-LPLL64:@_ZTV8test21_D = weak_odr constant [11 x i8*] [i8* inttoptr (i64 8 to i8*), i8* null, i8* null, i8* null, i8* bitcast (%1* @_ZTI8test21_D to i8*), i8* bitcast (void (%class.test20_D*)* @_ZN8test21_D3fooEv to i8*), i8* null, i8* inttoptr (i64 -8 to i8*), i8* inttoptr (i64 -8 to i8*), i8* bitcast (%1* @_ZTI8test21_D to i8*), i8* bitcast (void (%class.test20_D*)* @_ZTv0_n24_N8test21_D3fooEv to i8*)]
-
-// CHECK-LPLL64:@_ZTC8test21_D0_8test21_B = internal constant [5 x i8*] [i8* null, i8* null, i8* null, i8* bitcast (%3* @_ZTI8test21_B to i8*), i8* bitcast (void (%class.test14*)* @_ZN8test21_V3fooEv to i8*)]
-
-// CHECK-LPLL64:@_ZTC8test21_D8_9test21_B1 = internal constant [5 x i8*] [i8* null, i8* null, i8* null, i8* bitcast (%3* @_ZTI9test21_B1 to i8*), i8* bitcast (void (%class.test14*)* @_ZN9test21_V13fooEv to i8*)] ; <[5 x i8*]*> [#uses=1]
-
-// FIXME:
-// CHECK-LP64: __ZTT8test21_D:
-// CHECK-LP64-NEXT: .quad __ZTV8test21_D+40
-// CHECK-LP64-NEXT: .quad __ZTC8test21_D0_8test21_B+32
-// CHECK-LP64-NEXT: .quad __ZTC8test21_D0_8test21_B+32
-// CHECK-LP64-NEXT: .quad __ZTC8test21_D8_9test21_B1+32
-// CHECK-LP64-NEXT: .quad __ZTC8test21_D8_9test21_B1+32
-// CHECK-LP64-NEXT .quad __ZTV8test21_D+40
-// CHECK-LP64-NEXT .quad __ZTV8test21_D+80
-// CHECK-LP64-NEXT .quad __ZTV8test21_D+80
-
-
-struct test22_s1 { virtual void dtor() { } };
-struct test22_s2 { virtual void dtor() { } };
-struct test22_s3 : test22_s1, test22_s2 { virtual void dtor() { } };
-struct test22_D : test22_s3 { virtual void dtor() { } };
-
-// CHECK-LPLL64:@_ZTV8test22_D = weak_odr constant [6 x i8*] [i8* null, i8* bitcast (%4* @_ZTI8test22_D to i8*), i8* bitcast (void (%class.test20_D*)* @_ZN8test22_D4dtorEv to i8*), i8* inttoptr (i64 -8 to i8*), i8* bitcast (%4* @_ZTI8test22_D to i8*), i8* bitcast (void (%class.test20_D*)* @_ZThn8_N8test22_D4dtorEv to i8*)]
-
-
-class test23_s1 {
- virtual void fun1(char *t) { }
-};
-class test23_s2 {
- virtual void fun2(char *t) { }
-};
-class test23_s3 {
- virtual void fun3(char *t) { }
-};
-class test23_s4: virtual test23_s1, test23_s2, test23_s3 {
- virtual void fun4(char *t) { }
-};
-class test23_D: virtual test23_s4 {
- virtual void fun5(char *t) { }
-};
-
-
-// FIXME:
-// CHECK-LP64: __ZTV8test23_D:
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 8
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64-NEXT: .quad __ZTI8test23_D
-// CHECK-LP64-NEXT: .quad __ZN9test23_s14fun1EPc
-// CHECK-LP64-NEXT: .quad __ZN8test23_D4fun5EPc
-// CHECK-LP64-NEXT .quad 8
-// CHECK-LP64: .quad 0
-// CHECK-LP64-NEXT: .quad 0
-// CHECK-LP64: .quad -8
-// CHECK-LP64-NEXT: .quad -8
-// CHECK-LP64-NEXT: .quad __ZTI8test23_D
-// CHECK-LP64-NEXT: .quad __ZN9test23_s24fun2EPc
-// CHECK-LP64-NEXT: .quad __ZN9test23_s44fun4EPc
-// CHECK-LP64-NEXT: .quad -16
-// CHECK-LP64-NEXT: .quad __ZTI8test23_D
-// CHECK-LP64-NEXT: .quad __ZN9test23_s34fun3EPc
-
-
-test23_D d23;
-test22_D d22;
-test21_D d21;
-test20_D d20;
-test19_D d19;
-test18_D d18;
-test17_D d17;
-test16_D d16;
-test15_D d15;
-test13_D d13;
-test11_D d11;
-test10_D d10;
-test9_D d9;
-test8_D d8;
-
-test5_D d5;
-test4_D d4;
-test3_D d3;
-
-test6_D d6;
-test7_D d7;
-
-
-int j;
-void *vp;
-void test2() {
- F f;
- static int sz = (char *)(&f.f) - (char *)(&f);
- vp = &sz;
- j = sz;
- // FIXME: These should result in a frontend constant a la fold, no run time
- // initializer
- // CHECK-LPLL64: define void @_Z5test2v()
- // CHECK-LPLL64: = getelementptr inbounds %class.F* %f, i32 0, i32 1
-}
-
-static_assert(sizeof(F) == sizeof(void*)*4, "invalid vbase size");
-
-
-void test12_foo() {
- test12_pa->foo0();
- test12_pb->foo0();
- test12_pd->foo0();
- test12_pa->foo();
- test12_pb->foo();
- test12_pd->foo();
- test12_pa->test12_A::foo();
-}
-
-
-// CHECK-LPLL64:define void @_Z10test12_foov() nounwind {
-// CHECK-LPLL64: call void %
-// CHECK-LPLL64: call void %
-// CHECK-LPLL64: call void %
-// CHECK-LPLL64: call void %
-// CHECK-LPLL64: call void %
-// CHECK-LPLL64: call void %
-// CHECK-LPLL64: call void @_ZN8test12_A3fooEv(%class.test14* %{{.*}})
-
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index 3a0dae4..f2f5179 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -1303,3 +1303,337 @@ struct B : virtual A {
V2 *B::f() { return 0; }
}
+
+namespace Test30 {
+
+// Test that we don't assert when generating a vtable for F.
+struct A { };
+
+struct B : virtual A {
+ int i;
+};
+
+struct C {
+ virtual void f();
+};
+
+struct D : virtual C, B { };
+struct E : virtual D { };
+
+struct F : E {
+ virtual void f();
+};
+void F::f() { }
+
+}
+
+namespace Test31 {
+
+// Test that we don't add D::f twice to the primary vtable.
+struct A {
+ int a;
+};
+
+struct B {
+ virtual void f();
+};
+
+struct C : A, virtual B {
+ virtual void f();
+};
+
+// CHECK: Vtable for 'Test31::D' (11 entries).
+// CHECK-NEXT: 0 | vbase_offset (0)
+// CHECK-NEXT: 1 | vbase_offset (8)
+// CHECK-NEXT: 2 | vcall_offset (0)
+// CHECK-NEXT: 3 | offset_to_top (0)
+// CHECK-NEXT: 4 | Test31::D RTTI
+// CHECK-NEXT: -- (Test31::B, 0) vtable address --
+// CHECK-NEXT: -- (Test31::D, 0) vtable address --
+// CHECK-NEXT: 5 | void Test31::D::f()
+// CHECK-NEXT: 6 | vbase_offset (-8)
+// CHECK-NEXT: 7 | vcall_offset (-8)
+// CHECK-NEXT: 8 | offset_to_top (-8)
+// CHECK-NEXT: 9 | Test31::D RTTI
+// CHECK-NEXT: -- (Test31::C, 8) vtable address --
+// CHECK-NEXT: 10 | void Test31::D::f()
+// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+struct D : virtual C {
+ virtual void f();
+};
+void D::f() { }
+
+}
+
+namespace Test32 {
+
+// Check that we correctly lay out the virtual bases of 'Test32::D'.
+
+struct A {
+ virtual void f();
+};
+
+struct B : virtual A { };
+struct C : A, virtual B { };
+struct D : virtual B { };
+
+// CHECK: Virtual base offset offsets for 'Test32::E' (3 entries).
+// CHECK-NEXT: Test32::A | -32
+// CHECK-NEXT: Test32::B | -24
+// CHECK-NEXT: Test32::D | -40
+struct E : C, virtual D {
+ virtual void f();
+};
+void E::f() { }
+
+}
+
+namespace Test33 {
+
+// Test that we don't emit too many vcall offsets in 'Test32::F'.
+
+struct A {
+ virtual void a();
+};
+
+struct B {
+ virtual void b();
+};
+
+struct C : virtual A, virtual B {
+ virtual void c();
+};
+
+struct D : virtual C { };
+
+struct E : A, D {
+ virtual void e();
+};
+
+// CHECK: Vtable for 'Test33::F' (30 entries).
+// CHECK-NEXT: 0 | vbase_offset (24)
+// CHECK-NEXT: 1 | vbase_offset (16)
+// CHECK-NEXT: 2 | vbase_offset (16)
+// CHECK-NEXT: 3 | vbase_offset (8)
+// CHECK-NEXT: 4 | offset_to_top (0)
+// CHECK-NEXT: 5 | Test33::F RTTI
+// CHECK-NEXT: -- (Test33::A, 0) vtable address --
+// CHECK-NEXT: -- (Test33::F, 0) vtable address --
+// CHECK-NEXT: 6 | void Test33::A::a()
+// CHECK-NEXT: 7 | void Test33::F::f()
+// CHECK-NEXT: 8 | vcall_offset (0)
+// CHECK-NEXT: 9 | vcall_offset (0)
+// CHECK-NEXT: 10 | vbase_offset (16)
+// CHECK-NEXT: 11 | vbase_offset (8)
+// CHECK-NEXT: 12 | vbase_offset (8)
+// CHECK-NEXT: 13 | offset_to_top (-8)
+// CHECK-NEXT: 14 | Test33::F RTTI
+// CHECK-NEXT: -- (Test33::A, 8) vtable address --
+// CHECK-NEXT: -- (Test33::E, 8) vtable address --
+// CHECK-NEXT: 15 | void Test33::A::a()
+// CHECK-NEXT: 16 | void Test33::E::e()
+// CHECK-NEXT: 17 | vbase_offset (0)
+// CHECK-NEXT: 18 | vcall_offset (0)
+// CHECK-NEXT: 19 | vbase_offset (8)
+// CHECK-NEXT: 20 | vbase_offset (0)
+// CHECK-NEXT: 21 | vcall_offset (0)
+// CHECK-NEXT: 22 | offset_to_top (-16)
+// CHECK-NEXT: 23 | Test33::F RTTI
+// CHECK-NEXT: -- (Test33::A, 16) vtable address --
+// CHECK-NEXT: -- (Test33::C, 16) vtable address --
+// CHECK-NEXT: -- (Test33::D, 16) vtable address --
+// CHECK-NEXT: 24 | void Test33::A::a()
+// CHECK-NEXT: 25 | void Test33::C::c()
+// CHECK-NEXT: 26 | vcall_offset (0)
+// CHECK-NEXT: 27 | offset_to_top (-24)
+// CHECK-NEXT: 28 | Test33::F RTTI
+// CHECK-NEXT: -- (Test33::B, 24) vtable address --
+// CHECK-NEXT: 29 | void Test33::B::b()
+struct F : virtual E, A {
+ virtual void f();
+};
+void F::f() { }
+
+}
+
+namespace Test34 {
+
+// Test that we lay out the construction vtable for 'Test34::E' in 'Test34::F' correctly.
+
+struct A {
+ virtual void a();
+};
+struct B : virtual A { };
+
+struct C : B, A {
+ virtual void c();
+};
+
+struct D : A, C { };
+
+struct E : virtual D {
+ virtual void e();
+};
+
+// CHECK: Construction vtable for ('Test34::E', 0) in 'Test34::F' (22 entries).
+// CHECK-NEXT: 0 | vbase_offset (0)
+// CHECK-NEXT: 1 | vbase_offset (8)
+// CHECK-NEXT: 2 | vcall_offset (0)
+// CHECK-NEXT: 3 | offset_to_top (0)
+// CHECK-NEXT: 4 | Test34::E RTTI
+// CHECK-NEXT: -- (Test34::A, 0) vtable address --
+// CHECK-NEXT: -- (Test34::E, 0) vtable address --
+// CHECK-NEXT: 5 | void Test34::A::a()
+// CHECK-NEXT: 6 | void Test34::E::e()
+// CHECK-NEXT: 7 | vcall_offset (8)
+// CHECK-NEXT: 8 | vcall_offset (0)
+// CHECK-NEXT: 9 | vbase_offset (-8)
+// CHECK-NEXT: 10 | offset_to_top (-8)
+// CHECK-NEXT: 11 | Test34::E RTTI
+// CHECK-NEXT: -- (Test34::A, 8) vtable address --
+// CHECK-NEXT: -- (Test34::D, 8) vtable address --
+// CHECK-NEXT: 12 | void Test34::A::a()
+// CHECK-NEXT: 13 | vbase_offset (-16)
+// CHECK-NEXT: 14 | vcall_offset (-16)
+// CHECK-NEXT: 15 | offset_to_top (-16)
+// CHECK-NEXT: 16 | Test34::E RTTI
+// CHECK-NEXT: -- (Test34::B, 16) vtable address --
+// CHECK-NEXT: -- (Test34::C, 16) vtable address --
+// CHECK-NEXT: 17 | [unused] void Test34::A::a()
+// CHECK-NEXT: 18 | void Test34::C::c()
+// CHECK-NEXT: 19 | offset_to_top (-24)
+// CHECK-NEXT: 20 | Test34::E RTTI
+// CHECK-NEXT: -- (Test34::A, 24) vtable address --
+// CHECK-NEXT: 21 | void Test34::A::a()
+struct F : E {
+ virtual void f();
+};
+void F::f() { }
+
+}
+
+namespace Test35 {
+
+// Test that we lay out the virtual bases of 'Test35::H' in the correct order.
+
+struct A {
+ virtual void a();
+
+ int i;
+};
+
+struct B : virtual A {
+ virtual void b();
+};
+
+struct C {
+ virtual void c();
+};
+
+struct D : C, virtual B {
+ virtual void d();
+};
+
+struct E : D {
+ virtual void e();
+
+ bool b;
+};
+
+struct F : virtual D { };
+struct G : virtual E { };
+
+// CHECK: Vtable for 'Test35::H' (32 entries).
+// CHECK-NEXT: 0 | vbase_offset (32)
+// CHECK-NEXT: 1 | vbase_offset (0)
+// CHECK-NEXT: 2 | vcall_offset (0)
+// CHECK-NEXT: 3 | vcall_offset (0)
+// CHECK-NEXT: 4 | vbase_offset (16)
+// CHECK-NEXT: 5 | vbase_offset (8)
+// CHECK-NEXT: 6 | offset_to_top (0)
+// CHECK-NEXT: 7 | Test35::H RTTI
+// CHECK-NEXT: -- (Test35::C, 0) vtable address --
+// CHECK-NEXT: -- (Test35::D, 0) vtable address --
+// CHECK-NEXT: -- (Test35::F, 0) vtable address --
+// CHECK-NEXT: -- (Test35::H, 0) vtable address --
+// CHECK-NEXT: 8 | void Test35::C::c()
+// CHECK-NEXT: 9 | void Test35::D::d()
+// CHECK-NEXT: 10 | void Test35::H::h()
+// CHECK-NEXT: 11 | vbase_offset (0)
+// CHECK-NEXT: 12 | vbase_offset (24)
+// CHECK-NEXT: 13 | vcall_offset (0)
+// CHECK-NEXT: 14 | vbase_offset (8)
+// CHECK-NEXT: 15 | offset_to_top (-8)
+// CHECK-NEXT: 16 | Test35::H RTTI
+// CHECK-NEXT: -- (Test35::B, 8) vtable address --
+// CHECK-NEXT: -- (Test35::G, 8) vtable address --
+// CHECK-NEXT: 17 | void Test35::B::b()
+// CHECK-NEXT: 18 | vcall_offset (0)
+// CHECK-NEXT: 19 | offset_to_top (-16)
+// CHECK-NEXT: 20 | Test35::H RTTI
+// CHECK-NEXT: -- (Test35::A, 16) vtable address --
+// CHECK-NEXT: 21 | void Test35::A::a()
+// CHECK-NEXT: 22 | vcall_offset (0)
+// CHECK-NEXT: 23 | vcall_offset (0)
+// CHECK-NEXT: 24 | vcall_offset (0)
+// CHECK-NEXT: 25 | vbase_offset (-16)
+// CHECK-NEXT: 26 | vbase_offset (-24)
+// CHECK-NEXT: 27 | offset_to_top (-32)
+// CHECK-NEXT: 28 | Test35::H RTTI
+// CHECK-NEXT: -- (Test35::C, 32) vtable address --
+// CHECK-NEXT: -- (Test35::D, 32) vtable address --
+// CHECK-NEXT: -- (Test35::E, 32) vtable address --
+// CHECK-NEXT: 29 | void Test35::C::c()
+// CHECK-NEXT: 30 | void Test35::D::d()
+// CHECK-NEXT: 31 | void Test35::E::e()
+
+// CHECK: Virtual base offset offsets for 'Test35::H' (4 entries).
+// CHECK-NEXT: Test35::A | -32
+// CHECK-NEXT: Test35::B | -24
+// CHECK-NEXT: Test35::D | -56
+// CHECK-NEXT: Test35::E | -64
+struct H : F, G {
+ virtual void h();
+};
+void H::h() { }
+
+}
+
+namespace Test36 {
+
+// Test that we don't mark B::f as unused in the vtable for D.
+
+struct A {
+ virtual void f();
+};
+
+struct B : virtual A { };
+
+struct C : virtual A {
+ virtual void f();
+};
+
+// CHECK: Vtable for 'Test36::D' (12 entries).
+// CHECK-NEXT: 0 | vbase_offset (8)
+// CHECK-NEXT: 1 | vbase_offset (8)
+// CHECK-NEXT: 2 | vcall_offset (0)
+// CHECK-NEXT: 3 | offset_to_top (0)
+// CHECK-NEXT: 4 | Test36::D RTTI
+// CHECK-NEXT: -- (Test36::C, 0) vtable address --
+// CHECK-NEXT: -- (Test36::D, 0) vtable address --
+// CHECK-NEXT: 5 | void Test36::C::f()
+// CHECK-NEXT: 6 | void Test36::D::g()
+// CHECK-NEXT: 7 | vbase_offset (0)
+// CHECK-NEXT: 8 | vcall_offset (-8)
+// CHECK-NEXT: 9 | offset_to_top (-8)
+// CHECK-NEXT: 10 | Test36::D RTTI
+// CHECK-NEXT: -- (Test36::A, 8) vtable address --
+// CHECK-NEXT: -- (Test36::B, 8) vtable address --
+// CHECK-NEXT: 11 | void Test36::C::f()
+// CHECK-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
+struct D : virtual B, C {
+ virtual void g();
+};
+void D::g() { }
+
+}
diff --git a/test/CodeGenCXX/x86_32-arguments.cpp b/test/CodeGenCXX/x86_32-arguments.cpp
index d13c0e4..f8d6551 100644
--- a/test/CodeGenCXX/x86_32-arguments.cpp
+++ b/test/CodeGenCXX/x86_32-arguments.cpp
@@ -6,7 +6,7 @@ struct S {
int s;
};
-// CHECK: define void @_Z1fv(%struct.S* noalias sret %
+// CHECK: define void @_Z1fv(%struct.S* sret %
S f() { return S(); }
// CHECK: define void @_Z1f1S(%struct.S*)
void f(S) { }
@@ -17,7 +17,7 @@ class C {
double c;
};
-// CHECK: define void @_Z1gv(%class.C* noalias sret %
+// CHECK: define void @_Z1gv(%class.C* sret %
C g() { return C(); }
// CHECK: define void @_Z1f1C(%class.C*)
diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m
new file mode 100644
index 0000000..2896d37
--- /dev/null
+++ b/test/CodeGenObjC/atomic-aggregate-property.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
+// rdar: // 7849824
+
+struct s {
+ double a, b, c, d;
+};
+
+struct s1 {
+ int i;
+ id j;
+ id k;
+};
+
+@interface A
+@property (readwrite) double x;
+@property (readwrite) struct s y;
+@property (nonatomic, readwrite) struct s1 z;
+@end
+
+@implementation A
+@synthesize x;
+@synthesize y;
+@synthesize z;
+@end
+
+// CHECK-LP64: call void @objc_copyStruct
+// CHECK-LP64: call void @objc_copyStruct
+// CHECK-LP64: call void @objc_copyStruct
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index 6dc1410..8ba319e 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -29,7 +29,7 @@ void foo(T *P) {
@interface B : A @end
@implementation B
-(void) im1 {
- ^(void) { [super im0]; }();
+ ^(void) { [self im0]; }();
}
@end
diff --git a/test/CodeGenObjC/encode-cstyle-method.m b/test/CodeGenObjC/encode-cstyle-method.m
new file mode 100644
index 0000000..187c9bf
--- /dev/null
+++ b/test/CodeGenObjC/encode-cstyle-method.m
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s
+// rdar: // 7445205
+
+@interface Foo
+- (id)test:(id)one, id two;
+@end
+
+@implementation Foo
+- (id)test:(id )one, id two {return two; } @end
+
+// CHECK-LP64: internal global [11 x i8] c"@24@0:8@16
diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m
new file mode 100644
index 0000000..a74dee9
--- /dev/null
+++ b/test/CodeGenObjC/exceptions.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
+//
+// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes
+
+// Just check that we don't emit any dead blocks.
+//
+// RUN: grep 'No predecessors' %t | count 0
+
+@interface NSArray @end
+void f0() {
+ @try {
+ @try {
+ @throw @"a";
+ } @catch(NSArray *e) {
+ }
+ } @catch (id e) {
+ }
+}
diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m
index 8916d00..2777723 100644
--- a/test/CodeGenObjC/image-info.m
+++ b/test/CodeGenObjC/image-info.m
@@ -1,2 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
-// RUN: grep -F '@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"' %t
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s
+
+// CHECK-FRAGILE: @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"
+// CHECK-NONFRAGILE: @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip"
diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m
index 886d53a..dbc06d7 100644
--- a/test/CodeGenObjC/metadata-symbols-64.m
+++ b/test/CodeGenObjC/metadata-symbols-64.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -emit-llvm -o %t %s
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
// RUN: grep '@"OBJC_CLASS_$_A" = global' %t
diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m
index dc65382..921168c 100644
--- a/test/CodeGenObjC/metadata_symbols.m
+++ b/test/CodeGenObjC/metadata_symbols.m
@@ -1,25 +1,40 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
-
-// RUN: grep '@"OBJC_METACLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_CLASS_$_A" = global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH1" = weak global .*section "__DATA,__datacoal_nt,coalesced", align 8' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH2" = external global' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH3" = global .*section "__DATA,__objc_const", align 8' %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s
// RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3
-// RUN: grep '@"\\01L_OBJC_CLASS_NAME_" =.*section "__TEXT,__cstring,cstring_literals", align 1' %t | count 1
-// RUN: grep -F 'define internal void @"\01-[A im0]"' %t
-// RUN: grep -F 'define internal void @"\01-[A(Cat) im1]"' %t
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
+// CHECK-X86_64: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__cstring,cstring_literals", align 1
+// CHECK-X86_64: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 8
+// CHECK-X86_64: @"OBJC_EHTYPE_$_EH2" = external global
+// CHECK-X86_64: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 8
+// CHECK-X86_64: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8
+// CHECK-X86_64: define internal void @"\01-[A im0]"
+// CHECK-X86_64: define internal void @"\01-[A(Cat) im1]"
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s
+// RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s
+
+// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8
+// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH1" = weak hidden global {{.*}}, section "__DATA,__datacoal_nt,coalesced"
+// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH2" = external global
+// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8
+// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]"
+// CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]"
-// RUN: grep '@"OBJC_METACLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_CLASS_$_A" = hidden global .*section "__DATA, __objc_data", align 8' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH1" = weak hidden global .*section "__DATA,__datacoal_nt,coalesced"' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH2" = external global' %t
-// RUN: grep '@"OBJC_EHTYPE_$_EH3" = hidden global .*section "__DATA,__objc_const", align 8' %t
-// RUN: grep -F 'define internal void @"\01-[A im0]"' %t
-// RUN: grep -F 'define internal void @"\01-[A(Cat) im1]"' %t
+// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s
+// CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
+// CHECK-ARMV6: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4
+// CHECK-ARMV6: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__cstring,cstring_literals", align 1
+// CHECK-ARMV6: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 4
+// CHECK-ARMV6: @"OBJC_EHTYPE_$_EH2" = external global
+// CHECK-ARMV6: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 4
+// CHECK-ARMV6: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 4
+// CHECK-ARMV6: define internal arm_apcscc void @"\01-[A im0]"
+// CHECK-ARMV6: define internal arm_apcscc void @"\01-[A(Cat) im1]"
@interface A
@end
diff --git a/test/CodeGenObjC/next-objc-dispatch.m b/test/CodeGenObjC/next-objc-dispatch.m
new file mode 100644
index 0000000..a3e8e19
--- /dev/null
+++ b/test/CodeGenObjC/next-objc-dispatch.m
@@ -0,0 +1,73 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-dispatch-method=legacy | \
+// RUN: FileCheck -check-prefix CHECK-FRAGILE_LEGACY %s
+//
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=legacy | \
+// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_LEGACY %s
+//
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=non-legacy | \
+// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_NONLEGACY %s
+//
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s \
+// RUN: -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed | \
+// RUN: FileCheck -check-prefix CHECK-NONFRAGILE_MIXED %s
+//
+// <rdar://problem/7866951>
+
+// There are basically four ways that we end up doing message dispatch for the
+// NeXT runtime. They are:
+// (1) fragile ABI, legacy dispatch
+// (2) non-fragile ABI, legacy dispatch
+// (2) non-fragile ABI, non-legacy dispatch
+// (2) non-fragile ABI, mixed dispatch
+//
+// Note that fragile ABI and non-fragile ABI legacy dispatch are not the same,
+// they use some different API calls (objc_msgSendSuper vs objc_msgSendSuper2).
+
+// CHECK-FRAGILE_LEGACY: ModuleID
+// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-FRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
+// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSendSuper(
+// CHECK-FRAGILE_LEGACY: declare i8* @objc_msgSend(
+
+// CHECK-NONFRAGILE_LEGACY: ModuleID
+// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-NONFRAGILE_LEGACY-NOT: declare i8* @objc_msgSend_fixup(
+// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSendSuper2(
+// CHECK-NONFRAGILE_LEGACY: declare i8* @objc_msgSend(
+
+// CHECK-NONFRAGILE_NONLEGACY: ModuleID
+// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-NONFRAGILE_NONLEGACY: declare i8* @objc_msgSend_fixup(
+
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2_fixup(
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSendSuper2(
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend_fixup(
+// CHECK-NONFRAGILE_MIXED: declare i8* @objc_msgSend(
+
+@interface NSObject
++ (id)alloc;
+- (id)init;
+@end
+
+@interface I0 : NSObject
+-(void) im0;
+@end
+
+@implementation I0
++(id) alloc {
+ return [super alloc];
+}
+-(id) init {
+ [super init];
+ return self;
+}
+-(void) im0 {}
+@end
+
+void f0(I0 *a) {
+ [I0 alloc];
+ [a im0];
+}
diff --git a/test/CodeGenObjC/non-lazy-classes.m b/test/CodeGenObjC/non-lazy-classes.m
index 021db97..512ad89 100644
--- a/test/CodeGenObjC/non-lazy-classes.m
+++ b/test/CodeGenObjC/non-lazy-classes.m
@@ -1,5 +1,5 @@
// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CLASS_$" = internal global \[1 x .*\] .*@"OBJC_CLASS_$_A".*, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8' %t
// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CATEGORY_$" = internal global \[1 x .*\] .*@".01l_OBJC_$_CATEGORY_A_$_Cat".*, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8' %t
diff --git a/test/CodeGenObjC/ns-constant-strings.m b/test/CodeGenObjC/ns-constant-strings.m
new file mode 100644
index 0000000..3ef5f55
--- /dev/null
+++ b/test/CodeGenObjC/ns-constant-strings.m
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fno-constant-cfstrings -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fno-constant-cfstrings -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s
+
+@interface NSString @end
+
+@interface NSSimpleCString : NSString {
+@protected
+ char *bytes;
+ unsigned int numBytes;
+}
+@end
+
+@interface NSConstantString : NSSimpleCString
+@end
+
+#if OBJC_API_VERSION >= 2
+extern Class _NSConstantStringClassReference;
+#else
+extern struct objc_class _NSConstantStringClassReference;
+#endif
+
+const NSConstantString *appKey = @"MyApp";
+
+int main() {
+ const NSConstantString *appKey = @"MyApp";
+ const NSConstantString *appKey1 = @"MyApp1";
+}
+
+// CHECK-FRAGILE: @_NSConstantStringClassReference = external global
+// CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global
diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m
deleted file mode 100644
index e127242..0000000
--- a/test/CodeGenObjC/objc-gc-aggr-assign.m
+++ /dev/null
@@ -1,46 +0,0 @@
-// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o %t %s
-// RUN: grep objc_memmove_collectable %t | grep call | count 3
-
-static int count;
-
-typedef struct S {
- int ii;
-} SS;
-
-struct type_s {
- SS may_recurse;
- id id_val;
-};
-
-@interface NamedObject
-{
- struct type_s type_s_ivar;
-}
-- (void) setSome : (struct type_s) arg;
-- (struct type_s) getSome;
-@property(assign) struct type_s aggre_prop;
-@end
-
-@implementation NamedObject
-- (void) setSome : (struct type_s) arg
- {
- type_s_ivar = arg;
- }
-- (struct type_s) getSome
- {
- return type_s_ivar;
- }
-@synthesize aggre_prop = type_s_ivar;
-@end
-
-struct type_s some = {{1234}, (id)0};
-
-struct type_s get(void)
-{
- return some;
-}
-
-void f(const struct type_s *in, struct type_s *out) {
- *out = *in;
-}
-
diff --git a/test/CodeGenObjC/objc2-legacy-dispatch.m b/test/CodeGenObjC/objc2-legacy-dispatch.m
index 4c37573..7a99d15 100644
--- a/test/CodeGenObjC/objc2-legacy-dispatch.m
+++ b/test/CodeGenObjC/objc2-legacy-dispatch.m
@@ -1,11 +1,11 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s
//
// CHECK_NEW_DISPATCH: define void @f0
// CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc
// CHECK_NEW_DISPATCH: define void @f1
// CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
//
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-legacy-dispatch -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s
//
// CHECK_OLD_DISPATCH: define void @f0
// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
diff --git a/test/CodeGenObjC/x86_64-struct-return-gc.m b/test/CodeGenObjC/x86_64-struct-return-gc.m
index 32a321c..c62a33f 100644
--- a/test/CodeGenObjC/x86_64-struct-return-gc.m
+++ b/test/CodeGenObjC/x86_64-struct-return-gc.m
@@ -25,7 +25,7 @@ struct Indirect indirect_func(void);
void Indirect_test(void) {
struct Indirect i;
- // CHECK: call void @indirect_func(%struct.Indirect* noalias sret
+ // CHECK: call void @indirect_func(%struct.Indirect* sret
// CHECK: call i8* @objc_memmove_collectable(
i = indirect_func();
}
diff --git a/test/CodeGenObjCXX/ivar-objects.mm b/test/CodeGenObjCXX/ivar-objects.mm
new file mode 100644
index 0000000..79c1a39
--- /dev/null
+++ b/test/CodeGenObjCXX/ivar-objects.mm
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// CHECK: -[A .cxx_construct]
+// CHECK: -[A .cxx_destruct]
+
+@interface NSObject
+- alloc;
+- init;
+- (void) release;
+@end
+
+extern "C" int printf(const char *, ...);
+
+int count = 17;
+struct X {
+ X() : value(count++) { printf( "X::X()\n"); }
+ ~X() { printf( "X::~X()\n"); }
+ int value;
+};
+
+struct Y {
+ Y() : value(count++) { printf( "Y::Y()\n"); }
+ ~Y() { printf( "Y::~Y()\n"); }
+ int value;
+};
+
+@interface Super : NSObject {
+ Y yvar;
+ Y yvar1;
+ Y ya[3];
+}
+- (void)finalize;
+@end
+
+@interface A : Super {
+ X xvar;
+ X xvar1;
+ X xvar2;
+ X xa[2][2];
+}
+
+- (void)print;
+- (void)finalize;
+@end
+
+@implementation Super
+- (void)print {
+ printf( "yvar.value = %d\n", yvar.value);
+ printf( "yvar1.value = %d\n", yvar1.value);
+ printf( "ya[0..2] = %d %d %d\n", ya[0].value, ya[1].value, ya[2].value);
+}
+- (void)finalize {}
+@end
+
+@implementation A
+- (void)print {
+ printf( "xvar.value = %d\n", xvar.value);
+ printf( "xvar1.value = %d\n", xvar1.value);
+ printf( "xvar2.value = %d\n", xvar2.value);
+ printf( "xa[0..1][0..1] = %d %d %d %d\n",
+ xa[0][0].value, xa[0][1].value, xa[1][0].value, xa[1][1].value);
+ [super print];
+}
+- (void)finalize { [super finalize]; }
+@end
+
+int main() {
+ A *a = [[A alloc] init];
+ [a print];
+ [a release];
+}
+
diff --git a/test/CodeGenObjCXX/mangle.mm b/test/CodeGenObjCXX/mangle.mm
index d277c4e..7a75a5b 100644
--- a/test/CodeGenObjCXX/mangle.mm
+++ b/test/CodeGenObjCXX/mangle.mm
@@ -2,6 +2,7 @@
// CHECK: @"_ZZ11+[A shared]E1a" = internal global
// CHECK: @"_ZZ11-[A(Foo) f]E1a" = internal global
+// CHECK: v56@0:8i16i20i24i28i32i36i40i44^i48
@interface A
@end
@@ -30,3 +31,14 @@
return 0;
}
@end
+
+// PR6468
+@interface Test
+- (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i;
+@end
+
+@implementation Test
+- (void) process: (int)r3 :(int)r4 :(int)r5 :(int)r6 :(int)r7 :(int)r8 :(int)r9 :(int)r10 :(int &)i {
+}
+@end
+
diff --git a/test/Coverage/ast-printing.cpp b/test/Coverage/ast-printing.cpp
index ce0a569..1a75fb4 100644
--- a/test/Coverage/ast-printing.cpp
+++ b/test/Coverage/ast-printing.cpp
@@ -3,6 +3,6 @@
// RUN: %clang_cc1 -ast-dump %s
// FIXME: %clang_cc1 -ast-print-xml -o %t %s
// RUN: %clang_cc1 -print-decl-contexts %s
-// RUN: %clang_cc1 -dump-record-layouts %s
+// RUN: %clang_cc1 -fdump-record-layouts %s
#include "cxx-language-features.inc"
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index 9ae81f1..76ddaa8 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -33,7 +33,7 @@
// Note that at conception, this exactly matches gcc.
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -A ARG0 -F ARG1 -L ARG2 -Mach -T ARG4 -X -Z -all_load -allowable_client ARG8 -bind_at_load -compatibility_version ARG11 -current_version ARG12 -d -dead_strip -dylib_file ARG14 -dylinker -dylinker_install_name ARG16 -dynamic -dynamiclib -e ARG19 -exported_symbols_list ARG20 -fexceptions -flat_namespace -fnested-functions -fopenmp -force_cpusubtype_ALL -fpie -fprofile-arcs -headerpad_max_install_names -image_base ARG29 -init ARG30 -install_name ARG31 -m ARG33 -miphoneos-version-min=2.0 -mmacosx-version-min=10.3.2 -multi_module -multiply_defined ARG37 -multiply_defined_unused ARG38 -no_dead_strip_inits_and_terms -nodefaultlibs -nofixprebinding -nomultidefs -noprebind -noseglinkedit -nostartfiles -nostdlib -pagezero_size ARG54 -pg -prebind -prebind_all_twolevel_modules -preload -r -read_only_relocs ARG55 -s -sectalign ARG57_0 ARG57_1 ARG57_2 -sectcreate ARG58_0 ARG58_1 ARG58_2 -sectobjectsymbols ARG59_0 ARG59_1 -sectorder ARG60_0 ARG60_1 ARG60_2 -seg1addr ARG61 -seg_addr_table ARG62 -seg_addr_table_filename ARG63 -segaddr ARG64_0 ARG64_1 -segcreate ARG65_0 ARG65_1 ARG65_2 -seglinkedit -segprot ARG67_0 ARG67_1 ARG67_2 -segs_read_FOO -segs_read_only_addr ARG69 -segs_read_write_addr ARG70 -shared-libgcc -single_module -static -static-libgcc -sub_library ARG77 -sub_umbrella ARG78 -t -twolevel_namespace -twolevel_namespace_hints -u ARG82 -umbrella ARG83 -undefined ARG84 -unexported_symbols_list ARG85 -w -weak_reference_mismatches ARG87 -whatsloaded -whyload -y -filelist FOO -l FOO 2> %t.log
-// RUN: grep '".*ld.*" "-static" "-dylib" "-dylib_compatibility_version" "ARG11" "-dylib_current_version" "ARG12" "-arch" "i386" "-dylib_install_name" "ARG31" "-all_load" "-allowable_client" "ARG8" "-bind_at_load" "-dead_strip" "-no_dead_strip_inits_and_terms" "-dylib_file" "ARG14" "-dynamic" "-exported_symbols_list" "ARG20" "-flat_namespace" "-headerpad_max_install_names" "-image_base" "ARG29" "-init" "ARG30" "-macosx_version_min" "10.3.2" "-iphoneos_version_min" "2.0" "-nomultidefs" "-multi_module" "-single_module" "-multiply_defined" "ARG37" "-multiply_defined_unused" "ARG38" "-pie" "-prebind" "-noprebind" "-nofixprebinding" "-prebind_all_twolevel_modules" "-read_only_relocs" "ARG55" "-sectcreate" "ARG58_0" "ARG58_1" "ARG58_2" "-sectorder" "ARG60_0" "ARG60_1" "ARG60_2" "-seg1addr" "ARG61" "-segprot" "ARG67_0" "ARG67_1" "ARG67_2" "-segaddr" "ARG64_0" "ARG64_1" "-segs_read_only_addr" "ARG69" "-segs_read_write_addr" "ARG70" "-seg_addr_table" "ARG62" "-seg_addr_table_filename" "ARG63" "-sub_library" "ARG77" "-sub_umbrella" "ARG78" "-twolevel_namespace" "-twolevel_namespace_hints" "-umbrella" "ARG83" "-undefined" "ARG84" "-unexported_symbols_list" "ARG85" "-weak_reference_mismatches" "ARG87" "-X" "-y" "-w" "-pagezero_size" "ARG54" "-segs_read_FOO" "-seglinkedit" "-noseglinkedit" "-sectalign" "ARG57_0" "ARG57_1" "ARG57_2" "-sectobjectsymbols" "ARG59_0" "ARG59_1" "-segcreate" "ARG65_0" "ARG65_1" "ARG65_2" "-whyload" "-whatsloaded" "-dylinker_install_name" "ARG16" "-dylinker" "-Mach" "-d" "-s" "-t" "-Z" "-u" "ARG82" "-undefined" "ARG84" "-A" "ARG0" "-e" "ARG19" "-m" "ARG33" "-r" "-o" "a.out" "-L" "ARG2" "-lgomp" "-L/usr/lib/i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1/../../../i686-apple-darwin.*/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin.*/4.2.1/../../.." "-filelist" "FOO" "-lFOO" "-lgcov" "-allow_stack_execute" "-T" "ARG4" "-F" "ARG1"' %t.log
+// RUN: grep '".*ld.*" "-static" "-dylib" "-dylib_compatibility_version" "ARG11" "-dylib_current_version" "ARG12" "-arch" "i386" "-dylib_install_name" "ARG31" "-all_load" "-allowable_client" "ARG8" "-bind_at_load" "-dead_strip" "-no_dead_strip_inits_and_terms" "-dylib_file" "ARG14" "-dynamic" "-exported_symbols_list" "ARG20" "-flat_namespace" "-headerpad_max_install_names" "-image_base" "ARG29" "-init" "ARG30" "-macosx_version_min" "10.3.2" "-iphoneos_version_min" "2.0" "-nomultidefs" "-multi_module" "-single_module" "-multiply_defined" "ARG37" "-multiply_defined_unused" "ARG38" "-pie" "-prebind" "-noprebind" "-nofixprebinding" "-prebind_all_twolevel_modules" "-read_only_relocs" "ARG55" "-sectcreate" "ARG58_0" "ARG58_1" "ARG58_2" "-sectorder" "ARG60_0" "ARG60_1" "ARG60_2" "-seg1addr" "ARG61" "-segprot" "ARG67_0" "ARG67_1" "ARG67_2" "-segaddr" "ARG64_0" "ARG64_1" "-segs_read_only_addr" "ARG69" "-segs_read_write_addr" "ARG70" "-seg_addr_table" "ARG62" "-seg_addr_table_filename" "ARG63" "-sub_library" "ARG77" "-sub_umbrella" "ARG78" "-twolevel_namespace" "-twolevel_namespace_hints" "-umbrella" "ARG83" "-undefined" "ARG84" "-unexported_symbols_list" "ARG85" "-weak_reference_mismatches" "ARG87" "-X" "-y" "-w" "-pagezero_size" "ARG54" "-segs_read_FOO" "-seglinkedit" "-noseglinkedit" "-sectalign" "ARG57_0" "ARG57_1" "ARG57_2" "-sectobjectsymbols" "ARG59_0" "ARG59_1" "-segcreate" "ARG65_0" "ARG65_1" "ARG65_2" "-whyload" "-whatsloaded" "-dylinker_install_name" "ARG16" "-dylinker" "-Mach" "-d" "-s" "-t" "-Z" "-u" "ARG82" "-undefined" "ARG84" "-A" "ARG0" "-e" "ARG19" "-m" "ARG33" "-r" "-o" "a.out" "-L" "ARG2" "-lgomp".* "-filelist" "FOO" "-lFOO" "-lgcov" "-allow_stack_execute" "-T" "ARG4" "-F" "ARG1"' %t.log
// Don't run dsymutil on a fat build of an executable.
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch i386 -arch x86_64 -g %s 2> %t.log
diff --git a/test/Driver/darwin-objc-defaults.m b/test/Driver/darwin-objc-defaults.m
new file mode 100644
index 0000000..4cf83a1
--- /dev/null
+++ b/test/Driver/darwin-objc-defaults.m
@@ -0,0 +1,88 @@
+// Check non-fragile ABI and dispatch method defaults.
+
+// i386
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -mmacosx-version-min=10.5 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_OSX10_5 < %t %s
+
+// CHECK-CHECK-I386_OSX10_5: "-cc1"
+// CHECK-CHECK-I386_OSX10_5-NOT: -fobjc-nonfragile-abi
+// CHECK-CHECK-I386_OSX10_5-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_OSX10_5: darwin-objc-defaults
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -mmacosx-version-min=10.6 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_OSX10_6 < %t %s
+
+// CHECK-CHECK-I386_OSX10_6: "-cc1"
+// CHECK-CHECK-I386_OSX10_6-NOT: -fobjc-nonfragile-abi
+// CHECK-CHECK-I386_OSX10_6-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_OSX10_6: darwin-objc-defaults
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -miphoneos-version-min=3.0 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_IPHONE3_0 < %t %s
+
+// CHECK-CHECK-I386_IPHONE3_0: "-cc1"
+// CHECK-CHECK-I386_IPHONE3_0-NOT: -fobjc-nonfragile-abi
+// CHECK-CHECK-I386_IPHONE3_0-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_IPHONE3_0: darwin-objc-defaults
+
+// x86_64
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -mmacosx-version-min=10.5 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_5 < %t %s
+
+// CHECK-CHECK-X86_64_OSX10_5: "-cc1"
+// CHECK-CHECK-X86_64_OSX10_5: -fobjc-nonfragile-abi
+// CHECK-CHECK-X86_64_OSX10_5: -fobjc-dispatch-method=non-legacy
+// CHECK-CHECK-X86_64_OSX10_5: darwin-objc-defaults
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -mmacosx-version-min=10.6 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_6 < %t %s
+
+// CHECK-CHECK-X86_64_OSX10_6: "-cc1"
+// CHECK-CHECK-X86_64_OSX10_6: -fobjc-nonfragile-abi
+// CHECK-CHECK-X86_64_OSX10_6: -fobjc-dispatch-method=mixed
+// CHECK-CHECK-X86_64_OSX10_6: darwin-objc-defaults
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -miphoneos-version-min=3.0 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_IPHONE3_0 < %t %s
+
+// CHECK-CHECK-X86_64_IPHONE3_0: "-cc1"
+// CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-nonfragile-abi
+// CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-dispatch-method=mixed
+// CHECK-CHECK-X86_64_IPHONE3_0: darwin-objc-defaults
+
+// armv7
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch armv7 -mmacosx-version-min=10.5 2> %t
+// RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_5 < %t %s
+
+// CHECK-CHECK-ARMV7_OSX10_5: "-cc1"
+// CHECK-CHECK-ARMV7_OSX10_5: -fobjc-nonfragile-abi
+// CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-ARMV7_OSX10_5: darwin-objc-defaults
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch armv7 -mmacosx-version-min=10.6 2> %t
+// RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_6 < %t %s
+
+// CHECK-CHECK-ARMV7_OSX10_6: "-cc1"
+// CHECK-CHECK-ARMV7_OSX10_6: -fobjc-nonfragile-abi
+// CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-ARMV7_OSX10_6: darwin-objc-defaults
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch armv7 -miphoneos-version-min=3.0 2> %t
+// RUN: FileCheck --check-prefix CHECK-ARMV7_IPHONE3_0 < %t %s
+
+// CHECK-CHECK-ARMV7_IPHONE3_0: "-cc1"
+// CHECK-CHECK-ARMV7_IPHONE3_0: -fobjc-nonfragile-abi
+// CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-ARMV7_IPHONE3_0: darwin-objc-defaults
diff --git a/test/Driver/darwin-objc-gc.m b/test/Driver/darwin-objc-gc.m
new file mode 100644
index 0000000..aecb9a6
--- /dev/null
+++ b/test/Driver/darwin-objc-gc.m
@@ -0,0 +1,19 @@
+// Check that we warn, but accept, -fobjc-gc for iPhone OS.
+
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -miphoneos-version-min=3.0 -fobjc-gc -flto -S -o %t %s 2> %t.err
+// RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_LL %s < %t
+// RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_STDERR %s < %t.err
+
+// IPHONE_OBJC_GC_LL: define void @f0
+// IPHONE_OBJC_GC_LL-NOT: objc_assign_ivar
+// IPHONE_OBJC_GC_LL: }
+
+// IPHONE_OBJC_GC_STDERR: warning: Objective-C garbage collection is not supported on this platform, ignoring '-fobjc-gc'
+
+@interface A {
+@public
+ id x;
+}
+@end
+
+void f0(A *a, id x) { a->x = x; }
diff --git a/test/Driver/darwin-objc-options.m b/test/Driver/darwin-objc-options.m
new file mode 100644
index 0000000..bc0b12c
--- /dev/null
+++ b/test/Driver/darwin-objc-options.m
@@ -0,0 +1,19 @@
+// Check miscellaneous Objective-C options.
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -fobjc-abi-version=1 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_ABI1 < %t %s
+
+// CHECK-CHECK-X86_64_ABI1: "-cc1"
+// CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-nonfragile-abi
+// CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-X86_64_ABI1: darwin-objc-options
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -fobjc-abi-version=2 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_ABI2 < %t %s
+
+// CHECK-CHECK-I386_ABI2: "-cc1"
+// CHECK-CHECK-I386_ABI2: -fobjc-nonfragile-abi
+// CHECK-CHECK-I386_ABI2-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_ABI2: darwin-objc-options
diff --git a/test/FixIt/fixit-at.c b/test/FixIt/fixit-at.c
deleted file mode 100644
index c32aee9..0000000
--- a/test/FixIt/fixit-at.c
+++ /dev/null
@@ -1,5 +0,0 @@
-// RUN: %clang_cc1 -fixit-at=fixit-at.c:3:1 %s -o - | %clang_cc1 -verify -x c -
-
-_Complex cd;
-
-int i0[1] = { { 17 } }; // expected-warning{{braces}}
diff --git a/test/FixIt/fixit-c90.c b/test/FixIt/fixit-c90.c
index e84733f..0bc1fad 100644
--- a/test/FixIt/fixit-c90.c
+++ b/test/FixIt/fixit-c90.c
@@ -1,4 +1,10 @@
-/* RUN: %clang_cc1 -std=c90 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -x c -std=c90 -Werror -
+/* RUN: cp %s %t
+ RUN: %clang_cc1 -std=c90 -pedantic -fixit %t
+ RUN: %clang_cc1 -pedantic -x c -std=c90 -Werror %t
+ */
+/* XPASS: *
+ This test passes because clang merely warns for this syntax error even with
+ -pedantic -Werror -std=c90.
*/
/* This is a test of the various code modification hints that are
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp
index 3694b9d..d8a858d 100644
--- a/test/FixIt/fixit-cxx0x.cpp
+++ b/test/FixIt/fixit-cxx0x.cpp
@@ -1,13 +1,15 @@
-/* RUN: %clang_cc1 -std=c++0x -fixit %s -o - | %clang_cc1 -x c++ -std=c++0x -
- */
+// RUN: %clang_cc1 -verify -std=c++0x %s
+// RUN: cp %s %t
+// RUN: %clang_cc1 -std=c++0x -fixit %t || true
+// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++0x %t
/* This is a test of the various code modification hints that only
apply in C++0x. */
-struct A {
+struct A {
explicit operator int(); // expected-note{{conversion to integral type}}
};
-void x() {
+void x() {
switch(A()) { // expected-error{{explicit conversion to}}
}
}
diff --git a/test/FixIt/fixit-errors-1.c b/test/FixIt/fixit-errors-1.c
index ecad53c..96f27eb 100644
--- a/test/FixIt/fixit-errors-1.c
+++ b/test/FixIt/fixit-errors-1.c
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -Werror -x c -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -fixit %t
+// RUN: echo %clang_cc1 -pedantic -Werror -x c %t
+/* XPASS: * */
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit-errors.c b/test/FixIt/fixit-errors.c
index 7bf9a58..ff06363 100644
--- a/test/FixIt/fixit-errors.c
+++ b/test/FixIt/fixit-errors.c
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -pedantic -Werror -x c -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -verify -fixit -x c %t || true
+// RUN: %clang_cc1 -pedantic -Werror -x c %t
+// XFAIL: *
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m
index 665ac74..03f28a1 100644
--- a/test/FixIt/fixit-objc.m
+++ b/test/FixIt/fixit-objc.m
@@ -1,5 +1,6 @@
-// RUN: %clang_cc1 -pedantic -fixit %s -o %t
-// RUN: %clang_cc1 -pedantic -x objective-c %t -verify
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -fixit -x objective-c %t
+// RUN: %clang_cc1 -pedantic -verify -x objective-c %t
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -27,7 +28,7 @@ void h(id a);
void f(Test *t) {
NSString *a = "Foo";
id b = "Foo";
- A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'char [4]', expected 'A *'}}
+ A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'A *' with an expression of type 'char [4]'}}
g("Foo");
h("Foo");
h(("Foo"));
diff --git a/test/FixIt/fixit-pmem.cpp b/test/FixIt/fixit-pmem.cpp
index 0926309..b69eadf 100644
--- a/test/FixIt/fixit-pmem.cpp
+++ b/test/FixIt/fixit-pmem.cpp
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -pedantic -fixit %s -o - | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -fixit -x c++ %t
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ %t
+// XFAIL: *
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
diff --git a/test/FixIt/fixit-suffix.c b/test/FixIt/fixit-suffix.c
new file mode 100644
index 0000000..a1a747a
--- /dev/null
+++ b/test/FixIt/fixit-suffix.c
@@ -0,0 +1,5 @@
+// RUN: cp %s %t.extrasuffix
+// RUN: %clang_cc1 -fixit=fixed -x c %t.extrasuffix
+// RUN: %clang_cc1 -Werror -pedantic -x c %t.fixed.extrasuffix
+
+_Complex cd;
diff --git a/test/FixIt/fixit-unrecoverable.c b/test/FixIt/fixit-unrecoverable.c
new file mode 100644
index 0000000..8052beb
--- /dev/null
+++ b/test/FixIt/fixit-unrecoverable.c
@@ -0,0 +1,10 @@
+/* FIXME: This is a file containing various typos for which we can
+ suggest corrections but are unable to actually recover from
+ them. Ideally, we would eliminate all such cases and move these
+ tests elsewhere. */
+
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// FIXME: Sadly, the following doesn't work within a function.
+
+unsinged x = 17; // expected-error{{unknown type name 'unsinged'; did you mean 'unsigned'?}}
diff --git a/test/FixIt/fixit-unrecoverable.cpp b/test/FixIt/fixit-unrecoverable.cpp
new file mode 100644
index 0000000..00ed897
--- /dev/null
+++ b/test/FixIt/fixit-unrecoverable.cpp
@@ -0,0 +1,11 @@
+/* FIXME: This is a file containing various typos for which we can
+ suggest corrections but are unable to actually recover from
+ them. Ideally, we would eliminate all such cases and move these
+ tests elsewhere. */
+
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+float f(int y) {
+ return static_cst<float>(y); // expected-error{{use of undeclared identifier 'static_cst'; did you mean 'static_cast'?}}
+}
+
diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c
index 83d724d..b799fa3 100644
--- a/test/FixIt/fixit.c
+++ b/test/FixIt/fixit.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -pedantic -fixit %s -o - | grep -v 'CHECK' > %t
-// RUN: %clang_cc1 -pedantic -Werror -x c -
-// RUN: FileCheck -input-file=%t %s
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -fixit -x c %t || true
+// RUN: grep -v CHECK %t > %t2
+// RUN: %clang_cc1 -pedantic -Werror -x c %t
+// RUN: FileCheck -input-file=%t2 %t
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -25,15 +27,14 @@ struct s s0 = { y: 5 };
// CHECK: int array0[5] = { [3] = 3 };
int array0[5] = { [3] 3 };
-void f1(x, y)
+void f1(x, y)
{
}
int i0 = { 17 };
-int f2(const char *my_string) {
- // FIXME: terminal output isn't so good when "my_string" is shorter
-// CHECK: return strcmp(my_string , "foo") == 0;
- return my_string == "foo";
+int test_cond(int y, int fooBar) {
+// CHECK: int x = y ? 1 : 4+fooBar;
+ int x = y ? 1 4+foobar;
+ return x;
}
-
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index 79c294b..b9282c4 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -1,11 +1,13 @@
-// RUN: %clang_cc1 -pedantic -Wall -fixit %s -o - | %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x c++ -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -Wall -fixit -x c++ %t || true
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x c++ %t
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
warnings will be fixed by -fixit, and the resulting file should
compile cleanly with -Werror -pedantic. */
-struct C1 {
+struct C1 {
virtual void f();
static void g();
};
@@ -40,3 +42,12 @@ class B : public A {
void f() throw();
void f(); // expected-warning{{missing exception specification}}
+
+namespace rdar7853795 {
+ struct A {
+ bool getNumComponents() const; // expected-note{{declared here}}
+ void dump() const {
+ getNumComponenets(); // expected-error{{use of undeclared identifier 'getNumComponenets'; did you mean 'getNumComponents'?}}
+ }
+ };
+}
diff --git a/test/FixIt/typo.c b/test/FixIt/typo.c
index 72e3d65..01ff3a0 100644
--- a/test/FixIt/typo.c
+++ b/test/FixIt/typo.c
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -fixit -o - %s | %clang_cc1 -fsyntax-only -pedantic -Werror -x c -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fsyntax-only -fixit -x c %t || true
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c %t
struct Point {
float x, y;
};
diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp
index efc9ba8..5b9e68b 100644
--- a/test/FixIt/typo.cpp
+++ b/test/FixIt/typo.cpp
@@ -1,7 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -fixit -o - %s | %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fsyntax-only -fixit -x c++ %t || true
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ %t
namespace std {
template<typename T> class basic_string { // expected-note 2{{'basic_string' declared here}}
+ public:
int find(const char *substr); // expected-note{{'find' declared here}}
static const int npos = -1; // expected-note{{'npos' declared here}}
};
diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m
index 86dd383..f161bb8 100644
--- a/test/FixIt/typo.m
+++ b/test/FixIt/typo.m
@@ -1,8 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// FIXME: the test below isn't testing quite what we want...
-// RUN: %clang_cc1 -fsyntax-only -fixit -o - %s | %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c -
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fsyntax-only -fixit %t || true
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x objective-c %t
+// XFAIL: *
-@interface NSString
+@interface NSString // expected-note{{'NSString' declared here}}
+ (int)method:(int)x;
@end
@@ -57,8 +59,7 @@ void test() {
@end
void test_message_send(B* b) {
- // FIXME: Not providing fix-its
- [NSstring method:17]; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}}
+ [NSstring method:17]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}
}
@interface Collide // expected-note{{'Collide' declared here}}
@@ -88,3 +89,52 @@ void test2(Collide *a) {
@interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}}
@end
+
+@interface Super
+- (int)method;
+@end
+
+@interface Sub : Super
+- (int)method;
+@end
+
+@implementation Sub
+- (int)method {
+ return [supper method]; // expected-error{{unknown receiver 'supper'; did you mean 'super'?}}
+}
+
+@end
+
+@interface Ivar
+@end
+
+@protocol Proto
+@property (retain) id ivar;
+@end
+
+@interface User <Proto>
+- (void)method;
+@end
+
+@implementation User
+@synthesize ivar;
+
+- (void)method {
+ [ivar method]; // Test that we don't correct 'ivar' to 'Ivar'
+}
+@end
+
+@interface User2
+@end
+
+@interface User2 (Cat) < Proto>
+- (void)method;
+@end
+
+@implementation User2 (Cat)
+@synthesize ivar;
+
+- (void)method {
+ [ivar method]; // Test that we don't correct 'ivar' to 'Ivar'
+}
+@end
diff --git a/test/Index/Inputs/complete-pch.h b/test/Index/Inputs/complete-pch.h
new file mode 100644
index 0000000..ddf5253
--- /dev/null
+++ b/test/Index/Inputs/complete-pch.h
@@ -0,0 +1,10 @@
+@interface A
+- (int)instanceMethod1:(int)x;
++ (int)classMethod1:(double)d;
+@end
+
+@interface B
+- (int)instanceMethod2:(int)x;
++ (int)classMethod2:(float)f;
+@end
+
diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m
index 1badeb2..ce399d3 100644
--- a/test/Index/annotate-tokens.m
+++ b/test/Index/annotate-tokens.m
@@ -5,10 +5,11 @@
@implementation Foo
- (int)compare:(Foo*)other {
return 0;
+ (void)@encode(Foo);
}
@end
-// RUN: c-index-test -test-annotate-tokens=%s:1:1:9:5 %s | FileCheck %s
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:10:5 %s | FileCheck %s
// CHECK: Punctuation: "@" [1:1 - 1:2]
// CHECK: Identifier: "interface" [1:2 - 1:11]
// CHECK: Identifier: "Foo" [1:12 - 1:15] ObjCInterfaceDecl=Foo:1:12
@@ -44,6 +45,15 @@
// CHECK: Keyword: "return" [7:3 - 7:9]
// CHECK: Literal: "0" [7:10 - 7:11]
// CHECK: Punctuation: ";" [7:11 - 7:12]
-// CHECK: Punctuation: "}" [8:1 - 8:2]
-// CHECK: Punctuation: "@" [9:1 - 9:2]
-// CHECK: Identifier: "end" [9:2 - 9:5]
+// CHECK: Punctuation: "(" [8:3 - 8:4]
+// CHECK: Keyword: "void" [8:4 - 8:8]
+// CHECK: Punctuation: ")" [8:8 - 8:9]
+// CHECK: Punctuation: "@" [8:9 - 8:10]
+// CHECK: Identifier: "encode" [8:10 - 8:16]
+// CHECK: Punctuation: "(" [8:16 - 8:17]
+// CHECK: Identifier: "Foo" [8:17 - 8:20] ObjCClassRef=Foo:1:12
+// CHECK: Punctuation: ")" [8:20 - 8:21]
+// CHECK: Punctuation: ";" [8:21 - 8:22]
+// CHECK: Punctuation: "}" [9:1 - 9:2]
+// CHECK: Punctuation: "@" [10:1 - 10:2]
+// CHECK: Identifier: "end" [10:2 - 10:5]
diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m
index 1d0a471..811bca0 100644
--- a/test/Index/complete-at-directives.m
+++ b/test/Index/complete-at-directives.m
@@ -6,7 +6,7 @@
@end
// RUN: c-index-test -code-completion-at=%s:2:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder identifier}{SemiColon ;}
+// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder identifier}
// CHECK-CC1: {TypedText compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText implementation}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText interface}{HorizontalSpace }{Placeholder class}
@@ -24,7 +24,7 @@
// CHECK-CC3: {TypedText synthesize}{HorizontalSpace }{Placeholder property}
// RUN: c-index-test -code-completion-at=%s:2:1 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder identifier}{SemiColon ;}
+// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder identifier}
// CHECK-CC4: NotImplemented:{TypedText @compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
// CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace }{Placeholder class}
// CHECK-CC4: NotImplemented:{TypedText @interface}{HorizontalSpace }{Placeholder class}
diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m
index e8efc3c..87e554f 100644
--- a/test/Index/complete-at-exprstmt.m
+++ b/test/Index/complete-at-exprstmt.m
@@ -14,7 +14,7 @@
// CHECK-CC1: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC1: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
// CHECK-CC1: {TypedText synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
-// CHECK-CC1: {TypedText throw}{HorizontalSpace }{Placeholder expression}{SemiColon ;}
+// CHECK-CC1: {TypedText throw}{HorizontalSpace }{Placeholder expression}
// CHECK-CC1: {TypedText try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
// RUN: c-index-test -code-completion-at=%s:9:19 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
@@ -25,7 +25,7 @@
// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
// CHECK-CC3: NotImplemented:{TypedText @synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
-// CHECK-CC3: NotImplemented:{TypedText @throw}{HorizontalSpace }{Placeholder expression}{SemiColon ;}
+// CHECK-CC3: NotImplemented:{TypedText @throw}{HorizontalSpace }{Placeholder expression}
// CHECK-CC3: NotImplemented:{TypedText @try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText _cmd}
// CHECK-CC3: ParmDecl:{ResultType int}{TypedText arg}
diff --git a/test/Index/complete-exprs.c b/test/Index/complete-exprs.c
new file mode 100644
index 0000000..efc82f9
--- /dev/null
+++ b/test/Index/complete-exprs.c
@@ -0,0 +1,15 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+int f(int);
+
+int test(int i, int j, int k, int l) {
+ return i | j | k & l;
+}
+
+// RUN: c-index-test -code-completion-at=%s:7:9 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )}
+// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
+// RUN: c-index-test -code-completion-at=%s:7:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:7:18 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:7:22 %s | FileCheck -check-prefix=CHECK-CC1 %s
diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m
new file mode 100644
index 0000000..c18994e
--- /dev/null
+++ b/test/Index/complete-method-decls.m
@@ -0,0 +1,82 @@
+/* Note: the RUN lines are near the end of the file, since line/column
+ matter for this test. */
+
+@protocol P1
+- (id)abc;
+- (id)initWithInt:(int)x;
+- (id)initWithTwoInts:(int)x second:(int)y;
+- (int)getInt;
+- (id)getSelf;
+@end
+
+@protocol P2<P1>
++ (id)alloc;
+@end
+
+@interface A <P1>
+- (id)init;
+- (int)getValue;
+@end
+
+@interface B : A<P2>
+- (id)initWithInt:(int)x;
+- (int)getSecondValue;
+- (id)getSelf;
+- (int)setValue:(int)x;
+@end
+
+@interface B (FooBar)
+- (id)categoryFunction:(int)x;
+@end
+
+@implementation B
+- (int)getSecondValue { return 0; }
+- (id)init { return self; }
+- (id)getSelf { return self; }
+- (void)setValue:(int)x { }
+- (id)initWithTwoInts:(int)x second:(int)y { return self; }
++ (id)alloc { return 0; }
+@end
+
+@implementation B (FooBar)
+- (id)categoryFunction:(int)x { return self; }
+@end
+
+// RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText abc}
+// CHECK-CC1: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}
+// CHECK-CC1: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}
+// CHECK-CC1: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
+// CHECK-CC1: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
+// RUN: c-index-test -code-completion-at=%s:17:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: NotImplemented:{TypedText abc}
+// CHECK-CC2-NEXT: NotImplemented:{TypedText getSelf}
+// CHECK-CC2: NotImplemented:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
+// CHECK-CC2: NotImplemented:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
+// RUN: c-index-test -code-completion-at=%s:24:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: NotImplemented:{TypedText abc}
+// CHECK-CC3-NEXT: NotImplemented:{TypedText getSelf}
+// CHECK-CC3: NotImplemented:{TypedText init}
+// CHECK-CC3: NotImplemented:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
+// CHECK-CC3: NotImplemented:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
+// RUN: c-index-test -code-completion-at=%s:33:3 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: NotImplemented:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// RUN: c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: NotImplemented:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC5: NotImplemented:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC5-NOT: {TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC5: NotImplemented:{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// RUN: c-index-test -code-completion-at=%s:37:7 %s | FileCheck -check-prefix=CHECK-CC6 %s
+// CHECK-CC6: NotImplemented:{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC6-NOT: getSelf
+// CHECK-CC6: NotImplemented:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC6: NotImplemented:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// RUN: c-index-test -code-completion-at=%s:42:3 %s | FileCheck -check-prefix=CHECK-CC7 %s
+// CHECK-CC7: NotImplemented:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+
diff --git a/test/Index/complete-objc-message-id.m b/test/Index/complete-objc-message-id.m
new file mode 100644
index 0000000..a75ee4a
--- /dev/null
+++ b/test/Index/complete-objc-message-id.m
@@ -0,0 +1,42 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+@interface A
++ (id)alloc;
++ (id)init;
++ (id)new;
++ (Class)class;
++ (Class)superclass;
+- (id)retain;
+- (id)autorelease;
+- (id)superclass;
+@end
+
+@interface B : A
+- (int)B_method;
+@end
+
+@interface Unrelated
++ (id)icky;
+@end
+
+void message_id(B *b) {
+ [[A alloc] init];
+ [[b retain] B_method];
+ [[b superclass] B_method];
+}
+
+// RUN: c-index-test -code-completion-at=%s:24:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
+// CHECK-CC1-NOT: B_method
+// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType id}{TypedText retain}
+// RUN: c-index-test -code-completion-at=%s:25:15 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText B_method}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText retain}
+// RUN: c-index-test -code-completion-at=%s:26:19 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
+// CHECK-CC3-NOT: B_method
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText retain}
+
+
diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m
index 096ed24..e65a056 100644
--- a/test/Index/complete-objc-message.m
+++ b/test/Index/complete-objc-message.m
@@ -103,6 +103,25 @@ void f(Ellipsis *e) {
[e Method:1, 2, 3];
}
+@interface Overload2
++ (int)Method:(int)i;
++ (int)Method;
++ (int)Method:(float)f Arg1:(int)i1 Arg2:(int)i2;
++ (int)Method:(float)f Arg1:(int)i1 OtherArg:(id)obj;
++ (int)Method:(float)f SomeArg:(int)i1 OtherArg:(id)obj;
++ (int)OtherMethod:(float)f Arg1:(int)i1 Arg2:(int)i2;
+@end
+
+void test_overload2(void) {
+ [Overload2 Method:1 Arg1:1 OtherArg:ovl];
+}
+
+void msg_id(id x) {
+ [x Method:1 Arg1:1 OtherArg:ovl];
+ [[x blarg] Method:1 Arg1:1 OtherArg:ovl];
+ [id Method:1 Arg1:1 OtherArg:ovl];
+}
+
// RUN: c-index-test -code-completion-at=%s:23:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText categoryClassMethod}
// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)a}{HorizontalSpace }{Text withKeyword:}{Placeholder (int)b}
@@ -153,3 +172,62 @@ void f(Ellipsis *e) {
// CHECK-CCA: {TypedText super}
// RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s
// CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}{Placeholder , ...}
+// RUN: c-index-test -code-completion-at=%s:116:14 %s | FileCheck -check-prefix=CHECK-CCC %s
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text SomeArg:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// RUN: c-index-test -code-completion-at=%s:116:23 %s | FileCheck -check-prefix=CHECK-CCD %s
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText }
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// RUN: c-index-test -code-completion-at=%s:116:30 %s | FileCheck -check-prefix=CHECK-CCE %s
+// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)i2}
+// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj}
+// RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCF %s
+// CHECK-CCF: {ResultType SEL}{TypedText _cmd}
+// CHECK-CCF: TypedefDecl:{TypedText Class}
+// CHECK-CCF: ObjCInterfaceDecl:{TypedText Foo}
+// CHECK-CCF: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )}
+// CHECK-CCF: TypedefDecl:{TypedText id}
+// CHECK-CCF: ObjCInterfaceDecl:{TypedText MyClass}
+// CHECK-CCF: ObjCInterfaceDecl:{TypedText MySubClass}
+// CHECK-CCF: TypedefDecl:{TypedText SEL}
+// CHECK-CCF: {ResultType Class}{TypedText self}
+// CHECK-CCF: {TypedText super}
+// RUN: c-index-test -code-completion-at=%s:120:6 %s | FileCheck -check-prefix=CHECK-CCG %s
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText categoryInstanceMethod}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText instanceMethod1}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text SomeArg:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)x}{HorizontalSpace }{Text second:}{Placeholder (id)y}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod:}{Placeholder (id)obj}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)value}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText secondProtocolInstanceMethod}
+// RUN: c-index-test -code-completion-at=%s:121:14 %s | FileCheck -check-prefix=CHECK-CCG %s
+// RUN: c-index-test -code-completion-at=%s:122:7 %s | FileCheck -check-prefix=CHECK-CCH %s
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText categoryClassMethod}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod1:}{Placeholder (id)a}{HorizontalSpace }{Text withKeyword:}{Placeholder (int)b}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType void}{TypedText classMethod2}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)f}{HorizontalSpace }{Text SomeArg:}{Placeholder (int)i1}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)obj}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)obj}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubClassMethod}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubPrivateMethod}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText new}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)f}{HorizontalSpace }{Text Arg1:}{Placeholder (int)i1}{HorizontalSpace }{Text Arg2:}{Placeholder (int)i2}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText protocolClassMethod}
+
diff --git a/test/Index/complete-pch.m b/test/Index/complete-pch.m
new file mode 100644
index 0000000..09192ae
--- /dev/null
+++ b/test/Index/complete-pch.m
@@ -0,0 +1,26 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+@interface C
+- (int)instanceMethod3:(int)x;
++ (int)classMethod3:(float)f;
+@end
+
+void msg_id(id x) {
+ [id classMethod1:1.0];
+ [x instanceMethod1:5];
+}
+
+// Build the precompiled header
+// RUN: %clang -x objective-c-header -o %t.h.pch %S/Inputs/complete-pch.h
+
+// Run the actual tests
+// RUN: c-index-test -code-completion-at=%s:10:7 -include %t.h %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod1:}{Placeholder (double)d}
+// CHECK-CC1: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod2:}{Placeholder (float)f}
+// CHECK-CC1: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod3:}{Placeholder (float)f}
+
+// RUN: c-index-test -code-completion-at=%s:11:6 -include %t.h %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText instanceMethod1:}{Placeholder (int)x}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText instanceMethod2:}{Placeholder (int)x}
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType int}{TypedText instanceMethod3:}{Placeholder (int)x}
diff --git a/test/Index/invalid-code-rdar_7833619.m b/test/Index/invalid-code-rdar_7833619.m
new file mode 100644
index 0000000..0034539
--- /dev/null
+++ b/test/Index/invalid-code-rdar_7833619.m
@@ -0,0 +1,4 @@
+// RUN: c-index-test -test-load-source all %s
+// All we care about in this test is that it doesn't crash.
+typedef r7833619_a (*r7833619_b)(r7833619_c *r7833619_d, r7833619_c *r7833619_e);
+
diff --git a/test/Index/load-exprs.c b/test/Index/load-exprs.c
index f72f104..248bc6e 100644
--- a/test/Index/load-exprs.c
+++ b/test/Index/load-exprs.c
@@ -7,12 +7,49 @@ void f(void *ptr) {
void *xx = ptr ? : &x;
}
-// RUN: c-index-test -test-load-source all %s | FileCheck %s
+int test_blocks(int x) {
+ __block int y = x;
+ ^{
+ static int z = 0;
+ y = (++z) + x;
+ ^{
+ ++z;
+ ++y;
+ }();
+ }();
+ return y;
+}
+
+// RUN: c-index-test -test-load-source all %s -fblocks | FileCheck %s
+// CHECK: load-exprs.c:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:13 - 1:14]
+// CHECK: load-exprs.c:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23]
+// CHECK: load-exprs.c:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:16 - 2:17]
+// CHECK: load-exprs.c:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:19 - 2:20]
+// CHECK: load-exprs.c:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:6 - 8:2]
+// CHECK: load-exprs.c:3:14: ParmDecl=ptr:3:14 (Definition) Extent=[3:8 - 3:17]
+// CHECK: load-exprs.c:4:6: VarDecl=t_ptr:4:6 (Definition) Extent=[4:3 - 4:22]
+// CHECK: load-exprs.c:4:3: TypeRef=T:1:13 Extent=[4:3 - 4:4]
// CHECK: load-exprs.c:4:15: TypeRef=T:1:13 Extent=[4:15 - 4:16]
+// CHECK: load-exprs.c:4:19: DeclRefExpr=ptr:3:14 Extent=[4:19 - 4:22]
// CHECK: load-exprs.c:5:16: TypeRef=T:1:13 Extent=[5:16 - 5:17]
+// CHECK: load-exprs.c:6:12: VarDecl=x:6:12 (Definition) Extent=[6:10 - 6:32]
// CHECK: load-exprs.c:6:10: TypeRef=struct X:2:8 Extent=[6:10 - 6:11]
// CHECK: load-exprs.c:6:24: TypeRef=struct X:2:8 Extent=[6:24 - 6:25]
// CHECK: load-exprs.c:7:9: VarDecl=xx:7:9 (Definition) Extent=[7:3 - 7:24]
// CHECK: load-exprs.c:7:14: DeclRefExpr=ptr:3:14 Extent=[7:14 - 7:17]
// CHECK: load-exprs.c:7:23: DeclRefExpr=x:6:12 Extent=[7:23 - 7:24]
+// CHECK: load-exprs.c:10:5: FunctionDecl=test_blocks:10:5 (Definition) Extent=[10:5 - 21:2]
+// CHECK: load-exprs.c:10:21: ParmDecl=x:10:21 (Definition) Extent=[10:17 - 10:22]
+// CHECK: load-exprs.c:11:15: VarDecl=y:11:15 (Definition) Extent=[11:11 - 11:20]
+// CHECK: load-exprs.c:11:19: DeclRefExpr=x:10:21 Extent=[11:19 - 11:20]
+// CHECK: load-exprs.c:12:3: CallExpr= Extent=[12:3 - 19:7]
+// CHECK: load-exprs.c:13:17: VarDecl=z:13:17 (Definition) Extent=[13:13 - 13:22]
+// CHECK: load-exprs.c:14:6: DeclRefExpr= Extent=[14:6 - 14:7]
+// CHECK: load-exprs.c:14:13: DeclRefExpr=z:13:17 Extent=[14:13 - 14:14]
+// CHECK: load-exprs.c:14:18: DeclRefExpr= Extent=[14:18 - 14:19]
+// CHECK: load-exprs.c:15:6: CallExpr= Extent=[15:6 - 18:9]
+// CHECK: load-exprs.c:16:10: DeclRefExpr=z:13:17 Extent=[16:10 - 16:11]
+// CHECK: load-exprs.c:17:10: DeclRefExpr= Extent=[17:10 - 17:11]
+// CHECK: load-exprs.c:20:10: DeclRefExpr=y:11:15 Extent=[20:10 - 20:11]
+
diff --git a/test/Index/local-symbols.m b/test/Index/local-symbols.m
new file mode 100644
index 0000000..8557e7f
--- /dev/null
+++ b/test/Index/local-symbols.m
@@ -0,0 +1,26 @@
+// RUN: c-index-test -test-load-source local %s | FileCheck %s
+
+// From: <rdar://problem/7568881>
+// The method 'bar' was also being reported outside the @implementation
+
+@interface Foo {
+ id x;
+}
+- (id) bar;
+@end
+
+@implementation Foo
+- (id) bar {
+ return 0;
+}
+@end
+
+// CHECK: local-symbols.m:6:12: ObjCInterfaceDecl=Foo:6:12 Extent=[6:1 - 10:5]
+// CHECK: local-symbols.m:7:6: ObjCIvarDecl=x:7:6 (Definition) Extent=[7:6 - 7:7]
+// CHECK: local-symbols.m:7:3: TypeRef=id:0:0 Extent=[7:3 - 7:5]
+// CHECK: local-symbols.m:9:1: ObjCInstanceMethodDecl=bar:9:1 Extent=[9:1 - 9:12]
+// CHECK: local-symbols.m:9:4: TypeRef=id:0:0 Extent=[9:4 - 9:6]
+// CHECK: local-symbols.m:12:1: ObjCImplementationDecl=Foo:12:1 (Definition) Extent=[12:1 - 16:2]
+// CHECK: local-symbols.m:13:1: ObjCInstanceMethodDecl=bar:13:1 (Definition) Extent=[13:1 - 15:2]
+// CHECK: local-symbols.m:13:4: TypeRef=id:0:0 Extent=[13:4 - 13:6]
+
diff --git a/test/Index/print-usrs.c b/test/Index/print-usrs.c
index 9cd64f7..898778b 100644
--- a/test/Index/print-usrs.c
+++ b/test/Index/print-usrs.c
@@ -8,8 +8,8 @@ ObjCMethod baz:with 1 c:objc(cs)NSObject
ObjCProperty gimme c:objc(cs)NSObject
ObjCProtocol blah
// CHECK: c:objc(cs)NSObject
-// CHECK: c:objc(cy)NSObject^foo
-// CHECK: c:objc(cs)NSObject@^x
+// CHECK: c:objc(cy)NSObject@foo
+// CHECK: c:objc(cs)NSObject@x
// CHECK: c:objc(cs)NSObject(cm)foo:
// CHECK: c:objc(cs)NSObject(im)baz:with
// CHECK: c:objc(cs)NSObject(py)gimme
diff --git a/test/Index/usrs.m b/test/Index/usrs.m
new file mode 100644
index 0000000..eb0817c
--- /dev/null
+++ b/test/Index/usrs.m
@@ -0,0 +1,87 @@
+// RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
+
+static inline int my_helper(int x, int y) { return x + y; }
+
+enum {
+ ABA,
+ CADABA
+};
+
+enum {
+ FOO,
+ BAR
+};
+
+typedef struct {
+ int wa;
+ int moo;
+} MyStruct;
+
+enum Pizza {
+ CHEESE,
+ MUSHROOMS
+};
+
+@interface Foo {
+ id x;
+ id y;
+}
+- (id) godzilla;
++ (id) kingkong;
+@property int d1;
+@end
+
+@implementation Foo
+- (id) godzilla {
+ static int a = 0;
+ extern int z;
+ return 0;
+}
++ (id) kingkong {
+ int local_var;
+ return 0;
+}
+@synthesize d1;
+@end
+
+int z;
+
+static int local_func(int x) { return x; }
+
+// CHECK: usrs.m c:usrs.m@3:19@F@my_helper Extent=[3:19 - 3:60]
+// CHECK: usrs.m c:usrs.m@3:29@x Extent=[3:29 - 3:34]
+// CHECK: usrs.m c:usrs.m@3:36@y Extent=[3:36 - 3:41]
+// CHECK: usrs.m c:@Ea@usrs.m@5:1 Extent=[5:1 - 8:2]
+// CHECK: usrs.m c:@Ea@usrs.m@5:1@ABA Extent=[6:3 - 6:6]
+// CHECK: usrs.m c:@Ea@usrs.m@5:1@CADABA Extent=[7:3 - 7:9]
+// CHECK: usrs.m c:@Ea@usrs.m@10:1 Extent=[10:1 - 13:2]
+// CHECK: usrs.m c:@Ea@usrs.m@10:1@FOO Extent=[11:3 - 11:6]
+// CHECK: usrs.m c:@Ea@usrs.m@10:1@BAR Extent=[12:3 - 12:6]
+// CHECK: usrs.m c:@SA@MyStruct Extent=[15:9 - 18:2]
+// CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:7 - 16:9]
+// CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:7 - 17:10]
+// CHECK: usrs.m c:@T@usrs.m@18:3@MyStruct Extent=[18:3 - 18:11]
+// CHECK: usrs.m c:@E@Pizza Extent=[20:1 - 23:2]
+// CHECK: usrs.m c:@E@Pizza@CHEESE Extent=[21:3 - 21:9]
+// CHECK: usrs.m c:@E@Pizza@MUSHROOMS Extent=[22:3 - 22:12]
+// CHECK: usrs.m c:objc(cs)Foo Extent=[25:1 - 32:5]
+// CHECK: usrs.m c:objc(cs)Foo@x Extent=[26:6 - 26:7]
+// CHECK: usrs.m c:objc(cs)Foo@y Extent=[27:6 - 27:7]
+// CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[31:15 - 31:17]
+// CHECK: usrs.m c:objc(cs)Foo(im)godzilla Extent=[29:1 - 29:17]
+// CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[30:1 - 30:17]
+// CHECK: usrs.m c:objc(cs)Foo(im)d1 Extent=[31:15 - 31:17]
+// CHECK: usrs.m c:objc(cs)Foo(im)setD1: Extent=[31:15 - 31:17]
+// CHECK: usrs.m c:usrs.m@31:15@d1 Extent=[31:15 - 31:17]
+// CHECK: usrs.m c:objc(cs)Foo Extent=[34:1 - 45:2]
+// CHECK: usrs.m c:objc(cs)Foo(im)godzilla Extent=[35:1 - 39:2]
+// CHECK: usrs.m c:usrs.m@36:10@a Extent=[36:10 - 36:19]
+// CHECK: usrs.m c:@z Extent=[37:10 - 37:15]
+// CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[40:1 - 43:2]
+// CHECK: usrs.m c:usrs.m@41:3@local_var Extent=[41:3 - 41:16]
+// CHECK: usrs.m c:objc(cs)Foo@d1 Extent=[44:13 - 44:15]
+// CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[44:1 - 44:15]
+// CHECK: usrs.m c:@z Extent=[47:1 - 47:6]
+// CHECK: usrs.m c:usrs.m@49:12@F@local_func Extent=[49:12 - 49:43]
+// CHECK: usrs.m c:usrs.m@49:23@x Extent=[49:23 - 49:28]
+
diff --git a/test/Lexer/gnu_keywords.c b/test/Lexer/gnu_keywords.c
new file mode 100644
index 0000000..3234f58
--- /dev/null
+++ b/test/Lexer/gnu_keywords.c
@@ -0,0 +1,12 @@
+// RUN: %clang -DGNU_KEYWORDS -std=gnu89 -fsyntax-only -verify %s
+// RUN: %clang -DGNU_KEYWORDS -std=c99 -fgnu-keywords -fsyntax-only -verify %s
+// RUN: %clang -std=c99 -fsyntax-only -verify %s
+// RUN: %clang -std=gnu89 -fno-gnu-keywords -fsyntax-only -verify %s
+
+void f() {
+#ifdef GNU_KEYWORDS
+ asm ("ret" : :);
+#else
+ int asm;
+#endif
+}
diff --git a/test/Lexer/utf-16.c b/test/Lexer/utf-16.c
new file mode 100644
index 0000000..2b313e4
--- /dev/null
+++ b/test/Lexer/utf-16.c
@@ -0,0 +1,6 @@
+// RUN: not %clang %s -fsyntax-only -verify
+// rdar://7876588
+
+// This test verifies that clang gives a decent error for UTF-16 source files.
+
+#include "utf-16.c.txt" // expected-error {{UTF-16 (LE) byte order mark detected}}
diff --git a/test/Lexer/utf-16.c.txt b/test/Lexer/utf-16.c.txt
new file mode 100644
index 0000000..4f3d169
--- /dev/null
+++ b/test/Lexer/utf-16.c.txt
Binary files differ
diff --git a/test/Misc/message-length.c b/test/Misc/message-length.c
index 3c74605..3e69b6a 100644
--- a/test/Misc/message-length.c
+++ b/test/Misc/message-length.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s
-// RUN: %clang_cc1 -fmessage-length 1 %s
-
+// RUN: not %clang_cc1 -fmessage-length 72 %s 2>&1 | FileCheck -strict-whitespace %s
+// RUN: not %clang_cc1 -fmessage-length 1 %s
+// RUN: not %clang_cc1 -fmessage-length 8 %s 2>&1 | FileCheck -check-prefix=CHECK-DOT %s
// Hack so we can check things better, force the file name and line.
# 1 "FILE" 1
@@ -30,3 +30,13 @@ void a_very_long_line(int *ip, float *FloatPointer) {
// CHECK: FILE:23:78
// CHECK: {{^ ...// some long comment text and a brace, eh {} }}
+
+struct A { int x; };
+void h(struct A *a) {
+ // CHECK-DOT: member
+ // CHECK-DOT: reference
+ // CHECK-DOT: type
+ (void)a
+ .
+ x;
+}
diff --git a/test/Misc/tabstop.c b/test/Misc/tabstop.c
index 66685c6..49c4d7b 100644
--- a/test/Misc/tabstop.c
+++ b/test/Misc/tabstop.c
@@ -39,12 +39,9 @@ void f(void)
// CHECK-3: {{^ }}if (0 & 1 == 1)
// CHECK-3: {{^ }} ( )
-// CHECK-3: {{^ }} ( )
// CHECK-4: {{^ }}if (0 & 1 == 1)
// CHECK-4: {{^ }} ( )
-// CHECK-4: {{^ }} ( )
// CHECK-5: {{^ }}if (0 & 1 == 1)
// CHECK-5: {{^ }} ( )
-// CHECK-5: {{^ }} ( )
diff --git a/test/Misc/verify.c b/test/Misc/verify.c
new file mode 100644
index 0000000..85b034e
--- /dev/null
+++ b/test/Misc/verify.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct s; // expected-note 7 {{forward declaration of 'struct s'}}
+
+// standard string matching
+struct s s1; // expected-error {{tentative definition has type 'struct s' that is never completed}}
+struct s s2; // expected-error {{tentative definition has type}}
+
+// regex matching
+struct s r1; // expected-error-re {{tentative definition has type 'struct s' that is never completed}}
+struct s r2; // expected-error-re {{tentative definition has type '.*[[:space:]]*.*' that is never completed}}
+struct s r3; // expected-error-re {{tentative definition has type '(.*)[[:space:]]*(.*)' that is never completed}}
+struct s r4; // expected-error-re {{^tentative}}
+struct s r5; // expected-error-re {{completed$}}
diff --git a/test/PCH/exprs.c b/test/PCH/exprs.c
index 2b588a2..038a18b 100644
--- a/test/PCH/exprs.c
+++ b/test/PCH/exprs.c
@@ -5,6 +5,7 @@
// RUN: %clang_cc1 -emit-pch -fblocks -o %t %S/exprs.h
// RUN: %clang_cc1 -fblocks -include-pch %t -fsyntax-only -verify %s
+__SIZE_TYPE__ size_type_value;
int integer;
long long_integer;
double floating;
@@ -35,6 +36,9 @@ char_literal *int_ptr3 = &integer;
// UnaryOperator
negate_enum *int_ptr4 = &integer;
+// OffsetOfExpr
+offsetof_type *offsetof_ptr = &size_type_value;
+
// SizeOfAlignOfExpr
typeof(sizeof(float)) size_t_value;
typeof_sizeof *size_t_ptr = &size_t_value;
diff --git a/test/PCH/exprs.h b/test/PCH/exprs.h
index 7012422..5af8c7c 100644
--- a/test/PCH/exprs.h
+++ b/test/PCH/exprs.h
@@ -25,6 +25,19 @@ typedef typeof('a') char_literal;
// UnaryOperator
typedef typeof(-Enumerator) negate_enum;
+// OffsetOfExpr
+struct X {
+ int member;
+};
+struct Y {
+ struct X array[5];
+};
+struct Z {
+ struct Y y;
+};
+typedef typeof(__builtin_offsetof(struct Z, y.array[1 + 2].member))
+ offsetof_type;
+
// SizeOfAlignOfExpr
typedef typeof(sizeof(int)) typeof_sizeof;
typedef typeof(sizeof(Enumerator)) typeof_sizeof2;
diff --git a/test/PCH/functions.c b/test/PCH/functions.c
index eb8579a..23becb6 100644
--- a/test/PCH/functions.c
+++ b/test/PCH/functions.c
@@ -6,7 +6,7 @@
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
int f0(int x0, int y0, ...) { return x0 + y0; }
-
+// expected-note{{passing argument to parameter here}}
float *test_f1(int val, double x, double y) {
if (val > 5)
return f1(x, y);
@@ -15,7 +15,7 @@ float *test_f1(int val, double x, double y) {
}
void test_g0(int *x, float * y) {
- g0(y); // expected-warning{{incompatible pointer types passing 'float *', expected 'int *'}}
+ g0(y); // expected-warning{{incompatible pointer types passing 'float *' to parameter of type 'int *'}}
g0(x);
}
diff --git a/test/PCH/functions.h b/test/PCH/functions.h
index 3972430..f57400f 100644
--- a/test/PCH/functions.h
+++ b/test/PCH/functions.h
@@ -1,6 +1,9 @@
/* For use with the functions.c test */
-int f0(int x, int y, ...);
+
+
+
+int f0(int x, int y, ...);
float *f1(float x, float y);
void g0(int *);
diff --git a/test/PCH/objc_stmts.h b/test/PCH/objc_stmts.h
new file mode 100644
index 0000000..5f705df
--- /dev/null
+++ b/test/PCH/objc_stmts.h
@@ -0,0 +1,22 @@
+/* For use with the methods.m test */
+
+@interface A
+@end
+
+@interface B
+@end
+
+@interface TestPCH
+- (void)instMethod;
+@end
+
+@implementation TestPCH
+- (void)instMethod {
+ @try {
+ } @catch(A *a) {
+ } @catch(B *b) {
+ } @catch(...) {
+ } @finally {
+ }
+}
+@end
diff --git a/test/PCH/objc_stmts.m b/test/PCH/objc_stmts.m
new file mode 100644
index 0000000..ed7466a
--- /dev/null
+++ b/test/PCH/objc_stmts.m
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/objc_stmts.h -emit-llvm -o - %s
+// RUN: %clang_cc1 -include %S/objc_stmts.h -ast-dump -o - %s 2>&1 | FileCheck %s
+
+// Test with pch.
+// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_stmts.h
+// RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s
+// RUN: %clang_cc1 -include-pch %t -ast-dump -o - %s 2>&1 | FileCheck %s
+
+// CHECK: catch parm = "A *a"
+// CHECK: catch parm = "B *b"
+// CHECK: catch all
diff --git a/test/PCH/pr4489.c b/test/PCH/pr4489.c
index 1d8be2d..033e55b 100644
--- a/test/PCH/pr4489.c
+++ b/test/PCH/pr4489.c
@@ -1,6 +1,13 @@
// RUN: %clang -x c-header -o %t.pch %s
// RUN: echo > %t.empty.c
// RUN: %clang -include %t -x c %t.empty.c -emit-llvm -S -o -
+
+// FIXME: This test is forcibly disabled, it is flaky on the clang-i686-xp-msvc9
+// buildbot.
+//
+// RUN: false
+// XFAIL: *
+
// PR 4489: Crash with PCH
// PR 4492: Crash with PCH (round two)
// PR 4509: Crash with PCH (round three)
diff --git a/test/PCH/types.c b/test/PCH/types.c
index 1ebc01b..c21b33a 100644
--- a/test/PCH/types.c
+++ b/test/PCH/types.c
@@ -66,7 +66,7 @@ int_ptr_ptr ipp = &int_value_ptr;
// TYPE_TYPEOF_EXPR
typeof_17 *t17 = &int_value;
struct S { int x, y; };
-typeof_17 t17_2 = (struct S){1, 2}; // expected-error{{incompatible type initializing}}
+typeof_17 t17_2 = (struct S){1, 2}; // expected-error{{initializing 'typeof_17' (aka 'int') with an expression of incompatible type 'struct S'}}
// TYPE_TYPEOF
int_ptr_ptr2 ipp2 = &int_value_ptr;
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
index c2a32cf..ed14457 100644
--- a/test/Parser/altivec.c
+++ b/test/Parser/altivec.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -faltivec -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
__vector char vv_c;
__vector signed char vv_sc;
@@ -40,6 +40,8 @@ vector int f__r();
void f_a(vector int a);
void f_a2(int b, vector int a);
+vector int v = (vector int)(-1);
+
// These should have warnings.
__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
@@ -81,8 +83,8 @@ void f() {
gccvector unsigned int gv = v;
gccvector int gvi = (gccvector int)v;
__attribute__((vector_size(8))) unsigned int gv8;
- gv8 = gccv; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int', expected '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
- av = gv8; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int', expected '__vector unsigned int'}}
+ gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
+ av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
v = gccv;
__vector unsigned int tv = gccv;
diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c
index ca606f5..b287363 100644
--- a/test/Parser/attributes.c
+++ b/test/Parser/attributes.c
@@ -52,3 +52,7 @@ int foo42(void) {
void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void);
void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn));
+
+
+// PR6287
+void __attribute__((returns_twice)) returns_twice_test();
diff --git a/test/Parser/builtin_types_compatible.c b/test/Parser/builtin_types_compatible.c
index 325615c..ac81e7b 100644
--- a/test/Parser/builtin_types_compatible.c
+++ b/test/Parser/builtin_types_compatible.c
@@ -35,7 +35,7 @@ static void test()
struct xx { int a; } x, y;
c = __builtin_choose_expr(a+3-7, b, x); // expected-error{{'__builtin_choose_expr' requires a constant expression}}
- c = __builtin_choose_expr(0, b, x); // expected-error{{incompatible type assigning 'struct xx', expected 'int'}}
+ c = __builtin_choose_expr(0, b, x); // expected-error{{assigning to 'int' from incompatible type 'struct xx'}}
c = __builtin_choose_expr(5+3-7, b, x);
y = __builtin_choose_expr(4+3-7, b, x);
diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
index 085ff4c..db37793 100644
--- a/test/Parser/check-syntax-1.m
+++ b/test/Parser/check-syntax-1.m
@@ -11,9 +11,7 @@ typedef float CGFloat;
// rdar: // 7822196
@interface A
-(void) x; // expected-error {{method type specifier must start with '-' or '+'}} \
- // expected-warning {{type specifier missing, defaults to 'int' [-Wimplicit-int]}} \
- // expected-error {{cannot declare variable inside @interface or @protocol}}
+(void) x; // expected-error {{method type specifier must start with '-' or '+'}}
(int)im; // expected-error {{method type specifier must start with '-' or '+'}} \
- ok;
@end
diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
index 3610c0e..66d4f32 100644
--- a/test/Parser/cxx-altivec.cpp
+++ b/test/Parser/cxx-altivec.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -faltivec -fsyntax-only -verify %s
-
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
// This is the same as the C version:
__vector char vv_c;
@@ -42,6 +41,8 @@ vector int f__r();
void f_a(vector int a);
void f_a2(int b, vector int a);
+vector int v = (vector int)(-1);
+
// These should have warnings.
__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
@@ -81,8 +82,8 @@ void f() {
gccvector unsigned int gv = v;
gccvector int gvi = (gccvector int)v;
__attribute__((vector_size(8))) unsigned int gv8;
- gv8 = gccv; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int', expected '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
- av = gv8; // expected-error {{incompatible type assigning '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int', expected '__vector unsigned int'}}
+ gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
+ av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
v = gccv;
__vector unsigned int tv = gccv;
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
index c8b4716..98d962a 100644
--- a/test/Parser/cxx-casting.cpp
+++ b/test/Parser/cxx-casting.cpp
@@ -5,8 +5,6 @@ char *const_cast_test(const char *var)
return const_cast<char*>(var);
}
-#if 0
-// FIXME: Uncomment when C++ is supported more.
struct A {
virtual ~A() {}
};
@@ -18,7 +16,6 @@ struct B *dynamic_cast_test(struct A *a)
{
return dynamic_cast<struct B*>(a);
}
-#endif
char *reinterpret_cast_test()
{
@@ -34,3 +31,9 @@ char postfix_expr_test()
{
return reinterpret_cast<char*>(0xdeadbeef)[0];
}
+
+// This was being incorrectly tentatively parsed.
+namespace test1 {
+ template <class T> class A {};
+ void foo() { A<int>(*(A<int>*)0); }
+}
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index 576e57d..4abbbc5 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -8,7 +8,7 @@ protected:
struct S {};
enum {};
- int; // expected-error {{declaration does not declare anything}}
+ int; // expected-warning {{declaration does not declare anything}}
int : 1, : 2;
public:
diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp
index 2fe30cd..59350b5 100644
--- a/test/Parser/cxx-friend.cpp
+++ b/test/Parser/cxx-friend.cpp
@@ -21,9 +21,9 @@ class B {
// 'A' here should refer to the declaration above.
friend class A;
- friend C; // expected-error {{must specify 'class' to befriend}}
- friend U; // expected-error {{must specify 'union' to befriend}}
- friend int; // expected-error {{friends can only be classes or functions}}
+ friend C; // expected-warning {{must specify 'class' to befriend}}
+ friend U; // expected-warning {{must specify 'union' to befriend}}
+ friend int; // expected-warning {{non-class type 'int' cannot be a friend}}
friend void myfunc();
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
index 3f8f1ec..3a97efa 100644
--- a/test/Parser/cxx-template-decl.cpp
+++ b/test/Parser/cxx-template-decl.cpp
@@ -6,7 +6,7 @@ template x; // expected-error {{C++ requires a type specifier for al
// expected-error {{does not refer}}
export template x; // expected-error {{expected '<' after 'template'}}
export template<class T> class x0; // expected-warning {{exported templates are unsupported}}
-template < ; // expected-error {{parse error}} expected-error {{declaration does not declare anything}}
+template < ; // expected-error {{parse error}} expected-warning {{declaration does not declare anything}}
template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
// expected-error{{extraneous}}
template <template <typename> > struct Err2; // expected-error {{expected 'class' before '>'}} \
diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c
index 91803c1..31712af 100644
--- a/test/Parser/declarators.c
+++ b/test/Parser/declarators.c
@@ -53,7 +53,7 @@ myenum c; // expected-error {{must use 'enum' tag to refer to type 'myenum'
float *test7() {
// We should recover 'b' by parsing it with a valid type of "struct xyz", which
// allows us to diagnose other bad things done with y, such as this.
- return &b.y; // expected-warning {{incompatible pointer types returning 'int *', expected 'float *'}}
+ return &b.y; // expected-warning {{incompatible pointer types returning 'int *' from a function with result type 'float *'}}
}
struct xyz test8() { return a; } // a should be be marked invalid, no diag.
diff --git a/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c
index 900b4ec..a2b31f9 100644
--- a/test/Parser/implicit-casts.c
+++ b/test/Parser/implicit-casts.c
@@ -14,7 +14,7 @@ void test2() {
}
int test3() {
int a[2];
- a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning 'int ()', expected 'int'}}
+ a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning to 'int' from 'int ()'}}
return 0;
}
short x; void test4(char c) { x += c; }
diff --git a/test/Parser/objc-init.m b/test/Parser/objc-init.m
index 0c23aeb..32ba948 100644
--- a/test/Parser/objc-init.m
+++ b/test/Parser/objc-init.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic
+// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %s
// rdar://5707001
@interface NSNumber;
@@ -14,7 +15,7 @@ void test1() {
id objects[] = {[NSNumber METH]};
}
-void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value}}
+void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
id objects[] = {[x METH]};
}
diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m
index 62984a4..b6671d1 100644
--- a/test/Parser/objc-quirks.m
+++ b/test/Parser/objc-quirks.m
@@ -8,3 +8,21 @@ int @"s" = 5; // expected-error {{prefix attribute must be}}
@interface A
}; // expected-error {{missing @end}} expected-error {{expected external declaration}}
+
+
+
+// PR6811
+// 'super' isn't an expression, it is a magic context-sensitive keyword.
+@interface A2 {
+ id isa;
+}
+- (void)a;
+@end
+
+@interface B2 : A2 @end
+@implementation B2
+- (void)a
+{
+ [(super) a]; // expected-error {{use of undeclared identifier 'super'}}
+}
+@end
diff --git a/test/Preprocessor/expr_usual_conversions.c b/test/Preprocessor/expr_usual_conversions.c
index b1bddd3..5ca2cb8 100644
--- a/test/Preprocessor/expr_usual_conversions.c
+++ b/test/Preprocessor/expr_usual_conversions.c
@@ -1,8 +1,9 @@
-// RUN: %clang_cc1 %s -E 2>&1 | grep warning | wc -l | grep 2
+// RUN: %clang_cc1 %s -E -verify
#define INTMAX_MIN (-9223372036854775807LL -1)
-#if (-42 + 0U) / -2
+#if (-42 + 0U) /* expected-warning {{left side of operator converted from negative value to unsigned: -42 to 18446744073709551574}} */ \
+ / -2 /* expected-warning {{right side of operator converted from negative value to unsigned: -2 to 18446744073709551614}} */
foo
#endif
diff --git a/test/Preprocessor/if_warning.c b/test/Preprocessor/if_warning.c
index 98653a8..345ac95 100644
--- a/test/Preprocessor/if_warning.c
+++ b/test/Preprocessor/if_warning.c
@@ -19,3 +19,9 @@ extern int x;
#else 1 // Should not warn due to C99 6.10p4
#endif
#endif
+
+
+// PR6852
+#if 'somesillylongthing' // expected-warning {{character constant too long for its type}} \
+ // expected-warning {{multi-character character constant}}
+#endif
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index cccee76..b985098 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -11,7 +11,6 @@
//
// RUN: %clang_cc1 -x c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s
//
-// CXX0X:#define _GNU_SOURCE 1
// CXX0X:#define __DEPRECATED 1
// CXX0X:#define __GNUG__
// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1
@@ -22,7 +21,6 @@
//
// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s
//
-// CXX98:#define _GNU_SOURCE 1
// CXX98:#define __DEPRECATED 1
// CXX98:#define __GNUG__
// CXX98:#define __GXX_WEAK__ 1
@@ -50,6 +48,10 @@
// COMMON:#define __STDC__ 1
// COMMON:#define __VERSION__
// COMMON:#define __clang__ 1
+// COMMON:#define __clang_major__ 2
+// COMMON:#define __clang_minor__ 0
+// COMMON:#define __clang_patchlevel__ 0
+// COMMON:#define __clang_version__
// COMMON:#define __llvm__ 1
//
//
@@ -58,7 +60,6 @@
//
// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s
//
-// GXX98:#define _GNU_SOURCE 1
// GXX98:#define __DEPRECATED 1
// GXX98:#define __GNUG__
// GXX98:#define __GXX_WEAK__ 1
@@ -1028,3 +1029,6 @@
// X86_64:#define __x86_64 1
// X86_64:#define __x86_64__ 1
//
+// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
+// GNUSOURCE:#define _GNU_SOURCE 1
+//
diff --git a/test/Preprocessor/line-directive-output.c b/test/Preprocessor/line-directive-output.c
new file mode 100644
index 0000000..290703a
--- /dev/null
+++ b/test/Preprocessor/line-directive-output.c
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -E %s 2>&1 | FileCheck %s -strict-whitespace
+// PR6101
+int a;
+// CHECK: # 1 "{{.*}}line-directive-output.c"
+// CHECK: int a;
+
+// CHECK-NEXT: # 50 "{{.*}}line-directive-output.c"
+// CHECK-NEXT: int b;
+#line 50
+int b;
+
+// CHECK: # 13 "{{.*}}line-directive-output.c"
+// CHECK-NEXT: int c;
+# 13
+int c;
+
+
+// CHECK-NEXT: # 1 "A.c"
+#line 1 "A.c"
+// CHECK-NEXT: # 2 "A.c"
+#line 2
+
+// CHECK-NEXT: # 1 "B.c"
+#line 1 "B.c"
+
+// CHECK-NEXT: # 1000 "A.c"
+#line 1000 "A.c"
+
+int y;
+
+
+
+
+
+
+
+// CHECK: # 1010 "A.c"
+int z;
+
+extern int x;
+
+# 3 "temp2.h" 1
+extern int y;
+
+# 7 "A.c" 2
+extern int z;
+
+
+
+
+
+
+
+
+
+
+
+
+
+// CHECK: # 25 "A.c"
+
+
+// CHECK: # 50 "C.c" 1
+# 50 "C.c" 1
+
+
+// CHECK-NEXT: # 2000 "A.c" 2
+# 2000 "A.c" 2
+# 42 "A.c"
+# 44 "A.c"
+# 49 "A.c"
diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m
index 552209d..1f67ed3 100644
--- a/test/Preprocessor/non_fragile_feature.m
+++ b/test/Preprocessor/non_fragile_feature.m
@@ -6,3 +6,7 @@
#if !__has_feature(objc_nonfragile_abi)
#error Non-fragile ABI used for compilation but feature macro not set.
#endif
+
+#if !__has_feature(objc_weak_class)
+#error objc_weak_class should be enabled with nonfragile abi
+#endif
diff --git a/test/Preprocessor/output_paste_avoid.c b/test/Preprocessor/output_paste_avoid.c
index 8c6173a..8e4f3a4 100644
--- a/test/Preprocessor/output_paste_avoid.c
+++ b/test/Preprocessor/output_paste_avoid.c
@@ -4,8 +4,11 @@
#define y(a) ..a
A: y(.)
// This should print as ".. ." to avoid turning into ...
-// CHECK: A: . . .
+// CHECK: A: .. .
+#define X 0 .. 1
+B: X
+// CHECK: B: 0 .. 1
#define DOT .
C: ..DOT
diff --git a/test/Rewriter/dllimport-typedef.c b/test/Rewriter/dllimport-typedef.c
index 28d2e29..b86fa4a 100644
--- a/test/Rewriter/dllimport-typedef.c
+++ b/test/Rewriter/dllimport-typedef.c
@@ -10,8 +10,8 @@ typedef __declspec(dllimport) int CB(void);
void bar() { return 1; }
// CHECK-NEG: warning: void function 'bar' should not return a value
-// CHECK-NEG: 1 diagnostic generated
+// CHECK-NEG: 1 warning generated
// CHECK-POS: warning: 'dllimport' attribute only applies to variable and function type
// CHECK-POS: warning: void function 'bar' should not return a value
-// CHECK-POS: 2 diagnostics generated
+// CHECK-POS: 2 warnings generated
diff --git a/test/Rewriter/missing-dllimport.c b/test/Rewriter/missing-dllimport.c
index d2356bd..c060379 100644
--- a/test/Rewriter/missing-dllimport.c
+++ b/test/Rewriter/missing-dllimport.c
@@ -12,8 +12,8 @@ inline int __cdecl foo() { return 0; }
void bar() { return 1; }
// CHECK-NEG: warning: void function 'bar' should not return a value
-// CHECK-NEG: 1 diagnostic generated
+// CHECK-NEG: 1 warning generated
// CHECK-POS: warning: 'foo' redeclared without dllimport attribute: previous dllimport ignored
// CHECK-POS: warning: void function 'bar' should not return a value
-// CHECK-POS: 2 diagnostics generated
+// CHECK-POS: 2 warnings generated
diff --git a/test/Rewriter/rewrite-super-message.mm b/test/Rewriter/rewrite-super-message.mm
index 036aa1b..be0a963 100644
--- a/test/Rewriter/rewrite-super-message.mm
+++ b/test/Rewriter/rewrite-super-message.mm
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"id=struct objc_object *" -D"Class=struct objc_class *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o - %t-rw.cpp | FileCheck %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -DKEEP_ATTRIBUTES -D"id=struct objc_object *" -D"Class=struct objc_class *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o - %t-rw.cpp | FileCheck %t-rw.cpp
// radar 7738453
void *sel_registerName(const char *);
diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c
index badd238..6258114 100644
--- a/test/Sema/address_spaces.c
+++ b/test/Sema/address_spaces.c
@@ -37,6 +37,6 @@ struct _st {
__attribute__((address_space(256))) void * * const base = 0;
void * get_0(void) {
return base[0]; // expected-error {{illegal implicit cast between two pointers with different address spaces}} \
- expected-warning {{returning 'void __attribute__((address_space(256))) *' discards qualifiers, expected 'void *'}}
+ expected-warning {{returning 'void __attribute__((address_space(256))) *' from a function with result type 'void *' discards qualifiers}}
}
diff --git a/test/Sema/altivec-init.c b/test/Sema/altivec-init.c
index f22c1fc..57abc93 100644
--- a/test/Sema/altivec-init.c
+++ b/test/Sema/altivec-init.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -faltivec -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple=powerpc-apple-darwin8 -faltivec -verify -pedantic -fsyntax-only
typedef int v4 __attribute((vector_size(16)));
typedef short v8 __attribute((vector_size(16)));
@@ -6,7 +6,7 @@ typedef short v8 __attribute((vector_size(16)));
v8 foo(void) {
v8 a;
v4 b;
- a = (v8){4, 2}; // expected-error {{too few elements in vector initialization (expected 8 elements, have 2)}}
+ a = (v8){4, 2};
b = (v4)(5, 6, 7, 8, 9); // expected-warning {{excess elements in vector initializer}}
b = (v4)(5, 6, 8, 8.0f);
return (v8){0, 1, 2, 3, 1, 2, 3, 4};
diff --git a/test/Sema/anonymous-struct-union.c b/test/Sema/anonymous-struct-union.c
index 78995a9..d9e0839 100644
--- a/test/Sema/anonymous-struct-union.c
+++ b/test/Sema/anonymous-struct-union.c
@@ -50,12 +50,12 @@ struct Redecl {
void zz(); // expected-error{{duplicate member 'zz'}}
};
-union { // expected-error{{declaration does not declare anything}}
+union { // expected-warning{{declaration does not declare anything}}
int int_val;
float float_val;
};
-static union { // expected-error{{declaration does not declare anything}}
+static union { // expected-warning{{declaration does not declare anything}}
int int_val2;
float float_val2;
};
@@ -66,7 +66,7 @@ void f() {
}
void g() {
- union { // expected-error{{declaration does not declare anything}}
+ union { // expected-warning{{declaration does not declare anything}}
int i;
float f2;
};
@@ -78,7 +78,7 @@ void g() {
struct s0 { union { int f0; }; };
// <rdar://problem/6481130>
-typedef struct { }; // expected-error{{declaration does not declare anything}}
+typedef struct { }; // expected-warning{{declaration does not declare anything}}
// PR3675
struct s1 {
@@ -89,7 +89,7 @@ struct s1 {
};
// PR3680
-struct {}; // expected-error{{declaration does not declare anything}}
+struct {}; // expected-warning{{declaration does not declare anything}}
struct s2 {
union {
@@ -101,4 +101,4 @@ struct s2 {
typedef struct {
int x;
} a_struct;
-int tmp = (a_struct) { .x = 0 }; // expected-error {{incompatible type initializing 'a_struct', expected 'int'}}
+int tmp = (a_struct) { .x = 0 }; // expected-error {{initializing 'int' with an expression of incompatible type 'a_struct'}}
diff --git a/test/Sema/arm-layout.c b/test/Sema/arm-layout.c
index 1e239d2..4248685 100644
--- a/test/Sema/arm-layout.c
+++ b/test/Sema/arm-layout.c
@@ -1,20 +1,53 @@
// RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi apcs-gnu %s -verify
// RUN: %clang_cc1 -triple armv7-unknown-unknown -target-abi aapcs %s -verify
-#ifdef __ARM_EABI__
+#define check(name, cond) int _##name##_check[(cond) ? 1 : -1]
struct s0 { char field0; double field1; };
-int g0[sizeof(struct s0) == 16 ? 1 : -1];
+#ifdef __ARM_EABI__
+check(s0_size, sizeof(struct s0) == 16);
+#else
+check(s0_size, sizeof(struct s0) == 12);
+#endif
struct s1 { char field0; long double field1; };
-int g1[sizeof(struct s1) == 16 ? 1 : -1];
-
+#ifdef __ARM_EABI__
+check(s1_size, sizeof(struct s1) == 16);
#else
+check(s1_size, sizeof(struct s1) == 12);
+#endif
-struct s0 { char field0; double field1; };
-int g0[sizeof(struct s0) == 12 ? 1 : -1];
+struct s2 {
+ short field0;
+ int field1 : 24;
+ char field2;
+};
+#ifdef __ARM_EABI__
+check(s2_size, sizeof(struct s2) == 8);
+check(s2_offset_0, __builtin_offsetof(struct s2, field0) == 0);
+check(s2_offset_1, __builtin_offsetof(struct s2, field2) == 7);
+#else
+check(s2_size, sizeof(struct s2) == 6);
+check(s2_offset_0, __builtin_offsetof(struct s2, field0) == 0);
+check(s2_offset_1, __builtin_offsetof(struct s2, field2) == 5);
+#endif
-struct s1 { char field0; long double field1; };
-int g1[sizeof(struct s1) == 12 ? 1 : -1];
+struct s3 {
+ short field0;
+ int field1 : 24 __attribute__((aligned(4)));
+ char field2;
+};
+check(s3_size, sizeof(struct s3) == 8);
+check(s3_offset_0, __builtin_offsetof(struct s3, field0) == 0);
+check(s3_offset_1, __builtin_offsetof(struct s3, field2) == 7);
+struct s4 {
+ int field0 : 4
+};
+#ifdef __ARM_EABI__
+check(s4_size, sizeof(struct s4) == 4);
+check(s4_align, __alignof(struct s4) == 4);
+#else
+check(s4_size, sizeof(struct s4) == 1);
+check(s4_align, __alignof(struct s4) == 1);
#endif
diff --git a/test/Sema/array-constraint.c b/test/Sema/array-constraint.c
index 66f15c3..9fcac25 100644
--- a/test/Sema/array-constraint.c
+++ b/test/Sema/array-constraint.c
@@ -43,10 +43,10 @@ void check_size() {
static int I;
typedef int TA[I]; // expected-error {{variable length array declaration not allowed at file scope}}
-void strFunc(char *);
+void strFunc(char *); // expected-note{{passing argument to parameter here}}
const char staticAry[] = "test";
void checkStaticAry() {
- strFunc(staticAry); // expected-warning{{passing 'char const [5]' discards qualifiers, expected 'char *'}}
+ strFunc(staticAry); // expected-warning{{passing 'char const [5]' to parameter of type 'char *' discards qualifiers}}
}
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index 45d3183..f93b087 100644
--- a/test/Sema/array-init.c
+++ b/test/Sema/array-init.c
@@ -9,7 +9,7 @@ int ary2[] = { x, y, z }; // expected-error{{initializer element is not a compil
extern int fileScopeExtern[3] = { 1, 3, 5 }; // expected-warning{{'extern' variable has an initializer}}
-static long ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible pointer to integer conversion initializing 'char [4]', expected 'long'}}
+static long ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [4]'}}
void func() {
int x = 1;
@@ -44,11 +44,11 @@ void func() {
int a,b,c;
} z = { 1 };
- struct threeElements *p = 7; // expected-warning{{incompatible integer to pointer conversion initializing 'int', expected 'struct threeElements *'}}
+ struct threeElements *p = 7; // expected-warning{{incompatible integer to pointer conversion initializing 'struct threeElements *' with an expression of type 'int'}}
extern int blockScopeExtern[3] = { 1, 3, 5 }; // expected-error{{'extern' variable cannot have an initializer}}
- static long x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible pointer to integer conversion initializing 'char [4]', expected 'long'}}
+ static long x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [4]'}}
}
void test() {
@@ -155,10 +155,10 @@ void charArrays() {
char c[] = { "Hello" };
int l[sizeof(c) == 6 ? 1 : -1];
- int i[] = { "Hello "}; // expected-warning{{incompatible pointer to integer conversion initializing 'char [7]', expected 'int'}}
+ int i[] = { "Hello "}; // expected-warning{{incompatible pointer to integer conversion initializing 'int' with an expression of type 'char [7]'}}
char c2[] = { "Hello", "Good bye" }; //expected-warning{{excess elements in char array initializer}}
- int i2[1] = { "Hello" }; //expected-warning{{incompatible pointer to integer conversion initializing 'char [6]', expected 'int'}}
+ int i2[1] = { "Hello" }; //expected-warning{{incompatible pointer to integer conversion initializing 'int' with an expression of type 'char [6]'}}
char c3[5] = { "Hello" };
char c4[4] = { "Hello" }; //expected-warning{{initializer-string for char array is too long}}
@@ -191,12 +191,12 @@ void autoStructTest() {
struct s1 {char a; char b;} t1;
struct s2 {struct s1 c;} t2 = { t1 };
// The following is a less than great diagnostic (though it's on par with EDG).
-struct s1 t3[] = {t1, t1, "abc", 0}; //expected-warning{{incompatible pointer to integer conversion initializing 'char [4]', expected 'char'}}
+struct s1 t3[] = {t1, t1, "abc", 0}; //expected-warning{{incompatible pointer to integer conversion initializing 'char' with an expression of type 'char [4]'}}
int t4[sizeof t3 == 6 ? 1 : -1];
}
struct foo { int z; } w;
int bar (void) {
- struct foo z = { w }; //expected-error{{incompatible type initializing 'struct foo', expected 'int'}}
+ struct foo z = { w }; //expected-error{{initializing 'int' with an expression of incompatible type 'struct foo'}}
return z.z;
}
struct s3 {void (*a)(void);} t5 = {autoStructTest};
diff --git a/test/Sema/attr-format.c b/test/Sema/attr-format.c
index 0fadf98..a223e08 100644
--- a/test/Sema/attr-format.c
+++ b/test/Sema/attr-format.c
@@ -45,7 +45,7 @@ void e2(char *str, int c, ...) __attribute__((format(printf0, 2,3))); // expecte
// FreeBSD usage
#define __printf0like(fmt,va) __attribute__((__format__(__printf0__,fmt,va)))
void null(int i, const char *a, ...) __printf0like(2,0); // no-error
-void null(int i, const char *a, ...) {
+void null(int i, const char *a, ...) { // expected-note{{passing argument to parameter 'a' here}}
if (a)
(void)0/* vprintf(...) would go here */;
}
diff --git a/test/Sema/attr-noreturn.c b/test/Sema/attr-noreturn.c
index b17f9fd..5333a2c 100644
--- a/test/Sema/attr-noreturn.c
+++ b/test/Sema/attr-noreturn.c
@@ -40,3 +40,5 @@ f5 (unsigned long size)
__attribute__((noreturn)) void f(__attribute__((noreturn)) void (*x)(void)) {
x();
}
+
+typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{attribute requires 0 argument(s)}}
diff --git a/test/Sema/attr-section.c b/test/Sema/attr-section.c
index 614f294..a932525 100644
--- a/test/Sema/attr-section.c
+++ b/test/Sema/attr-section.c
@@ -12,4 +12,4 @@ int y __attribute__((section(
void test() {
__attribute__((section("NEAR,x"))) int n1; // expected-error {{'section' attribute is not valid on local variables}}
__attribute__((section("NEAR,x"))) static int n2; // ok.
-} \ No newline at end of file
+}
diff --git a/test/Sema/bitfield.c b/test/Sema/bitfield.c
index 6f129da..5bb194b 100644
--- a/test/Sema/bitfield.c
+++ b/test/Sema/bitfield.c
@@ -5,7 +5,7 @@ struct a {
int a : -1; // expected-error{{bit-field 'a' has negative width}}
// rdar://6081627
- int b : 33; // expected-error{{size of bit-field 'b' exceeds size of its type (32 bits)}}
+ int b : 33; // expected-error{{size of bit-field 'b' (33 bits) exceeds size of its type (32 bits)}}
int c : (1 + 0.25); // expected-error{{expression is not an integer constant expression}}
int d : (int)(1 + 0.25);
@@ -21,7 +21,7 @@ struct a {
int g : (_Bool)1;
// PR4017
- char : 10; // expected-error {{size of anonymous bit-field exceeds size of its type (8 bits)}}
+ char : 10; // expected-error {{size of anonymous bit-field (10 bits) exceeds size of its type (8 bits)}}
unsigned : -2; // expected-error {{anonymous bit-field has negative width (-2)}}
float : 12; // expected-error {{anonymous bit-field has non-integral type 'float'}}
};
diff --git a/test/Sema/block-call.c b/test/Sema/block-call.c
index 0aba75e..318bc6b 100644
--- a/test/Sema/block-call.c
+++ b/test/Sema/block-call.c
@@ -13,7 +13,7 @@ int main() {
int (^IFP) () = PFR; // OK
- const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int (^)()', expected 'int const (^)()'}}
+ const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int const (^)()' with an expression of type 'int (^)()'}}
const int (^CICC) () = CIC;
@@ -21,7 +21,7 @@ int main() {
int * const (^IPCC1) () = IPCC;
- int * (^IPCC2) () = IPCC; // expected-error {{incompatible block pointer types initializing 'int *const (^)()', expected 'int *(^)()'}}
+ int * (^IPCC2) () = IPCC; // expected-error {{incompatible block pointer types initializing 'int *(^)()' with an expression of type 'int *const (^)()'}}
int (^IPCC3) (const int) = PFR;
@@ -29,14 +29,14 @@ int main() {
int (^IPCC5) (int, char (^CArg) (double)) = IPCC4;
- int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{incompatible block pointer types initializing 'int (^)(int, char (^)(double))', expected 'int (^)(int, char (^)(float))'}}
+ int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{incompatible block pointer types initializing 'int (^)(int, char (^)(float))' with an expression of type 'int (^)(int, char (^)(double))'}}
IPCC2 = 0;
- IPCC2 = 1; // expected-error {{invalid conversion assigning integer 'int', expected block pointer 'int *(^)()'}}
+ IPCC2 = 1; // expected-error {{invalid block pointer conversion assigning to 'int *(^)()' from 'int'}}
int (^x)() = 0;
- int (^y)() = 3; // expected-error {{invalid conversion initializing integer 'int', expected block pointer 'int (^)()'}}
+ int (^y)() = 3; // expected-error {{invalid block pointer conversion initializing 'int (^)()' with an expression of type 'int'}}
int a = 1;
- int (^z)() = a+4; // expected-error {{invalid conversion initializing integer 'int', expected block pointer 'int (^)()'}}
+ int (^z)() = a+4; // expected-error {{invalid block pointer conversion initializing 'int (^)()' with an expression of type 'int'}}
}
int blah() {
diff --git a/test/Sema/block-misc.c b/test/Sema/block-misc.c
index ca71ab1..92be5b1 100644
--- a/test/Sema/block-misc.c
+++ b/test/Sema/block-misc.c
@@ -139,12 +139,12 @@ void test14() {
enum { LESS };
-void foo(long (^comp)()) {
+void foo(long (^comp)()) { // expected-note{{passing argument to parameter 'comp' here}}
}
void (^test15f)(void);
void test15() {
- foo(^{ return LESS; }); // expected-error {{incompatible block pointer types passing 'int (^)(void)', expected 'long (^)()'}}
+ foo(^{ return LESS; }); // expected-error {{incompatible block pointer types passing 'int (^)(void)' to parameter of type 'long (^)()'}}
}
__block int test16i; // expected-error {{__block attribute not allowed, only allowed on local variables}}
@@ -202,8 +202,8 @@ L0:
// radr://7438948
void test20() {
int n = 7;
- int vla[n]; // expected-note {{declared at}}
- int (*vm)[n] = 0; // expected-note {{declared at}}
+ int vla[n]; // expected-note {{declared here}}
+ int (*vm)[n] = 0; // expected-note {{declared here}}
vla[1] = 4341;
^{
(void)vla[1]; // expected-error {{cannot refer to declaration with a variably modified type inside block}}
@@ -213,8 +213,8 @@ void test20() {
// radr://7438948
void test21() {
- int a[7]; // expected-note {{declared at}}
- __block int b[10]; // expected-note {{declared at}}
+ int a[7]; // expected-note {{declared here}}
+ __block int b[10]; // expected-note {{declared here}}
a[1] = 1;
^{
(void)a[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c
index 2385106..10b3b84 100644
--- a/test/Sema/block-return.c
+++ b/test/Sema/block-return.c
@@ -4,7 +4,7 @@ typedef void (^CL)(void);
CL foo() {
short y;
- short (^add1)(void) = ^{ return y+1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(void)', expected 'short (^)(void)'}}
+ short (^add1)(void) = ^{ return y+1; }; // expected-error {{incompatible block pointer types initializing 'short (^)(void)' with an expression of type 'int (^)(void)'}}
CL X = ^{
if (2)
@@ -26,7 +26,7 @@ CL foo() {
return (char*)0;
};
- double (^A)(void) = ^ { // expected-error {{incompatible block pointer types initializing 'float (^)(void)', expected 'double (^)(void)'}}
+ double (^A)(void) = ^ { // expected-error {{incompatible block pointer types initializing 'double (^)(void)' with an expression of type 'float (^)(void)'}}
if (1)
return (float)1.0;
else
@@ -38,10 +38,10 @@ CL foo() {
if (3)
return "";
else
- return 2; // expected-warning {{incompatible integer to pointer conversion returning 'int', expected 'char *'}}
+ return 2; // expected-warning {{incompatible integer to pointer conversion returning 'int' from a function with result type 'char *'}}
};
- return ^{ return 1; }; // expected-error {{incompatible block pointer types returning 'int (^)(void)', expected 'CL'}}
+ return ^{ return 1; }; // expected-error {{incompatible block pointer types returning 'int (^)(void)' from a function with result type 'CL' (aka 'void (^)(void)')}}
}
typedef int (^CL2)(void);
@@ -78,8 +78,8 @@ static int funk(char *s) {
}
void next();
void foo4() {
- int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(char *)', expected 'int (^)(char const *)'}}
- int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (char *)', expected 'int (*)(char const *)'}}
+ int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(char const *)' with an expression of type 'int (^)(char *)'}}
+ int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (*)(char const *)' with an expression of type 'int (char *)'}}
int (^nested)(char *s) = ^(char *str) { void (^nest)(void) = ^(void) { printf("%s\n", str); }; next(); return 1; }; // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \
// expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
@@ -109,7 +109,7 @@ void foo6() {
void foo7()
{
- const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int (^)(void)', expected 'int const (^)(void)'}}
+ const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int const (^)(void)' with an expression of type 'int (^)(void)'}}
const int (^CC) (void) = ^const int{ const int i = 1; return i; }; // OK
int i;
diff --git a/test/Sema/builtin-prefetch.c b/test/Sema/builtin-prefetch.c
index 4f09da6..c5fa792 100644
--- a/test/Sema/builtin-prefetch.c
+++ b/test/Sema/builtin-prefetch.c
@@ -6,8 +6,8 @@ void foo() {
__builtin_prefetch(&a, 1);
__builtin_prefetch(&a, 1, 2);
__builtin_prefetch(&a, 1, 9, 3); // expected-error{{too many arguments to function}}
- __builtin_prefetch(&a, "hello", 2); // expected-error{{argument to __builtin_prefetch must be of integer type}}
- __builtin_prefetch(&a, a, 2); // expected-error{{argument to __builtin_prefetch must be a constant integer}}
+ __builtin_prefetch(&a, "hello", 2); // expected-error{{argument to '__builtin_prefetch' must be a constant integer}}
+ __builtin_prefetch(&a, a, 2); // expected-error{{argument to '__builtin_prefetch' must be a constant integer}}
__builtin_prefetch(&a, 2); // expected-error{{argument should be a value from 0 to 1}}
__builtin_prefetch(&a, 0, 4); // expected-error{{argument should be a value from 0 to 3}}
__builtin_prefetch(&a, -1, 4); // expected-error{{argument should be a value from 0 to 1}}
diff --git a/test/Sema/builtin-stackaddress.c b/test/Sema/builtin-stackaddress.c
index 1feb57e..5f63bb1 100644
--- a/test/Sema/builtin-stackaddress.c
+++ b/test/Sema/builtin-stackaddress.c
@@ -4,7 +4,7 @@ return __builtin_return_address(0);
}
void b(unsigned x) {
-return __builtin_return_address(x); // expected-error{{the level argument for a stack address builtin must be constant}}
+return __builtin_return_address(x); // expected-error{{argument to '__builtin_return_address' must be a constant integer}}
}
void* c(unsigned x) {
@@ -12,5 +12,5 @@ return __builtin_frame_address(0);
}
void d(unsigned x) {
-return __builtin_frame_address(x); // expected-error{{the level argument for a stack address builtin must be constant}}
+return __builtin_frame_address(x); // expected-error{{argument to '__builtin_frame_address' must be a constant integer}}
}
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index 7b2f2af..6fa563b 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -60,7 +60,7 @@ void test11(int X) {
break;
}
- __builtin_eh_return_data_regno(X); // expected-error {{not an integer constant expression}}
+ __builtin_eh_return_data_regno(X); // expected-error {{argument to '__builtin_eh_return_data_regno' must be a constant integer}}
}
// PR5062
diff --git a/test/Sema/cast-to-union.c b/test/Sema/cast-to-union.c
index 6856c17..6f275e8 100644
--- a/test/Sema/cast-to-union.c
+++ b/test/Sema/cast-to-union.c
@@ -10,7 +10,7 @@ void test(int x) {
union u w = (union u)2; // expected-warning {{C99 forbids casts to union type}}
union u ww = (union u)1.0; // expected-error{{cast to union type from type 'double' not present in union}}
-union u x = 7; // expected-error{{incompatible type initializing 'int', expected 'union u'}}
+union u x = 7; // expected-error{{initializing 'union u' with an expression of incompatible type 'int'}}
int i;
union u zz = (union u)i; // expected-error{{initializer element is not a compile-time constant}} expected-warning {{C99 forbids casts to union type}}
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 7c8c36f..631b694 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -282,3 +282,8 @@ int test5(unsigned int x) {
&& (x >= 0) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
&& (0 <= x); // expected-warning {{comparison of 0 <= unsigned expression is always true}}
}
+
+int test6(unsigned i, unsigned power) {
+ unsigned x = (i < (1 << power) ? i : 0);
+ return x != 3 ? 1 << power : i;
+}
diff --git a/test/Sema/compound-literal.c b/test/Sema/compound-literal.c
index 0c8ddd4..08c30b3 100644
--- a/test/Sema/compound-literal.c
+++ b/test/Sema/compound-literal.c
@@ -9,7 +9,7 @@ static int *p = (int []){2,4};
static int x = (int){1};
static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
-static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'char [2]', expected 'long'}}
+static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [2]'}}
typedef struct { } cache_t; // -expected-warning{{use of empty struct extension}}
static cache_t clo_I1_cache = ((cache_t) { } ); // -expected-warning{{use of GNU empty initializer extension}}
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c
index 5f01374..5e2c1a4 100644
--- a/test/Sema/conditional-expr.c
+++ b/test/Sema/conditional-expr.c
@@ -13,11 +13,11 @@ void foo() {
dp = vp;
vp = dp;
- ip = dp; // expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
- dp = ip; // expected-warning {{incompatible pointer types assigning 'int *', expected 'double *'}}
+ ip = dp; // expected-warning {{incompatible pointer types assigning to 'int *' from 'double *'}}
+ dp = ip; // expected-warning {{incompatible pointer types assigning to 'double *' from 'int *'}}
dp = 0 ? (double *)0 : (void *)0;
vp = 0 ? (double *)0 : (void *)0;
- ip = 0 ? (double *)0 : (void *)0; // expected-warning {{incompatible pointer types assigning 'double *', expected 'int *'}}
+ ip = 0 ? (double *)0 : (void *)0; // expected-warning {{incompatible pointer types assigning to 'int *' from 'double *'}}
const int *cip;
vp = (0 ? vp : cip); // expected-warning {{discards qualifiers}}
@@ -66,5 +66,5 @@ extern int f1(void);
int f0(int a) {
// GCC considers this a warning.
- return a ? f1() : nil; // expected-warning {{pointer/integer type mismatch in conditional expression ('int' and 'void *')}} expected-warning {{incompatible pointer to integer conversion returning 'void *', expected 'int'}}
+ return a ? f1() : nil; // expected-warning {{pointer/integer type mismatch in conditional expression ('int' and 'void *')}} expected-warning {{incompatible pointer to integer conversion returning 'void *' from a function with result type 'int'}}
}
diff --git a/test/Sema/conditional.c b/test/Sema/conditional.c
index c3dbe13..3d7bcca 100644
--- a/test/Sema/conditional.c
+++ b/test/Sema/conditional.c
@@ -6,9 +6,9 @@ void _efree(void *ptr);
void free(void *ptr);
int _php_stream_free1() {
- return (1 ? free(0) : _efree(0)); // expected-error {{incompatible type returning 'void', expected 'int'}}
+ return (1 ? free(0) : _efree(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}}
}
int _php_stream_free2() {
- return (1 ? _efree(0) : free(0)); // expected-error {{incompatible type returning 'void', expected 'int'}}
+ return (1 ? _efree(0) : free(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}}
}
diff --git a/test/Sema/decl-invalid.c b/test/Sema/decl-invalid.c
index 815e6dd..f6fed3c 100644
--- a/test/Sema/decl-invalid.c
+++ b/test/Sema/decl-invalid.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
// See Sema::ParsedFreeStandingDeclSpec about the double diagnostic
-typedef union <anonymous> __mbstate_t; // expected-error {{declaration of anonymous union must be a definition}} expected-error {{declaration does not declare anything}}
+typedef union <anonymous> __mbstate_t; // expected-error {{declaration of anonymous union must be a definition}} expected-warning {{declaration does not declare anything}}
// PR2017
@@ -13,12 +13,12 @@ int a() {
expected-error{{expected identifier or '('}}
}
-int; // expected-error {{declaration does not declare anything}}
-typedef int; // expected-error {{declaration does not declare anything}}
-const int; // expected-error {{declaration does not declare anything}}
-struct; // expected-error {{declaration of anonymous struct must be a definition}} // expected-error {{declaration does not declare anything}}
+int; // expected-warning {{declaration does not declare anything}}
+typedef int; // expected-warning {{declaration does not declare anything}}
+const int; // expected-warning {{declaration does not declare anything}}
+struct; // expected-error {{declaration of anonymous struct must be a definition}} // expected-warning {{declaration does not declare anything}}
typedef int I;
-I; // expected-error {{declaration does not declare anything}}
+I; // expected-warning {{declaration does not declare anything}}
diff --git a/test/Sema/declspec.c b/test/Sema/declspec.c
index 1c87a0e..7354028 100644
--- a/test/Sema/declspec.c
+++ b/test/Sema/declspec.c
@@ -10,7 +10,7 @@ int typedef validTypeDecl() { } // expected-error {{function definition declared
struct _zend_module_entry { } // expected-error {{expected ';' after struct}}
int gv1;
typedef struct _zend_function_entry { } // expected-error {{expected ';' after struct}} \
- // expected-error {{declaration does not declare anything}}
+ // expected-warning {{declaration does not declare anything}}
int gv2;
static void buggy(int *x) { }
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index 6177edf..ba4e56b 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -91,8 +91,7 @@ static enum e1 badfunc(struct s1 *q) {
typedef enum {
an_enumerator = 20
} an_enum;
-// FIXME: why is this only a warning?
-char * s = (an_enum) an_enumerator; // expected-warning {{incompatible integer to pointer conversion initializing 'an_enum', expected 'char *'}}
+char * s = (an_enum) an_enumerator; // expected-warning {{incompatible integer to pointer conversion initializing 'char *' with an expression of type 'an_enum'}}
// PR4515
enum PR4515 {PR4515a=1u,PR4515b=(PR4515a-2)/2};
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index 9acc63f..dbb6e80 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -84,7 +84,7 @@ void test11(struct mystruct P, float F) {
// PR3753
int test12(const char *X) {
- return X == "foo"; // expected-warning {{comparison against a string literal is unspecified}}
+ return X == "foo"; // expected-warning {{comparison against a string literal is unspecified (use strncmp instead)}}
}
int test12b(const char *X) {
@@ -128,3 +128,9 @@ void test17(int x) {
x = sizeof(x/0); // no warning.
}
+// PR6501
+void test18_a(int a);
+void test18(int b) {
+ test18_a(b, b); // expected-error {{too many arguments to function call, expected 1, have 2}}
+ test18_a(); // expected-error {{too few arguments to function call, expected 1, have 0}}
+}
diff --git a/test/Sema/ext_vector_casts.c b/test/Sema/ext_vector_casts.c
index cbda021..d297623 100644
--- a/test/Sema/ext_vector_casts.c
+++ b/test/Sema/ext_vector_casts.c
@@ -25,7 +25,7 @@ static void test() {
ivec4 = (int4)vec4_3;
i = (int)ivec4; // expected-error {{invalid conversion between vector type 'int4' and integer type 'int' of different size}}
- i = ivec4; // expected-error {{incompatible type assigning 'int4', expected 'int'}}
+ i = ivec4; // expected-error {{assigning to 'int' from incompatible type 'int4'}}
ivec4 = (int4)ptr; // expected-error {{invalid conversion between vector type 'int4' and scalar type 'int *'}}
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index dcc4c35..bdc2bb0 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -4,7 +4,7 @@
typedef __typeof(sizeof(int)) size_t;
typedef struct _FILE FILE;
int fprintf(FILE *, const char *restrict, ...);
-int printf(const char *restrict, ...);
+int printf(const char *restrict, ...); // expected-note{{passing argument to parameter here}}
int snprintf(char *restrict, size_t, const char *restrict, ...);
int sprintf(char *restrict, const char *restrict, ...);
int vasprintf(char **, const char *, va_list);
@@ -12,7 +12,7 @@ int asprintf(char **, const char *, ...);
int vfprintf(FILE *, const char *restrict, va_list);
int vprintf(const char *restrict, va_list);
int vsnprintf(char *, size_t, const char *, va_list);
-int vsprintf(char *restrict, const char *restrict, va_list);
+int vsprintf(char *restrict, const char *restrict, va_list); // expected-note{{passing argument to parameter here}}
char * global_fmt;
diff --git a/test/Sema/function-ptr.c b/test/Sema/function-ptr.c
index c1ff8e1..ff85272 100644
--- a/test/Sema/function-ptr.c
+++ b/test/Sema/function-ptr.c
@@ -3,9 +3,9 @@ typedef int unary_int_func(int arg);
unary_int_func *func;
unary_int_func *set_func(void *p) {
- func = p; // expected-warning {{converts between void* and function pointer}}
- p = func; // expected-warning {{converts between void* and function pointer}}
+ func = p; // expected-warning {{converts between void pointer and function pointer}}
+ p = func; // expected-warning {{converts between void pointer and function pointer}}
- return p; // expected-warning {{converts between void* and function pointer}}
+ return p; // expected-warning {{converts between void pointer and function pointer}}
}
diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c
index 1302b34..b8a64af 100644
--- a/test/Sema/function-redecl.c
+++ b/test/Sema/function-redecl.c
@@ -123,7 +123,7 @@ a x;
a2 x2;
void test_x() {
x(5);
- x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int', expected 'int *'}}
+ x2(5); // expected-warning{{incompatible integer to pointer conversion passing 'int' to parameter of type 'int *'}}
}
enum e0 {};
diff --git a/test/Sema/incompatible-sign.c b/test/Sema/incompatible-sign.c
index a1592ef..6249feb 100644
--- a/test/Sema/incompatible-sign.c
+++ b/test/Sema/incompatible-sign.c
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int a(int* x);
-int b(unsigned* y) { return a(y); } // expected-warning {{pointer types point to integer types with different sign}}
+int a(int* x); // expected-note{{passing argument to parameter 'x' here}}
+int b(unsigned* y) { return a(y); } // expected-warning {{passing 'unsigned int *' to parameter of type 'int *' converts between pointers to integer types with different sign}}
diff --git a/test/Sema/invalid-init-diag.c b/test/Sema/invalid-init-diag.c
index dec7d6c..3e4870e 100644
--- a/test/Sema/invalid-init-diag.c
+++ b/test/Sema/invalid-init-diag.c
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
int a;
-struct {int x;} x = a; // expected-error {{incompatible type initializing 'int', expected 'struct <anonymous}}
+struct {int x;} x = a; // expected-error {{with an expression of incompatible type 'int'}}
diff --git a/test/Sema/offsetof.c b/test/Sema/offsetof.c
index 49d4eb4..5026193 100644
--- a/test/Sema/offsetof.c
+++ b/test/Sema/offsetof.c
@@ -53,4 +53,15 @@ int x[__builtin_offsetof(union x, x)];
struct incomplete; // expected-note 2 {{forward declaration of 'struct incomplete'}}
int test1[__builtin_offsetof(struct incomplete, foo)]; // expected-error {{offsetof of incomplete type 'struct incomplete'}}
-int test1[__builtin_offsetof(struct incomplete[10], [4].foo)]; // expected-error {{array has incomplete element type 'struct incomplete'}}
+int test2[__builtin_offsetof(struct incomplete[10], [4].foo)]; // expected-error {{array has incomplete element type 'struct incomplete'}}
+
+// Bitfields
+struct has_bitfields {
+ int i : 7;
+ int j : 12; // expected-note{{bit-field is declared here}}
+};
+
+int test3 = __builtin_offsetof(struct has_bitfields, j); // expected-error{{cannot compute offset of bit-field 'j'}}
+
+typedef struct Array { int array[1]; } Array;
+int test4 = __builtin_offsetof(Array, array);
diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c
index 69c91cb..e53f0eb 100644
--- a/test/Sema/parentheses.c
+++ b/test/Sema/parentheses.c
@@ -5,17 +5,21 @@
void if_assign(void) {
int i;
if (i = 4) {} // expected-warning {{assignment as a condition}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
if ((i = 4)) {}
}
void bitwise_rel(unsigned i) {
(void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}} \
- // expected-note{{place parentheses around the & expression to evaluate it first}}
+ // expected-note{{place parentheses around the & expression to evaluate it first}} \
+ // expected-note{{place parentheses around the == expression to silence this warning}}
(void)(0 == i & 0x2); // expected-warning {{& has lower precedence than ==}} \
- // expected-note{{place parentheses around the & expression to evaluate it first}}
+ // expected-note{{place parentheses around the & expression to evaluate it first}} \
+ // expected-note{{place parentheses around the == expression to silence this warning}}
(void)(i & 0xff < 30); // expected-warning {{& has lower precedence than <}} \
- // expected-note{{place parentheses around the & expression to evaluate it first}}
+ // expected-note{{place parentheses around the & expression to evaluate it first}} \
+ // expected-note{{place parentheses around the < expression to silence this warning}}
(void)((i & 0x2) == 0);
(void)(i & (0x2 == 0));
// Eager logical op
diff --git a/test/Sema/pointer-conversion.c b/test/Sema/pointer-conversion.c
index 7191bf7..2d755ae 100644
--- a/test/Sema/pointer-conversion.c
+++ b/test/Sema/pointer-conversion.c
@@ -1,10 +1,10 @@
//RUN: %clang_cc1 -fsyntax-only -verify %s
char * c;
-char const ** c2 = &c; // expected-warning {{initializing, 'char const **' and 'char **' have different qualifiers in nested pointer types}}
+char const ** c2 = &c; // expected-warning {{discards qualifiers in nested pointer types}}
typedef char dchar;
-dchar *** c3 = &c2; // expected-warning {{initializing, 'dchar ***' and 'char const ***' have different qualifiers in nested pointer types}}
+dchar *** c3 = &c2; // expected-warning {{discards qualifiers in nested pointer types}}
volatile char * c4;
-char ** c5 = &c4; // expected-warning {{initializing, 'char **' and 'char volatile **' have different qualifiers in nested pointer types}}
+char ** c5 = &c4; // expected-warning {{discards qualifiers in nested pointer types}}
diff --git a/test/Sema/predef.c b/test/Sema/predef.c
index 9c19946..08a4a2b 100644
--- a/test/Sema/predef.c
+++ b/test/Sema/predef.c
@@ -6,7 +6,7 @@ void abcdefghi12(void) {
}
char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
- expected-warning {{initializing 'char const [1]' discards qualifiers, expected 'char *'}}
+ expected-warning {{initializing 'char *' with an expression of type 'char const [1]' discards qualifiers}}
void a() {
__func__[0] = 'a'; // expected-error {{variable is not assignable}}
diff --git a/test/Sema/predefined-function.c b/test/Sema/predefined-function.c
index 665d0fa..1c40b6e 100644
--- a/test/Sema/predefined-function.c
+++ b/test/Sema/predefined-function.c
@@ -4,13 +4,14 @@ char *funk(int format);
enum Test {A=-1};
char *funk(enum Test x);
-int eli(float b); // expected-note {{previous declaration is here}}
+int eli(float b); // expected-note {{previous declaration is here}} \
+// expected-note{{passing argument to parameter 'b' here}}
int b(int c) {return 1;}
int foo();
int foo() {
int eli(int (int)); // expected-error {{conflicting types for 'eli'}}
- eli(b); // expected-error{{incompatible type passing}}
+ eli(b); // expected-error{{passing 'int (int)' to parameter of incompatible type 'float'}}
return 0;
}
diff --git a/test/Sema/return.c b/test/Sema/return.c
index fab6a82..0d46d98 100644
--- a/test/Sema/return.c
+++ b/test/Sema/return.c
@@ -225,7 +225,7 @@ void test33() {
// Test that 'static inline' functions are only analyzed for CFG-based warnings
// when they are used.
-static inline int si_has_missing_return() {} // no-warning
+static inline int si_has_missing_return() {} // expected-warning{{control reaches end of non-void function}}
static inline int si_has_missing_return_2() {}; // expected-warning{{control reaches end of non-void function}}
static inline int si_forward();
static inline int si_has_missing_return_3(int x) {
diff --git a/test/Sema/statements.c b/test/Sema/statements.c
index 6da2daa..e3c41f3 100644
--- a/test/Sema/statements.c
+++ b/test/Sema/statements.c
@@ -13,7 +13,7 @@ int test(int _x) {
// PR2374
int test2() { return ({L:5;}); }
-int test3() { return ({ {5;} }); } // expected-error {{incompatible type returning 'void', expected 'int'}}\
+int test3() { return ({ {5;} }); } // expected-error {{returning 'void' from a function with incompatible result type 'int'}}\
// expected-warning {{expression result unused}}
int test4() { return ({ ({5;}); }); }
int test5() { return ({L1: L2: L3: 5;}); }
@@ -41,3 +41,13 @@ void test11(int bit) {
{
}
}
+
+// rdar://3271964
+enum Numbers { kOne, kTwo, kThree, kFour};
+int test12(enum Numbers num) {
+ switch (num == kOne) {// expected-warning {{switch condition has boolean value}}
+ default:
+ case kThree:
+ break;
+ }
+} \ No newline at end of file
diff --git a/test/Sema/struct-compat.c b/test/Sema/struct-compat.c
index 2e112e1..65bef9f 100644
--- a/test/Sema/struct-compat.c
+++ b/test/Sema/struct-compat.c
@@ -13,5 +13,5 @@ struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}}
struct x {int a;} r;
int b() {
-struct x {char x;} s = r; // expected-error {{incompatible type initializing}}
+struct x {char x;} s = r; // expected-error {{initializing 'struct x' with an expression of incompatible type 'struct x'}}
}
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index 03f6a53..cdfc850 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -4,7 +4,7 @@ typedef union {
float *fp;
} TU __attribute__((transparent_union));
-void f(TU);
+void f(TU); // expected-note{{passing argument to parameter here}}
void g(int *ip, float *fp, char *cp) {
f(ip);
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
index 0ef15fd..5b963c4 100644
--- a/test/Sema/typedef-retain.c
+++ b/test/Sema/typedef-retain.c
@@ -5,11 +5,11 @@ typedef int int4 __attribute__((vector_size(16)));
typedef int4* int4p;
void test1(float4 a, int4 *result, int i) {
- result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
+ result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
}
void test2(float4 a, int4p result, int i) {
- result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
+ result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
}
// PR2039
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index 4c6c47b..4ae0d4b 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -104,3 +104,9 @@ void t8() {
}
void t9() __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
+
+// rdar://7410924
+void *some_function(void);
+void t10() {
+ (void*) some_function(); //expected-warning {{expression result unused; should this cast be to 'void'?}}
+}
diff --git a/test/Sema/vector-assign.c b/test/Sema/vector-assign.c
index d074a95..05fc3b1 100644
--- a/test/Sema/vector-assign.c
+++ b/test/Sema/vector-assign.c
@@ -12,30 +12,30 @@ void test1() {
v2f v4;
v4ss v5;
- v1 = v2; // expected-warning {{incompatible vector types assigning 'v2u', expected 'v2s'}}
- v1 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2s'}}
- v1 = v4; // expected-warning {{incompatible vector types assigning 'v2f', expected 'v2s'}}
- v1 = v5; // expected-warning {{incompatible vector types assigning 'v4ss', expected 'v2s'}}
+ v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2u'}}
+ v1 = v3; // expected-error {{assigning to 'v2s' from incompatible type 'v1s'}}
+ v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2f'}}
+ v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v4ss'}}
- v2 = v1; // expected-warning {{incompatible vector types assigning 'v2s', expected 'v2u'}}
- v2 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2u'}}
- v2 = v4; // expected-warning {{incompatible vector types assigning 'v2f', expected 'v2u'}}
- v2 = v5; // expected-warning {{incompatible vector types assigning 'v4ss', expected 'v2u'}}
+ v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2s'}}
+ v2 = v3; // expected-error {{assigning to 'v2u' from incompatible type 'v1s'}}
+ v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2f'}}
+ v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v4ss'}}
- v3 = v1; // expected-error {{incompatible type assigning 'v2s', expected 'v1s'}}
- v3 = v2; // expected-error {{incompatible type assigning 'v2u', expected 'v1s'}}
- v3 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v1s'}}
- v3 = v5; // expected-error {{incompatible type assigning 'v4ss', expected 'v1s'}}
+ v3 = v1; // expected-error {{assigning to 'v1s' from incompatible type 'v2s'}}
+ v3 = v2; // expected-error {{assigning to 'v1s' from incompatible type 'v2u'}}
+ v3 = v4; // expected-error {{assigning to 'v1s' from incompatible type 'v2f'}}
+ v3 = v5; // expected-error {{assigning to 'v1s' from incompatible type 'v4ss'}}
- v4 = v1; // expected-warning {{incompatible vector types assigning 'v2s', expected 'v2f'}}
- v4 = v2; // expected-warning {{incompatible vector types assigning 'v2u', expected 'v2f'}}
- v4 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2f'}}
- v4 = v5; // expected-warning {{incompatible vector types assigning 'v4ss', expected 'v2f'}}
+ v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2s'}}
+ v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2u'}}
+ v4 = v3; // expected-error {{assigning to 'v2f' from incompatible type 'v1s'}}
+ v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v4ss'}}
- v5 = v1; // expected-warning {{incompatible vector types assigning 'v2s', expected 'v4ss'}}
- v5 = v2; // expected-warning {{incompatible vector types assigning 'v2u', expected 'v4ss'}}
- v5 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v4ss'}}
- v5 = v4; // expected-warning {{incompatible vector types assigning 'v2f', expected 'v4ss'}}
+ v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2s'}}
+ v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2u'}}
+ v5 = v3; // expected-error {{assigning to 'v4ss' from incompatible type 'v1s'}}
+ v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2f'}}
}
// PR2263
@@ -47,7 +47,7 @@ float test2(__attribute__((vector_size(16))) float a, int b) {
typedef long long __attribute__((__vector_size__(2 * sizeof(long long))))
longlongvec;
-void test3a(longlongvec *);
+void test3a(longlongvec *); // expected-note{{passing argument to parameter here}}
void test3(const unsigned *src) {
- test3a(src); // expected-warning {{incompatible pointer types passing 'unsigned int const *', expected 'longlongvec *'}}
+ test3a(src); // expected-warning {{incompatible pointer types passing 'unsigned int const *' to parameter of type 'longlongvec *'}}
}
diff --git a/test/Sema/vector-cast.c b/test/Sema/vector-cast.c
index aab0ab4..a717e86 100644
--- a/test/Sema/vector-cast.c
+++ b/test/Sema/vector-cast.c
@@ -30,9 +30,9 @@ type 't1' and integer type 'short' of different size}}
}
-void f2(t2 X);
+void f2(t2 X); // expected-note{{passing argument to parameter 'X' here}}
void f3(t3 Y) {
- f2(Y); // expected-warning {{incompatible vector types passing 't3', expected 't2'}}
+ f2(Y); // expected-warning {{incompatible vector types passing 't3' to parameter of type 't2'}}
}
diff --git a/test/Sema/warn-missing-braces.c b/test/Sema/warn-missing-braces.c
index 07eb61a..ebfe984 100644
--- a/test/Sema/warn-missing-braces.c
+++ b/test/Sema/warn-missing-braces.c
@@ -1,3 +1,3 @@
// RUN: %clang_cc1 -fsyntax-only -Wmissing-braces -verify %s
-int a[2][2] = { 0, 1, 2, 3 }; // expected-warning{{suggest braces}} expected-warning{{suggest braces}} \ No newline at end of file
+int a[2][2] = { 0, 1, 2, 3 }; // expected-warning{{suggest braces}} expected-warning{{suggest braces}}
diff --git a/test/Sema/warn-unused-function.c b/test/Sema/warn-unused-function.c
index b52f676..d5e676b 100644
--- a/test/Sema/warn-unused-function.c
+++ b/test/Sema/warn-unused-function.c
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-function -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
void foo() {}
static void f2() {}
@@ -28,3 +30,8 @@ static void f7(void) {}
__attribute__((unused)) static void bar(void);
void bar(void) { }
+__attribute__((constructor)) static void bar2(void);
+void bar2(void) { }
+
+__attribute__((destructor)) static void bar3(void);
+void bar3(void) { }
diff --git a/test/Sema/warn-unused-parameters.c b/test/Sema/warn-unused-parameters.c
index c6458cf..e47ddd5 100644
--- a/test/Sema/warn-unused-parameters.c
+++ b/test/Sema/warn-unused-parameters.c
@@ -1,13 +1,22 @@
-// RUN: %clang -fblocks -fsyntax-only -Wunused-parameter %s -Xclang -verify
+// RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused-parameter %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused %s 2>&1 | FileCheck -check-prefix=CHECK-unused %s
int f0(int x,
- int y, // expected-warning{{unused}}
+ int y,
int z __attribute__((unused))) {
return x;
}
void f1() {
(void)^(int x,
- int y, // expected-warning{{unused}}
+ int y,
int z __attribute__((unused))) { return x; };
}
+
+// Used when testing '-Wunused' to see that we only emit one diagnostic, and no
+// warnings for the above cases.
+static void achor() {};
+
+// CHECK: 5:12: warning: unused parameter 'y'
+// CHECK: 12:15: warning: unused parameter 'y'
+// CHECK-unused: 1 warning generated \ No newline at end of file
diff --git a/test/Sema/warn-unused-value.c b/test/Sema/warn-unused-value.c
index 2e0fa54..16b787f 100644
--- a/test/Sema/warn-unused-value.c
+++ b/test/Sema/warn-unused-value.c
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
int i = 0;
int j = 0;
@@ -51,3 +53,16 @@ void pr4806() {
*pi; // expected-warning {{expression result unused}}
*pj;
}
+
+// Don't warn about unused '||', '&&' expressions that contain assignments.
+int test_logical_foo1();
+int test_logical_foo2();
+int test_logical_foo3();
+int test_logical_bar() {
+ int x = 0;
+ (x = test_logical_foo1()) || // no-warning
+ (x = test_logical_foo2()) || // no-warning
+ (x = test_logical_foo3()); // no-warning
+ return x;
+}
+
diff --git a/test/Sema/warn-write-strings.c b/test/Sema/warn-write-strings.c
index 938f0be..04af00c 100644
--- a/test/Sema/warn-write-strings.c
+++ b/test/Sema/warn-write-strings.c
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s
// PR4804
-char* x = "foo"; // expected-warning {{initializing 'char const [4]' discards qualifiers, expected 'char *'}}
+char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'char const [4]' discards qualifiers}}
diff --git a/test/Sema/x86-builtin-palignr.c b/test/Sema/x86-builtin-palignr.c
new file mode 100644
index 0000000..eedf99b
--- /dev/null
+++ b/test/Sema/x86-builtin-palignr.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -target-feature +ssse3 -verify %s
+// Temporarily xfail this on windows.
+// XFAIL: win32
+
+#include <tmmintrin.h>
+
+__m64 foo(__m64 a, __m64 b, int c)
+{
+ return _mm_alignr_pi8(a, b, c); // expected-error {{argument to '__builtin_ia32_palignr' must be a constant integer}}
+}
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp
index 0ae6c44..3e61cc3 100644
--- a/test/SemaCXX/abstract.cpp
+++ b/test/SemaCXX/abstract.cpp
@@ -42,11 +42,11 @@ void f() {
t3(C()); // expected-error {{allocation of an object of abstract type 'C'}}
}
-C e1[2]; // expected-error {{variable type 'C' is an abstract class}}
-C (*e2)[2]; // expected-error {{variable type 'C' is an abstract class}}
-C (**e3)[2]; // expected-error {{variable type 'C' is an abstract class}}
+C e1[2]; // expected-error {{array of abstract class type 'C'}}
+C (*e2)[2]; // expected-error {{array of abstract class type 'C'}}
+C (**e3)[2]; // expected-error {{array of abstract class type 'C'}}
-void t4(C c[2]); // expected-error {{parameter type 'C' is an abstract class}}
+void t4(C c[2]); // expected-error {{array of abstract class type 'C'}}
void t5(void (*)(C)); // expected-error {{parameter type 'C' is an abstract class}}
@@ -168,4 +168,3 @@ namespace PureImplicit {
struct D : C {};
D y;
}
-
diff --git a/test/SemaCXX/access-base-class.cpp b/test/SemaCXX/access-base-class.cpp
index 25fd9e5..8551690 100644
--- a/test/SemaCXX/access-base-class.cpp
+++ b/test/SemaCXX/access-base-class.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace T1 {
class A { };
diff --git a/test/SemaCXX/access-control-check.cpp b/test/SemaCXX/access-control-check.cpp
index 1db6704..4540e99 100644
--- a/test/SemaCXX/access-control-check.cpp
+++ b/test/SemaCXX/access-control-check.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
class M {
int iM;
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index 3b06119..f8b00df 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -54,3 +54,35 @@ struct B
void d(void *);
static void d(A *);
};
+
+struct C {
+ C &getC() {
+ return makeAC; // expected-error{{address of overloaded function 'makeAC' cannot be converted to type 'C'}}
+ }
+
+ C &makeAC();
+ const C &makeAC() const;
+
+ static void f(); // expected-note{{candidate function}}
+ static void f(int); // expected-note{{candidate function}}
+
+ void g() {
+ int (&fp)() = f; // expected-error{{address of overloaded function 'f' does not match required type 'int ()'}}
+ }
+};
+
+// PR6886
+namespace test0 {
+ void myFunction(void (*)(void *));
+
+ class Foo {
+ void foo();
+
+ static void bar(void*);
+ static void bar();
+ };
+
+ void Foo::foo() {
+ myFunction(bar);
+ }
+}
diff --git a/test/SemaCXX/aggregate-initialization.cpp b/test/SemaCXX/aggregate-initialization.cpp
index 708a8f2..4c34447 100644
--- a/test/SemaCXX/aggregate-initialization.cpp
+++ b/test/SemaCXX/aggregate-initialization.cpp
@@ -60,10 +60,23 @@ struct C {
void f() {
A as1[1] = { };
- A as2[1] = { 1 }; // expected-error {{copying array element of type 'A' invokes deleted copy constructor}}
+ A as2[1] = { 1 }; // expected-error {{copying array element of type 'A' invokes deleted constructor}}
B b1 = { };
- B b2 = { 1 }; // expected-error {{copying member subobject of type 'A' invokes deleted copy constructor}}
+ B b2 = { 1 }; // expected-error {{copying member subobject of type 'A' invokes deleted constructor}}
C c1 = { 1 };
}
+
+class Agg {
+public:
+ int i, j;
+};
+
+class AggAgg {
+public:
+ Agg agg1;
+ Agg agg2;
+};
+
+AggAgg aggagg = { 1, 2, 3, 4 };
diff --git a/test/SemaCXX/anonymous-union.cpp b/test/SemaCXX/anonymous-union.cpp
index 0590db2..5c34e01 100644
--- a/test/SemaCXX/anonymous-union.cpp
+++ b/test/SemaCXX/anonymous-union.cpp
@@ -110,7 +110,7 @@ struct BadMembers {
};
// <rdar://problem/6481130>
-typedef union { }; // expected-error{{declaration does not declare anything}}
+typedef union { }; // expected-warning{{declaration does not declare anything}}
// <rdar://problem/7562438>
typedef struct objc_module *Foo ;
diff --git a/test/SemaCXX/bitfield-layout.cpp b/test/SemaCXX/bitfield-layout.cpp
new file mode 100644
index 0000000..adecf55
--- /dev/null
+++ b/test/SemaCXX/bitfield-layout.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-apple-darwin10
+
+#define CHECK_SIZE(name, size) extern int name##1[sizeof(name) == size ? 1 : -1];
+#define CHECK_ALIGN(name, size) extern int name##2[__alignof(name) == size ? 1 : -1];
+
+// Simple tests.
+struct Test1 {
+ char c : 9; // expected-warning {{size of bit-field 'c' (9 bits) exceeds the size of its type; value will be truncated to 8 bits}}
+};
+CHECK_SIZE(Test1, 2);
+CHECK_ALIGN(Test1, 1);
+
+struct Test2 {
+ char c : 16; // expected-warning {{size of bit-field 'c' (16 bits) exceeds the size of its type; value will be truncated to 8 bits}}
+};
+CHECK_SIZE(Test2, 2);
+CHECK_ALIGN(Test2, 2);
+
+struct Test3 {
+ char c : 32; // expected-warning {{size of bit-field 'c' (32 bits) exceeds the size of its type; value will be truncated to 8 bits}}
+};
+CHECK_SIZE(Test3, 4);
+CHECK_ALIGN(Test3, 4);
+
+struct Test4 {
+ char c : 64; // expected-warning {{size of bit-field 'c' (64 bits) exceeds the size of its type; value will be truncated to 8 bits}}
+};
+CHECK_SIZE(Test4, 8);
+CHECK_ALIGN(Test4, 8);
+
diff --git a/test/SemaCXX/class-base-member-init.cpp b/test/SemaCXX/class-base-member-init.cpp
index 7095d92..ca9f045 100644
--- a/test/SemaCXX/class-base-member-init.cpp
+++ b/test/SemaCXX/class-base-member-init.cpp
@@ -51,3 +51,26 @@ namespace Test3 {
t(2) { } // expected-error {{multiple initializations given for non-static member 't'}}
};
}
+
+namespace test4 {
+ class A {
+ union {
+ struct {
+ int a;
+ int b;
+ };
+
+ int c;
+
+ union {
+ int d;
+ int e;
+ };
+ };
+
+ A(char _) : a(0), b(0) {}
+ A(short _) : a(0), c(0) {} // expected-error {{initializing multiple members of anonymous union}} expected-note {{previous initialization is here}}
+ A(int _) : d(0), e(0) {} // expected-error {{initializing multiple members of anonymous union}} expected-note {{previous initialization is here}}
+ A(long _) : a(0), d(0) {} // expected-error {{initializing multiple members of anonymous union}} expected-note {{previous initialization is here}}
+ };
+}
diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp
index 508ca4d..7eea67a 100644
--- a/test/SemaCXX/class.cpp
+++ b/test/SemaCXX/class.cpp
@@ -103,7 +103,7 @@ void ogfn()
// PR3020: This used to crash due to double ownership of C4.
struct C4;
- C4; // expected-error {{declaration does not declare anything}}
+ C4; // expected-warning {{declaration does not declare anything}}
}
struct C4 {
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index 49bcd99..a812a59 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control -std=c++0x -Wsign-compare %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -Wsign-compare %s
// C++ rules for ?: are a lot stricter than C rules, and have to take into
// account more conversion options.
@@ -7,8 +7,7 @@
struct ToBool { explicit operator bool(); };
struct B;
-struct A { A(); A(const B&); }; // expected-note 2 {{candidate constructor}} \
- // expected-note 2 {{candidate is the implicit copy constructor}}
+struct A { A(); A(const B&); }; // expected-note 2 {{candidate constructor}}
struct B { operator A() const; }; // expected-note 2 {{candidate function}}
struct I { operator int(); };
struct J { operator I(); };
@@ -224,7 +223,7 @@ namespace PR6757 {
struct Foo3 {
Foo3();
- Foo3(Foo3&);
+ Foo3(Foo3&); // expected-note{{would lose const qualifier}}
};
struct Bar {
@@ -236,7 +235,6 @@ namespace PR6757 {
void f() {
(void)(true ? Bar() : Foo1()); // okay
(void)(true ? Bar() : Foo2()); // okay
- // FIXME: Diagnostic below could be improved
- (void)(true ? Bar() : Foo3()); // expected-error{{incompatible operand types ('PR6757::Bar' and 'PR6757::Foo3')}}
+ (void)(true ? Bar() : Foo3()); // expected-error{{no viable constructor copying temporary}}
}
}
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp
index 0d4d387..a17dd58 100644
--- a/test/SemaCXX/constant-expression.cpp
+++ b/test/SemaCXX/constant-expression.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
-
// C++ [expr.const]p1:
// In several places, C++ requires expressions that evaluate to an integral
// or enumeration constant: as array bounds, as case expressions, as
@@ -79,5 +78,10 @@ template <int itval, Enum etval> struct C {
};
template struct C<1, eval>;
-//template struct C<cval, ceval>;
-//template struct C<Struct::sval, Struct::seval>;
+template struct C<cval, ceval>;
+template struct C<Struct::sval, Struct::seval>;
+
+enum {
+ a = sizeof(int) == 8,
+ b = a? 8 : 4
+};
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index 96dfa8b..8e9e133 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -Wreorder -fsyntax-only -verify %s
class A {
int m;
+public:
A() : A::m(17) { } // expected-error {{member initializer 'm' does not name a non-static data member or base class}}
A(int);
};
@@ -72,8 +73,9 @@ class U {
union { int a; char* p; };
union { int b; double d; };
- U() : a(1), p(0), d(1.0) {} // expected-error {{multiple initializations given for non-static member 'p'}} \
- // expected-note {{previous initialization is here}}
+ U() : a(1), // expected-note {{previous initialization is here}}
+ p(0), // expected-error {{initializing multiple members of anonymous union}}
+ d(1.0) {}
};
struct V {};
@@ -86,12 +88,11 @@ struct Derived : Base, Base1, virtual V {
struct Current : Derived {
int Derived;
- Current() : Derived(1), ::Derived(), // expected-warning {{member 'Derived' will be initialized after}} \
- // expected-note {{base '::Derived'}} \
- // expected-warning {{base class '::Derived' will be initialized after}}
+ Current() : Derived(1), ::Derived(), // expected-warning {{field 'Derived' will be initialized after base '::Derived'}} \
+ // expected-warning {{base class '::Derived' will be initialized after base 'Derived::V'}}
::Derived::Base(), // expected-error {{type '::Derived::Base' is not a direct or virtual base of 'Current'}}
Derived::Base1(), // expected-error {{type 'Derived::Base1' is not a direct or virtual base of 'Current'}}
- Derived::V(), // expected-note {{base 'Derived::V'}}
+ Derived::V(),
::NonExisting(), // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
INT::NonExisting() {} // expected-error {{expected a class or namespace}} \
// expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
@@ -125,7 +126,7 @@ struct Q {
// A silly class used to demonstrate field-is-uninitialized in constructors with
// multiple params.
-class TwoInOne { TwoInOne(TwoInOne a, TwoInOne b) {} };
+class TwoInOne { public: TwoInOne(TwoInOne a, TwoInOne b) {} };
class InitializeUsingSelfTest {
bool A;
char* B;
@@ -170,3 +171,36 @@ struct X0 : NDC<int> {
NDC<int> ndc;
};
+
+namespace Test0 {
+
+struct A { A(); };
+
+struct B {
+ B() { }
+ const A a;
+};
+
+}
+
+namespace Test1 {
+ struct A {
+ enum Kind { Foo } Kind;
+ A() : Kind(Foo) {}
+ };
+}
+
+namespace Test2 {
+
+struct A {
+ A(const A&);
+};
+
+struct B : virtual A { };
+struct C : A, B { };
+
+C f(C c) {
+ return c;
+}
+
+}
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index bca75c0..3e96d02 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -56,7 +56,7 @@ public:
// This used to crash Clang.
struct Flip;
-struct Flop { // expected-note{{candidate is the implicit copy constructor}}
+struct Flop {
Flop();
Flop(const Flip&); // expected-note{{candidate constructor}}
};
@@ -129,5 +129,89 @@ private:
};
A1 f() {
- return "Hello"; // expected-error{{invokes deleted copy constructor}}
+ return "Hello"; // expected-error{{invokes deleted constructor}}
+}
+
+namespace source_locations {
+ template<typename T>
+ struct sneaky_int {
+ typedef int type;
+ };
+
+ template<typename T, typename U>
+ struct A { };
+
+ template<typename T>
+ struct A<T, T> : A<T, int> { };
+
+ struct E {
+ template<typename T>
+ operator A<T, typename sneaky_int<T>::type>&() const; // expected-note{{candidate function}}
+ };
+
+ void f() {
+ A<float, float> &af = E(); // expected-error{{no viable conversion}}
+ A<float, int> &af2 = E();
+ const A<float, int> &caf2 = E();
+ }
+
+ // Check
+ template<typename T>
+ struct E2 {
+ operator T
+ * // expected-error{{pointer to a reference}}
+ () const;
+ };
+
+ E2<int&> e2i; // expected-note{{in instantiation}}
+}
+
+namespace crazy_declarators {
+ struct A {
+ (&operator bool())(); // expected-error {{must use a typedef to declare a conversion to 'bool (&)()'}}
+
+ // FIXME: This diagnostic is misleading (the correct spelling
+ // would be 'operator int*'), but it's a corner case of a
+ // rarely-used syntax extension.
+ *operator int(); // expected-error {{must use a typedef to declare a conversion to 'int *'}}
+ };
+}
+
+namespace smart_ptr {
+ class Y {
+ class YRef { };
+
+ Y(Y&);
+
+ public:
+ Y();
+ Y(YRef);
+
+ operator YRef(); // expected-note{{candidate function}}
+ };
+
+ struct X { // expected-note{{candidate constructor (the implicit copy constructor) not}}
+ explicit X(Y);
+ };
+
+ Y make_Y();
+
+ X f() {
+ X x = make_Y(); // expected-error{{no viable conversion from 'smart_ptr::Y' to 'smart_ptr::X'}}
+ X x2(make_Y());
+ return X(Y());
+ }
+}
+
+struct Any {
+ Any(...);
+};
+
+struct Other {
+ Other(const Other &);
+ Other();
+};
+
+void test_any() {
+ Any any = Other(); // expected-error{{cannot pass object of non-POD type 'Other' through variadic constructor; call will abort at runtime}}
}
diff --git a/test/SemaCXX/copy-assignment.cpp b/test/SemaCXX/copy-assignment.cpp
index 8cdb1be..bfe1501 100644
--- a/test/SemaCXX/copy-assignment.cpp
+++ b/test/SemaCXX/copy-assignment.cpp
@@ -94,6 +94,6 @@ void test() {
int i;
i = convertibleToInt;
- i = a; // expected-error{{incompatible type assigning 'A', expected 'int'}}
+ i = a; // expected-error{{assigning to 'int' from incompatible type 'A'}}
}
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp
index e5b1fd7..0c4aa96 100644
--- a/test/SemaCXX/copy-initialization.cpp
+++ b/test/SemaCXX/copy-initialization.cpp
@@ -1,18 +1,21 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
class X {
public:
- explicit X(const X&);
- X(int*); // expected-note 2{{candidate constructor}}
- explicit X(float*);
+ explicit X(const X&); // expected-note {{candidate constructor}}
+ X(int*); // expected-note 3{{candidate constructor}}
+ explicit X(float*); // expected-note {{candidate constructor}}
};
class Y : public X { };
void f(Y y, int *ip, float *fp) {
X x1 = y; // expected-error{{no matching constructor for initialization of 'X'}}
- X x2 = 0;
- X x3 = ip;
+ X x2 = 0; // expected-error{{no viable constructor copying variable}}
+ X x3 = ip; // expected-error{{no viable constructor copying variable}}
X x4 = fp; // expected-error{{no viable conversion}}
+ X x2a(0); // expected-error{{call to constructor of 'X' is ambiguous}}
+ X x3a(ip);
+ X x4a(fp);
}
struct foo {
@@ -25,19 +28,17 @@ void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize objec
namespace PR6757 {
struct Foo {
Foo();
- Foo(Foo&);
+ Foo(Foo&); // expected-note{{candidate constructor not viable}}
};
struct Bar {
operator const Foo&() const;
};
- void f(Foo); // expected-note{{candidate function not viable: no known conversion from 'PR6757::Bar' to 'PR6757::Foo' for 1st argument}}
+ void f(Foo);
- // FIXME: This isn't really the right reason for the failure. We
- // should fail after overload resolution.
void g(Foo foo) {
- f(Bar()); // expected-error{{no matching function for call to 'f'}}
+ f(Bar()); // expected-error{{no viable constructor copying parameter of type 'PR6757::Foo const'}}
f(foo);
}
}
diff --git a/test/SemaCXX/cstyle-cast.cpp b/test/SemaCXX/cstyle-cast.cpp
index 6a28f4c..ccb25f0 100644
--- a/test/SemaCXX/cstyle-cast.cpp
+++ b/test/SemaCXX/cstyle-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {};
diff --git a/test/SemaCXX/default-assignment-operator.cpp b/test/SemaCXX/default-assignment-operator.cpp
index baae03c..a04de37 100644
--- a/test/SemaCXX/default-assignment-operator.cpp
+++ b/test/SemaCXX/default-assignment-operator.cpp
@@ -1,13 +1,17 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-class Base { // expected-error {{cannot define the implicit default assignment operator for 'Base', because non-static reference member 'ref' can't use default assignment operator}}
- int &ref; // expected-note {{declared at}}
+class Base { // expected-error {{cannot define the implicit default assignment operator for 'Base', because non-static reference member 'ref' can't use default assignment operator}} \
+ // expected-warning{{class 'Base' does not declare any constructor to initialize its non-modifiable members}} \
+ // expected-note {{synthesized method is first required here}}
+ int &ref; // expected-note {{declared here}} \
+ // expected-note{{reference member 'ref' will never be initialized}}
};
-class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'X', because non-static const member 'cint' can't use default assignment operator}}
+class X : Base { // // expected-error {{cannot define the implicit default assignment operator for 'X', because non-static const member 'cint' can't use default assignment operator}} \
+ // expected-note {{synthesized method is first required here}}
public:
X();
- const int cint; // expected-note {{declared at}}
+ const int cint; // expected-note {{declared here}}
};
struct Y : X {
@@ -25,7 +29,7 @@ Z z2;
// Test1
void f(X x, const X cx) {
- x = cx; // expected-note 2 {{synthesized method is first required here}}
+ x = cx;
x = cx;
z1 = z2;
}
@@ -70,9 +74,11 @@ void i() {
// Test5
-class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}}
+class E1 { // expected-error{{cannot define the implicit default assignment operator for 'E1', because non-static const member 'a' can't use default assignment operator}} \
+ // expected-note {{synthesized method is first required here}}
+
public:
- const int a; // expected-note{{declared at}}
+ const int a; // expected-note{{declared here}}
E1() : a(0) {}
};
@@ -80,6 +86,6 @@ public:
E1 e1, e2;
void j() {
- e1 = e2; // expected-note{{synthesized method is first required here}}
+ e1 = e2;
}
diff --git a/test/SemaCXX/default-constructor-initializers.cpp b/test/SemaCXX/default-constructor-initializers.cpp
index b40b133..757332d 100644
--- a/test/SemaCXX/default-constructor-initializers.cpp
+++ b/test/SemaCXX/default-constructor-initializers.cpp
@@ -16,7 +16,7 @@ X3 x3; // expected-note {{first required here}}
struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \
// expected-error {{must explicitly initialize the reference member 'rx2'}}
X2 x2; // expected-note {{member is declared here}}
- X2 & rx2; // expected-note {{declared at}}
+ X2 & rx2; // expected-note {{declared here}}
};
X4 x4; // expected-note {{first required here}}
@@ -46,8 +46,8 @@ Y4 y4;
struct Z1 { // expected-error {{must explicitly initialize the reference member 'z'}} \
// expected-error {{must explicitly initialize the const member 'c1'}}
- int& z; // expected-note {{declared at}}
- const int c1; // expected-note {{declared at}}
+ int& z; // expected-note {{declared here}}
+ const int c1; // expected-note {{declared here}}
volatile int v1;
};
diff --git a/test/SemaCXX/default1.cpp b/test/SemaCXX/default1.cpp
index 790208a..e9d8a2f 100644
--- a/test/SemaCXX/default1.cpp
+++ b/test/SemaCXX/default1.cpp
@@ -14,7 +14,8 @@ void h(int i, int j = 2, int k = 3,
int n);// expected-error {{missing default argument on parameter 'n'}}
struct S { } s;
-void i(int = s) { } // expected-error {{no viable conversion}}
+void i(int = s) { } // expected-error {{no viable conversion}} \
+// expected-note{{passing argument to parameter here}}
struct X {
X(int);
@@ -26,6 +27,8 @@ struct Y { // expected-note 2{{candidate}}
explicit Y(int);
};
-void k(Y y = 17); // expected-error{{no viable conversion}}
+void k(Y y = 17); // expected-error{{no viable conversion}} \
+// expected-note{{passing argument to parameter 'y' here}}
-void kk(Y = 17); // expected-error{{no viable conversion}}
+void kk(Y = 17); // expected-error{{no viable conversion}} \
+// expected-note{{passing argument to parameter here}}
diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp
index a0999c0..d9f1edf 100644
--- a/test/SemaCXX/default2.cpp
+++ b/test/SemaCXX/default2.cpp
@@ -102,7 +102,8 @@ void test_Z(const Z& z) {
struct ZZ {
static ZZ g(int = 17);
- void f(ZZ z = g()); // expected-error{{no matching constructor for initialization}}
+ void f(ZZ z = g()); // expected-error{{no matching constructor for initialization}} \
+ // expected-note{{passing argument to parameter 'z' here}}
ZZ(ZZ&, int = 17); // expected-note{{candidate constructor}}
};
diff --git a/test/SemaCXX/derived-to-base-ambig.cpp b/test/SemaCXX/derived-to-base-ambig.cpp
index 9216e5b..129ec79 100644
--- a/test/SemaCXX/derived-to-base-ambig.cpp
+++ b/test/SemaCXX/derived-to-base-ambig.cpp
@@ -6,7 +6,7 @@ class D : public B, public C { };
void f(D* d) {
A* a;
- a = d; // expected-error{{ambiguous conversion from derived class 'D' to base class 'A':}} expected-error{{incompatible type assigning 'D *', expected 'A *'}}
+ a = d; // expected-error{{ambiguous conversion from derived class 'D' to base class 'A':}} expected-error{{assigning to 'A *' from incompatible type 'D *'}}
}
class Object2 { };
@@ -20,7 +20,7 @@ class F2 : public E2, public A2 { };
void g(E2* e2, F2* f2) {
Object2* o2;
o2 = e2;
- o2 = f2; // expected-error{{ambiguous conversion from derived class 'F2' to base class 'Object2':}} expected-error{{incompatible type assigning 'F2 *', expected 'Object2 *'}}
+ o2 = f2; // expected-error{{ambiguous conversion from derived class 'F2' to base class 'Object2':}} expected-error{{assigning to 'Object2 *' from incompatible type 'F2 *'}}
}
// Test that ambiguous/inaccessibility checking does not trigger too
diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp
index d30642b..54cd6ca 100644
--- a/test/SemaCXX/direct-initializer.cpp
+++ b/test/SemaCXX/direct-initializer.cpp
@@ -10,7 +10,7 @@ void f() {
}
class Y {
- explicit Y(float);
+public: explicit Y(float);
};
class X { // expected-note{{candidate constructor (the implicit copy constructor)}}
diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp
index 3cd3a1b..2d0b571 100644
--- a/test/SemaCXX/elaborated-type-specifier.cpp
+++ b/test/SemaCXX/elaborated-type-specifier.cpp
@@ -22,7 +22,7 @@ namespace NS {
void test_elab2(struct S4 *s4);
};
- void X::test_elab2(S4 *s4) { }
+ void X::test_elab2(S4 *s4) { } // expected-note{{passing argument to parameter 's4' here}}
}
void test_X_elab(NS::X x) {
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp
index 2ed4bfe..18349d1 100644
--- a/test/SemaCXX/exceptions.cpp
+++ b/test/SemaCXX/exceptions.cpp
@@ -97,3 +97,26 @@ BadReturn::BadReturn(int) try {
}
}
}
+
+// Cannot throw an abstract type.
+class foo {
+public:
+ foo() {}
+ void bar () {
+ throw *this; // expected-error{{cannot throw an object of abstract type 'foo'}}
+ }
+ virtual void test () = 0; // expected-note{{pure virtual function 'test'}}
+};
+
+namespace PR6831 {
+ namespace NA { struct S; }
+ namespace NB { struct S; }
+
+ void f() {
+ using namespace NA;
+ using namespace NB;
+ try {
+ } catch (int S) {
+ }
+ }
+}
diff --git a/test/SemaCXX/functional-cast.cpp b/test/SemaCXX/functional-cast.cpp
index 4e0486c..3b08864 100644
--- a/test/SemaCXX/functional-cast.cpp
+++ b/test/SemaCXX/functional-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
// ------------ not interpreted as C-style cast ------------
diff --git a/test/SemaCXX/illegal-member-initialization.cpp b/test/SemaCXX/illegal-member-initialization.cpp
index 3fb0b93..87069ef 100644
--- a/test/SemaCXX/illegal-member-initialization.cpp
+++ b/test/SemaCXX/illegal-member-initialization.cpp
@@ -14,9 +14,9 @@ struct X {
// expected-error {{constructor for 'X' must explicitly initialize the const member 'cvalue'}} \
// expected-error {{constructor for 'X' must explicitly initialize the reference member 'b'}} \
// expected-error {{constructor for 'X' must explicitly initialize the const member 'cb'}}
- int &value; // expected-note{{declared at}}
- const int cvalue; // expected-note{{declared at}}
- B& b; // expected-note{{declared at}}
+ int &value; // expected-note{{declared here}}
+ const int cvalue; // expected-note{{declared here}}
+ B& b; // expected-note{{declared here}}
const B cb; // expected-note{{declared here}}
};
diff --git a/test/SemaCXX/implicit-member-functions.cpp b/test/SemaCXX/implicit-member-functions.cpp
index 40a61e4..79cc367 100644
--- a/test/SemaCXX/implicit-member-functions.cpp
+++ b/test/SemaCXX/implicit-member-functions.cpp
@@ -1,14 +1,41 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct A { }; // expected-note {{previous implicit declaration is here}}
+struct A { };
A::A() { } // expected-error {{definition of implicitly declared constructor}}
-struct B { }; // expected-note {{previous implicit declaration is here}}
+struct B { };
B::B(const B&) { } // expected-error {{definition of implicitly declared copy constructor}}
-struct C { }; // expected-note {{previous implicit declaration is here}}
+struct C { };
C& C::operator=(const C&) { return *this; } // expected-error {{definition of implicitly declared copy assignment operator}}
-struct D { }; // expected-note {{previous implicit declaration is here}}
+struct D { };
D::~D() { } // expected-error {{definition of implicitly declared destructor}}
+// Make sure that the special member functions are introduced for
+// name-lookup purposes and overload with user-declared
+// constructors and assignment operators.
+namespace PR6570 {
+ class A { };
+
+ class B {
+ public:
+ B() {}
+
+ B(const A& a) {
+ operator = (CONST);
+ operator = (a);
+ }
+
+ B& operator = (const A& a) {
+ return *this;
+ }
+
+ void f(const A &a) {
+ B b(a);
+ };
+
+ static const B CONST;
+ };
+
+}
diff --git a/test/SemaCXX/inc-decrement-qualifiers.cpp b/test/SemaCXX/inc-decrement-qualifiers.cpp
new file mode 100644
index 0000000..ba837a9
--- /dev/null
+++ b/test/SemaCXX/inc-decrement-qualifiers.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+volatile int i;
+
+const int &inc = i++;
+const int &dec = i--;
+
+const int &incfail = ++i; // expected-error {{drops qualifiers}}
+const int &decfail = --i; // expected-error {{drops qualifiers}}
diff --git a/test/SemaCXX/libstdcxx_is_pod_hack.cpp b/test/SemaCXX/libstdcxx_is_pod_hack.cpp
index 7a4bebc..2e92032 100644
--- a/test/SemaCXX/libstdcxx_is_pod_hack.cpp
+++ b/test/SemaCXX/libstdcxx_is_pod_hack.cpp
@@ -1,5 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only %s
+// This is a test for an egregious hack in Clang that works around
+// issues with GCC's evolution. libstdc++ 4.2.x uses __is_pod as an
+// identifier (to declare a struct template like the one below), while
+// GCC 4.3 and newer make __is_pod a keyword. Clang treats __is_pod as
+// a keyword *unless* it is introduced following the struct keyword.
+
template<typename T>
struct __is_pod {
};
diff --git a/test/SemaCXX/libstdcxx_map_base_hack.cpp b/test/SemaCXX/libstdcxx_map_base_hack.cpp
new file mode 100644
index 0000000..a556281
--- /dev/null
+++ b/test/SemaCXX/libstdcxx_map_base_hack.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+// libstdc++ 4.2.x contains a bug where a friend struct template
+// declaration for std::tr1::__detail::_Map base has different
+// template arguments than the real declaration. Clang has an
+// egregious hack to work around this problem, since we can't modify
+// all of the world's libstdc++'s.
+
+namespace std { namespace tr1 { namespace __detail {
+ template<typename _Key, typename _Value, typename _Ex, bool __unique,
+ typename _Hashtable>
+ struct _Map_base { };
+
+} } }
+
+namespace std { namespace tr1 {
+ template<typename T>
+ struct X1 {
+ template<typename _Key2, typename _Pair, typename _Hashtable>
+ friend struct __detail::_Map_base;
+ };
+
+} }
+
+std::tr1::X1<int> x1i;
diff --git a/test/SemaCXX/local-classes.cpp b/test/SemaCXX/local-classes.cpp
index 6799e58..500b219 100644
--- a/test/SemaCXX/local-classes.cpp
+++ b/test/SemaCXX/local-classes.cpp
@@ -30,3 +30,12 @@ namespace PR6383 {
compare_and_set2 (false, gross);
}
}
+
+namespace Templates {
+ template<int Value>
+ void f() {
+ struct Inner {
+ static int getValue() { return Value; }
+ };
+ }
+}
diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp
index 13ff64d..54a9593 100644
--- a/test/SemaCXX/member-expr.cpp
+++ b/test/SemaCXX/member-expr.cpp
@@ -2,7 +2,7 @@
class X{
public:
- enum E {Enumerator};
+ enum E {Enumerator}; // expected-note 2{{declared here}}
int f();
static int mem;
static float g();
@@ -11,8 +11,8 @@ public:
void test(X* xp, X x) {
int i1 = x.f();
int i2 = xp->f();
- x.E; // expected-error{{cannot refer to type member 'E' with '.'}}
- xp->E; // expected-error{{cannot refer to type member 'E' with '->'}}
+ x.E; // expected-error{{cannot refer to type member 'E' in 'X' with '.'}}
+ xp->E; // expected-error{{cannot refer to type member 'E' in 'X' with '->'}}
int i3 = x.Enumerator;
int i4 = xp->Enumerator;
x.mem = 1;
@@ -56,3 +56,19 @@ namespace test3 {
}
};
}
+
+namespace test4 {
+ class X {
+ protected:
+ template<typename T> void f(T);
+ };
+
+ class Y : public X {
+ public:
+ using X::f;
+ };
+
+ void test_f(Y y) {
+ y.f(17);
+ }
+}
diff --git a/test/SemaCXX/member-location.cpp b/test/SemaCXX/member-location.cpp
index c3099d2..6f7e1f5 100644
--- a/test/SemaCXX/member-location.cpp
+++ b/test/SemaCXX/member-location.cpp
@@ -1,5 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// PR4103: Make sure we have a location for the error
-class A { float a(int *); int b(); };
+class A {
+ float a(int *); // expected-note{{passing argument to parameter here}}
+ int b();
+};
int A::b() { return a(a((int*)0)); } // expected-error {{cannot initialize a parameter of type 'int *' with an rvalue of type 'float'}}
diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp
index 92ae92d..be25cbd 100644
--- a/test/SemaCXX/member-pointer.cpp
+++ b/test/SemaCXX/member-pointer.cpp
@@ -38,7 +38,7 @@ void f() {
int G::*pdig = pdi1; // expected-error {{conversion from pointer to member of class 'A' to pointer to member of class 'G' via virtual base 'D' is not allowed}}
// Conversion to member of base.
- pdi1 = pdid; // expected-error {{incompatible type assigning 'int D::*', expected 'int A::*'}}
+ pdi1 = pdid; // expected-error {{assigning to 'int A::*' from incompatible type 'int D::*'}}
// Comparisons
int (A::*pf2)(int, int);
@@ -88,7 +88,7 @@ void g() {
void (HasMembers::*pmd)() = &HasMembers::d;
}
-struct Incomplete;
+struct Incomplete; // expected-note {{forward declaration}}
void h() {
HasMembers hm, *phm = &hm;
@@ -123,7 +123,7 @@ void h() {
Incomplete *inc;
int Incomplete::*pii = 0;
- (void)(inc->*pii); // okay
+ (void)(inc->*pii); // expected-error {{pointer into incomplete}}
}
struct OverloadsPtrMem
@@ -147,3 +147,13 @@ namespace pr5985 {
}
};
}
+
+namespace pr6783 {
+ struct Base {};
+ struct X; // expected-note {{forward declaration}}
+
+ int test1(int Base::* p2m, X* object)
+ {
+ return object->*p2m; // expected-error {{left hand operand to ->*}}
+ }
+}
diff --git a/test/SemaCXX/missing-header.cpp b/test/SemaCXX/missing-header.cpp
new file mode 100644
index 0000000..f436579
--- /dev/null
+++ b/test/SemaCXX/missing-header.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include "not exist" // expected-error{{'not exist' file not found}}
+
+class AnalysisContext {};
+static ControlFlowKind CheckFallThrough(AnalysisContext &AC) {
+ if (const AsmStmt *AS = dyn_cast<AsmStmt>(S)) {}
+ bool NoReturnEdge = false;
+}
diff --git a/test/SemaCXX/namespace-alias.cpp b/test/SemaCXX/namespace-alias.cpp
index 3ea1ccf..1c3da3c 100644
--- a/test/SemaCXX/namespace-alias.cpp
+++ b/test/SemaCXX/namespace-alias.cpp
@@ -91,3 +91,13 @@ namespace A = N;
A::X nx;
+namespace PR7014 {
+ namespace X
+ {
+ namespace Y {}
+ }
+
+ using namespace X;
+
+ namespace Y = X::Y;
+}
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 9a611c3..59a8e8c 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -13,9 +13,9 @@ namespace A {
}
A:: ; // expected-error {{expected unqualified-id}}
-// FIXME: redundant errors
-::A::ax::undef ex3; // expected-error {{no member named}} expected-error {{unknown type name}}
-A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{unknown type name}}
+// FIXME: there is a member 'ax'; it's just not a class.
+::A::ax::undef ex3; // expected-error {{no member named 'ax'}}
+A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}}
int A::C::Ag1() { return 0; }
@@ -165,8 +165,7 @@ void ::global_func2(int) { } // expected-error{{definition or redeclaration of '
void N::f() { } // okay
struct Y; // expected-note{{forward declaration of 'Y'}}
-Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}} \
- // expected-error{{no type named 'foo' in}}
+Y::foo y; // expected-error{{incomplete type 'Y' named in nested name specifier}}
X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \
// expected-error{{C++ requires a type specifier for all declarations}} \
@@ -195,7 +194,7 @@ somens::a a3 = a2; // expected-error {{no viable conversion}}
// typedefs and using declarations.
namespace test1 {
namespace ns {
- class Counter { static int count; };
+ class Counter { public: static int count; };
typedef Counter counter;
}
using ns::counter;
@@ -224,9 +223,8 @@ namespace test2 {
// PR6259, invalid case
namespace test3 {
- // FIXME: this should really only trigger once
- class A; // expected-note 2 {{forward declaration}}
+ class A; // expected-note {{forward declaration}}
void foo(const char *path) {
- A::execute(path); // expected-error 2 {{incomplete type 'test3::A' named in nested name specifier}}
+ A::execute(path); // expected-error {{incomplete type 'test3::A' named in nested name specifier}}
}
}
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index ae77e70..763ed2c 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -34,7 +34,6 @@ void good_news()
S *ps = new S(1, 2, 3.4);
ps = new (pf) (S)(1, 2, 3.4);
S *(*paps)[2] = new S*[*pi][2];
- ps = new (S[3])(1, 2, 3.4);
typedef int ia4[4];
ia4 *pai = new (int[3][4]);
pi = ::new int;
@@ -182,6 +181,7 @@ void f(X8 *x8) {
}
class X9 {
+public:
static void operator delete(void*, int); // expected-note {{'operator delete' declared here}}
static void operator delete(void*, float); // expected-note {{'operator delete' declared here}}
};
@@ -216,6 +216,7 @@ static void* f(void* g)
}
class X14 {
+public:
static void operator delete(void*, const size_t);
};
@@ -229,3 +230,23 @@ namespace PR5918 { // Look for template operator new overloads.
(void)new(0) S;
}
}
+
+namespace Test1 {
+
+void f() {
+ (void)new int[10](1, 2); // expected-error {{array 'new' cannot have initialization arguments}}
+}
+
+template<typename T>
+void g(unsigned i) {
+ (void)new T[1](i); // expected-error {{array 'new' cannot have initialization arguments}}
+}
+
+template<typename T>
+void h(unsigned i) {
+ (void)new T(i); // expected-error {{array 'new' cannot have initialization arguments}}
+}
+template void h<unsigned>(unsigned);
+template void h<unsigned[10]>(unsigned); // expected-note {{in instantiation of function template specialization 'Test1::h<unsigned int [10]>' requested here}}
+
+}
diff --git a/test/SemaCXX/no-exceptions.cpp b/test/SemaCXX/no-exceptions.cpp
new file mode 100644
index 0000000..019e25c
--- /dev/null
+++ b/test/SemaCXX/no-exceptions.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Various tests for -fno-exceptions
+
+typedef __SIZE_TYPE__ size_t;
+
+namespace test0 {
+ // rdar://problem/7878149
+ class Foo {
+ public:
+ void* operator new(size_t x);
+ private:
+ void operator delete(void *x);
+ };
+
+ void test() {
+ // Under -fexceptions, this does access control for the associated
+ // 'operator delete'.
+ (void) new Foo();
+ }
+}
diff --git a/test/SemaCXX/offsetof.cpp b/test/SemaCXX/offsetof.cpp
index 3283270..47c3f22 100644
--- a/test/SemaCXX/offsetof.cpp
+++ b/test/SemaCXX/offsetof.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -Winvalid-offsetof
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -verify %s -Winvalid-offsetof
struct NonPOD {
virtual void f();
@@ -18,3 +18,38 @@ struct Derived : Base { int y; };
int o = __builtin_offsetof(Derived, x); // expected-warning{{offset of on non-POD type}}
const int o2 = sizeof(__builtin_offsetof(Derived, x));
+
+struct HasArray {
+ int array[17];
+};
+
+// Constant and non-constant offsetof expressions
+void test_ice(int i) {
+ int array0[__builtin_offsetof(HasArray, array[5])];
+ int array1[__builtin_offsetof(HasArray, array[i])]; // expected-error{{variable length arrays are not permitted in C++}}
+}
+
+// Bitfields
+struct has_bitfields {
+ int i : 7;
+ int j : 12; // expected-note{{bit-field is declared here}}
+};
+
+int test3 = __builtin_offsetof(struct has_bitfields, j); // expected-error{{cannot compute offset of bit-field 'j'}}
+
+// offsetof referring to members of a base class.
+struct Base1 {
+ int x;
+};
+
+struct Base2 {
+ int y;
+};
+
+struct Derived2 : public Base1, public Base2 {
+ int z;
+};
+
+int derived1[__builtin_offsetof(Derived2, x) == 0? 1 : -1];
+int derived2[__builtin_offsetof(Derived2, y) == 4? 1 : -1];
+int derived3[__builtin_offsetof(Derived2, z) == 8? 1 : -1];
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index c286028..79c74ce 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -247,14 +247,14 @@ struct Z : X, Y { };
int& cvqual_subsume(X&); // expected-note{{candidate function}}
float& cvqual_subsume(const Y&); // expected-note{{candidate function}}
-int& cvqual_subsume2(const X&);
-float& cvqual_subsume2(const volatile Y&);
+int& cvqual_subsume2(const X&); // expected-note{{candidate function}}
+float& cvqual_subsume2(const volatile Y&); // expected-note{{candidate function}}
Z get_Z();
void cvqual_subsume_test(Z z) {
cvqual_subsume(z); // expected-error{{call to 'cvqual_subsume' is ambiguous; candidates are:}}
- int& x = cvqual_subsume2(get_Z()); // okay: only binds to the first one
+ int& x = cvqual_subsume2(get_Z()); // expected-error{{call to 'cvqual_subsume2' is ambiguous; candidates are:}}
}
// Test overloading with cv-qualification differences in reference
@@ -406,3 +406,27 @@ namespace PR6483 {
f1(x1); // expected-error{{no matching function for call}}
}
}
+
+namespace PR6078 {
+ struct A {
+ A(short); // expected-note{{candidate constructor}}
+ A(long); // expected-note{{candidate constructor}}
+ };
+ struct S {
+ typedef void ft(A);
+ operator ft*();
+ };
+
+ void f() {
+ S()(0); // expected-error{{conversion from 'int' to 'PR6078::A' is ambiguous}}
+ }
+}
+
+namespace PR6177 {
+ struct String { String(char const*); };
+
+ void f(bool const volatile&); // expected-note{{passing argument to parameter here}}
+ void f(String);
+
+ void g() { f(""); } // expected-error{{volatile lvalue reference to type 'bool const volatile' cannot bind to a value of unrelated type 'char const [1]'}}
+}
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 89f1814..3d737f4 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -88,6 +88,7 @@ enum pr5244_bar
class pr5244_baz
{
+public:
pr5244_bar quux;
};
@@ -258,7 +259,7 @@ bool x(BB y, BB z) { return y != z; }
struct AX {
- AX& operator ->(); // expected-note {{declared at}}
+ AX& operator ->(); // expected-note {{declared here}}
int b;
};
@@ -268,14 +269,14 @@ void m() {
}
struct CircA {
- struct CircB& operator->(); // expected-note {{declared at}}
+ struct CircB& operator->(); // expected-note {{declared here}}
int val;
};
struct CircB {
- struct CircC& operator->(); // expected-note {{declared at}}
+ struct CircC& operator->(); // expected-note {{declared here}}
};
struct CircC {
- struct CircA& operator->(); // expected-note {{declared at}}
+ struct CircA& operator->(); // expected-note {{declared here}}
};
void circ() {
@@ -355,3 +356,24 @@ namespace pr5900 {
x(); // expected-error {{does not provide a call operator}}
}
}
+
+// Operator lookup through using declarations.
+namespace N {
+ struct X2 { };
+}
+
+namespace N2 {
+ namespace M {
+ namespace Inner {
+ template<typename T>
+ N::X2 &operator<<(N::X2&, const T&);
+ }
+ using Inner::operator<<;
+ }
+}
+
+void test_lookup_through_using() {
+ using namespace N2::M;
+ N::X2 x;
+ x << 17;
+}
diff --git a/test/SemaCXX/qual-id-test.cpp b/test/SemaCXX/qual-id-test.cpp
index 4846e72..e5c7306 100644
--- a/test/SemaCXX/qual-id-test.cpp
+++ b/test/SemaCXX/qual-id-test.cpp
@@ -48,7 +48,7 @@ namespace C
a.A::sub::x();
a.A::B::base::x();
- a.bad::x(); // expected-error{{type 'bad' is not a direct or virtual base of ''A::sub''}}
+ a.bad::x(); // expected-error{{'bad::x' is not a member of class 'A::sub'}}
a->foo();
a->member::foo();
@@ -69,7 +69,7 @@ namespace C
a->A::sub::x();
a->A::B::base::x();
- a->bad::x(); // expected-error{{type 'bad' is not a direct or virtual base of ''A::sub''}}
+ a->bad::x(); // expected-error{{'bad::x' is not a member of class 'A::sub'}}
(*a)->foo();
(*a)->member::foo();
@@ -107,7 +107,7 @@ namespace C
a.A::B::base::x();
a->A::member::foo();
- a.bad::x(); // expected-error{{direct or virtual}}
+ a.bad::x(); // expected-error{{'bad::x' is not a member of class 'A::sub'}}
}
void test_fun5() {
diff --git a/test/SemaCXX/qualified-id-lookup.cpp b/test/SemaCXX/qualified-id-lookup.cpp
index abde62e..dfb059a 100644
--- a/test/SemaCXX/qualified-id-lookup.cpp
+++ b/test/SemaCXX/qualified-id-lookup.cpp
@@ -124,3 +124,25 @@ namespace test1 {
template class ClassChecker<int>;
}
+
+namespace PR6830 {
+ namespace foo {
+
+ class X {
+ public:
+ X() {}
+ };
+
+ } // namespace foo
+
+ class Z {
+ public:
+ explicit Z(const foo::X& x) {}
+
+ void Work() {}
+ };
+
+ void Test() {
+ Z(foo::X()).Work();
+ }
+}
diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp
index 8844162..a8e95a3 100644
--- a/test/SemaCXX/ref-init-ambiguous.cpp
+++ b/test/SemaCXX/ref-init-ambiguous.cpp
@@ -17,7 +17,7 @@ void test(C c) {
const E2 &e2 = c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
}
-void foo(const E2 &);
+void foo(const E2 &);// expected-note{{passing argument to parameter here}}
const E2 & re(C c) {
foo(c); // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp
index f1f4ab9..e40ea01 100644
--- a/test/SemaCXX/references.cpp
+++ b/test/SemaCXX/references.cpp
@@ -66,8 +66,8 @@ int& test6(int& x) {
int& not_initialized_error; // expected-error{{declaration of reference variable 'not_initialized_error' requires an initializer}}
extern int& not_initialized_okay;
-class Test6 {
- int& okay;
+class Test6 { // expected-warning{{class 'Test6' does not declare any constructor to initialize its non-modifiable members}}
+ int& okay; // expected-note{{reference member 'okay' will never be initialized}}
};
struct C : B, A { };
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index a5dd7e2..48f641a 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/test/SemaCXX/static-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -faccess-control %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {};
struct B : public A {}; // Single public base.
struct C1 : public virtual B {}; // Single virtual base.
diff --git a/test/SemaCXX/storage-class.cpp b/test/SemaCXX/storage-class.cpp
new file mode 100644
index 0000000..a2e2063
--- /dev/null
+++ b/test/SemaCXX/storage-class.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+extern const int PR6495a = 42;
+extern int PR6495b = 42; // expected-warning{{'extern' variable has an initializer}}
+extern const int PR6495c[] = {42,43,44};
diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp
index c382539..49e1f3a 100644
--- a/test/SemaCXX/typedef-redecl.cpp
+++ b/test/SemaCXX/typedef-redecl.cpp
@@ -13,7 +13,7 @@ struct X {
struct Y; // expected-note{{previous definition is here}}
typedef int Y; // expected-error{{typedef redefinition with different types ('int' vs 'Y')}}
-typedef int Y2; // expected-note{{previous definition is here}}
+typedef int Y2; // expected-note{{declared here}}
struct Y2; // expected-error{{definition of type 'Y2' conflicts with typedef of the same name}}
void f(); // expected-note{{previous definition is here}}
@@ -37,3 +37,14 @@ namespace test1 {
using namespace a;
foo x;
}
+
+namespace PR6923 {
+ struct A;
+
+ extern "C" {
+ struct A;
+ typedef struct A A;
+ }
+
+ struct A;
+}
diff --git a/test/SemaCXX/typeid-ref.cpp b/test/SemaCXX/typeid-ref.cpp
new file mode 100644
index 0000000..da00169
--- /dev/null
+++ b/test/SemaCXX/typeid-ref.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+namespace std {
+ class type_info;
+}
+
+struct X { };
+
+void f() {
+ // CHECK: @_ZTS1X = weak_odr constant
+ // CHECK: @_ZTI1X = weak_odr constant
+ (void)typeid(X&);
+}
diff --git a/test/SemaCXX/typeid.cpp b/test/SemaCXX/typeid.cpp
index 0e78ff4..8db7db5 100644
--- a/test/SemaCXX/typeid.cpp
+++ b/test/SemaCXX/typeid.cpp
@@ -5,7 +5,6 @@ void f()
(void)typeid(int); // expected-error {{error: you need to include <typeinfo> before using the 'typeid' operator}}
}
-// FIXME: This should really include <typeinfo>, but we don't have that yet.
namespace std {
class type_info;
}
diff --git a/test/SemaCXX/unused-functions.cpp b/test/SemaCXX/unused-functions.cpp
new file mode 100644
index 0000000..cefa9e1
--- /dev/null
+++ b/test/SemaCXX/unused-functions.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused -verify %s
+
+static int foo(int x) { return x; }
+
+template<typename T>
+T get_from_foo(T y) { return foo(y); }
+
+int g(int z) { return get_from_foo(z); }
diff --git a/test/SemaCXX/user-defined-conversions.cpp b/test/SemaCXX/user-defined-conversions.cpp
index 4367f4b..5de7f44 100644
--- a/test/SemaCXX/user-defined-conversions.cpp
+++ b/test/SemaCXX/user-defined-conversions.cpp
@@ -67,3 +67,18 @@ void test_conversion(ConvertibleToBase ctb, ConvertibleToDerived ctd,
Base b4(ctd);
Base b5 = ctfd;
}
+
+struct X1 {
+ X1(X1&); // expected-note{{candidate constructor not viable: no known conversion from 'X1' to 'X1 &' for 1st argument}}
+};
+
+struct X2 {
+ operator X1();
+};
+
+int &f(X1);
+float &f(...);
+
+void g(X2 b) {
+ int &ir = f(b); // expected-error{{no viable constructor copying parameter of type 'X1'}}
+}
diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp
index 16a7a1d..10520fb 100644
--- a/test/SemaCXX/value-initialization.cpp
+++ b/test/SemaCXX/value-initialization.cpp
@@ -1,7 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-struct A { // expected-error {{implicit default constructor for 'A' must explicitly initialize the const member 'i'}}
- const int i; // expected-note {{declared at}}
+struct A { // expected-error {{implicit default constructor for 'A' must explicitly initialize the const member 'i'}} \
+ // expected-warning{{struct 'A' does not declare any constructor to initialize its non-modifiable members}}
+ const int i; // expected-note {{declared here}} \
+ // expected-note{{const member 'i' will never be initialized}}
virtual void f() { }
};
diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp
index 6887135..e07531f 100644
--- a/test/SemaCXX/virtual-override.cpp
+++ b/test/SemaCXX/virtual-override.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -faccess-control -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
namespace T1 {
class A {
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp
index ce16a68..e5a3425 100644
--- a/test/SemaCXX/warn-assignment-condition.cpp
+++ b/test/SemaCXX/warn-assignment-condition.cpp
@@ -12,33 +12,42 @@ void test() {
// With scalars.
if (x = 7) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
if ((x = 7)) {}
do {
} while (x = 7); // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
do {
} while ((x = 7));
while (x = 7) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
+
while ((x = 7)) {}
for (; x = 7; ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
for (; (x = 7); ) {}
if (p = p) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
if ((p = p)) {}
do {
} while (p = p); // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
do {
} while ((p = p));
while (p = p) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
while ((p = p)) {}
for (; p = p; ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
for (; (p = p); ) {}
// Initializing variables (shouldn't warn).
@@ -49,33 +58,41 @@ void test() {
// With temporaries.
if (x = (b+b).foo()) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
if ((x = (b+b).foo())) {}
do {
} while (x = (b+b).foo()); // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
do {
} while ((x = (b+b).foo()));
while (x = (b+b).foo()) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
while ((x = (b+b).foo())) {}
for (; x = (b+b).foo(); ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
for (; (x = (b+b).foo()); ) {}
// With a user-defined operator.
if (a = b + b) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
if ((a = b + b)) {}
do {
} while (a = b + b); // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
do {
} while ((a = b + b));
while (a = b + b) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
while ((a = b + b)) {}
for (; a = b + b; ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
- // expected-note{{use '==' to turn this assignment into an equality comparison}}
+ // expected-note{{use '==' to turn this assignment into an equality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
for (; (a = b + b); ) {}
}
diff --git a/test/SemaCXX/warn-missing-noreturn.cpp b/test/SemaCXX/warn-missing-noreturn.cpp
index 32d020f..8016c3d 100644
--- a/test/SemaCXX/warn-missing-noreturn.cpp
+++ b/test/SemaCXX/warn-missing-noreturn.cpp
@@ -22,3 +22,17 @@ struct B {
};
template void B::g<int>(int); // expected-note {{in instantiation of function template specialization 'B::g<int>' requested here}}
+
+// We don't want a warning here.
+struct X {
+ virtual void g() { f(); }
+};
+
+namespace test1 {
+ bool condition();
+
+ // We don't want a warning here.
+ void foo() {
+ while (condition()) {}
+ }
+}
diff --git a/test/SemaCXX/warn-reorder-ctor-initialization.cpp b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
index f419156..3ff01af 100644
--- a/test/SemaCXX/warn-reorder-ctor-initialization.cpp
+++ b/test/SemaCXX/warn-reorder-ctor-initialization.cpp
@@ -6,12 +6,13 @@ struct BB1 {};
class complex : public BB, BB1 {
public:
- complex() : s2(1), // expected-warning {{member 's2' will be initialized after}}
- s1(1) , // expected-note {{field s1}}
- s3(3), // expected-warning {{member 's3' will be initialized after}}
- BB1(), // expected-note {{base 'BB1'}} \
- // expected-warning {{base class 'BB1' will be initialized after}}
- BB() {} // expected-note {{base 'BB'}}
+ complex()
+ : s2(1), // expected-warning {{field 's2' will be initialized after field 's1'}}
+ s1(1),
+ s3(3), // expected-warning {{field 's3' will be initialized after base 'BB1'}}
+ BB1(), // expected-warning {{base class 'BB1' will be initialized after base 'BB'}}
+ BB()
+ {}
int s1;
int s2;
int s3;
@@ -44,14 +45,12 @@ struct C : public A, public B, private virtual V {
struct D : public A, public B {
- D() : A(), V() { } // expected-warning {{base class 'A' will be initialized after}} \
- // expected-note {{base 'V'}}
+ D() : A(), V() { } // expected-warning {{base class 'A' will be initialized after base 'V'}}
};
struct E : public A, public B, private virtual V {
- E() : A(), V() { } // expected-warning {{base class 'A' will be initialized after}} \
- // expected-note {{base 'V'}}
+ E() : A(), V() { } // expected-warning {{base class 'A' will be initialized after base 'V'}}
};
@@ -64,13 +63,11 @@ struct B1 {
};
struct F : public A1, public B1, private virtual V {
- F() : A1(), V() { } // expected-warning {{base class 'A1' will be initialized after}} \
- // expected-note {{base 'V'}}
+ F() : A1(), V() { } // expected-warning {{base class 'A1' will be initialized after base 'V'}}
};
struct X : public virtual A, virtual V, public virtual B {
- X(): A(), V(), B() {} // expected-warning {{base class 'A' will be initialized after}} \
- // expected-note {{base 'V'}}
+ X(): A(), V(), B() {} // expected-warning {{base class 'A' will be initialized after base 'V'}}
};
class Anon {
@@ -80,8 +77,8 @@ class Anon {
class Anon2 {
int c; union {int a,b;}; int d;
Anon2() : c(2),
- d(10), // expected-warning {{member 'd' will be initialized after}}
- b(1) {} // expected-note {{field b}}
+ d(10), // expected-warning {{field 'd' will be initialized after field 'b'}}
+ b(1) {}
};
class Anon3 {
union {int a,b;};
@@ -95,7 +92,31 @@ struct S2: virtual S1 { };
struct S3 { };
struct S4: virtual S3, S2 {
- S4() : S2(), // expected-warning {{base class 'T1::S2' will be initialized after}}
- S3() { }; // expected-note {{base 'T1::S3'}}
+ S4() : S2(), // expected-warning {{base class 'T1::S2' will be initialized after base 'T1::S3'}}
+ S3() { };
};
}
+
+namespace test2 {
+ struct Foo { Foo(); };
+ class A {
+ template <class T> A(T *t) :
+ y(), // expected-warning {{field 'y' will be initialized after field 'x'}}
+ x()
+ {}
+ Foo x;
+ Foo y;
+ };
+}
+
+// PR6575: this should not crash
+namespace test3 {
+ struct MyClass {
+ MyClass() : m_int(0) {}
+ union {
+ struct {
+ int m_int;
+ };
+ };
+ };
+}
diff --git a/test/SemaCXX/warn-unused-parameters.cpp b/test/SemaCXX/warn-unused-parameters.cpp
new file mode 100644
index 0000000..75d8dcc
--- /dev/null
+++ b/test/SemaCXX/warn-unused-parameters.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -verify %s
+template<typename T>
+struct X {
+ T f0(T x);
+ T f1(T x);
+ T f2(T);
+ template<typename U> U f3(U x);
+ template<typename U> U f4(U x);
+ template<typename U> U f5(U);
+};
+
+template<typename T> T X<T>::f0(T x) { return x; }
+template<typename T> T X<T>::f1(T) { return T(); }
+template<typename T> T X<T>::f2(T x) { return T(); } // expected-warning{{unused parameter 'x'}}
+template<typename T> template<typename U> U X<T>::f3(U x) { return x; }
+template<typename T> template<typename U> U X<T>::f4(U) { return U(); }
+template<typename T> template<typename U> U X<T>::f5(U x) { return U(); } // expected-warning{{unused parameter 'x'}}
+
+void test_X(X<int> &x, int i) {
+ x.f0(i);
+ x.f1(i);
+ x.f2(i);
+ x.f3(i);
+ x.f4(i);
+ x.f5(i);
+}
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp
index 3b5349a..5ef7e70 100644
--- a/test/SemaCXX/warn-unused-variables.cpp
+++ b/test/SemaCXX/warn-unused-variables.cpp
@@ -51,3 +51,11 @@ void test_dependent_init(T *p) {
X0<int> i(p);
(void)i;
}
+
+namespace PR6948 {
+ template<typename T> class X;
+
+ void f() {
+ X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
+ }
+}
diff --git a/test/SemaCXX/warn-weak-vtables.cpp b/test/SemaCXX/warn-weak-vtables.cpp
index 1ea88a5..39333c1 100644
--- a/test/SemaCXX/warn-weak-vtables.cpp
+++ b/test/SemaCXX/warn-weak-vtables.cpp
@@ -18,4 +18,4 @@ void f() {
struct A {
virtual void f() { }
};
-} \ No newline at end of file
+}
diff --git a/test/SemaObjC/argument-checking.m b/test/SemaObjC/argument-checking.m
index 3806a4c..9019a0f 100644
--- a/test/SemaObjC/argument-checking.m
+++ b/test/SemaObjC/argument-checking.m
@@ -2,24 +2,25 @@
struct S { int a; };
-extern int charStarFunc(char *);
-extern int charFunc(char);
+extern int charStarFunc(char *); // expected-note{{passing argument to parameter here}}
+extern int charFunc(char); // expected-note{{passing argument to parameter here}}
@interface Test
+alloc;
--(int)charStarMeth:(char *)s;
--structMeth:(struct S)s;
--structMeth:(struct S)s :(struct S)s2;
+-(int)charStarMeth:(char *)s; // expected-note{{passing argument to parameter 's' here}}
+-structMeth:(struct S)s; // expected-note{{passing argument to parameter 's' here}}
+-structMeth:(struct S)s
+ :(struct S)s2; // expected-note{{passing argument to parameter 's2' here}}
@end
void test() {
id obj = [Test alloc];
struct S sInst;
- charStarFunc(1); // expected-warning {{incompatible integer to pointer conversion passing 'int', expected 'char *'}}
- charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]', expected 'char'}}
+ charStarFunc(1); // expected-warning {{incompatible integer to pointer conversion passing 'int' to parameter of type 'char *'}}
+ charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]' to parameter of type 'char'}}
[obj charStarMeth:1]; // expected-warning {{incompatible integer to pointer conversion sending 'int'}}
- [obj structMeth:1]; // expected-error {{incompatible type sending 'int'}}
- [obj structMeth:sInst :1]; // expected-error {{incompatible type sending 'int'}}
+ [obj structMeth:1]; // expected-error {{sending 'int'}}
+ [obj structMeth:sInst :1]; // expected-error {{sending 'int'}}
}
diff --git a/test/SemaObjC/block-type-safety.m b/test/SemaObjC/block-type-safety.m
index b40f9b0..402a658 100644
--- a/test/SemaObjC/block-type-safety.m
+++ b/test/SemaObjC/block-type-safety.m
@@ -4,7 +4,7 @@
@interface Super @end
@interface Sub : Super @end
-void f2(void(^f)(Super *)) {
+void f2(void(^f)(Super *)) { // expected-note{{passing argument to parameter 'f' here}}
Super *o;
f(o);
}
@@ -18,7 +18,7 @@ void r0(Super* (^f)()) {
Super *o = f();
}
-void r1(Sub* (^f)()) {
+void r1(Sub* (^f)()) { // expected-note{{passing argument to parameter 'f' here}}
Sub *o = f();
}
@@ -29,14 +29,14 @@ void r2 (id<NSObject> (^f) (void)) {
}
void test1() {
- f2(^(Sub *o) { }); // expected-error {{incompatible block pointer types passing 'void (^)(Sub *)', expected 'void (^)(Super *)'}}
+ f2(^(Sub *o) { }); // expected-error {{incompatible block pointer types passing}}
f3(^(Super *o) { }); // OK, block taking Super* may be called with a Sub*
r0(^Super* () { return 0; }); // OK
r0(^Sub* () { return 0; }); // OK, variable of type Super* gets return value of type Sub*
r0(^id () { return 0; });
- r1(^Super* () { return 0; }); // expected-error {{incompatible block pointer types passing 'Super *(^)(void)', expected 'Sub *(^)()'}}
+ r1(^Super* () { return 0; }); // expected-error {{incompatible block pointer types passing}}
r1(^Sub* () { return 0; }); // OK
r1(^id () { return 0; });
@@ -94,3 +94,13 @@ void test2(void)
}
@end
+@protocol P, P2;
+void f4(void (^f)(id<P> x)) { // expected-note{{passing argument to parameter 'f' here}}
+ NSArray<P2> *b;
+ f(b); // expected-warning {{passing 'NSArray<P2> *' to parameter of incompatible type 'id<P>'}}
+}
+
+void test3() {
+ f4(^(NSArray<P2>* a) { }); // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)' to parameter of type 'void (^)(id<P>)'}}
+}
+
diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m
index ddac7d1..15aa581 100644
--- a/test/SemaObjC/blocks.m
+++ b/test/SemaObjC/blocks.m
@@ -21,9 +21,9 @@ void foo4(id (^objectCreationBlock)(int)) {
return bar4(objectCreationBlock);
}
-void bar5(id(^)(void));
+void bar5(id(^)(void)); // expected-note{{passing argument to parameter here}}
void foo5(id (^objectCreationBlock)(int)) {
- return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)', expected 'id (^)(void)'}}
+ return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)' to parameter of type 'id (^)(void)'}}
}
void bar6(id(^)(int));
@@ -39,10 +39,10 @@ void foo7(id (^x)(int)) {
@end
void foo8() {
- void *P = ^(itf x) {}; // expected-error {{Objective-C interface type 'itf' cannot be passed by value}}
- P = ^itf(int x) {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}}
- P = ^itf() {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}}
- P = ^itf{}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value}}
+ void *P = ^(itf x) {}; // expected-error {{Objective-C interface type 'itf' cannot be passed by value; did you forget * in 'itf'}}
+ P = ^itf(int x) {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value; did you forget * in 'itf'}}
+ P = ^itf() {}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value; did you forget * in 'itf'}}
+ P = ^itf{}; // expected-error {{Objective-C interface type 'itf' cannot be returned by value; did you forget * in 'itf'}}
}
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index 9be853b..043314d 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -69,7 +69,7 @@ id objc_getClass(const char *s);
- (int) instance_func1
{
int i = (size_t)[self instance_func0]; // expected-warning {{method '-instance_func0' not found (return type defaults to 'id'))}}
- return i + (size_t)[super instance_func0]; // expected-warning {{method '-instance_func0' not found (return type defaults to 'id')}}
+ return i + (size_t)[super instance_func0]; // expected-warning {{'Object' may not respond to 'instance_func0')}}
}
- (int) instance_func2
{
diff --git a/test/SemaObjC/catch-stmt.m b/test/SemaObjC/catch-stmt.m
index 80c986f..ef1da37 100644
--- a/test/SemaObjC/catch-stmt.m
+++ b/test/SemaObjC/catch-stmt.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -verify %s
-
+@interface A @end
@protocol P;
void f() {
@@ -8,6 +8,6 @@ void f() {
} @catch (int) { // expected-error{{@catch parameter is not a pointer to an interface type}}
} @catch (int *b) { // expected-error{{@catch parameter is not a pointer to an interface type}}
} @catch (id <P> c) { // expected-error{{illegal qualifiers on @catch parameter}}
- }
+ } @catch(A* a) { }
}
diff --git a/test/SemaObjC/class-bitfield.m b/test/SemaObjC/class-bitfield.m
index d152562..c0393c2 100644
--- a/test/SemaObjC/class-bitfield.m
+++ b/test/SemaObjC/class-bitfield.m
@@ -5,7 +5,7 @@
int a : -1; // expected-error{{bit-field 'a' has negative width}}
// rdar://6081627
- int b : 33; // expected-error{{size of bit-field 'b' exceeds size of its type (32 bits)}}
+ int b : 33; // expected-error{{size of bit-field 'b' (33 bits) exceeds size of its type (32 bits)}}
int c : (1 + 0.25); // expected-error{{expression is not an integer constant expression}}
int d : (int)(1 + 0.25);
diff --git a/test/SemaObjC/class-method-lookup.m b/test/SemaObjC/class-method-lookup.m
index f1269f2..f26d692 100644
--- a/test/SemaObjC/class-method-lookup.m
+++ b/test/SemaObjC/class-method-lookup.m
@@ -40,7 +40,7 @@
id foo(void) {
Object *obj;
id obj2 = obj;
- [obj setWindow:nil]; // expected-warning {{Object may not respond to 'setWindow:'}}
+ [obj setWindow:nil]; // expected-warning {{'Object' may not respond to 'setWindow:'}}
return obj;
}
diff --git a/test/SemaObjC/class-method-self.m b/test/SemaObjC/class-method-self.m
index 6f7d1fd..ba70644 100644
--- a/test/SemaObjC/class-method-self.m
+++ b/test/SemaObjC/class-method-self.m
@@ -3,7 +3,7 @@
typedef struct objc_class *Class;
@interface XX
-- (void)addObserver:(XX*)o;
+- (void)addObserver:(XX*)o; // expected-note 2{{passing argument to parameter 'o' here}}
@end
@@ -18,9 +18,9 @@ typedef struct objc_class *Class;
static XX *obj;
+ (void)classMethod {
- [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class', expected 'XX *'}}
+ [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}}
Class whatever;
- [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class', expected 'XX *'}}
+ [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}}
}
@end
diff --git a/test/SemaObjC/compatible-protocol-qualified-types.m b/test/SemaObjC/compatible-protocol-qualified-types.m
index 0df905c..0342622 100644
--- a/test/SemaObjC/compatible-protocol-qualified-types.m
+++ b/test/SemaObjC/compatible-protocol-qualified-types.m
@@ -44,7 +44,7 @@ extern NSString * const XCActiveSelectionLevel;
@interface NSTextStorage : NSObject
-- (void)setDelegate:(id <NSTextStorageDelegate>)delegate;
+- (void)setDelegate:(id <NSTextStorageDelegate>)delegate; // expected-note{{passing argument to parameter 'delegate' here}}
- (id <NSTextStorageDelegate>)delegate;
@end
@@ -69,7 +69,7 @@ extern NSString * const XCActiveSelectionLevel;
- (NSTextStorage *)contents {
- [_contents setDelegate:self]; // expected-warning {{incompatible type sending 'SKTText *', expected 'id<NSTextStorageDelegate>'}}
+ [_contents setDelegate:self]; // expected-warning {{sending 'SKTText *' to parameter of incompatible type 'id<NSTextStorageDelegate>'}}
return 0;
}
diff --git a/test/SemaObjC/compound-init.m b/test/SemaObjC/compound-init.m
new file mode 100644
index 0000000..7b288bb
--- /dev/null
+++ b/test/SemaObjC/compound-init.m
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@interface A
+@end
+
+void f() {
+ (A){ 0 }; // expected-error{{cannot initialize Objective-C class type 'A'}}
+}
diff --git a/test/SemaObjC/comptypes-1.m b/test/SemaObjC/comptypes-1.m
index 5b1891d..98107ee 100644
--- a/test/SemaObjC/comptypes-1.m
+++ b/test/SemaObjC/comptypes-1.m
@@ -34,25 +34,25 @@ int main()
/* Assigning to a 'MyClass *' variable should always generate a
warning, unless done from an 'id'. */
obj_c = obj; /* Ok */
- obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning 'MyOtherClass *', expected 'MyClass *'}}
- obj_c = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyClass *'}}
+ obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'MyOtherClass *'}}
+ obj_c = obj_C; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'Class'}}
/* Assigning to an 'id<MyProtocol>' variable should generate a
warning if done from a 'MyClass *' (which doesn't implement
MyProtocol), but not from an 'id' or from a 'MyOtherClass *'
(which implements MyProtocol). */
obj_p = obj; /* Ok */
- obj_p = obj_c; // expected-warning {{incompatible type assigning 'MyClass *', expected 'id<MyProtocol>'}}
+ obj_p = obj_c; // expected-warning {{ assigning to 'id<MyProtocol>' from incompatible type 'MyClass *'}}
obj_p = obj_cp; /* Ok */
- obj_p = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<MyProtocol>'}}
+ obj_p = obj_C; // expected-warning {{incompatible pointer types assigning to 'id<MyProtocol>' from 'Class'}}
/* Assigning to a 'MyOtherClass *' variable should always generate
a warning, unless done from an 'id' or an 'id<MyProtocol>' (since
MyOtherClass implements MyProtocol). */
obj_cp = obj; /* Ok */
- obj_cp = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *', expected 'MyOtherClass *'}}
+ obj_cp = obj_c; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'MyClass *'}}
obj_cp = obj_p; /* Ok */
- obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyOtherClass *'}}
+ obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}}
/* Any comparison involving an 'id' must be without warnings. */
if (obj == obj_p) foo() ; /* Ok */ /*Bogus warning here in 2.95.4*/
diff --git a/test/SemaObjC/comptypes-3.m b/test/SemaObjC/comptypes-3.m
index 94171d1..6c1ce41 100644
--- a/test/SemaObjC/comptypes-3.m
+++ b/test/SemaObjC/comptypes-3.m
@@ -26,21 +26,21 @@ int main()
id<MyProtocolAB> obj_ab = nil;
id<MyProtocolAC> obj_ac = nil;
- obj_a = obj_b; // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolA>'}}
+ obj_a = obj_b; // expected-warning {{assigning to 'id<MyProtocolA>' from incompatible type 'id<MyProtocolB>'}}
obj_a = obj_ab; /* Ok */
obj_a = obj_ac; /* Ok */
- obj_b = obj_a; // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolB>'}}
+ obj_b = obj_a; // expected-warning {{assigning to 'id<MyProtocolB>' from incompatible type 'id<MyProtocolA>'}}
obj_b = obj_ab; /* Ok */
- obj_b = obj_ac; // expected-warning {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolB>'}}
+ obj_b = obj_ac; // expected-warning {{assigning to 'id<MyProtocolB>' from incompatible type 'id<MyProtocolAC>'}}
- obj_ab = obj_a; // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAB>'}}
- obj_ab = obj_b; // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAB>'}}
- obj_ab = obj_ac; // expected-warning {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolAB>'}}
+ obj_ab = obj_a; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolA>'}}
+ obj_ab = obj_b; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolB>'}}
+ obj_ab = obj_ac; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolAC>'}}
- obj_ac = obj_a; // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAC>'}}
- obj_ac = obj_b; // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAC>'}}
- obj_ac = obj_ab; // expected-warning {{incompatible type assigning 'id<MyProtocolAB>', expected 'id<MyProtocolAC>'}}
+ obj_ac = obj_a; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolA>'}}
+ obj_ac = obj_b; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolB>'}}
+ obj_ac = obj_ab; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolAB>'}}
if (obj_a == obj_b) foo (); // expected-warning {{comparison of distinct pointer types ('id<MyProtocolA>' and 'id<MyProtocolB>')}}
if (obj_b == obj_a) foo (); // expected-warning {{comparison of distinct pointer types ('id<MyProtocolB>' and 'id<MyProtocolA>')}}
diff --git a/test/SemaObjC/comptypes-6.m b/test/SemaObjC/comptypes-6.m
index 2911a39..98cf488 100644
--- a/test/SemaObjC/comptypes-6.m
+++ b/test/SemaObjC/comptypes-6.m
@@ -9,7 +9,7 @@ extern Object* foo(void);
static Derived *test(void)
{
- Derived *m = foo(); // expected-warning {{incompatible pointer types initializing 'Object *', expected 'Derived *'}}
+ Derived *m = foo(); // expected-warning {{incompatible pointer types initializing 'Derived *' with an expression of type 'Object *'}}
return m;
}
diff --git a/test/SemaObjC/comptypes-7.m b/test/SemaObjC/comptypes-7.m
index 2519c41..df627e5 100644
--- a/test/SemaObjC/comptypes-7.m
+++ b/test/SemaObjC/comptypes-7.m
@@ -24,27 +24,27 @@ int main()
/* These should all generate warnings. */
- obj = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'id'}}
- obj = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id'}}
+ obj = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id' from 'int'}}
+ obj = j; // expected-warning {{incompatible pointer types assigning to 'id' from 'int *'}}
- obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'id<MyProtocol>'}}
- obj_p = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id<MyProtocol>'}}
+ obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id<MyProtocol>' from 'int'}}
+ obj_p = j; // expected-warning {{ incompatible pointer types assigning to 'id<MyProtocol>' from 'int *'}}
- obj_c = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'MyClass *'}}
- obj_c = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'MyClass *'}}
+ obj_c = i; // expected-warning {{ incompatible integer to pointer conversion assigning to 'MyClass *' from 'int'}}
+ obj_c = j; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'int *'}}
- obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'Class'}}
- obj_C = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'Class'}}
+ obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'Class' from 'int'}}
+ obj_C = j; // expected-warning {{incompatible pointer types assigning to 'Class' from 'int *'}}
- i = obj; // expected-warning {{incompatible pointer to integer conversion assigning 'id', expected 'int'}}
- i = obj_p; // expected-warning {{incompatible pointer to integer conversion assigning 'id<MyProtocol>', expected 'int'}}
- i = obj_c; // expected-warning {{incompatible pointer to integer conversion assigning 'MyClass *', expected 'int'}}
- i = obj_C; // expected-warning {{incompatible pointer to integer conversion assigning 'Class', expected 'int'}}
+ i = obj; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'id'}}
+ i = obj_p; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'id<MyProtocol>'}}
+ i = obj_c; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'MyClass *'}}
+ i = obj_C; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'Class'}}
- j = obj; // expected-warning {{incompatible pointer types assigning 'id', expected 'int *'}}
- j = obj_p; // expected-warning {{incompatible pointer types assigning 'id<MyProtocol>', expected 'int *'}}
- j = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *', expected 'int *'}}
- j = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'int *'}}
+ j = obj; // expected-warning {{incompatible pointer types assigning to 'int *' from 'id'}}
+ j = obj_p; // expected-warning {{ incompatible pointer types assigning to 'int *' from 'id<MyProtocol>'}}
+ j = obj_c; // expected-warning {{incompatible pointer types assigning to 'int *' from 'MyClass *'}}
+ j = obj_C; // expected-warning {{incompatible pointer types assigning to 'int *' from 'Class'}}
if (obj == i) foo() ; // expected-warning {{comparison between pointer and integer ('id' and 'int')}}
if (i == obj) foo() ; // expected-warning {{comparison between pointer and integer ('int' and 'id')}}
diff --git a/test/SemaObjC/comptypes-legal.m b/test/SemaObjC/comptypes-legal.m
index 8caf185..d83d559 100644
--- a/test/SemaObjC/comptypes-legal.m
+++ b/test/SemaObjC/comptypes-legal.m
@@ -26,12 +26,12 @@ NSObject *ExternFunc (NSObject *filePath, NSObject *key);
typedef id FuncSignature (NSObject *arg1, Derived *arg2);
@interface Derived: NSObject
-+ (void)registerFunc:(FuncSignature *)function;
++ (void)registerFunc:(FuncSignature *)function; // expected-note{{passing argument to parameter 'function' here}}
@end
void foo(void)
{
// GCC currently allows this (it has some fiarly new support for covariant return types and contravariant argument types).
// Since registerFunc: expects a Derived object as it's second argument, I don't know why this would be legal.
- [Derived registerFunc: ExternFunc]; // expected-warning{{incompatible pointer types sending 'NSObject *(NSObject *, NSObject *)', expected 'FuncSignature *'}}
+ [Derived registerFunc: ExternFunc]; // expected-warning{{incompatible pointer types sending 'NSObject *(NSObject *, NSObject *)' to parameter of type 'FuncSignature *'}}
}
diff --git a/test/SemaObjC/conditional-expr-2.m b/test/SemaObjC/conditional-expr-2.m
index e97b693..fdf3d13 100644
--- a/test/SemaObjC/conditional-expr-2.m
+++ b/test/SemaObjC/conditional-expr-2.m
@@ -25,5 +25,5 @@ void foo (int i, NSKey *NSKeyValueCoding_NullValue, UpdatesList *nukedUpdatesLis
obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
key = i ? NSKeyValueCoding_NullValue : keysub;
- keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning 'NSKey *', expected 'KeySub *'}}
+ keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}}
}
diff --git a/test/SemaObjC/conditional-expr-3.m b/test/SemaObjC/conditional-expr-3.m
index 312f77a..3b5f609 100644
--- a/test/SemaObjC/conditional-expr-3.m
+++ b/test/SemaObjC/conditional-expr-3.m
@@ -27,11 +27,11 @@ void f1(id x, A *a) {
}
void f2(id<P1> x) {
- id<P0> l = x; // expected-warning {{incompatible type initializing 'id<P1>', expected 'id<P0>'}}
+ id<P0> l = x; // expected-warning {{initializing 'id<P0>' with an expression of incompatible type 'id<P1>'}}
}
void f3(A *a) {
- id<P1> l = a; // expected-warning {{incompatible type initializing 'A *', expected 'id<P1>'}}
+ id<P1> l = a; // expected-warning {{ initializing 'id<P1>' with an expression of incompatible type 'A *'}}
}
void f4(int cond, id x, A *a) {
diff --git a/test/SemaObjC/conditional-expr-4.m b/test/SemaObjC/conditional-expr-4.m
index 84652e4..b3317f5 100644
--- a/test/SemaObjC/conditional-expr-4.m
+++ b/test/SemaObjC/conditional-expr-4.m
@@ -26,7 +26,7 @@ A *f1_a(int cond, A *a) {
}
void *f1_const_a(int x, void *p, const A * q) {
- void *r = x ? p : q; // expected-warning{{initializing 'void const *' discards qualifiers, expected 'void *'}}
+ void *r = x ? p : q; // expected-warning{{initializing 'void *' with an expression of type 'void const *' discards qualifiers}}
return r;
}
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index 1436f7e..74ab59b 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -27,7 +27,7 @@
@implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
- self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}}
+ self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream2 *' from incompatible type 'id<DTOutputStreams>'}}
return nextOutputStream ? nextOutputStream : self; // expected-warning {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream2 *')}}
}
@end
@@ -36,7 +36,7 @@
@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{method '-nextOutputStream' not found (return type defaults to 'id')}}
- self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream3 *'}}
+ self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream3 *' from incompatible type 'id<DTOutputStreams>'}}
return nextOutputStream ? nextOutputStream : self; // expected-warning {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream3 *')}}
}
@end
diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m
index 214c4e5..2525182 100644
--- a/test/SemaObjC/continuation-class-err.m
+++ b/test/SemaObjC/continuation-class-err.m
@@ -12,7 +12,7 @@
@interface ReadOnly ()
@property(readwrite, copy) id object; // expected-warning {{property attribute in continuation class does not match the primary class}}
-@property(readonly) id object1; // expected-error {{property declaration in continuation class of 'ReadOnly' is to change a 'readonly' property to 'readwrite'}}
+@property(readonly) id object1; // expected-error {{illegal declaration of property in continuation class 'ReadOnly': attribute must be}}
@property (readwrite, assign) int indentLevel; // OK. assign the the default in any case.
@end
@@ -31,8 +31,8 @@
@end
@interface Bar ()
-@property (copy) id foo; // expected-error {{property declaration in continuation class of 'Bar' is to change a 'readonly' property to 'readwrite'}}
-@property (copy) id fee; // expected-error {{property declaration in continuation class of 'Bar' is to change a 'readonly' property to 'readwrite'}}
+@property (copy) id foo; // expected-error {{illegal declaration of property in continuation class 'Bar': attribute must be}}
+@property (copy) id fee; // expected-error {{illegal declaration of property in continuation class 'Bar': attribute must be}}
@end
@implementation Bar
diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m
index 45a3710..283ad26 100644
--- a/test/SemaObjC/default-synthesize.m
+++ b/test/SemaObjC/default-synthesize.m
@@ -79,3 +79,27 @@
}
@end
+@protocol TopProtocol
+ @property (readonly) id myString;
+@end
+
+@interface TopClass <TopProtocol>
+{
+ id myString;
+}
+@end
+
+@interface SubClass : TopClass <TopProtocol>
+@end
+
+@implementation SubClass @end
+
+// rdar: // 7920807
+@interface C @end
+@interface C (Category)
+@property int p; // expected-warning {{property 'p' requires method 'p' to be defined }} \
+ // expected-warning {{property 'p' requires method 'setP:' to be defined}}
+@end
+@implementation C (Category) // expected-note 2 {{implementation is here}}
+@end
+
diff --git a/test/SemaObjC/ibaction.m b/test/SemaObjC/ibaction.m
new file mode 100644
index 0000000..b97e002
--- /dev/null
+++ b/test/SemaObjC/ibaction.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -verify
+
+@interface Foo
+{
+ __attribute__((iboutlet)) id myoutlet;
+}
+- (void) __attribute__((ibaction)) myMessage:(id)msg;
+@end
+
+@implementation Foo
+// Normally attributes should not be attached to method definitions, but
+// we allow 'ibaction' to be attached because it can be expanded from
+// the IBAction macro.
+- (void) __attribute__((ibaction)) myMessage:(id)msg {} // no-warning
+@end
diff --git a/test/SemaObjC/id.m b/test/SemaObjC/id.m
index 206127a..27b84de 100644
--- a/test/SemaObjC/id.m
+++ b/test/SemaObjC/id.m
@@ -9,8 +9,8 @@ void foo() {
// Test assignment compatibility of Class and id. No warning should be
// produced.
// rdar://6770142 - Class and id<foo> are compatible.
- S = T; // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<Foo>'}}
- T = S; // expected-warning {{incompatible pointer types assigning 'id<Foo>', expected 'Class'}}
+ S = T; // expected-warning {{incompatible pointer types assigning to 'id<Foo>' from 'Class'}}
+ T = S; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id<Foo>'}}
R = T; T = R;
R = S; S = R;
}
diff --git a/test/SemaObjC/incompatible-protocol-qualified-types.m b/test/SemaObjC/incompatible-protocol-qualified-types.m
index 7eb540a..494d23e 100644
--- a/test/SemaObjC/incompatible-protocol-qualified-types.m
+++ b/test/SemaObjC/incompatible-protocol-qualified-types.m
@@ -8,7 +8,7 @@
@interface INTF @end
-INTF <MyProto1> * Func(INTF <MyProto1, MyProto2> *p2)
+INTF <MyProto1> * Func(INTF <MyProto1, MyProto2> *p2) // expected-note{{passing argument to parameter 'p2' here}}
{
return p2;
}
@@ -21,15 +21,15 @@ INTF <MyProto1> * Func1(INTF <MyProto1, MyProto2> *p2)
INTF <MyProto1, MyProto2> * Func2(INTF <MyProto1> *p2)
{
- Func(p2); // expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}}
- return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}}
+ Func(p2); // expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *' to parameter of type 'INTF<MyProto1,MyProto2> *'}}
+ return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *' from a function with result type 'INTF<MyProto1,MyProto2> *'}}
}
INTF <MyProto1> * Func3(INTF <MyProto2> *p2)
{
- return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *', expected 'INTF<MyProto1> *}}
+ return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *' from a function with result type 'INTF<MyProto1> *'}}
}
diff --git a/test/SemaObjC/invalid-code.m b/test/SemaObjC/invalid-code.m
index 2f297cf..7a642fb 100644
--- a/test/SemaObjC/invalid-code.m
+++ b/test/SemaObjC/invalid-code.m
@@ -12,3 +12,10 @@ void test1() {
__PRETTY_FUNCTION__; // expected-warning{{expression result unused}}
}
@end
+
+// <rdar://problem/7881045>
+// This previously triggered a crash because a ';' was expected after the @throw statement.
+void foo() {
+ @throw (id)0 // expected-error{{expected ';' after @throw}}
+}
+
diff --git a/test/SemaObjC/invalid-objc-decls-1.m b/test/SemaObjC/invalid-objc-decls-1.m
index 2f3be28..91bd8a8 100644
--- a/test/SemaObjC/invalid-objc-decls-1.m
+++ b/test/SemaObjC/invalid-objc-decls-1.m
@@ -27,8 +27,8 @@ struct whatever {
}
@end
-Super foo( // expected-error{{interface interface type 'Super' cannot be returned by value}}
- Super parm1) { // expected-error{{interface interface type 'Super' cannot be passed by value}}
+Super foo( // expected-error{{interface interface type 'Super' cannot be returned by value; did you forget * in 'Super'}}
+ Super parm1) { // expected-error{{interface interface type 'Super' cannot be passed by value; did you forget * in 'Super'}}
Super p1; // expected-error{{interface type cannot be statically allocated}}
return p1;
}
diff --git a/test/SemaObjC/invalid-receiver.m b/test/SemaObjC/invalid-receiver.m
index 16f0155..1174dd2 100644
--- a/test/SemaObjC/invalid-receiver.m
+++ b/test/SemaObjC/invalid-receiver.m
@@ -5,5 +5,5 @@ typedef struct NotAClass {
} NotAClass;
void foo() {
- [NotAClass nonexistent_method]; // expected-error {{invalid receiver to message expression}}
+ [NotAClass nonexistent_method]; // expected-error {{receiver type 'NotAClass' (aka 'struct NotAClass') is not an Objective-C class}}
}
diff --git a/test/SemaObjC/ivar-in-class-extension-error.m b/test/SemaObjC/ivar-in-class-extension-error.m
index ffc0e8b..6e0b577 100644
--- a/test/SemaObjC/ivar-in-class-extension-error.m
+++ b/test/SemaObjC/ivar-in-class-extension-error.m
@@ -3,13 +3,13 @@
@interface A @end
-@interface A () { // expected-error {{ivars may not be placed in class extension}}
- int _p0;
+@interface A () {
+ int _p0; // expected-error {{ivars may not be placed in class extension}}
}
@property int p0;
@end
-@interface A(CAT) { // expected-error {{ivars may not be placed in categories}}
- int _p1;
+@interface A(CAT) {
+ int _p1; // expected-error {{ivars may not be placed in categories}}
}
@end
diff --git a/test/SemaObjC/ivar-in-class-extension.m b/test/SemaObjC/ivar-in-class-extension.m
index e1a649c..4130d8f 100644
--- a/test/SemaObjC/ivar-in-class-extension.m
+++ b/test/SemaObjC/ivar-in-class-extension.m
@@ -31,12 +31,12 @@ int fn3(SomeClass *obj) {
@end
@interface SomeClass (Category)
- { // expected-error {{ivars may not be placed in categories}}
- int categoryIvar;
+ {
+ int categoryIvar; // expected-error {{ivars may not be placed in categories}}
}
@end
@interface SomeClass (Category1)
- { // expected-error {{ivars may not be placed in categories}}
+ {
}
@end
diff --git a/test/SemaObjC/ivar-lookup.m b/test/SemaObjC/ivar-lookup.m
index 644b3b6..06e4711 100644
--- a/test/SemaObjC/ivar-lookup.m
+++ b/test/SemaObjC/ivar-lookup.m
@@ -16,3 +16,22 @@ extern struct foo x;
}
@end
+
+@interface Ivar
+- (float*)method;
+@end
+
+@interface A {
+ A *Ivar;
+}
+- (int*)method;
+@end
+
+@implementation A
+- (int*)method {
+ int *ip = [Ivar method]; // expected-warning{{warning: incompatible pointer types initializing 'int *' with an expression of type 'float *'}}
+ // Note that there is no warning in Objective-C++
+ return 0;
+}
+@end
+
diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m
index 57b1097..fed3961 100644
--- a/test/SemaObjC/message.m
+++ b/test/SemaObjC/message.m
@@ -87,7 +87,7 @@ struct S { int X; } S;
int test5(int X) {
int a = [X somemsg]; // expected-warning {{receiver type 'int' is not 'id'}} \
expected-warning {{method '-somemsg' not found}} \
- expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}}
+ expected-warning {{incompatible pointer to integer conversion initializing 'int' with an expression of type 'id'}}
int b = [S somemsg]; // expected-error {{bad receiver type 'struct S'}}
}
diff --git a/test/SemaObjC/method-arg-qualifier-warning.m b/test/SemaObjC/method-arg-qualifier-warning.m
index 397f241..463fb7f 100644
--- a/test/SemaObjC/method-arg-qualifier-warning.m
+++ b/test/SemaObjC/method-arg-qualifier-warning.m
@@ -3,7 +3,7 @@
typedef signed char BOOL;
@interface NSString
-- (BOOL)isEqualToString:(NSString *)aString;
+- (BOOL)isEqualToString:(NSString *)aString; // expected-note 2{{passing argument to parameter 'aString' here}}
@end
static const NSString * Identifier1 = @"Identifier1";
@@ -12,8 +12,8 @@ static NSString * const Identifier3 = @"Identifier3";
int main () {
- [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}}
- [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}}
+ [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
+ [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
[@"Identifier3" isEqualToString:Identifier3];
return 0;
}
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index c1509bf..324ed342 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -7,21 +7,21 @@
@end
@interface bar
--(void) my_method:(foo) my_param; // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
-- (foo)cccccc:(long)ddddd; // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
+-(void) my_method:(foo) my_param; // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
+- (foo)cccccc:(long)ddddd; // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
@end
@implementation bar
--(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
+-(void) my_method:(foo) my_param // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
{
}
-- (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
+- (foo)cccccc:(long)ddddd // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
{
}
@end
-void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
-foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}
+void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value; did you forget * in 'foo'}}
+foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value; did you forget * in 'foo'}}
// rdar://6780761
void f0(foo *a0) {
diff --git a/test/SemaObjC/objc-cstyle-args-in-methods.m b/test/SemaObjC/objc-cstyle-args-in-methods.m
new file mode 100644
index 0000000..9f75295
--- /dev/null
+++ b/test/SemaObjC/objc-cstyle-args-in-methods.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface Foo
+- (id)test:(id)one, id two;
+- (id)bad:(id)one, id two, double three;
+@end
+
+@implementation Foo
+- (id)test:(id )one, id two {return two; }
+- (id)bad:(id)one, id two, double three { return two; }
+@end
+
+
+int main() {
+ Foo *foo;
+ [foo test:@"One", @"Two"];
+ [foo bad:@"One", @"Two"]; // expected-error {{too few arguments to method call}}
+ [foo bad:@"One", @"Two", 3.14];
+ [foo bad:@"One", @"Two", 3.14, @"Two"]; // expected-error {{too many arguments to method call}}
+}
diff --git a/test/SemaObjC/pedantic-dynamic-test.m b/test/SemaObjC/pedantic-dynamic-test.m
new file mode 100644
index 0000000..9b14c1d
--- /dev/null
+++ b/test/SemaObjC/pedantic-dynamic-test.m
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// rdar: // 7860960
+
+@interface I
+{
+ int window;
+}
+@property int window, noWarningNeeded;
+@end
+
+@implementation I
+
+@synthesize window;
+
+@dynamic noWarningNeeded;
+@end
diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m
index d527a9c..669f9c0 100644
--- a/test/SemaObjC/property-9.m
+++ b/test/SemaObjC/property-9.m
@@ -43,9 +43,9 @@ typedef signed char BOOL;
int _awesome;
}
-@property (readonly) int; // expected-error {{declaration does not declare anything}}
+@property (readonly) int; // expected-warning {{declaration does not declare anything}}
@property (readonly) ; // expected-error {{type name requires a specifier or qualifier}} \
- expected-error {{declaration does not declare anything}}
+ expected-warning {{declaration does not declare anything}}
@property (readonly) int : 4; // expected-error {{property requires fields to be named}}
diff --git a/test/SemaObjC/property-typecheck-1.m b/test/SemaObjC/property-typecheck-1.m
index fc53b59..f86e047 100644
--- a/test/SemaObjC/property-typecheck-1.m
+++ b/test/SemaObjC/property-typecheck-1.m
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface A
--(float) x; // expected-note {{declared at}}
+-(float) x; // expected-note {{declared here}}
@property int x; // expected-warning {{type of property 'x' does not match type of accessor 'x'}}
@end
@@ -38,7 +38,7 @@ typedef void (F)(void);
@class SSyncSet_iDisk;
@interface SPeer_iDisk_remote1 : SPeer
-- (SSyncSet_iDisk*) syncSet; // expected-note {{declared at}}
+- (SSyncSet_iDisk*) syncSet; // expected-note {{declared here}}
@end
@interface SPeer_iDisk_local
@@ -76,7 +76,7 @@ typedef void (F)(void);
@property (readonly) NSArray* pieces; // expected-warning {{type of property 'pieces' does not match type of accessor 'pieces'}}
@property (readonly) NSMutableArray* first;
-- (NSMutableArray*) pieces; // expected-note {{declared at}} // expected-note {{declared at}}
+- (NSMutableArray*) pieces; // expected-note {{declared here}} // expected-note {{declared here}}
- (NSArray*) first;
@end
diff --git a/test/SemaObjC/protocol-id-test-3.m b/test/SemaObjC/protocol-id-test-3.m
index 3538b0e..624bab0 100644
--- a/test/SemaObjC/protocol-id-test-3.m
+++ b/test/SemaObjC/protocol-id-test-3.m
@@ -8,7 +8,7 @@
@interface INTF @end
-id<MyProto1> Func(INTF <MyProto1, MyProto2> *p2)
+id<MyProto1> Func(INTF <MyProto1, MyProto2> *p2) // expected-note 2{{passing argument to parameter 'p2' here}}
{
return p2;
}
@@ -29,15 +29,15 @@ id<MyProto1> Func(INTF <MyProto1, MyProto2> *p2)
id<MyProto1, MyProto2> Gunc2(id <MyProto1>p2)
{
- Func(p2); // expected-warning {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
- return p2; // expected-warning {{incompatible type returning 'id<MyProto1>', expected 'id<MyProto1,MyProto2>'}}
+ Func(p2); // expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}}
+ return p2; // expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'id<MyProto1,MyProto2>'}}
}
id<MyProto1> Gunc3(id <MyProto2>p2)
{
- return p2; // expected-warning {{incompatible type returning 'id<MyProto2>', expected 'id<MyProto1>'}}
+ return p2; // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'id<MyProto1>'}}
}
@@ -61,13 +61,13 @@ INTF<MyProto1> * Hunc1(id <MyProto1, MyProto2>p2)
INTF<MyProto1, MyProto2> * Hunc2(id <MyProto1>p2)
{
- Func(p2); // expected-warning {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
- return p2; // expected-warning {{incompatible type returning 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
+ Func(p2); // expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}}
+ return p2; // expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'INTF<MyProto1,MyProto2> *'}}
}
INTF<MyProto1> * Hunc3(id <MyProto2>p2)
{
- return p2; // expected-warning {{incompatible type returning 'id<MyProto2>', expected 'INTF<MyProto1> *'}}
+ return p2; // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'INTF<MyProto1> *'}}
}
diff --git a/test/SemaObjC/protocol-typecheck.m b/test/SemaObjC/protocol-typecheck.m
index d9cde87..4eb1b26 100644
--- a/test/SemaObjC/protocol-typecheck.m
+++ b/test/SemaObjC/protocol-typecheck.m
@@ -9,7 +9,7 @@
@interface XX
- (void)setFlexElement:(NSObject <PWhatever, XCElementP> *)flexer;
-- (void)setFlexElement2:(NSObject <PWhatever, XCElementSpacerP> *)flexer;
+- (void)setFlexElement2:(NSObject <PWhatever, XCElementSpacerP> *)flexer; // expected-note{{passing argument to parameter 'flexer' here}}
@end
@@ -20,6 +20,6 @@ void func() {
[obj setFlexElement:flexer];
// FIXME: GCC provides the following diagnostic (which is much better):
// protocol-typecheck.m:21: warning: class 'NSObject <PWhatever, XCElementP>' does not implement the 'XCElementSpacerP' protocol
- [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject<PWhatever,XCElementP> *', expected 'NSObject<PWhatever,XCElementSpacerP> *'}}
+ [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject<PWhatever,XCElementP> *' to parameter of type 'NSObject<PWhatever,XCElementSpacerP> *'}}
}
diff --git a/test/SemaObjC/protocol-warn.m b/test/SemaObjC/protocol-warn.m
index d0c51e3..2d04238 100644
--- a/test/SemaObjC/protocol-warn.m
+++ b/test/SemaObjC/protocol-warn.m
@@ -51,5 +51,5 @@ UIWebPDFView *getView()
{
UIWebBrowserView *browserView;
UIWebPDFView *pdfView;
- return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *', expected 'UIWebPDFView *'}}
+ return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *' from a function with result type 'UIWebPDFView *'}}
}
diff --git a/test/SemaObjC/stmts.m b/test/SemaObjC/stmts.m
index 20a9f55..d1e2ad3 100644
--- a/test/SemaObjC/stmts.m
+++ b/test/SemaObjC/stmts.m
@@ -2,12 +2,16 @@
struct some_struct;
+@interface NSObject
+@end
+
// Note: NSException is not declared.
void f0(id x) {
@try {
} @catch (NSException *x) { // expected-error {{unknown type name 'NSException'}}
} @catch (struct some_struct x) { // expected-error {{@catch parameter is not a pointer to an interface type}}
} @catch (int x) { // expected-error {{@catch parameter is not a pointer to an interface type}}
+ } @catch (static NSObject *y) { // expected-error {{@catch parameter cannot have storage specifier 'static'}}
} @catch (...) {
}
}
diff --git a/test/SemaObjC/super-class-protocol-conformance.m b/test/SemaObjC/super-class-protocol-conformance.m
new file mode 100644
index 0000000..ac8bc70
--- /dev/null
+++ b/test/SemaObjC/super-class-protocol-conformance.m
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 7884086
+
+@interface NSObject @end
+
+@protocol TopProtocol
+ @property (readonly) id myString; // expected-warning {{property 'myString' requires method 'myString' to be defined}}
+@end
+
+@protocol SubProtocol <TopProtocol>
+@end
+
+@interface TopClass : NSObject <TopProtocol> {}
+@end
+
+@interface SubClass : TopClass <SubProtocol> {}
+@end
+
+@interface SubClass1 : TopClass {}
+@end
+
+@implementation SubClass1 @end // Test1 - No Warning
+
+@implementation TopClass // expected-note {{implementation is here}}
+@end
+
+@implementation SubClass // Test3 - No Warning
+@end
+
+@interface SubClass2 : TopClass<TopProtocol>
+@end
+
+@implementation SubClass2 @end // Test 4 - No Warning
+
+@interface SubClass3 : TopClass<SubProtocol> @end
+@implementation SubClass3 @end // Test 5 - No Warning
+
+@interface SubClass4 : SubClass3 @end
+@implementation SubClass4 @end // Test 5 - No Warning
+
+@protocol NewProtocol
+ @property (readonly) id myNewString; // expected-warning {{property 'myNewString' requires method 'myNewString' to be defined}}
+@end
+
+@interface SubClass5 : SubClass4 <NewProtocol> @end
+@implementation SubClass5 @end // expected-note {{implementation is here}}
+
diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m
index a61d72f..31d8db1 100644
--- a/test/SemaObjC/super.m
+++ b/test/SemaObjC/super.m
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+
+void takevoidptr(void*);
+
@interface Foo
- iMethod;
@@ -6,6 +9,8 @@
@end
@interface A
++ superClassMethod;
+- (void)instanceMethod;
@end
@interface B : A
@@ -16,11 +21,24 @@
@implementation B
- (void)instanceMethod {
- [super iMethod]; // expected-warning{{method '-iMethod' not found (return type defaults to 'id')}}
+ [super iMethod]; // expected-warning{{'A' may not respond to 'iMethod')}}
+
+ // Use of super in a block is ok and does codegen to the right thing.
+ // rdar://7852959
+ takevoidptr(^{
+ [super instanceMethod];
+ });
}
+ classMethod {
[super cMethod]; // expected-warning{{method '+cMethod' not found (return type defaults to 'id')}}
+
+ id X[] = { [ super superClassMethod] };
+ id Y[] = {
+ [ super.superClassMethod iMethod],
+ super.superClassMethod,
+ (id)super.superClassMethod // not a cast of super: rdar://7853261
+ };
return 0;
}
@end
@@ -36,13 +54,34 @@ void f0(int super) {
[super m]; // expected-warning{{receiver type 'int' is not 'id'}} \
expected-warning {{method '-m' not found (return type defaults to 'id')}}
}
-void f1(int puper) {
- [super m]; // expected-error{{use of undeclared identifier 'super'}}
+void f1(id puper) { // expected-note {{'puper' declared here}}
+ [super m]; // expected-error{{use of undeclared identifier 'super'; did you mean 'puper'?}}
}
// radar 7400691
typedef Foo super;
+typedef Foo FooTD;
+
void test() {
+ [FooTD cMethod];
[super cMethod];
}
+
+struct SomeStruct {
+ int X;
+};
+
+int test2() {
+ struct SomeStruct super = { 0 };
+ return super.X;
+}
+
+int test3() {
+ id super = 0;
+ [(B*)super instanceMethod];
+ int *s1 = (int*)super;
+
+ id X[] = { [ super superClassMethod] };
+ return 0;
+}
diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m
index 465caf2..58bcf40 100644
--- a/test/SemaObjC/synthesized-ivar.m
+++ b/test/SemaObjC/synthesized-ivar.m
@@ -11,3 +11,6 @@
return IP;
}
@end
+
+// rdar: // 7823675
+int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is protected}}
diff --git a/test/SemaObjC/transparent-union.m b/test/SemaObjC/transparent-union.m
new file mode 100644
index 0000000..cb03dfe
--- /dev/null
+++ b/test/SemaObjC/transparent-union.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef union {
+ struct xx_object_s *_do;
+ struct xx_continuation_s *_dc;
+ struct xx_queue_s *_dq;
+ struct xx_queue_attr_s *_dqa;
+ struct xx_group_s *_dg;
+ struct xx_source_s *_ds;
+ struct xx_source_attr_s *_dsa;
+ struct xx_semaphore_s *_dsema;
+} xx_object_t __attribute__((transparent_union));
+
+@interface INTF
+- (void) doSomething : (xx_object_t) xxObject;
+- (void)testMeth;
+@end
+
+@implementation INTF
+- (void) doSomething : (xx_object_t) xxObject {}
+- (void)testMeth { struct xx_queue_s *sq; [self doSomething:sq ]; }
+@end
diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m
index a33a1bc..1ecf322 100644
--- a/test/SemaObjC/unused.m
+++ b/test/SemaObjC/unused.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -Wunused -fsyntax-only
+// RUN: %clang_cc1 %s -verify -Wunused -Wunused-parameter -fsyntax-only
int printf(const char *, ...);
@@ -21,7 +21,7 @@ int test1(void) {
@end
void test2() {
- @"pointless example call for test purposes".length; // expected-warning {{property access result unused - getters should not have side effects}}
+ @"pointless example call for test purposes".length; // expected-warning {{property access result unused - getters should not be used for side effects}}
}
@interface foo
diff --git a/test/SemaObjC/warn-incompatible-builtin-types.m b/test/SemaObjC/warn-incompatible-builtin-types.m
index 2a5005a..79c8cea 100644
--- a/test/SemaObjC/warn-incompatible-builtin-types.m
+++ b/test/SemaObjC/warn-incompatible-builtin-types.m
@@ -2,7 +2,7 @@
// rdar 7634850
@interface Foo
-- (void)foo:(Class)class;
+- (void)foo:(Class)class; // expected-note{{passing argument to parameter 'class' here}}
@end
void FUNC() {
@@ -10,8 +10,8 @@ void FUNC() {
SEL s1, s2;
id i, i1;
Foo *f;
- [f foo:f]; // expected-warning {{incompatible pointer types sending 'Foo *', expected 'Class'}}
- c = f; // expected-warning {{incompatible pointer types assigning 'Foo *', expected 'Class'}}
+ [f foo:f]; // expected-warning {{incompatible pointer types sending 'Foo *' to parameter of type 'Class'}}
+ c = f; // expected-warning {{incompatible pointer types assigning to 'Class' from 'Foo *'}}
c = i;
@@ -21,22 +21,22 @@ void FUNC() {
i = i1;
- s1 = i; // expected-warning {{incompatible pointer types assigning 'id', expected 'SEL'}}
- i = s1; // expected-warning {{incompatible pointer types assigning 'SEL', expected 'id'}}
+ s1 = i; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'id'}}
+ i = s1; // expected-warning {{incompatible pointer types assigning to 'id' from 'SEL'}}
s1 = s2;
- s1 = c; // expected-warning {{incompatible pointer types assigning 'Class', expected 'SEL'}}
+ s1 = c; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'Class'}}
- c = s1; // expected-warning {{incompatible pointer types assigning 'SEL', expected 'Class'}}
+ c = s1; // expected-warning {{incompatible pointer types assigning to 'Class' from 'SEL'}}
f = i;
- f = c; // expected-warning {{incompatible pointer types assigning 'Class', expected 'Foo *'}}
+ f = c; // expected-warning {{incompatible pointer types assigning to 'Foo *' from 'Class'}}
- f = s1; // expected-warning {{incompatible pointer types assigning 'SEL', expected 'Foo *'}}
+ f = s1; // expected-warning {{incompatible pointer types assigning to 'Foo *' from 'SEL'}}
i = f;
- s1 = f; // expected-warning {{incompatible pointer types assigning 'Foo *', expected 'SEL'}}
+ s1 = f; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'Foo *'}}
}
diff --git a/test/SemaObjC/warn-selector-selection.m b/test/SemaObjC/warn-selector-selection.m
index 96ed77c..e395f43 100644
--- a/test/SemaObjC/warn-selector-selection.m
+++ b/test/SemaObjC/warn-selector-selection.m
@@ -10,5 +10,5 @@
void foo(void) {
Object *obj;
- [obj setWindow:0]; // expected-warning{{Object may not respond to 'setWindow:'}}
+ [obj setWindow:0]; // expected-warning{{'Object' may not respond to 'setWindow:'}}
}
diff --git a/test/SemaObjC/warn-superclass-method-mismatch.m b/test/SemaObjC/warn-superclass-method-mismatch.m
index a4005ad..5205473 100644
--- a/test/SemaObjC/warn-superclass-method-mismatch.m
+++ b/test/SemaObjC/warn-superclass-method-mismatch.m
@@ -9,7 +9,7 @@
@interface Base : Root
-(void) method: (int*) x; // expected-note {{previous declaration is here}}
-(void) method1: (Base*) x; // expected-note {{previous declaration is here}}
--(void) method2: (Sub*) x;
+-(void) method2: (Sub*) x; // expected-note{{passing argument to parameter 'x' here}}
+ method3: (int)x1 : (Base *)x2 : (float)x3; // expected-note {{previous declaration is here}}
+ mathod4: (id)x1;
- method5: (int) x : (double) d; // expected-note {{previous declaration is here}}
diff --git a/test/SemaObjC/warn-unused-exception-param.m b/test/SemaObjC/warn-unused-exception-param.m
new file mode 100644
index 0000000..f649f8c
--- /dev/null
+++ b/test/SemaObjC/warn-unused-exception-param.m
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-exception-parameter %s
+void f0() {
+ @try {} @catch(id a) {} // expected-warning{{unused exception parameter 'a'}}
+}
diff --git a/test/SemaObjC/warn-write-strings.m b/test/SemaObjC/warn-write-strings.m
index 938f0be..04af00c 100644
--- a/test/SemaObjC/warn-write-strings.m
+++ b/test/SemaObjC/warn-write-strings.m
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s
// PR4804
-char* x = "foo"; // expected-warning {{initializing 'char const [4]' discards qualifiers, expected 'char *'}}
+char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'char const [4]' discards qualifiers}}
diff --git a/test/SemaObjCXX/blocks.mm b/test/SemaObjCXX/blocks.mm
index 72de171..fd0df4e 100644
--- a/test/SemaObjCXX/blocks.mm
+++ b/test/SemaObjCXX/blocks.mm
@@ -3,12 +3,12 @@
void bar(id(^)(void));
void foo(id <NSObject>(^objectCreationBlock)(void)) {
- return bar(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id (^)()', expected 'id<NSObject> (^)()'}}
+ return bar(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id<NSObject> (^)()' to type 'id (^)()'}}
}
void bar2(id(*)(void));
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
- return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id (*)()', expected 'id<NSObject> (*)()'}}
+ return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id<NSObject> (*)()' to type 'id (*)()'}}
}
void bar3(id(*)()); // expected-note{{candidate function}}
diff --git a/test/SemaObjCXX/instantiate-expr.mm b/test/SemaObjCXX/instantiate-expr.mm
new file mode 100644
index 0000000..08be5f7
--- /dev/null
+++ b/test/SemaObjCXX/instantiate-expr.mm
@@ -0,0 +1,73 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface A {
+@public
+ int ivar;
+}
+@property int prop;
+@end
+
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+// Test instantiation of value-dependent ObjCIvarRefExpr,
+// ObjCIsaRefExpr, and ObjCPropertyRefExpr nodes.
+A *get_an_A(unsigned);
+id get_an_id(unsigned);
+
+template<unsigned N, typename T, typename U, typename V>
+void f(U value, V value2) {
+ get_an_A(N)->ivar = value; // expected-error{{assigning to 'int' from incompatible type 'int *'}}
+ get_an_A(N).prop = value2; // expected-error{{assigning to 'int' from incompatible type 'double *'}}
+ T c = get_an_id(N)->isa; // expected-error{{cannot initialize a variable of type 'int' with an lvalue of type 'Class'}}
+}
+
+template void f<6, Class>(int, int);
+template void f<7, Class>(int*, int); // expected-note{{in instantiation of}}
+template void f<8, Class>(int, double*); // expected-note{{in instantiation of}}
+template void f<9, int>(int, int); // expected-note{{in instantiation of}}
+
+// Test instantiation of unresolved member reference expressions to an
+// ivar reference.
+template<typename T, typename U, typename V>
+void f2(T ptr, U value, V value2) {
+ ptr->ivar = value; // expected-error{{assigning to 'int' from incompatible type 'int *'}}
+ ptr.prop = value2; // expected-error{{assigning to 'int' from incompatible type 'double *'}}
+}
+
+template void f2(A*, int, int);
+template void f2(A*, int*, int); // expected-note{{instantiation of}}
+template void f2(A*, int, double*); // expected-note{{instantiation of}}
+
+// Test instantiation of unresolved member referfence expressions to
+// an isa.
+template<typename T, typename U>
+void f3(U ptr) {
+ T c = ptr->isa; // expected-error{{cannot initialize a variable of type 'int' with an lvalue of type 'Class'}}
+}
+
+template void f3<Class>(id);
+template void f3<int>(id); // expected-note{{instantiation of}}
+
+// Implicit setter/getter
+@interface B
+- (int)foo;
+- (void)setFoo:(int)value;
+@end
+
+template<typename T>
+void f4(B *b, T value) {
+ b.foo = value; // expected-error{{assigning to 'int' from incompatible type 'int *'}}
+}
+
+template void f4(B*, int);
+template void f4(B*, int*); // expected-note{{in instantiation of function template specialization 'f4<int *>' requested here}}
+
+template<typename T, typename U>
+void f5(T ptr, U value) {
+ ptr.foo = value; // expected-error{{assigning to 'int' from incompatible type 'int *'}}
+}
+
+template void f5(B*, int);
+template void f5(B*, int*); // expected-note{{in instantiation of function template specialization 'f5<B *, int *>' requested here}}
diff --git a/test/SemaObjCXX/instantiate-message.mm b/test/SemaObjCXX/instantiate-message.mm
new file mode 100644
index 0000000..46c8ede
--- /dev/null
+++ b/test/SemaObjCXX/instantiate-message.mm
@@ -0,0 +1,50 @@
+// RUN: %clang -cc1 -fsyntax-only -verify %s
+
+// Test template instantiation of Objective-C message sends.
+
+@interface ClassMethods
++ (ClassMethods *)method1:(void*)ptr;
+@end
+
+template<typename T>
+struct identity {
+ typedef T type;
+};
+
+template<typename R, typename T, typename Arg1>
+void test_class_method(Arg1 arg1) {
+ R *result1 = [T method1:arg1];
+ R *result2 = [typename identity<T>::type method1:arg1];
+ R *result3 = [ClassMethods method1:arg1]; // expected-error{{cannot initialize a variable of type 'ClassMethods2 *' with an rvalue of type 'ClassMethods *'}}
+}
+
+template void test_class_method<ClassMethods, ClassMethods>(void*);
+template void test_class_method<ClassMethods, ClassMethods>(int*);
+
+@interface ClassMethods2
++ (ClassMethods2 *)method1:(int*)ptr;
+@end
+
+template void test_class_method<ClassMethods2, ClassMethods2>(int*); // expected-note{{in instantiation of}}
+
+
+@interface InstanceMethods
+- (InstanceMethods *)method1:(void*)ptr;
+@end
+
+template<typename R, typename T, typename Arg1>
+void test_instance_method(Arg1 arg1) {
+ T *receiver = 0;
+ InstanceMethods *im = 0;
+ R *result1 = [receiver method1:arg1];
+ R *result2 = [im method1:arg1]; // expected-error{{cannot initialize a variable of type 'InstanceMethods2 *' with an rvalue of type 'InstanceMethods *'}}
+}
+
+template void test_instance_method<InstanceMethods, InstanceMethods>(void*);
+template void test_instance_method<InstanceMethods, InstanceMethods>(int*);
+
+@interface InstanceMethods2
+- (InstanceMethods2 *)method1:(void*)ptr;
+@end
+
+template void test_instance_method<InstanceMethods2, InstanceMethods2>(int*); // expected-note{{in instantiation of}}
diff --git a/test/SemaObjCXX/instantiate-stmt.mm b/test/SemaObjCXX/instantiate-stmt.mm
new file mode 100644
index 0000000..e92f8e8
--- /dev/null
+++ b/test/SemaObjCXX/instantiate-stmt.mm
@@ -0,0 +1,77 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface NSException
+@end
+
+// @throw
+template<typename T>
+void throw_test(T value) {
+ @throw value; // expected-error{{@throw requires an Objective-C object type ('int' invalid)}}
+}
+
+template void throw_test(NSException *);
+template void throw_test(int); // expected-note{{in instantiation of}}
+
+// @synchronized
+template<typename T>
+void synchronized_test(T value) {
+ @synchronized (value) { // expected-error{{@synchronized requires an Objective-C object type ('int' invalid)}}
+ value = 0;
+ }
+}
+
+template void synchronized_test(NSException *);
+template void synchronized_test(int); // expected-note{{in instantiation of}}
+
+// fast enumeration
+@interface NSArray
+@end
+
+@interface NSString
+@end
+
+struct vector {};
+
+template<typename T> void eat(T);
+
+template<typename E, typename T>
+void fast_enumeration_test(T collection) {
+ for (E element in collection) { // expected-error{{selector element type 'int' is not a valid object}} \
+ // expected-error{{collection expression type 'vector' is not a valid object}}
+ eat(element);
+ }
+
+ E element;
+ for (element in collection) // expected-error{{selector element type 'int' is not a valid object}} \
+ // expected-error{{collection expression type 'vector' is not a valid object}}
+ eat(element);
+
+ for (NSString *str in collection) // expected-error{{collection expression type 'vector' is not a valid object}}
+ eat(str);
+
+ NSString *str;
+ for (str in collection) // expected-error{{collection expression type 'vector' is not a valid object}}
+ eat(str);
+}
+
+template void fast_enumeration_test<NSString *>(NSArray*);
+template void fast_enumeration_test<int>(NSArray*); // expected-note{{in instantiation of}}
+template void fast_enumeration_test<NSString *>(vector); // expected-note{{in instantiation of}}
+
+// @try/@catch/@finally
+
+template<typename T, typename U>
+void try_catch_finally_test(U value) {
+ @try {
+ value = 1; // expected-error{{assigning to 'int *' from incompatible type 'int'}}
+ }
+ @catch (T obj) { // expected-error{{@catch parameter is not a pointer to an interface type}}
+ id x = obj;
+ } @finally {
+ value = 0;
+ }
+}
+
+template void try_catch_finally_test<NSString *>(int);
+template void try_catch_finally_test<NSString *>(int*); // expected-note{{in instantiation of}}
+template void try_catch_finally_test<NSString>(int); // expected-note{{in instantiation of function template specialization 'try_catch_finally_test<NSString, int>' requested here}}
diff --git a/test/SemaObjCXX/ivar-lookup.mm b/test/SemaObjCXX/ivar-lookup.mm
new file mode 100644
index 0000000..bb26f48
--- /dev/null
+++ b/test/SemaObjCXX/ivar-lookup.mm
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@interface Ivar
+- (float*)method;
+@end
+
+@interface A {
+ A *Ivar;
+}
+- (int*)method;
+@end
+
+@implementation A
+- (int*)method {
+ int *ip = [Ivar method]; // Okay; calls A's method on the instance variable Ivar.
+ // Note that Objective-C calls Ivar's method.
+ return 0;
+}
+@end
diff --git a/test/SemaObjCXX/ivar-reference-type.mm b/test/SemaObjCXX/ivar-reference-type.mm
new file mode 100644
index 0000000..2b5df45
--- /dev/null
+++ b/test/SemaObjCXX/ivar-reference-type.mm
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@interface A {
+ int &r; // expected-error {{instance variables cannot be of reference type}}
+}
+@end
diff --git a/test/SemaObjCXX/linkage-spec.mm b/test/SemaObjCXX/linkage-spec.mm
index b4e809e..1454e6a 100644
--- a/test/SemaObjCXX/linkage-spec.mm
+++ b/test/SemaObjCXX/linkage-spec.mm
@@ -2,3 +2,11 @@
extern "C" {
@class Protocol;
}
+
+// <rdar://problem/7827709>
+extern "C" {
+@class I;
+}
+
+@interface I
+@end
diff --git a/test/SemaObjCXX/message.mm b/test/SemaObjCXX/message.mm
index 93a600a..b75608e 100644
--- a/test/SemaObjCXX/message.mm
+++ b/test/SemaObjCXX/message.mm
@@ -1,12 +1,13 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface I1
-- (void)method;
+- (int*)method;
@end
@implementation I1
-- (void)method {
+- (int*)method {
struct x { };
- [x method]; // expected-error{{invalid receiver to message expression}}
+ [x method]; // expected-error{{receiver type 'x' is not an Objective-C class}}
+ return 0;
}
@end
@@ -15,15 +16,79 @@ typedef struct { int x; } ivar;
@interface I2 {
id ivar;
}
-- (void)method;
+- (int*)method;
+ (void)method;
@end
+struct I2_holder {
+ I2_holder();
+
+ I2 *get();
+};
+
+I2 *operator+(I2_holder, int);
+
@implementation I2
-- (void)method {
+- (int*)method {
[ivar method];
+
+ // Test instance messages that start with a simple-type-specifier.
+ [I2_holder().get() method];
+ [I2_holder().get() + 17 method];
+ return 0;
}
+ (void)method {
- [ivar method]; // expected-error{{invalid receiver to message expression}}
+ [ivar method]; // expected-error{{receiver type 'ivar' (aka 'ivar') is not an Objective-C class}}
+}
+@end
+
+// Class message sends
+@interface I3
++ (int*)method;
+@end
+
+@interface I4 : I3
++ (int*)otherMethod;
+@end
+
+template<typename T>
+struct identity {
+ typedef T type;
+};
+
+@implementation I4
++ (int *)otherMethod {
+ // Test class messages that use non-trivial simple-type-specifiers
+ // or typename-specifiers.
+ if (false) {
+ if (true)
+ return [typename identity<I3>::type method];
+
+ return [::I3 method];
+ }
+
+ int* ip1 = {[super method]};
+ int* ip2 = {[::I3 method]};
+ int* ip3 = {[typename identity<I3>::type method]};
+ int* ip4 = {[typename identity<I2_holder>::type().get() method]};
+ int array[5] = {[3] = 2};
+ return [super method];
}
@end
+
+struct String {
+ String(const char *);
+};
+
+struct MutableString : public String { };
+
+// C++-specific parameter types
+@interface I5
+- method:(const String&)str1
+ other:(String&)str2; // expected-note{{passing argument to parameter 'str2' here}}
+@end
+
+void test_I5(I5 *i5, String s) {
+ [i5 method:"hello" other:s];
+ [i5 method:s other:"world"]; // expected-error{{non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'char const [6]'}}
+}
diff --git a/test/SemaObjCXX/objc-pointer-conv.mm b/test/SemaObjCXX/objc-pointer-conv.mm
index 144bda4..cc3264f 100644
--- a/test/SemaObjCXX/objc-pointer-conv.mm
+++ b/test/SemaObjCXX/objc-pointer-conv.mm
@@ -26,13 +26,13 @@ void RandomFunc(CFMDRef theDict, const void *key, const void *value);
@end
@interface I
-- (void) Meth : (I*) Arg;
+- (void) Meth : (I*) Arg; // expected-note{{passing argument to parameter 'Arg' here}}
@end
void Func (I* arg); // expected-note {{candidate function not viable: no known conversion from 'I const *' to 'I *' for 1st argument}}
void foo(const I *p, I* sel) {
- [sel Meth : p]; // expected-error {{incompatible type sending 'I const *', expected 'I *'}}
+ [sel Meth : p]; // expected-error {{cannot initialize a parameter of type 'I *' with an lvalue of type 'I const *'}}
Func(p); // expected-error {{no matching function for call to 'Func'}}
}
diff --git a/test/SemaObjCXX/overload-1.mm b/test/SemaObjCXX/overload-1.mm
new file mode 100644
index 0000000..fc17ca2
--- /dev/null
+++ b/test/SemaObjCXX/overload-1.mm
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@protocol Proto1 @end
+
+@protocol Proto2 @end
+
+void f(id<Proto1> *) { } // expected-note {{previous definition is here}}
+
+void f(id<Proto1, Proto2> *) { } // expected-error {{conflicting types for 'f'}}
+
+void f(Class<Proto1> *) { } // expected-note {{previous definition is here}}
+
+void f(Class<Proto1, Proto2> *) { } // expected-error {{conflicting types for 'f'}}
+
+@interface I @end
+
+void f(I<Proto1> *) { } // expected-note {{previous definition is here}}
+
+void f(I<Proto1, Proto2> *) { } // expected-error {{conflicting types for 'f'}}
+
+@interface I1 @end
+
+void f1(I<Proto1> *) { }
+
+void f1(I1<Proto1, Proto2> *) { }
diff --git a/test/SemaObjCXX/parameters.mm b/test/SemaObjCXX/parameters.mm
new file mode 100644
index 0000000..aab1fbd
--- /dev/null
+++ b/test/SemaObjCXX/parameters.mm
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -verify %s
+
+@interface A
+@end
+
+template<typename T>
+struct X0 {
+ void f(T); // expected-error{{interface type 'A' cannot be passed by value}}
+};
+
+X0<A> x0a; // expected-note{{instantiation}}
+
diff --git a/test/SemaObjCXX/void_to_obj.mm b/test/SemaObjCXX/void_to_obj.mm
index 932827e..52510c8 100644
--- a/test/SemaObjCXX/void_to_obj.mm
+++ b/test/SemaObjCXX/void_to_obj.mm
@@ -7,5 +7,5 @@ void func() {
XX *obj;
void *vv;
- obj = vv; // expected-error{{incompatible type assigning 'void *', expected 'XX *'}}
+ obj = vv; // expected-error{{assigning to 'XX *' from incompatible type 'void *'}}
}
diff --git a/test/SemaTemplate/class-template-decl.cpp b/test/SemaTemplate/class-template-decl.cpp
index 71aabe9..1be1bc0 100644
--- a/test/SemaTemplate/class-template-decl.cpp
+++ b/test/SemaTemplate/class-template-decl.cpp
@@ -51,3 +51,8 @@ void f() {
}
template<typename T> class X1 { } var; // expected-error{{declared as a template}}
+
+namespace M {
+}
+
+template<typename T> class M::C3 { }; // expected-error{{out-of-line definition of 'C3' does not match any declaration in namespace 'M'}}
diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp
index 82c2aa4..b6ca72e 100644
--- a/test/SemaTemplate/constructor-template.cpp
+++ b/test/SemaTemplate/constructor-template.cpp
@@ -94,3 +94,18 @@ void default_ctor_inst() {
}
template void default_ctor_inst<int>();
+
+template<typename T>
+struct X5 {
+ X5();
+ X5(const T &);
+};
+
+struct X6 {
+ template<typename T> X6(T);
+};
+
+void test_X5_X6() {
+ X5<X6> tf;
+ X5<X6> tf2(tf);
+}
diff --git a/test/SemaTemplate/default-expr-arguments-2.cpp b/test/SemaTemplate/default-expr-arguments-2.cpp
new file mode 100644
index 0000000..88cc43d
--- /dev/null
+++ b/test/SemaTemplate/default-expr-arguments-2.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
+
+// This is a wacky test to ensure that we're actually instantiating
+// the default rguments of the constructor when the function type is
+// otherwise non-dependent.
+namespace PR6733 {
+ template <class T>
+ class bar {
+ public: enum { kSomeConst = 128 };
+ bar(int x = kSomeConst) {}
+ };
+
+ // CHECK: void f()
+ void f() {
+ // CHECK: bar<int> tmp =
+ // CHECK: CXXDefaultArgExpr{{.*}}'int'
+ bar<int> tmp;
+ }
+}
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index d2cc45b..7c3525a 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -7,7 +7,8 @@ C<char>::C(int a0);
struct S { }; // expected-note 3 {{candidate constructor (the implicit copy constructor)}}
-template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}}
+template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}} \
+// expected-note{{passing argument to parameter 'b' here}}
template<typename T> void f2(T a, T b = T()) { }
@@ -25,8 +26,10 @@ void g() {
}
template<typename T> struct F {
- F(T t = 10); // expected-error{{no viable conversion}}
- void f(T t = 10); // expected-error{{no viable conversion}}
+ F(T t = 10); // expected-error{{no viable conversion}} \
+ // expected-note{{passing argument to parameter 't' here}}
+ void f(T t = 10); // expected-error{{no viable conversion}} \
+ // expected-note{{passing argument to parameter 't' here}}
};
struct FD : F<int> { };
@@ -99,7 +102,8 @@ void test_x2(X2<int> x2i, X2<NotDefaultConstructible> x2n) {
// PR5283
namespace PR5283 {
template<typename T> struct A {
- A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}}
+ A(T = 1); // expected-error 3 {{cannot initialize a parameter of type 'int *' with an rvalue of type 'int'}} \
+ // expected-note 3{{passing argument to parameter here}}
};
struct B : A<int*> {
@@ -184,3 +188,21 @@ template<> void f4<int>(int, int);
void f4_test(int i) {
f4(i);
}
+
+// Instantiate for initialization
+namespace InstForInit {
+ template<typename T>
+ struct Ptr {
+ typedef T* type;
+ Ptr(type);
+ };
+
+ template<typename T>
+ struct Holder {
+ Holder(int i, Ptr<T> ptr = 0);
+ };
+
+ void test_holder(int i) {
+ Holder<int> h(i);
+ }
+};
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
index a2d3c56..7796106 100644
--- a/test/SemaTemplate/dependent-names.cpp
+++ b/test/SemaTemplate/dependent-names.cpp
@@ -18,15 +18,18 @@ template<class T> class R : Q<T> {T current;};
namespace test0 {
template <class T> class Base {
+ public:
void instance_foo();
static void static_foo();
class Inner {
+ public:
void instance_foo();
static void static_foo();
};
};
template <class T> class Derived1 : Base<T> {
+ public:
void test0() {
Base<T>::static_foo();
Base<T>::instance_foo();
@@ -49,6 +52,7 @@ namespace test0 {
};
template <class T> class Derived2 : Base<T>::Inner {
+ public:
void test0() {
Base<T>::static_foo();
Base<T>::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
diff --git a/test/SemaTemplate/destructor-template.cpp b/test/SemaTemplate/destructor-template.cpp
index 83b1bee..fa1b3e0 100644
--- a/test/SemaTemplate/destructor-template.cpp
+++ b/test/SemaTemplate/destructor-template.cpp
@@ -32,3 +32,11 @@ namespace PR6152 {
template struct X<int>;
}
+namespace cvquals {
+ template<typename T>
+ void f(int *ptr) {
+ ptr->~T();
+ }
+
+ template void f<const volatile int>(int *);
+}
diff --git a/test/SemaTemplate/elaborated-type-specifier.cpp b/test/SemaTemplate/elaborated-type-specifier.cpp
new file mode 100644
index 0000000..b34660a
--- /dev/null
+++ b/test/SemaTemplate/elaborated-type-specifier.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace PR6915 {
+ template <typename T>
+ class D {
+ enum T::X v; // expected-error{{use of 'X' with tag type that does not match previous declaration}} \
+ // expected-error{{no enum named 'X' in 'PR6915::D3'}}
+ };
+
+ struct D1 {
+ enum X { value };
+ };
+ struct D2 {
+ class X { }; // expected-note{{previous use is here}}
+ };
+ struct D3 { };
+
+ template class D<D1>;
+ template class D<D2>; // expected-note{{in instantiation of}}
+ template class D<D3>; // expected-note{{in instantiation of}}
+}
+
+template<typename T>
+struct DeclOrDef {
+ enum T::foo; // expected-error{{nested name specifier for a declaration cannot depend on a template parameter}}
+ enum T::bar { // expected-error{{nested name specifier for a declaration cannot depend on a template parameter}}
+ value
+ };
+};
+
+namespace PR6649 {
+ template <typename T> struct foo {
+ class T::bar; // expected-error{{nested name specifier for a declaration cannot depend on a template parameter}}
+ class T::bar { int x; }; // expected-error{{nested name specifier for a declaration cannot depend on a template parameter}}
+ };
+}
diff --git a/test/SemaTemplate/explicit-specialization-member.cpp b/test/SemaTemplate/explicit-specialization-member.cpp
index cb0a39a..417cdc1 100644
--- a/test/SemaTemplate/explicit-specialization-member.cpp
+++ b/test/SemaTemplate/explicit-specialization-member.cpp
@@ -16,7 +16,7 @@ namespace PR6161 {
// expected-error{{expected class name}} \
// expected-note{{attempt to specialize declaration here}}
{
- static locale::id id; // expected-error{{use of undeclared identifier}} FIXME: expected-error {{unknown type name}}
+ static locale::id id; // expected-error{{use of undeclared identifier}}
};
numpunct<char>::~numpunct(); // expected-error{{template specialization requires 'template<>'}} \
// expected-error{{specialization of member 'PR6161::numpunct<char>::~numpunct' does not specialize an instantiated member}}
diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp
index 6ee30aa..1d62804 100644
--- a/test/SemaTemplate/friend-template.cpp
+++ b/test/SemaTemplate/friend-template.cpp
@@ -127,3 +127,83 @@ namespace PR6022 {
};
}
+namespace FriendTemplateDefinition {
+ template<unsigned > struct int_c { };
+
+ template<typename T>
+ struct X {
+ template<unsigned N>
+ friend void f(X, int_c<N>) {
+ int value = N;
+ };
+ };
+
+ void test_X(X<int> x, int_c<5> i5) {
+ f(x, i5);
+ }
+}
+
+namespace PR7013a {
+ template<class > struct X0
+ {
+ typedef int type;
+ };
+ template<typename > struct X1
+ {
+ };
+ template<typename , typename T> struct X2
+ {
+ typename T::type e;
+ };
+ namespace N
+ {
+ template <typename = int, typename = X1<int> > struct X3
+ {
+ template <typename T1, typename T2, typename B> friend void op(X2<T1, T2>& , B);
+ };
+ template <typename Ch, typename Tr, typename B> void op(X2<Ch, Tr>& , B)
+ {
+ X2<int, Tr> s;
+ }
+ }
+ int n()
+ {
+ X2<int, X0<int> > ngs;
+ N::X3<> b;
+ op(ngs, b);
+ return 0;
+ }
+}
+
+namespace PR7013b {
+ template<class > struct X0
+ {
+ typedef int type;
+ };
+ template<typename > struct X1
+ {
+ };
+ template<typename , typename T> struct X2
+ {
+ typename T::type e;
+ };
+ namespace N
+ {
+ template <typename = X1<int> > struct X3
+ {
+ template <typename T1, typename T2, typename B> friend void op(X2<T1, T2>& , B);
+ };
+ template <typename Ch, typename Tr, typename B> void op(X2<Ch, Tr>& , B)
+ {
+ X2<int, Tr> s;
+ }
+ }
+ int n()
+ {
+ X2<int, X0<int> > ngs;
+ N::X3<> b;
+ op(ngs, b);
+ return 0;
+ }
+
+}
diff --git a/test/SemaTemplate/friend.cpp b/test/SemaTemplate/friend.cpp
index 61ef186..99685f2 100644
--- a/test/SemaTemplate/friend.cpp
+++ b/test/SemaTemplate/friend.cpp
@@ -12,3 +12,22 @@ void f() {
struct C0 {
friend struct A<int>;
};
+
+namespace PR6770 {
+ namespace N {
+ int f1(int);
+ }
+ using namespace N;
+
+ namespace M {
+ float f1(float);
+ }
+ using M::f1;
+
+ template<typename T> void f1(T, T);
+ template <class T>
+ void f() {
+ friend class f; // expected-error{{'friend' used outside of class}}
+ friend class f1; // expected-error{{ 'friend' used outside of class}}
+ }
+}
diff --git a/test/SemaTemplate/fun-template-def.cpp b/test/SemaTemplate/fun-template-def.cpp
index 1c9b232..309921c 100644
--- a/test/SemaTemplate/fun-template-def.cpp
+++ b/test/SemaTemplate/fun-template-def.cpp
@@ -42,7 +42,7 @@ T f1(T t1, U u1, int i1)
dummy d1 = sizeof(t1); // expected-error {{no viable conversion}}
dummy d2 = offsetof(T, foo); // expected-error {{no viable conversion}}
dummy d3 = __alignof(u1); // expected-error {{no viable conversion}}
- i1 = typeid(t1); // expected-error {{incompatible type assigning}}
+ i1 = typeid(t1); // expected-error {{assigning to 'int' from incompatible type 'std::type_info const'}}
return u1;
}
diff --git a/test/SemaTemplate/injected-class-name.cpp b/test/SemaTemplate/injected-class-name.cpp
index 586be18..4c21d25 100644
--- a/test/SemaTemplate/injected-class-name.cpp
+++ b/test/SemaTemplate/injected-class-name.cpp
@@ -48,3 +48,15 @@ namespace pr6326 {
};
template class A<int>;
}
+
+namespace ForwardDecls {
+ template<typename T>
+ struct X;
+
+ template<typename T>
+ struct X {
+ typedef T foo;
+ typedef X<T> xt;
+ typename xt::foo *t;
+ };
+}
diff --git a/test/SemaTemplate/instantiate-complete.cpp b/test/SemaTemplate/instantiate-complete.cpp
index 82cc320..d854c9e 100644
--- a/test/SemaTemplate/instantiate-complete.cpp
+++ b/test/SemaTemplate/instantiate-complete.cpp
@@ -11,7 +11,8 @@ struct X {
// expected-error{{data member instantiated with function type 'int (int)'}} \
// expected-error{{data member instantiated with function type 'char (char)'}} \
// expected-error{{data member instantiated with function type 'short (short)'}} \
- // expected-error{{data member instantiated with function type 'float (float)'}}
+ // expected-error{{data member instantiated with function type 'float (float)'}} \
+ // expected-error{{data member instantiated with function type 'long (long)'}}
};
X<int> f() { return 0; }
@@ -43,7 +44,7 @@ void test_memptr(X<long> *p1, long X<long>::*pm1,
X<long(long)> *p2,
long (X<long(long)>::*pm2)(long)) {
(void)(p1->*pm1);
- (void)((p2->*pm2)(0));
+ (void)((p2->*pm2)(0)); // expected-note{{in instantiation of template class 'X<long (long)>' requested here}}
}
// Reference binding to a base
@@ -83,3 +84,18 @@ namespace PR6376 {
template struct Y<int, float>;
}
+
+namespace TemporaryObjectCopy {
+ // Make sure we instantiate classes when we create a temporary copy.
+ template<typename T>
+ struct X {
+ X(T);
+ };
+
+ template<typename T>
+ void f(T t) {
+ const X<int> &x = X<int>(t);
+ }
+
+ template void f(int);
+}
diff --git a/test/SemaTemplate/instantiate-default-assignment-operator.cpp b/test/SemaTemplate/instantiate-default-assignment-operator.cpp
index 5594d6c..8b97f59 100644
--- a/test/SemaTemplate/instantiate-default-assignment-operator.cpp
+++ b/test/SemaTemplate/instantiate-default-assignment-operator.cpp
@@ -5,13 +5,13 @@ template<typename T> struct RefPtr {
RefPtr& operator=(const PassRefPtr<T>&);
};
-struct A { RefPtr<int> a; };
-struct B : RefPtr<float> { };
+struct A { RefPtr<int> a; }; // expected-note {{instantiation of member function 'RefPtr<int>::operator=' requested here}}
+struct B : RefPtr<float> { }; // expected-note {{in instantiation of member function 'RefPtr<float>::operator=' requested here}}
void f() {
A a1, a2;
- a1 = a2; // expected-note {{instantiation of member function 'RefPtr<int>::operator=' requested here}}
+ a1 = a2;
B b1, b2;
- b1 = b2; // expected-note {{in instantiation of member function 'RefPtr<float>::operator=' requested here}}
+ b1 = b2;
}
diff --git a/test/SemaTemplate/instantiate-expr-2.cpp b/test/SemaTemplate/instantiate-expr-2.cpp
index 4da4e71..b91b398 100644
--- a/test/SemaTemplate/instantiate-expr-2.cpp
+++ b/test/SemaTemplate/instantiate-expr-2.cpp
@@ -193,3 +193,22 @@ namespace N12 {
void f0(int **a) { C::f0(a); }
}
+
+namespace N13 {
+ class A{
+ A(const A&);
+
+ public:
+ ~A();
+ A(int);
+ template<typename T> A &operator<<(const T&);
+ };
+
+ template<typename T>
+ void f(T t) {
+ A(17) << t;
+ }
+
+ template void f(int);
+
+}
diff --git a/test/SemaTemplate/instantiate-expr-5.cpp b/test/SemaTemplate/instantiate-expr-5.cpp
index 941dae4..6cdedda 100644
--- a/test/SemaTemplate/instantiate-expr-5.cpp
+++ b/test/SemaTemplate/instantiate-expr-5.cpp
@@ -1,4 +1,38 @@
-// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
template <class A> int x(A x) { return x++; }
int y() { return x<int>(1); }
+
+namespace PR5880 {
+ template<typename T>
+ struct A {
+ static const int a = __builtin_offsetof(T, a.array[5].m); // expected-error{{error: no member named 'a' in 'HasM'}}
+ };
+ struct HasM {
+ float m;
+ };
+
+ struct ArrayOfHasM {
+ HasM array[10];
+ };
+
+ struct B { ArrayOfHasM a; };
+ A<B> x;
+ A<HasM> x2; // expected-note{{in instantiation of}}
+
+ template<typename T>
+ struct AnonymousUnion {
+ union {
+ int i;
+ float f;
+ };
+ };
+
+ template<typename T>
+ void test_anon_union() {
+ int array1[__builtin_offsetof(AnonymousUnion<T>, f) == 0? 1 : -1];
+ int array2[__builtin_offsetof(AnonymousUnion<int>, f) == 0? 1 : -1];
+ }
+
+ template void test_anon_union<int>();
+}
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp
index 6e0d711..1bda430 100644
--- a/test/SemaTemplate/instantiate-function-1.cpp
+++ b/test/SemaTemplate/instantiate-function-1.cpp
@@ -220,3 +220,8 @@ namespace test0 {
template <class T> class A { void foo(T array[10]); };
template class A<int>;
}
+
+namespace PR7016 {
+ template<typename T> void f() { T x = x; }
+ template void f<int>();
+}
diff --git a/test/SemaTemplate/instantiate-function-params.cpp b/test/SemaTemplate/instantiate-function-params.cpp
index ea8dd70..45de342 100644
--- a/test/SemaTemplate/instantiate-function-params.cpp
+++ b/test/SemaTemplate/instantiate-function-params.cpp
@@ -3,13 +3,13 @@
// PR6619
template<bool C> struct if_c { };
template<typename T1> struct if_ {
- typedef if_c< static_cast<bool>(T1::value)> almost_type_; // expected-note 7{{in instantiation}}
+ typedef if_c< static_cast<bool>(T1::value)> almost_type_; // expected-note 5{{in instantiation}}
};
template <class Model, void (Model::*)()> struct wrap_constraints { };
template <class Model>
-inline char has_constraints_(Model* , // expected-note 4{{while substituting deduced template arguments into function template 'has_constraints_' [with }} \
+inline char has_constraints_(Model* , // expected-note 2{{while substituting deduced template arguments into function template 'has_constraints_' [with }} \
// expected-note 3{{candidate template ignored}}
- wrap_constraints<Model,&Model::constraints>* = 0); // expected-note 4{{in instantiation}}
+ wrap_constraints<Model,&Model::constraints>* = 0); // expected-note 2{{in instantiation}}
template <class Model> struct not_satisfied {
static const bool value = sizeof( has_constraints_((Model*)0) == 1); // expected-error 3{{no matching function}}
@@ -17,20 +17,18 @@ template <class Model> struct not_satisfied {
template <class ModelFn> struct requirement_;
template <void(*)()> struct instantiate {
};
-template <class Model> struct requirement_<void(*)(Model)> : if_< not_satisfied<Model> >::type { // expected-error 3{{no type named}} \
- // expected-note 7{{in instantiation}}
+template <class Model> struct requirement_<void(*)(Model)> : if_< not_satisfied<Model> >::type { // expected-note 5{{in instantiation}}
};
template <class Model> struct usage_requirements {
};
template < typename TT > struct InputIterator {
- typedef instantiate< & requirement_<void(*)(usage_requirements<InputIterator> x)>::failed> boost_concept_check1; // expected-note 2{{in instantiation}}
+ typedef instantiate< & requirement_<void(*)(usage_requirements<InputIterator> x)>::failed> boost_concept_check1; // expected-note {{in instantiation}}
};
-template < typename TT > struct ForwardIterator : InputIterator<TT> { // expected-note 2{{in instantiation}}
- typedef instantiate< & requirement_<void(*)(usage_requirements<ForwardIterator> x)>::failed> boost_concept_check2; // expected-note 2 {{in instantiation}}
+template < typename TT > struct ForwardIterator : InputIterator<TT> { // expected-note {{in instantiation}}
+ typedef instantiate< & requirement_<void(*)(usage_requirements<ForwardIterator> x)>::failed> boost_concept_check2; // expected-note {{in instantiation}}
};
-typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX; // expected-error{{no member named}} \
-// expected-note 6{{in instantiation}}
+typedef instantiate< &requirement_<void(*)(ForwardIterator<char*> x)>::failed> boost_concept_checkX;// expected-note 3{{in instantiation}}
template<typename T> struct X0 { };
template<typename R, typename A1> struct X0<R(A1 param)> { };
@@ -55,3 +53,26 @@ void use_func_ptr() {
};
template void use_func_ptr<int, float, double>();
+
+namespace PR6990 {
+ template < typename , typename = int, typename = int > struct X1;
+ template <typename >
+ struct X2;
+
+ template <typename = int *, typename TokenT = int,
+ typename = int( X2<TokenT> &)>
+ struct X3
+ {
+ };
+
+ template <typename , typename P>
+ struct X3_base : X3< X1<int, P> >
+ {
+ protected: typedef X1< P> type;
+ X3<type> e;
+ };
+
+ struct r : X3_base<int, int>
+ {
+ };
+}
diff --git a/test/SemaTemplate/instantiate-local-class.cpp b/test/SemaTemplate/instantiate-local-class.cpp
index 72ad90a..d57ba8a 100644
--- a/test/SemaTemplate/instantiate-local-class.cpp
+++ b/test/SemaTemplate/instantiate-local-class.cpp
@@ -13,11 +13,11 @@ template void f0<int>();
// PR5764
namespace PR5764 {
- class X {
+ struct X {
template <typename T>
void Bar() {
typedef T ValueType;
- class Y {
+ struct Y {
Y() { V = ValueType(); }
ValueType V;
diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp
index 44f396e..f1bdf3e 100644
--- a/test/SemaTemplate/instantiate-member-class.cpp
+++ b/test/SemaTemplate/instantiate-member-class.cpp
@@ -18,8 +18,8 @@ X<int>::X *xi; // expected-error{{qualified reference to 'X' is a constructor na
X<float>::X *xf; // expected-error{{qualified reference to 'X' is a constructor name rather than a type wherever a constructor can be declared}}
void test_naming() {
- c1 = c2; // expected-error{{incompatible type assigning 'X<float>::C *', expected 'X<int>::C *'}}
- xi = xf; // expected-error{{incompatible type assigning}}
+ c1 = c2; // expected-error{{assigning to 'X<int>::C *' from incompatible type 'X<float>::C *'}}
+ xi = xf; // expected-error{{assigning to 'X<int>::X<int> *' from incompatible type 'X<float>::X<float> *'}}
// FIXME: error above doesn't print the type X<int>::X cleanly!
}
@@ -40,9 +40,9 @@ X<void>::D::E e2; // expected-note{{in instantiation of member class 'X<void>::D
// Redeclarations.
namespace test1 {
template <typename T> struct Registry {
- class node;
+ struct node;
static node *Head;
- class node {
+ struct node {
node(int v) { Head = this; }
};
};
@@ -64,6 +64,7 @@ namespace test2 {
template <typename T> class B {
class Foo;
class Foo {
+ public:
typedef int X;
};
typename Foo::X x;
diff --git a/test/SemaTemplate/instantiate-member-expr.cpp b/test/SemaTemplate/instantiate-member-expr.cpp
index f3a6067..188705c 100644
--- a/test/SemaTemplate/instantiate-member-expr.cpp
+++ b/test/SemaTemplate/instantiate-member-expr.cpp
@@ -43,7 +43,7 @@ namespace test1 {
int a;
template<typename T> struct B : A<T> {
void f() {
- a = 0; // expected-error {{type 'test1::O' is not a direct or virtual base of ''B<int>''}}
+ a = 0; // expected-error {{'test1::O::a' is not a member of class 'test1::O::B<int>'}}
}
};
};
diff --git a/test/SemaTemplate/instantiate-member-initializers.cpp b/test/SemaTemplate/instantiate-member-initializers.cpp
index e059434..45503b3 100644
--- a/test/SemaTemplate/instantiate-member-initializers.cpp
+++ b/test/SemaTemplate/instantiate-member-initializers.cpp
@@ -10,8 +10,8 @@ A<int> a0;
A<void*> a1; // expected-note{{in instantiation of member function 'A<void *>::A' requested here}}
template<typename T> struct B {
- B() : b(1), // expected-warning {{member 'b' will be initialized after}}
- a(2) { } // expected-note {{field a}}
+ B() : b(1), // expected-warning {{field 'b' will be initialized after field 'a'}}
+ a(2) { }
int a;
int b;
@@ -21,6 +21,7 @@ B<int> b0; // expected-note {{in instantiation of member function 'B<int>::B' re
template <class T> struct AA { AA(int); };
template <class T> class BB : public AA<T> {
+public:
BB() : AA<T>(1) {}
};
BB<int> x;
diff --git a/test/SemaTemplate/instantiate-member-template.cpp b/test/SemaTemplate/instantiate-member-template.cpp
index c1260cf..ae8425e 100644
--- a/test/SemaTemplate/instantiate-member-template.cpp
+++ b/test/SemaTemplate/instantiate-member-template.cpp
@@ -44,7 +44,7 @@ struct X1 {
template<typename U>
struct Inner3 {
- void f0(T t, U u) {
+ void f0(T t, U u) { // expected-note{{passing argument to parameter 't' here}}
(void)(t + u); // expected-error{{invalid operands}}
}
diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp
index 357ea26..363115d 100644
--- a/test/SemaTemplate/instantiate-method.cpp
+++ b/test/SemaTemplate/instantiate-method.cpp
@@ -5,7 +5,7 @@ public:
void f(T x); // expected-error{{argument may not have 'void' type}}
void g(T*);
- static int h(T, T); // expected-error 2{{argument may not have 'void' type}}
+ static int h(T, T); // expected-error {{argument may not have 'void' type}}
};
int identity(int x) { return x; }
@@ -117,3 +117,61 @@ struct X3 {
template struct X3<double>;
+
+// Don't try to instantiate this, it's invalid.
+namespace test1 {
+ template <class T> class A {};
+ template <class T> class B {
+ void foo(A<test1::Undeclared> &a) // expected-error {{no member named 'Undeclared' in namespace 'test1'}}
+ {}
+ };
+ template class B<int>;
+}
+
+namespace PR6947 {
+ template< class T >
+ struct X {
+ int f0( )
+ {
+ typedef void ( X::*impl_fun_ptr )( );
+ impl_fun_ptr pImpl = &X::template
+ f0_impl1<int>;
+ }
+ private:
+ int f1() {
+ }
+ template< class Processor>
+ void f0_impl1( )
+ {
+ }
+ };
+
+ char g0() {
+ X<int> pc;
+ pc.f0();
+ }
+
+}
+
+namespace PR7022 {
+ template <typename >
+ struct X1
+ {
+ typedef int state_t( );
+ state_t g ;
+ };
+
+ template < typename U = X1<int> > struct X2
+ {
+ X2( U = U())
+ {
+ }
+ };
+
+ void m(void)
+ {
+ typedef X2<> X2_type;
+ X2_type c;
+ }
+
+}
diff --git a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
index 414e62b..cbadcde 100644
--- a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
+++ b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
@@ -9,6 +9,28 @@ public:
}
};
-int main(int argc, char *argv[]) {
+void test_stringswitch(int argc, char *argv[]) {
(void)StringSwitch<int>();
}
+
+namespace PR6986 {
+ template<class Class,typename Type,Type Class::*>
+ struct non_const_member_base
+ {
+ };
+
+ template<class Class,typename Type,Type Class::*PtrToMember>
+ struct member: non_const_member_base<Class,Type,PtrToMember>
+ {
+ };
+
+ struct test_class
+ {
+ int int_member;
+ };
+ typedef member< test_class,const int,&test_class::int_member > ckey_m;
+ void test()
+ {
+ ckey_m m;
+ }
+}
diff --git a/test/SemaTemplate/instantiate-typedef.cpp b/test/SemaTemplate/instantiate-typedef.cpp
index bb168a1..4e6cd24 100644
--- a/test/SemaTemplate/instantiate-typedef.cpp
+++ b/test/SemaTemplate/instantiate-typedef.cpp
@@ -11,6 +11,5 @@ add_pointer<float>::type test2(int * ptr) {
return ptr; // expected-error{{cannot initialize return object of type 'add_pointer<float>::type' (aka 'float *') with an lvalue of type 'int *'}}
}
-add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}} \
-// expected-error {{no type named 'type' in 'add_pointer<int &>'}}
+add_pointer<int&>::type // expected-note{{in instantiation of template class 'add_pointer<int &>' requested here}}
test3();
diff --git a/test/SemaTemplate/instantiate-using-decl.cpp b/test/SemaTemplate/instantiate-using-decl.cpp
index a4394aa..2579044 100644
--- a/test/SemaTemplate/instantiate-using-decl.cpp
+++ b/test/SemaTemplate/instantiate-using-decl.cpp
@@ -38,7 +38,7 @@ namespace test1 {
using Base2::Visit;
};
- class Knot : JoinVisitor<Knot> {
+ class Knot : public JoinVisitor<Knot> {
};
void test() {
diff --git a/test/SemaTemplate/instantiation-depth.cpp b/test/SemaTemplate/instantiation-depth.cpp
index f48ede9..a2b9d2e 100644
--- a/test/SemaTemplate/instantiation-depth.cpp
+++ b/test/SemaTemplate/instantiation-depth.cpp
@@ -1,8 +1,10 @@
-// RUN: %clang_cc1 -fsyntax-only -ftemplate-depth 5 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 5 -ftemplate-backtrace-limit 4 %s
-template<typename T> struct X : X<T*> { }; // expected-error{{recursive template instantiation exceeded maximum depth of 5}} \
-// expected-note{{use -ftemplate-depth-N to increase recursive template instantiation depth}} \
-// expected-note 5 {{instantiation of template class}}
+template<typename T> struct X : X<T*> { }; \
+// expected-error{{recursive template instantiation exceeded maximum depth of 5}} \
+// expected-note 3 {{instantiation of template class}} \
+// expected-note {{skipping 2 contexts in backtrace}} \
+// expected-note {{use -ftemplate-depth-N to increase recursive template instantiation depth}}
void test() {
(void)sizeof(X<int>); // expected-note {{instantiation of template class}}
diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp
index 1691db7..9d25a05 100644
--- a/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/test/SemaTemplate/nested-name-spec-template.cpp
@@ -51,3 +51,16 @@ struct TestA {
typedef typename N::template B<T>::type type; // expected-error{{'B' following the 'template' keyword does not refer to a template}} \
// expected-error{{expected member name}}
};
+
+// Reduced from a Boost failure.
+namespace test1 {
+ template <class T> struct pair {
+ T x;
+ T y;
+
+ static T pair<T>::* const mem_array[2];
+ };
+
+ template <class T>
+ T pair<T>::* const pair<T>::mem_array[2] = { &pair<T>::x, &pair<T>::y };
+}
diff --git a/test/SemaTemplate/qualified-id.cpp b/test/SemaTemplate/qualified-id.cpp
index 2e3a826..29eab89 100644
--- a/test/SemaTemplate/qualified-id.cpp
+++ b/test/SemaTemplate/qualified-id.cpp
@@ -21,6 +21,7 @@ namespace test1 {
namespace test2 {
class Impl {
+ public:
int foo();
};
template <class T> class Magic : public Impl {
diff --git a/test/SemaTemplate/temp_arg.cpp b/test/SemaTemplate/temp_arg.cpp
index 80bbda7..5a4c8fc 100644
--- a/test/SemaTemplate/temp_arg.cpp
+++ b/test/SemaTemplate/temp_arg.cpp
@@ -2,7 +2,7 @@
template<typename T,
int I,
template<typename> class TT>
- class A; // expected-note 2 {{template is declared here}}
+ class A; // expected-note 3 {{template is declared here}}
template<typename> class X;
@@ -10,6 +10,7 @@ A<int, 0, X> * a1;
A<float, 1, X, double> *a2; // expected-error{{too many template arguments for class template 'A'}}
A<float, 1> *a3; // expected-error{{too few template arguments for class template 'A'}}
+A a3; // expected-error{{use of class template A requires template arguments}}
namespace test0 {
template <class t> class foo {};
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index 6e4f751..d351eb4 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -36,19 +36,19 @@ A<X(17, 42)> *a11; // expected-error{{non-type template argument of type 'X' mus
float f(float);
-float g(float);
-double g(double);
+float g(float); // expected-note 2{{candidate function}}
+double g(double); // expected-note 2{{candidate function}}
int h(int);
float h2(float);
-template<int fp(int)> struct A3; // expected-note 2{{template parameter is declared here}}
+template<int fp(int)> struct A3; // expected-note 1{{template parameter is declared here}}
A3<h> *a14_1;
A3<&h> *a14_2;
A3<f> *a14_3;
A3<&f> *a14_4;
A3<h2> *a14_6; // expected-error{{non-type template argument of type 'float (float)' cannot be converted to a value of type 'int (*)(int)'}}
-A3<g> *a14_7; // expected-error{{overloaded function cannot be resolved to a non-type template parameter of type 'int (*)(int)'}}
+A3<g> *a14_7; // expected-error{{address of overloaded function 'g' does not match required type 'int (int)'}}
struct Y { } y;
@@ -61,11 +61,11 @@ A4<*X_volatile_ptr> *a15_2; // expected-error{{non-type template argument does n
A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'X const &' cannot bind to template argument of type 'struct Y'}} \
// FIXME: expected-error{{expected unqualified-id}}
-template<int (&fr)(int)> struct A5; // expected-note 2{{template parameter is declared here}}
+template<int (&fr)(int)> struct A5; // expected-note{{template parameter is declared here}}
A5<h> *a16_1;
A5<f> *a16_3;
A5<h2> *a16_6; // expected-error{{non-type template parameter of reference type 'int (&)(int)' cannot bind to template argument of type 'float (float)'}}
-A5<g> *a14_7; // expected-error{{overloaded function cannot be resolved to a non-type template parameter of type 'int (&)(int)'}}
+A5<g> *a14_7; // expected-error{{address of overloaded function 'g' does not match required type 'int (int)'}}
struct Z {
int foo(int);
@@ -176,3 +176,30 @@ namespace PR6723 {
f<512>(arr512); // expected-error{{no matching function for call}}
}
}
+
+// Check that we instantiate declarations whose addresses are taken
+// for non-type template arguments.
+namespace EntityReferenced {
+ template<typename T, void (*)(T)> struct X { };
+
+ template<typename T>
+ struct Y {
+ static void f(T x) {
+ x = 1; // expected-error{{assigning to 'int *' from incompatible type 'int'}}
+ }
+ };
+
+ void g() {
+ typedef X<int*, Y<int*>::f> x; // expected-note{{in instantiation of}}
+ }
+}
+
+namespace PR6964 {
+ template <typename ,int, int = 9223372036854775807L > // expected-warning 2{{non-type template argument value '9223372036854775807' truncated to '-1' for template parameter of type 'int'}} \
+ // expected-note 2{{template parameter is declared here}}
+ struct as_nview { };
+
+ template <typename Sequence, int I0>
+ struct as_nview<Sequence, I0> // expected-note{{while checking a default template argument used here}}
+ { };
+}
diff --git a/test/SemaTemplate/temp_arg_type.cpp b/test/SemaTemplate/temp_arg_type.cpp
index a1db3f8..3876c25 100644
--- a/test/SemaTemplate/temp_arg_type.cpp
+++ b/test/SemaTemplate/temp_arg_type.cpp
@@ -1,16 +1,26 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<typename T> class A; // expected-note 2 {{template parameter is declared here}}
+template<typename T> class A; // expected-note 2 {{template parameter is declared here}} expected-note{{template is declared here}}
// [temp.arg.type]p1
A<0> *a1; // expected-error{{template argument for template type parameter must be a type}}
-A<A> *a2; // expected-error{{template argument for template type parameter must be a type}}
+A<A> *a2; // expected-error{{use of class template A requires template arguments}}
A<int> *a3;
A<int()> *a4;
A<int(float)> *a5;
A<A<int> > *a6;
+// Pass an overloaded function template:
+template<typename T> void function_tpl(T);
+A<function_tpl> a7; // expected-error{{template argument for template type parameter must be a type}}
+
+// Pass a qualified name:
+namespace ns {
+template<typename T> class B {}; // expected-note{{template is declared here}}
+}
+A<ns::B> a8; // expected-error{{use of class template ns::B requires template arguments}}
+
// [temp.arg.type]p2
void f() {
class X { };
@@ -18,7 +28,15 @@ void f() {
}
struct { int x; } Unnamed; // expected-note{{unnamed type used in template argument was declared here}}
-A<__typeof__(Unnamed)> *a7; // expected-error{{template argument uses unnamed type}}
+A<__typeof__(Unnamed)> *a9; // expected-error{{template argument uses unnamed type}}
+
+template<typename T, unsigned N>
+struct Array {
+ typedef struct { T x[N]; } type;
+};
+
+template<typename T> struct A1 { };
+A1<Array<int, 17>::type> ax;
// FIXME: [temp.arg.type]p3. The check doesn't really belong here (it
// belongs somewhere in the template instantiation section).
diff --git a/test/SemaTemplate/template-decl-fail.cpp b/test/SemaTemplate/template-decl-fail.cpp
index eca0f58..ad134cd 100644
--- a/test/SemaTemplate/template-decl-fail.cpp
+++ b/test/SemaTemplate/template-decl-fail.cpp
@@ -4,5 +4,7 @@ template<typename T> typedef T X; // expected-error{{typedef cannot be a templat
template<typename T>
enum t0 { A = T::x }; // expected-error{{enumeration cannot be a template}} \
- // expected-error{{declaration does not declare anything}}
+ // expected-warning{{declaration does not declare anything}}
+enum e0 {};
+template<int x> enum e0 f0(int a=x) {}
diff --git a/test/SemaTemplate/typename-specifier-4.cpp b/test/SemaTemplate/typename-specifier-4.cpp
index 280a1b4..8dfb60d 100644
--- a/test/SemaTemplate/typename-specifier-4.cpp
+++ b/test/SemaTemplate/typename-specifier-4.cpp
@@ -113,6 +113,6 @@ namespace PR6463 {
// FIXME: Improve source location info here.
template<typename T>
typename A<T>::type& A<T>::a() { // expected-error{{found in multiple base classes}}
- return x; // expected-error{{undeclared identifier}}
+ return x;
}
}
diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp
index 42766a0..3f6fe34 100644
--- a/test/SemaTemplate/typename-specifier.cpp
+++ b/test/SemaTemplate/typename-specifier.cpp
@@ -42,13 +42,10 @@ namespace N {
}
N::X<N::A>::type *ip4 = &i;
-N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}} \
-// expected-error{{no type named 'type' in}}
-N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}} \
-// expected-error{{no type named 'type' in}}
+N::X<N::B>::type *ip5 = &i; // expected-note{{in instantiation of template class 'N::X<N::B>' requested here}}
+N::X<N::C>::type *ip6 = &i; // expected-note{{in instantiation of template class 'N::X<N::C>' requested here}}
-N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}} \
-// expected-error{{no type named 'type' in}}
+N::X<int>::type fail1; // expected-note{{in instantiation of template class 'N::X<int>' requested here}}
template<typename T>
struct Y {
@@ -69,7 +66,5 @@ struct C {
};
::Y<A>::type ip7 = &i;
-::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}} \
-// expected-error{{no type named 'type' in}}
-::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}} \
-// expected-error{{no type named 'type' in}}
+::Y<B>::type ip8 = &i; // expected-note{{in instantiation of template class 'Y<B>' requested here}}
+::Y<C>::type ip9 = &i; // expected-note{{in instantiation of template class 'Y<C>' requested here}}
OpenPOWER on IntegriCloud