aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ASTMerge/var.c2
-rw-r--r--test/Analysis/CFDateGC.m10
-rw-r--r--test/Analysis/CFNumber.c8
-rw-r--r--test/Analysis/CFRetainRelease_NSAssertionHandler.m8
-rw-r--r--test/Analysis/CGColorSpace.c8
-rw-r--r--test/Analysis/CheckNSError.m8
-rw-r--r--test/Analysis/MissingDealloc.m2
-rw-r--r--test/Analysis/NSPanel.m8
-rw-r--r--test/Analysis/NSString.m23
-rw-r--r--test/Analysis/NSWindow.m8
-rw-r--r--test/Analysis/NoReturn.m8
-rw-r--r--test/Analysis/OSAtomic_mac.cpp19
-rw-r--r--test/Analysis/ObjCProperties.m8
-rw-r--r--test/Analysis/ObjCRetSigs.m2
-rw-r--r--test/Analysis/PR2599.m8
-rw-r--r--test/Analysis/PR2978.m2
-rw-r--r--test/Analysis/PR3991.m8
-rw-r--r--test/Analysis/PR7218.c2
-rw-r--r--test/Analysis/PR9741.cpp8
-rw-r--r--test/Analysis/additive-folding-range-constraints.c2
-rw-r--r--test/Analysis/additive-folding.c4
-rw-r--r--test/Analysis/analyzer-stats.c2
-rw-r--r--test/Analysis/array-struct-region.c4
-rw-r--r--test/Analysis/array-struct.c8
-rw-r--r--test/Analysis/auto-obj-dtors-cfg-output.cpp150
-rw-r--r--test/Analysis/base-init.cpp3
-rw-r--r--test/Analysis/blocks.m2
-rw-r--r--test/Analysis/bstring.c111
-rw-r--r--test/Analysis/casts.c4
-rw-r--r--test/Analysis/casts.m4
-rw-r--r--test/Analysis/cfref_PR2519.c8
-rw-r--r--test/Analysis/cfref_rdar6080742.c8
-rw-r--r--test/Analysis/chroot.c2
-rw-r--r--test/Analysis/complex.c8
-rw-r--r--test/Analysis/concrete-address.c4
-rw-r--r--test/Analysis/conditional-op-missing-lhs.c26
-rw-r--r--test/Analysis/constant-folding.c2
-rw-r--r--test/Analysis/cxx-crashes.cpp13
-rw-r--r--test/Analysis/dead-stores.c10
-rw-r--r--test/Analysis/dead-stores.cpp10
-rw-r--r--test/Analysis/dead-stores.m4
-rw-r--r--test/Analysis/delegates.m4
-rw-r--r--test/Analysis/derived-to-base.cpp2
-rw-r--r--test/Analysis/dtor.cpp2
-rw-r--r--test/Analysis/elementtype.c2
-rw-r--r--test/Analysis/exercise-ps.c4
-rw-r--r--test/Analysis/fields.c4
-rw-r--r--test/Analysis/flat-store.c2
-rw-r--r--test/Analysis/free.c2
-rw-r--r--test/Analysis/func.c4
-rw-r--r--test/Analysis/idempotent-operations-limited-loops.c6
-rw-r--r--test/Analysis/idempotent-operations.c9
-rw-r--r--test/Analysis/idempotent-operations.cpp21
-rw-r--r--test/Analysis/idempotent-operations.m14
-rw-r--r--test/Analysis/initializer.cpp2
-rw-r--r--test/Analysis/inline.c3
-rw-r--r--test/Analysis/inline2.c2
-rw-r--r--test/Analysis/inline3.c2
-rw-r--r--test/Analysis/inline4.c2
-rw-r--r--test/Analysis/iterators.cpp105
-rw-r--r--test/Analysis/lvalue.cpp2
-rw-r--r--test/Analysis/malloc.c28
-rw-r--r--test/Analysis/method-arg-decay.m (renamed from test/SemaObjC/method-arg-decay.m)2
-rw-r--r--test/Analysis/method-call.cpp2
-rw-r--r--test/Analysis/misc-ps-64.m8
-rw-r--r--test/Analysis/misc-ps-basic-store.m2
-rw-r--r--test/Analysis/misc-ps-eager-assume.m4
-rw-r--r--test/Analysis/misc-ps-flat-store.c2
-rw-r--r--test/Analysis/misc-ps-ranges.m4
-rw-r--r--test/Analysis/misc-ps-region-store-i386.m2
-rw-r--r--test/Analysis/misc-ps-region-store-x86_64.m2
-rw-r--r--test/Analysis/misc-ps-region-store.cpp159
-rw-r--r--test/Analysis/misc-ps-region-store.m66
-rw-r--r--test/Analysis/misc-ps-region-store.mm4
-rw-r--r--test/Analysis/misc-ps.m48
-rw-r--r--test/Analysis/new.cpp2
-rw-r--r--test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m2
-rw-r--r--test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m12
-rw-r--r--test/Analysis/no-exit-cfg.c4
-rw-r--r--test/Analysis/no-outofbounds.c8
-rw-r--r--test/Analysis/null-deref-ps-region.c2
-rw-r--r--test/Analysis/null-deref-ps.c8
-rw-r--r--test/Analysis/nullptr.cpp41
-rw-r--r--test/Analysis/operator-calls.cpp2
-rw-r--r--test/Analysis/out-of-bounds.c11
-rw-r--r--test/Analysis/outofbound.c2
-rw-r--r--test/Analysis/override-werror.c4
-rw-r--r--test/Analysis/plist-output-alternate.m2
-rw-r--r--test/Analysis/plist-output.m2
-rw-r--r--test/Analysis/pr4209.m4
-rw-r--r--test/Analysis/pr_2542_rdar_6793404.m4
-rw-r--r--test/Analysis/pr_4164.c4
-rw-r--r--test/Analysis/properties.m2
-rw-r--r--test/Analysis/ptr-arith.c4
-rw-r--r--test/Analysis/rdar-6442306-1.m4
-rw-r--r--test/Analysis/rdar-6540084.m2
-rw-r--r--test/Analysis/rdar-6541136-region.c2
-rw-r--r--test/Analysis/rdar-6541136.c2
-rw-r--r--test/Analysis/rdar-6562655.m4
-rw-r--r--test/Analysis/rdar-6582778-basic-store.c2
-rw-r--r--test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m4
-rw-r--r--test/Analysis/rdar-7168531.m4
-rw-r--r--test/Analysis/refcnt_naming.m4
-rw-r--r--test/Analysis/reference.cpp2
-rw-r--r--test/Analysis/region-1.m4
-rw-r--r--test/Analysis/retain-release-basic-store.m2
-rw-r--r--test/Analysis/retain-release-gc-only.m4
-rw-r--r--test/Analysis/retain-release-region-store.m2
-rw-r--r--test/Analysis/retain-release.m26
-rw-r--r--test/Analysis/security-syntax-checks-no-emit.c2
-rw-r--r--test/Analysis/security-syntax-checks.m63
-rw-r--r--test/Analysis/self-init.m2
-rw-r--r--test/Analysis/stack-addr-ps.c4
-rw-r--r--test/Analysis/stackaddrleak.c2
-rw-r--r--test/Analysis/stream.c2
-rw-r--r--test/Analysis/string.c448
-rw-r--r--test/Analysis/undef-buffers.c2
-rw-r--r--test/Analysis/uninit-msg-expr.m4
-rw-r--r--test/Analysis/uninit-ps-rdar6145427.m4
-rw-r--r--test/Analysis/uninit-vals-ps-region.m2
-rw-r--r--test/Analysis/uninit-vals-ps.c4
-rw-r--r--test/Analysis/uninit-vals.c53
-rw-r--r--test/Analysis/uninit-vals.m4
-rw-r--r--test/Analysis/unions-region.m2
-rw-r--r--test/Analysis/unix-fns.c4
-rw-r--r--test/Analysis/unreachable-code-path.c2
-rw-r--r--test/Analysis/unused-ivars.m2
-rw-r--r--test/Analysis/variadic-method-types.m93
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp2
-rw-r--r--test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp68
-rw-r--r--test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp26
-rw-r--r--test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp2
-rw-r--r--test/CXX/class.access/p4.cpp2
-rw-r--r--test/CXX/class.derived/p8-0x.cpp22
-rw-r--r--test/CXX/class/class.mem/p2.cpp31
-rw-r--r--test/CXX/class/class.mem/p8-0x-pedantic.cpp14
-rw-r--r--test/CXX/class/class.mem/p8-0x.cpp2
-rw-r--r--test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp17
-rw-r--r--test/CXX/class/class.union/p1.cpp34
-rw-r--r--test/CXX/class/p1-0x.cpp4
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp21
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp7
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp44
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp161
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.string/p2.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp2
-rw-r--r--test/CXX/except/except.handle/p16.cpp2
-rw-r--r--test/CXX/except/except.spec/p1.cpp60
-rw-r--r--test/CXX/except/except.spec/p11.cpp12
-rw-r--r--test/CXX/except/except.spec/p14.cpp2
-rw-r--r--test/CXX/except/except.spec/p15.cpp24
-rw-r--r--test/CXX/except/except.spec/p2-dynamic-types.cpp34
-rw-r--r--test/CXX/except/except.spec/p2-places.cpp63
-rw-r--r--test/CXX/except/except.spec/p3.cpp106
-rw-r--r--test/CXX/except/except.spec/p5-pointers.cpp85
-rw-r--r--test/CXX/except/except.spec/p5-virtual.cpp96
-rw-r--r--test/CXX/except/except.spec/p9-dynamic.cpp11
-rw-r--r--test/CXX/except/except.spec/p9-noexcept.cpp18
-rw-r--r--test/CXX/except/except.spec/template.cpp12
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp6
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp6
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.op/p6.cpp6
-rw-r--r--test/CXX/lex/lex.pptoken/p3-0x.cpp11
-rw-r--r--test/CXX/over/over.over/p2-resolve-single-template-id.cpp102
-rw-r--r--test/CXX/special/class.copy/p33-0x.cpp2
-rw-r--r--test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp210
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp18
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p4.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p5.cpp6
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp6
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp63
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp12
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp8
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp65
-rw-r--r--test/CodeCompletion/PR9728.cpp9
-rw-r--r--test/CodeCompletion/ordinary-name.cpp58
-rw-r--r--test/CodeGen/2008-07-17-no-emit-on-error.c4
-rw-r--r--test/CodeGen/altivec.c31
-rw-r--r--test/CodeGen/arm-clear.c21
-rw-r--r--test/CodeGen/arm-pcs.c12
-rw-r--r--test/CodeGen/arm-vector-align.c19
-rw-r--r--test/CodeGen/atomic.c5
-rw-r--r--test/CodeGen/attr-availability.c31
-rw-r--r--test/CodeGen/block-byref-aggr.c17
-rw-r--r--test/CodeGen/builtin-attributes.c5
-rw-r--r--test/CodeGen/builtin-expect.c12
-rw-r--r--test/CodeGen/builtin-memfns.c35
-rw-r--r--test/CodeGen/builtinmemcpy.c3
-rw-r--r--test/CodeGen/builtins-ppc-altivec.c325
-rw-r--r--test/CodeGen/builtins-ptx.c99
-rw-r--r--test/CodeGen/builtins-x86.c31
-rw-r--r--test/CodeGen/builtins.c2
-rw-r--r--test/CodeGen/char-literal.c2
-rw-r--r--test/CodeGen/conditional.c21
-rw-r--r--test/CodeGen/const-init.c4
-rw-r--r--test/CodeGen/darwin-string-literals.c4
-rw-r--r--test/CodeGen/debug-info-line2.c17
-rw-r--r--test/CodeGen/decl.c2
-rw-r--r--test/CodeGen/ext-vector.c134
-rw-r--r--test/CodeGen/integer-overflow.c14
-rw-r--r--test/CodeGen/mangle.c9
-rw-r--r--test/CodeGen/mmx-inline-asm.c22
-rw-r--r--test/CodeGen/mrtd.c15
-rw-r--r--test/CodeGen/ms_struct-bitfield-init.c68
-rw-r--r--test/CodeGen/ms_struct-bitfield.c131
-rw-r--r--test/CodeGen/mult-alt-x86.c56
-rw-r--r--test/CodeGen/packed-arrays.c157
-rw-r--r--test/CodeGen/ptx-cc.c9
-rw-r--r--test/CodeGen/regparm-flag.c5
-rw-r--r--test/CodeGen/switch-dce.c247
-rw-r--r--test/CodeGen/union.c2
-rw-r--r--test/CodeGen/x86_64-arguments-darwin.c17
-rw-r--r--test/CodeGen/x86_64-arguments.c22
-rw-r--r--test/CodeGenCXX/PR5863-unreachable-block.cpp2
-rw-r--r--test/CodeGenCXX/anonymous-namespaces.cpp2
-rw-r--r--test/CodeGenCXX/anonymous-union-member-initializer.cpp19
-rw-r--r--test/CodeGenCXX/apple-kext-guard-variable.cpp9
-rw-r--r--test/CodeGenCXX/arm.cpp3
-rw-r--r--test/CodeGenCXX/blocks.cpp49
-rw-r--r--test/CodeGenCXX/class-layout.cpp28
-rw-r--r--test/CodeGenCXX/cxx0x-delegating-ctors.cpp48
-rw-r--r--test/CodeGenCXX/debug-info-byval.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-cxx0x.cpp8
-rw-r--r--test/CodeGenCXX/debug-info-fn-template.cpp15
-rw-r--r--test/CodeGenCXX/debug-info-method-spec.cpp10
-rw-r--r--test/CodeGenCXX/debug-info-namespace.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-template.cpp24
-rw-r--r--test/CodeGenCXX/debug-info-this.cpp15
-rw-r--r--test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp2
-rw-r--r--test/CodeGenCXX/destructors.cpp2
-rw-r--r--test/CodeGenCXX/devirtualize-virtual-function-calls.cpp10
-rw-r--r--test/CodeGenCXX/dynamic-cast-always-null.cpp19
-rw-r--r--test/CodeGenCXX/dynamic-cast.cpp2
-rw-r--r--test/CodeGenCXX/dyncast.cpp367
-rw-r--r--test/CodeGenCXX/eh.cpp2
-rw-r--r--test/CodeGenCXX/exceptions-no-rtti.cpp2
-rw-r--r--test/CodeGenCXX/exceptions.cpp87
-rw-r--r--test/CodeGenCXX/explicit-instantiation.cpp2
-rw-r--r--test/CodeGenCXX/for-range-temporaries.cpp131
-rw-r--r--test/CodeGenCXX/for-range.cpp128
-rw-r--r--test/CodeGenCXX/global-init.cpp21
-rw-r--r--test/CodeGenCXX/goto.cpp2
-rw-r--r--test/CodeGenCXX/mangle-exprs.cpp60
-rw-r--r--test/CodeGenCXX/mangle-subst-std.cpp4
-rw-r--r--test/CodeGenCXX/mangle.cpp67
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp23
-rw-r--r--test/CodeGenCXX/nrvo.cpp2
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp10
-rw-r--r--test/CodeGenCXX/pragma-pack.cpp4
-rw-r--r--test/CodeGenCXX/references.cpp11
-rw-r--r--test/CodeGenCXX/specialized-static-data-mem-init.cpp4
-rw-r--r--test/CodeGenCXX/static-data-member.cpp4
-rw-r--r--test/CodeGenCXX/static-init-3.cpp4
-rw-r--r--test/CodeGenCXX/static-init.cpp4
-rw-r--r--test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp2
-rw-r--r--test/CodeGenCXX/threadsafe-statics-exceptions.cpp2
-rw-r--r--test/CodeGenCXX/threadsafe-statics.cpp10
-rw-r--r--test/CodeGenCXX/throw-expression-dtor.cpp2
-rw-r--r--test/CodeGenCXX/throw-expressions.cpp2
-rw-r--r--test/CodeGenCXX/try-catch.cpp2
-rw-r--r--test/CodeGenCXX/typeid.cpp22
-rw-r--r--test/CodeGenCXX/unknown-anytype.cpp99
-rw-r--r--test/CodeGenCXX/value-init.cpp58
-rw-r--r--test/CodeGenCXX/visibility.cpp11
-rw-r--r--test/CodeGenCXX/vtable-debug-info.cpp5
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp22
-rw-r--r--test/CodeGenCXX/vtable-linkage.cpp2
-rw-r--r--test/CodeGenCXX/x86_64-arguments.cpp6
-rw-r--r--test/CodeGenObjC/atomic-aggregate-property.m2
-rw-r--r--test/CodeGenObjC/attr-availability.m24
-rw-r--r--test/CodeGenObjC/bitfield-access.m9
-rw-r--r--test/CodeGenObjC/blocks.m13
-rw-r--r--test/CodeGenObjC/constant-strings.m16
-rw-r--r--test/CodeGenObjC/debug-info-foreach.m7
-rw-r--r--test/CodeGenObjC/debug-info-getter-name.m9
-rw-r--r--test/CodeGenObjC/debug-info-property.m12
-rw-r--r--test/CodeGenObjC/fpret.m2
-rw-r--r--test/CodeGenObjC/instance-method-metadata.m34
-rw-r--r--test/CodeGenObjC/messages.m20
-rw-r--r--test/CodeGenObjC/metadata-symbols-64.m6
-rw-r--r--test/CodeGenObjC/metadata_symbols.m4
-rw-r--r--test/CodeGenObjC/misc-atomic-property.m80
-rw-r--r--test/CodeGenObjC/missing-atend-metadata.m24
-rw-r--r--test/CodeGenObjC/no-vararg-messaging.m18
-rw-r--r--test/CodeGenObjC/property-agrr-getter.m8
-rw-r--r--test/CodeGenObjC/simplify-exceptions.mm18
-rw-r--r--test/CodeGenObjCXX/exceptions.mm2
-rw-r--r--test/CodeGenObjCXX/ivar-objects.mm18
-rw-r--r--test/CodeGenObjCXX/message-reference.mm20
-rw-r--r--test/CodeGenObjCXX/property-reference.mm34
-rw-r--r--test/CodeGenObjCXX/references.mm2
-rw-r--r--test/CodeGenOpenCL/2011-04-15-vec-init-from-vec.cl12
-rw-r--r--test/CodeGenOpenCL/address-spaces.cl27
-rw-r--r--test/Coverage/ast-printing.c1
-rw-r--r--test/Coverage/ast-printing.cpp1
-rw-r--r--test/Coverage/html-diagnostics.c2
-rw-r--r--test/Driver/apple-kext-i386.cpp9
-rw-r--r--test/Driver/apple-kext-mkernel.c24
-rw-r--r--test/Driver/ast.c2
-rw-r--r--test/Driver/cc-log-diagnostics.c29
-rw-r--r--test/Driver/cc-print-options.c2
-rw-r--r--test/Driver/clang-exception-flags.cpp23
-rw-r--r--test/Driver/clang-translation.c2
-rw-r--r--test/Driver/clang_f_opts.c17
-rw-r--r--test/Driver/clang_wrapv_opts.c11
-rw-r--r--test/Driver/darwin-cc.c7
-rw-r--r--test/Driver/darwin-dsymutil.c7
-rw-r--r--test/Driver/darwin-ld.c4
-rw-r--r--test/Driver/darwin-version.c8
-rw-r--r--test/Driver/darwin-xarch.c4
-rw-r--r--test/Driver/exceptions.m19
-rw-r--r--test/Driver/hello.c6
-rw-r--r--test/Driver/sysroot-flags.c14
-rw-r--r--test/FixIt/fixit-cxx0x.cpp3
-rw-r--r--test/FixIt/fixit-unrecoverable.c2
-rw-r--r--test/FixIt/fixit.c6
-rw-r--r--test/FixIt/fixit.cpp19
-rw-r--r--test/FixIt/no-macro-fixit.c16
-rw-r--r--test/FixIt/typo.c14
-rw-r--r--test/FixIt/typo.cpp12
-rw-r--r--test/FixIt/typo.m18
-rw-r--r--test/Frontend/dependency-gen.c3
-rw-r--r--test/Frontend/dependency-generation-crash.c4
-rw-r--r--test/Frontend/diagnostic-name.c5
-rw-r--r--test/Index/TestClassDecl.m2
-rw-r--r--test/Index/annotate-context-sensitive.cpp42
-rw-r--r--test/Index/annotate-nested-name-specifier.cpp328
-rw-r--r--test/Index/annotate-tokens.c50
-rw-r--r--test/Index/annotate-tokens.cpp89
-rw-r--r--test/Index/annotate-tokens.m31
-rw-r--r--test/Index/blocks.c8
-rw-r--r--test/Index/c-index-api-loadTU-test.m14
-rw-r--r--test/Index/c-index-getCursor-test.m6
-rw-r--r--test/Index/cindex-on-invalid.m17
-rw-r--r--test/Index/complete-objc-message.m12
-rw-r--r--test/Index/complete-properties.m27
-rw-r--r--test/Index/index-templates.cpp58
-rw-r--r--test/Index/initializer-memory.cpp16
-rw-r--r--test/Index/invalid-rdar-8236270.cpp2
-rw-r--r--test/Index/load-classes.cpp4
-rw-r--r--test/Index/load-exprs.c20
-rw-r--r--test/Index/load-namespaces.cpp16
-rw-r--r--test/Index/load-stmts.cpp16
-rw-r--r--test/Index/local-symbols.m2
-rw-r--r--test/Index/nested-binaryoperators.cpp4
-rw-r--r--test/Index/overrides.cpp4
-rw-r--r--test/Index/pragma-diag-reparse.c13
-rw-r--r--test/Index/preamble-reparse-chained.c4
-rw-r--r--test/Index/preamble.c4
-rw-r--r--test/Index/rdar-8288645-invalid-code.mm2
-rw-r--r--test/Index/recursive-cxx-member-calls.cpp523
-rw-r--r--test/Index/recursive-member-access.c12
-rw-r--r--test/Index/remap-load.c2
-rw-r--r--test/Index/usrs-cxx0x.cpp2
-rw-r--r--test/Index/usrs.cpp50
-rw-r--r--test/Index/usrs.m44
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp38
-rw-r--r--test/Lexer/pragma-message.c2
-rw-r--r--test/Makefile42
-rw-r--r--test/Misc/Inputs/include.h1
-rw-r--r--test/Misc/caret-diags-macros.c23
-rw-r--r--test/Misc/include-stack-for-note-flag.cpp18
-rw-r--r--test/Misc/warn-in-system-header.c4
-rw-r--r--test/Misc/warn-in-system-header.h4
-rw-r--r--test/PCH/Inputs/working-directory-1.h5
-rw-r--r--test/PCH/chain-cxx.cpp35
-rw-r--r--test/PCH/chain-empty-initial-namespace.cpp24
-rw-r--r--test/PCH/chain-implicit-definition.cpp39
-rw-r--r--test/PCH/chain-late-anonymous-namespace.cpp61
-rw-r--r--test/PCH/chain-pending-instantiations.cpp33
-rw-r--r--test/PCH/cxx-chain-function-template.cpp32
-rw-r--r--test/PCH/cxx-for-range.cpp19
-rw-r--r--test/PCH/cxx-for-range.h35
-rw-r--r--test/PCH/cxx-reference.cpp6
-rw-r--r--test/PCH/cxx-reference.h13
-rw-r--r--test/PCH/cxx-templates.cpp29
-rw-r--r--test/PCH/cxx-templates.h12
-rw-r--r--test/PCH/cxx_exprs.cpp6
-rw-r--r--test/PCH/exprs.c5
-rw-r--r--test/PCH/exprs.h6
-rw-r--r--test/PCH/headersearch.cpp6
-rw-r--r--test/PCH/modified-header-crash.c10
-rw-r--r--test/PCH/modified-header-crash.h1
-rw-r--r--test/PCH/objcxx-ivar-class.h1
-rw-r--r--test/PCH/pragma-diag-section.cpp5
-rw-r--r--test/PCH/pragma-diag.c3
-rw-r--r--test/PCH/rdar8852495.c3
-rw-r--r--test/PCH/reloc.c2
-rw-r--r--test/PCH/source-manager-stack.c4
-rw-r--r--test/PCH/working-directory.cpp12
-rw-r--r--test/PCH/working-directory.h1
-rw-r--r--test/Parser/DelayedTemplateParsing.cpp42
-rw-r--r--test/Parser/MicrosoftExtensions.c2
-rw-r--r--test/Parser/MicrosoftExtensions.cpp53
-rw-r--r--test/Parser/altivec.c8
-rw-r--r--test/Parser/attr-availability.c20
-rw-r--r--test/Parser/c1x-generic-selection.c10
-rw-r--r--test/Parser/cxx-casting.cpp34
-rw-r--r--test/Parser/cxx-decl.cpp4
-rw-r--r--test/Parser/cxx-exception-spec.cpp17
-rw-r--r--test/Parser/cxx-member-crash.cpp15
-rw-r--r--test/Parser/cxx-stmt.cpp2
-rw-r--r--test/Parser/cxx-throw.cpp2
-rw-r--r--test/Parser/cxx0x-attributes.cpp2
-rw-r--r--test/Parser/cxx0x-override-control-keywords.cpp3
-rw-r--r--test/Parser/expressions.c6
-rw-r--r--test/Parser/objc-missing-impl.m2
-rw-r--r--test/Parser/objcxx-at.mm15
-rw-r--r--test/Parser/opencl-image-access.cl16
-rw-r--r--test/Parser/recovery.m5
-rw-r--r--test/Parser/selector-1.m26
-rw-r--r--test/Parser/switch-recovery.cpp124
-rw-r--r--test/Preprocessor/init.c14
-rw-r--r--test/Preprocessor/pragma-pushpop-macro.c2
-rw-r--r--test/Preprocessor/pragma_diagnostic_sections.cpp8
-rw-r--r--test/Preprocessor/pragma_unknown.c2
-rw-r--r--test/Preprocessor/stdint.c12
-rw-r--r--test/Preprocessor/traditional-cpp.c12
-rw-r--r--test/Rewriter/rewrite-block-literal-1.mm32
-rw-r--r--test/Rewriter/rewrite-block-pointer.mm17
-rw-r--r--test/Sema/__try.c171
-rw-r--r--test/Sema/align-x86-64.c14
-rw-r--r--test/Sema/align-x86.c26
-rw-r--r--test/Sema/altivec-init.c12
-rw-r--r--test/Sema/annotate.c2
-rw-r--r--test/Sema/anonymous-struct-union.c2
-rw-r--r--test/Sema/arm-layout.c2
-rw-r--r--test/Sema/attr-args.c40
-rw-r--r--test/Sema/attr-availability-ios.c21
-rw-r--r--test/Sema/attr-availability-macosx.c17
-rw-r--r--test/Sema/attr-availability.c6
-rw-r--r--test/Sema/attr-cleanup.c4
-rw-r--r--test/Sema/attr-naked.c2
-rw-r--r--test/Sema/attr-nodebug.c2
-rw-r--r--test/Sema/attr-noinline.c2
-rw-r--r--test/Sema/attr-noreturn.c4
-rw-r--r--test/Sema/attr-regparm.c2
-rw-r--r--test/Sema/attr-unused.c2
-rw-r--r--test/Sema/block-args.c5
-rw-r--r--test/Sema/builtins-decl.c8
-rw-r--r--test/Sema/builtins.c2
-rw-r--r--test/Sema/c89.c2
-rw-r--r--test/Sema/callingconv.c4
-rw-r--r--test/Sema/const-eval.c2
-rw-r--r--test/Sema/constructor-attribute.c4
-rw-r--r--test/Sema/conversion.c4
-rw-r--r--test/Sema/expr-address-of.c11
-rw-r--r--test/Sema/exprs.c16
-rw-r--r--test/Sema/format-strings-fixit.c26
-rw-r--r--test/Sema/function-redecl.c2
-rw-r--r--test/Sema/generic-selection.c26
-rw-r--r--test/Sema/incomplete-call.c6
-rw-r--r--test/Sema/knr-def-call.c6
-rw-r--r--test/Sema/memset-invalid.c6
-rw-r--r--test/Sema/missing-field-initializers.c2
-rw-r--r--test/Sema/neon-vector-types.c2
-rw-r--r--test/Sema/overloaded-func-transparent-union.c28
-rw-r--r--test/Sema/parentheses.c3
-rw-r--r--test/Sema/pragma-ms_struct.c34
-rw-r--r--test/Sema/sentinel-attribute.c2
-rw-r--r--test/Sema/shift.c10
-rw-r--r--test/Sema/static-assert.c11
-rw-r--r--test/Sema/struct-decl.c11
-rw-r--r--test/Sema/uninit-variables-vectors.c17
-rw-r--r--test/Sema/uninit-variables.c123
-rw-r--r--test/Sema/vector-ops.c3
-rw-r--r--test/Sema/warn-gnu-designators.c2
-rw-r--r--test/Sema/warn-unused-function.c6
-rw-r--r--test/Sema/warn-unused-value.c9
-rw-r--r--test/Sema/warn-write-strings.c2
-rw-r--r--test/SemaCXX/MicrosoftExtensions.cpp86
-rw-r--r--test/SemaCXX/PR9459.cpp7
-rw-r--r--test/SemaCXX/PR9460.cpp19
-rw-r--r--test/SemaCXX/PR9461.cpp32
-rw-r--r--test/SemaCXX/PR9572.cpp15
-rw-r--r--test/SemaCXX/__try.cpp58
-rw-r--r--test/SemaCXX/addr-of-overloaded-function.cpp7
-rw-r--r--test/SemaCXX/address-space-conversion.cpp197
-rw-r--r--test/SemaCXX/address-space-newdelete.cpp24
-rw-r--r--test/SemaCXX/address-space-references.cpp19
-rw-r--r--test/SemaCXX/alignof-sizeof-reference.cpp6
-rw-r--r--test/SemaCXX/altivec.cpp30
-rw-r--r--test/SemaCXX/array-bounds.cpp53
-rw-r--r--test/SemaCXX/attr-nonnull.cpp6
-rw-r--r--test/SemaCXX/attr-unavailable.cpp2
-rw-r--r--test/SemaCXX/auto-subst-failure.cpp15
-rw-r--r--test/SemaCXX/conditional-expr.cpp2
-rw-r--r--test/SemaCXX/conversion-function.cpp25
-rw-r--r--test/SemaCXX/cxx0x-constexpr-const.cpp10
-rw-r--r--test/SemaCXX/cxx0x-delegating-ctors.cpp36
-rw-r--r--test/SemaCXX/cxx0x-return-init-list.cpp18
-rw-r--r--test/SemaCXX/decltype-98.cpp3
-rw-r--r--test/SemaCXX/decltype-overloaded-functions.cpp13
-rw-r--r--test/SemaCXX/destructor.cpp13
-rw-r--r--test/SemaCXX/enum-scoped.cpp6
-rw-r--r--test/SemaCXX/exception-spec-no-exceptions.cpp7
-rw-r--r--test/SemaCXX/exception-spec.cpp193
-rw-r--r--test/SemaCXX/exceptions.cpp2
-rw-r--r--test/SemaCXX/expression-traits.cpp620
-rw-r--r--test/SemaCXX/flexible-array-test.cpp16
-rw-r--r--test/SemaCXX/for-range-examples.cpp150
-rw-r--r--test/SemaCXX/for-range-no-std.cpp37
-rw-r--r--test/SemaCXX/friend.cpp4
-rw-r--r--test/SemaCXX/generic-selection.cpp46
-rw-r--r--test/SemaCXX/goto.cpp105
-rw-r--r--test/SemaCXX/goto2.cpp47
-rw-r--r--test/SemaCXX/init-priority-attr.cpp2
-rw-r--r--test/SemaCXX/libstdcxx_is_pod_hack.cpp16
-rw-r--r--test/SemaCXX/literal-type.cpp63
-rw-r--r--test/SemaCXX/member-expr.cpp5
-rw-r--r--test/SemaCXX/member-pointers-2.cpp15
-rw-r--r--test/SemaCXX/neon-vector-types.cpp27
-rw-r--r--test/SemaCXX/nested-name-spec-locations.cpp94
-rw-r--r--test/SemaCXX/nullptr.cpp2
-rw-r--r--test/SemaCXX/operator-arrow-temporary.cpp19
-rw-r--r--test/SemaCXX/overloaded-name.cpp12
-rw-r--r--test/SemaCXX/overloaded-operator.cpp15
-rw-r--r--test/SemaCXX/pascal-strings.cpp6
-rw-r--r--test/SemaCXX/pseudo-destructors.cpp7
-rw-r--r--test/SemaCXX/ptrtomember.cpp5
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp16
-rw-r--r--test/SemaCXX/return-noreturn.cpp73
-rw-r--r--test/SemaCXX/return.cpp14
-rw-r--r--test/SemaCXX/rval-references.cpp2
-rw-r--r--test/SemaCXX/scope-check.cpp20
-rw-r--r--test/SemaCXX/short-enums.cpp17
-rw-r--r--test/SemaCXX/short-wchar-sign.cpp6
-rw-r--r--test/SemaCXX/sourceranges.cpp6
-rw-r--r--test/SemaCXX/static-cast.cpp6
-rw-r--r--test/SemaCXX/storage-class.cpp3
-rw-r--r--test/SemaCXX/type-traits.cpp1598
-rw-r--r--test/SemaCXX/uninit-variables-conditional.cpp23
-rw-r--r--test/SemaCXX/uninit-variables.cpp66
-rw-r--r--test/SemaCXX/uninitialized.cpp53
-rw-r--r--test/SemaCXX/unknown-anytype.cpp36
-rw-r--r--test/SemaCXX/unreachable-catch-clauses.cpp2
-rw-r--r--test/SemaCXX/unreachable-code.cpp2
-rw-r--r--test/SemaCXX/unused-functions.cpp4
-rw-r--r--test/SemaCXX/vtable-instantiation.cc26
-rw-r--r--test/SemaCXX/warn-assignment-condition.cpp13
-rw-r--r--test/SemaCXX/warn-bool-conversion.cpp24
-rw-r--r--test/SemaCXX/warn-deprecated-header.cpp6
-rw-r--r--test/SemaCXX/warn-exit-time-destructors.cpp27
-rw-r--r--test/SemaCXX/warn-global-constructors.cpp4
-rw-r--r--test/SemaCXX/warn-literal-conversion.cpp15
-rw-r--r--test/SemaCXX/warn-missing-prototypes.cpp6
-rw-r--r--test/SemaCXX/warn-non-pod-memset.cpp63
-rw-r--r--test/SemaCXX/warn-overloaded-virtual.cpp12
-rw-r--r--test/SemaCXX/warn-shadow.cpp11
-rw-r--r--test/SemaCXX/warn-unreachable.cpp2
-rw-r--r--test/SemaCXX/warn-unused-filescoped.cpp9
-rw-r--r--test/SemaCXX/warn-using-namespace-in-header.cpp54
-rw-r--r--test/SemaCXX/warn-using-namespace-in-header.h50
-rw-r--r--test/SemaCXX/warn_false_to_pointer.cpp10
-rw-r--r--test/SemaCXX/writable-strings-deprecated.cpp2
-rw-r--r--test/SemaObjC/assign-rvalue-message.m24
-rw-r--r--test/SemaObjC/attr-objc-gc.m26
-rw-r--r--test/SemaObjC/auto-objective-c.m33
-rw-r--r--test/SemaObjC/block-type-safety.m17
-rw-r--r--test/SemaObjC/call-super-2.m14
-rw-r--r--test/SemaObjC/class-message-protocol-lookup.m34
-rw-r--r--test/SemaObjC/class-unavail-warning.m24
-rw-r--r--test/SemaObjC/comptypes-4.m2
-rw-r--r--test/SemaObjC/conditional-expr-8.m25
-rw-r--r--test/SemaObjC/exprs.m4
-rw-r--r--test/SemaObjC/foreach.m30
-rw-r--r--test/SemaObjC/format-arg-attribute.m8
-rw-r--r--test/SemaObjC/iboutletcollection-attr.m4
-rw-r--r--test/SemaObjC/idiomatic-parentheses.m4
-rw-r--r--test/SemaObjC/ignore-weakimport-method.m1
-rw-r--r--test/SemaObjC/ivar-lookup.m12
-rw-r--r--test/SemaObjC/method-bad-param.m2
-rw-r--r--test/SemaObjC/method-not-defined.m6
-rw-r--r--test/SemaObjC/method-prototype-scope.m4
-rw-r--r--test/SemaObjC/method-sentinel-attr.m2
-rw-r--r--test/SemaObjC/missing-atend-metadata.m22
-rw-r--r--test/SemaObjC/nonnull.m27
-rw-r--r--test/SemaObjC/objc-qualified-property-lookup.m21
-rw-r--r--test/SemaObjC/property-13.m2
-rw-r--r--test/SemaObjC/property-lookup-in-id.m33
-rw-r--r--test/SemaObjC/protocol-attribute.m2
-rw-r--r--test/SemaObjC/self-declared-in-block.m51
-rw-r--r--test/SemaObjC/self-in-function.m26
-rw-r--r--test/SemaObjC/sizeof-interface.m2
-rw-r--r--test/SemaObjC/special-dep-unavail-warning.m8
-rw-r--r--test/SemaObjC/uninit-variables.m4
-rw-r--r--test/SemaObjC/unqualified-to-qualified-class-warn.m72
-rw-r--r--test/SemaObjC/warn-write-strings.m2
-rw-r--r--test/SemaObjC/weak-attr-ivar.m10
-rw-r--r--test/SemaObjCXX/argument-dependent-lookup.mm19
-rw-r--r--test/SemaObjCXX/exceptions-fragile.mm2
-rw-r--r--test/SemaObjCXX/goto.mm16
-rw-r--r--test/SemaObjCXX/objc-pointer-conv.mm2
-rw-r--r--test/SemaObjCXX/overload-gc.mm24
-rw-r--r--test/SemaObjCXX/overload.mm26
-rw-r--r--test/SemaObjCXX/parameters.mm5
-rw-r--r--test/SemaObjCXX/propert-dot-error.mm11
-rw-r--r--test/SemaObjCXX/property-reference.mm44
-rw-r--r--test/SemaObjCXX/references.mm6
-rw-r--r--test/SemaOpenCL/extension-fp64.cl8
-rw-r--r--test/SemaOpenCL/vec_step.cl32
-rw-r--r--test/SemaTemplate/address-spaces.cpp86
-rw-r--r--test/SemaTemplate/deduction-crash.cpp2
-rw-r--r--test/SemaTemplate/dependent-template-recover.cpp42
-rw-r--r--test/SemaTemplate/destructor-template.cpp7
-rw-r--r--test/SemaTemplate/explicit-instantiation.cpp9
-rw-r--r--test/SemaTemplate/instantiate-cast.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-4.cpp2
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp2
-rw-r--r--test/SemaTemplate/instantiate-member-class.cpp23
-rw-r--r--test/SemaTemplate/instantiate-member-template.cpp44
-rw-r--r--test/SemaTemplate/instantiate-try-catch.cpp2
-rw-r--r--test/SemaTemplate/issue150.cpp107
-rw-r--r--test/SemaTemplate/nested-name-spec-template.cpp41
-rw-r--r--test/SemaTemplate/resolve-single-template-id.cpp80
-rw-r--r--test/SemaTemplate/temp_arg_template.cpp9
-rw-r--r--test/SemaTemplate/typename-specifier-4.cpp8
-rw-r--r--test/lit.cfg9
620 files changed, 13613 insertions, 2623 deletions
diff --git a/test/ASTMerge/var.c b/test/ASTMerge/var.c
index 7f23b9f5d26d..e1dde6abd2ac 100644
--- a/test/ASTMerge/var.c
+++ b/test/ASTMerge/var.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/var1.c
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/var2.c
-// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s
// CHECK: var2.c:2:9: error: external variable 'x1' declared with incompatible types in different translation units ('double *' vs. 'float **')
// CHECK: var1.c:2:9: note: declared here with type 'float **'
diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m
index a00895586e2e..bd1a4b7967ca 100644
--- a/test/Analysis/CFDateGC.m
+++ b/test/Analysis/CFDateGC.m
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -Wno-implicit-function-declaration
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -Wno-implicit-function-declaration
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc -disable-free %s -Wno-implicit-function-declaration
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -Wno-implicit-function-declaration
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -Wno-implicit-function-declaration
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -disable-free %s -Wno-implicit-function-declaration
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/CFNumber.c b/test/Analysis/CFNumber.c
index 4725f90f1a2f..dd57cd9cbfa1 100644
--- a/test/Analysis/CFNumber.c
+++ b/test/Analysis/CFNumber.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=macosx.CFNumber -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=macosx.CFNumber -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=macosx.CFNumber -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=macosx.CFNumber -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.coreFoundation.CFNumber -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
typedef signed long CFIndex;
typedef const struct __CFAllocator * CFAllocatorRef;
diff --git a/test/Analysis/CFRetainRelease_NSAssertionHandler.m b/test/Analysis/CFRetainRelease_NSAssertionHandler.m
index 7ece5c665904..ee52201e6285 100644
--- a/test/Analysis/CFRetainRelease_NSAssertionHandler.m
+++ b/test/Analysis/CFRetainRelease_NSAssertionHandler.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -verify %s -analyzer-constraints=basic -analyzer-store=basic
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -verify %s -analyzer-constraints=range -analyzer-store=basic
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -verify %s -analyzer-constraints=basic -analyzer-store=region
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -verify %s -analyzer-constraints=range -analyzer-store=region
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=basic -analyzer-store=basic
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=range -analyzer-store=basic
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=basic -analyzer-store=region
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s -analyzer-constraints=range -analyzer-store=region
typedef struct objc_selector *SEL;
typedef signed char BOOL;
diff --git a/test/Analysis/CGColorSpace.c b/test/Analysis/CGColorSpace.c
index 9d554a98f636..ea458404c5dd 100644
--- a/test/Analysis/CGColorSpace.c
+++ b/test/Analysis/CGColorSpace.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify %s
typedef struct CGColorSpace *CGColorSpaceRef;
extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
diff --git a/test/Analysis/CheckNSError.m b/test/Analysis/CheckNSError.m
index d12ad4eb2e65..3bc7d8f748e1 100644
--- a/test/Analysis/CheckNSError.m
+++ b/test/Analysis/CheckNSError.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=range -verify %s
typedef signed char BOOL;
diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m
index 27fd340dd0b2..e7930d1223b7 100644
--- a/test/Analysis/MissingDealloc.m
+++ b/test/Analysis/MissingDealloc.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=cocoa.experimental.Dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.experimental.Dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
typedef signed char BOOL;
@protocol NSObject
- (BOOL)isEqual:(id)object;
diff --git a/test/Analysis/NSPanel.m b/test/Analysis/NSPanel.m
index 3f356349ad8a..19b72d8f692f 100644
--- a/test/Analysis/NSPanel.m
+++ b/test/Analysis/NSPanel.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
// BEGIN delta-debugging reduced header stuff
diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m
index 52664df231c8..6ff4bb1e554f 100644
--- a/test/Analysis/NSString.m
+++ b/test/Analysis/NSString.m
@@ -1,13 +1,13 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
// ==-- FIXME: -analyzer-store=basic fails on this file (false negatives). --==
-// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s &&
-// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
-// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
-// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
+// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s &&
+// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
+// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
+// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.AtomicCAS,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
@@ -190,6 +190,13 @@ void f13(void) {
CFRelease(ref); // expected-warning{{Reference-counted object is used after it is released}}
}
+@interface MyString : NSString
+@end
+
+void f14(MyString *s) {
+ [s compare:0]; // expected-warning {{Argument to 'MyString' method 'compare:' cannot be nil.}}
+}
+
// Test regular use of -autorelease
@interface TestAutorelease
-(NSString*) getString;
diff --git a/test/Analysis/NSWindow.m b/test/Analysis/NSWindow.m
index 76e265f1ebcb..404448574ea1 100644
--- a/test/Analysis/NSWindow.m
+++ b/test/Analysis/NSWindow.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-checker=deadcode.DeadStores -analyzer-store=region -analyzer-constraints=range -verify %s
// These declarations were reduced using Delta-Debugging from Foundation.h
// on Mac OS X. The test cases are below.
diff --git a/test/Analysis/NoReturn.m b/test/Analysis/NoReturn.m
index f3bfcf53190e..42952ed3a7cc 100644
--- a/test/Analysis/NoReturn.m
+++ b/test/Analysis/NoReturn.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
#include <stdarg.h>
diff --git a/test/Analysis/OSAtomic_mac.cpp b/test/Analysis/OSAtomic_mac.cpp
new file mode 100644
index 000000000000..8ad7b3c3da66
--- /dev/null
+++ b/test/Analysis/OSAtomic_mac.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,osx -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+
+// Test handling of OSAtomicCompareAndSwap when C++ inserts "no-op" casts and we
+// do a forced load and binding to the environment on an expression that would regularly
+// not have an environment binding. This previously triggered a crash (<rdar://problem/9339920>).
+// NOTE: It is critical that the function called is OSAtomicCompareAndSwapIntBarrier.
+bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile int *__theValue ) ;
+static int _rdar9339920_x = 0;
+int rdar9339920_aux();
+
+int rdar9339920_test() {
+ int rdar9339920_x = rdar9339920_aux();
+ if (rdar9339920_x != _rdar9339920_x) {
+ if (OSAtomicCompareAndSwapIntBarrier(_rdar9339920_x, rdar9339920_x, &_rdar9339920_x))
+ return 1;
+ }
+ return 0;
+}
+
diff --git a/test/Analysis/ObjCProperties.m b/test/Analysis/ObjCProperties.m
index 9362692bd75e..103db486b1c2 100644
--- a/test/Analysis/ObjCProperties.m
+++ b/test/Analysis/ObjCProperties.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic %s -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range %s -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic %s -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range %s -verify
// The point of this test cases is to exercise properties in the static
// analyzer
diff --git a/test/Analysis/ObjCRetSigs.m b/test/Analysis/ObjCRetSigs.m
index 93dae14ea198..9778e41d9ced 100644
--- a/test/Analysis/ObjCRetSigs.m
+++ b/test/Analysis/ObjCRetSigs.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=cocoa.MethodSigs -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=osx.cocoa.IncompatibleMethodTypes -verify %s
int printf(const char *, ...);
diff --git a/test/Analysis/PR2599.m b/test/Analysis/PR2599.m
index 89f36d27749c..b9e9d6b757de 100644
--- a/test/Analysis/PR2599.m
+++ b/test/Analysis/PR2599.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-constraints=basic -analyzer-store=basic -analyzer-check-objc-mem -fobjc-gc -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-constraints=range -analyzer-store=basic -analyzer-check-objc-mem -fobjc-gc -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-constraints=basic -analyzer-store=basic -analyzer-check-objc-mem -fobjc-gc -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-constraints=range -analyzer-store=region -analyzer-check-objc-mem -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=range -analyzer-store=basic -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic -fobjc-gc -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=range -analyzer-store=region -fobjc-gc -verify %s
typedef const void * CFTypeRef;
typedef const struct __CFString * CFStringRef;
diff --git a/test/Analysis/PR2978.m b/test/Analysis/PR2978.m
index c3b21f230807..c07150f0ce2a 100644
--- a/test/Analysis/PR2978.m
+++ b/test/Analysis/PR2978.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=cocoa.experimental.Dealloc %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=osx.cocoa.experimental.Dealloc %s -verify
// Tests for the checker which checks missing/extra ivar 'release' calls
// in dealloc.
diff --git a/test/Analysis/PR3991.m b/test/Analysis/PR3991.m
index 83ae19f4ba8c..23f199311e47 100644
--- a/test/Analysis/PR3991.m
+++ b/test/Analysis/PR3991.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
//===----------------------------------------------------------------------===//
// Delta-debugging produced forward declarations.
diff --git a/test/Analysis/PR7218.c b/test/Analysis/PR7218.c
index 635e56f053ec..1775e057f4db 100644
--- a/test/Analysis/PR7218.c
+++ b/test/Analysis/PR7218.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -verify %s
char PR7218(char a) {
char buf[2];
buf[0] = a;
diff --git a/test/Analysis/PR9741.cpp b/test/Analysis/PR9741.cpp
new file mode 100644
index 000000000000..e20e56c9406a
--- /dev/null
+++ b/test/Analysis/PR9741.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -cc1 -std=c++0x -Wuninitialized -verify %s
+
+void f() {
+ int a[] = { 1, 2, 3 };
+ unsigned int u = 0;
+ for (auto x : a)
+ ;
+}
diff --git a/test/Analysis/additive-folding-range-constraints.c b/test/Analysis/additive-folding-range-constraints.c
index a8ca5d2e351d..e342bb453cda 100644
--- a/test/Analysis/additive-folding-range-constraints.c
+++ b/test/Analysis/additive-folding-range-constraints.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-experimental-checks -verify -analyzer-constraints=range %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify -analyzer-constraints=range %s
// These are used to trigger warnings.
typedef typeof(sizeof(int)) size_t;
diff --git a/test/Analysis/additive-folding.c b/test/Analysis/additive-folding.c
index 096ffb9a5059..17d9db6ea23a 100644
--- a/test/Analysis/additive-folding.c
+++ b/test/Analysis/additive-folding.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-checker=core.experimental.UnreachableCode -verify -analyzer-constraints=basic %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-checker=core.experimental.UnreachableCode -verify -analyzer-constraints=range %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode,unix.experimental.Malloc -verify -analyzer-constraints=basic %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode,unix.experimental.Malloc -verify -analyzer-constraints=range %s
// These are used to trigger warnings.
typedef typeof(sizeof(int)) size_t;
diff --git a/test/Analysis/analyzer-stats.c b/test/Analysis/analyzer-stats.c
index 2a2e325acef8..9eeaade793c2 100644
--- a/test/Analysis/analyzer-stats.c
+++ b/test/Analysis/analyzer-stats.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks -analyzer-stats %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.DeadStores,debug.Stats -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
int foo();
diff --git a/test/Analysis/array-struct-region.c b/test/Analysis/array-struct-region.c
index 168423e0c2cd..37a6f75b3ca2 100644
--- a/test/Analysis/array-struct-region.c
+++ b/test/Analysis/array-struct-region.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,deadcode.experimental.UnreachableCode -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,deadcode.experimental.UnreachableCode -analyzer-store=region -analyzer-constraints=range -verify %s
int string_literal_init() {
char a[] = "abc";
diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c
index df9e9786fff3..6b8bb6c5f675 100644
--- a/test/Analysis/array-struct.c
+++ b/test/Analysis/array-struct.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CastToStruct -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CastToStruct -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CastToStruct -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CastToStruct -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental.CastToStruct -analyzer-store=region -analyzer-constraints=range -verify %s
struct s {
int data;
diff --git a/test/Analysis/auto-obj-dtors-cfg-output.cpp b/test/Analysis/auto-obj-dtors-cfg-output.cpp
index 4bcfccd120e2..c877061eb6ae 100644
--- a/test/Analysis/auto-obj-dtors-cfg-output.cpp
+++ b/test/Analysis/auto-obj-dtors-cfg-output.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -analyze -analyzer-checker=debug.DumpCFG -cfg-add-implicit-dtors %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=debug.DumpCFG -cfg-add-implicit-dtors %s 2>&1 | FileCheck %s
// XPASS: *
class A {
@@ -159,7 +159,7 @@ void test_catch_copy() {
// CHECK: Predecessors (0):
// CHECK: Successors (1): B1
// CHECK: [ B1 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: 3: const A &b = a;
// CHECK: 4: A()
@@ -175,9 +175,9 @@ void test_catch_copy() {
// CHECK: Predecessors (0):
// CHECK: Successors (1): B1
// CHECK: [ B1 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a[2];
-// CHECK: 3:
+// CHECK: 3:
// CHECK: 4: A b[0];
// CHECK: 5: [B1.2].~A() (Implicit destructor)
// CHECK: Predecessors (1): B2
@@ -189,15 +189,15 @@ void test_catch_copy() {
// CHECK: Predecessors (0):
// CHECK: Successors (1): B1
// CHECK: [ B1 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
-// CHECK: 3:
+// CHECK: 3:
// CHECK: 4: A c;
-// CHECK: 5:
+// CHECK: 5:
// CHECK: 6: A d;
// CHECK: 7: [B1.6].~A() (Implicit destructor)
// CHECK: 8: [B1.4].~A() (Implicit destructor)
-// CHECK: 9:
+// CHECK: 9:
// CHECK: 10: A b;
// CHECK: 11: [B1.10].~A() (Implicit destructor)
// CHECK: 12: [B1.2].~A() (Implicit destructor)
@@ -210,7 +210,7 @@ void test_catch_copy() {
// CHECK: Predecessors (0):
// CHECK: Successors (1): B3
// CHECK: [ B1 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B1.2].~A() (Implicit destructor)
// CHECK: 4: [B3.4].~A() (Implicit destructor)
@@ -224,9 +224,9 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B3
// CHECK: Successors (1): B0
// CHECK: [ B3 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
-// CHECK: 3:
+// CHECK: 3:
// CHECK: 4: A b;
// CHECK: 5: UV
// CHECK: T: if [B3.5]
@@ -240,7 +240,7 @@ void test_catch_copy() {
// CHECK: Successors (1): B7
// CHECK: [ B1 ]
// CHECK: l1:
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B1.2].~A() (Implicit destructor)
// CHECK: 4: [B6.2].~A() (Implicit destructor)
@@ -248,7 +248,7 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B2 B3
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A b;
// CHECK: 3: [B2.2].~A() (Implicit destructor)
// CHECK: 4: [B6.4].~A() (Implicit destructor)
@@ -272,16 +272,16 @@ void test_catch_copy() {
// CHECK: Successors (1): B6
// CHECK: [ B6 ]
// CHECK: l0:
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A b;
-// CHECK: 3:
+// CHECK: 3:
// CHECK: 4: A a;
// CHECK: 5: UV
// CHECK: T: if [B6.5]
// CHECK: Predecessors (2): B7 B5
// CHECK: Successors (2): B5 B4
// CHECK: [ B7 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: Predecessors (1): B8
// CHECK: Successors (1): B6
@@ -297,24 +297,23 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B2 B3
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B2.2].~A() (Implicit destructor)
// CHECK: Predecessors (1): B4
// CHECK: Successors (1): B1
// CHECK: [ B3 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B3.2].~A() (Implicit destructor)
// CHECK: Predecessors (1): B4
// CHECK: Successors (1): B1
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: 3: a
-// CHECK: 4: if ([B4.6])
-// CHECK:[B3.2]else
-// CHECK:[B2.2] 5: b.operator int()
+// CHECK: 4: A b = a;
+// CHECK: 5: b.operator int()
// CHECK: 6: [B4.5]
// CHECK: T: if [B4.6]
// CHECK: Predecessors (1): B5
@@ -327,14 +326,14 @@ void test_catch_copy() {
// CHECK: Successors (1): B8
// CHECK: [ B1 ]
// CHECK: 1: [B8.4].~A() (Implicit destructor)
-// CHECK: 2:
+// CHECK: 2:
// CHECK: 3: A e;
// CHECK: 4: [B1.3].~A() (Implicit destructor)
// CHECK: 5: [B8.2].~A() (Implicit destructor)
// CHECK: Predecessors (2): B2 B5
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A d;
// CHECK: 3: [B2.2].~A() (Implicit destructor)
// CHECK: 4: [B4.2].~A() (Implicit destructor)
@@ -348,14 +347,14 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B4
// CHECK: Successors (1): B0
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: UV
// CHECK: T: if [B4.3]
// CHECK: Predecessors (1): B8
// CHECK: Successors (2): B3 B2
// CHECK: [ B5 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A d;
// CHECK: 3: [B5.2].~A() (Implicit destructor)
// CHECK: 4: [B7.2].~A() (Implicit destructor)
@@ -369,21 +368,17 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B7
// CHECK: Successors (1): B0
// CHECK: [ B7 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: UV
// CHECK: T: if [B7.3]
// CHECK: Predecessors (1): B8
// CHECK: Successors (2): B6 B5
// CHECK: [ B8 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: 3: a
-// CHECK: 4: if ([B8.6]) {
-// CHECK:[B7.2] if ([B7.3])
-// CHECK:[B6.1][B5.2]} else {
-// CHECK:[B4.2] if ([B4.3])
-// CHECK:[B3.1][B2.2]}
+// CHECK: 4: A b = a;
// CHECK: 5: b.operator int()
// CHECK: 6: [B8.5]
// CHECK: T: if [B8.6]
@@ -402,8 +397,8 @@ void test_catch_copy() {
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
// CHECK: 1: a
-// CHECK: 2: while ([B2.4])
-// CHECK:[B4.2] 3: b.operator int()
+// CHECK: 2: A b = a;
+// CHECK: 3: b.operator int()
// CHECK: 4: [B2.3]
// CHECK: T: while [B2.4]
// CHECK: Predecessors (2): B3 B5
@@ -412,14 +407,14 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B4
// CHECK: Successors (1): B2
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B4.2].~A() (Implicit destructor)
// CHECK: 4: [B2.2].~A() (Implicit destructor)
// CHECK: Predecessors (1): B2
// CHECK: Successors (1): B3
// CHECK: [ B5 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: Predecessors (1): B6
// CHECK: Successors (1): B2
@@ -431,7 +426,7 @@ void test_catch_copy() {
// CHECK: Successors (1): B11
// CHECK: [ B1 ]
// CHECK: 1: [B2.2].~A() (Implicit destructor)
-// CHECK: 2:
+// CHECK: 2:
// CHECK: 3: A e;
// CHECK: 4: [B1.3].~A() (Implicit destructor)
// CHECK: 5: [B11.2].~A() (Implicit destructor)
@@ -439,14 +434,7 @@ void test_catch_copy() {
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
// CHECK: 1: a
-// CHECK: 2: while ([B2.4])
-// CHECK: {
-// CHECK:[B10.2] if ([B10.3])
-// CHECK: break;
-// CHECK: if ([B8.1])
-// CHECK: continue;
-// CHECK: if ([B6.1])
-// CHECK:[B5.1][B4.2] }
+// CHECK: 2: A b = a;
// CHECK: 3: b.operator int()
// CHECK: 4: [B2.3]
// CHECK: T: while [B2.4]
@@ -456,7 +444,7 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B4 B7
// CHECK: Successors (1): B2
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A d;
// CHECK: 3: [B4.2].~A() (Implicit destructor)
// CHECK: 4: [B10.2].~A() (Implicit destructor)
@@ -492,14 +480,14 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B10
// CHECK: Successors (1): B1
// CHECK: [ B10 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: UV
// CHECK: T: if [B10.3]
// CHECK: Predecessors (1): B2
// CHECK: Successors (2): B9 B8
// CHECK: [ B11 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: Predecessors (1): B12
// CHECK: Successors (1): B2
@@ -515,7 +503,7 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B2
// CHECK: Successors (2): B3 B0
// CHECK: [ B2 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: 3: [B2.2].~A() (Implicit destructor)
// CHECK: Predecessors (2): B3 B4
@@ -530,7 +518,7 @@ void test_catch_copy() {
// CHECK: Predecessors (0):
// CHECK: Successors (1): B11
// CHECK: [ B1 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A d;
// CHECK: 3: [B1.2].~A() (Implicit destructor)
// CHECK: 4: [B11.2].~A() (Implicit destructor)
@@ -542,7 +530,7 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B3 B6
// CHECK: Successors (2): B10 B1
// CHECK: [ B3 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B3.2].~A() (Implicit destructor)
// CHECK: 4: [B9.2].~A() (Implicit destructor)
@@ -575,7 +563,7 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B9
// CHECK: Successors (1): B1
// CHECK: [ B9 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A b;
// CHECK: 3: UV
// CHECK: T: if [B9.3]
@@ -585,7 +573,7 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B2
// CHECK: Successors (1): B9
// CHECK: [ B11 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: Predecessors (1): B12
// CHECK: Successors (1): B9
@@ -601,16 +589,16 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B3 B2
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: 3: a
-// CHECK: 4: switch ([B2.5])
-// CHECK:[B3.2] 5: b.operator int()
+// CHECK: 4: A b = a;
+// CHECK: 5: b.operator int()
// CHECK: T: switch [B2.5]
// CHECK: Predecessors (1): B4
// CHECK: Successors (1): B1
// CHECK: [ B3 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B3.2].~A() (Implicit destructor)
// CHECK: Predecessors (0):
@@ -623,26 +611,17 @@ void test_catch_copy() {
// CHECK: Successors (1): B2
// CHECK: [ B1 ]
// CHECK: 1: [B2.4].~A() (Implicit destructor)
-// CHECK: 2:
+// CHECK: 2:
// CHECK: 3: A g;
// CHECK: 4: [B1.3].~A() (Implicit destructor)
// CHECK: 5: [B2.2].~A() (Implicit destructor)
// CHECK: Predecessors (3): B3 B7 B2
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: 3: a
-// CHECK: 4: switch ([B2.5]) {
-// CHECK: case 0:
-// CHECK: {
-// CHECK:[B8.2] if ([B8.3])
-// CHECK: break;
-// CHECK: if ([B6.1])
-// CHECK:[B5.1][B4.2] }
-// CHECK: case 1:
-// CHECK: break;
-// CHECK:}
+// CHECK: 4: A b = a;
// CHECK: 5: b.operator int()
// CHECK: T: switch [B2.5]
// CHECK: Predecessors (1): B9
@@ -654,7 +633,7 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B2 B4
// CHECK: Successors (1): B1
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A f;
// CHECK: 3: [B4.2].~A() (Implicit destructor)
// CHECK: 4: [B8.2].~A() (Implicit destructor)
@@ -679,7 +658,7 @@ void test_catch_copy() {
// CHECK: Successors (1): B1
// CHECK: [ B8 ]
// CHECK: case 0:
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: UV
// CHECK: T: if [B8.3]
@@ -698,8 +677,8 @@ void test_catch_copy() {
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
// CHECK: 1: a
-// CHECK: 2: for (A a; [B2.4];)
-// CHECK:[B4.2] 3: b.operator int()
+// CHECK: 2: A b = a;
+// CHECK: 3: b.operator int()
// CHECK: 4: [B2.3]
// CHECK: T: for (...; [B2.4]; )
// CHECK: Predecessors (2): B3 B5
@@ -709,13 +688,13 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B4
// CHECK: Successors (1): B2
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A c;
// CHECK: 3: [B4.2].~A() (Implicit destructor)
// CHECK: Predecessors (1): B2
// CHECK: Successors (1): B3
// CHECK: [ B5 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
// CHECK: Predecessors (1): B6
// CHECK: Successors (1): B2
@@ -728,7 +707,7 @@ void test_catch_copy() {
// CHECK: [ B1 ]
// CHECK: 1: [B2.2].~A() (Implicit destructor)
// CHECK: 2: [B11.4].~A() (Implicit destructor)
-// CHECK: 3:
+// CHECK: 3:
// CHECK: 4: A f;
// CHECK: 5: [B1.4].~A() (Implicit destructor)
// CHECK: 6: [B11.2].~A() (Implicit destructor)
@@ -736,13 +715,7 @@ void test_catch_copy() {
// CHECK: Successors (1): B0
// CHECK: [ B2 ]
// CHECK: 1: b
-// CHECK: 2: for (A b; [B2.4];) {
-// CHECK:[B10.2] if ([B10.3])
-// CHECK: break;
-// CHECK: if ([B8.1])
-// CHECK: continue;
-// CHECK: if ([B6.1])
-// CHECK:[B5.1][B4.2]}
+// CHECK: 2: A c = b;
// CHECK: 3: c.operator int()
// CHECK: 4: [B2.3]
// CHECK: T: for (...; [B2.4]; )
@@ -753,7 +726,7 @@ void test_catch_copy() {
// CHECK: Predecessors (2): B4 B7
// CHECK: Successors (1): B2
// CHECK: [ B4 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A e;
// CHECK: 3: [B4.2].~A() (Implicit destructor)
// CHECK: 4: [B10.2].~A() (Implicit destructor)
@@ -788,16 +761,16 @@ void test_catch_copy() {
// CHECK: Predecessors (1): B10
// CHECK: Successors (1): B1
// CHECK: [ B10 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A d;
// CHECK: 3: UV
// CHECK: T: if [B10.3]
// CHECK: Predecessors (1): B2
// CHECK: Successors (2): B9 B8
// CHECK: [ B11 ]
-// CHECK: 1:
+// CHECK: 1:
// CHECK: 2: A a;
-// CHECK: 3:
+// CHECK: 3:
// CHECK: 4: A b;
// CHECK: Predecessors (1): B12
// CHECK: Successors (1): B2
@@ -833,3 +806,4 @@ void test_catch_copy() {
// CHECK: [ B0 (EXIT) ]
// CHECK: Predecessors (3): B2 B1 B3
// CHECK: Successors (0):
+
diff --git a/test/Analysis/base-init.cpp b/test/Analysis/base-init.cpp
index 800763b25b49..8fd7abcc3778 100644
--- a/test/Analysis/base-init.cpp
+++ b/test/Analysis/base-init.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -analyzer-inline-call -cfg-add-initializers -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -analyzer-inline-call -cfg-add-initializers -verify %s
+// XFAIL: *
class A {
int x;
diff --git a/test/Analysis/blocks.m b/test/Analysis/blocks.m
index e18d7cfb7be6..7a604ddb4d91 100644
--- a/test/Analysis/blocks.m
+++ b/test/Analysis/blocks.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from Mac OS X headers:
diff --git a/test/Analysis/bstring.c b/test/Analysis/bstring.c
index eb235430aac0..1f6839d33703 100644
--- a/test/Analysis/bstring.c
+++ b/test/Analysis/bstring.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CString -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core.experimental.CString -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core.experimental.CString -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core.experimental.CString -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,cplusplus.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,cplusplus.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,cplusplus.experimental.CString -analyzer-store=region -Wno-null-dereference -verify %s
//===----------------------------------------------------------------------===
// Declarations
@@ -15,7 +15,7 @@
// Some functions are implemented as builtins. These should be #defined as
// BUILTIN(f), which will prepend "__builtin_" if USE_BUILTINS is defined.
-// Functions that have variants and are also availabe as builtins should be
+// Functions that have variants and are also available as builtins should be
// declared carefully! See memcpy() for an example.
#ifdef USE_BUILTINS
@@ -129,10 +129,111 @@ void memcpy11() {
void memcpy12() {
char a[4] = {0};
memcpy(0, a, 0); // no-warning
+}
+
+void memcpy13() {
+ char a[4] = {0};
memcpy(a, 0, 0); // no-warning
}
//===----------------------------------------------------------------------===
+// mempcpy()
+//===----------------------------------------------------------------------===
+
+#define mempcpy BUILTIN(mempcpy)
+void *mempcpy(void *restrict s1, const void *restrict s2, size_t n);
+
+void mempcpy0 () {
+ char src[] = {1, 2, 3, 4};
+ char dst[5] = {0};
+
+ mempcpy(dst, src, 4); // no-warning
+
+ if (mempcpy(dst, src, 4) != &dst[4]) {
+ (void)*(char*)0; // no-warning
+ }
+
+ if (dst[0] != 0)
+ (void)*(char*)0; // expected-warning{{null}}
+}
+
+void mempcpy1 () {
+ char src[] = {1, 2, 3, 4};
+ char dst[10];
+
+ mempcpy(dst, src, 5); // expected-warning{{Byte string function accesses out-of-bound array element}}
+}
+
+void mempcpy2 () {
+ char src[] = {1, 2, 3, 4};
+ char dst[1];
+
+ mempcpy(dst, src, 4); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void mempcpy3 () {
+ char src[] = {1, 2, 3, 4};
+ char dst[3];
+
+ mempcpy(dst+1, src+2, 2); // no-warning
+}
+
+void mempcpy4 () {
+ char src[] = {1, 2, 3, 4};
+ char dst[10];
+
+ mempcpy(dst+2, src+2, 3); // expected-warning{{Byte string function accesses out-of-bound array element}}
+}
+
+void mempcpy5() {
+ char src[] = {1, 2, 3, 4};
+ char dst[3];
+
+ mempcpy(dst+2, src+2, 2); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void mempcpy6() {
+ int a[4] = {0};
+ mempcpy(a, a, 8); // expected-warning{{overlapping}}
+}
+
+void mempcpy7() {
+ int a[4] = {0};
+ mempcpy(a+2, a+1, 8); // expected-warning{{overlapping}}
+}
+
+void mempcpy8() {
+ int a[4] = {0};
+ mempcpy(a+1, a+2, 8); // expected-warning{{overlapping}}
+}
+
+void mempcpy9() {
+ int a[4] = {0};
+ mempcpy(a+2, a+1, 4); // no-warning
+ mempcpy(a+1, a+2, 4); // no-warning
+}
+
+void mempcpy10() {
+ char a[4] = {0};
+ mempcpy(0, a, 4); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void mempcpy11() {
+ char a[4] = {0};
+ mempcpy(a, 0, 4); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void mempcpy12() {
+ char a[4] = {0};
+ mempcpy(0, a, 0); // no-warning
+}
+
+void mempcpy13() {
+ char a[4] = {0};
+ mempcpy(a, 0, 0); // no-warning
+}
+
+//===----------------------------------------------------------------------===
// memmove()
//===----------------------------------------------------------------------===
diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c
index 1df30c9e3555..35d97fec675d 100644
--- a/test/Analysis/casts.c
+++ b/test/Analysis/casts.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
// Test if the 'storage' region gets properly initialized after it is cast to
// 'struct sockaddr *'.
diff --git a/test/Analysis/casts.m b/test/Analysis/casts.m
index a6f11926818d..d073dff963fc 100644
--- a/test/Analysis/casts.m
+++ b/test/Analysis/casts.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
// Test function pointer casts. Currently we track function addresses using
// loc::FunctionVal. Because casts can be arbitrary, do we need to model
diff --git a/test/Analysis/cfref_PR2519.c b/test/Analysis/cfref_PR2519.c
index 94475bdcdf2d..280676330a46 100644
--- a/test/Analysis/cfref_PR2519.c
+++ b/test/Analysis/cfref_PR2519.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
typedef unsigned char Boolean;
typedef signed long CFIndex;
diff --git a/test/Analysis/cfref_rdar6080742.c b/test/Analysis/cfref_rdar6080742.c
index debc1d8990cc..aceefbe54872 100644
--- a/test/Analysis/cfref_rdar6080742.c
+++ b/test/Analysis/cfref_rdar6080742.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
// This test case was reported in <rdar:problem/6080742>.
// It tests path-sensitivity with respect to '!(cfstring != 0)' (negation of inequality).
diff --git a/test/Analysis/chroot.c b/test/Analysis/chroot.c
index 5b98a7197408..7a584da6c05c 100644
--- a/test/Analysis/chroot.c
+++ b/test/Analysis/chroot.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.experimental.Chroot -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.experimental.Chroot -analyzer-store region -verify %s
extern int chroot(const char* path);
extern int chdir(const char* path);
diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c
index c8bdce015363..b125a502f1df 100644
--- a/test/Analysis/complex.c
+++ b/test/Analysis/complex.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
#include <stdint.h>
diff --git a/test/Analysis/concrete-address.c b/test/Analysis/concrete-address.c
index 13afe0cbebd4..a722ab092e2c 100644
--- a/test/Analysis/concrete-address.c
+++ b/test/Analysis/concrete-address.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
void foo() {
int *p = (int*) 0x10000; // Should not crash here.
diff --git a/test/Analysis/conditional-op-missing-lhs.c b/test/Analysis/conditional-op-missing-lhs.c
deleted file mode 100644
index 51d40f2a040e..000000000000
--- a/test/Analysis/conditional-op-missing-lhs.c
+++ /dev/null
@@ -1,26 +0,0 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.DeadStores -warn-uninit-values -verify %s
-
-void f1()
-{
- int i;
-
- int j = i ? : 1; // expected-warning{{use of uninitialized variable}} //expected-warning{{Value stored to 'j' during its initialization is never read}}
-}
-
-void *f2(int *i)
-{
- return i ? : 0;
-}
-
-void *f3(int *i)
-{
- int a;
-
- return &a ? : i;
-}
-
-void f4()
-{
- char c[1 ? : 2];
-}
-
diff --git a/test/Analysis/constant-folding.c b/test/Analysis/constant-folding.c
index 33b48f5164cb..d3cbf9c56479 100644
--- a/test/Analysis/constant-folding.c
+++ b/test/Analysis/constant-folding.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode -Wno-null-dereference -verify %s
// Trigger a warning if the analyzer reaches this point in the control flow.
#define WARN ((void)*(char*)0)
diff --git a/test/Analysis/cxx-crashes.cpp b/test/Analysis/cxx-crashes.cpp
index c9775df7e2d0..17fc74d06f46 100644
--- a/test/Analysis/cxx-crashes.cpp
+++ b/test/Analysis/cxx-crashes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
int f1(char *dst) {
char *p = dst + 4;
@@ -43,3 +43,14 @@ void *f(S* w) {
}
}
+
+namespace {
+
+struct C {
+ void *p;
+ static void f();
+};
+
+void C::f() { }
+
+}
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c
index 39394c6354a4..85ea1ee2cb64 100644
--- a/test/Analysis/dead-stores.c
+++ b/test/Analysis/dead-stores.c
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.DeadStores,core.experimental.IdempotentOps -analyzer-check-objc-mem -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.DeadStores,core.experimental.IdempotentOps -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.DeadStores,core.experimental.IdempotentOps -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.DeadStores,core.experimental.IdempotentOps -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.DeadStores,core.experimental.IdempotentOps -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=basic -analyzer-constraints=basic -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=basic -analyzer-constraints=range -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=region -analyzer-constraints=basic -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.IdempotentOperations -analyzer-store=region -analyzer-constraints=range -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
void f1() {
int k, y; // expected-warning{{unused variable 'k'}} expected-warning{{unused variable 'y'}}
diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp
index 8477b701fa0c..932e94092847 100644
--- a/test/Analysis/dead-stores.cpp
+++ b/test/Analysis/dead-stores.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -fexceptions -analyze -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -fexceptions -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -fexceptions -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -fexceptions -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -fexceptions -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=basic -analyzer-constraints=basic -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=basic -analyzer-constraints=range -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=region -analyzer-constraints=basic -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-store=region -analyzer-constraints=range -analyzer-checker=deadcode.DeadStores -verify -Wno-unreachable-code %s
//===----------------------------------------------------------------------===//
// Basic dead store checking (but in C++ mode).
diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m
index 8e13a97393e9..3a06a8adeb0d 100644
--- a/test/Analysis/dead-stores.m
+++ b/test/Analysis/dead-stores.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=core.DeadStores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=deadcode.DeadStores -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@@ -25,7 +25,7 @@ typedef struct _NSPoint {} NSRange;
extern NSString *NSAlignmentBinding;
// This test case was reported as a false positive due to a bug in the
-// LiveVariables <-> DeadStores interplay. We should not flag a warning
+// LiveVariables <-> deadcode.DeadStores interplay. We should not flag a warning
// here. The test case was reported in:
// http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html
void DeadStoreTest(NSObject *anObject) {
diff --git a/test/Analysis/delegates.m b/test/Analysis/delegates.m
index 194a64a85516..218083598919 100644
--- a/test/Analysis/delegates.m
+++ b/test/Analysis/delegates.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===//
diff --git a/test/Analysis/derived-to-base.cpp b/test/Analysis/derived-to-base.cpp
index 2a9244ef34b2..f65b9db17b65 100644
--- a/test/Analysis/derived-to-base.cpp
+++ b/test/Analysis/derived-to-base.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region %s
class A {
protected:
diff --git a/test/Analysis/dtor.cpp b/test/Analysis/dtor.cpp
index ea5b04684d7f..dfd438ed405d 100644
--- a/test/Analysis/dtor.cpp
+++ b/test/Analysis/dtor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -analyzer-inline-call -cfg-add-implicit-dtors -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -analyzer-inline-call -cfg-add-implicit-dtors -verify %s
class A {
public:
diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c
index ba66015d746e..d41202a1f07f 100644
--- a/test/Analysis/elementtype.c
+++ b/test/Analysis/elementtype.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region %s
typedef struct added_obj_st {
int type;
diff --git a/test/Analysis/exercise-ps.c b/test/Analysis/exercise-ps.c
index f2b15bff3159..02772a148b6b 100644
--- a/test/Analysis/exercise-ps.c
+++ b/test/Analysis/exercise-ps.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
//
// Just exercise the analyzer on code that has at one point caused issues
// (i.e., no assertions or crashes).
diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c
index c7e223138b1c..0991d00868cf 100644
--- a/test/Analysis/fields.c
+++ b/test/Analysis/fields.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem %s -analyzer-store=basic -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=basic -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=region -verify
unsigned foo();
typedef struct bf { unsigned x:2; } bf;
diff --git a/test/Analysis/flat-store.c b/test/Analysis/flat-store.c
index bb274b0d5dfa..bf93c724400f 100644
--- a/test/Analysis/flat-store.c
+++ b/test/Analysis/flat-store.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=flat -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=flat -Wno-null-dereference -verify %s
#define FAIL ((void)*(char*)0)
struct simple { int x; };
diff --git a/test/Analysis/free.c b/test/Analysis/free.c
index 8aba4a05f0bf..d57da69ba456 100644
--- a/test/Analysis/free.c
+++ b/test/Analysis/free.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,unix.experimental.Malloc -fblocks -verify %s
void free(void *);
void t1 () {
diff --git a/test/Analysis/func.c b/test/Analysis/func.c
index e4e20a0bed14..0694f7bd4c26 100644
--- a/test/Analysis/func.c
+++ b/test/Analysis/func.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
void f(void) {
void (*p)(void);
diff --git a/test/Analysis/idempotent-operations-limited-loops.c b/test/Analysis/idempotent-operations-limited-loops.c
index e4c34cdead35..47a1f2854c74 100644
--- a/test/Analysis/idempotent-operations-limited-loops.c
+++ b/test/Analysis/idempotent-operations-limited-loops.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-max-loop 3 -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-max-loop 4 -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,deadcode.IdempotentOperations -analyzer-max-loop 3 -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,deadcode.IdempotentOperations -analyzer-max-loop 4 -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=core,deadcode.IdempotentOperations %s -verify
void always_warning() { int *p = 0; *p = 0xDEADBEEF; } // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
diff --git a/test/Analysis/idempotent-operations.c b/test/Analysis/idempotent-operations.c
index b47394c1626b..10bd9ff3198c 100644
--- a/test/Analysis/idempotent-operations.c
+++ b/test/Analysis/idempotent-operations.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=deadcode.IdempotentOperations -verify %s
+// RUN: %clang --analyze -Xclang -analyzer-disable-checker=deadcode.DeadStores -fblocks -Xclang -verify %s -o %t
// Basic tests
@@ -82,8 +83,8 @@ void bailout() {
typedef unsigned uintptr_t;
void kill_at_assign() {
short array[2];
- uintptr_t x = array; // expected-warning{{incompatible pointer to integer conversion}}
- short *p = x; // expected-warning{{incompatible integer to pointer conversion}}
+ uintptr_t x = (uintptr_t) array;
+ short *p = (short *) x;
// The following branch should be infeasible.
if (!(p = &array[0])) { // expected-warning{{Assigned value is always the same as the existing value}}
@@ -175,7 +176,7 @@ int false6() {
// Check that assignments filter out false positives correctly
int false7() {
- int zero = 0; // psuedo-constant
+ int zero = 0; // pseudo-constant
int one = 1;
int a = 55;
diff --git a/test/Analysis/idempotent-operations.cpp b/test/Analysis/idempotent-operations.cpp
index c213dc690e44..9d22909ed37e 100644
--- a/test/Analysis/idempotent-operations.cpp
+++ b/test/Analysis/idempotent-operations.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=deadcode.IdempotentOperations -verify %s
// C++ specific false positives
@@ -13,3 +13,22 @@ void false1() {
test(five * a); // expected-warning {{The right operand to '*' is always 0}}
b = 4;
}
+
+// Test not flagging idempotent operations because we aborted the analysis
+// of a path because of an unsupported construct.
+struct RDar9219143_Foo {
+ ~RDar9219143_Foo();
+ operator bool() const;
+};
+
+RDar9219143_Foo foo();
+unsigned RDar9219143_bar();
+void RDar9219143_test() {
+ unsigned i, e;
+ for (i = 0, e = RDar9219143_bar(); i != e; ++i)
+ if (foo())
+ break;
+ if (i == e) // no-warning
+ return;
+}
+
diff --git a/test/Analysis/idempotent-operations.m b/test/Analysis/idempotent-operations.m
index a77e2cbf8719..8f534940c975 100644
--- a/test/Analysis/idempotent-operations.m
+++ b/test/Analysis/idempotent-operations.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=deadcode.IdempotentOperations -verify %s
typedef signed char BOOL;
typedef unsigned long NSUInteger;
@@ -40,3 +40,15 @@ void pr9116(NSObject *placeholder) {
int x = placeholder.media.locked = placeholder ? 1 : 0;
}
+// <rdar://problem/9130239>: Test that calling property setters doesn't
+// trigger an assertion failure when the object is nil.
+@interface RDar9130239
+@property (assign) id delegate;
+@end
+
+void test_RDar9130239(RDar9130239 *x) {
+ if (x)
+ return;
+ x.delegate = x; // no-warning
+}
+
diff --git a/test/Analysis/initializer.cpp b/test/Analysis/initializer.cpp
index 2fa3a9eb86a7..656a8bf8eed8 100644
--- a/test/Analysis/initializer.cpp
+++ b/test/Analysis/initializer.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -cfg-add-initializers -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -cfg-add-initializers -verify %s
class A {
int x;
diff --git a/test/Analysis/inline.c b/test/Analysis/inline.c
index d7a599a76545..2aac15661b14 100644
--- a/test/Analysis/inline.c
+++ b/test/Analysis/inline.c
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
+// XFAIL: *
int test1_f1() {
int y = 1;
diff --git a/test/Analysis/inline2.c b/test/Analysis/inline2.c
index efdb75cc6535..97e479d4b292 100644
--- a/test/Analysis/inline2.c
+++ b/test/Analysis/inline2.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
// 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 884b3ed9dc25..9c8e26ece51b 100644
--- a/test/Analysis/inline3.c
+++ b/test/Analysis/inline3.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
// 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 5a1d193beb29..c428aad5ec4b 100644
--- a/test/Analysis/inline4.c
+++ b/test/Analysis/inline4.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
int g(int a) {
return a;
diff --git a/test/Analysis/iterators.cpp b/test/Analysis/iterators.cpp
new file mode 100644
index 000000000000..c3416f5beac1
--- /dev/null
+++ b/test/Analysis/iterators.cpp
@@ -0,0 +1,105 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.experimental.Iterators -verify %s
+// XFAIL: win32
+
+#include <vector>
+
+void fum(std::vector<int>::iterator t);
+
+void foo1()
+{
+ // iterators that are defined but not initialized
+ std::vector<int>::iterator it2;
+ fum(it2); // expected-warning{{Use of iterator that is not defined}}
+ *it2; // expected-warning{{Use of iterator that is not defined}}
+
+ std::vector<int> v, vv;
+ std::vector<int>::iterator it = v.begin();
+ fum(it); // no-warning
+ *it; // no-warning
+ // a valid iterator plus an integer is still valid
+ std::vector<int>::iterator et = it + 3;
+ while(it != et) { // no-warning
+ if (*it == 0) // no-warning
+ *it = 1; // no-warning
+ }
+ // iterators from different instances Cannot be compared
+ et = vv.end();
+ while(it != et) // expected-warning{{Cannot compare iterators from different containers}}
+ ;
+
+ for( std::vector<int>::iterator it = v.begin(); it != v.end(); it++ ) { // no-warning
+ if (*it == 1) // no-warning
+ *it = 0; // no-warning
+ }
+
+ // copying a valid iterator results in a valid iterator
+ et = it; // no-warning
+ *et; // no-warning
+
+ // any combo of valid iterator plus a constant is still valid
+ et = it + 2; // no-warning
+ *et; // no-warning
+ et = 2 + it; // no-warning
+ *et; // no-warning
+ et = 2 + 4 + it; // no-warning
+ *et; // no-warning
+
+ // calling insert invalidates unless assigned to as result, but still
+ // invalidates other iterators on the same instance
+ it = v.insert( it, 1 ); // no-warning
+ *et; // expected-warning{{Attempt to use an iterator made invalid by call to 'insert'}}
+ ++it; // no-warning
+
+ // calling erase invalidates the iterator
+ v.erase(it); // no-warning
+ et = it + 2; // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ et = 2 + it + 2; // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ et = 2 + it; // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ ++it; // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ it++; // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ *it; // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ it = v.insert( it, 1 ); // expected-warning{{Attempt to use an iterator made invalid by call to 'erase'}}
+ // now valid after return from insert
+ *it; // no-warning
+}
+
+// work with using namespace
+void foo2()
+{
+ using namespace std;
+
+ vector<int> v;
+ vector<int>::iterator it = v.begin();
+ *it; // no-warning
+ v.insert( it, 1 ); // no-warning
+ *it; // expected-warning{{Attempt to use an iterator made invalid by call to 'insert'}}
+ it = v.insert( it, 1 ); // expected-warning{{Attempt to use an iterator made invalid by call to 'insert'}}
+ *it; // no-warning
+}
+
+// using reserve eliminates some warnings
+void foo3()
+{
+ std::vector<long> v;
+ std::vector<long>::iterator b = v.begin();
+ v.reserve( 100 );
+
+ // iterator assigned before the reserve is still invalidated
+ *b; // expected-warning{{Attempt to use an iterator made invalid by call to 'reserve'}}
+ b = v.begin();
+ v.insert( b, 1 ); // no-warning
+
+ // iterator after assignment is still valid (probably)
+ *b; // no-warning
+}
+
+// check on copying one iterator to another
+void foo4()
+{
+ std::vector<float> v, vv;
+ std::vector<float>::iterator it = v.begin();
+ *it; // no-warning
+ v = vv;
+ *it; // expected-warning{{Attempt to use an iterator made invalid by copying another container to its container}}
+}
+
diff --git a/test/Analysis/lvalue.cpp b/test/Analysis/lvalue.cpp
index f19c59d9d258..0cc42f50372b 100644
--- a/test/Analysis/lvalue.cpp
+++ b/test/Analysis/lvalue.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
int f1() {
int x = 0, y = 1;
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index 2ffa1033598d..f9af199b5fad 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.UnreachableCode,core.experimental.CastSize -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.experimental.UnreachableCode,core.experimental.CastSize,unix.experimental.Malloc -analyzer-store=region -verify %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
void free(void *);
@@ -33,6 +33,17 @@ void f2() {
free(p); // expected-warning{{Try to free a memory block that has been released}}
}
+void f2_realloc_0() {
+ int *p = malloc(12);
+ realloc(p,0);
+ realloc(p,0); // expected-warning{{Try to free a memory block that has been released}}
+}
+
+void f2_realloc_1() {
+ int *p = malloc(12);
+ int *q = realloc(p,0); // expected-warning{{Assigned value is garbage or undefined}}
+}
+
// ownership attributes tests
void naf1() {
int *p = my_malloc3(12);
@@ -166,6 +177,15 @@ void f6() {
free(p);
}
+void f6_realloc() {
+ int *p = malloc(12);
+ if (!p)
+ return; // no-warning
+ else
+ realloc(p,0);
+}
+
+
char *doit2();
void pr6069() {
char *buf = doit2();
@@ -182,6 +202,12 @@ void f7() {
x[0] = 'a'; // expected-warning{{Use dynamically allocated memory after it is freed.}}
}
+void f7_realloc() {
+ char *x = (char*) malloc(4);
+ realloc(x,0);
+ x[0] = 'a'; // expected-warning{{Use dynamically allocated memory after it is freed.}}
+}
+
void PR6123() {
int *x = malloc(11); // expected-warning{{Cast a region whose size is not a multiple of the destination type size.}}
}
diff --git a/test/SemaObjC/method-arg-decay.m b/test/Analysis/method-arg-decay.m
index 6e11e97898d6..9ce88b242327 100644
--- a/test/SemaObjC/method-arg-decay.m
+++ b/test/Analysis/method-arg-decay.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyzer-check-objc-mem -verify %s
+// RUN: %clang_cc1 -analyzer-checker=core -verify %s
typedef signed char BOOL;
typedef int NSInteger;
typedef unsigned int NSUInteger;
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index b5b81e3402a1..323fffebcdbe 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-inline-call -analyzer-store region -verify %s
// XFAIL: *
struct A {
diff --git a/test/Analysis/misc-ps-64.m b/test/Analysis/misc-ps-64.m
index bdb12c963f95..1cd738292781 100644
--- a/test/Analysis/misc-ps-64.m
+++ b/test/Analysis/misc-ps-64.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=basic -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=basic -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
// <rdar://problem/6440393> - A bunch of misc. failures involving evaluating
// these expressions and building CFGs. These tests are here to prevent
diff --git a/test/Analysis/misc-ps-basic-store.m b/test/Analysis/misc-ps-basic-store.m
index 55042c142584..a29326d8b0e7 100644
--- a/test/Analysis/misc-ps-basic-store.m
+++ b/test/Analysis/misc-ps-basic-store.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify -fblocks %s
//---------------------------------------------------------------------------
// Test case 'checkaccess_union' differs for region store and basic store.
diff --git a/test/Analysis/misc-ps-eager-assume.m b/test/Analysis/misc-ps-eager-assume.m
index a0323f480ccc..649c4b07f543 100644
--- a/test/Analysis/misc-ps-eager-assume.m
+++ b/test/Analysis/misc-ps-eager-assume.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s -analyzer-eagerly-assume
// Delta-reduced header stuff (needed for test cases).
typedef signed char BOOL;
@@ -81,7 +81,7 @@ void pr3836(int *a, int *b) {
//===---------------------------------------------------------------------===//
// <rdar://problem/7342806>
-// This false positive occured because the symbolic constraint on a short was
+// This false positive occurred because the symbolic constraint on a short was
// not maintained via sign extension. The analyzer doesn't properly handle
// the sign extension, but now tracks the constraint. This particular
// case relies on -analyzer-eagerly-assume because of the expression
diff --git a/test/Analysis/misc-ps-flat-store.c b/test/Analysis/misc-ps-flat-store.c
index 8cbcecf51ff0..e6369cbfb079 100644
--- a/test/Analysis/misc-ps-flat-store.c
+++ b/test/Analysis/misc-ps-flat-store.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=flat -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=flat -verify %s
void f1() {
int x;
diff --git a/test/Analysis/misc-ps-ranges.m b/test/Analysis/misc-ps-ranges.m
index 01a228a5dec2..f2851f3257dd 100644
--- a/test/Analysis/misc-ps-ranges.m
+++ b/test/Analysis/misc-ps-ranges.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -analyzer-constraints=range -verify -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify -fblocks %s
// <rdar://problem/6776949>
// main's 'argc' argument is always > 0
diff --git a/test/Analysis/misc-ps-region-store-i386.m b/test/Analysis/misc-ps-region-store-i386.m
index 90183257d2b2..2988dca4abd9 100644
--- a/test/Analysis/misc-ps-region-store-i386.m
+++ b/test/Analysis/misc-ps-region-store-i386.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks %s
// Here is a case where a pointer is treated as integer, invalidated as an
// integer, and then used again as a pointer. This test just makes sure
diff --git a/test/Analysis/misc-ps-region-store-x86_64.m b/test/Analysis/misc-ps-region-store-x86_64.m
index a440bc55ae19..9f1498ef47f4 100644
--- a/test/Analysis/misc-ps-region-store-x86_64.m
+++ b/test/Analysis/misc-ps-region-store-x86_64.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks %s
// Here is a case where a pointer is treated as integer, invalidated as an
// integer, and then used again as a pointer. This test just makes sure
diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp
index 7c296fd3db9b..b122bffaaec0 100644
--- a/test/Analysis/misc-ps-region-store.cpp
+++ b/test/Analysis/misc-ps-region-store.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
// Test basic handling of references.
char &test1_aux();
@@ -240,3 +240,158 @@ void test_namespace() {
int x = i;
}
+// Test handling methods that accept references as parameters, and that
+// variables are properly invalidated.
+class RDar9203355 {
+ bool foo(unsigned valA, long long &result) const;
+ bool foo(unsigned valA, int &result) const;
+};
+bool RDar9203355::foo(unsigned valA, int &result) const {
+ long long val;
+ if (foo(valA, val) ||
+ (int)val != val) // no-warning
+ return true;
+ result = val; // no-warning
+ return false;
+}
+
+// Test handling of new[].
+void rdar9212512() {
+ int *x = new int[10];
+ for (unsigned i = 0 ; i < 2 ; ++i) {
+ // This previously triggered an uninitialized values warning.
+ x[i] = 1; // no-warning
+ }
+}
+
+// Test basic support for dynamic_cast<>.
+struct Rdar9212495_C { virtual void bar() const; };
+class Rdar9212495_B : public Rdar9212495_C {};
+class Rdar9212495_A : public Rdar9212495_B {};
+const Rdar9212495_A& rdar9212495(const Rdar9212495_C* ptr) {
+ const Rdar9212495_A& val = dynamic_cast<const Rdar9212495_A&>(*ptr);
+
+ if (&val == 0) {
+ val.bar(); // FIXME: This should eventually be a null dereference.
+ }
+
+ return val;
+}
+
+// Test constructors invalidating arguments. Previously this raised
+// an uninitialized value warning.
+extern "C" void __attribute__((noreturn)) PR9645_exit(int i);
+
+class PR9645_SideEffect
+{
+public:
+ PR9645_SideEffect(int *pi); // caches pi in i_
+ void Read(int *pi); // copies *pi into *i_
+private:
+ int *i_;
+};
+
+void PR9645() {
+ int i;
+
+ PR9645_SideEffect se(&i);
+ int j = 1;
+ se.Read(&j); // this has a side-effect of initializing i.
+
+ PR9645_exit(i); // no-warning
+}
+
+PR9645_SideEffect::PR9645_SideEffect(int *pi) : i_(pi) {}
+void PR9645_SideEffect::Read(int *pi) { *i_ = *pi; }
+
+// Invalidate fields during C++ method calls.
+class RDar9267815 {
+ int x;
+ void test();
+ void test_pos();
+ void test2();
+ void invalidate();
+};
+
+void RDar9267815::test_pos() {
+ int *p = 0;
+ if (x == 42)
+ return;
+ *p = 0xDEADBEEF; // expected-warning {{null}}
+}
+void RDar9267815::test() {
+ int *p = 0;
+ if (x == 42)
+ return;
+ if (x == 42)
+ *p = 0xDEADBEEF; // no-warning
+}
+
+void RDar9267815::test2() {
+ int *p = 0;
+ if (x == 42)
+ return;
+ invalidate();
+ if (x == 42)
+ *p = 0xDEADBEEF; // expected-warning {{null}}
+}
+
+// Test reference parameters.
+void test_ref_double_aux(double &Value);
+float test_ref_double() {
+ double dVal;
+ test_ref_double_aux(dVal);
+ // This previously warned because 'dVal' was thought to be uninitialized.
+ float Val = (float)dVal; // no-warning
+ return Val;
+}
+
+// Test invalidation of class fields.
+class TestInvalidateClass {
+public:
+ int x;
+};
+
+void test_invalidate_class_aux(TestInvalidateClass &x);
+
+int test_invalidate_class() {
+ TestInvalidateClass y;
+ test_invalidate_class_aux(y);
+ return y.x; // no-warning
+}
+
+// Test correct pointer arithmetic using 'p--'. This is to warn that we
+// were loading beyond the written characters in buf.
+char *RDar9269695(char *dst, unsigned int n)
+{
+ char buff[40], *p;
+
+ p = buff;
+ do
+ *p++ = '0' + n % 10;
+ while (n /= 10);
+
+ do
+ *dst++ = *--p; // no-warning
+ while (p != buff);
+
+ return dst;
+}
+
+// Test that we invalidate byref arguments passed to constructors.
+class TestInvalidateInCtor {
+public:
+ TestInvalidateInCtor(unsigned &x);
+};
+
+unsigned test_invalidate_in_ctor() {
+ unsigned x;
+ TestInvalidateInCtor foo(x);
+ return x; // no-warning
+}
+unsigned test_invalidate_in_ctor_new() {
+ unsigned x;
+ delete (new TestInvalidateInCtor(x));
+ return x; // no-warning
+}
+
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m
index 37e1a12c87bd..be0356d176b5 100644
--- a/test/Analysis/misc-ps-region-store.m
+++ b/test/Analysis/misc-ps-region-store.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental.IdempotentOps,core.experimental.CastToStruct,core.experimental.ReturnPtrRange,core.experimental.ReturnPtrRange,core.experimental.ArrayBound -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-checker=core.experimental.IdempotentOps,core.experimental.CastToStruct,core.experimental.ReturnPtrRange,core.experimental.ArrayBound -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental.CastToStruct,security.experimental.ReturnPtrRange,security.experimental.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental.CastToStruct,security.experimental.ReturnPtrRange,security.experimental.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
typedef long unsigned int size_t;
void *memcpy(void *, const void *, size_t);
@@ -1237,3 +1237,65 @@ void pr9048(pr9048_cdev_t dev, struct pr9048_diskslices * ssp, unsigned int slic
}
}
+// Test Store reference counting in the presence of Lazy compound values.
+// This previously caused an infinite recursion.
+typedef struct {} Rdar_9103310_A;
+typedef struct Rdar_9103310_B Rdar_9103310_B_t;
+struct Rdar_9103310_B {
+ unsigned char Rdar_9103310_C[101];
+};
+void Rdar_9103310_E(Rdar_9103310_A * x, struct Rdar_9103310_C * b) { // expected-warning {{declaration of 'struct Rdar_9103310_C' will not be visible outside of this function}}
+ char Rdar_9103310_D[4][4] = { "a", "b", "c", "d"};
+ int i;
+ Rdar_9103310_B_t *y = (Rdar_9103310_B_t *) x;
+ for (i = 0; i < 101; i++) {
+ Rdar_9103310_F(b, "%2d%s ", (y->Rdar_9103310_C[i]) / 4, Rdar_9103310_D[(y->Rdar_9103310_C[i]) % 4]); // expected-warning {{implicit declaration of function 'Rdar_9103310_F' is invalid in C99}}
+ }
+}
+
+// Test handling binding lazy compound values to a region and then have
+// specific elements have other bindings.
+int PR9455() {
+ char arr[4] = "000";
+ arr[0] = '1';
+ if (arr[1] == '0')
+ return 1;
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ return 1;
+}
+int PR9455_2() {
+ char arr[4] = "000";
+ arr[0] = '1';
+ if (arr[1] == '0') {
+ int *p = 0;
+ *p = 0xDEADBEEF; // expected-warning {{null}}
+ }
+ return 1;
+}
+
+// Test initialization of substructs via lazy compound values.
+typedef float RDar9163742_Float;
+
+typedef struct {
+ RDar9163742_Float x, y;
+} RDar9163742_Point;
+typedef struct {
+ RDar9163742_Float width, height;
+} RDar9163742_Size;
+typedef struct {
+ RDar9163742_Point origin;
+ RDar9163742_Size size;
+} RDar9163742_Rect;
+
+extern RDar9163742_Rect RDar9163742_RectIntegral(RDar9163742_Rect);
+
+RDar9163742_Rect RDar9163742_IntegralRect(RDar9163742_Rect frame)
+{
+ RDar9163742_Rect integralFrame;
+ integralFrame.origin.x = frame.origin.x;
+ integralFrame.origin.y = frame.origin.y;
+ integralFrame.size = frame.size;
+ return RDar9163742_RectIntegral(integralFrame); // no-warning; all fields initialized
+}
+
diff --git a/test/Analysis/misc-ps-region-store.mm b/test/Analysis/misc-ps-region-store.mm
index a2df723c794b..08f3e2486f8a 100644
--- a/test/Analysis/misc-ps-region-store.mm
+++ b/test/Analysis/misc-ps-region-store.mm
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
//===------------------------------------------------------------------------------------------===//
// This files tests our path-sensitive handling of Objective-c++ files.
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index db4fa02ff17c..9de4afb0ae98 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -1,12 +1,12 @@
// NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued.
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core.experimental,cocoa.AtSync -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-disable-checker=unix.experimental.Malloc -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,deadcode.IdempotentOperations,core.experimental,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
#ifndef __clang_analyzer__
#error __clang__analyzer__ not defined
@@ -1269,3 +1269,35 @@ void pr9287_c(int type, int *p) {
}
}
+void test_switch() {
+ switch (4) {
+ case 1: {
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ break;
+ }
+ case 4: {
+ int *p = 0;
+ *p = 0xDEADBEEF; // expected-warning {{null}}
+ break;
+ }
+ default: {
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ break;
+ }
+ }
+}
+
+// PR 9467. Tests various CFG optimizations. This previously crashed.
+static void test(unsigned int bit_mask)
+{
+ unsigned int bit_index;
+ for (bit_index = 0;
+ bit_index < 24;
+ bit_index++) {
+ switch ((0x01 << bit_index) & bit_mask) {
+ case 0x100000: ;
+ }
+ }
+}
diff --git a/test/Analysis/new.cpp b/test/Analysis/new.cpp
index f26eecd4b196..29ac5eebd242 100644
--- a/test/Analysis/new.cpp
+++ b/test/Analysis/new.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -verify %s
void f1() {
int *n = new int;
diff --git a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m
index eeab4312fe9c..80eeaf69ddbc 100644
--- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m
+++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=range -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=range -analyzer-store=region -verify %s
// <rdar://problem/6888289> - This test case shows that a nil instance
// variable can possibly be initialized by a method.
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 4ba1015c9a1d..3fcbc55044ea 100644
--- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
+++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s
-// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
-// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
-// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin8 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple thumbv6-apple-darwin4.0.0-iphoneos -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
@interface MyClass {}
- (void *)voidPtrM;
diff --git a/test/Analysis/no-exit-cfg.c b/test/Analysis/no-exit-cfg.c
index 2924aaeffff5..cfcd76d6e0cf 100644
--- a/test/Analysis/no-exit-cfg.c
+++ b/test/Analysis/no-exit-cfg.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
// This is a test case for the issue reported in PR 2819:
// http://llvm.org/bugs/show_bug.cgi?id=2819
diff --git a/test/Analysis/no-outofbounds.c b/test/Analysis/no-outofbounds.c
index 92cb8b327110..2d77cc92adf9 100644
--- a/test/Analysis/no-outofbounds.c
+++ b/test/Analysis/no-outofbounds.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyzer-check-objc-mem -analyze -analyzer-checker=core.experimental -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyzer-check-objc-mem -analyze -analyzer-checker=core.experimental -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,unix.experimental,security.experimental.ArrayBound -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental,unix.experimental,security.experimental.ArrayBound -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===//
// This file tests cases where we should not flag out-of-bounds warnings.
@@ -25,7 +25,9 @@ void free(void *);
void field() {
struct vec { size_t len; int data[0]; };
- struct vec *a = malloc(sizeof(struct vec) + 10);
+ // FIXME: Not warn for this.
+ struct vec *a = malloc(sizeof(struct vec) + 10); // expected-warning {{Cast a region whose size is not a multiple of the destination type size}}
a->len = 10;
a->data[1] = 5; // no-warning
+ free(a);
}
diff --git a/test/Analysis/null-deref-ps-region.c b/test/Analysis/null-deref-ps-region.c
index df498ce5e622..85784558161e 100644
--- a/test/Analysis/null-deref-ps-region.c
+++ b/test/Analysis/null-deref-ps-region.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -std=gnu99 -analyzer-store=region -verify %s
// The store for 'a[1]' should not be removed mistakenly. SymbolicRegions may
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 27f648770c94..4d0cc3fbddad 100644
--- a/test/Analysis/null-deref-ps.c
+++ b/test/Analysis/null-deref-ps.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental -std=gnu99 -analyzer-check-objc-mem -verify %s -analyzer-constraints=basic -analyzer-store=basic -Wreturn-type
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental -std=gnu99 -analyzer-check-objc-mem -verify %s -analyzer-constraints=range -analyzer-store=basic -Wreturn-type
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s -Wreturn-type
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -verify %s -analyzer-constraints=basic -analyzer-store=basic -Wreturn-type
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -verify %s -analyzer-constraints=range -analyzer-store=basic -Wreturn-type
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -analyzer-store=region -analyzer-constraints=range -analyzer-no-purge-dead -verify %s -Wreturn-type
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,deadcode,core.experimental -std=gnu99 -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type
typedef unsigned uintptr_t;
diff --git a/test/Analysis/nullptr.cpp b/test/Analysis/nullptr.cpp
new file mode 100644
index 000000000000..b74a5abcdfa4
--- /dev/null
+++ b/test/Analysis/nullptr.cpp
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -std=c++0x -analyze -analyzer-checker=core -analyzer-store region -verify %s
+
+// test to see if nullptr is detected as a null pointer
+void foo1(void) {
+ char *np = nullptr;
+ *np = 0; // expected-warning{{Dereference of null pointer}}
+}
+
+// check if comparing nullptr to nullptr is detected properly
+void foo2(void) {
+ char *np1 = nullptr;
+ char *np2 = np1;
+ char c;
+ if (np1 == np2)
+ np1 = &c;
+ *np1 = 0; // no-warning
+}
+
+// invoving a nullptr in a more complex operation should be cause a warning
+void foo3(void) {
+ struct foo {
+ int a, f;
+ };
+ char *np = nullptr;
+ // casting a nullptr to anything should be caught eventually
+ int *ip = &(((struct foo *)np)->f);
+ *ip = 0; // expected-warning{{Dereference of null pointer}}
+ // should be error here too, but analysis gets stopped
+// *np = 0;
+}
+
+// nullptr is implemented as a zero integer value, so should be able to compare
+void foo4(void) {
+ char *np = nullptr;
+ if (np != 0)
+ *np = 0; // no-warning
+ char *cp = 0;
+ if (np != cp)
+ *np = 0; // no-warning
+}
+
diff --git a/test/Analysis/operator-calls.cpp b/test/Analysis/operator-calls.cpp
index 97d54226f055..766d16140ed0 100644
--- a/test/Analysis/operator-calls.cpp
+++ b/test/Analysis/operator-calls.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -verify %s
struct X0 { };
bool operator==(const X0&, const X0&);
diff --git a/test/Analysis/out-of-bounds.c b/test/Analysis/out-of-bounds.c
index b8d6e442ff57..8c65b478f1c2 100644
--- a/test/Analysis/out-of-bounds.c
+++ b/test/Analysis/out-of-bounds.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-check-objc-mem -analyzer-check-buffer-overflows -verify %s
+// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,security.experimental.ArrayBoundV2 -verify %s
// Tests doing an out-of-bounds access after the end of an array using:
// - constant integer index
@@ -146,3 +146,12 @@ void test4(int x) {
if (x > 99)
buf[x] = 1;
}
+
+// Don't warn when indexing below the start of a symbolic region's whose
+// base extent we don't know.
+int *get_symbolic();
+void test_index_below_symboloc() {
+ int *buf = get_symbolic();
+ buf[-1] = 0; // no-warning;
+}
+
diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c
index 4508198b5292..891719c1932f 100644
--- a/test/Analysis/outofbound.c
+++ b/test/Analysis/outofbound.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core.experimental -analyzer-experimental-checks -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-checker=core,unix.experimental,security.experimental.ArrayBound -analyzer-store=region -verify %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
diff --git a/test/Analysis/override-werror.c b/test/Analysis/override-werror.c
index ce0f1ac9abe6..1b1f9e1c0169 100644
--- a/test/Analysis/override-werror.c
+++ b/test/Analysis/override-werror.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -Werror %s -analyzer-store=basic -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -Werror %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -Werror %s -analyzer-store=basic -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -Werror %s -analyzer-store=region -verify
// This test case illustrates that using '-analyze' overrides the effect of
// -Werror. This allows basic warnings not to interfere with producing
diff --git a/test/Analysis/plist-output-alternate.m b/test/Analysis/plist-output-alternate.m
index 7b8c2673b085..a7e3c3cfe48a 100644
--- a/test/Analysis/plist-output-alternate.m
+++ b/test/Analysis/plist-output-alternate.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
void test_null_init(void) {
int *p = 0;
diff --git a/test/Analysis/plist-output.m b/test/Analysis/plist-output.m
index 2224a2fbb859..224f5194765e 100644
--- a/test/Analysis/plist-output.m
+++ b/test/Analysis/plist-output.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
// XFAIL: *
void test_null_init(void) {
diff --git a/test/Analysis/pr4209.m b/test/Analysis/pr4209.m
index 9ce07edcb02b..1e0fd32fcd03 100644
--- a/test/Analysis/pr4209.m
+++ b/test/Analysis/pr4209.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
// This test case was crashing due to how CFRefCount.cpp resolved the
// ObjCInterfaceDecl* and ClassName in EvalObjCMessageExpr.
diff --git a/test/Analysis/pr_2542_rdar_6793404.m b/test/Analysis/pr_2542_rdar_6793404.m
index 46b7fd36a64a..73218d8bc80e 100644
--- a/test/Analysis/pr_2542_rdar_6793404.m
+++ b/test/Analysis/pr_2542_rdar_6793404.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -pedantic -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -pedantic -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -pedantic -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -pedantic -analyzer-store=region -verify %s
// BEGIN delta-debugging reduced header stuff
diff --git a/test/Analysis/pr_4164.c b/test/Analysis/pr_4164.c
index ee5d4028e7d3..c58c8abe3f67 100644
--- a/test/Analysis/pr_4164.c
+++ b/test/Analysis/pr_4164.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
// PR 4164: http://llvm.org/bugs/show_bug.cgi?id=4164
//
diff --git a/test/Analysis/properties.m b/test/Analysis/properties.m
index ce8faf52736a..ad9db1ad6818 100644
--- a/test/Analysis/properties.m
+++ b/test/Analysis/properties.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c
index fe378957531b..502de6c3ef9a 100644
--- a/test/Analysis/ptr-arith.c
+++ b/test/Analysis/ptr-arith.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr,core.experimental.PointerArithm,core.experimental.PointerSub -analyzer-check-objc-mem -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr,core.experimental.PointerArithm,core.experimental.PointerSub -analyzer-check-objc-mem -analyzer-store=region -verify -triple i686-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr,core.experimental.PointerArithm,core.experimental.PointerSub -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr,core.experimental.PointerArithm,core.experimental.PointerSub -analyzer-store=region -verify -triple i686-apple-darwin9 %s
// Used to trigger warnings for unreachable paths.
#define WARN do { int a, b; int c = &b-&a; } while (0)
diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m
index 086cdd8d51b0..d576eae8f652 100644
--- a/test/Analysis/rdar-6442306-1.m
+++ b/test/Analysis/rdar-6442306-1.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem %s -analyzer-store=basic -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=basic -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental %s -analyzer-store=region -verify
typedef int bar_return_t;
typedef struct {
diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m
index 7ce73bc48da0..4c70dbc0758f 100644
--- a/test/Analysis/rdar-6540084.m
+++ b/test/Analysis/rdar-6540084.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=core.DeadStores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-checker=deadcode.DeadStores -verify %s
//
// This test exercises the live variables analysis (LiveVariables.cpp).
// The case originally identified a non-termination bug.
diff --git a/test/Analysis/rdar-6541136-region.c b/test/Analysis/rdar-6541136-region.c
index d8d1e996a5fa..5555b018578f 100644
--- a/test/Analysis/rdar-6541136-region.c
+++ b/test/Analysis/rdar-6541136-region.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region %s
+// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core,security.experimental.ArrayBound -analyzer-store=region %s
struct tea_cheese { unsigned magic; };
typedef struct tea_cheese kernel_tea_cheese_t;
diff --git a/test/Analysis/rdar-6541136.c b/test/Analysis/rdar-6541136.c
index a175497fcba6..095aefadb8ce 100644
--- a/test/Analysis/rdar-6541136.c
+++ b/test/Analysis/rdar-6541136.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic %s
+// RUN: %clang_cc1 -verify -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic %s
struct tea_cheese { unsigned magic; };
typedef struct tea_cheese kernel_tea_cheese_t;
diff --git a/test/Analysis/rdar-6562655.m b/test/Analysis/rdar-6562655.m
index 19b2697b3831..1e0998aa974e 100644
--- a/test/Analysis/rdar-6562655.m
+++ b/test/Analysis/rdar-6562655.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region -verify %s
//
// This test case mainly checks that the retain/release checker doesn't crash
// on this file.
diff --git a/test/Analysis/rdar-6582778-basic-store.c b/test/Analysis/rdar-6582778-basic-store.c
index a545d8b6ac70..0642b64cd7fd 100644
--- a/test/Analysis/rdar-6582778-basic-store.c
+++ b/test/Analysis/rdar-6582778-basic-store.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
typedef const void * CFTypeRef;
typedef double CFTimeInterval;
diff --git a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
index 4932a526fc4c..03b2656c7ee6 100644
--- a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
+++ b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=basic %s -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=basic %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-constraints=basic -analyzer-store=region %s -verify
typedef struct Foo { int x; } Bar;
diff --git a/test/Analysis/rdar-7168531.m b/test/Analysis/rdar-7168531.m
index 8225cd36539f..b2b66b279296 100644
--- a/test/Analysis/rdar-7168531.m
+++ b/test/Analysis/rdar-7168531.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -triple i386-apple-darwin10 -analyzer-store=region %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -triple i386-apple-darwin10 -analyzer-store=basic %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -triple i386-apple-darwin10 -analyzer-store=region %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -triple i386-apple-darwin10 -analyzer-store=basic %s
// Note that the target triple is important for this test case. It specifies that we use the
// fragile Objective-C ABI.
diff --git a/test/Analysis/refcnt_naming.m b/test/Analysis/refcnt_naming.m
index 4fe6d19f1cbf..8e99f3409b81 100644
--- a/test/Analysis/refcnt_naming.m
+++ b/test/Analysis/refcnt_naming.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
typedef const struct __CFString * CFStringRef;
typedef const struct __CFAllocator * CFAllocatorRef;
diff --git a/test/Analysis/reference.cpp b/test/Analysis/reference.cpp
index b01d70825a1f..3422b58d3fe8 100644
--- a/test/Analysis/reference.cpp
+++ b/test/Analysis/reference.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -analyzer-constraints=range -verify %s
typedef typeof(sizeof(int)) size_t;
void malloc (size_t);
diff --git a/test/Analysis/region-1.m b/test/Analysis/region-1.m
index 7770d29cfab9..7f4cd26e405e 100644
--- a/test/Analysis/region-1.m
+++ b/test/Analysis/region-1.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,core.experimental -analyzer-store=region -verify %s
//
// This test case simply should not crash. It evaluates the logic of not
// using MemRegion::getRValueType in incorrect places.
diff --git a/test/Analysis/retain-release-basic-store.m b/test/Analysis/retain-release-basic-store.m
index 8c05efef66ee..7fd17ffb995f 100644
--- a/test/Analysis/retain-release-basic-store.m
+++ b/test/Analysis/retain-release-basic-store.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m
index 7d7c58fbcd51..cbf00a27721d 100644
--- a/test/Analysis/retain-release-gc-only.m
+++ b/test/Analysis/retain-release-gc-only.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=cocoa.NSAutoreleasePool -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=cocoa.NSAutoreleasePool -analyzer-check-objc-mem -analyzer-store=region -fobjc-gc-only -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSAutoreleasePool -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSAutoreleasePool -analyzer-store=region -fobjc-gc-only -fblocks -verify %s
//===----------------------------------------------------------------------===//
// Header stuff.
diff --git a/test/Analysis/retain-release-region-store.m b/test/Analysis/retain-release-region-store.m
index ec765e3fe809..ac2362a4a73c 100644
--- a/test/Analysis/retain-release-region-store.m
+++ b/test/Analysis/retain-release-region-store.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-max-loop 6 -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-max-loop 6 -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 5cc29b0f866b..6782c90375f6 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=macosx.CFRetainRelease,cocoa.ClassRelease -analyzer-check-objc-mem -analyzer-store=basic -fblocks -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=macosx.CFRetainRelease,cocoa.ClassRelease -analyzer-check-objc-mem -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -fblocks -verify -x objective-c++ %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify -x objective-c++ %s
#if __has_feature(attribute_ns_returns_retained)
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
@@ -910,7 +912,7 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort,
// Test of handling objects whose references "escape" to containers.
//===----------------------------------------------------------------------===//
-void CFDictionaryAddValue();
+void CFDictionaryAddValue(CFMutableDictionaryRef, void *, void *);
// <rdar://problem/6539791>
void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
@@ -920,9 +922,9 @@ void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
signed z = 1;
CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z);
if (value) {
- CFDictionaryAddValue(x, val_key, value); // no-warning
+ CFDictionaryAddValue(x, val_key, (void*)value); // no-warning
CFRelease(value);
- CFDictionaryAddValue(y, val_key, value); // no-warning
+ CFDictionaryAddValue(y, val_key, (void*)value); // no-warning
}
}
@@ -1013,8 +1015,8 @@ typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
typedef __darwin_pthread_t pthread_t;
typedef __darwin_pthread_attr_t pthread_attr_t;
-int pthread_create(pthread_t * restrict, const pthread_attr_t * restrict,
- void *(*)(void *), void * restrict);
+int pthread_create(pthread_t *, const pthread_attr_t *,
+ void *(*)(void *), void *);
void *rdar_7299394_start_routine(void *p) {
[((id) p) release];
@@ -1435,7 +1437,6 @@ extern const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key
typedef struct __CFError * CFErrorRef;
extern const CFStringRef kCFErrorUnderlyingErrorKey;
extern CFDictionaryRef CFErrorCopyUserInfo(CFErrorRef err);
-
static void rdar_8724287(CFErrorRef error)
{
CFErrorRef error_to_dump;
@@ -1444,7 +1445,7 @@ static void rdar_8724287(CFErrorRef error)
while (error_to_dump != ((void*)0)) {
CFDictionaryRef info;
- info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1447 and stored into 'info'}}
+ info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1448 and stored into 'info'}}
if (info != ((void*)0)) {
}
@@ -1453,3 +1454,10 @@ static void rdar_8724287(CFErrorRef error)
}
}
+// <rdar://problem/9234108> - Make sure the model applies cf_consumed
+// correctly in argument positions besides the first.
+extern void *CFStringCreate(void);
+extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value);
+void rdar_9234108() {
+ rdar_9234108_helper(0, CFStringCreate());
+}
diff --git a/test/Analysis/security-syntax-checks-no-emit.c b/test/Analysis/security-syntax-checks-no-emit.c
index f129e8a8e5ac..4e37c44247c2 100644
--- a/test/Analysis/security-syntax-checks-no-emit.c
+++ b/test/Analysis/security-syntax-checks-no-emit.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -analyze -analyzer-checker=core.experimental.SecuritySyntactic %s -verify
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -analyze -analyzer-checker=security.experimental.SecuritySyntactic %s -verify
// This file complements 'security-syntax-checks.m', but tests that we omit
// specific checks on platforms where they don't make sense.
diff --git a/test/Analysis/security-syntax-checks.m b/test/Analysis/security-syntax-checks.m
index bac6ee89df90..160dcf657387 100644
--- a/test/Analysis/security-syntax-checks.m
+++ b/test/Analysis/security-syntax-checks.m
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental.SecuritySyntactic %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=security.experimental.SecuritySyntactic %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DUSE_BUILTINS -analyzer-checker=security.experimental.SecuritySyntactic %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DVARIANT -analyzer-checker=security.experimental.SecuritySyntactic %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=security.experimental.SecuritySyntactic %s -verify
+
+#ifdef USE_BUILTINS
+# define BUILTIN(f) __builtin_ ## f
+#else /* USE_BUILTINS */
+# define BUILTIN(f) f
+#endif /* USE_BUILTINS */
+
+typedef typeof(sizeof(int)) size_t;
+
// <rdar://problem/6336718> rule request: floating point used as loop
// condition (FLP30-C, FLP-30-CPP)
@@ -103,3 +115,52 @@ char *mktemp(char *buf);
void test_mktemp() {
char *x = mktemp("/tmp/zxcv"); // expected-warning{{Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file}}
}
+
+
+//===----------------------------------------------------------------------===
+// strcpy()
+//===----------------------------------------------------------------------===
+#ifdef VARIANT
+
+#define __strcpy_chk BUILTIN(__strcpy_chk)
+char *__strcpy_chk(char *restrict s1, const char *restrict s2, size_t destlen);
+
+#define strcpy(a,b) __strcpy_chk(a,b,(size_t)-1)
+
+#else /* VARIANT */
+
+#define strcpy BUILTIN(strcpy)
+char *strcpy(char *restrict s1, const char *restrict s2);
+
+#endif /* VARIANT */
+
+void test_strcpy() {
+ char x[4];
+ char *y;
+
+ strcpy(x, y); //expected-warning{{Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strncpy'. CWE-119.}}
+}
+
+//===----------------------------------------------------------------------===
+// strcat()
+//===----------------------------------------------------------------------===
+#ifdef VARIANT
+
+#define __strcat_chk BUILTIN(__strcat_chk)
+char *__strcat_chk(char *restrict s1, const char *restrict s2, size_t destlen);
+
+#define strcat(a,b) __strcat_chk(a,b,(size_t)-1)
+
+#else /* VARIANT */
+
+#define strcat BUILTIN(strcat)
+char *strcat(char *restrict s1, const char *restrict s2);
+
+#endif /* VARIANT */
+
+void test_strcat() {
+ char x[4];
+ char *y;
+
+ strcat(x, y); //expected-warning{{Call to function 'strcat' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strncat'. CWE-119.}}
+}
diff --git a/test/Analysis/self-init.m b/test/Analysis/self-init.m
index b8c2c3e8d984..92006a6d2459 100644
--- a/test/Analysis/self-init.m
+++ b/test/Analysis/self-init.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=cocoa.SelfInit %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.experimental.SelfInit %s -verify
@class NSZone, NSCoder;
@protocol NSObject
diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c
index 8e7e7dfd9a40..bf2a4fa4e13c 100644
--- a/test/Analysis/stack-addr-ps.c
+++ b/test/Analysis/stack-addr-ps.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.StackAddrEscape -analyzer-store=basic -fblocks -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.StackAddrEscape -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -fblocks -verify %s
int* f1() {
int x = 0;
diff --git a/test/Analysis/stackaddrleak.c b/test/Analysis/stackaddrleak.c
index f19eddc811e8..ada0cc106905 100644
--- a/test/Analysis/stackaddrleak.c
+++ b/test/Analysis/stackaddrleak.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.StackAddrEscape -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store region -verify %s
char const *p;
diff --git a/test/Analysis/stream.c b/test/Analysis/stream.c
index 7dfd49b39dc0..2f372e755153 100644
--- a/test/Analysis/stream.c
+++ b/test/Analysis/stream.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.experimental.Stream -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.experimental.Stream -analyzer-store region -verify %s
typedef __typeof__(sizeof(int)) size_t;
typedef struct _IO_FILE FILE;
diff --git a/test/Analysis/string.c b/test/Analysis/string.c
index 756115180cab..19c838c25564 100644
--- a/test/Analysis/string.c
+++ b/test/Analysis/string.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CString,core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core.experimental.CString,core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
-// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core.experimental.CString,core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core.experimental.CString,core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,cplusplus.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core,cplusplus.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core,cplusplus.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core,cplusplus.experimental.CString,deadcode.experimental.UnreachableCode -analyzer-store=region -Wno-null-dereference -verify %s
//===----------------------------------------------------------------------===
// Declarations
@@ -15,7 +15,7 @@
// Some functions are implemented as builtins. These should be #defined as
// BUILTIN(f), which will prepend "__builtin_" if USE_BUILTINS is defined.
-// Functions that have variants and are also availabe as builtins should be
+// Functions that have variants and are also available as builtins should be
// declared carefully! See memcpy() for an example.
#ifdef USE_BUILTINS
@@ -68,7 +68,7 @@ label:
}
void strlen_subregion() {
- struct two_strings { char a[2], b[2] };
+ struct two_strings { char a[2], b[2]; };
extern void use_two_strings(struct two_strings *);
struct two_strings z;
@@ -200,7 +200,7 @@ label:
}
void strnlen_subregion() {
- struct two_stringsn { char a[2], b[2] };
+ struct two_stringsn { char a[2], b[2]; };
extern void use_two_stringsn(struct two_stringsn *);
struct two_stringsn z;
@@ -438,3 +438,437 @@ void stpcpy_no_overflow(char *y) {
if (strlen(y) == 3)
stpcpy(x, y); // no-warning
}
+
+//===----------------------------------------------------------------------===
+// strcat()
+//===----------------------------------------------------------------------===
+
+#ifdef VARIANT
+
+#define __strcat_chk BUILTIN(__strcat_chk)
+char *__strcat_chk(char *restrict s1, const char *restrict s2, size_t destlen);
+
+#define strcat(a,b) __strcat_chk(a,b,(size_t)-1)
+
+#else /* VARIANT */
+
+#define strcat BUILTIN(strcat)
+char *strcat(char *restrict s1, const char *restrict s2);
+
+#endif /* VARIANT */
+
+
+void strcat_null_dst(char *x) {
+ strcat(NULL, x); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strcat_null_src(char *x) {
+ strcat(x, NULL); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strcat_fn(char *x) {
+ strcat(x, (char*)&strcat_fn); // expected-warning{{Argument to byte string function is the address of the function 'strcat_fn', which is not a null-terminated string}}
+}
+
+void strcat_effects(char *y) {
+ char x[8] = "123";
+ size_t orig_len = strlen(x);
+ char a = x[0];
+
+ if (strlen(y) != 4)
+ return;
+
+ if (strcat(x, y) != x)
+ (void)*(char*)0; // no-warning
+
+ if ((int)strlen(x) != (orig_len + strlen(y)))
+ (void)*(char*)0; // no-warning
+
+ if (a != x[0])
+ (void)*(char*)0; // expected-warning{{null}}
+}
+
+void strcat_overflow_0(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 4)
+ strcat(x, y); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void strcat_overflow_1(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 3)
+ strcat(x, y); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void strcat_overflow_2(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 2)
+ strcat(x, y); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void strcat_no_overflow(char *y) {
+ char x[5] = "12";
+ if (strlen(y) == 2)
+ strcat(x, y); // no-warning
+}
+
+
+//===----------------------------------------------------------------------===
+// strncat()
+//===----------------------------------------------------------------------===
+
+#ifdef VARIANT
+
+#define __strncat_chk BUILTIN(__strncat_chk)
+char *__strncat_chk(char *restrict s1, const char *restrict s2, size_t n, size_t destlen);
+
+#define strncat(a,b,c) __strncat_chk(a,b,c, (size_t)-1)
+
+#else /* VARIANT */
+
+#define strncat BUILTIN(strncat)
+char *strncat(char *restrict s1, const char *restrict s2, size_t n);
+
+#endif /* VARIANT */
+
+
+void strncat_null_dst(char *x) {
+ strncat(NULL, x, 4); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strncat_null_src(char *x) {
+ strncat(x, NULL, 4); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strncat_fn(char *x) {
+ strncat(x, (char*)&strncat_fn, 4); // expected-warning{{Argument to byte string function is the address of the function 'strncat_fn', which is not a null-terminated string}}
+}
+
+void strncat_effects(char *y) {
+ char x[8] = "123";
+ size_t orig_len = strlen(x);
+ char a = x[0];
+
+ if (strlen(y) != 4)
+ return;
+
+ if (strncat(x, y, strlen(y)) != x)
+ (void)*(char*)0; // no-warning
+
+ if (strlen(x) != orig_len + strlen(y))
+ (void)*(char*)0; // no-warning
+
+ if (a != x[0])
+ (void)*(char*)0; // expected-warning{{null}}
+}
+
+void strncat_overflow_0(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 4)
+ strncat(x, y, strlen(y)); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void strncat_overflow_1(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 3)
+ strncat(x, y, strlen(y)); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void strncat_overflow_2(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 2)
+ strncat(x, y, strlen(y)); // expected-warning{{Byte string function overflows destination buffer}}
+}
+
+void strncat_overflow_3(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 4)
+ strncat(x, y, 2); // expected-warning{{Byte string function overflows destination buffer}}
+}
+void strncat_no_overflow_1(char *y) {
+ char x[5] = "12";
+ if (strlen(y) == 2)
+ strncat(x, y, strlen(y)); // no-warning
+}
+
+void strncat_no_overflow_2(char *y) {
+ char x[4] = "12";
+ if (strlen(y) == 4)
+ strncat(x, y, 1); // no-warning
+}
+
+//===----------------------------------------------------------------------===
+// strcmp()
+//===----------------------------------------------------------------------===
+
+#define strcmp BUILTIN(strcmp)
+int strcmp(const char *restrict s1, const char *restrict s2);
+
+void strcmp_constant0() {
+ if (strcmp("123", "123") != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_constant_and_var_0() {
+ char *x = "123";
+ if (strcmp(x, "123") != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_constant_and_var_1() {
+ char *x = "123";
+ if (strcmp("123", x) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_0() {
+ char *x = "123";
+ char *y = "123";
+ if (strcmp(x, y) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_1() {
+ char *x = "234";
+ char *y = "123";
+ if (strcmp(x, y) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_2() {
+ char *x = "123";
+ char *y = "234";
+ if (strcmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_null_0() {
+ char *x = NULL;
+ char *y = "123";
+ strcmp(x, y); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strcmp_null_1() {
+ char *x = "123";
+ char *y = NULL;
+ strcmp(x, y); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strcmp_diff_length_0() {
+ char *x = "12345";
+ char *y = "234";
+ if (strcmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_diff_length_1() {
+ char *x = "123";
+ char *y = "23456";
+ if (strcmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_diff_length_2() {
+ char *x = "12345";
+ char *y = "123";
+ if (strcmp(x, y) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcmp_diff_length_3() {
+ char *x = "123";
+ char *y = "12345";
+ if (strcmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+//===----------------------------------------------------------------------===
+// strncmp()
+//===----------------------------------------------------------------------===
+
+#define strncmp BUILTIN(strncmp)
+int strncmp(const char *restrict s1, const char *restrict s2, size_t n);
+
+void strncmp_constant0() {
+ if (strncmp("123", "123", 3) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_constant_and_var_0() {
+ char *x = "123";
+ if (strncmp(x, "123", 3) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_constant_and_var_1() {
+ char *x = "123";
+ if (strncmp("123", x, 3) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_0() {
+ char *x = "123";
+ char *y = "123";
+ if (strncmp(x, y, 3) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_1() {
+ char *x = "234";
+ char *y = "123";
+ if (strncmp(x, y, 3) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_2() {
+ char *x = "123";
+ char *y = "234";
+ if (strncmp(x, y, 3) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_null_0() {
+ char *x = NULL;
+ char *y = "123";
+ strncmp(x, y, 3); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strncmp_null_1() {
+ char *x = "123";
+ char *y = NULL;
+ strncmp(x, y, 3); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strncmp_diff_length_0() {
+ char *x = "12345";
+ char *y = "234";
+ if (strncmp(x, y, 5) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_diff_length_1() {
+ char *x = "123";
+ char *y = "23456";
+ if (strncmp(x, y, 5) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_diff_length_2() {
+ char *x = "12345";
+ char *y = "123";
+ if (strncmp(x, y, 5) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_diff_length_3() {
+ char *x = "123";
+ char *y = "12345";
+ if (strncmp(x, y, 5) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_diff_length_4() {
+ char *x = "123";
+ char *y = "12345";
+ if (strncmp(x, y, 3) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_diff_length_5() {
+ char *x = "012";
+ char *y = "12345";
+ if (strncmp(x, y, 3) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strncmp_diff_length_6() {
+ char *x = "234";
+ char *y = "12345";
+ if (strncmp(x, y, 3) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+//===----------------------------------------------------------------------===
+// strcasecmp()
+//===----------------------------------------------------------------------===
+
+#define strcasecmp BUILTIN(strcasecmp)
+int strcasecmp(const char *restrict s1, const char *restrict s2);
+
+void strcasecmp_constant0() {
+ if (strcasecmp("abc", "Abc") != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_constant_and_var_0() {
+ char *x = "abc";
+ if (strcasecmp(x, "Abc") != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_constant_and_var_1() {
+ char *x = "abc";
+ if (strcasecmp("Abc", x) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_0() {
+ char *x = "abc";
+ char *y = "Abc";
+ if (strcasecmp(x, y) != 0)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_1() {
+ char *x = "Bcd";
+ char *y = "abc";
+ if (strcasecmp(x, y) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_2() {
+ char *x = "abc";
+ char *y = "Bcd";
+ if (strcasecmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_null_0() {
+ char *x = NULL;
+ char *y = "123";
+ strcasecmp(x, y); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strcasecmp_null_1() {
+ char *x = "123";
+ char *y = NULL;
+ strcasecmp(x, y); // expected-warning{{Null pointer argument in call to byte string function}}
+}
+
+void strcasecmp_diff_length_0() {
+ char *x = "abcde";
+ char *y = "aBd";
+ if (strcasecmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_diff_length_1() {
+ char *x = "abc";
+ char *y = "aBdef";
+ if (strcasecmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_diff_length_2() {
+ char *x = "aBcDe";
+ char *y = "abc";
+ if (strcasecmp(x, y) != 1)
+ (void)*(char*)0; // no-warning
+}
+
+void strcasecmp_diff_length_3() {
+ char *x = "aBc";
+ char *y = "abcde";
+ if (strcasecmp(x, y) != -1)
+ (void)*(char*)0; // no-warning
+}
diff --git a/test/Analysis/undef-buffers.c b/test/Analysis/undef-buffers.c
index 27c3b8df8411..df124b10d10e 100644
--- a/test/Analysis/undef-buffers.c
+++ b/test/Analysis/undef-buffers.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.experimental,core.uninitialized -analyzer-store=region -verify %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
void free(void *);
diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m
index a8e2f1b65592..743d36ff56de 100644
--- a/test/Analysis/uninit-msg-expr.m
+++ b/test/Analysis/uninit-msg-expr.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/uninit-ps-rdar6145427.m b/test/Analysis/uninit-ps-rdar6145427.m
index ccaf2e8105bf..f1794068d5e1 100644
--- a/test/Analysis/uninit-ps-rdar6145427.m
+++ b/test/Analysis/uninit-ps-rdar6145427.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -verify -analyzer-store=basic -analyzer-check-objc-mem %s
-// RUN: %clang_cc1 -analyze -verify -analyzer-store=region -analyzer-check-objc-mem %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -analyzer-store=basic %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -analyzer-store=region %s
// Delta-Debugging reduced preamble.
typedef signed char BOOL;
diff --git a/test/Analysis/uninit-vals-ps-region.m b/test/Analysis/uninit-vals-ps-region.m
index 2b3b027657f6..1700f54dbfb0 100644
--- a/test/Analysis/uninit-vals-ps-region.m
+++ b/test/Analysis/uninit-vals-ps-region.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-checker=core.experimental.IdempotentOps -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-checker=core,deadcode.IdempotentOperations -verify %s
struct s {
int data;
diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c
index 9e53fbc34881..915961aa11da 100644
--- a/test/Analysis/uninit-vals-ps.c
+++ b/test/Analysis/uninit-vals-ps.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
struct FPRec {
void (*my_func)(int * x);
diff --git a/test/Analysis/uninit-vals.c b/test/Analysis/uninit-vals.c
deleted file mode 100644
index e4395e848661..000000000000
--- a/test/Analysis/uninit-vals.c
+++ /dev/null
@@ -1,53 +0,0 @@
-// RUN: %clang_cc1 -analyze -warn-uninit-values -verify %s
-
-int f1() {
- int x;
- return x; // expected-warning {{use of uninitialized variable}}
-}
-
-int f2(int x) {
- int y;
- int z = x + y; // expected-warning {{use of uninitialized variable}}
- return z;
-}
-
-
-int f3(int x) {
- int y;
- return x ? 1 : y; // expected-warning {{use of uninitialized variable}}
-}
-
-int f4(int x) {
- int y;
- if (x) y = 1;
- return y; // expected-warning {{use of uninitialized variable}}
-}
-
-void f5() {
- int a;
- a = 30; // no-warning
-}
-
-void f6(int i) {
- int x;
- for (i = 0 ; i < 10; i++)
- printf("%d",x++); // expected-warning {{use of uninitialized variable}} \
- // expected-warning{{implicitly declaring C library function 'printf' with type 'int (const char *, ...)'}} \
- // expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
-}
-
-void f7(int i) {
- int x = i;
- int y;
- for (i = 0; i < 10; i++ ) {
- printf("%d",x++); // no-warning
- x += y; // expected-warning {{use of uninitialized variable}}
- }
-}
-
-int f8(int j) {
- int x = 1, y = x + 1;
- if (y) // no-warning
- return x;
- return y;
-}
diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m
index 2f7f29c5d9e4..2cd5e0c11848 100644
--- a/test/Analysis/uninit-vals.m
+++ b/test/Analysis/uninit-vals.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
typedef unsigned int NSUInteger;
diff --git a/test/Analysis/unions-region.m b/test/Analysis/unions-region.m
index 180faf8fd72d..1a716847186f 100644
--- a/test/Analysis/unions-region.m
+++ b/test/Analysis/unions-region.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range %s -verify
//===-- unions-region.m ---------------------------------------------------===//
//
diff --git a/test/Analysis/unix-fns.c b/test/Analysis/unix-fns.c
index 656a1c9c1340..5df6b37bb91a 100644
--- a/test/Analysis/unix-fns.c
+++ b/test/Analysis/unix-fns.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.API,macosx.API %s -analyzer-store=region -fblocks -verify
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.API,macosx.API %s -analyzer-store=basic -fblocks -verify
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=unix.API,osx.API %s -analyzer-store=region -fblocks -verify
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=unix.API,osx.API %s -analyzer-store=basic -fblocks -verify
struct _opaque_pthread_once_t {
long __sig;
diff --git a/test/Analysis/unreachable-code-path.c b/test/Analysis/unreachable-code-path.c
index 6ae0822c7344..7df52402e735 100644
--- a/test/Analysis/unreachable-code-path.c
+++ b/test/Analysis/unreachable-code-path.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core.DeadStores,core.experimental.UnreachableCode -analyzer-check-objc-mem -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,deadcode.DeadStores,deadcode.experimental.UnreachableCode -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s
extern void foo(int a);
diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m
index b43ae18694dd..931c84a3745a 100644
--- a/test/Analysis/unused-ivars.m
+++ b/test/Analysis/unused-ivars.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -analyze -analyzer-checker=cocoa.UnusedIvars %s -verify
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -analyze -analyzer-checker=osx.cocoa.UnusedIvars %s -verify
//===--- BEGIN: Delta-debugging reduced headers. --------------------------===//
diff --git a/test/Analysis/variadic-method-types.m b/test/Analysis/variadic-method-types.m
new file mode 100644
index 000000000000..018956ab1b2d
--- /dev/null
+++ b/test/Analysis/variadic-method-types.m
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.VariadicMethodTypes -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.VariadicMethodTypes -analyzer-store=region -fblocks -verify %s
+
+//===----------------------------------------------------------------------===//
+// The following code is reduced using delta-debugging from
+// Foundation.h (Mac OS X).
+//
+// It includes the basic definitions for the test cases below.
+// Not directly including Foundation.h directly makes this test case
+// both svelte and portable to non-Mac platforms.
+//===----------------------------------------------------------------------===//
+
+#define nil (void*)0
+typedef const struct __CFString * CFStringRef;
+extern const CFStringRef kCGImageSourceShouldCache __attribute__((visibility("default")));
+typedef signed char BOOL;
+typedef struct _NSZone NSZone;
+typedef unsigned int NSUInteger;
+@protocol NSObject
+- (BOOL)isEqual:(id)object;
+- (oneway void)release;
+- (id)retain;
+- (id)autorelease;
+@end
+@protocol NSCopying
+- (id)copyWithZone:(NSZone *)zone;
+@end
+@protocol NSMutableCopying
+- (id)mutableCopyWithZone:(NSZone *)zone;
+@end
+@class NSCoder;
+@protocol NSCoding
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+@end
+@interface NSObject <NSObject> {}
+- (id)init;
++ (id)alloc;
+@end
+typedef struct {} NSFastEnumerationState;
+@protocol NSFastEnumeration
+- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
+@end
+@interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
+@end
+@interface NSArray (NSArrayCreation)
++ (id)arrayWithObjects:(id)firstObj, ... __attribute__((sentinel(0,1)));
+- (id)initWithObjects:(id)firstObj, ... __attribute__((sentinel(0,1)));
+@end
+@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
+@end
+@interface NSDictionary (NSDictionaryCreation)
++ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ... __attribute__((sentinel(0,1)));
+- (id)initWithObjectsAndKeys:(id)firstObject, ... __attribute__((sentinel(0,1)));
+@end
+@interface NSSet : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
+@end
+@interface NSSet (NSSetCreation)
++ (id)setWithObjects:(id)firstObj, ... __attribute__((sentinel(0,1)));
+- (id)initWithObjects:(id)firstObj, ... __attribute__((sentinel(0,1)));
+@end
+@protocol P;
+@class C;
+
+typedef struct FooType * __attribute__ ((NSObject)) FooType;
+typedef struct BarType * BarType;
+
+
+void f(id a, id<P> b, C* c, C<P> *d, FooType fooType, BarType barType) {
+ [NSArray arrayWithObjects:@"Hello", a, b, c, d, nil];
+ [NSArray arrayWithObjects:@"Foo", ^{}, nil];
+
+ [NSArray arrayWithObjects:@"Foo", "Bar", "Baz", nil]; // expected-warning 2 {{Argument to 'NSArray' method 'arrayWithObjects:' should be an Objective-C pointer type, not 'char *'}}
+ [NSDictionary dictionaryWithObjectsAndKeys:@"Foo", "Bar", nil]; // expected-warning {{Argument to 'NSDictionary' method 'dictionaryWithObjectsAndKeys:' should be an Objective-C pointer type, not 'char *'}}
+ [NSSet setWithObjects:@"Foo", "Bar", nil]; // expected-warning {{Argument to 'NSSet' method 'setWithObjects:' should be an Objective-C pointer type, not 'char *'}}
+
+ [[[NSArray alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}}
+ [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjectsAndKeys:' should be an Objective-C pointer type, not 'char *'}}
+ [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", (void*) 0, nil] autorelease]; // no-warning
+ [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", kCGImageSourceShouldCache, nil] autorelease]; // no-warning
+ [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", fooType, nil] autorelease]; // no-warning
+ [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", barType, nil] autorelease]; // expected-warning {{Argument to method 'initWithObjectsAndKeys:' should be an Objective-C pointer type, not 'BarType'}}
+ [[[NSSet alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}}
+}
+
+// This previously crashed the variadic argument checker.
+@protocol RDar9273215
+- (void)rdar9273215:(id)x, ...;
+@end
+
+void test_rdar9273215(id<RDar9273215> y) {
+ return [y rdar9273215:y, y];
+}
+
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 0c905fbf325d..cee7c0242033 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p2.cpp
@@ -17,7 +17,7 @@ namespace M {
struct Y : N::X { };
}
-void f();
+void f(); // expected-note 2 {{'f' declared here}}
void test_operator_adl(N::X x, M::Y y) {
(void)(x + x);
diff --git a/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp b/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp
new file mode 100644
index 000000000000..d930f97ce791
--- /dev/null
+++ b/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+void f() {
+ int b;
+ int arr[] = {1, 2, 3};
+
+ if (bool b = true) // expected-note 2{{previous definition}}
+ bool b; // expected-error {{redefinition}}
+ else
+ int b; // expected-error {{redefinition}}
+ while (bool b = true) // expected-note {{previous definition}}
+ int b; // expected-error {{redefinition}}
+ for (int c; // expected-note 2{{previous definition}}
+ bool c = true;) // expected-error {{redefinition}}
+ double c; // expected-error {{redefinition}}
+ switch (int n = 37 + 5) // expected-note {{previous definition}}
+ int n; // expected-error {{redefinition}}
+ for (int a : arr) // expected-note {{previous definition}}
+ int a = 0; // expected-error {{redefinition}}
+
+ if (bool b = true) { // expected-note 2{{previous definition}}
+ int b; // expected-error {{redefinition}}
+ } else {
+ int b; // expected-error {{redefinition}}
+ }
+ while (bool b = true) { // expected-note {{previous definition}}
+ int b; // expected-error {{redefinition}}
+ }
+ for (int c; // expected-note 2{{previous definition}}
+ bool c = true;) { // expected-error {{redefinition}}
+ double c; // expected-error {{redefinition}}
+ }
+ switch (int n = 37 + 5) { // expected-note {{previous definition}}
+ int n; // expected-error {{redefinition}}
+ }
+ for (int &a : arr) { // expected-note {{previous definition}}
+ int a = 0; // expected-error {{redefinition}}
+ }
+
+ if (bool b = true) {{ // expected-note {{previous definition}}
+ bool b;
+ }} else {
+ int b; // expected-error {{redefinition}}
+ }
+ if (bool b = true) { // expected-note {{previous definition}}
+ bool b; // expected-error {{redefinition}}
+ } else {{
+ int b;
+ }}
+ if (bool b = true) {{
+ bool b;
+ }} else {{
+ int b;
+ }}
+ while (bool b = true) {{
+ int b;
+ }}
+ for (int c; // expected-note {{previous definition}}
+ bool c = true; ) {{ // expected-error {{redefinition}}
+ double c;
+ }}
+ switch (int n = 37 + 5) {{
+ int n;
+ }}
+ for (int &a : arr) {{
+ int a = 0;
+ }}
+}
diff --git a/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp b/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp
new file mode 100644
index 000000000000..751c0df6b867
--- /dev/null
+++ b/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+// Classes.
+namespace Class {
+ namespace NS {
+ class C {}; // expected-note {{candidate}}
+ }
+ using namespace NS;
+ class C : C {}; // expected-error {{reference to 'C' is ambiguous}} \
+ expected-note {{candidate}}
+}
+
+// Enumerations.
+enum E {
+ EPtrSize = sizeof((E*)0) // ok, E is already declared
+};
+
+// Alias declarations. clang implements the proposed resolution to N1044.
+namespace Alias {
+ namespace NS {
+ class C;
+ }
+ using namespace NS;
+ using C = C; // ok, C = B::C
+ using C = NS::C; // ok, same type
+}
diff --git a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
index 37a4f976bada..47b51585556f 100644
--- a/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
+++ b/test/CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fexceptions -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
int *use_new(int N) {
if (N == 1)
return new int;
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index 84b7b1915f17..4228a44fc122 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
// C++0x [class.access]p4:
diff --git a/test/CXX/class.derived/p8-0x.cpp b/test/CXX/class.derived/p8-0x.cpp
deleted file mode 100644
index 6a667f73ec3f..000000000000
--- a/test/CXX/class.derived/p8-0x.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++0x
-
-namespace Test1 {
-
-struct A {
- virtual void f(); // expected-note {{overridden virtual function is here}}
-};
-
-struct B explicit : A {
- virtual void f(); // expected-error {{overrides function without being marked 'override'}}
-};
-
-struct C {
- virtual ~C();
-};
-
-struct D explicit : C {
- virtual ~D();
-};
-
-}
-
diff --git a/test/CXX/class/class.mem/p2.cpp b/test/CXX/class/class.mem/p2.cpp
new file mode 100644
index 000000000000..09040d859c80
--- /dev/null
+++ b/test/CXX/class/class.mem/p2.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// C++11 [class.mem]p2:
+// A class is considered a completely-defined object type (or
+// complete type) at the closing } of the class-specifier. Within
+// the class member-specification, the class is regarded as complete
+// within function bodies, default arguments,
+// exception-specifications, and brace-or-equal-initializers for
+// non-static data members (including such things in nested classes).
+// Otherwise it is regarded as incomplete within its own class
+// member-specification.
+
+namespace test0 {
+ struct A { // expected-note {{definition of 'test0::A' is not complete until the closing '}'}}
+ A x; // expected-error {{field has incomplete type 'test0::A'}}
+ };
+}
+
+namespace test1 {
+ template <class T> struct A {
+ A<int> x; // expected-error {{implicit instantiation of template 'test1::A<int>' within its own definition}}
+ };
+}
+
+namespace test2 {
+ template <class T> struct A;
+ template <> struct A<int> {};
+ template <class T> struct A {
+ A<int> x;
+ };
+}
diff --git a/test/CXX/class/class.mem/p8-0x-pedantic.cpp b/test/CXX/class/class.mem/p8-0x-pedantic.cpp
deleted file mode 100644
index a4b775c191d8..000000000000
--- a/test/CXX/class/class.mem/p8-0x-pedantic.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -pedantic -verify %s
-
-namespace inline_extension {
- struct Base1 {
- virtual void f() {}
- };
-
- struct B : Base1 {
- virtual void f() override {} // expected-warning {{'override' keyword only allowed in declarations, allowed as an extension}}
- virtual void g() final {} // expected-warning {{'final' keyword only allowed in declarations, allowed as an extension}}
- virtual void h() new {} // expected-warning {{'new' keyword only allowed in declarations, allowed as an extension}}
- };
-}
-
diff --git a/test/CXX/class/class.mem/p8-0x.cpp b/test/CXX/class/class.mem/p8-0x.cpp
index bf1b4c177bf8..836ebad48ee1 100644
--- a/test/CXX/class/class.mem/p8-0x.cpp
+++ b/test/CXX/class/class.mem/p8-0x.cpp
@@ -5,7 +5,6 @@ struct Base1 {
};
struct A : Base1 {
- virtual void f() new new; // expected-error {{class member already marked 'new'}}
virtual void g() override override; // expected-error {{class member already marked 'override'}}
virtual void h() final final; // expected-error {{class member already marked 'final'}}
};
@@ -34,7 +33,6 @@ namespace inline_extension {
};
struct A : Base1 {
- virtual void f() new new {} // expected-error {{class member already marked 'new'}}
virtual void g() override override {} // expected-error {{class member already marked 'override'}}
virtual void h() final final {} // expected-error {{class member already marked 'final'}}
};
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 c81e4ef1b1b8..9116e7146f81 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
@@ -35,17 +35,22 @@ namespace test1 {
struct A {
void foo(Opaque1); // expected-note {{candidate}}
void foo(Opaque2); // expected-note {{candidate}}
- void test();
};
struct B : A {
-
+ void test();
};
- void A::test() {
- B::foo(Opaque1());
- B::foo(Opaque2());
- B::foo(Opaque3()); // expected-error {{no matching member function}}
+ struct C1 : A { };
+ struct C2 : B { };
+
+ void B::test() {
+ A::foo(Opaque1());
+ A::foo(Opaque2());
+ A::foo(Opaque3()); // expected-error {{no matching member function}}
+
+ C1::foo(Opaque1()); // expected-error {{call to non-static member function without an object argument}}
+ C2::foo(Opaque1()); // expected-error {{call to non-static member function without an object argument}}
}
}
diff --git a/test/CXX/class/class.union/p1.cpp b/test/CXX/class/class.union/p1.cpp
index b5dd4dfd705d..011185fb49e4 100644
--- a/test/CXX/class/class.union/p1.cpp
+++ b/test/CXX/class/class.union/p1.cpp
@@ -7,30 +7,30 @@ class Okay {
};
class Virtual {
- virtual void foo() { abort(); } // expected-note 3 {{because type 'Virtual' has a virtual member function}}
+ virtual void foo() { abort(); } // expected-note 4 {{because type 'Virtual' has a virtual member function}}
};
-class VirtualBase : virtual Okay { // expected-note 3 {{because type 'VirtualBase' has a virtual base class}}
+class VirtualBase : virtual Okay { // expected-note 4 {{because type 'VirtualBase' has a virtual base class}}
};
class Ctor {
- Ctor() { abort(); } // expected-note 3 {{because type 'Ctor' has a user-declared constructor}}
+ Ctor() { abort(); } // expected-note 4 {{because type 'Ctor' has a user-declared constructor}}
};
class Ctor2 {
Ctor2(); // expected-note 3 {{because type 'Ctor2' has a user-declared constructor}}
};
class CopyCtor {
- CopyCtor(CopyCtor &cc) { abort(); } // expected-note 3 {{because type 'CopyCtor' has a user-declared copy constructor}}
+ CopyCtor(CopyCtor &cc) { abort(); } // expected-note 4 {{because type 'CopyCtor' has a user-declared copy constructor}}
};
// FIXME: this should eventually trigger on the operator's declaration line
-class CopyAssign { // expected-note 3 {{because type 'CopyAssign' has a user-declared copy assignment operator}}
+class CopyAssign { // expected-note 4 {{because type 'CopyAssign' has a user-declared copy assignment operator}}
CopyAssign& operator=(CopyAssign& CA) { abort(); }
};
class Dtor {
- ~Dtor() { abort(); } // expected-note 3 {{because type 'Dtor' has a user-declared destructor}}
+ ~Dtor() { abort(); } // expected-note 4 {{because type 'Dtor' has a user-declared destructor}}
};
union U1 {
@@ -100,23 +100,21 @@ union U5 {
template <class A, class B> struct Either {
bool tag;
- union {
+ union { // expected-note 6 {{in instantiation of member class}}
A a;
- B b;
+ B b; // expected-error 6 {{non-trivial}}
};
- Either(A& a) : tag(true), a(a) {}
- Either(B& b) : tag(false), b(b) {}
+ Either(const A& a) : tag(true), a(a) {}
+ Either(const B& b) : tag(false), b(b) {}
};
-/* FIXME: this should work, but crashes in template code.
void fred() {
- Either<int,Virtual> virt(0);
- Either<int,VirtualBase> vbase(0);
- Either<int,Ctor> ctor(0);
- Either<int,CopyCtor> copyctor(0);
- Either<int,CopyAssign> copyassign(0);
- Either<int,Dtor> dtor(0);
+ Either<int,Virtual> virt(0); // expected-note {{in instantiation of template}}
+ Either<int,VirtualBase> vbase(0); // expected-note {{in instantiation of template}}
+ Either<int,Ctor> ctor(0); // expected-note {{in instantiation of template}}
+ Either<int,CopyCtor> copyctor(0); // expected-note {{in instantiation of template}}
+ Either<int,CopyAssign> copyassign(0); // expected-note {{in instantiation of template}}
+ Either<int,Dtor> dtor(0); // expected-note {{in instantiation of template}}
Either<int,Okay> okay(0);
}
- */
diff --git a/test/CXX/class/p1-0x.cpp b/test/CXX/class/p1-0x.cpp
index 5851de6cc395..e677dec4caf1 100644
--- a/test/CXX/class/p1-0x.cpp
+++ b/test/CXX/class/p1-0x.cpp
@@ -2,9 +2,5 @@
namespace Test1 {
class A final { };
-class B explicit { };
-class C final explicit { };
-class D final final { }; // expected-error {{class already marked 'final'}}
-class E explicit explicit { }; // expected-error {{class already marked 'explicit'}}
}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp
index b9ad6e1c067f..7c4a21c35a7d 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp
@@ -95,3 +95,24 @@ namespace redecl { inline namespace n1 {
};
} }
+
+// Normal redeclarations (not for explicit instantiations or
+// specializations) are distinct in an inline namespace vs. not in an
+// inline namespace.
+namespace redecl2 {
+ inline namespace n1 {
+ void f(int) { }
+ struct X1 { };
+ template<typename T> void f(T) { }
+ template<typename T> struct X2 { };
+ int i = 71;
+ enum E { e };
+ }
+
+ void f(int) { }
+ struct X1 { };
+ template<typename T> void f(T) { }
+ template<typename T> struct X2 { };
+ int i = 71;
+ enum E { e };
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
index 15efd72c1457..07eec1edbe39 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
@@ -4,4 +4,4 @@
void f0() {
}
-inline void f0(); // expected-error {{function definition cannot preceed inline declaration}}
+inline void f0(); // expected-error {{function definition cannot precede inline declaration}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
index 18a0cf169d54..1b1f11a660b5 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++0x
struct S {
virtual ~S();
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
index fec53c941e3d..09245cfd2000 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++0x
struct S {
virtual ~S();
@@ -43,8 +43,7 @@ void j() {
(void)sizeof(auto); // expected-error{{'auto' not allowed here}}
(void)__alignof(auto); // expected-error{{'auto' not allowed here}}
- // FIXME: don't issue the second diagnostic for this error.
- U<auto> v; // expected-error{{'auto' not allowed in template argument}} unexpected-error{{C++ requires a type specifier}}
+ U<auto> v; // expected-error{{'auto' not allowed in template argument}}
int n;
(void)dynamic_cast<auto&>(S()); // expected-error{{'auto' not allowed here}}
@@ -63,7 +62,7 @@ enum E : auto {}; // expected-error{{'auto' not allowed here}}
struct F : auto {}; // expected-error{{expected class name}}
template<typename T = auto> struct G { }; // expected-error{{'auto' not allowed here}}
-using A = auto; // expected-error{{expected ';'}} expected-error{{requires a qualified name}}
+using A = auto; // expected-error{{'auto' not allowed in type alias}}
// FIXME: don't issue the second diagnostic for this error.
auto k() -> auto; // expected-error{{'auto' not allowed here}} unexpected-error{{without trailing return type}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
new file mode 100644
index 000000000000..10184a058f17
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// FIXME: when clang supports alias-declarations.
+#if 0
+using X = struct { // ok
+};
+#endif
+
+class K {
+ virtual ~K();
+ // FIXME: the diagnostic here isn't very good
+ operator struct S {} (); // expected-error 2{{}}
+};
+
+void f() {
+ int arr[3] = {1,2,3};
+
+ for (struct S { S(int) {} } s : arr) { // expected-error {{types may not be defined in a for range declaration}}
+ }
+
+ new struct T {}; // expected-error {{allocation of incomplete type}} expected-note {{forward declaration}}
+
+ // FIXME: the diagnostic here isn't very good
+ try {} catch (struct U {}); // expected-error 3{{}} expected-note 2{{}}
+
+ (void)(struct V { V(int); })0; // expected-error {{'V' can not be defined in a type specifier}}
+
+ (void)dynamic_cast<struct W {}*>((K*)0); // expected-error {{'W' can not be defined in a type specifier}}
+ (void)static_cast<struct X {}*>(0); // expected-error {{'X' can not be defined in a type specifier}}
+ (void)reinterpret_cast<struct Y {}*>(0); // expected-error {{'Y' can not be defined in a type specifier}}
+ (void)const_cast<struct Z {}*>((const Z*)0); // expected-error {{'Z' can not be defined in a type specifier}}
+}
+
+void g() throw (struct Ex {}) { // expected-error {{'Ex' can not be defined in a type specifier}}
+}
+
+// FIXME: this currently gives a strange error because alignas is not recognised as a keyword yet.
+int alignas(struct Aa {}) x; // expected-error {{'Aa' can not be defined in a parameter type}} expected-error {{expected function body}}
+
+int a = sizeof(struct So {}); // expected-error {{'So' can not be defined in a type specifier}}
+int b = alignof(struct Ao {}); // expected-error {{'Ao' can not be defined in a type specifier}}
+
+namespace std { struct type_info; }
+const std::type_info &ti = typeid(struct Ti {}); // expected-error {{'Ti' can not be defined in a type specifier}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
new file mode 100644
index 000000000000..a51cfbfffcce
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
@@ -0,0 +1,161 @@
+// RUN: %clang_cc1 -verify -std=c++0x %s
+
+namespace RedeclAliasTypedef {
+ typedef int T;
+ using T = int;
+ using T = int;
+ typedef T T;
+ using T = T;
+ typedef int T;
+}
+
+namespace IllegalTypeIds {
+ using A = void(int n = 0); // expected-error {{default arguments can only be specified for parameters in a function declaration}}
+ using B = inline void(int n); // expected-error {{type name does not allow function specifier}}
+ using C = virtual void(int n); // expected-error {{type name does not allow function specifier}}
+ using D = explicit void(int n); // expected-error {{type name does not allow function specifier}}
+ using E = void(int n) throw(); // expected-error {{exception specifications are not allowed in type aliases}}
+ // FIXME: this is illegal; we incorrectly accept it for typedefs too.
+ using F = void(*)(int n) &&; // expected-err
+ using G = __thread void(int n); // expected-error {{type name does not allow storage class to be specified}}
+
+ using H = void(int n); // ok
+ using I = void(int n) &&; // ok
+}
+
+namespace IllegalSyntax {
+ using ::T = void(int n); // expected-error {{name defined in alias declaration must be an identifier}}
+ using operator int = void(int n); // expected-error {{name defined in alias declaration must be an identifier}}
+ using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}}
+ using typename ::V = void(int n); // expected-error {{name defined in alias declaration must be an identifier}}
+ using typename ::operator bool = void(int n); // expected-error {{name defined in alias declaration must be an identifier}}
+}
+
+namespace VariableLengthArrays {
+ using T = int[42]; // ok
+
+ int n = 32;
+ using T = int[n]; // expected-error {{variable length array declaration not allowed at file scope}}
+
+ const int m = 42;
+ using U = int[m]; // expected-note {{previous definition}}
+ using U = int[42]; // ok
+ using U = int; // expected-error {{type alias redefinition with different types ('int' vs 'int [42]')}}
+
+ void f() {
+ int n = 42;
+ goto foo; // expected-error {{goto into protected scope}}
+ using T = int[n]; // expected-note {{bypasses initialization of VLA type alias}}
+ foo: ;
+ }
+}
+
+namespace RedeclFunc {
+ int f(int, char**);
+ using T = int;
+ T f(int, char **); // ok
+}
+
+namespace LookupFilter {
+ namespace N { struct S; }
+ using namespace N;
+ using S = S*; // ok
+}
+
+namespace InFunctions {
+ template<typename...T> void f0() {
+ using U = T*; // expected-error {{declaration type contains unexpanded parameter pack 'T'}}
+ U u;
+ }
+ template void f0<int, char>();
+
+ void f1() {
+ using T = int;
+ }
+ void f2() {
+ using T = int[-1]; // expected-error {{array size is negative}}
+ }
+
+ template<typename...T> void f3() { // expected-note {{template parameter is declared here}}
+ using T = int; // expected-error {{declaration of 'T' shadows template parameter}}
+ }
+}
+
+namespace ClassNameRedecl {
+ class C0 {
+ // FIXME: this diagnostic is pretty poor
+ using C0 = int; // expected-error {{name defined in alias declaration must be an identifier}}
+ };
+ class C1 {
+ // FIXME: this diagnostic is pretty poor
+ using C1 = C1; // expected-error {{name defined in alias declaration must be an identifier}}
+ };
+ class C2 {
+ using C0 = C1; // ok
+ };
+ template<typename...T> class C3 {
+ using f = T; // expected-error {{declaration type contains unexpanded parameter pack 'T'}}
+ };
+ template<typename T> class C4 { // expected-note {{template parameter is declared here}}
+ using T = int; // expected-error {{declaration of 'T' shadows template parameter}}
+ };
+ class C5 {
+ class c; // expected-note {{previous definition}}
+ using c = int; // expected-error {{typedef redefinition with different types}}
+ class d;
+ using d = d; // ok
+ };
+ class C6 {
+ class c { using C6 = int; }; // ok
+ };
+}
+
+class CtorDtorName {
+ using X = CtorDtorName;
+ X(); // expected-error {{expected member name}}
+ ~X(); // expected-error {{destructor cannot be declared using a type alias}}
+};
+
+namespace TagName {
+ using S = struct { int n; };
+ using T = class { int n; };
+ using U = enum { a, b, c };
+ using V = struct V { int n; };
+}
+
+namespace CWG1044 {
+ // FIXME: this is terrible. one error is plenty.
+ using T = T; // expected-error {{type name requires a specifier}} \
+ expected-error {{C++ requires a type specifier}} \
+ expected-error {{expected ';' after alias declaration}}
+}
+
+namespace StdExample {
+ template<typename T, typename U> struct pair;
+
+ using handler_t = void (*)(int);
+ extern handler_t ignore;
+ extern void (*ignore)(int);
+ // FIXME: we know we're parsing a type here; don't recover as if we were
+ // using operator*.
+ using cell = pair<void*, cell*>; // expected-error {{use of undeclared identifier 'cell'}} \
+ expected-error {{expected expression}}
+}
+
+namespace Access {
+ class C0 {
+ using U = int; // expected-note {{declared private here}}
+ };
+ C0::U v; // expected-error {{'U' is a private member}}
+ class C1 {
+ public:
+ using U = int;
+ };
+ C1::U w; // ok
+}
+
+namespace VoidArg {
+ using V = void;
+ V f(int); // ok
+ V g(V); // expected-error {{empty parameter list defined with a type alias of 'void' not allowed}}
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.string/p2.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p2.cpp
new file mode 100644
index 000000000000..3d67fccb4282
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p2.cpp
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+char test1[1]="f"; // expected-error {{initializer-string for char array is too long}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
index 5fb35ba9622b..868d009003ee 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fcxx-exceptions -fexceptions -verify %s
// When it is part of a parameter-declaration-clause, the parameter
// pack is a function parameter pack.
diff --git a/test/CXX/except/except.handle/p16.cpp b/test/CXX/except/except.handle/p16.cpp
index 24f0db08cd8d..0810be108e41 100644
--- a/test/CXX/except/except.handle/p16.cpp
+++ b/test/CXX/except/except.handle/p16.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
// The object declared in an exception-declaration or, if the
// exception-declaration does not specify a name, a temporary (12.2)
diff --git a/test/CXX/except/except.spec/p1.cpp b/test/CXX/except/except.spec/p1.cpp
new file mode 100644
index 000000000000..0559285e77a9
--- /dev/null
+++ b/test/CXX/except/except.spec/p1.cpp
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Simple parser tests, dynamic specification.
+
+namespace dyn {
+
+ struct X { };
+
+ struct Y { };
+
+ void f() throw() { }
+
+ void g(int) throw(X) { }
+
+ void h() throw(X, Y) { }
+
+ class Class {
+ void foo() throw (X, Y) { }
+ };
+
+ void (*fptr)() throw();
+
+}
+
+// Simple parser tests, noexcept specification.
+
+namespace noex {
+
+ void f1() noexcept { }
+ void f2() noexcept (true) { }
+ void f3() noexcept (false) { }
+ void f4() noexcept (1 < 2) { }
+
+ class CA1 {
+ void foo() noexcept { }
+ void bar() noexcept (true) { }
+ };
+
+ void (*fptr1)() noexcept;
+ void (*fptr2)() noexcept (true);
+
+}
+
+namespace mix {
+
+ void f() throw(int) noexcept { } // expected-error {{cannot have both}}
+ void g() noexcept throw(int) { } // expected-error {{cannot have both}}
+
+}
+
+// Sema tests, noexcept specification
+
+namespace noex {
+
+ struct A {};
+
+ void g1() noexcept(A()); // expected-error {{not contextually convertible}}
+ void g2(bool b) noexcept(b); // expected-error {{argument to noexcept specifier must be a constant expression}}
+
+}
diff --git a/test/CXX/except/except.spec/p11.cpp b/test/CXX/except/except.spec/p11.cpp
new file mode 100644
index 000000000000..268b53ad79d0
--- /dev/null
+++ b/test/CXX/except/except.spec/p11.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// This is the "let the user shoot himself in the foot" clause.
+void f() noexcept {
+ throw 0; // no-error
+}
+void g() throw() {
+ throw 0; // no-error
+}
+void h() throw(int) {
+ throw 0.0; // no-error
+}
diff --git a/test/CXX/except/except.spec/p14.cpp b/test/CXX/except/except.spec/p14.cpp
index 9450b1cf80d7..f5e83eaac618 100644
--- a/test/CXX/except/except.spec/p14.cpp
+++ b/test/CXX/except/except.spec/p14.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -verify %s
struct A { };
struct B { };
struct C { };
diff --git a/test/CXX/except/except.spec/p15.cpp b/test/CXX/except/except.spec/p15.cpp
new file mode 100644
index 000000000000..2dae9623e0cc
--- /dev/null
+++ b/test/CXX/except/except.spec/p15.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Deallocation functions are implicitly noexcept.
+// Thus, explicit specs aren't allowed to conflict.
+
+void f() {
+ // Force implicit declaration of delete.
+ delete new int;
+ delete[] new int[1];
+}
+
+void operator delete(void*) noexcept;
+void operator delete[](void*) noexcept;
+
+// Same goes for explicit declarations.
+void operator delete(void*, float);
+void operator delete(void*, float) noexcept;
+
+void operator delete[](void*, float);
+void operator delete[](void*, float) noexcept;
+
+// But explicit specs stay.
+void operator delete(void*, double) throw(int); // expected-note {{previous}}
+void operator delete(void*, double) noexcept; // expected-error {{does not match}}
diff --git a/test/CXX/except/except.spec/p2-dynamic-types.cpp b/test/CXX/except/except.spec/p2-dynamic-types.cpp
new file mode 100644
index 000000000000..57f8c3251a1c
--- /dev/null
+++ b/test/CXX/except/except.spec/p2-dynamic-types.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Dynamic specifications: valid types.
+
+struct Incomplete; // expected-note 3 {{forward declaration}}
+
+// Exception spec must not have incomplete types, or pointers to them, except
+// void.
+void ic1() throw(void); // expected-error {{incomplete type 'void' is not allowed in exception specification}}
+void ic2() throw(Incomplete); // expected-error {{incomplete type 'Incomplete' is not allowed in exception specification}}
+void ic3() throw(void*);
+void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'Incomplete' is not allowed in exception specification}}
+void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'Incomplete' is not allowed in exception specification}}
+
+// Don't suppress errors in template instantiation.
+template <typename T> struct TEx; // expected-note {{template is declared here}}
+
+void tf() throw(TEx<int>); // expected-error {{implicit instantiation of undefined template}}
+
+// DR 437, class throws itself.
+struct DR437 {
+ void f() throw(DR437);
+ void g() throw(DR437*);
+ void h() throw(DR437&);
+};
+
+// DR 437 within a nested class
+struct DR437_out {
+ struct DR437_in {
+ void f() throw(DR437_out);
+ void g() throw(DR437_out*);
+ void h() throw(DR437_out&);
+ };
+};
diff --git a/test/CXX/except/except.spec/p2-places.cpp b/test/CXX/except/except.spec/p2-places.cpp
new file mode 100644
index 000000000000..db1ee77463fb
--- /dev/null
+++ b/test/CXX/except/except.spec/p2-places.cpp
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Tests where specs are allowed and where they aren't.
+
+namespace dyn {
+
+ // Straight from the standard:
+
+ // Plain function with spec
+ void f() throw(int);
+
+ // Pointer to function with spec
+ void (*fp)() throw (int);
+
+ // Function taking reference to function with spec
+ void g(void pfa() throw(int));
+
+ // Typedef for pointer to function with spec
+ typedef int (*pf)() throw(int); // expected-error {{specifications are not allowed in typedefs}}
+
+ // Some more:
+
+ // Function returning function with spec
+ void (*h())() throw(int);
+
+ // Ultimate parser thrill: function with spec returning function with spec and
+ // taking pointer to function with spec.
+ // The actual function throws int, the return type double, the argument float.
+ void (*i() throw(int))(void (*)() throw(float)) throw(double);
+
+ // Pointer to pointer to function taking function with spec
+ void (**k)(void pfa() throw(int)); // no-error
+
+ // Pointer to pointer to function with spec
+ void (**j)() throw(int); // expected-error {{not allowed beyond a single}}
+
+ // Pointer to function returning pointer to pointer to function with spec
+ void (**(*h())())() throw(int); // expected-error {{not allowed beyond a single}}
+
+}
+
+namespace noex {
+
+ // These parallel those from above.
+
+ void f() noexcept(false);
+
+ void (*fp)() noexcept(false);
+
+ void g(void pfa() noexcept(false));
+
+ typedef int (*pf)() noexcept(false); // expected-error {{specifications are not allowed in typedefs}}
+
+ void (*h())() noexcept(false);
+
+ void (*i() noexcept(false))(void (*)() noexcept(true)) noexcept(false);
+
+ void (**k)(void pfa() noexcept(false)); // no-error
+
+ void (**j)() noexcept(false); // expected-error {{not allowed beyond a single}}
+
+ void (**(*h())())() noexcept(false); // expected-error {{not allowed beyond a single}}
+}
diff --git a/test/CXX/except/except.spec/p3.cpp b/test/CXX/except/except.spec/p3.cpp
new file mode 100644
index 000000000000..5df5f26a8f8f
--- /dev/null
+++ b/test/CXX/except/except.spec/p3.cpp
@@ -0,0 +1,106 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Exception specification compatibility.
+// We test function pointers, because functions have an extra rule in p4.
+
+// Same type is compatible
+extern void (*r1)() throw(int);
+extern void (*r1)() throw(int);
+
+// Typedefs don't matter.
+typedef int INT;
+extern void (*r2)() throw(int);
+extern void (*r2)() throw(INT);
+
+// Order doesn't matter.
+extern void (*r3)() throw(int, float);
+extern void (*r3)() throw(float, int);
+
+// MS throw-any spec and no spec at all are compatible
+extern void (*r4)();
+extern void (*r4)() throw(...);
+
+// throw(X) and no spec are not compatible
+extern void (*r5)() throw(int); // expected-note {{previous declaration}}
+extern void (*r5)(); // expected-error {{exception specification in declaration does not match}}
+
+// For functions, we accept this with a warning.
+extern void f5() throw(int); // expected-note {{previous declaration}}
+extern void f5(); // expected-warning {{missing exception specification}}
+
+// Different types are not compatible.
+extern void (*r7)() throw(int); // expected-note {{previous declaration}}
+extern void (*r7)() throw(float); // expected-error {{exception specification in declaration does not match}}
+
+// Top-level const doesn't matter.
+extern void (*r8)() throw(int);
+extern void (*r8)() throw(const int);
+
+// Multiple appearances don't matter.
+extern void (*r9)() throw(int, int);
+extern void (*r9)() throw(int, int);
+
+
+// noexcept is compatible with itself
+extern void (*r10)() noexcept;
+extern void (*r10)() noexcept;
+
+// noexcept(true) is compatible with noexcept
+extern void (*r11)() noexcept;
+extern void (*r11)() noexcept(true);
+
+// noexcept(false) isn't
+extern void (*r12)() noexcept; // expected-note {{previous declaration}}
+extern void (*r12)() noexcept(false); // expected-error {{does not match}}
+
+// The form of the boolean expression doesn't matter.
+extern void (*r13)() noexcept(1 < 2);
+extern void (*r13)() noexcept(2 > 1);
+
+// noexcept(false) is incompatible with noexcept(true)
+extern void (*r14)() noexcept(true); // expected-note {{previous declaration}}
+extern void (*r14)() noexcept(false); // expected-error {{does not match}}
+
+// noexcept(false) is compatible with itself
+extern void (*r15)() noexcept(false);
+extern void (*r15)() noexcept(false);
+
+// noexcept(false) is compatible with MS throw(...)
+extern void (*r16)() noexcept(false);
+extern void (*r16)() throw(...);
+
+// noexcept(false) is *not* compatible with no spec
+extern void (*r17)(); // expected-note {{previous declaration}}
+extern void (*r17)() noexcept(false); // expected-error {{does not match}}
+
+// except for functions
+void f17();
+void f17() noexcept(false);
+
+// noexcept(false) is compatible with dynamic specs that throw unless
+// CWG 1073 resolution is accepted. Clang implements it.
+//extern void (*r18)() throw(int);
+//extern void (*r18)() noexcept(false);
+
+// noexcept(true) is compatible with dynamic specs that don't throw
+extern void (*r19)() throw();
+extern void (*r19)() noexcept(true);
+
+// The other way round doesn't work.
+extern void (*r20)() throw(); // expected-note {{previous declaration}}
+extern void (*r20)() noexcept(false); // expected-error {{does not match}}
+
+extern void (*r21)() throw(int); // expected-note {{previous declaration}}
+extern void (*r21)() noexcept(true); // expected-error {{does not match}}
+
+
+// As a very special workaround, we allow operator new to match no spec
+// with a throw(bad_alloc) spec, because C++0x makes an incompatible change
+// here.
+extern "C++" { namespace std { class bad_alloc {}; } }
+typedef decltype(sizeof(int)) mysize_t;
+void* operator new(mysize_t) throw(std::bad_alloc);
+void* operator new(mysize_t);
+void* operator new[](mysize_t);
+void* operator new[](mysize_t) throw(std::bad_alloc);
+
diff --git a/test/CXX/except/except.spec/p5-pointers.cpp b/test/CXX/except/except.spec/p5-pointers.cpp
new file mode 100644
index 000000000000..171afff22b5b
--- /dev/null
+++ b/test/CXX/except/except.spec/p5-pointers.cpp
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Assignment of function pointers.
+
+struct A
+{
+};
+
+struct B1 : A
+{
+};
+
+struct B2 : A
+{
+};
+
+struct D : B1, B2
+{
+};
+
+struct P : private A
+{
+};
+
+// Some functions to play with below.
+void s1() throw();
+void s2() throw(int);
+void s3() throw(A);
+void s4() throw(B1);
+void s5() throw(D);
+void s6();
+void s7() throw(int, float);
+void (*s8())() throw(B1); // s8 returns a pointer to function with spec
+void s9(void (*)() throw(B1)); // s9 takes pointer to function with spec
+
+void s10() noexcept;
+void s11() noexcept(true);
+void s12() noexcept(false);
+
+void fnptrs()
+{
+ // Assignment and initialization of function pointers.
+ void (*t1)() throw() = &s1; // valid
+ t1 = &s2; // expected-error {{not superset}} expected-error {{incompatible type}}
+ t1 = &s3; // expected-error {{not superset}} expected-error {{incompatible type}}
+ void (&t2)() throw() = s2; // expected-error {{not superset}}
+ void (*t3)() throw(int) = &s2; // valid
+ void (*t4)() throw(A) = &s1; // valid
+ t4 = &s3; // valid
+ t4 = &s4; // valid
+ t4 = &s5; // expected-error {{not superset}} expected-error {{incompatible type}}
+ void (*t5)() = &s1; // valid
+ t5 = &s2; // valid
+ t5 = &s6; // valid
+ t5 = &s7; // valid
+ t1 = t3; // expected-error {{not superset}} expected-error {{incompatible type}}
+ t3 = t1; // valid
+ void (*t6)() throw(B1);
+ t6 = t4; // expected-error {{not superset}} expected-error {{incompatible type}}
+ t4 = t6; // valid
+ t5 = t1; // valid
+ t1 = t5; // expected-error {{not superset}} expected-error {{incompatible type}}
+
+ // return types and arguments must match exactly, no inheritance allowed
+ void (*(*t7)())() throw(B1) = &s8; // valid
+ void (*(*t8)())() throw(A) = &s8; // expected-error {{return types differ}}
+ void (*(*t9)())() throw(D) = &s8; // expected-error {{return types differ}}
+ void (*t10)(void (*)() throw(B1)) = &s9; // valid expected-warning{{disambiguated}}
+ void (*t11)(void (*)() throw(A)) = &s9; // expected-error {{argument types differ}} expected-warning{{disambiguated}}
+ void (*t12)(void (*)() throw(D)) = &s9; // expected-error {{argument types differ}} expected-warning{{disambiguated}}
+}
+
+// Member function stuff
+
+struct Str1 { void f() throw(int); }; // expected-note {{previous declaration}}
+void Str1::f() // expected-warning {{missing exception specification}}
+{
+}
+
+void mfnptr()
+{
+ void (Str1::*pfn1)() throw(int) = &Str1::f; // valid
+ void (Str1::*pfn2)() = &Str1::f; // valid
+ void (Str1::*pfn3)() throw() = &Str1::f; // expected-error {{not superset}}
+}
diff --git a/test/CXX/except/except.spec/p5-virtual.cpp b/test/CXX/except/except.spec/p5-virtual.cpp
new file mode 100644
index 000000000000..ceea9f8f2500
--- /dev/null
+++ b/test/CXX/except/except.spec/p5-virtual.cpp
@@ -0,0 +1,96 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// Compatibility of virtual functions.
+
+struct A
+{
+};
+
+struct B1 : A
+{
+};
+
+struct B2 : A
+{
+};
+
+struct D : B1, B2
+{
+};
+
+struct P : private A
+{
+};
+
+struct Base
+{
+ virtual void f1() throw();
+ virtual void f2() throw(int, float);
+
+ virtual void f3() throw(int, float);
+ virtual void f4() throw(A);
+ virtual void f5() throw(A, int, float);
+ virtual void f6();
+
+ virtual void f7() noexcept;
+ virtual void f8() noexcept;
+ virtual void f9() noexcept(false);
+ virtual void f10() noexcept(false);
+
+ virtual void f11() throw();
+ virtual void f12() noexcept;
+ virtual void f13() noexcept(false);
+ virtual void f14() throw(int);
+
+ virtual void f15();
+ virtual void f16();
+
+ virtual void g1() throw(); // expected-note {{overridden virtual function is here}}
+ virtual void g2() throw(int); // expected-note {{overridden virtual function is here}}
+ virtual void g3() throw(A); // expected-note {{overridden virtual function is here}}
+ virtual void g4() throw(B1); // expected-note {{overridden virtual function is here}}
+ virtual void g5() throw(A); // expected-note {{overridden virtual function is here}}
+
+ virtual void g6() noexcept; // expected-note {{overridden virtual function is here}}
+ virtual void g7() noexcept; // expected-note {{overridden virtual function is here}}
+
+ virtual void g8() noexcept; // expected-note {{overridden virtual function is here}}
+ virtual void g9() throw(); // expected-note {{overridden virtual function is here}}
+ virtual void g10() throw(int); // expected-note {{overridden virtual function is here}}
+};
+struct Derived : Base
+{
+ virtual void f1() throw();
+ virtual void f2() throw(float, int);
+
+ virtual void f3() throw(float);
+ virtual void f4() throw(B1);
+ virtual void f5() throw(B1, B2, int);
+ virtual void f6() throw(B2, B2, int, float, char, double, bool);
+
+ virtual void f7() noexcept;
+ virtual void f8() noexcept(true);
+ virtual void f9() noexcept(true);
+ virtual void f10() noexcept(false);
+
+ virtual void f11() noexcept;
+ virtual void f12() throw();
+ virtual void f13() throw(int);
+ virtual void f14() noexcept(true);
+
+ virtual void f15() noexcept;
+ virtual void f16() throw();
+
+ virtual void g1() throw(int); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g2(); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g3() throw(D); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g4() throw(A); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g5() throw(P); // expected-error {{exception specification of overriding function is more lax}}
+
+ virtual void g6() noexcept(false); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g7(); // expected-error {{exception specification of overriding function is more lax}}
+
+ virtual void g8() throw(int); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g9() noexcept(false); // expected-error {{exception specification of overriding function is more lax}}
+ virtual void g10() noexcept(false); // expected-error {{exception specification of overriding function is more lax}}
+};
diff --git a/test/CXX/except/except.spec/p9-dynamic.cpp b/test/CXX/except/except.spec/p9-dynamic.cpp
new file mode 100644
index 000000000000..490d2fa21f99
--- /dev/null
+++ b/test/CXX/except/except.spec/p9-dynamic.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
+
+void external();
+
+void target() throw(int)
+{
+ // CHECK: invoke void @_Z8externalv()
+ external();
+}
+// CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} i8* bitcast (i8** @_ZTIi to i8*), i8* null) nounwind
+// CHECK: call void @__cxa_call_unexpected
diff --git a/test/CXX/except/except.spec/p9-noexcept.cpp b/test/CXX/except/except.spec/p9-noexcept.cpp
new file mode 100644
index 000000000000..76ac66c841b9
--- /dev/null
+++ b/test/CXX/except/except.spec/p9-noexcept.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 %s -std=c++0x -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
+
+void external();
+
+void target() noexcept
+{
+ // CHECK: invoke void @_Z8externalv()
+ external();
+}
+// CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} i8* null) nounwind
+// CHECK-NEXT: call void @_ZSt9terminatev() noreturn nounwind
+// CHECK-NEXT: unreachable
+
+void reverse() noexcept(false)
+{
+ // CHECK: call void @_Z8externalv()
+ external();
+}
diff --git a/test/CXX/except/except.spec/template.cpp b/test/CXX/except/except.spec/template.cpp
new file mode 100644
index 000000000000..f8b7270344a7
--- /dev/null
+++ b/test/CXX/except/except.spec/template.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+
+// We use pointer assignment compatibility to test instantiation.
+
+template <int N> void f1() throw(int);
+template <int N> void f2() noexcept(N > 1);
+
+void (*t1)() throw(int) = &f1<0>;
+void (*t2)() throw() = &f1<0>; // expected-error {{not superset}}
+
+void (*t3)() noexcept = &f2<2>; // no-error
+void (*t4)() noexcept = &f2<0>; // expected-error {{not superset}}
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
index 6aec3a2781ef..67d853a287f8 100644
--- a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include %S/ser.h %s -o - | FileCheck %s
-// RUN: %clang_cc1 -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++0x -x c++ %S/ser.h
-// RUN: %clang_cc1 -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include-pch %t-ser.pch %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include %S/ser.h %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++0x -x c++ %S/ser.h
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include-pch %t-ser.pch %s -o - | FileCheck %s
struct D {
~D() throw();
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
index 98c6f4e09f51..28ed62c71ec0 100644
--- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x -fms-extensions %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -fms-extensions %s
#define P(e) static_assert(noexcept(e), "expected nothrow")
#define N(e) static_assert(!noexcept(e), "expected throw")
@@ -20,6 +20,8 @@ void allspec() throw(...);
void intspec() throw(int);
void emptyspec() throw();
void nothrowattr() __attribute__((nothrow));
+void noexcept_true() noexcept;
+void noexcept_false() noexcept(false);
void call() {
N(nospec());
@@ -27,6 +29,8 @@ void call() {
N(intspec());
P(emptyspec());
P(nothrowattr());
+ P(noexcept_true());
+ N(noexcept_false());
}
void (*pnospec)();
diff --git a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
index 543a86d4e351..30f8c5491951 100644
--- a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
@@ -29,8 +29,8 @@ bool b8 = !S(); //expected-error {{invalid argument type 'S'}}
namespace PR8181
{
- void f() { }
- void f(char) { }
- bool b = !&f; //expected-error {{cannot resolve overloaded function from context}}
+ void f() { } // expected-note{{candidate function}}
+ void f(char) { } // expected-note{{candidate function}}
+ bool b = !&f; //expected-error {{cannot resolve overloaded function 'f' from context}}
}
diff --git a/test/CXX/lex/lex.pptoken/p3-0x.cpp b/test/CXX/lex/lex.pptoken/p3-0x.cpp
new file mode 100644
index 000000000000..4ae867c2095e
--- /dev/null
+++ b/test/CXX/lex/lex.pptoken/p3-0x.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+int a<::> = { 1, 2, 3 };
+int b = a<:::a<:0:>:>;
+bool c = a<:0:><::b;
+
+template<int &n> void f() {}
+template void f<::b>();
+
+#define x a<:: ## : b :>
+int d = x; // expected-error {{pasting formed ':::', an invalid preprocessing token}} expected-error {{expected unqualified-id}}
diff --git a/test/CXX/over/over.over/p2-resolve-single-template-id.cpp b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
index f38a74e6e495..544a66d9e39a 100644
--- a/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
+++ b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
@@ -22,6 +22,36 @@ namespace DontResolveTooEarly_WaitForOverloadResolution
} // End namespace
+namespace DontAllowUnresolvedOverloadedExpressionInAnUnusedExpression
+{
+ void one() { }
+ template<class T> void oneT() { }
+
+ void two() { } //expected-note 2{{candidate}}
+ void two(int) { } //expected-note 2{{candidate}}
+ template<class T> void twoT() { } //expected-note 2{{candidate}}
+ template<class T> void twoT(T) { } //expected-note 2{{candidate}}
+
+ void check()
+ {
+ one; // expected-warning {{expression result unused}}
+ two; // expected-error{{cannot resolve overloaded function 'two' from context}}
+ oneT<int>; // expected-warning {{expression result unused}}
+ twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ }
+
+ // check the template function case
+ template<class T> void check()
+ {
+ one; // expected-warning {{expression result unused}}
+ two; // expected-error{{cannot resolve overloaded function 'two' from context}}
+ oneT<int>; // expected-warning {{expression result unused}}
+ twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}}
+
+ }
+
+}
+
template<typename T>
void twoT() { }
template<typename T, typename U>
@@ -45,13 +75,14 @@ namespace DontResolveTooEarly_WaitForOverloadResolution
int main()
{
+
{ static_cast<void>(one); }
{ (void)(one); }
{ static_cast<void>(oneT<int>); }
{ (void)(oneT<int>); }
- { static_cast<void>(two); } // expected-error {{address of overloaded}}
- { (void)(two); } // expected-error {{address of overloaded}}
+ { static_cast<void>(two); } // expected-error {{address of overloaded function 'two' cannot be static_cast to type 'void'}}
+ { (void)(two); } // expected-error {{address of overloaded function 'two' cannot be cast to type 'void'}}
{ static_cast<void>(twoT<int>); }
{ (void)(twoT<int>); }
@@ -92,4 +123,69 @@ int main()
}
-
+namespace member_pointers {
+ struct S {
+ template <typename T> bool f(T) { return false; }
+ template <typename T> static bool g(T) { return false; }
+
+ template <typename T> bool h(T) { return false; }
+ template <int N> static bool h(int) { return false; }
+ };
+
+ void test(S s) {
+ if (S::f<char>) return; // expected-error {{call to non-static member function without an object argument}}
+ if (S::f<int>) return; // expected-error {{call to non-static member function without an object argument}}
+ if (&S::f<char>) return;
+ if (&S::f<int>) return;
+ if (s.f<char>) return; // expected-error {{a bound member function may only be called}}
+ if (s.f<int>) return; // expected-error {{a bound member function may only be called}}
+ if (&s.f<char>) return; // expected-error {{cannot create a non-constant pointer to member function}}
+ if (&s.f<int>) return; // expected-error {{cannot create a non-constant pointer to member function}}
+
+ if (S::g<char>) return;
+ if (S::g<int>) return;
+ if (&S::g<char>) return;
+ if (&S::g<int>) return;
+ if (s.g<char>) return;
+ if (s.g<int>) return;
+ if (&s.g<char>) return;
+ if (&s.g<int>) return;
+
+ if (S::h<42>) return;
+ if (S::h<int>) return; // expected-error {{a bound member function may only be called}}
+ if (&S::h<42>) return;
+ if (&S::h<int>) return;
+ if (s.h<42>) return;
+ if (s.h<int>) return; // expected-error {{a bound member function may only be called}}
+ if (&s.h<42>) return;
+ if (&s.h<int>) return; // expected-error {{a bound member function may only be called}}
+
+ { bool b = S::f<char>; } // expected-error {{call to non-static member function without an object argument}}
+ { bool b = S::f<int>; } // expected-error {{call to non-static member function without an object argument}}
+ { bool b = &S::f<char>; }
+ { bool b = &S::f<int>; }
+ // These next two errors are terrible.
+ { bool b = s.f<char>; } // expected-error {{cannot initialize}}
+ { bool b = s.f<int>; } // expected-error {{cannot initialize}}
+ { bool b = &s.f<char>; } // expected-error {{cannot create a non-constant pointer to member function}}
+ { bool b = &s.f<int>; } // expected-error {{cannot create a non-constant pointer to member function}}
+
+ { bool b = S::g<char>; }
+ { bool b = S::g<int>; }
+ { bool b = &S::g<char>; }
+ { bool b = &S::g<int>; }
+ { bool b = s.g<char>; }
+ { bool b = s.g<int>; }
+ { bool b = &s.g<char>; }
+ { bool b = &s.g<int>; }
+
+ { bool b = S::h<42>; }
+ { bool b = S::h<int>; } // expected-error {{can't form member pointer of type 'bool' without '&' and class name}}
+ { bool b = &S::h<42>; }
+ { bool b = &S::h<int>; }
+ { bool b = s.h<42>; }
+ { bool b = s.h<int>; } // expected-error {{can't form member pointer of type 'bool' without '&' and class name}}
+ { bool b = &s.h<42>; }
+ { bool b = &s.h<int>; } // expected-error {{can't form member pointer of type 'bool' without '&' and class name}}
+ }
+}
diff --git a/test/CXX/special/class.copy/p33-0x.cpp b/test/CXX/special/class.copy/p33-0x.cpp
index 262809e35cb1..1e6a025ef31b 100644
--- a/test/CXX/special/class.copy/p33-0x.cpp
+++ b/test/CXX/special/class.copy/p33-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fsyntax-only -verify %s
class X {
X(const X&);
diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
new file mode 100644
index 000000000000..12acde143c4f
--- /dev/null
+++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -0,0 +1,210 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+namespace std {
+ template<typename T>
+ auto begin(T &&t) -> decltype(t.begin()) { return t.begin(); } // expected-note 4{{ignored: substitution failure}}
+ template<typename T>
+ auto end(T &&t) -> decltype(t.end()) { return t.end(); } // expected-note {{candidate template ignored: substitution failure [with T = }}
+
+ template<typename T>
+ auto begin(T &&t) -> decltype(t.alt_begin()) { return t.alt_begin(); } // expected-note {{selected 'begin' template [with T = }} \
+ expected-note 4{{candidate template ignored: substitution failure [with T = }}
+ template<typename T>
+ auto end(T &&t) -> decltype(t.alt_end()) { return t.alt_end(); } // expected-note {{candidate template ignored: substitution failure [with T = }}
+
+ namespace inner {
+ // These should never be considered.
+ int begin(int);
+ int end(int);
+ }
+
+ using namespace inner;
+}
+
+struct A { // expected-note {{candidate constructor}}
+ A();
+ int *begin(); // expected-note 3{{selected 'begin' function with iterator type 'int *'}} expected-note {{'begin' declared here}}
+ int *end();
+};
+
+struct B {
+ B();
+ int *alt_begin();
+ int *alt_end();
+};
+
+void f(); // expected-note {{candidate}}
+void f(int); // expected-note {{candidate}}
+
+void g() {
+ for (int a : A())
+ A __begin;
+ for (char *a : A()) { // expected-error {{cannot initialize a variable of type 'char *' with an lvalue of type 'int'}}
+ }
+ for (char *a : B()) { // expected-error {{cannot initialize a variable of type 'char *' with an lvalue of type 'int'}}
+ }
+ // FIXME: Terrible diagnostic here. auto deduction should fail, but does not!
+ for (double a : f) { // expected-error {{address of overloaded function 'f' does not match required type '<overloaded function type>'}}
+ }
+ for (auto a : A()) {
+ }
+ for (auto a : B()) {
+ }
+ for (auto *a : A()) { // expected-error {{variable 'a' with type 'auto *' has incompatible initializer of type 'int'}}
+ }
+ // : is not a typo for :: here.
+ for (A NS:A()) { // expected-error {{no viable conversion from 'int' to 'A'}}
+ }
+ for (auto not_in_scope : not_in_scope) { // expected-error {{use of undeclared identifier 'not_in_scope'}}
+ }
+
+ for (auto a : A())
+ for (auto b : A()) {
+ __range.begin(); // expected-error {{use of undeclared identifier '__range'}}
+ ++__begin; // expected-error {{use of undeclared identifier '__begin'}}
+ --__end; // expected-error {{use of undeclared identifier '__end'}}
+ }
+
+ for (char c : "test")
+ ;
+ for (auto a : f()) // expected-error {{cannot use type 'void' as a range}}
+ ;
+
+ extern int incomplete[];
+ for (auto a : incomplete) // expected-error {{cannot use incomplete type 'int []' as a range}}
+ ;
+ extern struct Incomplete also_incomplete[2]; // expected-note {{forward declaration}}
+ for (auto &a : also_incomplete) // expected-error {{cannot use incomplete type 'struct Incomplete [2]' as a range}}
+ ;
+
+ struct VoidBegin {
+ void begin(); // expected-note {{selected 'begin' function with iterator type 'void'}}
+ void end();
+ };
+ for (auto a : VoidBegin()) // expected-error {{cannot use type 'void' as an iterator}}
+ ;
+
+ struct null_t {
+ operator int*();
+ };
+ struct Differ {
+ int *begin(); // expected-note {{selected 'begin' function with iterator type 'int *'}}
+ null_t end(); // expected-note {{selected 'end' function with iterator type 'null_t'}}
+ };
+ for (auto a : Differ()) // expected-error {{'begin' and 'end' must return the same type (got 'int *' and 'null_t')}}
+ ;
+
+ for (void f() : "error") // expected-error {{for range declaration must declare a variable}}
+ ;
+
+ for (extern int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'extern'}}
+ for (static int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'static'}}
+ for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}}
+ // FIXME: when clang supports constexpr, this should be rejected.
+ for (constexpr int a : A()) {} // desired-error {{loop variable 'a' may not be declared 'constexpr'}}
+
+ struct NoBeginADL {
+ null_t alt_end();
+ };
+ struct NoEndADL {
+ null_t alt_begin();
+ };
+ for (auto u : NoBeginADL()) { // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type 'NoBeginADL'}}
+ }
+ for (auto u : NoEndADL()) { // expected-error {{no matching function for call to 'end'}} expected-note {{range has type 'NoEndADL'}}
+ }
+
+ struct NoBegin {
+ null_t end();
+ };
+ struct NoEnd {
+ null_t begin();
+ };
+ for (auto u : NoBegin()) { // expected-error {{range type 'NoBegin' has 'end' member but no 'begin' member}}
+ }
+ for (auto u : NoEnd()) { // expected-error {{range type 'NoEnd' has 'begin' member but no 'end' member}}
+ }
+
+ struct NoIncr {
+ void *begin(); // expected-note {{selected 'begin' function with iterator type 'void *'}}
+ void *end();
+ };
+ for (auto u : NoIncr()) { // expected-error {{arithmetic on pointer to void type}}
+ }
+
+ struct NoNotEq {
+ NoNotEq begin(); // expected-note {{selected 'begin' function with iterator type 'NoNotEq'}}
+ NoNotEq end();
+ void operator++();
+ };
+ for (auto u : NoNotEq()) { // expected-error {{invalid operands to binary expression}}
+ }
+
+ struct NoCopy {
+ NoCopy();
+ NoCopy(const NoCopy &) = delete;
+ int *begin();
+ int *end();
+ };
+ for (int n : NoCopy()) { // ok
+ }
+
+ for (int n : 42) { // expected-error {{no matching function for call to 'begin'}} \
+ expected-note {{range has type 'int'}}
+ }
+
+ for (auto a : *also_incomplete) { // expected-error {{cannot use incomplete type 'struct Incomplete' as a range}}
+ }
+}
+
+template<typename T, typename U>
+void h(T t) {
+ for (U u : t) { // expected-error {{no viable conversion from 'A' to 'int'}}
+ }
+ for (auto u : t) {
+ }
+}
+
+template void h<A, int>(A);
+template void h<A(&)[4], A &>(A(&)[4]);
+template void h<A(&)[13], A>(A(&)[13]);
+template void h<A(&)[13], int>(A(&)[13]); // expected-note {{requested here}}
+
+template<typename T>
+void i(T t) {
+ for (auto u : t) { // expected-error {{no matching function for call to 'begin'}} \
+ expected-error {{member function 'begin' not viable}} \
+ expected-note {{range has type}}
+ }
+}
+template void i<A[13]>(A*); // expected-note {{requested here}}
+template void i<const A>(const A); // expected-note {{requested here}}
+
+namespace NS {
+ class ADL {};
+ int *begin(ADL); // expected-note {{no known conversion from 'NS::NoADL' to 'NS::ADL'}}
+ int *end(ADL);
+
+ class NoADL {};
+}
+int *begin(NS::NoADL);
+int *end(NS::NoADL);
+
+struct VoidBeginADL {};
+void begin(VoidBeginADL); // expected-note {{selected 'begin' function with iterator type 'void'}}
+void end(VoidBeginADL);
+
+void j() {
+ for (auto u : NS::ADL()) {
+ }
+ for (auto u : NS::NoADL()) { // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type}}
+ }
+ for (auto a : VoidBeginADL()) { // expected-error {{cannot use type 'void' as an iterator}}
+ }
+}
+
+void example() {
+ int array[5] = { 1, 2, 3, 4, 5 };
+ for (int &x : array)
+ x *= 2;
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
index 2df6d33a8904..cda9ac8b045c 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
@@ -216,3 +216,21 @@ namespace ExpandingNonTypeTemplateParameters {
tuple_of_values<int&, float&>::apply<i, f, i>::type tv4; // expected-error{{too many template arguments for class template 'apply'}}
}
+
+namespace ExpandingFunctionParameters {
+ template<typename ...T>
+ struct X0 {
+ typedef int type;
+ };
+
+ template<typename ...T>
+ struct X1 {
+ template<typename ... U>
+ typename X0<T(T, U...)...>::type f(U...);
+ };
+
+ void test() {
+ X1<float> x1;
+ x1.f(17, 3.14159);
+ }
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
index e2fa12293725..71839727e0d1 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
template<typename... Types> struct tuple;
template<int I> struct int_c;
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
index 1acc21eb4fd5..25338e3bae67 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -std=c++0x -fblocks -fms-extensions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fblocks -fms-extensions -fsyntax-only -verify %s
template<typename T, typename U> struct pair;
template<typename ...> struct tuple;
@@ -205,6 +205,8 @@ struct TestUnexpandedDecls : T{
Types t; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
for (Types *t = 0; ; ) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
for (; Types *t = 0; ) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ T a[] = { T(), T(), T() };
+ for (Types t : a) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
switch(Types *t = 0) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
while(Types *t = 0) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
if (Types *t = 0) { } // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
@@ -341,6 +343,8 @@ void test_unexpanded_exprs(Types ...values) {
// SizeOfPackExpr is uninteresting
// FIXME: Objective-C expressions will need to go elsewhere
+
+ for (auto t : values) { } // expected-error{{expression contains unexpanded parameter pack 'values'}}
}
// Test unexpanded parameter packs in partial specializations.
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
index 9ec8f0c90e17..1140aaee6c17 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
@@ -29,8 +29,8 @@ struct is_same<T, T> {
int typeof0[is_same<__typeof__(f<int>), void (int)>::value? 1 : -1];
int typeof1[is_same<__typeof__(&f<int>), void (*)(int)>::value? 1 : -1];
-template <typename T> void g(T);
-template <typename T> void g(T, T);
+template <typename T> void g(T); // expected-note{{candidate function}}
+template <typename T> void g(T, T); // expected-note{{candidate function}}
int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \
- // expected-error{{cannot resolve overloaded function from context}}
+ // expected-error{{cannot resolve overloaded function 'g' from context}}
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
index ed600e4ad999..4a17ceca7cb6 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
@@ -237,3 +237,66 @@ void test_func_template(N0::X0<void *> xvp, void *vp, const void *cvp,
xvp.ft1(vp, i);
xvp.ft1(vp, u);
}
+
+namespace has_inline_namespaces {
+ inline namespace inner {
+ template<class T> void f(T&);
+
+ template<class T>
+ struct X0 {
+ struct MemberClass;
+
+ void mem_func();
+
+ template<typename U>
+ struct MemberClassTemplate;
+
+ template<typename U>
+ void mem_func_template(U&);
+
+ static int value;
+ };
+ }
+
+ struct X1;
+ struct X2;
+
+ // An explicit specialization whose declarator-id is not qualified
+ // shall be declared in the nearest enclosing namespace of the
+ // template, or, if the namespace is inline (7.3.1), any namespace
+ // from its enclosing namespace set.
+ template<> void f(X1&);
+ template<> void f<X2>(X2&);
+
+ template<> struct X0<X1> { };
+
+ template<> struct X0<X2>::MemberClass { };
+
+ template<> void X0<X2>::mem_func();
+
+ template<> template<typename T> struct X0<X2>::MemberClassTemplate { };
+
+ template<> template<typename T> void X0<X2>::mem_func_template(T&) { }
+
+ template<> int X0<X2>::value = 12;
+}
+
+struct X3;
+struct X4;
+
+template<> void has_inline_namespaces::f(X3&);
+template<> void has_inline_namespaces::f<X4>(X4&);
+
+template<> struct has_inline_namespaces::X0<X3> { };
+
+template<> struct has_inline_namespaces::X0<X4>::MemberClass { };
+
+template<> void has_inline_namespaces::X0<X4>::mem_func();
+
+template<> template<typename T>
+struct has_inline_namespaces::X0<X4>::MemberClassTemplate { };
+
+template<> template<typename T>
+void has_inline_namespaces::X0<X4>::mem_func_template(T&) { }
+
+template<> int has_inline_namespaces::X0<X4>::value = 13;
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
index 1032a87def13..229523557008 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -237,3 +237,15 @@ void test_func_template(N0::X0<void *> xvp, void *vp, const void *cvp,
xvp.ft1(vp, i);
xvp.ft1(vp, u);
}
+
+namespace PR8979 {
+ template<typename Z>
+ struct X0 {
+ template <class T, class U> class Inner;
+ struct OtherInner;
+ template<typename T, typename U> void f(Inner<T, U>&);
+
+ typedef Inner<OtherInner, OtherInner> MyInner;
+ template<> void f(MyInner&); // expected-error{{cannot specialize a function 'f' within class scope}}
+ };
+}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
index d8f7b52145dd..d0df305941d9 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1-emit.cpp
@@ -12,16 +12,16 @@ T X<T>::member1;
template<typename T>
T X<T>::member2 = 17;
-// CHECK: @_ZN1XIiE7member1E = weak global i32 0
+// CHECK: @_ZN1XIiE7member1E = weak_odr global i32 0
template int X<int>::member1;
-// CHECK: @_ZN1XIiE7member2E = weak global i32 17
+// CHECK: @_ZN1XIiE7member2E = weak_odr global i32 17
template int X<int>::member2;
// For implicit instantiation of
long& get(bool Cond1, bool Cond2) {
- // CHECK: @_ZN1XIlE7member1E = weak global i64 0
- // CHECK: @_ZN1XIlE7member2E = weak global i64 17
+ // CHECK: @_ZN1XIlE7member1E = weak_odr global i64 0
+ // CHECK: @_ZN1XIlE7member2E = weak_odr global i64 17
// CHECK: @_ZN1XIlE7member3E = external global i64
return Cond1? X<long>::member1
: Cond2? X<long>::member2
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp
new file mode 100644
index 000000000000..fdb922abcf9b
--- /dev/null
+++ b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -std=c++0x -verify %s
+
+// If the name declared in the explicit instantiation is an
+// unqualified name, the explicit instantiation shall appear in the
+// namespace where its template is declared or, if that namespace is
+// inline (7.3.1), any namespace from its enclosing namespace set.
+
+namespace has_inline_namespaces {
+ inline namespace inner {
+ template<class T> void f(T&) {}
+
+ template<class T>
+ struct X0 {
+ struct MemberClass {};
+
+ void mem_func() {}
+
+ template<typename U>
+ struct MemberClassTemplate {};
+
+ template<typename U>
+ void mem_func_template(U&) {}
+
+ static int value;
+ };
+ }
+
+ template<typename T> int X0<T>::value = 17;
+
+ struct X1 {};
+ struct X2 {};
+
+ template void f(X1&);
+ template void f<X2>(X2&);
+
+ template struct X0<X1>;
+
+ template struct X0<X2>::MemberClass;
+
+ template void X0<X2>::mem_func();
+
+ template struct X0<X2>::MemberClassTemplate<X1>;
+
+ template void X0<X2>::mem_func_template(X1&);
+
+ template int X0<X2>::value;
+}
+
+struct X3;
+struct X4;
+
+template void has_inline_namespaces::f(X3&);
+template void has_inline_namespaces::f<X4>(X4&);
+
+template struct has_inline_namespaces::X0<X3>;
+
+template struct has_inline_namespaces::X0<X4>::MemberClass;
+
+template void has_inline_namespaces::X0<X4>::mem_func();
+
+template
+struct has_inline_namespaces::X0<X4>::MemberClassTemplate<X3>;
+
+template
+void has_inline_namespaces::X0<X4>::mem_func_template(X3&);
diff --git a/test/CodeCompletion/PR9728.cpp b/test/CodeCompletion/PR9728.cpp
new file mode 100644
index 000000000000..91f49be91fcf
--- /dev/null
+++ b/test/CodeCompletion/PR9728.cpp
@@ -0,0 +1,9 @@
+namespace N {
+struct SFoo;
+}
+
+struct brokenfile_t {
+ brokenfile_t (N::
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:20 %s -o - | FileCheck %s
+ // CHECK: SFoo
+
diff --git a/test/CodeCompletion/ordinary-name.cpp b/test/CodeCompletion/ordinary-name.cpp
index 6771dd226518..4dbf84dc1783 100644
--- a/test/CodeCompletion/ordinary-name.cpp
+++ b/test/CodeCompletion/ordinary-name.cpp
@@ -4,7 +4,7 @@ typedef struct t TYPEDEF;
void foo() {
int y = 17;
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: COMPLETION: bool
// CHECK-CC1-NEXT: COMPLETION: char
// CHECK-CC1-NEXT: COMPLETION: class
@@ -132,7 +132,7 @@ void foo() {
// CHECK-CC3-NEXT: COMPLETION: wchar_t
// CHECK-CC3-NEXT: COMPLETION: X : X
- // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+ // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: COMPLETION: bool
// CHECK-CC4-NEXT: COMPLETION: char
// CHECK-CC4-NEXT: COMPLETION: class
@@ -173,3 +173,57 @@ void foo() {
// CHECK-CC4-NEXT: COMPLETION: X : X
// CHECK-CC4-NEXT: COMPLETION: y : [#int#]y
// CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>)
+
+ // RUN: %clang_cc1 -fsyntax-only -fno-rtti -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-NO-RTTI %s
+ // CHECK-NO-RTTI: COMPLETION: bool
+ // CHECK-NO-RTTI-NEXT: COMPLETION: char
+ // CHECK-NO-RTTI-NEXT: COMPLETION: class
+ // CHECK-NO-RTTI-NEXT: COMPLETION: const
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
+ // CHECK-NO-RTTI: COMPLETION: Pattern : delete <#expression#>
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : delete [] <#expression#>
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do{<#statements#>
+ // CHECK-NO-RTTI: COMPLETION: double
+ // CHECK-NO-RTTI-NOT: dynamic_cast
+ // CHECK-NO-RTTI: COMPLETION: enum
+ // CHECK-NO-RTTI-NEXT: COMPLETION: extern
+ // CHECK-NO-RTTI-NEXT: COMPLETION: false
+ // CHECK-NO-RTTI-NEXT: COMPLETION: float
+ // CHECK-NO-RTTI-NEXT: COMPLETION: foo : [#void#]foo()
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
+ // CHECK-NO-RTTI: COMPLETION: Pattern : goto <#label#>
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
+ // CHECK-NO-RTTI: COMPLETION: int
+ // CHECK-NO-RTTI-NEXT: COMPLETION: long
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
+ // CHECK-NO-RTTI-NEXT: COMPLETION: operator
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : return
+ // CHECK-NO-RTTI-NEXT: COMPLETION: short
+ // CHECK-NO-RTTI-NEXT: COMPLETION: signed
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>)
+ // CHECK-NO-RTTI-NEXT: COMPLETION: static
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
+ // CHECK-NO-RTTI-NEXT: COMPLETION: struct
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : switch(<#condition#>){
+ // CHECK-NO-RTTI: COMPLETION: t : t
+ // CHECK-NO-RTTI-NOT: throw
+ // CHECK-NO-RTTI: COMPLETION: true
+ // CHECK-NO-RTTI-NOT: try
+ // CHECK-NO-RTTI: COMPLETION: TYPEDEF : TYPEDEF
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
+ // CHECK-NO-RTTI-NOT: typeid
+ // CHECK-NO-RTTI: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof <#expression#>
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof(<#type#>)
+ // CHECK-NO-RTTI-NEXT: COMPLETION: union
+ // CHECK-NO-RTTI-NEXT: COMPLETION: unsigned
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
+ // CHECK-NO-RTTI-NEXT: COMPLETION: void
+ // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
+ // CHECK-NO-RTTI-NEXT: COMPLETION: wchar_t
+ // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
+ // CHECK-NO-RTTI: COMPLETION: X : X
+ // CHECK-NO-RTTI-NEXT: COMPLETION: y : [#int#]y
+ // CHECK-NO-RTTI-NEXT: COMPLETION: z : [#void#]z(<#int#>)
diff --git a/test/CodeGen/2008-07-17-no-emit-on-error.c b/test/CodeGen/2008-07-17-no-emit-on-error.c
index 855ede7ab02b..2cae57b3d89f 100644
--- a/test/CodeGen/2008-07-17-no-emit-on-error.c
+++ b/test/CodeGen/2008-07-17-no-emit-on-error.c
@@ -1,9 +1,9 @@
// RUN: rm -f %t1.bc
// RUN: %clang_cc1 -DPASS %s -emit-llvm-bc -o %t1.bc
-// RUN: test -f %t1.bc
+// RUN: opt %t1.bc -disable-output
// RUN: rm -f %t1.bc
// RUN: not %clang_cc1 %s -emit-llvm-bc -o %t1.bc
-// RUN: not test -f %t1.bc
+// RUN: not opt %t1.bc -disable-output
void f() {
}
diff --git a/test/CodeGen/altivec.c b/test/CodeGen/altivec.c
index 9e38df50930c..ec1efd9ba197 100644
--- a/test/CodeGen/altivec.c
+++ b/test/CodeGen/altivec.c
@@ -1,4 +1,31 @@
// RUN: %clang_cc1 -faltivec -triple powerpc-unknown-unknown -emit-llvm %s -o - | FileCheck %s
-// CHECK: @test0 = global <4 x i32> <i32 1, i32 1, i32 1, i32 1>
-vector int test0 = (vector int)(1);
+// Check initialization
+
+vector int test0 = (vector int)(1); // CHECK: @test0 = global <4 x i32> <i32 1, i32 1, i32 1, i32 1>
+vector float test1 = (vector float)(1.0); // CHECK: @test1 = global <4 x float> <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
+
+void test2()
+{
+ vector int vi;
+ vector float vf;
+ vi = (vector int)(1); // CHECK: <i32 1, i32 1, i32 1, i32 1>
+ vf = (vector float)(1.0); // CHECK: <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
+ vi = (vector int)(1, 2, 3, 4); // CHECK: <i32 1, i32 2, i32 3, i32 4>
+ vi = (vector int)(1, 2, 3, 4, 5); // CHECK: <i32 1, i32 2, i32 3, i32 4>
+
+ vi = (vector int){1}; // CHECK: <i32 1, i32 0, i32 0, i32 0>
+ vi = (vector int){1, 2}; // CHECK: <i32 1, i32 2, i32 0, i32 0>
+ vi = (vector int){1, 2, 3, 4}; // CHECK: <i32 1, i32 2, i32 3, i32 4>
+
+}
+
+// Check pre/post increment/decrement
+void test3() {
+ vector int vi;
+ vi++; // CHECK: add nsw <4 x i32> {{.*}} <i32 1, i32 1, i32 1, i32 1>
+ vector unsigned int vui;
+ --vui; // CHECK: add <4 x i32> {{.*}} <i32 -1, i32 -1, i32 -1, i32 -1>
+ vector float vf;
+ vf++; // CHECK: fadd <4 x float> {{.*}} <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
+}
diff --git a/test/CodeGen/arm-clear.c b/test/CodeGen/arm-clear.c
new file mode 100644
index 000000000000..eda64ce99ee4
--- /dev/null
+++ b/test/CodeGen/arm-clear.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple armv7-apple-darwin9 -emit-llvm -w -o - %s | FileCheck %s
+
+void clear0(void *ptr) {
+ // CHECK: clear0
+ // CHECK-NOT: load i8**
+ __clear_cache();
+}
+
+void clear1(void *ptr) {
+ // CHECK: clear1
+ // CHECK: load i8**
+ // CHECK-NOT: load i8**
+ __clear_cache(ptr);
+}
+
+void clear2(void *ptr, void *ptr2) {
+ // CHECK: clear2
+ // CHECK: load i8**
+ // CHECK: load i8**
+ __clear_cache(ptr, ptr2);
+}
diff --git a/test/CodeGen/arm-pcs.c b/test/CodeGen/arm-pcs.c
new file mode 100644
index 000000000000..d722f84cebd7
--- /dev/null
+++ b/test/CodeGen/arm-pcs.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple arm-none-linux-gnueabi -emit-llvm -w -o - < %s | FileCheck %s
+typedef int __attribute__((pcs("aapcs"))) (*aapcs_fn)(void);
+typedef int __attribute__((pcs("aapcs-vfp"))) (*aapcs_vfp_fn)(void);
+
+aapcs_fn bar;
+
+int foo(aapcs_vfp_fn baz) {
+// CHECK: define i32 @foo
+// CHECK: call arm_aapcscc
+// CHECK: call arm_aapcs_vfpcc
+ return bar() + baz();
+}
diff --git a/test/CodeGen/arm-vector-align.c b/test/CodeGen/arm-vector-align.c
new file mode 100644
index 000000000000..c1119cb5b736
--- /dev/null
+++ b/test/CodeGen/arm-vector-align.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin \
+// RUN: -target-abi apcs-gnu \
+// RUN: -target-cpu cortex-a8 \
+// RUN: -mfloat-abi soft \
+// RUN: -target-feature +soft-float-abi \
+// RUN: -ffreestanding \
+// RUN: -emit-llvm -w -o - %s | FileCheck %s
+
+#include <arm_neon.h>
+
+// Radar 9311427: Check that alignment specifier is used in Neon load/store
+// intrinsics.
+typedef float AlignedAddr __attribute__ ((aligned (16)));
+void t1(AlignedAddr *addr1, AlignedAddr *addr2) {
+// CHECK: call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* %{{.*}}, i32 16)
+ float32x4_t a = vld1q_f32(addr1);
+// CHECK: call void @llvm.arm.neon.vst1.v4f32(i8* %{{.*}}, <4 x float> %{{.*}}, i32 16)
+ vst1q_f32(addr2, a);
+}
diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c
index 4a7c13f03c41..8ce2d96043f2 100644
--- a/test/CodeGen/atomic.c
+++ b/test/CodeGen/atomic.c
@@ -44,6 +44,11 @@ int atomic(void) {
// CHECK: call i32 @llvm.atomic.swap.i32.p0i32(i32* %val, i32 7)
// CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ old = __sync_swap(&val, 8);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.swap.i32.p0i32(i32* %val, i32 8)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_val_compare_and_swap(&val, 4, 1976);
// CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
// CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %val, i32 4, i32 1976)
diff --git a/test/CodeGen/attr-availability.c b/test/CodeGen/attr-availability.c
new file mode 100644
index 000000000000..6f9c045a3f17
--- /dev/null
+++ b/test/CodeGen/attr-availability.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -fvisibility hidden "-triple" "x86_64-apple-darwin8.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_4 %s
+// RUN: %clang_cc1 -fvisibility hidden "-triple" "x86_64-apple-darwin9.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_5 %s
+// RUN: %clang_cc1 -fvisibility hidden "-triple" "x86_64-apple-darwin10.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_6 %s
+
+// CHECK-10_4: define hidden void @f2
+// CHECK-10_5: define hidden void @f2
+// CHECK-10_6: define hidden void @f2
+void f2();
+void f2() { }
+
+// CHECK-10_4: define void @f3
+// CHECK-10_5: define void @f3
+// CHECK-10_6: define void @f3
+void f3() __attribute__((availability(macosx,introduced=10.5)));
+void f3() { }
+
+// CHECK-10_4: declare extern_weak void @f0
+// CHECK-10_5: declare void @f0
+// CHECK-10_6: declare void @f0
+void f0() __attribute__((availability(macosx,introduced=10.5)));
+
+// CHECK-10_4: declare extern_weak void @f1
+// CHECK-10_5: declare extern_weak void @f1
+// CHECK-10_6: declare void @f1
+void f1() __attribute__((availability(macosx,introduced=10.6)));
+
+void test() {
+ f0();
+ f1();
+ f2();
+}
diff --git a/test/CodeGen/block-byref-aggr.c b/test/CodeGen/block-byref-aggr.c
new file mode 100644
index 000000000000..3027df04861c
--- /dev/null
+++ b/test/CodeGen/block-byref-aggr.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s
+// rdar://9309454
+
+typedef struct { int v; } RetType;
+
+RetType func();
+
+int main () {
+ __attribute__((__blocks__(byref))) RetType a = {100};
+
+ a = func();
+}
+// CHECK: [[C1:%.*]] = call i32 (...)* @func()
+// CHECK-NEXT: [[CO:%.*]] = getelementptr
+// CHECK-NEXT: store i32 [[C1]], i32* [[CO]]
+// CHECK-NEXT: [[FORWARDING:%.*]] = getelementptr inbounds [[BR:%.*]]* [[A:%.*]], i32 0, i32 1
+// CHECK-NEXT: [[O:%.*]] = load [[BR]]** [[FORWARDING]]
diff --git a/test/CodeGen/builtin-attributes.c b/test/CodeGen/builtin-attributes.c
index afde3fab8481..822b8eecf7d7 100644
--- a/test/CodeGen/builtin-attributes.c
+++ b/test/CodeGen/builtin-attributes.c
@@ -10,3 +10,8 @@ void f0() {
void f1() {
exit(1);
}
+
+// CHECK: call i8* @strstr{{.*}} nounwind
+char* f2(char* a, char* b) {
+ return __builtin_strstr(a, b);
+}
diff --git a/test/CodeGen/builtin-expect.c b/test/CodeGen/builtin-expect.c
index 8f02c4da78a4..88479d90a092 100644
--- a/test/CodeGen/builtin-expect.c
+++ b/test/CodeGen/builtin-expect.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
int x;
int y(void);
@@ -9,3 +9,13 @@ void FUNC() {
foo ();
}
+// rdar://9330105
+void isigprocmask(void);
+long bar();
+
+int main() {
+ (void) __builtin_expect((isigprocmask(), 0), bar());
+}
+
+// CHECK: call void @isigprocmask()
+// CHECK: [[C:%.*]] = call i64 (...)* @bar()
diff --git a/test/CodeGen/builtin-memfns.c b/test/CodeGen/builtin-memfns.c
index e8c407fd6f27..fb4d7200752d 100644
--- a/test/CodeGen/builtin-memfns.c
+++ b/test/CodeGen/builtin-memfns.c
@@ -1,12 +1,13 @@
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm < %s| FileCheck %s
+// CHECK: @test1
// CHECK: call void @llvm.memset.p0i8.i32
// CHECK: call void @llvm.memset.p0i8.i32
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i32
// CHECK: call void @llvm.memmove.p0i8.p0i8.i32
// CHECK-NOT: __builtin
// CHECK: ret
-int main(int argc, char **argv) {
+int test1(int argc, char **argv) {
unsigned char a = 0x11223344;
unsigned char b = 0x11223344;
__builtin_bzero(&a, sizeof(a));
@@ -15,3 +16,35 @@ int main(int argc, char **argv) {
__builtin_memmove(&a, &b, sizeof(a));
return 0;
}
+
+// rdar://9289468
+
+// CHECK: @test2
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i32
+char* test2(char* a, char* b) {
+ return __builtin_memcpy(a, b, 4);
+}
+
+// CHECK: @test3
+// CHECK: call void @llvm.memset
+void test3(char *P) {
+ __builtin___memset_chk(P, 42, 128, 128);
+}
+
+// CHECK: @test4
+// CHECK: call void @llvm.memcpy
+void test4(char *P, char *Q) {
+ __builtin___memcpy_chk(P, Q, 128, 128);
+}
+
+// CHECK: @test5
+// CHECK: call void @llvm.memmove
+void test5(char *P, char *Q) {
+ __builtin___memmove_chk(P, Q, 128, 128);
+}
+
+// CHECK: @test6
+// CHECK: call void @llvm.memcpy
+int test6(char *X) {
+ return __builtin___memcpy_chk(X, X, 42, 42) != 0;
+}
diff --git a/test/CodeGen/builtinmemcpy.c b/test/CodeGen/builtinmemcpy.c
deleted file mode 100644
index 93253c5a8a48..000000000000
--- a/test/CodeGen/builtinmemcpy.c
+++ /dev/null
@@ -1,3 +0,0 @@
-// RUN: %clang_cc1 -emit-llvm < %s -o - | grep "llvm.memcpy"
-
-char* x(char* a, char* b) {return __builtin_memcpy(a, b, 4);}
diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c
index e03e69c28cfe..586f1133a8dc 100644
--- a/test/CodeGen/builtins-ppc-altivec.c
+++ b/test/CodeGen/builtins-ppc-altivec.c
@@ -1789,23 +1789,23 @@ void test6() {
/* vec_lvlx */
res_vsc = vec_lvlx(0, &param_sc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vsc = vec_lvlx(0, &vsc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vuc = vec_lvlx(0, &param_uc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vuc = vec_lvlx(0, &vuc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbc = vec_lvlx(0, &vbc); // CHECK: @llvm.ppc.altivec.lvx
@@ -1814,23 +1814,23 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
res_vs = vec_lvlx(0, &param_s); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vs = vec_lvlx(0, &vs); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vus = vec_lvlx(0, &param_us); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vus = vec_lvlx(0, &vus); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbs = vec_lvlx(0, &vbs); // CHECK: @llvm.ppc.altivec.lvx
@@ -1844,23 +1844,23 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
res_vi = vec_lvlx(0, &param_i); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vi = vec_lvlx(0, &vi); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vui = vec_lvlx(0, &param_ui); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vui = vec_lvlx(0, &vui); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbi = vec_lvlx(0, &vbi); // CHECK: @llvm.ppc.altivec.lvx
@@ -1869,29 +1869,29 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
res_vf = vec_lvlx(0, &vf); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
/* vec_lvlxl */
res_vsc = vec_lvlxl(0, &param_sc); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vsc = vec_lvlxl(0, &vsc); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vuc = vec_lvlxl(0, &param_uc); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vuc = vec_lvlxl(0, &vuc); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbc = vec_lvlxl(0, &vbc); // CHECK: @llvm.ppc.altivec.lvxl
@@ -1900,23 +1900,23 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
res_vs = vec_lvlxl(0, &param_s); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vs = vec_lvlxl(0, &vs); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vus = vec_lvlxl(0, &param_us); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vus = vec_lvlxl(0, &vus); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbs = vec_lvlxl(0, &vbs); // CHECK: @llvm.ppc.altivec.lvxl
@@ -1930,23 +1930,23 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
res_vi = vec_lvlxl(0, &param_i); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vi = vec_lvlxl(0, &vi); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vui = vec_lvlxl(0, &param_ui); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vui = vec_lvlxl(0, &vui); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbi = vec_lvlxl(0, &vbi); // CHECK: @llvm.ppc.altivec.lvxl
@@ -1955,29 +1955,29 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
res_vf = vec_lvlxl(0, &vf); // CHECK: @llvm.ppc.altivec.lvxl
- // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
/* vec_lvrx */
- res_vsc = vec_lvrx(0, &param_sc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vsc = vec_lvrx(0, &param_sc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vsc = vec_lvrx(0, &vsc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vsc = vec_lvrx(0, &vsc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vuc = vec_lvrx(0, &param_uc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vuc = vec_lvrx(0, &param_uc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vuc = vec_lvrx(0, &vuc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vuc = vec_lvrx(0, &vuc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbc = vec_lvrx(0, &vbc); // CHECK: store <16 x i8> zeroinitializer
@@ -1985,24 +1985,24 @@ void test6() {
// CHECK: @llvm.ppc.altivec.lvsl
// CHECK: @llvm.ppc.altivec.vperm
- res_vs = vec_lvrx(0, &param_s); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vs = vec_lvrx(0, &param_s); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vs = vec_lvrx(0, &vs); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vs = vec_lvrx(0, &vs); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vus = vec_lvrx(0, &param_us); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vus = vec_lvrx(0, &param_us); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vus = vec_lvrx(0, &vus); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vus = vec_lvrx(0, &vus); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbs = vec_lvrx(0, &vbs); // CHECK: store <8 x i16> zeroinitializer
@@ -2015,24 +2015,24 @@ void test6() {
// CHECK: @llvm.ppc.altivec.lvsl
// CHECK: @llvm.ppc.altivec.vperm
- res_vi = vec_lvrx(0, &param_i); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vi = vec_lvrx(0, &param_i); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vi = vec_lvrx(0, &vi); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vi = vec_lvrx(0, &vi); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vui = vec_lvrx(0, &param_ui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vui = vec_lvrx(0, &param_ui); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vui = vec_lvrx(0, &vui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vui = vec_lvrx(0, &vui); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbi = vec_lvrx(0, &vbi); // CHECK: store <4 x i32> zeroinitializer
@@ -2040,30 +2040,30 @@ void test6() {
// CHECK: @llvm.ppc.altivec.lvsl
// CHECK: @llvm.ppc.altivec.vperm
- res_vf = vec_lvrx(0, &vf); // CHECK: store <4 x float> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ res_vf = vec_lvrx(0, &vf); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
/* vec_lvrxl */
- res_vsc = vec_lvrxl(0, &param_sc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vsc = vec_lvrxl(0, &param_sc); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vsc = vec_lvrxl(0, &vsc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vsc = vec_lvrxl(0, &vsc); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vuc = vec_lvrxl(0, &param_uc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vuc = vec_lvrxl(0, &param_uc); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vuc = vec_lvrxl(0, &vuc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vuc = vec_lvrxl(0, &vuc); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbc = vec_lvrxl(0, &vbc); // CHECK: store <16 x i8> zeroinitializer
@@ -2071,24 +2071,24 @@ void test6() {
// CHECK: @llvm.ppc.altivec.lvsl
// CHECK: @llvm.ppc.altivec.vperm
- res_vs = vec_lvrxl(0, &param_s); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vs = vec_lvrxl(0, &param_s); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vs = vec_lvrxl(0, &vs); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vs = vec_lvrxl(0, &vs); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vus = vec_lvrxl(0, &param_us); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vus = vec_lvrxl(0, &param_us); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vus = vec_lvrxl(0, &vus); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vus = vec_lvrxl(0, &vus); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbs = vec_lvrxl(0, &vbs); // CHECK: store <8 x i16> zeroinitializer
@@ -2101,24 +2101,24 @@ void test6() {
// CHECK: @llvm.ppc.altivec.lvsl
// CHECK: @llvm.ppc.altivec.vperm
- res_vi = vec_lvrxl(0, &param_i); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vi = vec_lvrxl(0, &param_i); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vi = vec_lvrxl(0, &vi); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vi = vec_lvrxl(0, &vi); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vui = vec_lvrxl(0, &param_ui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vui = vec_lvrxl(0, &param_ui); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
- res_vui = vec_lvrxl(0, &vui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vui = vec_lvrxl(0, &vui); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
res_vbi = vec_lvrxl(0, &vbi); // CHECK: store <4 x i32> zeroinitializer
@@ -2126,39 +2126,39 @@ void test6() {
// CHECK: @llvm.ppc.altivec.lvsl
// CHECK: @llvm.ppc.altivec.vperm
- res_vf = vec_lvrxl(0, &vf); // CHECK: store <4 x float> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvxl
+ res_vf = vec_lvrxl(0, &vf); // CHECK: @llvm.ppc.altivec.lvxl
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
/* vec_stvlx */
- vec_stvlx(vsc, 0, &param_sc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vsc, 0, &param_sc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vsc, 0, &vsc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vsc, 0, &vsc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vuc, 0, &param_uc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vuc, 0, &param_uc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vuc, 0, &vuc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vuc, 0, &vuc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2172,33 +2172,33 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vs, 0, &param_s); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vs, 0, &param_s); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vs, 0, &vs); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vs, 0, &vs); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vus, 0, &param_us); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vus, 0, &param_us); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vus, 0, &vus); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vus, 0, &vus); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2220,33 +2220,33 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vi, 0, &param_i); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vi, 0, &param_i); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vi, 0, &vi); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vi, 0, &vi); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vui, 0, &param_ui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vui, 0, &param_ui); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vui, 0, &vui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vui, 0, &vui); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2260,42 +2260,42 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
- vec_stvlx(vf, 0, &vf); // CHECK: store <4 x float> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlx(vf, 0, &vf); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
/* vec_stvlxl */
- vec_stvlxl(vsc, 0, &param_sc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vsc, 0, &param_sc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vsc, 0, &vsc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vsc, 0, &vsc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vuc, 0, &param_uc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vuc, 0, &param_uc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vuc, 0, &vuc); // CHECK: store <16 x i8> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vuc, 0, &vuc); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2309,33 +2309,33 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vs, 0, &param_s); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vs, 0, &param_s); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vs, 0, &vs); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vs, 0, &vs); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vus, 0, &param_us); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vus, 0, &param_us); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vus, 0, &vus); // CHECK: store <8 x i16> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vus, 0, &vus); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2357,33 +2357,33 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vi, 0, &param_i); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vi, 0, &param_i); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vi, 0, &vi); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vi, 0, &vi); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vui, 0, &param_ui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vui, 0, &param_ui); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vui, 0, &vui); // CHECK: store <4 x i32> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vui, 0, &vui); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2397,9 +2397,9 @@ void test6() {
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
- vec_stvlxl(vf, 0, &vf); // CHECK: store <4 x float> zeroinitializer
- // CHECK: @llvm.ppc.altivec.lvx
+ vec_stvlxl(vf, 0, &vf); // CHECK: @llvm.ppc.altivec.lvx
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2407,32 +2407,32 @@ void test6() {
/* vec_stvrx */
vec_stvrx(vsc, 0, &param_sc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vsc, 0, &vsc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vuc, 0, &param_uc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vuc, 0, &vuc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2447,32 +2447,32 @@ void test6() {
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vs, 0, &param_s); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vs, 0, &vs); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vus, 0, &param_us); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vus, 0, &vus); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2495,32 +2495,32 @@ void test6() {
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vi, 0, &param_i); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vi, 0, &vi); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vui, 0, &param_ui); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vui, 0, &vui); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2535,8 +2535,8 @@ void test6() {
// CHECK: @llvm.ppc.altivec.stvx
vec_stvrx(vf, 0, &vf); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2544,32 +2544,32 @@ void test6() {
/* vec_stvrxl */
vec_stvrxl(vsc, 0, &param_sc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vsc, 0, &vsc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vuc, 0, &param_uc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vuc, 0, &vuc); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <16 x i8> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2584,32 +2584,32 @@ void test6() {
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vs, 0, &param_s); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vs, 0, &vs); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vus, 0, &param_us); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vus, 0, &vus); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <8 x i16> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2632,32 +2632,32 @@ void test6() {
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vi, 0, &param_i); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vi, 0, &vi); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vui, 0, &param_ui); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vui, 0, &vui); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x i32> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -2672,8 +2672,8 @@ void test6() {
// CHECK: @llvm.ppc.altivec.stvxl
vec_stvrxl(vf, 0, &vf); // CHECK: @llvm.ppc.altivec.lvx
- // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: store <4 x float> zeroinitializer
// CHECK: @llvm.ppc.altivec.vperm
// CHECK: @llvm.ppc.altivec.lvsr
// CHECK: @llvm.ppc.altivec.vperm
@@ -3053,7 +3053,7 @@ void test6() {
res_i = vec_any_out(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpbfp.p
}
-/* ------------------------------ Relational Operators------------------------------- */
+/* ------------------------------ Relational Operators ------------------------------ */
// CHECK: define void @test7
void test7() {
vector signed char vsc1 = (vector signed char)(-1);
@@ -3113,14 +3113,3 @@ void test7() {
res_i = (vf1 <= vf2); // CHECK: @llvm.ppc.altivec.vcmpgefp.p(i32 2
res_i = (vf1 >= vf2); // CHECK: @llvm.ppc.altivec.vcmpgefp.p(i32 2
}
-
-/* ------------------------------- increment/decrement: ----------------------------- */
-// CHECK: define void @test8
-void test8() {
- vector int vi;
- vi++; // CHECK: add nsw <4 x i32> {{.*}} <i32 1, i32 1, i32 1, i32 1>
- vector unsigned int vui;
- --vui; // CHECK: add <4 x i32> {{.*}} <i32 -1, i32 -1, i32 -1, i32 -1>
- vector float vf;
- vf++; // CHECK: fadd <4 x float> {{.*}} <float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}, float 1.000000e+{{0+}}>
-}
diff --git a/test/CodeGen/builtins-ptx.c b/test/CodeGen/builtins-ptx.c
new file mode 100644
index 000000000000..6dd10188e9fb
--- /dev/null
+++ b/test/CodeGen/builtins-ptx.c
@@ -0,0 +1,99 @@
+// RUN: %clang_cc1 -triple ptx32-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple ptx64-unknown-unknown -emit-llvm -o %t %s
+
+
+int read_tid() {
+
+ int x = __builtin_ptx_read_tid_x();
+ int y = __builtin_ptx_read_tid_y();
+ int z = __builtin_ptx_read_tid_z();
+ int w = __builtin_ptx_read_tid_w();
+
+ return x + y + z + w;
+
+}
+
+int read_ntid() {
+
+ int x = __builtin_ptx_read_ntid_x();
+ int y = __builtin_ptx_read_ntid_y();
+ int z = __builtin_ptx_read_ntid_z();
+ int w = __builtin_ptx_read_ntid_w();
+
+ return x + y + z + w;
+
+}
+
+int read_ctaid() {
+
+ int x = __builtin_ptx_read_ctaid_x();
+ int y = __builtin_ptx_read_ctaid_y();
+ int z = __builtin_ptx_read_ctaid_z();
+ int w = __builtin_ptx_read_ctaid_w();
+
+ return x + y + z + w;
+
+}
+
+int read_nctaid() {
+
+ int x = __builtin_ptx_read_nctaid_x();
+ int y = __builtin_ptx_read_nctaid_y();
+ int z = __builtin_ptx_read_nctaid_z();
+ int w = __builtin_ptx_read_nctaid_w();
+
+ return x + y + z + w;
+
+}
+
+int read_ids() {
+
+ int a = __builtin_ptx_read_laneid();
+ int b = __builtin_ptx_read_warpid();
+ int c = __builtin_ptx_read_nwarpid();
+ int d = __builtin_ptx_read_smid();
+ int e = __builtin_ptx_read_nsmid();
+ int f = __builtin_ptx_read_gridid();
+
+ return a + b + c + d + e + f;
+
+}
+
+int read_lanemasks() {
+
+ int a = __builtin_ptx_read_lanemask_eq();
+ int b = __builtin_ptx_read_lanemask_le();
+ int c = __builtin_ptx_read_lanemask_lt();
+ int d = __builtin_ptx_read_lanemask_ge();
+ int e = __builtin_ptx_read_lanemask_gt();
+
+ return a + b + c + d + e;
+
+}
+
+
+long read_clocks() {
+
+ int a = __builtin_ptx_read_clock();
+ long b = __builtin_ptx_read_clock64();
+
+ return (long)a + b;
+
+}
+
+int read_pms() {
+
+ int a = __builtin_ptx_read_pm0();
+ int b = __builtin_ptx_read_pm1();
+ int c = __builtin_ptx_read_pm2();
+ int d = __builtin_ptx_read_pm3();
+
+ return a + b + c + d;
+
+}
+
+void sync() {
+
+ __builtin_ptx_bar_sync(0);
+
+}
diff --git a/test/CodeGen/builtins-x86.c b/test/CodeGen/builtins-x86.c
index 56f220b8a6e8..bb63048b6166 100644
--- a/test/CodeGen/builtins-x86.c
+++ b/test/CodeGen/builtins-x86.c
@@ -273,7 +273,6 @@ void f0() {
#endif
tmp_V2i = __builtin_ia32_cvttps2pi(tmp_V4f);
(void) __builtin_ia32_maskmovq(tmp_V8c, tmp_V8c, tmp_cp);
- tmp_V4f = __builtin_ia32_loadups(tmp_fCp);
(void) __builtin_ia32_storeups(tmp_fp, tmp_V4f);
(void) __builtin_ia32_storehps(tmp_V2ip, tmp_V4f);
(void) __builtin_ia32_storelps(tmp_V2ip, tmp_V4f);
@@ -291,7 +290,6 @@ void f0() {
tmp_V4f = __builtin_ia32_sqrtps(tmp_V4f);
tmp_V4f = __builtin_ia32_sqrtss(tmp_V4f);
(void) __builtin_ia32_maskmovdqu(tmp_V16c, tmp_V16c, tmp_cp);
- tmp_V2d = __builtin_ia32_loadupd(tmp_dCp);
(void) __builtin_ia32_storeupd(tmp_dp, tmp_V2d);
tmp_i = __builtin_ia32_movmskpd(tmp_V2d);
tmp_i = __builtin_ia32_pmovmskb128(tmp_V16c);
@@ -481,4 +479,33 @@ void f0() {
__builtin_ia32_maskstoreps(tmp_V4fp, tmp_V4f, tmp_V4f);
__builtin_ia32_maskstorepd256(tmp_V4dp, tmp_V4d, tmp_V4d);
__builtin_ia32_maskstoreps256(tmp_V8fp, tmp_V8f, tmp_V8f);
+
+#ifdef USE_3DNOW
+ tmp_V8c = __builtin_ia32_pavgusb(tmp_V8c, tmp_V8c);
+ tmp_V2i = __builtin_ia32_pf2id(tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfacc(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfadd(tmp_V2f, tmp_V2f);
+ tmp_V2i = __builtin_ia32_pfcmpeq(tmp_V2f, tmp_V2f);
+ tmp_V2i = __builtin_ia32_pfcmpge(tmp_V2f, tmp_V2f);
+ tmp_V2i = __builtin_ia32_pfcmpgt(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfmax(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfmin(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfmul(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfrcp(tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfrcpit1(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfrcpit2(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfrsqrt(tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfrsqit1(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfrsqrtit1(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfsub(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfsubr(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pi2fd(tmp_V2i);
+ tmp_V4s = __builtin_ia32_pmulhrw(tmp_V4s, tmp_V4s);
+ tmp_V2i = __builtin_ia32_pf2iw(tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfnacc(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pfpnacc(tmp_V2f, tmp_V2f);
+ tmp_V2f = __builtin_ia32_pi2fw(tmp_V2i);
+ tmp_V2f = __builtin_ia32_pswapdsf(tmp_V2f);
+ tmp_V2i = __builtin_ia32_pswapdsi(tmp_V2i);
+#endif
}
diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c
index 40f77249f918..fca087e197fc 100644
--- a/test/CodeGen/builtins.c
+++ b/test/CodeGen/builtins.c
@@ -138,7 +138,7 @@ void bar() {
// LLVM's hex representation of float constants is really unfortunate;
// basically it does a float-to-double "conversion" and then prints the
- // hex form of that. That gives us wierd artifacts like exponents
+ // hex form of that. That gives us weird artifacts like exponents
// that aren't numerically similar to the original exponent and
// significand bit-patterns that are offset by three bits (because
// the exponent was expanded from 8 bits to 11).
diff --git a/test/CodeGen/char-literal.c b/test/CodeGen/char-literal.c
index aff76d280d30..322041c0049a 100644
--- a/test/CodeGen/char-literal.c
+++ b/test/CodeGen/char-literal.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -x c++ -triple i386-unknown-unkown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
// Runs in c++ mode so that wchar_t is available.
int main() {
diff --git a/test/CodeGen/conditional.c b/test/CodeGen/conditional.c
index d079aafd787a..15e15f11e35f 100644
--- a/test/CodeGen/conditional.c
+++ b/test/CodeGen/conditional.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
float test1(int cond, float a, float b) {
return cond ? a : b;
@@ -47,3 +47,22 @@ void test9(struct test9 *p) {
p ? p : test9spare();
}
+// CHECK: @test10
+// CHECK: select i1 {{.*}}, i32 4, i32 5
+int test10(int c) {
+ return c ? 4 : 5;
+}
+enum { Gronk = 5 };
+
+// rdar://9289603
+// CHECK: @test11
+// CHECK: select i1 {{.*}}, i32 4, i32 5
+int test11(int c) {
+ return c ? 4 : Gronk;
+}
+
+// CHECK: @test12
+// CHECK: select i1 {{.*}}, double 4.0{{.*}}, double 2.0
+double test12(int c) {
+ return c ? 4.0 : 2.0;
+}
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index 32b762d646e6..c6778630a0a0 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -4,6 +4,10 @@
// Brace-enclosed string array initializers
char a[] = { "asdf" };
+// CHECK: @a = global [5 x i8] c"asdf\00"
+
+char a2[2][5] = { "asdf" };
+// CHECK: @a2 = global [2 x [5 x i8]] {{\[}}[5 x i8] c"asdf\00", [5 x i8] zeroinitializer]
// Double-implicit-conversions of array/functions (not legal C, but
// clang accepts it for gcc compat).
diff --git a/test/CodeGen/darwin-string-literals.c b/test/CodeGen/darwin-string-literals.c
index ef5601e8f224..6f9e0d2a63ed 100644
--- a/test/CodeGen/darwin-string-literals.c
+++ b/test/CodeGen/darwin-string-literals.c
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s
// CHECK-LSB: @.str = private unnamed_addr constant [8 x i8] c"string0\00"
-// CHECK-LSB: @.str1 = private unnamed_addr constant [8 x i8] c"string1\00"
+// CHECK-LSB: @.str1 = linker_private unnamed_addr constant [8 x i8] c"string1\00"
// CHECK-LSB: @.str2 = internal unnamed_addr constant [36 x i8] c"h\00e\00l\00l\00o\00 \00\92! \00\03& \00\90! \00w\00o\00r\00l\00d\00\00\00", align 2
// RUN: %clang_cc1 -triple powerpc-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix MSB %s
// CHECK-MSB: @.str = private unnamed_addr constant [8 x i8] c"string0\00"
-// CHECK-MSB: @.str1 = private unnamed_addr constant [8 x i8] c"string1\00"
+// CHECK-MSB: @.str1 = linker_private unnamed_addr constant [8 x i8] c"string1\00"
// CHECK-MSB: @.str2 = internal unnamed_addr constant [36 x i8] c"\00h\00e\00l\00l\00o\00 !\92\00 &\03\00 !\90\00 \00w\00o\00r\00l\00d\00\00", align 2
const char *g0 = "string0";
diff --git a/test/CodeGen/debug-info-line2.c b/test/CodeGen/debug-info-line2.c
new file mode 100644
index 000000000000..b5eba8a1a060
--- /dev/null
+++ b/test/CodeGen/debug-info-line2.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-darwin-apple -g -emit-llvm -o - %s | FileCheck %s
+// Radar 9199234
+
+int bar();
+int foo(int i) {
+ int j = 0;
+ if (i) {
+ j = bar();
+//CHECK: store i32
+//CHECK-NOT: br label %{{%[a-zA-Z0-9\.]+}}, !dbg
+ }
+ else
+ {
+ j = bar() + 2;
+ }
+ return j;
+}
diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c
index 5be421623616..7a9971ee1812 100644
--- a/test/CodeGen/decl.c
+++ b/test/CodeGen/decl.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -w -emit-llvm < %s | FileCheck %s
-// CHECK: @test1.x = private constant [12 x i32] [i32 1
+// 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 }
diff --git a/test/CodeGen/ext-vector.c b/test/CodeGen/ext-vector.c
index daa18265a49f..1abd9f27ae12 100644
--- a/test/CodeGen/ext-vector.c
+++ b/test/CodeGen/ext-vector.c
@@ -1,13 +1,18 @@
-// RUN: %clang_cc1 -emit-llvm-only %s
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
typedef __attribute__(( ext_vector_type(4) )) float float4;
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef __attribute__(( ext_vector_type(4) )) int int4;
+typedef __attribute__(( ext_vector_type(4) )) unsigned int uint4;
+// CHECK: @foo = global <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>
float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };
+// CHECK: @bar = constant <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 0x7FF0000000000000>
const float4 bar = (float4){ 1.0, 2.0, 3.0, __builtin_inff() };
+// CHECK: @test1
+// CHECK: fadd <4 x float>
float4 test1(float4 V) {
return V.wzyx+V;
}
@@ -16,6 +21,12 @@ float2 vec2, vec2_2;
float4 vec4, vec4_2;
float f;
+// CHECK: @test2
+// CHECK: shufflevector {{.*}} <i32 0, i32 1>
+// CHECK: extractelement
+// CHECK: shufflevector {{.*}} <i32 1, i32 1, i32 1, i32 1>
+// CHECK: insertelement
+// CHECK: shufflevector {{.*}} <i32 1, i32 0>
void test2() {
vec2 = vec4.xy; // shorten
f = vec2.x; // extract elt
@@ -25,10 +36,15 @@ void test2() {
vec2.yx = vec2; // reverse
}
+// CHECK: @test3
+// CHECK: store <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>
void test3(float4 *out) {
*out = ((float4) {1.0f, 2.0f, 3.0f, 4.0f });
}
+// CHECK: @test4
+// CHECK: store <4 x float>
+// CHECK: store <4 x float>
void test4(float4 *out) {
float a = 1.0f;
float b = 2.0f;
@@ -37,6 +53,12 @@ void test4(float4 *out) {
*out = ((float4) {a,b,c,d});
}
+// CHECK: @test5
+// CHECK: shufflevector {{.*}} <4 x i32> zeroinitializer
+// CHECK: fmul <4 x float>
+// CHECK: fmul <4 x float>
+// CHECK: shufflevector {{.*}} <4 x i32> zeroinitializer
+// CHECK: fmul <4 x float>
void test5(float4 *out) {
float a;
float4 b;
@@ -50,25 +72,42 @@ void test5(float4 *out) {
*out = b;
}
+// CHECK: @test6
void test6(float4 *ap, float4 *bp, float c) {
float4 a = *ap;
float4 b = *bp;
-
+
+ // CHECK: fadd <4 x float>
+ // CHECK: fsub <4 x float>
+ // CHECK: fmul <4 x float>
+ // CHECK: fdiv <4 x float>
a = a + b;
a = a - b;
a = a * b;
a = a / b;
-
+
+ // CHECK: fadd <4 x float>
+ // CHECK: fsub <4 x float>
+ // CHECK: fmul <4 x float>
+ // CHECK: fdiv <4 x float>
a = a + c;
a = a - c;
a = a * c;
a = a / c;
+ // CHECK: fadd <4 x float>
+ // CHECK: fsub <4 x float>
+ // CHECK: fmul <4 x float>
+ // CHECK: fdiv <4 x float>
a += b;
a -= b;
a *= b;
a /= b;
-
+
+ // CHECK: fadd <4 x float>
+ // CHECK: fsub <4 x float>
+ // CHECK: fmul <4 x float>
+ // CHECK: fdiv <4 x float>
a += c;
a -= c;
a *= c;
@@ -87,76 +126,153 @@ void test6(float4 *ap, float4 *bp, float c) {
#endif
}
+// CHECK: @test7
void test7(int4 *ap, int4 *bp, int c) {
int4 a = *ap;
int4 b = *bp;
-
+
+ // CHECK: add nsw <4 x i32>
+ // CHECK: sub nsw <4 x i32>
+ // CHECK: mul nsw <4 x i32>
+ // CHECK: sdiv <4 x i32>
+ // CHECK: srem <4 x i32>
a = a + b;
a = a - b;
a = a * b;
a = a / b;
a = a % b;
-
+
+ // CHECK: add nsw <4 x i32>
+ // CHECK: sub nsw <4 x i32>
+ // CHECK: mul nsw <4 x i32>
+ // CHECK: sdiv <4 x i32>
+ // CHECK: srem <4 x i32>
a = a + c;
a = a - c;
a = a * c;
a = a / c;
a = a % c;
+ // CHECK: add nsw <4 x i32>
+ // CHECK: sub nsw <4 x i32>
+ // CHECK: mul nsw <4 x i32>
+ // CHECK: sdiv <4 x i32>
+ // CHECK: srem <4 x i32>
a += b;
a -= b;
a *= b;
a /= b;
a %= b;
-
+
+ // CHECK: add nsw <4 x i32>
+ // CHECK: sub nsw <4 x i32>
+ // CHECK: mul nsw <4 x i32>
+ // CHECK: sdiv <4 x i32>
+ // CHECK: srem <4 x i32>
a += c;
a -= c;
a *= c;
a /= c;
a %= c;
+
// Vector comparisons.
+ // CHECK: icmp slt
+ // CHECK: icmp sle
+ // CHECK: icmp sgt
+ // CHECK: icmp sge
+ // CHECK: icmp eq
+ // CHECK: icmp ne
int4 cmp;
cmp = a < b;
cmp = a <= b;
- cmp = a < b;
+ cmp = a > b;
cmp = a >= b;
cmp = a == b;
cmp = a != b;
}
+// CHECK: @test8
void test8(float4 *ap, float4 *bp, int c) {
float4 a = *ap;
float4 b = *bp;
// Vector comparisons.
+ // CHECK: fcmp olt
+ // CHECK: fcmp ole
+ // CHECK: fcmp ogt
+ // CHECK: fcmp oge
+ // CHECK: fcmp oeq
+ // CHECK: fcmp une
int4 cmp;
cmp = a < b;
cmp = a <= b;
- cmp = a < b;
+ cmp = a > b;
cmp = a >= b;
cmp = a == b;
cmp = a != b;
}
+// CHECK: @test9
+// CHECK: extractelement <4 x i32>
int test9(int4 V) {
return V.xy.x;
}
+// CHECK: @test10
+// CHECK: add nsw <4 x i32>
+// CHECK: extractelement <4 x i32>
int test10(int4 V) {
return (V+V).x;
}
+// CHECK: @test11
+// CHECK: extractelement <4 x i32>
int4 test11a();
int test11() {
return test11a().x;
}
+// CHECK: @test12
+// CHECK: shufflevector {{.*}} <i32 2, i32 1, i32 0>
+// CHECK: shufflevector {{.*}} <i32 0, i32 1, i32 2, i32 undef>
+// CHECK: shufflevector {{.*}} <i32 4, i32 5, i32 6, i32 3>
int4 test12(int4 V) {
V.xyz = V.zyx;
return V;
}
+// CHECK: @test13
+// CHECK: shufflevector {{.*}} <i32 2, i32 1, i32 0, i32 3>
int4 test13(int4 *V) {
return V->zyxw;
}
+
+// CHECK: @test14
+void test14(uint4 *ap, uint4 *bp, unsigned c) {
+ uint4 a = *ap;
+ uint4 b = *bp;
+
+ // CHECK: udiv <4 x i32>
+ // CHECK: urem <4 x i32>
+ a = a / b;
+ a = a % b;
+
+ // CHECK: udiv <4 x i32>
+ // CHECK: urem <4 x i32>
+ a = a / c;
+ a = a % c;
+
+ // CHECK: icmp ult
+ // CHECK: icmp ule
+ // CHECK: icmp ugt
+ // CHECK: icmp uge
+ // CHECK: icmp eq
+ // CHECK: icmp ne
+ a = a < b;
+ a = a <= b;
+ a = a > b;
+ a = a >= b;
+ a = a == b;
+ a = a != b;
+}
diff --git a/test/CodeGen/integer-overflow.c b/test/CodeGen/integer-overflow.c
index 103cc8427bb0..1d460656a1c7 100644
--- a/test/CodeGen/integer-overflow.c
+++ b/test/CodeGen/integer-overflow.c
@@ -49,4 +49,18 @@ void test1() {
// TRAPV: llvm.sadd.with.overflow.i32({{.*}}, i32 -1)
// TRAPV_HANDLER: foo(
--a;
+
+ // -fwrapv should turn off inbounds for GEP's, PR9256
+ extern int* P;
+ ++P;
+ // DEFAULT: getelementptr inbounds i32*
+ // WRAPV: getelementptr i32*
+ // TRAPV: getelementptr inbounds i32*
+
+ // PR9350: char increment never overflows.
+ extern volatile signed char PR9350;
+ // DEFAULT: add i8 {{.*}}, 1
+ // WRAPV: add i8 {{.*}}, 1
+ // TRAPV: add i8 {{.*}}, 1
+ ++PR9350;
}
diff --git a/test/CodeGen/mangle.c b/test/CodeGen/mangle.c
index 3bbd9c8b807e..46ef512f6950 100644
--- a/test/CodeGen/mangle.c
+++ b/test/CodeGen/mangle.c
@@ -63,3 +63,12 @@ int func(void) {
// CHECK: @_Z4foo9Dv4_f
typedef __attribute__(( vector_size(16) )) float float4;
void __attribute__((__overloadable__)) foo9(float4 f) {}
+
+// Intrinsic calls.
+extern int llvm_cas(volatile int*, int, int)
+ __asm__("llvm.atomic.cmp.swap.i32.p0i32");
+
+int foo10(volatile int* add, int from, int to) {
+ // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32
+ return llvm_cas(add, from, to);
+}
diff --git a/test/CodeGen/mmx-inline-asm.c b/test/CodeGen/mmx-inline-asm.c
new file mode 100644
index 000000000000..c473a930ecc8
--- /dev/null
+++ b/test/CodeGen/mmx-inline-asm.c
@@ -0,0 +1,22 @@
+// RUN: %clang -mmmx -ccc-host-triple i386-unknown-unknown -emit-llvm -S %s -o - | FileCheck %s
+// <rdar://problem/9091220>
+#include <mmintrin.h>
+
+// CHECK: type { x86_mmx, x86_mmx, x86_mmx, x86_mmx, x86_mmx, x86_mmx, x86_mmx }
+
+void foo(long long fill) {
+ __m64 vfill = _mm_cvtsi64_m64(fill);
+ __m64 v1, v2, v3, v4, v5, v6, v7;
+
+ __asm__ __volatile__ (
+ "\tmovq %7, %0\n"
+ "\tmovq %7, %1\n"
+ "\tmovq %7, %2\n"
+ "\tmovq %7, %3\n"
+ "\tmovq %7, %4\n"
+ "\tmovq %7, %5\n"
+ "\tmovq %7, %6"
+ : "=&y" (v1), "=&y" (v2), "=&y" (v3),
+ "=&y" (v4), "=&y" (v5), "=&y" (v6), "=y" (v7)
+ : "y" (vfill));
+}
diff --git a/test/CodeGen/mrtd.c b/test/CodeGen/mrtd.c
new file mode 100644
index 000000000000..2cc71bb0086f
--- /dev/null
+++ b/test/CodeGen/mrtd.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -mrtd -triple i386-unknown-freebsd9.0 -emit-llvm -o - %s | FileCheck %s
+
+void baz(int arg);
+
+// CHECK: define x86_stdcallcc void @foo(i32 %arg) nounwind
+void foo(int arg) {
+// CHECK: call x86_stdcallcc i32 (...)* @bar(i32
+ bar(arg);
+// CHECK: call x86_stdcallcc void @baz(i32
+ baz(arg);
+}
+
+// CHECK: declare x86_stdcallcc i32 @bar(...)
+
+// CHECK: declare x86_stdcallcc void @baz(i32)
diff --git a/test/CodeGen/ms_struct-bitfield-init.c b/test/CodeGen/ms_struct-bitfield-init.c
new file mode 100644
index 000000000000..7a483fb84b8b
--- /dev/null
+++ b/test/CodeGen/ms_struct-bitfield-init.c
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s
+// rdar://8823265
+
+extern void abort(void);
+#define ATTR __attribute__((__ms_struct__))
+
+struct
+{
+ char foo;
+ long : 0;
+ char : 0;
+ int : 0;
+ char bar;
+} ATTR t1 = {'a', 'b'};
+
+struct
+{
+ char bar0;
+ long : 0;
+ int : 0;
+ char bar1;
+ char bar2;
+ long : 0;
+ char bar3;
+ char bar4;
+ char : 0;
+ char bar5;
+ char bar6;
+ char : 0;
+ char bar7;
+ char bar8;
+} ATTR t2 = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'};
+
+struct {
+ int : 0;
+ int i1;
+ int : 0;
+ int i2;
+ int : 0;
+ int i3;
+ int : 0;
+ int i4;
+} t3 = {1,2,3,4};
+
+int main() {
+ if (sizeof(t1) != 2)
+ abort();
+ if (t1.foo != 'a')
+ abort();
+ if (t1.bar != 'b')
+ abort();
+ t1.foo = 'c';
+ t1.bar = 'd';
+ if (t1.foo != 'c')
+ abort();
+ if (t1.bar != 'd')
+ abort();
+ if (sizeof(t2) != 9)
+ abort();
+ if (t2.bar0 != 'a' || t2.bar8 != 'i')
+ abort();
+ if (sizeof(t3) != 16)
+ abort();
+ if (t3.i1 != 1 || t3.i4 != 4)
+ abort();
+ return 0;
+}
+
diff --git a/test/CodeGen/ms_struct-bitfield.c b/test/CodeGen/ms_struct-bitfield.c
new file mode 100644
index 000000000000..a8f4c91a4937
--- /dev/null
+++ b/test/CodeGen/ms_struct-bitfield.c
@@ -0,0 +1,131 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s
+// rdar://8823265
+
+#define ATTR __attribute__((__ms_struct__))
+
+struct
+{
+ char foo;
+ long : 0;
+ char bar;
+} ATTR t1;
+
+struct
+{
+ char foo;
+ long : 0;
+ char : 0;
+ int : 0;
+ char bar;
+} ATTR t2;
+
+struct
+{
+ char foo;
+ long : 0;
+ char : 0;
+ int : 0;
+ char bar;
+ long : 0;
+ char : 0;
+} ATTR t3;
+
+struct
+{
+ long : 0;
+ char bar;
+} ATTR t4;
+
+struct
+{
+ long : 0;
+ long : 0;
+ char : 0;
+ char bar;
+} ATTR t5;
+
+struct
+{
+ long : 0;
+ long : 0;
+ char : 0;
+ char bar;
+} ATTR t6;
+
+struct
+{
+ char foo;
+ long : 0;
+ int : 0;
+ char bar;
+ char bar1;
+ long : 0;
+ char bar2;
+ char bar3;
+ char : 0;
+ char bar4;
+ char bar5;
+ char : 0;
+ char bar6;
+ char bar7;
+} ATTR t7;
+
+struct
+{
+ long : 0;
+ long : 0;
+ char : 0;
+} ATTR t8;
+
+struct
+{
+ char foo;
+ long : 0;
+ int : 0;
+ char bar;
+ char bar1;
+ long : 0;
+ char bar2;
+ char bar3;
+ char : 0;
+ char bar4;
+ char bar5;
+ char : 0;
+ char bar6;
+ char bar7;
+ int i1;
+ char : 0;
+ long : 0;
+ char :4;
+ char bar8;
+ char : 0;
+ char bar9;
+ char bar10;
+ int i2;
+ char : 0;
+ long : 0;
+ char :4;
+} ATTR t9;
+
+struct
+{
+ char foo: 8;
+ long : 0;
+ char bar;
+} ATTR t10;
+
+static int arr1[(sizeof(t1) == 2) -1];
+static int arr2[(sizeof(t2) == 2) -1];
+static int arr3[(sizeof(t3) == 2) -1];
+static int arr4[(sizeof(t4) == 1) -1];
+static int arr5[(sizeof(t5) == 1) -1];
+static int arr6[(sizeof(t6) == 1) -1];
+static int arr7[(sizeof(t7) == 9) -1];
+static int arr8[(sizeof(t8) == 0) -1];
+static int arr9[(sizeof(t9) == 28) -1];
+static int arr10[(sizeof(t10) == 16) -1];
+
+int main() {
+ return 0;
+}
+
diff --git a/test/CodeGen/mult-alt-x86.c b/test/CodeGen/mult-alt-x86.c
index 84011f2d5303..4e2a69d85bdd 100644
--- a/test/CodeGen/mult-alt-x86.c
+++ b/test/CodeGen/mult-alt-x86.c
@@ -194,70 +194,70 @@ void single_Z()
void multi_R()
{
// CHECK: asm "foo $1,$0", "=*r|R|m,r|R|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=R,=m" (mout0) : "r,R,m" (min1));
+ asm("foo %1,%0" : "=r,R,m" (mout0) : "r,R,m" (min1));
}
// CHECK: @multi_q
void multi_q()
{
// CHECK: asm "foo $1,$0", "=*r|q|m,r|q|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=q,=m" (mout0) : "r,q,m" (min1));
+ asm("foo %1,%0" : "=r,q,m" (mout0) : "r,q,m" (min1));
}
// CHECK: @multi_Q
void multi_Q()
{
// CHECK: asm "foo $1,$0", "=*r|Q|m,r|Q|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=Q,=m" (mout0) : "r,Q,m" (min1));
+ asm("foo %1,%0" : "=r,Q,m" (mout0) : "r,Q,m" (min1));
}
// CHECK: @multi_a
void multi_a()
{
// CHECK: asm "foo $1,$0", "=*r|{ax}|m,r|{ax}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=a,=m" (mout0) : "r,a,m" (min1));
+ asm("foo %1,%0" : "=r,a,m" (mout0) : "r,a,m" (min1));
}
// CHECK: @multi_b
void multi_b()
{
// CHECK: asm "foo $1,$0", "=*r|{bx}|m,r|{bx}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=b,=m" (mout0) : "r,b,m" (min1));
+ asm("foo %1,%0" : "=r,b,m" (mout0) : "r,b,m" (min1));
}
// CHECK: @multi_c
void multi_c()
{
// CHECK: asm "foo $1,$0", "=*r|{cx}|m,r|{cx}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=c,=m" (mout0) : "r,c,m" (min1));
+ asm("foo %1,%0" : "=r,c,m" (mout0) : "r,c,m" (min1));
}
// CHECK: @multi_d
void multi_d()
{
- // CHECK: asm "foo $1,$0", "=*r|{dx}|m,r|{dx}[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=d,=m" (mout0) : "r,d" (min1));
+ // CHECK: asm "foo $1,$0", "=*r|{dx}|m,r|{dx}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,d,m" (mout0) : "r,d,m" (min1));
}
// CHECK: @multi_S
void multi_S()
{
// CHECK: asm "foo $1,$0", "=*r|{si}|m,r|{si}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=S,=m" (mout0) : "r,S,m" (min1));
+ asm("foo %1,%0" : "=r,S,m" (mout0) : "r,S,m" (min1));
}
// CHECK: @multi_D
void multi_D()
{
// CHECK: asm "foo $1,$0", "=*r|{di}|m,r|{di}|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=D,=m" (mout0) : "r,D,m" (min1));
+ asm("foo %1,%0" : "=r,D,m" (mout0) : "r,D,m" (min1));
}
// CHECK: @multi_A
void multi_A()
{
// CHECK: asm "foo $1,$0", "=*r|A|m,r|A|m[[CLOBBERS]](i32* @mout0, i32 {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=A,=m" (mout0) : "r,A,m" (min1));
+ asm("foo %1,%0" : "=r,A,m" (mout0) : "r,A,m" (min1));
}
// CHECK: @multi_f
@@ -282,93 +282,93 @@ void multi_u()
void multi_y()
{
// CHECK: asm "foo $1,$0", "=*r|y|m,r|y|m[[CLOBBERS]](double* @dout0, double {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=y,=m" (dout0) : "r,y,m" (din1));
+ asm("foo %1,%0" : "=r,y,m" (dout0) : "r,y,m" (din1));
}
// CHECK: @multi_x
void multi_x()
{
// CHECK: asm "foo $1,$0", "=*r|x|m,r|x|m[[CLOBBERS]](double* @dout0, double {{[a-zA-Z0-9@%]+}})
- asm("foo %1,%0" : "=r,=x,=m" (dout0) : "r,x,m" (din1));
+ asm("foo %1,%0" : "=r,x,m" (dout0) : "r,x,m" (din1));
}
// CHECK: @multi_Y
void multi_Y0()
{
// Y constraint currently broken.
- //asm("foo %1,%0" : "=r,=Y0,=m" (mout0) : "r,Y0,m" (min1));
- //asm("foo %1,%0" : "=r,=Yz,=m" (mout0) : "r,Yz,m" (min1));
- //asm("foo %1,%0" : "=r,=Yt,=m" (mout0) : "r,Yt,m" (min1));
- //asm("foo %1,%0" : "=r,=Yi,=m" (mout0) : "r,Yi,m" (min1));
- //asm("foo %1,%0" : "=r,=Ym,=m" (mout0) : "r,Ym,m" (min1));
+ //asm("foo %1,%0" : "=r,Y0,m" (mout0) : "r,Y0,m" (min1));
+ //asm("foo %1,%0" : "=r,Yz,m" (mout0) : "r,Yz,m" (min1));
+ //asm("foo %1,%0" : "=r,Yt,m" (mout0) : "r,Yt,m" (min1));
+ //asm("foo %1,%0" : "=r,Yi,m" (mout0) : "r,Yi,m" (min1));
+ //asm("foo %1,%0" : "=r,Ym,m" (mout0) : "r,Ym,m" (min1));
}
// CHECK: @multi_I
void multi_I()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|I|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,I,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,I,m" (1));
}
// CHECK: @multi_J
void multi_J()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|J|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,J,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,J,m" (1));
}
// CHECK: @multi_K
void multi_K()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|K|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,K,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,K,m" (1));
}
// CHECK: @multi_L
void multi_L()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|L|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,L,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,L,m" (1));
}
// CHECK: @multi_M
void multi_M()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|M|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,M,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,M,m" (1));
}
// CHECK: @multi_N
void multi_N()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|N|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,N,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,N,m" (1));
}
// CHECK: @multi_G
void multi_G()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|G|m[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,G,m" (1.0));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,G,m" (1.0));
}
// CHECK: @multi_C
void multi_C()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|C|m[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,C,m" (1.0));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,C,m" (1.0));
}
// CHECK: @multi_e
void multi_e()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|e|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,e,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,e,m" (1));
}
// CHECK: @multi_Z
void multi_Z()
{
// CHECK: asm "foo $1,$0", "=*r|m|m,r|Z|m[[CLOBBERS]](i32* @mout0, i32 1)
- asm("foo %1,%0" : "=r,=m,=m" (mout0) : "r,Z,m" (1));
+ asm("foo %1,%0" : "=r,m,m" (mout0) : "r,Z,m" (1));
}
diff --git a/test/CodeGen/packed-arrays.c b/test/CodeGen/packed-arrays.c
new file mode 100644
index 000000000000..785db4d2dde2
--- /dev/null
+++ b/test/CodeGen/packed-arrays.c
@@ -0,0 +1,157 @@
+// RUN: %clang_cc1 -triple x86_64-unk-unk -emit-llvm -Os -o %t %s
+// RUN: FileCheck < %t %s
+
+struct s0 {
+ unsigned int x[2] __attribute__((packed));
+};
+
+struct s1 {
+ unsigned int x[2] __attribute__((packed));
+ unsigned int y;
+ unsigned int z __attribute__((packed));
+};
+
+struct s2 {
+ unsigned int x[2] __attribute__((packed));
+ unsigned int y __attribute__((packed));
+ unsigned int z __attribute__((packed));
+};
+
+struct __attribute__((packed)) s3 {
+ unsigned int x[2];
+ unsigned int y;
+ unsigned int z;
+};
+
+// CHECK: @align0 = global i32 1
+int align0 = __alignof(struct s0);
+// CHECK: @align1 = global i32 4
+int align1 = __alignof(struct s1);
+// CHECK: @align2 = global i32 1
+int align2 = __alignof(struct s2);
+// CHECK: @align3 = global i32 1
+int align3 = __alignof(struct s3);
+
+// CHECK: @align0_x = global i32 1
+int align0_x = __alignof(((struct s0*) 0)->x);
+// We are currently incompatible with GCC here. <rdar://problem/9217290>
+//
+// CHECK-XFAIL: @align1_x = global i32 1
+// CHECK: @align1_x = global i32 4
+int align1_x = __alignof(((struct s1*) 0)->x);
+// CHECK: @align2_x = global i32 1
+int align2_x = __alignof(((struct s2*) 0)->x);
+// CHECK: @align3_x = global i32 1
+int align3_x = __alignof(((struct s3*) 0)->x);
+
+// CHECK: @align0_x0 = global i32 4
+int align0_x0 = __alignof(((struct s0*) 0)->x[0]);
+// CHECK: @align1_x0 = global i32 4
+int align1_x0 = __alignof(((struct s1*) 0)->x[0]);
+// CHECK: @align2_x0 = global i32 4
+int align2_x0 = __alignof(((struct s2*) 0)->x[0]);
+// CHECK: @align3_x0 = global i32 4
+int align3_x0 = __alignof(((struct s3*) 0)->x[0]);
+
+// CHECK: define i32 @f0_a
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+// CHECK: define i32 @f0_b
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+int f0_a(struct s0 *a) {
+ return a->x[1];
+}
+int f0_b(struct s0 *a) {
+ return *(a->x + 1);
+}
+
+// CHECK: define i32 @f1_a
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+// CHECK: define i32 @f1_b
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+
+// Note that we are incompatible with GCC on these two examples.
+//
+// CHECK: define i32 @f1_c
+// CHECK-XFAIL: load i32* %{{.*}}, align 1
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+// CHECK: define i32 @f1_d
+// CHECK-XFAIL: load i32* %{{.*}}, align 1
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+int f1_a(struct s1 *a) {
+ return a->x[1];
+}
+int f1_b(struct s1 *a) {
+ return *(a->x + 1);
+}
+int f1_c(struct s1 *a) {
+ return a->y;
+}
+int f1_d(struct s1 *a) {
+ return a->z;
+}
+
+// CHECK: define i32 @f2_a
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+// CHECK: define i32 @f2_b
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+// CHECK: define i32 @f2_c
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+// CHECK: define i32 @f2_d
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+int f2_a(struct s2 *a) {
+ return a->x[1];
+}
+int f2_b(struct s2 *a) {
+ return *(a->x + 1);
+}
+int f2_c(struct s2 *a) {
+ return a->y;
+}
+int f2_d(struct s2 *a) {
+ return a->z;
+}
+
+// CHECK: define i32 @f3_a
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+// CHECK: define i32 @f3_b
+// CHECK: load i32* %{{.*}}, align 4
+// CHECK: }
+// CHECK: define i32 @f3_c
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+// CHECK: define i32 @f3_d
+// CHECK: load i32* %{{.*}}, align 1
+// CHECK: }
+int f3_a(struct s3 *a) {
+ return a->x[1];
+}
+int f3_b(struct s3 *a) {
+ return *(a->x + 1);
+}
+int f3_c(struct s3 *a) {
+ return a->y;
+}
+int f3_d(struct s3 *a) {
+ return a->z;
+}
+
+// Verify we don't claim things are overaligned.
+//
+// CHECK: define double @f4
+// CHECK: load double* {{.*}}, align 8
+// CHECK: }
+extern double g4[5] __attribute__((aligned(16)));
+double f4() {
+ return g4[1];
+}
diff --git a/test/CodeGen/ptx-cc.c b/test/CodeGen/ptx-cc.c
new file mode 100644
index 000000000000..2212d4260b35
--- /dev/null
+++ b/test/CodeGen/ptx-cc.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple ptx32-unknown-unknown -O3 -S -o %t %s -emit-llvm
+// RUN: %clang_cc1 -triple ptx64-unknown-unknown -O3 -S -o %t %s -emit-llvm
+
+// Just make sure Clang uses the proper calling convention for the PTX back-end.
+// If something is wrong, the back-end will fail.
+void foo(float* a,
+ float* b) {
+ a[0] = b[0];
+}
diff --git a/test/CodeGen/regparm-flag.c b/test/CodeGen/regparm-flag.c
index f37239e473cd..8ecf53950805 100644
--- a/test/CodeGen/regparm-flag.c
+++ b/test/CodeGen/regparm-flag.c
@@ -4,12 +4,17 @@
void f1(int a, int b, int c, int d,
int e, int f, int g, int h);
+void f2(int a, int b) __attribute((regparm(0)));
+
void f0() {
// CHECK: call void @f1(i32 inreg 1, i32 inreg 2, i32 inreg 3, i32 inreg 4,
// CHECK: i32 5, i32 6, i32 7, i32 8)
f1(1, 2, 3, 4, 5, 6, 7, 8);
+// CHECK: call void @f2(i32 1, i32 2)
+ f2(1, 2);
}
// CHECK: declare void @f1(i32 inreg, i32 inreg, i32 inreg, i32 inreg,
// CHECK: i32, i32, i32, i32)
+// CHECK: declare void @f2(i32, i32)
diff --git a/test/CodeGen/switch-dce.c b/test/CodeGen/switch-dce.c
new file mode 100644
index 000000000000..bbb5f7e5aa36
--- /dev/null
+++ b/test/CodeGen/switch-dce.c
@@ -0,0 +1,247 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O0 %s -emit-llvm -o - | FileCheck %s
+
+// PR9322 and rdar://6970405
+
+// CHECK: @test1
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32 {{.*}}, 1
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+int i;
+void dead();
+
+void test1() {
+ switch (1)
+ case 1:
+ ++i;
+
+ switch (0)
+ case 1:
+ dead();
+}
+
+
+// CHECK: @test2
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32 {{.*}}, 2
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test2() {
+ switch (4) {
+ case 1:
+ dead();
+ break;
+ case 4:
+ i += 2;
+ // Fall off the end of the switch.
+ }
+}
+
+
+// CHECK: @test3
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32 {{.*}}, 2
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test3() {
+ switch (4) {
+ case 1:
+ dead();
+ break;
+ case 4: {
+ i += 2;
+ break;
+ }
+ }
+}
+
+// CHECK: @test4
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32 {{.*}}, 2
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test4() {
+ switch (4) {
+ case 1:
+ dead();
+ break;
+ default: {
+ i += 2;
+ break;
+ }
+ }
+}
+
+// This shouldn't crash codegen, but we don't have to optimize out the switch
+// in this case.
+void test5() {
+ switch (1) {
+ int x; // eliding var decl?
+ case 1:
+ x = 4;
+ i = x;
+ break;
+ }
+}
+
+// CHECK: @test6
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test6() {
+ // Neither case is reachable.
+ switch (40) {
+ case 1:
+ dead();
+ break;
+ case 4: {
+ dead();
+ break;
+ }
+ }
+}
+
+// CHECK: @test7
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test7() {
+ switch (4) {
+ case 1:
+ dead();
+ break;
+ {
+ case 4: // crazy brace scenario
+ ++i;
+ }
+ break;
+ }
+}
+
+// CHECK: @test8
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test8() {
+ switch (4) {
+ case 1:
+ dead();
+ break;
+ case 4:
+ ++i;
+ // Fall off the end of the switch.
+ }
+}
+
+// CHECK: @test9
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: add nsw i32
+// CHECK: add nsw i32
+// CHECK-NOT: switch
+// CHECK-NOT: @dead
+// CHECK: ret void
+void test9(int i) {
+ switch (1) {
+ case 5:
+ dead();
+ case 1:
+ ++i;
+ // Fall through is fine.
+ case 4:
+ ++i;
+ break;
+ }
+}
+
+// CHECK: @test10
+// CHECK-NOT: switch
+// CHECK: ret i32
+int test10(void) {
+ switch(8) {
+ case 8:
+ break;
+ case 4:
+ break;
+ default:
+ dead();
+ }
+
+ return 0;
+}
+
+// CHECK: @test11
+// CHECK-NOT: switch
+// CHECK: ret void
+void test11() {
+ switch (1) {
+ case 1:
+ break;
+ case 42: ;
+ int x; // eliding var decl?
+ x = 4;
+ break;
+ }
+}
+
+// CHECK: @test12
+// CHECK-NOT: switch
+// CHECK: ret void
+void test12() {
+ switch (1) {
+ case 2: {
+ int a; // Ok to skip this vardecl.
+ a = 42;
+ }
+ case 1:
+ break;
+ case 42: ;
+ int x; // eliding var decl?
+ x = 4;
+ break;
+ }
+}
+
+
+// rdar://9289524 - Check that the empty cases don't produce an empty block.
+// CHECK: @test13
+// CHECK: switch
+// CHECK: i32 42, label [[EPILOG:%[0-9.a-z]+]]
+// CHECK: i32 11, label [[EPILOG]]
+void test13(int x) {
+ switch (x) {
+ case 42: break; // No empty block please.
+ case 11: break; // No empty block please.
+ default: test13(42); break;
+ }
+}
+
+
+// Verify that case 42 only calls test14 once.
+// CHECK: @test14
+// CHECK: call void @test14(i32 97)
+// CHECK-NEXT: br label [[EPILOG2:%[0-9.a-z]+]]
+// CHECK: call void @test14(i32 42)
+// CHECK-NEXT: br label [[EPILOG2]]
+void test14(int x) {
+ switch (x) {
+ case 42: test14(97); // fallthrough
+ case 11: break;
+ default: test14(42); break;
+ }
+}
+
diff --git a/test/CodeGen/union.c b/test/CodeGen/union.c
index 1883ca639b7e..5c89e2d72a7e 100644
--- a/test/CodeGen/union.c
+++ b/test/CodeGen/union.c
@@ -42,3 +42,5 @@ int RRF(void) {return RRU.a;}
// PR6164
typedef union T0 { unsigned int : 0; } T0;
T0 t0;
+
+union { int large_bitfield: 31; char c } u2;
diff --git a/test/CodeGen/x86_64-arguments-darwin.c b/test/CodeGen/x86_64-arguments-darwin.c
new file mode 100644
index 000000000000..2f804e6efc03
--- /dev/null
+++ b/test/CodeGen/x86_64-arguments-darwin.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s| FileCheck %s
+
+// rdar://9122143
+// CHECK: declare void @func(i64, double)
+typedef struct _str {
+ union {
+ long double a;
+ long c;
+ };
+} str;
+
+void func(str s);
+str ss;
+void f9122143()
+{
+ func(ss);
+}
diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c
index 51a234d993ca..ebde884d78d6 100644
--- a/test/CodeGen/x86_64-arguments.c
+++ b/test/CodeGen/x86_64-arguments.c
@@ -1,8 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s| FileCheck %s
#include <stdarg.h>
-// CHECK: %0 = type { i64, double }
-
// CHECK: define signext i8 @f0()
char f0(void) {
return 0;
@@ -44,8 +42,8 @@ void f7(e7 a0) {
// Test merging/passing of upper eightbyte with X87 class.
//
-// CHECK: define %0 @f8_1()
-// CHECK: define void @f8_2(i64 %a0.coerce0, double %a0.coerce1)
+// CHECK: define void @f8_1(%struct.s19* sret %agg.result)
+// CHECK: define void @f8_2(%struct.s19* byval align 16 %a0)
union u8 {
long double a;
int b;
@@ -245,3 +243,19 @@ v1i64 f34(v1i64 arg) { return arg; }
typedef unsigned long v1i64_2 __attribute__((__vector_size__(8)));
v1i64_2 f35(v1i64_2 arg) { return arg+arg; }
+// rdar://9122143
+// CHECK: declare void @func(%struct._str* byval align 16)
+typedef struct _str {
+ union {
+ long double a;
+ long c;
+ };
+} str;
+
+void func(str s);
+str ss;
+void f9122143()
+{
+ func(ss);
+}
+
diff --git a/test/CodeGenCXX/PR5863-unreachable-block.cpp b/test/CodeGenCXX/PR5863-unreachable-block.cpp
index 4829b5277aad..3f32d7570435 100644
--- a/test/CodeGenCXX/PR5863-unreachable-block.cpp
+++ b/test/CodeGenCXX/PR5863-unreachable-block.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -emit-llvm-only %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm-only %s
// PR5863
class E { };
diff --git a/test/CodeGenCXX/anonymous-namespaces.cpp b/test/CodeGenCXX/anonymous-namespaces.cpp
index 0198ed0e3e23..32e17a35ff2d 100644
--- a/test/CodeGenCXX/anonymous-namespaces.cpp
+++ b/test/CodeGenCXX/anonymous-namespaces.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -triple x86_64-apple-darwin10 -emit-llvm %s -o - > %t
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-llvm %s -o - > %t
// RUN: FileCheck %s -check-prefix=1 < %t
// RUN: FileCheck %s -check-prefix=2 < %t
diff --git a/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
index 85e931b50c91..2ddafecf6651 100644
--- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
@@ -106,14 +106,11 @@ struct S {
} s;
- //PR8760
- template <typename T>
- struct Foo {
- Foo() : ptr(__nullptr) {}
- union {
- T *ptr;
- };
- };
- Foo<int> f;
-
-
+//PR8760
+template <typename T> struct Foo {
+ Foo() : ptr(__nullptr) {}
+ union {
+ T *ptr;
+ };
+};
+Foo<int> f;
diff --git a/test/CodeGenCXX/apple-kext-guard-variable.cpp b/test/CodeGenCXX/apple-kext-guard-variable.cpp
new file mode 100644
index 000000000000..26b0d14b34d6
--- /dev/null
+++ b/test/CodeGenCXX/apple-kext-guard-variable.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -S -o %t.s -mkernel -Xclang -verify %s
+
+// rdar://problem/9143356
+
+int foo();
+void test() {
+ static int y = 0;
+ static int x = foo(); // expected-error {{this initialization requires a guard variable, which the kernel does not support}}
+}
diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp
index 672ca0100788..8d74d003c3d6 100644
--- a/test/CodeGenCXX/arm.cpp
+++ b/test/CodeGenCXX/arm.cpp
@@ -117,7 +117,8 @@ namespace test3 {
// CHECK: [[N:%.*]] = load i32*
// CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 4)
// CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8)
- // CHECK: [[SZ:%.*]] = select
+ // CHECK: [[OR:%.*]] = or i1
+ // CHECK: [[SZ:%.*]] = select i1 [[OR]]
// CHECK: call noalias i8* @_Znam(i32 [[SZ]])
// CHECK: store i32 4
// CHECK: store i32 [[N]]
diff --git a/test/CodeGenCXX/blocks.cpp b/test/CodeGenCXX/blocks.cpp
index ea174b57e44d..a4d5b86565e2 100644
--- a/test/CodeGenCXX/blocks.cpp
+++ b/test/CodeGenCXX/blocks.cpp
@@ -55,3 +55,52 @@ namespace test1 {
// ...or non-trivial copy constructors, but it's not clear how to do
// that and still have a constant initializer in '03.
}
+
+namespace test2 {
+ struct A {
+ A();
+ A(const A &);
+ ~A();
+ };
+
+ struct B {
+ B();
+ B(const B &);
+ ~B();
+ };
+
+ // CHECK: define void @_ZN5test24testEv()
+ void test() {
+ __block A a;
+ __block B b;
+ }
+
+ // CHECK: define internal void @__Block_byref_object_copy
+ // CHECK: call void @_ZN5test21AC1ERKS0_(
+
+ // CHECK: define internal void @__Block_byref_object_dispose
+ // CHECK: call void @_ZN5test21AD1Ev(
+
+ // CHECK: define internal void @__Block_byref_object_copy
+ // CHECK: call void @_ZN5test21BC1ERKS0_(
+
+ // CHECK: define internal void @__Block_byref_object_dispose
+ // CHECK: call void @_ZN5test21BD1Ev(
+}
+
+// rdar://problem/9334739
+// Make sure we mark destructors for parameters captured in blocks.
+namespace test3 {
+ struct A {
+ A(const A&);
+ ~A();
+ };
+
+ struct B : A {
+ };
+
+ void test(B b) {
+ extern void consume(void(^)());
+ consume(^{ (void) b; });
+ }
+}
diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp
index 6675b4963bd2..96fbae8970e0 100644
--- a/test/CodeGenCXX/class-layout.cpp
+++ b/test/CodeGenCXX/class-layout.cpp
@@ -17,3 +17,31 @@ namespace Test3 {
// CHECK: %"struct.Test3::A" = type { i32 (...)**, i32 }
struct A { virtual void f(); int a; } *a;
}
+
+namespace Test4 {
+ // Test from PR5589.
+ // CHECK: %"struct.Test4::A" = type { i32, i8, float }
+ // CHECK: %"struct.Test4::B" = type { %"struct.Test4::A", i16, double }
+ struct A {
+ int a;
+ char c;
+ float b;
+ };
+ struct B : public A {
+ short d;
+ double e;
+ } *b;
+}
+
+namespace Test5 {
+ struct A {
+ virtual void f();
+ char a;
+ };
+
+ // CHECK: %"struct.Test5::B" = type { [9 x i8], i8, i8, [5 x i8] }
+ struct B : A {
+ char b : 1;
+ char c;
+ } *b;
+}
diff --git a/test/CodeGenCXX/cxx0x-delegating-ctors.cpp b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
new file mode 100644
index 000000000000..5b432c769016
--- /dev/null
+++ b/test/CodeGenCXX/cxx0x-delegating-ctors.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -emit-llvm -fexceptions -fcxx-exceptions -std=c++0x -o - %s | FileCheck %s
+
+struct non_trivial {
+ non_trivial();
+ ~non_trivial();
+};
+non_trivial::non_trivial() {}
+non_trivial::~non_trivial() {}
+
+// We use a virtual base to ensure that the constructor
+// delegation optimization (complete->base) can't be
+// performed.
+struct delegator {
+ non_trivial n;
+ delegator();
+ delegator(int);
+ delegator(char);
+ delegator(bool);
+};
+
+delegator::delegator() {
+ throw 0;
+}
+
+// CHECK: define void @_ZN9delegatorC1Ei
+// CHECK: call void @_ZN9delegatorC1Ev
+// CHECK-NOT: lpad
+// CHECK: ret
+// CHECK-NOT: lpad
+// CHECK: define void @_ZN9delegatorC2Ei
+// CHECK: call void @_ZN9delegatorC2Ev
+// CHECK-NOT: lpad
+// CHECK: ret
+// CHECK-NOT: lpad
+delegator::delegator(int)
+ : delegator()
+{}
+
+delegator::delegator(bool)
+{}
+
+// CHECK: define void @_ZN9delegatorC2Ec
+// CHECK: call void @_ZN9delegatorC2Eb
+// CHECK: call void @__cxa_throw
+delegator::delegator(char)
+ : delegator(true) {
+ throw 0;
+}
diff --git a/test/CodeGenCXX/debug-info-byval.cpp b/test/CodeGenCXX/debug-info-byval.cpp
index c99518e7a6b8..f0cb6d68c837 100644
--- a/test/CodeGenCXX/debug-info-byval.cpp
+++ b/test/CodeGenCXX/debug-info-byval.cpp
@@ -1,5 +1,5 @@
// RUN: %clang -g -S %s -o - | FileCheck %s
-// Test to check presense of debug info for byval parameter.
+// Test to check presence of debug info for byval parameter.
// Radar 8350436.
class DAG {
public:
diff --git a/test/CodeGenCXX/debug-info-cxx0x.cpp b/test/CodeGenCXX/debug-info-cxx0x.cpp
new file mode 100644
index 000000000000..5753b05d728e
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-cxx0x.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm-only -std=c++0x -g %s
+
+namespace PR9414 {
+ int f() {
+ auto x = 0;
+ return x;
+ }
+}
diff --git a/test/CodeGenCXX/debug-info-fn-template.cpp b/test/CodeGenCXX/debug-info-fn-template.cpp
new file mode 100644
index 000000000000..c8291af852d3
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-fn-template.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
+
+template<typename T>
+struct XF {
+ T member;
+};
+
+template<typename T>
+T fx(XF<T> xi) {
+ return xi.member;
+}
+
+//CHECK: DW_TAG_template_type_parameter
+//CHECK: XF<int>
+template int fx(XF<int>);
diff --git a/test/CodeGenCXX/debug-info-method-spec.cpp b/test/CodeGenCXX/debug-info-method-spec.cpp
new file mode 100644
index 000000000000..31f66633dc4c
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-method-spec.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang -fverbose-asm -cc1 -g -S %s -o - | grep DW_AT_specification
+// Radar 9254491
+class A {
+public:
+ void doSomething(int i) { ++i; }
+};
+
+void foo(A *a) {
+ a->doSomething(2);
+}
diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp
index 2e0a96d56660..27f5eae9780f 100644
--- a/test/CodeGenCXX/debug-info-namespace.cpp
+++ b/test/CodeGenCXX/debug-info-namespace.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -g -S %s -o - | FileCheck %s
+// RUN: %clang -g -S -fverbose-asm %s -o - | FileCheck %s
// CHECK: TAG_namespace
namespace A {
diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp
index 0ddfc242b10e..9d52159bed84 100644
--- a/test/CodeGenCXX/debug-info-template.cpp
+++ b/test/CodeGenCXX/debug-info-template.cpp
@@ -20,3 +20,27 @@ class TU {
};
TU<2> u2;
+
+// PR9600
+template<typename T> class vector {};
+class Foo;
+typedef vector<Foo*> FooVector[3];
+struct Test {
+ virtual void foo(FooVector *);
+};
+static Test test;
+
+// PR9608
+template <int i> struct TheTemplate {
+ struct Empty2 {};
+ typedef const Empty2 DependentType[i];
+ TheTemplate() {}
+};
+
+class TheTemplateTest : public TheTemplate<42> {
+ TheTemplateTest();
+ void method(const TheTemplate<42>::DependentType *) {}
+};
+
+TheTemplateTest::TheTemplateTest() : TheTemplate<42>() {}
+
diff --git a/test/CodeGenCXX/debug-info-this.cpp b/test/CodeGenCXX/debug-info-this.cpp
new file mode 100644
index 000000000000..a2842d021783
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-this.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
+// Radar 9239104
+class Class
+{
+public:
+//CHECK: DW_TAG_const_type
+ int foo (int p) const {
+ return p+m_int;
+ }
+
+protected:
+ int m_int;
+};
+
+Class c;
diff --git a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
index e332f4020001..0e153022439b 100644
--- a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
+++ b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
struct A { int i; };
-struct B { int j; };
+struct B { char j; };
struct C : A, B { int k; };
struct D final : virtual C {
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index f382413cba41..353b61061ad1 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - -mconstructor-aliases -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - -mconstructor-aliases -fcxx-exceptions -fexceptions | FileCheck %s
// CHECK: @_ZN5test01AD1Ev = alias {{.*}} @_ZN5test01AD2Ev
// CHECK: @_ZN5test11MD2Ev = alias {{.*}} @_ZN5test11AD2Ev
diff --git a/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp b/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
index 74795b5dfb0e..5eede66cd7b4 100644
--- a/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
+++ b/test/CodeGenCXX/devirtualize-virtual-function-calls.cpp
@@ -2,7 +2,8 @@
struct A {
virtual void f();
-
+ virtual void f_const() const;
+
A h();
};
@@ -28,6 +29,12 @@ void f(A a, A *ap, A& ar) {
// CHECK: call void @_ZN1A1fEv
a.h().f();
+
+ // CHECK: call void @_ZNK1A7f_constEv
+ a.f_const();
+
+ // CHECK: call void @_ZN1A1fEv
+ (a).f();
}
struct B {
@@ -45,3 +52,4 @@ void f() {
// CHECK: call void @_ZN1B1fEv
B().h().f();
}
+
diff --git a/test/CodeGenCXX/dynamic-cast-always-null.cpp b/test/CodeGenCXX/dynamic-cast-always-null.cpp
new file mode 100644
index 000000000000..e4e86942181d
--- /dev/null
+++ b/test/CodeGenCXX/dynamic-cast-always-null.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -std=c++0x -o - | FileCheck %s
+struct A { virtual ~A(); };
+struct B final : A { };
+struct C { virtual ~C(); int c; };
+
+// CHECK: @_Z1fP1B
+C *f(B* b) {
+ // CHECK-NOT: call i8* @__dynamic_cast
+ // CHECK: ret %struct.C* null
+ return dynamic_cast<C*>(b);
+}
+
+// CHECK: @_Z1fR1B
+C &f(B& b) {
+ // CHECK-NOT: call i8* @__dynamic_cast
+ // CHECK: call void @__cxa_bad_cast() noreturn
+ // CHECK: ret %struct.C* undef
+ return dynamic_cast<C&>(b);
+}
diff --git a/test/CodeGenCXX/dynamic-cast.cpp b/test/CodeGenCXX/dynamic-cast.cpp
index 9838e25b1d3f..e84bb9b4ff50 100644
--- a/test/CodeGenCXX/dynamic-cast.cpp
+++ b/test/CodeGenCXX/dynamic-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - | FileCheck %s
+// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
struct A { virtual void f(); };
struct B : A { };
diff --git a/test/CodeGenCXX/dyncast.cpp b/test/CodeGenCXX/dyncast.cpp
deleted file mode 100644
index 7fd5899225c2..000000000000
--- a/test/CodeGenCXX/dyncast.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-// RUN: %clang_cc1 -I%S -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
-// RUN: FileCheck -check-prefix LL --input-file=%t.ll %s
-
-#include <typeinfo>
-
-class test1_A { virtual void f() { } };
-class test1_B { virtual void g() { } };
-class test1_D : public virtual test1_A, private test1_B {};
-class test1_E : public test1_D, public test1_B {};
-class test1_F : public test1_E, public test1_D {};
-
-extern test1_D test1_d;
-extern test1_F test1_f;
-
-extern "C" int printf(const char *str...);
-
-#define S(V, N) if (V) printf("PASS: %d\n", N); else printf("FAIL: %d\n", N)
-
-void test1() {
- test1_B* bp = (test1_B*)&test1_d;
- test1_A* ap = &test1_d;
- test1_D* dp = dynamic_cast<test1_D*>(bp);
- S(dp == 0, 1);
- ap = dynamic_cast<test1_A*>(bp);
- S(ap == 0, 2);
- bp = dynamic_cast<test1_B*>(ap);
- S(bp == 0, 3);
- ap = dynamic_cast<test1_A*>(&test1_d);
- S(ap != 0, 4);
- // FIXME: Doesn't work yet, gcc fails this at compile time. We'd need access
- // control for this to work.
- // bp = dynamic_cast<test1_B*>(&test1_d);
- // S(bp == 0, 5);
- {
- test1_A* ap = &test1_f;
- S(ap != 0, 6);
- test1_D* dp = dynamic_cast<test1_D*>(ap);
- S(dp == 0, 7);
- // cast from virtual base
- test1_E* ep1 = dynamic_cast<test1_E*>(ap);
- S(ep1 != 0, 8);
- }
- dp = dynamic_cast<test1_D*>(&test1_d);
- S(dp == &test1_d, 9);
- const test1_D *cdp = dynamic_cast<const test1_D*>(&test1_d);
- S(cdp == &test1_d, 10);
- dp = dynamic_cast<test1_D*>((test1_A*)0);
- S(dp == 0, 11);
- ap = dynamic_cast<test1_A*>(&test1_d);
- S(ap == (test1_A*)&test1_d, 12);
- test1_E* ep = dynamic_cast<test1_E*>(&test1_f);
- S(ep == (test1_E*)&test1_f, 13);
- void *vp = dynamic_cast<void*>(ap);
- S(vp == &test1_d, 14);
- const void *cvp = dynamic_cast<const void*>(ap);
- S(cvp == &test1_d, 15);
-}
-
-// CHECK-LL: define void @_Z5test1v() nounwind {
-// CHECK-LL: [[bp:%.*]] = alloca %class.test1_A*, align 8
-// CHECK-LL-NEXT: [[ap:%.*]] = alloca %class.test1_A*, align 8
-// CHECK-LL-NEXT: [[dp:%.*]] = alloca %class.test1_D*, align 8
-// CHECK-LL-NEXT: [[ap37:%.*]] = alloca %class.test1_A*, align 8
-// CHECK-LL-NEXT: [[dp53:%.*]] = alloca %class.test1_D*, align 8
-// CHECK-LL-NEXT: [[ep1:%.*]] = alloca %class.test1_E*, align 8
-// CHECK-LL-NEXT: [[cdp:%.*]] = alloca %class.test1_D*, align 8
-// CHECK-LL-NEXT: [[ep:%.*]] = alloca %class.test1_E*, align 8
-// CHECK-LL-NEXT: [[vp:%.*]] = alloca i8*, align 8
-// CHECK-LL-NEXT: [[cvp:%.*]] = alloca i8*, align 8
-// CHECK-LL-NEXT: store %class.test1_A* bitcast (%class.test1_D* @test1_d to %class.test1_A*), %class.test1_A** [[bp]]
-// CHECK-LL-NEXT: br i1 false, label %[[castnull2:.*]], label %[[castnotnull1:.*]]
-// CHECK-LL: [[castnotnull1]]
-// CHECK-LL-NEXT: [[vtable:%.*]] = load i8** bitcast (%class.test1_D* @test1_d to i8**)
-// CHECK-LL-NEXT: [[vbaseoffsetptr:%.*]] = getelementptr i8* [[vtable]], i64 -24
-// CHECK-LL-NEXT: [[v1:%.*]] = bitcast i8* [[vbaseoffsetptr]] to i64*
-// CHECK-LL-NEXT: [[vbaseoffset:%.*]] = load i64* [[v1]]
-// CHECK-LL-NEXT: [[addptr:%.*]] = getelementptr i8* getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0), i64 [[vbaseoffset:.*]]
-// CHECK-LL-NEXT: [[v2:%.*]] = bitcast i8* [[addptr]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[castend3:.*]]
-// CHECK-LL: [[castnull2]]
-// CHECK-LL-NEXT: br label %[[castend3]]
-// CHECK-LL: [[castend3]]
-// CHECK-LL-NEXT: [[v3:%.*]] = phi %class.test1_A* [ [[v2]], %[[castnotnull1]] ], [ null, %[[castnull2]] ]
-// CHECK-LL-NEXT: store %class.test1_A* [[v3]], %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[tmp:%.*]] = load %class.test1_A** [[bp]]
-// CHECK-LL-NEXT: [[v4:%.*]] = icmp ne %class.test1_A* [[tmp]], null
-// CHECK-LL-NEXT: br i1 [[v4]], label %[[v5:.*]], label %[[v9:.*]]
-// CHECK-LL: [[v6:%.*]] = bitcast %class.test1_A* [[tmp]] to i8*
-// CHECK-LL-NEXT: [[v7:%.*]] = call i8* @__dynamic_cast(i8* [[v6]], i8* bitcast (%0* @_ZTI7test1_B to i8*), i8* bitcast (%1* @_ZTI7test1_D to i8*), i64 -1)
-// CHECK-LL-NEXT: [[v8:%.*]] = bitcast i8* [[v7]] to %class.test1_D*
-// CHECK-LL-NEXT: br label %[[v10:.*]]
-// CHECK-LL: br label %[[v10]]
-// CHECK-LL: [[v11:%.*]] = phi %class.test1_D* [ [[v8]], %[[v5]] ], [ null, %[[v9]] ]
-// CHECK-LL-NEXT: store %class.test1_D* [[v11]], %class.test1_D** [[dp]]
-// CHECK-LL-NEXT: [[tmp4:%.*]] = load %class.test1_D** [[dp]]
-// CHECK-LL-NEXT: [[cmp:%.*]] = icmp eq %class.test1_D* [[tmp4]], null
-// CHECK-LL-NEXT: br i1 [[cmp]], label %[[ifthen:.*]], label %[[ifelse:.*]]
-// CHECK-LL: [[ifthen]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 1)
-// CHECK-LL-NEXT: br label %[[ifend:.*]]
-// CHECK-LL: [[ifelse]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 1)
-// CHECK-LL-NEXT: br label %[[ifend]]
-// CHECK-LL: [[ifend]]
-// CHECK-LL-NEXT: [[tmp6:%.*]] = load %class.test1_A** [[bp]]
-// CHECK-LL-NEXT: [[v12:%.*]] = icmp ne %class.test1_A* [[tmp6]], null
-// CHECK-LL-NEXT: br i1 [[v12]], label %[[v13:.*]], label %[[v17:.*]]
-// CHECK-LL: [[v14:%.*]] = bitcast %class.test1_A* [[tmp6]] to i8*
-// CHECK-LL-NEXT: [[v15:%.*]] = call i8* @__dynamic_cast(i8* [[v14]], i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i64 -1)
-// CHECK-LL-NEXT: [[v16:%.*]] = bitcast i8* [[v15]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[v18:.*]]
-// CHECK-LL: br label %[[v18]]
-// CHECK-LL: [[v19:%.*]] = phi %class.test1_A* [ [[v16]], %[[v13]] ], [ null, %[[v17]] ]
-// CHECK-LL-NEXT: store %class.test1_A* [[v19]], %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[tmp7:%.*]] = load %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[cmp8:%.*]] = icmp eq %class.test1_A* [[tmp7]], null
-// CHECK-LL-NEXT: br i1 [[cmp8]], label %[[ifthen9:.*]], label %[[ifelse11:.*]]
-// CHECK-LL: [[ifthen9]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 2)
-// CHECK-LL-NEXT: br label %[[ifend13:.*]]
-// CHECK-LL: [[ifelse11]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 2)
-// CHECK-LL-NEXT: br label %[[ifend13]]
-// CHECK-LL: [[ifend13]]
-// CHECK-LL-NEXT: [[tmp14:%.*]] = load %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[v20:%.*]] = icmp ne %class.test1_A* [[tmp14]], null
-// CHECK-LL-NEXT: br i1 [[v20]], label %[[v21:.*]], label %[[v25:.*]]
-// CHECK-LL: [[v22:%.*]] = bitcast %class.test1_A* [[tmp14]] to i8*
-// CHECK-LL-NEXT: [[v23:%.*]] = call i8* @__dynamic_cast({{.*}} [[v22]], i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_B to i8*), i64 -1)
-// CHECK-LL-NEXT: [[v24:%.*]] = bitcast i8* [[v23]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[v26:.*]]
-// CHECK-LL: br label %[[v26]]
-// CHECK-LL: [[v27:%.*]] = phi %class.test1_A* [ [[v24]], %[[v21]] ], [ null, %[[v25]] ]
-// CHECK-LL-NEXT: store %class.test1_A* [[v27]], %class.test1_A** [[bp]]
-// CHECK-LL-NEXT: [[tmp15:%.*]] = load %class.test1_A** [[bp]]
-// CHECK-LL-NEXT: [[cmp16:%.*]] = icmp eq %class.test1_A* [[tmp15]], null
-// CHECK-LL-NEXT: br i1 [[cmp16]], label %[[ifthen17:.*]], label %[[ifelse19:.*]]
-// CHECK-LL: [[ifthen17]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 3)
-// CHECK-LL-NEXT: br label %[[ifend21:.*]]
-// CHECK-LL: [[ifelse19]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 3)
-// CHECK-LL-NEXT: br label %[[ifend21]]
-// CHECK-LL: [[ifend21]]
-// CHECK-LL-NEXT: br i1 false, label %[[castnull27:.*]], label %[[castnotnull22:.*]]
-// CHECK-LL: [[castnotnull22]]
-// CHECK-LL-NEXT: [[vtable23:%.*]] = load i8** bitcast (%class.test1_D* @test1_d to i8**)
-// CHECK-LL-NEXT: [[vbaseoffsetptr24:%.*]] = getelementptr i8* [[vtable23]], i64 -24
-// CHECK-LL-NEXT: [[v28:%.*]] = bitcast i8* [[vbaseoffsetptr24]] to i64*
-// CHECK-LL-NEXT: [[vbaseoffset25:%.*]] = load i64* [[v28]]
-// CHECK-LL-NEXT: [[addptr26:%.*]] = getelementptr i8* getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0), i64 [[vbaseoffset25]]
-// CHECK-LL-NEXT: [[v29:%.*]] = bitcast i8* [[addptr26]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[castend28:.*]]
-// CHECK-LL: [[castnull27]]
-// CHECK-LL-NEXT: br label %[[castend28]]
-// CHECK-LL: [[castend28]]
-// CHECK-LL-NEXT: [[v30:%.*]] = phi %class.test1_A* [ [[v29]], %[[castnotnull22]] ], [ null, %[[castnull27]] ]
-// CHECK-LL-NEXT: store %class.test1_A* [[v30]], %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[tmp29:%.*]] = load %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[cmp30:%.*]] = icmp ne %class.test1_A* [[tmp29]], null
-// CHECK-LL-NEXT: br i1 [[cmp30]], label %[[ifthen31:.*]], label %[[ifelse33:.*]]
-// CHECK-LL: [[ifthen31]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 4)
-// CHECK-LL-NEXT: br label %[[ifend35:.*]]
-// CHECK-LL: [[ifelse33]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 4)
-// CHECK-LL-NEXT: br label %[[ifend35]]
-// CHECK-LL: [[ifend35]]
-// CHECK-LL-NEXT: br i1 false, label %[[castnull43:.*]], label %[[castnotnull38:.*]]
-// CHECK-LL: [[castnotnull38]]
-// CHECK-LL-NEXT: [[vtable39:%.*]] = load i8** bitcast (%class.test1_F* @test1_f to i8**)
-// CHECK-LL-NEXT: [[vbaseoffsetptr40:%.*]] = getelementptr i8* [[vtable39]], i64 -24
-// CHECK-LL-NEXT: [[v31:%.*]] = bitcast i8* [[vbaseoffsetptr40]] to i64*
-// CHECK-LL-NEXT: [[vbaseoffset41:%.*]] = load i64* [[v31]]
-// CHECK-LL-NEXT: [[addptr42:%.*]] = getelementptr i8* getelementptr inbounds (%class.test1_F* @test1_f, i32 0, i32 0, i32 0), i64 [[vbaseoffset41]]
-// CHECK-LL-NEXT: [[v32:%.*]] = bitcast i8* [[addptr42]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[castend44:.*]]
-// CHECK-LL: [[castnull43]]
-// CHECK-LL-NEXT: br label %[[castend44]]
-// CHECK-LL: [[castend44]]
-// CHECK-LL-NEXT: [[v33:%.*]] = phi %class.test1_A* [ [[v32]], %[[castnotnull38]] ], [ null, %[[castnull43]] ]
-// CHECK-LL-NEXT: store %class.test1_A* [[v33]], %class.test1_A** [[ap37]]
-// CHECK-LL-NEXT: [[tmp45:%.*]] = load %class.test1_A** [[ap37]]
-// CHECK-LL-NEXT: [[cmp46:%.*]] = icmp ne %class.test1_A* [[tmp45]], null
-// CHECK-LL-NEXT: br i1 [[cmp46]], label %[[ifthen47:.*]], label %[[ifelse49:.*]]
-// CHECK-LL: [[ifthen47]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 6)
-// CHECK-LL-NEXT: br label %[[ifend51:.*]]
-// CHECK-LL: [[ifelse49]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 6)
-// CHECK-LL-NEXT: br label %[[ifend51]]
-// CHECK-LL: [[ifend51]]
-// CHECK-LL-NEXT: [[tmp54:%.*]] = load %class.test1_A** [[ap37]]
-// CHECK-LL-NEXT: [[v34:%.*]] = icmp ne %class.test1_A* [[tmp54]], null
-// CHECK-LL-NEXT: br i1 [[v34]], label %[[v35:.*]], label %[[v39:.*]]
-// CHECK-LL: [[v36:%.*]] = bitcast %class.test1_A* [[tmp54]] to i8*
-// CHECK-LL-NEXT: [[v37:%.*]] = call i8* @__dynamic_cast(i8* [[v36]], i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_D to i8*), i64 -1)
-// CHECK-LL-NEXT: [[v38:%.*]] = bitcast i8* [[v37]] to %class.test1_D*
-// CHECK-LL-NEXT: br label %[[v40:.*]]
-// CHECK-LL: br label %[[v40]]
-// CHECK-LL: [[v41:%.*]] = phi %class.test1_D* [ [[v38]], %[[v35]] ], [ null, %[[v39]] ]
-// CHECK-LL-NEXT: store %class.test1_D* [[v41]], %class.test1_D** [[dp53]]
-// CHECK-LL-NEXT: [[tmp55:%.*]] = load %class.test1_D** [[dp53]]
-// CHECK-LL-NEXT: [[cmp56:%.*]] = icmp eq %class.test1_D* [[tmp55]], null
-// CHECK-LL-NEXT: br i1 [[cmp56]], label %[[ifthen57:.*]], label %[[ifelse59:.*]]
-// CHECK-LL: [[ifthen57]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 7)
-// CHECK-LL-NEXT: br label %[[ifend61:.*]]
-// CHECK-LL: [[ifelse59]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 7)
-// CHECK-LL-NEXT: br label %[[ifend61]]
-// CHECK-LL: [[ifend61]]
-// CHECK-LL-NEXT: [[tmp63:%.*]] = load %class.test1_A** [[ap37]]
-// CHECK-LL-NEXT: [[v42:%.*]] = icmp ne %class.test1_A* [[tmp63]], null
-// CHECK-LL-NEXT: br i1 [[v42]], label %[[v43:.*]], label %[[v47:.*]]
-// CHECK-LL: [[v44:%.*]] = bitcast %class.test1_A* [[tmp63]] to i8*
-// CHECK-LL-NEXT: [[v45:%.*]] = call i8* @__dynamic_cast(i8* [[v44]], i8* bitcast ({{.*}} @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_E to i8*), i64 -1)
-// CHECK-LL-NEXT: [[v46:%.*]] = bitcast i8* [[v45]] to %class.test1_E*
-// CHECK-LL-NEXT: br label %[[v48:.*]]
-// CHECK-LL: br label %[[v48]]
-// CHECK-LL: [[v49:%.*]] = phi %class.test1_E* [ [[v46]], %[[v43]] ], [ null, %[[v47]] ]
-// CHECK-LL-NEXT: store %class.test1_E* [[v49]], %class.test1_E** [[ep1]]
-// CHECK-LL-NEXT: [[tmp64:%.*]] = load %class.test1_E** [[ep1]]
-// CHECK-LL-NEXT: [[cmp65:%.*]] = icmp ne %class.test1_E* [[tmp64]], null
-// CHECK-LL-NEXT: br i1 [[cmp65]], label %[[ifthen66:.*]], label %[[ifelse68:.*]]
-// CHECK-LL: [[ifthen66]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 8)
-// CHECK-LL-NEXT: br label %[[ifend70:.*]]
-// CHECK-LL: [[ifelse68]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 8)
-// CHECK-LL-NEXT: br label %[[ifend70]]
-// CHECK-LL: [[ifend70]]
-// CHECK-LL-NEXT: store %class.test1_D* @test1_d, %class.test1_D** [[dp]]
-// CHECK-LL-NEXT: [[tmp71:%.*]] = load %class.test1_D** [[dp]]
-// CHECK-LL-NEXT: [[cmp72:%.*]] = icmp eq %class.test1_D* [[tmp71]], @test1_d
-// CHECK-LL-NEXT: br i1 [[cmp72]], label %[[ifthen73:.*]], label %[[ifelse75:.*]]
-// CHECK-LL: [[ifthen73]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 9)
-// CHECK-LL-NEXT: br label %[[ifend77:.*]]
-// CHECK-LL: [[ifelse75]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 9)
-// CHECK-LL-NEXT: br label %[[ifend77]]
-// CHECK-LL: [[ifend77]]
-// CHECK-LL-NEXT: store %class.test1_D* @test1_d, %class.test1_D** [[cdp]]
-// CHECK-LL-NEXT: [[tmp79:%.*]] = load %class.test1_D** [[cdp]]
-// CHECK-LL-NEXT: [[cmp80:%.*]] = icmp eq %class.test1_D* [[tmp79]], @test1_d
-// CHECK-LL-NEXT: br i1 [[cmp80]], label %[[ifthen81:.*]], label %[[ifelse83:.*]]
-// CHECK-LL: [[ifthen81]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 10)
-// CHECK-LL-NEXT: br label %[[ifend85:.*]]
-// CHECK-LL: [[ifelse83]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 10)
-// CHECK-LL-NEXT: br label %[[ifend85]]
-// CHECK-LL: [[ifend85]]
-// CHECK-LL-NEXT: br i1 false, label %[[v50:.*]], label %[[v53:.*]]
-// CHECK-LL: [[v51:%.*]] = call i8* @__dynamic_cast(i8* null, i8* bitcast ({{.*}}* @_ZTI7test1_A to i8*), i8* bitcast ({{.*}} @_ZTI7test1_D to i8*), i64 -1)
-// CHECK-LL-NEXT: [[v52:%.*]] = bitcast i8* [[v51]] to %class.test1_D*
-// CHECK-LL-NEXT: br label %[[v54:.*]]
-// CHECK-LL: br label %[[v54]]
-// CHECK-LL: [[v55:%.*]] = phi %class.test1_D* [ [[v52]], %[[v50]] ], [ null, %[[v53]] ]
-// CHECK-LL-NEXT: store %class.test1_D* [[v55]], %class.test1_D** [[dp]]
-// CHECK-LL-NEXT: [[tmp86:%.*]] = load %class.test1_D** [[dp]]
-// CHECK-LL-NEXT: [[cmp87:%.*]] = icmp eq %class.test1_D* [[tmp86]], null
-// CHECK-LL-NEXT: br i1 [[cmp87]], label %[[ifthen88:.*]], label %[[ifelse90:.*]]
-// CHECK-LL: [[ifthen88]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 11)
-// CHECK-LL-NEXT: br label %[[ifend92:.*]]
-// CHECK-LL: [[ifelse90]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 11)
-// CHECK-LL-NEXT: br label %[[ifend92]]
-// CHECK-LL: [[ifend92]]
-// CHECK-LL-NEXT: br i1 false, label %[[castnull98:.*]], label %[[castnotnull93:.*]]
-// CHECK-LL: [[castnotnull93]]
-// CHECK-LL-NEXT: [[vtable94:%.*]] = load i8** bitcast (%class.test1_D* @test1_d to i8**)
-// CHECK-LL-NEXT: [[vbaseoffsetptr95:%.*]] = getelementptr i8* [[vtable94]], i64 -24
-// CHECK-LL-NEXT: [[v56:%.*]] = bitcast i8* [[vbaseoffsetptr95]] to i64*
-// CHECK-LL-NEXT: [[vbaseoffset96:%.*]] = load i64* [[v56]]
-// CHECK-LL-NEXT: [[addptr97:%.*]] = getelementptr i8* getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0), i64 [[vbaseoffset96]]
-// CHECK-LL-NEXT: [[v57:%.*]] = bitcast i8* [[addptr97]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[castend99:.*]]
-// CHECK-LL: [[castnull98]]
-// CHECK-LL-NEXT: br label %[[castend99]]
-// CHECK-LL: [[castend99]]
-// CHECK-LL-NEXT: [[v58:%.*]] = phi %class.test1_A* [ [[v57]], %[[castnotnull93]] ], [ null, %[[castnull98]] ]
-// CHECK-LL-NEXT: store %class.test1_A* [[v58]], %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[tmp100:%.*]] = load %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: br i1 false, label %[[castnull106:.*]], label %[[castnotnull101:.*]]
-// CHECK-LL: [[castnotnull101]]
-// CHECK-LL-NEXT: [[vtable102:%.*]] = load i8** bitcast (%class.test1_D* @test1_d to i8**)
-// CHECK-LL-NEXT: [[vbaseoffsetptr103:%.*]] = getelementptr i8* [[vtable102]], i64 -24
-// CHECK-LL-NEXT: [[v59:%.*]] = bitcast i8* [[vbaseoffsetptr103]] to i64*
-// CHECK-LL-NEXT: [[vbaseoffset104:%.*]] = load i64* [[v59]]
-// CHECK-LL-NEXT: [[addptr105:%.*]] = getelementptr i8* getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0), i64 [[vbaseoffset104]]
-// CHECK-LL-NEXT: [[v60:%.*]] = bitcast i8* [[addptr105]] to %class.test1_A*
-// CHECK-LL-NEXT: br label %[[castend107:.*]]
-// CHECK-LL: [[castnull106]]
-// CHECK-LL-NEXT: br label %[[castend107]]
-// CHECK-LL: [[castend107]]
-// CHECK-LL-NEXT: [[v61:%.*]] = phi %class.test1_A* [ [[v60]], %[[castnotnull101]] ], [ null, %[[castnull106]] ]
-// CHECK-LL-NEXT: [[cmp108:%.*]] = icmp eq %class.test1_A* [[tmp100]], [[v61]]
-// CHECK-LL-NEXT: br i1 [[cmp108]], label %[[ifthen109:.*]], label %[[ifelse111:.*]]
-// CHECK-LL: [[ifthen109]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 12)
-// CHECK-LL-NEXT: br label %[[ifend113:.*]]
-// CHECK-LL: [[ifelse111]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 12)
-// CHECK-LL-NEXT: br label %[[ifend113]]
-// CHECK-LL: [[ifend113]]
-// CHECK-LL-NEXT: store %class.test1_E* bitcast (%class.test1_F* @test1_f to %class.test1_E*), %class.test1_E** [[ep]]
-// CHECK-LL-NEXT: [[tmp118:%.*]] = load %class.test1_E** [[ep]]
-// CHECK-LL-NEXT: [[cmp122:%.*]] = icmp eq %class.test1_E* [[tmp118]], bitcast (%class.test1_F* @test1_f to %class.test1_E*)
-
-// CHECK-LL-NEXT: br i1 [[cmp122]], label %[[ifthen123:.*]], label %[[ifelse125:.*]]
-// CHECK-LL: [[ifthen123]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 13)
-// CHECK-LL-NEXT: br label %[[ifend127:.*]]
-// CHECK-LL: [[ifelse125]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 13)
-// CHECK-LL-NEXT: br label %[[ifend127]]
-// CHECK-LL: [[ifend127]]
-// CHECK-LL-NEXT: [[tmp129:%.*]] = load %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[v64:%.*]] = icmp ne %class.test1_A* [[tmp129]], null
-// CHECK-LL-NEXT: br i1 [[v64]], label %[[v65:.*]], label %[[v70:.*]]
-// CHECK-LL: [[v66:%.*]] = bitcast %class.test1_A* [[tmp129]] to i64**
-// CHECK-LL-NEXT: [[vtable130:%.*]] = load i64** [[v66]]
-// CHECK-LL-NEXT: [[v67:%.*]] = getelementptr inbounds i64* [[vtable130]], i64 -2
-// CHECK-LL-NEXT: [[offsettotop:%.*]] = load i64* [[v67]]
-// CHECK-LL-NEXT: [[v68:%.*]] = bitcast %class.test1_A* [[tmp129]] to i8*
-// CHECK-LL-NEXT: [[v69:%.*]] = getelementptr inbounds i8* [[v68]], i64 [[offsettotop]]
-// CHECK-LL-NEXT: br label %[[v71:.*]]
-// CHECK-LL: br label %[[v71]]
-// CHECK-LL: [[v72:%.*]] = phi i8* [ [[v69]], %[[v65]] ], [ null, %[[v70]] ]
-// CHECK-LL-NEXT: store i8* [[v72]], i8** [[vp]]
-// CHECK-LL-NEXT: [[tmp131:%.*]] = load i8** [[vp]]
-// CHECK-LL-NEXT: [[cmp132:%.*]] = icmp eq i8* [[tmp131]], getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0)
-// CHECK-LL-NEXT: br i1 [[cmp132]], label %[[ifthen133:.*]], label %[[ifelse135:.*]]
-// CHECK-LL: [[ifthen133]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 14)
-// CHECK-LL-NEXT: br label %[[ifend137:.*]]
-// CHECK-LL: [[ifelse135]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 14)
-// CHECK-LL-NEXT: br label %[[ifend137]]
-// CHECK-LL: [[ifend137]]
-// CHECK-LL-NEXT: [[tmp139:%.*]] = load %class.test1_A** [[ap]]
-// CHECK-LL-NEXT: [[v73:%.*]] = icmp ne %class.test1_A* [[tmp139]], null
-// CHECK-LL-NEXT: br i1 [[v73]], label %[[v74:.*]], label %[[v79:.*]]
-// CHECK-LL: [[v75:%.*]] = bitcast %class.test1_A* [[tmp139]] to i64**
-// CHECK-LL-NEXT: [[vtable140:%.*]] = load i64** [[v75]]
-// CHECK-LL-NEXT: [[v76:%.*]] = getelementptr inbounds i64* [[vtable140]], i64 -2
-// CHECK-LL-NEXT: [[offsettotop141:%.*]] = load i64* [[v76]]
-// CHECK-LL-NEXT: [[v77:%.*]] = bitcast %class.test1_A* [[tmp139]] to i8*
-// CHECK-LL-NEXT: [[v78:%.*]] = getelementptr inbounds i8* [[v77]], i64 [[offsettotop141]]
-// CHECK-LL-NEXT: br label %[[v80:.*]]
-// CHECK-LL: br label %[[v80]]
-// CHECK-LL: [[v81:%.*]] = phi i8* [ [[v78]], %[[v74]] ], [ null, %[[v79]] ]
-// CHECK-LL-NEXT: store i8* [[v81]], i8** [[cvp]]
-// CHECK-LL-NEXT: [[tmp142:%.*]] = load i8** [[cvp]]
-// CHECK-LL-NEXT: [[cmp143:%.*]] = icmp eq i8* [[tmp142]], getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0)
-// CHECK-LL-NEXT: br i1 [[cmp143]], label %[[ifthen144:.*]], label %[[ifelse146:.*]]
-// CHECK-LL: [[ifthen144]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str, i32 0, i32 0), i32 15)
-// CHECK-LL-NEXT: br label %[[ifend148:.*]]
-// CHECK-LL: [[ifelse146]]
-// CHECK-LL-NEXT: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]* @.str1, i32 0, i32 0), i32 15)
-// CHECK-LL-NEXT: br label %[[ifend148]]
-// CHECK-LL: [[ifend148]]
-// CHECK-LL-NEXT: ret void
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index 5ae65ccfaab6..6c44c7612966 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll
+// RUN: %clang_cc1 -fcxx-exceptions -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 {
diff --git a/test/CodeGenCXX/exceptions-no-rtti.cpp b/test/CodeGenCXX/exceptions-no-rtti.cpp
index bbbc1b8a8bb6..902d6ac2973a 100644
--- a/test/CodeGenCXX/exceptions-no-rtti.cpp
+++ b/test/CodeGenCXX/exceptions-no-rtti.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fno-rtti -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -fno-rtti -fcxx-exceptions -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: @_ZTIN5test11AE = linkonce_odr unnamed_addr constant
// CHECK: @_ZTIN5test11BE = linkonce_odr unnamed_addr constant
diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp
index 80818189f48b..d9b850672cd1 100644
--- a/test/CodeGenCXX/exceptions.cpp
+++ b/test/CodeGenCXX/exceptions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
typedef typeof(sizeof(0)) size_t;
@@ -305,3 +305,88 @@ namespace test6 {
}
}
}
+
+// PR9298
+namespace test7 {
+ struct A { A(); ~A(); };
+ struct B {
+ // The throw() operator means that a bad allocation is signalled
+ // with a null return, which means that the initializer is
+ // evaluated conditionally.
+ static void *operator new(size_t size) throw();
+ B(const A&, B*);
+ ~B();
+ };
+
+ B *test() {
+ // CHECK: define [[B:%.*]]* @_ZN5test74testEv()
+ // CHECK: [[OUTER_NEW:%.*]] = alloca i1
+ // CHECK-NEXT: alloca [[A:%.*]],
+ // CHECK-NEXT: alloca i8*
+ // CHECK-NEXT: alloca i32
+ // CHECK-NEXT: [[OUTER_A:%.*]] = alloca i1
+ // CHECK-NEXT: alloca i8*
+ // CHECK-NEXT: [[INNER_NEW:%.*]] = alloca i1
+ // CHECK-NEXT: alloca [[A]]
+ // CHECK-NEXT: [[INNER_A:%.*]] = alloca i1
+
+ // These entry-block stores are to deactivate the delete cleanups.
+ // CHECK-NEXT: store i1 false, i1* [[INNER_NEW]]
+ // CHECK-NEXT: store i1 false, i1* [[OUTER_NEW]]
+
+ // Allocate the outer object.
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_ZN5test71BnwEm(
+ // CHECK-NEXT: icmp eq i8* [[NEW]], null
+
+ // These stores, emitted before the outermost conditional branch,
+ // deactivate the temporary cleanups.
+ // CHECK-NEXT: store i1 false, i1* [[OUTER_A]]
+ // CHECK-NEXT: store i1 false, i1* [[INNER_A]]
+ // CHECK-NEXT: br i1
+
+ // We passed the first null check; activate that cleanup and continue.
+ // CHECK: store i1 true, i1* [[OUTER_NEW]]
+ // CHECK-NEXT: bitcast
+
+ // Create the first A temporary and activate that cleanup.
+ // CHECK-NEXT: invoke void @_ZN5test71AC1Ev(
+ // CHECK: store i1 true, i1* [[OUTER_A]]
+
+ // Allocate the inner object.
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_ZN5test71BnwEm(
+ // CHECK-NEXT: icmp eq i8* [[NEW]], null
+ // CHECK-NEXT: br i1
+
+ // We passed the second null check; save that pointer, activate
+ // that cleanup, and continue.
+ // CHECK: store i8* [[NEW]]
+ // CHECK-NEXT: store i1 true, i1* [[INNER_NEW]]
+ // CHECK-NEXT: bitcast
+
+ // Build the second A temporary and activate that cleanup.
+ // CHECK-NEXT: invoke void @_ZN5test71AC1Ev(
+ // CHECK: store i1 true, i1* [[INNER_A]]
+
+ // Build the inner B object and deactivate the inner delete cleanup.
+ // CHECK-NEXT: invoke void @_ZN5test71BC1ERKNS_1AEPS0_(
+ // CHECK: store i1 false, i1* [[INNER_NEW]]
+ // CHECK: phi
+
+ // Build the outer B object and deactivate the outer delete cleanup.
+ // CHECK-NEXT: invoke void @_ZN5test71BC1ERKNS_1AEPS0_(
+ // CHECK: store i1 false, i1* [[OUTER_NEW]]
+ // CHECK: phi
+
+ // Destroy the inner A object.
+ // CHECK-NEXT: load i1* [[INNER_A]]
+ // CHECK-NEXT: br i1
+ // CHECK: invoke void @_ZN5test71AD1Ev(
+
+ // Destroy the outer A object.
+ // CHECK: load i1* [[OUTER_A]]
+ // CHECK-NEXT: br i1
+ // CHECK: invoke void @_ZN5test71AD1Ev(
+
+ return new B(A(), new B(A(), 0));
+ }
+}
diff --git a/test/CodeGenCXX/explicit-instantiation.cpp b/test/CodeGenCXX/explicit-instantiation.cpp
index b82958568a8a..8daf3c680006 100644
--- a/test/CodeGenCXX/explicit-instantiation.cpp
+++ b/test/CodeGenCXX/explicit-instantiation.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -emit-llvm -triple i686-pc-linux-gnu -o - %s | FileCheck %s
// This check logically is attached to 'template int S<int>::i;' below.
-// CHECK: @_ZN1SIiE1iE = weak global i32
+// CHECK: @_ZN1SIiE1iE = weak_odr global i32
template<typename T, typename U, typename Result>
struct plus {
diff --git a/test/CodeGenCXX/for-range-temporaries.cpp b/test/CodeGenCXX/for-range-temporaries.cpp
new file mode 100644
index 000000000000..be594ce5223d
--- /dev/null
+++ b/test/CodeGenCXX/for-range-temporaries.cpp
@@ -0,0 +1,131 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++0x -emit-llvm -o - -UDESUGAR %s | opt -instnamer -S | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++0x -emit-llvm -o - -DDESUGAR %s | opt -instnamer -S | FileCheck %s
+
+struct A {
+ A();
+ A(const A &);
+ ~A();
+};
+
+struct B {
+ B();
+ B(const B &);
+ ~B();
+};
+
+struct C {
+ C(const B &);
+ C(const C &);
+ ~C();
+};
+
+struct E;
+struct D {
+ D(const C &);
+ D(const D &);
+ ~D();
+};
+E begin(D);
+E end(D);
+
+struct F;
+struct G;
+struct H;
+struct E {
+ E(const E &);
+ ~E();
+ F operator*();
+ G operator++();
+ H operator!=(const E &o);
+};
+
+struct I;
+struct F {
+ F(const F &);
+ ~F();
+ operator I();
+};
+
+struct G {
+ G(const G &);
+ ~G();
+ operator bool();
+};
+
+struct H {
+ H(const H &);
+ ~H();
+ operator bool();
+};
+
+struct I {
+ I(const I &);
+ ~I();
+};
+
+void body(const I &);
+
+void for_temps() {
+ A a;
+#ifdef DESUGAR
+ {
+ auto && __range = D(B());
+ for (auto __begin = begin(__range), __end = end(__range);
+ __begin != __end; ++__begin) {
+ I i = *__begin;
+ body(i);
+ }
+ }
+#else
+ for (I i : D(B())) {
+ body(i);
+ }
+#endif
+}
+
+// CHECK: define void @_Z9for_tempsv()
+// CHECK: call void @_ZN1AC1Ev(
+// CHECK: call void @_ZN1BC1Ev(
+// CHECK: call void @_ZN1CC1ERK1B(
+// CHECK: call void @_ZN1DC1ERK1C(
+// CHECK: call void @_ZN1CD1Ev(
+// CHECK: call void @_ZN1BD1Ev(
+// CHECK: call void @_ZN1DC1ERKS_(
+// CHECK: call void @_Z5begin1D(
+// CHECK: call void @_ZN1DD1Ev(
+// CHECK: call void @_ZN1DC1ERKS_(
+// CHECK: call void @_Z3end1D(
+// CHECK: call void @_ZN1DD1Ev(
+// CHECK: br label %[[COND:.*]]
+
+// CHECK: [[COND]]:
+// CHECK: call void @_ZN1EneERKS_(
+// CHECK: %[[CMP:.*]] = call zeroext i1 @_ZN1HcvbEv(
+// CHECK: call void @_ZN1HD1Ev(
+// CHECK: br i1 %[[CMP]], label %[[BODY:.*]], label %[[CLEANUP:.*]]
+
+// CHECK: [[CLEANUP]]:
+// CHECK: call void @_ZN1ED1Ev(
+// CHECK: call void @_ZN1ED1Ev(
+// In for-range:
+// call void @_ZN1DD1Ev(
+// CHECK: br label %[[END:.*]]
+
+// CHECK: [[BODY]]:
+// CHECK: call void @_ZN1EdeEv(
+// CHECK: call void @_ZN1Fcv1IEv(
+// CHECK: call void @_ZN1FD1Ev(
+// CHECK: call void @_Z4bodyRK1I(
+// CHECK: call void @_ZN1ID1Ev(
+// CHECK: br label %[[INC:.*]]
+
+// CHECK: [[INC]]:
+// CHECK: call void @_ZN1EppEv(
+// CHECK: call void @_ZN1GD1Ev(
+// CHECK: br label %[[COND]]
+
+// CHECK: [[END]]:
+// In desugared version:
+// call void @_ZN1DD1Ev(
+// CHECK: call void @_ZN1AD1Ev(
+// CHECK: ret void
diff --git a/test/CodeGenCXX/for-range.cpp b/test/CodeGenCXX/for-range.cpp
new file mode 100644
index 000000000000..af4664462351
--- /dev/null
+++ b/test/CodeGenCXX/for-range.cpp
@@ -0,0 +1,128 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -std=c++0x -emit-llvm -o - %s | opt -instnamer -S | FileCheck %s
+
+struct A {
+ A();
+ A(const A&);
+ ~A();
+};
+
+struct B {
+ B();
+ B(const B&);
+ ~B();
+};
+
+struct C {
+ C();
+ C(const C&);
+ ~C();
+};
+
+struct D {
+ D();
+ D(const D&);
+ ~D();
+
+ B *begin();
+ B *end();
+};
+
+namespace std {
+ B *begin(C&);
+ B *end(C&);
+}
+
+extern B array[5];
+
+// CHECK: define void @_Z9for_arrayv(
+void for_array() {
+ // CHECK: call void @_ZN1AC1Ev(%struct.A* [[A:.*]])
+ A a;
+ for (B b : array) {
+ // CHECK-NOT: 5begin
+ // CHECK-NOT: 3end
+ // CHECK: getelementptr {{.*}}, i32 0
+ // CHECK: getelementptr {{.*}}, i64 5
+ // CHECK: br label %[[COND:.*]]
+
+ // CHECK: [[COND]]:
+ // CHECK: %[[CMP:.*]] = icmp ne
+ // CHECK: br i1 %[[CMP]], label %[[BODY:.*]], label %[[END:.*]]
+
+ // CHECK: [[BODY]]:
+ // CHECK: call void @_ZN1BC1ERKS_(
+ // CHECK: call void @_ZN1BD1Ev(
+ // CHECK: br label %[[INC:.*]]
+
+ // CHECK: [[INC]]:
+ // CHECK: getelementptr {{.*}} i32 1
+ // CHECK: br label %[[COND]]
+ }
+ // CHECK: [[END]]:
+ // CHECK: call void @_ZN1AD1Ev(%struct.A* [[A]])
+ // CHECK: ret void
+}
+
+// CHECK: define void @_Z9for_rangev(
+void for_range() {
+ // CHECK: call void @_ZN1AC1Ev(%struct.A* [[A:.*]])
+ A a;
+ for (B b : C()) {
+ // CHECK: call void @_ZN1CC1Ev(
+ // CHECK: = call %struct.A* @_ZSt5beginR1C(
+ // CHECK: = call %struct.A* @_ZSt3endR1C(
+ // CHECK: br label %[[COND:.*]]
+
+ // CHECK: [[COND]]:
+ // CHECK: %[[CMP:.*]] = icmp ne
+ // CHECK: br i1 %[[CMP]], label %[[BODY:.*]], label %[[CLEANUP:.*]]
+
+ // CHECK: [[CLEANUP]]:
+ // CHECK: call void @_ZN1CD1Ev(
+ // CHECK: br label %[[END:.*]]
+
+ // CHECK: [[BODY]]:
+ // CHECK: call void @_ZN1BC1ERKS_(
+ // CHECK: call void @_ZN1BD1Ev(
+ // CHECK: br label %[[INC:.*]]
+
+ // CHECK: [[INC]]:
+ // CHECK: getelementptr {{.*}} i32 1
+ // CHECK: br label %[[COND]]
+ }
+ // CHECK: [[END]]:
+ // CHECK: call void @_ZN1AD1Ev(%struct.A* [[A]])
+ // CHECK: ret void
+}
+
+// CHECK: define void @_Z16for_member_rangev(
+void for_member_range() {
+ // CHECK: call void @_ZN1AC1Ev(%struct.A* [[A:.*]])
+ A a;
+ for (B b : D()) {
+ // CHECK: call void @_ZN1DC1Ev(
+ // CHECK: = call %struct.A* @_ZN1D5beginEv(
+ // CHECK: = call %struct.A* @_ZN1D3endEv(
+ // CHECK: br label %[[COND:.*]]
+
+ // CHECK: [[COND]]:
+ // CHECK: %[[CMP:.*]] = icmp ne
+ // CHECK: br i1 %[[CMP]], label %[[BODY:.*]], label %[[CLEANUP:.*]]
+
+ // CHECK: [[CLEANUP]]:
+ // CHECK: call void @_ZN1DD1Ev(
+ // CHECK: br label %[[END:.*]]
+
+ // CHECK: [[BODY]]:
+ // CHECK: call void @_ZN1BC1ERKS_(
+ // CHECK: call void @_ZN1BD1Ev(
+ // CHECK: br label %[[INC:.*]]
+
+ // CHECK: [[INC]]:
+ // CHECK: getelementptr {{.*}} i32 1
+ // CHECK: br label %[[COND]]
+ }
+ // CHECK: [[END]]:
+ // CHECK: call void @_ZN1AD1Ev(%struct.A* [[A]])
+ // CHECK: ret void
+}
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp
index 600327081681..9bd7390d076c 100644
--- a/test/CodeGenCXX/global-init.cpp
+++ b/test/CodeGenCXX/global-init.cpp
@@ -20,8 +20,8 @@ struct D { ~D(); };
// PR6205: The casts should not require global initializers
// CHECK: @_ZN6PR59741cE = external global %"struct.PR5974::C"
-// CHECK: @_ZN6PR59741aE = global %"struct.PR5974::A"* bitcast (%"struct.PR5974::C"* @_ZN6PR59741cE to %"struct.PR5974::A"*), align 8
-// CHECK: @_ZN6PR59741bE = global %"struct.PR5974::A"* bitcast (i8* getelementptr (%"struct.PR5974::C"* @_ZN6PR59741cE, i32 0, i32 0, i64 4) to %"struct.PR5974::A"*), align 8
+// CHECK: @_ZN6PR59741aE = global %"struct.PR5974::A"* getelementptr inbounds (%"struct.PR5974::C"* @_ZN6PR59741cE, i32 0, i32 0)
+// CHECK: @_ZN6PR59741bE = global %"struct.PR5974::A"* bitcast (i8* getelementptr (i8* bitcast (%"struct.PR5974::C"* @_ZN6PR59741cE to i8*), i64 4) to %"struct.PR5974::A"*), align 8
// CHECK: call void @_ZN1AC1Ev(%struct.A* @a)
// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
@@ -90,6 +90,23 @@ namespace PR5974 {
// CHECK-NEXT: sub
// CHECK-NEXT: store i32 {{.*}}, i32* @_ZN5test1L1yE
+// PR9570: the indirect field shouldn't crash IR gen.
+namespace test5 {
+ static union {
+ unsigned bar[4096] __attribute__((aligned(128)));
+ };
+}
+
+namespace test6 {
+ struct A {
+ A();
+ };
+ extern int foo();
+
+ // This needs an initialization function but not guard variables.
+ __attribute__((weak)) int x = foo();
+}
+
// At the end of the file, we check that y is initialized before z.
// CHECK: define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_instructions" {
diff --git a/test/CodeGenCXX/goto.cpp b/test/CodeGenCXX/goto.cpp
index 938d4e12d8d5..3286b228b25f 100644
--- a/test/CodeGenCXX/goto.cpp
+++ b/test/CodeGenCXX/goto.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fexceptions -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -o - | FileCheck %s
// Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
namespace test0 {
diff --git a/test/CodeGenCXX/mangle-exprs.cpp b/test/CodeGenCXX/mangle-exprs.cpp
index e5f26e584b06..46c46f04a8a2 100644
--- a/test/CodeGenCXX/mangle-exprs.cpp
+++ b/test/CodeGenCXX/mangle-exprs.cpp
@@ -49,3 +49,63 @@ namespace Casts {
// CHECK: define weak_odr void @_ZN5Casts5auto_IiEEvDTnw_DapicvT__EEE(
template void auto_<int>(int*);
}
+
+namespace test1 {
+ short foo(short);
+ int foo(int);
+
+ // CHECK: define linkonce_odr signext i16 @_ZN5test11aIsEEDTcl3foocvT__EEES1_(
+ template <class T> auto a(T t) -> decltype(foo(T())) { return foo(t); }
+
+ // CHECK: define linkonce_odr signext i16 @_ZN5test11bIsEEDTcp3foocvT__EEES1_(
+ template <class T> auto b(T t) -> decltype((foo)(T())) { return (foo)(t); }
+
+ void test(short s) {
+ a(s);
+ b(s);
+ }
+}
+
+namespace test2 {
+ template <class T> void a(T x, decltype(x()) y) {}
+ template <class T> auto b(T x) -> decltype(x()) { return x(); }
+ template <class T> void c(T x, void (*p)(decltype(x()))) {}
+ template <class T> void d(T x, auto (*p)() -> decltype(x())) {}
+ template <class T> void e(auto (*p)(T y) -> decltype(y())) {}
+ template <class T> void f(void (*p)(T x, decltype(x()) y)) {}
+ template <class T> void g(T x, decltype(x()) y) {
+ static decltype(x()) variable;
+ variable = 0;
+ }
+ template <class T> void h(T x, decltype((decltype(x())(*)()) 0) y) {}
+ template <class T> void i(decltype((auto (*)(T x) -> decltype(x())) 0) y) {}
+
+ float foo();
+ void bar(float);
+ float baz(float(*)());
+ void fred(float(*)(), float);
+
+ // CHECK: define void @_ZN5test211instantiateEv
+ void instantiate() {
+ // CHECK: call void @_ZN5test21aIPFfvEEEvT_DTclfL0p_EE(
+ a(foo, 0.0f);
+ // CHECK: call float @_ZN5test21bIPFfvEEEDTclfp_EET_(
+ (void) b(foo);
+ // CHECK: call void @_ZN5test21cIPFfvEEEvT_PFvDTclfL1p_EEE(
+ c(foo, bar);
+ // CHECK: call void @_ZN5test21dIPFfvEEEvT_PFDTclfL0p_EEvE(
+ d(foo, foo);
+ // CHECK: call void @_ZN5test21eIPFfvEEEvPFDTclfp_EET_E(
+ e(baz);
+ // CHECK: call void @_ZN5test21fIPFfvEEEvPFvT_DTclfL0p_EEE(
+ f(fred);
+ // CHECK: call void @_ZN5test21gIPFfvEEEvT_DTclfL0p_EE(
+ g(foo, 0.0f);
+ // CHECK: call void @_ZN5test21hIPFfvEEEvT_DTcvPFDTclfL0p_EEvELi0EE(
+ h(foo, foo);
+ // CHECK: call void @_ZN5test21iIPFfvEEEvDTcvPFDTclfp_EET_ELi0EE(
+ i<float(*)()>(baz);
+ }
+
+ // CHECK: store float {{.*}}, float* @_ZZN5test21gIPFfvEEEvT_DTclfL0p_EEE8variable,
+}
diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp
index 8d79988da8e3..fea3582d321a 100644
--- a/test/CodeGenCXX/mangle-subst-std.cpp
+++ b/test/CodeGenCXX/mangle-subst-std.cpp
@@ -5,8 +5,8 @@
// CHECK: @_ZTTSd = linkonce_odr unnamed_addr constant
// CHECK: @_ZTVSd = linkonce_odr unnamed_addr constant
-// CHECK: @_ZTCSd0_Si = internal constant
-// CHECK: @_ZTCSd16_So = internal constant
+// CHECK: @_ZTCSd0_Si = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTCSd16_So = linkonce_odr unnamed_addr constant
// CHECK: @_ZTTSo = linkonce_odr unnamed_addr constant
// CHECK: @_ZTVSo = linkonce_odr unnamed_addr constant
// CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index ec496fe1f753..27777a51c4f1 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -183,7 +183,7 @@ template <typename T> typename T::U ft6(const T&) { return 0; }
// CHECK: @_Z3ft6I1SENT_1UERKS1_
template int ft6<S>(const S&);
-template<typename> struct __is_scalar {
+template<typename> struct __is_scalar_type {
enum { __value = 1 };
};
@@ -194,11 +194,11 @@ template<typename T> struct __enable_if<true, T> {
};
// PR5063
-template<typename T> typename __enable_if<__is_scalar<T>::__value, void>::__type ft7() { }
+template<typename T> typename __enable_if<__is_scalar_type<T>::__value, void>::__type ft7() { }
-// CHECK: @_Z3ft7IiEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
+// CHECK: @_Z3ft7IiEN11__enable_ifIXsr16__is_scalar_typeIT_E7__valueEvE6__typeEv
template void ft7<int>();
-// CHECK: @_Z3ft7IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
+// CHECK: @_Z3ft7IPvEN11__enable_ifIXsr16__is_scalar_typeIT_E7__valueEvE6__typeEv
template void ft7<void*>();
// PR5144
@@ -225,15 +225,15 @@ struct S7 {
S7::S7() {}
// PR5063
-template<typename T> typename __enable_if<(__is_scalar<T>::__value), void>::__type ft8() { }
-// CHECK: @_Z3ft8IiEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
+template<typename T> typename __enable_if<(__is_scalar_type<T>::__value), void>::__type ft8() { }
+// CHECK: @_Z3ft8IiEN11__enable_ifIXsr16__is_scalar_typeIT_E7__valueEvE6__typeEv
template void ft8<int>();
-// CHECK: @_Z3ft8IPvEN11__enable_ifIXsr11__is_scalarIT_E7__valueEvE6__typeEv
+// CHECK: @_Z3ft8IPvEN11__enable_ifIXsr16__is_scalar_typeIT_E7__valueEvE6__typeEv
template void ft8<void*>();
// PR5796
namespace PR5796 {
-template<typename> struct __is_scalar {
+template<typename> struct __is_scalar_type {
enum { __value = 0 };
};
@@ -241,8 +241,8 @@ template<bool, typename> struct __enable_if {};
template<typename T> struct __enable_if<true, T> { typedef T __type; };
template<typename T>
-// CHECK: define linkonce_odr void @_ZN6PR57968__fill_aIiEENS_11__enable_ifIXntsrNS_11__is_scalarIT_EE7__valueEvE6__typeEv
-typename __enable_if<!__is_scalar<T>::__value, void>::__type __fill_a() { };
+// CHECK: define linkonce_odr void @_ZN6PR57968__fill_aIiEENS_11__enable_ifIXntsrNS_16__is_scalar_typeIT_EE7__valueEvE6__typeEv
+typename __enable_if<!__is_scalar_type<T>::__value, void>::__type __fill_a() { };
void f() { __fill_a<int>(); }
}
@@ -348,7 +348,7 @@ namespace test0 {
char buffer[sizeof(float)];
g<float>(buffer);
}
- // CHECK: define linkonce_odr void @_ZN5test01gIfEEvRAszplcvT__ELf40A00000E_c(
+ // CHECK: define linkonce_odr void @_ZN5test01gIfEEvRAszplcvT__ELf40a00000E_c(
template <class T> void h(char (&buffer)[sizeof(T() + 5.0)]) {}
void test3() {
@@ -373,7 +373,7 @@ namespace test1 {
template void f(X<int>);
}
-// CHECK: define internal void @_Z27functionWithInternalLinkagev()
+// CHECK: define internal void @_ZL27functionWithInternalLinkagev()
static void functionWithInternalLinkage() { }
void g() { functionWithInternalLinkage(); }
@@ -390,26 +390,29 @@ namespace test2 {
// CHECK: define linkonce_odr i32 @_ZN5test211read_memberINS_1AEEEDtptcvPT_Li0E6memberERS2_(
}
+// rdar://problem/9280586
namespace test3 {
struct AmbiguousBase { int ab; };
struct Path1 : AmbiguousBase { float p; };
struct Path2 : AmbiguousBase { double p; };
struct Derived : Path1, Path2 { };
- //template <class T> decltype(((T*) 0)->Path1::ab) get_ab_1(T &ref) { return ref.Path1::ab; }
- //template <class T> decltype(((T*) 0)->Path2::ab) get_ab_2(T &ref) { return ref.Path2::ab; }
+ // CHECK: define linkonce_odr i32 @_ZN5test38get_ab_1INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path1E2abERS2_(
+ template <class T> decltype(((T*) 0)->Path1::ab) get_ab_1(T &ref) { return ref.Path1::ab; }
- // define weak_odr float @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0E5Path11pERS2_(
+ // CHECK: define linkonce_odr i32 @_ZN5test38get_ab_2INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path2E2abERS2_(
+ template <class T> decltype(((T*) 0)->Path2::ab) get_ab_2(T &ref) { return ref.Path2::ab; }
+
+ // CHECK: define linkonce_odr float @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path1E1pERS2_(
template <class T> decltype(((T*) 0)->Path1::p) get_p_1(T &ref) { return ref.Path1::p; }
- // define weak_odr double @_ZN5test37get_p_1INS_7DerivedEEEDtptcvPT_Li0E5Path21pERS2_(
+ // CHECK: define linkonce_odr double @_ZN5test37get_p_2INS_7DerivedEEEDtptcvPT_Li0EsrNS_5Path2E1pERS2_(
template <class T> decltype(((T*) 0)->Path2::p) get_p_2(T &ref) { return ref.Path2::p; }
Derived obj;
void test() {
- // FIXME: uncomment these when we support diamonds competently
- //get_ab_1(obj);
- //get_ab_2(obj);
+ get_ab_1(obj);
+ get_ab_2(obj);
get_p_1(obj);
get_p_2(obj);
}
@@ -647,3 +650,29 @@ namespace test23 {
void f(vpca5 volatile (&)[10]) {}
// CHECK: define void @_ZN6test231fERA10_A5_VKPv(
}
+
+namespace test24 {
+ void test0() {
+ extern int foo();
+ // CHECK: call i32 @_ZN6test243fooEv()
+ foo();
+ }
+
+ static char foo() {}
+ void test1() {
+ // CHECK: call signext i8 @_ZN6test24L3fooEv()
+ foo();
+ }
+}
+
+// rdar://problem/8806641
+namespace test25 {
+ template <void (*fn)()> struct A {
+ static void call() { fn(); }
+ };
+ void foo();
+ void test() {
+ // CHECK: call void @_ZN6test251AIXadL_ZNS_3fooEvEEE4callEv()
+ A<foo>::call();
+ }
+}
diff --git a/test/CodeGenCXX/member-function-pointers.cpp b/test/CodeGenCXX/member-function-pointers.cpp
index 78a571e196e4..011e9cd68556 100644
--- a/test/CodeGenCXX/member-function-pointers.cpp
+++ b/test/CodeGenCXX/member-function-pointers.cpp
@@ -209,3 +209,26 @@ namespace test8 {
return pmf();
}
}
+
+namespace test9 {
+ struct A {
+ void foo();
+ };
+ struct B : A {
+ void foo();
+ };
+
+ typedef void (A::*fooptr)();
+
+ struct S {
+ fooptr p;
+ };
+
+ // CHECK: define void @_ZN5test94testEv(
+ // CHECK: alloca i32
+ // CHECK-NEXT: ret void
+ void test() {
+ int x;
+ static S array[] = { (fooptr) &B::foo };
+ }
+}
diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp
index d03b21bacbaf..ad6fa4f74456 100644
--- a/test/CodeGenCXX/nrvo.cpp
+++ b/test/CodeGenCXX/nrvo.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -emit-llvm -O1 -o - %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -O1 -fexceptions -o - %s | FileCheck --check-prefix=CHECK-EH %s
+// RUN: %clang_cc1 -emit-llvm -O1 -fcxx-exceptions -fexceptions -o - %s | FileCheck --check-prefix=CHECK-EH %s
// Test code generation for the named return value optimization.
class X {
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp
index 40723a856cd6..2a22d23e509d 100644
--- a/test/CodeGenCXX/pointers-to-data-members.cpp
+++ b/test/CodeGenCXX/pointers-to-data-members.cpp
@@ -55,7 +55,7 @@ namespace ZeroInit {
};
struct C : A, B { int j; };
- // CHECK-GLOBAL: @_ZN8ZeroInit1cE = global {{%.*}} { [16 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00", [176 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", i32 0, [4 x i8] zeroinitializer }
+ // CHECK-GLOBAL: @_ZN8ZeroInit1cE = global {{%.*}} { %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.ZeroInit::B" { [10 x %"struct.PR7139::ptr_to_member_struct"] [%"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }, %"struct.PR7139::ptr_to_member_struct" { i64 -1, i32 0 }], i8 0, i64 -1 }, i32 0 }, align 8
C c;
}
@@ -172,15 +172,15 @@ struct A {
int A::*i;
};
-// CHECK-GLOBAL: @_ZN12VirtualBases1bE = global {{%.*}} { i32 (...)** null, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF" }
+// CHECK-GLOBAL: @_ZN12VirtualBases1bE = global %"struct.VirtualBases::B" { i32 (...)** null, %"struct.VirtualBases::A" { i8 0, i64 -1 } }, align 8
struct B : virtual A { };
B b;
-// CHECK-GLOBAL: @_ZN12VirtualBases1cE = global {{%.*}} { i32 (...)** null, i64 -1, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF" }
+// CHECK-GLOBAL: @_ZN12VirtualBases1cE = global %"struct.VirtualBases::C" { i32 (...)** null, i64 -1, %"struct.VirtualBases::A" { i8 0, i64 -1 } }, align 8
struct C : virtual A { int A::*i; };
C c;
- // CHECK-GLOBAL: @_ZN12VirtualBases1dE = global {{%.*}} { [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", i64 -1, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF" }
+// CHECK-GLOBAL: @_ZN12VirtualBases1dE = global %"struct.VirtualBases::D" { %"struct.VirtualBases::C.base" { i32 (...)** null, i64 -1 }, i64 -1, %"struct.VirtualBases::A" { i8 0, i64 -1 } }, align 8
struct D : C { int A::*i; };
D d;
@@ -227,6 +227,6 @@ namespace test4 {
struct C : virtual B { int *C_p; };
struct D : C { int *D_p; };
- // CHECK-GLOBAL: @_ZN5test41dE = global {{%.*}} { [16 x i8] zeroinitializer, i32* null, [16 x i8] c"\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF", [4 x i8] zeroinitializer }
+ // CHECK-GLOBAL: @_ZN5test41dE = global %"struct.test4::D" { %"struct.test4::C.base" zeroinitializer, i32* null, %"struct.VirtualBases::C.base" { i32 (...)** null, i64 -1 }, %"struct.test4::A" zeroinitializer }, align 8
D d;
}
diff --git a/test/CodeGenCXX/pragma-pack.cpp b/test/CodeGenCXX/pragma-pack.cpp
index c0ddb1d855a9..c0b025978467 100644
--- a/test/CodeGenCXX/pragma-pack.cpp
+++ b/test/CodeGenCXX/pragma-pack.cpp
@@ -10,5 +10,7 @@ struct Sub : virtual Base {
char c;
};
-// CHECK: %struct.Sub = type <{ i32 (...)**, i8, [8 x i8] }>
+// CHECK: %struct.Sub = type <{ i32 (...)**, i8, %struct.Base }>
void f(Sub*) { }
+
+static int i[sizeof(Sub) == 13 ? 1 : -1];
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp
index d2ad98013553..25bc8d801790 100644
--- a/test/CodeGenCXX/references.cpp
+++ b/test/CodeGenCXX/references.cpp
@@ -258,3 +258,14 @@ void f() {
}
}
+// PR9494
+namespace N5 {
+struct AnyS { bool b; };
+void f(const bool&);
+AnyS g();
+void h() {
+ // CHECK: call i8 @_ZN2N51gEv()
+ // CHECK: call void @_ZN2N51fERKb(i8*
+ f(g().b);
+}
+}
diff --git a/test/CodeGenCXX/specialized-static-data-mem-init.cpp b/test/CodeGenCXX/specialized-static-data-mem-init.cpp
index 8f5765bcbbe9..c2a2ddb11254 100644
--- a/test/CodeGenCXX/specialized-static-data-mem-init.cpp
+++ b/test/CodeGenCXX/specialized-static-data-mem-init.cpp
@@ -2,8 +2,8 @@
// rdar: // 8562966
// pr8409
-// CHECK: @_ZN1CIiE11needs_guardE = weak global
-// CHECK: @_ZGVN1CIiE11needs_guardE = weak global
+// CHECK: @_ZN1CIiE11needs_guardE = weak_odr global
+// CHECK: @_ZGVN1CIiE11needs_guardE = weak_odr global
struct K
{
diff --git a/test/CodeGenCXX/static-data-member.cpp b/test/CodeGenCXX/static-data-member.cpp
index 64fca2eb6837..b19067af61df 100644
--- a/test/CodeGenCXX/static-data-member.cpp
+++ b/test/CodeGenCXX/static-data-member.cpp
@@ -2,8 +2,8 @@
// CHECK: @_ZN5test11A1aE = constant i32 10, align 4
// CHECK: @_ZN5test212_GLOBAL__N_11AIiE1xE = internal global i32 0, align 4
-// CHECK: @_ZN5test31AIiE1xE = weak global i32 0, align 4
-// CHECK: @_ZGVN5test31AIiE1xE = weak global i64 0
+// CHECK: @_ZN5test31AIiE1xE = weak_odr global i32 0, align 4
+// CHECK: @_ZGVN5test31AIiE1xE = weak_odr global i64 0
// PR5564.
namespace test1 {
diff --git a/test/CodeGenCXX/static-init-3.cpp b/test/CodeGenCXX/static-init-3.cpp
index 5bf76a61708e..bd717caaa172 100644
--- a/test/CodeGenCXX/static-init-3.cpp
+++ b/test/CodeGenCXX/static-init-3.cpp
@@ -16,8 +16,8 @@ struct X1
}
};
-// CHECK: @_ZN2X1I2X2I1BEE8instanceE = weak global %struct.X0* null, align 8
-// CHECJ: @_ZN2X1I2X2I1AEE8instanceE = weak global %struct.X0* null, align 8
+// CHECK: @_ZN2X1I2X2I1BEE8instanceE = weak_odr global %struct.X0* null, align 8
+// CHECJ: @_ZN2X1I2X2I1AEE8instanceE = weak_odr global %struct.X0* null, align 8
template<class T> T & X1<T>::instance = X1<T>::get();
class A { };
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index dd9ed61434e2..78749a7a2faf 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -2,7 +2,7 @@
// CHECK: @_ZZ1hvE1i = internal global i32 0, align 4
-// CHECK: @_ZZN5test16getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16
+// CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16
// CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0
// CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0
@@ -50,7 +50,7 @@ namespace test0 {
}
namespace test1 {
- // CHECK: define internal i32 @_ZN5test16getvarEi(
+ // CHECK: define internal i32 @_ZN5test1L6getvarEi(
static inline int getvar(int index) {
static const int var[] = { 1, 0, 2, 4 };
return var[index];
diff --git a/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp b/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
index ca4446cd200e..2c62b60b1100 100644
--- a/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
+++ b/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fvisibility hidden -emit-llvm -o - %s | FileCheck %s
// Verify that symbols are hidden.
-// CHECK: @_ZN1CIiE5Inner6Inner26StaticE = weak hidden global
+// CHECK: @_ZN1CIiE5Inner6Inner26StaticE = weak_odr hidden global
// CHECK: define weak_odr hidden void @_ZN1CIiE5Inner1fEv
// CHECK: define weak_odr hidden void @_ZN1CIiE5Inner6Inner21gEv
diff --git a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
index 87be57295cbd..0bd810eeca56 100644
--- a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
+++ b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - -fexceptions -triple x86_64-apple-darwin10 %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 %s | FileCheck %s
struct X {
X();
diff --git a/test/CodeGenCXX/threadsafe-statics.cpp b/test/CodeGenCXX/threadsafe-statics.cpp
index 65ebc43c5d25..8afc2746f42e 100644
--- a/test/CodeGenCXX/threadsafe-statics.cpp
+++ b/test/CodeGenCXX/threadsafe-statics.cpp
@@ -1,8 +1,11 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix=WITH-TSS %s
-// RUN: %clang_cc1 -emit-llvm -o - %s -fno-threadsafe-statics | FileCheck -check-prefix=NO-TSS %s
+// RUN: %clang_cc1 -emit-llvm -triple=x86_64-apple-darwin10 -o - %s | FileCheck -check-prefix=WITH-TSS %s
+// RUN: %clang_cc1 -emit-llvm -triple=x86_64-apple-darwin10 -o - %s -fno-threadsafe-statics | FileCheck -check-prefix=NO-TSS %s
int f();
+// WITH-TSS: @_ZZ1gvE1a = internal global i32 0, align 4
+// WITH-TSS: @_ZGVZ1gvE1a = internal global i64 0
+
// WITH-TSS: define void @_Z1gv() nounwind
// WITH-TSS: call i32 @__cxa_guard_acquire
// WITH-TSS: call void @__cxa_guard_release
@@ -11,6 +14,9 @@ void g() {
static int a = f();
}
+// NO-TSS: @_ZZ1gvE1a = internal global i32 0, align 4
+// NO-TSS: @_ZGVZ1gvE1a = internal global i8 0
+
// NO-TSS: define void @_Z1gv() nounwind
// NO-TSS-NOT: call i32 @__cxa_guard_acquire
// NO-TSS-NOT: call void @__cxa_guard_release
diff --git a/test/CodeGenCXX/throw-expression-dtor.cpp b/test/CodeGenCXX/throw-expression-dtor.cpp
index f87657fdcc01..0de6683f88d1 100644
--- a/test/CodeGenCXX/throw-expression-dtor.cpp
+++ b/test/CodeGenCXX/throw-expression-dtor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm-only -verify -fexceptions
+// RUN: %clang_cc1 %s -emit-llvm-only -verify -fcxx-exceptions -fexceptions
// PR7281
class A {
diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp
index 1d22ec05c37f..0fd32c44575b 100644
--- a/test/CodeGenCXX/throw-expressions.cpp
+++ b/test/CodeGenCXX/throw-expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -emit-llvm-only -verify %s -Wno-unreachable-code
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm-only -verify %s -Wno-unreachable-code
int val = 42;
int& test1() {
diff --git a/test/CodeGenCXX/try-catch.cpp b/test/CodeGenCXX/try-catch.cpp
index 2b5f3232d1fb..89f229fee375 100644
--- a/test/CodeGenCXX/try-catch.cpp
+++ b/test/CodeGenCXX/try-catch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
struct X { };
diff --git a/test/CodeGenCXX/typeid.cpp b/test/CodeGenCXX/typeid.cpp
new file mode 100644
index 000000000000..1af96705ba41
--- /dev/null
+++ b/test/CodeGenCXX/typeid.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
+#include <typeinfo>
+
+namespace Test1 {
+
+// PR7400
+struct A { virtual void f(); };
+
+// CHECK: define i8* @_ZN5Test11fEv
+const char *f() {
+ try {
+ // CHECK: br i1
+ // CHECK: invoke void @__cxa_bad_typeid() noreturn
+ return typeid(*static_cast<A *>(0)).name();
+ } catch (...) {
+ // CHECK: call i8* @llvm.eh.exception
+ }
+
+ return 0;
+}
+
+}
diff --git a/test/CodeGenCXX/unknown-anytype.cpp b/test/CodeGenCXX/unknown-anytype.cpp
new file mode 100644
index 000000000000..902cc8de5c97
--- /dev/null
+++ b/test/CodeGenCXX/unknown-anytype.cpp
@@ -0,0 +1,99 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -funknown-anytype -emit-llvm -o - %s | FileCheck %s
+
+int test0() {
+ extern __unknown_anytype test0_any;
+ // CHECK: load i32* @test0_any
+ return (int) test0_any;
+}
+
+int test1() {
+ extern __unknown_anytype test1_any();
+ // CHECK: call i32 @_Z9test1_anyv()
+ return (int) test1_any();
+}
+
+extern "C" __unknown_anytype test2_any(...);
+float test2() {
+ // CHECK: call float (...)* @test2_any(double {{[^,]+}})
+ return (float) test2_any(0.5f);
+}
+
+extern "C" __unknown_anytype test2a_any(...);
+float test2a() {
+ // CHECK: call float (...)* @test2a_any(float {{[^,]+}})
+ return (float) test2a_any((float) 0.5f);
+}
+
+float test3() {
+ extern __unknown_anytype test3_any;
+ // CHECK: [[FN:%.*]] = load float (i32)** @test3_any,
+ // CHECK: call float [[FN]](i32 5)
+ return ((float(*)(int)) test3_any)(5);
+}
+
+namespace test4 {
+ extern __unknown_anytype test4_any1;
+ extern __unknown_anytype test4_any2;
+
+ int test() {
+ // CHECK: load i32* @_ZN5test410test4_any1E
+ // CHECK: load i8* @_ZN5test410test4_any2E
+ return (int) test4_any1 + (char) test4_any2;
+ }
+}
+
+extern "C" __unknown_anytype test5_any();
+void test5() {
+ // CHECK: call void @test5_any()
+ return (void) test5_any();
+}
+
+extern "C" __unknown_anytype test6_any(float *);
+long test6() {
+ // CHECK: call i64 @test6_any(float* null)
+ return (long) test6_any(0);
+}
+
+struct Test7 {
+ ~Test7();
+};
+extern "C" __unknown_anytype test7_any(int);
+Test7 test7() {
+ // CHECK: call void @test7_any({{%.*}}* sret {{%.*}}, i32 5)
+ return (Test7) test7_any(5);
+}
+
+struct Test8 {
+ __unknown_anytype foo();
+ __unknown_anytype foo(int);
+
+ void test();
+};
+void Test8::test() {
+ float f;
+ // CHECK: call i32 @_ZN5Test83fooEv(
+ f = (int) foo();
+ // CHECK: call i32 @_ZN5Test83fooEi(
+ f = (int) foo(5);
+ // CHECK: call i32 @_ZN5Test83fooEv(
+ f = (float) this->foo();
+ // CHECK: call i32 @_ZN5Test83fooEi(
+ f = (float) this->foo(5);
+}
+void test8(Test8 *p) {
+ double d;
+ // CHECK: call i32 @_ZN5Test83fooEv(
+ d = (double) p->foo();
+ // CHECK: call i32 @_ZN5Test83fooEi(
+ d = (double) p->foo(5);
+ // CHECK: call i32 @_ZN5Test83fooEv(
+ d = (bool) (*p).foo();
+ // CHECK: call i32 @_ZN5Test83fooEi(
+ d = (bool) (*p).foo(5);
+}
+
+extern "C" __unknown_anytype test9_foo;
+void *test9() {
+ // CHECK: ret i8* bitcast (i32* @test9_foo to i8*)
+ return (int*) &test9_foo;
+}
diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp
index 258d6926e148..a5a0b67d57d8 100644
--- a/test/CodeGenCXX/value-init.cpp
+++ b/test/CodeGenCXX/value-init.cpp
@@ -83,6 +83,61 @@ namespace ptrmem {
}
}
+namespace PR9801 {
+
+struct Test {
+ Test() : i(10) {}
+ Test(int i) : i(i) {}
+ int i;
+private:
+ int j;
+};
+
+struct Test2 {
+ Test t;
+};
+
+struct Test3 : public Test { };
+
+// CHECK: define void @_ZN6PR98011fEv
+void f() {
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98014TestC1Ei
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98014TestC1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98014TestC1Ev
+ Test partial[3] = { 1 };
+
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98014TestC1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98014TestC1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98014TestC1Ev
+ Test empty[3] = {};
+
+ // CHECK: call void @llvm.memset.p0i8.i64
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98015Test2C1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98015Test2C1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98015Test2C1Ev
+ Test2 empty2[3] = {};
+
+ // CHECK: call void @llvm.memset.p0i8.i64
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98015Test3C1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98015Test3C1Ev
+ // CHECK-NOT: call void @llvm.memset.p0i8.i64
+ // CHECK: call void @_ZN6PR98015Test3C1Ev
+ Test3 empty3[3] = {};
+}
+
+}
+
namespace zeroinit {
struct S { int i; };
@@ -121,6 +176,7 @@ namespace zeroinit {
template<typename>
struct X3 : X2<int> {
X3() : X2<int>() { }
+ int i;
};
@@ -133,7 +189,7 @@ namespace zeroinit {
X3<int>().f();
}
- // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev(%struct.B* %this) unnamed_addr
+ // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev(%"struct.zeroinit::X3"* %this) unnamed_addr
// CHECK: call void @llvm.memset.p0i8.i64
// CHECK-NEXT: call void @_ZN8zeroinit2X2IiEC2Ev
// CHECK-NEXT: ret void
diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp
index 931465060b62..7644e47ff780 100644
--- a/test/CodeGenCXX/visibility.cpp
+++ b/test/CodeGenCXX/visibility.cpp
@@ -411,3 +411,14 @@ namespace Test20 {
B<A<2> >::test5();
}
}
+
+// PR9371
+namespace test21 {
+ enum En { en };
+ template<En> struct A {
+ __attribute__((visibility("default"))) void foo() {}
+ };
+
+ // CHECK: define weak_odr void @_ZN6test211AILNS_2EnE0EE3fooEv(
+ template void A<en>::foo();
+}
diff --git a/test/CodeGenCXX/vtable-debug-info.cpp b/test/CodeGenCXX/vtable-debug-info.cpp
index c355406fae4a..9294d20e7292 100644
--- a/test/CodeGenCXX/vtable-debug-info.cpp
+++ b/test/CodeGenCXX/vtable-debug-info.cpp
@@ -2,8 +2,9 @@
// Radar 8730409
// XFAIL: win32
-// FIXME: This test crashes on Windows.
-#ifdef _WIN32
+// FIXME: This test crashes on *-pc-win32
+// for lack of debugging support on -integrated-as (MCCOFF).
+#ifdef _MSC_VER
#error this test must xfail
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index 1cf8a52d44b9..bd696813c814 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -41,6 +41,7 @@
// RUN: FileCheck --check-prefix=CHECK-40 %s < %t
// RUN: FileCheck --check-prefix=CHECK-41 %s < %t
// RUN: FileCheck --check-prefix=CHECK-42 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-43 %s < %t
// For now, just verify this doesn't crash.
namespace test0 {
@@ -1679,3 +1680,24 @@ struct D : virtual B, C {
void D::g() { }
}
+
+namespace Test37 {
+
+// Test that we give C::f the right vtable index. (PR9660).
+struct A {
+ virtual A* f() = 0;
+};
+
+struct B : virtual A {
+ virtual B* f();
+};
+
+// CHECK-43: VTable indices for 'Test37::C' (1 entries).
+// CHECK-43-NEXT: 1 | Test37::C *Test37::C::f()
+struct C : B {
+ virtual C* f();
+};
+
+C* C::f() { return 0; }
+
+}
diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp
index fc14c71a0e48..4633a3fe9569 100644
--- a/test/CodeGenCXX/vtable-linkage.cpp
+++ b/test/CodeGenCXX/vtable-linkage.cpp
@@ -203,7 +203,7 @@ void G_f0() { new G<int>(); }
// RUN: FileCheck --check-prefix=CHECK-H %s < %t
// H<int> has a key function without a body but it's a template instantiation
-// so its VTable must be emmitted.
+// so its VTable must be emitted.
// CHECK-H: @_ZTV1HIiE = linkonce_odr unnamed_addr constant
template <typename T>
class H {
diff --git a/test/CodeGenCXX/x86_64-arguments.cpp b/test/CodeGenCXX/x86_64-arguments.cpp
index e7316989feaa..01f1a445b1c7 100644
--- a/test/CodeGenCXX/x86_64-arguments.cpp
+++ b/test/CodeGenCXX/x86_64-arguments.cpp
@@ -3,13 +3,13 @@
// Basic base class test.
struct f0_s0 { unsigned a; };
struct f0_s1 : public f0_s0 { void *b; };
-// CHECK: define void @_Z2f05f0_s1(i64 %a0.coerce0, i8* %a0.coerce1)
+// CHECK: define void @_Z2f05f0_s1(i32 %a0.coerce0, i8* %a0.coerce1)
void f0(f0_s1 a0) { }
// Check with two eight-bytes in base class.
struct f1_s0 { unsigned a; unsigned b; float c; };
struct f1_s1 : public f1_s0 { float d;};
-// CHECK: define void @_Z2f15f1_s1(i64 %a0.coerce0, double %a0.coerce1)
+// CHECK: define void @_Z2f15f1_s1(i64 %a0.coerce0, <2 x float> %a0.coerce1)
void f1(f1_s1 a0) { }
// Check with two eight-bytes in base class and merge.
@@ -54,7 +54,7 @@ namespace PR7742 { // Also rdar://8250764
struct c2 : public s2 {};
- // CHECK: define double @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P)
+ // CHECK: define <2 x float> @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P)
c2 foo(c2 *P) {
}
diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m
index 93eeca820117..3cd12a5c2c1a 100644
--- a/test/CodeGenObjC/atomic-aggregate-property.m
+++ b/test/CodeGenObjC/atomic-aggregate-property.m
@@ -23,7 +23,7 @@ struct s1 {
@synthesize y;
@synthesize z;
@end
-
// CHECK-LP64: call void @objc_copyStruct
// CHECK-LP64: call void @objc_copyStruct
// CHECK-LP64: call void @objc_copyStruct
+// CHECK-LP64: call i8* @objc_memmove_collectable
diff --git a/test/CodeGenObjC/attr-availability.m b/test/CodeGenObjC/attr-availability.m
new file mode 100644
index 000000000000..d2b2973c78d3
--- /dev/null
+++ b/test/CodeGenObjC/attr-availability.m
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin8.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_4 %s
+// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin9.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_5 %s
+// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin10.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_6 %s
+
+// CHECK-10_4: @"OBJC_CLASS_$_WeakClass1" = extern_weak global
+// CHECK-10_5: @"OBJC_CLASS_$_WeakClass1" = external global
+// CHECK-10_6: @"OBJC_CLASS_$_WeakClass1" = external global
+__attribute__((availability(macosx,introduced=10.5)))
+@interface WeakClass1 @end
+
+@implementation WeakClass1(MyCategory) @end
+
+@implementation WeakClass1(YourCategory) @end
+
+// CHECK-10_4: @"OBJC_CLASS_$_WeakClass2" = extern_weak global
+// CHECK-10_5: @"OBJC_CLASS_$_WeakClass2" = extern_weak global
+// CHECK-10_6: @"OBJC_CLASS_$_WeakClass2" = external global
+__attribute__((availability(macosx,introduced=10.6)))
+@interface WeakClass2 @end
+
+@implementation WeakClass2(MyCategory) @end
+
+@implementation WeakClass2(YourCategory) @end
+
diff --git a/test/CodeGenObjC/bitfield-access.m b/test/CodeGenObjC/bitfield-access.m
index 16b0001ddfda..ab776abd4ea6 100644
--- a/test/CodeGenObjC/bitfield-access.m
+++ b/test/CodeGenObjC/bitfield-access.m
@@ -1,7 +1,8 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -o %t %s
-// RUN: FileCheck -check-prefix=CHECK-I386 < %t %s
-// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -emit-llvm -o %t %s
-// RUN: FileCheck -check-prefix=CHECK-ARM < %t %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -o %t1 %s
+// RUN: FileCheck -check-prefix=CHECK-I386 < %t1 %s
+
+// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -emit-llvm -o %t2 %s
+// RUN: FileCheck -check-prefix=CHECK-ARM < %t2 %s
@interface I0 {
@public
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index 06dc908f2ba3..151c16234214 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -87,3 +87,16 @@ void test2(Test2 *x) {
__weak __block Test2 *weakX = x;
test2_helper(^{ [weakX destroy]; });
}
+
+// rdar://problem/9124263
+// In the test above, check that the use in the invocation function
+// doesn't require a read barrier.
+// CHECK: define internal void @__test2_block_invoke_
+// CHECK: [[BLOCK:%.*]] = bitcast i8* {{%.*}} to [[BLOCK_T]]*
+// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5
+// CHECK-NEXT: [[T1:%.*]] = load i8** [[T0]]
+// CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to [[WEAK_T]]*
+// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [[WEAK_T]]* [[T2]], i32 0, i32 1
+// CHECK-NEXT: [[T4:%.*]] = load [[WEAK_T]]** [[T3]]
+// CHECK-NEXT: [[WEAKX:%.*]] = getelementptr inbounds [[WEAK_T]]* [[T4]], i32 0, i32 6
+// CHECK-NEXT: [[T0:%.*]] = load [[TEST2]]** [[WEAKX]], align 4
diff --git a/test/CodeGenObjC/constant-strings.m b/test/CodeGenObjC/constant-strings.m
index 227694969bfe..398981362e08 100644
--- a/test/CodeGenObjC/constant-strings.m
+++ b/test/CodeGenObjC/constant-strings.m
@@ -1,6 +1,18 @@
// RUN: %clang_cc1 -emit-llvm -o %t %s
-// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1
-// RUN: %clang_cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1
+// RUN: FileCheck --check-prefix=CHECK-NEXT < %t %s
+// Check that we set alignment 1 on the string.
+//
+// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", align 1
+
+// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix=CHECK-GNU < %t %s
+// CHECK-GNU: NXConstantString
+// CHECK-GNU-NOT: NXConstantString
+
+// RUN: %clang_cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix=CHECK-GNU-WITH-CLASS < %t %s
+// CHECK-GNU-WITH-CLASS: NSConstantString
+// CHECK-GNU-WITH-CLASS-NOT: NSConstantString
id a = @"Hello World!";
diff --git a/test/CodeGenObjC/debug-info-foreach.m b/test/CodeGenObjC/debug-info-foreach.m
index c056e0e249de..89b409c7169e 100644
--- a/test/CodeGenObjC/debug-info-foreach.m
+++ b/test/CodeGenObjC/debug-info-foreach.m
@@ -4,10 +4,17 @@
@class NSArray;
+int i;
void f(NSArray *a) {
id keys;
for (id thisKey in keys) {
+ int j = i;
+ ++j;
+ i = j;
}
for (id thisKey in keys) {
+ int k = i;
+ ++k;
+ i = k;
}
}
diff --git a/test/CodeGenObjC/debug-info-getter-name.m b/test/CodeGenObjC/debug-info-getter-name.m
index 0263f112aeb4..746fcee18298 100644
--- a/test/CodeGenObjC/debug-info-getter-name.m
+++ b/test/CodeGenObjC/debug-info-getter-name.m
@@ -1,5 +1,10 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -g %s -o %t
-// RUN: grep "\[InstanceVariablesEverywhereButTheInterface someString\]" %t | count 6
+// RUN: %clang_cc1 -fno-dwarf2-cfi-asm -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -g %s -o - | FileCheck %s
+
+//CHECK: "-[InstanceVariablesEverywhereButTheInterface someString]":
+//CHECK: .quad "-[InstanceVariablesEverywhereButTheInterface someString]"
+//CHECK: .ascii "-[InstanceVariablesEverywhereButTheInterface someString]"
+//CHECK: .asciz "-[InstanceVariablesEverywhereButTheInterface someString]"
+//CHECK: "-[InstanceVariablesEverywhereButTheInterface someString].eh":
//rdar: //8498026
diff --git a/test/CodeGenObjC/debug-info-property.m b/test/CodeGenObjC/debug-info-property.m
new file mode 100644
index 000000000000..d86b7c7a5eba
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-property.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s
+
+// CHECK: AT_APPLE_property_name
+@interface I1 {
+int p1;
+}
+@property int p1;
+@end
+
+@implementation I1
+@synthesize p1;
+@end
diff --git a/test/CodeGenObjC/fpret.m b/test/CodeGenObjC/fpret.m
index 48848885c1f6..bde0caa8ff3a 100644
--- a/test/CodeGenObjC/fpret.m
+++ b/test/CodeGenObjC/fpret.m
@@ -16,7 +16,7 @@
// CHECK-X86_32: define void @t0()
// CHECK-X86_32: call float bitcast {{.*}} @objc_msgSend_fpret to
-// CHECK-X86_32: call double {{.*}} @objc_msgSend_fpret(
+// CHECK-X86_32: call double bitcast {{.*}} @objc_msgSend_fpret to
// CHECK-X86_32: call x86_fp80 bitcast {{.*}} @objc_msgSend_fpret to
// CHECK-X86_32: }
//
diff --git a/test/CodeGenObjC/instance-method-metadata.m b/test/CodeGenObjC/instance-method-metadata.m
new file mode 100644
index 000000000000..ae87c7a85345
--- /dev/null
+++ b/test/CodeGenObjC/instance-method-metadata.m
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -o %t %s
+// RUN: FileCheck < %t %s
+
+// rdar://9072317
+
+/** The problem looks like clang getting confused when a single translation unit
+ contains a protocol with a property and two classes that implement that protocol
+ and synthesize the property.
+*/
+
+@protocol Proto
+@property (assign) id prop;
+@end
+
+@interface NSObject @end
+
+@interface Foo : NSObject <Proto> { int x; } @end
+
+@interface Bar : NSObject <Proto> @end
+
+@implementation Foo
+@synthesize prop;
+@end
+
+@implementation Bar
+@synthesize prop;
+@end
+
+// CHECK: l_OBJC_$_INSTANCE_METHODS_Bar:
+// CHECK-NEXT .long 24
+// CHECK-NEXT .long 2
+// CHECK-NEXT .quad L_OBJC_METH_VAR_NAME_
+// CHECK-NEXT .quad L_OBJC_METH_VAR_TYPE_
+// CHECK-NEXT .quad "-[Bar prop]"
diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m
index b36fe5b644ed..a921dc774ad1 100644
--- a/test/CodeGenObjC/messages.m
+++ b/test/CodeGenObjC/messages.m
@@ -13,35 +13,35 @@ void f0(id a) {
int i;
MyPoint pt = { 1, 2};
- // CHECK-MAC: call {{.*}} @objc_msgSend(
- // CHECK-MAC-NF: call {{.*}} @objc_msgSend(
+ // CHECK-MAC: call {{.*}} @objc_msgSend to
+ // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
// CHECK-GNU: call {{.*}} @objc_msg_lookup(
// CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
[a print0];
// CHECK-MAC: call {{.*}} @objc_msgSend to
// CHECK-MAC-NF: call {{.*}} @objc_msgSend to
- // CHECK-GNU: call {{.*}} @objc_msg_lookup to
- // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
+ // CHECK-GNU: call {{.*}} @objc_msg_lookup(
+ // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
[a print1: 10];
// CHECK-MAC: call {{.*}} @objc_msgSend to
// CHECK-MAC-NF: call {{.*}} @objc_msgSend to
- // CHECK-GNU: call {{.*}} @objc_msg_lookup to
- // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
+ // CHECK-GNU: call {{.*}} @objc_msg_lookup(
+ // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
[a print2: 10 and: "hello" and: 2.2];
// CHECK-MAC: call {{.*}} @objc_msgSend to
// CHECK-MAC-NF: call {{.*}} @objc_msgSend to
- // CHECK-GNU: call {{.*}} @objc_msg_lookup to
- // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
+ // CHECK-GNU: call {{.*}} @objc_msg_lookup(
+ // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
[a takeStruct: pt ];
void *s = @selector(print0);
for (i=0; i<2; ++i)
// CHECK-MAC: call {{.*}} @objc_msgSend to
// CHECK-MAC-NF: call {{.*}} @objc_msgSend to
- // CHECK-GNU: call {{.*}} @objc_msg_lookup to
- // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
+ // CHECK-GNU: call {{.*}} @objc_msg_lookup(
+ // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
[a performSelector:s];
}
diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m
index dbc06d76cd50..908c95cdf5d2 100644
--- a/test/CodeGenObjC/metadata-symbols-64.m
+++ b/test/CodeGenObjC/metadata-symbols-64.m
@@ -7,11 +7,11 @@
// RUN: grep '@"OBJC_METACLASS_$_A" = global .* section "__DATA, __objc_data", align 8' %t
// RUN: grep '@"\\01L_OBJC_CLASSLIST_REFERENCES_$_[0-9]*" = internal global .* section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8' %t
// RUN: grep '@"\\01L_OBJC_CLASSLIST_SUP_REFS_$_[0-9]*" = internal global .* section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8' %t | count 2
-// RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t
+// RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .* section "__TEXT,__objc_classname,cstring_literals", align 1' %t
// RUN: grep '@"\\01L_OBJC_LABEL_CATEGORY_$" = internal global .* section "__DATA, __objc_catlist, regular, no_dead_strip", align 8' %t
// RUN: grep '@"\\01L_OBJC_LABEL_CLASS_$" = internal global .* section "__DATA, __objc_classlist, regular, no_dead_strip", align 8' %t
-// RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t
-// RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t
+// RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .* section "__TEXT,__objc_methname,cstring_literals", align 1' %t
+// RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .* section "__TEXT,__objc_methtype,cstring_literals", align 1' %t
// RUN: grep '@"\\01L_OBJC_PROP_NAME_ATTR_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t
// RUN: grep '@"\\01L_OBJC_SELECTOR_REFERENCES_*" = internal global .* section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"' %t
// RUN: grep '@"\\01l_OBJC_$_CATEGORY_A_$_Cat" = internal global .* section "__DATA, __objc_const", align 8' %t
diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m
index d86422999f61..370ca6eccbe9 100644
--- a/test/CodeGenObjC/metadata_symbols.m
+++ b/test/CodeGenObjC/metadata_symbols.m
@@ -4,7 +4,7 @@
// 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: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,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
@@ -28,7 +28,7 @@
// 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: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,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
diff --git a/test/CodeGenObjC/misc-atomic-property.m b/test/CodeGenObjC/misc-atomic-property.m
new file mode 100644
index 000000000000..26402d355b59
--- /dev/null
+++ b/test/CodeGenObjC/misc-atomic-property.m
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
+// rdar: //8808439
+
+typedef struct {
+#ifdef __LP64__
+ unsigned char b[15];
+#else
+ unsigned char b[7];
+#endif
+} bools_minus_one;
+
+typedef struct {
+#ifdef __LP64__
+ unsigned char b[16];
+#else
+ unsigned char b[8];
+#endif
+} bools;
+
+
+@interface Foo
+{
+#ifndef __LP64__
+ bools x;
+ bools_minus_one y;
+#endif
+}
+@property(assign) bools bools_p;
+@property(assign) bools_minus_one bools_minus_one_p;
+@end
+
+@implementation Foo
+@synthesize bools_p=x;
+@synthesize bools_minus_one_p=y;
+@end
+
+#ifdef __LP64__
+typedef __int128_t dword;
+#else
+typedef long long int dword;
+#endif
+
+@interface Test_dwords
+{
+#ifndef __LP64__
+ dword dw;
+#endif
+}
+@property(assign) dword dword_p;
+@end
+
+@implementation Test_dwords
+@synthesize dword_p=dw;
+@end
+
+
+@interface Test_floats
+{
+ float fl;
+ double d;
+ long double ld;
+}
+@property(assign) float fl_p;
+@property(assign) double d_p;
+@property(assign) long double ld_p;
+@end
+
+@implementation Test_floats
+@synthesize fl_p = fl;
+@synthesize d_p = d;
+@synthesize ld_p = ld;
+@end
+
+// CHECK: call void @objc_copyStruct
+// CHECK: call void @objc_copyStruct
+// CHECK: call void @objc_copyStruct
+// CHECK: call void @objc_copyStruct
+// CHECK: call void @objc_copyStruct
+// CHECK: call void @objc_copyStruct
diff --git a/test/CodeGenObjC/missing-atend-metadata.m b/test/CodeGenObjC/missing-atend-metadata.m
deleted file mode 100644
index 50e597c8d1a8..000000000000
--- a/test/CodeGenObjC/missing-atend-metadata.m
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s
-
-@interface I0
-@end
-
-@implementation I0 // expected-warning {{'@end' is missing in implementation context}}
-- meth { return 0; }
-
-@interface I1 : I0
-@end
-
-@implementation I1 // expected-warning {{'@end' is missing in implementation context}}
--(void) im0 { self = [super init]; }
-
-@interface I2 : I0
-- I2meth;
-@end
-
-@implementation I2 // expected-warning {{'@end' is missing in implementation context}}
-- I2meth { return 0; }
-
-@implementation I2(CAT) // expected-warning {{'@end' is missing in implementation context}}
-
-// CHECK: @"\01L_OBJC_CLASS_I1" = internal global
diff --git a/test/CodeGenObjC/no-vararg-messaging.m b/test/CodeGenObjC/no-vararg-messaging.m
new file mode 100644
index 000000000000..f72820a4b66e
--- /dev/null
+++ b/test/CodeGenObjC/no-vararg-messaging.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -o - %s | FileCheck %s
+// rdar://9048030
+
+@interface Foo
++(id)alloc;
+-(id)init;
+-(id)self;
+-(id)retain;
+-(void)release;
+-(id)autorelease;
+@end
+
+void test(void)
+{
+ [[[[[[Foo alloc] init] retain] autorelease] self] release];
+}
+
+// CHECK-NOT: xorb
diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m
index 2dd32bb4f373..6d8f1d6b03ad 100644
--- a/test/CodeGenObjC/property-agrr-getter.m
+++ b/test/CodeGenObjC/property-agrr-getter.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm-only %s
typedef struct {
unsigned f0;
@@ -36,3 +36,9 @@ float f ()
AnObject* obj;
return (obj.size).width;
}
+
+// rdar://problem/9272392
+void test3(AnObject *obj) {
+ obj.size;
+ (void) obj.size;
+}
diff --git a/test/CodeGenObjC/simplify-exceptions.mm b/test/CodeGenObjC/simplify-exceptions.mm
new file mode 100644
index 000000000000..a35b10d73d2d
--- /dev/null
+++ b/test/CodeGenObjC/simplify-exceptions.mm
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm \
+// RUN: -fexceptions -fobjc-exceptions -fobjc-nonfragile-abi \
+// RUN: -o %t %s
+// RUN: FileCheck < %t %s
+//
+// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes
+
+// Check that we don't emit unnecessary personality function references.
+struct t0_A { t0_A(); };
+struct t0_B { t0_A a; };
+
+// CHECK: define {{.*}} @_Z2t0v(){{.*}} {
+// CHECK-NOT: objc_personality
+// CHECK: }
+t0_B& t0() {
+ static t0_B x;
+ return x;
+}
diff --git a/test/CodeGenObjCXX/exceptions.mm b/test/CodeGenObjCXX/exceptions.mm
index 00de88c15220..d4c0756cb89f 100644
--- a/test/CodeGenObjCXX/exceptions.mm
+++ b/test/CodeGenObjCXX/exceptions.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fcxx-exceptions -fexceptions -o - %s | FileCheck %s
@interface OCType @end
void opaque();
diff --git a/test/CodeGenObjCXX/ivar-objects.mm b/test/CodeGenObjCXX/ivar-objects.mm
index d0432edf2b29..d05763b3fcf8 100644
--- a/test/CodeGenObjCXX/ivar-objects.mm
+++ b/test/CodeGenObjCXX/ivar-objects.mm
@@ -1,6 +1,10 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// CHECK: -[A .cxx_construct]
// CHECK: -[A .cxx_destruct]
+// CHECK: -[B .cxx_construct]
+// CHECK-NOT: -[B .cxx_destruct]
+// CHECK-NOT: -[C .cxx_construct]
+// CHECK: -[C .cxx_destruct]
@interface NSObject
- alloc;
@@ -84,3 +88,17 @@ public:
@implementation I
@synthesize position;
@end
+
+// This class should have a .cxx_construct but no .cxx_destruct.
+namespace test3 { struct S { S(); }; }
+@implementation B {
+ test3::S s;
+}
+@end
+
+// This class should have a .cxx_destruct but no .cxx_construct.
+namespace test4 { struct S { ~S(); }; }
+@implementation C {
+ test4::S s;
+}
+@end
diff --git a/test/CodeGenObjCXX/message-reference.mm b/test/CodeGenObjCXX/message-reference.mm
new file mode 100644
index 000000000000..b7cf98d88c66
--- /dev/null
+++ b/test/CodeGenObjCXX/message-reference.mm
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// rdar://8604515
+
+@interface I {}
+-(unsigned int&)referenceCount;
+@end
+
+@interface MyClass
++(int)writeBlip:(I*)srcBlip;
+@end
+
+@implementation MyClass
++(int)writeBlip:(I*)srcBlip{
+ return ([srcBlip referenceCount] == 0);
+}
+@end
+
+// CHECK: [[T:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK: [[U:%.*]] = load i32* [[T]]
+// CHECK [[V:%.*]] = icmp eq i32 [[U]], 0
diff --git a/test/CodeGenObjCXX/property-reference.mm b/test/CodeGenObjCXX/property-reference.mm
new file mode 100644
index 000000000000..7c235cb9b4ef
--- /dev/null
+++ b/test/CodeGenObjCXX/property-reference.mm
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// rdar://9208606
+
+struct MyStruct
+{
+ int x;
+ int y;
+ int z;
+};
+
+@interface MyClass
+{
+ MyStruct _foo;
+}
+
+@property (assign, readwrite) const MyStruct& foo;
+
+- (const MyStruct&) foo;
+- (void) setFoo:(const MyStruct&)inFoo;
+@end
+
+int main()
+{
+ MyClass* myClass;
+ MyStruct myStruct;
+
+ myClass.foo = myStruct;
+
+ const MyStruct& currentMyStruct = myClass.foo;
+ return 0;
+}
+
+// CHECK: [[C:%.*]] = call %struct.MyStruct* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK: store %struct.MyStruct* [[C]], %struct.MyStruct** [[D:%.*]]
diff --git a/test/CodeGenObjCXX/references.mm b/test/CodeGenObjCXX/references.mm
index 8875fd624074..6265c7be7613 100644
--- a/test/CodeGenObjCXX/references.mm
+++ b/test/CodeGenObjCXX/references.mm
@@ -30,7 +30,7 @@ void f(B* b) {
@protocol P2 @end
@protocol P3 @end
@interface foo<P1> {} @end
-@interface bar : foo <P1, P2> {} @end
+@interface bar : foo <P1, P2, P3> {} @end
typedef bar baz;
void f5(foo&);
void f5b(foo<P1>&);
diff --git a/test/CodeGenOpenCL/2011-04-15-vec-init-from-vec.cl b/test/CodeGenOpenCL/2011-04-15-vec-init-from-vec.cl
new file mode 100644
index 000000000000..c61be69b5739
--- /dev/null
+++ b/test/CodeGenOpenCL/2011-04-15-vec-init-from-vec.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -emit-llvm -o %t
+
+typedef __attribute__((ext_vector_type(4))) unsigned char uchar4;
+typedef __attribute__((ext_vector_type(4))) unsigned int int4;
+typedef __attribute__((ext_vector_type(8))) unsigned char uchar8;
+
+// OpenCL allows vectors to be initialized by vectors Handle bug in
+// VisitInitListExpr for this case below.
+void foo( int4 v )
+{
+ uchar4 val[4] = {{(uchar4){((uchar8)(v.lo)).lo}}};
+} \ No newline at end of file
diff --git a/test/CodeGenOpenCL/address-spaces.cl b/test/CodeGenOpenCL/address-spaces.cl
new file mode 100644
index 000000000000..e030c77d3e01
--- /dev/null
+++ b/test/CodeGenOpenCL/address-spaces.cl
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -ffake-address-space-map -emit-llvm -o - | FileCheck %s
+
+void f__p(__private int *arg) { }
+// CHECK: i32* nocapture %arg
+
+void f__g(__global int *arg) { }
+// CHECK: i32 addrspace(1)* nocapture %arg
+
+void f__l(__local int *arg) { }
+// CHECK: i32 addrspace(2)* nocapture %arg
+
+void f__c(__constant int *arg) { }
+// CHECK: i32 addrspace(3)* nocapture %arg
+
+
+void fp(private int *arg) { }
+// CHECK: i32* nocapture %arg
+
+void fg(global int *arg) { }
+// CHECK: i32 addrspace(1)* nocapture %arg
+
+void fl(local int *arg) { }
+// CHECK: i32 addrspace(2)* nocapture %arg
+
+void fc(constant int *arg) { }
+// CHECK: i32 addrspace(3)* nocapture %arg
+
diff --git a/test/Coverage/ast-printing.c b/test/Coverage/ast-printing.c
index bbbc366eb711..ecaf3abeaa8a 100644
--- a/test/Coverage/ast-printing.c
+++ b/test/Coverage/ast-printing.c
@@ -1,7 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only %s
// RUN: %clang_cc1 -ast-print %s
// RUN: %clang_cc1 -ast-dump %s
-// RUN: %clang_cc1 -ast-print-xml -o %t %s
// RUN: %clang_cc1 -print-decl-contexts %s
#include "c-language-features.inc"
diff --git a/test/Coverage/ast-printing.cpp b/test/Coverage/ast-printing.cpp
index 0de56422895f..3205078758f1 100644
--- a/test/Coverage/ast-printing.cpp
+++ b/test/Coverage/ast-printing.cpp
@@ -1,7 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only %s
// RUN: %clang_cc1 -ast-print %s
// RUN: %clang_cc1 -ast-dump %s
-// RUN: %clang_cc1 -ast-print-xml -o %t %s
// RUN: %clang_cc1 -print-decl-contexts %s
// RUN: %clang_cc1 -fdump-record-layouts %s
diff --git a/test/Coverage/html-diagnostics.c b/test/Coverage/html-diagnostics.c
index be820fb90f29..4f1b0e3763b8 100644
--- a/test/Coverage/html-diagnostics.c
+++ b/test/Coverage/html-diagnostics.c
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-check-objc-mem -o %t %s
+// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s
// RUN: cat %t/*.html | FileCheck %s
// CHECK: <h3>Annotated Source Code</h3>
diff --git a/test/Driver/apple-kext-i386.cpp b/test/Driver/apple-kext-i386.cpp
new file mode 100644
index 000000000000..dc4e6a641f0d
--- /dev/null
+++ b/test/Driver/apple-kext-i386.cpp
@@ -0,0 +1,9 @@
+// Check that we transparently fallback to llvm-gcc for i386 kexts, we don't
+// support the ABI they use (yet).
+
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
+// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK < %t %s
+
+// CHECK: cc1plus"
+// CHECK: "-fapple-kext"
diff --git a/test/Driver/apple-kext-mkernel.c b/test/Driver/apple-kext-mkernel.c
index 712dfc8d0eba..82a6896415c2 100644
--- a/test/Driver/apple-kext-mkernel.c
+++ b/test/Driver/apple-kext-mkernel.c
@@ -1,6 +1,18 @@
-// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -mkernel -### -fsyntax-only %s 2> %t
-// RUN grep "-disable-red-zone" %t
-// RUN grep "-fapple-kext" %t
-// RUN grep "-fno-builtin" %t
-// RUN grep "-fno-rtti" %t
-// RUN grep "-fno-common" %t
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 \
+// RUN: -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-X86 < %t %s
+
+// CHECK-X86: "-disable-red-zone"
+// CHECK-X86: "-fno-builtin"
+// CHECK-X86: "-fno-rtti"
+// CHECK-X86: "-fno-common"
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 \
+// RUN: -arch armv7 -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ARM < %t %s
+
+// CHECK-ARM: "-backend-option" "-arm-long-calls"
+// CHECK-ARM: "-backend-option" "-arm-strict-align"
+// CHECK-ARM: "-fno-builtin"
+// CHECK-ARM: "-fno-rtti"
+// CHECK-ARM: "-fno-common"
diff --git a/test/Driver/ast.c b/test/Driver/ast.c
index 6e5857fba5e3..e9fbb068d969 100644
--- a/test/Driver/ast.c
+++ b/test/Driver/ast.c
@@ -22,5 +22,5 @@
// COMPILE-AST-PHASES: END
// FIXME: There is a problem with compiling AST's in that the input language is
-// not availabe for use by other tools (for example, to automatically add
+// not available for use by other tools (for example, to automatically add
// -lstdc++). We may need -x [objective-]c++-ast and all that goodness. :(
diff --git a/test/Driver/cc-log-diagnostics.c b/test/Driver/cc-log-diagnostics.c
new file mode 100644
index 000000000000..a70686ad615a
--- /dev/null
+++ b/test/Driver/cc-log-diagnostics.c
@@ -0,0 +1,29 @@
+// RUN: env RC_DEBUG_OPTIONS=1 \
+// RUN: CC_LOG_DIAGNOSTICS=1 \
+// RUN: CC_LOG_DIAGNOSTICS_FILE=%t.log \
+// RUN: %clang -no-canonical-prefixes -ccc-host-triple x86_64-apple-darwin10 -fsyntax-only %s
+// RUN: FileCheck %s < %t.log
+
+int f0() {}
+
+// CHECK: <dict>
+// CHECK: <key>main-file</key>
+// CHECK: <string>{{.*}}cc-log-diagnostics.c</string>
+// CHECK: <key>dwarf-debug-flags</key>
+// CHECK: <string>{{.*}}clang{{.*}}-fsyntax-only{{.*}}</string>
+// CHECK: <key>diagnostics</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>level</key>
+// CHECK: <string>warning</string>
+// CHECK: <key>filename</key>
+// CHECK: <string>{{.*}}cc-log-diagnostics.c</string>
+// CHECK: <key>line</key>
+// CHECK: <integer>7</integer>
+// CHECK: <key>column</key>
+// CHECK: <integer>11</integer>
+// CHECK: <key>message</key>
+// CHECK: <string>control reaches end of non-void function</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
diff --git a/test/Driver/cc-print-options.c b/test/Driver/cc-print-options.c
index 7b798cb08a85..77dd0fef5f98 100644
--- a/test/Driver/cc-print-options.c
+++ b/test/Driver/cc-print-options.c
@@ -1,6 +1,6 @@
// RUN: env CC_PRINT_OPTIONS=1 \
// RUN: CC_PRINT_OPTIONS_FILE=%t.log \
-// RUN: %clang -S -o %t.s %s
+// RUN: %clang -no-canonical-prefixes -S -o %t.s %s
// RUN: FileCheck %s < %t.log
// CHECK: [Logging clang options]{{.*}}clang{{.*}}"-S"
diff --git a/test/Driver/clang-exception-flags.cpp b/test/Driver/clang-exception-flags.cpp
new file mode 100644
index 000000000000..90a9ebf5e44e
--- /dev/null
+++ b/test/Driver/clang-exception-flags.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
+// DEFAULT: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fexceptions %s 2>&1 | FileCheck %s -check-prefix=ON1
+// ON1: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fno-exceptions -fcxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=ON2
+// ON2: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fno-cxx-exceptions -fexceptions %s 2>&1 | FileCheck %s -check-prefix=ON3
+// ON3: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fno-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF1
+// OFF1-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
+//
+// RUN: %clang -### -fno-cxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF2
+// OFF2-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
+//
+// RUN: %clang -### -fcxx-exceptions -fno-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF3
+// OFF3-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
+//
+// RUN: %clang -### -fexceptions -fno-cxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF4
+// OFF4-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c
index 2464f03b7a1e..b2b358f0ebb8 100644
--- a/test/Driver/clang-translation.c
+++ b/test/Driver/clang-translation.c
@@ -31,6 +31,8 @@
// ARMV7_SOFTFLOAT: "-cc1"
// ARMV7_SOFTFLOAT: "-msoft-float"
// ARMV7_SOFTFLOAT: "-mfloat-abi" "soft"
+// ARMV7_SOFTFLOAT: "-target-feature"
+// ARMV7_SOFTFLOAT: "-neon"
// ARMV7_SOFTFLOAT: "-x" "c"
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### -S %s 2> %t.log \
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
index 8e6b0fe850de..4eed4aa06f3f 100644
--- a/test/Driver/clang_f_opts.c
+++ b/test/Driver/clang_f_opts.c
@@ -12,3 +12,20 @@
// CHECK-OPTIONS2: -fshort-wchar
// CHECK-OPTIONS2: -fno-common
// CHECK-OPTIONS2: -fno-show-source-location
+
+// RUN: %clang -### -S -Wwrite-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS1 %s
+// WRITE-STRINGS1: -fconst-strings
+// RUN: %clang -### -S -Wwrite-strings -Wno-write-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS2 %s
+// WRITE-STRINGS2-NOT: -fconst-strings
+// RUN: %clang -### -S -Wwrite-strings -w %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS3 %s
+// WRITE-STRINGS3: -fconst-strings
+
+// RUN: %clang -### -x c++ -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -x c++ -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -x c++ -c -Wno-deprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
+// RUN: %clang -### -x c++ -c -Wno-deprecated -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -x c++ -c -w %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
+// RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
+// DEPRECATED-ON-CHECK: -fdeprecated-macro
+// DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
diff --git a/test/Driver/clang_wrapv_opts.c b/test/Driver/clang_wrapv_opts.c
new file mode 100644
index 000000000000..826468e0678d
--- /dev/null
+++ b/test/Driver/clang_wrapv_opts.c
@@ -0,0 +1,11 @@
+// RUN: %clang -### -S -fwrapv -fno-wrapv -fwrapv %s 2>&1 | FileCheck -check-prefix=CHECK1 %s
+// CHECK1: -fwrapv
+//
+// RUN: %clang -### -S -fstrict-overflow -fno-strict-overflow %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
+// CHECK2: -fwrapv
+//
+// RUN: %clang -### -S -fwrapv -fstrict-overflow %s 2>&1 | FileCheck -check-prefix=CHECK3 %s
+// CHECK3: -fwrapv
+//
+// RUN: %clang -### -S -fno-wrapv -fno-strict-overflow %s 2>&1 | FileCheck -check-prefix=CHECK4 %s
+// CHECK4-NOT: -fwrapv
diff --git a/test/Driver/darwin-cc.c b/test/Driver/darwin-cc.c
index b068bb4e3fd4..247b02bebea2 100644
--- a/test/Driver/darwin-cc.c
+++ b/test/Driver/darwin-cc.c
@@ -1,5 +1,4 @@
// RUN: %clang -ccc-no-clang -ccc-host-triple i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log
-// RUN: grep ' ".*cc1" "-E" "-nostdinc" "-v" "-I" "ARG0" "-FARG1" "-I" "ARG2" "-P" "-MD" "/tmp/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "/tmp/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"' %t.log
-// RUN: grep ' ".*cc1" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-aFOO" "-auxbase-strip" "/tmp/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "/tmp/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"' %t.log
-
-
+// RUN: FileCheck %s < %t.log
+// CHECK: {{ ".*cc1.*" "-E" "-nostdinc" "-v" "-I" "ARG0" "-FARG1" "-I" "ARG2" "-P" "-MD" "[^"]*/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "[^"]*/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"}}
+// CHECK: {{ ".*cc1.*" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-aFOO" "-auxbase-strip" "[^"]*/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "[^"]*/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"}}
diff --git a/test/Driver/darwin-dsymutil.c b/test/Driver/darwin-dsymutil.c
index f1ffcdc589d4..afb41a9db28b 100644
--- a/test/Driver/darwin-dsymutil.c
+++ b/test/Driver/darwin-dsymutil.c
@@ -36,3 +36,10 @@
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-bindings \
// RUN: -o foo %t.o -g 2> %t
// RUN: grep "Dsymutil" %t | count 0
+
+// Check that we put the .dSYM in the right place.
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -o bar/foo %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-LOCATION < %t %s
+
+// CHECK-LOCATION: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["bar/foo"], output: "bar/foo.dSYM"
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index 206e665a2cf3..3f2b69185a58 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -18,8 +18,8 @@
//
// 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" "-LARG2" "-lgomp".* "-filelist" "FOO" "-lFOO" "-lgcov" "-allow_stack_execute" "-T" "ARG4" "-FARG1"' %t.log
+// 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 -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" "-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" "-LARG2" "-lgomp".* "-filelist" "FOO" "-lFOO" "-lgcov" "-allow_stack_execute" "-T" "ARG4" "-FARG1"' %t.log
// Check linker changes that came with new linkedit format.
// RUN: touch %t.o
diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c
index 84533a625246..d9c5c5ed3f7b 100644
--- a/test/Driver/darwin-version.c
+++ b/test/Driver/darwin-version.c
@@ -21,3 +21,11 @@
#error Invalid version
#endif
#endif
+
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.4.10 \
+// RUN: %clang -ccc-host-triple i386-apple-darwin9 -DTEST3 -E %s
+#ifdef TEST3
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1049
+#error Invalid version
+#endif
+#endif
diff --git a/test/Driver/darwin-xarch.c b/test/Driver/darwin-xarch.c
index d2fb43e68caf..d16d5318f7f8 100644
--- a/test/Driver/darwin-xarch.c
+++ b/test/Driver/darwin-xarch.c
@@ -4,8 +4,8 @@
// RUN: -c %s 2> %t
// RUN: FileCheck --check-prefix=CHECK-COMPILE < %t %s
//
-// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "i386-apple-darwin8.0.0"
-// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "x86_64-apple-darwin9.0.0"
+// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "i386-apple-macosx10.4.0"
+// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "x86_64-apple-macosx10.5.0"
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### \
// RUN: -arch i386 -Xarch_i386 -Wl,-some-linker-arg -filelist X 2> %t
diff --git a/test/Driver/exceptions.m b/test/Driver/exceptions.m
new file mode 100644
index 000000000000..7d85fe30aefa
--- /dev/null
+++ b/test/Driver/exceptions.m
@@ -0,0 +1,19 @@
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin9 \
+// RUN: -fsyntax-only -fno-exceptions %s
+
+void f1() {
+ @throw @"A";
+}
+
+void f0() {
+ @try {
+ f1();
+ } @catch (id x) {
+ ;
+ }
+}
+
+int main() {
+ f0();
+ return 0;
+}
diff --git a/test/Driver/hello.c b/test/Driver/hello.c
index da628724d6d9..c2260e53eb38 100644
--- a/test/Driver/hello.c
+++ b/test/Driver/hello.c
@@ -1,9 +1,9 @@
-// RUN: %clang -ccc-echo -o %t %s 2> %t.log
+// RUN: %clang -ccc-echo -o %t.exe %s 2> %t.log
// Make sure we used clang.
-// RUN: grep 'clang" -cc1 .*hello.c' %t.log
+// RUN: grep 'clang\(-[0-9.]\+\)\?\(\.[Ee][Xx][Ee]\)\?" -cc1 .*hello.c' %t.log
-// RUN: %t > %t.out
+// RUN: %t.exe > %t.out
// RUN: grep "I'm a little driver, short and stout." %t.out
// FIXME: We don't have a usable assembler on Windows, so we can't build real
diff --git a/test/Driver/sysroot-flags.c b/test/Driver/sysroot-flags.c
index 461c451e1293..044a86f6331b 100644
--- a/test/Driver/sysroot-flags.c
+++ b/test/Driver/sysroot-flags.c
@@ -2,27 +2,27 @@
// RUN: %clang -### -fsyntax-only -isysroot /foo/bar %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=ISYSROOT
-// ISYSROOT: "-isysroot" "/foo/bar"
+// ISYSROOT: "-isysroot" "{{[^"]*}}/foo/bar"
// Check that we get both isysroot for headers, and pass --sysroot on to GCC to
// produce the final binary.
// RUN: %clang -### -ccc-host-triple x86_64-unknown-linux-gnu \
// RUN: --sysroot=/foo/bar -o /dev/null %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=SYSROOT_EQ
-// SYSROOT_EQ: "-isysroot" "/foo/bar"
-// SYSROOT_EQ: "--sysroot{{" "|=}}/foo/bar"
+// SYSROOT_EQ: "-isysroot" "{{[^"]*}}/foo/bar"
+// SYSROOT_EQ: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
// Check for overriding the header sysroot by providing both --sysroot and
// -isysroot.
// RUN: %clang -### -ccc-host-triple x86_64-unknown-linux-gnu -isysroot /baz \
// RUN: --sysroot=/foo/bar -o /dev/null %s 2>&1 | FileCheck %s \
// RUN: -check-prefix=ISYSROOT_AND_SYSROOT
-// ISYSROOT_AND_SYSROOT: "-isysroot" "/baz"
-// ISYSROOT_AND_SYSROOT: "--sysroot{{" "|=}}/foo/bar"
+// ISYSROOT_AND_SYSROOT: "-isysroot" "{{[^"]*}}/baz"
+// ISYSROOT_AND_SYSROOT: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
// Check that omitting the equals works as well.
// RUN: %clang -### -ccc-host-triple x86_64-unknown-linux-gnu \
// RUN: --sysroot /foo/bar -o /dev/null %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=SYSROOT_SEPARATE
-// SYSROOT_SEPARATE: "-isysroot" "/foo/bar"
-// SYSROOT_SEPARATE: "--sysroot{{" "|=}}/foo/bar"
+// SYSROOT_SEPARATE: "-isysroot" "{{[^"]*}}/foo/bar"
+// SYSROOT_SEPARATE: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp
index d8a858d9da74..90bf9f5c1880 100644
--- a/test/FixIt/fixit-cxx0x.cpp
+++ b/test/FixIt/fixit-cxx0x.cpp
@@ -14,3 +14,6 @@ void x() {
}
}
+using ::T = void; // expected-error {{name defined in alias declaration must be an identifier}}
+using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}}
+using typename ::V = void; // expected-error {{name defined in alias declaration must be an identifier}}
diff --git a/test/FixIt/fixit-unrecoverable.c b/test/FixIt/fixit-unrecoverable.c
index 8052beb5591c..fb6c4e2104be 100644
--- a/test/FixIt/fixit-unrecoverable.c
+++ b/test/FixIt/fixit-unrecoverable.c
@@ -5,6 +5,4 @@
// 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.c b/test/FixIt/fixit.c
index 9c7443594283..1a6ef635570a 100644
--- a/test/FixIt/fixit.c
+++ b/test/FixIt/fixit.c
@@ -48,3 +48,9 @@ enum Color {
Green = 17 // expected-error{{missing ',' between enumerators}}
Blue,
};
+
+// rdar://9295072
+struct test_struct {
+ // CHECK: struct test_struct *struct_ptr;
+ test_struct *struct_ptr; // expected-error {{must use 'struct' tag to refer to type 'test_struct'}}
+};
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index 41b187b0718c..ac749859ea05 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -78,3 +78,22 @@ void f() {
}
}
+template <class A>
+class F1 {
+public:
+ template <int B>
+ class Iterator {
+ };
+};
+
+template<class T>
+class F2 {
+ typename F1<T>:: /*template*/ Iterator<0> Mypos; // expected-error {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
+};
+
+template <class T>
+void f(){
+ typename F1<T>:: /*template*/ Iterator<0> Mypos; // expected-error {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
+}
+
+
diff --git a/test/FixIt/no-macro-fixit.c b/test/FixIt/no-macro-fixit.c
new file mode 100644
index 000000000000..b6a9285e22f0
--- /dev/null
+++ b/test/FixIt/no-macro-fixit.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -pedantic -fixit -x c %s
+// rdar://9091893
+
+#define va_arg(ap, type) __builtin_va_arg(ap, type)
+typedef __builtin_va_list va_list;
+
+void myFunc() {
+ va_list values;
+
+ int value;
+
+ while (value = va_arg(values, int)) { // 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 {{place parentheses around the assignment to silence this warning}}
+ }
+}
diff --git a/test/FixIt/typo.c b/test/FixIt/typo.c
index 01ff3a09cf3e..88d9dc62a1f2 100644
--- a/test/FixIt/typo.c
+++ b/test/FixIt/typo.c
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: cp %s %t
-// RUN: %clang_cc1 -fsyntax-only -fixit -x c %t || true
+// RUN: not %clang_cc1 -fsyntax-only -fixit -x c %t
// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c %t
+// RUN: grep "Rectangle" %t
struct Point {
float x, y;
};
@@ -23,3 +24,14 @@ struct Window window = {
topleft.x = 3.14, // expected-error{{field designator 'topleft' does not refer to any field in type 'struct Rectangle'; did you mean 'top_left'?}}
2.71818, 5.0, 6.0, Red
};
+
+void test() {
+ Rectangle r1; // expected-error{{must use 'struct' tag to refer to type 'Rectangle'}}
+ r1.top_left.x = 0;
+
+ typedef struct Rectangle Rectangle; // expected-note{{'Rectangle' declared here}}
+ rectangle *r2 = &r1; // expected-error{{ unknown type name 'rectangle'; did you mean 'Rectangle'?}}
+ r2->top_left.y = 0;
+ unsinged *ptr = 0; // expected-error{{use of undeclared identifier 'unsinged'; did you mean 'unsigned'?}}
+ *ptr = 17;
+}
diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp
index d1e732fd1dba..f8b5352374f3 100644
--- a/test/FixIt/typo.cpp
+++ b/test/FixIt/typo.cpp
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: cp %s %t
-// RUN: %clang_cc1 -fsyntax-only -fixit -x c++ %t || true
+// RUN: not %clang_cc1 -fsyntax-only -fixit -x c++ %t
// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ %t
+// RUN: grep test_string %t
namespace std {
template<typename T> class basic_string { // expected-note 2{{'basic_string' declared here}}
@@ -64,3 +65,12 @@ struct Derived : public Base { // expected-note{{base class 'Base' specified her
int &Derived::getMember() {
return ember; // expected-error{{use of undeclared identifier 'ember'; did you mean 'member'?}}
}
+
+typedef int Integer; // expected-note{{'Integer' declared here}}
+int global_value; // expected-note{{'global_value' declared here}}
+
+int foo() {
+ integer * i = 0; // expected-error{{unknown type name 'integer'; did you mean 'Integer'?}}
+ unsinged *ptr = 0; // expected-error{{use of undeclared identifier 'unsinged'; did you mean 'unsigned'?}}
+ return *i + *ptr + global_val; // expected-error{{use of undeclared identifier 'global_val'; did you mean 'global_value'?}}
+}
diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m
index 8a474ab16879..ecb207ee3917 100644
--- a/test/FixIt/typo.m
+++ b/test/FixIt/typo.m
@@ -1,22 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -DNON_FIXITS -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -x objective-c -E -P %s -o %t
-// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fixit %t || true
+// RUN: cp %s %t
+// RUN: not %clang_cc1 -x objective-c -fsyntax-only -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fixit %t
// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -pedantic -Werror %t
-// RUN: false
-// XFAIL: *
+// RUN: grep "@implementation Sub3" %t
-
-@interface NSString // expected-note{{'NSString' declared here}}
+@interface NSString // expected-note 2{{'NSString' declared here}}
+ (int)method:(int)x;
@end
-#ifdef NON_FIXITS
void test() {
- // FIXME: not providing fix-its
- NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}} \
- // expected-error{{use of undeclared identifier 'str'}}
+ NSstring *str = @"A string"; // expected-error{{unknown type name 'NSstring'; did you mean 'NSString'?}}
}
-#endif
@protocol P1
@optional
@@ -166,7 +160,7 @@ void f(A *a) {
@implementation Sub3
- (int)method3 {
- int x = super; // expected-note{{use of undeclared identifier 'super'}}
+ int x = super; // expected-error{{use of undeclared identifier 'super'}}
return 0;
}
@end
diff --git a/test/Frontend/dependency-gen.c b/test/Frontend/dependency-gen.c
index bad84938296a..0f8adabc85aa 100644
--- a/test/Frontend/dependency-gen.c
+++ b/test/Frontend/dependency-gen.c
@@ -8,7 +8,8 @@
// RUN: grep 'dependency-gen.c' %t.d
// PR8974
-// XFAIL: win32
+// REQUIRES: shell
+// "cd %t.dir" requires shell.
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir/a/b
// RUN: echo > %t.dir/a/b/x.h
diff --git a/test/Frontend/dependency-generation-crash.c b/test/Frontend/dependency-generation-crash.c
new file mode 100644
index 000000000000..181bb71f1b09
--- /dev/null
+++ b/test/Frontend/dependency-generation-crash.c
@@ -0,0 +1,4 @@
+// RUN: touch %t
+// RUN: chmod 0 %t
+// %clang -E -dependency-file bla -MT %t -MP -o %t -x c /dev/null
+// rdar://9286457
diff --git a/test/Frontend/diagnostic-name.c b/test/Frontend/diagnostic-name.c
new file mode 100644
index 000000000000..7f43f65d718e
--- /dev/null
+++ b/test/Frontend/diagnostic-name.c
@@ -0,0 +1,5 @@
+// RUN: %clang -Wunused-parameter -fdiagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 1
+// RUN: %clang -Wunused-parameter -fno-diagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 0
+int main(int argc, char *argv[]) {
+ return argc;
+}
diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m
index 1aa26ac77c12..2e11191dca63 100644
--- a/test/Index/TestClassDecl.m
+++ b/test/Index/TestClassDecl.m
@@ -28,6 +28,6 @@ void function(Foo * arg)
// CHECK-scan: [14:1 - 16:2] UnexposedStmt=
// CHECK-load: TestClassDecl.m:10:12: ObjCInterfaceDecl=Foo:10:12 Extent=[10:1 - 11:5]
-// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:6 - 16:2]
+// CHECK-load: TestClassDecl.m:13:6: FunctionDecl=function:13:6 (Definition) Extent=[13:1 - 16:2]
// CHECK-load: TestClassDecl.m:13:21: ParmDecl=arg:13:21 (Definition) Extent=[13:15 - 13:24]
diff --git a/test/Index/annotate-context-sensitive.cpp b/test/Index/annotate-context-sensitive.cpp
new file mode 100644
index 000000000000..307bced59f9b
--- /dev/null
+++ b/test/Index/annotate-context-sensitive.cpp
@@ -0,0 +1,42 @@
+class Base {
+public:
+ virtual void f();
+};
+
+class Derived final : public Base {
+ virtual void f() override final;
+
+ struct final { };
+};
+
+typedef int override;
+struct Base2 {
+ virtual int override();
+};
+
+struct Derived2 : Base2 {
+ ::override override() override;
+};
+
+// RUN: c-index-test -test-annotate-tokens=%s:6:1:19:1 %s | FileCheck -check-prefix=CHECK-OVERRIDE-FINAL %s
+
+// CHECK-OVERRIDE-FINAL: Keyword: "class" [6:1 - 6:6] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Identifier: "Derived" [6:7 - 6:14] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Keyword: "final" [6:15 - 6:20] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Punctuation: ":" [6:21 - 6:22] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Keyword: "public" [6:23 - 6:29] C++ base class specifier=class Base:1:7 [access=public isVirtual=false]
+// CHECK-OVERRIDE-FINAL: Identifier: "Base" [6:30 - 6:34] TypeRef=class Base:1:7
+// CHECK-OVERRIDE-FINAL: Punctuation: "{" [6:35 - 6:36] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Keyword: "virtual" [7:3 - 7:10] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Keyword: "void" [7:11 - 7:15] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Identifier: "f" [7:16 - 7:17] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Punctuation: "(" [7:17 - 7:18] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Punctuation: ")" [7:18 - 7:19] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Keyword: "override" [7:20 - 7:28] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Keyword: "final" [7:29 - 7:34] CXXMethod=f:7:16 [Overrides @3:16]
+// CHECK-OVERRIDE-FINAL: Punctuation: ";" [7:34 - 7:35] ClassDecl=Derived:6:7 (Definition)
+// CHECK-OVERRIDE-FINAL: Keyword: "struct" [9:3 - 9:9] StructDecl=final:9:10 (Definition)
+// CHECK-OVERRIDE-FINAL: Identifier: "final" [9:10 - 9:15] StructDecl=final:9:10 (Definition)
+// CHECK-OVERRIDE-FINAL: Punctuation: "{" [9:16 - 9:17] StructDecl=final:9:10 (Definition)
+// CHECK-OVERRIDE-FINAL: Punctuation: "}" [9:18 - 9:19] StructDecl=final:9:10 (Definition)
+// CHECK-OVERRIDE-FINAL: Punctuation: ";" [9:19 - 9:20] ClassDecl=Derived:6:7 (Definition)
diff --git a/test/Index/annotate-nested-name-specifier.cpp b/test/Index/annotate-nested-name-specifier.cpp
index 70d84889e996..7c83740f0888 100644
--- a/test/Index/annotate-nested-name-specifier.cpp
+++ b/test/Index/annotate-nested-name-specifier.cpp
@@ -58,7 +58,86 @@ struct X3 {
}
};
-// RUN: c-index-test -test-annotate-tokens=%s:13:1:60:1 %s | FileCheck %s
+namespace outer {
+ namespace inner {
+ void f(int);
+ void f(double);
+ }
+}
+
+template<typename T>
+struct X4 {
+ typedef T type;
+ void g(int);
+ void g(float);
+
+ void h(T t) {
+ ::outer_alias::inner::f(t);
+ ::X4<type>::g(t);
+ this->::X4<type>::g(t);
+ }
+};
+
+typedef int Integer;
+template<>
+struct X4<Integer> {
+ typedef Integer type;
+
+ void g(int);
+ void g(float);
+
+ void h(type t) {
+ ::outer_alias::inner::f(t);
+ ::X4<type>::g(t);
+ this->::X4<type>::g(t);
+ }
+};
+
+
+template<typename T>
+struct X5 {
+ typedef T type;
+ typedef typename outer_alias::inner::vector<type>::iterator iter_type;
+ typedef typename outer_alias::inner::vector<int>::iterator int_ptr_type;
+};
+
+template<typename T>
+struct X6 {
+ typedef T* type;
+ typedef typename outer_alias::inner::vector<type>::template rebind<type> type1;
+ typedef typename outer_alias::inner::vector<type>::template rebind<type>::other type2;
+ typedef class outer_alias::inner::vector<type>::template rebind<type> type3;
+ typedef class outer_alias::inner::vector<type>::template rebind<type>::other type4;
+};
+
+namespace outer {
+ namespace inner {
+ template<typename T, template<class> class TT>
+ struct apply_meta {
+ typedef typename TT<T>::type type;
+ };
+ }
+}
+
+template<typename T, typename U>
+struct X7 {
+ typedef T T_type;
+ typedef U U_type;
+ typedef outer_alias::inner::apply_meta<T_type, U_type::template apply> type;
+};
+
+struct X8 {
+ void f();
+};
+
+struct X9 : X8 {
+ typedef X8 inherited;
+ void f() {
+ inherited::f();
+ }
+};
+
+// RUN: c-index-test -test-annotate-tokens=%s:13:1:137:1 %s | FileCheck %s
// CHECK: Keyword: "using" [14:1 - 14:6] UsingDeclaration=vector[4:12]
// CHECK: Identifier: "outer_alias" [14:7 - 14:18] NamespaceRef=outer_alias:10:11
@@ -67,7 +146,18 @@ struct X3 {
// CHECK: Punctuation: "::" [14:25 - 14:27] UsingDeclaration=vector[4:12]
// CHECK: Identifier: "vector" [14:27 - 14:33] OverloadedDeclRef=vector[4:12]
// CHECK: Punctuation: ";" [14:33 - 14:34]
-// FIXME: Base specifiers, too
+
+// Base specifiers
+// CHECK: Identifier: "outer_alias" [16:19 - 16:30] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [16:30 - 16:32] C++ base class specifier=outer_alias::inner::vector<X>:4:12 [access=public isVirtual=false]
+// CHECK: Identifier: "inner" [16:32 - 16:37] NamespaceRef=inner:2:13
+// CHECK: Punctuation: "::" [16:37 - 16:39] C++ base class specifier=outer_alias::inner::vector<X>:4:12 [access=public isVirtual=false]
+// CHECK: Identifier: "vector" [16:39 - 16:45] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [16:45 - 16:46] C++ base class specifier=outer_alias::inner::vector<X>:4:12 [access=public isVirtual=false]
+// CHECK: Identifier: "X" [16:46 - 16:47] TypeRef=struct X:12:8
+// CHECK: Punctuation: ">" [16:47 - 16:48] C++ base class specifier=outer_alias::inner::vector<X>:4:12 [access=public isVirtual=false]
+
+
// CHECK: Keyword: "using" [17:3 - 17:8] UsingDeclaration=iterator[5:18]
// CHECK: Identifier: "outer_alias" [17:9 - 17:20] NamespaceRef=outer_alias:10:11
// CHECK: Punctuation: "::" [17:20 - 17:22] UsingDeclaration=iterator[5:18]
@@ -80,7 +170,38 @@ struct X3 {
// CHECK: Punctuation: "::" [17:38 - 17:40] UsingDeclaration=iterator[5:18]
// CHECK: Identifier: "iterator" [17:40 - 17:48] OverloadedDeclRef=iterator[5:18]
-// FIXME: Check nested-name-specifiers on VarDecl, CXXMethodDecl.
+// CHECK: Keyword: "void" [31:1 - 31:5] CXXMethod=foo:31:33 (Definition)
+// CHECK: Identifier: "outer" [31:6 - 31:11] NamespaceRef=outer:20:11
+// CHECK: Punctuation: "::" [31:11 - 31:13] CXXMethod=foo:31:33 (Definition)
+// CHECK: Identifier: "inner" [31:13 - 31:18] NamespaceRef=inner:21:13
+// CHECK: Punctuation: "::" [31:18 - 31:20] CXXMethod=foo:31:33 (Definition)
+// CHECK: Identifier: "array" [31:20 - 31:25] TemplateRef=array:23:12
+// CHECK: Punctuation: "<" [31:25 - 31:26] CXXMethod=foo:31:33 (Definition)
+// CHECK: Identifier: "T" [31:26 - 31:27] TypeRef=T:30:19
+// CHECK: Punctuation: "," [31:27 - 31:28] CXXMethod=foo:31:33 (Definition)
+// CHECK: Identifier: "N" [31:29 - 31:30] DeclRefExpr=N:30:31
+// CHECK: Punctuation: ">" [31:30 - 31:31] CXXMethod=foo:31:33 (Definition)
+// CHECK: Punctuation: "::" [31:31 - 31:33] CXXMethod=foo:31:33 (Definition)
+// CHECK: Identifier: "foo" [31:33 - 31:36] CXXMethod=foo:31:33 (Definition)
+// CHECK: Punctuation: "(" [31:36 - 31:37] CXXMethod=foo:31:33 (Definition)
+// CHECK: Punctuation: ")" [31:37 - 31:38] CXXMethod=foo:31:33 (Definition)
+
+// CHECK: Keyword: "int" [35:1 - 35:4] VarDecl=max_size:35:32 (Definition)
+// CHECK: Identifier: "outer" [35:5 - 35:10] NamespaceRef=outer:20:11
+// CHECK: Punctuation: "::" [35:10 - 35:12] VarDecl=max_size:35:32 (Definition)
+// CHECK: Identifier: "inner" [35:12 - 35:17] NamespaceRef=inner:21:13
+// CHECK: Punctuation: "::" [35:17 - 35:19] VarDecl=max_size:35:32 (Definition)
+// CHECK: Identifier: "array" [35:19 - 35:24] TemplateRef=array:23:12
+// CHECK: Punctuation: "<" [35:24 - 35:25] VarDecl=max_size:35:32 (Definition)
+// CHECK: Identifier: "T" [35:25 - 35:26] TypeRef=T:34:19
+// CHECK: Punctuation: "," [35:26 - 35:27] VarDecl=max_size:35:32 (Definition)
+// CHECK: Identifier: "N" [35:28 - 35:29] DeclRefExpr=N:34:31
+// CHECK: Punctuation: ">" [35:29 - 35:30] VarDecl=max_size:35:32 (Definition)
+// CHECK: Punctuation: "::" [35:30 - 35:32] VarDecl=max_size:35:32 (Definition)
+// CHECK: Identifier: "max_size" [35:32 - 35:40] VarDecl=max_size:35:32 (Definition)
+// CHECK: Punctuation: "=" [35:41 - 35:42] VarDecl=max_size:35:32 (Definition)
+// CHECK: Literal: "17" [35:43 - 35:45] UnexposedExpr=
+// CHECK: Punctuation: ";" [35:45 - 35:46]
// CHECK: Keyword: "using" [40:3 - 40:8] UsingDeclaration=iterator:40:46
// CHECK: Keyword: "typename" [40:9 - 40:17] UsingDeclaration=iterator:40:46
@@ -138,13 +259,208 @@ struct X3 {
// CHECK: Keyword: "template" [57:30 - 57:38] UnexposedExpr=
// CHECK: Identifier: "vector" [57:39 - 57:45] TemplateRef=vector:4:12
// CHECK: Punctuation: "<" [57:45 - 57:46] UnexposedExpr=
-// CHECK: Identifier: "T" [57:46 - 57:47] UnexposedExpr=
+// CHECK: Identifier: "T" [57:46 - 57:47] TypeRef=T:54:19
// CHECK: Punctuation: ">" [57:47 - 57:48] UnexposedExpr=
// CHECK: Punctuation: "::" [57:48 - 57:50] UnexposedExpr=
// CHECK: Punctuation: "~" [57:50 - 57:51] UnexposedExpr=
// CHECK: Identifier: "vector" [57:51 - 57:57] TemplateRef=vector:4:12
// CHECK: Punctuation: "<" [57:57 - 57:58] UnexposedExpr=
-// CHECK: Identifier: "T" [57:58 - 57:59] UnexposedExpr=
-// CHECK: Punctuation: ">" [57:59 - 57:60] UnexposedExpr=
+// CHECK: Identifier: "T" [57:58 - 57:59] TypeRef=T:54:19
+// CHECK: Punctuation: ">" [57:59 - 57:60] CallExpr=
// CHECK: Punctuation: "(" [57:60 - 57:61] CallExpr=
// CHECK: Punctuation: ")" [57:61 - 57:62] CallExpr=
+
+// Unresolved member and non-member references
+// CHECK: Punctuation: "::" [75:5 - 75:7] UnexposedExpr=[63:10, 64:10]
+// CHECK: Identifier: "outer_alias" [75:7 - 75:18] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [75:18 - 75:20] UnexposedExpr=[63:10, 64:10]
+// CHECK: Identifier: "inner" [75:20 - 75:25] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [75:25 - 75:27] UnexposedExpr=[63:10, 64:10]
+// CHECK: Identifier: "f" [75:27 - 75:28] OverloadedDeclRef=f[63:10, 64:10]
+// CHECK: Punctuation: "(" [75:28 - 75:29] CallExpr=
+// CHECK: Identifier: "t" [75:29 - 75:30] DeclRefExpr=t:74:12
+// CHECK: Punctuation: ")" [75:30 - 75:31] CallExpr=
+// CHECK: Punctuation: "::" [76:5 - 76:7] UnexposedExpr=[71:8, 72:8]
+// CHECK: Identifier: "X4" [76:7 - 76:9] TemplateRef=X4:69:8
+// CHECK: Punctuation: "<" [76:9 - 76:10] UnexposedExpr=[71:8, 72:8]
+// CHECK: Identifier: "type" [76:10 - 76:14] TypeRef=type:70:13
+// CHECK: Punctuation: ">" [76:14 - 76:15] UnexposedExpr=[71:8, 72:8]
+// CHECK: Punctuation: "::" [76:15 - 76:17] UnexposedExpr=[71:8, 72:8]
+// CHECK: Identifier: "g" [76:17 - 76:18] OverloadedDeclRef=g[71:8, 72:8]
+// CHECK: Punctuation: "(" [76:18 - 76:19] CallExpr=
+// CHECK: Identifier: "t" [76:19 - 76:20] DeclRefExpr=t:74:12
+// CHECK: Punctuation: ")" [76:20 - 76:21] CallExpr=
+// CHECK: Punctuation: ";" [76:21 - 76:22] UnexposedStmt=
+// CHECK: Keyword: "this" [77:5 - 77:9] UnexposedExpr=
+// CHECK: Punctuation: "->" [77:9 - 77:11] UnexposedExpr=
+// CHECK: Punctuation: "::" [77:11 - 77:13] UnexposedExpr=
+// CHECK: Identifier: "X4" [77:13 - 77:15] TemplateRef=X4:69:8
+// CHECK: Punctuation: "<" [77:15 - 77:16] UnexposedExpr=
+// CHECK: Identifier: "type" [77:16 - 77:20] TypeRef=type:70:13
+// CHECK: Punctuation: ">" [77:20 - 77:21] UnexposedExpr=
+// CHECK: Punctuation: "::" [77:21 - 77:23] UnexposedExpr=
+// CHECK: Identifier: "g" [77:23 - 77:24] UnexposedExpr=
+// CHECK: Punctuation: "(" [77:24 - 77:25] CallExpr=
+// CHECK: Identifier: "t" [77:25 - 77:26] DeclRefExpr=t:74:12
+// CHECK: Punctuation: ")" [77:26 - 77:27] CallExpr=
+
+// Resolved member and non-member references
+// CHECK: Punctuation: "::" [90:5 - 90:7] DeclRefExpr=f:63:10
+// CHECK: Identifier: "outer_alias" [90:7 - 90:18] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [90:18 - 90:20] DeclRefExpr=f:63:10
+// CHECK: Identifier: "inner" [90:20 - 90:25] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [90:25 - 90:27] DeclRefExpr=f:63:10
+// CHECK: Identifier: "f" [90:27 - 90:28] DeclRefExpr=f:63:10
+// CHECK: Punctuation: "(" [90:28 - 90:29] CallExpr=f:63:10
+// CHECK: Identifier: "t" [90:29 - 90:30] DeclRefExpr=t:89:15
+// CHECK: Punctuation: ")" [90:30 - 90:31] CallExpr=f:63:10
+// CHECK: Punctuation: ";" [90:31 - 90:32] UnexposedStmt=
+// CHECK: Punctuation: "::" [91:5 - 91:7] MemberRefExpr=g:86:8
+// CHECK: Identifier: "X4" [91:7 - 91:9] TemplateRef=X4:69:8
+// CHECK: Punctuation: "<" [91:9 - 91:10] MemberRefExpr=g:86:8
+// CHECK: Identifier: "type" [91:10 - 91:14] TypeRef=type:84:19
+// CHECK: Punctuation: ">" [91:14 - 91:15] MemberRefExpr=g:86:8
+// CHECK: Punctuation: "::" [91:15 - 91:17] MemberRefExpr=g:86:8
+// CHECK: Identifier: "g" [91:17 - 91:18] MemberRefExpr=g:86:8
+// CHECK: Punctuation: "(" [91:18 - 91:19] CallExpr=g:86:8
+// CHECK: Identifier: "t" [91:19 - 91:20] DeclRefExpr=t:89:15
+// CHECK: Punctuation: ")" [91:20 - 91:21] CallExpr=g:86:8
+// CHECK: Punctuation: ";" [91:21 - 91:22] UnexposedStmt=
+// CHECK: Keyword: "this" [92:5 - 92:9] UnexposedExpr=
+// CHECK: Punctuation: "->" [92:9 - 92:11] MemberRefExpr=g:86:8
+// CHECK: Punctuation: "::" [92:11 - 92:13] MemberRefExpr=g:86:8
+// CHECK: Identifier: "X4" [92:13 - 92:15] TemplateRef=X4:69:8
+// CHECK: Punctuation: "<" [92:15 - 92:16] MemberRefExpr=g:86:8
+// CHECK: Identifier: "type" [92:16 - 92:20] TypeRef=type:84:19
+// CHECK: Punctuation: ">" [92:20 - 92:21] MemberRefExpr=g:86:8
+// CHECK: Punctuation: "::" [92:21 - 92:23] MemberRefExpr=g:86:8
+// CHECK: Identifier: "g" [92:23 - 92:24] MemberRefExpr=g:86:8
+// CHECK: Punctuation: "(" [92:24 - 92:25] CallExpr=g:86:8
+// CHECK: Identifier: "t" [92:25 - 92:26] DeclRefExpr=t:89:15
+// CHECK: Punctuation: ")" [92:26 - 92:27] CallExpr=g:86:8
+
+// Dependent name type
+// CHECK: Keyword: "typedef" [100:3 - 100:10] ClassTemplate=X5:98:8 (Definition)
+// CHECK: Keyword: "typename" [100:11 - 100:19] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Identifier: "outer_alias" [100:20 - 100:31] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [100:31 - 100:33] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Identifier: "inner" [100:33 - 100:38] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [100:38 - 100:40] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Identifier: "vector" [100:40 - 100:46] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [100:46 - 100:47] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Identifier: "type" [100:47 - 100:51] TypeRef=type:99:13
+// CHECK: Punctuation: ">" [100:51 - 100:52] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Punctuation: "::" [100:52 - 100:54] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Identifier: "iterator" [100:54 - 100:62] TypedefDecl=iter_type:100:63 (Definition)
+// CHECK: Identifier: "iter_type" [100:63 - 100:72] TypedefDecl=iter_type:100:63 (Definition)
+
+// CHECK: Keyword: "typedef" [101:3 - 101:10] ClassTemplate=X5:98:8 (Definition)
+// CHECK: Keyword: "typename" [101:11 - 101:19] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Identifier: "outer_alias" [101:20 - 101:31] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [101:31 - 101:33] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Identifier: "inner" [101:33 - 101:38] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [101:38 - 101:40] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Identifier: "vector" [101:40 - 101:46] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [101:46 - 101:47] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Keyword: "int" [101:47 - 101:50] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Punctuation: ">" [101:50 - 101:51] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Punctuation: "::" [101:51 - 101:53] TypedefDecl=int_ptr_type:101:62 (Definition)
+// CHECK: Identifier: "iterator" [101:53 - 101:61] TypeRef=iterator:5:18
+// CHECK: Identifier: "int_ptr_type" [101:62 - 101:74] TypedefDecl=int_ptr_type:101:62 (Definition)
+
+// Dependent template specialization types
+// CHECK: Keyword: "typename" [107:11 - 107:19] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "outer_alias" [107:20 - 107:31] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [107:31 - 107:33] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "inner" [107:33 - 107:38] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [107:38 - 107:40] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "vector" [107:40 - 107:46] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [107:46 - 107:47] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "type" [107:47 - 107:51] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [107:51 - 107:52] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Punctuation: "::" [107:52 - 107:54] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Keyword: "template" [107:54 - 107:62] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "rebind" [107:63 - 107:69] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Punctuation: "<" [107:69 - 107:70] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "type" [107:70 - 107:74] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [107:74 - 107:75] TypedefDecl=type1:107:76 (Definition)
+// CHECK: Identifier: "type1" [107:76 - 107:81] TypedefDecl=type1:107:76 (Definition)
+
+// CHECK: Keyword: "typedef" [108:3 - 108:10] ClassTemplate=X6:105:8 (Definition)
+// CHECK: Keyword: "typename" [108:11 - 108:19] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "outer_alias" [108:20 - 108:31] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [108:31 - 108:33] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "inner" [108:33 - 108:38] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [108:38 - 108:40] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "vector" [108:40 - 108:46] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [108:46 - 108:47] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "type" [108:47 - 108:51] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [108:51 - 108:52] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Punctuation: "::" [108:52 - 108:54] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Keyword: "template" [108:54 - 108:62] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "rebind" [108:63 - 108:69] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Punctuation: "<" [108:69 - 108:70] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "type" [108:70 - 108:74] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [108:74 - 108:75] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Punctuation: "::" [108:75 - 108:77] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "other" [108:77 - 108:82] TypedefDecl=type2:108:83 (Definition)
+// CHECK: Identifier: "type2" [108:83 - 108:88] TypedefDecl=type2:108:83 (Definition)
+
+// CHECK: Keyword: "typedef" [109:3 - 109:10] ClassTemplate=X6:105:8 (Definition)
+// CHECK: Keyword: "class" [109:11 - 109:16] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "outer_alias" [109:17 - 109:28] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [109:28 - 109:30] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "inner" [109:30 - 109:35] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [109:35 - 109:37] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "vector" [109:37 - 109:43] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [109:43 - 109:44] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "type" [109:44 - 109:48] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [109:48 - 109:49] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Punctuation: "::" [109:49 - 109:51] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Keyword: "template" [109:51 - 109:59] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "rebind" [109:60 - 109:66] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Punctuation: "<" [109:66 - 109:67] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "type" [109:67 - 109:71] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [109:71 - 109:72] TypedefDecl=type3:109:73 (Definition)
+// CHECK: Identifier: "type3" [109:73 - 109:78] TypedefDecl=type3:109:73 (Definition)
+
+// CHECK: Keyword: "class" [110:11 - 110:16] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "outer_alias" [110:17 - 110:28] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [110:28 - 110:30] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "inner" [110:30 - 110:35] NamespaceRef=inner:62:13
+// CHECK: Punctuation: "::" [110:35 - 110:37] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "vector" [110:37 - 110:43] TemplateRef=vector:4:12
+// CHECK: Punctuation: "<" [110:43 - 110:44] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "type" [110:44 - 110:48] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [110:48 - 110:49] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Punctuation: "::" [110:49 - 110:51] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Keyword: "template" [110:51 - 110:59] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "rebind" [110:60 - 110:66] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Punctuation: "<" [110:66 - 110:67] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "type" [110:67 - 110:71] TypeRef=type:106:14
+// CHECK: Punctuation: ">" [110:71 - 110:72] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Punctuation: "::" [110:72 - 110:74] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "other" [110:74 - 110:79] TypedefDecl=type4:110:80 (Definition)
+// CHECK: Identifier: "type4" [110:80 - 110:85] TypedefDecl=type4:110:80 (Definition)
+
+// Template template arguments
+// CHECK: Keyword: "typedef" [126:3 - 126:10] ClassTemplate=X7:123:8 (Definition)
+// CHECK: Identifier: "outer_alias" [126:11 - 126:22] NamespaceRef=outer_alias:10:11
+// CHECK: Punctuation: "::" [126:22 - 126:24] TypedefDecl=type:126:74 (Definition)
+// CHECK: Identifier: "inner" [126:24 - 126:29] NamespaceRef=inner:114:13
+// CHECK: Punctuation: "::" [126:29 - 126:31] TypedefDecl=type:126:74 (Definition)
+// CHECK: Identifier: "apply_meta" [126:31 - 126:41] TemplateRef=apply_meta:116:12
+// CHECK: Punctuation: "<" [126:41 - 126:42] TypedefDecl=type:126:74 (Definition)
+// CHECK: Identifier: "T_type" [126:42 - 126:48] TypeRef=T_type:124:13
+// CHECK: Punctuation: "," [126:48 - 126:49] TypedefDecl=type:126:74 (Definition)
+// CHECK: Identifier: "U_type" [126:50 - 126:56] TypeRef=U_type:125:13
+// CHECK: Punctuation: "::" [126:56 - 126:58] TypedefDecl=type:126:74 (Definition)
+// CHECK: Keyword: "template" [126:58 - 126:66] TypedefDecl=type:126:74 (Definition)
+// CHECK: Identifier: "apply" [126:67 - 126:72] TypedefDecl=type:126:74 (Definition)
+// CHECK: Punctuation: ">" [126:72 - 126:73] TypedefDecl=type:126:74 (Definition)
+// CHECK: Identifier: "type" [126:74 - 126:78] TypedefDecl=type:126:74 (Definition)
+
+// Member access expressions
+// CHECK: Identifier: "inherited" [136:5 - 136:14] TypeRef=inherited:134:14
+// CHECK: Punctuation: "::" [136:14 - 136:16] MemberRefExpr=f:130:8
+// CHECK: Identifier: "f" [136:16 - 136:17] MemberRefExpr=f:130:8
diff --git a/test/Index/annotate-tokens.c b/test/Index/annotate-tokens.c
index d692bd3bbac6..162a224ed684 100644
--- a/test/Index/annotate-tokens.c
+++ b/test/Index/annotate-tokens.c
@@ -8,9 +8,9 @@ void f(void *ptr) {
void *xx = ptr ? : &x;
const char * hello = "Hello";
}
-
+enum Color { Red, Green, Blue };
typedef int Int;
-void g(int i, ...) {
+enum Color g(int i, ...) {
__builtin_va_list va;
(void)__builtin_va_arg(va, Int);
(void)__builtin_types_compatible_p(Int, Int);
@@ -19,9 +19,21 @@ void g(int i, ...) {
do {
x.a++;
} while (x.a < 10);
+
+ enum Color c;
+ switch (c) {
+ case Red:
+ return Green;
+
+ case Green:
+ return Blue;
+
+ case Blue:
+ return Red;
+ }
}
-// RUN: c-index-test -test-annotate-tokens=%s:4:1:22:1 %s | FileCheck %s
+// RUN: c-index-test -test-annotate-tokens=%s:4:1:34:1 %s | FileCheck %s
// CHECK: Identifier: "T" [4:3 - 4:4] TypeRef=T:1:13
// CHECK: Punctuation: "*" [4:4 - 4:5] VarDecl=t_ptr:4:6 (Definition)
// CHECK: Identifier: "t_ptr" [4:6 - 4:11] VarDecl=t_ptr:4:6 (Definition)
@@ -41,7 +53,7 @@ void g(int i, ...) {
// CHECK: Punctuation: ")" [5:17 - 5:18] UnexposedExpr=
// CHECK: Punctuation: ";" [5:18 - 5:19] UnexposedStmt=
// CHECK: Comment: "/* A comment */" [6:3 - 6:18] UnexposedStmt=
-// CHECK: Keyword: "struct" [7:3 - 7:9] UnexposedStmt=
+// CHECK: Keyword: "struct" [7:3 - 7:9] VarDecl=x:7:12 (Definition)
// CHECK: Identifier: "X" [7:10 - 7:11] TypeRef=struct X:2:8
// CHECK: Identifier: "x" [7:12 - 7:13] VarDecl=x:7:12 (Definition)
// CHECK: Punctuation: "=" [7:14 - 7:15] VarDecl=x:7:12 (Definition)
@@ -79,7 +91,7 @@ void g(int i, ...) {
// CHECK: Identifier: "Int" [16:38 - 16:41] TypeRef=Int:12:13
// CHECK: Punctuation: "," [16:41 - 16:42] UnexposedExpr=
// CHECK: Identifier: "Int" [16:43 - 16:46] TypeRef=Int:12:13
-// CHECK: Keyword: "struct" [18:3 - 18:9] UnexposedStmt=
+// CHECK: Keyword: "struct" [18:3 - 18:9] VarDecl=x:18:12 (Definition)
// CHECK: Identifier: "X" [18:10 - 18:11] TypeRef=struct X:2:8
// CHECK: Identifier: "x" [18:12 - 18:13] VarDecl=x:18:12 (Definition)
// CHECK: Keyword: "do" [19:3 - 19:5] UnexposedStmt=
@@ -95,5 +107,33 @@ void g(int i, ...) {
// CHECK: Punctuation: "." [21:13 - 21:14] MemberRefExpr=a:2:16
// CHECK: Identifier: "a" [21:14 - 21:15] MemberRefExpr=a:2:16
+// CHECK: Keyword: "enum" [23:3 - 23:7] VarDecl=c:23:14 (Definition)
+// CHECK: Identifier: "Color" [23:8 - 23:13] TypeRef=enum Color:11:6
+// CHECK: Identifier: "c" [23:14 - 23:15] VarDecl=c:23:14 (Definition)
+// CHECK: Punctuation: ";" [23:15 - 23:16] UnexposedStmt=
+// CHECK: Keyword: "switch" [24:3 - 24:9] UnexposedStmt=
+// CHECK: Punctuation: "(" [24:10 - 24:11] UnexposedStmt=
+// CHECK: Identifier: "c" [24:11 - 24:12] DeclRefExpr=c:23:14
+// CHECK: Punctuation: ")" [24:12 - 24:13] UnexposedStmt=
+// CHECK: Punctuation: "{" [24:14 - 24:15] UnexposedStmt=
+// CHECK: Keyword: "case" [25:3 - 25:7] UnexposedStmt=
+// CHECK: Identifier: "Red" [25:8 - 25:11] DeclRefExpr=Red:11:14
+// CHECK: Punctuation: ":" [25:11 - 25:12] UnexposedStmt=
+// CHECK: Keyword: "return" [26:5 - 26:11] UnexposedStmt=
+// CHECK: Identifier: "Green" [26:12 - 26:17] DeclRefExpr=Green:11:19
+// CHECK: Punctuation: ";" [26:17 - 26:18] UnexposedStmt=
+// CHECK: Keyword: "case" [28:3 - 28:7] UnexposedStmt=
+// CHECK: Identifier: "Green" [28:8 - 28:13] DeclRefExpr=Green:11:19
+// CHECK: Punctuation: ":" [28:13 - 28:14] UnexposedStmt=
+// CHECK: Keyword: "return" [29:5 - 29:11] UnexposedStmt=
+// CHECK: Identifier: "Blue" [29:12 - 29:16] DeclRefExpr=Blue:11:26
+// CHECK: Punctuation: ";" [29:16 - 29:17] UnexposedStmt=
+// CHECK: Keyword: "case" [31:3 - 31:7] UnexposedStmt=
+// CHECK: Identifier: "Blue" [31:8 - 31:12] DeclRefExpr=Blue:11:26
+// CHECK: Punctuation: ":" [31:12 - 31:13] UnexposedStmt=
+// CHECK: Keyword: "return" [32:5 - 32:11] UnexposedStmt=
+// CHECK: Identifier: "Red" [32:12 - 32:15] DeclRefExpr=Red:11:14
+// CHECK: Punctuation: ";" [32:15 - 32:16] UnexposedStmt=
+
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:32 %s | FileCheck %s
// RUN: c-index-test -test-annotate-tokens=%s:4:1:165:38 %s | FileCheck %s
diff --git a/test/Index/annotate-tokens.cpp b/test/Index/annotate-tokens.cpp
index 3138babf0aaf..ccc9e9602843 100644
--- a/test/Index/annotate-tokens.cpp
+++ b/test/Index/annotate-tokens.cpp
@@ -4,7 +4,22 @@ void test(bonk X) {
__is_base_of(bonk, bonk);
}
-// RUN: c-index-test -test-annotate-tokens=%s:1:1:6:5 %s | FileCheck %s
+struct X {
+ X operator++();
+ X operator++(int);
+};
+void test2(X x) {
+ ++(x);
+ (x)++;
+}
+
+struct S1 { void f(); };
+struct S2 { S1 *operator->(); };
+void test3(S2 s2) {
+ s2->f();
+}
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:20:1 %s | FileCheck %s
// CHECK: Keyword: "struct" [1:1 - 1:7] StructDecl=bonk:1:8 (Definition)
// CHECK: Identifier: "bonk" [1:8 - 1:12] StructDecl=bonk:1:8 (Definition)
// CHECK: Punctuation: "{" [1:13 - 1:14] StructDecl=bonk:1:8 (Definition)
@@ -29,3 +44,75 @@ void test(bonk X) {
// CHECK: Punctuation: ")" [4:28 - 4:29] UnexposedExpr=
// CHECK: Punctuation: ";" [4:29 - 4:30] UnexposedStmt=
// CHECK: Punctuation: "}" [5:1 - 5:2] UnexposedStmt=
+// CHECK: Keyword: "struct" [7:1 - 7:7] StructDecl=X:7:8 (Definition)
+// CHECK: Identifier: "X" [7:8 - 7:9] StructDecl=X:7:8 (Definition)
+// CHECK: Punctuation: "{" [7:10 - 7:11] StructDecl=X:7:8 (Definition)
+// CHECK: Identifier: "X" [8:3 - 8:4] TypeRef=struct X:7:8
+// CHECK: Keyword: "operator" [8:5 - 8:13] CXXMethod=operator++:8:5
+// CHECK: Punctuation: "++" [8:13 - 8:15] CXXMethod=operator++:8:5
+// CHECK: Punctuation: "(" [8:15 - 8:16] CXXMethod=operator++:8:5
+// CHECK: Punctuation: ")" [8:16 - 8:17] CXXMethod=operator++:8:5
+// CHECK: Punctuation: ";" [8:17 - 8:18] StructDecl=X:7:8 (Definition)
+// CHECK: Identifier: "X" [9:3 - 9:4] TypeRef=struct X:7:8
+// CHECK: Keyword: "operator" [9:5 - 9:13] CXXMethod=operator++:9:5
+// CHECK: Punctuation: "++" [9:13 - 9:15] CXXMethod=operator++:9:5
+// CHECK: Punctuation: "(" [9:15 - 9:16] CXXMethod=operator++:9:5
+// CHECK: Keyword: "int" [9:16 - 9:19] ParmDecl=:9:19 (Definition)
+// CHECK: Punctuation: ")" [9:19 - 9:20] ParmDecl=:9:19 (Definition)
+// CHECK: Punctuation: ";" [9:20 - 9:21] StructDecl=X:7:8 (Definition)
+// CHECK: Punctuation: "}" [10:1 - 10:2] StructDecl=X:7:8 (Definition)
+// CHECK: Punctuation: ";" [10:2 - 10:3]
+// CHECK: Keyword: "void" [11:1 - 11:5] FunctionDecl=test2:11:6 (Definition)
+// CHECK: Identifier: "test2" [11:6 - 11:11] FunctionDecl=test2:11:6 (Definition)
+// CHECK: Punctuation: "(" [11:11 - 11:12] FunctionDecl=test2:11:6 (Definition)
+// CHECK: Identifier: "X" [11:12 - 11:13] TypeRef=struct X:7:8
+// CHECK: Identifier: "x" [11:14 - 11:15] ParmDecl=x:11:14 (Definition)
+// CHECK: Punctuation: ")" [11:15 - 11:16] FunctionDecl=test2:11:6 (Definition)
+// CHECK: Punctuation: "{" [11:17 - 11:18] UnexposedStmt=
+// CHECK: Punctuation: "++" [12:3 - 12:5] CallExpr=operator++:8:5
+// CHECK: Punctuation: "(" [12:5 - 12:6] UnexposedExpr=
+// CHECK: Identifier: "x" [12:6 - 12:7] DeclRefExpr=x:11:14
+// CHECK: Punctuation: ")" [12:7 - 12:8] UnexposedExpr=
+// CHECK: Punctuation: ";" [12:8 - 12:9] UnexposedStmt=
+// CHECK: Punctuation: "(" [13:3 - 13:4] UnexposedExpr=
+// CHECK: Identifier: "x" [13:4 - 13:5] DeclRefExpr=x:11:14
+// CHECK: Punctuation: ")" [13:5 - 13:6] UnexposedExpr=
+// CHECK: Punctuation: "++" [13:6 - 13:8] CallExpr=operator++:9:5
+// CHECK: Punctuation: ";" [13:8 - 13:9] UnexposedStmt=
+// CHECK: Punctuation: "}" [14:1 - 14:2] UnexposedStmt=
+// CHECK: Keyword: "struct" [16:1 - 16:7] StructDecl=S1:16:8 (Definition)
+// CHECK: Identifier: "S1" [16:8 - 16:10] StructDecl=S1:16:8 (Definition)
+// CHECK: Punctuation: "{" [16:11 - 16:12] StructDecl=S1:16:8 (Definition)
+// CHECK: Keyword: "void" [16:13 - 16:17] CXXMethod=f:16:18
+// CHECK: Identifier: "f" [16:18 - 16:19] CXXMethod=f:16:18
+// CHECK: Punctuation: "(" [16:19 - 16:20] CXXMethod=f:16:18
+// CHECK: Punctuation: ")" [16:20 - 16:21] CXXMethod=f:16:18
+// CHECK: Punctuation: ";" [16:21 - 16:22] StructDecl=S1:16:8 (Definition)
+// CHECK: Punctuation: "}" [16:23 - 16:24] StructDecl=S1:16:8 (Definition)
+// CHECK: Punctuation: ";" [16:24 - 16:25]
+// CHECK: Keyword: "struct" [17:1 - 17:7] StructDecl=S2:17:8 (Definition)
+// CHECK: Identifier: "S2" [17:8 - 17:10] StructDecl=S2:17:8 (Definition)
+// CHECK: Punctuation: "{" [17:11 - 17:12] StructDecl=S2:17:8 (Definition)
+// CHECK: Identifier: "S1" [17:13 - 17:15] TypeRef=struct S1:16:8
+// CHECK: Punctuation: "*" [17:16 - 17:17] CXXMethod=operator->:17:17
+// CHECK: Keyword: "operator" [17:17 - 17:25] CXXMethod=operator->:17:17
+// CHECK: Punctuation: "->" [17:25 - 17:27] CXXMethod=operator->:17:17
+// CHECK: Punctuation: "(" [17:27 - 17:28] CXXMethod=operator->:17:17
+// CHECK: Punctuation: ")" [17:28 - 17:29] CXXMethod=operator->:17:17
+// CHECK: Punctuation: ";" [17:29 - 17:30] StructDecl=S2:17:8 (Definition)
+// CHECK: Punctuation: "}" [17:31 - 17:32] StructDecl=S2:17:8 (Definition)
+// CHECK: Punctuation: ";" [17:32 - 17:33]
+// CHECK: Keyword: "void" [18:1 - 18:5] FunctionDecl=test3:18:6 (Definition)
+// CHECK: Identifier: "test3" [18:6 - 18:11] FunctionDecl=test3:18:6 (Definition)
+// CHECK: Punctuation: "(" [18:11 - 18:12] FunctionDecl=test3:18:6 (Definition)
+// CHECK: Identifier: "S2" [18:12 - 18:14] TypeRef=struct S2:17:8
+// CHECK: Identifier: "s2" [18:15 - 18:17] ParmDecl=s2:18:15 (Definition)
+// CHECK: Punctuation: ")" [18:17 - 18:18] FunctionDecl=test3:18:6 (Definition)
+// CHECK: Punctuation: "{" [18:19 - 18:20] UnexposedStmt=
+// CHECK: Identifier: "s2" [19:3 - 19:5] DeclRefExpr=s2:18:15
+// CHECK: Punctuation: "->" [19:5 - 19:7] MemberRefExpr=f:16:18
+// CHECK: Identifier: "f" [19:7 - 19:8] MemberRefExpr=f:16:18
+// CHECK: Punctuation: "(" [19:8 - 19:9] CallExpr=f:16:18
+// CHECK: Punctuation: ")" [19:9 - 19:10] CallExpr=f:16:18
+// CHECK: Punctuation: ";" [19:10 - 19:11] UnexposedStmt=
+// CHECK: Punctuation: "}" [20:1 - 20:2] UnexposedStmt=
diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m
index f4d47ac4ae55..f977e5c3dfe8 100644
--- a/test/Index/annotate-tokens.m
+++ b/test/Index/annotate-tokens.m
@@ -30,12 +30,12 @@ typedef int * barType;
// Since there are no source ranges for attributes, we currently don't
// annotate them.
@interface IBActionTests
-- (IBAction) actionMethod:(id)arg;
+- (IBAction) actionMethod:(in id)arg;
- (void)foo:(int)x;
@end
extern int ibaction_test(void);
@implementation IBActionTests
-- (IBAction) actionMethod:(id)arg
+- (IBAction) actionMethod:(in id)arg
{
ibaction_test();
[self foo:0];
@@ -231,10 +231,11 @@ static Rdar8595462_A * Rdar8595462_staticVar;
// CHECK: Identifier: "actionMethod" [33:14 - 33:26] ObjCInstanceMethodDecl=actionMethod::33:1
// CHECK: Punctuation: ":" [33:26 - 33:27] ObjCInstanceMethodDecl=actionMethod::33:1
// CHECK: Punctuation: "(" [33:27 - 33:28] ObjCInstanceMethodDecl=actionMethod::33:1
-// CHECK: Identifier: "id" [33:28 - 33:30] TypeRef=id:0:0
-// CHECK: Punctuation: ")" [33:30 - 33:31] ParmDecl=arg:33:31 (Definition)
-// CHECK: Identifier: "arg" [33:31 - 33:34] ParmDecl=arg:33:31 (Definition)
-// CHECK: Punctuation: ";" [33:34 - 33:35] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Keyword: "in" [33:28 - 33:30] ObjCInstanceMethodDecl=actionMethod::33:1
+// CHECK: Identifier: "id" [33:31 - 33:33] TypeRef=id:0:0
+// CHECK: Punctuation: ")" [33:33 - 33:34] ParmDecl=arg:33:34 (Definition)
+// CHECK: Identifier: "arg" [33:34 - 33:37] ParmDecl=arg:33:34 (Definition)
+// CHECK: Punctuation: ";" [33:37 - 33:38] ObjCInstanceMethodDecl=actionMethod::33:1
// CHECK: Punctuation: "-" [34:1 - 34:2] ObjCInstanceMethodDecl=foo::34:1
// CHECK: Punctuation: "(" [34:3 - 34:4] ObjCInstanceMethodDecl=foo::34:1
// CHECK: Keyword: "void" [34:4 - 34:8] ObjCInstanceMethodDecl=foo::34:1
@@ -264,10 +265,10 @@ static Rdar8595462_A * Rdar8595462_staticVar;
// CHECK: Punctuation: ")" [38:12 - 38:13] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
// CHECK: Identifier: "actionMethod" [38:14 - 38:26] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
// CHECK: Punctuation: ":" [38:26 - 38:27] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
-// CHECK: Punctuation: "(" [38:27 - 38:28] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition)
-// CHECK: Identifier: "id" [38:28 - 38:30] TypeRef=id:0:0
-// CHECK: Punctuation: ")" [38:30 - 38:31] ParmDecl=arg:38:31 (Definition)
-// CHECK: Identifier: "arg" [38:31 - 38:34] ParmDecl=arg:38:31 (Definition)
+// CHECK: Keyword: "in" [38:28 - 38:30] ObjCInstanceMethodDecl=actionMethod::38:1 (Definition) [Overrides @33:1]
+// CHECK: Identifier: "id" [38:31 - 38:33] TypeRef=id:0:0
+// CHECK: Punctuation: ")" [38:33 - 38:34] ParmDecl=arg:38:34 (Definition)
+// CHECK: Identifier: "arg" [38:34 - 38:37] ParmDecl=arg:38:34 (Definition)
// CHECK: Punctuation: "{" [39:1 - 39:2] UnexposedStmt=
// CHECK: Identifier: "ibaction_test" [40:5 - 40:18] DeclRefExpr=ibaction_test:36:12
// CHECK: Punctuation: "(" [40:18 - 40:19] CallExpr=ibaction_test:36:12
@@ -484,16 +485,16 @@ static Rdar8595462_A * Rdar8595462_staticVar;
// CHECK: Punctuation: "@" [110:1 - 110:2] ObjCPropertyDecl=foo:110:33
// CHECK: Keyword: "property" [110:2 - 110:10] ObjCPropertyDecl=foo:110:33
// CHECK: Punctuation: "(" [110:11 - 110:12] ObjCPropertyDecl=foo:110:33
-// CHECK: Identifier: "readonly" [110:12 - 110:20] ObjCPropertyDecl=foo:110:33
+// CHECK: Keyword: "readonly" [110:12 - 110:20] ObjCPropertyDecl=foo:110:33
// CHECK: Punctuation: "," [110:20 - 110:21] ObjCPropertyDecl=foo:110:33
-// CHECK: Identifier: "copy" [110:22 - 110:26] ObjCPropertyDecl=foo:110:33
+// CHECK: Keyword: "copy" [110:22 - 110:26] ObjCPropertyDecl=foo:110:33
// CHECK: Punctuation: ")" [110:26 - 110:27] ObjCPropertyDecl=foo:110:33
// CHECK: Identifier: "Foo" [110:28 - 110:31] ObjCClassRef=Foo:1:12
// CHECK: Punctuation: "*" [110:32 - 110:33] ObjCPropertyDecl=foo:110:33
// CHECK: Identifier: "foo" [110:33 - 110:36] ObjCPropertyDecl=foo:110:33
// CHECK: Keyword: "property" [111:2 - 111:10] ObjCPropertyDecl=foo2:111:27
// CHECK: Punctuation: "(" [111:11 - 111:12] ObjCPropertyDecl=foo2:111:27
-// CHECK: Identifier: "readonly" [111:12 - 111:20] ObjCPropertyDecl=foo2:111:27
+// CHECK: Keyword: "readonly" [111:12 - 111:20] ObjCPropertyDecl=foo2:111:27
// CHECK: Punctuation: ")" [111:20 - 111:21] ObjCPropertyDecl=foo2:111:27
// CHECK: Identifier: "Foo" [111:22 - 111:25] ObjCClassRef=Foo:1:12
// CHECK: Punctuation: "*" [111:26 - 111:27] ObjCPropertyDecl=foo2:111:27
@@ -539,9 +540,9 @@ static Rdar8595462_A * Rdar8595462_staticVar;
// CHECK-PROP-AFTER-METHOD: Punctuation: "@" [136:1 - 136:2] ObjCPropertyDecl=blah:136:38
// CHECK-PROP-AFTER-METHOD: Keyword: "property" [136:2 - 136:10] ObjCPropertyDecl=blah:136:38
// CHECK-PROP-AFTER-METHOD: Punctuation: "(" [136:11 - 136:12] ObjCPropertyDecl=blah:136:38
-// CHECK-PROP-AFTER-METHOD: Identifier: "readonly" [136:12 - 136:20] ObjCPropertyDecl=blah:136:38
+// CHECK-PROP-AFTER-METHOD: Keyword: "readonly" [136:12 - 136:20] ObjCPropertyDecl=blah:136:38
// CHECK-PROP-AFTER-METHOD: Punctuation: "," [136:20 - 136:21] ObjCPropertyDecl=blah:136:38
-// CHECK-PROP-AFTER-METHOD: Identifier: "nonatomic" [136:22 - 136:31] ObjCPropertyDecl=blah:136:38
+// CHECK-PROP-AFTER-METHOD: Keyword: "nonatomic" [136:22 - 136:31] ObjCPropertyDecl=blah:136:38
// CHECK-PROP-AFTER-METHOD: Punctuation: ")" [136:31 - 136:32] ObjCPropertyDecl=blah:136:38
// CHECK-PROP-AFTER-METHOD: Identifier: "Foo" [136:33 - 136:36] ObjCClassRef=Foo:1:12
// CHECK-PROP-AFTER-METHOD: Punctuation: "*" [136:37 - 136:38] ObjCPropertyDecl=blah:136:38
diff --git a/test/Index/blocks.c b/test/Index/blocks.c
index a8965d2aa670..633e171ffa37 100644
--- a/test/Index/blocks.c
+++ b/test/Index/blocks.c
@@ -9,17 +9,17 @@ void test() {
^ int_t(struct foo *foo) { return (int_t) foo->x + i; }(&_foo);
}
-// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:6 - 10:2]
+// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:1 - 10:2]
// CHECK: blocks.c:6:13: UnexposedStmt= Extent=[6:13 - 10:2]
// CHECK: blocks.c:7:3: UnexposedStmt= Extent=[7:3 - 7:26]
-// CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:17 - 7:25]
+// CHECK: blocks.c:7:21: VarDecl=_foo:7:21 (Definition) Extent=[7:3 - 7:25]
// CHECK: blocks.c:7:17: TypeRef=struct foo:4:8 Extent=[7:17 - 7:20]
-// CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:11 - 8:16]
+// CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:3 - 8:16]
// CHECK: blocks.c:8:15: UnexposedExpr= Extent=[8:15 - 8:16]
// CHECK: blocks.c:9:3: CallExpr= Extent=[9:3 - 9:65]
// CHECK: blocks.c:9:3: UnexposedExpr= Extent=[9:3 - 9:58]
// CHECK: blocks.c:9:5: TypeRef=int_t:3:13 Extent=[9:5 - 9:10]
-// CHECK: blocks.c:9:23: ParmDecl=foo:9:23 (Definition) Extent=[9:18 - 9:26]
+// CHECK: blocks.c:9:23: ParmDecl=foo:9:23 (Definition) Extent=[9:11 - 9:26]
// CHECK: blocks.c:9:18: TypeRef=struct foo:4:8 Extent=[9:18 - 9:21]
// CHECK: blocks.c:9:28: UnexposedStmt= Extent=[9:28 - 9:58]
// CHECK: blocks.c:9:30: UnexposedStmt= Extent=[9:30 - 9:55]
diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m
index f34593f3e85e..98a41d837fdc 100644
--- a/test/Index/c-index-api-loadTU-test.m
+++ b/test/Index/c-index-api-loadTU-test.m
@@ -71,7 +71,7 @@ struct X0;
struct X0 {};
// CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 12:5]
-// CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:32 - 6:40]
+// CHECK: c-index-api-loadTU-test.m:6:32: ObjCIvarDecl=myoutlet:6:32 (Definition) Extent=[6:3 - 6:40]
// CHECK: <invalid loc>:0:0: attribute(iboutlet)=
// CHECK: c-index-api-loadTU-test.m:6:29: TypeRef=id:0:0 Extent=[6:29 - 6:31]
// CHECK: c-index-api-loadTU-test.m:8:1: ObjCInstanceMethodDecl=myMessage::8:1 Extent=[8:1 - 8:54]
@@ -95,14 +95,14 @@ struct X0 {};
// CHECK: c-index-api-loadTU-test.m:33:12: ObjCInterfaceDecl=Baz:33:12 Extent=[33:1 - 40:5]
// CHECK: c-index-api-loadTU-test.m:33:18: ObjCSuperClassRef=Bar:14:12 Extent=[33:18 - 33:21]
// CHECK: c-index-api-loadTU-test.m:33:23: ObjCProtocolRef=SubP:29:1 Extent=[33:23 - 33:27]
-// CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:9 - 35:16]
+// CHECK: c-index-api-loadTU-test.m:35:9: ObjCIvarDecl=_anIVar:35:9 (Definition) Extent=[35:5 - 35:16]
// CHECK: c-index-api-loadTU-test.m:38:1: ObjCInstanceMethodDecl=bazMethod:38:1 Extent=[38:1 - 38:21]
// CHECK: c-index-api-loadTU-test.m:38:4: ObjCClassRef=Foo:4:12 Extent=[38:4 - 38:7]
// CHECK: c-index-api-loadTU-test.m:42:1: EnumDecl=:42:1 (Definition) Extent=[42:1 - 44:2]
// CHECK: c-index-api-loadTU-test.m:43:3: EnumConstantDecl=someEnum:43:3 (Definition) Extent=[43:3 - 43:11]
-// CHECK: c-index-api-loadTU-test.m:46:5: FunctionDecl=main:46:5 (Definition) Extent=[46:5 - 55:2]
+// CHECK: c-index-api-loadTU-test.m:46:5: FunctionDecl=main:46:5 (Definition) Extent=[46:1 - 55:2]
// CHECK: c-index-api-loadTU-test.m:46:15: ParmDecl=argc:46:15 (Definition) Extent=[46:11 - 46:19]
-// CHECK: c-index-api-loadTU-test.m:46:34: ParmDecl=argv:46:34 (Definition) Extent=[46:27 - 46:38]
+// CHECK: c-index-api-loadTU-test.m:46:34: ParmDecl=argv:46:34 (Definition) Extent=[46:21 - 46:40]
// CHECK: c-index-api-loadTU-test.m:47:8: VarDecl=bee:47:8 (Definition) Extent=[47:2 - 47:11]
// CHECK: c-index-api-loadTU-test.m:47:2: ObjCClassRef=Baz:33:12 Extent=[47:2 - 47:5]
// CHECK: c-index-api-loadTU-test.m:48:5: VarDecl=a:48:5 (Definition) Extent=[48:2 - 48:18]
@@ -135,9 +135,9 @@ struct X0 {};
// CHECK: c-index-api-loadTU-test.m:54:18: UnexposedExpr=bee:47:8 Extent=[54:18 - 54:36]
// CHECK: c-index-api-loadTU-test.m:54:33: DeclRefExpr=bee:47:8 Extent=[54:33 - 54:36]
// CHECK: c-index-api-loadTU-test.m:62:12: ObjCInterfaceDecl=TestAttributes:62:12 Extent=[62:1 - 67:5]
-// CHECK: c-index-api-loadTU-test.m:63:19: ObjCIvarDecl=anOutlet:63:19 (Definition) Extent=[63:19 - 63:27]
+// CHECK: c-index-api-loadTU-test.m:63:19: ObjCIvarDecl=anOutlet:63:19 (Definition) Extent=[58:18 - 63:27]
// CHECK: <invalid loc>:0:0: attribute(iboutlet)=
-// CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[64:29 - 64:47]
+// CHECK: c-index-api-loadTU-test.m:64:29: ObjCIvarDecl=anOutletCollection:64:29 (Definition) Extent=[59:39 - 64:47]
// CHECK: <invalid loc>:0:0: attribute(iboutletcollection)= [IBOutletCollection=ObjCObjectPointer]
// CHECK: c-index-api-loadTU-test.m:64:26: TypeRef=id:0:0 Extent=[64:26 - 64:28]
// CHECK: c-index-api-loadTU-test.m:66:1: ObjCInstanceMethodDecl=actionMethod::66:1 Extent=[66:1 - 66:35]
@@ -145,7 +145,7 @@ struct X0 {};
// CHECK: c-index-api-loadTU-test.m:66:31: ParmDecl=arg:66:31 (Definition) Extent=[66:28 - 66:34]
// CHECK: c-index-api-loadTU-test.m:66:28: TypeRef=id:0:0 Extent=[66:28 - 66:30]
// CHECK: c-index-api-loadTU-test.m:69:16: StructDecl=X0:69:16 Extent=[69:9 - 69:18]
-// CHECK: c-index-api-loadTU-test.m:69:19: TypedefDecl=X1:69:19 (Definition) Extent=[69:19 - 69:21]
+// CHECK: c-index-api-loadTU-test.m:69:19: TypedefDecl=X1:69:19 (Definition) Extent=[69:1 - 69:21]
// CHECK: c-index-api-loadTU-test.m:69:16: TypeRef=struct X0:71:8 Extent=[69:16 - 69:18]
// CHECK: c-index-api-loadTU-test.m:70:8: StructDecl=X0:70:8 Extent=[70:1 - 70:10]
// CHECK: c-index-api-loadTU-test.m:71:8: StructDecl=X0:71:8 (Definition) Extent=[71:1 - 71:14]
diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m
index 91482eb798a4..c2ff6963c9ff 100644
--- a/test/Index/c-index-getCursor-test.m
+++ b/test/Index/c-index-getCursor-test.m
@@ -108,9 +108,9 @@ void f() {
// CHECK: [42:2 - 44:1] Invalid Cursor => NoDeclFound
// CHECK: [44:1 - 44:11] FunctionDecl=main:44:5 (Definition)
// CHECK: [44:11 - 44:19] ParmDecl=argc:44:15 (Definition)
-// CHECK: [44:19 - 44:27] FunctionDecl=main:44:5 (Definition)
-// CHECK: [44:27 - 44:38] ParmDecl=argv:44:34 (Definition)
-// CHECK: [44:38 - 44:42] FunctionDecl=main:44:5 (Definition)
+// CHECK: [44:19 - 44:21] FunctionDecl=main:44:5 (Definition)
+// CHECK: [44:21 - 44:40] ParmDecl=argv:44:34 (Definition)
+// CHECK: [44:40 - 44:42] FunctionDecl=main:44:5 (Definition)
// CHECK: [44:42 - 45:2] UnexposedStmt=
// CHECK: [45:2 - 45:5] ObjCClassRef=Baz:31:12
// CHECK: [45:5 - 45:11] VarDecl=bee:45:8 (Definition)
diff --git a/test/Index/cindex-on-invalid.m b/test/Index/cindex-on-invalid.m
index d2d952d8b19e..6eff24baf808 100644
--- a/test/Index/cindex-on-invalid.m
+++ b/test/Index/cindex-on-invalid.m
@@ -1,6 +1,21 @@
// RUN: c-index-test -test-load-source local %s 2>&1 | FileCheck %s
+// <rdar://problem/9123493>
+void test() {
+ goto exit;
+}
+
int foo;
+
+#define NO 0
+
+void f(int y) {
+ if (y = NO);
+}
+
int
-// CHECK: cindex-on-invalid.m:6:70: error: expected identifier or '(' \ No newline at end of file
+// CHECK: cindex-on-invalid.m:5:8: error: use of undeclared label 'exit'
+// CHECK: cindex-on-invalid.m:13:9:{13:7-13:13}
+// CHECK: cindex-on-invalid.m:21:1: error: expected identifier or '('
+
diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m
index 0658d53c651b..0ea33850560e 100644
--- a/test/Index/complete-objc-message.m
+++ b/test/Index/complete-objc-message.m
@@ -175,6 +175,12 @@ void test_missing_open_more() {
A *a = A class_method3];
}
+void test_block_invoke(A *(^block1)(int),
+ int (^block2)(int),
+ id (^block3)(int)) {
+ [block1(5) init];
+}
+
// 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)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)}
@@ -285,6 +291,12 @@ void test_missing_open_more() {
// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method3} (35)
// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method4} (35)
+// RUN: c-index-test -code-completion-at=%s:181:4 %s | FileCheck -check-prefix=CHECK-BLOCK-RECEIVER %s
+// CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText A} (50)
+// CHECK-BLOCK-RECEIVER: ObjCInterfaceDecl:{TypedText B} (50)
+// CHECK-BLOCK-RECEIVER: ParmDecl:{ResultType A *(^)(int)}{TypedText block1} (34)
+// CHECK-BLOCK-RECEIVER-NEXT: ParmDecl:{ResultType id (^)(int)}{TypedText block3} (34)
+
// Test code completion with a missing opening bracket:
// RUN: c-index-test -code-completion-at=%s:135:5 %s | FileCheck -check-prefix=CHECK-CCI %s
// RUN: c-index-test -code-completion-at=%s:139:7 %s | FileCheck -check-prefix=CHECK-CC7 %s
diff --git a/test/Index/complete-properties.m b/test/Index/complete-properties.m
index 725f180f7c29..ce1870e6511b 100644
--- a/test/Index/complete-properties.m
+++ b/test/Index/complete-properties.m
@@ -29,6 +29,22 @@ id test(I3 *i3) {
return i3.Prop3;
}
+@interface I4
+@property id Prop2;
+@end
+
+@interface I4 () {
+ I4 *Prop1;
+}
+@end
+
+@implementation I4 {
+ id Prop2_;
+}
+
+@synthesize Prop2 = Prop2_;
+@end
+
// RUN: c-index-test -code-completion-at=%s:20:13 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText Prop1}
@@ -41,8 +57,10 @@ id test(I3 *i3) {
// CHECK-CC2-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3}
// CHECK-CC2: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
// RUN: c-index-test -code-completion-at=%s:20:35 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ObjCIvarDecl:{ResultType int}{TypedText RandomIVar}
-// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText StoredProp3}
+// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText _Prop3} (36)
+// CHECK-CC3: ObjCIvarDecl:{ResultType int}{TypedText RandomIVar} (35)
+// CHECK-CC3: ObjCIvarDecl:{ResultType id}{TypedText StoredProp3} (8)
+
// RUN: c-index-test -code-completion-at=%s:21:10 %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: ObjCPropertyDecl:{ResultType int}{TypedText Prop0}
// CHECK-CC4-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4}
@@ -57,3 +75,8 @@ id test(I3 *i3) {
// RUN: c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: ObjCInterfaceDecl:{TypedText MyClass} (50)
+
+// RUN: c-index-test -code-completion-at=%s:45:21 -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC7 %s
+// CHECK-CC7-NOT: ObjCIvarDecl:{ResultType id}{TypedText _Prop2}
+// CHECK-CC7: ObjCIvarDecl:{ResultType I4 *}{TypedText Prop1} (17)
+// CHECK-CC7: ObjCIvarDecl:{ResultType id}{TypedText Prop2_} (7)
diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp
index 3def6001a10a..abc95545c53b 100644
--- a/test/Index/index-templates.cpp
+++ b/test/Index/index-templates.cpp
@@ -102,7 +102,7 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { };
// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-LOAD %s
// CHECK-LOAD: index-templates.cpp:4:6: FunctionTemplate=f:4:6 Extent=[3:1 - 4:22]
-// CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:19 - 3:20]
+// CHECK-LOAD: index-templates.cpp:3:19: TemplateTypeParameter=T:3:19 (Definition) Extent=[3:10 - 3:20]
// CHECK-LOAD: index-templates.cpp:3:24: NonTypeTemplateParameter=Value:3:24 (Definition) Extent=[3:22 - 3:29]
// FIXME: Need the template type parameter here
// CHECK-LOAD: index-templates.cpp:3:66: TemplateTemplateParameter=X:3:66 (Definition) Extent=[3:31 - 3:67]
@@ -111,49 +111,49 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { };
// FIXME: Need the template type parameter here
// CHECK-LOAD: index-templates.cpp:4:13: DeclRefExpr=Value:3:24 Extent=[4:13 - 4:18]
// CHECK-LOAD: index-templates.cpp:6:28: ClassTemplate=allocator:6:28 Extent=[6:1 - 6:37]
-// CHECK-LOAD: index-templates.cpp:6:19: TemplateTypeParameter=T:6:19 (Definition) Extent=[6:19 - 6:20]
+// CHECK-LOAD: index-templates.cpp:6:19: TemplateTypeParameter=T:6:19 (Definition) Extent=[6:10 - 6:20]
// CHECK-LOAD: index-templates.cpp:9:7: ClassTemplate=vector:9:7 (Definition) Extent=[8:1 - 11:2]
-// CHECK-LOAD: index-templates.cpp:8:19: TemplateTypeParameter=T:8:19 (Definition) Extent=[8:19 - 8:20]
-// CHECK-LOAD: index-templates.cpp:8:31: TemplateTypeParameter=Alloc:8:31 (Definition) Extent=[8:31 - 8:36]
+// CHECK-LOAD: index-templates.cpp:8:19: TemplateTypeParameter=T:8:19 (Definition) Extent=[8:10 - 8:20]
+// CHECK-LOAD: index-templates.cpp:8:31: TemplateTypeParameter=Alloc:8:31 (Definition) Extent=[8:22 - 8:51]
// CHECK-LOAD: index-templates.cpp:8:39: TemplateRef=allocator:6:28 Extent=[8:39 - 8:48]
-// CHECK-LOAD: index-templates.cpp:10:8: CXXMethod=clear:10:8 Extent=[10:8 - 10:15]
+// CHECK-LOAD: index-templates.cpp:10:8: CXXMethod=clear:10:8 Extent=[10:3 - 10:15]
// CHECK-LOAD: index-templates.cpp:14:7: ClassTemplatePartialSpecialization=vector:14:7 (Definition) [Specialization of vector:9:7] Extent=[13:1 - 14:21]
-// CHECK-LOAD: index-templates.cpp:13:19: TemplateTypeParameter=T:13:19 (Definition) Extent=[13:19 - 13:20]
+// CHECK-LOAD: index-templates.cpp:13:19: TemplateTypeParameter=T:13:19 (Definition) Extent=[13:10 - 13:20]
// CHECK-LOAD: index-templates.cpp:16:8: StructDecl=Z1:16:8 (Definition) Extent=[16:1 - 16:14]
-// CHECK-LOAD: index-templates.cpp:18:16: ClassDecl=vector:18:16 (Definition) [Specialization of vector:9:7] Extent=[18:1 - 18:22]
+// CHECK-LOAD: index-templates.cpp:18:16: ClassDecl=vector:18:16 (Definition) [Specialization of vector:9:7] Extent=[18:1 - 18:26]
// CHECK-LOAD: index-templates.cpp:18:23: TypeRef=struct Z1:16:8 Extent=[18:23 - 18:25]
// CHECK-LOAD-NOT: CXXMethod=clear
// CHECK-LOAD: index-templates.cpp:20:8: StructDecl=Z2:20:8 (Definition) Extent=[20:1 - 20:14]
// CHECK-LOAD: index-templates.cpp:23:7: ClassDecl=vector:23:7 (Definition) [Specialization of vector:9:7] Extent=[22:1 - 25:2]
// CHECK-LOAD: index-templates.cpp:23:14: TypeRef=struct Z2:20:8 Extent=[23:14 - 23:16]
-// CHECK-LOAD: index-templates.cpp:24:8: CXXMethod=clear:24:8 Extent=[24:8 - 24:15]
+// CHECK-LOAD: index-templates.cpp:24:8: CXXMethod=clear:24:8 Extent=[24:3 - 24:15]
// CHECK-LOAD: index-templates.cpp:28:8: ClassTemplate=Y:28:8 (Definition) Extent=[27:1 - 31:2]
-// CHECK-LOAD: index-templates.cpp:27:19: TemplateTypeParameter=T:27:19 (Definition) Extent=[27:19 - 27:20]
-// CHECK-LOAD: index-templates.cpp:27:31: TemplateTypeParameter=U:27:31 (Definition) Extent=[27:31 - 27:32]
+// CHECK-LOAD: index-templates.cpp:27:19: TemplateTypeParameter=T:27:19 (Definition) Extent=[27:10 - 27:20]
+// CHECK-LOAD: index-templates.cpp:27:31: TemplateTypeParameter=U:27:31 (Definition) Extent=[27:22 - 27:32]
// CHECK-LOAD: index-templates.cpp:29:21: UsingDeclaration=type:29:21 Extent=[29:3 - 29:25]
// CHECK-LOAD: index-templates.cpp:30:12: UsingDeclaration=operator Z2:30:12 Extent=[30:3 - 30:23]
// CHECK-LOAD: index-templates.cpp:30:21: TypeRef=struct Z2:20:8 Extent=[30:21 - 30:23]
-// CHECK-LOAD: index-templates.cpp:35:16: VarDecl=OneDimension:35:16 (Definition) Extent=[35:7 - 35:32]
+// CHECK-LOAD: index-templates.cpp:35:16: VarDecl=OneDimension:35:16 (Definition) Extent=[35:1 - 35:32]
// CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32]
// CHECK-LOAD: index-templates.cpp:35:31: UnexposedExpr= Extent=[35:31 - 35:32]
// CHECK-LOAD: index-templates.cpp:37:8: ClassTemplate=array:37:8 (Definition) Extent=[36:1 - 37:17]
-// CHECK-LOAD: index-templates.cpp:36:19: TemplateTypeParameter=T:36:19 (Definition) Extent=[36:19 - 36:20]
-// CHECK-LOAD: index-templates.cpp:36:31: NonTypeTemplateParameter=Dimensions:36:31 (Definition) Extent=[36:22 - 36:41]
+// CHECK-LOAD: index-templates.cpp:36:19: TemplateTypeParameter=T:36:19 (Definition) Extent=[36:10 - 36:20]
+// CHECK-LOAD: index-templates.cpp:36:31: NonTypeTemplateParameter=Dimensions:36:31 (Definition) Extent=[36:22 - 36:56]
// CHECK-LOAD: index-templates.cpp:36:44: DeclRefExpr=OneDimension:35:16 Extent=[36:44 - 36:56]
// CHECK-LOAD: index-templates.cpp:40:8: ClassTemplate=storage:40:8 (Definition) Extent=[39:1 - 40:19]
// CHECK-LOAD: index-templates.cpp:39:45: TemplateTemplateParameter=DataStructure:39:45 (Definition) Extent=[39:10 - 39:66]
// CHECK-LOAD: index-templates.cpp:39:19: TemplateTypeParameter=:39:19 (Definition) Extent=[39:19 - 39:27]
// CHECK-LOAD: index-templates.cpp:39:37: NonTypeTemplateParameter=:39:37 (Definition) Extent=[39:29 - 39:38]
// CHECK-LOAD: index-templates.cpp:39:61: TemplateRef=array:37:8 Extent=[39:61 - 39:66]
-// CHECK-LOAD: index-templates.cpp:42:18: TypedefDecl=Unsigned:42:18 (Definition) Extent=[42:18 - 42:26]
+// CHECK-LOAD: index-templates.cpp:42:18: TypedefDecl=Unsigned:42:18 (Definition) Extent=[42:1 - 42:26]
// CHECK-LOAD: index-templates.cpp:45:8: ClassTemplate=value_c:45:8 Extent=[44:1 - 45:15]
-// CHECK-LOAD: index-templates.cpp:44:19: TemplateTypeParameter=T:44:19 (Definition) Extent=[44:19 - 44:20]
+// CHECK-LOAD: index-templates.cpp:44:19: TemplateTypeParameter=T:44:19 (Definition) Extent=[44:10 - 44:20]
// CHECK-LOAD: index-templates.cpp:44:31: NonTypeTemplateParameter=Value:44:31 (Definition) Extent=[44:22 - 44:36]
// CHECK-LOAD: index-templates.cpp:44:22: TypeRef=Unsigned:42:18 Extent=[44:22 - 44:30]
-// CHECK-LOAD: index-templates.cpp:47:16: ClassDecl=vector:47:16 (Definition) [Specialization of vector:14:7] Extent=[47:1 - 47:22]
+// CHECK-LOAD: index-templates.cpp:47:16: ClassDecl=vector:47:16 (Definition) [Specialization of vector:14:7] Extent=[47:1 - 47:28]
// CHECK-LOAD: index-templates.cpp:49:8: StructDecl=Z4:49:8 (Definition) Extent=[49:1 - 51:2]
// CHECK-LOAD: index-templates.cpp:50:26: FunctionTemplate=getAs:50:26 Extent=[50:3 - 50:33]
-// CHECK-LOAD: index-templates.cpp:50:21: TemplateTypeParameter=T:50:21 (Definition) Extent=[50:21 - 50:22]
+// CHECK-LOAD: index-templates.cpp:50:21: TemplateTypeParameter=T:50:21 (Definition) Extent=[50:12 - 50:22]
// CHECK-LOAD: index-templates.cpp:53:6: FunctionDecl=template_exprs:53:6 (Definition)
// CHECK-LOAD: index-templates.cpp:54:3: CallExpr=f:4:6 Extent=[54:3 - 54:68]
// CHECK-LOAD: index-templates.cpp:54:3: UnexposedExpr=f:4:6 Extent=[54:3 - 54:35]
@@ -174,34 +174,34 @@ struct SuperPair : Pair<int, int>, Pair<T, U> { };
// CHECK-LOAD: index-templates.cpp:85:23: TypeRef=second_type:83:13 Extent=[85:23 - 85:34]
// CHECK-LOAD: index-templates.cpp:85:35: DeclRefExpr=u:82:23 Extent=[85:35 - 85:36]
// CHECK-LOAD: index-templates.cpp:101:8: ClassTemplate=SuperPair:101:8 (Definition) Extent=[100:1 - 101:50]
-// CHECK-LOAD: index-templates.cpp:100:19: TemplateTypeParameter=T:100:19 (Definition) Extent=[100:19 - 100:20]
-// CHECK-LOAD: index-templates.cpp:100:31: TemplateTypeParameter=U:100:31 (Definition) Extent=[100:31 - 100:32]
+// CHECK-LOAD: index-templates.cpp:100:19: TemplateTypeParameter=T:100:19 (Definition) Extent=[100:10 - 100:20]
+// CHECK-LOAD: index-templates.cpp:100:31: TemplateTypeParameter=U:100:31 (Definition) Extent=[100:22 - 100:32]
// CHECK-LOAD: index-templates.cpp:101:20: C++ base class specifier=Pair<int, int>:98:16 [access=public isVirtual=false] Extent=[101:20 - 101:34]
// CHECK-LOAD: index-templates.cpp:101:36: C++ base class specifier=Pair<T, U>:76:8 [access=public isVirtual=false] Extent=[101:36 - 101:46]
// RUN: c-index-test -test-load-source-usrs all %s | FileCheck -check-prefix=CHECK-USRS %s
// CHECK-USRS: index-templates.cpp c:@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22S0_# Extent=[3:1 - 4:22]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@79 Extent=[3:19 - 3:20]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@70 Extent=[3:10 - 3:20]
// CHECK-USRS: index-templates.cpp c:index-templates.cpp@82 Extent=[3:22 - 3:29]
// CHECK-USRS: index-templates.cpp c:index-templates.cpp@91 Extent=[3:31 - 3:67]
// CHECK-USRS: index-templates.cpp c:index-templates.cpp@136@FT@>3#T#Nt0.0#t>2#T#Nt1.0f#>t0.22S0_#@x Extent=[4:8 - 4:21]
// CHECK-USRS: index-templates.cpp c:@CT>1#T@allocator Extent=[6:1 - 6:37]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@171 Extent=[6:19 - 6:20]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@162 Extent=[6:10 - 6:20]
// CHECK-USRS: index-templates.cpp c:@CT>2#T#T@vector Extent=[8:1 - 11:2]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@210 Extent=[8:19 - 8:20]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@222 Extent=[8:31 - 8:36]
-// CHECK-USRS: index-templates.cpp c:@CT>2#T#T@vector@F@clear# Extent=[10:8 - 10:15]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@201 Extent=[8:10 - 8:20]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@213 Extent=[8:22 - 8:51]
+// CHECK-USRS: index-templates.cpp c:@CT>2#T#T@vector@F@clear# Extent=[10:3 - 10:15]
// CHECK-USRS: index-templates.cpp c:@CP>1#T@vector>#*t0.0#>@CT>1#T@allocator1S0_ Extent=[13:1 - 14:21]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@298 Extent=[13:19 - 13:20]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@289 Extent=[13:10 - 13:20]
// CHECK-USRS: index-templates.cpp c:@S@Z1 Extent=[16:1 - 16:14]
-// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z1#$@C@allocator>#S0_ Extent=[18:1 - 18:22]
+// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z1#$@C@allocator>#S0_ Extent=[18:1 - 18:26]
// CHECK-USRS: index-templates.cpp c:@S@Z2 Extent=[20:1 - 20:14]
// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#S0_ Extent=[22:1 - 25:2]
-// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#S0_@F@clear# Extent=[24:8 - 24:15]
+// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#S0_@F@clear# Extent=[24:3 - 24:15]
// CHECK-USRS: index-templates.cpp c:@ST>2#T#T@Y Extent=[27:1 - 31:2]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@452 Extent=[27:19 - 27:20]
-// CHECK-USRS: index-templates.cpp c:index-templates.cpp@464 Extent=[27:31 - 27:32]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@443 Extent=[27:10 - 27:20]
+// CHECK-USRS: index-templates.cpp c:index-templates.cpp@455 Extent=[27:22 - 27:32]
// CHECK-USRS-NOT: type
// CHECK-USRS: index-templates.cpp c:@S@Z3 Extent=[33:1 - 33:14]
// CHECK-USRS: index-templates.cpp c:@F@f#$@S@map>#$@S@Z4#$@S@Pair>#I#S1_#$@S@compare>#$@S@Pair>#S1_#S2_#$@C@allocator>#S4_#
diff --git a/test/Index/initializer-memory.cpp b/test/Index/initializer-memory.cpp
new file mode 100644
index 000000000000..f085c3562438
--- /dev/null
+++ b/test/Index/initializer-memory.cpp
@@ -0,0 +1,16 @@
+// RUN: c-index-test -test-load-source-memory-usage none %s 2>&1 | FileCheck %s
+
+// rdar://9275920 - We would create millions of Exprs to fill out the initializer.
+
+double data[1000000] = {0};
+double data_empty_init[1000000] = {};
+
+struct S {
+ S(int);
+ S();
+};
+
+S data2[1000000] = {0};
+S data_empty_init2[1000000] = {};
+
+// CHECK: TOTAL = {{.*}} (0.{{.*}} MBytes)
diff --git a/test/Index/invalid-rdar-8236270.cpp b/test/Index/invalid-rdar-8236270.cpp
index 6fd088dcc813..4593b512ee24 100644
--- a/test/Index/invalid-rdar-8236270.cpp
+++ b/test/Index/invalid-rdar-8236270.cpp
@@ -6,6 +6,6 @@ struct abc *P;
int main(
// CHECK: StructDecl=abc:5:8 Extent=[5:1 - 5:11]
-// CHECK: VarDecl=P:5:13 (Definition) Extent=[5:8 - 5:14]
+// CHECK: VarDecl=P:5:13 (Definition) Extent=[5:1 - 5:14]
// CHECK: VarDecl=main:6:5 (Definition) Extent=[6:1 - 6:9]
diff --git a/test/Index/load-classes.cpp b/test/Index/load-classes.cpp
index 349ebdecd750..58770191ea99 100644
--- a/test/Index/load-classes.cpp
+++ b/test/Index/load-classes.cpp
@@ -17,12 +17,12 @@ X::X(int value) {
// CHECK: load-classes.cpp:4:9: ParmDecl=value:4:9 (Definition) Extent=[4:5 - 4:14]
// CHECK: load-classes.cpp:5:3: CXXConstructor=X:5:3 Extent=[5:3 - 5:16]
// FIXME: missing TypeRef in the constructor name
-// CHECK: load-classes.cpp:5:14: ParmDecl=x:5:14 (Definition) Extent=[5:11 - 5:15]
+// CHECK: load-classes.cpp:5:14: ParmDecl=x:5:14 (Definition) Extent=[5:5 - 5:15]
// CHECK: load-classes.cpp:5:11: TypeRef=struct X:3:8 Extent=[5:11 - 5:12]
// CHECK: load-classes.cpp:6:3: CXXDestructor=~X:6:3 Extent=[6:3 - 6:7]
// FIXME: missing TypeRef in the destructor name
// CHECK: load-classes.cpp:7:3: CXXConversion=operator struct X *:7:3 Extent=[7:3 - 7:16]
// CHECK: load-classes.cpp:7:12: TypeRef=struct X:3:8 Extent=[7:12 - 7:13]
-// CHECK: load-classes.cpp:10:4: CXXConstructor=X:10:4 (Definition) Extent=[10:4 - 11:2]
+// CHECK: load-classes.cpp:10:4: CXXConstructor=X:10:4 (Definition) Extent=[10:1 - 11:2]
// CHECK: load-classes.cpp:10:1: TypeRef=struct X:3:8 Extent=[10:1 - 10:2]
// CHECK: load-classes.cpp:10:10: ParmDecl=value:10:10 (Definition) Extent=[10:6 - 10:15]
diff --git a/test/Index/load-exprs.c b/test/Index/load-exprs.c
index 01adf62aff49..a4723d88ef85 100644
--- a/test/Index/load-exprs.c
+++ b/test/Index/load-exprs.c
@@ -32,30 +32,30 @@ void test_members(int aval, int bval) {
}
// 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: macro definition=__clang__
+// CHECK: load-exprs.c:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 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:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17]
+// CHECK: load-exprs.c:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:12 - 2:20]
+// CHECK: load-exprs.c:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:1 - 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:12: VarDecl=x:6:12 (Definition) Extent=[6:3 - 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:5: FunctionDecl=test_blocks:10:5 (Definition) Extent=[10:1 - 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:15: VarDecl=y:11:15 (Definition) Extent=[11:3 - 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:13:17: VarDecl=z:13:17 (Definition) Extent=[13:6 - 13:22]
// CHECK: load-exprs.c:14:6: DeclRefExpr=y:11:15 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=x:10:21 Extent=[14:18 - 14:19]
@@ -64,7 +64,7 @@ void test_members(int aval, int bval) {
// CHECK: load-exprs.c:17:10: DeclRefExpr=y:11:15 Extent=[17:10 - 17:11]
// CHECK: load-exprs.c:20:10: DeclRefExpr=y:11:15 Extent=[20:10 - 20:11]
// CHECK: load-exprs.c:29:6: FunctionDecl=test_members:29:6 (Definition)
-// CHECK: load-exprs.c:30:12: VarDecl=y0:30:12 (Definition) Extent=[30:10 - 30:77]
+// CHECK: load-exprs.c:30:12: VarDecl=y0:30:12 (Definition) Extent=[30:3 - 30:77]
// CHECK: load-exprs.c:30:10: TypeRef=struct Y:23:8 Extent=[30:10 - 30:11]
// CHECK: load-exprs.c:30:20: MemberRef=array:24:12 Extent=[30:20 - 30:25]
// CHECK: load-exprs.c:30:26: DeclRefExpr=StartIndex:27:8 Extent=[30:26 - 30:36]
diff --git a/test/Index/load-namespaces.cpp b/test/Index/load-namespaces.cpp
index 931a1dc79d2c..49de66a81d36 100644
--- a/test/Index/load-namespaces.cpp
+++ b/test/Index/load-namespaces.cpp
@@ -27,23 +27,23 @@ void std::g() {
namespace my_rel_ops = std::rel_ops;
// RUN: c-index-test -test-load-source all %s | FileCheck %s
-// CHECK: load-namespaces.cpp:3:11: Namespace=std:3:11 (Definition) Extent=[3:11 - 7:2]
-// CHECK: load-namespaces.cpp:4:13: Namespace=rel_ops:4:13 (Definition) Extent=[4:13 - 6:4]
-// CHECK: load-namespaces.cpp:5:10: FunctionDecl=f:5:10 Extent=[5:10 - 5:13]
-// CHECK: load-namespaces.cpp:9:11: Namespace=std:9:11 (Definition) Extent=[9:11 - 11:2]
-// CHECK: load-namespaces.cpp:10:8: FunctionDecl=g:10:8 Extent=[10:8 - 10:11]
+// CHECK: load-namespaces.cpp:3:11: Namespace=std:3:11 (Definition) Extent=[3:1 - 7:2]
+// CHECK: load-namespaces.cpp:4:13: Namespace=rel_ops:4:13 (Definition) Extent=[4:3 - 6:4]
+// CHECK: load-namespaces.cpp:5:10: FunctionDecl=f:5:10 Extent=[5:5 - 5:13]
+// CHECK: load-namespaces.cpp:9:11: Namespace=std:9:11 (Definition) Extent=[9:1 - 11:2]
+// CHECK: load-namespaces.cpp:10:8: FunctionDecl=g:10:8 Extent=[10:3 - 10:11]
// CHECK: load-namespaces.cpp:13:11: NamespaceAlias=std98:13:11 Extent=[13:1 - 13:22]
// CHECK: load-namespaces.cpp:13:19: NamespaceRef=std:3:11 Extent=[13:19 - 13:22]
// CHECK: load-namespaces.cpp:14:11: NamespaceAlias=std0x:14:11 Extent=[14:1 - 14:24]
// CHECK: load-namespaces.cpp:14:19: NamespaceRef=std98:13:11 Extent=[14:19 - 14:24]
// CHECK: load-namespaces.cpp:16:17: UsingDirective=:16:17 Extent=[16:1 - 16:22]
// CHECK: load-namespaces.cpp:16:17: NamespaceRef=std0x:14:11 Extent=[16:17 - 16:22]
-// CHECK: load-namespaces.cpp:18:11: Namespace=std:18:11 (Definition) Extent=[18:11 - 20:2]
-// CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:7 - 19:13]
+// CHECK: load-namespaces.cpp:18:11: Namespace=std:18:11 (Definition) Extent=[18:1 - 20:2]
+// CHECK: load-namespaces.cpp:19:7: FunctionDecl=g:19:7 Extent=[19:3 - 19:13]
// CHECK: load-namespaces.cpp:19:12: ParmDecl=:19:12 (Definition) Extent=[19:9 - 19:13]
// CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g[19:7, 10:8] Extent=[22:1 - 22:13]
// CHECK: load-namespaces.cpp:22:7: NamespaceRef=std:18:11 Extent=[22:7 - 22:10]
-// CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:11 - 25:2]
+// CHECK: load-namespaces.cpp:24:11: FunctionDecl=g:24:11 (Definition) Extent=[24:1 - 25:2]
// CHECK: load-namespaces.cpp:24:6: NamespaceRef=std:18:11 Extent=[24:6 - 24:9]
// CHECK: load-namespaces.cpp:27:11: NamespaceAlias=my_rel_ops:27:11 Extent=[27:1 - 27:36]
// CHECK: load-namespaces.cpp:27:24: NamespaceRef=std:18:11 Extent=[27:24 - 27:27]
diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp
index 323b778faf23..cb9d3f2b609f 100644
--- a/test/Index/load-stmts.cpp
+++ b/test/Index/load-stmts.cpp
@@ -118,11 +118,11 @@ void casts(int *ip) {
}
// RUN: c-index-test -test-load-source all %s | FileCheck %s
-// CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:13 - 1:14]
+// CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:1 - 1:14]
// CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23]
-// CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:16 - 2:17]
-// CHECK: load-stmts.cpp:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:19 - 2:20]
-// CHECK: load-stmts.cpp:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:6 - 11:2]
+// CHECK: load-stmts.cpp:2:16: FieldDecl=a:2:16 (Definition) Extent=[2:12 - 2:17]
+// CHECK: load-stmts.cpp:2:19: FieldDecl=b:2:19 (Definition) Extent=[2:12 - 2:20]
+// CHECK: load-stmts.cpp:3:6: FunctionDecl=f:3:6 (Definition) Extent=[3:1 - 11:2]
// CHECK: load-stmts.cpp:3:12: ParmDecl=x:3:12 (Definition) Extent=[3:8 - 3:13]
// CHECK: load-stmts.cpp:4:10: VarDecl=y:4:10 (Definition) Extent=[4:8 - 4:15]
// CHECK: load-stmts.cpp:4:8: TypeRef=T:1:13 Extent=[4:8 - 4:9]
@@ -152,13 +152,13 @@ void casts(int *ip) {
// CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15]
// CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:10]
// CHECK: load-stmts.cpp:14:7: ClassDecl=A:14:7 (Definition) Extent=[14:1 - 16:2]
-// CHECK: load-stmts.cpp:15:8: CXXMethod=doA:15:8 Extent=[15:8 - 15:13]
+// CHECK: load-stmts.cpp:15:8: CXXMethod=doA:15:8 Extent=[15:3 - 15:13]
// CHECK: load-stmts.cpp:18:7: ClassDecl=B:18:7 (Definition) Extent=[18:1 - 20:2]
-// CHECK: load-stmts.cpp:19:8: CXXMethod=doB:19:8 Extent=[19:8 - 19:13]
+// CHECK: load-stmts.cpp:19:8: CXXMethod=doB:19:8 Extent=[19:3 - 19:13]
// CHECK: load-stmts.cpp:22:7: ClassDecl=C:22:7 (Definition) Extent=[22:1 - 24:2]
// CHECK: load-stmts.cpp:22:18: C++ base class specifier=class A:14:7 [access=public isVirtual=false]
// CHECK: load-stmts.cpp:22:29: C++ base class specifier=class B:18:7 [access=private isVirtual=false]
-// CHECK: load-stmts.cpp:23:8: CXXMethod=doC:23:8 Extent=[23:8 - 23:13]
+// CHECK: load-stmts.cpp:23:8: CXXMethod=doC:23:8 Extent=[23:3 - 23:13]
// CHECK: load-stmts.cpp:26:7: ClassDecl=D:26:7 (Definition) Extent=[26:1 - 26:49]
// CHECK: load-stmts.cpp:26:26: C++ base class specifier=class C:22:7 [access=public isVirtual=true]
// CHECK: load-stmts.cpp:26:45: C++ base class specifier=class A:14:7 [access=private isVirtual=true]
@@ -174,7 +174,7 @@ void casts(int *ip) {
// CHECK: load-stmts.cpp:51:3: CallExpr= Extent=[51:3 - 51:10]
// CHECK: load-stmts.cpp:51:3: NamespaceRef=N:41:11 Extent=[51:3 - 51:4]
// CHECK: load-stmts.cpp:51:8: DeclRefExpr=t:50:29 Extent=[51:8 - 51:9]
-// CHECK: load-stmts.cpp:52:13: TypedefDecl=type:52:13 (Definition) Extent=[52:13 - 52:17]
+// CHECK: load-stmts.cpp:52:13: TypedefDecl=type:52:13 (Definition) Extent=[52:3 - 52:17]
// CHECK: load-stmts.cpp:53:3: CallExpr= Extent=[53:3 - 53:16]
// CHECK: load-stmts.cpp:53:3: NamespaceRef=N:41:11 Extent=[53:3 - 53:4]
// CHECK: load-stmts.cpp:53:8: TypeRef=type:52:13 Extent=[53:8 - 53:12]
diff --git a/test/Index/local-symbols.m b/test/Index/local-symbols.m
index af3b601465a8..3a479522944e 100644
--- a/test/Index/local-symbols.m
+++ b/test/Index/local-symbols.m
@@ -27,7 +27,7 @@
@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:6: ObjCIvarDecl=x:7:6 (Definition) Extent=[7:3 - 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]
diff --git a/test/Index/nested-binaryoperators.cpp b/test/Index/nested-binaryoperators.cpp
index d263b9ddbc21..db5efe2cc8c2 100644
--- a/test/Index/nested-binaryoperators.cpp
+++ b/test/Index/nested-binaryoperators.cpp
@@ -161,8 +161,8 @@ int foo(uint c) {
}
// RUN: c-index-test -test-load-source all %s | FileCheck %s
-// CHECK: 1:22: TypedefDecl=uint:1:22 (Definition) Extent=[1:22 - 1:26]
-// CHECK: 2:5: FunctionDecl=foo:2:5 (Definition) Extent=[2:5 - 161:2]
+// CHECK: 1:22: TypedefDecl=uint:1:22 (Definition) Extent=[1:1 - 1:26]
+// CHECK: 2:5: FunctionDecl=foo:2:5 (Definition) Extent=[2:1 - 161:2]
// CHECK: 2:14: ParmDecl=c:2:14 (Definition) Extent=[2:9 - 2:15]
// CHECK: 2:9: TypeRef=uint:1:22 Extent=[2:9 - 2:13]
// CHECK: 2:17: UnexposedStmt= Extent=[2:17 - 161:2]
diff --git a/test/Index/overrides.cpp b/test/Index/overrides.cpp
index 3dee607e4318..ed24cc5cf59b 100644
--- a/test/Index/overrides.cpp
+++ b/test/Index/overrides.cpp
@@ -16,5 +16,5 @@ struct D : C {
};
// RUN: c-index-test -test-load-source local %s | FileCheck %s
-// CHECK: overrides.cpp:11:16: CXXMethod=g:11:16 [Overrides @7:16] Extent=[11:16 - 11:19]
-// CHECK: overrides.cpp:15:16: CXXMethod=f:15:16 [Overrides @2:16, @6:16] Extent=[15:16 - 15:22]
+// CHECK: overrides.cpp:11:16: CXXMethod=g:11:16 [Overrides @7:16] Extent=[11:3 - 11:19]
+// CHECK: overrides.cpp:15:16: CXXMethod=f:15:16 [Overrides @2:16, @6:16] Extent=[15:3 - 15:22]
diff --git a/test/Index/pragma-diag-reparse.c b/test/Index/pragma-diag-reparse.c
new file mode 100644
index 000000000000..efe59b177841
--- /dev/null
+++ b/test/Index/pragma-diag-reparse.c
@@ -0,0 +1,13 @@
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local %s | FileCheck %s
+
+int main (int argc, const char * argv[])
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ int x;
+#pragma clang diagnostic pop
+
+ return 0;
+}
+
+// CHECK: pragma-diag-reparse.c:7:7: VarDecl=x:7:7 (Definition) Extent=[7:3 - 7:8]
diff --git a/test/Index/preamble-reparse-chained.c b/test/Index/preamble-reparse-chained.c
index 5be3b12f01db..5cc28f705464 100644
--- a/test/Index/preamble-reparse-chained.c
+++ b/test/Index/preamble-reparse-chained.c
@@ -6,5 +6,5 @@
A a;
B b;
-// CHECK: a.h:3:13: TypedefDecl=A:3:13 (Definition) Extent=[3:13 - 3:14]
-// CHECK: b.h:1:15: TypedefDecl=B:1:15 (Definition) Extent=[1:15 - 1:16]
+// CHECK: a.h:3:13: TypedefDecl=A:3:13 (Definition) Extent=[3:1 - 3:14]
+// CHECK: b.h:1:15: TypedefDecl=B:1:15 (Definition) Extent=[1:1 - 1:16]
diff --git a/test/Index/preamble.c b/test/Index/preamble.c
index fb784b389d0a..119bdb58e759 100644
--- a/test/Index/preamble.c
+++ b/test/Index/preamble.c
@@ -8,13 +8,13 @@ void f(int x) {
// RUN: c-index-test -write-pch %t.pch -x c-header %S/Inputs/prefix.h
// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local -I %S/Inputs -include %t %s 2> %t.stderr.txt | FileCheck %s
// RUN: FileCheck -check-prefix CHECK-DIAG %s < %t.stderr.txt
-// CHECK: preamble.h:1:12: FunctionDecl=bar:1:12 (Definition) Extent=[1:12 - 6:2]
+// CHECK: preamble.h:1:12: FunctionDecl=bar:1:12 (Definition) Extent=[1:1 - 6:2]
// CHECK: preamble.h:4:3: UnexposedExpr= Extent=[4:3 - 4:13]
// CHECK: preamble.h:4:3: DeclRefExpr=ptr:2:8 Extent=[4:3 - 4:6]
// CHECK: preamble.h:4:9: UnexposedExpr=ptr1:3:10 Extent=[4:9 - 4:13]
// CHECK: preamble.h:4:9: DeclRefExpr=ptr1:3:10 Extent=[4:9 - 4:13]
// CHECK: preamble.h:5:10: UnexposedExpr= Extent=[5:10 - 5:11]
-// CHECK: preamble.c:3:5: FunctionDecl=wibble:3:5 Extent=[3:5 - 3:16]
+// CHECK: preamble.c:3:5: FunctionDecl=wibble:3:5 Extent=[3:1 - 3:16]
// CHECK: preamble.c:3:15: ParmDecl=:3:15 (Definition) Extent=[3:12 - 3:16]
// CHECK-DIAG: preamble.h:4:7:{4:9-4:13}: warning: incompatible pointer types assigning to 'int *' from 'float *'
// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:6:1 -I %S/Inputs -include %t %s 2> %t.stderr.txt | FileCheck -check-prefix CHECK-CC %s
diff --git a/test/Index/rdar-8288645-invalid-code.mm b/test/Index/rdar-8288645-invalid-code.mm
index 3405f0a93270..74e2365edcfe 100644
--- a/test/Index/rdar-8288645-invalid-code.mm
+++ b/test/Index/rdar-8288645-invalid-code.mm
@@ -5,4 +5,4 @@
extern "C" { @implementation Foo - (id)initWithBar:(Baz<WozBar>)pepper {
// CHECK: warning: cannot find interface declaration for 'Foo'
-// CHECK: warning: '@end' is missing in implementation context
+// CHECK: error: '@end' is missing in implementation context
diff --git a/test/Index/recursive-cxx-member-calls.cpp b/test/Index/recursive-cxx-member-calls.cpp
index 1707491af03e..6170fdcb81d7 100644
--- a/test/Index/recursive-cxx-member-calls.cpp
+++ b/test/Index/recursive-cxx-member-calls.cpp
@@ -201,16 +201,16 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Punctuation: "{" [3:15 - 3:16] Namespace=std:3:11 (Definition)
// CHECK-tokens: Keyword: "template" [4:3 - 4:11] ClassTemplate=pair:4:44 (Definition)
// CHECK-tokens: Punctuation: "<" [4:12 - 4:13] ClassTemplate=pair:4:44 (Definition)
-// CHECK-tokens: Keyword: "class" [4:14 - 4:19] ClassTemplate=pair:4:44 (Definition)
+// CHECK-tokens: Keyword: "class" [4:14 - 4:19] TemplateTypeParameter=_T1:4:20 (Definition)
// CHECK-tokens: Identifier: "_T1" [4:20 - 4:23] TemplateTypeParameter=_T1:4:20 (Definition)
// CHECK-tokens: Punctuation: "," [4:23 - 4:24] ClassTemplate=pair:4:44 (Definition)
-// CHECK-tokens: Keyword: "class" [4:25 - 4:30] ClassTemplate=pair:4:44 (Definition)
+// CHECK-tokens: Keyword: "class" [4:25 - 4:30] TemplateTypeParameter=_T2:4:31 (Definition)
// CHECK-tokens: Identifier: "_T2" [4:31 - 4:34] TemplateTypeParameter=_T2:4:31 (Definition)
// CHECK-tokens: Punctuation: ">" [4:35 - 4:36] ClassTemplate=pair:4:44 (Definition)
// CHECK-tokens: Keyword: "struct" [4:37 - 4:43] ClassTemplate=pair:4:44 (Definition)
// CHECK-tokens: Identifier: "pair" [4:44 - 4:48] ClassTemplate=pair:4:44 (Definition)
// CHECK-tokens: Punctuation: "{" [4:49 - 4:50] ClassTemplate=pair:4:44 (Definition)
-// CHECK-tokens: Identifier: "_T2" [4:51 - 4:54] FieldDecl=second:4:55 (Definition)
+// CHECK-tokens: Identifier: "_T2" [4:51 - 4:54] TypeRef=_T2:4:31
// CHECK-tokens: Identifier: "second" [4:55 - 4:61] FieldDecl=second:4:55 (Definition)
// CHECK-tokens: Punctuation: ";" [4:61 - 4:62] ClassTemplate=pair:4:44 (Definition)
// CHECK-tokens: Punctuation: "}" [4:63 - 4:64] ClassTemplate=pair:4:44 (Definition)
@@ -429,8 +429,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Punctuation: ":" [39:7 - 39:8] UnexposedDecl=:39:1 (Definition)
// CHECK-tokens: Keyword: "typedef" [40:3 - 40:10] ClassDecl=StringRef:38:7 (Definition)
// CHECK-tokens: Keyword: "const" [40:11 - 40:16] ClassDecl=StringRef:38:7 (Definition)
-// CHECK-tokens: Keyword: "char" [40:17 - 40:21] ClassDecl=StringRef:38:7 (Definition)
-// CHECK-tokens: Punctuation: "*" [40:22 - 40:23] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Keyword: "char" [40:17 - 40:21] TypedefDecl=iterator:40:23 (Definition)
+// CHECK-tokens: Punctuation: "*" [40:22 - 40:23] TypedefDecl=iterator:40:23 (Definition)
// CHECK-tokens: Identifier: "iterator" [40:23 - 40:31] TypedefDecl=iterator:40:23 (Definition)
// CHECK-tokens: Punctuation: ";" [40:31 - 40:32] ClassDecl=StringRef:38:7 (Definition)
// CHECK-tokens: Keyword: "static" [41:3 - 41:9] ClassDecl=StringRef:38:7 (Definition)
@@ -679,16 +679,16 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Keyword: "const" [68:30 - 68:35] CXXMethod=getNameStart:68:15 (Definition)
// CHECK-tokens: Punctuation: "{" [68:36 - 68:37] UnexposedStmt=
// CHECK-tokens: Keyword: "typedef" [69:5 - 69:12] UnexposedStmt=
-// CHECK-tokens: Identifier: "std" [69:13 - 69:16] UnexposedStmt=
-// CHECK-tokens: Punctuation: "::" [69:16 - 69:18] UnexposedStmt=
-// CHECK-tokens: Identifier: "pair" [69:18 - 69:22] UnexposedStmt=
-// CHECK-tokens: Punctuation: "<" [69:23 - 69:24] UnexposedStmt=
-// CHECK-tokens: Identifier: "IdentifierInfo" [69:25 - 69:39] UnexposedStmt=
-// CHECK-tokens: Punctuation: "," [69:39 - 69:40] UnexposedStmt=
-// CHECK-tokens: Keyword: "const" [69:41 - 69:46] UnexposedStmt=
-// CHECK-tokens: Keyword: "char" [69:47 - 69:51] UnexposedStmt=
-// CHECK-tokens: Punctuation: "*" [69:52 - 69:53] UnexposedStmt=
-// CHECK-tokens: Punctuation: ">" [69:53 - 69:54] UnexposedStmt=
+// CHECK-tokens: Identifier: "std" [69:13 - 69:16] NamespaceRef=std:3:11
+// CHECK-tokens: Punctuation: "::" [69:16 - 69:18] TypedefDecl=actualtype:69:54 (Definition)
+// CHECK-tokens: Identifier: "pair" [69:18 - 69:22] TemplateRef=pair:4:44
+// CHECK-tokens: Punctuation: "<" [69:23 - 69:24] TypedefDecl=actualtype:69:54 (Definition)
+// CHECK-tokens: Identifier: "IdentifierInfo" [69:25 - 69:39] TypeRef=class clang::IdentifierInfo:66:7
+// CHECK-tokens: Punctuation: "," [69:39 - 69:40] TypedefDecl=actualtype:69:54 (Definition)
+// CHECK-tokens: Keyword: "const" [69:41 - 69:46] TypedefDecl=actualtype:69:54 (Definition)
+// CHECK-tokens: Keyword: "char" [69:47 - 69:51] TypedefDecl=actualtype:69:54 (Definition)
+// CHECK-tokens: Punctuation: "*" [69:52 - 69:53] TypedefDecl=actualtype:69:54 (Definition)
+// CHECK-tokens: Punctuation: ">" [69:53 - 69:54] TypedefDecl=actualtype:69:54 (Definition)
// CHECK-tokens: Identifier: "actualtype" [69:54 - 69:64] TypedefDecl=actualtype:69:54 (Definition)
// CHECK-tokens: Punctuation: ";" [69:64 - 69:65] UnexposedStmt=
// CHECK-tokens: Keyword: "return" [70:5 - 70:11] UnexposedStmt=
@@ -711,16 +711,16 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Keyword: "const" [72:24 - 72:29] CXXMethod=getLength:72:12 (Definition)
// CHECK-tokens: Punctuation: "{" [72:30 - 72:31] UnexposedStmt=
// CHECK-tokens: Keyword: "typedef" [73:5 - 73:12] UnexposedStmt=
-// CHECK-tokens: Identifier: "std" [73:13 - 73:16] UnexposedStmt=
-// CHECK-tokens: Punctuation: "::" [73:16 - 73:18] UnexposedStmt=
-// CHECK-tokens: Identifier: "pair" [73:18 - 73:22] UnexposedStmt=
-// CHECK-tokens: Punctuation: "<" [73:23 - 73:24] UnexposedStmt=
-// CHECK-tokens: Identifier: "IdentifierInfo" [73:25 - 73:39] UnexposedStmt=
-// CHECK-tokens: Punctuation: "," [73:39 - 73:40] UnexposedStmt=
-// CHECK-tokens: Keyword: "const" [73:41 - 73:46] UnexposedStmt=
-// CHECK-tokens: Keyword: "char" [73:47 - 73:51] UnexposedStmt=
-// CHECK-tokens: Punctuation: "*" [73:52 - 73:53] UnexposedStmt=
-// CHECK-tokens: Punctuation: ">" [73:53 - 73:54] UnexposedStmt=
+// CHECK-tokens: Identifier: "std" [73:13 - 73:16] NamespaceRef=std:3:11
+// CHECK-tokens: Punctuation: "::" [73:16 - 73:18] TypedefDecl=actualtype:73:54 (Definition)
+// CHECK-tokens: Identifier: "pair" [73:18 - 73:22] TemplateRef=pair:4:44
+// CHECK-tokens: Punctuation: "<" [73:23 - 73:24] TypedefDecl=actualtype:73:54 (Definition)
+// CHECK-tokens: Identifier: "IdentifierInfo" [73:25 - 73:39] TypeRef=class clang::IdentifierInfo:66:7
+// CHECK-tokens: Punctuation: "," [73:39 - 73:40] TypedefDecl=actualtype:73:54 (Definition)
+// CHECK-tokens: Keyword: "const" [73:41 - 73:46] TypedefDecl=actualtype:73:54 (Definition)
+// CHECK-tokens: Keyword: "char" [73:47 - 73:51] TypedefDecl=actualtype:73:54 (Definition)
+// CHECK-tokens: Punctuation: "*" [73:52 - 73:53] TypedefDecl=actualtype:73:54 (Definition)
+// CHECK-tokens: Punctuation: ">" [73:53 - 73:54] TypedefDecl=actualtype:73:54 (Definition)
// CHECK-tokens: Identifier: "actualtype" [73:54 - 73:64] TypedefDecl=actualtype:73:54 (Definition)
// CHECK-tokens: Punctuation: ";" [73:64 - 73:65] UnexposedStmt=
// CHECK-tokens: Keyword: "const" [74:5 - 74:10] UnexposedStmt=
@@ -771,18 +771,18 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Literal: "1" [75:61 - 75:62] UnexposedExpr=
// CHECK-tokens: Punctuation: ";" [75:62 - 75:63] UnexposedStmt=
// CHECK-tokens: Punctuation: "}" [76:3 - 76:4] UnexposedStmt=
-// CHECK-tokens: Identifier: "llvm" [77:3 - 77:7] CXXMethod=getName:77:19 (Definition)
+// CHECK-tokens: Identifier: "llvm" [77:3 - 77:7] NamespaceRef=llvm:37:11
// CHECK-tokens: Punctuation: "::" [77:7 - 77:9] CXXMethod=getName:77:19 (Definition)
-// CHECK-tokens: Identifier: "StringRef" [77:9 - 77:18] CXXMethod=getName:77:19 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [77:9 - 77:18] TypeRef=class llvm::StringRef:38:7
// CHECK-tokens: Identifier: "getName" [77:19 - 77:26] CXXMethod=getName:77:19 (Definition)
// CHECK-tokens: Punctuation: "(" [77:26 - 77:27] CXXMethod=getName:77:19 (Definition)
// CHECK-tokens: Punctuation: ")" [77:27 - 77:28] CXXMethod=getName:77:19 (Definition)
// CHECK-tokens: Keyword: "const" [77:29 - 77:34] CXXMethod=getName:77:19 (Definition)
// CHECK-tokens: Punctuation: "{" [77:35 - 77:36] UnexposedStmt=
// CHECK-tokens: Keyword: "return" [78:5 - 78:11] UnexposedStmt=
-// CHECK-tokens: Identifier: "llvm" [78:12 - 78:16] CallExpr=StringRef:49:3
+// CHECK-tokens: Identifier: "llvm" [78:12 - 78:16] NamespaceRef=llvm:37:11
// CHECK-tokens: Punctuation: "::" [78:16 - 78:18] CallExpr=StringRef:49:3
-// CHECK-tokens: Identifier: "StringRef" [78:18 - 78:27] CallExpr=StringRef:49:3
+// CHECK-tokens: Identifier: "StringRef" [78:18 - 78:27] TypeRef=class llvm::StringRef:38:7
// CHECK-tokens: Punctuation: "(" [78:27 - 78:28] CallExpr=StringRef:49:3
// CHECK-tokens: Identifier: "getNameStart" [78:28 - 78:40] MemberRefExpr=getNameStart:68:15
// CHECK-tokens: Punctuation: "(" [78:40 - 78:41] CallExpr=getNameStart:68:15
@@ -802,13 +802,13 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Punctuation: "{" [82:16 - 82:17] Namespace=llvm:82:11 (Definition)
// CHECK-tokens: Keyword: "template" [83:1 - 83:9] ClassTemplate=StringSwitch:83:47 (Definition)
// CHECK-tokens: Punctuation: "<" [83:10 - 83:11] ClassTemplate=StringSwitch:83:47 (Definition)
-// CHECK-tokens: Keyword: "typename" [83:12 - 83:20] ClassTemplate=StringSwitch:83:47 (Definition)
+// CHECK-tokens: Keyword: "typename" [83:12 - 83:20] TemplateTypeParameter=T:83:21 (Definition)
// CHECK-tokens: Identifier: "T" [83:21 - 83:22] TemplateTypeParameter=T:83:21 (Definition)
// CHECK-tokens: Punctuation: "," [83:22 - 83:23] ClassTemplate=StringSwitch:83:47 (Definition)
-// CHECK-tokens: Keyword: "typename" [83:24 - 83:32] ClassTemplate=StringSwitch:83:47 (Definition)
+// CHECK-tokens: Keyword: "typename" [83:24 - 83:32] TemplateTypeParameter=R:83:33 (Definition)
// CHECK-tokens: Identifier: "R" [83:33 - 83:34] TemplateTypeParameter=R:83:33 (Definition)
-// CHECK-tokens: Punctuation: "=" [83:35 - 83:36] ClassTemplate=StringSwitch:83:47 (Definition)
-// CHECK-tokens: Identifier: "T" [83:37 - 83:38] ClassTemplate=StringSwitch:83:47 (Definition)
+// CHECK-tokens: Punctuation: "=" [83:35 - 83:36] TemplateTypeParameter=R:83:33 (Definition)
+// CHECK-tokens: Identifier: "T" [83:37 - 83:38] TypeRef=T:83:21
// CHECK-tokens: Punctuation: ">" [83:39 - 83:40] ClassTemplate=StringSwitch:83:47 (Definition)
// CHECK-tokens: Keyword: "class" [83:41 - 83:46] ClassTemplate=StringSwitch:83:47 (Definition)
// CHECK-tokens: Identifier: "StringSwitch" [83:47 - 83:59] ClassTemplate=StringSwitch:83:47 (Definition)
@@ -817,13 +817,13 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Identifier: "Str" [84:13 - 84:16] FieldDecl=Str:84:13 (Definition)
// CHECK-tokens: Punctuation: ";" [84:16 - 84:17] ClassTemplate=StringSwitch:83:47 (Definition)
// CHECK-tokens: Keyword: "const" [85:3 - 85:8] ClassTemplate=StringSwitch:83:47 (Definition)
-// CHECK-tokens: Identifier: "T" [85:9 - 85:10] FieldDecl=Result:85:12 (Definition)
+// CHECK-tokens: Identifier: "T" [85:9 - 85:10] TypeRef=T:83:21
// CHECK-tokens: Punctuation: "*" [85:11 - 85:12] FieldDecl=Result:85:12 (Definition)
// CHECK-tokens: Identifier: "Result" [85:12 - 85:18] FieldDecl=Result:85:12 (Definition)
// CHECK-tokens: Punctuation: ";" [85:18 - 85:19] ClassTemplate=StringSwitch:83:47 (Definition)
// CHECK-tokens: Keyword: "public" [86:1 - 86:7] UnexposedDecl=:86:1 (Definition)
// CHECK-tokens: Punctuation: ":" [86:7 - 86:8] UnexposedDecl=:86:1 (Definition)
-// CHECK-tokens: Keyword: "explicit" [87:3 - 87:11] ClassTemplate=StringSwitch:83:47 (Definition)
+// CHECK-tokens: Keyword: "explicit" [87:3 - 87:11] CXXConstructor=StringSwitch<T, R>:87:12 (Definition)
// CHECK-tokens: Identifier: "StringSwitch" [87:12 - 87:24] CXXConstructor=StringSwitch<T, R>:87:12 (Definition)
// CHECK-tokens: Punctuation: "(" [87:24 - 87:25] CXXConstructor=StringSwitch<T, R>:87:12 (Definition)
// CHECK-tokens: Identifier: "StringRef" [87:25 - 87:34] TypeRef=class llvm::StringRef:38:7
@@ -858,10 +858,10 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Punctuation: ")" [88:61 - 88:62] ParmDecl=S:88:60 (Definition)
// CHECK-tokens: Punctuation: "[" [88:62 - 88:63] ParmDecl=S:88:60 (Definition)
// CHECK-tokens: Identifier: "N" [88:63 - 88:64] DeclRefExpr=N:88:23
-// CHECK-tokens: Punctuation: "]" [88:64 - 88:65] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Punctuation: "]" [88:64 - 88:65] ParmDecl=S:88:60 (Definition)
// CHECK-tokens: Punctuation: "," [88:65 - 88:66] FunctionTemplate=Case:88:42 (Definition)
// CHECK-tokens: Keyword: "const" [89:47 - 89:52] FunctionTemplate=Case:88:42 (Definition)
-// CHECK-tokens: Identifier: "T" [89:53 - 89:54] ParmDecl=Value:89:57 (Definition)
+// CHECK-tokens: Identifier: "T" [89:53 - 89:54] TypeRef=T:83:21
// CHECK-tokens: Punctuation: "&" [89:55 - 89:56] ParmDecl=Value:89:57 (Definition)
// CHECK-tokens: Identifier: "Value" [89:57 - 89:62] ParmDecl=Value:89:57 (Definition)
// CHECK-tokens: Punctuation: ")" [89:62 - 89:63] FunctionTemplate=Case:88:42 (Definition)
@@ -871,11 +871,11 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Keyword: "this" [90:13 - 90:17] UnexposedExpr=
// CHECK-tokens: Punctuation: ";" [90:17 - 90:18] UnexposedStmt=
// CHECK-tokens: Punctuation: "}" [91:3 - 91:4] UnexposedStmt=
-// CHECK-tokens: Identifier: "R" [92:3 - 92:4] CXXMethod=Default:92:5 (Definition)
+// CHECK-tokens: Identifier: "R" [92:3 - 92:4] TypeRef=R:83:33
// CHECK-tokens: Identifier: "Default" [92:5 - 92:12] CXXMethod=Default:92:5 (Definition)
// CHECK-tokens: Punctuation: "(" [92:12 - 92:13] CXXMethod=Default:92:5 (Definition)
// CHECK-tokens: Keyword: "const" [92:13 - 92:18] CXXMethod=Default:92:5 (Definition)
-// CHECK-tokens: Identifier: "T" [92:19 - 92:20] ParmDecl=Value:92:23 (Definition)
+// CHECK-tokens: Identifier: "T" [92:19 - 92:20] TypeRef=T:83:21
// CHECK-tokens: Punctuation: "&" [92:21 - 92:22] ParmDecl=Value:92:23 (Definition)
// CHECK-tokens: Identifier: "Value" [92:23 - 92:28] ParmDecl=Value:92:23 (Definition)
// CHECK-tokens: Punctuation: ")" [92:28 - 92:29] CXXMethod=Default:92:5 (Definition)
@@ -892,9 +892,9 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Keyword: "namespace" [98:7 - 98:16] UsingDirective=:98:17
// CHECK-tokens: Identifier: "clang" [98:17 - 98:22] NamespaceRef=clang:10:17
// CHECK-tokens: Punctuation: ";" [98:22 - 98:23]
-// CHECK-tokens: Identifier: "AttributeList" [100:1 - 100:14] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Identifier: "AttributeList" [100:1 - 100:14] TypeRef=class clang::AttributeList:12:9
// CHECK-tokens: Punctuation: "::" [100:14 - 100:16] CXXMethod=getKind:100:36 (Definition)
-// CHECK-tokens: Identifier: "Kind" [100:16 - 100:20] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Identifier: "Kind" [100:16 - 100:20] TypeRef=enum clang::AttributeList::Kind:13:10
// CHECK-tokens: Identifier: "AttributeList" [100:21 - 100:34] TypeRef=class clang::AttributeList:12:9
// CHECK-tokens: Punctuation: "::" [100:34 - 100:36] CXXMethod=getKind:100:36 (Definition)
// CHECK-tokens: Identifier: "getKind" [100:36 - 100:43] CXXMethod=getKind:100:36 (Definition)
@@ -905,9 +905,9 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Identifier: "Name" [100:67 - 100:71] ParmDecl=Name:100:67 (Definition)
// CHECK-tokens: Punctuation: ")" [100:71 - 100:72] CXXMethod=getKind:100:36 (Definition)
// CHECK-tokens: Punctuation: "{" [100:73 - 100:74] UnexposedStmt=
-// CHECK-tokens: Identifier: "llvm" [101:3 - 101:7] VarDecl=AttrName:101:19 (Definition)
+// CHECK-tokens: Identifier: "llvm" [101:3 - 101:7] NamespaceRef=llvm:82:11
// CHECK-tokens: Punctuation: "::" [101:7 - 101:9] VarDecl=AttrName:101:19 (Definition)
-// CHECK-tokens: Identifier: "StringRef" [101:9 - 101:18] VarDecl=AttrName:101:19 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [101:9 - 101:18] TypeRef=class llvm::StringRef:38:7
// CHECK-tokens: Identifier: "AttrName" [101:19 - 101:27] VarDecl=AttrName:101:19 (Definition)
// CHECK-tokens: Punctuation: "=" [101:28 - 101:29] VarDecl=AttrName:101:19 (Definition)
// CHECK-tokens: Identifier: "Name" [101:30 - 101:34] DeclRefExpr=Name:100:67
@@ -950,13 +950,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Punctuation: ")" [103:54 - 103:55] CallExpr=substr:60:13
// CHECK-tokens: Punctuation: ";" [103:55 - 103:56] UnexposedStmt=
// CHECK-tokens: Keyword: "return" [105:3 - 105:9] UnexposedStmt=
-// CHECK-tokens: Identifier: "llvm" [105:10 - 105:14] UnexposedStmt=
-// CHECK-tokens: Punctuation: "::" [105:14 - 105:16] UnexposedStmt=
+// FIXME: Missing "llvm" namespace reference below
+// CHECK-tokens: Identifier: "llvm" [105:10 - 105:14] NamespaceRef=llvm:82:11
+// CHECK-tokens: Punctuation: "::" [105:14 - 105:16] UnexposedExpr=StringSwitch:87:12
// CHECK-tokens: Identifier: "StringSwitch" [105:16 - 105:28] TemplateRef=StringSwitch:83:47
-// CHECK-tokens: Punctuation: "<" [105:29 - 105:30] CallExpr=StringSwitch:87:12
-// CHECK-tokens: Identifier: "AttributeList" [105:31 - 105:44] CallExpr=StringSwitch:87:12
-// CHECK-tokens: Punctuation: "::" [105:44 - 105:46] CallExpr=StringSwitch:87:12
-// CHECK-tokens: Identifier: "Kind" [105:46 - 105:50] CallExpr=StringSwitch:87:12
+// CHECK-tokens: Punctuation: "<" [105:29 - 105:30] UnexposedExpr=StringSwitch:87:12
+// CHECK-tokens: Identifier: "AttributeList" [105:31 - 105:44] TypeRef=class clang::AttributeList:12:9
+// CHECK-tokens: Punctuation: "::" [105:44 - 105:46] UnexposedExpr=StringSwitch:87:12
+// CHECK-tokens: Identifier: "Kind" [105:46 - 105:50] TypeRef=enum clang::AttributeList::Kind:13:10
// CHECK-tokens: Punctuation: ">" [105:51 - 105:52] CallExpr=StringSwitch:87:12
// CHECK-tokens: Punctuation: "(" [105:53 - 105:54] CallExpr=StringSwitch:87:12
// CHECK-tokens: Identifier: "AttrName" [105:54 - 105:62] DeclRefExpr=AttrName:101:19
@@ -1523,24 +1524,24 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK-tokens: Punctuation: "}" [186:1 - 186:2] UnexposedStmt=
// RUN: c-index-test -test-load-source all %s 2>&1 | FileCheck %s
-// CHECK: 1:27: TypedefDecl=__darwin_size_t:1:27 (Definition) Extent=[1:27 - 1:42]
-// CHECK: 2:25: TypedefDecl=size_t:2:25 (Definition) Extent=[2:25 - 2:31]
+// CHECK: 1:27: TypedefDecl=__darwin_size_t:1:27 (Definition) Extent=[1:1 - 1:42]
+// CHECK: 2:25: TypedefDecl=size_t:2:25 (Definition) Extent=[2:1 - 2:31]
// CHECK: 2:9: TypeRef=__darwin_size_t:1:27 Extent=[2:9 - 2:24]
-// CHECK: 3:11: Namespace=std:3:11 (Definition) Extent=[3:11 - 5:2]
+// CHECK: 3:11: Namespace=std:3:11 (Definition) Extent=[3:1 - 5:2]
// CHECK: 4:44: ClassTemplate=pair:4:44 (Definition) Extent=[4:3 - 4:64]
-// CHECK: 4:20: TemplateTypeParameter=_T1:4:20 (Definition) Extent=[4:20 - 4:23]
-// CHECK: 4:31: TemplateTypeParameter=_T2:4:31 (Definition) Extent=[4:31 - 4:34]
-// CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:55 - 4:61]
-// CHECK: 6:8: UnexposedDecl=:6:8 (Definition) Extent=[6:8 - 6:11]
-// CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:7 - 7:49]
-// CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:20 - 7:27]
-// CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:34 - 7:41]
+// CHECK: 4:20: TemplateTypeParameter=_T1:4:20 (Definition) Extent=[4:14 - 4:23]
+// CHECK: 4:31: TemplateTypeParameter=_T2:4:31 (Definition) Extent=[4:25 - 4:34]
+// CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:51 - 4:61]
+// CHECK: 6:8: UnexposedDecl=:6:8 (Definition) Extent=[6:1 - 9:2]
+// CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:3 - 7:49]
+// CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:14 - 7:27]
+// CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:28 - 7:41]
// CHECK: 7:48: ParmDecl=:7:48 (Definition) Extent=[7:42 - 7:49]
// CHECK: 7:42: TypeRef=size_t:2:25 Extent=[7:42 - 7:48]
-// CHECK: 8:10: FunctionDecl=strlen:8:10 Extent=[8:10 - 8:30]
+// CHECK: 8:10: FunctionDecl=strlen:8:10 Extent=[8:3 - 8:30]
// CHECK: 8:3: TypeRef=size_t:2:25 Extent=[8:3 - 8:9]
-// CHECK: 8:29: ParmDecl=:8:29 (Definition) Extent=[8:23 - 8:30]
-// CHECK: 10:17: Namespace=clang:10:17 (Definition) Extent=[10:17 - 35:2]
+// CHECK: 8:29: ParmDecl=:8:29 (Definition) Extent=[8:17 - 8:30]
+// CHECK: 10:17: Namespace=clang:10:17 (Definition) Extent=[10:1 - 35:2]
// CHECK: 11:9: ClassDecl=IdentifierInfo:11:9 Extent=[11:3 - 11:23]
// CHECK: 12:9: ClassDecl=AttributeList:12:9 (Definition) Extent=[12:3 - 34:4]
// CHECK: 13:10: EnumDecl=Kind:13:10 (Definition) Extent=[13:5 - 32:6]
@@ -1615,18 +1616,18 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 30:40: EnumConstantDecl=AT_init_priority:30:40 (Definition) Extent=[30:40 - 30:56]
// CHECK: 31:7: EnumConstantDecl=IgnoredAttribute:31:7 (Definition) Extent=[31:7 - 31:23]
// CHECK: 31:25: EnumConstantDecl=UnknownAttribute:31:25 (Definition) Extent=[31:25 - 31:41]
-// CHECK: 33:17: CXXMethod=getKind:33:17 Extent=[33:17 - 33:53]
+// CHECK: 33:17: CXXMethod=getKind:33:17 Extent=[33:5 - 33:53]
// CHECK: 33:12: TypeRef=enum clang::AttributeList::Kind:13:10 Extent=[33:12 - 33:16]
-// CHECK: 33:48: ParmDecl=Name:33:48 (Definition) Extent=[33:31 - 33:52]
+// CHECK: 33:48: ParmDecl=Name:33:48 (Definition) Extent=[33:25 - 33:52]
// CHECK: 33:31: TypeRef=class clang::IdentifierInfo:66:7 Extent=[33:31 - 33:45]
-// CHECK: 36:8: FunctionDecl=magic_length:36:8 Extent=[36:8 - 36:35]
+// CHECK: 36:8: FunctionDecl=magic_length:36:8 Extent=[36:1 - 36:35]
// CHECK: 36:1: TypeRef=size_t:2:25 Extent=[36:1 - 36:7]
-// CHECK: 36:33: ParmDecl=s:36:33 (Definition) Extent=[36:27 - 36:34]
-// CHECK: 37:11: Namespace=llvm:37:11 (Definition) Extent=[37:11 - 64:2]
+// CHECK: 36:33: ParmDecl=s:36:33 (Definition) Extent=[36:21 - 36:34]
+// CHECK: 37:11: Namespace=llvm:37:11 (Definition) Extent=[37:1 - 64:2]
// CHECK: 38:7: ClassDecl=StringRef:38:7 (Definition) Extent=[38:1 - 63:2]
// CHECK: 39:1: UnexposedDecl=:39:1 (Definition) Extent=[39:1 - 39:8]
-// CHECK: 40:23: TypedefDecl=iterator:40:23 (Definition) Extent=[40:23 - 40:31]
-// CHECK: 41:23: VarDecl=npos:41:23 Extent=[41:16 - 41:40]
+// CHECK: 40:23: TypedefDecl=iterator:40:23 (Definition) Extent=[40:3 - 40:31]
+// CHECK: 41:23: VarDecl=npos:41:23 Extent=[41:3 - 41:40]
// CHECK: 41:16: TypeRef=size_t:2:25 Extent=[41:16 - 41:22]
// CHECK: 41:30: UnexposedExpr= Extent=[41:30 - 41:40]
// CHECK: 41:31: UnexposedExpr= Extent=[41:31 - 41:40]
@@ -1634,10 +1635,10 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 41:38: UnexposedExpr= Extent=[41:38 - 41:39]
// CHECK: 41:38: UnexposedExpr= Extent=[41:38 - 41:39]
// CHECK: 42:1: UnexposedDecl=:42:1 (Definition) Extent=[42:1 - 42:9]
-// CHECK: 43:15: FieldDecl=Data:43:15 (Definition) Extent=[43:15 - 43:19]
-// CHECK: 44:10: FieldDecl=Length:44:10 (Definition) Extent=[44:10 - 44:16]
+// CHECK: 43:15: FieldDecl=Data:43:15 (Definition) Extent=[43:3 - 43:19]
+// CHECK: 44:10: FieldDecl=Length:44:10 (Definition) Extent=[44:3 - 44:16]
// CHECK: 44:3: TypeRef=size_t:2:25 Extent=[44:3 - 44:9]
-// CHECK: 45:17: CXXMethod=min:45:17 (Definition) Extent=[45:17 - 45:66]
+// CHECK: 45:17: CXXMethod=min:45:17 (Definition) Extent=[45:3 - 45:66]
// CHECK: 45:10: TypeRef=size_t:2:25 Extent=[45:10 - 45:16]
// CHECK: 45:28: ParmDecl=a:45:28 (Definition) Extent=[45:21 - 45:29]
// CHECK: 45:21: TypeRef=size_t:2:25 Extent=[45:21 - 45:27]
@@ -1661,7 +1662,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 47:32: UnexposedExpr= Extent=[47:32 - 47:33]
// CHECK: 47:35: UnexposedStmt= Extent=[47:35 - 47:37]
// CHECK: 48:3: CXXConstructor=StringRef:48:3 (Definition) Extent=[48:3 - 48:71]
-// CHECK: 48:25: ParmDecl=Str:48:25 (Definition) Extent=[48:19 - 48:28]
+// CHECK: 48:25: ParmDecl=Str:48:25 (Definition) Extent=[48:13 - 48:28]
// CHECK: 48:32: MemberRef=Data:43:15 Extent=[48:32 - 48:36]
// CHECK: 48:37: DeclRefExpr=Str:48:25 Extent=[48:37 - 48:40]
// CHECK: 48:43: MemberRef=Length:44:10 Extent=[48:43 - 48:49]
@@ -1671,7 +1672,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 48:63: DeclRefExpr=Str:48:25 Extent=[48:63 - 48:66]
// CHECK: 48:69: UnexposedStmt= Extent=[48:69 - 48:71]
// CHECK: 49:3: CXXConstructor=StringRef:49:3 (Definition) Extent=[49:3 - 49:77]
-// CHECK: 49:25: ParmDecl=data:49:25 (Definition) Extent=[49:19 - 49:29]
+// CHECK: 49:25: ParmDecl=data:49:25 (Definition) Extent=[49:13 - 49:29]
// CHECK: 49:38: ParmDecl=length:49:38 (Definition) Extent=[49:31 - 49:44]
// CHECK: 49:31: TypeRef=size_t:2:25 Extent=[49:31 - 49:37]
// CHECK: 49:48: MemberRef=Data:43:15 Extent=[49:48 - 49:52]
@@ -1679,17 +1680,17 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 49:60: MemberRef=Length:44:10 Extent=[49:60 - 49:66]
// CHECK: 49:67: DeclRefExpr=length:49:38 Extent=[49:67 - 49:73]
// CHECK: 49:75: UnexposedStmt= Extent=[49:75 - 49:77]
-// CHECK: 50:12: CXXMethod=end:50:12 (Definition) Extent=[50:12 - 50:40]
+// CHECK: 50:12: CXXMethod=end:50:12 (Definition) Extent=[50:3 - 50:40]
// CHECK: 50:3: TypeRef=iterator:40:23 Extent=[50:3 - 50:11]
// CHECK: 50:24: UnexposedStmt= Extent=[50:24 - 50:40]
// CHECK: 50:26: UnexposedStmt= Extent=[50:26 - 50:37]
// CHECK: 50:33: MemberRefExpr=Data:43:15 Extent=[50:33 - 50:37]
-// CHECK: 51:10: CXXMethod=size:51:10 (Definition) Extent=[51:10 - 51:41]
+// CHECK: 51:10: CXXMethod=size:51:10 (Definition) Extent=[51:3 - 51:41]
// CHECK: 51:3: TypeRef=size_t:2:25 Extent=[51:3 - 51:9]
// CHECK: 51:23: UnexposedStmt= Extent=[51:23 - 51:41]
// CHECK: 51:25: UnexposedStmt= Extent=[51:25 - 51:38]
// CHECK: 51:32: MemberRefExpr=Length:44:10 Extent=[51:32 - 51:38]
-// CHECK: 52:8: CXXMethod=startswith:52:8 (Definition) Extent=[52:8 - 55:4]
+// CHECK: 52:8: CXXMethod=startswith:52:8 (Definition) Extent=[52:3 - 55:4]
// CHECK: 52:29: ParmDecl=Prefix:52:29 (Definition) Extent=[52:19 - 52:35]
// CHECK: 52:19: TypeRef=class llvm::StringRef:38:7 Extent=[52:19 - 52:28]
// CHECK: 52:43: UnexposedStmt= Extent=[52:43 - 55:4]
@@ -1712,7 +1713,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 54:44: MemberRefExpr=Length:44:10 Extent=[54:37 - 54:50]
// CHECK: 54:37: DeclRefExpr=Prefix:52:29 Extent=[54:37 - 54:43]
// CHECK: 54:55: UnexposedExpr= Extent=[54:55 - 54:56]
-// CHECK: 56:8: CXXMethod=endswith:56:8 (Definition) Extent=[56:8 - 59:4]
+// CHECK: 56:8: CXXMethod=endswith:56:8 (Definition) Extent=[56:3 - 59:4]
// CHECK: 56:27: ParmDecl=Suffix:56:27 (Definition) Extent=[56:17 - 56:33]
// CHECK: 56:17: TypeRef=class llvm::StringRef:38:7 Extent=[56:17 - 56:26]
// CHECK: 56:41: UnexposedStmt= Extent=[56:41 - 59:4]
@@ -1739,7 +1740,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 58:57: MemberRefExpr=Length:44:10 Extent=[58:50 - 58:63]
// CHECK: 58:50: DeclRefExpr=Suffix:56:27 Extent=[58:50 - 58:56]
// CHECK: 58:68: UnexposedExpr= Extent=[58:68 - 58:69]
-// CHECK: 60:13: CXXMethod=substr:60:13 (Definition) Extent=[60:13 - 62:4]
+// CHECK: 60:13: CXXMethod=substr:60:13 (Definition) Extent=[60:3 - 62:4]
// CHECK: 60:3: TypeRef=class llvm::StringRef:38:7 Extent=[60:3 - 60:12]
// CHECK: 60:27: ParmDecl=Start:60:27 (Definition) Extent=[60:20 - 60:32]
// CHECK: 60:20: TypeRef=size_t:2:25 Extent=[60:20 - 60:26]
@@ -1764,14 +1765,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 61:43: UnexposedExpr=Length:44:10 Extent=[61:43 - 61:49]
// CHECK: 61:43: MemberRefExpr=Length:44:10 Extent=[61:43 - 61:49]
// CHECK: 61:52: DeclRefExpr=Start:60:27 Extent=[61:52 - 61:57]
-// CHECK: 65:11: Namespace=clang:65:11 (Definition) Extent=[65:11 - 81:2]
+// CHECK: 65:11: Namespace=clang:65:11 (Definition) Extent=[65:1 - 81:2]
// CHECK: 66:7: ClassDecl=IdentifierInfo:66:7 (Definition) Extent=[66:1 - 80:2]
// CHECK: 67:1: UnexposedDecl=:67:1 (Definition) Extent=[67:1 - 67:8]
// CHECK: 67:8: CXXConstructor=IdentifierInfo:67:8 Extent=[67:8 - 67:24]
-// CHECK: 68:15: CXXMethod=getNameStart:68:15 (Definition) Extent=[68:15 - 71:4]
+// CHECK: 68:15: CXXMethod=getNameStart:68:15 (Definition) Extent=[68:3 - 71:4]
// CHECK: 68:36: UnexposedStmt= Extent=[68:36 - 71:4]
// CHECK: 69:5: UnexposedStmt= Extent=[69:5 - 69:65]
-// CHECK: 69:54: TypedefDecl=actualtype:69:54 (Definition) Extent=[69:54 - 69:64]
+// CHECK: 69:54: TypedefDecl=actualtype:69:54 (Definition) Extent=[69:5 - 69:64]
// CHECK: 69:18: TemplateRef=pair:4:44 Extent=[69:18 - 69:22]
// CHECK: 69:25: TypeRef=class clang::IdentifierInfo:66:7 Extent=[69:25 - 69:39]
// CHECK: 70:5: UnexposedStmt= Extent=[70:5 - 70:47]
@@ -1780,14 +1781,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:38]
// CHECK: 70:20: TypeRef=actualtype:69:54 Extent=[70:20 - 70:30]
// CHECK: 70:34: UnexposedExpr= Extent=[70:34 - 70:38]
-// CHECK: 72:12: CXXMethod=getLength:72:12 (Definition) Extent=[72:12 - 76:4]
+// CHECK: 72:12: CXXMethod=getLength:72:12 (Definition) Extent=[72:3 - 76:4]
// CHECK: 72:30: UnexposedStmt= Extent=[72:30 - 76:4]
// CHECK: 73:5: UnexposedStmt= Extent=[73:5 - 73:65]
-// CHECK: 73:54: TypedefDecl=actualtype:73:54 (Definition) Extent=[73:54 - 73:64]
+// CHECK: 73:54: TypedefDecl=actualtype:73:54 (Definition) Extent=[73:5 - 73:64]
// CHECK: 73:18: TemplateRef=pair:4:44 Extent=[73:18 - 73:22]
// CHECK: 73:25: TypeRef=class clang::IdentifierInfo:66:7 Extent=[73:25 - 73:39]
// CHECK: 74:5: UnexposedStmt= Extent=[74:5 - 74:61]
-// CHECK: 74:17: VarDecl=p:74:17 (Definition) Extent=[74:11 - 74:60]
+// CHECK: 74:17: VarDecl=p:74:17 (Definition) Extent=[74:5 - 74:60]
// CHECK: 74:21: UnexposedExpr= Extent=[74:21 - 74:60]
// CHECK: 74:21: UnexposedExpr=second:4:55 Extent=[74:21 - 74:56]
// CHECK: 74:50: MemberRefExpr=second:4:55 Extent=[74:21 - 74:56]
@@ -1819,7 +1820,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 75:55: UnexposedExpr= Extent=[75:55 - 75:56]
// CHECK: 75:61: UnexposedExpr= Extent=[75:61 - 75:62]
// CHECK: 75:61: UnexposedExpr= Extent=[75:61 - 75:62]
-// CHECK: 77:19: CXXMethod=getName:77:19 (Definition) Extent=[77:19 - 79:4]
+// CHECK: 77:19: CXXMethod=getName:77:19 (Definition) Extent=[77:3 - 79:4]
// CHECK: 77:35: UnexposedStmt= Extent=[77:35 - 79:4]
// CHECK: 78:5: UnexposedStmt= Extent=[78:5 - 78:56]
// CHECK: 78:12: CallExpr= Extent=[78:12 - 78:56]
@@ -1830,15 +1831,15 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 78:44: UnexposedExpr=getLength:72:12 Extent=[78:44 - 78:55]
// CHECK: 78:44: CallExpr=getLength:72:12 Extent=[78:44 - 78:55]
// CHECK: 78:44: MemberRefExpr=getLength:72:12 Extent=[78:44 - 78:53]
-// CHECK: 82:11: Namespace=llvm:82:11 (Definition) Extent=[82:11 - 96:2]
+// CHECK: 82:11: Namespace=llvm:82:11 (Definition) Extent=[82:1 - 96:2]
// CHECK: 83:47: ClassTemplate=StringSwitch:83:47 (Definition) Extent=[83:1 - 95:2]
-// CHECK: 83:21: TemplateTypeParameter=T:83:21 (Definition) Extent=[83:21 - 83:22]
-// CHECK: 83:33: TemplateTypeParameter=R:83:33 (Definition) Extent=[83:33 - 83:34]
-// CHECK: 84:13: FieldDecl=Str:84:13 (Definition) Extent=[84:13 - 84:16]
+// CHECK: 83:21: TemplateTypeParameter=T:83:21 (Definition) Extent=[83:12 - 83:22]
+// CHECK: 83:33: TemplateTypeParameter=R:83:33 (Definition) Extent=[83:24 - 83:38]
+// CHECK: 84:13: FieldDecl=Str:84:13 (Definition) Extent=[84:3 - 84:16]
// CHECK: 84:3: TypeRef=class llvm::StringRef:38:7 Extent=[84:3 - 84:12]
-// CHECK: 85:12: FieldDecl=Result:85:12 (Definition) Extent=[85:12 - 85:18]
+// CHECK: 85:12: FieldDecl=Result:85:12 (Definition) Extent=[85:3 - 85:18]
// CHECK: 86:1: UnexposedDecl=:86:1 (Definition) Extent=[86:1 - 86:8]
-// CHECK: 87:12: CXXConstructor=StringSwitch<T, R>:87:12 (Definition) Extent=[87:12 - 87:64]
+// CHECK: 87:12: CXXConstructor=StringSwitch<T, R>:87:12 (Definition) Extent=[87:3 - 87:64]
// CHECK: 87:35: ParmDecl=Str:87:35 (Definition) Extent=[87:25 - 87:38]
// CHECK: 87:25: TypeRef=class llvm::StringRef:38:7 Extent=[87:25 - 87:34]
// CHECK: 87:42: MemberRef=Str:84:13 Extent=[87:42 - 87:45]
@@ -1850,23 +1851,23 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 87:62: UnexposedStmt= Extent=[87:62 - 87:64]
// CHECK: 88:42: FunctionTemplate=Case:88:42 (Definition) Extent=[88:3 - 91:4]
// CHECK: 88:23: NonTypeTemplateParameter=N:88:23 (Definition) Extent=[88:14 - 88:24]
-// CHECK: 88:60: ParmDecl=S:88:60 (Definition) Extent=[88:53 - 88:61]
+// CHECK: 88:60: ParmDecl=S:88:60 (Definition) Extent=[88:47 - 88:65]
// CHECK: 88:63: DeclRefExpr=N:88:23 Extent=[88:63 - 88:64]
-// CHECK: 89:57: ParmDecl=Value:89:57 (Definition) Extent=[89:53 - 89:62]
+// CHECK: 89:57: ParmDecl=Value:89:57 (Definition) Extent=[89:47 - 89:62]
// CHECK: 89:64: UnexposedStmt= Extent=[89:64 - 91:4]
// CHECK: 90:5: UnexposedStmt= Extent=[90:5 - 90:17]
// CHECK: 90:12: UnexposedExpr= Extent=[90:12 - 90:17]
// CHECK: 90:13: UnexposedExpr= Extent=[90:13 - 90:17]
-// CHECK: 92:5: CXXMethod=Default:92:5 (Definition) Extent=[92:5 - 94:4]
-// CHECK: 92:23: ParmDecl=Value:92:23 (Definition) Extent=[92:19 - 92:28]
+// CHECK: 92:5: CXXMethod=Default:92:5 (Definition) Extent=[92:3 - 94:4]
+// CHECK: 92:23: ParmDecl=Value:92:23 (Definition) Extent=[92:13 - 92:28]
// CHECK: 92:36: UnexposedStmt= Extent=[92:36 - 94:4]
// CHECK: 93:5: UnexposedStmt= Extent=[93:5 - 93:17]
// CHECK: 93:12: DeclRefExpr=Value:92:23 Extent=[93:12 - 93:17]
// CHECK: 98:17: UsingDirective=:98:17 Extent=[98:1 - 98:22]
// CHECK: 98:17: NamespaceRef=clang:10:17 Extent=[98:17 - 98:22]
-// CHECK: 100:36: CXXMethod=getKind:100:36 (Definition) Extent=[100:36 - 186:2]
+// CHECK: 100:36: CXXMethod=getKind:100:36 (Definition) Extent=[100:1 - 186:2]
// CHECK: 100:21: TypeRef=class clang::AttributeList:12:9 Extent=[100:21 - 100:34]
-// CHECK: 100:67: ParmDecl=Name:100:67 (Definition) Extent=[100:50 - 100:71]
+// CHECK: 100:67: ParmDecl=Name:100:67 (Definition) Extent=[100:44 - 100:71]
// CHECK: 100:50: TypeRef=class clang::IdentifierInfo:66:7 Extent=[100:50 - 100:64]
// CHECK: 100:73: UnexposedStmt= Extent=[100:73 - 186:2]
// CHECK: 101:3: UnexposedStmt= Extent=[101:3 - 101:46]
@@ -1917,170 +1918,170 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
// CHECK: 103:53: UnexposedExpr= Extent=[103:53 - 103:54]
// CHECK: 103:53: UnexposedExpr= Extent=[103:53 - 103:54]
// CHECK: 105:3: UnexposedStmt= Extent=[105:3 - 185:31]
-// CHECK: 105:16: CallExpr=Default:92:5 Extent=[105:16 - 185:31]
-// CHECK: 185:6: MemberRefExpr=Default:92:5 Extent=[105:16 - 185:13]
-// CHECK: 105:16: UnexposedExpr=Case:88:42 Extent=[105:16 - 184:33]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 184:33]
-// CHECK: 184:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 184:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 183:37]
-// CHECK: 183:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 183:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 182:37]
-// CHECK: 182:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 182:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 181:35]
-// CHECK: 181:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 181:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 180:31]
-// CHECK: 180:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 180:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 179:31]
-// CHECK: 179:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 179:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 178:35]
-// CHECK: 178:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 178:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 177:63]
-// CHECK: 177:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 177:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 176:45]
-// CHECK: 176:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 176:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 175:51]
-// CHECK: 175:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 175:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 174:49]
-// CHECK: 174:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 174:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 173:49]
-// CHECK: 173:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 173:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 172:53]
-// CHECK: 172:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 172:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 171:57]
-// CHECK: 171:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 171:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 170:65]
-// CHECK: 170:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 170:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 169:57]
-// CHECK: 169:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 169:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 168:65]
-// CHECK: 168:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 168:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 167:55]
-// CHECK: 167:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 167:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 166:55]
-// CHECK: 166:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 166:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 165:53]
-// CHECK: 165:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 165:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 164:53]
-// CHECK: 164:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 164:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 163:49]
-// CHECK: 163:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 163:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 162:47]
-// CHECK: 162:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 162:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 161:45]
-// CHECK: 161:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 161:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 160:45]
-// CHECK: 160:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 160:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 159:45]
-// CHECK: 159:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 159:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 158:45]
-// CHECK: 158:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 158:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 157:43]
-// CHECK: 157:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 157:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 156:41]
-// CHECK: 156:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 156:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 155:41]
-// CHECK: 155:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 155:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 154:41]
-// CHECK: 154:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 154:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 153:37]
-// CHECK: 153:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 153:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 152:41]
-// CHECK: 152:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 152:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 151:39]
-// CHECK: 151:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 151:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 150:39]
-// CHECK: 150:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 150:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 149:39]
-// CHECK: 149:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 149:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 148:39]
-// CHECK: 148:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 148:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 147:39]
-// CHECK: 147:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 147:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 146:39]
-// CHECK: 146:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 146:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 145:41]
-// CHECK: 145:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 145:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 144:37]
-// CHECK: 144:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 144:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 143:37]
-// CHECK: 143:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 143:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 142:35]
-// CHECK: 142:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 142:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 141:35]
-// CHECK: 141:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 141:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 140:35]
-// CHECK: 140:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 140:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 139:35]
-// CHECK: 139:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 139:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 138:35]
-// CHECK: 138:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 138:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 137:55]
-// CHECK: 137:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 137:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 136:35]
-// CHECK: 136:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 136:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 135:35]
-// CHECK: 135:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 135:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 134:35]
-// CHECK: 134:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 134:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 133:35]
-// CHECK: 133:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 133:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 132:33]
-// CHECK: 132:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 132:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 131:33]
-// CHECK: 131:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 131:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 130:33]
-// CHECK: 130:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 130:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 129:33]
-// CHECK: 129:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 129:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 128:33]
-// CHECK: 128:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 128:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 127:33]
-// CHECK: 127:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 127:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 126:33]
-// CHECK: 126:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 126:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 125:29]
-// CHECK: 125:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 125:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 124:33]
-// CHECK: 124:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 124:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 123:33]
-// CHECK: 123:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 123:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 122:31]
-// CHECK: 122:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 122:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 121:31]
-// CHECK: 121:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 121:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 120:31]
-// CHECK: 120:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 120:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 119:31]
-// CHECK: 119:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 119:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 118:31]
-// CHECK: 118:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 118:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 117:31]
-// CHECK: 117:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 117:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 116:31]
-// CHECK: 116:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 116:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 115:29]
-// CHECK: 115:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 115:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 114:29]
-// CHECK: 114:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 114:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 113:29]
-// CHECK: 113:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 113:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 112:31]
-// CHECK: 112:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 112:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 111:29]
-// CHECK: 111:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 111:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 110:27]
-// CHECK: 110:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 110:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 109:27]
-// CHECK: 109:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 109:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 108:27]
-// CHECK: 108:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 108:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 107:33]
-// CHECK: 107:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 107:10]
-// CHECK: 105:16: CallExpr=Case:88:42 Extent=[105:16 - 106:27]
-// CHECK: 106:6: MemberRefExpr=Case:88:42 Extent=[105:16 - 106:10]
-// CHECK: 105:16: UnexposedExpr=StringSwitch:87:12 Extent=[105:16 - 105:63]
+// CHECK: 105:10: CallExpr=Default:92:5 Extent=[105:10 - 185:31]
+// CHECK: 185:6: MemberRefExpr=Default:92:5 Extent=[105:10 - 185:13]
+// CHECK: 105:10: UnexposedExpr=Case:88:42 Extent=[105:10 - 184:33]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 184:33]
+// CHECK: 184:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 184:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 183:37]
+// CHECK: 183:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 183:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 182:37]
+// CHECK: 182:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 182:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 181:35]
+// CHECK: 181:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 181:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 180:31]
+// CHECK: 180:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 180:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 179:31]
+// CHECK: 179:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 179:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 178:35]
+// CHECK: 178:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 178:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 177:63]
+// CHECK: 177:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 177:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 176:45]
+// CHECK: 176:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 176:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 175:51]
+// CHECK: 175:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 175:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 174:49]
+// CHECK: 174:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 174:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 173:49]
+// CHECK: 173:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 173:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 172:53]
+// CHECK: 172:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 172:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 171:57]
+// CHECK: 171:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 171:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 170:65]
+// CHECK: 170:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 170:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 169:57]
+// CHECK: 169:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 169:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 168:65]
+// CHECK: 168:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 168:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 167:55]
+// CHECK: 167:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 167:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 166:55]
+// CHECK: 166:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 166:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 165:53]
+// CHECK: 165:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 165:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 164:53]
+// CHECK: 164:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 164:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 163:49]
+// CHECK: 163:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 163:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 162:47]
+// CHECK: 162:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 162:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 161:45]
+// CHECK: 161:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 161:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 160:45]
+// CHECK: 160:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 160:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 159:45]
+// CHECK: 159:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 159:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 158:45]
+// CHECK: 158:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 158:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 157:43]
+// CHECK: 157:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 157:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 156:41]
+// CHECK: 156:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 156:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 155:41]
+// CHECK: 155:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 155:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 154:41]
+// CHECK: 154:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 154:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 153:37]
+// CHECK: 153:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 153:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 152:41]
+// CHECK: 152:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 152:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 151:39]
+// CHECK: 151:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 151:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 150:39]
+// CHECK: 150:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 150:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 149:39]
+// CHECK: 149:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 149:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 148:39]
+// CHECK: 148:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 148:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 147:39]
+// CHECK: 147:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 147:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 146:39]
+// CHECK: 146:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 146:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 145:41]
+// CHECK: 145:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 145:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 144:37]
+// CHECK: 144:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 144:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 143:37]
+// CHECK: 143:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 143:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 142:35]
+// CHECK: 142:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 142:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 141:35]
+// CHECK: 141:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 141:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 140:35]
+// CHECK: 140:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 140:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 139:35]
+// CHECK: 139:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 139:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 138:35]
+// CHECK: 138:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 138:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 137:55]
+// CHECK: 137:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 137:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 136:35]
+// CHECK: 136:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 136:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 135:35]
+// CHECK: 135:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 135:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 134:35]
+// CHECK: 134:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 134:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 133:35]
+// CHECK: 133:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 133:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 132:33]
+// CHECK: 132:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 132:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 131:33]
+// CHECK: 131:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 131:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 130:33]
+// CHECK: 130:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 130:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 129:33]
+// CHECK: 129:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 129:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 128:33]
+// CHECK: 128:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 128:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 127:33]
+// CHECK: 127:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 127:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 126:33]
+// CHECK: 126:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 126:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 125:29]
+// CHECK: 125:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 125:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 124:33]
+// CHECK: 124:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 124:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 123:33]
+// CHECK: 123:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 123:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 122:31]
+// CHECK: 122:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 122:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 121:31]
+// CHECK: 121:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 121:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 120:31]
+// CHECK: 120:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 120:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 119:31]
+// CHECK: 119:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 119:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 118:31]
+// CHECK: 118:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 118:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 117:31]
+// CHECK: 117:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 117:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 116:31]
+// CHECK: 116:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 116:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 115:29]
+// CHECK: 115:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 115:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 114:29]
+// CHECK: 114:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 114:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 113:29]
+// CHECK: 113:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 113:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 112:31]
+// CHECK: 112:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 112:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 111:29]
+// CHECK: 111:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 111:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 110:27]
+// CHECK: 110:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 110:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 109:27]
+// CHECK: 109:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 109:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 108:27]
+// CHECK: 108:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 108:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 107:33]
+// CHECK: 107:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 107:10]
+// CHECK: 105:10: CallExpr=Case:88:42 Extent=[105:10 - 106:27]
+// CHECK: 106:6: MemberRefExpr=Case:88:42 Extent=[105:10 - 106:10]
+// CHECK: 105:10: UnexposedExpr=StringSwitch:87:12 Extent=[105:10 - 105:63]
// CHECK: 105:16: TemplateRef=StringSwitch:83:47 Extent=[105:16 - 105:28]
-// CHECK: 105:16: CallExpr=StringSwitch:87:12 Extent=[105:16 - 105:62]
+// CHECK: 105:10: CallExpr=StringSwitch:87:12 Extent=[105:10 - 105:62]
// CHECK: 105:54: CallExpr=StringRef:38:7 Extent=[105:54 - 105:62]
// CHECK: 105:54: UnexposedExpr=AttrName:101:19 Extent=[105:54 - 105:62]
// CHECK: 105:54: DeclRefExpr=AttrName:101:19 Extent=[105:54 - 105:62]
diff --git a/test/Index/recursive-member-access.c b/test/Index/recursive-member-access.c
index c76fa0e50401..87855ca36159 100644
--- a/test/Index/recursive-member-access.c
+++ b/test/Index/recursive-member-access.c
@@ -125,11 +125,11 @@ int test_rdar8650865(struct rdar8650865 *s) {
// RUN: c-index-test -test-load-source all %s | FileCheck %s
// CHECK: 1:8: StructDecl=rdar8650865:1:8 (Definition) Extent=[1:1 - 4:2]
-// CHECK: 2:23: FieldDecl=first:2:23 (Definition) Extent=[2:23 - 2:28]
+// CHECK: 2:23: FieldDecl=first:2:23 (Definition) Extent=[2:3 - 2:28]
// CHECK: 2:10: TypeRef=struct rdar8650865:1:8 Extent=[2:10 - 2:21]
-// CHECK: 3:7: FieldDecl=x:3:7 (Definition) Extent=[3:7 - 3:8]
-// CHECK: 6:5: FunctionDecl=test_rdar8650865:6:5 (Definition) Extent=[6:5 - 124:2]
-// CHECK: 6:42: ParmDecl=s:6:42 (Definition) Extent=[6:29 - 6:43]
+// CHECK: 3:7: FieldDecl=x:3:7 (Definition) Extent=[3:3 - 3:8]
+// CHECK: 6:5: FunctionDecl=test_rdar8650865:6:5 (Definition) Extent=[6:1 - 124:2]
+// CHECK: 6:42: ParmDecl=s:6:42 (Definition) Extent=[6:22 - 6:43]
// CHECK: 6:29: TypeRef=struct rdar8650865:1:8 Extent=[6:29 - 6:40]
// CHECK: 6:45: UnexposedStmt= Extent=[6:45 - 124:2]
// CHECK: 7:3: UnexposedStmt= Extent=[7:3 - 123:8]
@@ -257,7 +257,7 @@ int test_rdar8650865(struct rdar8650865 *s) {
// CHECK-tokens: Keyword: "struct" [1:1 - 1:7] StructDecl=rdar8650865:1:8 (Definition)
// CHECK-tokens: Identifier: "rdar8650865" [1:8 - 1:19] StructDecl=rdar8650865:1:8 (Definition)
// CHECK-tokens: Punctuation: "{" [1:20 - 1:21] StructDecl=rdar8650865:1:8 (Definition)
-// CHECK-tokens: Keyword: "struct" [2:3 - 2:9] StructDecl=rdar8650865:1:8 (Definition)
+// CHECK-tokens: Keyword: "struct" [2:3 - 2:9] FieldDecl=first:2:23 (Definition)
// CHECK-tokens: Identifier: "rdar8650865" [2:10 - 2:21] TypeRef=struct rdar8650865:1:8
// CHECK-tokens: Punctuation: "*" [2:22 - 2:23] FieldDecl=first:2:23 (Definition)
// CHECK-tokens: Identifier: "first" [2:23 - 2:28] FieldDecl=first:2:23 (Definition)
@@ -270,7 +270,7 @@ int test_rdar8650865(struct rdar8650865 *s) {
// CHECK-tokens: Keyword: "int" [6:1 - 6:4] FunctionDecl=test_rdar8650865:6:5 (Definition)
// CHECK-tokens: Identifier: "test_rdar8650865" [6:5 - 6:21] FunctionDecl=test_rdar8650865:6:5 (Definition)
// CHECK-tokens: Punctuation: "(" [6:21 - 6:22] FunctionDecl=test_rdar8650865:6:5 (Definition)
-// CHECK-tokens: Keyword: "struct" [6:22 - 6:28] FunctionDecl=test_rdar8650865:6:5 (Definition)
+// CHECK-tokens: Keyword: "struct" [6:22 - 6:28] ParmDecl=s:6:42 (Definition)
// CHECK-tokens: Identifier: "rdar8650865" [6:29 - 6:40] TypeRef=struct rdar8650865:1:8
// CHECK-tokens: Punctuation: "*" [6:41 - 6:42] ParmDecl=s:6:42 (Definition)
// CHECK-tokens: Identifier: "s" [6:42 - 6:43] ParmDecl=s:6:42 (Definition)
diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c
index d54c3a107682..5a8f46b7f3d8 100644
--- a/test/Index/remap-load.c
+++ b/test/Index/remap-load.c
@@ -1,6 +1,6 @@
// RUN: c-index-test -test-load-source all -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck -check-prefix=CHECK %s
-// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:5 - 3:2]
+// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:1 - 3:2]
// CHECK: remap-load.c:1:13: ParmDecl=parm1:1:13 (Definition) Extent=[1:9 - 1:18]
// CHECK: remap-load.c:1:26: ParmDecl=parm2:1:26 (Definition) Extent=[1:20 - 1:31]
// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23]
diff --git a/test/Index/usrs-cxx0x.cpp b/test/Index/usrs-cxx0x.cpp
index a0ea6ba69cf0..50aee0968867 100644
--- a/test/Index/usrs-cxx0x.cpp
+++ b/test/Index/usrs-cxx0x.cpp
@@ -5,4 +5,4 @@ void f(tuple<int, float, double>);
// RUN: c-index-test -test-load-source-usrs all -std=c++0x %s | FileCheck %s
// CHECK: usrs-cxx0x.cpp c:@ST>1#pT@tuple Extent=[1:1 - 2:17]
-// CHECK: usrs-cxx0x.cpp c:@F@f#$@S@tuple>#p3Ifd# Extent=[4:6 - 4:34]
+// CHECK: usrs-cxx0x.cpp c:@F@f#$@S@tuple>#p3Ifd# Extent=[4:1 - 4:34]
diff --git a/test/Index/usrs.cpp b/test/Index/usrs.cpp
index 698aded84381..a43b6893ebfb 100644
--- a/test/Index/usrs.cpp
+++ b/test/Index/usrs.cpp
@@ -66,55 +66,55 @@ using foo::ClsB;
namespace foo_alias3 = foo;
// RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
-// CHECK: usrs.cpp c:@N@foo Extent=[1:11 - 4:2]
+// CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2]
// CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
-// CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:8 - 3:18]
+// CHECK: usrs.cpp c:@N@foo@F@bar#I# Extent=[3:3 - 3:18]
// CHECK: usrs.cpp c:usrs.cpp@36@N@foo@F@bar#I#@z Extent=[3:12 - 3:17]
-// CHECK: usrs.cpp c:@N@bar Extent=[5:11 - 8:2]
-// CHECK: usrs.cpp c:usrs.cpp@76@N@bar@T@QType Extent=[6:15 - 6:20]
-// CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:8 - 7:20]
+// CHECK: usrs.cpp c:@N@bar Extent=[5:1 - 8:2]
+// CHECK: usrs.cpp c:usrs.cpp@64@N@bar@T@QType Extent=[6:3 - 6:20]
+// CHECK: usrs.cpp c:@N@bar@F@bar#I# Extent=[7:3 - 7:20]
// CHECK: usrs.cpp c:usrs.cpp@94@N@bar@F@bar#I#@z Extent=[7:12 - 7:19]
// CHECK: usrs.cpp c:@C@ClsA Extent=[10:1 - 14:2]
// CHECK: usrs.cpp c: Extent=[11:1 - 11:8]
-// CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:7 - 12:8]
-// CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:10 - 12:11]
+// CHECK: usrs.cpp c:@C@ClsA@FI@a Extent=[12:3 - 12:8]
+// CHECK: usrs.cpp c:@C@ClsA@FI@b Extent=[12:3 - 12:11]
// CHECK: usrs.cpp c:@C@ClsA@F@ClsA#I#I# Extent=[13:3 - 13:37]
// CHECK: usrs.cpp c:usrs.cpp@147@C@ClsA@F@ClsA#I#I#@A Extent=[13:8 - 13:13]
// CHECK: usrs.cpp c:usrs.cpp@154@C@ClsA@F@ClsA#I#I#@B Extent=[13:15 - 13:20]
-// CHECK: usrs.cpp c:@N@foo Extent=[16:11 - 22:2]
+// CHECK: usrs.cpp c:@N@foo Extent=[16:1 - 22:2]
// CHECK: usrs.cpp c:@N@foo@C@ClsB Extent=[17:3 - 21:4]
// CHECK: usrs.cpp c: Extent=[18:3 - 18:10]
// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@ClsB# Extent=[19:5 - 19:27]
-// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:9 - 20:17]
-// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:16 - 26:2]
+// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:5 - 20:23]
+// CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:1 - 26:2]
// CHECK: usrs.cpp c:@aN@C@ClsC Extent=[29:3 - 29:35]
// CHECK: usrs.cpp c:@aN@w Extent=[30:3 - 30:8]
// CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6]
-// CHECK: usrs.cpp c:@N@foo Extent=[35:11 - 40:2]
-// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:27 - 39:2]
+// CHECK: usrs.cpp c:@N@foo Extent=[35:1 - 40:2]
+// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:17 - 39:2]
// CHECK: usrs.cpp c:@N@foo@N@taz@x Extent=[36:3 - 36:8]
-// CHECK: usrs.cpp c:usrs.cpp@475@N@foo@N@taz@F@add#I#I# Extent=[37:21 - 37:56]
+// CHECK: usrs.cpp c:usrs.cpp@457@N@foo@N@taz@F@add#I#I# Extent=[37:3 - 37:56]
// CHECK: usrs.cpp c:usrs.cpp@479@N@foo@N@taz@F@add#I#I#@a Extent=[37:25 - 37:30]
// CHECK: usrs.cpp c:usrs.cpp@486@N@foo@N@taz@F@add#I#I#@b Extent=[37:32 - 37:37]
-// CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:8 - 38:25]
+// CHECK: usrs.cpp c:@N@foo@N@taz@F@sub#I#I# Extent=[38:3 - 38:25]
// CHECK: usrs.cpp c:usrs.cpp@522@N@foo@N@taz@F@sub#I#I#@a Extent=[38:12 - 38:17]
// CHECK: usrs.cpp c:usrs.cpp@529@N@foo@N@taz@F@sub#I#I#@b Extent=[38:19 - 38:24]
-// CHECK: usrs.cpp c:@N@foo Extent=[42:11 - 52:3]
-// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:27 - 52:2]
+// CHECK: usrs.cpp c:@N@foo Extent=[42:1 - 52:3]
+// CHECK: usrs.cpp c:@N@foo@N@taz Extent=[42:17 - 52:2]
// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD Extent=[43:3 - 51:4]
// CHECK: usrs.cpp c: Extent=[44:3 - 44:10]
-// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:11 - 45:52]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#I# Extent=[45:5 - 45:52]
// CHECK: usrs.cpp c:usrs.cpp@638@N@foo@N@taz@C@ClsD@F@operator=#I#@x Extent=[45:21 - 45:26]
-// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:11 - 46:61]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#d# Extent=[46:5 - 46:61]
// CHECK: usrs.cpp c:usrs.cpp@690@N@foo@N@taz@C@ClsD@F@operator=#d#@x Extent=[46:21 - 46:29]
-// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:11 - 47:62]
-// CHECK: usrs.cpp c:usrs.cpp@757@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:27 - 47:34]
-// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:16 - 48:21]
-// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:16 - 49:30]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD# Extent=[47:5 - 47:62]
+// CHECK: usrs.cpp c:usrs.cpp@751@N@foo@N@taz@C@ClsD@F@operator=#&1$@N@foo@N@taz@C@ClsD#@x Extent=[47:21 - 47:34]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@qux#S Extent=[48:5 - 48:21]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@uz#I.#S Extent=[49:5 - 49:30]
// CHECK: usrs.cpp c:usrs.cpp@833@N@foo@N@taz@C@ClsD@F@uz#I.#S@z Extent=[49:19 - 49:24]
-// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1 Extent=[50:10 - 50:62]
-// CHECK: usrs.cpp c:usrs.cpp@872@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:27 - 50:34]
-// CHECK: usrs.cpp c:@F@rez Extent=[55:8 - 55:25]
+// CHECK: usrs.cpp c:@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1 Extent=[50:5 - 50:62]
+// CHECK: usrs.cpp c:usrs.cpp@866@N@foo@N@taz@C@ClsD@F@operator==#&1$@N@foo@N@taz@C@ClsD#1@x Extent=[50:21 - 50:34]
+// CHECK: usrs.cpp c:@F@rez Extent=[55:3 - 55:25]
// CHECK: usrs.cpp c:usrs.cpp@941@F@rez@a Extent=[55:12 - 55:17]
// CHECK: usrs.cpp c:usrs.cpp@948@F@rez@b Extent=[55:19 - 55:24]
// CHECK: usrs.cpp c:@NA@foo_alias
diff --git a/test/Index/usrs.m b/test/Index/usrs.m
index edfb81437d87..4b79fdcbba8d 100644
--- a/test/Index/usrs.m
+++ b/test/Index/usrs.m
@@ -80,7 +80,7 @@ int test_multi_declaration(void) {
- (void)method;
@end
-// CHECK: usrs.m c:usrs.m@85@F@my_helper Extent=[3:19 - 3:60]
+// CHECK: usrs.m c:usrs.m@67@F@my_helper Extent=[3:1 - 3:60]
// CHECK: usrs.m c:usrs.m@95@F@my_helper@x Extent=[3:29 - 3:34]
// CHECK: usrs.m c:usrs.m@102@F@my_helper@y Extent=[3:36 - 3:41]
// CHECK: usrs.m c:usrs.m@128@Ea Extent=[5:1 - 8:2]
@@ -90,15 +90,15 @@ int test_multi_declaration(void) {
// CHECK: usrs.m c:usrs.m@155@Ea@FOO Extent=[11:3 - 11:6]
// CHECK: usrs.m c:usrs.m@155@Ea@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:usrs.m@219@T@MyStruct Extent=[18:3 - 18:11]
+// CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:3 - 16:9]
+// CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:3 - 17:10]
+// CHECK: usrs.m c:usrs.m@179@T@MyStruct Extent=[15:1 - 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@x Extent=[26:3 - 26:7]
+// CHECK: usrs.m c:objc(cs)Foo@y Extent=[27:3 - 27:7]
// 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(py)d1 Extent=[31:1 - 31:17]
@@ -107,14 +107,14 @@ int test_multi_declaration(void) {
// CHECK: usrs.m c:usrs.m@352objc(cs)Foo(im)setD1:@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@409objc(cs)Foo(im)godzilla@a Extent=[36:10 - 36:19]
-// CHECK: usrs.m c:objc(cs)Foo(im)godzilla@z Extent=[37:10 - 37:15]
+// CHECK: usrs.m c:usrs.m@402objc(cs)Foo(im)godzilla@a Extent=[36:3 - 36:19]
+// CHECK: usrs.m c:objc(cs)Foo(im)godzilla@z Extent=[37:3 - 37:15]
// CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[40:1 - 43:2]
// CHECK: usrs.m c:usrs.m@470objc(cs)Foo(cm)kingkong@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@540@F@local_func Extent=[49:12 - 49:43]
+// CHECK: usrs.m c:usrs.m@529@F@local_func Extent=[49:1 - 49:43]
// CHECK: usrs.m c:usrs.m@551@F@local_func@x Extent=[49:23 - 49:28]
// CHECK: usrs.m c:objc(cs)CWithExt Extent=[51:1 - 53:5]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth1 Extent=[52:1 - 52:14]
@@ -130,8 +130,8 @@ int test_multi_declaration(void) {
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth3 Extent=[66:1 - 66:27]
// CHECK: usrs.m c:objc(cy)CWithExt@Bar Extent=[68:1 - 70:2]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth4 Extent=[69:1 - 69:27]
-// CHECK: usrs.m c:@F@aux_1 Extent=[72:6 - 72:26]
-// CHECK: usrs.m c:@F@test_multi_declaration Extent=[73:5 - 77:2]
+// CHECK: usrs.m c:@F@aux_1 Extent=[72:1 - 72:26]
+// CHECK: usrs.m c:@F@test_multi_declaration Extent=[73:1 - 77:2]
// CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@foo Extent=[74:3 - 74:14]
// CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@bar Extent=[74:16 - 74:23]
// CHECK: usrs.m c:usrs.m@980@F@test_multi_declaration@baz Extent=[74:25 - 74:32]
@@ -139,7 +139,7 @@ int test_multi_declaration(void) {
// CHECK: usrs.m c:objc(pl)P1(im)method Extent=[80:1 - 80:16]
// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-source %s
-// CHECK-source: usrs.m:3:19: FunctionDecl=my_helper:3:19 (Definition) Extent=[3:19 - 3:60]
+// CHECK-source: usrs.m:3:19: FunctionDecl=my_helper:3:19 (Definition) Extent=[3:1 - 3:60]
// CHECK-source: usrs.m:3:33: ParmDecl=x:3:33 (Definition) Extent=[3:29 - 3:34]
// CHECK-source: usrs.m:3:40: ParmDecl=y:3:40 (Definition) Extent=[3:36 - 3:41]
// CHECK-source: usrs.m:3:43: UnexposedStmt= Extent=[3:43 - 3:60]
@@ -154,17 +154,17 @@ int test_multi_declaration(void) {
// CHECK-source: usrs.m:11:3: EnumConstantDecl=FOO:11:3 (Definition) Extent=[11:3 - 11:6]
// CHECK-source: usrs.m:12:3: EnumConstantDecl=BAR:12:3 (Definition) Extent=[12:3 - 12:6]
// CHECK-source: usrs.m:15:9: StructDecl=:15:9 (Definition) Extent=[15:9 - 18:2]
-// CHECK-source: usrs.m:16:7: FieldDecl=wa:16:7 (Definition) Extent=[16:7 - 16:9]
-// CHECK-source: usrs.m:17:7: FieldDecl=moo:17:7 (Definition) Extent=[17:7 - 17:10]
-// CHECK-source: usrs.m:18:3: TypedefDecl=MyStruct:18:3 (Definition) Extent=[18:3 - 18:11]
+// CHECK-source: usrs.m:16:7: FieldDecl=wa:16:7 (Definition) Extent=[16:3 - 16:9]
+// CHECK-source: usrs.m:17:7: FieldDecl=moo:17:7 (Definition) Extent=[17:3 - 17:10]
+// CHECK-source: usrs.m:18:3: TypedefDecl=MyStruct:18:3 (Definition) Extent=[15:1 - 18:11]
// CHECK-source: usrs.m:15:9: TypeRef=MyStruct:15:9 Extent=[15:9 - 15:15]
// CHECK-source: usrs.m:20:6: EnumDecl=Pizza:20:6 (Definition) Extent=[20:1 - 23:2]
// CHECK-source: usrs.m:21:3: EnumConstantDecl=CHEESE:21:3 (Definition) Extent=[21:3 - 21:9]
// CHECK-source: usrs.m:22:3: EnumConstantDecl=MUSHROOMS:22:3 (Definition) Extent=[22:3 - 22:12]
// CHECK-source: usrs.m:25:12: ObjCInterfaceDecl=Foo:25:12 Extent=[25:1 - 32:5]
-// CHECK-source: usrs.m:26:6: ObjCIvarDecl=x:26:6 (Definition) Extent=[26:6 - 26:7]
+// CHECK-source: usrs.m:26:6: ObjCIvarDecl=x:26:6 (Definition) Extent=[26:3 - 26:7]
// CHECK-source: usrs.m:26:3: TypeRef=id:0:0 Extent=[26:3 - 26:5]
-// CHECK-source: usrs.m:27:6: ObjCIvarDecl=y:27:6 (Definition) Extent=[27:6 - 27:7]
+// CHECK-source: usrs.m:27:6: ObjCIvarDecl=y:27:6 (Definition) Extent=[27:3 - 27:7]
// CHECK-source: usrs.m:27:3: TypeRef=id:0:0 Extent=[27:3 - 27:5]
// CHECK-source: usrs.m:29:1: ObjCInstanceMethodDecl=godzilla:29:1 Extent=[29:1 - 29:17]
// CHECK-source: usrs.m:29:4: TypeRef=id:0:0 Extent=[29:4 - 29:6]
@@ -179,10 +179,10 @@ int test_multi_declaration(void) {
// CHECK-source: usrs.m:35:4: TypeRef=id:0:0 Extent=[35:4 - 35:6]
// CHECK-source: usrs.m:35:17: UnexposedStmt= Extent=[35:17 - 39:2]
// CHECK-source: usrs.m:36:3: UnexposedStmt= Extent=[36:3 - 36:20]
-// CHECK-source: usrs.m:36:14: VarDecl=a:36:14 (Definition) Extent=[36:10 - 36:19]
+// CHECK-source: usrs.m:36:14: VarDecl=a:36:14 (Definition) Extent=[36:3 - 36:19]
// CHECK-source: usrs.m:36:18: UnexposedExpr= Extent=[36:18 - 36:19]
// CHECK-source: usrs.m:37:3: UnexposedStmt= Extent=[37:3 - 37:16]
-// CHECK-source: usrs.m:37:14: VarDecl=z:37:14 Extent=[37:10 - 37:15]
+// CHECK-source: usrs.m:37:14: VarDecl=z:37:14 Extent=[37:3 - 37:15]
// CHECK-source: usrs.m:38:3: UnexposedStmt= Extent=[38:3 - 38:11]
// CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11]
// CHECK-source: usrs.m:38:10: UnexposedExpr= Extent=[38:10 - 38:11]
@@ -197,7 +197,7 @@ int test_multi_declaration(void) {
// CHECK-source: usrs.m:44:13: ObjCIvarDecl=d1:44:13 (Definition) Extent=[44:13 - 44:15]
// CHECK-source: usrs.m:44:13: UnexposedDecl=d1:31:15 (Definition) Extent=[44:1 - 44:15]
// CHECK-source: usrs.m:47:5: VarDecl=z:47:5 Extent=[47:1 - 47:6]
-// CHECK-source: usrs.m:49:12: FunctionDecl=local_func:49:12 (Definition) Extent=[49:12 - 49:43]
+// CHECK-source: usrs.m:49:12: FunctionDecl=local_func:49:12 (Definition) Extent=[49:1 - 49:43]
// CHECK-source: usrs.m:49:27: ParmDecl=x:49:27 (Definition) Extent=[49:23 - 49:28]
// CHECK-source: usrs.m:49:30: UnexposedStmt= Extent=[49:30 - 49:43]
// CHECK-source: usrs.m:49:32: UnexposedStmt= Extent=[49:32 - 49:40]
@@ -244,11 +244,11 @@ int test_multi_declaration(void) {
// CHECK-source: usrs.m:69:16: UnexposedStmt= Extent=[69:16 - 69:24]
// CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24]
// CHECK-source: usrs.m:69:23: UnexposedExpr= Extent=[69:23 - 69:24]
-// CHECK-source: usrs.m:72:6: FunctionDecl=aux_1:72:6 Extent=[72:6 - 72:26]
+// CHECK-source: usrs.m:72:6: FunctionDecl=aux_1:72:6 Extent=[72:1 - 72:26]
// CHECK-source: usrs.m:72:15: ParmDecl=:72:15 (Definition) Extent=[72:12 - 72:16]
// CHECK-source: usrs.m:72:20: ParmDecl=:72:20 (Definition) Extent=[72:17 - 72:21]
// CHECK-source: usrs.m:72:25: ParmDecl=:72:25 (Definition) Extent=[72:22 - 72:26]
-// CHECK-source: usrs.m:73:5: FunctionDecl=test_multi_declaration:73:5 (Definition) Extent=[73:5 - 77:2]
+// CHECK-source: usrs.m:73:5: FunctionDecl=test_multi_declaration:73:5 (Definition) Extent=[73:1 - 77:2]
// CHECK-source: usrs.m:73:34: UnexposedStmt= Extent=[73:34 - 77:2]
// CHECK-source: usrs.m:74:3: UnexposedStmt= Extent=[74:3 - 74:33]
// CHECK-source: usrs.m:74:7: VarDecl=foo:74:7 (Definition) Extent=[74:3 - 74:14]
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index 07a3ebd38d3a..57949e301773 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -41,6 +41,16 @@ int no_auto_type();
// CHECK-NO-0X: no_auto_type
+#if __has_feature(cxx_trailing_return)
+int has_trailing_return();
+#else
+int no_trailing_return();
+#endif
+
+// CHECK-0X: has_trailing_return
+// CHECK-NO-0X: no_trailing_return
+
+
#if __has_feature(cxx_attributes)
int has_attributes();
#else
@@ -99,6 +109,17 @@ int no_inline_namespaces();
// CHECK-0X: has_inline_namespaces
// CHECK-NO-0X: no_inline_namespaces
+
+#if __has_feature(cxx_range_for)
+int has_range_for();
+#else
+int no_range_for();
+#endif
+
+// CHECK-0X: has_range_for
+// CHECK-NO-0X: no_range_for
+
+
#if __has_feature(cxx_reference_qualified_functions)
int has_reference_qualified_functions();
#else
@@ -117,3 +138,20 @@ int no_default_function_template_args();
// CHECK-0X: has_default_function_template_args
// CHECK-NO-0X: no_default_function_template_args
+#if __has_feature(cxx_noexcept)
+int has_noexcept();
+#else
+int no_noexcept();
+#endif
+
+// CHECK-0X: has_noexcept
+// CHECK-NO-0X: no_noexcept
+
+#if __has_feature(cxx_override_control)
+int has_override_control();
+#else
+int no_override_control();
+#endif
+
+// CHECK-0X: has_override_control
+// CHECK-NO-0X: no_override_control
diff --git a/test/Lexer/pragma-message.c b/test/Lexer/pragma-message.c
index 710568cc2de6..807edda66a0c 100644
--- a/test/Lexer/pragma-message.c
+++ b/test/Lexer/pragma-message.c
@@ -7,7 +7,7 @@
// OR
// #pragma message messagestring
//
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Werror %s
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#pragma message(":O I'm a message! " STRING(__LINE__)) // expected-warning {{:O I'm a message! 13}}
diff --git a/test/Makefile b/test/Makefile
index b0c829c255e6..050c3a51ddec 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -38,30 +38,32 @@ FORCE:
lit.site.cfg: FORCE
@echo "Making Clang 'lit.site.cfg' file..."
- @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
- -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
- -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
- -e "s#@LLVM_LIBS_DIR@#$(LibDir)#g" \
- -e "s#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \
- -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \
- -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \
- $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
+ @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > lit.tmp
+ @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
+ @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
+ @$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> lit.tmp
+ @$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> lit.tmp
+ @$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> lit.tmp
+ @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
+ @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
+ @-rm -f lit.tmp
Unit/lit.site.cfg: FORCE
@echo "Making Clang 'Unit/lit.site.cfg' file..."
@$(MKDIR) $(dir $@)
- @sed -e "s#@LLVM_SOURCE_DIR@#$(LLVM_SRC_ROOT)#g" \
- -e "s#@LLVM_BINARY_DIR@#$(LLVM_OBJ_ROOT)#g" \
- -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
- -e "s#@LLVM_LIBS_DIR@#$(LibDir)#g" \
- -e "s#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \
- -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \
- -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \
- -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
- -e "s#@ENABLE_SHARED@#$(ENABLE_SHARED)#g" \
- -e "s#@SHLIBDIR@#$(SharedLibDir)#g" \
- -e "s#@SHLIBPATH_VAR@#$(SHLIBPATH_VAR)#g" \
- $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
+ @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > unit.tmp
+ @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> unit.tmp
+ @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> unit.tmp
+ @$(ECHOPATH) s=@LLVM_LIBS_DIR@=$(LibDir)=g >> unit.tmp
+ @$(ECHOPATH) s=@CLANG_SOURCE_DIR@=$(PROJ_SRC_DIR)/..=g >> unit.tmp
+ @$(ECHOPATH) s=@CLANG_BINARY_DIR@=$(PROJ_OBJ_DIR)/..=g >> unit.tmp
+ @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> unit.tmp
+ @$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> unit.tmp
+ @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> unit.tmp
+ @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> unit.tmp
+ @$(ECHOPATH) s=@SHLIBPATH_VAR@=$(SHLIBPATH_VAR)=g >> unit.tmp
+ @sed -f unit.tmp $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
+ @-rm -f unit.tmp
clean::
@ find . -name Output | xargs rm -fr
diff --git a/test/Misc/Inputs/include.h b/test/Misc/Inputs/include.h
new file mode 100644
index 000000000000..d325775691de
--- /dev/null
+++ b/test/Misc/Inputs/include.h
@@ -0,0 +1 @@
+int foo(int x) { return x; }
diff --git a/test/Misc/caret-diags-macros.c b/test/Misc/caret-diags-macros.c
index e138f59d608c..e45ad2a60518 100644
--- a/test/Misc/caret-diags-macros.c
+++ b/test/Misc/caret-diags-macros.c
@@ -1,27 +1,24 @@
-// RUN: %clang_cc1 -fsyntax-only %s > %t 2>&1
+// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s
#define M1(x) x
-
-// RUN: grep ":6:12: note: instantiated from:" %t
#define M2 1;
-
void foo() {
- // RUN: grep ":10:2: warning: expression result unused" %t
- M1(
- // RUN: grep ":12:5: note: instantiated from:" %t
- M2)
+ M1(
+ M2);
+ // CHECK: {{.*}}:6:{{[0-9]+}}: warning: expression result unused
+ // CHECK: {{.*}}:7:{{[0-9]+}}: note: instantiated from:
+ // CHECK: {{.*}}:4:{{[0-9]+}}: note: instantiated from:
}
-// RUN: grep ":16:11: note: instantiated from:" %t
#define A 1
-// RUN: grep ":18:11: note: instantiated from:" %t
#define B A
-// RUN: grep ":20:11: note: instantiated from:" %t
#define C B
-
void bar() {
- // RUN: grep ":24:3: warning: expression result unused" %t
C;
+ // CHECK: {{.*}}:17:{{[0-9]+}}: warning: expression result unused
+ // CHECK: {{.*}}:15:{{[0-9]+}}: note: instantiated from:
+ // CHECK: {{.*}}:14:{{[0-9]+}}: note: instantiated from:
+ // CHECK: {{.*}}:13:{{[0-9]+}}: note: instantiated from:
}
diff --git a/test/Misc/include-stack-for-note-flag.cpp b/test/Misc/include-stack-for-note-flag.cpp
new file mode 100644
index 000000000000..f8d0080f57ac
--- /dev/null
+++ b/test/Misc/include-stack-for-note-flag.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACK
+// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACKLESS
+// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-note-include-stack -fdiagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACK
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -fno-diagnostics-show-note-include-stack %s 2>&1 | FileCheck %s -check-prefix=STACKLESS
+// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -check-prefix=STACKLESS
+
+#include "Inputs/include.h"
+int test() {
+ return foo(1, 1);
+}
+
+// STACK: error: no matching function for call to 'foo'
+// STACK: In file included from
+// STACK: note: candidate function not viable
+
+// STACKLESS: error: no matching function for call to 'foo'
+// STACKLESS-NOT: In file included from
+// STACKLESS: note: candidate function not viable
diff --git a/test/Misc/warn-in-system-header.c b/test/Misc/warn-in-system-header.c
new file mode 100644
index 000000000000..7e4615e65efa
--- /dev/null
+++ b/test/Misc/warn-in-system-header.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -isystem %S %s -fsyntax-only -verify
+
+#include <warn-in-system-header.h>
+// expected-warning {{#warning}}
diff --git a/test/Misc/warn-in-system-header.h b/test/Misc/warn-in-system-header.h
new file mode 100644
index 000000000000..5e127b9d3fc8
--- /dev/null
+++ b/test/Misc/warn-in-system-header.h
@@ -0,0 +1,4 @@
+
+
+
+#warning the cake is a lie
diff --git a/test/PCH/Inputs/working-directory-1.h b/test/PCH/Inputs/working-directory-1.h
new file mode 100644
index 000000000000..e42eda45c87f
--- /dev/null
+++ b/test/PCH/Inputs/working-directory-1.h
@@ -0,0 +1,5 @@
+template<typename T> struct A {
+ A() {
+ int a;
+ }
+};
diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp
index d269de529fba..af0a23afea9f 100644
--- a/test/PCH/chain-cxx.cpp
+++ b/test/PCH/chain-cxx.cpp
@@ -4,9 +4,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s
// With PCH
-// RUN: %clang_cc1 -x c++-header -emit-pch -o %t1 %s
-// RUN: %clang_cc1 -x c++-header -emit-pch -o %t2 %s -include-pch %t1 -chained-pch
-// RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s
#ifndef HEADER1
#define HEADER1
@@ -34,9 +32,26 @@ struct S<T *> { typedef int H; };
template <typename T> struct TS2;
typedef TS2<int> TS2int;
+template <typename T> struct TestBaseSpecifiers { };
+template<typename T> struct TestBaseSpecifiers2 : TestBaseSpecifiers<T> { };
+
+template <typename T>
+struct TS3 {
+ static const int value = 0;
+};
+template <typename T>
+const int TS3<T>::value;
+// Instantiate struct, but not value.
+struct instantiate : TS3<int> {};
+
+
//===----------------------------------------------------------------------===//
#elif not defined(HEADER2)
#define HEADER2
+#if !defined(HEADER1)
+#error Header inclusion order messed up
+#endif
+
//===----------------------------------------------------------------------===//
// Dependent header for C++ chained PCH test
@@ -73,6 +88,15 @@ struct S<int &> { typedef int L; };
template <typename T> struct TS2 { };
+struct TestBaseSpecifiers3 { };
+struct TestBaseSpecifiers4 : TestBaseSpecifiers3 { };
+
+struct A { };
+struct B : A { };
+
+// Instantiate TS3's member.
+static const int ts3m1 = TS3<int>::value;
+
//===----------------------------------------------------------------------===//
#else
//===----------------------------------------------------------------------===//
@@ -96,7 +120,12 @@ void test() {
typedef S<int &>::L T6;
TS2int ts2;
+
+ B b;
}
+// Should have remembered that there is a definition.
+static const int ts3m2 = TS3<int>::value;
+
//===----------------------------------------------------------------------===//
#endif
diff --git a/test/PCH/chain-empty-initial-namespace.cpp b/test/PCH/chain-empty-initial-namespace.cpp
new file mode 100644
index 000000000000..bf15caa72cda
--- /dev/null
+++ b/test/PCH/chain-empty-initial-namespace.cpp
@@ -0,0 +1,24 @@
+// no PCH
+// RUN: %clang_cc1 -include %s -include %s -fsyntax-only %s
+// full PCH
+// RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s
+#if !defined(PASS1)
+#define PASS1
+
+namespace foo {} // no external storage
+
+#elif !defined(PASS2)
+#define PASS2
+
+namespace foo {
+ void bar();
+}
+
+#else
+// PASS3
+
+void test() {
+ foo::bar(); // no-error
+}
+
+#endif
diff --git a/test/PCH/chain-implicit-definition.cpp b/test/PCH/chain-implicit-definition.cpp
new file mode 100644
index 000000000000..245e8f9e10f8
--- /dev/null
+++ b/test/PCH/chain-implicit-definition.cpp
@@ -0,0 +1,39 @@
+// no PCH
+// RUN: %clang_cc1 -emit-llvm-only -include %s -include %s %s
+// with PCH
+// RUN: %clang_cc1 -emit-llvm-only -chain-include %s -chain-include %s %s
+#if !defined(PASS1)
+#define PASS1
+
+// A base with a virtual dtor.
+struct A {
+ virtual ~A();
+};
+
+// A derived class with an implicit virtual dtor.
+struct B : A {
+ // Key function to suppress vtable definition.
+ virtual void virt();
+};
+
+#elif !defined(PASS2)
+#define PASS2
+
+// Further derived class that requires ~B().
+// Causes definition of ~B(), but it was lost when saving PCH.
+struct C : B {
+ C();
+ ~C() {}
+};
+
+#else
+
+void foo() {
+ // Variable that requires ~C().
+ C c;
+}
+
+// VTable placement would again cause definition of ~B(), hiding the bug,
+// if not for B::virt(), which suppresses the placement.
+
+#endif
diff --git a/test/PCH/chain-late-anonymous-namespace.cpp b/test/PCH/chain-late-anonymous-namespace.cpp
new file mode 100644
index 000000000000..87205c631b3a
--- /dev/null
+++ b/test/PCH/chain-late-anonymous-namespace.cpp
@@ -0,0 +1,61 @@
+// no PCH
+// RUN: %clang_cc1 -include %s -include %s -fsyntax-only %s
+// with PCH
+// RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s
+#if !defined(PASS1)
+#define PASS1
+
+namespace ns {}
+namespace os {}
+
+#elif !defined(PASS2)
+#define PASS2
+
+namespace ns {
+ namespace {
+ extern int x;
+ }
+}
+
+namespace {
+ extern int y;
+}
+namespace {
+}
+
+namespace os {
+ extern "C" {
+ namespace {
+ extern int z;
+ }
+ }
+}
+
+#else
+
+namespace ns {
+ namespace {
+ int x;
+ }
+ void test() {
+ (void)x;
+ }
+}
+
+namespace {
+ int y;
+}
+void test() {
+ (void)y;
+}
+
+namespace os {
+ namespace {
+ int z;
+ }
+ void test() {
+ (void)z;
+ }
+}
+
+#endif
diff --git a/test/PCH/chain-pending-instantiations.cpp b/test/PCH/chain-pending-instantiations.cpp
new file mode 100644
index 000000000000..e49abcda4484
--- /dev/null
+++ b/test/PCH/chain-pending-instantiations.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -chain-include %s -chain-include %s | FileCheck %s
+// CHECK: define linkonce_odr %{{[^ ]+}} @_ZN1AI1BE3getEv
+#if !defined(PASS1)
+#define PASS1
+
+template <typename Derived>
+struct A {
+ Derived* get() { return 0; }
+};
+
+struct B : A<B> {
+};
+
+#elif !defined(PASS2)
+#define PASS2
+
+struct C : B {
+};
+
+struct D : C {
+ void run() {
+ (void)get();
+ }
+};
+
+#else
+
+int main() {
+ D d;
+ d.run();
+}
+
+#endif
diff --git a/test/PCH/cxx-chain-function-template.cpp b/test/PCH/cxx-chain-function-template.cpp
new file mode 100644
index 000000000000..494e190f776b
--- /dev/null
+++ b/test/PCH/cxx-chain-function-template.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s
+// Just don't crash.
+#if !defined(RUN1)
+#define RUN1
+
+struct CXXRecordDecl { CXXRecordDecl(int); };
+
+template <typename T, typename U>
+T cast(U u) {
+ return reinterpret_cast<T&>(u);
+}
+
+void test1() {
+ cast<float>(1);
+}
+
+#elif !defined(RUN2)
+#define RUN2
+
+template <typename T>
+void test2(T) {
+ cast<CXXRecordDecl>(1.0f);
+}
+
+#else
+
+void test3() {
+ cast<CXXRecordDecl>(1.0f);
+ test2(1);
+}
+
+#endif
diff --git a/test/PCH/cxx-for-range.cpp b/test/PCH/cxx-for-range.cpp
new file mode 100644
index 000000000000..5854917da5c7
--- /dev/null
+++ b/test/PCH/cxx-for-range.cpp
@@ -0,0 +1,19 @@
+// Test this without pch.
+// RUN: %clang_cc1 -std=c++0x -include %S/cxx-for-range.h -fsyntax-only -emit-llvm -o - %s
+
+// Test with pch.
+// RUN: %clang_cc1 -std=c++0x -emit-pch -o %t %S/cxx-for-range.h
+// RUN: %clang_cc1 -std=c++0x -include-pch %t -fsyntax-only -emit-llvm -o - %s
+
+void h() {
+ f();
+
+ g<int>();
+
+ char a[3] = { 0, 1, 2 };
+ for (auto w : a)
+ for (auto x : S())
+ for (auto y : T())
+ for (auto z : U())
+ ;
+}
diff --git a/test/PCH/cxx-for-range.h b/test/PCH/cxx-for-range.h
new file mode 100644
index 000000000000..f15c7e73df39
--- /dev/null
+++ b/test/PCH/cxx-for-range.h
@@ -0,0 +1,35 @@
+// Header for PCH test cxx-for-range.cpp
+
+struct S {
+ int *begin();
+ int *end();
+};
+
+struct T { };
+char *begin(T);
+char *end(T);
+
+struct U { };
+namespace std {
+ char *begin(U);
+ char *end(U);
+}
+
+void f() {
+ char a[3] = { 0, 1, 2 };
+ for (auto w : a)
+ for (auto x : S())
+ for (auto y : T())
+ for (auto z : U())
+ ;
+}
+
+template<typename A>
+void g() {
+ A a[3] = { 0, 1, 2 };
+ for (auto &v : a)
+ for (auto x : S())
+ for (auto y : T())
+ for (auto z : U())
+ ;
+}
diff --git a/test/PCH/cxx-reference.cpp b/test/PCH/cxx-reference.cpp
new file mode 100644
index 000000000000..90d00d777c44
--- /dev/null
+++ b/test/PCH/cxx-reference.cpp
@@ -0,0 +1,6 @@
+// Test this without pch.
+// RUN: %clang_cc1 -std=c++0x -include %S/cxx-reference.h -fsyntax-only -emit-llvm -o - %s
+
+// Test with pch.
+// RUN: %clang_cc1 -std=c++0x -emit-pch -o %t %S/cxx-reference.h
+// RUN: %clang_cc1 -std=c++0x -include-pch %t -fsyntax-only -emit-llvm -o - %s
diff --git a/test/PCH/cxx-reference.h b/test/PCH/cxx-reference.h
new file mode 100644
index 000000000000..b46a3671a325
--- /dev/null
+++ b/test/PCH/cxx-reference.h
@@ -0,0 +1,13 @@
+// Header for PCH test cxx-reference.cpp
+
+typedef char (&LR);
+typedef char (&&RR);
+
+char c;
+
+char &lr = c;
+char &&rr = 'c';
+LR &lrlr = c;
+LR &&rrlr = c;
+RR &lrrr = c;
+RR &&rrrr = 'c';
diff --git a/test/PCH/cxx-templates.cpp b/test/PCH/cxx-templates.cpp
index 05dd6ed0d2be..982fc67e4e8a 100644
--- a/test/PCH/cxx-templates.cpp
+++ b/test/PCH/cxx-templates.cpp
@@ -1,11 +1,11 @@
// Test this without pch.
-// RUN: %clang_cc1 -fexceptions -include %S/cxx-templates.h -verify %s -ast-dump -o -
-// RUN: %clang_cc1 -fexceptions -include %S/cxx-templates.h %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx-templates.h -verify %s -ast-dump -o -
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx-templates.h %s -emit-llvm -o - | FileCheck %s
// Test with pch.
-// RUN: %clang_cc1 -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h
-// RUN: %clang_cc1 -fexceptions -include-pch %t -verify %s -ast-dump -o -
-// RUN: %clang_cc1 -fexceptions -include-pch %t %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -emit-pch -o %t %S/cxx-templates.h
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include-pch %t -verify %s -ast-dump -o -
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include-pch %t %s -emit-llvm -o - | FileCheck %s
// CHECK: define weak_odr void @_ZN2S4IiE1mEv
// CHECK: define linkonce_odr void @_ZN2S3IiE1mEv
@@ -43,3 +43,22 @@ S7<int[5]> s7_5;
namespace ZeroLengthExplicitTemplateArgs {
template void f<X>(X*);
}
+
+// This used to overwrite memory and crash.
+namespace Test1 {
+ struct StringHasher {
+ template<typename T, char Converter(T)> static inline unsigned createHash(const T*, unsigned) {
+ return 0;
+ }
+ };
+
+ struct CaseFoldingHash {
+ static inline char foldCase(char) {
+ return 0;
+ }
+
+ static unsigned hash(const char* data, unsigned length) {
+ return StringHasher::createHash<char, foldCase>(data, length);
+ }
+ };
+}
diff --git a/test/PCH/cxx-templates.h b/test/PCH/cxx-templates.h
index d2c820f877c6..c45e02dcb23c 100644
--- a/test/PCH/cxx-templates.h
+++ b/test/PCH/cxx-templates.h
@@ -193,3 +193,15 @@ namespace ZeroLengthExplicitTemplateArgs {
template<typename T> void g2(T);
};
}
+
+namespace NonTypeTemplateParmContext {
+ template<typename T, int inlineCapacity = 0> class Vector { };
+
+ struct String {
+ template<int inlineCapacity>
+ static String adopt(Vector<char, inlineCapacity>&);
+ };
+
+ template<int inlineCapacity>
+ inline bool equalIgnoringNullity(const Vector<char, inlineCapacity>& a, const String& b) { return false; }
+}
diff --git a/test/PCH/cxx_exprs.cpp b/test/PCH/cxx_exprs.cpp
index cf7ae338eba1..49df80db4fed 100644
--- a/test/PCH/cxx_exprs.cpp
+++ b/test/PCH/cxx_exprs.cpp
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: %clang_cc1 -fexceptions -include %S/cxx_exprs.h -std=c++0x -fsyntax-only -verify %s -ast-dump
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -include %S/cxx_exprs.h -std=c++0x -fsyntax-only -verify %s -ast-dump
// Test with pch. Use '-ast-dump' to force deserialization of function bodies.
-// RUN: %clang_cc1 -fexceptions -x c++-header -std=c++0x -emit-pch -o %t %S/cxx_exprs.h
-// RUN: %clang_cc1 -fexceptions -std=c++0x -include-pch %t -fsyntax-only -verify %s -ast-dump
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -x c++-header -std=c++0x -emit-pch -o %t %S/cxx_exprs.h
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -include-pch %t -fsyntax-only -verify %s -ast-dump
int integer;
double floating;
diff --git a/test/PCH/exprs.c b/test/PCH/exprs.c
index d855defe7eed..5928abda58f3 100644
--- a/test/PCH/exprs.c
+++ b/test/PCH/exprs.c
@@ -39,7 +39,7 @@ negate_enum *int_ptr4 = &integer;
// OffsetOfExpr
offsetof_type *offsetof_ptr = &size_type_value;
-// SizeOfAlignOfExpr
+// UnaryExprOrTypeTraitExpr
typeof(sizeof(float)) size_t_value;
typeof_sizeof *size_t_ptr = &size_t_value;
typeof_sizeof2 *size_t_ptr2 = &size_t_value;
@@ -93,3 +93,6 @@ choose_expr *int_ptr8 = &integer;
// ShuffleVectorExpr
shuffle_expr *vec_ptr = &vec2;
+
+// GenericSelectionExpr
+generic_selection_expr *double_ptr6 = &floating;
diff --git a/test/PCH/exprs.h b/test/PCH/exprs.h
index 80768f8df24e..3495b8b4bbde 100644
--- a/test/PCH/exprs.h
+++ b/test/PCH/exprs.h
@@ -38,7 +38,7 @@ struct Z {
typedef typeof(__builtin_offsetof(struct Z, y.array[1 + 2].member))
offsetof_type;
-// SizeOfAlignOfExpr
+// UnaryExprOrTypeTraitExpr
typedef typeof(sizeof(int)) typeof_sizeof;
typedef typeof(sizeof(Enumerator)) typeof_sizeof2;
@@ -99,3 +99,7 @@ typedef typeof(__builtin_choose_expr(17 > 19, d0, 1)) choose_expr;
// ShuffleVectorExpr
typedef typeof(__builtin_shufflevector(vec2, vec2b, 2, 1)) shuffle_expr;
+
+// GenericSelectionExpr
+typedef typeof(_Generic(i, char*: 0, int: 0., default: hello))
+ generic_selection_expr;
diff --git a/test/PCH/headersearch.cpp b/test/PCH/headersearch.cpp
index 151756c7071e..8ca0c361c4dc 100644
--- a/test/PCH/headersearch.cpp
+++ b/test/PCH/headersearch.cpp
@@ -1,8 +1,9 @@
// Test reading of PCH with changed location of original input files,
// i.e. invoking header search.
-// XFAIL: win32
+// REQUIRES: shell
// Generate the original files:
+// RUN: rm -rf %t_orig %t_moved
// RUN: mkdir -p %t_orig/sub %t_orig/sub2
// RUN: echo 'struct orig_sub{char c; int i; };' > %t_orig/sub/orig_sub.h
// RUN: echo 'void orig_sub2_1();' > %t_orig/sub2/orig_sub2_1.h
@@ -16,8 +17,7 @@
// Generate the PCH:
// RUN: cd %t_orig && %clang_cc1 -x c++ -emit-pch -o all.h.pch -Isub2 all.h
-// RUN: rm -rf %t_moved
-// RUN: mv %t_orig %t_moved
+// RUN: cp -pR %t_orig %t_moved
// Check diagnostic with location in original source:
// RUN: %clang_cc1 -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -Wpadded -emit-obj -o %t.o %s 2> %t.stderr
diff --git a/test/PCH/modified-header-crash.c b/test/PCH/modified-header-crash.c
new file mode 100644
index 000000000000..c74ce2239c22
--- /dev/null
+++ b/test/PCH/modified-header-crash.c
@@ -0,0 +1,10 @@
+// Don't crash.
+
+// RUN: cp %S/modified-header-crash.h %t.h
+// RUN: %clang_cc1 -DCAKE -x c-header %t.h -emit-pch -o %t
+// RUN: echo >> %t.h
+// RUN: not %clang_cc1 %s -include-pch %t -fsyntax-only
+
+void f(void) {
+ foo = 3;
+}
diff --git a/test/PCH/modified-header-crash.h b/test/PCH/modified-header-crash.h
new file mode 100644
index 000000000000..971746e3bd4c
--- /dev/null
+++ b/test/PCH/modified-header-crash.h
@@ -0,0 +1 @@
+int foo;
diff --git a/test/PCH/objcxx-ivar-class.h b/test/PCH/objcxx-ivar-class.h
index 50ebda709db0..5e5565864d87 100644
--- a/test/PCH/objcxx-ivar-class.h
+++ b/test/PCH/objcxx-ivar-class.h
@@ -1,6 +1,7 @@
struct S {
S();
S(const S&);
+ ~S();
S& operator= (const S&);
};
diff --git a/test/PCH/pragma-diag-section.cpp b/test/PCH/pragma-diag-section.cpp
index 312f720ebd98..5b996bb2f0d1 100644
--- a/test/PCH/pragma-diag-section.cpp
+++ b/test/PCH/pragma-diag-section.cpp
@@ -12,7 +12,10 @@
#pragma clang diagnostic ignored "-Wtautological-compare"
template <typename T>
struct TS {
- void m() { T b = b==b; }
+ void m() {
+ T a = 0;
+ T b = a==a;
+ }
};
#pragma clang diagnostic pop
diff --git a/test/PCH/pragma-diag.c b/test/PCH/pragma-diag.c
index c5171036400f..b304c4bf8c35 100644
--- a/test/PCH/pragma-diag.c
+++ b/test/PCH/pragma-diag.c
@@ -13,7 +13,8 @@
#else
void f() {
- int b = b==b;
+ int a = 0;
+ int b = a==a;
}
#endif
diff --git a/test/PCH/rdar8852495.c b/test/PCH/rdar8852495.c
index 2d49e001b051..fb465a37ce38 100644
--- a/test/PCH/rdar8852495.c
+++ b/test/PCH/rdar8852495.c
@@ -16,7 +16,8 @@
#else
int f() {
- int b = b==b;
+ int a;
+ int b = a==a;
unsigned x;
signed y;
return x == y;
diff --git a/test/PCH/reloc.c b/test/PCH/reloc.c
index 51a7c4c87946..fd78feba6047 100644
--- a/test/PCH/reloc.c
+++ b/test/PCH/reloc.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -emit-pch -o %t -relocatable-pch -isysroot %S/libroot %S/libroot/usr/include/reloc.h
// RUN: %clang_cc1 -include-pch %t -isysroot %S/libroot %s -verify
// RUN: not %clang_cc1 -include-pch %t %s
-// XFAIL: win32
+
#include <reloc.h>
int x = 2; // expected-error{{redefinition}}
diff --git a/test/PCH/source-manager-stack.c b/test/PCH/source-manager-stack.c
index cc8555661a4d..8f5da2f0e371 100644
--- a/test/PCH/source-manager-stack.c
+++ b/test/PCH/source-manager-stack.c
@@ -2,9 +2,9 @@
// when using PCH.
// RUN: echo 'int x;' > %t.prefix.h
-// RUN: not %clang_cc1 -fsyntax-only -include %t.prefix.h %s 2> %t.diags.no_pch.txt
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -include %t.prefix.h %s 2> %t.diags.no_pch.txt
// RUN: %clang_cc1 -emit-pch -o %t.prefix.pch %t.prefix.h
-// RUN: not %clang_cc1 -fsyntax-only -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt
// RUN: diff %t.diags.no_pch.txt %t.diags.pch.txt
// XFAIL: *
// PR5662
diff --git a/test/PCH/working-directory.cpp b/test/PCH/working-directory.cpp
new file mode 100644
index 000000000000..e77d31b4be61
--- /dev/null
+++ b/test/PCH/working-directory.cpp
@@ -0,0 +1,12 @@
+// Test this without pch.
+// RUN: %clang_cc1 -working-directory %S -I. -include working-directory.h %s -Wunused
+
+// Test with pch.
+// RUN: %clang_cc1 -working-directory %S -x c++-header -emit-pch -o %t.pch -I. working-directory.h
+// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only %s -Wunused
+
+void f() {
+ // Instantiating A<char> will trigger a warning, which will end up trying to get the path to
+ // the header that contains A.
+ A<char> b;
+}
diff --git a/test/PCH/working-directory.h b/test/PCH/working-directory.h
new file mode 100644
index 000000000000..02a60e3e763e
--- /dev/null
+++ b/test/PCH/working-directory.h
@@ -0,0 +1 @@
+#include <Inputs/working-directory-1.h>
diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp
new file mode 100644
index 000000000000..b447fff2f1c0
--- /dev/null
+++ b/test/Parser/DelayedTemplateParsing.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s
+
+template <class T>
+class A {
+ void foo() {
+ undeclared();
+ }
+ void foo2();
+};
+
+template <class T>
+class B {
+ void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}}
+ void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} expected-note {{previous definition is here}}
+};
+
+
+template <class T>
+void B<T>::foo4() {// expected-error {{redefinition of 'foo4'}}
+}
+
+template <class T>
+void A<T>::foo2() {
+ undeclared();
+}
+
+
+template <class T>
+void foo3() {
+ undeclared();
+}
+
+template void A<int>::foo2();
+
+
+void undeclared()
+{
+
+}
+
+template <class T> void foo5() {} //expected-note {{previous definition is here}}
+template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}}
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 9df8fa3a4e91..2f5da5255b37 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -43,7 +43,7 @@ char x = FOO(a);
typedef enum E { e1 };
-
+
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index fd0d7d50d0eb..32ed375889a6 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -95,6 +95,16 @@ void template_uuid()
}
+template <class T, const GUID* g = &__uuidof(T)>
+class COM_CLASS_TEMPLATE { };
+
+typedef COM_CLASS_TEMPLATE<struct_with_uuid, &__uuidof(struct_with_uuid)> COM_TYPE_1;
+typedef COM_CLASS_TEMPLATE<struct_with_uuid> COM_TYPE_2;
+
+template <class T, const GUID& g>
+class COM_CLASS_TEMPLATE_REF { };
+typedef COM_CLASS_TEMPLATE<struct_with_uuid, __uuidof(struct_with_uuid)> COM_TYPE_REF;
+
class CtorCall {
public:
@@ -111,3 +121,46 @@ CtorCall& CtorCall::operator=(const CtorCall& that)
}
return *this;
}
+
+template <class A>
+class C1 {
+public:
+ template <int B>
+ class Iterator {
+ };
+};
+
+template<class T>
+class C2 {
+ typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
+};
+
+template <class T>
+void f(){
+ typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
+}
+
+
+
+class AAAA { };
+
+template <class T>
+void redundant_typename() {
+ typename T t;// expected-warning {{expected a qualified name after 'typename'}}
+ typename AAAA a;// expected-warning {{expected a qualified name after 'typename'}}
+ t = 3;
+}
+
+int main() {
+ redundant_typename<int>();
+ f<int>();
+}
+
+
+__interface MicrosoftInterface;
+__interface MicrosoftInterface {
+ virtual void foo1() = 0;
+ virtual void foo2() = 0;
+};
+
+__int64 x7 = __int64(0);
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
index 64f82f7a563c..d1e655213761 100644
--- a/test/Parser/altivec.c
+++ b/test/Parser/altivec.c
@@ -113,9 +113,9 @@ void f() {
}
// bug 6895 - Vectorl literal casting confusion.
-vector char v1 = (vector char)((vector int)(1, 2, 3, 4));
-vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f));
-vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd'));
-vector int v4 = (vector int)(1, 2, 3, 4);
+vector char v1 = (vector char)((vector int)(1, 2, 3, 4));
+vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f));
+vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd'));
+vector int v4 = (vector int)(1, 2, 3, 4);
vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3)));
diff --git a/test/Parser/attr-availability.c b/test/Parser/attr-availability.c
new file mode 100644
index 000000000000..269f90847d66
--- /dev/null
+++ b/test/Parser/attr-availability.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#if !__has_feature(attribute_availability)
+# error 'availability' attribute is not available
+#endif
+
+void f0() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));
+
+void f1() __attribute__((availability(macosx,deprecated=10.4,introduced=10.2,obsoleted=10.6)));
+
+void f2() __attribute__((availability(ios,deprecated=10.4.7,introduced=10,obsoleted=10.6)));
+
+void f3() __attribute__((availability(ios,deprecated=10.4.7,introduced=10,obsoleted=10.6,introduced=10.2))); // expected-error{{redundant 'introduced' availability change; only the last specified change will be used}}
+
+void f4() __attribute__((availability(macosx,introduced=10.5), availability(ios,unavailable)));
+
+void f5() __attribute__((availability(macosx,introduced=10.5), availability(ios,unavailable, unavailable))); // expected-error{{redundant 'unavailable' availability change; only the last specified change will be used}}
+
+void f6() __attribute__((availability(macosx,unavailable,introduced=10.5))); // expected-warning{{warning: 'unavailable' availability overrides all other availability information}}
+
diff --git a/test/Parser/c1x-generic-selection.c b/test/Parser/c1x-generic-selection.c
new file mode 100644
index 000000000000..ee23059cc4de
--- /dev/null
+++ b/test/Parser/c1x-generic-selection.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+
+void foo(void) {
+ _Generic; // expected-error {{expected '('}}
+ (void) _Generic(0); // expected-error {{expected ','}}
+ (void) _Generic(0, void); // expected-error {{expected ':'}}
+ (void) _Generic(0,
+ default: 0, // expected-note {{previous default generic association is here}}
+ default: 0); // expected-error {{duplicate default generic association}}
+}
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
index 98d962ad0998..4a0bb4d1e4e5 100644
--- a/test/Parser/cxx-casting.cpp
+++ b/test/Parser/cxx-casting.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
char *const_cast_test(const char *var)
{
@@ -34,6 +34,36 @@ char postfix_expr_test()
// This was being incorrectly tentatively parsed.
namespace test1 {
- template <class T> class A {};
+ template <class T> class A {}; // expected-note 2{{here}}
void foo() { A<int>(*(A<int>*)0); }
}
+
+typedef char* c;
+typedef A* a;
+void test2(char x, struct B * b) {
+ (void)const_cast<::c>(&x); // expected-error{{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)dynamic_cast<::a>(b); // expected-error{{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)reinterpret_cast<::c>(x); // expected-error{{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)static_cast<::c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+
+ // Do not do digraph correction.
+ (void)static_cast<: :c>(&x); //\
+ expected-error {{expected '<' after 'static_cast'}} \
+ expected-error {{expected expression}}\
+ expected-error {{expected ']'}}\
+ expected-note {{to match this '['}}
+ (void)static_cast<: // expected-error {{expected '<' after 'static_cast'}} \
+ expected-note {{to match this '['}}
+ :c>(&x); // expected-error {{expected expression}} \
+ expected-error {{expected ']'}}
+#define LC <:
+#define C :
+ test1::A LC:B> c; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}}
+ (void)static_cast LC:c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
+ test1::A<:C B> d; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}}
+ (void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
+
+#define LCC <::
+ test1::A LCC B> e; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)static_cast LCC c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 6d720d36a259..70eff973e0e1 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -7,8 +7,8 @@ struct Type {
};
// rdar://8365458
-typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}} \
- // expected-warning {{declaration does not declare anything}}
+// rdar://9132143
+typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}}
// PR4451 - We should recover well from the typo of '::' as ':' in a2.
namespace y {
diff --git a/test/Parser/cxx-exception-spec.cpp b/test/Parser/cxx-exception-spec.cpp
deleted file mode 100644
index e6c3c757f012..000000000000
--- a/test/Parser/cxx-exception-spec.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only %s
-
-struct X { };
-
-struct Y { };
-
-void f() throw() { }
-
-void g(int) throw(X) { }
-
-void h() throw(X, Y) { }
-
-class Class {
- void foo() throw (X, Y) { }
-};
-
-void (*fptr)() throw();
diff --git a/test/Parser/cxx-member-crash.cpp b/test/Parser/cxx-member-crash.cpp
new file mode 100644
index 000000000000..2b31a608a583
--- /dev/null
+++ b/test/Parser/cxx-member-crash.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only %s 2>&1|FileCheck %s
+
+// <rdar://problem/9221993>
+
+// We only care to chek whether the compiler crashes; the actual
+// diagnostics are uninteresting.
+// CHECK: 8 errors generated.
+template<class _CharT> struct char_traits;
+template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ios;
+template<typename _CharT, typename _Traits = char_traits<_CharT> > class ostreambuf_iterator;
+template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class num_get;
+template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, string& __xtrc) const {
+ const bool __plus = __c == __lit[__num_base::_S_iplus];
+ if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) {
diff --git a/test/Parser/cxx-stmt.cpp b/test/Parser/cxx-stmt.cpp
index 795aca6e93c0..7677ca880128 100644
--- a/test/Parser/cxx-stmt.cpp
+++ b/test/Parser/cxx-stmt.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
void f1()
{
diff --git a/test/Parser/cxx-throw.cpp b/test/Parser/cxx-throw.cpp
index 20b8f4b754ab..d63b6d4cae6c 100644
--- a/test/Parser/cxx-throw.cpp
+++ b/test/Parser/cxx-throw.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
int i;
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 3147de940418..f65e29070957 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x %s
// Declaration syntax checks
[[]] int before_attr;
diff --git a/test/Parser/cxx0x-override-control-keywords.cpp b/test/Parser/cxx0x-override-control-keywords.cpp
index f959f7a9952c..91d5132febe8 100644
--- a/test/Parser/cxx0x-override-control-keywords.cpp
+++ b/test/Parser/cxx0x-override-control-keywords.cpp
@@ -7,9 +7,6 @@ struct Base {
struct S : Base {
virtual void final() final;
virtual void override() override;
- virtual void n() new;
- int i : 3 new;
- int j new;
};
struct T {
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index 6015e918a340..0d1b6c945c5c 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -51,3 +51,9 @@ int test6(void) {
test5(1)
; // expected-error {{expected ')'}}
}
+
+// PR8394
+void test7() {
+ ({} // expected-note {{to match}}
+ ; // expected-error {{expected ')'}}
+}
diff --git a/test/Parser/objc-missing-impl.m b/test/Parser/objc-missing-impl.m
index 05d9d6c0b232..e9c37ab1b158 100644
--- a/test/Parser/objc-missing-impl.m
+++ b/test/Parser/objc-missing-impl.m
@@ -1,2 +1,2 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@end // expected-warning {{@end must appear in an @implementation context}}
+@end // expected-error {{@end must appear in an @implementation context}}
diff --git a/test/Parser/objcxx-at.mm b/test/Parser/objcxx-at.mm
new file mode 100644
index 000000000000..37aee4dd6aa9
--- /dev/null
+++ b/test/Parser/objcxx-at.mm
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface B {
+ int i;
+}
+@end
+
+struct Z {
+ @defs(B); // expected-error{{@defs is not supported in Objective-C++}}
+};
+
+struct Y { // expected-note{{to match this '{'}}
+ struct X { } // expected-error{{expected ';' after struct}}
+ @interface A // expected-error{{unexpected '@' in member specification}}
+} // expected-error{{expected '}'}} expected-error{{expected ';' after struct}}
diff --git a/test/Parser/opencl-image-access.cl b/test/Parser/opencl-image-access.cl
new file mode 100644
index 000000000000..313587c1d225
--- /dev/null
+++ b/test/Parser/opencl-image-access.cl
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+
+typedef void* image2d_t;
+
+__kernel void f__ro(__read_only image2d_t a) { }
+
+__kernel void f__wo(__write_only image2d_t a) { }
+
+__kernel void f__rw(__read_write image2d_t a) { }
+
+
+__kernel void fro(read_only image2d_t a) { }
+
+__kernel void fwo(write_only image2d_t a) { }
+
+__kernel void frw(read_write image2d_t a) { }
diff --git a/test/Parser/recovery.m b/test/Parser/recovery.m
new file mode 100644
index 000000000000..e1265262b1b2
--- /dev/null
+++ b/test/Parser/recovery.m
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
+
+@interface Test0
+@property (assign) id x // expected-error {{expected ';' at end of declaration list}}
+@end
diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m
index 0f35ce79b20f..5ba2da9931cf 100644
--- a/test/Parser/selector-1.m
+++ b/test/Parser/selector-1.m
@@ -1,14 +1,20 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// rdar://8366474
int main() {
- SEL s = @selector(retain);
- SEL s1 = @selector(meth1:);
- SEL s2 = @selector(retainArgument::);
- SEL s3 = @selector(retainArgument:::::);
- SEL s4 = @selector(retainArgument:with:);
- SEL s5 = @selector(meth1:with:with:);
- SEL s6 = @selector(getEnum:enum:bool:);
- SEL s7 = @selector(char:float:double:unsigned:short:long:);
-
- SEL s9 = @selector(:enum:bool:);
+ SEL s = @selector(retain);
+ SEL s1 = @selector(meth1:);
+ SEL s2 = @selector(retainArgument::);
+ SEL s3 = @selector(retainArgument:::::);
+ SEL s4 = @selector(retainArgument:with:);
+ SEL s5 = @selector(meth1:with:with:);
+ SEL s6 = @selector(getEnum:enum:bool:);
+ SEL s7 = @selector(char:float:double:unsigned:short:long:);
+ SEL s9 = @selector(:enum:bool:);
+
+ (void) @selector(foo:);
+ (void) @selector(foo::);
+ (void) @selector(foo:::);
+ (void) @selector(foo::::);
}
diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp
index f11babc5b600..0e4dcfa3c637 100644
--- a/test/Parser/switch-recovery.cpp
+++ b/test/Parser/switch-recovery.cpp
@@ -31,4 +31,128 @@ struct B {
break;
}
}
+
+ int test3(int i) {
+ switch (i) {
+ case 1: return 0;
+ 2: return 1; // expected-error {{expected 'case' keyword before expression}}
+ default: return 5;
+ }
+ }
};
+
+int test4(int i) {
+ switch (i)
+ 1: return -1; // expected-error {{expected 'case' keyword before expression}}
+ return 0;
+}
+
+int test5(int i) {
+ switch (i) {
+ case 1: case 2: case 3: return 1;
+ {
+ 4:5:6:7: return 2; // expected-error 4{{expected 'case' keyword before expression}}
+ }
+ default: return -1;
+ }
+}
+
+int test6(int i) {
+ switch (i) {
+ case 1:
+ case 4:
+ // This class provides extra single colon tokens. Make sure no
+ // errors are seen here.
+ class foo{
+ public:
+ protected:
+ private:
+ };
+ case 2:
+ 5: // expected-error {{expected 'case' keyword before expression}}
+ default: return 1;
+ }
+}
+
+int test7(int i) {
+ switch (i) {
+ case false ? 1 : 2:
+ true ? 1 : 2: // expected-error {{expected 'case' keyword before expression}}
+ case 10:
+ 14 ? 3 : 4;
+ default:
+ return 1;
+ }
+}
+
+enum foo { A, B, C};
+int test8( foo x ) {
+ switch (x) {
+ A: return 0; // FIXME: give a warning for unused labels that could also be
+ // a case expression.
+ default: return 1;
+ }
+}
+
+// Stress test to make sure Clang doesn't crash.
+void test9(int x) {
+ switch(x) {
+ case 1: return;
+ 2: case; // expected-error {{expected 'case' keyword before expression}} \
+ expected-error {{expected expression}}
+ 4:5:6: return; // expected-error 3{{expected 'case' keyword before expression}}
+ 7: :x; // expected-error {{expected 'case' keyword before expression}} \
+ expected-error {{expected expression}}
+ 8:: x; // expected-error {{expected ';' after expression}} \
+ expected-error {{no member named 'x' in the global namespace}} \
+ expected-warning {{expression result unused}}
+ 9:: :y; // expected-error {{expected ';' after expression}} \
+ expected-error {{expected unqualified-id}} \
+ expected-warning {{expression result unused}}
+ :; // expected-error {{expected expression}}
+ ::; // expected-error {{expected unqualified-id}}
+ }
+}
+
+void test10(int x) {
+ switch (x) {
+ case 1: {
+ struct Inner {
+ void g(int y) {
+ 2: y++; // expected-error {{expected ';' after expression}} \
+ // expected-warning {{expression result unused}}
+ }
+ };
+ break;
+ }
+ }
+}
+
+template<typename T>
+struct test11 {
+ enum { E };
+
+ void f(int x) {
+ switch (x) {
+ E: break; // FIXME: give a 'case' fix-it for unused labels that
+ // could also be an expression an a case label.
+ E+1: break; // expected-error {{expected 'case' keyword before expression}}
+ }
+ }
+};
+
+void test12(int x) {
+ switch (x) {
+ 0: // expected-error {{expected 'case' keyword before expression}}
+ while (x) {
+ 1: // expected-error {{expected 'case' keyword before expression}}
+ for (;x;) {
+ 2: // expected-error {{expected 'case' keyword before expression}}
+ if (x > 0) {
+ 3: // expected-error {{expected 'case' keyword before expression}}
+ --x;
+ }
+ }
+ }
+ }
+}
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 98b053552eb1..b0515b3bba3c 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 __DEPRECATED 1
// CXX0X:#define __GNUG__
// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1
// CXX0X:#define __GXX_RTTI 1
@@ -22,7 +21,6 @@
//
// RUN: %clang_cc1 -x c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s
//
-// CXX98:#define __DEPRECATED 1
// CXX98:#define __GNUG__
// CXX98:#define __GXX_RTTI 1
// CXX98:#define __GXX_WEAK__ 1
@@ -30,6 +28,11 @@
// CXX98:#define __private_extern__ extern
//
//
+// RUN: %clang_cc1 -fdeprecated-macro -E -dM < /dev/null | FileCheck -check-prefix DEPRECATED %s
+//
+// DEPRECATED:#define __DEPRECATED 1
+//
+//
// RUN: %clang_cc1 -std=c99 -E -dM < /dev/null | FileCheck -check-prefix C99 %s
//
// C99:#define __STDC_VERSION__ 199901L
@@ -62,7 +65,6 @@
//
// RUN: %clang_cc1 -x c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s
//
-// GXX98:#define __DEPRECATED 1
// GXX98:#define __GNUG__
// GXX98:#define __GXX_WEAK__ 1
// GXX98:#define __cplusplus 1
@@ -78,10 +80,6 @@
//
// MSEXT-NOT:#define __STDC__
// MSEXT:#define _INTEGRAL_MAX_BITS 64
-// MSEXT:#define __int16 __INT16_TYPE__
-// MSEXT:#define __int32 __INT32_TYPE__
-// MSEXT:#define __int64 __INT64_TYPE__
-// MSEXT:#define __int8 __INT8_TYPE__
//
//
// RUN: %clang_cc1 -x objective-c -E -dM < /dev/null | FileCheck -check-prefix OBJC %s
@@ -982,7 +980,7 @@
// SPARC:#define __SIZE_WIDTH__ 32
// SPARC:#define __UINTMAX_TYPE__ long long unsigned int
// SPARC:#define __USER_LABEL_PREFIX__ _
-// SPARC:#define __VERSION__ "4.2.1 Compatible Clang Compiler"
+// SPARC:#define __VERSION__ "4.2.1 Compatible
// SPARC:#define __WCHAR_MAX__ 2147483647
// SPARC:#define __WCHAR_TYPE__ int
// SPARC:#define __WCHAR_WIDTH__ 32
diff --git a/test/Preprocessor/pragma-pushpop-macro.c b/test/Preprocessor/pragma-pushpop-macro.c
index 71b0e0e2600b..08a65704e4cb 100644
--- a/test/Preprocessor/pragma-pushpop-macro.c
+++ b/test/Preprocessor/pragma-pushpop-macro.c
@@ -25,7 +25,7 @@ int pmx3 = X;
#pragma pop_macro("Y")
int pmy1 = Y;
-// Have a stray 'push' to show we don't crash when having inbalanced
+// Have a stray 'push' to show we don't crash when having imbalanced
// push/pop
#pragma push_macro("Y")
#define Y 4
diff --git a/test/Preprocessor/pragma_diagnostic_sections.cpp b/test/Preprocessor/pragma_diagnostic_sections.cpp
index 69436b0bd84e..b680fae5b993 100644
--- a/test/Preprocessor/pragma_diagnostic_sections.cpp
+++ b/test/Preprocessor/pragma_diagnostic_sections.cpp
@@ -2,14 +2,14 @@
// rdar://8365684
struct S {
- void m1() { int b = b==b; } // expected-warning {{always evaluates to true}}
+ void m1() { int b; while (b==b); } // expected-warning {{always evaluates to true}}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
- void m2() { int b = b==b; }
+ void m2() { int b; while (b==b); }
#pragma clang diagnostic pop
- void m3() { int b = b==b; } // expected-warning {{always evaluates to true}}
+ void m3() { int b; while (b==b); } // expected-warning {{always evaluates to true}}
};
//------------------------------------------------------------------------------
@@ -18,7 +18,7 @@ struct S {
#pragma clang diagnostic ignored "-Wtautological-compare"
template <typename T>
struct TS {
- void m() { T b = b==b; }
+ void m() { T b; while (b==b); }
};
#pragma clang diagnostic pop
diff --git a/test/Preprocessor/pragma_unknown.c b/test/Preprocessor/pragma_unknown.c
index 0672ade66059..2586754a180a 100644
--- a/test/Preprocessor/pragma_unknown.c
+++ b/test/Preprocessor/pragma_unknown.c
@@ -21,7 +21,7 @@
#pragma STDC CX_LIMITED_RANGE IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
#pragma STDC CX_LIMITED_RANGE // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
-#pragma STDC CX_LIMITED_RANGE ON FULL POWER // expected-warning {{expected end of macro in pragma}}
+#pragma STDC CX_LIMITED_RANGE ON FULL POWER // expected-warning {{expected end of directive in pragma}}
#pragma STDC SO_GREAT // expected-warning {{unknown pragma in STDC namespace}}
#pragma STDC // expected-warning {{unknown pragma in STDC namespace}}
diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c
index b3ae8438033c..ee8e3c28c37f 100644
--- a/test/Preprocessor/stdint.c
+++ b/test/Preprocessor/stdint.c
@@ -1059,6 +1059,18 @@
// X86_64:UINTMAX_C_(0) 0UL
//
//
+// RUN: %clang_cc1 -E -ffreestanding -triple=x86_64-pc-linux-gnu %s | FileCheck -check-prefix X86_64_LINUX %s
+//
+// X86_64_LINUX:WINT_MIN_ 0U
+// X86_64_LINUX:WINT_MAX_ 4294967295U
+//
+//
+// RUN: %clang_cc1 -E -ffreestanding -triple=i386-mingw32 %s | FileCheck -check-prefix I386_MINGW32 %s
+//
+// I386_MINGW32:WCHAR_MAX_ 65535U
+// I386_MINGW32:WCHAR_MIN_ 0U
+//
+//
// stdint.h forms several macro definitions by pasting together identifiers
// to form names (eg. int32_t is formed from int ## 32 ## _t). The following
// case tests that these joining operations are performed correctly even if
diff --git a/test/Preprocessor/traditional-cpp.c b/test/Preprocessor/traditional-cpp.c
new file mode 100644
index 000000000000..5fc9ee398ecf
--- /dev/null
+++ b/test/Preprocessor/traditional-cpp.c
@@ -0,0 +1,12 @@
+/* Clang supports a very limited subset of -traditional-cpp, basically we only
+ * intend to add support for things that people actually rely on when doing
+ * things like using /usr/bin/cpp to preprocess non-source files. */
+
+/*
+ RUN: %clang_cc1 -traditional-cpp %s -E -o %t
+ RUN: FileCheck < %t %s
+*/
+
+/* CHECK: foo // bar
+ */
+foo // bar
diff --git a/test/Rewriter/rewrite-block-literal-1.mm b/test/Rewriter/rewrite-block-literal-1.mm
new file mode 100644
index 000000000000..04302d17f10f
--- /dev/null
+++ b/test/Rewriter/rewrite-block-literal-1.mm
@@ -0,0 +1,32 @@
+// 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 -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// radar 9254348
+
+void *sel_registerName(const char *);
+typedef void (^BLOCK_TYPE)(void);
+
+@interface CoreDAVTaskGroup
+{
+ int IVAR;
+}
+@property int IVAR;
+- (void) setCompletionBlock : (BLOCK_TYPE) arg;
+@end
+
+@implementation CoreDAVTaskGroup
+- (void)_finishInitialSync {
+ CoreDAVTaskGroup *folderPost;
+ folderPost.completionBlock = ^{
+ self.IVAR = 0;
+ [self _finishInitialSync];
+ };
+
+ [folderPost setCompletionBlock : (^{
+ self.IVAR = 0;
+ })];
+}
+@dynamic IVAR;
+- (void) setCompletionBlock : (BLOCK_TYPE) arg {}
+@end
+
+
diff --git a/test/Rewriter/rewrite-block-pointer.mm b/test/Rewriter/rewrite-block-pointer.mm
index abb2f136183c..d010a22484af 100644
--- a/test/Rewriter/rewrite-block-pointer.mm
+++ b/test/Rewriter/rewrite-block-pointer.mm
@@ -88,3 +88,20 @@ void test8608902() {
ppp(1, 0);
}
+void test9204669() {
+ __attribute__((__blocks__(byref))) char (^addChangeToData)();
+
+ addChangeToData = ^() {
+ return 'b';
+ };
+ addChangeToData();
+}
+
+void test9204669_1() {
+ __attribute__((__blocks__(byref))) void (^addChangeToData)();
+
+ addChangeToData = ^() {
+ addChangeToData();
+ };
+}
+
diff --git a/test/Sema/__try.c b/test/Sema/__try.c
new file mode 100644
index 000000000000..5490aea539ed
--- /dev/null
+++ b/test/Sema/__try.c
@@ -0,0 +1,171 @@
+// RUN: %clang_cc1 -fborland-extensions -fsyntax-only -verify %s
+
+#define JOIN2(x,y) x ## y
+#define JOIN(x,y) JOIN2(x,y)
+#define TEST2(name) JOIN(name,__LINE__)
+#define TEST TEST2(test)
+typedef int DWORD;
+
+#pragma sysheader begin
+
+struct EXCEPTION_INFO{};
+
+int __exception_code();
+struct EXCEPTION_INFO* __exception_info();
+void __abnormal_termination();
+
+#define GetExceptionCode __exception_code
+#define GetExceptionInformation __exception_info
+#define AbnormalTermination __abnormal_termination
+
+#pragma sysheader end
+
+DWORD FilterExpression(int);
+DWORD FilterExceptionInformation(struct EXCEPTION_INFO*);
+
+const char * NotFilterExpression();
+
+void TEST() {
+ __try {
+ __try {
+ __try {
+ }
+ __finally{
+ }
+ }
+ __finally{
+ }
+ }
+ __finally{
+ }
+}
+
+void TEST() {
+ __try {
+
+ }
+} // expected-error{{expected '__except' or '__finally' block}}
+
+void TEST() {
+ __except ( FilterExpression() ) { // expected-error{{}}
+
+ }
+}
+
+void TEST() {
+ __finally { } // expected-error{{}}
+}
+
+void TEST() {
+ __try{
+ int try_scope = 0;
+ } // TODO: expected expression is an extra error
+ __except( try_scope ? 1 : -1 ) // expected-error{{undeclared identifier 'try_scope'}} expected-error{{expected expression}}
+ {}
+}
+
+void TEST() {
+ __try {
+
+ }
+ // TODO: Why are there two errors?
+ __except( ) { // expected-error{{expected expression}} expected-error{{expected expression}}
+ }
+}
+
+void TEST() {
+ __try {
+
+ }
+ __except ( FilterExpression(GetExceptionCode()) ) {
+
+ }
+
+ __try {
+
+ }
+ __except( FilterExpression(__exception_code()) ) {
+
+ }
+
+ __try {
+
+ }
+ __except( FilterExceptionInformation(__exception_info()) ) {
+
+ }
+
+ __try {
+
+ }
+ __except(FilterExceptionInformation( GetExceptionInformation() ) ) {
+
+ }
+}
+
+void TEST() {
+ __try {
+
+ }
+ __except ( NotFilterExpression() ) { // expected-error{{filter expression type should be an integral value not 'const char *'}}
+
+ }
+}
+
+void TEST() {
+ int function_scope = 0;
+ __try {
+ int try_scope = 0;
+ }
+ __except ( FilterExpression(GetExceptionCode()) ) {
+ (void)function_scope;
+ (void)try_scope; // expected-error{{undeclared identifier}}
+ }
+}
+
+void TEST() {
+ int function_scope = 0;
+ __try {
+ int try_scope = 0;
+ }
+ __finally {
+ (void)function_scope;
+ (void)try_scope; // expected-error{{undeclared identifier}}
+ }
+}
+
+void TEST() {
+ int function_scope = 0;
+ __try {
+
+ }
+ __except( function_scope ? 1 : -1 ) {}
+}
+
+void TEST() {
+ __try {
+ (void)AbnormalTermination; // expected-error{{only allowed in __finally block}}
+ (void)__abnormal_termination; // expected-error{{only allowed in __finally block}}
+ }
+ __except( 1 ) {
+ (void)AbnormalTermination; // expected-error{{only allowed in __finally block}}
+ (void)__abnormal_termination; // expected-error{{only allowed in __finally block}}
+ }
+
+ __try {
+ }
+ __finally {
+ AbnormalTermination();
+ __abnormal_termination();
+ }
+}
+
+void TEST() {
+ (void)__exception_code; // expected-error{{only allowed in __except block}}
+ (void)__exception_info; // expected-error{{only allowed in __except filter expression}}
+ (void)__abnormal_termination; // expected-error{{only allowed in __finally block}}
+
+ (void)GetExceptionCode(); // expected-error{{only allowed in __except block}}
+ (void)GetExceptionInformation(); // expected-error{{only allowed in __except filter expression}}
+ (void)AbnormalTermination(); // expected-error{{only allowed in __finally block}}
+}
diff --git a/test/Sema/align-x86-64.c b/test/Sema/align-x86-64.c
index 6dcf5714b005..edea5d8b7422 100644
--- a/test/Sema/align-x86-64.c
+++ b/test/Sema/align-x86-64.c
@@ -9,3 +9,17 @@ void foo(void) {
char y[__alignof__(x) == 16 ? 1 : -1];
frob(y);
}
+
+// PR5637
+
+typedef __attribute__((aligned(16))) struct {
+ unsigned long long w[3];
+} UINT192;
+
+UINT192 ten2mk192M[] = {
+ {{0xcddd6e04c0592104ULL, 0x0fcf80dc33721d53ULL, 0xa7c5ac471b478423ULL}},
+ {{0xcddd6e04c0592104ULL, 0x0fcf80dc33721d53ULL, 0xa7c5ac471b478423ULL}},
+ {{0xcddd6e04c0592104ULL, 0x0fcf80dc33721d53ULL, 0xa7c5ac471b478423ULL}}
+};
+
+short chk1[sizeof(ten2mk192M) == 80 ? 1 : -1];
diff --git a/test/Sema/align-x86.c b/test/Sema/align-x86.c
index c9a63989ecbc..61bd1d33c9d6 100644
--- a/test/Sema/align-x86.c
+++ b/test/Sema/align-x86.c
@@ -14,7 +14,31 @@ short chk1[__alignof__(g3) == 8 ? 1 : -1];
short chk2[__alignof__(_Complex double) == 8 ? 1 : -1];
// PR6362
-struct __attribute__((packed)) {unsigned int a} g4;
+struct __attribute__((packed)) {unsigned int a;} g4;
short chk1[__alignof__(g4) == 1 ? 1 : -1];
short chk2[__alignof__(g4.a) == 1 ? 1 : -1];
+
+// PR5637
+
+#define ALIGNED(x) __attribute__((aligned(x)))
+
+typedef ALIGNED(2) struct {
+ char a[3];
+} T;
+
+short chk1[sizeof(T) == 3 ? 1 : -1];
+short chk2[sizeof(T[1]) == 4 ? 1 : -1];
+short chk3[sizeof(T[2]) == 6 ? 1 : -1];
+short chk4[sizeof(T[2][1]) == 8 ? 1 : -1];
+short chk5[sizeof(T[1][2]) == 6 ? 1 : -1];
+
+typedef struct ALIGNED(2) {
+ char a[3];
+} T2;
+
+short chk1[sizeof(T2) == 4 ? 1 : -1];
+short chk2[sizeof(T2[1]) == 4 ? 1 : -1];
+short chk3[sizeof(T2[2]) == 8 ? 1 : -1];
+short chk4[sizeof(T2[2][1]) == 8 ? 1 : -1];
+short chk5[sizeof(T2[1][2]) == 8 ? 1 : -1];
diff --git a/test/Sema/altivec-init.c b/test/Sema/altivec-init.c
index ef6fe4bd9d2f..973aab15d466 100644
--- a/test/Sema/altivec-init.c
+++ b/test/Sema/altivec-init.c
@@ -9,6 +9,18 @@ v8 foo(void) {
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);
+
+ vector int vi;
+ vi = (vector int)(1);
+ vi = (vector int)(1, 2); // expected-error {{number of elements must be either one or match the size of the vector}}
+ vi = (vector int)(1, 2, 3, 4);
+ vi = (vector int)(1, 2, 3, 4, 5); // expected-warning {{excess elements in vector initializer}}
+ vi = (vector int){1};
+ vi = (vector int){1, 2};
+ vi = (vector int){1, 2, 3, 4, 5}; // expected-warning {{excess elements in vector initializer}}
+ vector float vf;
+ vf = (vector float)(1.0);
+
return (v8){0, 1, 2, 3, 1, 2, 3, 4};
// FIXME: test that (type)(fn)(args) still works with -faltivec
diff --git a/test/Sema/annotate.c b/test/Sema/annotate.c
index 4d550759a25f..6f81491f1ffa 100644
--- a/test/Sema/annotate.c
+++ b/test/Sema/annotate.c
@@ -3,5 +3,5 @@
void __attribute__((annotate("foo"))) foo(float *a) {
__attribute__((annotate("bar"))) int x;
__attribute__((annotate(1))) int y; // expected-error {{argument to annotate attribute was not a string literal}}
- __attribute__((annotate("bar", 1))) int z; // expected-error {{attribute requires 1 argument(s)}}
+ __attribute__((annotate("bar", 1))) int z; // expected-error {{attribute takes one argument}}
}
diff --git a/test/Sema/anonymous-struct-union.c b/test/Sema/anonymous-struct-union.c
index d9e08397f2d3..d88abc3c3b9e 100644
--- a/test/Sema/anonymous-struct-union.c
+++ b/test/Sema/anonymous-struct-union.c
@@ -94,7 +94,7 @@ struct {}; // expected-warning{{declaration does not declare anything}}
struct s2 {
union {
int a;
- }
+ } // expected-warning{{expected ';' at end of declaration list}}
}; // expected-error{{expected member name or ';' after declaration specifiers}}
// Make sure we don't a.k.a. anonymous structs.
diff --git a/test/Sema/arm-layout.c b/test/Sema/arm-layout.c
index 424868510428..d017fdb8aa07 100644
--- a/test/Sema/arm-layout.c
+++ b/test/Sema/arm-layout.c
@@ -42,7 +42,7 @@ 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
+ int field0 : 4;
};
#ifdef __ARM_EABI__
check(s4_size, sizeof(struct s4) == 4);
diff --git a/test/Sema/attr-args.c b/test/Sema/attr-args.c
new file mode 100644
index 000000000000..61358016fbe1
--- /dev/null
+++ b/test/Sema/attr-args.c
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -DATTR=noreturn -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=always_inline -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=cdecl -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=const -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=fastcall -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=malloc -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=nothrow -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=stdcall -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=used -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=unused -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=weak -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+
+#define ATTR_DECL(a) __attribute__((ATTR(a)))
+
+int a;
+
+inline ATTR_DECL(a) void* foo(); // expected-error{{attribute takes no arguments}}
+
+
+
+// RUN: %clang_cc1 -DATTR=noreturn -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=always_inline -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=cdecl -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=const -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=fastcall -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=malloc -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=nothrow -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=stdcall -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=used -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=unused -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+// RUN: %clang_cc1 -DATTR=weak -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
+
+#define ATTR_DECL(a) __attribute__((ATTR(a)))
+
+int a;
+
+inline ATTR_DECL(a) void* foo(); // expected-error{{attribute takes no arguments}}
+
+
+
diff --git a/test/Sema/attr-availability-ios.c b/test/Sema/attr-availability-ios.c
new file mode 100644
index 000000000000..435e312481d6
--- /dev/null
+++ b/test/Sema/attr-availability-ios.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 "-triple" "x86_64-apple-darwin3.0.0-iphoneos" -fsyntax-only -verify %s
+
+void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1)));
+void f1(int) __attribute__((availability(ios,introduced=2.1)));
+void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0)));
+void f3(int) __attribute__((availability(ios,introduced=3.0)));
+void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}
+
+void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0)));
+void f6(int) __attribute__((availability(ios,deprecated=3.0)));
+void f6(int) __attribute__((availability(ios,introduced=2.0)));
+
+void test() {
+ f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
+ f1(0);
+ f2(0); // expected-warning{{'f2' is deprecated: first deprecated in iOS 3.0}}
+ f3(0);
+ f4(0); // expected-error{{f4' is unavailable: obsoleted in iOS 3.0}}
+ f5(0); // expected-warning{{'f5' is deprecated: first deprecated in iOS 3.0}}
+ f6(0); // expected-warning{{'f6' is deprecated: first deprecated in iOS 3.0}}
+}
diff --git a/test/Sema/attr-availability-macosx.c b/test/Sema/attr-availability-macosx.c
new file mode 100644
index 000000000000..2b7c1e06ace7
--- /dev/null
+++ b/test/Sema/attr-availability-macosx.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 "-triple" "x86_64-apple-darwin9.0.0" -fsyntax-only -verify %s
+
+void f0(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.6)));
+void f1(int) __attribute__((availability(macosx,introduced=10.5)));
+void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5)));
+void f3(int) __attribute__((availability(macosx,introduced=10.6)));
+void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=3.0))); // expected-note{{explicitly marked unavailable}}
+void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{function has been explicitly marked unavailable here}}
+
+void test() {
+ f0(0);
+ f1(0);
+ f2(0); // expected-warning{{'f2' is deprecated: first deprecated in Mac OS X 10.5}}
+ f3(0);
+ f4(0); // expected-error{{f4' is unavailable: obsoleted in Mac OS X 10.5}}
+ f5(0); // expected-error{{'f5' is unavailable: not available on Mac OS X}}
+}
diff --git a/test/Sema/attr-availability.c b/test/Sema/attr-availability.c
new file mode 100644
index 000000000000..1314cf5a5b03
--- /dev/null
+++ b/test/Sema/attr-availability.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in Mac OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
+void f1() __attribute__((availability(ios,obsoleted=2.1,deprecated=3.0))); // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}}
+
+void f2() __attribute__((availability(otheros,introduced=2.2))); // expected-warning{{unknown platform 'otheros' in availability macro}}
diff --git a/test/Sema/attr-cleanup.c b/test/Sema/attr-cleanup.c
index 9057c27a56fe..59ebbfc4599f 100644
--- a/test/Sema/attr-cleanup.c
+++ b/test/Sema/attr-cleanup.c
@@ -8,8 +8,8 @@ static int g3 __attribute((cleanup(c1))); // expected-warning {{cleanup attribut
void t1()
{
- int v1 __attribute((cleanup)); // expected-error {{attribute requires 1 argument(s)}}
- int v2 __attribute((cleanup(1, 2))); // expected-error {{attribute requires 1 argument(s)}}
+ int v1 __attribute((cleanup)); // expected-error {{attribute takes one argument}}
+ int v2 __attribute((cleanup(1, 2))); // expected-error {{attribute takes one argument}}
static int v3 __attribute((cleanup(c1))); // expected-warning {{cleanup attribute ignored}}
diff --git a/test/Sema/attr-naked.c b/test/Sema/attr-naked.c
index 65d1726da133..1ebd78438e2f 100644
--- a/test/Sema/attr-naked.c
+++ b/test/Sema/attr-naked.c
@@ -4,5 +4,5 @@ int a __attribute__((naked)); // expected-warning {{'naked' attribute only appli
void t1() __attribute__((naked));
-void t2() __attribute__((naked(2))); // expected-error {{attribute requires 0 argument(s)}}
+void t2() __attribute__((naked(2))); // expected-error {{attribute takes no arguments}}
diff --git a/test/Sema/attr-nodebug.c b/test/Sema/attr-nodebug.c
index 6865de060266..a66e96168dd6 100644
--- a/test/Sema/attr-nodebug.c
+++ b/test/Sema/attr-nodebug.c
@@ -4,5 +4,5 @@ int a __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only a
void t1() __attribute__((nodebug));
-void t2() __attribute__((nodebug(2))); // expected-error {{attribute requires 0 argument(s)}}
+void t2() __attribute__((nodebug(2))); // expected-error {{attribute takes no arguments}}
diff --git a/test/Sema/attr-noinline.c b/test/Sema/attr-noinline.c
index 8c91b65b4f48..dfc88a8d8fcb 100644
--- a/test/Sema/attr-noinline.c
+++ b/test/Sema/attr-noinline.c
@@ -4,5 +4,5 @@ int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only
void t1() __attribute__((noinline));
-void t2() __attribute__((noinline(2))); // expected-error {{attribute requires 0 argument(s)}}
+void t2() __attribute__((noinline(2))); // expected-error {{attribute takes no arguments}}
diff --git a/test/Sema/attr-noreturn.c b/test/Sema/attr-noreturn.c
index 5333a2c13fc2..5c643fff718d 100644
--- a/test/Sema/attr-noreturn.c
+++ b/test/Sema/attr-noreturn.c
@@ -13,7 +13,7 @@ int f1() __attribute__((noreturn));
int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' only applies to function types; type here is 'int'}}
-int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute requires 0 argument(s)}}
+int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute takes no arguments}}
void f3() __attribute__((noreturn));
void f3() {
@@ -41,4 +41,4 @@ __attribute__((noreturn)) void f(__attribute__((noreturn)) void (*x)(void)) {
x();
}
-typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{attribute requires 0 argument(s)}}
+typedef void (*Fun)(void) __attribute__ ((noreturn(2))); // expected-error {{attribute takes no arguments}}
diff --git a/test/Sema/attr-regparm.c b/test/Sema/attr-regparm.c
index 4049e0e8a13f..642c07e7bc11 100644
--- a/test/Sema/attr-regparm.c
+++ b/test/Sema/attr-regparm.c
@@ -4,7 +4,7 @@ __attribute((regparm(2))) int x0(void);
__attribute((regparm(1.0))) int x1(void); // expected-error{{'regparm' attribute requires integer constant}}
__attribute((regparm(-1))) int x2(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
__attribute((regparm(5))) int x3(void); // expected-error{{'regparm' parameter must be between 0 and 3 inclusive}}
-__attribute((regparm(5,3))) int x4(void); // expected-error{{attribute requires 1 argument(s)}}
+__attribute((regparm(5,3))) int x4(void); // expected-error{{attribute takes one argument}}
void __attribute__((regparm(3))) x5(int);
void x5(int); // expected-note{{previous declaration is here}}
diff --git a/test/Sema/attr-unused.c b/test/Sema/attr-unused.c
index 6a7ea951a360..07c65cbd9aed 100644
--- a/test/Sema/attr-unused.c
+++ b/test/Sema/attr-unused.c
@@ -9,7 +9,7 @@ int f1() __attribute__((unused));
int g0 __attribute__((unused));
-int f2() __attribute__((unused(1, 2))); // expected-error {{attribute requires 0 argument(s)}}
+int f2() __attribute__((unused(1, 2))); // expected-error {{attribute takes no arguments}}
struct Test0_unused {} __attribute__((unused));
struct Test0_not_unused {};
diff --git a/test/Sema/block-args.c b/test/Sema/block-args.c
index e2e2d8e44622..5ee383eebb02 100644
--- a/test/Sema/block-args.c
+++ b/test/Sema/block-args.c
@@ -40,3 +40,8 @@ void test4() {
int (^f)() = ^((x)) { }; // expected-error {{expected ')'}} expected-warning {{type specifier missing}} expected-note {{to match this}}
}
+// rdar://problem/9170609
+void test5_helper(void (^)(int, int[*]));
+void test5(void) {
+ test5_helper(^(int n, int array[n]) {});
+}
diff --git a/test/Sema/builtins-decl.c b/test/Sema/builtins-decl.c
new file mode 100644
index 000000000000..19bdb840ccfb
--- /dev/null
+++ b/test/Sema/builtins-decl.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=i686-mingw32
+// RUN: %clang_cc1 %s -fsyntax-only -verify -triple=x86_64-mingw32
+
+// mingw-w64's intrin.h has decls below.
+// we should accept them.
+extern unsigned int __builtin_ia32_crc32qi (unsigned int, unsigned char);
+extern unsigned int __builtin_ia32_crc32hi (unsigned int, unsigned short);
+extern unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int);
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index 4072faa94b9f..64efefc7fdad 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -27,7 +27,7 @@ int test6(float a, long double b) {
void test7() {
const void *X;
X = CFSTR("\242"); // expected-warning {{input conversion stopped}}
- X = CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
+ X = CFSTR("\0"); // no-warning
X = CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible integer to pointer conversion}}
X = CFSTR("foo", "bar"); // expected-error {{too many arguments to function call}}
}
diff --git a/test/Sema/c89.c b/test/Sema/c89.c
index 038f7e537d76..670dd15539f0 100644
--- a/test/Sema/c89.c
+++ b/test/Sema/c89.c
@@ -80,3 +80,5 @@ void test13b() {
/* Make sure we allow *test14 as a "function designator" */
int test14() { return (&*test14)(); }
+
+int test15[5] = { [2] = 1 }; /* expected-warning {{designated initializers are a C99 feature}} */
diff --git a/test/Sema/callingconv.c b/test/Sema/callingconv.c
index 92a20572a2c1..25669f08ae29 100644
--- a/test/Sema/callingconv.c
+++ b/test/Sema/callingconv.c
@@ -6,7 +6,7 @@ void __attribute__((fastcall)) foo(float *a) {
void __attribute__((stdcall)) bar(float *a) {
}
-void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute requires 0 argument(s)}}
+void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute takes no arguments}}
}
void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use fastcall calling convention}}
@@ -20,7 +20,7 @@ void __attribute__((fastcall)) test2(int a, ...) { // expected-error {{variadic
void __attribute__((cdecl)) ctest0() {}
-void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute requires 0 argument(s)}}
+void __attribute__((cdecl(1))) ctest1(float x) {} // expected-error {{attribute takes no arguments}}
void (__attribute__((fastcall)) *pfoo)(float*) = foo;
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index aa0cee5da5b3..56c429c58c2a 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -58,7 +58,7 @@ EVAL_EXPR(29, (_Complex int)1 ? 1 : -1)
// PR4027 + rdar://6808859
-struct a { int x, y };
+struct a { int x, y; };
static struct a V2 = (struct a)(struct a){ 1, 2};
static const struct a V1 = (struct a){ 1, 2};
diff --git a/test/Sema/constructor-attribute.c b/test/Sema/constructor-attribute.c
index 2decebbd284a..382591654d91 100644
--- a/test/Sema/constructor-attribute.c
+++ b/test/Sema/constructor-attribute.c
@@ -3,13 +3,13 @@
int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}}
int f() __attribute__((constructor));
int f() __attribute__((constructor(1)));
-int f() __attribute__((constructor(1,2))); // expected-error {{attribute requires 0 or 1 argument(s)}}
+int f() __attribute__((constructor(1,2))); // expected-error {{attribute takes no more than 1 argument}}
int f() __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires parameter 1 to be an integer constant}}
int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to functions}}
int f() __attribute__((destructor));
int f() __attribute__((destructor(1)));
-int f() __attribute__((destructor(1,2))); // expected-error {{attribute requires 0 or 1 argument(s)}}
+int f() __attribute__((destructor(1,2))); // expected-error {{attribute takes no more than 1 argument}}
int f() __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires parameter 1 to be an integer constant}}
diff --git a/test/Sema/conversion.c b/test/Sema/conversion.c
index 619d6993251f..1eaf7082d67e 100644
--- a/test/Sema/conversion.c
+++ b/test/Sema/conversion.c
@@ -323,6 +323,10 @@ void test_8559831(enum E8559831b value_a, E8559831c value_c) {
enum E8559831a a1 = value_a; // expected-warning{{implicit conversion from enumeration type 'enum E8559831b' to different enumeration type 'enum E8559831a'}}
a1 = value_a; // expected-warning{{implicit conversion from enumeration type 'enum E8559831b' to different enumeration type 'enum E8559831a'}}
+ test_8559831_a(E8559831b_val); // expected-warning{{implicit conversion from enumeration type 'enum E8559831b' to different enumeration type 'enum E8559831a'}}
+ enum E8559831a a1a = E8559831b_val; // expected-warning{{implicit conversion from enumeration type 'enum E8559831b' to different enumeration type 'enum E8559831a'}}
+ a1 = E8559831b_val; // expected-warning{{implicit conversion from enumeration type 'enum E8559831b' to different enumeration type 'enum E8559831a'}}
+
test_8559831_a(value_c); // expected-warning{{implicit conversion from enumeration type 'E8559831c' to different enumeration type 'enum E8559831a'}}
enum E8559831a a2 = value_c; // expected-warning{{implicit conversion from enumeration type 'E8559831c' to different enumeration type 'enum E8559831a'}}
a2 = value_c; // expected-warning{{implicit conversion from enumeration type 'E8559831c' to different enumeration type 'enum E8559831a'}}
diff --git a/test/Sema/expr-address-of.c b/test/Sema/expr-address-of.c
index 8f9f795d00dd..2b8cfbfa68f5 100644
--- a/test/Sema/expr-address-of.c
+++ b/test/Sema/expr-address-of.c
@@ -107,3 +107,14 @@ char* f7() {
void* t3 = &(*(void*)0);
}
+
+void f8() {
+ void *dummy0 = &f8(); // expected-error {{address expression must be an lvalue or a function designator}}
+
+ extern void v;
+ void *dummy1 = &(1 ? v : f8()); // expected-error {{address expression must be an lvalue or a function designator}}
+
+ void *dummy2 = &(f8(), v); // expected-error {{address expression must be an lvalue or a function designator}}
+
+ void *dummy3 = &({ ; }); // expected-error {{address expression must be an lvalue or a function designator}}
+}
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index 0d6c5488de5f..e4eeaec05d97 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -12,6 +12,14 @@
} while (0)
+// Test that we don't report divide-by-zero errors in unreachable code.
+// This test should be left as is, as it also tests CFG functionality.
+void radar9171946() {
+ if (0) {
+ 0 / (0 ? 1 : 0); // expected-warning {{expression result unused}}
+ }
+}
+
int test_pr8876() {
PR8876(0); // no-warning
PR8876_pos(0); // expected-warning{{indirection of non-volatile null pointer will be deleted, not trap}} expected-note{{consider using __builtin_trap() or qualifying pointer with 'volatile'}}
@@ -155,7 +163,7 @@ void test17(int x) {
}
// PR6501
-void test18_a(int a);
+void test18_a(int a); // expected-note {{'test18_a' declared here}}
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}}
@@ -166,6 +174,12 @@ void test19() {
*(int*)0 = 0; // expected-warning {{indirection of non-volatile null pointer}} \
// expected-note {{consider using __builtin_trap}}
*(volatile int*)0 = 0; // Ok.
+
+ // rdar://9269271
+ int x = *(int*)0; // expected-warning {{indirection of non-volatile null pointer}} \
+ // expected-note {{consider using __builtin_trap}}
+ int x2 = *(volatile int*)0; // Ok.
+ int *p = &(*(int*)0); // Ok;
}
int test20(int x) {
diff --git a/test/Sema/format-strings-fixit.c b/test/Sema/format-strings-fixit.c
index 7cd76c7c37e7..c2fa2f770745 100644
--- a/test/Sema/format-strings-fixit.c
+++ b/test/Sema/format-strings-fixit.c
@@ -1,6 +1,7 @@
// RUN: cp %s %t
// RUN: %clang_cc1 -pedantic -Wall -fixit %t || true
// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror %t
+// RUN: %clang_cc1 -E -o - %t | FileCheck %s
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -41,4 +42,29 @@ void test() {
// Bad length modifiers
printf("%hhs", "foo");
printf("%1$zp", (void *)0);
+
+ // Perserve the original formatting for unsigned integers.
+ unsigned long val = 42;
+ printf("%X", val);
}
+
+// Validate the fixes...
+// CHECK: printf("%d", (int) 123);
+// CHECK: printf("abc%s", "testing testing 123");
+// CHECK: printf("%ld", (long) -12);
+// CHECK: printf("%d", 123);
+// CHECK: printf("%s\n", "x");
+// CHECK: printf("%f\n", 1.23);
+// CHECK: printf("%.2llu", (unsigned long long) 123456);
+// CHECK: printf("%1Lf", (long double) 1.23);
+// CHECK: printf("%0u", (unsigned) 31337);
+// CHECK: printf("%p", (void *) 0);
+// CHECK: printf("%+f", 1.23);
+// CHECK: printf("%-f", 1.23);
+// CHECK: printf("%1$d:%2$.*3$d:%4$.*3$d\n", 1, 2, 3, 4);
+// CHECK: printf("%10.5ld", 1l);
+// CHECK: printf("%c", 'a');
+// CHECK: printf("%-f", 1.23);
+// CHECK: printf("%s", "foo");
+// CHECK: printf("%1$p", (void *)0);
+// CHECK: printf("%lX", val);
diff --git a/test/Sema/function-redecl.c b/test/Sema/function-redecl.c
index 27ec163ea9cb..7076bdf3bd1f 100644
--- a/test/Sema/function-redecl.c
+++ b/test/Sema/function-redecl.c
@@ -2,7 +2,7 @@
// PR3588
void g0(int, int);
-void g0(); // expected-note{{previous declaration is here}}
+void g0(); // expected-note{{previous declaration is here}} expected-note{{'g0' declared here}}
void f0() {
g0(1, 2, 3); // expected-error{{too many arguments to function call}}
diff --git a/test/Sema/generic-selection.c b/test/Sema/generic-selection.c
new file mode 100644
index 000000000000..8cef975c709c
--- /dev/null
+++ b/test/Sema/generic-selection.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+
+void foo(int n) {
+ (void) _Generic(0,
+ struct A: 0, // expected-error {{type 'struct A' in generic association incomplete}}
+ void(): 0, // expected-error {{type 'void ()' in generic association not an object type}}
+ int[n]: 0); // expected-error {{type 'int [n]' in generic association is a variably modified type}}
+
+ (void) _Generic(0,
+ void (*)(): 0, // expected-note {{compatible type 'void (*)()' specified here}}
+ void (*)(void): 0); // expected-error {{type 'void (*)(void)' in generic association compatible with previously specified type 'void (*)()'}}
+
+ (void) _Generic((void (*)()) 0, // expected-error {{controlling expression type 'void (*)()' compatible with 2 generic association types}}
+ void (*)(int): 0, // expected-note {{compatible type 'void (*)(int)' specified here}}
+ void (*)(void): 0); // expected-note {{compatible type 'void (*)(void)' specified here}}
+
+ (void) _Generic(0, // expected-error {{controlling expression type 'int' not compatible with any generic association type}}
+ char: 0, short: 0, long: 0);
+
+ int a1[_Generic(0, int: 1, short: 2, float: 3, default: 4) == 1 ? 1 : -1];
+ int a2[_Generic(0, default: 1, short: 2, float: 3, int: 4) == 4 ? 1 : -1];
+ int a3[_Generic(0L, int: 1, short: 2, float: 3, default: 4) == 4 ? 1 : -1];
+ int a4[_Generic(0L, default: 1, short: 2, float: 3, int: 4) == 1 ? 1 : -1];
+ int a5[_Generic(0, int: 1, short: 2, float: 3) == 1 ? 1 : -1];
+ int a6[_Generic(0, short: 1, float: 2, int: 3) == 3 ? 1 : -1];
+}
diff --git a/test/Sema/incomplete-call.c b/test/Sema/incomplete-call.c
index 3ef578d59f6f..d34bda54986c 100644
--- a/test/Sema/incomplete-call.c
+++ b/test/Sema/incomplete-call.c
@@ -6,8 +6,8 @@ struct foo a(); // expected-note {{'a' declared here}}
void b(struct foo);
void c();
-void func() {
+void func(void *p) {
a(); // expected-error{{calling 'a' with incomplete return type 'struct foo'}}
- b(*(struct foo*)0); // expected-error{{argument type 'struct foo' is incomplete}}
- c(*(struct foo*)0); // expected-error{{argument type 'struct foo' is incomplete}}
+ b(*(struct foo*)p); // expected-error{{argument type 'struct foo' is incomplete}}
+ c(*(struct foo*)p); // expected-error{{argument type 'struct foo' is incomplete}}
}
diff --git a/test/Sema/knr-def-call.c b/test/Sema/knr-def-call.c
index d054a0476505..6243af619398 100644
--- a/test/Sema/knr-def-call.c
+++ b/test/Sema/knr-def-call.c
@@ -36,6 +36,8 @@ void proto(x)
}
void use_proto() {
- proto(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}}
- (&proto)(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}}
+ proto(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
+ (&proto)(42.0); // expected-warning{{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
}
diff --git a/test/Sema/memset-invalid.c b/test/Sema/memset-invalid.c
new file mode 100644
index 000000000000..c763858e26ec
--- /dev/null
+++ b/test/Sema/memset-invalid.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+char memset(); // expected-warning {{incompatible redeclaration of library function 'memset'}} expected-note{{'memset' is a builtin with type}}
+char test() {
+ return memset();
+}
diff --git a/test/Sema/missing-field-initializers.c b/test/Sema/missing-field-initializers.c
index 6aa48ba9e419..90e0e2a345b0 100644
--- a/test/Sema/missing-field-initializers.c
+++ b/test/Sema/missing-field-initializers.c
@@ -46,7 +46,7 @@ struct Three data[] = {
{ { .two = { 1.0f, 2.0f } } } // expected-warning {{missing field 'e' initializer}}
};
-struct { int:5; int a; int:5; int b; int:5 } noNamedImplicit[] = {
+struct { int:5; int a; int:5; int b; int:5; } noNamedImplicit[] = {
{ 1, 2 },
{ 1 } // expected-warning {{missing field 'b' initializer}}
};
diff --git a/test/Sema/neon-vector-types.c b/test/Sema/neon-vector-types.c
index 1f501776cc8e..cbf013398a26 100644
--- a/test/Sema/neon-vector-types.c
+++ b/test/Sema/neon-vector-types.c
@@ -16,7 +16,7 @@ typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t;
typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
// The attributes must have a single argument.
-typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute requires 1 argument(s)}}
+typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute takes one argument}}
// The number of elements must be an ICE.
typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires integer constant}}
diff --git a/test/Sema/overloaded-func-transparent-union.c b/test/Sema/overloaded-func-transparent-union.c
new file mode 100644
index 000000000000..fa0314e946f2
--- /dev/null
+++ b/test/Sema/overloaded-func-transparent-union.c
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar:// 9129552
+// PR9406
+
+typedef struct {
+ char *str;
+ char *str2;
+} Class;
+
+typedef union {
+ Class *object;
+} Instance __attribute__((transparent_union));
+
+__attribute__((overloadable)) void Class_Init(Instance this, char *str, void *str2) {
+ this.object->str = str;
+ this.object->str2 = str2;
+}
+
+__attribute__((overloadable)) void Class_Init(Instance this, char *str) {
+ this.object->str = str;
+ this.object->str2 = str;
+}
+
+int main(void) {
+ Class obj;
+ Class_Init(&obj, "Hello ", " World");
+}
+
diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c
index b45d8512f6bf..a25ded66a665 100644
--- a/test/Sema/parentheses.c
+++ b/test/Sema/parentheses.c
@@ -26,7 +26,8 @@ void bitwise_rel(unsigned i) {
(void)(i == 1 | i == 2 | i == 3);
(void)(i != 1 & i != 2 & i != 3);
- (void)(i || i && i); // expected-warning {{'&&' within '||'}} \
+ (void)(i ||
+ i && i); // expected-warning {{'&&' within '||'}} \
// expected-note {{place parentheses around the '&&' expression to silence this warning}}
(void)(i || i && "w00t"); // no warning.
(void)("w00t" && i || i); // no warning.
diff --git a/test/Sema/pragma-ms_struct.c b/test/Sema/pragma-ms_struct.c
new file mode 100644
index 000000000000..b2c2684c6194
--- /dev/null
+++ b/test/Sema/pragma-ms_struct.c
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
+
+#pragma ms_struct on
+
+#pragma ms_struct off
+
+#pragma ms_struct reset
+
+#pragma ms_struct // expected-warning {{incorrect use of '#pragma ms_struct on|off' - ignored}}
+
+#pragma ms_struct on top of spaghetti // expected-warning {{extra tokens at end of '#pragma ms_struct' - ignored}}
+
+struct foo
+{
+ int a;
+ int b;
+ char c;
+};
+
+
+struct {
+ unsigned long bf_1 : 12;
+ unsigned long : 0;
+ unsigned long bf_2 : 12;
+} __attribute__((__ms_struct__)) t1;
+
+struct S {
+ double __attribute__((ms_struct)) d; // expected-warning {{'ms_struct' attribute ignored}}
+ unsigned long bf_1 : 12;
+ unsigned long : 0;
+ unsigned long bf_2 : 12;
+} __attribute__((ms_struct)) t2;
+
+
diff --git a/test/Sema/sentinel-attribute.c b/test/Sema/sentinel-attribute.c
index ed0ef89db70b..e5cbf6ee04af 100644
--- a/test/Sema/sentinel-attribute.c
+++ b/test/Sema/sentinel-attribute.c
@@ -5,7 +5,7 @@ void f1(int a, ...) __attribute__ ((sentinel));
void f2(int a, ...) __attribute__ ((sentinel(1)));
void f3(int a, ...) __attribute__ ((sentinel("hello"))); //expected-error{{'sentinel' attribute requires parameter 1 to be an integer constant}}
-void f4(int a, ...) __attribute__ ((sentinel(1, 2, 3))); //expected-error{{attribute requires 0, 1 or 2 argument(s)}}
+void f4(int a, ...) __attribute__ ((sentinel(1, 2, 3))); //expected-error{{attribute takes no more than 2 arguments}}
void f4(int a, ...) __attribute__ ((sentinel(-1))); //expected-error{{parameter 1 less than zero}}
void f4(int a, ...) __attribute__ ((sentinel(0, 2))); // expected-error{{parameter 2 not 0 or 1}}
diff --git a/test/Sema/shift.c b/test/Sema/shift.c
index df6b1141bdfc..28407be079f4 100644
--- a/test/Sema/shift.c
+++ b/test/Sema/shift.c
@@ -56,3 +56,13 @@ void test() {
#define ashift 8
enum { b = (a << ashift) };
+// Don't warn for negative shifts in code that is unreachable.
+void test_pr5544() {
+ (void) (((1) > 63 && (1) < 128 ? (((unsigned long long) 1)<<((1)-64)) : (unsigned long long) 0)); // no-warning
+}
+
+void test_shift_too_much(char x) {
+ if (0)
+ (void) (x >> 80); // no-warning
+ (void) (x >> 80); // expected-warning {{shift count >= width of type}}
+}
diff --git a/test/Sema/static-assert.c b/test/Sema/static-assert.c
new file mode 100644
index 000000000000..13d70708582b
--- /dev/null
+++ b/test/Sema/static-assert.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+
+_Static_assert("foo", "string is nonzero"); // expected-error {{static_assert expression is not an integral constant expression}}
+
+_Static_assert(1, "1 is nonzero");
+_Static_assert(0, "0 is nonzero"); // expected-error {{static_assert failed "0 is nonzero"}}
+
+void foo(void) {
+ _Static_assert(1, "1 is nonzero");
+ _Static_assert(0, "0 is nonzero"); // expected-error {{static_assert failed "0 is nonzero"}}
+}
diff --git a/test/Sema/struct-decl.c b/test/Sema/struct-decl.c
index 3639d2479b97..e1c7073e01b2 100644
--- a/test/Sema/struct-decl.c
+++ b/test/Sema/struct-decl.c
@@ -46,3 +46,14 @@ struct s0 f0(void) {}
struct x0 {
unsigned int x1;
};
+
+// rdar://problem/9150338
+static struct test1 { // expected-warning {{'static' ignored on this declaration}}
+ int x;
+};
+const struct test2 { // expected-warning {{'const' ignored on this declaration}}
+ int x;
+};
+inline struct test3 { // expected-warning {{'inline' ignored on this declaration}}
+ int x;
+};
diff --git a/test/Sema/uninit-variables-vectors.c b/test/Sema/uninit-variables-vectors.c
new file mode 100644
index 000000000000..10a8ecc378f0
--- /dev/null
+++ b/test/Sema/uninit-variables-vectors.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fsyntax-only -Wuninitialized -fsyntax-only %s -verify
+
+typedef int __v4si __attribute__((__vector_size__(16)));
+typedef float __m128 __attribute__((__vector_size__(16)));
+__m128 _mm_xor_ps(__m128 a, __m128 b);
+__m128 _mm_loadu_ps(const float *p);
+
+void test1(float *input) {
+ __m128 x, y, z, w, X; // expected-note {{variable 'x' is declared here}} expected-note {{variable 'y' is declared here}} expected-note {{variable 'w' is declared here}} expected-note {{variable 'z' is declared here}}
+ x = _mm_xor_ps(x,x); // expected-warning {{variable 'x' is uninitialized when used here}}
+ y = _mm_xor_ps(y,y); // expected-warning {{variable 'y' is uninitialized when used here}}
+ z = _mm_xor_ps(z,z); // expected-warning {{variable 'z' is uninitialized when used here}}
+ w = _mm_xor_ps(w,w); // expected-warning {{variable 'w' is uninitialized when used here}}
+ X = _mm_loadu_ps(&input[0]);
+ X = _mm_xor_ps(X,X); // no-warning
+}
+
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
index 973e504f634d..60cae802ae73 100644
--- a/test/Sema/uninit-variables.c
+++ b/test/Sema/uninit-variables.c
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only -fblocks %s -verify
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -Wconditional-uninitialized -fsyntax-only -fblocks %s -verify
int test1() {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
int test2() {
@@ -18,19 +18,19 @@ int test3() {
int test4() {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- ++x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ ++x; // expected-warning{{variable 'x' is uninitialized when used here}}
return x;
}
int test5() {
int x, y; // expected-note{{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
- x = y; // expected-warning{{variable 'y' is possibly uninitialized when used here}}
+ x = y; // expected-warning{{variable 'y' is uninitialized when used here}}
return x;
}
int test6() {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- x += 2; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ x += 2; // expected-warning{{variable 'x' is uninitialized when used here}}
return x;
}
@@ -38,7 +38,7 @@ int test7(int y) {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
if (y)
x = 1;
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
}
int test8(int y) {
@@ -57,7 +57,7 @@ int test9(int n) {
break;
x = 1;
}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
}
int test10(unsigned n) {
@@ -65,7 +65,7 @@ int test10(unsigned n) {
for (unsigned i = 0 ; i < n; ++i) {
x = 1;
}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
}
int test11(unsigned n) {
@@ -73,11 +73,11 @@ int test11(unsigned n) {
for (unsigned i = 0 ; i <= n; ++i) {
x = 1;
}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' may be uninitialized when used here}}
}
void test12(unsigned n) {
- for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' is possibly uninitialized when used here}} expected-note{{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' may be uninitialized when used here}} expected-note{{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}}
}
int test13() {
@@ -91,8 +91,10 @@ void test14() {
for (;;) {}
}
-void test15() {
- int x = x; // expected-warning{{variable 'x' is possibly uninitialized when used here}} expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
+int test15() {
+ int x = x; // no-warning: signals intended lack of initialization. \
+ // expected-note{{variable 'x' is declared here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
// Don't warn in the following example; shows dataflow confluence.
@@ -107,7 +109,7 @@ void test17() {
// Don't warn multiple times about the same uninitialized variable
// along the same path.
int *x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- *x = 1; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ *x = 1; // expected-warning{{variable 'x' is uninitialized when used here}}
*x = 1; // no-warning
}
@@ -132,14 +134,14 @@ int test19() {
int test20() {
int z; // expected-note{{variable 'z' is declared here}} expected-note{{add initialization to silence this warning}}
if ((test19_aux1() + test19_aux2() && test19_aux1()) || test19_aux3(&z))
- return z; // expected-warning{{variable 'z' is possibly uninitialized when used here}}
+ return z; // expected-warning{{variable 'z' may be uninitialized when used here}}
return 0;
}
int test21(int x, int y) {
int z; // expected-note{{variable 'z' is declared here}} expected-note{{add initialization to silence this warning}}
if ((x && y) || test19_aux3(&z) || test19_aux2())
- return z; // expected-warning{{variable 'z' is possibly uninitialized when used here}}
+ return z; // expected-warning{{variable 'z' may be uninitialized when used here}}
return 0;
}
@@ -167,18 +169,18 @@ int test24(int flag) {
val = 1;
if (!flag)
val = 1;
- return val; // expected-warning{{variable 'val' is possibly uninitialized when used here}}
+ return val; // expected-warning{{variable 'val' may be uninitialized when used here}}
}
float test25() {
float x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
typedef int MyInt;
MyInt test26() {
MyInt x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
// Test handling of sizeof().
@@ -189,12 +191,12 @@ int test27() {
int test28() {
int len; // expected-note{{variable 'len' is declared here}} expected-note{{add initialization to silence this warning}}
- return sizeof(int[len]); // expected-warning{{variable 'len' is possibly uninitialized when used here}}
+ return sizeof(int[len]); // expected-warning{{variable 'len' is uninitialized when used here}}
}
void test29() {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
- (void) ^{ (void) x; }; // expected-warning{{variable 'x' is possibly uninitialized when captured by block}}
+ (void) ^{ (void) x; }; // expected-warning{{variable 'x' is uninitialized when captured by block}}
}
void test30() {
@@ -220,7 +222,7 @@ void test_33() {
int test_34() {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
(void) x;
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
// Test that this case doesn't crash.
@@ -235,7 +237,7 @@ void test36()
void **pc; // expected-note{{variable 'pc' is declared here}} expected-note{{add initialization to silence this warning}}
void *dummy[] = { &&L1, &&L2 };
L1:
- goto *pc; // expected-warning{{variable 'pc' is possibly uninitialized when used here}}
+ goto *pc; // expected-warning{{variable 'pc' may be uninitialized when used here}}
L2:
goto *pc;
}
@@ -260,3 +262,80 @@ int test38(int r, int x, int y)
return ((r < 0) || ((r == 0) && (x < y)));
}
+int test39(int x) {
+ int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
+ int z = x + y; // expected-warning {{variable 'y' is uninitialized when used here}}
+ return z;
+}
+
+
+int test40(int x) {
+ int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
+ return x ? 1 : y; // expected-warning {{variable 'y' is uninitialized when used here}}
+}
+
+int test41(int x) {
+ int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
+ if (x) y = 1; // no-warning
+ return y; // expected-warning {{variable 'y' may be uninitialized when used here}}
+}
+
+void test42() {
+ int a;
+ a = 30; // no-warning
+}
+
+void test43_aux(int x);
+void test43(int i) {
+ int x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (i = 0 ; i < 10; i++)
+ test43_aux(x++); // expected-warning {{variable 'x' may be uninitialized when used here}}
+}
+
+void test44(int i) {
+ int x = i;
+ int y; // expected-note {{variable 'y' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (i = 0; i < 10; i++ ) {
+ test43_aux(x++); // no-warning
+ x += y; // expected-warning {{variable 'y' may be uninitialized when used here}}
+ }
+}
+
+int test45(int j) {
+ int x = 1, y = x + 1;
+ if (y) // no-warning
+ return x;
+ return y;
+}
+
+void test46()
+{
+ int i; // expected-note {{variable 'i' is declared here}} expected-note{{add initialization to silence this warning}}
+ int j = i ? : 1; // expected-warning {{variable 'i' is uninitialized when used here}}
+}
+
+void *test47(int *i)
+{
+ return i ? : 0; // no-warning
+}
+
+void *test49(int *i)
+{
+ int a;
+ return &a ? : i; // no-warning
+}
+
+void test50()
+{
+ char c[1 ? : 2]; // no-warning
+}
+
+int test51(void)
+{
+ __block int a;
+ ^(void) {
+ a = 42;
+ }();
+ return a; // no-warning
+}
+
diff --git a/test/Sema/vector-ops.c b/test/Sema/vector-ops.c
index 20575ec510c3..ca397375d739 100644
--- a/test/Sema/vector-ops.c
+++ b/test/Sema/vector-ops.c
@@ -12,6 +12,9 @@ void test1(v2u v2ua, v2s v2sa, v2f v2fa) {
(void)(~v2ua);
(void)(~v2fa); // expected-error{{invalid argument type 'v2f' to unary}}
+ // Comparison operators
+ v2ua = (v2ua==v2sa);
+
// Arrays
int array1[v2ua]; // expected-error{{size of array has non-integer type 'v2u'}}
int array2[17];
diff --git a/test/Sema/warn-gnu-designators.c b/test/Sema/warn-gnu-designators.c
index d5ac8cfe5539..bdb3374288df 100644
--- a/test/Sema/warn-gnu-designators.c
+++ b/test/Sema/warn-gnu-designators.c
@@ -1,2 +1,2 @@
// RUN: %clang_cc1 -Wno-gnu-designator -verify %s
-struct { int x, y, z[12] } value = { x:17, .z [3 ... 5] = 7 };
+struct { int x, y, z[12]; } value = { x:17, .z [3 ... 5] = 7 };
diff --git a/test/Sema/warn-unused-function.c b/test/Sema/warn-unused-function.c
index 5bbcf18a623d..8f4cdcba881e 100644
--- a/test/Sema/warn-unused-function.c
+++ b/test/Sema/warn-unused-function.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-function -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-function -Wunneeded-internal-declaration -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
@@ -6,7 +6,7 @@ void foo() {}
static void f2() {}
static void f1() {f2();} // expected-warning{{unused}}
-static int f0() { return 17; } // expected-warning{{unused}}
+static int f0() { return 17; } // expected-warning{{not needed and will not be emitted}}
int x = sizeof(f0());
static void f3();
@@ -46,7 +46,7 @@ static void f12(void) { } // expected-warning{{unused}}
static void f12(void);
// PR7923
-static void unused(void) { unused(); } // expected-warning{{unused}}
+static void unused(void) { unused(); } // expected-warning{{not needed and will not be emitted}}
// rdar://8728293
static void cleanupMalloc(char * const * const allocation) { }
diff --git a/test/Sema/warn-unused-value.c b/test/Sema/warn-unused-value.c
index 876eb9e4823e..95cd8fb70400 100644
--- a/test/Sema/warn-unused-value.c
+++ b/test/Sema/warn-unused-value.c
@@ -72,6 +72,15 @@ int test_logical_bar() {
return x;
}
+// PR8282
+void conditional_for_control_flow(int cond, int x, int y)
+{
+ cond? y++ : x; // no-warning
+ cond? y : ++x; // no-warning
+ cond? (x |= y) : ++x; // no-warning
+ cond? y : x; // expected-warning {{expression result unused}}
+}
+
struct s0 { int f0; };
void f0(int a);
diff --git a/test/Sema/warn-write-strings.c b/test/Sema/warn-write-strings.c
index dd0bb8a6d83a..dee554cf6b57 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
+// RUN: %clang_cc1 -verify -fsyntax-only -fconst-strings %s
// PR4804
char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'const char [4]' discards qualifiers}}
diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp
index 30ad4d0482f6..2d620b6da620 100644
--- a/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/test/SemaCXX/MicrosoftExtensions.cpp
@@ -1,24 +1,16 @@
-// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexceptions
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexceptions -fcxx-exceptions
// ::type_info is predeclared with forward class declartion
void f(const type_info &a);
-// The following three are all equivalent when ms-extensions are on
-void foo() throw(int);
-void foo() throw(int, long);
-void foo() throw(...);
-void foo(); // expected-note {{previous declaration}}
-
-// Only nothrow specification is treated specially.
-void foo() throw(); // expected-error {{exception specification in declaration does not match previous declaration}}
-// throw(...)
-void r3();
-void r3() throw(...);
+// Microsoft doesn't validate exception specification.
+void foo(); // expected-note {{previous declaration}}
+void foo() throw(); // expected-warning {{exception specification in declaration does not match previous declaration}}
-void r6() throw(...);
-void r6() throw(int); // okay
+void r6() throw(...); // expected-note {{previous declaration}}
+void r6() throw(int); // expected-warning {{exception specification in declaration does not match previous declaration}}
struct Base {
virtual void f2();
@@ -122,3 +114,69 @@ struct X0 {
enum : long long { // expected-warning{{enumeration types with a fixed underlying type are a Microsoft extension}}
SomeValue = 0x100000000
};
+
+
+class AAA {
+__declspec(dllimport) void f(void) { }
+void f2(void);
+};
+
+__declspec(dllimport) void AAA::f2(void) { // expected-error {{dllimport attribute can be applied only to symbol}}
+
+}
+
+
+
+template <class T>
+class BB {
+public:
+ void f(int g = 10 ); // expected-note {{previous definition is here}}
+};
+
+template <class T>
+void BB<T>::f(int g = 0) { } // expected-warning {{redefinition of default argument}}
+
+
+namespace MissingTypename {
+
+template<class T> class A {
+public:
+ typedef int TYPE;
+};
+
+template<class T> class B {
+public:
+ typedef int TYPE;
+};
+
+
+template<class T, class U>
+class C : private A<T>, public B<U> {
+public:
+ typedef A<T> Base1;
+ typedef B<U> Base2;
+ typedef A<U> Base3;
+
+ A<T>::TYPE a1; // expected-warning {{missing 'typename' prior to dependent type name}}
+ Base1::TYPE a2; // expected-warning {{missing 'typename' prior to dependent type name}}
+
+ B<U>::TYPE a3; // expected-warning {{missing 'typename' prior to dependent type name}}
+ Base2::TYPE a4; // expected-warning {{missing 'typename' prior to dependent type name}}
+
+ A<U>::TYPE a5; // expected-error {{missing 'typename' prior to dependent type name}}
+ Base3::TYPE a6; // expected-error {{missing 'typename' prior to dependent type name}}
+ };
+
+}
+
+
+
+
+extern void static_func();
+void static_func(); // expected-note {{previous declaration is here}}
+
+
+static void static_func() // expected-warning {{static declaration of 'static_func' follows non-static declaration}}
+{
+
+} \ No newline at end of file
diff --git a/test/SemaCXX/PR9459.cpp b/test/SemaCXX/PR9459.cpp
new file mode 100644
index 000000000000..dfb242dc5952
--- /dev/null
+++ b/test/SemaCXX/PR9459.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Don't crash.
+
+template<typename>struct ae_same;
+template<typename>struct ts{}ap()
+{ts<a>::ap<ae_same<int>::&ae_same<>>::p(a); }; // expected-error {{use of undeclared identifier 'a'}}
diff --git a/test/SemaCXX/PR9460.cpp b/test/SemaCXX/PR9460.cpp
new file mode 100644
index 000000000000..2cc435e495d2
--- /dev/null
+++ b/test/SemaCXX/PR9460.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Don't crash.
+
+template<typename aT>
+struct basic_string{
+ a; // expected-error {{requires a type specifier}}
+ basic_string(aT*);
+};
+
+struct runtime_error{ // expected-note {{candidate constructor}}
+ runtime_error( // expected-note {{candidate constructor}}
+basic_string<char> struct{ // expected-error {{cannot combine with previous 'type-name' declaration specifier}}
+a(){ // expected-error {{requires a type specifier}}
+ runtime_error(0); // expected-error {{no matching conversion}}
+}
+}
+);
+};
diff --git a/test/SemaCXX/PR9461.cpp b/test/SemaCXX/PR9461.cpp
new file mode 100644
index 000000000000..ce17931324e0
--- /dev/null
+++ b/test/SemaCXX/PR9461.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Don't crash.
+
+template<typename,typename=int,typename=int>struct basic_string;
+
+typedef basic_string<char> string;
+
+
+
+template<typename aT,typename,typename oc>
+struct basic_string
+{
+int us;
+basic_string(const aT*,const oc&a=int());
+
+int _S_construct();
+
+int _S_construct(int);
+
+_S_construct(); // expected-error {{requires}}
+};
+
+template<typename _CharT,typename _Traits,typename _Alloc>
+basic_string<_CharT,_Traits,_Alloc>::basic_string(const _CharT*,const _Alloc&)
+:us(_S_construct)
+{string a;}
+
+struct runtime_error{runtime_error(string);}; // expected-note 2 {{candidate constructor}}
+
+struct system_error:runtime_error{ // expected-note {{to match}} expected-note {{specified here}}
+system_error():time_error("" // expected-error 4 {{expected}} expected-error {{initializer}} expected-note {{to match}} expected-error {{no matching constructor}}
diff --git a/test/SemaCXX/PR9572.cpp b/test/SemaCXX/PR9572.cpp
new file mode 100644
index 000000000000..d1b70778d062
--- /dev/null
+++ b/test/SemaCXX/PR9572.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+class Base {
+ virtual ~Base();
+};
+struct Foo : public Base {
+ const int kBlah = 3; // expected-error{{fields can only be initialized in constructors}}
+ Foo();
+};
+struct Bar : public Foo {
+ Bar() { }
+};
+struct Baz {
+ Foo f;
+ Baz() { }
+};
diff --git a/test/SemaCXX/__try.cpp b/test/SemaCXX/__try.cpp
new file mode 100644
index 000000000000..cb5d38a097ef
--- /dev/null
+++ b/test/SemaCXX/__try.cpp
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fborland-extensions -fcxx-exceptions %s
+
+// This test is from http://docwiki.embarcadero.com/RADStudio/en/Try
+
+int puts(const char *);
+
+template<typename T>
+int printf(const char *, T);
+
+const char * strdup(const char *);
+
+void free(const void *);
+
+#define EXCEPTION_EXECUTE_HANDLER 1
+
+class Exception
+{
+public:
+ Exception(const char* s = "Unknown"){what = strdup(s); }
+ Exception(const Exception& e ){what = strdup(e.what); }
+ ~Exception() {free(what); }
+ const char* msg() const {return what; }
+private:
+ const char* what;
+};
+
+int main()
+{
+ float e, f, g;
+ try
+ {
+ try
+ {
+ f = 1.0;
+ g = 0.0;
+ try
+ {
+ puts("Another exception:");
+
+ e = f / g;
+ }
+ __except(EXCEPTION_EXECUTE_HANDLER)
+ {
+ puts("Caught a C-based exception.");
+ throw(Exception("Hardware error: Divide by 0"));
+ }
+ }
+ catch(const Exception& e)
+ {
+ printf("Caught C++ Exception: %s :\n", e.msg());
+ }
+ }
+ __finally
+ {
+ puts("C++ allows __finally too!");
+ }
+ return e;
+}
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index a1079ff5bac6..a36fd582db2e 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -57,11 +57,12 @@ struct B
struct C {
C &getC() {
- return makeAC; // expected-error{{address of overloaded function 'makeAC'}}
+ // FIXME: this error message is terrible
+ return makeAC; // expected-error{{cannot bind to a value of unrelated type}}
}
- C &makeAC(); //expected-note{{candidate function}}
- const C &makeAC() const; //expected-note{{candidate function}}
+ C &makeAC();
+ const C &makeAC() const;
static void f(); // expected-note{{candidate function}}
static void f(int); // expected-note{{candidate function}}
diff --git a/test/SemaCXX/address-space-conversion.cpp b/test/SemaCXX/address-space-conversion.cpp
new file mode 100644
index 000000000000..d21d4194235b
--- /dev/null
+++ b/test/SemaCXX/address-space-conversion.cpp
@@ -0,0 +1,197 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// This test checks for the various conversions and casting operations
+// with address-space-qualified pointers.
+
+struct A { virtual ~A() {} };
+struct B : A { };
+
+typedef void *void_ptr;
+typedef void __attribute__((address_space(1))) *void_ptr_1;
+typedef void __attribute__((address_space(2))) *void_ptr_2;
+
+typedef int *int_ptr;
+typedef int __attribute__((address_space(1))) *int_ptr_1;
+typedef int __attribute__((address_space(2))) *int_ptr_2;
+
+typedef A *A_ptr;
+typedef A __attribute__((address_space(1))) *A_ptr_1;
+typedef A __attribute__((address_space(2))) *A_ptr_2;
+
+typedef B *B_ptr;
+typedef B __attribute__((address_space(1))) *B_ptr_1;
+typedef B __attribute__((address_space(2))) *B_ptr_2;
+
+void test_const_cast(int_ptr ip, int_ptr_1 ip1, int_ptr_2 ip2,
+ A_ptr ap, A_ptr_1 ap1, A_ptr_2 ap2,
+ const int *cip,
+ const int __attribute__((address_space(1))) *cip1) {
+ // Cannot use const_cast to cast between address spaces, add an
+ // address space, or remove an address space.
+ (void)const_cast<int_ptr>(ip1); // expected-error{{is not allowed}}
+ (void)const_cast<int_ptr>(ip2); // expected-error{{is not allowed}}
+ (void)const_cast<int_ptr_1>(ip); // expected-error{{is not allowed}}
+ (void)const_cast<int_ptr_1>(ip2); // expected-error{{is not allowed}}
+ (void)const_cast<int_ptr_2>(ip); // expected-error{{is not allowed}}
+ (void)const_cast<int_ptr_2>(ip1); // expected-error{{is not allowed}}
+
+ (void)const_cast<A_ptr>(ap1); // expected-error{{is not allowed}}
+ (void)const_cast<A_ptr>(ap2); // expected-error{{is not allowed}}
+ (void)const_cast<A_ptr_1>(ap); // expected-error{{is not allowed}}
+ (void)const_cast<A_ptr_1>(ap2); // expected-error{{is not allowed}}
+ (void)const_cast<A_ptr_2>(ap); // expected-error{{is not allowed}}
+ (void)const_cast<A_ptr_2>(ap1); // expected-error{{is not allowed}}
+
+ // It's acceptable to cast away constness.
+ (void)const_cast<int_ptr>(cip);
+ (void)const_cast<int_ptr_1>(cip1);
+}
+
+void test_static_cast(void_ptr vp, void_ptr_1 vp1, void_ptr_2 vp2,
+ A_ptr ap, A_ptr_1 ap1, A_ptr_2 ap2,
+ B_ptr bp, B_ptr_1 bp1, B_ptr_2 bp2) {
+ // Well-formed upcast
+ (void)static_cast<A_ptr>(bp);
+ (void)static_cast<A_ptr_1>(bp1);
+ (void)static_cast<A_ptr_2>(bp2);
+
+ // Well-formed downcast
+ (void)static_cast<B_ptr>(ap);
+ (void)static_cast<B_ptr_1>(ap1);
+ (void)static_cast<B_ptr_2>(ap2);
+
+ // Well-formed cast to/from void
+ (void)static_cast<void_ptr>(ap);
+ (void)static_cast<void_ptr_1>(ap1);
+ (void)static_cast<void_ptr_2>(ap2);
+ (void)static_cast<A_ptr>(vp);
+ (void)static_cast<A_ptr_1>(vp1);
+ (void)static_cast<A_ptr_2>(vp2);
+
+ // Ill-formed upcasts
+ (void)static_cast<A_ptr>(bp1); // expected-error{{is not allowed}}
+ (void)static_cast<A_ptr>(bp2); // expected-error{{is not allowed}}
+ (void)static_cast<A_ptr_1>(bp); // expected-error{{is not allowed}}
+ (void)static_cast<A_ptr_1>(bp2); // expected-error{{is not allowed}}
+ (void)static_cast<A_ptr_2>(bp); // expected-error{{is not allowed}}
+ (void)static_cast<A_ptr_2>(bp1); // expected-error{{is not allowed}}
+
+ // Ill-formed downcasts
+ (void)static_cast<B_ptr>(ap1); // expected-error{{casts away qualifiers}}
+ (void)static_cast<B_ptr>(ap2); // expected-error{{casts away qualifiers}}
+ (void)static_cast<B_ptr_1>(ap); // expected-error{{casts away qualifiers}}
+ (void)static_cast<B_ptr_1>(ap2); // expected-error{{casts away qualifiers}}
+ (void)static_cast<B_ptr_2>(ap); // expected-error{{casts away qualifiers}}
+ (void)static_cast<B_ptr_2>(ap1); // expected-error{{casts away qualifiers}}
+
+ // Ill-formed cast to/from void
+ (void)static_cast<void_ptr>(ap1); // expected-error{{is not allowed}}
+ (void)static_cast<void_ptr>(ap2); // expected-error{{is not allowed}}
+ (void)static_cast<void_ptr_1>(ap); // expected-error{{is not allowed}}
+ (void)static_cast<void_ptr_1>(ap2); // expected-error{{is not allowed}}
+ (void)static_cast<void_ptr_2>(ap); // expected-error{{is not allowed}}
+ (void)static_cast<void_ptr_2>(ap1); // expected-error{{is not allowed}}
+ (void)static_cast<A_ptr>(vp1); // expected-error{{casts away qualifiers}}
+ (void)static_cast<A_ptr>(vp2); // expected-error{{casts away qualifiers}}
+ (void)static_cast<A_ptr_1>(vp); // expected-error{{casts away qualifiers}}
+ (void)static_cast<A_ptr_1>(vp2); // expected-error{{casts away qualifiers}}
+ (void)static_cast<A_ptr_2>(vp); // expected-error{{casts away qualifiers}}
+ (void)static_cast<A_ptr_2>(vp1); // expected-error{{casts away qualifiers}}
+}
+
+void test_dynamic_cast(A_ptr ap, A_ptr_1 ap1, A_ptr_2 ap2,
+ B_ptr bp, B_ptr_1 bp1, B_ptr_2 bp2) {
+ // Well-formed upcast
+ (void)dynamic_cast<A_ptr>(bp);
+ (void)dynamic_cast<A_ptr_1>(bp1);
+ (void)dynamic_cast<A_ptr_2>(bp2);
+
+ // Well-formed downcast
+ (void)dynamic_cast<B_ptr>(ap);
+ (void)dynamic_cast<B_ptr_1>(ap1);
+ (void)dynamic_cast<B_ptr_2>(ap2);
+
+ // Ill-formed upcasts
+ (void)dynamic_cast<A_ptr>(bp1); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<A_ptr>(bp2); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<A_ptr_1>(bp); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<A_ptr_1>(bp2); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<A_ptr_2>(bp); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<A_ptr_2>(bp1); // expected-error{{casts away qualifiers}}
+
+ // Ill-formed downcasts
+ (void)dynamic_cast<B_ptr>(ap1); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<B_ptr>(ap2); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<B_ptr_1>(ap); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<B_ptr_1>(ap2); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<B_ptr_2>(ap); // expected-error{{casts away qualifiers}}
+ (void)dynamic_cast<B_ptr_2>(ap1); // expected-error{{casts away qualifiers}}
+}
+
+void test_reinterpret_cast(void_ptr vp, void_ptr_1 vp1, void_ptr_2 vp2,
+ A_ptr ap, A_ptr_1 ap1, A_ptr_2 ap2,
+ B_ptr bp, B_ptr_1 bp1, B_ptr_2 bp2,
+ const void __attribute__((address_space(1))) *cvp1) {
+ // reinterpret_cast can be used to cast to a different address space.
+ (void)reinterpret_cast<A_ptr>(ap1);
+ (void)reinterpret_cast<A_ptr>(ap2);
+ (void)reinterpret_cast<A_ptr>(bp);
+ (void)reinterpret_cast<A_ptr>(bp1);
+ (void)reinterpret_cast<A_ptr>(bp2);
+ (void)reinterpret_cast<A_ptr>(vp);
+ (void)reinterpret_cast<A_ptr>(vp1);
+ (void)reinterpret_cast<A_ptr>(vp2);
+ (void)reinterpret_cast<A_ptr_1>(ap);
+ (void)reinterpret_cast<A_ptr_1>(ap2);
+ (void)reinterpret_cast<A_ptr_1>(bp);
+ (void)reinterpret_cast<A_ptr_1>(bp1);
+ (void)reinterpret_cast<A_ptr_1>(bp2);
+ (void)reinterpret_cast<A_ptr_1>(vp);
+ (void)reinterpret_cast<A_ptr_1>(vp1);
+ (void)reinterpret_cast<A_ptr_1>(vp2);
+
+ // ... but don't try to cast away constness!
+ (void)reinterpret_cast<A_ptr_2>(cvp1); // expected-error{{casts away qualifiers}}
+}
+
+void test_cstyle_cast(void_ptr vp, void_ptr_1 vp1, void_ptr_2 vp2,
+ A_ptr ap, A_ptr_1 ap1, A_ptr_2 ap2,
+ B_ptr bp, B_ptr_1 bp1, B_ptr_2 bp2,
+ const void __attribute__((address_space(1))) *cvp1) {
+ // C-style casts are the wild west of casts.
+ (void)(A_ptr)(ap1);
+ (void)(A_ptr)(ap2);
+ (void)(A_ptr)(bp);
+ (void)(A_ptr)(bp1);
+ (void)(A_ptr)(bp2);
+ (void)(A_ptr)(vp);
+ (void)(A_ptr)(vp1);
+ (void)(A_ptr)(vp2);
+ (void)(A_ptr_1)(ap);
+ (void)(A_ptr_1)(ap2);
+ (void)(A_ptr_1)(bp);
+ (void)(A_ptr_1)(bp1);
+ (void)(A_ptr_1)(bp2);
+ (void)(A_ptr_1)(vp);
+ (void)(A_ptr_1)(vp1);
+ (void)(A_ptr_1)(vp2);
+ (void)(A_ptr_2)(cvp1);
+}
+
+void test_implicit_conversion(void_ptr vp, void_ptr_1 vp1, void_ptr_2 vp2,
+ A_ptr ap, A_ptr_1 ap1, A_ptr_2 ap2,
+ B_ptr bp, B_ptr_1 bp1, B_ptr_2 bp2) {
+ // Well-formed conversions
+ void_ptr vpA = ap;
+ void_ptr_1 vp_1A = ap1;
+ void_ptr_2 vp_2A = ap2;
+ A_ptr ap_A = bp;
+ A_ptr_1 ap_A1 = bp1;
+ A_ptr_2 ap_A2 = bp2;
+
+ // Ill-formed conversions
+ void_ptr vpB = ap1; // expected-error{{cannot initialize a variable of type}}
+ void_ptr_1 vp_1B = ap2; // expected-error{{cannot initialize a variable of type}}
+ A_ptr ap_B = bp1; // expected-error{{cannot initialize a variable of type}}
+ A_ptr_1 ap_B1 = bp2; // expected-error{{cannot initialize a variable of type}}
+}
diff --git a/test/SemaCXX/address-space-newdelete.cpp b/test/SemaCXX/address-space-newdelete.cpp
new file mode 100644
index 000000000000..b809cd3fadcc
--- /dev/null
+++ b/test/SemaCXX/address-space-newdelete.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void* operator new (__SIZE_TYPE__ size, void* ptr);
+void* operator new[](__SIZE_TYPE__ size, void* ptr);
+
+typedef int __attribute__((address_space(1))) int_1;
+
+void test_new(void *p) {
+ (void)new int_1; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+ (void)new __attribute__((address_space(1))) int; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+ (void)new int_1 [5]; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+ (void)new __attribute__((address_space(1))) int [5]; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+
+ // Placement new
+ (void)new (p) int_1; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+ (void)new (p) __attribute__((address_space(1))) int; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+ (void)new (p) int_1 [5]; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+ (void)new (p) __attribute__((address_space(1))) int [5]; // expected-error{{'new' cannot allocate objects of type 'int' in address space '1'}}
+}
+
+void test_delete(int_1 *ip1) {
+ delete ip1; // expected-error{{'delete' cannot delete objects of type 'int' in address space '1'}}
+ delete [] ip1; // expected-error{{'delete' cannot delete objects of type 'int' in address space '1'}}
+}
diff --git a/test/SemaCXX/address-space-references.cpp b/test/SemaCXX/address-space-references.cpp
new file mode 100644
index 000000000000..f5a63d24a968
--- /dev/null
+++ b/test/SemaCXX/address-space-references.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef int __attribute__((address_space(1))) int_1;
+typedef int __attribute__((address_space(2))) int_2;
+
+void f0(int_1 &); // expected-note{{candidate function not viable: 1st argument ('int') is in address space 0, but parameter must be in address space 1}} \
+// expected-note{{candidate function not viable: 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')) is in address space 2, but parameter must be in address space 1}}
+void f0(const int_1 &); // expected-note{{candidate function not viable: 1st argument ('int') is in address space 0, but parameter must be in address space 1}} \
+// expected-note{{candidate function not viable: 1st argument ('int_2' (aka '__attribute__((address_space(2))) int')) is in address space 2, but parameter must be in address space 1}}
+
+void test_f0() {
+ int i;
+ static int_1 i1;
+ static int_2 i2;
+
+ f0(i); // expected-error{{no matching function for call to 'f0'}}
+ f0(i1);
+ f0(i2); // expected-error{{no matching function for call to 'f0'}}
+}
diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp
index 761edfc6393a..b517e43cf1ff 100644
--- a/test/SemaCXX/alignof-sizeof-reference.cpp
+++ b/test/SemaCXX/alignof-sizeof-reference.cpp
@@ -8,8 +8,8 @@ void test() {
static_assert(sizeof(r) == 1, "bad size");
}
-void f();
-void f(int);
+void f(); // expected-note{{candidate function}}
+void f(int); // expected-note{{candidate function}}
void g() {
- sizeof(&f); // expected-error{{cannot resolve overloaded function from context}}
+ sizeof(&f); // expected-error{{cannot resolve overloaded function 'f' from context}}
}
diff --git a/test/SemaCXX/altivec.cpp b/test/SemaCXX/altivec.cpp
index 921bb73f9ead..504eb1b33660 100644
--- a/test/SemaCXX/altivec.cpp
+++ b/test/SemaCXX/altivec.cpp
@@ -2,6 +2,36 @@
typedef int V4i __attribute__((vector_size(16)));
+void test_vec_step(vector short arg1) {
+ vector bool char vbc;
+ vector signed char vsc;
+ vector unsigned char vuc;
+ vector bool short vbs;
+ vector short vs;
+ vector unsigned short vus;
+ vector pixel vp;
+ vector bool int vbi;
+ vector int vi;
+ vector unsigned int vui;
+ vector float vf;
+
+ vector int *pvi;
+
+ int res1[vec_step(arg1) == 8 ? 1 : -1];
+ int res2[vec_step(vbc) == 16 ? 1 : -1];
+ int res3[vec_step(vsc) == 16 ? 1 : -1];
+ int res4[vec_step(vuc) == 16 ? 1 : -1];
+ int res5[vec_step(vbs) == 8 ? 1 : -1];
+ int res6[vec_step(vs) == 8 ? 1 : -1];
+ int res7[vec_step(vus) == 8 ? 1 : -1];
+ int res8[vec_step(vp) == 8 ? 1 : -1];
+ int res9[vec_step(vbi) == 4 ? 1 : -1];
+ int res10[vec_step(vi) == 4 ? 1 : -1];
+ int res11[vec_step(vui) == 4 ? 1 : -1];
+ int res12[vec_step(vf) == 4 ? 1 : -1];
+ int res13[vec_step(*pvi) == 4 ? 1 : -1];
+}
+
void f(V4i a)
{
}
diff --git a/test/SemaCXX/array-bounds.cpp b/test/SemaCXX/array-bounds.cpp
index 80646c719078..3bd6c35420d7 100644
--- a/test/SemaCXX/array-bounds.cpp
+++ b/test/SemaCXX/array-bounds.cpp
@@ -120,3 +120,56 @@ int test_pr9296() {
return array[true]; // no-warning
}
+int test_sizeof_as_condition(int flag) {
+ int arr[2] = { 0, 0 }; // expected-note {{array 'arr' declared here}}
+ if (flag)
+ return sizeof(char) != sizeof(char) ? arr[2] : arr[1];
+ return sizeof(char) == sizeof(char) ? arr[2] : arr[1]; // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}}
+}
+
+void test_switch() {
+ switch (4) {
+ case 1: {
+ int arr[2];
+ arr[2] = 1; // no-warning
+ break;
+ }
+ case 4: {
+ int arr[2]; // expected-note {{array 'arr' declared here}}
+ arr[2] = 1; // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}}
+ break;
+ }
+ default: {
+ int arr[2];
+ arr[2] = 1; // no-warning
+ break;
+ }
+ }
+}
+
+// Test nested switch statements.
+enum enumA { enumA_A, enumA_B, enumA_C, enumA_D, enumA_E };
+enum enumB { enumB_X, enumB_Y, enumB_Z };
+static enum enumB myVal = enumB_X;
+void test_nested_switch()
+{
+ switch (enumA_E) { // expected-warning {{no case matching constant}}
+ switch (myVal) { // expected-warning {{enumeration values 'enumB_X' and 'enumB_Z' not handled in switch}}
+ case enumB_Y: ;
+ }
+ }
+}
+
+// Test that if all the values of an enum covered, that the 'default' branch
+// is unreachable.
+enum Values { A, B, C, D };
+void test_all_enums_covered(enum Values v) {
+ int x[2];
+ switch (v) {
+ case A: return;
+ case B: return;
+ case C: return;
+ case D: return;
+ }
+ x[2] = 0; // no-warning
+}
diff --git a/test/SemaCXX/attr-nonnull.cpp b/test/SemaCXX/attr-nonnull.cpp
index 19d6642eb553..09c054c19770 100644
--- a/test/SemaCXX/attr-nonnull.cpp
+++ b/test/SemaCXX/attr-nonnull.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S {
+ S(const char *) __attribute__((nonnull(2)));
+
static void f(const char*, const char*) __attribute__((nonnull(1)));
// GCC has a hidden 'this' argument in member functions, so the middle
@@ -10,7 +12,9 @@ struct S {
expected-error{{invalid for the implicit this argument}}
};
-void test(S s) {
+void test() {
+ S s(0); // expected-warning{{null passed}}
+
s.f(0, ""); // expected-warning{{null passed}}
s.f("", 0);
s.g("", 0, ""); // expected-warning{{null passed}}
diff --git a/test/SemaCXX/attr-unavailable.cpp b/test/SemaCXX/attr-unavailable.cpp
index fe3e8b14706f..5f34ed990413 100644
--- a/test/SemaCXX/attr-unavailable.cpp
+++ b/test/SemaCXX/attr-unavailable.cpp
@@ -25,6 +25,6 @@ namespace radar9046492 {
void foo() FOO; // expected-note {{candidate function has been explicitly made unavailable}}
void bar() {
- foo(); // expected-error {{call to unavailable function 'foo' not available - replaced}}
+ foo(); // expected-error {{call to unavailable function 'foo': not available - replaced}}
}
}
diff --git a/test/SemaCXX/auto-subst-failure.cpp b/test/SemaCXX/auto-subst-failure.cpp
new file mode 100644
index 000000000000..442c7e82ccdb
--- /dev/null
+++ b/test/SemaCXX/auto-subst-failure.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+void f() {
+ auto a = f(); // expected-error {{variable has incomplete type 'void'}}
+ auto &b = f(); // expected-error {{cannot form a reference to 'void'}}
+ auto *c = f(); // expected-error {{incompatible initializer of type 'void'}}
+
+ auto d(f()); // expected-error {{variable has incomplete type 'void'}}
+ auto &&e(f()); // expected-error {{cannot form a reference to 'void'}}
+ auto *g(f()); // expected-error {{incompatible initializer of type 'void'}}
+
+ (void)new auto(f()); // expected-error {{allocation of incomplete type 'void'}}
+ (void)new auto&(f()); // expected-error {{cannot form a reference to 'void'}}
+ (void)new auto*(f()); // expected-error {{incompatible constructor argument of type 'void'}}
+}
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index 1da9a1724d31..b95700e9ba18 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x -Wsign-compare %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -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.
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index 61c8ada62fb3..aa47ae0f4825 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -353,3 +353,28 @@ namespace PR8034 {
};
int x = C().operator int();
}
+
+namespace PR9336 {
+ template<class T>
+ struct generic_list
+ {
+ template<class Container>
+ operator Container()
+ {
+ Container ar;
+ T* i;
+ ar[0]=*i;
+ return ar;
+ }
+ };
+
+ template<class T>
+ struct array
+ {
+ T& operator[](int);
+ const T& operator[](int)const;
+ };
+
+ generic_list<generic_list<int> > l;
+ array<array<int> > a = l;
+}
diff --git a/test/SemaCXX/cxx0x-constexpr-const.cpp b/test/SemaCXX/cxx0x-constexpr-const.cpp
new file mode 100644
index 000000000000..79e6dda3e11c
--- /dev/null
+++ b/test/SemaCXX/cxx0x-constexpr-const.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+constexpr int x = 1;
+constexpr int id(int x) { return x; }
+
+void foo(void) {
+ x = 2; // expected-error {{read-only variable is not assignable}}
+ int (*idp)(int) = id;
+}
+
diff --git a/test/SemaCXX/cxx0x-delegating-ctors.cpp b/test/SemaCXX/cxx0x-delegating-ctors.cpp
new file mode 100644
index 000000000000..b211cb1fe004
--- /dev/null
+++ b/test/SemaCXX/cxx0x-delegating-ctors.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+struct foo {
+ int i;
+ foo();
+ foo(int);
+ foo(int, int);
+ foo(bool);
+ foo(char);
+ foo(float*);
+ foo(float&);
+};
+
+// Good
+foo::foo (int i) : i(i) {
+}
+// Good
+foo::foo () : foo(-1) {
+}
+// Good
+foo::foo (int, int) : foo() {
+}
+
+foo::foo (bool) : foo(true) { // expected-error{{delegates to itself}}
+}
+
+// Good
+foo::foo (float* f) : foo(*f) {
+}
+
+// FIXME: This should error
+foo::foo (float &f) : foo(&f) {
+}
+
+foo::foo (char) : i(3), foo(3) { // expected-error{{must appear alone}}
+}
diff --git a/test/SemaCXX/cxx0x-return-init-list.cpp b/test/SemaCXX/cxx0x-return-init-list.cpp
new file mode 100644
index 000000000000..2005a7f9f676
--- /dev/null
+++ b/test/SemaCXX/cxx0x-return-init-list.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// This test checks for a teeny tiny subset of the functionality in
+// the C++0x generalized initializer lists feature, which happens to
+// be used in libstdc++ 4.5. We accept only this syntax so that Clang
+// can handle the libstdc++ 4.5 headers.
+
+int test0(int i) {
+ return { i }; // expected-warning{{generalized initializer lists are a C++0x extension unsupported in Clang}}
+}
+
+template<typename T, typename U>
+T test1(U u) {
+ return { u }; // expected-warning{{generalized initializer lists are a C++0x extension unsupported in Clang}}
+}
+
+template int test1(char);
+template long test1(int);
diff --git a/test/SemaCXX/decltype-98.cpp b/test/SemaCXX/decltype-98.cpp
new file mode 100644
index 000000000000..db52565e6c74
--- /dev/null
+++ b/test/SemaCXX/decltype-98.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s
+extern int x;
+__decltype(1) x = 3;
diff --git a/test/SemaCXX/decltype-overloaded-functions.cpp b/test/SemaCXX/decltype-overloaded-functions.cpp
index c11a47ecdf04..f4aacd64ddbc 100644
--- a/test/SemaCXX/decltype-overloaded-functions.cpp
+++ b/test/SemaCXX/decltype-overloaded-functions.cpp
@@ -1,12 +1,15 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-void f();
-void f(int);
-decltype(f) a; // expected-error{{cannot resolve overloaded function from context}}
+void f(); // expected-note{{candidate function}}
+void f(int); // expected-note{{candidate function}}
+decltype(f) a; // expected-error{{cannot resolve overloaded function 'f' from context}}
template<typename T> struct S {
- decltype(T::f) * f; // expected-error{{cannot resolve overloaded function from context}}
+ decltype(T::f) * f; // expected-error{{cannot resolve overloaded function 'f' from context}}
};
-struct K { void f(); void f(int); };
+struct K {
+ void f(); // expected-note{{candidate function}}
+ void f(int); // expected-note{{candidate function}}
+};
S<K> b; // expected-note{{in instantiation of template class 'S<K>' requested here}}
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index 14a4fb891cd3..01f21de6de17 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -177,3 +177,16 @@ namespace PR9238 {
class B { public: ~B(); };
class C : virtual B { public: ~C() { } };
}
+
+namespace PR7900 {
+ struct A { // expected-note 2{{type 'PR7900::A' is declared here}}
+ };
+ struct B : public A {
+ };
+ void foo() {
+ B b;
+ b.~B();
+ b.~A(); // expected-error{{destructor type 'PR7900::A' in object destruction expression does not match the type 'PR7900::B' of the object being destroyed}}
+ (&b)->~A(); // expected-error{{destructor type 'PR7900::A' in object destruction expression does not match the type 'PR7900::B' of the object being destroyed}}
+ }
+}
diff --git a/test/SemaCXX/enum-scoped.cpp b/test/SemaCXX/enum-scoped.cpp
index cf579e180f69..8c4bfe72d3e2 100644
--- a/test/SemaCXX/enum-scoped.cpp
+++ b/test/SemaCXX/enum-scoped.cpp
@@ -103,3 +103,9 @@ enum : long {
enum : long x; // expected-error{{unnamed enumeration must be a definition}} \
// expected-warning{{declaration does not declare anything}}
+
+void PR9333() {
+ enum class scoped_enum { yes, no, maybe };
+ scoped_enum e = scoped_enum::yes;
+ if (e == scoped_enum::no) { }
+}
diff --git a/test/SemaCXX/exception-spec-no-exceptions.cpp b/test/SemaCXX/exception-spec-no-exceptions.cpp
index 1fe45b0cffcb..2e180706d3b9 100644
--- a/test/SemaCXX/exception-spec-no-exceptions.cpp
+++ b/test/SemaCXX/exception-spec-no-exceptions.cpp
@@ -1,7 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fobjc-exceptions %s
-// Note: this is intentionally -fno-exceptions, not just accidentally
-// so because that's the current -cc1 default.
+// Note that we're specifically excluding -fcxx-exceptions in the command line above.
+
+// That this should work even with -fobjc-exceptions is PR9358
// PR7243: redeclarations
namespace test0 {
diff --git a/test/SemaCXX/exception-spec.cpp b/test/SemaCXX/exception-spec.cpp
deleted file mode 100644
index b4bc78aa9a6d..000000000000
--- a/test/SemaCXX/exception-spec.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s
-
-// Straight from the standard:
-// Plain function with spec
-void f() throw(int);
-// Pointer to function with spec
-void (*fp)() throw (int);
-// Function taking reference to function with spec
-void g(void pfa() throw(int));
-// Typedef for pointer to function with spec
-typedef int (*pf)() throw(int); // expected-error {{specifications are not allowed in typedefs}}
-
-// Some more:
-// Function returning function with spec
-void (*h())() throw(int);
-// Ultimate parser thrill: function with spec returning function with spec and
-// taking pointer to function with spec.
-// The actual function throws int, the return type double, the argument float.
-void (*i() throw(int))(void (*)() throw(float)) throw(double);
-// Pointer to pointer to function taking function with spec
-void (**k)(void pfa() throw(int)); // no-error
-// Pointer to pointer to function with spec
-void (**j)() throw(int); // expected-error {{not allowed beyond a single}}
-// Pointer to function returning pointer to pointer to function with spec
-void (**(*h())())() throw(int); // expected-error {{not allowed beyond a single}}
-
-struct Incomplete; // expected-note 3 {{forward declaration}}
-
-// Exception spec must not have incomplete types, or pointers to them, except
-// void.
-void ic1() throw(void); // expected-error {{incomplete type 'void' is not allowed in exception specification}}
-void ic2() throw(Incomplete); // expected-error {{incomplete type 'Incomplete' is not allowed in exception specification}}
-void ic3() throw(void*);
-void ic4() throw(Incomplete*); // expected-error {{pointer to incomplete type 'Incomplete' is not allowed in exception specification}}
-void ic5() throw(Incomplete&); // expected-error {{reference to incomplete type 'Incomplete' is not allowed in exception specification}}
-
-// Redeclarations
-typedef int INT;
-void r1() throw(int);
-void r1() throw(int);
-
-void r2() throw(int);
-void r2() throw(INT);
-
-// throw-any spec and no spec at all are semantically equivalent
-void r4() throw(int, float);
-void r4() throw(float, int);
-
-void r5() throw(int); // expected-note {{previous declaration}}
-void r5(); // expected-warning {{missing exception specification}}
-
-void r7() throw(int); // expected-note {{previous declaration}}
-void r7() throw(float); // expected-error {{exception specification in declaration does not match}}
-
-// Top-level const doesn't matter.
-void r8() throw(int);
-void r8() throw(const int);
-
-// Multiple appearances don't matter.
-void r9() throw(int, int);
-void r9() throw(int, int);
-
-struct A
-{
-};
-
-struct B1 : A
-{
-};
-
-struct B2 : A
-{
-};
-
-struct D : B1, B2
-{
-};
-
-struct P : private A
-{
-};
-
-struct Base
-{
- virtual void f1() throw();
- virtual void f4() throw(int, float);
-
- virtual void f5() throw(int, float);
- virtual void f6() throw(A);
- virtual void f7() throw(A, int, float);
- virtual void f8();
-
- virtual void g1() throw(); // expected-note {{overridden virtual function is here}}
- virtual void g2() throw(int); // expected-note {{overridden virtual function is here}}
- virtual void g3() throw(A); // expected-note {{overridden virtual function is here}}
- virtual void g4() throw(B1); // expected-note {{overridden virtual function is here}}
- virtual void g5() throw(A); // expected-note {{overridden virtual function is here}}
-};
-struct Derived : Base
-{
- virtual void f1() throw();
- virtual void f4() throw(float, int);
-
- virtual void f5() throw(float);
- virtual void f6() throw(B1);
- virtual void f7() throw(B1, B2, int);
- virtual void f8() throw(B2, B2, int, float, char, double, bool);
-
- virtual void g1() throw(int); // expected-error {{exception specification of overriding function is more lax}}
- virtual void g2(); // expected-error {{exception specification of overriding function is more lax}}
- virtual void g3() throw(D); // expected-error {{exception specification of overriding function is more lax}}
- virtual void g4() throw(A); // expected-error {{exception specification of overriding function is more lax}}
- virtual void g5() throw(P); // expected-error {{exception specification of overriding function is more lax}}
-};
-
-// Some functions to play with below.
-void s1() throw();
-void s2() throw(int);
-void s3() throw(A);
-void s4() throw(B1);
-void s5() throw(D);
-void s6();
-void s7() throw(int, float);
-void (*s8())() throw(B1); // s8 returns a pointer to function with spec
-void s9(void (*)() throw(B1)); // s9 takes pointer to function with spec
-
-void fnptrs()
-{
- // Assignment and initialization of function pointers.
- void (*t1)() throw() = &s1; // valid
- t1 = &s2; // expected-error {{not superset}} expected-error {{incompatible type}}
- t1 = &s3; // expected-error {{not superset}} expected-error {{incompatible type}}
- void (&t2)() throw() = s2; // expected-error {{not superset}}
- void (*t3)() throw(int) = &s2; // valid
- void (*t4)() throw(A) = &s1; // valid
- t4 = &s3; // valid
- t4 = &s4; // valid
- t4 = &s5; // expected-error {{not superset}} expected-error {{incompatible type}}
- void (*t5)() = &s1; // valid
- t5 = &s2; // valid
- t5 = &s6; // valid
- t5 = &s7; // valid
- t1 = t3; // expected-error {{not superset}} expected-error {{incompatible type}}
- t3 = t1; // valid
- void (*t6)() throw(B1);
- t6 = t4; // expected-error {{not superset}} expected-error {{incompatible type}}
- t4 = t6; // valid
- t5 = t1; // valid
- t1 = t5; // expected-error {{not superset}} expected-error {{incompatible type}}
-
- // return types and arguments must match exactly, no inheritance allowed
- void (*(*t7)())() throw(B1) = &s8; // valid
- void (*(*t8)())() throw(A) = &s8; // expected-error {{return types differ}}
- void (*(*t9)())() throw(D) = &s8; // expected-error {{return types differ}}
- void (*t10)(void (*)() throw(B1)) = &s9; // valid expected-warning{{disambiguated}}
- void (*t11)(void (*)() throw(A)) = &s9; // expected-error {{argument types differ}} expected-warning{{disambiguated}}
- void (*t12)(void (*)() throw(D)) = &s9; // expected-error {{argument types differ}} expected-warning{{disambiguated}}
-}
-
-// Member function stuff
-
-struct Str1 { void f() throw(int); }; // expected-note {{previous declaration}}
-void Str1::f() // expected-warning {{missing exception specification}}
-{
-}
-
-void mfnptr()
-{
- void (Str1::*pfn1)() throw(int) = &Str1::f; // valid
- void (Str1::*pfn2)() = &Str1::f; // valid
- void (Str1::*pfn3)() throw() = &Str1::f; // expected-error {{not superset}}
-}
-
-// Don't suppress errors in template instantiation.
-template <typename T> struct TEx; // expected-note {{template is declared here}}
-
-void tf() throw(TEx<int>); // expected-error {{implicit instantiation of undefined template}}
-
-// DR 437, class throws itself.
-struct DR437 {
- void f() throw(DR437);
- void g() throw(DR437*);
- void h() throw(DR437&);
-};
-
-// DR 437 within a nested class
-struct DR437_out {
- struct DR437_in {
- void f() throw(DR437_out);
- void g() throw(DR437_out*);
- void h() throw(DR437_out&);
- };
-};
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp
index bda4a3d2ec54..e2bfe1839467 100644
--- a/test/SemaCXX/exceptions.cpp
+++ b/test/SemaCXX/exceptions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
struct A; // expected-note 4 {{forward declaration of 'A'}}
diff --git a/test/SemaCXX/expression-traits.cpp b/test/SemaCXX/expression-traits.cpp
new file mode 100644
index 000000000000..4555192280f0
--- /dev/null
+++ b/test/SemaCXX/expression-traits.cpp
@@ -0,0 +1,620 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fcxx-exceptions %s
+
+//
+// Tests for "expression traits" intrinsics such as __is_lvalue_expr.
+//
+// For the time being, these tests are written against the 2003 C++
+// standard (ISO/IEC 14882:2003 -- see draft at
+// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2001/n1316/).
+//
+// C++0x has its own, more-refined, idea of lvalues and rvalues.
+// If/when we need to support those, we'll need to track both
+// standard documents.
+
+#if !__has_feature(cxx_static_assert)
+# define CONCAT_(X_, Y_) CONCAT1_(X_, Y_)
+# define CONCAT1_(X_, Y_) X_ ## Y_
+
+// This emulation can be used multiple times on one line (and thus in
+// a macro), except at class scope
+# define static_assert(b_, m_) \
+ typedef int CONCAT_(sa_, __LINE__)[b_ ? 1 : -1]
+#endif
+
+// Tests are broken down according to section of the C++03 standard
+// (ISO/IEC 14882:2003(E))
+
+// Assertion macros encoding the following two paragraphs
+//
+// basic.lval/1 Every expression is either an lvalue or an rvalue.
+//
+// expr.prim/5 A parenthesized expression is a primary expression whose type
+// and value are identical to those of the enclosed expression. The
+// presence of parentheses does not affect whether the expression is
+// an lvalue.
+//
+// Note: these asserts cannot be made at class scope in C++03. Put
+// them in a member function instead.
+#define ASSERT_LVALUE(expr) \
+ static_assert(__is_lvalue_expr(expr), "should be an lvalue"); \
+ static_assert(__is_lvalue_expr((expr)), \
+ "the presence of parentheses should have" \
+ " no effect on lvalueness (expr.prim/5)"); \
+ static_assert(!__is_rvalue_expr(expr), "should be an lvalue"); \
+ static_assert(!__is_rvalue_expr((expr)), \
+ "the presence of parentheses should have" \
+ " no effect on lvalueness (expr.prim/5)")
+
+#define ASSERT_RVALUE(expr); \
+ static_assert(__is_rvalue_expr(expr), "should be an rvalue"); \
+ static_assert(__is_rvalue_expr((expr)), \
+ "the presence of parentheses should have" \
+ " no effect on lvalueness (expr.prim/5)"); \
+ static_assert(!__is_lvalue_expr(expr), "should be an rvalue"); \
+ static_assert(!__is_lvalue_expr((expr)), \
+ "the presence of parentheses should have" \
+ " no effect on lvalueness (expr.prim/5)")
+
+enum Enum { Enumerator };
+
+int ReturnInt();
+void ReturnVoid();
+Enum ReturnEnum();
+
+void basic_lval_5()
+{
+ // basic.lval/5: The result of calling a function that does not return
+ // a reference is an rvalue.
+ ASSERT_RVALUE(ReturnInt());
+ ASSERT_RVALUE(ReturnVoid());
+ ASSERT_RVALUE(ReturnEnum());
+}
+
+int& ReturnIntReference();
+extern Enum& ReturnEnumReference();
+
+void basic_lval_6()
+{
+ // basic.lval/6: An expression which holds a temporary object resulting
+ // from a cast to a nonreference type is an rvalue (this includes
+ // the explicit creation of an object using functional notation
+ struct IntClass
+ {
+ explicit IntClass(int = 0);
+ IntClass(char const*);
+ operator int() const;
+ };
+
+ struct ConvertibleToIntClass
+ {
+ operator IntClass() const;
+ };
+
+ ConvertibleToIntClass b;
+
+ // Make sure even trivial conversions are not detected as lvalues
+ int intLvalue = 0;
+ ASSERT_RVALUE((int)intLvalue);
+ ASSERT_RVALUE((short)intLvalue);
+ ASSERT_RVALUE((long)intLvalue);
+
+ // Same tests with function-call notation
+ ASSERT_RVALUE(int(intLvalue));
+ ASSERT_RVALUE(short(intLvalue));
+ ASSERT_RVALUE(long(intLvalue));
+
+ char charLValue = 'x';
+ ASSERT_RVALUE((signed char)charLValue);
+ ASSERT_RVALUE((unsigned char)charLValue);
+
+ ASSERT_RVALUE(static_cast<int>(IntClass()));
+ IntClass intClassLValue;
+ ASSERT_RVALUE(static_cast<int>(intClassLValue));
+ ASSERT_RVALUE(static_cast<IntClass>(ConvertibleToIntClass()));
+ ConvertibleToIntClass convertibleToIntClassLValue;
+ ASSERT_RVALUE(static_cast<IntClass>(convertibleToIntClassLValue));
+
+
+ typedef signed char signed_char;
+ typedef unsigned char unsigned_char;
+ ASSERT_RVALUE(signed_char(charLValue));
+ ASSERT_RVALUE(unsigned_char(charLValue));
+
+ ASSERT_RVALUE(int(IntClass()));
+ ASSERT_RVALUE(int(intClassLValue));
+ ASSERT_RVALUE(IntClass(ConvertibleToIntClass()));
+ ASSERT_RVALUE(IntClass(convertibleToIntClassLValue));
+}
+
+void conv_ptr_1()
+{
+ // conv.ptr/1: A null pointer constant is an integral constant
+ // expression (5.19) rvalue of integer type that evaluates to
+ // zero.
+ ASSERT_RVALUE(0);
+}
+
+void expr_6()
+{
+ // expr/6: If an expression initially has the type “reference to T”
+ // (8.3.2, 8.5.3), ... the expression is an lvalue.
+ int x = 0;
+ int& referenceToInt = x;
+ ASSERT_LVALUE(referenceToInt);
+ ASSERT_LVALUE(ReturnIntReference());
+}
+
+void expr_prim_2()
+{
+ // 5.1/2 A string literal is an lvalue; all other
+ // literals are rvalues.
+ ASSERT_LVALUE("foo");
+ ASSERT_RVALUE(1);
+ ASSERT_RVALUE(1.2);
+ ASSERT_RVALUE(10UL);
+}
+
+void expr_prim_3()
+{
+ // 5.1/3: The keyword "this" names a pointer to the object for
+ // which a nonstatic member function (9.3.2) is invoked. ...The
+ // expression is an rvalue.
+ struct ThisTest
+ {
+ void f() { ASSERT_RVALUE(this); }
+ };
+}
+
+extern int variable;
+void Function();
+
+struct BaseClass
+{
+ virtual ~BaseClass();
+
+ int BaseNonstaticMemberFunction();
+ static int BaseStaticMemberFunction();
+ int baseDataMember;
+};
+
+struct Class : BaseClass
+{
+ static void function();
+ static int variable;
+
+ template <class T>
+ struct NestedClassTemplate {};
+
+ template <class T>
+ static int& NestedFuncTemplate() { return variable; } // expected-note{{candidate function}}
+
+ template <class T>
+ int& NestedMemfunTemplate() { return variable; }
+
+ int operator*() const;
+
+ template <class T>
+ int operator+(T) const;
+
+ int NonstaticMemberFunction();
+ static int StaticMemberFunction();
+ int dataMember;
+
+ int& referenceDataMember;
+ static int& staticReferenceDataMember;
+ static int staticNonreferenceDataMember;
+
+ enum Enum { Enumerator };
+
+ operator long() const;
+
+ Class();
+ Class(int,int);
+
+ void expr_prim_4()
+ {
+ // 5.1/4: The operator :: followed by an identifier, a
+ // qualified-id, or an operator-function-id is a primary-
+ // expression. ...The result is an lvalue if the entity is
+ // a function or variable.
+ ASSERT_LVALUE(::Function); // identifier: function
+ ASSERT_LVALUE(::variable); // identifier: variable
+
+ // the only qualified-id form that can start without "::" (and thus
+ // be legal after "::" ) is
+ //
+ // ::<sub>opt</sub> nested-name-specifier template<sub>opt</sub> unqualified-id
+ ASSERT_LVALUE(::Class::function); // qualified-id: function
+ ASSERT_LVALUE(::Class::variable); // qualified-id: variable
+
+ // The standard doesn't give a clear answer about whether these
+ // should really be lvalues or rvalues without some surrounding
+ // context that forces them to be interpreted as naming a
+ // particular function template specialization (that situation
+ // doesn't come up in legal pure C++ programs). This language
+ // extension simply rejects them as requiring additional context
+ __is_lvalue_expr(::Class::NestedFuncTemplate); // qualified-id: template \
+ // expected-error{{cannot resolve overloaded function 'NestedFuncTemplate' from context}}
+
+ __is_lvalue_expr(::Class::NestedMemfunTemplate); // qualified-id: template \
+ // expected-error{{a bound member function may only be called}}
+
+ __is_lvalue_expr(::Class::operator+); // operator-function-id: template \
+ // expected-error{{a bound member function may only be called}}
+
+ //ASSERT_RVALUE(::Class::operator*); // operator-function-id: member function
+ }
+
+ void expr_prim_7()
+ {
+ // expr.prim/7 An identifier is an id-expression provided it has been
+ // suitably declared (clause 7). [Note: ... ] The type of the
+ // expression is the type of the identifier. The result is the
+ // entity denoted by the identifier. The result is an lvalue if
+ // the entity is a function, variable, or data member... (cont'd)
+ ASSERT_LVALUE(Function); // identifier: function
+ ASSERT_LVALUE(StaticMemberFunction); // identifier: function
+ ASSERT_LVALUE(variable); // identifier: variable
+ ASSERT_LVALUE(dataMember); // identifier: data member
+ //ASSERT_RVALUE(NonstaticMemberFunction); // identifier: member function
+
+ // (cont'd)...A nested-name-specifier that names a class,
+ // optionally followed by the keyword template (14.2), and then
+ // followed by the name of a member of either that class (9.2) or
+ // one of its base classes... is a qualified-id... The result is
+ // the member. The type of the result is the type of the
+ // member. The result is an lvalue if the member is a static
+ // member function or a data member.
+ ASSERT_LVALUE(Class::dataMember);
+ ASSERT_LVALUE(Class::StaticMemberFunction);
+ //ASSERT_RVALUE(Class::NonstaticMemberFunction); // identifier: member function
+
+ ASSERT_LVALUE(Class::baseDataMember);
+ ASSERT_LVALUE(Class::BaseStaticMemberFunction);
+ //ASSERT_RVALUE(Class::BaseNonstaticMemberFunction); // identifier: member function
+ }
+};
+
+void expr_call_10()
+{
+ // expr.call/10: A function call is an lvalue if and only if the
+ // result type is a reference. This statement is partially
+ // redundant with basic.lval/5
+ basic_lval_5();
+
+ ASSERT_LVALUE(ReturnIntReference());
+ ASSERT_LVALUE(ReturnEnumReference());
+}
+
+namespace Namespace
+{
+ int x;
+ void function();
+}
+
+void expr_prim_8()
+{
+ // expr.prim/8 A nested-name-specifier that names a namespace
+ // (7.3), followed by the name of a member of that namespace (or
+ // the name of a member of a namespace made visible by a
+ // using-directive ) is a qualified-id; 3.4.3.2 describes name
+ // lookup for namespace members that appear in qualified-ids. The
+ // result is the member. The type of the result is the type of the
+ // member. The result is an lvalue if the member is a function or
+ // a variable.
+ ASSERT_LVALUE(Namespace::x);
+ ASSERT_LVALUE(Namespace::function);
+}
+
+void expr_sub_1(int* pointer)
+{
+ // expr.sub/1 A postfix expression followed by an expression in
+ // square brackets is a postfix expression. One of the expressions
+ // shall have the type “pointer to T” and the other shall have
+ // enumeration or integral type. The result is an lvalue of type
+ // “T.”
+ ASSERT_LVALUE(pointer[1]);
+
+ // The expression E1[E2] is identical (by definition) to *((E1)+(E2)).
+ ASSERT_LVALUE(*(pointer+1));
+}
+
+void expr_type_conv_1()
+{
+ // expr.type.conv/1 A simple-type-specifier (7.1.5) followed by a
+ // parenthesized expression-list constructs a value of the specified
+ // type given the expression list. ... If the expression list
+ // specifies more than a single value, the type shall be a class with
+ // a suitably declared constructor (8.5, 12.1), and the expression
+ // T(x1, x2, ...) is equivalent in effect to the declaration T t(x1,
+ // x2, ...); for some invented temporary variable t, with the result
+ // being the value of t as an rvalue.
+ ASSERT_RVALUE(Class(2,2));
+}
+
+void expr_type_conv_2()
+{
+ // expr.type.conv/2 The expression T(), where T is a
+ // simple-type-specifier (7.1.5.2) for a non-array complete object
+ // type or the (possibly cv-qualified) void type, creates an
+ // rvalue of the specified type,
+ ASSERT_RVALUE(int());
+ ASSERT_RVALUE(Class());
+ ASSERT_RVALUE(void());
+}
+
+
+void expr_ref_4()
+{
+ // Applies to expressions of the form E1.E2
+
+ // If E2 is declared to have type “reference to T”, then E1.E2 is
+ // an lvalue;.... Otherwise, one of the following rules applies.
+ ASSERT_LVALUE(Class().staticReferenceDataMember);
+ ASSERT_LVALUE(Class().referenceDataMember);
+
+ // — If E2 is a static data member, and the type of E2 is T, then
+ // E1.E2 is an lvalue; ...
+ ASSERT_LVALUE(Class().staticNonreferenceDataMember);
+ ASSERT_LVALUE(Class().staticReferenceDataMember);
+
+
+ // — If E2 is a non-static data member, ... If E1 is an lvalue,
+ // then E1.E2 is an lvalue...
+ Class lvalue;
+ ASSERT_LVALUE(lvalue.dataMember);
+ ASSERT_RVALUE(Class().dataMember);
+
+ // — If E1.E2 refers to a static member function, ... then E1.E2
+ // is an lvalue
+ ASSERT_LVALUE(Class().StaticMemberFunction);
+
+ // — Otherwise, if E1.E2 refers to a non-static member function,
+ // then E1.E2 is not an lvalue.
+ //ASSERT_RVALUE(Class().NonstaticMemberFunction);
+
+ // — If E2 is a member enumerator, and the type of E2 is T, the
+ // expression E1.E2 is not an lvalue. The type of E1.E2 is T.
+ ASSERT_RVALUE(Class().Enumerator);
+ ASSERT_RVALUE(lvalue.Enumerator);
+}
+
+
+void expr_post_incr_1(int x)
+{
+ // expr.post.incr/1 The value obtained by applying a postfix ++ is
+ // the value that the operand had before applying the
+ // operator... The result is an rvalue.
+ ASSERT_RVALUE(x++);
+}
+
+void expr_dynamic_cast_2()
+{
+ // expr.dynamic.cast/2: If T is a pointer type, v shall be an
+ // rvalue of a pointer to complete class type, and the result is
+ // an rvalue of type T.
+ Class instance;
+ ASSERT_RVALUE(dynamic_cast<Class*>(&instance));
+
+ // If T is a reference type, v shall be an
+ // lvalue of a complete class type, and the result is an lvalue of
+ // the type referred to by T.
+ ASSERT_LVALUE(dynamic_cast<Class&>(instance));
+}
+
+void expr_dynamic_cast_5()
+{
+ // expr.dynamic.cast/5: If T is “reference to cv1 B” and v has type
+ // “cv2 D” such that B is a base class of D, the result is an
+ // lvalue for the unique B sub-object of the D object referred
+ // to by v.
+ typedef BaseClass B;
+ typedef Class D;
+ D object;
+ ASSERT_LVALUE(dynamic_cast<B&>(object));
+}
+
+// expr.dynamic.cast/8: The run-time check logically executes as follows:
+//
+// — If, in the most derived object pointed (referred) to by v, v
+// points (refers) to a public base class subobject of a T object, and
+// if only one object of type T is derived from the sub-object pointed
+// (referred) to by v, the result is a pointer (an lvalue referring)
+// to that T object.
+//
+// — Otherwise, if v points (refers) to a public base class sub-object
+// of the most derived object, and the type of the most derived object
+// has a base class, of type T, that is unambiguous and public, the
+// result is a pointer (an lvalue referring) to the T sub-object of
+// the most derived object.
+//
+// The mention of "lvalue" in the text above appears to be a
+// defect that is being corrected by the response to UK65 (see
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2841.html).
+
+#if 0
+void expr_typeid_1()
+{
+ // expr.typeid/1: The result of a typeid expression is an lvalue...
+ ASSERT_LVALUE(typeid(1));
+}
+#endif
+
+void expr_static_cast_1(int x)
+{
+ // expr.static.cast/1: The result of the expression
+ // static_cast<T>(v) is the result of converting the expression v
+ // to type T. If T is a reference type, the result is an lvalue;
+ // otherwise, the result is an rvalue.
+ ASSERT_LVALUE(static_cast<int&>(x));
+ ASSERT_RVALUE(static_cast<int>(x));
+}
+
+void expr_reinterpret_cast_1()
+{
+ // expr.reinterpret.cast/1: The result of the expression
+ // reinterpret_cast<T>(v) is the result of converting the
+ // expression v to type T. If T is a reference type, the result is
+ // an lvalue; otherwise, the result is an rvalue
+ ASSERT_RVALUE(reinterpret_cast<int*>(0));
+ char const v = 0;
+ ASSERT_LVALUE(reinterpret_cast<char const&>(v));
+}
+
+void expr_unary_op_1(int* pointer, struct incomplete* pointerToIncompleteType)
+{
+ // expr.unary.op/1: The unary * operator performs indirection: the
+ // expression to which it is applied shall be a pointer to an
+ // object type, or a pointer to a function type and the result is
+ // an lvalue referring to the object or function to which the
+ // expression points.
+ ASSERT_LVALUE(*pointer);
+ ASSERT_LVALUE(*Function);
+
+ // [Note: a pointer to an incomplete type
+ // (other than cv void ) can be dereferenced. ]
+ ASSERT_LVALUE(*pointerToIncompleteType);
+}
+
+void expr_pre_incr_1(int operand)
+{
+ // expr.pre.incr/1: The operand of prefix ++ ... shall be a
+ // modifiable lvalue.... The value is the new value of the
+ // operand; it is an lvalue.
+ ASSERT_LVALUE(++operand);
+}
+
+void expr_cast_1(int x)
+{
+ // expr.cast/1: The result of the expression (T) cast-expression
+ // is of type T. The result is an lvalue if T is a reference type,
+ // otherwise the result is an rvalue.
+ ASSERT_LVALUE((void(&)())expr_cast_1);
+ ASSERT_LVALUE((int&)x);
+ ASSERT_RVALUE((void(*)())expr_cast_1);
+ ASSERT_RVALUE((int)x);
+}
+
+void expr_mptr_oper()
+{
+ // expr.mptr.oper/6: The result of a .* expression is an lvalue
+ // only if its first operand is an lvalue and its second operand
+ // is a pointer to data member... (cont'd)
+ typedef Class MakeRValue;
+ ASSERT_RVALUE(MakeRValue().*(&Class::dataMember));
+ //ASSERT_RVALUE(MakeRValue().*(&Class::NonstaticMemberFunction));
+ Class lvalue;
+ ASSERT_LVALUE(lvalue.*(&Class::dataMember));
+ //ASSERT_RVALUE(lvalue.*(&Class::NonstaticMemberFunction));
+
+ // (cont'd)...The result of an ->* expression is an lvalue only
+ // if its second operand is a pointer to data member. If the
+ // second operand is the null pointer to member value (4.11), the
+ // behavior is undefined.
+ ASSERT_LVALUE((&lvalue)->*(&Class::dataMember));
+ //ASSERT_RVALUE((&lvalue)->*(&Class::NonstaticMemberFunction));
+}
+
+void expr_cond(bool cond)
+{
+ // 5.16 Conditional operator [expr.cond]
+ //
+ // 2 If either the second or the third operand has type (possibly
+ // cv-qualified) void, then the lvalue-to-rvalue (4.1),
+ // array-to-pointer (4.2), and function-to-pointer (4.3) standard
+ // conversions are performed on the second and third operands, and one
+ // of the following shall hold:
+ //
+ // — The second or the third operand (but not both) is a
+ // throw-expression (15.1); the result is of the type of the other and
+ // is an rvalue.
+
+ Class classLvalue;
+ ASSERT_RVALUE(cond ? throw 1 : (void)0);
+ ASSERT_RVALUE(cond ? (void)0 : throw 1);
+ ASSERT_RVALUE(cond ? throw 1 : classLvalue);
+ ASSERT_RVALUE(cond ? classLvalue : throw 1);
+
+ // — Both the second and the third operands have type void; the result
+ // is of type void and is an rvalue. [Note: this includes the case
+ // where both operands are throw-expressions. ]
+ ASSERT_RVALUE(cond ? (void)1 : (void)0);
+ ASSERT_RVALUE(cond ? throw 1 : throw 0);
+
+ // expr.cond/4: If the second and third operands are lvalues and
+ // have the same type, the result is of that type and is an
+ // lvalue.
+ ASSERT_LVALUE(cond ? classLvalue : classLvalue);
+ int intLvalue = 0;
+ ASSERT_LVALUE(cond ? intLvalue : intLvalue);
+
+ // expr.cond/5:Otherwise, the result is an rvalue.
+ typedef Class MakeRValue;
+ ASSERT_RVALUE(cond ? MakeRValue() : classLvalue);
+ ASSERT_RVALUE(cond ? classLvalue : MakeRValue());
+ ASSERT_RVALUE(cond ? MakeRValue() : MakeRValue());
+ ASSERT_RVALUE(cond ? classLvalue : intLvalue);
+ ASSERT_RVALUE(cond ? intLvalue : int());
+}
+
+void expr_ass_1(int x)
+{
+ // expr.ass/1: There are several assignment operators, all of
+ // which group right-to-left. All require a modifiable lvalue as
+ // their left operand, and the type of an assignment expression is
+ // that of its left operand. The result of the assignment
+ // operation is the value stored in the left operand after the
+ // assignment has taken place; the result is an lvalue.
+ ASSERT_LVALUE(x = 1);
+ ASSERT_LVALUE(x += 1);
+ ASSERT_LVALUE(x -= 1);
+ ASSERT_LVALUE(x *= 1);
+ ASSERT_LVALUE(x /= 1);
+ ASSERT_LVALUE(x %= 1);
+ ASSERT_LVALUE(x ^= 1);
+ ASSERT_LVALUE(x &= 1);
+ ASSERT_LVALUE(x |= 1);
+}
+
+void expr_comma(int x)
+{
+ // expr.comma: A pair of expressions separated by a comma is
+ // evaluated left-to-right and the value of the left expression is
+ // discarded... result is an lvalue if its right operand is.
+
+ // Can't use the ASSERT_XXXX macros without adding parens around
+ // the comma expression.
+ static_assert(__is_lvalue_expr(x,x), "expected an lvalue");
+ static_assert(__is_rvalue_expr(x,1), "expected an rvalue");
+ static_assert(__is_lvalue_expr(1,x), "expected an lvalue");
+ static_assert(__is_rvalue_expr(1,1), "expected an rvalue");
+}
+
+#if 0
+template<typename T> void f();
+
+// FIXME These currently fail
+void expr_fun_lvalue()
+{
+ ASSERT_LVALUE(&f<int>);
+}
+
+void expr_fun_rvalue()
+{
+ ASSERT_RVALUE(f<int>);
+}
+#endif
+
+template <int NonTypeNonReferenceParameter, int& NonTypeReferenceParameter>
+void check_temp_param_6()
+{
+ ASSERT_RVALUE(NonTypeNonReferenceParameter);
+ ASSERT_LVALUE(NonTypeReferenceParameter);
+}
+
+int AnInt = 0;
+
+void temp_param_6()
+{
+ check_temp_param_6<3,AnInt>();
+}
diff --git a/test/SemaCXX/flexible-array-test.cpp b/test/SemaCXX/flexible-array-test.cpp
index 95d8bb1aa413..e6c3132801f8 100644
--- a/test/SemaCXX/flexible-array-test.cpp
+++ b/test/SemaCXX/flexible-array-test.cpp
@@ -51,5 +51,19 @@ class A {
union B {
int s;
- char c[]; // expected-error {{field has incomplete type 'char []'}}
+ char c[];
+};
+
+namespace rdar9065507 {
+
+struct StorageBase {
+ long ref_count;
+ unsigned size;
+ unsigned capacity;
};
+
+struct Storage : StorageBase {
+ int data[];
+};
+
+}
diff --git a/test/SemaCXX/for-range-examples.cpp b/test/SemaCXX/for-range-examples.cpp
new file mode 100644
index 000000000000..810f1de441a1
--- /dev/null
+++ b/test/SemaCXX/for-range-examples.cpp
@@ -0,0 +1,150 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+namespace value_range_detail {
+ template<typename T>
+ class value_range_iter {
+ T t;
+ public:
+ value_range_iter(const T &t) : t(t) {}
+ T operator*() const { return t; }
+ bool operator!=(const value_range_iter &o) const { return t != o.t; }
+ value_range_iter &operator++() { ++t; return *this; }
+ };
+
+ template<typename T>
+ struct value_range {
+ value_range(const T &a, const T &b) : begin_(a), end_(b) {}
+ value_range_iter<T> begin_, end_;
+ };
+
+ template<typename T>
+ value_range_iter<T> begin(const value_range<T> &r) { return r.begin_; }
+ template<typename T>
+ value_range_iter<T> end(const value_range<T> &r) { return r.end_; }
+
+
+ struct end_t {};
+
+ template<typename T>
+ class value_range_step_iter {
+ T it, step;
+ public:
+ value_range_step_iter(const T &it, const T &step) : it(it), step(step) {}
+ T operator*() const { return it; }
+ bool operator!=(value_range_step_iter end) const { return it != end.it; }
+ value_range_step_iter &operator++() { it += step; return *this; }
+ };
+
+ template<typename T>
+ class value_range_step {
+ T it, step, end_;
+ public:
+ value_range_step(const T &it, const T &end, const T &step) :
+ it(it), end_(end), step(step) {}
+ typedef value_range_step_iter<T> iterator;
+ iterator begin() const { return iterator(it, step); }
+ iterator end() const { return iterator(end_, step); }
+ };
+}
+
+template<typename T>
+value_range_detail::value_range<T> range(const T &a, const T &b) { return value_range_detail::value_range<T>(a, b); }
+
+template<typename T>
+value_range_detail::value_range_step<T> range(const T &a, const T &b, const T &step) { return value_range_detail::value_range_step<T>(a, b, step); }
+
+
+namespace map_range {
+ template<typename T>
+ class vector {
+ T storage[100];
+ decltype(sizeof(char)) size;
+ public:
+ vector() : size() {}
+ void push_back(T t) { storage[size++] = t; }
+ T *begin() { return storage; }
+ T *end() { return storage + size; }
+ };
+
+ template<typename T> struct tuple_elem {
+ T t;
+ tuple_elem() {}
+ tuple_elem(T t) : t(t) {}
+ };
+ template<typename... A>
+ struct tuple : tuple_elem<A>... {
+ tuple() : tuple_elem<A>()... {}
+ tuple(A... a) : tuple_elem<A>(a)... {}
+ template<typename B> B &get() { return tuple_elem<B>::t; }
+ };
+
+ template<typename F, typename I>
+ class map_iter {
+ F f;
+ I i;
+ public:
+ map_iter(F f, I i) : f(f), i(i) {}
+ auto operator*() const -> decltype(f(*i)) { return f(*i); }
+ bool operator!=(const map_iter &o) const { return i != o.i; }
+ map_iter &operator++() { ++i; return *this; }
+ };
+
+ template<typename T>
+ struct iter_pair {
+ T begin_, end_;
+ iter_pair(T begin, T end) : begin_(begin), end_(end) {}
+ };
+ template<typename T> T begin(iter_pair<T> p) { return p.begin_; }
+ template<typename T> T end(iter_pair<T> p) { return p.end_; }
+
+ template<typename...> class mem_fun_impl;
+ template<typename R, typename T, typename... A>
+ class mem_fun_impl<R (T::*)(A...)> {
+ typedef R (T::*F)(A...);
+ F f;
+ public:
+ mem_fun_impl(F f) : f(f) {}
+ R operator()(T &t, A &&...a) const { return (t.*f)(static_cast<A&&>(a)...); }
+ };
+ template<typename F> mem_fun_impl<F> mem_fun(F f) { return mem_fun_impl<F>(f); }
+
+ template<typename F, typename T>
+ auto map(const F &f, T &t) -> iter_pair<map_iter<F, decltype(t.begin())>> {
+ typedef map_iter<F, decltype(t.begin())> iter;
+ return iter_pair<iter>(iter(f, t.begin()), iter(f, t.end()));
+ }
+}
+
+#define assert(b) if (!b) { return 1; }
+int main() {
+ int total = 0;
+
+ for (auto n : range(1, 5)) {
+ total += n;
+ }
+ assert(total == 10);
+
+ for (auto n : range(10, 100, 10)) {
+ total += n;
+ }
+ assert(total == 460);
+
+ map_range::vector<char> chars;
+ chars.push_back('a');
+ chars.push_back('b');
+ chars.push_back('c');
+ for (char c : chars) {
+ ++total;
+ }
+ assert(total == 463);
+
+ typedef map_range::tuple<int, double> T;
+ map_range::vector<T> pairs;
+ pairs.push_back(T(42, 12.9));
+ pairs.push_back(T(6, 4.2));
+ pairs.push_back(T(9, 1.1));
+ for (auto a : map(map_range::mem_fun(&T::get<int>), pairs)) {
+ total += a;
+ }
+ assert(total == 500);
+}
diff --git a/test/SemaCXX/for-range-no-std.cpp b/test/SemaCXX/for-range-no-std.cpp
new file mode 100644
index 000000000000..8cc71e5111a2
--- /dev/null
+++ b/test/SemaCXX/for-range-no-std.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+struct S {
+ int *begin();
+ int *end();
+};
+
+struct T {
+};
+
+struct Range {};
+int begin(Range); // expected-note {{not viable}}
+int end(Range);
+
+namespace NS {
+ struct ADL {};
+ struct iter {
+ int operator*();
+ bool operator!=(iter);
+ void operator++();
+ };
+ iter begin(ADL); // expected-note {{not viable}}
+ iter end(ADL);
+
+ struct NoADL {};
+}
+NS::iter begin(NS::NoADL); // expected-note {{not viable}}
+NS::iter end(NS::NoADL);
+
+void f() {
+ int a[] = {1, 2, 3};
+ for (auto b : S()) {} // ok
+ for (auto b : T()) {} // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type}}
+ for (auto b : a) {} // ok
+ for (int b : NS::ADL()) {} // ok
+ for (int b : NS::NoADL()) {} // expected-error {{no matching function for call to 'begin'}} expected-note {{range has type}}
+}
diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp
index 1222dd0940da..b1ef220e534c 100644
--- a/test/SemaCXX/friend.cpp
+++ b/test/SemaCXX/friend.cpp
@@ -64,11 +64,11 @@ namespace test4 {
}
namespace rdar8529993 {
-struct A { ~A(); }; // expected-note {{nearly matches}}
+struct A { ~A(); };
struct B : A
{
- template<int> friend A::~A(); // expected-error {{does not match}}
+ template<int> friend A::~A(); // expected-error {{destructor cannot be declared as a template}}
};
}
diff --git a/test/SemaCXX/generic-selection.cpp b/test/SemaCXX/generic-selection.cpp
new file mode 100644
index 000000000000..b171fce540d8
--- /dev/null
+++ b/test/SemaCXX/generic-selection.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template <typename T, typename U = void*>
+struct A {
+ enum {
+ id = _Generic(T(), // expected-error {{controlling expression type 'char' not compatible with any generic association type}}
+ int: 1, // expected-note {{compatible type 'int' specified here}}
+ float: 2,
+ U: 3) // expected-error {{type 'int' in generic association compatible with previously specified type 'int'}}
+ };
+};
+
+static_assert(A<int>::id == 1, "fail");
+static_assert(A<float>::id == 2, "fail");
+static_assert(A<double, double>::id == 3, "fail");
+
+A<char> a1; // expected-note {{in instantiation of template class 'A<char, void *>' requested here}}
+A<short, int> a2; // expected-note {{in instantiation of template class 'A<short, int>' requested here}}
+
+template <typename T, typename U>
+struct B {
+ enum {
+ id = _Generic(T(),
+ int: 1, // expected-note {{compatible type 'int' specified here}}
+ int: 2, // expected-error {{type 'int' in generic association compatible with previously specified type 'int'}}
+ U: 3)
+ };
+};
+
+template <unsigned Arg, unsigned... Args> struct Or {
+ enum { result = Arg | Or<Args...>::result };
+};
+
+template <unsigned Arg> struct Or<Arg> {
+ enum { result = Arg };
+};
+
+template <class... Args> struct TypeMask {
+ enum {
+ result = Or<_Generic(Args(), int: 1, long: 2, short: 4, float: 8)...>::result
+ };
+};
+
+static_assert(TypeMask<int, long, short>::result == 7, "fail");
+static_assert(TypeMask<float, short>::result == 12, "fail");
+static_assert(TypeMask<int, float, float>::result == 9, "fail");
diff --git a/test/SemaCXX/goto.cpp b/test/SemaCXX/goto.cpp
new file mode 100644
index 000000000000..d8d5ec51f6e4
--- /dev/null
+++ b/test/SemaCXX/goto.cpp
@@ -0,0 +1,105 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wall -fblocks %s
+
+// PR9463
+double *end;
+void f(bool b1, bool b2) {
+ {
+ do {
+ int end = 0;
+ if (b2) {
+ do {
+ goto end;
+ } while (b2);
+ }
+ end = 1;
+ } while (b1);
+ }
+
+ end:
+ return;
+}
+
+namespace N {
+ float* end;
+ void f(bool b1, bool b2) {
+ {
+ do {
+ int end = 0;
+ if (b2) {
+ do {
+ goto end;
+ } while (b2);
+ }
+ end = 1;
+ } while (b1);
+ }
+
+ end:
+ return;
+ }
+}
+
+void g() {
+ end = 1; // expected-error{{assigning to 'double *' from incompatible type 'int'}}
+}
+
+void h(int end) {
+ {
+ goto end; // expected-error{{use of undeclared label 'end'}}
+ }
+}
+
+void h2(int end) {
+ {
+ __label__ end;
+ goto end;
+
+ end:
+ ::end = 0;
+ }
+ end: // expected-warning{{unused label 'end'}}
+ end = 1;
+}
+
+class X {
+public:
+ X();
+};
+
+void rdar9135994()
+{
+X:
+ goto X;
+}
+
+namespace PR9495 {
+ struct NonPOD { NonPOD(); ~NonPOD(); };
+
+ void f(bool b) {
+ NonPOD np;
+ if (b) {
+ goto undeclared; // expected-error{{use of undeclared label 'undeclared'}}
+ }
+ }
+
+ void g() {
+ (void)^(bool b){
+ NonPOD np;
+ if (b) {
+ goto undeclared; // expected-error{{use of undeclared label 'undeclared'}}
+ }
+ };
+ }
+}
+
+extern "C" {
+ void exit(int);
+}
+
+void f() {
+ {
+ goto exit;
+ }
+ exit:
+ return;
+}
diff --git a/test/SemaCXX/goto2.cpp b/test/SemaCXX/goto2.cpp
new file mode 100644
index 000000000000..01ea031ac2c1
--- /dev/null
+++ b/test/SemaCXX/goto2.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+//PR9463
+int subfun(const char *text) {
+ const char *tmp = text;
+ return 0;
+}
+
+void fun(const char* text) {
+ int count = 0;
+ bool check = true;
+
+ if (check)
+ {
+ const char *end = text;
+
+ if (check)
+ {
+ do
+ {
+ if (check)
+ {
+ count = subfun(end);
+ goto end;
+ }
+
+ check = !check;
+ }
+ while (check);
+ }
+ // also works, after commenting following line of source code
+ int e = subfun(end);
+ }
+ end:
+ if (check)
+ ++count;
+}
+
+const char *text = "some text";
+
+int main() {
+ const char *ptr = text;
+
+ fun(ptr);
+
+ return 0;
+}
diff --git a/test/SemaCXX/init-priority-attr.cpp b/test/SemaCXX/init-priority-attr.cpp
index 7605ee625ed4..6facebf0d000 100644
--- a/test/SemaCXX/init-priority-attr.cpp
+++ b/test/SemaCXX/init-priority-attr.cpp
@@ -19,7 +19,7 @@ extern Two koo[];
Two foo __attribute__((init_priority(101))) ( 5, 6 );
-Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{attribute requires 1 argument(s)}}
+Two goo __attribute__((init_priority(2,3))) ( 5, 6 ); // expected-error {{attribute takes one argument}}
Two coo[2] __attribute__((init_priority(3))); // expected-error {{init_priority attribute requires integer constant between 101 and 65535 inclusive}}
diff --git a/test/SemaCXX/libstdcxx_is_pod_hack.cpp b/test/SemaCXX/libstdcxx_is_pod_hack.cpp
index 2e9203219536..3581c796ce91 100644
--- a/test/SemaCXX/libstdcxx_is_pod_hack.cpp
+++ b/test/SemaCXX/libstdcxx_is_pod_hack.cpp
@@ -11,3 +11,19 @@ struct __is_pod {
};
__is_pod<int> ipi;
+
+// Ditto for __is_same.
+template<typename T>
+struct __is_same {
+};
+
+__is_same<int> isi;
+
+// Another, similar egregious hack for __is_signed, which is a type
+// trait in Embarcadero's compiler but is used as an identifier in
+// libstdc++.
+struct test_is_signed {
+ static const bool __is_signed = true;
+};
+
+bool check_signed = test_is_signed::__is_signed;
diff --git a/test/SemaCXX/literal-type.cpp b/test/SemaCXX/literal-type.cpp
index 142dd756e5a3..6a61823adb28 100644
--- a/test/SemaCXX/literal-type.cpp
+++ b/test/SemaCXX/literal-type.cpp
@@ -1,10 +1,71 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
static_assert(__is_literal(int), "fail");
+static_assert(__is_literal_type(int), "fail"); // alternate spelling for GCC
static_assert(__is_literal(void*), "fail");
enum E { E1 };
static_assert(__is_literal(E), "fail");
static_assert(__is_literal(decltype(E1)), "fail");
typedef int IAR[10];
static_assert(__is_literal(IAR), "fail");
-// FIXME: Records
+typedef int Vector __attribute__((vector_size(16)));
+typedef int VectorExt __attribute__((ext_vector_type(4)));
+static_assert(__is_literal(Vector), "fail");
+static_assert(__is_literal(VectorExt), "fail");
+
+// C++0x [basic.types]p10:
+// A type is a literal type if it is:
+// [...]
+// -- a class type that has all of the following properties:
+// -- it has a trivial destructor
+// -- every constructor call and full-expression in the
+// brace-or-equal-initializers for non-static data members (if an) is
+// a constant expression,
+// -- it is an aggregate type or has at least one constexpr constructor
+// or constructor template that is not a copy or move constructor, and
+// -- it has all non-static data members and base classes of literal
+// types
+struct Empty {};
+struct LiteralType {
+ int x;
+ E e;
+ IAR arr;
+ Empty empty;
+ int method();
+};
+struct HasDtor { ~HasDtor(); };
+
+class NonAggregate { int x; };
+struct HasNonLiteralBase : NonAggregate {};
+struct HasNonLiteralMember { HasDtor x; };
+
+static_assert(__is_literal(Empty), "fail");
+static_assert(__is_literal(LiteralType), "fail");
+static_assert(!__is_literal(HasDtor), "fail");
+static_assert(!__is_literal(NonAggregate), "fail");
+static_assert(!__is_literal(HasNonLiteralBase), "fail");
+static_assert(!__is_literal(HasNonLiteralMember), "fail");
+
+// FIXME: Test constexpr constructors and non-static members with initializers
+// when Clang supports them:
+#if 0
+extern int f();
+struct HasNonConstExprMemInit {
+ int x = f();
+ constexpr HasNonConstExprMemInit(int y) {}
+};
+static_assert(!__is_literal(HasNonConstExprMemInit), "fail");
+
+class HasConstExprCtor {
+ int x;
+public:
+ constexpr HasConstExprCtor(int x) : x(x) {}
+};
+template <typename T> class HasConstExprCtorTemplate {
+ T x;
+public:
+ template <typename U> constexpr HasConstExprCtorTemplate(U y) : x(y) {}
+};
+static_assert(__is_literal(HasConstExprCtor), "fail");
+static_assert(__is_literal(HasConstExprCtorTemplate), "fail");
+#endif
diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp
index 3c3eb04e08fa..68af4152ef4e 100644
--- a/test/SemaCXX/member-expr.cpp
+++ b/test/SemaCXX/member-expr.cpp
@@ -135,4 +135,9 @@ namespace PR9025 {
int g3() {
return fun3.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it with no arguments?}}
}
+
+ template <typename T> S fun4();
+ int g4() {
+ return fun4.x; // expected-error{{base of member reference is a function; perhaps you meant to call it?}}
+ }
}
diff --git a/test/SemaCXX/member-pointers-2.cpp b/test/SemaCXX/member-pointers-2.cpp
index 4b3b82c02975..6c39282e5a31 100644
--- a/test/SemaCXX/member-pointers-2.cpp
+++ b/test/SemaCXX/member-pointers-2.cpp
@@ -34,3 +34,18 @@ void test0() {
Test0 mytest;
mytest.test();
}
+
+namespace rdar9065289 {
+ typedef void (*FuncPtr)();
+ struct X0 { };
+
+ struct X1
+ {
+ X0* x0;
+ FuncPtr X0::*fptr;
+ };
+
+ void f(X1 p) {
+ (p.x0->*(p.fptr))();
+ }
+}
diff --git a/test/SemaCXX/neon-vector-types.cpp b/test/SemaCXX/neon-vector-types.cpp
new file mode 100644
index 000000000000..aa82b11e8cd7
--- /dev/null
+++ b/test/SemaCXX/neon-vector-types.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9208404
+
+typedef int MP4Err;
+typedef float Float32;
+typedef float float32_t;
+typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t;
+typedef float vFloat __attribute__((__vector_size__(16)));
+typedef vFloat VFLOAT;
+typedef unsigned long UInt32;
+
+extern int bar (float32x4_t const *p);
+
+int foo (const Float32 *realBufPtr) {
+ float32x4_t const *vRealPtr = (VFLOAT *)&realBufPtr[0];
+ return bar(vRealPtr);
+}
+
+MP4Err autoCorrelation2nd_Neon(Float32 *alphar, Float32 *alphai,
+ const Float32 *realBufPtr,
+ const Float32 *imagBufPtr,
+ const UInt32 len)
+{
+ float32x4_t const *vRealPtr = (VFLOAT *)&realBufPtr[0];
+ return 0;
+}
+
diff --git a/test/SemaCXX/nested-name-spec-locations.cpp b/test/SemaCXX/nested-name-spec-locations.cpp
index 25914df627bd..048d4baf135b 100644
--- a/test/SemaCXX/nested-name-spec-locations.cpp
+++ b/test/SemaCXX/nested-name-spec-locations.cpp
@@ -65,6 +65,98 @@ void PseudoDestructorExprCheck(
template<typename T>
struct DependentScopedDeclRefExpr {
void f() {
- outer_alias::inner::X0<T>::value = 17;
+ outer_alias::inner::X0<typename add_reference<T>::type
+ * // expected-error{{as a pointer to a reference of type}}
+ >::value = 17;
}
};
+
+void DependentScopedDeclRefExprCheck(DependentScopedDeclRefExpr<int> t) {
+ t.f(); // expected-note{{in instantiation of member function}}
+}
+
+
+template<typename T>
+struct TypenameTypeTester {
+ typedef typename outer::inner::X0<
+ typename add_reference<T>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ >::type type;
+};
+
+TypenameTypeTester<int> TypenameTypeCheck; // expected-note{{in instantiation of template class}}
+
+template<typename T, typename U>
+struct DependentTemplateSpecializationTypeTester {
+ typedef typename T::template apply<typename add_reference<U>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ >::type type;
+};
+
+struct HasApply {
+ template<typename T>
+ struct apply {
+ typedef T type;
+ };
+};
+
+DependentTemplateSpecializationTypeTester<HasApply, int> DTSTCheck; // expected-note{{in instantiation of template class}}
+
+template<typename T, typename U>
+struct DependentTemplateSpecializationTypeTester2 {
+ typedef typename T::template apply<typename add_reference<U>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ > type;
+};
+
+DependentTemplateSpecializationTypeTester2<HasApply, int> DTSTCheck2; // expected-note{{in instantiation of template class}}
+
+template<typename T, typename U>
+struct DependentTemplateSpecializationTypeTester3 :
+ T::template apply<typename add_reference<U>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ >
+{};
+
+DependentTemplateSpecializationTypeTester3<HasApply, int> DTSTCheck3; // expected-note{{in instantiation of template class}}
+
+template<typename T, typename U>
+struct DependentTemplateSpecializationTypeTester4 {
+ typedef class T::template apply<typename add_reference<U>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ > type;
+};
+
+DependentTemplateSpecializationTypeTester4<HasApply, int> DTSTCheck4; // expected-note{{in instantiation of template class}}
+
+template<template<class T> class TTP>
+struct AcceptedTemplateTemplateParameter {
+};
+
+template<typename T, typename U>
+struct DependentTemplateTemplateArgumentTester {
+ typedef AcceptedTemplateTemplateParameter<
+ T::
+ template apply<
+ typename add_reference<U>::type
+ * // expected-error{{declared as a pointer to a reference of type}}
+ >::
+ template X>
+ type;
+};
+
+DependentTemplateTemplateArgumentTester<HasApply, int> DTTACheck; // expected-note{{in instantiation of template class}}
+
+namespace PR9388 {
+ namespace std {
+ template<typename T> class vector {
+ };
+ }
+ template<typename T> static void foo(std::vector<T*> &V) {
+ __PRETTY_FUNCTION__; // expected-warning{{expression result unused}}
+ }
+ void bar(std::vector<int*> &Blocks) {
+ foo(Blocks); // expected-note{{in instantiation of}}
+ }
+
+}
diff --git a/test/SemaCXX/nullptr.cpp b/test/SemaCXX/nullptr.cpp
index 01f3d9367935..84c80aa286c2 100644
--- a/test/SemaCXX/nullptr.cpp
+++ b/test/SemaCXX/nullptr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x -ffreestanding %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x -ffreestanding %s
#include <stdint.h>
typedef decltype(nullptr) nullptr_t;
diff --git a/test/SemaCXX/operator-arrow-temporary.cpp b/test/SemaCXX/operator-arrow-temporary.cpp
new file mode 100644
index 000000000000..8e79609342b5
--- /dev/null
+++ b/test/SemaCXX/operator-arrow-temporary.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// PR9615
+
+struct Resource {
+ void doit();
+};
+
+template<int x> struct Lock {
+ ~Lock() { int a[x]; } // expected-error {{declared as an array with a negative size}}
+ Resource* operator->() { return 0; }
+};
+
+struct Accessor {
+ Lock<-1> operator->();
+};
+
+// Make sure we try to instantiate the destructor for Lock here
+void f() { Accessor acc; acc->doit(); } // expected-note {{requested here}}
+
diff --git a/test/SemaCXX/overloaded-name.cpp b/test/SemaCXX/overloaded-name.cpp
index 289d5c92ecff..5a87cc8e67e6 100644
--- a/test/SemaCXX/overloaded-name.cpp
+++ b/test/SemaCXX/overloaded-name.cpp
@@ -1,14 +1,14 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-int ovl(int);
-float ovl(float);
+int ovl(int); // expected-note 3{{candidate function}}
+float ovl(float); // expected-note 3{{candidate function}}
-template<typename T> T ovl(T);
+template<typename T> T ovl(T); // expected-note 3{{candidate function}}
void test(bool b) {
- (void)((void)0, ovl); // expected-error{{cannot resolve overloaded function from context}}
+ (void)((void)0, ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}}
// PR7863
- (void)(b? ovl : &ovl); // expected-error{{cannot resolve overloaded function from context}}
- (void)(b? ovl<float> : &ovl); // expected-error{{cannot resolve overloaded function from context}}
+ (void)(b? ovl : &ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}}
+ (void)(b? ovl<float> : &ovl); // expected-error{{cannot resolve overloaded function 'ovl' from context}}
(void)(b? ovl<float> : ovl<float>);
}
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 4399a026eaf4..44d013fe796e 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -384,3 +384,18 @@ void test_lookup_through_using() {
N::X2 x;
x << 17;
}
+
+namespace rdar9136502 {
+ struct X {
+ int i();
+ int i(int);
+ };
+
+ struct Y {
+ Y &operator<<(int); // expected-note{{candidate function not viable: no known conversion from '<bound member function type>' to 'int'}}
+ };
+
+ void f(X x, Y y) {
+ y << x.i; // expected-error{{a bound member function may only be called}}
+ }
+}
diff --git a/test/SemaCXX/pascal-strings.cpp b/test/SemaCXX/pascal-strings.cpp
new file mode 100644
index 000000000000..89194b54aa8d
--- /dev/null
+++ b/test/SemaCXX/pascal-strings.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fpascal-strings
+const wchar_t *pascalString = L"\pThis is a Pascal string";
+
+unsigned char a[3] = "\pa";
+unsigned char b[3] = "\pab";
+unsigned char c[3] = "\pabc"; // expected-error {{initializer-string for char array is too long}}
diff --git a/test/SemaCXX/pseudo-destructors.cpp b/test/SemaCXX/pseudo-destructors.cpp
index 30d9faac2e28..d71304e28b11 100644
--- a/test/SemaCXX/pseudo-destructors.cpp
+++ b/test/SemaCXX/pseudo-destructors.cpp
@@ -2,7 +2,7 @@
struct A {};
enum Foo { F };
-typedef Foo Bar;
+typedef Foo Bar; // expected-note{{type 'Bar' (aka 'Foo') is declared here}}
typedef int Integer;
typedef double Double;
@@ -23,10 +23,9 @@ void f(A* a, Foo *f, int *i, double *d) {
a->~A();
a->A::~A();
- a->~foo(); // expected-error{{identifier 'foo' in pseudo-destructor expression does not name a type}}
+ a->~foo(); // expected-error{{identifier 'foo' in object destruction expression does not name a type}}
- // FIXME: the diagnostic below isn't wonderful
- a->~Bar(); // expected-error{{does not name a type}}
+ a->~Bar(); // expected-error{{destructor type 'Bar' (aka 'Foo') in object destruction expression does not match the type 'A' of the object being destroyed}}
f->~Bar();
f->~Foo();
diff --git a/test/SemaCXX/ptrtomember.cpp b/test/SemaCXX/ptrtomember.cpp
index 1038de9a1d3b..c3917333a540 100644
--- a/test/SemaCXX/ptrtomember.cpp
+++ b/test/SemaCXX/ptrtomember.cpp
@@ -27,6 +27,7 @@ void f3(S3* p, void (S3::*m)()) {
(void)(void*)(p->*m); // expected-error {{a bound member function may only be called}}
(void)reinterpret_cast<void*>(p->*m); // expected-error {{a bound member function may only be called}}
if (p->*m) {} // expected-error {{a bound member function may only be called}}
-
- p->m; // expected-error {{a bound member function may only be called}}
+ if (!(p->*m)) {} // expected-error {{a bound member function may only be called}}
+ if (p->m) {}; // expected-error {{a bound member function may only be called}}
+ if (!p->m) {}; // expected-error {{a bound member function may only be called}}
}
diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp
index 74dbc01ee5ac..f5262496c4b0 100644
--- a/test/SemaCXX/reinterpret-cast.cpp
+++ b/test/SemaCXX/reinterpret-cast.cpp
@@ -45,9 +45,9 @@ void constness()
// Valid: T1* -> T2 const*
int const *icp = reinterpret_cast<int const*>(ipppc);
// Invalid: T1 const* -> T2*
- (void)reinterpret_cast<int*>(icp); // expected-error {{reinterpret_cast from 'const int *' to 'int *' casts away constness}}
+ (void)reinterpret_cast<int*>(icp); // expected-error {{reinterpret_cast from 'const int *' to 'int *' casts away qualifiers}}
// Invalid: T1*** -> T2 const* const**
- int const *const **icpcpp = reinterpret_cast<int const* const**>(ipppc); // expected-error {{reinterpret_cast from 'int ***' to 'const int *const **' casts away constness}}
+ int const *const **icpcpp = reinterpret_cast<int const* const**>(ipppc); // expected-error {{reinterpret_cast from 'int ***' to 'const int *const **' casts away qualifiers}}
// Valid: T1* -> T2*
int *ip = reinterpret_cast<int*>(icpcpp);
// Valid: T* -> T const*
@@ -77,7 +77,7 @@ void memptrs()
{
const int structure::*psi = 0;
(void)reinterpret_cast<const float structure::*>(psi);
- (void)reinterpret_cast<int structure::*>(psi); // expected-error {{reinterpret_cast from 'const int structure::*' to 'int structure::*' casts away constness}}
+ (void)reinterpret_cast<int structure::*>(psi); // expected-error {{reinterpret_cast from 'const int structure::*' to 'int structure::*' casts away qualifiers}}
void (structure::*psf)() = 0;
(void)reinterpret_cast<int (structure::*)()>(psf);
@@ -105,6 +105,14 @@ void const_arrays() {
const STRING *s;
const char *c;
- (void)reinterpret_cast<char *>(s); // expected-error {{reinterpret_cast from 'const STRING *' (aka 'char const (*)[10]') to 'char *' casts away constness}}
+ (void)reinterpret_cast<char *>(s); // expected-error {{reinterpret_cast from 'const STRING *' (aka 'char const (*)[10]') to 'char *' casts away qualifiers}}
(void)reinterpret_cast<const STRING *>(c);
}
+
+namespace PR9564 {
+ struct a { int a : 10; }; a x;
+ int *y = &reinterpret_cast<int&>(x.a); // expected-error {{not allowed}}
+
+ __attribute((ext_vector_type(4))) typedef float v4;
+ float& w(v4 &a) { return reinterpret_cast<float&>(a[1]); } // expected-error {{not allowed}}
+}
diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp
index 7e0a69c266b5..53ed0d724527 100644
--- a/test/SemaCXX/return-noreturn.cpp
+++ b/test/SemaCXX/return-noreturn.cpp
@@ -1,18 +1,69 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code
-// XFAIL: *
// A destructor may be marked noreturn and should still influence the CFG.
-namespace PR6884 {
- struct abort_struct {
- abort_struct() {} // Make this non-POD so the destructor is invoked.
- ~abort_struct() __attribute__((noreturn));
- };
-
- int f() {
- abort_struct();
+void pr6884_abort() __attribute__((noreturn));
+
+struct pr6884_abort_struct {
+ pr6884_abort_struct() {}
+ ~pr6884_abort_struct() __attribute__((noreturn)) { pr6884_abort(); }
+};
+
+int pr6884_f(int x) {
+ switch (x) { default: pr6884_abort(); }
+}
+
+int pr6884_g(int x) {
+ switch (x) { default: pr6884_abort_struct(); }
+}
+
+int pr6884_g_positive(int x) {
+ switch (x) { default: ; }
+} // expected-warning {{control reaches end of non-void function}}
+
+int pr6884_h(int x) {
+ switch (x) {
+ default: {
+ pr6884_abort_struct a;
+ }
}
+}
- int f2() {
- abort_struct s;
+// PR9380
+struct PR9380 {
+ ~PR9380();
+};
+struct PR9380_B : public PR9380 {
+ PR9380_B( const PR9380& str );
+};
+void test_PR9380(const PR9380& aKey) {
+ const PR9380& flatKey = PR9380_B(aKey);
+}
+
+// Array of objects with destructors. This is purely a coverage test case.
+void test_array() {
+ PR9380 a[2];
+}
+
+// Test classes wrapped in typedefs. This is purely a coverage test case
+// for CFGImplictDtor::getDestructorDecl().
+void test_typedefs() {
+ typedef PR9380 PR9380_Ty;
+ PR9380_Ty test;
+ PR9380_Ty test2[20];
+}
+
+// PR9412 - Handle CFG traversal with null successors.
+enum PR9412_MatchType { PR9412_Exact };
+
+template <PR9412_MatchType type> int PR9412_t() {
+ switch (type) {
+ case PR9412_Exact:
+ default:
+ break;
}
+} // expected-warning {{control reaches end of non-void function}}
+
+void PR9412_f() {
+ PR9412_t<PR9412_Exact>(); // expected-note {{in instantiation of function template specialization 'PR9412_t<0>' requested here}}
}
+
diff --git a/test/SemaCXX/return.cpp b/test/SemaCXX/return.cpp
index 46524fccfcc5..af7f50ce44b3 100644
--- a/test/SemaCXX/return.cpp
+++ b/test/SemaCXX/return.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fexceptions -fsyntax-only -Wignored-qualifiers -verify
+// RUN: %clang_cc1 %s -fcxx-exceptions -fexceptions -fsyntax-only -Wignored-qualifiers -verify
int test1() {
throw;
@@ -41,3 +41,15 @@ char* volatile i(); // expected-warning{{'volatile' type qualifier on return typ
const volatile int scalar_cv(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}}
}
+
+namespace PR9328 {
+ typedef char *PCHAR;
+ class Test
+ {
+ const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}}
+ };
+}
+
+class foo {
+ operator int * const ();
+};
diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp
index 11187cba5d82..74afdbe41043 100644
--- a/test/SemaCXX/rval-references.cpp
+++ b/test/SemaCXX/rval-references.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++0x %s
typedef int&& irr;
typedef irr& ilr_c1; // Collapses to int&
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp
index d462af06d730..3a90cc08f6a2 100644
--- a/test/SemaCXX/scope-check.cpp
+++ b/test/SemaCXX/scope-check.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s -Wno-unreachable-code
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu++0x %s -Wno-unreachable-code
namespace test0 {
struct D { ~D(); };
@@ -151,3 +152,22 @@ namespace test8 {
l2: x++;
}
}
+
+namespace test9 {
+ struct S { int i; };
+ void test1() {
+ goto foo;
+ S s;
+ foo:
+ return;
+ }
+ unsigned test2(unsigned x, unsigned y) {
+ switch (x) {
+ case 2:
+ S s;
+ if (y > 42) return x + y;
+ default:
+ return x - 2;
+ }
+ }
+}
diff --git a/test/SemaCXX/short-enums.cpp b/test/SemaCXX/short-enums.cpp
new file mode 100644
index 000000000000..ca713b733410
--- /dev/null
+++ b/test/SemaCXX/short-enums.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fshort-enums -fsyntax-only %s
+
+// This shouldn't crash: PR9474
+
+enum E { VALUE_1 };
+
+template <typename T>
+struct A {};
+
+template <E Enum>
+struct B : A<B<Enum> > {};
+
+void bar(int x) {
+ switch (x) {
+ case sizeof(B<VALUE_1>): ;
+ }
+} \ No newline at end of file
diff --git a/test/SemaCXX/short-wchar-sign.cpp b/test/SemaCXX/short-wchar-sign.cpp
new file mode 100644
index 000000000000..9a177c04b104
--- /dev/null
+++ b/test/SemaCXX/short-wchar-sign.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fshort-wchar -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -pedantic -verify %s
+
+// Check that short wchar_t is unsigned, and that regular wchar_t is not.
+int test[(wchar_t(-1)<wchar_t(0)) == (sizeof(wchar_t) == 4) ?1:-1];
diff --git a/test/SemaCXX/sourceranges.cpp b/test/SemaCXX/sourceranges.cpp
index 602d76baa9db..0537aa20d5e9 100644
--- a/test/SemaCXX/sourceranges.cpp
+++ b/test/SemaCXX/sourceranges.cpp
@@ -13,15 +13,15 @@ typedef int C;
}
int main() {
- // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::class A *'
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::A *'
P<foo::A> p14 = new foo::A;
- // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::enum B *'
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::B *'
P<foo::B> p24 = new foo::B;
// CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::C *'
P<foo::C> pr4 = new foo::C;
}
foo::A getName() {
- // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::class A'
+ // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::A'
return foo::A();
}
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index 46c6eee2c4e8..7fb016ea86d8 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/test/SemaCXX/static-cast.cpp
@@ -84,8 +84,8 @@ void t_529_5_8()
(void)static_cast<C1&>(*((A*)0)); // expected-error {{cannot cast 'A' to 'C1 &' via virtual base 'B'}}
(void)static_cast<D*>((A*)0); // expected-error {{cannot cast 'A *' to 'D *' via virtual base 'B'}}
(void)static_cast<D&>(*((A*)0)); // expected-error {{cannot cast 'A' to 'D &' via virtual base 'B'}}
- (void)static_cast<B*>((const A*)0); // expected-error {{static_cast from 'const A *' to 'B *' casts away constness}}
- (void)static_cast<B&>(*((const A*)0)); // expected-error {{static_cast from 'const A' to 'B &' casts away constness}}
+ (void)static_cast<B*>((const A*)0); // expected-error {{static_cast from 'const A *' to 'B *' casts away qualifiers}}
+ (void)static_cast<B&>(*((const A*)0)); // expected-error {{static_cast from 'const A' to 'B &' casts away qualifiers}}
(void)static_cast<E*>((A*)0); // expected-error {{cannot cast private base class 'A' to 'E'}}
(void)static_cast<E&>(*((A*)0)); // expected-error {{cannot cast private base class 'A' to 'E'}}
(void)static_cast<H*>((A*)0); // expected-error {{ambiguous cast from base 'A' to derived 'H':\n struct A -> struct B -> struct G1 -> struct H\n struct A -> struct B -> struct G2 -> struct H}}
@@ -119,7 +119,7 @@ void t_529_10()
// Bad code below
- (void)static_cast<int*>((const void*)0); // expected-error {{static_cast from 'const void *' to 'int *' casts away constness}}
+ (void)static_cast<int*>((const void*)0); // expected-error {{static_cast from 'const void *' to 'int *' casts away qualifiers}}
(void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)()' is not allowed}}
}
diff --git a/test/SemaCXX/storage-class.cpp b/test/SemaCXX/storage-class.cpp
index a2e206323a07..01cfbfc51faa 100644
--- a/test/SemaCXX/storage-class.cpp
+++ b/test/SemaCXX/storage-class.cpp
@@ -2,3 +2,6 @@
extern const int PR6495a = 42;
extern int PR6495b = 42; // expected-warning{{'extern' variable has an initializer}}
extern const int PR6495c[] = {42,43,44};
+
+extern struct Test1 {}; // expected-warning {{'extern' ignored on this declaration}}
+extern "C" struct Test0 {}; // no warning
diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp
index ff9a6bf51a6f..96e9696a041c 100644
--- a/test/SemaCXX/type-traits.cpp
+++ b/test/SemaCXX/type-traits.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
#define T(b) (b) ? 1 : -1
#define F(b) (b) ? -1 : 1
@@ -27,22 +27,37 @@ struct HasAnonymousUnion {
};
};
+typedef int Vector __attribute__((vector_size(16)));
+typedef int VectorExt __attribute__((ext_vector_type(4)));
+
// Not PODs
typedef const void cvoid;
struct Derives : POD {};
+typedef Derives DerivesAr[10];
+typedef Derives DerivesArNB[];
struct DerivesEmpty : Empty {};
struct HasCons { HasCons(int); };
struct HasCopyAssign { HasCopyAssign operator =(const HasCopyAssign&); };
+struct HasMoveAssign { HasMoveAssign operator =(const HasMoveAssign&&); }; // \
+ // expected-warning {{rvalue references}}
struct HasDest { ~HasDest(); };
class HasPriv { int priv; };
class HasProt { protected: int prot; };
struct HasRef { int i; int& ref; HasRef() : i(0), ref(i) {} };
struct HasNonPOD { NonPOD np; };
struct HasVirt { virtual void Virt() {}; };
-typedef Derives NonPODAr[10];
+typedef NonPOD NonPODAr[10];
typedef HasVirt VirtAr[10];
-typedef HasCons NonPODArNB[];
+typedef NonPOD NonPODArNB[];
union NonPODUnion { int i; Derives n; };
+struct DerivesHasCons : HasCons {};
+struct DerivesHasCopyAssign : HasCopyAssign {};
+struct DerivesHasMoveAssign : HasMoveAssign {};
+struct DerivesHasDest : HasDest {};
+struct DerivesHasPriv : HasPriv {};
+struct DerivesHasProt : HasProt {};
+struct DerivesHasRef : HasRef {};
+struct DerivesHasVirt : HasVirt {};
struct HasNoThrowCopyAssign {
void operator =(const HasNoThrowCopyAssign&) throw();
@@ -77,37 +92,51 @@ typedef HasVirtDest VirtDestAr[1];
void is_pod()
{
- int t01[T(__is_pod(int))];
- int t02[T(__is_pod(Enum))];
- int t03[T(__is_pod(POD))];
- int t04[T(__is_pod(Int))];
- int t05[T(__is_pod(IntAr))];
- int t06[T(__is_pod(Statics))];
- int t07[T(__is_pod(Empty))];
- int t08[T(__is_pod(EmptyUnion))];
- int t09[T(__is_pod(Union))];
- int t10[T(__is_pod(HasFunc))];
- int t11[T(__is_pod(HasOp))];
- int t12[T(__is_pod(HasConv))];
- int t13[T(__is_pod(HasAssign))];
- int t14[T(__is_pod(IntArNB))];
- int t15[T(__is_pod(HasAnonymousUnion))];
-
- int t21[F(__is_pod(Derives))];
- int t22[F(__is_pod(HasCons))];
- int t23[F(__is_pod(HasCopyAssign))];
- int t24[F(__is_pod(HasDest))];
- int t25[F(__is_pod(HasPriv))];
- int t26[F(__is_pod(HasProt))];
- int t27[F(__is_pod(HasRef))];
- int t28[F(__is_pod(HasNonPOD))];
- int t29[F(__is_pod(HasVirt))];
- int t30[F(__is_pod(NonPODAr))];
- int t31[F(__is_pod(DerivesEmpty))];
- int t32[F(__is_pod(void))];
- int t33[F(__is_pod(cvoid))];
- int t34[F(__is_pod(NonPODArNB))];
- // int t32[F(__is_pod(NonPODUnion))];
+ { int arr[T(__is_pod(int))]; }
+ { int arr[T(__is_pod(Enum))]; }
+ { int arr[T(__is_pod(POD))]; }
+ { int arr[T(__is_pod(Int))]; }
+ { int arr[T(__is_pod(IntAr))]; }
+ { int arr[T(__is_pod(Statics))]; }
+ { int arr[T(__is_pod(Empty))]; }
+ { int arr[T(__is_pod(EmptyUnion))]; }
+ { int arr[T(__is_pod(Union))]; }
+ { int arr[T(__is_pod(HasFunc))]; }
+ { int arr[T(__is_pod(HasOp))]; }
+ { int arr[T(__is_pod(HasConv))]; }
+ { int arr[T(__is_pod(HasAssign))]; }
+ { int arr[T(__is_pod(IntArNB))]; }
+ { int arr[T(__is_pod(HasAnonymousUnion))]; }
+ { int arr[T(__is_pod(Vector))]; }
+ { int arr[T(__is_pod(VectorExt))]; }
+
+ { int arr[F(__is_pod(Derives))]; }
+ { int arr[F(__is_pod(DerivesAr))]; }
+ { int arr[F(__is_pod(DerivesArNB))]; }
+ { int arr[F(__is_pod(DerivesEmpty))]; }
+ { int arr[F(__is_pod(HasCons))]; }
+ { int arr[F(__is_pod(HasCopyAssign))]; }
+ { int arr[F(__is_pod(HasMoveAssign))]; }
+ { int arr[F(__is_pod(HasDest))]; }
+ { int arr[F(__is_pod(HasPriv))]; }
+ { int arr[F(__is_pod(HasProt))]; }
+ { int arr[F(__is_pod(HasRef))]; }
+ { int arr[F(__is_pod(HasVirt))]; }
+ { int arr[F(__is_pod(DerivesHasCons))]; }
+ { int arr[F(__is_pod(DerivesHasCopyAssign))]; }
+ { int arr[F(__is_pod(DerivesHasMoveAssign))]; }
+ { int arr[F(__is_pod(DerivesHasDest))]; }
+ { int arr[F(__is_pod(DerivesHasPriv))]; }
+ { int arr[F(__is_pod(DerivesHasProt))]; }
+ { int arr[F(__is_pod(DerivesHasRef))]; }
+ { int arr[F(__is_pod(DerivesHasVirt))]; }
+ { int arr[F(__is_pod(NonPOD))]; }
+ { int arr[F(__is_pod(HasNonPOD))]; }
+ { int arr[F(__is_pod(NonPODAr))]; }
+ { int arr[F(__is_pod(NonPODArNB))]; }
+ { int arr[F(__is_pod(void))]; }
+ { int arr[F(__is_pod(cvoid))]; }
+// { int arr[F(__is_pod(NonPODUnion))]; }
}
typedef Empty EmptyAr[10];
@@ -118,48 +147,49 @@ struct BitOnly { int x : 3; };
void is_empty()
{
- int t01[T(__is_empty(Empty))];
- int t02[T(__is_empty(DerivesEmpty))];
- int t03[T(__is_empty(HasCons))];
- int t04[T(__is_empty(HasCopyAssign))];
- int t05[T(__is_empty(HasDest))];
- int t06[T(__is_empty(HasFunc))];
- int t07[T(__is_empty(HasOp))];
- int t08[T(__is_empty(HasConv))];
- int t09[T(__is_empty(HasAssign))];
- int t10[T(__is_empty(Bit0))];
- int t11[T(__is_empty(Bit0Cons))];
-
- int t21[F(__is_empty(Int))];
- int t22[F(__is_empty(POD))];
- int t23[F(__is_empty(EmptyUnion))];
- int t24[F(__is_empty(EmptyAr))];
- int t25[F(__is_empty(HasRef))];
- int t26[F(__is_empty(HasVirt))];
- int t27[F(__is_empty(BitOnly))];
- int t28[F(__is_empty(void))];
- int t29[F(__is_empty(IntArNB))];
- int t30[F(__is_empty(HasAnonymousUnion))];
-// int t27[F(__is_empty(DerivesVirt))];
+ { int arr[T(__is_empty(Empty))]; }
+ { int arr[T(__is_empty(DerivesEmpty))]; }
+ { int arr[T(__is_empty(HasCons))]; }
+ { int arr[T(__is_empty(HasCopyAssign))]; }
+ { int arr[T(__is_empty(HasMoveAssign))]; }
+ { int arr[T(__is_empty(HasDest))]; }
+ { int arr[T(__is_empty(HasFunc))]; }
+ { int arr[T(__is_empty(HasOp))]; }
+ { int arr[T(__is_empty(HasConv))]; }
+ { int arr[T(__is_empty(HasAssign))]; }
+ { int arr[T(__is_empty(Bit0))]; }
+ { int arr[T(__is_empty(Bit0Cons))]; }
+
+ { int arr[F(__is_empty(Int))]; }
+ { int arr[F(__is_empty(POD))]; }
+ { int arr[F(__is_empty(EmptyUnion))]; }
+ { int arr[F(__is_empty(EmptyAr))]; }
+ { int arr[F(__is_empty(HasRef))]; }
+ { int arr[F(__is_empty(HasVirt))]; }
+ { int arr[F(__is_empty(BitOnly))]; }
+ { int arr[F(__is_empty(void))]; }
+ { int arr[F(__is_empty(IntArNB))]; }
+ { int arr[F(__is_empty(HasAnonymousUnion))]; }
+// { int arr[F(__is_empty(DerivesVirt))]; }
}
typedef Derives ClassType;
void is_class()
{
- int t01[T(__is_class(Derives))];
- int t02[T(__is_class(HasPriv))];
- int t03[T(__is_class(ClassType))];
- int t04[T(__is_class(HasAnonymousUnion))];
+ { int arr[T(__is_class(Derives))]; }
+ { int arr[T(__is_class(HasPriv))]; }
+ { int arr[T(__is_class(ClassType))]; }
+ { int arr[T(__is_class(HasAnonymousUnion))]; }
- int t11[F(__is_class(int))];
- int t12[F(__is_class(Enum))];
- int t13[F(__is_class(Int))];
- int t14[F(__is_class(IntAr))];
- int t15[F(__is_class(NonPODAr))];
- int t16[F(__is_class(Union))];
- int t17[F(__is_class(cvoid))];
- int t18[F(__is_class(IntArNB))];
+ { int arr[F(__is_class(int))]; }
+ { int arr[F(__is_class(Enum))]; }
+ { int arr[F(__is_class(Int))]; }
+ { int arr[F(__is_class(IntAr))]; }
+ { int arr[F(__is_class(DerivesAr))]; }
+ { int arr[F(__is_class(Union))]; }
+ { int arr[F(__is_class(cvoid))]; }
+ { int arr[F(__is_class(IntArNB))]; }
}
typedef Union UnionAr[10];
@@ -167,36 +197,36 @@ typedef Union UnionType;
void is_union()
{
- int t01[T(__is_union(Union))];
- int t02[T(__is_union(UnionType))];
+ { int arr[T(__is_union(Union))]; }
+ { int arr[T(__is_union(UnionType))]; }
- int t11[F(__is_union(int))];
- int t12[F(__is_union(Enum))];
- int t13[F(__is_union(Int))];
- int t14[F(__is_union(IntAr))];
- int t15[F(__is_union(UnionAr))];
- int t16[F(__is_union(cvoid))];
- int t17[F(__is_union(IntArNB))];
- int t18[F(__is_union(HasAnonymousUnion))];
+ { int arr[F(__is_union(int))]; }
+ { int arr[F(__is_union(Enum))]; }
+ { int arr[F(__is_union(Int))]; }
+ { int arr[F(__is_union(IntAr))]; }
+ { int arr[F(__is_union(UnionAr))]; }
+ { int arr[F(__is_union(cvoid))]; }
+ { int arr[F(__is_union(IntArNB))]; }
+ { int arr[F(__is_union(HasAnonymousUnion))]; }
}
typedef Enum EnumType;
void is_enum()
{
- int t01[T(__is_enum(Enum))];
- int t02[T(__is_enum(EnumType))];
+ { int arr[T(__is_enum(Enum))]; }
+ { int arr[T(__is_enum(EnumType))]; }
- int t11[F(__is_enum(int))];
- int t12[F(__is_enum(Union))];
- int t13[F(__is_enum(Int))];
- int t14[F(__is_enum(IntAr))];
- int t15[F(__is_enum(UnionAr))];
- int t16[F(__is_enum(Derives))];
- int t17[F(__is_enum(ClassType))];
- int t18[F(__is_enum(cvoid))];
- int t19[F(__is_enum(IntArNB))];
- int t20[F(__is_enum(HasAnonymousUnion))];
+ { int arr[F(__is_enum(int))]; }
+ { int arr[F(__is_enum(Union))]; }
+ { int arr[F(__is_enum(Int))]; }
+ { int arr[F(__is_enum(IntAr))]; }
+ { int arr[F(__is_enum(UnionAr))]; }
+ { int arr[F(__is_enum(Derives))]; }
+ { int arr[F(__is_enum(ClassType))]; }
+ { int arr[F(__is_enum(cvoid))]; }
+ { int arr[F(__is_enum(IntArNB))]; }
+ { int arr[F(__is_enum(HasAnonymousUnion))]; }
}
typedef HasVirt Polymorph;
@@ -204,19 +234,788 @@ struct InheritPolymorph : Polymorph {};
void is_polymorphic()
{
- int t01[T(__is_polymorphic(Polymorph))];
- int t02[T(__is_polymorphic(InheritPolymorph))];
+ { int arr[T(__is_polymorphic(Polymorph))]; }
+ { int arr[T(__is_polymorphic(InheritPolymorph))]; }
+
+ { int arr[F(__is_polymorphic(int))]; }
+ { int arr[F(__is_polymorphic(Union))]; }
+ { int arr[F(__is_polymorphic(Int))]; }
+ { int arr[F(__is_polymorphic(IntAr))]; }
+ { int arr[F(__is_polymorphic(UnionAr))]; }
+ { int arr[F(__is_polymorphic(Derives))]; }
+ { int arr[F(__is_polymorphic(ClassType))]; }
+ { int arr[F(__is_polymorphic(Enum))]; }
+ { int arr[F(__is_polymorphic(cvoid))]; }
+ { int arr[F(__is_polymorphic(IntArNB))]; }
+}
+
+void is_integral()
+{
+ int t01[T(__is_integral(bool))];
+ int t02[T(__is_integral(char))];
+ int t03[T(__is_integral(signed char))];
+ int t04[T(__is_integral(unsigned char))];
+ //int t05[T(__is_integral(char16_t))];
+ //int t06[T(__is_integral(char32_t))];
+ int t07[T(__is_integral(wchar_t))];
+ int t08[T(__is_integral(short))];
+ int t09[T(__is_integral(unsigned short))];
+ int t10[T(__is_integral(int))];
+ int t11[T(__is_integral(unsigned int))];
+ int t12[T(__is_integral(long))];
+ int t13[T(__is_integral(unsigned long))];
+
+ int t21[F(__is_integral(float))];
+ int t22[F(__is_integral(double))];
+ int t23[F(__is_integral(long double))];
+ int t24[F(__is_integral(Union))];
+ int t25[F(__is_integral(UnionAr))];
+ int t26[F(__is_integral(Derives))];
+ int t27[F(__is_integral(ClassType))];
+ int t28[F(__is_integral(Enum))];
+ int t29[F(__is_integral(void))];
+ int t30[F(__is_integral(cvoid))];
+ int t31[F(__is_integral(IntArNB))];
+}
+
+void is_floating_point()
+{
+ int t01[T(__is_floating_point(float))];
+ int t02[T(__is_floating_point(double))];
+ int t03[T(__is_floating_point(long double))];
+
+ int t11[F(__is_floating_point(bool))];
+ int t12[F(__is_floating_point(char))];
+ int t13[F(__is_floating_point(signed char))];
+ int t14[F(__is_floating_point(unsigned char))];
+ //int t15[F(__is_floating_point(char16_t))];
+ //int t16[F(__is_floating_point(char32_t))];
+ int t17[F(__is_floating_point(wchar_t))];
+ int t18[F(__is_floating_point(short))];
+ int t19[F(__is_floating_point(unsigned short))];
+ int t20[F(__is_floating_point(int))];
+ int t21[F(__is_floating_point(unsigned int))];
+ int t22[F(__is_floating_point(long))];
+ int t23[F(__is_floating_point(unsigned long))];
+ int t24[F(__is_floating_point(Union))];
+ int t25[F(__is_floating_point(UnionAr))];
+ int t26[F(__is_floating_point(Derives))];
+ int t27[F(__is_floating_point(ClassType))];
+ int t28[F(__is_floating_point(Enum))];
+ int t29[F(__is_floating_point(void))];
+ int t30[F(__is_floating_point(cvoid))];
+ int t31[F(__is_floating_point(IntArNB))];
+}
+
+void is_arithmetic()
+{
+ int t01[T(__is_arithmetic(float))];
+ int t02[T(__is_arithmetic(double))];
+ int t03[T(__is_arithmetic(long double))];
+ int t11[T(__is_arithmetic(bool))];
+ int t12[T(__is_arithmetic(char))];
+ int t13[T(__is_arithmetic(signed char))];
+ int t14[T(__is_arithmetic(unsigned char))];
+ //int t15[T(__is_arithmetic(char16_t))];
+ //int t16[T(__is_arithmetic(char32_t))];
+ int t17[T(__is_arithmetic(wchar_t))];
+ int t18[T(__is_arithmetic(short))];
+ int t19[T(__is_arithmetic(unsigned short))];
+ int t20[T(__is_arithmetic(int))];
+ int t21[T(__is_arithmetic(unsigned int))];
+ int t22[T(__is_arithmetic(long))];
+ int t23[T(__is_arithmetic(unsigned long))];
+
+ int t24[F(__is_arithmetic(Union))];
+ int t25[F(__is_arithmetic(UnionAr))];
+ int t26[F(__is_arithmetic(Derives))];
+ int t27[F(__is_arithmetic(ClassType))];
+ int t28[F(__is_arithmetic(Enum))];
+ int t29[F(__is_arithmetic(void))];
+ int t30[F(__is_arithmetic(cvoid))];
+ int t31[F(__is_arithmetic(IntArNB))];
+}
+
+struct ACompleteType {};
+struct AnIncompleteType;
+
+void is_complete_type()
+{
+ int t01[T(__is_complete_type(float))];
+ int t02[T(__is_complete_type(double))];
+ int t03[T(__is_complete_type(long double))];
+ int t11[T(__is_complete_type(bool))];
+ int t12[T(__is_complete_type(char))];
+ int t13[T(__is_complete_type(signed char))];
+ int t14[T(__is_complete_type(unsigned char))];
+ //int t15[T(__is_complete_type(char16_t))];
+ //int t16[T(__is_complete_type(char32_t))];
+ int t17[T(__is_complete_type(wchar_t))];
+ int t18[T(__is_complete_type(short))];
+ int t19[T(__is_complete_type(unsigned short))];
+ int t20[T(__is_complete_type(int))];
+ int t21[T(__is_complete_type(unsigned int))];
+ int t22[T(__is_complete_type(long))];
+ int t23[T(__is_complete_type(unsigned long))];
+ int t24[T(__is_complete_type(ACompleteType))];
+
+ int t30[F(__is_complete_type(AnIncompleteType))];
+}
+
+void is_void()
+{
+ int t01[T(__is_void(void))];
+ int t02[T(__is_void(cvoid))];
+
+ int t10[F(__is_void(float))];
+ int t11[F(__is_void(double))];
+ int t12[F(__is_void(long double))];
+ int t13[F(__is_void(bool))];
+ int t14[F(__is_void(char))];
+ int t15[F(__is_void(signed char))];
+ int t16[F(__is_void(unsigned char))];
+ int t17[F(__is_void(wchar_t))];
+ int t18[F(__is_void(short))];
+ int t19[F(__is_void(unsigned short))];
+ int t20[F(__is_void(int))];
+ int t21[F(__is_void(unsigned int))];
+ int t22[F(__is_void(long))];
+ int t23[F(__is_void(unsigned long))];
+ int t24[F(__is_void(Union))];
+ int t25[F(__is_void(UnionAr))];
+ int t26[F(__is_void(Derives))];
+ int t27[F(__is_void(ClassType))];
+ int t28[F(__is_void(Enum))];
+ int t29[F(__is_void(IntArNB))];
+ int t30[F(__is_void(void*))];
+ int t31[F(__is_void(cvoid*))];
+}
+
+void is_array()
+{
+ int t01[T(__is_array(IntAr))];
+ int t02[T(__is_array(IntArNB))];
+ int t03[T(__is_array(UnionAr))];
+
+ int t10[F(__is_array(void))];
+ int t11[F(__is_array(cvoid))];
+ int t12[F(__is_array(float))];
+ int t13[F(__is_array(double))];
+ int t14[F(__is_array(long double))];
+ int t15[F(__is_array(bool))];
+ int t16[F(__is_array(char))];
+ int t17[F(__is_array(signed char))];
+ int t18[F(__is_array(unsigned char))];
+ int t19[F(__is_array(wchar_t))];
+ int t20[F(__is_array(short))];
+ int t21[F(__is_array(unsigned short))];
+ int t22[F(__is_array(int))];
+ int t23[F(__is_array(unsigned int))];
+ int t24[F(__is_array(long))];
+ int t25[F(__is_array(unsigned long))];
+ int t26[F(__is_array(Union))];
+ int t27[F(__is_array(Derives))];
+ int t28[F(__is_array(ClassType))];
+ int t29[F(__is_array(Enum))];
+ int t30[F(__is_array(void*))];
+ int t31[F(__is_array(cvoid*))];
+}
+
+template <typename T> void tmpl_func(T&) {}
+
+template <typename T> struct type_wrapper {
+ typedef T type;
+ typedef T* ptrtype;
+ typedef T& reftype;
+};
+
+void is_function()
+{
+ int t01[T(__is_function(type_wrapper<void(void)>::type))];
+ int t02[T(__is_function(typeof(tmpl_func<int>)))];
+
+ typedef void (*ptr_to_func_type)(void);
+
+ int t10[F(__is_function(void))];
+ int t11[F(__is_function(cvoid))];
+ int t12[F(__is_function(float))];
+ int t13[F(__is_function(double))];
+ int t14[F(__is_function(long double))];
+ int t15[F(__is_function(bool))];
+ int t16[F(__is_function(char))];
+ int t17[F(__is_function(signed char))];
+ int t18[F(__is_function(unsigned char))];
+ int t19[F(__is_function(wchar_t))];
+ int t20[F(__is_function(short))];
+ int t21[F(__is_function(unsigned short))];
+ int t22[F(__is_function(int))];
+ int t23[F(__is_function(unsigned int))];
+ int t24[F(__is_function(long))];
+ int t25[F(__is_function(unsigned long))];
+ int t26[F(__is_function(Union))];
+ int t27[F(__is_function(Derives))];
+ int t28[F(__is_function(ClassType))];
+ int t29[F(__is_function(Enum))];
+ int t30[F(__is_function(void*))];
+ int t31[F(__is_function(cvoid*))];
+ int t32[F(__is_function(void(*)()))];
+ int t33[F(__is_function(ptr_to_func_type))];
+ int t34[F(__is_function(type_wrapper<void(void)>::ptrtype))];
+ int t35[F(__is_function(type_wrapper<void(void)>::reftype))];
+}
+
+void is_reference()
+{
+ int t01[T(__is_reference(int&))];
+ int t02[T(__is_reference(const int&))];
+ int t03[T(__is_reference(void *&))];
+
+ int t10[F(__is_reference(int))];
+ int t11[F(__is_reference(const int))];
+ int t12[F(__is_reference(void *))];
+}
+
+void is_lvalue_reference()
+{
+ int t01[T(__is_lvalue_reference(int&))];
+ int t02[T(__is_lvalue_reference(void *&))];
+ int t03[T(__is_lvalue_reference(const int&))];
+ int t04[T(__is_lvalue_reference(void * const &))];
+
+ int t10[F(__is_lvalue_reference(int))];
+ int t11[F(__is_lvalue_reference(const int))];
+ int t12[F(__is_lvalue_reference(void *))];
+}
+
+#if __has_feature(cxx_rvalue_references)
+
+void is_rvalue_reference()
+{
+ int t01[T(__is_rvalue_reference(const int&&))];
+ int t02[T(__is_rvalue_reference(void * const &&))];
+
+ int t10[F(__is_rvalue_reference(int&))];
+ int t11[F(__is_rvalue_reference(void *&))];
+ int t12[F(__is_rvalue_reference(const int&))];
+ int t13[F(__is_rvalue_reference(void * const &))];
+ int t14[F(__is_rvalue_reference(int))];
+ int t15[F(__is_rvalue_reference(const int))];
+ int t16[F(__is_rvalue_reference(void *))];
+}
+
+#endif
+
+void is_fundamental()
+{
+ int t01[T(__is_fundamental(float))];
+ int t02[T(__is_fundamental(double))];
+ int t03[T(__is_fundamental(long double))];
+ int t11[T(__is_fundamental(bool))];
+ int t12[T(__is_fundamental(char))];
+ int t13[T(__is_fundamental(signed char))];
+ int t14[T(__is_fundamental(unsigned char))];
+ //int t15[T(__is_fundamental(char16_t))];
+ //int t16[T(__is_fundamental(char32_t))];
+ int t17[T(__is_fundamental(wchar_t))];
+ int t18[T(__is_fundamental(short))];
+ int t19[T(__is_fundamental(unsigned short))];
+ int t20[T(__is_fundamental(int))];
+ int t21[T(__is_fundamental(unsigned int))];
+ int t22[T(__is_fundamental(long))];
+ int t23[T(__is_fundamental(unsigned long))];
+ int t24[T(__is_fundamental(void))];
+ int t25[T(__is_fundamental(cvoid))];
+
+ int t30[F(__is_fundamental(Union))];
+ int t31[F(__is_fundamental(UnionAr))];
+ int t32[F(__is_fundamental(Derives))];
+ int t33[F(__is_fundamental(ClassType))];
+ int t34[F(__is_fundamental(Enum))];
+ int t35[F(__is_fundamental(IntArNB))];
+}
+
+void is_object()
+{
+ int t01[T(__is_object(int))];
+ int t02[T(__is_object(int *))];
+ int t03[T(__is_object(void *))];
+ int t04[T(__is_object(Union))];
+ int t05[T(__is_object(UnionAr))];
+ int t06[T(__is_object(ClassType))];
+ int t07[T(__is_object(Enum))];
+
+ int t10[F(__is_object(type_wrapper<void(void)>::type))];
+ int t11[F(__is_object(int&))];
+ int t12[F(__is_object(void))];
+}
+
+void is_scalar()
+{
+ int t01[T(__is_scalar(float))];
+ int t02[T(__is_scalar(double))];
+ int t03[T(__is_scalar(long double))];
+ int t04[T(__is_scalar(bool))];
+ int t05[T(__is_scalar(char))];
+ int t06[T(__is_scalar(signed char))];
+ int t07[T(__is_scalar(unsigned char))];
+ int t08[T(__is_scalar(wchar_t))];
+ int t09[T(__is_scalar(short))];
+ int t10[T(__is_scalar(unsigned short))];
+ int t11[T(__is_scalar(int))];
+ int t12[T(__is_scalar(unsigned int))];
+ int t13[T(__is_scalar(long))];
+ int t14[T(__is_scalar(unsigned long))];
+ int t15[T(__is_scalar(Enum))];
+ int t16[T(__is_scalar(void*))];
+ int t17[T(__is_scalar(cvoid*))];
+
+ int t20[F(__is_scalar(void))];
+ int t21[F(__is_scalar(cvoid))];
+ int t22[F(__is_scalar(Union))];
+ int t23[F(__is_scalar(UnionAr))];
+ int t24[F(__is_scalar(Derives))];
+ int t25[F(__is_scalar(ClassType))];
+ int t26[F(__is_scalar(IntArNB))];
+}
+
+struct StructWithMembers {
+ int member;
+ void method() {}
+};
+
+void is_compound()
+{
+ int t01[T(__is_compound(void*))];
+ int t02[T(__is_compound(cvoid*))];
+ int t03[T(__is_compound(void (*)()))];
+ int t04[T(__is_compound(int StructWithMembers::*))];
+ int t05[T(__is_compound(void (StructWithMembers::*)()))];
+ int t06[T(__is_compound(int&))];
+ int t07[T(__is_compound(Union))];
+ int t08[T(__is_compound(UnionAr))];
+ int t09[T(__is_compound(Derives))];
+ int t10[T(__is_compound(ClassType))];
+ int t11[T(__is_compound(IntArNB))];
+ int t12[T(__is_compound(Enum))];
+
+ int t20[F(__is_compound(float))];
+ int t21[F(__is_compound(double))];
+ int t22[F(__is_compound(long double))];
+ int t23[F(__is_compound(bool))];
+ int t24[F(__is_compound(char))];
+ int t25[F(__is_compound(signed char))];
+ int t26[F(__is_compound(unsigned char))];
+ int t27[F(__is_compound(wchar_t))];
+ int t28[F(__is_compound(short))];
+ int t29[F(__is_compound(unsigned short))];
+ int t30[F(__is_compound(int))];
+ int t31[F(__is_compound(unsigned int))];
+ int t32[F(__is_compound(long))];
+ int t33[F(__is_compound(unsigned long))];
+ int t34[F(__is_compound(void))];
+ int t35[F(__is_compound(cvoid))];
+}
+
+void is_pointer()
+{
+ StructWithMembers x;
+
+ int t01[T(__is_pointer(void*))];
+ int t02[T(__is_pointer(cvoid*))];
+ int t03[T(__is_pointer(cvoid*))];
+ int t04[T(__is_pointer(char*))];
+ int t05[T(__is_pointer(int*))];
+ int t06[T(__is_pointer(int**))];
+ int t07[T(__is_pointer(ClassType*))];
+ int t08[T(__is_pointer(Derives*))];
+ int t09[T(__is_pointer(Enum*))];
+ int t10[T(__is_pointer(IntArNB*))];
+ int t11[T(__is_pointer(Union*))];
+ int t12[T(__is_pointer(UnionAr*))];
+ int t13[T(__is_pointer(StructWithMembers*))];
+ int t14[T(__is_pointer(void (*)()))];
+
+ int t20[F(__is_pointer(void))];
+ int t21[F(__is_pointer(cvoid))];
+ int t22[F(__is_pointer(cvoid))];
+ int t23[F(__is_pointer(char))];
+ int t24[F(__is_pointer(int))];
+ int t25[F(__is_pointer(int))];
+ int t26[F(__is_pointer(ClassType))];
+ int t27[F(__is_pointer(Derives))];
+ int t28[F(__is_pointer(Enum))];
+ int t29[F(__is_pointer(IntArNB))];
+ int t30[F(__is_pointer(Union))];
+ int t31[F(__is_pointer(UnionAr))];
+ int t32[F(__is_pointer(StructWithMembers))];
+ int t33[F(__is_pointer(int StructWithMembers::*))];
+ int t34[F(__is_pointer(void (StructWithMembers::*) ()))];
+}
+
+void is_member_object_pointer()
+{
+ StructWithMembers x;
+
+ int t01[T(__is_member_object_pointer(int StructWithMembers::*))];
+
+ int t10[F(__is_member_object_pointer(void (StructWithMembers::*) ()))];
+ int t11[F(__is_member_object_pointer(void*))];
+ int t12[F(__is_member_object_pointer(cvoid*))];
+ int t13[F(__is_member_object_pointer(cvoid*))];
+ int t14[F(__is_member_object_pointer(char*))];
+ int t15[F(__is_member_object_pointer(int*))];
+ int t16[F(__is_member_object_pointer(int**))];
+ int t17[F(__is_member_object_pointer(ClassType*))];
+ int t18[F(__is_member_object_pointer(Derives*))];
+ int t19[F(__is_member_object_pointer(Enum*))];
+ int t20[F(__is_member_object_pointer(IntArNB*))];
+ int t21[F(__is_member_object_pointer(Union*))];
+ int t22[F(__is_member_object_pointer(UnionAr*))];
+ int t23[F(__is_member_object_pointer(StructWithMembers*))];
+ int t24[F(__is_member_object_pointer(void))];
+ int t25[F(__is_member_object_pointer(cvoid))];
+ int t26[F(__is_member_object_pointer(cvoid))];
+ int t27[F(__is_member_object_pointer(char))];
+ int t28[F(__is_member_object_pointer(int))];
+ int t29[F(__is_member_object_pointer(int))];
+ int t30[F(__is_member_object_pointer(ClassType))];
+ int t31[F(__is_member_object_pointer(Derives))];
+ int t32[F(__is_member_object_pointer(Enum))];
+ int t33[F(__is_member_object_pointer(IntArNB))];
+ int t34[F(__is_member_object_pointer(Union))];
+ int t35[F(__is_member_object_pointer(UnionAr))];
+ int t36[F(__is_member_object_pointer(StructWithMembers))];
+ int t37[F(__is_member_object_pointer(void (*)()))];
+}
+
+void is_member_function_pointer()
+{
+ StructWithMembers x;
- int t11[F(__is_polymorphic(int))];
- int t12[F(__is_polymorphic(Union))];
- int t13[F(__is_polymorphic(Int))];
- int t14[F(__is_polymorphic(IntAr))];
- int t15[F(__is_polymorphic(UnionAr))];
- int t16[F(__is_polymorphic(Derives))];
- int t17[F(__is_polymorphic(ClassType))];
- int t18[F(__is_polymorphic(Enum))];
- int t19[F(__is_polymorphic(cvoid))];
- int t20[F(__is_polymorphic(IntArNB))];
+ int t01[T(__is_member_function_pointer(void (StructWithMembers::*) ()))];
+
+ int t10[F(__is_member_function_pointer(int StructWithMembers::*))];
+ int t11[F(__is_member_function_pointer(void*))];
+ int t12[F(__is_member_function_pointer(cvoid*))];
+ int t13[F(__is_member_function_pointer(cvoid*))];
+ int t14[F(__is_member_function_pointer(char*))];
+ int t15[F(__is_member_function_pointer(int*))];
+ int t16[F(__is_member_function_pointer(int**))];
+ int t17[F(__is_member_function_pointer(ClassType*))];
+ int t18[F(__is_member_function_pointer(Derives*))];
+ int t19[F(__is_member_function_pointer(Enum*))];
+ int t20[F(__is_member_function_pointer(IntArNB*))];
+ int t21[F(__is_member_function_pointer(Union*))];
+ int t22[F(__is_member_function_pointer(UnionAr*))];
+ int t23[F(__is_member_function_pointer(StructWithMembers*))];
+ int t24[F(__is_member_function_pointer(void))];
+ int t25[F(__is_member_function_pointer(cvoid))];
+ int t26[F(__is_member_function_pointer(cvoid))];
+ int t27[F(__is_member_function_pointer(char))];
+ int t28[F(__is_member_function_pointer(int))];
+ int t29[F(__is_member_function_pointer(int))];
+ int t30[F(__is_member_function_pointer(ClassType))];
+ int t31[F(__is_member_function_pointer(Derives))];
+ int t32[F(__is_member_function_pointer(Enum))];
+ int t33[F(__is_member_function_pointer(IntArNB))];
+ int t34[F(__is_member_function_pointer(Union))];
+ int t35[F(__is_member_function_pointer(UnionAr))];
+ int t36[F(__is_member_function_pointer(StructWithMembers))];
+ int t37[F(__is_member_function_pointer(void (*)()))];
+}
+
+void is_member_pointer()
+{
+ StructWithMembers x;
+
+ int t01[T(__is_member_pointer(int StructWithMembers::*))];
+ int t02[T(__is_member_pointer(void (StructWithMembers::*) ()))];
+
+ int t10[F(__is_member_pointer(void*))];
+ int t11[F(__is_member_pointer(cvoid*))];
+ int t12[F(__is_member_pointer(cvoid*))];
+ int t13[F(__is_member_pointer(char*))];
+ int t14[F(__is_member_pointer(int*))];
+ int t15[F(__is_member_pointer(int**))];
+ int t16[F(__is_member_pointer(ClassType*))];
+ int t17[F(__is_member_pointer(Derives*))];
+ int t18[F(__is_member_pointer(Enum*))];
+ int t19[F(__is_member_pointer(IntArNB*))];
+ int t20[F(__is_member_pointer(Union*))];
+ int t21[F(__is_member_pointer(UnionAr*))];
+ int t22[F(__is_member_pointer(StructWithMembers*))];
+ int t23[F(__is_member_pointer(void))];
+ int t24[F(__is_member_pointer(cvoid))];
+ int t25[F(__is_member_pointer(cvoid))];
+ int t26[F(__is_member_pointer(char))];
+ int t27[F(__is_member_pointer(int))];
+ int t28[F(__is_member_pointer(int))];
+ int t29[F(__is_member_pointer(ClassType))];
+ int t30[F(__is_member_pointer(Derives))];
+ int t31[F(__is_member_pointer(Enum))];
+ int t32[F(__is_member_pointer(IntArNB))];
+ int t33[F(__is_member_pointer(Union))];
+ int t34[F(__is_member_pointer(UnionAr))];
+ int t35[F(__is_member_pointer(StructWithMembers))];
+ int t36[F(__is_member_pointer(void (*)()))];
+}
+
+void is_const()
+{
+ int t01[T(__is_const(cvoid))];
+ int t02[T(__is_const(const char))];
+ int t03[T(__is_const(const int))];
+ int t04[T(__is_const(const long))];
+ int t05[T(__is_const(const short))];
+ int t06[T(__is_const(const signed char))];
+ int t07[T(__is_const(const wchar_t))];
+ int t08[T(__is_const(const bool))];
+ int t09[T(__is_const(const float))];
+ int t10[T(__is_const(const double))];
+ int t11[T(__is_const(const long double))];
+ int t12[T(__is_const(const unsigned char))];
+ int t13[T(__is_const(const unsigned int))];
+ int t14[T(__is_const(const unsigned long long))];
+ int t15[T(__is_const(const unsigned long))];
+ int t16[T(__is_const(const unsigned short))];
+ int t17[T(__is_const(const void))];
+ int t18[T(__is_const(const ClassType))];
+ int t19[T(__is_const(const Derives))];
+ int t20[T(__is_const(const Enum))];
+ int t21[T(__is_const(const IntArNB))];
+ int t22[T(__is_const(const Union))];
+ int t23[T(__is_const(const UnionAr))];
+
+ int t30[F(__is_const(char))];
+ int t31[F(__is_const(int))];
+ int t32[F(__is_const(long))];
+ int t33[F(__is_const(short))];
+ int t34[F(__is_const(signed char))];
+ int t35[F(__is_const(wchar_t))];
+ int t36[F(__is_const(bool))];
+ int t37[F(__is_const(float))];
+ int t38[F(__is_const(double))];
+ int t39[F(__is_const(long double))];
+ int t40[F(__is_const(unsigned char))];
+ int t41[F(__is_const(unsigned int))];
+ int t42[F(__is_const(unsigned long long))];
+ int t43[F(__is_const(unsigned long))];
+ int t44[F(__is_const(unsigned short))];
+ int t45[F(__is_const(void))];
+ int t46[F(__is_const(ClassType))];
+ int t47[F(__is_const(Derives))];
+ int t48[F(__is_const(Enum))];
+ int t49[F(__is_const(IntArNB))];
+ int t50[F(__is_const(Union))];
+ int t51[F(__is_const(UnionAr))];
+}
+
+void is_volatile()
+{
+ int t02[T(__is_volatile(volatile char))];
+ int t03[T(__is_volatile(volatile int))];
+ int t04[T(__is_volatile(volatile long))];
+ int t05[T(__is_volatile(volatile short))];
+ int t06[T(__is_volatile(volatile signed char))];
+ int t07[T(__is_volatile(volatile wchar_t))];
+ int t08[T(__is_volatile(volatile bool))];
+ int t09[T(__is_volatile(volatile float))];
+ int t10[T(__is_volatile(volatile double))];
+ int t11[T(__is_volatile(volatile long double))];
+ int t12[T(__is_volatile(volatile unsigned char))];
+ int t13[T(__is_volatile(volatile unsigned int))];
+ int t14[T(__is_volatile(volatile unsigned long long))];
+ int t15[T(__is_volatile(volatile unsigned long))];
+ int t16[T(__is_volatile(volatile unsigned short))];
+ int t17[T(__is_volatile(volatile void))];
+ int t18[T(__is_volatile(volatile ClassType))];
+ int t19[T(__is_volatile(volatile Derives))];
+ int t20[T(__is_volatile(volatile Enum))];
+ int t21[T(__is_volatile(volatile IntArNB))];
+ int t22[T(__is_volatile(volatile Union))];
+ int t23[T(__is_volatile(volatile UnionAr))];
+
+ int t30[F(__is_volatile(char))];
+ int t31[F(__is_volatile(int))];
+ int t32[F(__is_volatile(long))];
+ int t33[F(__is_volatile(short))];
+ int t34[F(__is_volatile(signed char))];
+ int t35[F(__is_volatile(wchar_t))];
+ int t36[F(__is_volatile(bool))];
+ int t37[F(__is_volatile(float))];
+ int t38[F(__is_volatile(double))];
+ int t39[F(__is_volatile(long double))];
+ int t40[F(__is_volatile(unsigned char))];
+ int t41[F(__is_volatile(unsigned int))];
+ int t42[F(__is_volatile(unsigned long long))];
+ int t43[F(__is_volatile(unsigned long))];
+ int t44[F(__is_volatile(unsigned short))];
+ int t45[F(__is_volatile(void))];
+ int t46[F(__is_volatile(ClassType))];
+ int t47[F(__is_volatile(Derives))];
+ int t48[F(__is_volatile(Enum))];
+ int t49[F(__is_volatile(IntArNB))];
+ int t50[F(__is_volatile(Union))];
+ int t51[F(__is_volatile(UnionAr))];
+}
+
+struct TrivialStruct {
+ int member;
+};
+
+struct NonTrivialStruct {
+ int member;
+ NonTrivialStruct() {
+ member = 0;
+ }
+};
+
+void is_trivial2()
+{
+ int t01[T(__is_trivial(char))];
+ int t02[T(__is_trivial(int))];
+ int t03[T(__is_trivial(long))];
+ int t04[T(__is_trivial(short))];
+ int t05[T(__is_trivial(signed char))];
+ int t06[T(__is_trivial(wchar_t))];
+ int t07[T(__is_trivial(bool))];
+ int t08[T(__is_trivial(float))];
+ int t09[T(__is_trivial(double))];
+ int t10[T(__is_trivial(long double))];
+ int t11[T(__is_trivial(unsigned char))];
+ int t12[T(__is_trivial(unsigned int))];
+ int t13[T(__is_trivial(unsigned long long))];
+ int t14[T(__is_trivial(unsigned long))];
+ int t15[T(__is_trivial(unsigned short))];
+ int t16[T(__is_trivial(ClassType))];
+ int t17[T(__is_trivial(Derives))];
+ int t18[T(__is_trivial(Enum))];
+ int t19[T(__is_trivial(IntAr))];
+ int t20[T(__is_trivial(Union))];
+ int t21[T(__is_trivial(UnionAr))];
+ int t22[T(__is_trivial(TrivialStruct))];
+
+ int t30[F(__is_trivial(void))];
+ int t31[F(__is_trivial(NonTrivialStruct))];
+}
+
+struct CStruct {
+ int one;
+ int two;
+};
+
+struct CEmptyStruct {};
+
+struct CppEmptyStruct : CStruct {};
+struct CppStructStandard : CEmptyStruct {
+ int three;
+ int four;
+};
+struct CppStructNonStandardByBase : CStruct {
+ int three;
+ int four;
+};
+struct CppStructNonStandardByVirt : CStruct {
+ virtual void method() {}
+};
+struct CppStructNonStandardByMemb : CStruct {
+ CppStructNonStandardByVirt member;
+};
+struct CppStructNonStandardByProt : CStruct {
+ int five;
+protected:
+ int six;
+};
+struct CppStructNonStandardByVirtBase : virtual CStruct {
+};
+struct CppStructNonStandardBySameBase : CEmptyStruct {
+ CEmptyStruct member;
+};
+struct CppStructNonStandardBy2ndVirtBase : CEmptyStruct {
+ CEmptyStruct member;
+};
+
+void is_standard_layout()
+{
+ typedef const int ConstInt;
+ typedef ConstInt ConstIntAr[4];
+ typedef CppStructStandard CppStructStandardAr[4];
+
+ int t01[T(__is_standard_layout(int))];
+ int t02[T(__is_standard_layout(ConstInt))];
+ int t03[T(__is_standard_layout(ConstIntAr))];
+ int t04[T(__is_standard_layout(CStruct))];
+ int t05[T(__is_standard_layout(CppStructStandard))];
+ int t06[T(__is_standard_layout(CppStructStandardAr))];
+ int t07[T(__is_standard_layout(Vector))];
+ int t08[T(__is_standard_layout(VectorExt))];
+
+ typedef CppStructNonStandardByBase CppStructNonStandardByBaseAr[4];
+
+ int t10[F(__is_standard_layout(CppStructNonStandardByVirt))];
+ int t11[F(__is_standard_layout(CppStructNonStandardByMemb))];
+ int t12[F(__is_standard_layout(CppStructNonStandardByProt))];
+ int t13[F(__is_standard_layout(CppStructNonStandardByVirtBase))];
+ int t14[F(__is_standard_layout(CppStructNonStandardByBase))];
+ int t15[F(__is_standard_layout(CppStructNonStandardByBaseAr))];
+ int t16[F(__is_standard_layout(CppStructNonStandardBySameBase))];
+ int t17[F(__is_standard_layout(CppStructNonStandardBy2ndVirtBase))];
+}
+
+void is_signed()
+{
+ //int t01[T(__is_signed(char))];
+ int t02[T(__is_signed(int))];
+ int t03[T(__is_signed(long))];
+ int t04[T(__is_signed(short))];
+ int t05[T(__is_signed(signed char))];
+ int t06[T(__is_signed(wchar_t))];
+
+ int t10[F(__is_signed(bool))];
+ int t11[F(__is_signed(cvoid))];
+ int t12[F(__is_signed(float))];
+ int t13[F(__is_signed(double))];
+ int t14[F(__is_signed(long double))];
+ int t15[F(__is_signed(unsigned char))];
+ int t16[F(__is_signed(unsigned int))];
+ int t17[F(__is_signed(unsigned long long))];
+ int t18[F(__is_signed(unsigned long))];
+ int t19[F(__is_signed(unsigned short))];
+ int t20[F(__is_signed(void))];
+ int t21[F(__is_signed(ClassType))];
+ int t22[F(__is_signed(Derives))];
+ int t23[F(__is_signed(Enum))];
+ int t24[F(__is_signed(IntArNB))];
+ int t25[F(__is_signed(Union))];
+ int t26[F(__is_signed(UnionAr))];
+}
+
+void is_unsigned()
+{
+ int t01[T(__is_unsigned(bool))];
+ int t02[T(__is_unsigned(unsigned char))];
+ int t03[T(__is_unsigned(unsigned short))];
+ int t04[T(__is_unsigned(unsigned int))];
+ int t05[T(__is_unsigned(unsigned long))];
+ int t06[T(__is_unsigned(unsigned long long))];
+ int t07[T(__is_unsigned(Enum))];
+
+ int t10[F(__is_unsigned(void))];
+ int t11[F(__is_unsigned(cvoid))];
+ int t12[F(__is_unsigned(float))];
+ int t13[F(__is_unsigned(double))];
+ int t14[F(__is_unsigned(long double))];
+ int t16[F(__is_unsigned(char))];
+ int t17[F(__is_unsigned(signed char))];
+ int t18[F(__is_unsigned(wchar_t))];
+ int t19[F(__is_unsigned(short))];
+ int t20[F(__is_unsigned(int))];
+ int t21[F(__is_unsigned(long))];
+ int t22[F(__is_unsigned(Union))];
+ int t23[F(__is_unsigned(UnionAr))];
+ int t24[F(__is_unsigned(Derives))];
+ int t25[F(__is_unsigned(ClassType))];
+ int t26[F(__is_unsigned(IntArNB))];
}
typedef Int& IntRef;
@@ -227,6 +1026,10 @@ struct HasCopy {
HasCopy(HasCopy& cp);
};
+struct HasMove {
+ HasMove(HasMove&& cp); // expected-warning {{rvalue references}}
+};
+
struct HasTemplateCons {
HasVirt Annoying;
@@ -235,216 +1038,235 @@ struct HasTemplateCons {
};
void has_trivial_default_constructor() {
- int t01[T(__has_trivial_constructor(Int))];
- int t02[T(__has_trivial_constructor(IntAr))];
- int t03[T(__has_trivial_constructor(Union))];
- int t04[T(__has_trivial_constructor(UnionAr))];
- int t05[T(__has_trivial_constructor(POD))];
- int t06[T(__has_trivial_constructor(Derives))];
- int t07[T(__has_trivial_constructor(ConstIntAr))];
- int t08[T(__has_trivial_constructor(ConstIntArAr))];
- int t09[T(__has_trivial_constructor(HasDest))];
- int t10[T(__has_trivial_constructor(HasPriv))];
- int t11[F(__has_trivial_constructor(HasCons))];
- int t12[F(__has_trivial_constructor(HasRef))];
- int t13[F(__has_trivial_constructor(HasCopy))];
- int t14[F(__has_trivial_constructor(IntRef))];
- int t15[T(__has_trivial_constructor(HasCopyAssign))];
- int t16[T(__has_trivial_constructor(const Int))];
- int t17[T(__has_trivial_constructor(NonPODAr))];
- int t18[F(__has_trivial_constructor(VirtAr))];
- int t19[F(__has_trivial_constructor(void))];
- int t20[F(__has_trivial_constructor(cvoid))];
- int t21[F(__has_trivial_constructor(HasTemplateCons))];
+ { int arr[T(__has_trivial_constructor(Int))]; }
+ { int arr[T(__has_trivial_constructor(IntAr))]; }
+ { int arr[T(__has_trivial_constructor(Union))]; }
+ { int arr[T(__has_trivial_constructor(UnionAr))]; }
+ { int arr[T(__has_trivial_constructor(POD))]; }
+ { int arr[T(__has_trivial_constructor(Derives))]; }
+ { int arr[T(__has_trivial_constructor(DerivesAr))]; }
+ { int arr[T(__has_trivial_constructor(ConstIntAr))]; }
+ { int arr[T(__has_trivial_constructor(ConstIntArAr))]; }
+ { int arr[T(__has_trivial_constructor(HasDest))]; }
+ { int arr[T(__has_trivial_constructor(HasPriv))]; }
+ { int arr[T(__has_trivial_constructor(HasCopyAssign))]; }
+ { int arr[T(__has_trivial_constructor(HasMoveAssign))]; }
+ { int arr[T(__has_trivial_constructor(const Int))]; }
+
+ { int arr[F(__has_trivial_constructor(HasCons))]; }
+ { int arr[F(__has_trivial_constructor(HasRef))]; }
+ { int arr[F(__has_trivial_constructor(HasCopy))]; }
+ { int arr[F(__has_trivial_constructor(IntRef))]; }
+ { int arr[F(__has_trivial_constructor(VirtAr))]; }
+ { int arr[F(__has_trivial_constructor(void))]; }
+ { int arr[F(__has_trivial_constructor(cvoid))]; }
+ { int arr[F(__has_trivial_constructor(HasTemplateCons))]; }
}
void has_trivial_copy_constructor() {
- int t01[T(__has_trivial_copy(Int))];
- int t02[T(__has_trivial_copy(IntAr))];
- int t03[T(__has_trivial_copy(Union))];
- int t04[T(__has_trivial_copy(UnionAr))];
- int t05[T(__has_trivial_copy(POD))];
- int t06[T(__has_trivial_copy(Derives))];
- int t07[T(__has_trivial_copy(ConstIntAr))];
- int t08[T(__has_trivial_copy(ConstIntArAr))];
- int t09[T(__has_trivial_copy(HasDest))];
- int t10[T(__has_trivial_copy(HasPriv))];
- int t11[T(__has_trivial_copy(HasCons))];
- int t12[T(__has_trivial_copy(HasRef))];
- int t13[F(__has_trivial_copy(HasCopy))];
- int t14[T(__has_trivial_copy(IntRef))];
- int t15[T(__has_trivial_copy(HasCopyAssign))];
- int t16[T(__has_trivial_copy(const Int))];
- int t17[F(__has_trivial_copy(NonPODAr))];
- int t18[F(__has_trivial_copy(VirtAr))];
- int t19[F(__has_trivial_copy(void))];
- int t20[F(__has_trivial_copy(cvoid))];
- int t21[F(__has_trivial_copy(HasTemplateCons))];
+ { int arr[T(__has_trivial_copy(Int))]; }
+ { int arr[T(__has_trivial_copy(IntAr))]; }
+ { int arr[T(__has_trivial_copy(Union))]; }
+ { int arr[T(__has_trivial_copy(UnionAr))]; }
+ { int arr[T(__has_trivial_copy(POD))]; }
+ { int arr[T(__has_trivial_copy(Derives))]; }
+ { int arr[T(__has_trivial_copy(ConstIntAr))]; }
+ { int arr[T(__has_trivial_copy(ConstIntArAr))]; }
+ { int arr[T(__has_trivial_copy(HasDest))]; }
+ { int arr[T(__has_trivial_copy(HasPriv))]; }
+ { int arr[T(__has_trivial_copy(HasCons))]; }
+ { int arr[T(__has_trivial_copy(HasRef))]; }
+ { int arr[T(__has_trivial_copy(HasMove))]; }
+ { int arr[T(__has_trivial_copy(IntRef))]; }
+ { int arr[T(__has_trivial_copy(HasCopyAssign))]; }
+ { int arr[T(__has_trivial_copy(HasMoveAssign))]; }
+ { int arr[T(__has_trivial_copy(const Int))]; }
+
+ { int arr[F(__has_trivial_copy(HasCopy))]; }
+ { int arr[F(__has_trivial_copy(HasTemplateCons))]; }
+ { int arr[F(__has_trivial_copy(DerivesAr))]; }
+ { int arr[F(__has_trivial_copy(VirtAr))]; }
+ { int arr[F(__has_trivial_copy(void))]; }
+ { int arr[F(__has_trivial_copy(cvoid))]; }
}
void has_trivial_copy_assignment() {
- int t01[T(__has_trivial_assign(Int))];
- int t02[T(__has_trivial_assign(IntAr))];
- int t03[T(__has_trivial_assign(Union))];
- int t04[T(__has_trivial_assign(UnionAr))];
- int t05[T(__has_trivial_assign(POD))];
- int t06[T(__has_trivial_assign(Derives))];
- int t07[F(__has_trivial_assign(ConstIntAr))];
- int t08[F(__has_trivial_assign(ConstIntArAr))];
- int t09[T(__has_trivial_assign(HasDest))];
- int t10[T(__has_trivial_assign(HasPriv))];
- int t11[T(__has_trivial_assign(HasCons))];
- int t12[T(__has_trivial_assign(HasRef))];
- int t13[T(__has_trivial_assign(HasCopy))];
- int t14[F(__has_trivial_assign(IntRef))];
- int t15[F(__has_trivial_assign(HasCopyAssign))];
- int t16[F(__has_trivial_assign(const Int))];
- int t17[F(__has_trivial_assign(NonPODAr))];
- int t18[F(__has_trivial_assign(VirtAr))];
- int t19[F(__has_trivial_assign(void))];
- int t20[F(__has_trivial_assign(cvoid))];
+ { int arr[T(__has_trivial_assign(Int))]; }
+ { int arr[T(__has_trivial_assign(IntAr))]; }
+ { int arr[T(__has_trivial_assign(Union))]; }
+ { int arr[T(__has_trivial_assign(UnionAr))]; }
+ { int arr[T(__has_trivial_assign(POD))]; }
+ { int arr[T(__has_trivial_assign(Derives))]; }
+ { int arr[T(__has_trivial_assign(HasDest))]; }
+ { int arr[T(__has_trivial_assign(HasPriv))]; }
+ { int arr[T(__has_trivial_assign(HasCons))]; }
+ { int arr[T(__has_trivial_assign(HasRef))]; }
+ { int arr[T(__has_trivial_assign(HasCopy))]; }
+ { int arr[T(__has_trivial_assign(HasMove))]; }
+ { int arr[T(__has_trivial_assign(HasMoveAssign))]; }
+
+ { int arr[F(__has_trivial_assign(IntRef))]; }
+ { int arr[F(__has_trivial_assign(HasCopyAssign))]; }
+ { int arr[F(__has_trivial_assign(const Int))]; }
+ { int arr[F(__has_trivial_assign(ConstIntAr))]; }
+ { int arr[F(__has_trivial_assign(ConstIntArAr))]; }
+ { int arr[F(__has_trivial_assign(DerivesAr))]; }
+ { int arr[F(__has_trivial_assign(VirtAr))]; }
+ { int arr[F(__has_trivial_assign(void))]; }
+ { int arr[F(__has_trivial_assign(cvoid))]; }
}
void has_trivial_destructor() {
- int t01[T(__has_trivial_destructor(Int))];
- int t02[T(__has_trivial_destructor(IntAr))];
- int t03[T(__has_trivial_destructor(Union))];
- int t04[T(__has_trivial_destructor(UnionAr))];
- int t05[T(__has_trivial_destructor(POD))];
- int t06[T(__has_trivial_destructor(Derives))];
- int t07[T(__has_trivial_destructor(ConstIntAr))];
- int t08[T(__has_trivial_destructor(ConstIntArAr))];
- int t09[F(__has_trivial_destructor(HasDest))];
- int t10[T(__has_trivial_destructor(HasPriv))];
- int t11[T(__has_trivial_destructor(HasCons))];
- int t12[T(__has_trivial_destructor(HasRef))];
- int t13[T(__has_trivial_destructor(HasCopy))];
- int t14[T(__has_trivial_destructor(IntRef))];
- int t15[T(__has_trivial_destructor(HasCopyAssign))];
- int t16[T(__has_trivial_destructor(const Int))];
- int t17[T(__has_trivial_destructor(NonPODAr))];
- int t18[T(__has_trivial_destructor(VirtAr))];
- int t19[F(__has_trivial_destructor(void))];
- int t20[F(__has_trivial_destructor(cvoid))];
+ { int arr[T(__has_trivial_destructor(Int))]; }
+ { int arr[T(__has_trivial_destructor(IntAr))]; }
+ { int arr[T(__has_trivial_destructor(Union))]; }
+ { int arr[T(__has_trivial_destructor(UnionAr))]; }
+ { int arr[T(__has_trivial_destructor(POD))]; }
+ { int arr[T(__has_trivial_destructor(Derives))]; }
+ { int arr[T(__has_trivial_destructor(ConstIntAr))]; }
+ { int arr[T(__has_trivial_destructor(ConstIntArAr))]; }
+ { int arr[T(__has_trivial_destructor(HasPriv))]; }
+ { int arr[T(__has_trivial_destructor(HasCons))]; }
+ { int arr[T(__has_trivial_destructor(HasRef))]; }
+ { int arr[T(__has_trivial_destructor(HasCopy))]; }
+ { int arr[T(__has_trivial_destructor(HasMove))]; }
+ { int arr[T(__has_trivial_destructor(IntRef))]; }
+ { int arr[T(__has_trivial_destructor(HasCopyAssign))]; }
+ { int arr[T(__has_trivial_destructor(HasMoveAssign))]; }
+ { int arr[T(__has_trivial_destructor(const Int))]; }
+ { int arr[T(__has_trivial_destructor(DerivesAr))]; }
+ { int arr[T(__has_trivial_destructor(VirtAr))]; }
+
+ { int arr[F(__has_trivial_destructor(HasDest))]; }
+ { int arr[F(__has_trivial_destructor(void))]; }
+ { int arr[F(__has_trivial_destructor(cvoid))]; }
}
struct A { ~A() {} };
template<typename> struct B : A { };
void f() {
- int t01[F(__has_trivial_destructor(A))];
- int t02[F(__has_trivial_destructor(B<int>))];
+ { int arr[F(__has_trivial_destructor(A))]; }
+ { int arr[F(__has_trivial_destructor(B<int>))]; }
}
void has_nothrow_assign() {
- int t01[T(__has_nothrow_assign(Int))];
- int t02[T(__has_nothrow_assign(IntAr))];
- int t03[T(__has_nothrow_assign(Union))];
- int t04[T(__has_nothrow_assign(UnionAr))];
- int t05[T(__has_nothrow_assign(POD))];
- int t06[T(__has_nothrow_assign(Derives))];
- int t07[F(__has_nothrow_assign(ConstIntAr))];
- int t08[F(__has_nothrow_assign(ConstIntArAr))];
- int t09[T(__has_nothrow_assign(HasDest))];
- int t10[T(__has_nothrow_assign(HasPriv))];
- int t11[T(__has_nothrow_assign(HasCons))];
- int t12[T(__has_nothrow_assign(HasRef))];
- int t13[T(__has_nothrow_assign(HasCopy))];
- int t14[F(__has_nothrow_assign(IntRef))];
- int t15[F(__has_nothrow_assign(HasCopyAssign))];
- int t16[F(__has_nothrow_assign(const Int))];
- int t17[F(__has_nothrow_assign(NonPODAr))];
- int t18[F(__has_nothrow_assign(VirtAr))];
- int t19[T(__has_nothrow_assign(HasNoThrowCopyAssign))];
- int t20[F(__has_nothrow_assign(HasMultipleCopyAssign))];
- int t21[T(__has_nothrow_assign(HasMultipleNoThrowCopyAssign))];
- int t22[F(__has_nothrow_assign(void))];
- int t23[F(__has_nothrow_assign(cvoid))];
- int t24[T(__has_nothrow_assign(HasVirtDest))];
+ { int arr[T(__has_nothrow_assign(Int))]; }
+ { int arr[T(__has_nothrow_assign(IntAr))]; }
+ { int arr[T(__has_nothrow_assign(Union))]; }
+ { int arr[T(__has_nothrow_assign(UnionAr))]; }
+ { int arr[T(__has_nothrow_assign(POD))]; }
+ { int arr[T(__has_nothrow_assign(Derives))]; }
+ { int arr[T(__has_nothrow_assign(HasDest))]; }
+ { int arr[T(__has_nothrow_assign(HasPriv))]; }
+ { int arr[T(__has_nothrow_assign(HasCons))]; }
+ { int arr[T(__has_nothrow_assign(HasRef))]; }
+ { int arr[T(__has_nothrow_assign(HasCopy))]; }
+ { int arr[T(__has_nothrow_assign(HasMove))]; }
+ { int arr[T(__has_nothrow_assign(HasMoveAssign))]; }
+ { int arr[T(__has_nothrow_assign(HasNoThrowCopyAssign))]; }
+ { int arr[T(__has_nothrow_assign(HasMultipleNoThrowCopyAssign))]; }
+ { int arr[T(__has_nothrow_assign(HasVirtDest))]; }
+
+ { int arr[F(__has_nothrow_assign(IntRef))]; }
+ { int arr[F(__has_nothrow_assign(HasCopyAssign))]; }
+ { int arr[F(__has_nothrow_assign(HasMultipleCopyAssign))]; }
+ { int arr[F(__has_nothrow_assign(const Int))]; }
+ { int arr[F(__has_nothrow_assign(ConstIntAr))]; }
+ { int arr[F(__has_nothrow_assign(ConstIntArAr))]; }
+ { int arr[F(__has_nothrow_assign(DerivesAr))]; }
+ { int arr[F(__has_nothrow_assign(VirtAr))]; }
+ { int arr[F(__has_nothrow_assign(void))]; }
+ { int arr[F(__has_nothrow_assign(cvoid))]; }
}
void has_nothrow_copy() {
- int t01[T(__has_nothrow_copy(Int))];
- int t02[T(__has_nothrow_copy(IntAr))];
- int t03[T(__has_nothrow_copy(Union))];
- int t04[T(__has_nothrow_copy(UnionAr))];
- int t05[T(__has_nothrow_copy(POD))];
- int t06[T(__has_nothrow_copy(Derives))];
- int t07[T(__has_nothrow_copy(ConstIntAr))];
- int t08[T(__has_nothrow_copy(ConstIntArAr))];
- int t09[T(__has_nothrow_copy(HasDest))];
- int t10[T(__has_nothrow_copy(HasPriv))];
- int t11[T(__has_nothrow_copy(HasCons))];
- int t12[T(__has_nothrow_copy(HasRef))];
- int t13[F(__has_nothrow_copy(HasCopy))];
- int t14[T(__has_nothrow_copy(IntRef))];
- int t15[T(__has_nothrow_copy(HasCopyAssign))];
- int t16[T(__has_nothrow_copy(const Int))];
- int t17[F(__has_nothrow_copy(NonPODAr))];
- int t18[F(__has_nothrow_copy(VirtAr))];
-
- int t19[T(__has_nothrow_copy(HasNoThrowCopy))];
- int t20[F(__has_nothrow_copy(HasMultipleCopy))];
- int t21[T(__has_nothrow_copy(HasMultipleNoThrowCopy))];
- int t22[F(__has_nothrow_copy(void))];
- int t23[F(__has_nothrow_copy(cvoid))];
- int t24[T(__has_nothrow_copy(HasVirtDest))];
- int t25[T(__has_nothrow_copy(HasTemplateCons))];
+ { int arr[T(__has_nothrow_copy(Int))]; }
+ { int arr[T(__has_nothrow_copy(IntAr))]; }
+ { int arr[T(__has_nothrow_copy(Union))]; }
+ { int arr[T(__has_nothrow_copy(UnionAr))]; }
+ { int arr[T(__has_nothrow_copy(POD))]; }
+ { int arr[T(__has_nothrow_copy(const Int))]; }
+ { int arr[T(__has_nothrow_copy(ConstIntAr))]; }
+ { int arr[T(__has_nothrow_copy(ConstIntArAr))]; }
+ { int arr[T(__has_nothrow_copy(Derives))]; }
+ { int arr[T(__has_nothrow_copy(IntRef))]; }
+ { int arr[T(__has_nothrow_copy(HasDest))]; }
+ { int arr[T(__has_nothrow_copy(HasPriv))]; }
+ { int arr[T(__has_nothrow_copy(HasCons))]; }
+ { int arr[T(__has_nothrow_copy(HasRef))]; }
+ { int arr[T(__has_nothrow_copy(HasMove))]; }
+ { int arr[T(__has_nothrow_copy(HasCopyAssign))]; }
+ { int arr[T(__has_nothrow_copy(HasMoveAssign))]; }
+ { int arr[T(__has_nothrow_copy(HasNoThrowCopy))]; }
+ { int arr[T(__has_nothrow_copy(HasMultipleNoThrowCopy))]; }
+ { int arr[T(__has_nothrow_copy(HasVirtDest))]; }
+ { int arr[T(__has_nothrow_copy(HasTemplateCons))]; }
+
+ { int arr[F(__has_nothrow_copy(HasCopy))]; }
+ { int arr[F(__has_nothrow_copy(HasMultipleCopy))]; }
+ { int arr[F(__has_nothrow_copy(DerivesAr))]; }
+ { int arr[F(__has_nothrow_copy(VirtAr))]; }
+ { int arr[F(__has_nothrow_copy(void))]; }
+ { int arr[F(__has_nothrow_copy(cvoid))]; }
}
void has_nothrow_constructor() {
- int t01[T(__has_nothrow_constructor(Int))];
- int t02[T(__has_nothrow_constructor(IntAr))];
- int t03[T(__has_nothrow_constructor(Union))];
- int t04[T(__has_nothrow_constructor(UnionAr))];
- int t05[T(__has_nothrow_constructor(POD))];
- int t06[T(__has_nothrow_constructor(Derives))];
- int t07[T(__has_nothrow_constructor(ConstIntAr))];
- int t08[T(__has_nothrow_constructor(ConstIntArAr))];
- int t09[T(__has_nothrow_constructor(HasDest))];
- int t10[T(__has_nothrow_constructor(HasPriv))];
- int t11[F(__has_nothrow_constructor(HasCons))];
- int t12[F(__has_nothrow_constructor(HasRef))];
- int t13[F(__has_nothrow_constructor(HasCopy))];
- int t14[F(__has_nothrow_constructor(IntRef))];
- int t15[T(__has_nothrow_constructor(HasCopyAssign))];
- int t16[T(__has_nothrow_constructor(const Int))];
- int t17[T(__has_nothrow_constructor(NonPODAr))];
- // int t18[T(__has_nothrow_constructor(VirtAr))]; // not implemented
-
- int t19[T(__has_nothrow_constructor(HasNoThrowConstructor))];
- int t20[F(__has_nothrow_constructor(HasNoThrowConstructorWithArgs))];
- int t21[F(__has_nothrow_constructor(void))];
- int t22[F(__has_nothrow_constructor(cvoid))];
- int t23[T(__has_nothrow_constructor(HasVirtDest))];
- int t24[F(__has_nothrow_constructor(HasTemplateCons))];
+ { int arr[T(__has_nothrow_constructor(Int))]; }
+ { int arr[T(__has_nothrow_constructor(IntAr))]; }
+ { int arr[T(__has_nothrow_constructor(Union))]; }
+ { int arr[T(__has_nothrow_constructor(UnionAr))]; }
+ { int arr[T(__has_nothrow_constructor(POD))]; }
+ { int arr[T(__has_nothrow_constructor(Derives))]; }
+ { int arr[T(__has_nothrow_constructor(DerivesAr))]; }
+ { int arr[T(__has_nothrow_constructor(ConstIntAr))]; }
+ { int arr[T(__has_nothrow_constructor(ConstIntArAr))]; }
+ { int arr[T(__has_nothrow_constructor(HasDest))]; }
+ { int arr[T(__has_nothrow_constructor(HasPriv))]; }
+ { int arr[T(__has_nothrow_constructor(HasCopyAssign))]; }
+ { int arr[T(__has_nothrow_constructor(const Int))]; }
+ { int arr[T(__has_nothrow_constructor(HasNoThrowConstructor))]; }
+ { int arr[T(__has_nothrow_constructor(HasVirtDest))]; }
+ // { int arr[T(__has_nothrow_constructor(VirtAr))]; } // not implemented
+
+ { int arr[F(__has_nothrow_constructor(HasCons))]; }
+ { int arr[F(__has_nothrow_constructor(HasRef))]; }
+ { int arr[F(__has_nothrow_constructor(HasCopy))]; }
+ { int arr[F(__has_nothrow_constructor(HasMove))]; }
+ { int arr[F(__has_nothrow_constructor(HasNoThrowConstructorWithArgs))]; }
+ { int arr[F(__has_nothrow_constructor(IntRef))]; }
+ { int arr[F(__has_nothrow_constructor(void))]; }
+ { int arr[F(__has_nothrow_constructor(cvoid))]; }
+ { int arr[F(__has_nothrow_constructor(HasTemplateCons))]; }
}
void has_virtual_destructor() {
- int t01[F(__has_virtual_destructor(Int))];
- int t02[F(__has_virtual_destructor(IntAr))];
- int t03[F(__has_virtual_destructor(Union))];
- int t04[F(__has_virtual_destructor(UnionAr))];
- int t05[F(__has_virtual_destructor(POD))];
- int t06[F(__has_virtual_destructor(Derives))];
- int t07[F(__has_virtual_destructor(ConstIntAr))];
- int t08[F(__has_virtual_destructor(ConstIntArAr))];
- int t09[F(__has_virtual_destructor(HasDest))];
- int t10[F(__has_virtual_destructor(HasPriv))];
- int t11[F(__has_virtual_destructor(HasCons))];
- int t12[F(__has_virtual_destructor(HasRef))];
- int t13[F(__has_virtual_destructor(HasCopy))];
- int t14[F(__has_virtual_destructor(IntRef))];
- int t15[F(__has_virtual_destructor(HasCopyAssign))];
- int t16[F(__has_virtual_destructor(const Int))];
- int t17[F(__has_virtual_destructor(NonPODAr))];
- int t18[F(__has_virtual_destructor(VirtAr))];
-
- int t19[T(__has_virtual_destructor(HasVirtDest))];
- int t20[T(__has_virtual_destructor(DerivedVirtDest))];
- int t21[F(__has_virtual_destructor(VirtDestAr))];
- int t22[F(__has_virtual_destructor(void))];
- int t23[F(__has_virtual_destructor(cvoid))];
+ { int arr[F(__has_virtual_destructor(Int))]; }
+ { int arr[F(__has_virtual_destructor(IntAr))]; }
+ { int arr[F(__has_virtual_destructor(Union))]; }
+ { int arr[F(__has_virtual_destructor(UnionAr))]; }
+ { int arr[F(__has_virtual_destructor(POD))]; }
+ { int arr[F(__has_virtual_destructor(Derives))]; }
+ { int arr[F(__has_virtual_destructor(DerivesAr))]; }
+ { int arr[F(__has_virtual_destructor(const Int))]; }
+ { int arr[F(__has_virtual_destructor(ConstIntAr))]; }
+ { int arr[F(__has_virtual_destructor(ConstIntArAr))]; }
+ { int arr[F(__has_virtual_destructor(HasDest))]; }
+ { int arr[F(__has_virtual_destructor(HasPriv))]; }
+ { int arr[F(__has_virtual_destructor(HasCons))]; }
+ { int arr[F(__has_virtual_destructor(HasRef))]; }
+ { int arr[F(__has_virtual_destructor(HasCopy))]; }
+ { int arr[F(__has_virtual_destructor(HasMove))]; }
+ { int arr[F(__has_virtual_destructor(HasCopyAssign))]; }
+ { int arr[F(__has_virtual_destructor(HasMoveAssign))]; }
+ { int arr[F(__has_virtual_destructor(IntRef))]; }
+ { int arr[F(__has_virtual_destructor(VirtAr))]; }
+
+ { int arr[T(__has_virtual_destructor(HasVirtDest))]; }
+ { int arr[T(__has_virtual_destructor(DerivedVirtDest))]; }
+ { int arr[F(__has_virtual_destructor(VirtDestAr))]; }
+ { int arr[F(__has_virtual_destructor(void))]; }
+ { int arr[F(__has_virtual_destructor(cvoid))]; }
}
@@ -474,29 +1296,29 @@ template <class T> class NonderivedTemp {};
template <class T> class UndefinedTemp; // expected-note {{declared here}}
void is_base_of() {
- int t01[T(__is_base_of(Base, Derived))];
- int t02[T(__is_base_of(const Base, Derived))];
- int t03[F(__is_base_of(Derived, Base))];
- int t04[F(__is_base_of(Derived, int))];
- int t05[T(__is_base_of(Base, Base))];
- int t06[T(__is_base_of(Base, Derived3))];
- int t07[T(__is_base_of(Derived, Derived3))];
- int t08[T(__is_base_of(Derived2b, Derived3))];
- int t09[T(__is_base_of(Derived2a, Derived3))];
- int t10[T(__is_base_of(BaseA<int>, DerivedB<int>))];
- int t11[F(__is_base_of(DerivedB<int>, BaseA<int>))];
- int t12[T(__is_base_of(Base, CrazyDerived<Base>))];
- int t13[F(__is_base_of(Union, Union))];
- int t14[T(__is_base_of(Empty, Empty))];
- int t15[T(__is_base_of(class_forward, class_forward))];
- int t16[F(__is_base_of(Empty, class_forward))]; // expected-error {{incomplete type 'class_forward' used in type trait expression}}
- int t17[F(__is_base_of(Base&, Derived&))];
+ { int arr[T(__is_base_of(Base, Derived))]; }
+ { int arr[T(__is_base_of(const Base, Derived))]; }
+ { int arr[F(__is_base_of(Derived, Base))]; }
+ { int arr[F(__is_base_of(Derived, int))]; }
+ { int arr[T(__is_base_of(Base, Base))]; }
+ { int arr[T(__is_base_of(Base, Derived3))]; }
+ { int arr[T(__is_base_of(Derived, Derived3))]; }
+ { int arr[T(__is_base_of(Derived2b, Derived3))]; }
+ { int arr[T(__is_base_of(Derived2a, Derived3))]; }
+ { int arr[T(__is_base_of(BaseA<int>, DerivedB<int>))]; }
+ { int arr[F(__is_base_of(DerivedB<int>, BaseA<int>))]; }
+ { int arr[T(__is_base_of(Base, CrazyDerived<Base>))]; }
+ { int arr[F(__is_base_of(Union, Union))]; }
+ { int arr[T(__is_base_of(Empty, Empty))]; }
+ { int arr[T(__is_base_of(class_forward, class_forward))]; }
+ { int arr[F(__is_base_of(Empty, class_forward))]; } // expected-error {{incomplete type 'class_forward' used in type trait expression}}
+ { int arr[F(__is_base_of(Base&, Derived&))]; }
int t18[F(__is_base_of(Base[10], Derived[10]))];
- int t19[F(__is_base_of(int, int))];
- int t20[F(__is_base_of(long, int))];
- int t21[T(__is_base_of(Base, DerivedTemp<int>))];
- int t22[F(__is_base_of(Base, NonderivedTemp<int>))];
- int t23[F(__is_base_of(Base, UndefinedTemp<int>))]; // expected-error {{implicit instantiation of undefined template 'UndefinedTemp<int>'}}
+ { int arr[F(__is_base_of(int, int))]; }
+ { int arr[F(__is_base_of(long, int))]; }
+ { int arr[T(__is_base_of(Base, DerivedTemp<int>))]; }
+ { int arr[F(__is_base_of(Base, NonderivedTemp<int>))]; }
+ { int arr[F(__is_base_of(Base, UndefinedTemp<int>))]; } // expected-error {{implicit instantiation of undefined template 'UndefinedTemp<int>'}}
isBaseOfT<Base, Derived>();
isBaseOfF<Derived, Base>();
@@ -508,6 +1330,64 @@ void is_base_of() {
isBaseOfF<DerivedB<int>, BaseA<int> >();
}
+#if 0
+template<class T, class U>
+class TemplateClass {};
+
+template<class T>
+using TemplateAlias = TemplateClass<T, int>;
+#endif
+
+typedef class Base BaseTypedef;
+
+void is_same()
+{
+ int t01[T(__is_same(Base, Base))];
+ int t02[T(__is_same(Base, BaseTypedef))];
+#if 0
+ int t03[T(__is_same(TemplateClass<int, int>, TemplateAlias<int>))];
+#endif
+
+ int t10[F(__is_same(Base, const Base))];
+ int t11[F(__is_same(Base, Base&))];
+ int t12[F(__is_same(Base, Derived))];
+}
+
+struct IntWrapper
+{
+ int value;
+ IntWrapper(int _value) : value(_value) {}
+ operator int() const {
+ return value;
+ }
+};
+
+struct FloatWrapper
+{
+ float value;
+ FloatWrapper(float _value) : value(_value) {}
+ FloatWrapper(const IntWrapper& obj)
+ : value(static_cast<float>(obj.value)) {}
+ operator float() const {
+ return value;
+ }
+ operator IntWrapper() const {
+ return IntWrapper(static_cast<int>(value));
+ }
+};
+
+void is_convertible()
+{
+ int t01[T(__is_convertible(IntWrapper, IntWrapper))];
+ int t02[T(__is_convertible(IntWrapper, const IntWrapper))];
+ int t03[T(__is_convertible(IntWrapper, int))];
+ int t04[T(__is_convertible(int, IntWrapper))];
+ int t05[T(__is_convertible(IntWrapper, FloatWrapper))];
+ int t06[T(__is_convertible(FloatWrapper, IntWrapper))];
+ int t07[T(__is_convertible(FloatWrapper, float))];
+ int t08[T(__is_convertible(float, FloatWrapper))];
+}
+
struct FromInt { FromInt(int); };
struct ToInt { operator int(); };
typedef void Function();
@@ -524,27 +1404,83 @@ struct X0 {
};
void is_convertible_to() {
- int t01[T(__is_convertible_to(Int, Int))];
- int t02[F(__is_convertible_to(Int, IntAr))];
- int t03[F(__is_convertible_to(IntAr, IntAr))];
- int t04[T(__is_convertible_to(void, void))];
- int t05[T(__is_convertible_to(cvoid, void))];
- int t06[T(__is_convertible_to(void, cvoid))];
- int t07[T(__is_convertible_to(cvoid, cvoid))];
- int t08[T(__is_convertible_to(int, FromInt))];
- int t09[T(__is_convertible_to(long, FromInt))];
- int t10[T(__is_convertible_to(double, FromInt))];
- int t11[T(__is_convertible_to(const int, FromInt))];
- int t12[T(__is_convertible_to(const int&, FromInt))];
- int t13[T(__is_convertible_to(ToInt, int))];
- int t14[T(__is_convertible_to(ToInt, const int&))];
- int t15[T(__is_convertible_to(ToInt, long))];
- int t16[F(__is_convertible_to(ToInt, int&))];
- int t17[F(__is_convertible_to(ToInt, FromInt))];
- int t18[T(__is_convertible_to(IntAr&, IntAr&))];
- int t19[T(__is_convertible_to(IntAr&, const IntAr&))];
- int t20[F(__is_convertible_to(const IntAr&, IntAr&))];
- int t21[F(__is_convertible_to(Function, Function))];
- int t22[F(__is_convertible_to(PrivateCopy, PrivateCopy))];
- int t23[T(__is_convertible_to(X0<int>, X0<float>))];
+ { int arr[T(__is_convertible_to(Int, Int))]; }
+ { int arr[F(__is_convertible_to(Int, IntAr))]; }
+ { int arr[F(__is_convertible_to(IntAr, IntAr))]; }
+ { int arr[T(__is_convertible_to(void, void))]; }
+ { int arr[T(__is_convertible_to(cvoid, void))]; }
+ { int arr[T(__is_convertible_to(void, cvoid))]; }
+ { int arr[T(__is_convertible_to(cvoid, cvoid))]; }
+ { int arr[T(__is_convertible_to(int, FromInt))]; }
+ { int arr[T(__is_convertible_to(long, FromInt))]; }
+ { int arr[T(__is_convertible_to(double, FromInt))]; }
+ { int arr[T(__is_convertible_to(const int, FromInt))]; }
+ { int arr[T(__is_convertible_to(const int&, FromInt))]; }
+ { int arr[T(__is_convertible_to(ToInt, int))]; }
+ { int arr[T(__is_convertible_to(ToInt, const int&))]; }
+ { int arr[T(__is_convertible_to(ToInt, long))]; }
+ { int arr[F(__is_convertible_to(ToInt, int&))]; }
+ { int arr[F(__is_convertible_to(ToInt, FromInt))]; }
+ { int arr[T(__is_convertible_to(IntAr&, IntAr&))]; }
+ { int arr[T(__is_convertible_to(IntAr&, const IntAr&))]; }
+ { int arr[F(__is_convertible_to(const IntAr&, IntAr&))]; }
+ { int arr[F(__is_convertible_to(Function, Function))]; }
+ { int arr[F(__is_convertible_to(PrivateCopy, PrivateCopy))]; }
+ { int arr[T(__is_convertible_to(X0<int>, X0<float>))]; }
+}
+
+void is_trivial()
+{
+ { int arr[T(__is_trivial(int))]; }
+ { int arr[T(__is_trivial(Enum))]; }
+ { int arr[T(__is_trivial(POD))]; }
+ { int arr[T(__is_trivial(Int))]; }
+ { int arr[T(__is_trivial(IntAr))]; }
+ { int arr[T(__is_trivial(IntArNB))]; }
+ { int arr[T(__is_trivial(Statics))]; }
+ { int arr[T(__is_trivial(Empty))]; }
+ { int arr[T(__is_trivial(EmptyUnion))]; }
+ { int arr[T(__is_trivial(Union))]; }
+ { int arr[T(__is_trivial(Derives))]; }
+ { int arr[T(__is_trivial(DerivesAr))]; }
+ { int arr[T(__is_trivial(DerivesArNB))]; }
+ { int arr[T(__is_trivial(DerivesEmpty))]; }
+ { int arr[T(__is_trivial(HasFunc))]; }
+ { int arr[T(__is_trivial(HasOp))]; }
+ { int arr[T(__is_trivial(HasConv))]; }
+ { int arr[T(__is_trivial(HasAssign))]; }
+ { int arr[T(__is_trivial(HasAnonymousUnion))]; }
+ { int arr[T(__is_trivial(HasPriv))]; }
+ { int arr[T(__is_trivial(HasProt))]; }
+ { int arr[T(__is_trivial(DerivesHasPriv))]; }
+ { int arr[T(__is_trivial(DerivesHasProt))]; }
+ { int arr[T(__is_trivial(Vector))]; }
+ { int arr[T(__is_trivial(VectorExt))]; }
+
+ { int arr[F(__is_trivial(HasCons))]; }
+ { int arr[F(__is_trivial(HasCopyAssign))]; }
+ { int arr[F(__is_trivial(HasMoveAssign))]; }
+ { int arr[F(__is_trivial(HasDest))]; }
+ { int arr[F(__is_trivial(HasRef))]; }
+ { int arr[F(__is_trivial(HasNonPOD))]; }
+ { int arr[F(__is_trivial(HasVirt))]; }
+ { int arr[F(__is_trivial(DerivesHasCons))]; }
+ { int arr[F(__is_trivial(DerivesHasCopyAssign))]; }
+ { int arr[F(__is_trivial(DerivesHasMoveAssign))]; }
+ { int arr[F(__is_trivial(DerivesHasDest))]; }
+ { int arr[F(__is_trivial(DerivesHasRef))]; }
+ { int arr[F(__is_trivial(DerivesHasVirt))]; }
+ { int arr[F(__is_trivial(void))]; }
+ { int arr[F(__is_trivial(cvoid))]; }
+}
+
+void array_rank() {
+ int t01[T(__array_rank(IntAr) == 1)];
+ int t02[T(__array_rank(ConstIntArAr) == 2)];
+}
+
+void array_extent() {
+ int t01[T(__array_extent(IntAr, 0) == 10)];
+ int t02[T(__array_extent(ConstIntArAr, 0) == 4)];
+ int t03[T(__array_extent(ConstIntArAr, 1) == 10)];
}
diff --git a/test/SemaCXX/uninit-variables-conditional.cpp b/test/SemaCXX/uninit-variables-conditional.cpp
new file mode 100644
index 000000000000..3324215621bf
--- /dev/null
+++ b/test/SemaCXX/uninit-variables-conditional.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -Wconditional-uninitialized -fsyntax-only %s -verify
+
+class Foo {
+public:
+ Foo();
+ ~Foo();
+ operator bool();
+};
+
+int bar();
+int baz();
+int init(double *);
+
+// This case flags a false positive under -Wconditional-uninitialized because
+// the destructor in Foo fouls about the minor bit of path-sensitivity in
+// -Wuninitialized.
+double test() {
+ double x; // expected-note {{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
+ if (bar() || baz() || Foo() || init(&x))
+ return 1.0;
+
+ return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
+}
diff --git a/test/SemaCXX/uninit-variables.cpp b/test/SemaCXX/uninit-variables.cpp
index 2bc7fb32547b..a0180e3d3a15 100644
--- a/test/SemaCXX/uninit-variables.cpp
+++ b/test/SemaCXX/uninit-variables.cpp
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fcxx-exceptions %s -verify
+
+// Stub out types for 'typeid' to work.
+namespace std { class type_info {}; }
int test1_aux(int &x);
int test1() {
@@ -13,6 +16,20 @@ int test2_aux() {
return x; // no-warning
}
+// Don't warn on unevaluated contexts.
+void unevaluated_tests() {
+ int x;
+ (void)sizeof(x);
+ (void)typeid(x);
+}
+
+// Warn for glvalue arguments to typeid whose type is polymorphic.
+struct A { virtual ~A() {} };
+void polymorphic_test() {
+ A *a; // expected-note{{declared here}} expected-note{{add initialization}}
+ (void)typeid(*a); // expected-warning{{variable 'a' is uninitialized when used here }}
+}
+
// Handle cases where the CFG may constant fold some branches, thus
// mitigating the need for some path-sensitivity in the analysis.
unsigned test3_aux();
@@ -38,7 +55,7 @@ unsigned test3_c() {
if (flag && (x = test3_aux()) == 0) {
x = 1;
}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
enum test4_A {
@@ -46,6 +63,49 @@ enum test4_A {
};
test4_A test4() {
test4_A a; // expected-note{{variable 'a' is declared here}}
- return a; // expected-warning{{variable 'a' is possibly uninitialized when used here}}
+ return a; // expected-warning{{variable 'a' is uninitialized when used here}}
}
+// This test previously crashed Sema.
+class Rdar9188004A {
+public:
+ virtual ~Rdar9188004A();
+};
+
+template< typename T > class Rdar9188004B : public Rdar9188004A {
+virtual double *foo(Rdar9188004B *next) const {
+ double *values = next->foo(0);
+ try {
+ }
+ catch(double e) {
+ values[0] = e;
+ }
+ return 0;
+ }
+};
+class Rdar9188004C : public Rdar9188004B<Rdar9188004A> {
+ virtual void bar(void) const;
+};
+void Rdar9188004C::bar(void) const {}
+
+// Don't warn about uninitialized variables in unreachable code.
+void PR9625() {
+ if (false) {
+ int x;
+ (void)static_cast<float>(x); // no-warning
+ }
+}
+
+// Don't warn about variables declared in "catch"
+void RDar9251392_bar(const char *msg);
+
+void RDar9251392() {
+ try {
+ throw "hi";
+ }
+ catch (const char* msg) {
+ RDar9251392_bar(msg); // no-warning
+ }
+}
+
+
diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp
index 26202fbccc81..0a3b5d938dd3 100644
--- a/test/SemaCXX/uninitialized.cpp
+++ b/test/SemaCXX/uninitialized.cpp
@@ -1,14 +1,45 @@
// RUN: %clang_cc1 -fsyntax-only -Wall -Wuninitialized -verify %s
-// Previously this triggered a warning on the sizeof(fieldB), indicating
-// a use of an uninitialized value.
-class Rdar8610363_A {
- int fieldA;
-public:
- Rdar8610363_A(int a);
-};
-class Rdar8610363_B {
- Rdar8610363_A fieldB;
-public:
- Rdar8610363_B(int b) : fieldB(sizeof(fieldB)) {} // no-warning
+int foo(int x);
+int bar(int* x);
+int boo(int& x);
+int far(const int& x);
+
+// Test self-references within initializers which are guaranteed to be
+// uninitialized.
+int a = a; // no-warning: used to signal intended lack of initialization.
+int b = b + 1; // expected-warning {{variable 'b' is uninitialized when used within its own initialization}}
+int c = (c + c); // expected-warning 2 {{variable 'c' is uninitialized when used within its own initialization}}
+void test() {
+ int d = ({ d + d ;}); // expected-warning {{variable 'd' is uninitialized when used within its own initialization}}
+}
+int e = static_cast<long>(e) + 1; // expected-warning {{variable 'e' is uninitialized when used within its own initialization}}
+int f = foo(f); // expected-warning {{variable 'f' is uninitialized when used within its own initialization}}
+
+// Thes don't warn as they don't require the value.
+int g = sizeof(g);
+void* ptr = &ptr;
+int h = bar(&h);
+int i = boo(i);
+int j = far(j);
+int k = __alignof__(k);
+
+// Also test similar constructs in a field's initializer.
+struct S {
+ int x;
+ void *ptr;
+
+ S(bool (*)[1]) : x(x) {} // expected-warning {{field is uninitialized when used here}}
+ S(bool (*)[2]) : x(x + 1) {} // expected-warning {{field is uninitialized when used here}}
+ S(bool (*)[3]) : x(x + x) {} // expected-warning {{field is uninitialized when used here}}
+ S(bool (*)[4]) : x(static_cast<long>(x) + 1) {} // expected-warning {{field is uninitialized when used here}}
+ S(bool (*)[5]) : x(foo(x)) {} // FIXME: This should warn!
+
+ // These don't actually require the value of x and so shouldn't warn.
+ S(char (*)[1]) : x(sizeof(x)) {} // rdar://8610363
+ S(char (*)[2]) : ptr(&ptr) {}
+ S(char (*)[3]) : x(__alignof__(x)) {}
+ S(char (*)[4]) : x(bar(&x)) {}
+ S(char (*)[5]) : x(boo(x)) {}
+ S(char (*)[6]) : x(far(x)) {}
};
diff --git a/test/SemaCXX/unknown-anytype.cpp b/test/SemaCXX/unknown-anytype.cpp
new file mode 100644
index 000000000000..b0a2981f470d
--- /dev/null
+++ b/test/SemaCXX/unknown-anytype.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -funknown-anytype -fsyntax-only -verify %s
+
+namespace test0 {
+ extern __unknown_anytype test0;
+ extern __unknown_anytype test1();
+ extern __unknown_anytype test2(int);
+}
+
+namespace test1 {
+ extern __unknown_anytype foo;
+ int test() {
+ // TODO: it would be great if the 'cannot initialize' errors
+ // turned into something more interesting. It's just a matter of
+ // making sure that these locations check for placeholder types
+ // properly.
+
+ int x = foo; // expected-error {{cannot initialize}}
+ int y = 0 + foo; // expected-error {{'foo' has unknown type}}
+ return foo; // expected-error {{cannot initialize}}
+ }
+}
+
+namespace test2 {
+ extern __unknown_anytype foo();
+ void test() {
+ foo(); // expected-error {{'foo' has unknown return type}}
+ }
+}
+
+namespace test3 {
+ extern __unknown_anytype foo;
+ void test() {
+ foo(); // expected-error {{call to unsupported expression with unknown type}}
+ ((void(void)) foo)(); // expected-error {{variable 'foo' with unknown type cannot be given a function type}}
+ }
+}
diff --git a/test/SemaCXX/unreachable-catch-clauses.cpp b/test/SemaCXX/unreachable-catch-clauses.cpp
index e8158d449555..c75067f393ef 100644
--- a/test/SemaCXX/unreachable-catch-clauses.cpp
+++ b/test/SemaCXX/unreachable-catch-clauses.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
class BaseEx {};
class Ex1: public BaseEx {};
diff --git a/test/SemaCXX/unreachable-code.cpp b/test/SemaCXX/unreachable-code.cpp
index 03d44ab8ce47..743290e1b9e5 100644
--- a/test/SemaCXX/unreachable-code.cpp
+++ b/test/SemaCXX/unreachable-code.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -Wunreachable-code -fblocks -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -Wunreachable-code -fblocks -verify %s
int j;
void bar() { }
diff --git a/test/SemaCXX/unused-functions.cpp b/test/SemaCXX/unused-functions.cpp
index cefa9e118a48..f164bf276846 100644
--- a/test/SemaCXX/unused-functions.cpp
+++ b/test/SemaCXX/unused-functions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused -verify %s
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -Wunused -verify %s
static int foo(int x) { return x; }
@@ -6,3 +6,5 @@ template<typename T>
T get_from_foo(T y) { return foo(y); }
int g(int z) { return get_from_foo(z); }
+
+namespace { void f() = delete; }
diff --git a/test/SemaCXX/vtable-instantiation.cc b/test/SemaCXX/vtable-instantiation.cc
index 5a13d9505b3d..49949a773675 100644
--- a/test/SemaCXX/vtable-instantiation.cc
+++ b/test/SemaCXX/vtable-instantiation.cc
@@ -18,3 +18,29 @@ void f() {
c2.c2(); // expected-note {{in instantiation of member function}}
}
+namespace PR9325 {
+ template<typename T>
+ class Target
+ {
+ public:
+ virtual T Value() const
+ {
+ return 1; // expected-error{{cannot initialize return object of type 'int *' with an rvalue of type 'int'}}
+ }
+ };
+
+ template<typename T>
+ struct Provider
+ {
+ static Target<T> Instance;
+ };
+
+ template<typename T>
+ Target<T> Provider<T>::Instance; // expected-note{{in instantiation of}}
+
+ void f()
+ {
+ Target<int*>* traits = &Provider<int*>::Instance;
+ }
+
+}
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp
index 27eedb9128d7..c0ef35b252d8 100644
--- a/test/SemaCXX/warn-assignment-condition.cpp
+++ b/test/SemaCXX/warn-assignment-condition.cpp
@@ -125,3 +125,16 @@ void test2() {
if ((test2 == fn)) {}
}
+namespace rdar9027658 {
+template <typename T>
+void f() {
+ if ((T::g == 3)) { } // expected-warning {{equality comparison with extraneous parentheses}} \
+ // expected-note {{use '=' to turn this equality comparison into an assignment}} \
+ // expected-note {{remove extraneous parentheses around the comparison to silence this warning}}
+}
+
+struct S { int g; };
+void test() {
+ f<S>(); // expected-note {{in instantiation}}
+}
+}
diff --git a/test/SemaCXX/warn-bool-conversion.cpp b/test/SemaCXX/warn-bool-conversion.cpp
new file mode 100644
index 000000000000..f6fa9f28369d
--- /dev/null
+++ b/test/SemaCXX/warn-bool-conversion.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int* j = false; // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}}
+
+void foo(int* i, int *j=(false)) // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}}
+{
+ foo(false); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}}
+ foo((int*)false); // no-warning: explicit cast
+ foo(0); // no-warning: not a bool, even though its convertible to bool
+
+ foo(false == true); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}}
+ foo((42 + 24) < 32); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}}
+
+ const bool kFlag = false;
+ foo(kFlag); // expected-warning{{ initialization of pointer of type 'int *' to NULL from a constant boolean expression}}
+}
+
+char f(struct Undefined*);
+double f(...);
+
+// Ensure that when using false in metaprogramming machinery its conversion
+// isn't flagged.
+template <int N> struct S {};
+S<sizeof(f(false))> s;
diff --git a/test/SemaCXX/warn-deprecated-header.cpp b/test/SemaCXX/warn-deprecated-header.cpp
new file mode 100644
index 000000000000..f6ac2cb6393a
--- /dev/null
+++ b/test/SemaCXX/warn-deprecated-header.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -fdeprecated-macro -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Werror %s
+
+#ifdef __DEPRECATED
+#warning This file is deprecated. // expected-warning {{This file is deprecated.}}
+#endif
diff --git a/test/SemaCXX/warn-exit-time-destructors.cpp b/test/SemaCXX/warn-exit-time-destructors.cpp
new file mode 100644
index 000000000000..f49134b71c97
--- /dev/null
+++ b/test/SemaCXX/warn-exit-time-destructors.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -Wexit-time-destructors %s -verify
+
+namespace test1 {
+ struct A { ~A(); };
+ A a; // expected-warning {{declaration requires an exit-time destructor}}
+ A b[10]; // expected-warning {{declaration requires an exit-time destructor}}
+ A c[10][10]; // expected-warning {{declaration requires an exit-time destructor}}
+
+ A &d = a;
+ A &e = b[5];
+ A &f = c[5][7];
+}
+
+namespace test2 {
+void f() {
+ struct A { ~A() { } };
+
+ static A a; // expected-warning {{declaration requires an exit-time destructor}}
+ static A b[10]; // expected-warning {{declaration requires an exit-time destructor}}
+ static A c[10][10]; // expected-warning {{declaration requires an exit-time destructor}}
+
+ static A &d = a;
+ static A &e = b[5];
+ static A &f = c[5][7];
+}
+
+}
diff --git a/test/SemaCXX/warn-global-constructors.cpp b/test/SemaCXX/warn-global-constructors.cpp
index ad609545ece1..6330958df703 100644
--- a/test/SemaCXX/warn-global-constructors.cpp
+++ b/test/SemaCXX/warn-global-constructors.cpp
@@ -53,8 +53,8 @@ namespace test3 {
namespace test4 {
char a[] = "hello";
- char b[5] = "hello";
- char c[][5] = { "hello" };
+ char b[6] = "hello";
+ char c[][6] = { "hello" };
}
namespace test5 {
diff --git a/test/SemaCXX/warn-literal-conversion.cpp b/test/SemaCXX/warn-literal-conversion.cpp
index dab5c01bf6b0..b9c952873b9f 100644
--- a/test/SemaCXX/warn-literal-conversion.cpp
+++ b/test/SemaCXX/warn-literal-conversion.cpp
@@ -8,13 +8,18 @@ void test0() {
int y0 = 1.2222F; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
int y1 = (1.2222F); // expected-warning {{implicit conversion turns literal floating-point number into integer}}
int y2 = (((1.2222F))); // expected-warning {{implicit conversion turns literal floating-point number into integer}}
- int y3 = 12E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
- int y4 = 1.2E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
+ int y3 = 12E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
+ int y4 = 1.2E1F; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
// Double
int y5 = 1.2222; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
- int y6 = 12E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
- int y7 = 1.2E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
- int y8 = (1.2E1); // expected-warning {{implicit conversion turns literal floating-point number into integer}}
+ int y6 = 12E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
+ int y7 = 1.2E1; // expected-warning {{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
+ int y8 = (1.2E1); // expected-warning {{implicit conversion turns literal floating-point number into integer}} \
+ // expected-note {{this can be rewritten as an integer literal with the exact same value}}
// Test assignment to an existing variable.
y8 = 2.22F; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
diff --git a/test/SemaCXX/warn-missing-prototypes.cpp b/test/SemaCXX/warn-missing-prototypes.cpp
index b6ebe820f39c..f7e8db38a4f6 100644
--- a/test/SemaCXX/warn-missing-prototypes.cpp
+++ b/test/SemaCXX/warn-missing-prototypes.cpp
@@ -24,3 +24,9 @@ template<typename> void h() { }
// Don't warn when instantiating function templates.
template void h<int>();
+
+// PR9519: don't warn about friend functions.
+class I {
+ friend void I_friend() {}
+};
+
diff --git a/test/SemaCXX/warn-non-pod-memset.cpp b/test/SemaCXX/warn-non-pod-memset.cpp
new file mode 100644
index 000000000000..fbdceadae29b
--- /dev/null
+++ b/test/SemaCXX/warn-non-pod-memset.cpp
@@ -0,0 +1,63 @@
+// RUN: %clang_cc1 -fsyntax-only -Wnon-pod-memset -verify %s
+
+extern void *memset(void *, int, unsigned);
+
+// Several POD types that should not warn.
+struct S1 {} s1;
+struct S2 { int x; } s2;
+struct S3 { float x, y; S1 s[4]; void (*f)(S1**); } s3;
+
+// We use the C++11 concept of POD for this warning, so ensure a non-aggregate
+// still warns.
+class C1 {
+ int x, y, z;
+public:
+ void foo() {}
+} c1;
+
+// Non-POD types that should warn.
+struct X1 { X1(); } x1;
+struct X2 { ~X2(); } x2;
+struct X3 { virtual void f(); } x3;
+struct X4 : X2 {} x4;
+struct X5 : virtual S1 {} x5;
+
+void test_warn() {
+ memset(&x1, 0, sizeof x1); // \
+ // expected-warning {{destination for this memset call is a pointer to a non-POD type}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ memset(&x2, 0, sizeof x2); // \
+ // expected-warning {{destination for this memset call is a pointer to a non-POD type}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ memset(&x3, 0, sizeof x3); // \
+ // expected-warning {{destination for this memset call is a pointer to a non-POD type}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ memset(&x4, 0, sizeof x4); // \
+ // expected-warning {{destination for this memset call is a pointer to a non-POD type}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+ memset(&x5, 0, sizeof x5); // \
+ // expected-warning {{destination for this memset call is a pointer to a non-POD type}} \
+ // expected-note {{explicitly cast the pointer to silence this warning}}
+}
+
+void test_nowarn(void *void_ptr) {
+ int i, *iptr;
+ float y;
+ char c;
+
+ memset(&i, 0, sizeof i);
+ memset(&iptr, 0, sizeof iptr);
+ memset(&y, 0, sizeof y);
+ memset(&c, 0, sizeof c);
+ memset(void_ptr, 0, 42);
+ memset(&s1, 0, sizeof s1);
+ memset(&s2, 0, sizeof s2);
+ memset(&s3, 0, sizeof s3);
+ memset(&c1, 0, sizeof c1);
+
+ // Unevaluated code shouldn't warn.
+ (void)sizeof memset(&x1, 0, sizeof x1);
+
+ // Dead code shouldn't warn.
+ if (false) memset(&x1, 0, sizeof x1);
+}
diff --git a/test/SemaCXX/warn-overloaded-virtual.cpp b/test/SemaCXX/warn-overloaded-virtual.cpp
index 86b1d2365f93..8e2b671bf493 100644
--- a/test/SemaCXX/warn-overloaded-virtual.cpp
+++ b/test/SemaCXX/warn-overloaded-virtual.cpp
@@ -52,3 +52,15 @@ struct Derived : public Base {
void foo(int, int);
};
}
+
+namespace PR9396 {
+class A {
+public:
+ virtual void f(int) {}
+};
+
+class B : public A {
+public:
+ static void f() {}
+};
+}
diff --git a/test/SemaCXX/warn-shadow.cpp b/test/SemaCXX/warn-shadow.cpp
index 3bf9af414db0..68e9467a937b 100644
--- a/test/SemaCXX/warn-shadow.cpp
+++ b/test/SemaCXX/warn-shadow.cpp
@@ -70,3 +70,14 @@ struct S {
}
};
}
+
+extern int bob; // expected-note {{previous declaration is here}}
+
+// rdar://8883302
+void rdar8883302() {
+ extern int bob; // don't warn for shadowing.
+}
+
+void test8() {
+ int bob; // expected-warning {{declaration shadows a variable in the global namespace}}
+}
diff --git a/test/SemaCXX/warn-unreachable.cpp b/test/SemaCXX/warn-unreachable.cpp
index 3c8a429b3e58..ea6755f2d6ce 100644
--- a/test/SemaCXX/warn-unreachable.cpp
+++ b/test/SemaCXX/warn-unreachable.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fexceptions -fsyntax-only -verify -fblocks -Wunreachable-code -Wno-unused-value
+// RUN: %clang_cc1 %s -fcxx-exceptions -fexceptions -fsyntax-only -verify -fblocks -Wunreachable-code -Wno-unused-value
int &halt() __attribute__((noreturn));
int &live();
diff --git a/test/SemaCXX/warn-unused-filescoped.cpp b/test/SemaCXX/warn-unused-filescoped.cpp
index c32acb0b48be..dbff4b0e68c1 100644
--- a/test/SemaCXX/warn-unused-filescoped.cpp
+++ b/test/SemaCXX/warn-unused-filescoped.cpp
@@ -78,3 +78,12 @@ namespace test4 {
void test(A a); // expected-warning {{unused function}}
extern "C" void test4(A a);
}
+
+namespace rdar8733476 {
+ static void foo() { } // expected-warning {{not needed and will not be emitted}}
+
+ template <int>
+ void bar() {
+ foo();
+ }
+}
diff --git a/test/SemaCXX/warn-using-namespace-in-header.cpp b/test/SemaCXX/warn-using-namespace-in-header.cpp
new file mode 100644
index 000000000000..72c25529b40f
--- /dev/null
+++ b/test/SemaCXX/warn-using-namespace-in-header.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsyntax-only -Wheader-hygiene -verify %s
+
+#include "warn-using-namespace-in-header.h"
+
+namespace dont_warn {}
+using namespace dont_warn;
+
+// Warning is actually in the header but only the cpp file gets scanned.
+// expected-warning {{using namespace directive in global context in header}}
+
+
+
+
+
+
+
+
+
+// Warn inside linkage specs too.
+// expected-warning {{using namespace directive in global context in header}}
+
+
+
+
+
+
+// expected-warning {{using namespace directive in global context in header}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// expected-warning {{using namespace directive in global context in header}}
+
+// |using namespace| through a macro shouldn't warn if the instantiation is in a
+// cc file.
+USING_MACRO
diff --git a/test/SemaCXX/warn-using-namespace-in-header.h b/test/SemaCXX/warn-using-namespace-in-header.h
new file mode 100644
index 000000000000..b544c548ae9b
--- /dev/null
+++ b/test/SemaCXX/warn-using-namespace-in-header.h
@@ -0,0 +1,50 @@
+
+
+
+
+
+// Lots of vertical space to make the error line match up with the line of the
+// expected line in the source file.
+namespace warn_in_header_in_global_context {}
+using namespace warn_in_header_in_global_context;
+
+// While we want to error on the previous using directive, we don't when we are
+// inside a namespace
+namespace dont_warn_here {
+using namespace warn_in_header_in_global_context;
+}
+
+// We should warn in toplevel extern contexts.
+namespace warn_inside_linkage {}
+extern "C++" {
+using namespace warn_inside_linkage;
+}
+
+// This is really silly, but we should warn on it:
+extern "C++" {
+extern "C" {
+extern "C++" {
+using namespace warn_inside_linkage;
+}
+}
+}
+
+// But we shouldn't warn in extern contexts inside namespaces.
+namespace dont_warn_here {
+extern "C++" {
+using namespace warn_in_header_in_global_context;
+}
+}
+
+// We also shouldn't warn in case of functions.
+inline void foo() {
+ using namespace warn_in_header_in_global_context;
+}
+
+
+namespace macronamespace {}
+#define USING_MACRO using namespace macronamespace;
+
+// |using namespace| through a macro should warn if the instantiation is in a
+// header.
+USING_MACRO
diff --git a/test/SemaCXX/warn_false_to_pointer.cpp b/test/SemaCXX/warn_false_to_pointer.cpp
deleted file mode 100644
index fb6f9551a7ac..000000000000
--- a/test/SemaCXX/warn_false_to_pointer.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-int* j = false; // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
-
-void foo(int* i, int *j=(false)) // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
-{
- foo(false); // expected-warning{{ initialization of pointer of type 'int *' from literal 'false'}}
- foo((int*)false);
-}
-
diff --git a/test/SemaCXX/writable-strings-deprecated.cpp b/test/SemaCXX/writable-strings-deprecated.cpp
index c89c88256426..829540149563 100644
--- a/test/SemaCXX/writable-strings-deprecated.cpp
+++ b/test/SemaCXX/writable-strings-deprecated.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-write-strings -verify %s
// rdar://8827606
char *fun(void)
diff --git a/test/SemaObjC/assign-rvalue-message.m b/test/SemaObjC/assign-rvalue-message.m
new file mode 100644
index 000000000000..7e05c89afa43
--- /dev/null
+++ b/test/SemaObjC/assign-rvalue-message.m
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s
+// rdar://9005189
+
+@interface Foo
+@end
+
+struct Bar {
+ int x;
+};
+
+@implementation Foo {
+ struct Bar bar;
+}
+
+- (const struct Bar)bar {
+ return bar;
+}
+
+- (void)baz {
+ bar.x = 0;
+ [self bar].x = 10; // expected-error {{assigning to 'readonly' return result of an objective-c message not allowed}}
+}
+@end
diff --git a/test/SemaObjC/attr-objc-gc.m b/test/SemaObjC/attr-objc-gc.m
index 47da653afe6e..9ca12c9315a1 100644
--- a/test/SemaObjC/attr-objc-gc.m
+++ b/test/SemaObjC/attr-objc-gc.m
@@ -1,8 +1,30 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify %s
static id __attribute((objc_gc(weak))) a;
static id __attribute((objc_gc(strong))) b;
static id __attribute((objc_gc())) c; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
static id __attribute((objc_gc(123))) d; // expected-error{{'objc_gc' attribute requires parameter 1 to be a string}}
-static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute requires 1 argument(s)}}
+static id __attribute((objc_gc(foo, 456))) e; // expected-error{{attribute takes one argument}}
static id __attribute((objc_gc(hello))) f; // expected-warning{{'objc_gc' attribute argument not supported: 'hello'}}
+
+static int __attribute__((objc_gc(weak))) g; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}}
+
+static __weak int h; // expected-warning {{'__weak' only applies to pointer types; type here is 'int'}}
+
+// TODO: it would be great if this reported as __weak
+#define WEAK __weak
+static WEAK int h; // expected-warning {{'objc_gc' only applies to pointer types; type here is 'int'}}
+
+/* expected-warning {{'__weak' only applies to pointer types; type here is 'int'}}*/ static __we\
+ak int i;
+
+// rdar://problem/9126213
+void test2(id __attribute((objc_gc(strong))) *strong,
+ id __attribute((objc_gc(weak))) *weak) {
+ void *opaque;
+ opaque = strong;
+ strong = opaque;
+
+ opaque = weak;
+ weak = opaque;
+}
diff --git a/test/SemaObjC/auto-objective-c.m b/test/SemaObjC/auto-objective-c.m
deleted file mode 100644
index 5467e24a7951..000000000000
--- a/test/SemaObjC/auto-objective-c.m
+++ /dev/null
@@ -1,33 +0,0 @@
-// RUN: %clang_cc1 -x objective-c -fblocks -fsyntax-only -verify %s
-
-@interface I
-{
- id pi;
-}
-- (id) Meth;
-@end
-
-// Objective-C does not support trailing return types, so check we don't get
-// the C++ diagnostic suggesting we forgot one.
-auto noTrailingReturnType(); // expected-error {{'auto' not allowed in function return type}}
-
-typedef int (^P) (int x);
-
-@implementation I
-- (id) Meth {
- auto p = [pi Meth];
- return p;
-}
-
-- (P) bfunc {
- auto my_block = ^int (int x) {return x; };
- my_block(1);
- return my_block;
-}
-@end
-
-
-// rdar://9036633
-int main() {
- auto int auto_i = 7; // expected-warning {{'auto' storage class specifier is redundant and will be removed in future releases}}
-}
diff --git a/test/SemaObjC/block-type-safety.m b/test/SemaObjC/block-type-safety.m
index c13e80618d51..ebc6777f7fbb 100644
--- a/test/SemaObjC/block-type-safety.m
+++ b/test/SemaObjC/block-type-safety.m
@@ -121,3 +121,20 @@ int test4 () {
return 0;
}
+// rdar:// 9118343
+
+@protocol NSCopying @end
+
+@interface NSAllArray <NSCopying>
+@end
+
+@interface NSAllArray (FooConformance) <Foo>
+@end
+
+int test5() {
+ NSAllArray *(^block)(id);
+ id <Foo> (^genericBlock)(id);
+ genericBlock = block;
+ return 0;
+}
+
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index 84a625c404ec..d77b759ffa73 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -35,8 +35,8 @@ id objc_getClass(const char *s);
@implementation Derived
+ (int) class_func1
{
- int i = (size_t)[self class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
- return i + (size_t)[super class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
+ int i = (size_t)[self class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
+ return i + (size_t)[super class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
}
+ (int) class_func2
{
@@ -55,8 +55,8 @@ id objc_getClass(const char *s);
}
+ (int) class_func5
{
- int i = (size_t)[Derived class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
- return i + (size_t)[Object class_func0]; // expected-warning {{method '+class_func0' not found (return type defaults to 'id')}}
+ int i = (size_t)[Derived class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
+ return i + (size_t)[Object class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
}
+ (int) class_func6
{
@@ -68,7 +68,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'))}}
+ int i = (size_t)[self instance_func0]; // expected-warning {{instance 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
@@ -85,8 +85,8 @@ id objc_getClass(const char *s);
}
- (int) instance_func5
{
- int i = (size_t)[Derived instance_func1]; // expected-warning {{method '+instance_func1' not found (return type defaults to 'id')}}
- return i + (size_t)[Object instance_func1]; // expected-warning {{method '+instance_func1' not found (return type defaults to 'id')}}
+ int i = (size_t)[Derived instance_func1]; // expected-warning {{class method '+instance_func1' not found (return type defaults to 'id')}}
+ return i + (size_t)[Object instance_func1]; // expected-warning {{class method '+instance_func1' not found (return type defaults to 'id')}}
}
- (int) instance_func6
{
diff --git a/test/SemaObjC/class-message-protocol-lookup.m b/test/SemaObjC/class-message-protocol-lookup.m
new file mode 100644
index 000000000000..ae64ea86804b
--- /dev/null
+++ b/test/SemaObjC/class-message-protocol-lookup.m
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9224670
+
+@interface RandomObject {
+@private
+}
++ (id)alloc;
+@end
+
+@protocol TestProtocol
+- (void)nothingInteresting;
+@end
+
+@protocol Test2Protocol
++ (id)alloc;
+- (id)alloc2; // expected-note 2 {{method declared here}}
+@end
+
+@implementation RandomObject
+- (void) Meth {
+ Class<TestProtocol> c = [c alloc]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}}
+ Class<Test2Protocol> c1 = [c1 alloc2]; // expected-warning {{instance method 'alloc2' found instead of class method 'alloc2'}}
+ Class<Test2Protocol> c2 = [c2 alloc]; // ok
+}
++ (id)alloc { return 0; }
+@end
+
+int main ()
+{
+ Class<TestProtocol> c = [c alloc]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}}
+ Class<Test2Protocol> c1 = [c1 alloc2]; // expected-warning {{instance method 'alloc2' found instead of class method 'alloc2'}}
+ Class<Test2Protocol> c2 = [c2 alloc]; // ok
+ return 0;
+}
diff --git a/test/SemaObjC/class-unavail-warning.m b/test/SemaObjC/class-unavail-warning.m
new file mode 100644
index 000000000000..426ac772c8aa
--- /dev/null
+++ b/test/SemaObjC/class-unavail-warning.m
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9092208
+
+__attribute__((unavailable("not available")))
+@interface MyClass { // expected-note 5 {{function has been explicitly marked unavailable here}}
+@public
+ void *_test;
+}
+
+- (id)self;
+- new;
++ (void)addObject:(id)anObject;
+
+@end
+
+int main() {
+ [MyClass new]; // expected-error {{'MyClass' is unavailable: not available}}
+ [MyClass self]; // expected-error {{'MyClass' is unavailable: not available}}
+ [MyClass addObject:((void *)0)]; // expected-error {{'MyClass' is unavailable: not available}}
+
+ MyClass *foo = [MyClass new]; // expected-error 2 {{'MyClass' is unavailable: not available}}
+
+ return 0;
+}
diff --git a/test/SemaObjC/comptypes-4.m b/test/SemaObjC/comptypes-4.m
index 56b23b22458f..adc324c91ee5 100644
--- a/test/SemaObjC/comptypes-4.m
+++ b/test/SemaObjC/comptypes-4.m
@@ -12,7 +12,7 @@ int main()
MyClass *obj_cp;
obj_cp = obj_p;
- obj_p = obj_cp;
+ obj_p = obj_cp; // expected-warning {{incompatible pointer types assigning to 'MyClass<MyProtocol> *' from 'MyClass *'}}
if (obj_cp == obj_p)
foo();
diff --git a/test/SemaObjC/conditional-expr-8.m b/test/SemaObjC/conditional-expr-8.m
new file mode 100644
index 000000000000..6799983e3b16
--- /dev/null
+++ b/test/SemaObjC/conditional-expr-8.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9296866
+
+@interface NSResponder
+@end
+
+
+@interface NSView : NSResponder
+@end
+
+@interface WebView : NSView
+@end
+
+@protocol WebDocumentView
+@end
+
+@implementation NSView
+
+- (void) FUNC : (id)s {
+ WebView *m_webView;
+ NSView <WebDocumentView> *documentView;
+ NSView *coordinateView = s ? documentView : m_webView;
+}
+@end
+
diff --git a/test/SemaObjC/exprs.m b/test/SemaObjC/exprs.m
index 13c34e5650de..d7c122356f58 100644
--- a/test/SemaObjC/exprs.m
+++ b/test/SemaObjC/exprs.m
@@ -9,12 +9,12 @@ Class test1(Class X) {
// rdar://6079877
void test2() {
id str = @"foo"
- "bar\0" // expected-warning {{literal contains NUL character}}
+ "bar\0" // no-warning
@"baz" " blarg";
id str2 = @"foo"
"bar"
@"baz"
- " b\0larg"; // expected-warning {{literal contains NUL character}}
+ " b\0larg"; // no-warning
if (@encode(int) == "foo") { } // expected-warning {{result of comparison against @encode is unspecified}}
diff --git a/test/SemaObjC/foreach.m b/test/SemaObjC/foreach.m
index 0f7fd9eea992..c865374e61af 100644
--- a/test/SemaObjC/foreach.m
+++ b/test/SemaObjC/foreach.m
@@ -16,3 +16,33 @@ void f(NSArray *a) {
for (id thisKey in keys);
for (id thisKey in keys);
}
+
+/* // rdar://9072298 */
+@protocol NSObject @end
+
+@interface NSObject <NSObject> {
+ Class isa;
+}
+@end
+
+typedef struct {
+ unsigned long state;
+ id *itemsPtr;
+ unsigned long *mutationsPtr;
+ unsigned long extra[5];
+} NSFastEnumerationState;
+
+@protocol NSFastEnumeration
+
+- (unsigned long)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(unsigned long)len;
+
+@end
+
+int main ()
+{
+ NSObject<NSFastEnumeration>* collection = ((void*)0);
+ for (id thing in collection) { }
+
+ return 0;
+}
+
diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m
index 98dff3aa7a7b..6edb8fd99b31 100644
--- a/test/SemaObjC/format-arg-attribute.m
+++ b/test/SemaObjC/format-arg-attribute.m
@@ -5,16 +5,16 @@
extern NSString *fa2 (const NSString *) __attribute__((format_arg(1)));
extern NSString *fa3 (NSString *) __attribute__((format_arg(1)));
-extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{attribute requires 1 argument(s)}}
-extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute requires 1 argument(s)}}
-extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute requires 1 argument(s)}}
+extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-error {{attribute takes one argument}}
+extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{attribute takes one argument}}
+extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{attribute takes one argument}}
struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
-extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{attribute requires 1 argument(s)}}
+extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{attribute takes one argument}}
/* format_arg formats must take and return a string. */
extern NSString *fi0 (int) __attribute__((format_arg(1))); // expected-error {{format argument not a string type}}
diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m
index 217daa7c3b58..5c82c8308a43 100644
--- a/test/SemaObjC/iboutletcollection-attr.m
+++ b/test/SemaObjC/iboutletcollection-attr.m
@@ -16,13 +16,13 @@
typedef void *PV;
@interface BAD {
- __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute requires 1 argument(s)}}
+ __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}}
__attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
__attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}}
__attribute__((iboutletcollection(PV))) void *ivar4; // expected-error {{ivar with iboutletcollection attribute must have object type (invalid 'void *')}}
__attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}}
}
-@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute requires 1 argument(s)}}
+@property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}}
@property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}}
@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-error {{property with iboutletcollection attribute must have object type (invalid 'int')}}
diff --git a/test/SemaObjC/idiomatic-parentheses.m b/test/SemaObjC/idiomatic-parentheses.m
index 011efbc437bf..39e97e2df60a 100644
--- a/test/SemaObjC/idiomatic-parentheses.m
+++ b/test/SemaObjC/idiomatic-parentheses.m
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wparentheses %s
-// Don't warn about some common ObjC idioms unless we have -Wparentheses on.
+// Don't warn about some common ObjC idioms unless we have -Widiomatic-parentheses on.
// <rdar://problem/7382435>
@interface Object
diff --git a/test/SemaObjC/ignore-weakimport-method.m b/test/SemaObjC/ignore-weakimport-method.m
index f80312ac06f3..d71cebf2c79a 100644
--- a/test/SemaObjC/ignore-weakimport-method.m
+++ b/test/SemaObjC/ignore-weakimport-method.m
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-
@interface foo
+ (void) cx __attribute__((weak_import));
- (void) x __attribute__((weak_import));
diff --git a/test/SemaObjC/ivar-lookup.m b/test/SemaObjC/ivar-lookup.m
index 06e47116f73c..2b14bff85d84 100644
--- a/test/SemaObjC/ivar-lookup.m
+++ b/test/SemaObjC/ivar-lookup.m
@@ -35,3 +35,15 @@ extern struct foo x;
}
@end
+@interface TwoIvars {
+ int a;
+ int b;
+}
+@end
+
+@implementation TwoIvars
++ (int)classMethod {
+ return a + b; // expected-error{{instance variable 'a' accessed in class method}} \
+ // expected-error{{instance variable 'b' accessed in class method}}
+}
+@end
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index 388e44724d5b..0a1b1cd06782 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -26,7 +26,7 @@ foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot b
// rdar://6780761
void f0(foo *a0) {
extern void g0(int x, ...);
- g0(1, *(foo*)0); // expected-error {{cannot pass object with interface type 'foo' by-value through variadic function}}
+ g0(1, *(foo*)a0); // expected-error {{cannot pass object with interface type 'foo' by-value through variadic function}}
}
// rdar://8421082
diff --git a/test/SemaObjC/method-not-defined.m b/test/SemaObjC/method-not-defined.m
index 78bf65027284..ed68b22945c4 100644
--- a/test/SemaObjC/method-not-defined.m
+++ b/test/SemaObjC/method-not-defined.m
@@ -7,7 +7,7 @@ void test() {
Foo *fooObj;
id obj;
- [[Foo alloc] init]; // expected-warning {{method '+alloc' not found (return type defaults to 'id')}} expected-warning {{method '-init' not found (return type defaults to 'id')}}
- [fooObj notdefined]; // expected-warning {{method '-notdefined' not found (return type defaults to 'id')}}
- [obj whatever:1 :2 :3]; // expected-warning {{method '-whatever:::' not found (return type defaults to 'id'))}}
+ [[Foo alloc] init]; // expected-warning {{class method '+alloc' not found (return type defaults to 'id')}} expected-warning {{instance method '-init' not found (return type defaults to 'id')}}
+ [fooObj notdefined]; // expected-warning {{instance method '-notdefined' not found (return type defaults to 'id')}}
+ [obj whatever:1 :2 :3]; // expected-warning {{instance method '-whatever:::' not found (return type defaults to 'id'))}}
}
diff --git a/test/SemaObjC/method-prototype-scope.m b/test/SemaObjC/method-prototype-scope.m
index 2184172f35c9..b08faa65b22a 100644
--- a/test/SemaObjC/method-prototype-scope.m
+++ b/test/SemaObjC/method-prototype-scope.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wduplicate-method-arg -verify %s
// rdar://8877730
@@ -11,7 +11,7 @@ int object;
- doSomethingElseWith:(id)object;
-- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object; // expected-warning {{redefinition of method parameter 'object'}} \
+- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object; // expected-warning {{redeclaration of method parameter 'object'}} \
// expected-note {{previous declaration is here}}
@end
diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m
index 5375408a2b66..274e93660653 100644
--- a/test/SemaObjC/method-sentinel-attr.m
+++ b/test/SemaObjC/method-sentinel-attr.m
@@ -13,7 +13,7 @@
- (void) foo8 : (int)x, ... __attribute__ ((__sentinel__("a"))); // expected-error {{'sentinel' attribute requires parameter 1 to be an integer constant}}
- (void) foo9 : (int)x, ... __attribute__ ((__sentinel__(-1))); // expected-error {{'sentinel' parameter 1 less than zero}}
- (void) foo10 : (int)x, ... __attribute__ ((__sentinel__(1,1)));
-- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3))); // expected-error {{attribute requires 0, 1 or 2 argument(s)}}
+- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3))); // expected-error {{attribute takes no more than 2 arguments}}
- (void) foo12 : (int)x, ... ATTR; // expected-note {{method has been explicitly marked sentinel here}}
// rdar://7975788
diff --git a/test/SemaObjC/missing-atend-metadata.m b/test/SemaObjC/missing-atend-metadata.m
new file mode 100644
index 000000000000..434706d3fafc
--- /dev/null
+++ b/test/SemaObjC/missing-atend-metadata.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+
+@interface I0
+@end
+
+@implementation I0 // expected-error {{'@end' is missing in implementation context}}
+- meth { return 0; }
+
+@interface I1 : I0
+@end
+
+@implementation I1 // expected-error {{'@end' is missing in implementation context}}
+-(void) im0 { self = [super init]; } // expected-warning {{nstance method '-init' not found }}
+
+@interface I2 : I0
+- I2meth;
+@end
+
+@implementation I2 // expected-error {{'@end' is missing in implementation context}}
+- I2meth { return 0; }
+
+@implementation I2(CAT) // expected-error {{'@end' is missing in implementation context}}
diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m
index 6c45d97b0660..76c6ffa229ea 100644
--- a/test/SemaObjC/nonnull.m
+++ b/test/SemaObjC/nonnull.m
@@ -67,3 +67,30 @@ void func6(dispatch_object_t _head) {
_dispatch_queue_push_list(_head._do); // no warning
}
+// rdar://9287695
+#define NULL (void*)0
+
+@interface NSObject
+- (void)doSomethingWithNonNullPointer:(void *)ptr :(int)iarg : (void*)ptr1 __attribute__((nonnull(1, 3)));
++ (void)doSomethingClassyWithNonNullPointer:(void *)ptr __attribute__((nonnull(1)));
+@end
+
+extern void DoSomethingNotNull(void *db) __attribute__((nonnull(1)));
+
+@interface IMP
+{
+ void * vp;
+}
+@end
+
+@implementation IMP
+- (void) Meth {
+ NSObject *object;
+ [object doSomethingWithNonNullPointer:NULL:1:NULL]; // expected-warning 2 {{null passed to a callee which requires a non-null argument}}
+ [object doSomethingWithNonNullPointer:vp:1:NULL]; // expected-warning {{null passed to a callee which requires a non-null argument}}
+ [NSObject doSomethingClassyWithNonNullPointer:NULL]; // expected-warning {{null passed to a callee which requires a non-null argument}}
+ DoSomethingNotNull(NULL); // expected-warning {{null passed to a callee which requires a non-null argument}}
+ [object doSomethingWithNonNullPointer:vp:1:vp];
+}
+@end
+
diff --git a/test/SemaObjC/objc-qualified-property-lookup.m b/test/SemaObjC/objc-qualified-property-lookup.m
new file mode 100644
index 000000000000..daf583de334b
--- /dev/null
+++ b/test/SemaObjC/objc-qualified-property-lookup.m
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9078584
+
+@interface NSObject @end
+
+@protocol TextInput
+-editRange;
+@end
+
+@interface I {
+ NSObject<TextInput>* editor;
+}
+- (id) Meth;
+@end
+
+@implementation I
+- (id) Meth {
+ return editor.editRange;
+}
+@end
+
diff --git a/test/SemaObjC/property-13.m b/test/SemaObjC/property-13.m
index 6d56dabb9c0e..2ca341652686 100644
--- a/test/SemaObjC/property-13.m
+++ b/test/SemaObjC/property-13.m
@@ -48,7 +48,7 @@ void abort(void);
int main ()
{
Test *x = [[Test alloc] init];
- /* 1. Test of a requred property */
+ /* 1. Test of a required property */
x.required1 = 100;
if (x.required1 != 100)
abort ();
diff --git a/test/SemaObjC/property-lookup-in-id.m b/test/SemaObjC/property-lookup-in-id.m
new file mode 100644
index 000000000000..86da48e85105
--- /dev/null
+++ b/test/SemaObjC/property-lookup-in-id.m
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9106929
+
+typedef struct objc_class *Class;
+
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+
+typedef struct __FSEventStream* FSEventStreamRef;
+
+extern id NSApp;
+
+@interface FileSystemMonitor {
+
+ FSEventStreamRef fsEventStream;
+}
+@property(assign) FSEventStreamRef fsEventStream;
+
+@end
+
+@implementation FileSystemMonitor
+@synthesize fsEventStream;
+
+- (void)startFSEventGathering:(id)sender
+{
+ fsEventStream = [NSApp delegate].fsEventStream; // expected-warning {{warning: instance method '-delegate' not found (return type defaults to 'id')}} \
+ // expected-error {{property 'fsEventStream' not found on object of type 'id'}}
+
+}
+@end
+
diff --git a/test/SemaObjC/protocol-attribute.m b/test/SemaObjC/protocol-attribute.m
index 52c980396eda..178774c6640f 100644
--- a/test/SemaObjC/protocol-attribute.m
+++ b/test/SemaObjC/protocol-attribute.m
@@ -40,7 +40,7 @@ Class <MyProto1> clsP1 = 0; // expected-warning {{'MyProto1' is deprecated}}
__attribute ((unavailable)) __attribute ((deprecated)) @protocol XProto; // expected-note{{marked unavailable}}
-id <XProto> idX = 0; // expected-error {{'XProto' is unavailable}} expected-warning {{'XProto' is deprecated}}
+id <XProto> idX = 0; // expected-error {{'XProto' is unavailable}}
int main ()
{
diff --git a/test/SemaObjC/self-declared-in-block.m b/test/SemaObjC/self-declared-in-block.m
new file mode 100644
index 000000000000..4bd720214438
--- /dev/null
+++ b/test/SemaObjC/self-declared-in-block.m
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10 -fblocks -fobjc-nonfragile-abi -verify %s
+// rdar://9154582
+
+@interface Blocky @end
+
+@implementation Blocky {
+ int _a;
+}
+- (void)doAThing {
+ ^{
+ char self; // expected-note {{declared here}}
+ _a; // expected-error {{instance variable '_a' cannot be accessed because 'self' has been redeclared}}
+ }();
+}
+
+@end
+
+
+// rdar://9284603
+@interface ShadowSelf
+{
+ int _anIvar;
+}
+@end
+
+@interface C {
+ int _cIvar;
+}
+@end
+
+@implementation ShadowSelf
+- (void)doSomething {
+ __typeof(self) newSelf = self;
+ {
+ __typeof(self) self = newSelf;
+ (void)_anIvar;
+ }
+ {
+ C* self; // expected-note {{declared here}}
+ (void) _anIvar; // expected-error {{instance variable '_anIvar' cannot be accessed because 'self' has been redeclared}}
+ }
+}
+- (void)doAThing {
+ ^{
+ id self; // expected-note {{declared here}}
+ (void)_anIvar; // expected-error {{instance variable '_anIvar' cannot be accessed because 'self' has been redeclared}}
+ }();
+}
+@end
+
diff --git a/test/SemaObjC/self-in-function.m b/test/SemaObjC/self-in-function.m
new file mode 100644
index 000000000000..9027a947a03c
--- /dev/null
+++ b/test/SemaObjC/self-in-function.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
+// rdar://9181463
+
+typedef struct objc_class *Class;
+
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+@interface NSObject
++ (id) alloc;
+@end
+
+
+void foo(Class self) {
+ [self alloc];
+ (^() {
+ [self alloc];
+ })();
+}
+
+void bar(Class self) {
+ Class y = self;
+ [y alloc];
+}
+
diff --git a/test/SemaObjC/sizeof-interface.m b/test/SemaObjC/sizeof-interface.m
index 9d85f1f53fcc..3fe39645fddb 100644
--- a/test/SemaObjC/sizeof-interface.m
+++ b/test/SemaObjC/sizeof-interface.m
@@ -43,7 +43,7 @@ int g2[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to inte
@synthesize p0 = _p0;
@end
-typedef struct { @defs(I1) } I1_defs; // expected-error {{invalid application of @defs in non-fragile ABI}}
+typedef struct { @defs(I1); } I1_defs; // expected-error {{invalid application of @defs in non-fragile ABI}}
// FIXME: This is currently broken due to the way the record layout we
// create is tied to whether we have seen synthesized properties. Ugh.
diff --git a/test/SemaObjC/special-dep-unavail-warning.m b/test/SemaObjC/special-dep-unavail-warning.m
index b7a2d663441c..1d07a49e619d 100644
--- a/test/SemaObjC/special-dep-unavail-warning.m
+++ b/test/SemaObjC/special-dep-unavail-warning.m
@@ -27,7 +27,7 @@
@end
-@class C;
+@class C; // expected-note 5 {{forward class is declared here}}
void test(C *c) {
[c depInA]; // expected-warning {{'depInA' maybe deprecated because receiver type is unknown}}
@@ -36,10 +36,8 @@ void test(C *c) {
[c unavailMeth1]; // expected-warning {{'unavailMeth1' maybe unavailable because receiver type is unknown}}
[c depInA2]; // expected-warning {{'depInA2' maybe deprecated because receiver type is unknown}}
[c unavailMeth2]; // expected-warning {{'unavailMeth2' maybe unavailable because receiver type is unknown}}
- [c depunavailInA]; // expected-warning {{'depunavailInA' maybe deprecated because receiver type is unknown}} \
- // expected-warning {{'depunavailInA' maybe unavailable because receiver type is unknown}}
- [c depunavailInA1]; // expected-warning {{'depunavailInA1' maybe deprecated because receiver type is unknown}} \
- // expected-warning {{'depunavailInA1' maybe unavailable because receiver type is unknown}}
+ [c depunavailInA]; // expected-warning {{'depunavailInA' maybe unavailable because receiver type is unknown}}
+ [c depunavailInA1];// expected-warning {{'depunavailInA1' maybe unavailable because receiver type is unknown}}
[c FuzzyMeth]; // expected-warning {{'FuzzyMeth' maybe deprecated because receiver type is unknown}}
[c FuzzyMeth1]; // expected-warning {{'FuzzyMeth1' maybe deprecated because receiver type is unknown}}
diff --git a/test/SemaObjC/uninit-variables.m b/test/SemaObjC/uninit-variables.m
index 63c214053b00..b5c49184f4bc 100644
--- a/test/SemaObjC/uninit-variables.m
+++ b/test/SemaObjC/uninit-variables.m
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only -fblocks %s -verify
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized -fsyntax-only -fblocks %s -verify
// Duplicated from uninit-variables.c.
// Test just to ensure the analysis is working.
int test1() {
int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization}}
- return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+ return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
// Test ObjC fast enumeration.
diff --git a/test/SemaObjC/unqualified-to-qualified-class-warn.m b/test/SemaObjC/unqualified-to-qualified-class-warn.m
new file mode 100644
index 000000000000..e6fa13850fbd
--- /dev/null
+++ b/test/SemaObjC/unqualified-to-qualified-class-warn.m
@@ -0,0 +1,72 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://9091389
+
+@protocol Fooable
+- (void)foo;
+@end
+
+@protocol SubFooable <Fooable>
+@end
+
+@interface AClass
+@end
+
+@interface BClass : AClass <SubFooable>
+@end
+
+@implementation BClass
+- (void)foo {
+}
+@end
+
+void functionTakingAClassConformingToAProtocol(AClass <Fooable> *instance) { // expected-note {{passing argument to parameter 'instance' here}}
+}
+
+int main () {
+ AClass *aobject = 0;
+ BClass *bobject = 0;
+ functionTakingAClassConformingToAProtocol(aobject); // expected-warning {{incompatible pointer types passing 'AClass *' to parameter of type 'AClass<Fooable> *'}}
+ functionTakingAClassConformingToAProtocol(bobject); // Shouldn't warn - does implement Fooable
+ return 0;
+}
+
+// rdar://9267196
+@interface NSObject @end
+
+@protocol MyProtocol
+@end
+
+@interface MyClass : NSObject
+{
+}
+@end
+
+@implementation MyClass
+@end
+
+@interface MySubclass : MyClass <MyProtocol>
+{
+}
+@end
+
+@interface MyTestClass : NSObject
+{
+@private
+ NSObject <MyProtocol> *someObj;
+}
+
+@property (nonatomic, assign) NSObject <MyProtocol> *someObj;
+
+@end
+
+@implementation MyTestClass
+
+@synthesize someObj;
+
+- (void)someMethod
+{
+ MySubclass *foo;
+ [self setSomeObj:foo]; // no warning here!
+}
+
+@end
diff --git a/test/SemaObjC/warn-write-strings.m b/test/SemaObjC/warn-write-strings.m
index 450d0a6fe62e..163c864257e9 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
+// RUN: %clang_cc1 -verify -fsyntax-only -fconst-strings %s
// PR4804
char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'const char [4]' discards qualifiers}}
diff --git a/test/SemaObjC/weak-attr-ivar.m b/test/SemaObjC/weak-attr-ivar.m
index d5bbb01902db..e3d96da13bb7 100644
--- a/test/SemaObjC/weak-attr-ivar.m
+++ b/test/SemaObjC/weak-attr-ivar.m
@@ -72,3 +72,13 @@ typedef enum { Foo_HUH_NONE } FooHUHCode;
}
@end
+// rdar://problem/9123040
+@interface Test1 {
+@public
+ id ivar __attribute__((objc_gc(weak)));
+}
+@property (assign) id prop __attribute((objc_gc(weak)));
+@end
+void test1(Test1 *t) {
+ id *(__attribute__((objc_gc(strong))) x) = &t->ivar; // expected-warning {{initializing '__strong id *' with an expression of type '__weak id *' discards qualifiers}}
+}
diff --git a/test/SemaObjCXX/argument-dependent-lookup.mm b/test/SemaObjCXX/argument-dependent-lookup.mm
new file mode 100644
index 000000000000..a25cc68888d7
--- /dev/null
+++ b/test/SemaObjCXX/argument-dependent-lookup.mm
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// <rdar://problem/9142559>: For the purposes of Argument-Dependent
+// Lookup, Objective-C classes are considered to be in the global
+// namespace.
+
+@interface NSFoo
+@end
+
+template<typename T>
+void f(T t) {
+ g(t);
+}
+
+void g(NSFoo*);
+
+void test(NSFoo *foo) {
+ f(foo);
+}
diff --git a/test/SemaObjCXX/exceptions-fragile.mm b/test/SemaObjCXX/exceptions-fragile.mm
index e345ebc70b18..d1e7077089e2 100644
--- a/test/SemaObjCXX/exceptions-fragile.mm
+++ b/test/SemaObjCXX/exceptions-fragile.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
@interface NSException @end
void opaque();
diff --git a/test/SemaObjCXX/goto.mm b/test/SemaObjCXX/goto.mm
new file mode 100644
index 000000000000..67df1f4c3240
--- /dev/null
+++ b/test/SemaObjCXX/goto.mm
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR9495
+struct NonPOD { NonPOD(); ~NonPOD(); };
+
+@interface A
+@end
+
+@implementation A
+- (void)method:(bool)b {
+ NonPOD np;
+ if (b) {
+ goto undeclared; // expected-error{{use of undeclared label 'undeclared'}}
+ }
+}
+@end
diff --git a/test/SemaObjCXX/objc-pointer-conv.mm b/test/SemaObjCXX/objc-pointer-conv.mm
index 209dcfdfd705..6f59de179472 100644
--- a/test/SemaObjCXX/objc-pointer-conv.mm
+++ b/test/SemaObjCXX/objc-pointer-conv.mm
@@ -43,6 +43,6 @@ void accept_derived(DerivedFromI*);
void test_base_to_derived(I* i) {
accept_derived(i); // expected-warning{{incompatible pointer types passing 'I *' to parameter of type 'DerivedFromI *'}}
- DerivedFromI *di = i; // expected-warning{{incompatible pointer types initializing 'I *' with an expression of type 'DerivedFromI *'}}
+ DerivedFromI *di = i; // expected-warning{{incompatible pointer types initializing 'DerivedFromI *' with an expression of type 'I *'}}
DerivedFromI *di2 = (DerivedFromI *)i;
}
diff --git a/test/SemaObjCXX/overload-gc.mm b/test/SemaObjCXX/overload-gc.mm
new file mode 100644
index 000000000000..d2ddd40efb4c
--- /dev/null
+++ b/test/SemaObjCXX/overload-gc.mm
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -triple i386-apple-darwin9 -fobjc-gc -verify %s
+
+void f0(__weak id *); // expected-note{{candidate function not viable: 1st argument ('id *') has no lifetime, but parameter has __weak lifetime}}
+
+void test_f0(id *x) {
+ f0(x); // expected-error{{no matching function for call to 'f0'}}
+}
+
+@interface A
+@end
+
+void f1(__weak id*);
+void test_f1(__weak A** a) {
+ f1(a);
+}
+
+@interface B : A
+@end
+
+void f2(__weak A**);
+void test_f2(__weak B** b) {
+ f2(b);
+}
+
diff --git a/test/SemaObjCXX/overload.mm b/test/SemaObjCXX/overload.mm
index 7e79a4249cb0..960a7b228ff3 100644
--- a/test/SemaObjCXX/overload.mm
+++ b/test/SemaObjCXX/overload.mm
@@ -51,12 +51,12 @@ void test0(A* a, B* b, id val) {
}
void test1(A* a) {
- B* b = a; // expected-warning{{incompatible pointer types initializing 'A *' with an expression of type 'B *'}}
+ B* b = a; // expected-warning{{incompatible pointer types initializing 'B *' with an expression of type 'A *'}}
B *c; c = a; // expected-warning{{incompatible pointer types assigning to 'A *' from 'B *'}}
}
void test2(A** ap) {
- B** bp = ap; // expected-warning{{incompatible pointer types initializing 'A **' with an expression of type 'B **'}}
+ B** bp = ap; // expected-warning{{incompatible pointer types initializing 'B **' with an expression of type 'A **'}}
bp = ap; // expected-warning{{incompatible pointer types assigning to 'A **' from 'B **'}}
}
@@ -149,3 +149,25 @@ namespace rdar8734046 {
f2(a);
}
}
+
+namespace PR9735 {
+ int &f3(const A*);
+ float &f3(const void*);
+
+ void test_f(B* b, const B* bc) {
+ int &ir1 = f3(b);
+ int &ir2 = f3(bc);
+ }
+}
+
+@interface D : B
+@end
+
+namespace rdar9327203 {
+ int &f(void* const&, int);
+ float &f(void* const&, long);
+
+ void g(id x) {
+ int &fr = (f)(x, 0);
+ }
+}
diff --git a/test/SemaObjCXX/parameters.mm b/test/SemaObjCXX/parameters.mm
index aab1fbda4dd8..1a7869dc7a7a 100644
--- a/test/SemaObjCXX/parameters.mm
+++ b/test/SemaObjCXX/parameters.mm
@@ -10,3 +10,8 @@ struct X0 {
X0<A> x0a; // expected-note{{instantiation}}
+
+struct test2 { virtual void foo() = 0; }; // expected-note {{unimplemented}}
+@interface Test2
+- (void) foo: (test2) foo; // expected-error {{parameter type 'test2' is an abstract class}}
+@end
diff --git a/test/SemaObjCXX/propert-dot-error.mm b/test/SemaObjCXX/propert-dot-error.mm
index 47b7dc64d5cc..7a5feb42e5b1 100644
--- a/test/SemaObjCXX/propert-dot-error.mm
+++ b/test/SemaObjCXX/propert-dot-error.mm
@@ -39,3 +39,14 @@ void g(B *b) {
b.value.staticData = 17;
b.value.method();
}
+
+@interface C
+@end
+
+@implementation C
+- (void)method:(B *)b {
+ // <rdar://problem/8985943>
+ b.operator+ = 17; // expected-error{{'operator+' is not a valid property name (accessing an object of type 'B *')}}
+ b->operator+ = 17; // expected-error{{'B' does not have a member named 'operator+'}}
+}
+@end
diff --git a/test/SemaObjCXX/property-reference.mm b/test/SemaObjCXX/property-reference.mm
new file mode 100644
index 000000000000..5dc8061de70b
--- /dev/null
+++ b/test/SemaObjCXX/property-reference.mm
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fsyntax-only -verify -fobjc-nonfragile-abi %s
+// rdar://9070460
+
+class TCPPObject
+{
+public:
+ TCPPObject(const TCPPObject& inObj);
+ TCPPObject();
+ ~TCPPObject();
+
+ TCPPObject& operator=(const TCPPObject& inObj)const ;
+
+ void* Data();
+
+private:
+ void* fData;
+};
+
+
+typedef const TCPPObject& CREF_TCPPObject;
+
+@interface TNSObject
+@property (assign, readwrite, nonatomic) CREF_TCPPObject cppObjectNonAtomic;
+@property (assign, readwrite) CREF_TCPPObject cppObjectAtomic;
+@property (assign, readwrite, nonatomic) const TCPPObject& cppObjectDynamic;
+@end
+
+
+@implementation TNSObject
+
+@synthesize cppObjectNonAtomic;
+@synthesize cppObjectAtomic;
+@dynamic cppObjectDynamic;
+
+- (const TCPPObject&) cppObjectNonAtomic
+{
+ return cppObjectNonAtomic;
+}
+
+- (void) setCppObjectNonAtomic: (const TCPPObject&)cppObject
+{
+ cppObjectNonAtomic = cppObject;
+}
+@end
diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm
index 15033f6bde8d..3a522005abee 100644
--- a/test/SemaObjCXX/references.mm
+++ b/test/SemaObjCXX/references.mm
@@ -9,7 +9,7 @@ typedef struct {
@interface A
@property (assign) T p0;
-@property (assign) T& p1; // expected-error {{property of reference type is not supported}}
+@property (assign) T& p1;
@end
int f0(const T& t) {
@@ -21,7 +21,7 @@ int f1(A *a) {
}
int f2(A *a) {
- return f0(a.p1); // expected-error {{property 'p1' not found on object of type 'A *'}}
+ return f0(a.p1);
}
// PR7740
@@ -37,7 +37,7 @@ void f4(NSString &tmpstr) {
@protocol P2 @end
@protocol P3 @end
@interface foo<P1> {} @end
-@interface bar : foo <P1, P2> {} @end
+@interface bar : foo <P1, P2, P3> {} @end
typedef bar baz;
struct ToBar {
diff --git a/test/SemaOpenCL/extension-fp64.cl b/test/SemaOpenCL/extension-fp64.cl
index eaf2509502f2..e0c2b1ea4b53 100644
--- a/test/SemaOpenCL/extension-fp64.cl
+++ b/test/SemaOpenCL/extension-fp64.cl
@@ -1,17 +1,19 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
-void f1(double da) { // expected-error {{requires cl_khr_fp64 extension}}
- double d; // expected-error {{requires cl_khr_fp64 extension}}
+void f1(double da) { // expected-error {{type 'double' requires cl_khr_fp64 extension}}
+ double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}}
+ (void) 1.0; // expected-warning {{double precision constant requires cl_khr_fp64}}
}
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
void f2(void) {
double d;
+ (void) 1.0;
}
#pragma OPENCL EXTENSION cl_khr_fp64 : disable
void f3(void) {
- double d; // expected-error {{requires cl_khr_fp64 extension}}
+ double d; // expected-error {{type 'double' requires cl_khr_fp64 extension}}
}
diff --git a/test/SemaOpenCL/vec_step.cl b/test/SemaOpenCL/vec_step.cl
new file mode 100644
index 000000000000..d83ebf11fe03
--- /dev/null
+++ b/test/SemaOpenCL/vec_step.cl
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+typedef int int2 __attribute__((ext_vector_type(2)));
+typedef int int3 __attribute__((ext_vector_type(3)));
+typedef int int4 __attribute__((ext_vector_type(4)));
+typedef int int8 __attribute__((ext_vector_type(8)));
+typedef int int16 __attribute__((ext_vector_type(16)));
+
+void foo(int3 arg1, int8 arg2) {
+ int4 auto1;
+ int16 *auto2;
+ int auto3;
+ int2 auto4;
+ struct S *incomplete1;
+
+ int res1[vec_step(arg1) == 4 ? 1 : -1];
+ int res2[vec_step(arg2) == 8 ? 1 : -1];
+ int res3[vec_step(auto1) == 4 ? 1 : -1];
+ int res4[vec_step(*auto2) == 16 ? 1 : -1];
+ int res5[vec_step(auto3) == 1 ? 1 : -1];
+ int res6[vec_step(auto4) == 2 ? 1 : -1];
+ int res7[vec_step(int2) == 2 ? 1 : -1];
+ int res8[vec_step(int3) == 4 ? 1 : -1];
+ int res9[vec_step(int4) == 4 ? 1 : -1];
+ int res10[vec_step(int8) == 8 ? 1 : -1];
+ int res11[vec_step(int16) == 16 ? 1 : -1];
+ int res12[vec_step(void) == 1 ? 1 : -1];
+
+ int res13 = vec_step(*incomplete1); // expected-error {{'vec_step' requires built-in scalar or vector type, 'struct S' invalid}}
+ int res14 = vec_step(int16*); // expected-error {{'vec_step' requires built-in scalar or vector type, 'int16 *' invalid}}
+ int res15 = vec_step(void(void)); // expected-error {{'vec_step' requires built-in scalar or vector type, 'void (void)' invalid}}
+}
diff --git a/test/SemaTemplate/address-spaces.cpp b/test/SemaTemplate/address-spaces.cpp
new file mode 100644
index 000000000000..eda03dbac2bd
--- /dev/null
+++ b/test/SemaTemplate/address-spaces.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T, typename U>
+struct is_same {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_same<T, T> {
+ static const bool value = true;
+};
+
+typedef int __attribute__((address_space(1))) int_1;;
+typedef int __attribute__((address_space(2))) int_2;;
+typedef int __attribute__((address_space(1))) *int_1_ptr;
+typedef int_2 *int_2_ptr;
+
+// Check that we maintain address spaces through template argument
+// deduction from a type.
+template<typename T>
+struct remove_pointer {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_pointer<T *> {
+ typedef T type;
+};
+
+int check_remove0[is_same<remove_pointer<int_1_ptr>::type, int_1>::value? 1 : -1];
+int check_remove1[is_same<remove_pointer<int_2_ptr>::type, int_2>::value? 1 : -1];
+int check_remove2[is_same<remove_pointer<int_2_ptr>::type, int>::value? -1 : 1];
+int check_remove3[is_same<remove_pointer<int_2_ptr>::type, int_1>::value? -1 : 1];
+
+template<typename T>
+struct is_pointer_in_address_space_1 {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_pointer_in_address_space_1<T __attribute__((address_space(1))) *> {
+ static const bool value = true;
+};
+
+int check_ptr_in_as1[is_pointer_in_address_space_1<int_1_ptr>::value? 1 : -1];
+int check_ptr_in_as2[is_pointer_in_address_space_1<int_2_ptr>::value? -1 : 1];
+int check_ptr_in_as3[is_pointer_in_address_space_1<int*>::value? -1 : 1];
+
+// Check that we maintain address spaces through template argument
+// deduction for a call.
+template<typename T>
+void accept_any_pointer(T*) {
+ T *x = 1; // expected-error{{cannot initialize a variable of type '__attribute__((address_space(1))) int *' with an rvalue of type 'int'}} \
+ // expected-error{{cannot initialize a variable of type '__attribute__((address_space(3))) int *' with an rvalue of type 'int'}}
+}
+
+void test_accept_any_pointer(int_1_ptr ip1, int_2_ptr ip2) {
+ static __attribute__((address_space(3))) int array[17];
+ accept_any_pointer(ip1); // expected-note{{in instantiation of}}
+ accept_any_pointer(array); // expected-note{{in instantiation of}}
+}
+
+template<typename T> struct identity {};
+
+template<typename T>
+identity<T> accept_arg_in_address_space_1(__attribute__((address_space(1))) T &ir1);
+
+template<typename T>
+identity<T> accept_any_arg(T &ir1);
+
+void test_arg_in_address_space_1() {
+ static int __attribute__((address_space(1))) int_1;
+ identity<int> ii = accept_arg_in_address_space_1(int_1);
+ identity<int __attribute__((address_space(1)))> ii2 = accept_any_arg(int_1);
+}
+
+// Partial ordering
+template<typename T> int &order1(__attribute__((address_space(1))) T&);
+template<typename T> float &order1(T&);
+
+void test_order1() {
+ static __attribute__((address_space(1))) int i1;
+ int i;
+ int &ir = order1(i1);
+ float &fr = order1(i);
+}
diff --git a/test/SemaTemplate/deduction-crash.cpp b/test/SemaTemplate/deduction-crash.cpp
index 8f4b7281818d..ec97311e5d72 100644
--- a/test/SemaTemplate/deduction-crash.cpp
+++ b/test/SemaTemplate/deduction-crash.cpp
@@ -4,7 +4,7 @@
// Note that the error count below doesn't matter. We just want to
// make sure that the parser doesn't crash.
-// CHECK: 15 errors
+// CHECK: 13 errors
template<a>
struct int_;
diff --git a/test/SemaTemplate/dependent-template-recover.cpp b/test/SemaTemplate/dependent-template-recover.cpp
index e91ffb52539c..3c01f6586b01 100644
--- a/test/SemaTemplate/dependent-template-recover.cpp
+++ b/test/SemaTemplate/dependent-template-recover.cpp
@@ -16,3 +16,45 @@ struct X {
(*t).f2<0>(); // expected-error{{expected expression}}
}
};
+
+namespace PR9401 {
+ // From GCC PR c++/45558
+ template <typename S, typename T>
+ struct C
+ {
+ template <typename U>
+ struct B
+ {
+ template <typename W>
+ struct E
+ {
+ explicit E(const W &x) : w(x) {}
+ const W &w;
+ };
+ };
+ };
+
+ struct F;
+ template <typename X>
+ struct D
+ {
+ D() {}
+ };
+
+ const D<F> g;
+ template <typename S, typename T>
+ struct A
+ {
+ template <typename U>
+ struct B : C<S, T>::template B<U>
+ {
+ typedef typename C<S, T>::template B<U> V;
+ static const D<typename V::template E<D<F> > > a;
+ };
+ };
+
+ template <typename S, typename T>
+ template <typename U>
+ const D<typename C<S, T>::template B<U>::template E<D<F> > >
+ A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g);
+}
diff --git a/test/SemaTemplate/destructor-template.cpp b/test/SemaTemplate/destructor-template.cpp
index 6fe7f69cdd5f..07beda40aaa7 100644
--- a/test/SemaTemplate/destructor-template.cpp
+++ b/test/SemaTemplate/destructor-template.cpp
@@ -50,3 +50,10 @@ namespace PR7239 {
}
};
}
+
+namespace PR7904 {
+ struct Foo {
+ template <int i> ~Foo() {} // expected-error{{destructor cannot be declared as a template}}
+ };
+ Foo f;
+}
diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp
index ffec3c2b97f0..63016fd71568 100644
--- a/test/SemaTemplate/explicit-instantiation.cpp
+++ b/test/SemaTemplate/explicit-instantiation.cpp
@@ -88,15 +88,12 @@ template<typename> struct X3 { };
inline template struct X3<int>; // expected-warning{{ignoring 'inline' keyword on explicit template instantiation}}
static template struct X3<float>; // expected-warning{{ignoring 'static' keyword on explicit template instantiation}}
-namespace PR7622 { // expected-note{{to match this}}
+namespace PR7622 {
template<typename,typename=int>
struct basic_streambuf;
- // FIXME: Very poor recovery here.
template<typename,typename>
struct basic_streambuf{friend bob<>()}; // expected-error{{unknown type name 'bob'}} \
// expected-error{{ expected member name or ';' after declaration specifiers}}
- template struct basic_streambuf<int>; // expected-error{{explicit instantiation of 'basic_streambuf' in class scope}}
-} // expected-error{{expected ';' after struct}}
-
-//expected-error{{expected '}'}}
+ template struct basic_streambuf<int>;
+}
diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp
index abf1b3c31d74..b3babf12981e 100644
--- a/test/SemaTemplate/instantiate-cast.cpp
+++ b/test/SemaTemplate/instantiate-cast.cpp
@@ -63,7 +63,7 @@ template struct DynamicCast0<Base*, A>; // expected-note{{instantiation}}
template<typename T, typename U>
struct ReinterpretCast0 {
void f(T t) {
- (void)reinterpret_cast<U>(t); // expected-error{{constness}}
+ (void)reinterpret_cast<U>(t); // expected-error{{qualifiers}}
}
};
diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp
index 74eb5e5fff3d..521d2180d7ab 100644
--- a/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/test/SemaTemplate/instantiate-expr-4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
// ---------------------------------------------------------------------
// C++ Functional Casts
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp
index dbd1e6930382..688d0095267a 100644
--- a/test/SemaTemplate/instantiate-function-1.cpp
+++ b/test/SemaTemplate/instantiate-function-1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
template<typename T, typename U>
struct X0 {
void f(T x, U y) {
diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp
index f1bdf3e1e6d5..74c2609dcd0f 100644
--- a/test/SemaTemplate/instantiate-member-class.cpp
+++ b/test/SemaTemplate/instantiate-member-class.cpp
@@ -1,5 +1,28 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+namespace PR8965 {
+ template<typename T>
+ struct X {
+ typedef int type;
+
+ T field; // expected-note{{in instantiation of member class}}
+ };
+
+ template<typename T>
+ struct Y {
+ struct Inner;
+
+ typedef typename X<Inner>::type // expected-note{{in instantiation of template class}}
+ type; // expected-note{{not-yet-instantiated member is declared here}}
+
+ struct Inner {
+ typedef type field; // expected-error{{no member 'type' in 'PR8965::Y<int>'; it has not yet been instantiated}}
+ };
+ };
+
+ Y<int> y; // expected-note{{in instantiation of template class}}
+}
+
template<typename T>
class X {
public:
diff --git a/test/SemaTemplate/instantiate-member-template.cpp b/test/SemaTemplate/instantiate-member-template.cpp
index e2f72756189c..4c74f5fb938b 100644
--- a/test/SemaTemplate/instantiate-member-template.cpp
+++ b/test/SemaTemplate/instantiate-member-template.cpp
@@ -215,3 +215,47 @@ namespace PR8489 {
c.F(); // expected-error{{no matching member function}}
}
}
+
+namespace rdar8986308 {
+ template <bool> struct __static_assert_test;
+ template <> struct __static_assert_test<true> {};
+ template <unsigned> struct __static_assert_check {};
+
+ namespace std {
+
+ template <class _Tp, class _Up>
+ struct __has_rebind
+ {
+ private:
+ struct __two {char _; char __;};
+ template <class _Xp> static __two __test(...);
+ template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
+ public:
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
+ };
+
+ }
+
+ template <class T> struct B1 {};
+
+ template <class T>
+ struct B
+ {
+ template <class U> struct rebind {typedef B1<U> other;};
+ };
+
+ template <class T, class U> struct D1 {};
+
+ template <class T, class U>
+ struct D
+ {
+ template <class V> struct rebind {typedef D1<V, U> other;};
+ };
+
+ int main()
+ {
+ typedef __static_assert_check<sizeof(__static_assert_test<((std::__has_rebind<B<int>, double>::value))>)> __t64;
+ typedef __static_assert_check<sizeof(__static_assert_test<((std::__has_rebind<D<char, int>, double>::value))>)> __t64;
+ }
+
+}
diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp
index f1ffd06334c3..1c6c26f2586e 100644
--- a/test/SemaTemplate/instantiate-try-catch.cpp
+++ b/test/SemaTemplate/instantiate-try-catch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fexceptions -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -std=c++0x -verify %s
template<typename T> struct TryCatch0 {
void f() {
diff --git a/test/SemaTemplate/issue150.cpp b/test/SemaTemplate/issue150.cpp
new file mode 100644
index 000000000000..af3b93c907c1
--- /dev/null
+++ b/test/SemaTemplate/issue150.cpp
@@ -0,0 +1,107 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Core issue 150: Template template parameters and default arguments
+
+template<typename T, typename U>
+struct is_same {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_same<T, T> {
+ static const bool value = true;
+};
+
+namespace PR9353 {
+ template<class _T, class Traits> class IM;
+
+ template <class T, class Trt,
+ template<class _T, class Traits = int> class IntervalMap>
+ void foo(IntervalMap<T,Trt>* m) { typedef IntervalMap<int> type; }
+
+ void f(IM<int, int>* m) { foo(m); }
+}
+
+namespace PR9400 {
+ template<template <typename T, typename = T > class U> struct A
+ {
+ template<int> U<int> foo();
+ };
+
+ template <typename T, typename = T>
+ struct s {
+ };
+
+ void f() {
+ A<s> x;
+ x.foo<2>();
+ }
+}
+
+namespace MultiReplace {
+ template<typename Z,
+ template<typename T, typename U = T *, typename V = U const> class TT>
+ struct X {
+ typedef TT<Z> type;
+ };
+
+ template<typename T, typename = int, typename = float>
+ struct Y { };
+
+ int check0[is_same<X<int, Y>::type, Y<int, int*, int* const> >::value? 1 : -1];
+}
+
+namespace MultiReplacePartial {
+ template<typename First, typename Z,
+ template<typename T, typename U = T *, typename V = U const> class TT>
+ struct X {
+ typedef TT<Z> type;
+ };
+
+ template<typename Z,
+ template<typename T, typename U = T *, typename V = U const> class TT>
+ struct X<int, Z, TT> {
+ typedef TT<Z> type;
+ };
+
+ template<typename T, typename = int, typename = float>
+ struct Y { };
+
+ int check0[is_same<X<int, int, Y>::type, Y<int, int*, int* const> >::value? 1 : -1];
+}
+
+namespace PR9016 {
+ template<typename > struct allocator ;
+ template<typename > struct less ;
+
+ template<class T, template<class> class Compare, class Default,
+ template<class> class Alloc>
+ struct interval_set { };
+
+ template <class X, template<class> class = less> struct interval_type_default {
+ typedef X type;
+ };
+
+ template <class T,
+ template<class _T, template<class> class Compare = PR9016::less,
+ class = typename interval_type_default<_T,Compare>::type,
+ template<class> class = allocator> class IntervalSet>
+ struct ZZZ
+ {
+ IntervalSet<T> IntervalSetT;
+ };
+
+ template <class T,
+ template<class _T, template<class> class Compare = PR9016::less,
+ class = typename interval_type_default<_T,Compare>::type,
+ template<class> class = allocator> class IntervalSet>
+ void int40()
+ {
+ IntervalSet<T> IntervalSetT;
+ }
+
+ void test() {
+ ZZZ<int, interval_set> zzz;
+ int40<int, interval_set>();
+ }
+}
diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp
index 9c72845fb6a6..635687d4f6b7 100644
--- a/test/SemaTemplate/nested-name-spec-template.cpp
+++ b/test/SemaTemplate/nested-name-spec-template.cpp
@@ -99,3 +99,44 @@ namespace PR7725 {
}
};
}
+
+namespace PR9226 {
+ template<typename a>
+ void nt() // expected-note{{function template 'nt' declared here}}
+ { nt<>:: } // expected-error{{qualified name refers into a specialization of function template 'nt'}} \
+ // expected-error{{expected unqualified-id}}
+
+ template<typename T>
+ void f(T*); // expected-note{{function template 'f' declared here}}
+
+ template<typename T>
+ void f(T*, T*); // expected-note{{function template 'f' declared here}}
+
+ void g() {
+ f<int>:: // expected-error{{qualified name refers into a specialization of function template 'f'}}
+ } // expected-error{{expected unqualified-id}}
+
+ struct X {
+ template<typename T> void f(); // expected-note{{function template 'f' declared here}}
+ };
+
+ template<typename T, typename U>
+ struct Y {
+ typedef typename T::template f<U> type; // expected-error{{template name refers to non-type template 'X::f'}}
+ };
+
+ Y<X, int> yxi; // expected-note{{in instantiation of template class 'PR9226::Y<PR9226::X, int>' requested here}}
+}
+
+namespace PR9449 {
+ template <typename T>
+ struct s; // expected-note{{template is declared here}}
+
+ template <typename T>
+ void f() {
+ int s<T>::template n<T>::* f; // expected-error{{implicit instantiation of undefined template 'PR9449::s<int>'}} \
+ // expected-error{{following the 'template' keyword}}
+ }
+
+ template void f<int>(); // expected-note{{in instantiation of}}
+}
diff --git a/test/SemaTemplate/resolve-single-template-id.cpp b/test/SemaTemplate/resolve-single-template-id.cpp
new file mode 100644
index 000000000000..ef0a76307670
--- /dev/null
+++ b/test/SemaTemplate/resolve-single-template-id.cpp
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+namespace std {
+ class type_info {};
+}
+
+void one() { }
+void two() { } // expected-note 3{{candidate}}
+void two(int) { } // expected-note 3{{candidate}}
+
+template<class T> void twoT() { } // expected-note 5{{candidate}}
+template<class T> void twoT(int) { } // expected-note 5{{candidate}}
+
+template<class T> void oneT() { }
+template<class T, class U> void oneT(U) { }
+/*
+The target can be
+ an object or reference being initialized (8.5, 8.5.3),
+ the left side of an assignment (5.17),
+ a parameter of a function (5.2.2),
+ a parameter of a user-defined operator (13.5),
+ the return value of a function, operator function, or conversion (6.6.3),
+ an explicit type conversion (5.2.3, 5.2.9, 5.4), or
+ a non-type template-parameter (14.3.2)
+*/
+//#include <typeinfo>
+template<void (*p)(int)> struct test { };
+
+int main()
+{
+ one; // expected-warning {{expression result unused}}
+ two; // expected-error {{cannot resolve overloaded function 'two' from context}}
+ oneT<int>; // expected-warning {{expression result unused}}
+ twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ typeid(oneT<int>); // expected-warning{{expression result unused}}
+ sizeof(oneT<int>); // expected-warning {{expression result unused}}
+ sizeof(twoT<int>); //expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ decltype(oneT<int>)* fun = 0;
+
+ *one; // expected-warning {{expression result unused}}
+ *oneT<int>; // expected-warning {{expression result unused}}
+ *two; //expected-error {{cannot resolve overloaded function 'two' from context}}
+ *twoT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ !oneT<int>; // expected-warning {{expression result unused}}
+ +oneT<int>; // expected-warning {{expression result unused}}
+ -oneT<int>; //expected-error {{invalid argument type}}
+ oneT<int> == 0; // expected-warning {{expression result unused}}
+ 0 == oneT<int>; // expected-warning {{expression result unused}}
+ 0 != oneT<int>; // expected-warning {{expression result unused}}
+ (false ? one : oneT<int>); // expected-warning {{expression result unused}}
+ void (*p1)(int); p1 = oneT<int>;
+
+ int i = (int) (false ? (void (*)(int))twoT<int> : oneT<int>); //expected-error {{incompatible operand}}
+ (twoT<int>) == oneT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ bool b = oneT<int>;
+ void (*p)() = oneT<int>;
+ test<oneT<int> > ti;
+ void (*u)(int) = oneT<int>;
+
+ b = (void (*)()) twoT<int>;
+
+ one < one; //expected-warning {{self-comparison always evaluates to false}} \
+ //expected-warning {{expression result unused}}
+
+ oneT<int> < oneT<int>; //expected-warning {{self-comparison always evaluates to false}} \
+ //expected-warning {{expression result unused}}
+
+ two < two; //expected-error {{cannot resolve overloaded function 'two' from context}}
+ twoT<int> < twoT<int>; //expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ oneT<int> == 0; // expected-warning {{expression result unused}}
+
+}
+
+struct rdar9108698 {
+ template<typename> void f();
+};
+
+void test_rdar9108698(rdar9108698 x) {
+ x.f<int>; // expected-error{{a bound member function may only be called}}
+}
diff --git a/test/SemaTemplate/temp_arg_template.cpp b/test/SemaTemplate/temp_arg_template.cpp
index 944acacd8441..9c34089e61f7 100644
--- a/test/SemaTemplate/temp_arg_template.cpp
+++ b/test/SemaTemplate/temp_arg_template.cpp
@@ -30,9 +30,12 @@ template<typename T> void f(int);
A<f> *a9; // expected-error{{must be a class template}}
-// FIXME: The code below is ill-formed, because of the evil digraph '<:'.
-// We should provide a much better error message than we currently do.
-// A<::N::Z> *a10;
+// Evil digraph '<:' is parsed as '[', expect error.
+A<::N::Z> *a10; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+
+// Do not do a digraph correction here.
+A<: :N::Z> *a11; // expected-error{{expected expression}} \
+ expected-error{{C++ requires a type specifier for all declarations}}
// PR7807
namespace N {
diff --git a/test/SemaTemplate/typename-specifier-4.cpp b/test/SemaTemplate/typename-specifier-4.cpp
index 38045e0a31bf..44cf966e33b5 100644
--- a/test/SemaTemplate/typename-specifier-4.cpp
+++ b/test/SemaTemplate/typename-specifier-4.cpp
@@ -154,3 +154,11 @@ namespace rdar8740998 {
xi.f();
}
}
+
+namespace rdar9068589 {
+ // From GCC PR c++/13950
+ template <class T> struct Base {};
+ template <class T> struct Derived: public Base<T> {
+ typename Derived::template Base<double>* p1;
+ };
+}
diff --git a/test/lit.cfg b/test/lit.cfg
index 6567c6d229cb..4b9d529b7d26 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -24,7 +24,8 @@ if platform.system() == 'Windows':
#
# For now we require '&&' between commands, until they get globally killed and
# the test runner updated.
-execute_external = platform.system() != 'Windows'
+execute_external = (platform.system() != 'Windows'
+ or lit.getBashPath() not in [None, ""])
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
@@ -137,7 +138,7 @@ def inferClang(PATH):
if lit.useValgrind:
config.target_triple += '-vg'
-config.clang = inferClang(config.environment['PATH'])
+config.clang = inferClang(config.environment['PATH']).replace('\\', '/')
if not lit.quiet:
lit.note('using clang: %r' % config.clang)
config.substitutions.append( ('%clang_cc1', config.clang + ' -cc1') )
@@ -166,3 +167,7 @@ config.substitutions.append(
# Set available features we allow tests to conditionalize on.
if platform.system() != 'Windows':
config.available_features.add('crash-recovery')
+
+# Shell execution
+if platform.system() not in ['Windows'] or lit.getBashPath() != '':
+ config.available_features.add('shell')