aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
commitbca07a4524feb4edec581062d631a13116320a24 (patch)
treea9243275843fbeaa590afc07ee888e006b8d54ea /test
parent998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff)
downloadsrc-bca07a4524feb4edec581062d631a13116320a24.tar.gz
src-bca07a4524feb4edec581062d631a13116320a24.zip
Vendor import of clang trunk r126079:vendor/clang/clang-r126079
Notes
Notes: svn path=/vendor/clang/dist/; revision=218887 svn path=/vendor/clang/clang-r126079/; revision=218888; tag=vendor/clang/clang-r126079
Diffstat (limited to 'test')
-rw-r--r--test/ASTMerge/Inputs/category1.m23
-rw-r--r--test/ASTMerge/Inputs/category2.m22
-rw-r--r--test/ASTMerge/Inputs/class-template1.cpp34
-rw-r--r--test/ASTMerge/Inputs/class-template2.cpp35
-rw-r--r--test/ASTMerge/Inputs/class1.cpp7
-rw-r--r--test/ASTMerge/Inputs/class2.cpp1
-rw-r--r--test/ASTMerge/Inputs/interface1.m22
-rw-r--r--test/ASTMerge/Inputs/interface2.m20
-rw-r--r--test/ASTMerge/Inputs/property1.m19
-rw-r--r--test/ASTMerge/Inputs/property2.m20
-rw-r--r--test/ASTMerge/category.m4
-rw-r--r--test/ASTMerge/class-template.cpp24
-rw-r--r--test/ASTMerge/interface.m5
-rw-r--r--test/ASTMerge/property.m6
-rw-r--r--test/Analysis/CFNumber.c8
-rw-r--r--test/Analysis/MissingDealloc.m2
-rw-r--r--test/Analysis/NSString.m16
-rw-r--r--test/Analysis/NSWindow.m8
-rw-r--r--test/Analysis/ObjCRetSigs.m2
-rw-r--r--test/Analysis/PR2978.m2
-rw-r--r--test/Analysis/additive-folding.c8
-rw-r--r--test/Analysis/analyzer-stats.c14
-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.cpp835
-rw-r--r--test/Analysis/base-init.cpp30
-rw-r--r--test/Analysis/blocks.m4
-rw-r--r--test/Analysis/bstring.c8
-rw-r--r--test/Analysis/chroot.c24
-rw-r--r--test/Analysis/complex.c8
-rw-r--r--test/Analysis/conditional-op-missing-lhs.c2
-rw-r--r--test/Analysis/constant-folding.c2
-rw-r--r--test/Analysis/cxx-crashes.cpp45
-rw-r--r--test/Analysis/dead-stores.c68
-rw-r--r--test/Analysis/dead-stores.cpp28
-rw-r--r--test/Analysis/dead-stores.m37
-rw-r--r--test/Analysis/derived-to-base.cpp15
-rw-r--r--test/Analysis/dtor.cpp13
-rw-r--r--test/Analysis/dtors-in-dtor-cfg-output.cpp60
-rw-r--r--test/Analysis/exercise-ps.c2
-rw-r--r--test/Analysis/fields.c10
-rw-r--r--test/Analysis/idempotent-operations-limited-loops.c21
-rw-r--r--test/Analysis/idempotent-operations.c49
-rw-r--r--test/Analysis/idempotent-operations.cpp2
-rw-r--r--test/Analysis/idempotent-operations.m42
-rw-r--r--test/Analysis/initializer.cpp14
-rw-r--r--test/Analysis/initializers-cfg-output.cpp94
-rw-r--r--test/Analysis/inline.c16
-rw-r--r--test/Analysis/lvalue.cpp6
-rw-r--r--test/Analysis/malloc.c2
-rw-r--r--test/Analysis/method-call.cpp25
-rw-r--r--test/Analysis/misc-ps-64.m2
-rw-r--r--test/Analysis/misc-ps-region-store.cpp81
-rw-r--r--test/Analysis/misc-ps-region-store.m113
-rw-r--r--test/Analysis/misc-ps.m191
-rw-r--r--test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m38
-rw-r--r--test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m32
-rw-r--r--test/Analysis/null-deref-ps.c18
-rw-r--r--test/Analysis/operator-calls.cpp16
-rw-r--r--test/Analysis/out-of-bounds.c148
-rw-r--r--test/Analysis/outofbound.c2
-rw-r--r--test/Analysis/plist-output-alternate.m1014
-rw-r--r--test/Analysis/plist-output.m1
-rw-r--r--test/Analysis/properties.m145
-rw-r--r--test/Analysis/ptr-arith.c4
-rw-r--r--test/Analysis/rdar-6442306-1.m2
-rw-r--r--test/Analysis/rdar-6540084.m2
-rw-r--r--test/Analysis/refcnt_naming.m29
-rw-r--r--test/Analysis/reference.cpp3
-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.m106
-rw-r--r--test/Analysis/security-syntax-checks-no-emit.c2
-rw-r--r--test/Analysis/security-syntax-checks.m2
-rw-r--r--test/Analysis/self-init.m165
-rw-r--r--test/Analysis/sizeofpointer.c2
-rw-r--r--test/Analysis/stack-addr-ps.c4
-rw-r--r--test/Analysis/stack-addr-ps.cpp86
-rw-r--r--test/Analysis/stackaddrleak.c2
-rw-r--r--test/Analysis/stream.c8
-rw-r--r--test/Analysis/string.c8
-rw-r--r--test/Analysis/temp-obj-dtors-cfg-output.cpp591
-rw-r--r--test/Analysis/uninit-msg-expr.m4
-rw-r--r--test/Analysis/uninit-ps-rdar6145427.m2
-rw-r--r--test/Analysis/uninit-vals-ps-region.m2
-rw-r--r--test/Analysis/uninit-vals-ps.c2
-rw-r--r--test/Analysis/uninit-vals.c2
-rw-r--r--test/Analysis/unix-fns.c21
-rw-r--r--test/Analysis/unreachable-code-path.c26
-rw-r--r--test/Analysis/unused-ivars.m14
-rw-r--r--test/CMakeLists.txt70
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp2
-rw-r--r--test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp24
-rw-r--r--test/CXX/basic/basic.start/basic.start.main/p2h.cpp5
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp41
-rw-r--r--test/CXX/class.access/class.friend/p11.cpp19
-rw-r--r--test/CXX/class.access/p4.cpp62
-rw-r--r--test/CXX/class.access/p6.cpp29
-rw-r--r--test/CXX/class.derived/class.abstract/p4.cpp4
-rw-r--r--test/CXX/class.derived/class.abstract/p5.cpp10
-rw-r--r--test/CXX/class.derived/class.member.lookup/p9.cpp28
-rw-r--r--test/CXX/class.derived/class.virtual/p3-0x.cpp53
-rw-r--r--test/CXX/class.derived/p8-0x.cpp22
-rw-r--r--test/CXX/class/class.friend/p1.cpp3
-rw-r--r--test/CXX/class/class.mem/p1.cpp27
-rw-r--r--test/CXX/class/class.mem/p13.cpp40
-rw-r--r--test/CXX/class/class.mem/p14.cpp19
-rw-r--r--test/CXX/class/class.mem/p1b.cpp46
-rw-r--r--test/CXX/class/class.mem/p8-0x-pedantic.cpp14
-rw-r--r--test/CXX/class/class.mem/p8-0x.cpp55
-rw-r--r--test/CXX/class/class.nest/p1-cxx0x.cpp14
-rw-r--r--test/CXX/class/class.nest/p1.cpp6
-rw-r--r--test/CXX/class/class.union/p1.cpp8
-rw-r--r--test/CXX/class/p1-0x.cpp10
-rw-r--r--test/CXX/class/p2-0x.cpp28
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp27
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp24
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp1
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp31
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp35
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp73
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp86
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp23
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp164
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp24
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp20
-rw-r--r--test/CXX/dcl.decl/dcl.init/p6.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp1
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp14
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp48
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp31
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp5
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp28
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp14
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8.cpp10
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp26
-rw-r--r--test/CXX/dcl.decl/p4-0x.cpp8
-rw-r--r--test/CXX/except/except.handle/p16.cpp2
-rw-r--r--test/CXX/except/except.spec/p14-ir.cpp14
-rw-r--r--test/CXX/expr/expr.cast/p4-0x.cpp11
-rw-r--r--test/CXX/expr/expr.cast/p4.cpp23
-rw-r--r--test/CXX/expr/expr.mptr.oper/p5.cpp61
-rw-r--r--test/CXX/expr/expr.mptr.oper/p6-0x.cpp34
-rw-r--r--test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp17
-rw-r--r--test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp14
-rw-r--r--test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp16
-rw-r--r--test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp24
-rw-r--r--test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp29
-rw-r--r--test/CXX/expr/expr.unary/expr.delete/p5.cpp22
-rw-r--r--test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp23
-rw-r--r--test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp38
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp26
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp172
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h8
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.op/p4.cpp6
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.op/p6.cpp36
-rw-r--r--test/CXX/over/over.built/p1.cpp16
-rw-r--r--test/CXX/over/over.built/p25.cpp15
-rw-r--r--test/CXX/over/over.load/p2-0x.cpp24
-rw-r--r--test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp59
-rw-r--r--test/CXX/over/over.match/over.match.funcs/p4-0x.cpp70
-rw-r--r--test/CXX/over/over.over/p2-resolve-single-template-id.cpp95
-rw-r--r--test/CXX/over/over.over/p2.cpp5
-rw-r--r--test/CXX/over/over.over/p4.cpp7
-rw-r--r--test/CXX/special/class.copy/p33-0x.cpp25
-rw-r--r--test/CXX/special/class.copy/p9.cpp24
-rw-r--r--test/CXX/special/class.ctor/p4-0x.cpp7
-rw-r--r--test/CXX/special/class.dtor/p2-0x.cpp10
-rw-r--r--test/CXX/special/class.inhctor/elsewhere.cpp31
-rw-r--r--test/CXX/special/class.inhctor/p3.cpp30
-rw-r--r--test/CXX/special/class.inhctor/p7.cpp18
-rw-r--r--test/CXX/stmt.stmt/stmt.label/p1.cpp25
-rw-r--r--test/CXX/stmt.stmt/stmt.select/p3.cpp2
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp16
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp40
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.type/p2.cpp42
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p6.cpp21
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp8
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp13
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p9.cpp26
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp17
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp16
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p1.cpp39
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p5.cpp106
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p8.cpp6
-rw-r--r--test/CXX/temp/temp.decls/temp.mem/p3.cpp6
-rw-r--r--test/CXX/temp/temp.decls/temp.mem/p5.cpp6
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/deduction.cpp50
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp352
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/example-function.cpp86
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp260
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp39
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp75
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp274
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp218
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p1.cpp9
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p2.cpp22
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p4.cpp135
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p5.cpp393
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp34
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp61
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp27
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp68
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp88
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp46
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp22
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp31
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp27
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp10
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp4
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp23
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp31
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp14
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp22
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp47
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp55
-rw-r--r--test/CXX/temp/temp.param/p1.cpp12
-rw-r--r--test/CXX/temp/temp.param/p11-0x.cpp61
-rw-r--r--test/CXX/temp/temp.param/p15-cxx0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p9-0x.cpp52
-rw-r--r--test/CXX/temp/temp.param/p9.cpp4
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp239
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp14
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p12.cpp2
-rw-r--r--test/CodeCompletion/ordinary-name.c3
-rw-r--r--test/CodeCompletion/ordinary-name.cpp2
-rw-r--r--test/CodeCompletion/stdin.c7
-rw-r--r--test/CodeGen/2008-07-17-no-emit-on-error.c1
-rw-r--r--test/CodeGen/2008-07-29-override-alias-decl.c2
-rw-r--r--test/CodeGen/2010-03-09-DbgInfo.c2
-rw-r--r--test/CodeGen/annotate.c2
-rw-r--r--test/CodeGen/arm-vector-arguments.c30
-rw-r--r--test/CodeGen/asm-errors.c2
-rw-r--r--test/CodeGen/asm-inout.c12
-rw-r--r--test/CodeGen/asm-variable.c59
-rw-r--r--test/CodeGen/assign.c6
-rw-r--r--test/CodeGen/atomic.c130
-rw-r--r--test/CodeGen/attr-naked.c9
-rw-r--r--test/CodeGen/blocks-1.c28
-rw-r--r--test/CodeGen/blocks.c7
-rw-r--r--test/CodeGen/blocksignature.c12
-rw-r--r--test/CodeGen/blockstret.c2
-rw-r--r--test/CodeGen/blockwithlocalstatic.c19
-rw-r--r--test/CodeGen/bool_test.c5
-rw-r--r--test/CodeGen/builtins-ppc-altivec.c1029
-rw-r--r--test/CodeGen/builtins-x86.c1
-rw-r--r--test/CodeGen/char-literal.c35
-rw-r--r--test/CodeGen/conditional-gnu-ext.c24
-rw-r--r--test/CodeGen/const-init.c2
-rw-r--r--test/CodeGen/darwin-string-literals.c12
-rw-r--r--test/CodeGen/debug-info-crash.c9
-rw-r--r--test/CodeGen/debug-info-line.c15
-rw-r--r--test/CodeGen/debug-info-var-location.c21
-rw-r--r--test/CodeGen/designated-initializers.c33
-rw-r--r--test/CodeGen/enum.c3
-rw-r--r--test/CodeGen/exceptions.c19
-rw-r--r--test/CodeGen/exprs.c26
-rw-r--r--test/CodeGen/frame-pointer-elim.c29
-rw-r--r--test/CodeGen/func-in-block.c2
-rw-r--r--test/CodeGen/illegal-UTF8.m4
-rw-r--r--test/CodeGen/imaginary.c4
-rw-r--r--test/CodeGen/init.c69
-rw-r--r--test/CodeGen/integer-overflow.c7
-rw-r--r--test/CodeGen/lineno-dbginfo.c2
-rw-r--r--test/CodeGen/mangle.c6
-rw-r--r--test/CodeGen/may-alias.c21
-rw-r--r--test/CodeGen/mcount.c4
-rw-r--r--test/CodeGen/mms-bitfields.c22
-rw-r--r--test/CodeGen/mmx-builtins.c452
-rw-r--r--test/CodeGen/mmx-shift-with-immediate.c23
-rw-r--r--test/CodeGen/ms-anonymous-struct.c99
-rw-r--r--test/CodeGen/mult-alt-generic.c283
-rw-r--r--test/CodeGen/mult-alt-x86.c374
-rw-r--r--test/CodeGen/no-common.c17
-rw-r--r--test/CodeGen/packed-structure.c13
-rw-r--r--test/CodeGen/palignr.c6
-rw-r--r--test/CodeGen/pascal-wchar-string.c12
-rw-r--r--test/CodeGen/pointer-arithmetic.c3
-rw-r--r--test/CodeGen/pointer-signext.c32
-rw-r--r--test/CodeGen/pragma-weak.c2
-rw-r--r--test/CodeGen/predefined-expr.c16
-rw-r--r--test/CodeGen/regparm-flag.c15
-rw-r--r--test/CodeGen/regparm.c5
-rw-r--r--test/CodeGen/sizeof-vla.c2
-rw-r--r--test/CodeGen/statements.c2
-rw-r--r--test/CodeGen/string-literal-short-wstring.c43
-rw-r--r--test/CodeGen/string-literal.c11
-rw-r--r--test/CodeGen/struct-init.c13
-rw-r--r--test/CodeGen/struct-passing.c20
-rw-r--r--test/CodeGen/switch.c17
-rw-r--r--test/CodeGen/thread-specifier.c10
-rw-r--r--test/CodeGen/transparent-union.c25
-rw-r--r--test/CodeGen/va_list_test.c6
-rw-r--r--test/CodeGen/visibility.c77
-rw-r--r--test/CodeGen/vla.c65
-rw-r--r--test/CodeGen/volatile-1.c216
-rw-r--r--test/CodeGen/volatile-2.c23
-rw-r--r--test/CodeGen/x86_32-arguments-darwin.c (renamed from test/CodeGen/x86_32-arguments.c)62
-rw-r--r--test/CodeGen/x86_32-arguments-linux.c51
-rw-r--r--test/CodeGen/x86_32-arguments-realign.c11
-rw-r--r--test/CodeGenCXX/PR5050-constructor-conversion.cpp2
-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.cpp35
-rw-r--r--test/CodeGenCXX/apple-kext-indirect-call-2.C77
-rw-r--r--test/CodeGenCXX/apple-kext-indirect-call.C14
-rw-r--r--test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp19
-rw-r--r--test/CodeGenCXX/apple-kext-linkage.C25
-rw-r--r--test/CodeGenCXX/apple-kext-no-staticinit-section.C20
-rw-r--r--test/CodeGenCXX/arm.cpp79
-rw-r--r--test/CodeGenCXX/array-construction.cpp2
-rw-r--r--test/CodeGenCXX/array-operator-delete-call.cpp2
-rw-r--r--test/CodeGenCXX/array-value-initialize.cpp2
-rw-r--r--test/CodeGenCXX/asm.cpp14
-rw-r--r--test/CodeGenCXX/attr-used.cpp9
-rw-r--r--test/CodeGenCXX/attr.cpp2
-rw-r--r--test/CodeGenCXX/block-byref-cxx-objc.cpp25
-rw-r--r--test/CodeGenCXX/blocks.cpp57
-rw-r--r--test/CodeGenCXX/builtins.cpp9
-rw-r--r--test/CodeGenCXX/c99-variable-length-array.cpp2
-rw-r--r--test/CodeGenCXX/call-arg-zero-temp.cpp2
-rw-r--r--test/CodeGenCXX/cast-conversion.cpp12
-rw-r--r--test/CodeGenCXX/class-layout.cpp24
-rw-r--r--test/CodeGenCXX/const-init.cpp12
-rw-r--r--test/CodeGenCXX/constructor-attr.cpp12
-rw-r--r--test/CodeGenCXX/constructor-conversion.cpp6
-rw-r--r--test/CodeGenCXX/constructor-convert.cpp2
-rw-r--r--test/CodeGenCXX/constructor-default-arg.cpp6
-rw-r--r--test/CodeGenCXX/constructor-direct-call.cpp60
-rw-r--r--test/CodeGenCXX/constructor-for-array-members.cpp2
-rw-r--r--test/CodeGenCXX/constructor-init.cpp34
-rw-r--r--test/CodeGenCXX/constructors.cpp20
-rw-r--r--test/CodeGenCXX/convert-to-fptr.cpp4
-rw-r--r--test/CodeGenCXX/copy-constructor-elim-2.cpp24
-rw-r--r--test/CodeGenCXX/copy-constructor-synthesis-2.cpp2
-rw-r--r--test/CodeGenCXX/copy-constructor-synthesis.cpp4
-rw-r--r--test/CodeGenCXX/cxx-block-objects.cpp33
-rw-r--r--test/CodeGenCXX/debug-info-ctor2.cpp15
-rw-r--r--test/CodeGenCXX/debug-info-large-constant.cpp8
-rw-r--r--test/CodeGenCXX/debug-info-member.cpp6
-rw-r--r--test/CodeGenCXX/debug-info-method.cpp6
-rw-r--r--test/CodeGenCXX/debug-info-namespace.cpp12
-rw-r--r--test/CodeGenCXX/debug-info-template.cpp15
-rw-r--r--test/CodeGenCXX/decl-ref-init.cpp4
-rw-r--r--test/CodeGenCXX/default-arg-temps.cpp2
-rw-r--r--test/CodeGenCXX/default-arguments.cpp4
-rw-r--r--test/CodeGenCXX/default-constructor-for-members.cpp2
-rw-r--r--test/CodeGenCXX/default-constructor-template-member.cpp2
-rw-r--r--test/CodeGenCXX/delete-two-arg.cpp70
-rw-r--r--test/CodeGenCXX/delete.cpp9
-rw-r--r--test/CodeGenCXX/derived-to-base-conv.cpp4
-rw-r--r--test/CodeGenCXX/derived-to-base.cpp11
-rw-r--r--test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp16
-rw-r--r--test/CodeGenCXX/destructors.cpp54
-rw-r--r--test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp51
-rw-r--r--test/CodeGenCXX/dyncast.cpp1
-rw-r--r--test/CodeGenCXX/eh.cpp88
-rw-r--r--test/CodeGenCXX/empty-classes.cpp13
-rw-r--r--test/CodeGenCXX/exceptions-no-rtti.cpp10
-rw-r--r--test/CodeGenCXX/exceptions.cpp303
-rw-r--r--test/CodeGenCXX/friend-redecl.cpp18
-rw-r--r--test/CodeGenCXX/global-init.cpp17
-rw-r--r--test/CodeGenCXX/gnu-conditional-scalar-ext.cpp62
-rw-r--r--test/CodeGenCXX/goto.cpp43
-rw-r--r--test/CodeGenCXX/implicit-copy-constructor.cpp2
-rw-r--r--test/CodeGenCXX/inline-functions.cpp32
-rw-r--r--test/CodeGenCXX/internal-linkage.cpp4
-rw-r--r--test/CodeGenCXX/key-function-vtable.cpp13
-rw-r--r--test/CodeGenCXX/mangle-abi-examples.cpp27
-rw-r--r--test/CodeGenCXX/mangle-local-class-vtables.cpp61
-rw-r--r--test/CodeGenCXX/mangle-local-classes-nested.cpp81
-rw-r--r--test/CodeGenCXX/mangle-ms.cpp8
-rw-r--r--test/CodeGenCXX/mangle-neon-vectors.cpp32
-rw-r--r--test/CodeGenCXX/mangle-ref-qualifiers.cpp16
-rw-r--r--test/CodeGenCXX/mangle-subst-std.cpp16
-rw-r--r--test/CodeGenCXX/mangle-template.cpp2
-rw-r--r--test/CodeGenCXX/mangle-unnamed.cpp21
-rw-r--r--test/CodeGenCXX/mangle-variadic-templates.cpp67
-rw-r--r--test/CodeGenCXX/mangle.cpp23
-rw-r--r--test/CodeGenCXX/member-functions.cpp4
-rw-r--r--test/CodeGenCXX/member-init-assignment.cpp2
-rw-r--r--test/CodeGenCXX/member-pointer-type-convert.cpp1
-rw-r--r--test/CodeGenCXX/member-templates.cpp4
-rw-r--r--test/CodeGenCXX/nrvo-noreturn.cc17
-rw-r--r--test/CodeGenCXX/nrvo.cpp15
-rw-r--r--test/CodeGenCXX/nullptr.cpp9
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp59
-rw-r--r--test/CodeGenCXX/pr9130.cpp14
-rw-r--r--test/CodeGenCXX/pragma-pack.cpp14
-rw-r--r--test/CodeGenCXX/pragma-visibility.cpp4
-rw-r--r--test/CodeGenCXX/predefined-expr.cpp106
-rw-r--r--test/CodeGenCXX/ptr-to-member-function.cpp4
-rw-r--r--test/CodeGenCXX/rtti-fundamental.cpp157
-rw-r--r--test/CodeGenCXX/rtti-linkage.cpp102
-rw-r--r--test/CodeGenCXX/rtti-visibility.cpp35
-rw-r--r--test/CodeGenCXX/rvalue-references.cpp85
-rw-r--r--test/CodeGenCXX/specialized-static-data-mem-init.cpp29
-rw-r--r--test/CodeGenCXX/static-data-member.cpp70
-rw-r--r--test/CodeGenCXX/static-init.cpp2
-rw-r--r--test/CodeGenCXX/stmtexpr.cpp75
-rw-r--r--test/CodeGenCXX/template-anonymous-types.cpp4
-rw-r--r--test/CodeGenCXX/template-dependent-bind-temporary.cpp24
-rw-r--r--test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp24
-rw-r--r--test/CodeGenCXX/template-instantiation.cpp51
-rw-r--r--test/CodeGenCXX/template-linkage.cpp2
-rw-r--r--test/CodeGenCXX/temporaries.cpp185
-rw-r--r--test/CodeGenCXX/threadsafe-statics-exceptions.cpp4
-rw-r--r--test/CodeGenCXX/throw-expressions.cpp7
-rw-r--r--test/CodeGenCXX/thunks-available-externally.cpp88
-rw-r--r--test/CodeGenCXX/thunks.cpp63
-rw-r--r--test/CodeGenCXX/value-init.cpp15
-rw-r--r--test/CodeGenCXX/variadic-templates.cpp12
-rw-r--r--test/CodeGenCXX/virt-dtor-gen.cpp2
-rw-r--r--test/CodeGenCXX/virt-dtor-key.cpp2
-rw-r--r--test/CodeGenCXX/virt-template-vtable.cpp8
-rw-r--r--test/CodeGenCXX/virtual-base-destructor-call.cpp12
-rw-r--r--test/CodeGenCXX/virtual-bases.cpp12
-rw-r--r--test/CodeGenCXX/virtual-destructor-calls.cpp6
-rw-r--r--test/CodeGenCXX/visibility-inlines-hidden.cpp46
-rw-r--r--test/CodeGenCXX/visibility.cpp331
-rw-r--r--test/CodeGenCXX/volatile-1.cpp352
-rw-r--r--test/CodeGenCXX/volatile.cpp2
-rw-r--r--test/CodeGenCXX/vtable-available-externally.cpp171
-rw-r--r--test/CodeGenCXX/vtable-debug-info.cpp318
-rw-r--r--test/CodeGenCXX/vtable-key-function.cpp2
-rw-r--r--test/CodeGenCXX/vtable-layout.cpp2
-rw-r--r--test/CodeGenCXX/vtable-linkage.cpp95
-rw-r--r--test/CodeGenCXX/vtable-pointer-initialization.cpp10
-rw-r--r--test/CodeGenCXX/vtt-layout.cpp8
-rw-r--r--test/CodeGenCXX/warn-padded-packed.cpp76
-rw-r--r--test/CodeGenObjC/arm-atomic-scalar-setter-getter.m13
-rw-r--r--test/CodeGenObjC/bitfield-gnu.m5
-rw-r--r--test/CodeGenObjC/block-6.m12
-rw-r--r--test/CodeGenObjC/block-var-layout.m101
-rw-r--r--test/CodeGenObjC/blocks-1.m8
-rw-r--r--test/CodeGenObjC/blocks-2.m37
-rw-r--r--test/CodeGenObjC/blocks.m56
-rw-r--r--test/CodeGenObjC/constant-string-class.m35
-rw-r--r--test/CodeGenObjC/debug-info-default-synth-ivar.m35
-rw-r--r--test/CodeGenObjC/debug-info-fnname.m15
-rw-r--r--test/CodeGenObjC/debug-info-foreach.m13
-rw-r--r--test/CodeGenObjC/debug-info-getter-name.m50
-rw-r--r--test/CodeGenObjC/debug-info-selector.m15
-rw-r--r--test/CodeGenObjC/debug-info-self.m16
-rw-r--r--test/CodeGenObjC/debug-info-static-var.m23
-rw-r--r--test/CodeGenObjC/default-property-synthesis.m2
-rw-r--r--test/CodeGenObjC/encode-test-1.m36
-rw-r--r--test/CodeGenObjC/encode-test.m61
-rw-r--r--test/CodeGenObjC/exceptions-nonfragile.m17
-rw-r--r--test/CodeGenObjC/exceptions.m62
-rw-r--r--test/CodeGenObjC/implicit-objc_msgSend.m2
-rw-r--r--test/CodeGenObjC/interface-layout-64.m4
-rw-r--r--test/CodeGenObjC/ivar-layout-64-bitfields.m5
-rw-r--r--test/CodeGenObjC/ivar-layout-array0-struct.m22
-rw-r--r--test/CodeGenObjC/ivar-layout-nonfragile-abi2.m4
-rw-r--r--test/CodeGenObjC/ivars.m15
-rw-r--r--test/CodeGenObjC/local-static-block.m57
-rw-r--r--test/CodeGenObjC/ns-constant-strings.m6
-rw-r--r--test/CodeGenObjC/objc-read-weak-byref.m4
-rw-r--r--test/CodeGenObjC/objc2-nonfragile-abi-impl.m2
-rw-r--r--test/CodeGenObjC/objc2-weak-block-call.m13
-rw-r--r--test/CodeGenObjC/predefined-expr.m20
-rw-r--r--test/CodeGenObjC/property-ref-cast-to-void.m18
-rw-r--r--test/CodeGenObjC/property-type-mismatch.m17
-rw-r--r--test/CodeGenObjC/property.m55
-rw-r--r--test/CodeGenObjCXX/block-var-layout.mm157
-rw-r--r--test/CodeGenObjCXX/blocks.mm30
-rw-r--r--test/CodeGenObjCXX/encode.mm12
-rw-r--r--test/CodeGenObjCXX/implicit-copy-constructor.mm2
-rw-r--r--test/CodeGenObjCXX/property-derived-to-base-conv.mm10
-rw-r--r--test/CodeGenObjCXX/property-dot-copy.mm68
-rw-r--r--test/CodeGenObjCXX/property-dot-reference.mm62
-rw-r--r--test/CodeGenObjCXX/property-object-conditional-exp.mm38
-rw-r--r--test/CodeGenObjCXX/property-objects.mm19
-rw-r--r--test/CodeGenObjCXX/refence-assign-write-barrier.mm20
-rw-r--r--test/CodeGenObjCXX/rtti.mm14
-rw-r--r--test/CodeGenObjCXX/write-barrier-global-assign.mm29
-rw-r--r--test/CodeGenOpenCL/ext-vector-shuffle.cl (renamed from test/CodeGen/ext-vector-shuffle.c)6
-rw-r--r--test/CodeGenOpenCL/kernel-metadata.cl10
-rw-r--r--test/CodeGenOpenCL/single-precision-constant.cl7
-rw-r--r--test/Coverage/c-language-features.inc8
-rw-r--r--test/Coverage/cxx-language-features.inc6
-rw-r--r--test/Coverage/html-diagnostics.c5
-rw-r--r--test/Coverage/targets.c1
-rw-r--r--test/Driver/apple-kext-mkernel.c6
-rw-r--r--test/Driver/clang_f_opts.c6
-rw-r--r--test/Driver/darwin-ld.c22
-rw-r--r--test/Driver/darwin-xarch.c12
-rw-r--r--test/Driver/dragonfly.c1
-rw-r--r--test/Driver/emit-llvm.c3
-rw-r--r--test/Driver/freebsd.c6
-rw-r--r--test/Driver/m_and_mm.c3
-rw-r--r--test/Driver/openbsd.c1
-rw-r--r--test/Driver/sysroot-flags.c28
-rw-r--r--test/FixIt/fixit-errors.c2
-rw-r--r--test/FixIt/fixit-objc-message.m38
-rw-r--r--test/FixIt/fixit-objc.m32
-rw-r--r--test/FixIt/fixit-unrecoverable.cpp3
-rw-r--r--test/FixIt/fixit.c7
-rw-r--r--test/FixIt/fixit.cpp27
-rw-r--r--test/FixIt/typo.cpp1
-rw-r--r--test/FixIt/typo.m25
-rw-r--r--test/Headers/arm-neon-header.c5
-rw-r--r--test/Headers/stdbool.cpp14
-rw-r--r--test/Headers/x86-intrinsics-headers.c10
-rw-r--r--test/Index/Inputs/a.h4
-rw-r--r--test/Index/Inputs/b.h1
-rw-r--r--test/Index/Inputs/get-cursor-includes-1.h6
-rw-r--r--test/Index/Inputs/get-cursor-includes-2.h2
-rw-r--r--test/Index/TestClassDecl.m6
-rw-r--r--test/Index/TestClassForwardDecl.m6
-rw-r--r--test/Index/annotate-tokens-cxx0x.cpp8
-rw-r--r--test/Index/annotate-tokens-include.c5
-rw-r--r--test/Index/annotate-tokens-pp.c100
-rw-r--r--test/Index/annotate-tokens.c23
-rw-r--r--test/Index/annotate-tokens.cpp14
-rw-r--r--test/Index/annotate-tokens.m235
-rw-r--r--test/Index/blocks.c41
-rw-r--r--test/Index/c-index-api-loadTU-test.m5
-rw-r--r--test/Index/c-index-getCursor-pp.c27
-rw-r--r--test/Index/c-index-getCursor-test.m10
-rw-r--r--test/Index/c-index-redecls.c107
-rw-r--r--test/Index/cindex-on-invalid-usrs.m7
-rw-r--r--test/Index/code-complete-errors.c16
-rw-r--r--test/Index/code-completion.cpp20
-rw-r--r--test/Index/complete-at-directives.m14
-rw-r--r--test/Index/complete-at-exprstmt.m16
-rw-r--r--test/Index/complete-blocks.m37
-rw-r--r--test/Index/complete-ctor-inits.cpp26
-rw-r--r--test/Index/complete-declarators.cpp32
-rw-r--r--test/Index/complete-declarators.m55
-rw-r--r--test/Index/complete-driver-errors.c24
-rw-r--r--test/Index/complete-enums.c23
-rw-r--r--test/Index/complete-exprs.c42
-rw-r--r--test/Index/complete-exprs.cpp53
-rw-r--r--test/Index/complete-exprs.m29
-rw-r--r--test/Index/complete-hiding.c19
-rw-r--r--test/Index/complete-kvc.m87
-rw-r--r--test/Index/complete-macros.c4
-rw-r--r--test/Index/complete-member-access.m4
-rw-r--r--test/Index/complete-memfunc-cvquals.cpp40
-rw-r--r--test/Index/complete-method-decls.m163
-rw-r--r--test/Index/complete-objc-message-id.m30
-rw-r--r--test/Index/complete-objc-message.m113
-rw-r--r--test/Index/complete-preprocessor.m96
-rw-r--r--test/Index/complete-properties.m21
-rw-r--r--test/Index/complete-protocols.m4
-rw-r--r--test/Index/complete-recovery.m16
-rw-r--r--test/Index/complete-super.cpp10
-rw-r--r--test/Index/complete-super.m44
-rw-r--r--test/Index/complete-synthesized.m56
-rw-r--r--test/Index/complete-templates.cpp2
-rw-r--r--test/Index/complete-type-factors.m146
-rw-r--r--test/Index/crash-recovery-code-complete.c3
-rw-r--r--test/Index/crash-recovery-reparse.c3
-rw-r--r--test/Index/fix-its.c18
-rw-r--r--test/Index/get-cursor-includes.c7
-rw-r--r--test/Index/get-cursor.cpp63
-rw-r--r--test/Index/index-templates.cpp76
-rw-r--r--test/Index/load-decls.c1
-rw-r--r--test/Index/load-exprs.c32
-rw-r--r--test/Index/load-namespaces.cpp2
-rw-r--r--test/Index/load-stmts.cpp99
-rw-r--r--test/Index/local-symbols.m2
-rw-r--r--test/Index/nested-binaryoperators.cpp1982
-rw-r--r--test/Index/overrides.cpp20
-rw-r--r--test/Index/overrides.m35
-rw-r--r--test/Index/preamble-reparse-chained.c10
-rw-r--r--test/Index/preamble.c6
-rw-r--r--test/Index/print-display-names.cpp20
-rw-r--r--test/Index/print-typekind.c10
-rw-r--r--test/Index/properties-class-extensions.m95
-rw-r--r--test/Index/recursive-cxx-member-calls.cpp2246
-rw-r--r--test/Index/recursive-member-access.c532
-rw-r--r--test/Index/remap-complete.c6
-rw-r--r--test/Index/remap-cursor-at.c1
-rw-r--r--test/Index/remap-load.c4
-rw-r--r--test/Index/retain-target-options.c8
-rw-r--r--test/Index/usrs-cxx0x.cpp8
-rw-r--r--test/Index/usrs.m154
-rw-r--r--test/Index/warning-flags.c16
-rw-r--r--test/Lexer/11-27-2007-FloatLiterals.c2
-rw-r--r--test/Lexer/c90.c5
-rw-r--r--test/Lexer/char-escapes.c1
-rw-r--r--test/Lexer/clang-keywords.cpp3
-rw-r--r--test/Lexer/constants.c8
-rw-r--r--test/Lexer/cxx0x_keyword_as_cxx98.cpp3
-rw-r--r--test/Lexer/digraph.c2
-rw-r--r--test/Lexer/has_attribute.cpp12
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp58
-rw-r--r--test/Lexer/has_feature_type_traits.cpp91
-rw-r--r--test/Lexer/ms-extensions.c1
-rw-r--r--test/Lexer/pragma-message.c14
-rw-r--r--test/Lexer/pragma-operators.cpp20
-rw-r--r--test/Lexer/preamble.c1
-rw-r--r--test/Lexer/rdar-8914293.c7
-rw-r--r--test/Lexer/rdr-6096838-2.c2
-rw-r--r--test/Lexer/rdr-6096838.c4
-rw-r--r--test/Lexer/wchar.c12
-rw-r--r--test/Makefile18
-rw-r--r--test/Misc/Inputs/working-directory.h1
-rw-r--r--test/Misc/diag-aka-types.cpp8
-rw-r--r--test/Misc/predefines.c2
-rw-r--r--test/Misc/working-directory.c5
-rw-r--r--test/PCH/Inputs/chain-cxx1.h19
-rw-r--r--test/PCH/Inputs/chain-cxx2.h32
-rw-r--r--test/PCH/Inputs/chain-macro-override1.h1
-rw-r--r--test/PCH/Inputs/chain-macro-override2.h1
-rw-r--r--test/PCH/Inputs/chain-remap-types1.h10
-rw-r--r--test/PCH/Inputs/chain-remap-types2.h8
-rw-r--r--test/PCH/Inputs/chain-selectors1.h4
-rw-r--r--test/PCH/Inputs/chain-selectors2.h4
-rw-r--r--test/PCH/Inputs/namespaces.h4
-rw-r--r--test/PCH/Inputs/typo.h6
-rw-r--r--test/PCH/Inputs/va_arg.h2
-rw-r--r--test/PCH/attrs-PR8406.c23
-rw-r--r--test/PCH/attrs.c15
-rw-r--r--test/PCH/attrs.h7
-rw-r--r--test/PCH/chain-cxx.cpp80
-rw-r--r--test/PCH/chain-macro-override.c9
-rw-r--r--test/PCH/chain-macro.c4
-rw-r--r--test/PCH/chain-remap-types.m12
-rw-r--r--test/PCH/chain-selectors.m16
-rw-r--r--test/PCH/check-deserializations.cpp20
-rw-r--r--test/PCH/cmdline-include.c6
-rw-r--r--test/PCH/cmdline-include1.h1
-rw-r--r--test/PCH/cmdline-include2.h1
-rw-r--r--test/PCH/cuda-kernel-call.cu25
-rw-r--r--test/PCH/cxx-templates.cpp22
-rw-r--r--test/PCH/cxx-templates.h58
-rw-r--r--test/PCH/cxx-variadic-templates.cpp11
-rw-r--r--test/PCH/cxx-variadic-templates.h18
-rw-r--r--test/PCH/cxx_exprs.cpp6
-rw-r--r--test/PCH/headersearch.cpp44
-rw-r--r--test/PCH/missing-file.cpp31
-rw-r--r--test/PCH/namespaces.cpp3
-rw-r--r--test/PCH/opencl-extensions.cl17
-rw-r--r--test/PCH/pragma-diag-section.cpp26
-rw-r--r--test/PCH/pragma-diag.c19
-rw-r--r--test/PCH/rdar8852495.c25
-rw-r--r--test/PCH/reinclude.cpp2
-rw-r--r--test/PCH/reinclude1.h3
-rw-r--r--test/PCH/reloc.c2
-rw-r--r--test/PCH/types.c3
-rw-r--r--test/PCH/typo.m6
-rw-r--r--test/PCH/va_arg.cpp16
-rw-r--r--test/Parser/MicrosoftExtensions.c28
-rw-r--r--test/Parser/MicrosoftExtensions.cpp113
-rw-r--r--test/Parser/altivec.c10
-rw-r--r--test/Parser/asm-constraints-pr7869.c2
-rw-r--r--test/Parser/cuda-kernel-call.cu9
-rw-r--r--test/Parser/cxx-altivec.cpp43
-rw-r--r--test/Parser/cxx-class.cpp8
-rw-r--r--test/Parser/cxx-decl.cpp14
-rw-r--r--test/Parser/cxx-in-c.c5
-rw-r--r--test/Parser/cxx-reference.cpp2
-rw-r--r--test/Parser/cxx-stmt.cpp2
-rw-r--r--test/Parser/cxx-template-argument.cpp3
-rw-r--r--test/Parser/cxx-template-decl.cpp4
-rw-r--r--test/Parser/cxx-throw.cpp2
-rw-r--r--test/Parser/cxx0x-attributes.cpp3
-rw-r--r--test/Parser/cxx0x-in-cxx98.cpp10
-rw-r--r--test/Parser/cxx0x-override-control-keywords.cpp28
-rw-r--r--test/Parser/encode.m4
-rw-r--r--test/Parser/expressions.c3
-rw-r--r--test/Parser/for.cpp20
-rw-r--r--test/Parser/goto-ident.c6
-rw-r--r--test/Parser/goto.c30
-rw-r--r--test/Parser/missing-end-2.m19
-rw-r--r--test/Parser/missing-end-3.m10
-rw-r--r--test/Parser/objc-forcollection-neg-2.m2
-rw-r--r--test/Parser/objc-forcollection-neg.m1
-rw-r--r--test/Parser/objc-foreach-syntax.m3
-rw-r--r--test/Parser/objc-interfaces.m2
-rw-r--r--test/Parser/objc-property-syntax.m7
-rw-r--r--test/Parser/objc-quirks.m8
-rw-r--r--test/Parser/opencl-kernel.cl9
-rw-r--r--test/Parser/opencl-pragma.cl12
-rw-r--r--test/Parser/opencl-storage-class.cl9
-rw-r--r--test/Parser/placeholder-recovery.m12
-rw-r--r--test/Parser/recovery.c6
-rw-r--r--test/Parser/switch-recovery.cpp24
-rw-r--r--test/Preprocessor/assembler-with-cpp.c5
-rw-r--r--test/Preprocessor/clang_headers.c2
-rw-r--r--test/Preprocessor/has_include.c32
-rw-r--r--test/Preprocessor/header_lookup1.c4
-rw-r--r--test/Preprocessor/include-directive2.c2
-rw-r--r--test/Preprocessor/init.c304
-rw-r--r--test/Preprocessor/objc-pp.m2
-rw-r--r--test/Preprocessor/pragma-pushpop-macro.c8
-rw-r--r--test/Preprocessor/pragma_diagnostic_sections.cpp80
-rw-r--r--test/Preprocessor/pragma_unknown.c2
-rw-r--r--test/Preprocessor/predefined-macros.c12
-rw-r--r--test/Preprocessor/print_line_empty_file.c12
-rw-r--r--test/Preprocessor/pushable-diagnostics.c6
-rw-r--r--test/Preprocessor/stdint.c100
-rw-r--r--test/Preprocessor/warn-macro-unused.c5
-rw-r--r--test/Rewriter/blockstruct.m17
-rw-r--r--test/Rewriter/dllimport-typedef.c2
-rw-r--r--test/Rewriter/finally.m2
-rw-r--r--test/Rewriter/properties.m7
-rw-r--r--test/Rewriter/property-dot-syntax.mm46
-rw-r--r--test/Rewriter/rewrite-block-pointer.mm30
-rw-r--r--test/Rewriter/rewrite-captured-nested-bvar.c35
-rw-r--r--test/Rewriter/rewrite-nested-blocks-2.mm18
-rwxr-xr-xtest/Rewriter/rewrite-nested-property-in-blocks.mm52
-rw-r--r--test/Rewriter/rewrite-property-set-cfstring.mm21
-rw-r--r--test/Rewriter/rewrite-protocol-property.mm22
-rw-r--r--test/Rewriter/rewrite-protocol-qualified.mm18
-rw-r--r--test/Rewriter/rewrite-user-defined-accessors.mm30
-rw-r--r--test/Sema/Inputs/conversion.h1
-rw-r--r--test/Sema/MicrosoftExtensions.c69
-rw-r--r--test/Sema/address_spaces.c8
-rw-r--r--test/Sema/altivec-init.c2
-rw-r--r--test/Sema/arm-neon-types.c13
-rw-r--r--test/Sema/array-constraint.c4
-rw-r--r--test/Sema/asm.c28
-rw-r--r--test/Sema/attr-alias.c8
-rw-r--r--test/Sema/attr-aligned.c23
-rw-r--r--test/Sema/attr-deprecated-message.c31
-rw-r--r--test/Sema/attr-deprecated.c13
-rw-r--r--test/Sema/attr-malloc.c5
-rw-r--r--test/Sema/attr-naked.c8
-rw-r--r--test/Sema/attr-nodebug.c2
-rw-r--r--test/Sema/attr-noinline.c2
-rw-r--r--test/Sema/attr-unavailable-message.c18
-rw-r--r--test/Sema/attr-unused.c22
-rw-r--r--test/Sema/attr-used.c2
-rw-r--r--test/Sema/attr-weak.c7
-rw-r--r--test/Sema/bitfield-promote-int-16bit.c25
-rw-r--r--test/Sema/bitfield.c4
-rw-r--r--test/Sema/block-args.c6
-rw-r--r--test/Sema/block-call.c2
-rw-r--r--test/Sema/block-labels.c14
-rw-r--r--test/Sema/block-return.c11
-rw-r--r--test/Sema/builtin_objc_msgSend.c12
-rw-r--r--test/Sema/builtins.c17
-rw-r--r--test/Sema/cast-to-union.c3
-rw-r--r--test/Sema/cast.c141
-rw-r--r--test/Sema/compare.c24
-rw-r--r--test/Sema/complex-int.c12
-rw-r--r--test/Sema/compound-literal.c5
-rw-r--r--test/Sema/conditional-expr.c13
-rw-r--r--test/Sema/const-eval.c8
-rw-r--r--test/Sema/const-ptr-int-ptr-cast.c2
-rw-r--r--test/Sema/constant-builtins-2.c4
-rw-r--r--test/Sema/constant-conversion.c57
-rw-r--r--test/Sema/constructor-attribute.c4
-rw-r--r--test/Sema/conversion.c45
-rw-r--r--test/Sema/designated-initializers.c28
-rw-r--r--test/Sema/dllimport-dllexport.c8
-rw-r--r--test/Sema/enum.c15
-rw-r--r--test/Sema/exprs.c16
-rw-r--r--test/Sema/flexible-array-init.c26
-rw-r--r--test/Sema/format-strings.c41
-rw-r--r--test/Sema/i-c-e.c3
-rw-r--r--test/Sema/if-empty-body.c16
-rw-r--r--test/Sema/implicit-builtin-decl.c7
-rw-r--r--test/Sema/init.c3
-rw-r--r--test/Sema/knr-def-call.c16
-rw-r--r--test/Sema/neon-vector-types.c33
-rw-r--r--test/Sema/parentheses.c11
-rw-r--r--test/Sema/pointer-addition.c1
-rw-r--r--test/Sema/pragma-unused.c40
-rw-r--r--test/Sema/predef.c2
-rw-r--r--test/Sema/private-extern.c16
-rw-r--r--test/Sema/promote-int-16bit.c6
-rw-r--r--test/Sema/rdr6094103-unordered-compare-promote.c2
-rw-r--r--test/Sema/redefinition.c4
-rw-r--r--test/Sema/return.c15
-rw-r--r--test/Sema/scope-check.c35
-rw-r--r--test/Sema/self-comparison.c11
-rw-r--r--test/Sema/sentinel-attribute.c2
-rw-r--r--test/Sema/shift.c2
-rw-r--r--test/Sema/short-enums.c5
-rw-r--r--test/Sema/statements.c51
-rw-r--r--test/Sema/stdcall-fastcall.c12
-rw-r--r--test/Sema/struct-packed-align.c15
-rw-r--r--test/Sema/switch.c2
-rw-r--r--test/Sema/transparent-union.c26
-rw-r--r--test/Sema/typedef-retain.c12
-rw-r--r--test/Sema/typeof-use-deprecated.c26
-rw-r--r--test/Sema/uninit-variables.c262
-rw-r--r--test/Sema/unused-expr.c5
-rw-r--r--test/Sema/varargs-x86-64.c2
-rw-r--r--test/Sema/vector-assign.c2
-rw-r--r--test/Sema/vector-init.c9
-rw-r--r--test/Sema/warn-shadow.c11
-rw-r--r--test/Sema/warn-unreachable.c24
-rw-r--r--test/Sema/warn-unused-function.c7
-rw-r--r--test/Sema/warn-unused-label.c11
-rw-r--r--test/Sema/warn-unused-value.c5
-rw-r--r--test/Sema/warn-write-strings.c2
-rw-r--r--test/Sema/x86-attr-force-align-arg-pointer.c2
-rw-r--r--test/Sema/x86-builtin-palignr.c14
-rw-r--r--test/SemaCUDA/config-type.cu3
-rw-r--r--test/SemaCUDA/cuda.h19
-rw-r--r--test/SemaCUDA/kernel-call.cu15
-rw-r--r--test/SemaCUDA/qualifiers.cu8
-rw-r--r--test/SemaCXX/MicrosoftExtensions.cpp69
-rw-r--r--test/SemaCXX/PR7944.cpp12
-rw-r--r--test/SemaCXX/PR8012.cpp3
-rw-r--r--test/SemaCXX/PR8755.cpp16
-rw-r--r--test/SemaCXX/PR8884.cpp12
-rw-r--r--test/SemaCXX/__null.cpp7
-rw-r--r--test/SemaCXX/abstract.cpp26
-rw-r--r--test/SemaCXX/addr-of-overloaded-function-casting.cpp57
-rw-r--r--test/SemaCXX/addr-of-overloaded-function.cpp61
-rw-r--r--test/SemaCXX/address-of-temporary.cpp8
-rw-r--r--test/SemaCXX/alignof-sizeof-reference.cpp2
-rw-r--r--test/SemaCXX/altivec.cpp24
-rw-r--r--test/SemaCXX/ambig-user-defined-conversions.cpp10
-rw-r--r--test/SemaCXX/ambiguous-builtin-unary-operator.cpp4
-rw-r--r--test/SemaCXX/anonymous-union.cpp20
-rw-r--r--test/SemaCXX/array-bounds.cpp93
-rw-r--r--test/SemaCXX/arrow-operator.cpp13
-rw-r--r--test/SemaCXX/attr-cxx0x.cpp24
-rw-r--r--test/SemaCXX/attr-deprecated.cpp43
-rw-r--r--test/SemaCXX/attr-format.cpp29
-rw-r--r--test/SemaCXX/attr-nonnull.cpp29
-rw-r--r--test/SemaCXX/attr-weak.cpp29
-rw-r--r--test/SemaCXX/attr-weakref.cpp8
-rw-r--r--test/SemaCXX/block-call.cpp52
-rw-r--r--test/SemaCXX/borland-extensions.cpp27
-rw-r--r--test/SemaCXX/builtin-ptrtomember-ambig.cpp6
-rw-r--r--test/SemaCXX/builtin_objc_msgSend.cpp14
-rw-r--r--test/SemaCXX/c99-variable-length-array.cpp7
-rw-r--r--test/SemaCXX/c99.cpp8
-rw-r--r--test/SemaCXX/cast-conversion.cpp10
-rw-r--r--test/SemaCXX/class.cpp39
-rw-r--r--test/SemaCXX/compare.cpp6
-rw-r--r--test/SemaCXX/composite-pointer-type.cpp4
-rw-r--r--test/SemaCXX/compound-literal.cpp14
-rw-r--r--test/SemaCXX/condition.cpp9
-rw-r--r--test/SemaCXX/conditional-expr.cpp25
-rw-r--r--test/SemaCXX/const-cast.cpp6
-rw-r--r--test/SemaCXX/constructor-initializer.cpp35
-rw-r--r--test/SemaCXX/constructor.cpp3
-rw-r--r--test/SemaCXX/conversion-function.cpp30
-rw-r--r--test/SemaCXX/conversion.cpp7
-rw-r--r--test/SemaCXX/copy-assignment.cpp16
-rw-r--r--test/SemaCXX/copy-initialization.cpp10
-rw-r--r--test/SemaCXX/crash-8124080.cpp21
-rw-r--r--test/SemaCXX/crash-PR7625.cpp6
-rw-r--r--test/SemaCXX/crashes.cpp97
-rw-r--r--test/SemaCXX/cstyle-cast.cpp2
-rw-r--r--test/SemaCXX/dcl_ambig_res.cpp3
-rw-r--r--test/SemaCXX/dcl_init_aggr.cpp2
-rw-r--r--test/SemaCXX/decl-expr-ambiguity.cpp6
-rw-r--r--test/SemaCXX/decl-init-ref.cpp6
-rw-r--r--test/SemaCXX/decltype-overloaded-functions.cpp4
-rw-r--r--test/SemaCXX/default2.cpp3
-rw-r--r--test/SemaCXX/delete.cpp9
-rw-r--r--test/SemaCXX/deleted-function-extension.cpp8
-rw-r--r--test/SemaCXX/dependent-auto.cpp34
-rw-r--r--test/SemaCXX/destructor.cpp70
-rw-r--r--test/SemaCXX/direct-initializer.cpp2
-rw-r--r--test/SemaCXX/elaborated-type-specifier.cpp3
-rw-r--r--test/SemaCXX/enum-bitfield.cpp18
-rw-r--r--test/SemaCXX/enum-scoped.cpp98
-rw-r--r--test/SemaCXX/enum.cpp5
-rw-r--r--test/SemaCXX/exceptions.cpp6
-rw-r--r--test/SemaCXX/expressions.cpp18
-rw-r--r--test/SemaCXX/format-attribute.cpp8
-rw-r--r--test/SemaCXX/friend.cpp68
-rw-r--r--test/SemaCXX/functional-cast.cpp7
-rw-r--r--test/SemaCXX/gnu-case-ranges.cpp24
-rw-r--r--test/SemaCXX/if-empty-body.cpp35
-rw-r--r--test/SemaCXX/init-priority-attr.cpp6
-rw-r--r--test/SemaCXX/invalid-member-expr.cpp8
-rw-r--r--test/SemaCXX/issue547.cpp66
-rw-r--r--test/SemaCXX/linkage-spec.cpp3
-rw-r--r--test/SemaCXX/linkage.cpp68
-rw-r--r--test/SemaCXX/lookup-member.cpp13
-rw-r--r--test/SemaCXX/member-expr-anonymous-union.cpp2
-rw-r--r--test/SemaCXX/member-expr.cpp15
-rw-r--r--test/SemaCXX/member-operator-expr.cpp4
-rw-r--r--test/SemaCXX/member-pointer.cpp5
-rw-r--r--test/SemaCXX/nested-name-spec.cpp19
-rw-r--r--test/SemaCXX/new-delete.cpp41
-rw-r--r--test/SemaCXX/no-exceptions.cpp14
-rw-r--r--test/SemaCXX/non-empty-class-size-zero.cpp18
-rw-r--r--test/SemaCXX/nullptr-98.cpp3
-rw-r--r--test/SemaCXX/nullptr.cpp47
-rw-r--r--test/SemaCXX/overload-call.cpp19
-rw-r--r--test/SemaCXX/overload-member-call.cpp12
-rw-r--r--test/SemaCXX/overloaded-builtin-operators-0x.cpp11
-rw-r--r--test/SemaCXX/overloaded-builtin-operators.cpp37
-rw-r--r--test/SemaCXX/overloaded-name.cpp14
-rw-r--r--test/SemaCXX/overloaded-operator.cpp10
-rw-r--r--test/SemaCXX/pragma-pack.cpp34
-rw-r--r--test/SemaCXX/pragma-unused.cpp8
-rw-r--r--test/SemaCXX/ptrtomember-badcall.cpp13
-rw-r--r--test/SemaCXX/ptrtomember.cpp32
-rw-r--r--test/SemaCXX/qualified-id-lookup.cpp2
-rw-r--r--test/SemaCXX/redeclared-auto.cpp26
-rw-r--r--test/SemaCXX/ref-init-ambiguous.cpp6
-rw-r--r--test/SemaCXX/references.cpp6
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp12
-rw-r--r--test/SemaCXX/return-noreturn.cpp10
-rw-r--r--test/SemaCXX/return-stack-addr.cpp18
-rw-r--r--test/SemaCXX/return.cpp2
-rw-r--r--test/SemaCXX/rval-references-examples.cpp112
-rw-r--r--test/SemaCXX/rval-references-xfail.cpp14
-rw-r--r--test/SemaCXX/rval-references.cpp10
-rw-r--r--test/SemaCXX/scope-check.cpp4
-rw-r--r--test/SemaCXX/sourceranges.cpp27
-rw-r--r--test/SemaCXX/static-cast.cpp12
-rw-r--r--test/SemaCXX/trailing-return-0x.cpp61
-rw-r--r--test/SemaCXX/type-convert-construct.cpp2
-rw-r--r--test/SemaCXX/type-dependent-exprs.cpp11
-rw-r--r--test/SemaCXX/type-formatting.cpp10
-rw-r--r--test/SemaCXX/type-traits-incomplete.cpp3
-rw-r--r--test/SemaCXX/type-traits.cpp166
-rw-r--r--test/SemaCXX/typeid-ref.cpp4
-rw-r--r--test/SemaCXX/undefined-internal.cpp86
-rw-r--r--test/SemaCXX/uninit-variables.cpp51
-rw-r--r--test/SemaCXX/uninitialized.cpp14
-rw-r--r--test/SemaCXX/unreachable-catch-clauses.cpp2
-rw-r--r--test/SemaCXX/unreachable-code.cpp2
-rw-r--r--test/SemaCXX/unused-with-error.cpp8
-rw-r--r--test/SemaCXX/using-decl-1.cpp23
-rw-r--r--test/SemaCXX/using-decl-templates.cpp18
-rw-r--r--test/SemaCXX/using-directive.cpp7
-rw-r--r--test/SemaCXX/vector-casts.cpp6
-rw-r--r--test/SemaCXX/virtual-override.cpp20
-rw-r--r--test/SemaCXX/vtable-instantiation.cc20
-rw-r--r--test/SemaCXX/warn-assignment-condition.cpp29
-rw-r--r--test/SemaCXX/warn-enum-compare.cpp212
-rw-r--r--test/SemaCXX/warn-global-constructors.cpp24
-rw-r--r--test/SemaCXX/warn-large-by-value-copy.cpp42
-rw-r--r--test/SemaCXX/warn-literal-conversion.cpp41
-rw-r--r--test/SemaCXX/warn-missing-noreturn.cpp55
-rw-r--r--test/SemaCXX/warn-overloaded-virtual.cpp54
-rw-r--r--test/SemaCXX/warn-self-assign.cpp47
-rw-r--r--test/SemaCXX/warn-shadow.cpp28
-rw-r--r--test/SemaCXX/warn-unreachable.cpp8
-rw-r--r--test/SemaCXX/warn-unused-filescoped.cpp24
-rw-r--r--test/SemaCXX/warn-unused-variables.cpp6
-rw-r--r--test/SemaCXX/warn_false_to_pointer.cpp1
-rw-r--r--test/SemaCXX/writable-strings-deprecated.cpp12
-rw-r--r--test/SemaObjC/access-property-getter.m2
-rw-r--r--test/SemaObjC/attr-deprecated.m11
-rw-r--r--test/SemaObjC/bad-receiver-1.m2
-rw-r--r--test/SemaObjC/block-attr.m2
-rw-r--r--test/SemaObjC/block-return.m13
-rw-r--r--test/SemaObjC/builtin_objc_lib_functions.m29
-rw-r--r--test/SemaObjC/builtin_objc_msgSend.m3
-rw-r--r--test/SemaObjC/call-super-2.m2
-rw-r--r--test/SemaObjC/category-1.m22
-rw-r--r--test/SemaObjC/class-conforming-protocol-2.m15
-rw-r--r--test/SemaObjC/class-method-lookup.m2
-rw-r--r--test/SemaObjC/compare-qualified-class.m2
-rw-r--r--test/SemaObjC/compare-qualified-id.m5
-rw-r--r--test/SemaObjC/comptypes-10.m34
-rw-r--r--test/SemaObjC/comptypes-a.m7
-rw-r--r--test/SemaObjC/conditional-expr-4.m2
-rw-r--r--test/SemaObjC/conflict-nonfragile-abi2.m4
-rw-r--r--test/SemaObjC/continuation-class-err.m6
-rw-r--r--test/SemaObjC/crash-label.m2
-rw-r--r--test/SemaObjC/custom-atomic-property.m20
-rw-r--r--test/SemaObjC/default-synthesize-1.m2
-rw-r--r--test/SemaObjC/default-synthesize.m4
-rw-r--r--test/SemaObjC/direct-synthesized-ivar-access.m14
-rw-r--r--test/SemaObjC/duplicate-ivar-in-class-extension.m2
-rw-r--r--test/SemaObjC/duplicate-property-class-extension.m15
-rw-r--r--test/SemaObjC/error-missing-getter.m19
-rw-r--r--test/SemaObjC/error-property-gc-attr.m4
-rw-r--r--test/SemaObjC/exprs.m10
-rw-r--r--test/SemaObjC/format-arg-attribute.m6
-rw-r--r--test/SemaObjC/ibaction.m2
-rw-r--r--test/SemaObjC/iboutletcollection-attr.m2
-rw-r--r--test/SemaObjC/incomplete-implementation.m26
-rw-r--r--test/SemaObjC/ivar-in-class-extension-error.m2
-rw-r--r--test/SemaObjC/ivar-in-class-extension.m2
-rw-r--r--test/SemaObjC/ivar-in-implementations.m2
-rw-r--r--test/SemaObjC/method-arg-decay.m5
-rw-r--r--test/SemaObjC/method-arg-qualifier-warning.m4
-rw-r--r--test/SemaObjC/method-bad-param.m14
-rw-r--r--test/SemaObjC/method-conflict-1.m83
-rw-r--r--test/SemaObjC/method-conflict-2.m44
-rw-r--r--test/SemaObjC/method-conflict.m6
-rw-r--r--test/SemaObjC/method-def-1.m2
-rw-r--r--test/SemaObjC/method-in-class-extension-impl.m20
-rw-r--r--test/SemaObjC/method-lookup-5.m10
-rw-r--r--test/SemaObjC/method-lookup.m2
-rw-r--r--test/SemaObjC/method-prototype-scope.m38
-rw-r--r--test/SemaObjC/method-sentinel-attr.m4
-rw-r--r--test/SemaObjC/method-typecheck-3.m22
-rw-r--r--test/SemaObjC/method-undef-category-warn-1.m12
-rw-r--r--test/SemaObjC/method-undef-extension-warn-1.m5
-rw-r--r--test/SemaObjC/method-undefined-warn-1.m14
-rw-r--r--test/SemaObjC/no-objc-exceptions.m13
-rw-r--r--test/SemaObjC/nonnull.h2
-rw-r--r--test/SemaObjC/nonnull.m26
-rw-r--r--test/SemaObjC/property-9.m11
-rw-r--r--test/SemaObjC/property-and-class-extension.m2
-rw-r--r--test/SemaObjC/property-and-ivar-use.m2
-rw-r--r--test/SemaObjC/property-dot-receiver.m22
-rw-r--r--test/SemaObjC/property-impl-misuse.m20
-rw-r--r--test/SemaObjC/property-in-class-extension.m37
-rw-r--r--test/SemaObjC/property-missing.m12
-rw-r--r--test/SemaObjC/property-user-setter.m10
-rw-r--r--test/SemaObjC/provisional-ivar-lookup.m43
-rw-r--r--test/SemaObjC/selector-1.m11
-rw-r--r--test/SemaObjC/selector-2.m14
-rw-r--r--test/SemaObjC/selector-3.m29
-rw-r--r--test/SemaObjC/self-assign.m14
-rw-r--r--test/SemaObjC/setter-dotsyntax.m19
-rw-r--r--test/SemaObjC/special-dep-unavail-warning.m47
-rw-r--r--test/SemaObjC/super-class-protocol-conformance.m2
-rw-r--r--test/SemaObjC/super.m2
-rw-r--r--test/SemaObjC/synth-provisional-ivars-1.m28
-rw-r--r--test/SemaObjC/synth-provisional-ivars.m4
-rw-r--r--test/SemaObjC/synthesized-ivar.m43
-rw-r--r--test/SemaObjC/undef-protocol-methods-1.m21
-rw-r--r--test/SemaObjC/undef-superclass-1.m2
-rw-r--r--test/SemaObjC/uninit-variables.m27
-rw-r--r--test/SemaObjC/warn-deprecated-implementations.m45
-rw-r--r--test/SemaObjC/warn-implicit-atomic-property.m13
-rw-r--r--test/SemaObjC/warn-incompatible-builtin-types.m2
-rw-r--r--test/SemaObjC/warn-write-strings.m2
-rw-r--r--test/SemaObjCXX/blocks.mm72
-rw-r--r--test/SemaObjCXX/conversion-ranking.mm89
-rw-r--r--test/SemaObjCXX/cstyle-cast.mm2
-rw-r--r--test/SemaObjCXX/exceptions-fragile.mm2
-rw-r--r--test/SemaObjCXX/message.mm35
-rw-r--r--test/SemaObjCXX/objc-pointer-conv.mm10
-rw-r--r--test/SemaObjCXX/overload.mm87
-rw-r--r--test/SemaObjCXX/propert-dot-error.mm41
-rw-r--r--test/SemaObjCXX/properties.mm24
-rw-r--r--test/SemaObjCXX/property-synthesis-error.mm32
-rw-r--r--test/SemaObjCXX/protocol-lookup.mm5
-rw-r--r--test/SemaObjCXX/reserved-keyword-methods.mm42
-rw-r--r--test/SemaObjCXX/reserved-keyword-selectors.mm35
-rw-r--r--test/SemaOpenCL/cond.cl5
-rw-r--r--test/SemaOpenCL/extension-fp64.cl17
-rw-r--r--test/SemaOpenCL/init.cl (renamed from test/Sema/opencl-init.c)2
-rw-r--r--test/SemaTemplate/anonymous-union.cpp21
-rw-r--r--test/SemaTemplate/attributes.cpp2
-rw-r--r--test/SemaTemplate/class-template-decl.cpp18
-rw-r--r--test/SemaTemplate/class-template-id.cpp2
-rw-r--r--test/SemaTemplate/class-template-spec.cpp2
-rw-r--r--test/SemaTemplate/constructor-template.cpp23
-rw-r--r--test/SemaTemplate/current-instantiation.cpp16
-rw-r--r--test/SemaTemplate/deduction.cpp18
-rw-r--r--test/SemaTemplate/default-expr-arguments-2.cpp2
-rw-r--r--test/SemaTemplate/default-expr-arguments.cpp88
-rw-r--r--test/SemaTemplate/dependent-base-classes.cpp4
-rw-r--r--test/SemaTemplate/dependent-expr.cpp26
-rw-r--r--test/SemaTemplate/dependent-names.cpp27
-rw-r--r--test/SemaTemplate/elaborated-type-specifier.cpp4
-rw-r--r--test/SemaTemplate/enum-forward.cpp8
-rw-r--r--test/SemaTemplate/explicit-instantiation.cpp4
-rw-r--r--test/SemaTemplate/explicit-specialization-member.cpp6
-rw-r--r--test/SemaTemplate/friend-template.cpp11
-rw-r--r--test/SemaTemplate/fun-template-def.cpp2
-rw-r--r--test/SemaTemplate/function-template-specialization.cpp5
-rw-r--r--test/SemaTemplate/inject-templated-friend-post.cpp4
-rw-r--r--test/SemaTemplate/inject-templated-friend.cpp2
-rw-r--r--test/SemaTemplate/instantiate-anonymous-union.cpp21
-rw-r--r--test/SemaTemplate/instantiate-cast.cpp8
-rw-r--r--test/SemaTemplate/instantiate-complete.cpp24
-rw-r--r--test/SemaTemplate/instantiate-default-assignment-operator.cpp2
-rw-r--r--test/SemaTemplate/instantiate-expr-4.cpp8
-rw-r--r--test/SemaTemplate/instantiate-field.cpp12
-rw-r--r--test/SemaTemplate/instantiate-function-1.cpp2
-rw-r--r--test/SemaTemplate/instantiate-local-class.cpp15
-rw-r--r--test/SemaTemplate/instantiate-member-expr.cpp25
-rw-r--r--test/SemaTemplate/instantiate-member-pointers.cpp2
-rw-r--r--test/SemaTemplate/instantiate-member-template.cpp12
-rw-r--r--test/SemaTemplate/instantiate-non-type-template-parameter.cpp19
-rw-r--r--test/SemaTemplate/instantiate-static-var.cpp4
-rw-r--r--test/SemaTemplate/instantiate-template-template-parm.cpp51
-rw-r--r--test/SemaTemplate/instantiate-try-catch.cpp2
-rw-r--r--test/SemaTemplate/instantiate-using-decl.cpp19
-rw-r--r--test/SemaTemplate/instantiation-default-1.cpp2
-rw-r--r--test/SemaTemplate/member-access-ambig.cpp35
-rw-r--r--test/SemaTemplate/member-access-expr.cpp15
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp28
-rw-r--r--test/SemaTemplate/temp_class_spec_neg.cpp2
-rw-r--r--test/SemaTemplate/typename-specifier-4.cpp37
-rw-r--r--test/SemaTemplate/variadic-class-template-1.cpp4
-rw-r--r--test/SemaTemplate/variadic-class-template-2.cpp19
-rw-r--r--test/SemaTemplate/variadic-parse.cpp6
-rw-r--r--test/SemaTemplate/variadic-unsupported.cpp5
-rw-r--r--test/Unit/lit.cfg86
-rw-r--r--test/Unit/lit.site.cfg.in26
-rw-r--r--test/lit.cfg20
-rw-r--r--test/lit.site.cfg.in1
1092 files changed, 34508 insertions, 2749 deletions
diff --git a/test/ASTMerge/Inputs/category1.m b/test/ASTMerge/Inputs/category1.m
index ade1c6c66da3..afcaab81f2b7 100644
--- a/test/ASTMerge/Inputs/category1.m
+++ b/test/ASTMerge/Inputs/category1.m
@@ -23,3 +23,26 @@
@interface I2 ()
- (int)method3;
@end
+
+// Category with implementation
+@interface I2 (Cat3)
+@end
+
+@implementation I2 (Cat3)
+@end
+
+// Category with implementation
+@interface I2 (Cat4)
+@end
+
+@implementation I2 (Cat4)
+@end
+
+// Category with mismatched implementation
+@interface I2 (Cat6)
+@end
+
+@implementation I2 (Cat6)
+- (float)blah { return 0; }
+@end
+
diff --git a/test/ASTMerge/Inputs/category2.m b/test/ASTMerge/Inputs/category2.m
index f66c208680c2..49a3c270a1c2 100644
--- a/test/ASTMerge/Inputs/category2.m
+++ b/test/ASTMerge/Inputs/category2.m
@@ -25,3 +25,25 @@ typedef int Int;
@interface I2 ()
- (float)method3;
@end
+
+// Category with implementation
+@interface I2 (Cat3)
+@end
+
+@implementation I2 (Cat3)
+@end
+
+// Category with implementation
+@interface I2 (Cat5)
+@end
+
+@implementation I2 (Cat5)
+@end
+
+// Category with mismatched implementation
+@interface I2 (Cat6)
+@end
+
+@implementation I2 (Cat6)
+- (int)blah { return 0; }
+@end
diff --git a/test/ASTMerge/Inputs/class-template1.cpp b/test/ASTMerge/Inputs/class-template1.cpp
new file mode 100644
index 000000000000..440b5abfc869
--- /dev/null
+++ b/test/ASTMerge/Inputs/class-template1.cpp
@@ -0,0 +1,34 @@
+template<typename T>
+struct X0;
+
+template<int I>
+struct X1;
+
+template<int I>
+struct X2;
+
+template<int I>
+struct X3;
+
+template<template<int I> class>
+struct X4;
+
+template<template<long> class>
+struct X5;
+
+template<typename>
+struct X6;
+
+extern X0<int> *x0i;
+extern X0<long> *x0l;
+extern X0<float> *x0r;
+
+template<>
+struct X0<char> {
+ int member;
+};
+
+template<>
+struct X0<wchar_t> {
+ int member;
+};
diff --git a/test/ASTMerge/Inputs/class-template2.cpp b/test/ASTMerge/Inputs/class-template2.cpp
new file mode 100644
index 000000000000..6300301a4ffa
--- /dev/null
+++ b/test/ASTMerge/Inputs/class-template2.cpp
@@ -0,0 +1,35 @@
+template<class T>
+struct X0;
+
+template<int I>
+struct X1;
+
+template<long I>
+struct X2;
+
+template<typename>
+struct X3;
+
+template<template<int I> class>
+struct X4;
+
+template<template<int I> class>
+struct X5;
+
+template<template<int I> class>
+struct X6;
+
+typedef int Integer;
+extern X0<Integer> *x0i;
+extern X0<float> *x0f;
+extern X0<double> *x0r;
+
+template<>
+struct X0<char> {
+ int member;
+};
+
+template<>
+struct X0<wchar_t> {
+ float member;
+};
diff --git a/test/ASTMerge/Inputs/class1.cpp b/test/ASTMerge/Inputs/class1.cpp
index e13faf0539b1..b600cdb1fcf9 100644
--- a/test/ASTMerge/Inputs/class1.cpp
+++ b/test/ASTMerge/Inputs/class1.cpp
@@ -6,3 +6,10 @@ struct B : A {
float y;
float foo();
};
+
+struct C {
+ C(int i = 10);
+ C(const C&);
+ C &operator=(C&);
+ ~C();
+};
diff --git a/test/ASTMerge/Inputs/class2.cpp b/test/ASTMerge/Inputs/class2.cpp
index 91b84dc13b75..fa38916f5e2e 100644
--- a/test/ASTMerge/Inputs/class2.cpp
+++ b/test/ASTMerge/Inputs/class2.cpp
@@ -6,3 +6,4 @@ struct B : A {
int y;
int foo();
};
+
diff --git a/test/ASTMerge/Inputs/interface1.m b/test/ASTMerge/Inputs/interface1.m
index 7e9935db7c7b..5865c0eff070 100644
--- a/test/ASTMerge/Inputs/interface1.m
+++ b/test/ASTMerge/Inputs/interface1.m
@@ -79,3 +79,25 @@
@protocol P4
- (double)honk:(int)a;
@end
+
+// Interface with implementation
+@interface I13
+@end
+
+@implementation I13
+@end
+
+@interface I13a
+@end
+
+@implementation I13a
+@end
+
+// Implementation by itself
+@implementation I14 : I12
+@end
+
+@implementation I15 : I12
+@end
+
+
diff --git a/test/ASTMerge/Inputs/interface2.m b/test/ASTMerge/Inputs/interface2.m
index bef7fb838c05..3fb43f5930c3 100644
--- a/test/ASTMerge/Inputs/interface2.m
+++ b/test/ASTMerge/Inputs/interface2.m
@@ -78,3 +78,23 @@
@protocol P5
- (double)honk:(int)a;
@end
+
+// Interface with implementation
+@interface I13
+@end
+
+@implementation I13
+@end
+
+@interface I13b
+@end
+
+@implementation I13b
+@end
+
+// Implementation by itself
+@implementation I14 : I12
+@end
+
+@implementation I15 : I11
+@end
diff --git a/test/ASTMerge/Inputs/property1.m b/test/ASTMerge/Inputs/property1.m
index 37887a34f767..22fe0a02220c 100644
--- a/test/ASTMerge/Inputs/property1.m
+++ b/test/ASTMerge/Inputs/property1.m
@@ -10,3 +10,22 @@
@property (readonly) float Prop1;
@end
+// Properties with implementations
+@interface I3 {
+ int ivar1;
+ int ivar2;
+ int ivar3;
+ int Prop4;
+}
+@property int Prop1;
+@property int Prop2;
+@property int Prop3;
+@property int Prop4;
+@end
+
+@implementation I3
+@synthesize Prop1 = ivar1;
+@synthesize Prop2 = ivar3;
+@dynamic Prop3;
+@synthesize Prop4;
+@end
diff --git a/test/ASTMerge/Inputs/property2.m b/test/ASTMerge/Inputs/property2.m
index 6039f10ec6e8..64a03fb04ec3 100644
--- a/test/ASTMerge/Inputs/property2.m
+++ b/test/ASTMerge/Inputs/property2.m
@@ -11,3 +11,23 @@
@interface I2
@property (readonly) int Prop1;
@end
+
+// Properties with implementations
+@interface I3 {
+ int ivar1;
+ int ivar2;
+ int ivar3;
+ int Prop4;
+}
+@property int Prop1;
+@property int Prop2;
+@property int Prop3;
+@property int Prop4;
+@end
+
+@implementation I3
+@synthesize Prop2 = ivar2;
+@synthesize Prop1 = ivar1;
+@synthesize Prop3 = ivar3;
+@synthesize Prop4 = Prop4;
+@end
diff --git a/test/ASTMerge/category.m b/test/ASTMerge/category.m
index 6ba229204147..54a12408c480 100644
--- a/test/ASTMerge/category.m
+++ b/test/ASTMerge/category.m
@@ -6,4 +6,6 @@
// CHECK: category1.m:16:1: note: instance method 'method2' also declared here
// CHECK: category2.m:26:1: error: instance method 'method3' has incompatible result types in different translation units ('float' vs. 'int')
// CHECK: category1.m:24:1: note: instance method 'method3' also declared here
-// CHECK: 2 errors generated.
+// CHECK: category2.m:48:1: error: instance method 'blah' has incompatible result types in different translation units ('int' vs. 'float')
+// CHECK: category1.m:46:1: note: instance method 'blah' also declared here
+// CHECK: 3 errors generated.
diff --git a/test/ASTMerge/class-template.cpp b/test/ASTMerge/class-template.cpp
new file mode 100644
index 000000000000..eea31b1c2feb
--- /dev/null
+++ b/test/ASTMerge/class-template.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/class-template1.cpp
+// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/class-template2.cpp
+// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
+
+// CHECK: class-template1.cpp:7:14: error: non-type template parameter declared with incompatible types in different translation units ('int' vs. 'long')
+// CHECK: class-template2.cpp:7:15: note: declared here with type 'long'
+
+// CHECK: class-template1.cpp:10:14: error: template parameter has different kinds in different translation units
+// CHECK: class-template2.cpp:10:10: note: template parameter declared here
+
+// CHECK: class-template1.cpp:16:23: error: non-type template parameter declared with incompatible types in different translation units ('long' vs. 'int')
+// CHECK: class-template2.cpp:16:23: note: declared here with type 'int'
+
+// CHECK: class-template1.cpp:19:10: error: template parameter has different kinds in different translation units
+// CHECK: class-template2.cpp:19:10: note: template parameter declared here
+
+// CHECK: class-template2.cpp:25:20: error: external variable 'x0r' declared with incompatible types in different translation units ('X0<double> *' vs. 'X0<float> *')
+// CHECK: class-template1.cpp:24:19: note: declared here with type 'X0<float> *'
+
+// CHECK: class-template1.cpp:32:8: warning: type 'X0<wchar_t>' has incompatible definitions in different translation units
+// CHECK: class-template1.cpp:33:7: note: field 'member' has type 'int' here
+// CHECK: class-template2.cpp:34:9: note: field 'member' has type 'float' here
+
+// CHECK: 1 warning and 5 errors generated.
diff --git a/test/ASTMerge/interface.m b/test/ASTMerge/interface.m
index 420ae3882548..e37e3807e514 100644
--- a/test/ASTMerge/interface.m
+++ b/test/ASTMerge/interface.m
@@ -15,5 +15,8 @@
// CHECK: interface1.m:46:1: note: class method 'bar:' also declared here
// CHECK: interface2.m:57:20: error: instance method 'bar:' has a parameter with a different types in different translation units ('double' vs. 'float')
// CHECK: interface1.m:58:19: note: declared here with type 'float'
-// CHECK: 6 errors generated
+// CHECK: interface1.m:100:1: error: class 'I15' has incompatible superclasses
+// CHECK: interface1.m:100:1: note: inherits from superclass 'I12' here
+// CHECK: interface2.m:99:1: note: inherits from superclass 'I11' here
+// CHECK: 8 errors generated
diff --git a/test/ASTMerge/property.m b/test/ASTMerge/property.m
index 5f7a7308da65..a8dd7c420c89 100644
--- a/test/ASTMerge/property.m
+++ b/test/ASTMerge/property.m
@@ -6,4 +6,8 @@
// CHECK: property1.m:10:28: note: declared here with type 'float'
// CHECK: property2.m:12:26: error: instance method 'Prop1' has incompatible result types in different translation units ('int' vs. 'float')
// CHECK: property1.m:10:28: note: instance method 'Prop1' also declared here
-// CHECK: 2 errors generated.
+// CHECK: property1.m:28:21: error: property 'Prop2' is synthesized to different ivars in different translation units ('ivar3' vs. 'ivar2')
+// CHECK: property2.m:29:21: note: property is synthesized to ivar 'ivar2' here
+// CHECK: property1.m:29:10: error: property 'Prop3' is implemented with @dynamic in one translation but @synthesize in another translation unit
+// CHECK: property2.m:31:13: note: property 'Prop3' is implemented with @synthesize here
+// CHECK: 4 errors generated.
diff --git a/test/Analysis/CFNumber.c b/test/Analysis/CFNumber.c
index 544644a747dc..4725f90f1a2f 100644
--- a/test/Analysis/CFNumber.c
+++ b/test/Analysis/CFNumber.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s
+// 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
typedef signed long CFIndex;
typedef const struct __CFAllocator * CFAllocatorRef;
diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m
index bfd968a9a1a6..d7aaa99be70e 100644
--- a/test/Analysis/MissingDealloc.m
+++ b/test/Analysis/MissingDealloc.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=cocoa.experimental.Dealloc '-DIBOutlet=__attribute__((iboutlet))' %s -verify
typedef signed char BOOL;
@protocol NSObject
- (BOOL)isEqual:(id)object;
diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m
index fa81b3d95da9..c5f7a4569a5b 100644
--- a/test/Analysis/NSString.m
+++ b/test/Analysis/NSString.m
@@ -1,13 +1,13 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=cocoa.NilArg -analyzer-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -analyzer-check-objc-mem -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-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s &&
-// NOTWORK: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
-// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s &&
-// NOTWORK: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from
diff --git a/test/Analysis/NSWindow.m b/test/Analysis/NSWindow.m
index 34e6c68b8501..c386adf3f085 100644
--- a/test/Analysis/NSWindow.m
+++ b/test/Analysis/NSWindow.m
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=basic -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=basic -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.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/ObjCRetSigs.m b/test/Analysis/ObjCRetSigs.m
index a76d7b979ee0..5a912a808984 100644
--- a/test/Analysis/ObjCRetSigs.m
+++ b/test/Analysis/ObjCRetSigs.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-methodsigs -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=cocoa.MethodSigs -verify %s
int printf(const char *, ...);
diff --git a/test/Analysis/PR2978.m b/test/Analysis/PR2978.m
index 1ed138e45d13..ac3ef790cabd 100644
--- a/test/Analysis/PR2978.m
+++ b/test/Analysis/PR2978.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-missing-dealloc %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=cocoa.experimental.Dealloc %s -verify
// Tests for the checker which checks missing/extra ivar 'release' calls
// in dealloc.
diff --git a/test/Analysis/additive-folding.c b/test/Analysis/additive-folding.c
index e4a565133968..096ffb9a5059 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 -verify -analyzer-constraints=basic %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-experimental-checks -verify -analyzer-constraints=range %s
+// 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
// These are used to trigger warnings.
typedef typeof(sizeof(int)) size_t;
@@ -183,14 +183,14 @@ void tautologyGT (unsigned a) {
void tautologyGE (unsigned a) {
char* b = malloc(1);
- if (a >= 0)
+ if (a >= 0) // expected-warning{{always true}}
free(b);
return; // no-warning
}
void tautologyLT (unsigned a) {
char* b = malloc(1);
- if (a < 0)
+ if (a < 0) // expected-warning{{always false}}
return; // expected-warning{{never executed}}
free(b);
}
diff --git a/test/Analysis/analyzer-stats.c b/test/Analysis/analyzer-stats.c
new file mode 100644
index 000000000000..d8dde23d6709
--- /dev/null
+++ b/test/Analysis/analyzer-stats.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks -analyzer-stats %s
+
+int foo();
+
+int test() { // expected-warning{{Total CFGBlocks}}
+ int a = 1;
+ a = 34 / 12;
+
+ if (foo())
+ return a;
+
+ a /= 4;
+ return a;
+}
diff --git a/test/Analysis/array-struct-region.c b/test/Analysis/array-struct-region.c
index dabd25bb1f50..8162200b0aca 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-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-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-experimental-internal-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -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 3e46a0a62235..df9e9786fff3 100644
--- a/test/Analysis/array-struct.c
+++ b/test/Analysis/array-struct.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+// 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
struct s {
int data;
diff --git a/test/Analysis/auto-obj-dtors-cfg-output.cpp b/test/Analysis/auto-obj-dtors-cfg-output.cpp
new file mode 100644
index 000000000000..4bcfccd120e2
--- /dev/null
+++ b/test/Analysis/auto-obj-dtors-cfg-output.cpp
@@ -0,0 +1,835 @@
+// RUN: %clang_cc1 -fexceptions -analyze -analyzer-checker=debug.DumpCFG -cfg-add-implicit-dtors %s 2>&1 | FileCheck %s
+// XPASS: *
+
+class A {
+public:
+ A() {}
+ ~A() {}
+ operator int() const { return 1; }
+};
+
+extern const bool UV;
+
+void test_const_ref() {
+ A a;
+ const A& b = a;
+ const A& c = A();
+}
+
+void test_array() {
+ A a[2];
+ A b[0];
+}
+
+void test_scope() {
+ A a;
+ { A c;
+ A d;
+ }
+ A b;
+}
+
+void test_return() {
+ A a;
+ A b;
+ if (UV) return;
+ A c;
+}
+
+void test_goto() {
+ A a;
+l0:
+ A b;
+ { A a;
+ if (UV) goto l0;
+ if (UV) goto l1;
+ A b;
+ }
+l1:
+ A c;
+}
+
+void test_if_implicit_scope() {
+ A a;
+ if (A b = a)
+ A c;
+ else A c;
+}
+
+void test_if_jumps() {
+ A a;
+ if (A b = a) {
+ A c;
+ if (UV) return;
+ A d;
+ } else {
+ A c;
+ if (UV) return;
+ A d;
+ }
+ A e;
+}
+
+void test_while_implicit_scope() {
+ A a;
+ while (A b = a)
+ A c;
+}
+
+void test_while_jumps() {
+ A a;
+ while (A b = a) {
+ A c;
+ if (UV) break;
+ if (UV) continue;
+ if (UV) return;
+ A d;
+ }
+ A e;
+}
+
+void test_do_implicit_scope() {
+ do A a;
+ while (UV);
+}
+
+void test_do_jumps() {
+ A a;
+ do {
+ A b;
+ if (UV) break;
+ if (UV) continue;
+ if (UV) return;
+ A c;
+ } while (UV);
+ A d;
+}
+
+void test_switch_implicit_scope() {
+ A a;
+ switch (A b = a)
+ A c;
+}
+
+void test_switch_jumps() {
+ A a;
+ switch (A b = a) {
+ case 0: {
+ A c;
+ if (UV) break;
+ if (UV) return;
+ A f;
+ }
+ case 1:
+ break;
+ }
+ A g;
+}
+
+void test_for_implicit_scope() {
+ for (A a; A b = a; )
+ A c;
+}
+
+void test_for_jumps() {
+ A a;
+ for (A b; A c = b; ) {
+ A d;
+ if (UV) break;
+ if (UV) continue;
+ if (UV) return;
+ A e;
+ }
+ A f;
+}
+
+void test_catch_const_ref() {
+ try {
+ } catch (const A& e) {
+ }
+}
+
+void test_catch_copy() {
+ try {
+ } catch (A e) {
+ }
+}
+
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1:
+// CHECK: 2: A a;
+// CHECK: 3: const A &b = a;
+// CHECK: 4: A()
+// CHECK: 5: const A &c = A();
+// CHECK: 6: [B1.5].~A() (Implicit destructor)
+// CHECK: 7: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1:
+// CHECK: 2: A a[2];
+// CHECK: 3:
+// CHECK: 4: A b[0];
+// CHECK: 5: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1:
+// CHECK: 2: A a;
+// CHECK: 3:
+// CHECK: 4: A c;
+// CHECK: 5:
+// CHECK: 6: A d;
+// CHECK: 7: [B1.6].~A() (Implicit destructor)
+// CHECK: 8: [B1.4].~A() (Implicit destructor)
+// CHECK: 9:
+// CHECK: 10: A b;
+// CHECK: 11: [B1.10].~A() (Implicit destructor)
+// CHECK: 12: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B4 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B3
+// CHECK: [ B1 ]
+// CHECK: 1:
+// CHECK: 2: A c;
+// CHECK: 3: [B1.2].~A() (Implicit destructor)
+// CHECK: 4: [B3.4].~A() (Implicit destructor)
+// CHECK: 5: [B3.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: return;
+// CHECK: 2: [B3.4].~A() (Implicit destructor)
+// CHECK: 3: [B3.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B3
+// CHECK: Successors (1): B0
+// CHECK: [ B3 ]
+// CHECK: 1:
+// CHECK: 2: A a;
+// CHECK: 3:
+// CHECK: 4: A b;
+// CHECK: 5: UV
+// CHECK: T: if [B3.5]
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (2): B2 B1
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (2): B1 B2
+// CHECK: Successors (0):
+// CHECK: [ B8 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B7
+// CHECK: [ B1 ]
+// CHECK: l1:
+// CHECK: 1:
+// CHECK: 2: A c;
+// CHECK: 3: [B1.2].~A() (Implicit destructor)
+// CHECK: 4: [B6.2].~A() (Implicit destructor)
+// CHECK: 5: [B7.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1:
+// CHECK: 2: A b;
+// CHECK: 3: [B2.2].~A() (Implicit destructor)
+// CHECK: 4: [B6.4].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: [B6.4].~A() (Implicit destructor)
+// CHECK: T: goto l1;
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1: UV
+// CHECK: T: if [B4.1]
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (2): B3 B2
+// CHECK: [ B5 ]
+// CHECK: 1: [B6.4].~A() (Implicit destructor)
+// CHECK: 2: [B6.2].~A() (Implicit destructor)
+// CHECK: T: goto l0;
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B6
+// CHECK: [ B6 ]
+// CHECK: l0:
+// CHECK: 1:
+// CHECK: 2: A b;
+// 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: 2: A a;
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (1): B6
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B5 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B4
+// CHECK: [ B1 ]
+// CHECK: 1: [B4.4].~A() (Implicit destructor)
+// CHECK: 2: [B4.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// 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: 2: A c;
+// CHECK: 3: [B3.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// 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: 6: [B4.5]
+// CHECK: T: if [B4.6]
+// CHECK: Predecessors (1): B5
+// CHECK: Successors (2): B3 B2
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B9 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B8
+// CHECK: [ B1 ]
+// CHECK: 1: [B8.4].~A() (Implicit destructor)
+// 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: 2: A d;
+// CHECK: 3: [B2.2].~A() (Implicit destructor)
+// CHECK: 4: [B4.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: return;
+// CHECK: 2: [B4.2].~A() (Implicit destructor)
+// CHECK: 3: [B8.4].~A() (Implicit destructor)
+// CHECK: 4: [B8.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B0
+// CHECK: [ B4 ]
+// 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: 2: A d;
+// CHECK: 3: [B5.2].~A() (Implicit destructor)
+// CHECK: 4: [B7.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B1
+// CHECK: [ B6 ]
+// CHECK: 1: return;
+// CHECK: 2: [B7.2].~A() (Implicit destructor)
+// CHECK: 3: [B8.4].~A() (Implicit destructor)
+// CHECK: 4: [B8.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B0
+// CHECK: [ B7 ]
+// 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: 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: 5: b.operator int()
+// CHECK: 6: [B8.5]
+// CHECK: T: if [B8.6]
+// CHECK: Predecessors (1): B9
+// CHECK: Successors (2): B7 B4
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (3): B1 B3 B6
+// CHECK: Successors (0):
+// CHECK: [ B6 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B5
+// CHECK: [ B1 ]
+// CHECK: 1: [B2.2].~A() (Implicit destructor)
+// CHECK: 2: [B5.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: a
+// CHECK: 2: while ([B2.4])
+// CHECK:[B4.2] 3: b.operator int()
+// CHECK: 4: [B2.3]
+// CHECK: T: while [B2.4]
+// CHECK: Predecessors (2): B3 B5
+// CHECK: Successors (2): B4 B1
+// CHECK: [ B3 ]
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B2
+// CHECK: [ B4 ]
+// 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: 2: A a;
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B2
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B12 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B11
+// CHECK: [ B1 ]
+// CHECK: 1: [B2.2].~A() (Implicit destructor)
+// CHECK: 2:
+// CHECK: 3: A e;
+// CHECK: 4: [B1.3].~A() (Implicit destructor)
+// CHECK: 5: [B11.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B9 B2
+// 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: 3: b.operator int()
+// CHECK: 4: [B2.3]
+// CHECK: T: while [B2.4]
+// CHECK: Predecessors (2): B3 B11
+// CHECK: Successors (2): B10 B1
+// CHECK: [ B3 ]
+// CHECK: Predecessors (2): B4 B7
+// CHECK: Successors (1): B2
+// CHECK: [ B4 ]
+// CHECK: 1:
+// CHECK: 2: A d;
+// CHECK: 3: [B4.2].~A() (Implicit destructor)
+// CHECK: 4: [B10.2].~A() (Implicit destructor)
+// CHECK: 5: [B2.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B3
+// CHECK: [ B5 ]
+// CHECK: 1: return;
+// CHECK: 2: [B10.2].~A() (Implicit destructor)
+// CHECK: 3: [B2.2].~A() (Implicit destructor)
+// CHECK: 4: [B11.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B0
+// CHECK: [ B6 ]
+// CHECK: 1: UV
+// CHECK: T: if [B6.1]
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (2): B5 B4
+// CHECK: [ B7 ]
+// CHECK: 1: [B10.2].~A() (Implicit destructor)
+// CHECK: 2: [B2.2].~A() (Implicit destructor)
+// CHECK: T: continue;
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (1): B3
+// CHECK: [ B8 ]
+// CHECK: 1: UV
+// CHECK: T: if [B8.1]
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (2): B7 B6
+// CHECK: [ B9 ]
+// CHECK: 1: [B10.2].~A() (Implicit destructor)
+// CHECK: T: break;
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (1): B1
+// CHECK: [ B10 ]
+// 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: 2: A a;
+// CHECK: Predecessors (1): B12
+// CHECK: Successors (1): B2
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (2): B1 B5
+// CHECK: Successors (0):
+// CHECK: [ B4 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B2
+// CHECK: [ B1 ]
+// CHECK: 1: UV
+// CHECK: T: do ... while [B1.1]
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (2): B3 B0
+// CHECK: [ B2 ]
+// CHECK: 1:
+// CHECK: 2: A a;
+// CHECK: 3: [B2.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B3 B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (1): B2
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B12 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B11
+// CHECK: [ B1 ]
+// CHECK: 1:
+// CHECK: 2: A d;
+// CHECK: 3: [B1.2].~A() (Implicit destructor)
+// CHECK: 4: [B11.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B8 B2
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: UV
+// CHECK: T: do ... while [B2.1]
+// CHECK: Predecessors (2): B3 B6
+// CHECK: Successors (2): B10 B1
+// CHECK: [ B3 ]
+// CHECK: 1:
+// CHECK: 2: A c;
+// CHECK: 3: [B3.2].~A() (Implicit destructor)
+// CHECK: 4: [B9.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B5
+// CHECK: Successors (1): B2
+// CHECK: [ B4 ]
+// CHECK: 1: return;
+// CHECK: 2: [B9.2].~A() (Implicit destructor)
+// CHECK: 3: [B11.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B5
+// CHECK: Successors (1): B0
+// CHECK: [ B5 ]
+// CHECK: 1: UV
+// CHECK: T: if [B5.1]
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (2): B4 B3
+// CHECK: [ B6 ]
+// CHECK: 1: [B9.2].~A() (Implicit destructor)
+// CHECK: T: continue;
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B2
+// CHECK: [ B7 ]
+// CHECK: 1: UV
+// CHECK: T: if [B7.1]
+// CHECK: Predecessors (1): B9
+// CHECK: Successors (2): B6 B5
+// CHECK: [ B8 ]
+// CHECK: 1: [B9.2].~A() (Implicit destructor)
+// CHECK: T: break;
+// CHECK: Predecessors (1): B9
+// CHECK: Successors (1): B1
+// CHECK: [ B9 ]
+// CHECK: 1:
+// CHECK: 2: A b;
+// CHECK: 3: UV
+// CHECK: T: if [B9.3]
+// CHECK: Predecessors (2): B10 B11
+// CHECK: Successors (2): B8 B7
+// CHECK: [ B10 ]
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B9
+// CHECK: [ B11 ]
+// CHECK: 1:
+// CHECK: 2: A a;
+// CHECK: Predecessors (1): B12
+// CHECK: Successors (1): B9
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (2): B1 B4
+// CHECK: Successors (0):
+// CHECK: [ B4 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B2
+// CHECK: [ B1 ]
+// CHECK: 1: [B2.4].~A() (Implicit destructor)
+// CHECK: 2: [B2.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B3 B2
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1:
+// CHECK: 2: A a;
+// CHECK: 3: a
+// CHECK: 4: switch ([B2.5])
+// CHECK:[B3.2] 5: b.operator int()
+// CHECK: T: switch [B2.5]
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1:
+// CHECK: 2: A c;
+// CHECK: 3: [B3.2].~A() (Implicit destructor)
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B9 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B2
+// CHECK: [ B1 ]
+// CHECK: 1: [B2.4].~A() (Implicit destructor)
+// 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: 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: 5: b.operator int()
+// CHECK: T: switch [B2.5]
+// CHECK: Predecessors (1): B9
+// CHECK: Successors (3): B3 B8
+// CHECK: B1
+// CHECK: [ B3 ]
+// CHECK: case 1:
+// CHECK: T: break;
+// CHECK: Predecessors (2): B2 B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1:
+// CHECK: 2: A f;
+// CHECK: 3: [B4.2].~A() (Implicit destructor)
+// CHECK: 4: [B8.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B3
+// CHECK: [ B5 ]
+// CHECK: 1: return;
+// CHECK: 2: [B8.2].~A() (Implicit destructor)
+// CHECK: 3: [B2.4].~A() (Implicit destructor)
+// CHECK: 4: [B2.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B0
+// CHECK: [ B6 ]
+// CHECK: 1: UV
+// CHECK: T: if [B6.1]
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (2): B5 B4
+// CHECK: [ B7 ]
+// CHECK: 1: [B8.2].~A() (Implicit destructor)
+// CHECK: T: break;
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (1): B1
+// CHECK: [ B8 ]
+// CHECK: case 0:
+// CHECK: 1:
+// CHECK: 2: A c;
+// CHECK: 3: UV
+// CHECK: T: if [B8.3]
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (2): B7 B6
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (2): B1 B5
+// CHECK: Successors (0):
+// CHECK: [ B6 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B5
+// CHECK: [ B1 ]
+// CHECK: 1: [B2.2].~A() (Implicit destructor)
+// CHECK: 2: [B5.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: a
+// CHECK: 2: for (A a; [B2.4];)
+// CHECK:[B4.2] 3: b.operator int()
+// CHECK: 4: [B2.3]
+// CHECK: T: for (...; [B2.4]; )
+// CHECK: Predecessors (2): B3 B5
+// CHECK: Successors (2): B4 B1
+// CHECK: [ B3 ]
+// CHECK: 1: [B2.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B2
+// CHECK: [ B4 ]
+// 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: 2: A a;
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B2
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B12 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B11
+// CHECK: [ B1 ]
+// CHECK: 1: [B2.2].~A() (Implicit destructor)
+// CHECK: 2: [B11.4].~A() (Implicit destructor)
+// CHECK: 3:
+// CHECK: 4: A f;
+// CHECK: 5: [B1.4].~A() (Implicit destructor)
+// CHECK: 6: [B11.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B9 B2
+// 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: 3: c.operator int()
+// CHECK: 4: [B2.3]
+// CHECK: T: for (...; [B2.4]; )
+// CHECK: Predecessors (2): B3 B11
+// CHECK: Successors (2): B10 B1
+// CHECK: [ B3 ]
+// CHECK: 1: [B2.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B4 B7
+// CHECK: Successors (1): B2
+// CHECK: [ B4 ]
+// CHECK: 1:
+// CHECK: 2: A e;
+// CHECK: 3: [B4.2].~A() (Implicit destructor)
+// CHECK: 4: [B10.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B3
+// CHECK: [ B5 ]
+// CHECK: 1: return;
+// CHECK: 2: [B10.2].~A() (Implicit destructor)
+// CHECK: 3: [B2.2].~A() (Implicit destructor)
+// CHECK: 4: [B11.4].~A() (Implicit destructor)
+// CHECK: 5: [B11.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B6
+// CHECK: Successors (1): B0
+// CHECK: [ B6 ]
+// CHECK: 1: UV
+// CHECK: T: if [B6.1]
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (2): B5 B4
+// CHECK: [ B7 ]
+// CHECK: 1: [B10.2].~A() (Implicit destructor)
+// CHECK: T: continue;
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (1): B3
+// CHECK: [ B8 ]
+// CHECK: 1: UV
+// CHECK: T: if [B8.1]
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (2): B7 B6
+// CHECK: [ B9 ]
+// CHECK: 1: [B10.2].~A() (Implicit destructor)
+// CHECK: T: break;
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (1): B1
+// CHECK: [ B10 ]
+// 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: 2: A a;
+// CHECK: 3:
+// CHECK: 4: A b;
+// CHECK: Predecessors (1): B12
+// CHECK: Successors (1): B2
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (2): B1 B5
+// CHECK: Successors (0):
+// CHECK: [ B3 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B0
+// CHECK: [ B1 ]
+// CHECK: T: try ...
+// CHECK: Predecessors (0):
+// CHECK: Successors (2): B2 B0
+// CHECK: [ B2 ]
+// CHECK: catch (const A &e):
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (3): B2 B1 B3
+// CHECK: Successors (0):
+// CHECK: [ B3 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B0
+// CHECK: [ B1 ]
+// CHECK: T: try ...
+// CHECK: Predecessors (0):
+// CHECK: Successors (2): B2 B0
+// CHECK: [ B2 ]
+// CHECK: catch (A e):
+// CHECK: 1: .~A() (Implicit destructor)
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (1): B0
+// 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
new file mode 100644
index 000000000000..800763b25b49
--- /dev/null
+++ b/test/Analysis/base-init.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -analyzer-inline-call -cfg-add-initializers -verify %s
+
+class A {
+ int x;
+public:
+ A();
+ int getx() const {
+ return x;
+ }
+};
+
+A::A() : x(0) {
+}
+
+class B : public A {
+ int y;
+public:
+ B();
+};
+
+B::B() {
+}
+
+void f() {
+ B b;
+ if (b.getx() != 0) {
+ int *p = 0;
+ *p = 0; // no-warning
+ }
+}
diff --git a/test/Analysis/blocks.m b/test/Analysis/blocks.m
index b05b198c5489..e18d7cfb7be6 100644
--- a/test/Analysis/blocks.m
+++ b/test/Analysis/blocks.m
@@ -73,7 +73,7 @@ void test1(NSString *format, ...) {
void test2() {
static int y = 0;
int x;
- ^{ y = x + 1; }(); // expected-warning{{Variable 'x' is captured by block with a garbage value}}
+ ^{ y = x + 1; }(); // expected-warning{{Variable 'x' is uninitialized when captured by block}}
}
void test2_b() {
@@ -86,5 +86,5 @@ void test2_b() {
void test2_c() {
typedef void (^myblock)(void);
- myblock f = ^() { f(); }; // expected-warning{{Variable 'f' is captured by block with a garbage value}}
+ myblock f = ^() { f(); }; // expected-warning{{Variable 'f' is uninitialized when captured by block}}
} \ No newline at end of file
diff --git a/test/Analysis/bstring.c b/test/Analysis/bstring.c
index ffe420f72517..eb235430aac0 100644
--- a/test/Analysis/bstring.c
+++ b/test/Analysis/bstring.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
+// 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
//===----------------------------------------------------------------------===
// Declarations
diff --git a/test/Analysis/chroot.c b/test/Analysis/chroot.c
new file mode 100644
index 000000000000..5b98a7197408
--- /dev/null
+++ b/test/Analysis/chroot.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.experimental.Chroot -analyzer-store region -verify %s
+
+extern int chroot(const char* path);
+extern int chdir(const char* path);
+
+void foo(void) {
+}
+
+void f1(void) {
+ chroot("/usr/local"); // root changed.
+ foo(); // expected-warning {{No call of chdir("/") immediately after chroot}}
+}
+
+void f2(void) {
+ chroot("/usr/local"); // root changed.
+ chdir("/"); // enter the jail.
+ foo(); // no-warning
+}
+
+void f3(void) {
+ chroot("/usr/local"); // root changed.
+ chdir("../"); // change working directory, still out of jail.
+ foo(); // expected-warning {{No call of chdir("/") immediately after chroot}}
+}
diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c
index bb2b2fe7292e..1a33349960fb 100644
--- a/test/Analysis/complex.c
+++ b/test/Analysis/complex.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -Wno-unreachable-code -ffreestanding %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -Wno-unreachable-code -ffreestanding %s
#include <stdint.h>
diff --git a/test/Analysis/conditional-op-missing-lhs.c b/test/Analysis/conditional-op-missing-lhs.c
index 86882a5ac4b6..e738964194d9 100644
--- a/test/Analysis/conditional-op-missing-lhs.c
+++ b/test/Analysis/conditional-op-missing-lhs.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -warn-uninit-values -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=core.DeadStores -warn-uninit-values -verify %s
void f1()
{
diff --git a/test/Analysis/constant-folding.c b/test/Analysis/constant-folding.c
index 9191a9e0578e..bb339f6957a1 100644
--- a/test/Analysis/constant-folding.c
+++ b/test/Analysis/constant-folding.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-experimental-checks -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
new file mode 100644
index 000000000000..c9775df7e2d0
--- /dev/null
+++ b/test/Analysis/cxx-crashes.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -verify %s
+
+int f1(char *dst) {
+ char *p = dst + 4;
+ char *q = dst + 3;
+ return !(q >= p);
+}
+
+long f2(char *c) {
+ return long(c) & 1;
+}
+
+bool f3() {
+ return !false;
+}
+
+void *f4(int* w) {
+ return reinterpret_cast<void*&>(w);
+}
+
+namespace {
+
+struct A { };
+struct B {
+ operator A() { return A(); }
+};
+
+A f(char *dst) {
+ B b;
+ return b;
+}
+
+}
+
+namespace {
+
+struct S {
+ void *p;
+};
+
+void *f(S* w) {
+ return &reinterpret_cast<void*&>(*w);
+}
+
+}
diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c
index 57d5d112d717..7fc0f0464d72 100644
--- a/test/Analysis/dead-stores.c
+++ b/test/Analysis/dead-stores.c
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-check-dead-stores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.experimental.IdempotentOps -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.experimental.IdempotentOps -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-checker=core.DeadStores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.experimental.IdempotentOps -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-checker=core.DeadStores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.experimental.IdempotentOps -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-checker=core.DeadStores -fblocks -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -Wunused-variable -analyze -analyzer-checker=core.experimental.IdempotentOps -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-checker=core.DeadStores -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'}}
@@ -13,7 +13,7 @@ void f1() {
void f2(void *b) {
char *c = (char*)b; // no-warning
char *d = b+1; // expected-warning {{never read}} expected-warning{{unused variable 'd'}}
- printf("%s", c); // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \
+ printf("%s", c); // 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'}}
}
@@ -44,10 +44,11 @@ void f5() {
}
+//
int f6() {
int x = 4;
- ++x; // expected-warning{{never read}}
+ ++x; // no-warning
return 1;
}
@@ -75,9 +76,11 @@ int f7d(int *p) {
return 1;
}
+// Don't warn for dead stores in nested expressions. We have yet
+// to see a real bug in this scenario.
int f8(int *p) {
extern int *baz();
- if ((p = baz())) // expected-warning{{Although the value}}
+ if ((p = baz())) // no-warning
return 1;
return 0;
}
@@ -148,9 +151,11 @@ void f15(unsigned x, unsigned y) {
int z[count]; // expected-warning{{unused variable 'z'}}
}
+// Don't warn for dead stores in nested expressions. We have yet
+// to see a real bug in this scenario.
int f16(int x) {
x = x * 2;
- x = sizeof(int [x = (x || x + 1) * 2]) // expected-warning{{Although the value stored to 'x' is used}} expected-warning{{The left operand to '*' is always 1}}
+ x = sizeof(int [x = (x || x + 1) * 2]) // expected-warning{{The left operand to '+' is always 0}} expected-warning{{The left operand to '*' is always 1}}
? 5 : 8;
return x;
}
@@ -171,11 +176,35 @@ int f18() {
x = 10; // expected-warning{{Value stored to 'x' is never read}}
while (1)
x = 10; // expected-warning{{Value stored to 'x' is never read}}
+ // unreachable.
do
- x = 10; // expected-warning{{Value stored to 'x' is never read}}
+ x = 10; // no-warning
while (1);
+ return (x = 10); // no-warning
+}
+
+int f18_a() {
+ int x = 0; // no-warning
+ return (x = 10); // no-warning
+}
+
+void f18_b() {
+ int x = 0; // no-warning
+ if (1)
+ x = 10; // expected-warning{{Value stored to 'x' is never read}}
+}
+
+void f18_c() {
+ int x = 0;
+ while (1)
+ x = 10; // expected-warning{{Value stored to 'x' is never read}}
+}
- return (x = 10); // expected-warning{{Although the value stored to 'x' is used in the enclosing expression, the value is never actually read from 'x'}}
+void f18_d() {
+ int x = 0; // no-warning
+ do
+ x = 10; // expected-warning{{Value stored to 'x' is never read}}
+ while (1);
}
// PR 3514: false positive `dead initialization` warning for init to global
@@ -203,7 +232,7 @@ void halt() __attribute__((noreturn));
int f21() {
int x = 4;
- ++x; // expected-warning{{never read}}
+ x = x + 1; // expected-warning{{never read}}
if (1) {
halt();
(void)x;
@@ -235,7 +264,7 @@ void f22() {
int y19 = 4;
int y20 = 4;
- ++x; // expected-warning{{never read}}
+ x = x + 1; // expected-warning{{never read}}
++y1;
++y2;
++y3;
@@ -486,3 +515,16 @@ void rdar8320674(s_rdar8320674 *z, unsigned y, s2_rdar8320674 *st, int m)
}while (--m);
}
+// Avoid dead stores resulting from an assignment (and use) being unreachable.
+void rdar8405222_aux(int i);
+void rdar8405222() {
+ const int show = 0;
+ int i = 0;
+
+ if (show)
+ i = 5; // no-warning
+
+ if (show)
+ rdar8405222_aux(i);
+}
+
diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp
index b21ffad6c5f0..59a48bada1b3 100644
--- a/test/Analysis/dead-stores.cpp
+++ b/test/Analysis/dead-stores.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -analyzer-check-dead-stores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -analyzer-check-dead-stores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -analyzer-check-dead-stores -verify -Wno-unreachable-code %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-check-dead-stores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fexceptions -analyze -analyzer-experimental-internal-checks -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
+// RUN: %clang_cc1 -fexceptions -analyze -analyzer-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -analyzer-checker=core.DeadStores -verify -Wno-unreachable-code %s
//===----------------------------------------------------------------------===//
// Basic dead store checking (but in C++ mode).
@@ -12,7 +12,7 @@ int j;
void test1() {
int x = 4;
- ++x; // expected-warning{{never read}}
+ x = x + 1; // expected-warning{{never read}}
switch (j) {
case 1:
@@ -69,11 +69,11 @@ void test2_b() {
//===----------------------------------------------------------------------===//
void test3_a(int x) {
- ++x; // expected-warning{{never read}}
+ x = x + 1; // expected-warning{{never read}}
}
void test3_b(int &x) {
- ++x; // no-warninge
+ x = x + 1; // no-warninge
}
void test3_c(int x) {
@@ -100,3 +100,15 @@ static void test_new(unsigned n) {
char **p = new char* [n]; // expected-warning{{never read}}
}
+//===----------------------------------------------------------------------===//
+// Dead stores in namespaces.
+//===----------------------------------------------------------------------===//
+
+namespace foo {
+ int test_4(int x) {
+ x = 2; // expected-warning{{Value stored to 'x' is never read}}
+ x = 2;
+ return x;
+ }
+}
+
diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m
index 701e5802b25e..00c9e53d2525 100644
--- a/test/Analysis/dead-stores.m
+++ b/test/Analysis/dead-stores.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=core.DeadStores -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@@ -41,3 +41,38 @@ void DeadStoreTest(NSObject *anObject) {
void rdar_7631278(NSObject *x) {
x = ((void*)0);
}
+
+// This test case issuing a bogus warning for the declaration of 'isExec'
+// because the compound statement for the @synchronized was being visited
+// twice by the LiveVariables analysis.
+BOOL baz_rdar8527823();
+void foo_rdar8527823();
+@interface RDar8527823
+- (void) bar_rbar8527823;
+@end
+@implementation RDar8527823
+- (void) bar_rbar8527823
+{
+ @synchronized(self) {
+ BOOL isExec = baz_rdar8527823(); // no-warning
+ if (isExec) foo_rdar8527823();
+ }
+}
+@end
+
+// Don't flag dead stores to assignments to self within a nested assignment.
+@interface Rdar7947686
+- (id) init;
+@end
+
+@interface Rdar7947686_B : Rdar7947686
+- (id) init;
+@end
+
+@implementation Rdar7947686_B
+- (id) init {
+ id x = (self = [super init]); // no-warning
+ return x;
+}
+@end
+
diff --git a/test/Analysis/derived-to-base.cpp b/test/Analysis/derived-to-base.cpp
new file mode 100644
index 000000000000..2a9244ef34b2
--- /dev/null
+++ b/test/Analysis/derived-to-base.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region %s
+
+class A {
+protected:
+ int x;
+};
+
+class B : public A {
+public:
+ void f();
+};
+
+void B::f() {
+ x = 3;
+}
diff --git a/test/Analysis/dtor.cpp b/test/Analysis/dtor.cpp
new file mode 100644
index 000000000000..ea5b04684d7f
--- /dev/null
+++ b/test/Analysis/dtor.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -analyzer-inline-call -cfg-add-implicit-dtors -verify %s
+
+class A {
+public:
+ ~A() {
+ int *x = 0;
+ *x = 3; // expected-warning{{Dereference of null pointer}}
+ }
+};
+
+int main() {
+ A a;
+}
diff --git a/test/Analysis/dtors-in-dtor-cfg-output.cpp b/test/Analysis/dtors-in-dtor-cfg-output.cpp
new file mode 100644
index 000000000000..776548318003
--- /dev/null
+++ b/test/Analysis/dtors-in-dtor-cfg-output.cpp
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -cfg-add-implicit-dtors %s 2>&1 | FileCheck %s
+// XPASS: *
+
+class A {
+public:
+ ~A() {}
+};
+
+class B : public virtual A {
+public:
+ ~B() {}
+};
+
+class C : public virtual A {
+public:
+ ~C() {}
+};
+
+class TestOrder : public C, public B, public virtual A {
+ A a;
+ int i;
+ A *p;
+public:
+ ~TestOrder();
+};
+
+TestOrder::~TestOrder() {}
+
+class TestArray {
+ A a[2];
+ A b[0];
+public:
+ ~TestArray();
+};
+
+TestArray::~TestArray() {}
+
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: this->a.~A() (Member object destructor)
+// CHECK: 2: ~B() (Base object destructor)
+// CHECK: 3: ~C() (Base object destructor)
+// CHECK: 4: ~A() (Base object destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: this->a.~A() (Member object destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
diff --git a/test/Analysis/exercise-ps.c b/test/Analysis/exercise-ps.c
index 0a95b7055601..196b67936a9c 100644
--- a/test/Analysis/exercise-ps.c
+++ b/test/Analysis/exercise-ps.c
@@ -19,6 +19,6 @@ void_typedef f2_helper();
static void f2(void *buf) {
F12_typedef* x;
x = f2_helper();
- memcpy((&x[1]), (buf), 1); // expected-warning{{implicitly declaring C library function 'memcpy' with type 'void *(void *, void const *}} \
+ memcpy((&x[1]), (buf), 1); // expected-warning{{implicitly declaring C library function 'memcpy' with type 'void *(void *, const void *}} \
// expected-note{{please include the header <string.h> or explicitly provide a declaration for 'memcpy'}}
}
diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c
index c97d4f82cdc0..0827f3dbad18 100644
--- a/test/Analysis/fields.c
+++ b/test/Analysis/fields.c
@@ -17,3 +17,13 @@ void f() {
struct s a;
int *p = &(a.n) + 1;
}
+
+typedef struct {
+ int x,y;
+} Point;
+
+Point getit(void);
+void test() {
+ Point p;
+ (void)(p = getit()).x;
+}
diff --git a/test/Analysis/idempotent-operations-limited-loops.c b/test/Analysis/idempotent-operations-limited-loops.c
new file mode 100644
index 000000000000..e4c34cdead35
--- /dev/null
+++ b/test/Analysis/idempotent-operations-limited-loops.c
@@ -0,0 +1,21 @@
+// 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
+
+void always_warning() { int *p = 0; *p = 0xDEADBEEF; } // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
+
+// This test case previously caused a bogus idempotent operation warning
+// due to us not properly culling warnings due to incomplete analysis of loops.
+int pr8403()
+{
+ int i;
+ for(i=0; i<10; i++)
+ {
+ int j;
+ for(j=0; j+1<i; j++)
+ {
+ }
+ }
+ return 0;
+}
+
diff --git a/test/Analysis/idempotent-operations.c b/test/Analysis/idempotent-operations.c
index 5c9a59d73616..b47394c1626b 100644
--- a/test/Analysis/idempotent-operations.c
+++ b/test/Analysis/idempotent-operations.c
@@ -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-check-idempotent-operations -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 -verify %s
// Basic tests
@@ -187,3 +187,50 @@ int false7() {
return a;
}
+
+// Check truncations do not flag as self-assignments
+void false8() {
+ int a = 10000000;
+ a = (short)a; // no-warning
+ test(a);
+}
+
+// This test case previously flagged a warning at 'b == c' because the
+// analyzer previously allowed 'UnknownVal' as the index for ElementRegions.
+typedef struct RDar8431728_F {
+ int RDar8431728_A;
+ unsigned char *RDar8431728_B;
+ int RDar8431728_E[6];
+} RDar8431728_D;
+static inline int RDar8431728_C(RDar8431728_D * s, int n,
+ unsigned char **RDar8431728_B_ptr) {
+ int xy, wrap, pred, a, b, c;
+
+ xy = s->RDar8431728_E[n];
+ wrap = s->RDar8431728_A;
+
+ a = s->RDar8431728_B[xy - 1];
+ b = s->RDar8431728_B[xy - 1 - wrap];
+ c = s->RDar8431728_B[xy - wrap];
+
+ if (b == c) { // no-warning
+ pred = a;
+ } else {
+ pred = c;
+ }
+
+ *RDar8431728_B_ptr = &s->RDar8431728_B[xy];
+
+ return pred;
+}
+
+// <rdar://problem/8601243> - Don't warn on pointer arithmetic. This
+// is often idiomatic.
+unsigned rdar8601243_aux(unsigned n);
+void rdar8601243() {
+ char arr[100];
+ char *start = arr;
+ start = start + rdar8601243_aux(sizeof(arr) - (arr - start)); // no-warning
+ (void) start;
+}
+
diff --git a/test/Analysis/idempotent-operations.cpp b/test/Analysis/idempotent-operations.cpp
index c5d1ceb8aff0..c213dc690e44 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-check-idempotent-operations -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 -verify %s
// C++ specific false positives
diff --git a/test/Analysis/idempotent-operations.m b/test/Analysis/idempotent-operations.m
new file mode 100644
index 000000000000..a77e2cbf8719
--- /dev/null
+++ b/test/Analysis/idempotent-operations.m
@@ -0,0 +1,42 @@
+// 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
+
+typedef signed char BOOL;
+typedef unsigned long NSUInteger;
+typedef struct _NSZone NSZone;
+@protocol NSObject - (BOOL)isEqual:(id)object;
+@end
+
+@interface NSObject {}
+ @property int locked;
+ @property(nonatomic, readonly) NSObject *media;
+@end
+
+// <rdar://problem/8725041> - Don't flag idempotent operation warnings when
+// a method may invalidate an instance variable.
+@interface Rdar8725041 : NSObject {
+ id _attribute;
+}
+ - (void) method2;
+@end
+
+@implementation Rdar8725041
+- (BOOL) method1 {
+ BOOL needsUpdate = (BOOL)0;
+ id oldAttribute = _attribute;
+ [self method2];
+ needsUpdate |= (_attribute != oldAttribute); // no-warning
+ return needsUpdate;
+}
+
+- (void) method2
+{
+ _attribute = ((void*)0);
+}
+@end
+
+// Test that the idempotent operations checker works in the prescence
+// of property expressions.
+void pr9116(NSObject *placeholder) {
+ int x = placeholder.media.locked = placeholder ? 1 : 0;
+}
+
diff --git a/test/Analysis/initializer.cpp b/test/Analysis/initializer.cpp
new file mode 100644
index 000000000000..2fa3a9eb86a7
--- /dev/null
+++ b/test/Analysis/initializer.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -cfg-add-initializers -verify %s
+
+class A {
+ int x;
+public:
+ A();
+};
+
+A::A() : x(0) {
+ if (x != 0) {
+ int *p = 0;
+ *p = 0; // no-warning
+ }
+}
diff --git a/test/Analysis/initializers-cfg-output.cpp b/test/Analysis/initializers-cfg-output.cpp
new file mode 100644
index 000000000000..5c5d51494749
--- /dev/null
+++ b/test/Analysis/initializers-cfg-output.cpp
@@ -0,0 +1,94 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -cfg-add-initializers %s 2>&1 | FileCheck %s
+// XPASS: *
+
+class A {
+public:
+ A() {}
+ A(int i) {}
+};
+
+class B : public virtual A {
+public:
+ B() {}
+ B(int i) : A(i) {}
+};
+
+class C : public virtual A {
+public:
+ C() {}
+ C(int i) : A(i) {}
+};
+
+class TestOrder : public C, public B, public A {
+ int i;
+ int& r;
+public:
+ TestOrder();
+};
+
+TestOrder::TestOrder()
+ : r(i), B(), i(), C() {
+ A a;
+}
+
+class TestControlFlow {
+ int x, y, z;
+public:
+ TestControlFlow(bool b);
+};
+
+TestControlFlow::TestControlFlow(bool b)
+ : y(b ? 0 : 1)
+ , x(0)
+ , z(y) {
+ int v;
+}
+
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1:
+// CHECK: 2: A([B1.1]) (Base initializer)
+// CHECK: 3:
+// CHECK: 4: C([B1.3]) (Base initializer)
+// CHECK: 5:
+// CHECK: 6: B([B1.5]) (Base initializer)
+// CHECK: 7:
+// CHECK: 8: A([B1.7]) (Base initializer)
+// CHECK: 9: i(/*implicit*/int()) (Member initializer)
+// CHECK: 10: r(this->i) (Member initializer)
+// CHECK: 11:
+// CHECK: 12: A a;
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B5 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B4
+// CHECK: [ B1 ]
+// CHECK: 1: [B4.2] ? [B2.1] : [B3.1]
+// CHECK: 2: y([B1.1]) (Member initializer)
+// CHECK: 3: z(this->y) (Member initializer)
+// CHECK: 4: int v;
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: 0
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: 1
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1: x(0) (Member initializer)
+// CHECK: 2: b
+// CHECK: T: [B4.2] ? ... : ...
+// CHECK: Predecessors (1): B5
+// CHECK: Successors (2): B2 B3
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
diff --git a/test/Analysis/inline.c b/test/Analysis/inline.c
index 50c1a54d1016..d7a599a76545 100644
--- a/test/Analysis/inline.c
+++ b/test/Analysis/inline.c
@@ -1,14 +1,14 @@
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
-int f1() {
+int test1_f1() {
int y = 1;
y++;
return y;
}
-void f2() {
+void test1_f2() {
int x = 1;
- x = f1();
+ x = test1_f1();
if (x == 1) {
int *p = 0;
*p = 3; // no-warning
@@ -18,3 +18,13 @@ void f2() {
*p = 3; // expected-warning{{Dereference of null pointer (loaded from variable 'p')}}
}
}
+
+// Test that inlining works when the declared function has less arguments
+// than the actual number in the declaration.
+void test2_f1() {}
+int test2_f2();
+
+void test2_f3() {
+ test2_f1(test2_f2()); // expected-warning{{too many arguments in call to 'test2_f1'}}
+}
+
diff --git a/test/Analysis/lvalue.cpp b/test/Analysis/lvalue.cpp
new file mode 100644
index 000000000000..f19c59d9d258
--- /dev/null
+++ b/test/Analysis/lvalue.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+
+int f1() {
+ int x = 0, y = 1;
+ return x += y; // Should bind a location to 'x += y'. No crash.
+}
diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c
index e443150e1fbb..fdfccab204ce 100644
--- a/test/Analysis/malloc.c
+++ b/test/Analysis/malloc.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-store=region -verify %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
void free(void *);
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index 47f14447d6bd..b5b81e3402a1 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -1,8 +1,10 @@
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-inline-call -analyzer-store region -verify %s
+// XFAIL: *
+
struct A {
int x;
A(int a) { x = a; }
- int getx() { return x; }
+ int getx() const { return x; }
};
void f1() {
@@ -16,3 +18,24 @@ void f1() {
}
}
+void f2() {
+ const A &x = A(3);
+ if (x.getx() == 3) {
+ int *p = 0;
+ *p = 3; // expected-warning{{Dereference of null pointer}}
+ } else {
+ int *p = 0;
+ *p = 3; // no-warning
+ }
+}
+
+void f3() {
+ const A &x = (A)3;
+ if (x.getx() == 3) {
+ int *p = 0;
+ *p = 3; // expected-warning{{Dereference of null pointer}}
+ } else {
+ int *p = 0;
+ *p = 3; // no-warning
+ }
+}
diff --git a/test/Analysis/misc-ps-64.m b/test/Analysis/misc-ps-64.m
index 0dbd6cb948b3..f65673eea24f 100644
--- a/test/Analysis/misc-ps-64.m
+++ b/test/Analysis/misc-ps-64.m
@@ -14,7 +14,7 @@ typedef unsigned char Boolean;
typedef const struct __CFDictionary * CFDictionaryRef;
extern Boolean CFDictionaryGetValueIfPresent(CFDictionaryRef theDict, const void *key, const void **value);
-static void shazam(NSUInteger i, unsigned char **out);
+void shazam(NSUInteger i, unsigned char **out);
void rdar_6440393_1(NSDictionary *dict) {
NSInteger x = 0;
diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp
index bfa5e5cbb9b0..1dba09d76ddc 100644
--- a/test/Analysis/misc-ps-region-store.cpp
+++ b/test/Analysis/misc-ps-region-store.cpp
@@ -159,3 +159,84 @@ int r8375510(R8375510 x, R8375510 y) {
for (; ; x++) { }
}
+// PR8419 -- this used to crash.
+
+class String8419 {
+ public:
+ char& get(int n);
+ char& operator[](int n);
+};
+
+char& get8419();
+
+void Test8419() {
+ String8419 s;
+ ++(s.get(0));
+ get8419()--; // used to crash
+ --s[0]; // used to crash
+ s[0] &= 1; // used to crash
+ s[0]++; // used to crash
+}
+
+// PR8426 -- this used to crash.
+
+void Use(void* to);
+
+template <class T> class Foo {
+ ~Foo();
+ struct Bar;
+ Bar* bar_;
+};
+
+template <class T> Foo<T>::~Foo() {
+ Use(bar_);
+ T::DoSomething();
+ bar_->Work();
+}
+
+// PR8427 -- this used to crash.
+
+class Dummy {};
+
+bool operator==(Dummy, int);
+
+template <typename T>
+class Foo2 {
+ bool Bar();
+};
+
+template <typename T>
+bool Foo2<T>::Bar() {
+ return 0 == T();
+}
+
+// PR8433 -- this used to crash.
+
+template <typename T>
+class Foo3 {
+ public:
+ void Bar();
+ void Baz();
+ T value_;
+};
+
+template <typename T>
+void Foo3<T>::Bar() {
+ Baz();
+ value_();
+}
+
+//===---------------------------------------------------------------------===//
+// Handle misc. C++ constructs.
+//===---------------------------------------------------------------------===//
+
+namespace fum {
+ int i = 3;
+};
+
+void test_namespace() {
+ // Previously triggered a crash.
+ using namespace fum;
+ int x = i;
+}
+
diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m
index a4e0d0bfa616..b35a834c3352 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-experimental-internal-checks -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-experimental-internal-checks -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.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-experimental-internal-checks -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 -analyzer-checker=core.experimental.CastToStruct -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
typedef long unsigned int size_t;
void *memcpy(void *, const void *, size_t);
@@ -394,7 +394,7 @@ void rdar_7332673_test1() {
int rdar_7332673_test2_aux(char *x);
void rdar_7332673_test2() {
char *value;
- if ( rdar_7332673_test2_aux(value) != 1 ) {} // expected-warning{{Pass-by-value argument in function call is undefined}}
+ if ( rdar_7332673_test2_aux(value) != 1 ) {} // expected-warning{{Function call argument is an uninitialized value}}
}
//===----------------------------------------------------------------------===//
@@ -671,7 +671,7 @@ typedef void (^RDar_7462324_Callback)(id obj);
builder = ^(id object) {
id x;
if (object) {
- builder(x); // expected-warning{{Pass-by-value argument in function call is undefined}}
+ builder(x); // expected-warning{{Function call argument is an uninitialized value}}
}
};
builder(target);
@@ -1103,16 +1103,18 @@ void pr8015_C() {
}
}
-// FIXME: This is a false positive due to not reasoning about symbolic
-// array indices correctly. Discussion in PR 8015.
+// Tests that we correctly handle that 'number' is perfectly constrained
+// after 'if (nunber == 0)', allowing us to resolve that
+// numbers[number] == numbers[0].
void pr8015_D_FIXME() {
int number = pr8015_A();
const char *numbers[] = { "zero" };
if (number == 0) {
- if (numbers[number] == numbers[0])
+ if (numbers[number] == numbers[0]) // expected-warning{{Both operands to '==' always have the same value}}
return;
+ // Unreachable.
int *p = 0;
- *p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
+ *p = 0xDEADBEEF; // no-warnng
}
}
@@ -1140,3 +1142,98 @@ void pr8015_F_FIXME() {
}
}
+// PR 8141. Previously the statement expression in the for loop caused
+// the CFG builder to crash.
+struct list_pr8141
+{
+ struct list_pr8141 *tail;
+};
+
+struct list_pr8141 *
+pr8141 (void) {
+ struct list_pr8141 *items;
+ for (;; items = ({ do { } while (0); items->tail; })) // expected-warning{{Dereference of undefined pointer value}}
+ {
+ }
+}
+
+// Don't crash when building the CFG.
+void do_not_crash(int x) {
+ while (x - ({do {} while (0); x; })) {
+ }
+}
+
+// <rdar://problem/8424269> - Handle looking at the size of a VLA in
+// ArrayBoundChecker. Nothing intelligent (yet); just don't crash.
+typedef struct RDar8424269_A {
+ int RDar8424269_C;
+} RDar8424269_A;
+static void RDar8424269_B(RDar8424269_A *p, unsigned char *RDar8424269_D,
+ const unsigned char *RDar8424269_E, int RDar8424269_F,
+ int b_w, int b_h, int dx, int dy) {
+ int x, y, b, r, l;
+ unsigned char tmp2t[3][RDar8424269_F * (32 + 8)];
+ unsigned char *tmp2 = tmp2t[0];
+ if (p && !p->RDar8424269_C)
+ b = 15;
+ tmp2 = tmp2t[1];
+ if (b & 2) { // expected-warning{{The left operand of '&' is a garbage value}}
+ for (y = 0; y < b_h; y++) {
+ for (x = 0; x < b_w + 1; x++) {
+ int am = 0;
+ tmp2[x] = am;
+ }
+ }
+ }
+ tmp2 = tmp2t[2];
+}
+
+// <rdar://problem/8642434> - Handle transparent unions with the AttrNonNullChecker.
+typedef union {
+ struct rdar_8642434_typeA *_dq;
+}
+rdar_8642434_typeB __attribute__((transparent_union));
+
+__attribute__((visibility("default"))) __attribute__((__nonnull__)) __attribute__((__nothrow__))
+void rdar_8642434_funcA(rdar_8642434_typeB object);
+
+void rdar_8642434_funcB(struct rdar_8642434_typeA *x, struct rdar_8642434_typeA *y) {
+ rdar_8642434_funcA(x);
+ if (!y)
+ rdar_8642434_funcA(y); // expected-warning{{Null pointer passed as an argument to a 'nonnull' parameter}}
+}
+
+// <rdar://problem/8848957> - Handle loads and stores from a symbolic index
+// into array without warning about an uninitialized value being returned.
+// While RegionStore can't fully reason about this example, it shouldn't
+// warn here either.
+typedef struct s_test_rdar8848957 {
+ int x, y, z;
+} s_test_rdar8848957;
+
+s_test_rdar8848957 foo_rdar8848957();
+int rdar8848957(int index) {
+ s_test_rdar8848957 vals[10];
+ vals[index] = foo_rdar8848957();
+ return vals[index].x; // no-warning
+}
+
+// PR 9049 - crash on symbolicating unions. This test exists solely to
+// test that the analyzer doesn't crash.
+typedef struct pr9048_cdev *pr9048_cdev_t;
+typedef union pr9048_abstracted_disklabel { void *opaque; } pr9048_disklabel_t;
+struct pr9048_diskslice { pr9048_disklabel_t ds_label; };
+struct pr9048_diskslices {
+ int dss_secmult;
+ struct pr9048_diskslice dss_slices[16];
+};
+void pr9048(pr9048_cdev_t dev, struct pr9048_diskslices * ssp, unsigned int slice)
+{
+ pr9048_disklabel_t lp;
+ struct pr9048_diskslice *sp;
+ sp = &ssp->dss_slices[slice];
+ if (ssp->dss_secmult == 1) {
+ } else if ((lp = sp->ds_label).opaque != ((void *) 0)) {
+ }
+}
+
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index 4fbaa49c1168..45b44b7412c9 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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=basic -fobjc-gc -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=basic -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-checker=core.experimental.IdempotentOps -analyzer-checker=core.experimental.CastToStruct -analyzer-checker=cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code %s
#ifndef __clang_analyzer__
#error __clang__analyzer__ not defined
@@ -794,7 +794,7 @@ int test_uninit_branch_c(void) {
void test_bad_call_aux(int x);
void test_bad_call(void) {
int y;
- test_bad_call_aux(y); // expected-warning{{Pass-by-value argument in function call is undefined}}
+ test_bad_call_aux(y); // expected-warning{{Function call argument is an uninitialized value}}
}
@interface TestBadArg {}
@@ -803,7 +803,7 @@ void test_bad_call(void) {
void test_bad_msg(TestBadArg *p) {
int y;
- [p testBadArg:y]; // expected-warning{{Pass-by-value argument in message expression is undefined}}
+ [p testBadArg:y]; // expected-warning{{Argument in message expression is an uninitialized value}}
}
//===----------------------------------------------------------------------===//
@@ -822,7 +822,7 @@ struct trie {
struct kwset {
struct trie *trie;
- unsigned char delta[10];
+ unsigned char y[10];
struct trie* next[10];
int d;
};
@@ -837,9 +837,9 @@ void f(kwset_t *kws, char const *p, char const *q) {
register char const *end = p;
register char const *lim = q;
register int d = 1;
- register unsigned char const *delta = kws->delta;
+ register unsigned char const *y = kws->y;
- d = delta[c = (end+=d)[-1]]; // no-warning
+ d = y[c = (end+=d)[-1]]; // no-warning
trie = next[c];
}
@@ -1068,3 +1068,168 @@ void pr8050(struct PR8050 **arg)
*arg = malloc(1);
}
+// <rdar://problem/5880430> Switch on enum should not consider default case live
+// if all enum values are covered
+enum Cases { C1, C2, C3, C4 };
+void test_enum_cases(enum Cases C) {
+ switch (C) {
+ case C1:
+ case C2:
+ case C4:
+ case C3:
+ return;
+ }
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+}
+
+void test_enum_cases_positive(enum Cases C) {
+ switch (C) { // expected-warning{{enumeration value 'C4' not handled in switch}}
+ case C1:
+ case C2:
+ case C3:
+ return;
+ }
+ int *p = 0;
+ *p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
+}
+
+// <rdar://problem/6351970> rule request: warn if synchronization mutex can be nil
+void rdar6351970() {
+ id x = 0;
+ @synchronized(x) {} // expected-warning{{Nil value used as mutex for @synchronized() (no synchronization will occur)}}
+}
+
+void rdar6351970_b(id x) {
+ if (!x)
+ @synchronized(x) {} // expected-warning{{Nil value used as mutex for @synchronized() (no synchronization will occur)}}
+}
+
+void rdar6351970_c() {
+ id x;
+ @synchronized(x) {} // expected-warning{{Uninitialized value used as mutex for @synchronized}}
+}
+
+@interface Rdar8578650
+- (id) foo8578650;
+@end
+
+void rdar8578650(id x) {
+ @synchronized (x) {
+ [x foo8578650];
+ }
+ // At this point we should assume that 'x' is not nil, not
+ // the inverse.
+ @synchronized (x) { // no-warning
+ }
+}
+
+// <rdar://problem/6352035> rule request: direct structure member access null pointer dereference
+@interface RDar6352035 {
+ int c;
+}
+- (void)foo;
+- (void)bar;
+@end
+
+@implementation RDar6352035
+- (void)foo {
+ RDar6352035 *friend = 0;
+ friend->c = 7; // expected-warning{{Instance variable access (via 'friend') results in a null pointer dereference}}
+}
+- (void)bar {
+ self = 0;
+ c = 7; // expected-warning{{Instance variable access (via 'self') results in a null pointer dereference}}
+}
+@end
+
+// PR 8149 - GNU statement expression in condition of ForStmt.
+// This previously triggered an assertion failure in CFGBuilder.
+void pr8149(void) {
+ for (; ({ do { } while (0); 0; });) { }
+}
+
+// PR 8458 - Make sure @synchronized doesn't crash with properties.
+@interface PR8458 {}
+@property(readonly) id lock;
+@end
+
+static
+void __PR8458(PR8458 *x) {
+ @synchronized(x.lock) {} // no-warning
+}
+
+// PR 8440 - False null dereference during store to array-in-field-in-global.
+// This test case previously resulted in a bogus null deref warning from
+// incorrect lazy symbolication logic in RegionStore.
+static struct {
+ int num;
+ char **data;
+} saved_pr8440;
+
+char *foo_pr8440();
+char **bar_pr8440();
+void baz_pr8440(int n)
+{
+ saved_pr8440.num = n;
+ if (saved_pr8440.data)
+ return;
+ saved_pr8440.data = bar_pr8440();
+ for (int i = 0 ; i < n ; i ++)
+ saved_pr8440.data[i] = foo_pr8440(); // no-warning
+}
+
+// Support direct accesses to non-null memory. Reported in:
+// PR 5272
+// <rdar://problem/6839683>
+int test_direct_address_load() {
+ int *p = (int*) 0x4000;
+ return *p; // no-warning
+}
+
+void pr5272_test() {
+ struct pr5272 { int var2; };
+ (*(struct pr5272*)0xBC000000).var2 = 0; // no-warning
+ (*(struct pr5272*)0xBC000000).var2 += 2; // no-warning
+}
+
+// Support casting the return value of function to another different type
+// This previously caused a crash, although we likely need more precise
+// reasoning here. <rdar://problem/8663544>
+void* rdar8663544();
+typedef struct {} Val8663544;
+Val8663544 bazR8663544() {
+ Val8663544(*func) () = (Val8663544(*) ()) rdar8663544;
+ return func();
+}
+
+// PR 8619 - Handle ternary expressions with a call to a noreturn function.
+// This previously resulted in a crash.
+void pr8619_noreturn(int x) __attribute__((noreturn));
+
+void pr8619(int a, int b, int c) {
+ a ?: pr8619_noreturn(b || c);
+}
+
+
+// PR 8646 - crash in the analyzer when handling unions.
+union pr8648_union {
+ signed long long pr8648_union_field;
+};
+void pr8648() {
+ long long y;
+ union pr8648_union x = { .pr8648_union_field = 0LL };
+ y = x.pr8648_union_field;
+
+ union pr8648_union z;
+ z = (union pr8648_union) { .pr8648_union_field = 0LL };
+
+ union pr8648_union w;
+ w = ({ (union pr8648_union) { .pr8648_union_field = 0LL }; });
+
+ // crash, no assignment
+ (void) ({ (union pr8648_union) { .pr8648_union_field = 0LL }; }).pr8648_union_field;
+
+ // crash with assignment
+ y = ({ (union pr8648_union) { .pr8648_union_field = 0LL }; }).pr8648_union_field;
+}
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
new file mode 100644
index 000000000000..4c754fb951ad
--- /dev/null
+++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -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.
+typedef struct RDar6888289_data {
+ long data[100];
+} RDar6888289_data;
+
+@interface RDar6888289
+{
+ RDar6888289 *x;
+}
+- (RDar6888289_data) test;
+- (RDar6888289_data) test2;
+- (void) invalidate;
+- (RDar6888289_data) getData;
+@end
+
+@implementation RDar6888289
+- (RDar6888289_data) test {
+ if (!x)
+ [self invalidate];
+ return [x getData];
+}
+- (RDar6888289_data) test2 {
+ if (!x) {}
+ return [x getData]; // expected-warning{{The receiver of message 'getData' is nil and returns a value of type 'RDar6888289_data' that will be garbage}}
+}
+
+- (void) invalidate {
+ x = self;
+}
+
+- (RDar6888289_data) getData {
+ return (RDar6888289_data) { 0 };
+}
+@end
+
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 5f5187194dab..6c8f525eb375 100644
--- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
+++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
@@ -2,11 +2,14 @@
// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -analyzer-check-objc-mem -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
@interface MyClass {}
- (void *)voidPtrM;
- (int)intM;
- (long long)longlongM;
+- (unsigned long long)unsignedLongLongM;
- (double)doubleM;
- (long double)longDoubleM;
- (void)voidM;
@@ -15,6 +18,7 @@
- (void *)voidPtrM { return (void *)0; }
- (int)intM { return 0; }
- (long long)longlongM { return 0; }
+- (unsigned long long)unsignedLongLongM { return 0; }
- (double)doubleM { return 0.0; }
- (long double)longDoubleM { return 0.0; }
- (void)voidM {}
@@ -30,20 +34,20 @@ void createFoo() {
void createFoo2() {
MyClass *obj = 0;
- long double ld = [obj longDoubleM]; // expected-warning{{The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage}}
+ long double ld = [obj longDoubleM];
}
void createFoo3() {
MyClass *obj;
obj = 0;
- long long ll = [obj longlongM]; // expected-warning{{The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage}}
+ long long ll = [obj longlongM];
}
void createFoo4() {
MyClass *obj = 0;
- double d = [obj doubleM]; // expected-warning{{The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage}}
+ double d = [obj doubleM];
}
void createFoo5() {
@@ -52,16 +56,23 @@ void createFoo5() {
double d = [obj doubleM]; // no-warning
}
+void createFoo6() {
+ MyClass *obj;
+ obj = 0;
+
+ unsigned long long ull = [obj unsignedLongLongM];
+}
+
void handleNilPruneLoop(MyClass *obj) {
if (!!obj)
return;
// Test if [obj intM] evaluates to 0, thus pruning the entire loop.
for (int i = 0; i < [obj intM]; i++) {
- long long j = [obj longlongM]; // no-warning
+ long long j = [obj longlongM];
}
- long long j = [obj longlongM]; // expected-warning{{The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage}}
+ long long j = [obj longlongM];
}
int handleVoidInComma() {
@@ -72,11 +83,16 @@ int handleVoidInComma() {
int marker(void) { // control reaches end of non-void function
}
-// CHECK-darwin8: control reaches end of non-void function
+
// CHECK-darwin8: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
// CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
// CHECK-darwin8: warning: The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage
+// CHECK-darwin8: warning: The receiver of message 'unsignedLongLongM' is nil and returns a value of type 'unsigned long long' that will be garbage
// CHECK-darwin8: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
-// CHECK-darwin8: 5 warnings generated
-// CHECK-darwin9: control reaches end of non-void function
+// CHECK-darwin9-NOT: warning: The receiver of message 'longDoubleM' is nil and returns a value of type 'long double' that will be garbage
+// CHECK-darwin9-NOT: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
+// CHECK-darwin9-NOT: warning: The receiver of message 'doubleM' is nil and returns a value of type 'double' that will be garbage
+// CHECK-darwin9-NOT: warning: The receiver of message 'unsignedLongLongM' is nil and returns a value of type 'unsigned long long' that will be garbage
+// CHECK-darwin9-NOT: warning: The receiver of message 'longlongM' is nil and returns a value of type 'long long' that will be garbage
// CHECK-darwin9: 1 warning generated
+
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c
index 8daa84506818..5db4923cd34d 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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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-experimental-internal-checks -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.experimental.IdempotentOps -analyzer-experimental-internal-checks -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.IdempotentOps -analyzer-experimental-internal-checks -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.IdempotentOps -analyzer-experimental-internal-checks -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.IdempotentOps -analyzer-experimental-internal-checks -std=gnu99 -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s -Wreturn-type
typedef unsigned uintptr_t;
@@ -26,7 +26,7 @@ int f2(struct foo_struct* p) {
if (p)
p->x = 1;
- return p->x++; // expected-warning{{Field access results in a dereference of a null pointer (loaded from variable 'p')}}
+ return p->x++; // expected-warning{{Access to field 'x' results in a dereference of a null pointer (loaded from variable 'p')}}
}
int f3(char* x) {
@@ -36,7 +36,7 @@ int f3(char* x) {
if (x)
return x[i - 1];
- return x[i+1]; // expected-warning{{Dereference of null pointer}}
+ return x[i+1]; // expected-warning{{Array access (from variable 'x') results in a null pointer dereference}}
}
int f3_b(char* x) {
@@ -46,7 +46,7 @@ int f3_b(char* x) {
if (x)
return x[i - 1];
- return x[i+1]++; // expected-warning{{Dereference of null pointer}}
+ return x[i+1]++; // expected-warning{{Array access (from variable 'x') results in a null pointer dereference}}
}
int f4(int *p) {
@@ -237,7 +237,7 @@ int* f10(int* p, signed char x, int y) {
// Test case from <rdar://problem/6407949>
void f11(unsigned i) {
int *x = 0;
- if (i >= 0) {
+ if (i >= 0) { // expected-warning{{always true}}
// always true
} else {
*x = 42; // no-warning
@@ -288,7 +288,7 @@ void pr4759_aux(int *p) __attribute__((nonnull));
void pr4759() {
int *p;
- pr4759_aux(p); // expected-warning{{undefined}}
+ pr4759_aux(p); // expected-warning{{Function call argument is an uninitialized value}}
}
diff --git a/test/Analysis/operator-calls.cpp b/test/Analysis/operator-calls.cpp
new file mode 100644
index 000000000000..892a1ab0769f
--- /dev/null
+++ b/test/Analysis/operator-calls.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-experimental-checks -verify %s
+struct X0 { };
+bool operator==(const X0&, const X0&);
+
+// PR7287
+struct test { int a[2]; };
+
+void t2() {
+ test p = {{1,2}};
+ test q;
+ q = p;
+}
+
+bool PR7287(X0 a, X0 b) {
+ return operator==(a, b);
+}
diff --git a/test/Analysis/out-of-bounds.c b/test/Analysis/out-of-bounds.c
new file mode 100644
index 000000000000..b8d6e442ff57
--- /dev/null
+++ b/test/Analysis/out-of-bounds.c
@@ -0,0 +1,148 @@
+// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-check-objc-mem -analyzer-check-buffer-overflows -verify %s
+
+// Tests doing an out-of-bounds access after the end of an array using:
+// - constant integer index
+// - constant integer size for buffer
+void test1(int x) {
+ int buf[100];
+ buf[100] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+void test1_ok(int x) {
+ int buf[100];
+ buf[99] = 1; // no-warning
+}
+
+const char test1_strings_underrun(int x) {
+ const char *mystr = "mary had a little lamb";
+ return mystr[-1]; // expected-warning{{Out of bound memory access}}
+}
+
+const char test1_strings_overrun(int x) {
+ const char *mystr = "mary had a little lamb";
+ return mystr[1000]; // expected-warning{{Out of bound memory access}}
+}
+
+const char test1_strings_ok(int x) {
+ const char *mystr = "mary had a little lamb";
+ return mystr[5]; // no-warning
+}
+
+// Tests doing an out-of-bounds access after the end of an array using:
+// - indirect pointer to buffer
+// - constant integer index
+// - constant integer size for buffer
+void test1_ptr(int x) {
+ int buf[100];
+ int *p = buf;
+ p[101] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+void test1_ptr_ok(int x) {
+ int buf[100];
+ int *p = buf;
+ p[99] = 1; // no-warning
+}
+
+// Tests doing an out-of-bounds access before the start of an array using:
+// - indirect pointer to buffer, manipulated using simple pointer arithmetic
+// - constant integer index
+// - constant integer size for buffer
+void test1_ptr_arith(int x) {
+ int buf[100];
+ int *p = buf;
+ p = p + 100;
+ p[0] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+void test1_ptr_arith_ok(int x) {
+ int buf[100];
+ int *p = buf;
+ p = p + 99;
+ p[0] = 1; // no-warning
+}
+
+void test1_ptr_arith_bad(int x) {
+ int buf[100];
+ int *p = buf;
+ p = p + 99;
+ p[1] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+void test1_ptr_arith_ok2(int x) {
+ int buf[100];
+ int *p = buf;
+ p = p + 99;
+ p[-1] = 1; // no-warning
+}
+
+// Tests doing an out-of-bounds access before the start of an array using:
+// - constant integer index
+// - constant integer size for buffer
+void test2(int x) {
+ int buf[100];
+ buf[-1] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+// Tests doing an out-of-bounds access before the start of an array using:
+// - indirect pointer to buffer
+// - constant integer index
+// - constant integer size for buffer
+void test2_ptr(int x) {
+ int buf[100];
+ int *p = buf;
+ p[-1] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+// ** FIXME ** Doesn't work yet because we don't support pointer arithmetic.
+// Tests doing an out-of-bounds access before the start of an array using:
+// - indirect pointer to buffer, manipulated using simple pointer arithmetic
+// - constant integer index
+// - constant integer size for buffer
+void test2_ptr_arith(int x) {
+ int buf[100];
+ int *p = buf;
+ --p;
+ p[0] = 1; // no-warning
+}
+
+// Tests doing an out-of-bounds access before the start of a multi-dimensional
+// array using:
+// - constant integer indices
+// - constant integer sizes for the array
+void test2_multi(int x) {
+ int buf[100][100];
+ buf[0][-1] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+// Tests doing an out-of-bounds access before the start of a multi-dimensional
+// array using:
+// - constant integer indices
+// - constant integer sizes for the array
+void test2_multi_b(int x) {
+ int buf[100][100];
+ buf[-1][0] = 1; // expected-warning{{Out of bound memory access}}
+}
+
+void test2_multi_ok(int x) {
+ int buf[100][100];
+ buf[0][0] = 1; // no-warning
+}
+
+// *** FIXME ***
+// We don't get a warning here yet because our symbolic constraint solving
+// doesn't handle: (symbol * constant) < constant
+void test3(int x) {
+ int buf[100];
+ if (x < 0)
+ buf[x] = 1;
+}
+
+// *** FIXME ***
+// We don't get a warning here yet because our symbolic constraint solving
+// doesn't handle: (symbol * constant) < constant
+void test4(int x) {
+ int buf[100];
+ if (x > 99)
+ buf[x] = 1;
+}
diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c
index ed51dc6ac06a..3b261bbb5ca8 100644
--- a/test/Analysis/outofbound.c
+++ b/test/Analysis/outofbound.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-experimental-checks -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -Wno-array-bounds -analyze -analyzer-experimental-internal-checks -analyzer-experimental-checks -analyzer-check-objc-mem -analyzer-store=region -verify %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
diff --git a/test/Analysis/plist-output-alternate.m b/test/Analysis/plist-output-alternate.m
new file mode 100644
index 000000000000..12697b4c6c8d
--- /dev/null
+++ b/test/Analysis/plist-output-alternate.m
@@ -0,0 +1,1014 @@
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
+
+void test_null_init(void) {
+ int *p = 0;
+ *p = 0xDEADBEEF;
+}
+
+void test_null_assign(void) {
+ int *p;
+ p = 0;
+ *p = 0xDEADBEEF;
+}
+
+void test_null_assign_transitive(void) {
+ int *p;
+ p = 0;
+ int *q = p;
+ *q = 0xDEADBEEF;
+}
+
+void test_null_cond(int *p) {
+ if (!p) {
+ *p = 0xDEADBEEF;
+ }
+}
+
+void test_null_cond_transitive(int *q) {
+ if (!q) {
+ int *p = q;
+ *p = 0xDEADBEEF;
+ }
+}
+
+void test_null_field(void) {
+ struct s { int *p; } x;
+ x.p = 0;
+ *(x.p) = 0xDEADBEEF;
+}
+
+// <rdar://problem/8331641> leak reports should not show paths that end with exit() (but ones that don't end with exit())
+void panic() __attribute__((noreturn));
+enum { kCFNumberSInt8Type = 1, kCFNumberSInt16Type = 2, kCFNumberSInt32Type = 3, kCFNumberSInt64Type = 4, kCFNumberFloat32Type = 5, kCFNumberFloat64Type = 6, kCFNumberCharType = 7, kCFNumberShortType = 8, kCFNumberIntType = 9, kCFNumberLongType = 10, kCFNumberLongLongType = 11, kCFNumberFloatType = 12, kCFNumberDoubleType = 13, kCFNumberCFIndexType = 14, kCFNumberNSIntegerType = 15, kCFNumberCGFloatType = 16, kCFNumberMaxType = 16 };
+typedef const struct __CFAllocator * CFAllocatorRef;
+extern const CFAllocatorRef kCFAllocatorDefault;
+typedef signed long CFIndex;
+typedef CFIndex CFNumberType;
+typedef const struct __CFNumber * CFNumberRef;
+
+extern CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
+
+void rdar8331641(int x) {
+ signed z = 1;
+ CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z); // expected-warning{{leak}}
+ if (x)
+ panic();
+ (void) value;
+}
+
+// CHECK: <?xml version="1.0" encoding="UTF-8"?>
+// CHECK: <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+// CHECK: <plist version="1.0">
+// CHECK: <dict>
+// CHECK: <key>files</key>
+// CHECK: <array>
+// CHECK: </array>
+// CHECK: <key>diagnostics</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>4</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>4</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>4</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>4</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>4</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>5</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>5</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>5</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>5</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>5</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>category</key><string>Logic error</string>
+// CHECK: <key>type</key><string>Dereference of null pointer</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>5</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>9</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>9</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>7</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Null pointer value stored to &apos;p&apos;</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Null pointer value stored to &apos;p&apos;</string>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>10</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>11</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>11</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>11</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>11</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>11</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>category</key><string>Logic error</string>
+// CHECK: <key>type</key><string>Dereference of null pointer</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>11</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>15</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>15</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Variable &apos;q&apos; initialized to a null pointer value</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Variable &apos;q&apos; initialized to a null pointer value</string>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>17</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>18</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>18</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>18</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>18</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>18</integer>
+// CHECK: <key>col</key><integer>4</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;q&apos;)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;q&apos;)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable &apos;q&apos;)</string>
+// CHECK: <key>category</key><string>Logic error</string>
+// CHECK: <key>type</key><string>Dereference of null pointer</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>18</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>22</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>22</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>23</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>23</integer>
+// CHECK: <key>col</key><integer>6</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>23</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>23</integer>
+// CHECK: <key>col</key><integer>6</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>23</integer>
+// CHECK: <key>col</key><integer>6</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>category</key><string>Logic error</string>
+// CHECK: <key>type</key><string>Dereference of null pointer</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>23</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>28</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>28</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Variable &apos;p&apos; initialized to a null pointer value</string>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>29</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>30</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>30</integer>
+// CHECK: <key>col</key><integer>6</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>30</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>30</integer>
+// CHECK: <key>col</key><integer>6</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>30</integer>
+// CHECK: <key>col</key><integer>6</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Dereference of null pointer (loaded from variable &apos;p&apos;)</string>
+// CHECK: <key>category</key><string>Logic error</string>
+// CHECK: <key>type</key><string>Dereference of null pointer</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>30</integer>
+// CHECK: <key>col</key><integer>5</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>35</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>35</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>35</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>35</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>35</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>35</integer>
+// CHECK: <key>col</key><integer>10</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>37</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>37</integer>
+// CHECK: <key>col</key><integer>8</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>37</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>37</integer>
+// CHECK: <key>col</key><integer>7</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>37</integer>
+// CHECK: <key>col</key><integer>7</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Dereference of null pointer (loaded from field &apos;p&apos;)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Dereference of null pointer (loaded from field &apos;p&apos;)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Dereference of null pointer (loaded from field &apos;p&apos;)</string>
+// CHECK: <key>category</key><string>Logic error</string>
+// CHECK: <key>type</key><string>Dereference of null pointer</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>37</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>path</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>52</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>52</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>23</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>82</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>23</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>23</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>82</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Call to function &apos;CFNumberCreate&apos; returns a Core Foundation object with a +1 retain count (owning reference)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Call to function &apos;CFNumberCreate&apos; returns a Core Foundation object with a +1 retain count (owning reference)</string>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>23</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>53</integer>
+// CHECK: <key>col</key><integer>82</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>54</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>54</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>54</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>54</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>56</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>56</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>control</string>
+// CHECK: <key>edges</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>start</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>56</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>56</integer>
+// CHECK: <key>col</key><integer>3</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>end</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>57</integer>
+// CHECK: <key>col</key><integer>1</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>57</integer>
+// CHECK: <key>col</key><integer>1</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>kind</key><string>event</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>57</integer>
+// CHECK: <key>col</key><integer>1</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <key>ranges</key>
+// CHECK: <array>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>57</integer>
+// CHECK: <key>col</key><integer>1</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>57</integer>
+// CHECK: <key>col</key><integer>1</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </array>
+// CHECK: <key>extended_message</key>
+// CHECK: <string>Object allocated on line 53 and stored into &apos;value&apos; is not referenced later in this execution path and has a retain count of +1 (object leaked)</string>
+// CHECK: <key>message</key>
+// CHECK: <string>Object allocated on line 53 and stored into &apos;value&apos; is not referenced later in this execution path and has a retain count of +1 (object leaked)</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: <key>description</key><string>Potential leak of an object allocated on line 53 and stored into &apos;value&apos;</string>
+// CHECK: <key>category</key><string>Memory (Core Foundation/Objective-C)</string>
+// CHECK: <key>type</key><string>Leak of returned object</string>
+// CHECK: <key>location</key>
+// CHECK: <dict>
+// CHECK: <key>line</key><integer>57</integer>
+// CHECK: <key>col</key><integer>1</integer>
+// CHECK: <key>file</key><integer>0</integer>
+// CHECK: </dict>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
+// CHECK: </plist>
diff --git a/test/Analysis/plist-output.m b/test/Analysis/plist-output.m
index 95faa06a0633..ec4f770cb245 100644
--- a/test/Analysis/plist-output.m
+++ b/test/Analysis/plist-output.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-output=plist -o - %s | FileCheck %s
+// XFAIL: *
void test_null_init(void) {
int *p = 0;
diff --git a/test/Analysis/properties.m b/test/Analysis/properties.m
new file mode 100644
index 000000000000..ce8faf52736a
--- /dev/null
+++ b/test/Analysis/properties.m
@@ -0,0 +1,145 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
+
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+@protocol NSObject - (BOOL)isEqual:(id)object; @end
+@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end
+@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
+@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
+@interface NSObject <NSObject> {}
++(id)alloc;
+-(id)init;
+-(id)autorelease;
+-(id)copy;
+-(id)retain;
+@end
+@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
+- (NSUInteger)length;
+-(id)initWithFormat:(NSString *)f,...;
+-(BOOL)isEqualToString:(NSString *)s;
++ (id)string;
+@end
+@interface NSNumber : NSObject {}
++(id)alloc;
+-(id)initWithInteger:(int)i;
+@end
+
+// rdar://6946338
+
+@interface Test1 : NSObject {
+ NSString *text;
+}
+-(id)myMethod;
+@property (nonatomic, assign) NSString *text;
+@end
+
+
+@implementation Test1
+
+@synthesize text;
+
+-(id)myMethod {
+ Test1 *cell = [[[Test1 alloc] init] autorelease];
+
+ NSString *string1 = [[NSString alloc] initWithFormat:@"test %f", 0.0]; // expected-warning {{Potential leak}}
+ cell.text = string1;
+
+ return cell;
+}
+
+@end
+
+
+// rdar://8824416
+
+@interface MyNumber : NSObject
+{
+ NSNumber* _myNumber;
+}
+
+- (id)initWithNumber:(NSNumber *)number;
+
+@property (nonatomic, readonly) NSNumber* myNumber;
+@property (nonatomic, readonly) NSNumber* newMyNumber;
+
+@end
+
+@implementation MyNumber
+@synthesize myNumber=_myNumber;
+
+- (id)initWithNumber:(NSNumber *)number
+{
+ self = [super init];
+
+ if ( self )
+ {
+ _myNumber = [number copy];
+ }
+
+ return self;
+}
+
+- (NSNumber*)newMyNumber
+{
+ if ( _myNumber )
+ return [_myNumber retain];
+
+ return [[NSNumber alloc] initWithInteger:1];
+}
+
+- (id)valueForUndefinedKey:(NSString*)key
+{
+ id value = 0;
+
+ if ([key isEqualToString:@"MyIvarNumberAsPropertyOverReleased"])
+ value = self.myNumber; // _myNumber will be over released, since the value returned from self.myNumber is not retained.
+ else if ([key isEqualToString:@"MyIvarNumberAsPropertyOk"])
+ value = [self.myNumber retain]; // this line fixes the over release
+ else if ([key isEqualToString:@"MyIvarNumberAsNewMyNumber"])
+ value = self.newMyNumber; // this one is ok, since value is returned retained
+ else
+ value = [[NSNumber alloc] initWithInteger:0];
+
+ return [value autorelease]; // expected-warning {{Object sent -autorelease too many times}}
+}
+
+@end
+
+NSNumber* numberFromMyNumberProperty(MyNumber* aMyNumber)
+{
+ NSNumber* result = aMyNumber.myNumber;
+
+ return [result autorelease]; // expected-warning {{Object sent -autorelease too many times}}
+}
+
+
+// rdar://6611873
+
+@interface Person : NSObject {
+ NSString *_name;
+}
+@property (retain) NSString * name;
+@end
+
+@implementation Person
+@synthesize name = _name;
+@end
+
+void rdar6611873() {
+ Person *p = [[[Person alloc] init] autorelease];
+
+ p.name = [[NSString string] retain]; // expected-warning {{leak}}
+ p.name = [[NSString alloc] init]; // expected-warning {{leak}}
+}
+
+@interface SubPerson : Person
+-(NSString *)foo;
+@end
+
+@implementation SubPerson
+-(NSString *)foo {
+ return super.name;
+}
+@end
diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c
index 0c2e22139821..044d72aeef16 100644
--- a/test/Analysis/ptr-arith.c
+++ b/test/Analysis/ptr-arith.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -verify -triple i686-apple-darwin9 %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.FixedAddr -analyzer-checker=core.experimental.PointerArithm -analyzer-checker=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 -analyzer-checker=core.experimental.PointerArithm -analyzer-checker=core.experimental.PointerSub -analyzer-check-objc-mem -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 dfe9b722d13f..0d35f23328ad 100644
--- a/test/Analysis/rdar-6442306-1.m
+++ b/test/Analysis/rdar-6442306-1.m
@@ -16,7 +16,7 @@ typedef struct {
double __Foo_READSWAP__double(double*);
static __inline__ bar_return_t
-__Beeble_check__Request__SetPortalSize_t(__attribute__((__unused__)) __Request__SetPortalSize_t *In0P) {
+__Beeble_check__Request__SetPortalSize_t(__Request__SetPortalSize_t *In0P) {
if (In0P->Foo.int_rep != Foo_record.int_rep) {
do {
int __i__, __C__ = (2);
diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m
index dd0181099ee7..d6a03b6f9880 100644
--- a/test/Analysis/rdar-6540084.m
+++ b/test/Analysis/rdar-6540084.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-dead-stores -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-checker=core.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/refcnt_naming.m b/test/Analysis/refcnt_naming.m
index 9defce2735ef..7299001051c8 100644
--- a/test/Analysis/refcnt_naming.m
+++ b/test/Analysis/refcnt_naming.m
@@ -11,6 +11,10 @@ typedef signed char BOOL;
@class NSArray, NSString, NSURL;
@interface NamingTest : NSObject {}
+-(NSObject*)copyPhoto;
+-(NSObject*)mutableCopyPhoto;
+-(NSObject*)mutable;
+-(NSObject*)mutableCopying;
-(NSObject*)photocopy; // read as "photocopy"
-(NSObject*)photoCopy; // read as "photo Copy"
-(NSObject*)__blebPRCopy; // read as "bleb PRCopy"
@@ -26,7 +30,9 @@ typedef signed char BOOL;
}
- (NSURL *)myMethod:(NSString *)inString;
- (NSURL *)getMethod:(NSString*)inString;
-- (void)addObject:(id)X;
+- (NSURL *)getMethod2:(NSString*)inString;
+- (void)addObject:(id) __attribute__((ns_consumed)) X;
+- (void)addObject2:(id) X;
@end
@implementation MyClass
@@ -44,10 +50,21 @@ typedef signed char BOOL;
return url; // no-warning
}
+- (NSURL *)getMethod2:(NSString *)inString
+{
+ NSURL *url = (NSURL *)CFURLCreateWithString(0, (CFStringRef)inString, 0); // expected-warning{{leak}}
+ [self addObject2:url];
+ return url;
+}
+
void testNames(NamingTest* x) {
+ [x copyPhoto]; // expected-warning{{leak}}
+ [x mutableCopyPhoto]; // expected-warning{{leak}}
+ [x mutable]; // no-warning
+ [x mutableCopying]; // no-warning
[x photocopy]; // no-warning
- [x photoCopy]; // expected-warning{{leak}}
- [x __blebPRCopy]; // expected-warning{{leak}}
+ [x photoCopy]; // no-warning
+ [x __blebPRCopy]; // no-warning
[x __blebPRcopy]; // no-warning
[x new_theprefixdoescount]; // expected-warning{{leak}}
[x newestAwesomeStuff]; // no-warning
@@ -59,4 +76,10 @@ void testNames(NamingTest* x) {
myObject = X;
}
+- (void)addObject2:(id)X
+{
+ myObject = X;
+}
+
@end
+
diff --git a/test/Analysis/reference.cpp b/test/Analysis/reference.cpp
index f1694163a20c..51c8aae66c1e 100644
--- a/test/Analysis/reference.cpp
+++ b/test/Analysis/reference.cpp
@@ -1,9 +1,10 @@
// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+
typedef typeof(sizeof(int)) size_t;
void malloc (size_t);
void f1() {
- int const &i = 3;
+ int const &i = 3; // <--- **FIXME** This is currently not being modeled correctly.
int b = i;
int *p = 0;
diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m
index 8995d5f364f1..6f1dd92df997 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-check-objc-mem -analyzer-store=basic -verify -fobjc-gc-only -fblocks %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -fobjc-gc-only -fblocks -verify %s
+// 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
//===----------------------------------------------------------------------===//
// Header stuff.
diff --git a/test/Analysis/retain-release-region-store.m b/test/Analysis/retain-release-region-store.m
index 7b9855473dce..05b91fcf5c56 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 -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -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 064165aaf9e1..81e015f5fc44 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem -analyzer-store=basic -fblocks -verify %s
-// 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=macosx.CFRetainRelease -analyzer-checker=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 -analyzer-checker=cocoa.ClassRelease -analyzer-check-objc-mem -analyzer-store=region -fblocks -verify %s
#if __has_feature(attribute_ns_returns_retained)
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
@@ -13,6 +13,15 @@
#if __has_feature(attribute_cf_returns_not_retained)
#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
#endif
+#if __has_feature(attribute_ns_consumes_self)
+#define NS_CONSUMES_SELF __attribute__((ns_consumes_self))
+#endif
+#if __has_feature(attribute_ns_consumed)
+#define NS_CONSUMED __attribute__((ns_consumed))
+#endif
+#if __has_feature(attribute_cf_consumed)
+#define CF_CONSUMED __attribute__((cf_consumed))
+#endif
//===----------------------------------------------------------------------===//
// The following code is reduced using delta-debugging from Mac OS X headers:
@@ -703,7 +712,7 @@ typedef CFTypeRef OtherRef;
NSString *_foo;
}
- (id)initReturningNewClass;
-- (id)initReturningNewClassBad;
+- (id)_initReturningNewClassBad;
- (id)initReturningNewClassBad2;
@end
@@ -716,7 +725,7 @@ typedef CFTypeRef OtherRef;
self = [[RDar6320065Subclass alloc] init]; // no-warning
return self;
}
-- (id)initReturningNewClassBad {
+- (id)_initReturningNewClassBad {
[self release];
[[RDar6320065Subclass alloc] init]; // expected-warning {{leak}}
return self;
@@ -762,13 +771,13 @@ int RDar6320065_test() {
@end
@implementation RDar6859457
-- (NSString*) NoCopyString { return [[NSString alloc] init]; } // no-warning
-- (NSString*) noCopyString { return [[NSString alloc] init]; } // no-warning
+- (NSString*) NoCopyString { return [[NSString alloc] init]; } // expected-warning{{leak}}
+- (NSString*) noCopyString { return [[NSString alloc] init]; } // expected-warning{{leak}}
@end
void test_RDar6859457(RDar6859457 *x, void *bytes, NSUInteger dataLength) {
- [x NoCopyString]; // expected-warning{{leak}}
- [x noCopyString]; // expected-warning{{leak}}
+ [x NoCopyString]; // no-warning
+ [x noCopyString]; // no-warning
[NSData dataWithBytesNoCopy:bytes length:dataLength]; // no-warning
[NSData dataWithBytesNoCopy:bytes length:dataLength freeWhenDone:1]; // no-warning
}
@@ -1210,10 +1219,13 @@ typedef NSString* MyStringTy;
- (MyStringTy) returnsAnOwnedTypedString NS_RETURNS_RETAINED; // no-warning
- (NSString*) newString NS_RETURNS_NOT_RETAINED; // no-warning
- (NSString*) newStringNoAttr;
-- (int) returnsAnOwnedInt NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to functions or methods that return a pointer or Objective-C object}}
+- (int) returnsAnOwnedInt NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to methods that return an Objective-C object}}
+- (id) pseudoInit NS_CONSUMES_SELF NS_RETURNS_RETAINED;
++ (void) consume:(id) NS_CONSUMED x;
++ (void) consume2:(id) CF_CONSUMED x;
@end
-static int ownership_attribute_doesnt_go_here NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to function or method types}}
+static int ownership_attribute_doesnt_go_here NS_RETURNS_RETAINED; // expected-warning{{'ns_returns_retained' attribute only applies to functions and methods}}
void test_attr_1(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
@@ -1228,6 +1240,37 @@ void test_attr1c(TestOwnershipAttr *X) {
NSString *str2 = [X newStringNoAttr]; // expected-warning{{leak}}
}
+void testattr2_a() {
+ TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // expected-warning{{leak}}
+}
+
+void testattr2_b() {
+ TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit]; // expected-warning{{leak}}
+}
+
+void testattr2_c() {
+ TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit]; // no-warning
+ [x release];
+}
+
+void testattr3() {
+ TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // no-warning
+ [TestOwnershipAttr consume:x];
+ TestOwnershipAttr *y = [TestOwnershipAttr alloc]; // no-warning
+ [TestOwnershipAttr consume2:y];
+}
+
+void consume_ns(id NS_CONSUMED x);
+void consume_cf(id CF_CONSUMED x);
+
+void testattr4() {
+ TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // no-warning
+ consume_ns(x);
+ TestOwnershipAttr *y = [TestOwnershipAttr alloc]; // no-warning
+ consume_cf(y);
+}
+
+
@interface MyClassTestCFAttr : NSObject {}
- (NSDate*) returnsCFRetained CF_RETURNS_RETAINED;
- (CFDateRef) returnsCFRetainedAsCF CF_RETURNS_RETAINED;
@@ -1367,3 +1410,46 @@ void r8272168() {
GetAClassThatImplementsProt_R8272168();
}
+// Test case for <rdar://problem/8356342>, which in the past triggered
+// a false positive.
+@interface RDar8356342
+- (NSDate*) rdar8356342:(NSDate *)inValue;
+@end
+
+@implementation RDar8356342
+- (NSDate*) rdar8356342:(NSDate*)inValue {
+ NSDate *outValue = inValue;
+ if (outValue == 0)
+ outValue = [[NSDate alloc] init]; // no-warning
+
+ if (outValue != inValue)
+ [outValue autorelease];
+
+ return outValue;
+}
+@end
+
+// <rdar://problem/8724287> - This test case previously crashed because
+// of a bug in BugReporter.
+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;
+
+ error_to_dump = 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'}}
+
+ if (info != ((void*)0)) {
+ }
+
+ error_to_dump = (CFErrorRef) CFDictionaryGetValue(info, kCFErrorUnderlyingErrorKey);
+ }
+}
+
diff --git a/test/Analysis/security-syntax-checks-no-emit.c b/test/Analysis/security-syntax-checks-no-emit.c
index 7a71235a2c79..f129e8a8e5ac 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-check-security-syntactic %s -verify
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -analyze -analyzer-checker=core.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 8dd859a4c4f3..bac6ee89df90 100644
--- a/test/Analysis/security-syntax-checks.m
+++ b/test/Analysis/security-syntax-checks.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-check-security-syntactic %s -verify
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.experimental.SecuritySyntactic %s -verify
// <rdar://problem/6336718> rule request: floating point used as loop
// condition (FLP30-C, FLP-30-CPP)
diff --git a/test/Analysis/self-init.m b/test/Analysis/self-init.m
new file mode 100644
index 000000000000..b8c2c3e8d984
--- /dev/null
+++ b/test/Analysis/self-init.m
@@ -0,0 +1,165 @@
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=cocoa.SelfInit %s -verify
+
+@class NSZone, NSCoder;
+@protocol NSObject
+@end
+@protocol NSCopying - (id)copyWithZone:(NSZone *)zone;
+@end
+@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone;
+@end
+@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder;
+@end
+@interface NSObject <NSObject> {}
++ (id)allocWithZone:(NSZone *)zone;
++ (id)alloc;
+- (void)dealloc;
+-(id)class;
+-(id)init;
+-(id)release;
+@end
+@interface NSProxy <NSObject> {}
+@end
+
+//#import "Foundation/NSObject.h"
+typedef unsigned NSUInteger;
+typedef int NSInteger;
+
+@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>
+- (NSUInteger)length;
++ (id)stringWithUTF8String:(const char *)nullTerminatedCString;
+@end extern NSString * const NSBundleDidLoadNotification;
+@interface NSAssertionHandler : NSObject {}
++ (NSAssertionHandler *)currentHandler;
+- (void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,...;
+@end
+extern NSString * const NSConnectionReplyMode;
+
+@interface NSBundle : NSObject
++(id)loadNibNamed:(NSString*)s owner:(id)o;
+@end
+
+void log(void *obj);
+extern void *somePtr;
+
+@class MyObj;
+static id _commonInit(MyObj *self) {
+ return self;
+}
+
+@interface MyObj : NSObject {
+ id myivar;
+ int myint;
+}
+-(id)_init;
+-(id)initWithSomething:(int)x;
+-(void)doSomething;
+@end
+
+@interface MyProxyObj : NSProxy {}
+-(id)init;
+@end
+
+@implementation MyObj
+
+-(id)init {
+ do { if (!((somePtr != 0))) { [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd object:self file:[NSString stringWithUTF8String:"init.m"] lineNumber:21 description:(@"Invalid parameter not satisfying: %s"), ("x != 0"), (0), (0), (0), (0)]; } } while(0);
+ return [self initWithSomething:0];
+}
+
+-(id)init2 {
+ self = [self initWithSomething:0];
+ return self;
+}
+
+-(id)init3 {
+ log([self class]);
+ return [self initWithSomething:0];
+}
+
+-(id)init4 {
+ self = [super init];
+ if (self) {
+ log(&self);
+ }
+ return self;
+}
+
+- (id)initWithSomething:(int)x {
+ if ((self = [super init]))
+ myint = x;
+ return self;
+}
+
+-(id)_init {
+ myivar = 0;
+ return self;
+}
+
+-(id)init5 {
+ [NSBundle loadNibNamed:@"Window" owner:self];
+ return [self initWithSomething:0];
+}
+
+-(id)init6 {
+ [NSBundle loadNibNamed:@"Window" owner:myivar]; // no-warning
+ return [self initWithSomething:0];
+}
+
+-(id)init7 {
+ if (0 != (self = [self _init]))
+ myivar = 0;
+ return self;
+}
+
+-(id)init8 {
+ if ((self = [super init])) {
+ log(&self);
+ myivar = 0;
+ }
+ return self;
+}
+
+-(id)init9 {
+ [self doSomething];
+ return self; // no-warning
+}
+
+-(id)init10 {
+ myivar = 0; // no-warning
+ return self;
+}
+
+-(id)init11 {
+ return self; // no-warning
+}
+
+-(id)init12 {
+ [super init];
+ return self; // expected-warning {{Returning 'self'}}
+}
+
+-(id)init13 {
+ if (self == [super init]) {
+ myivar = 0; // expected-warning {{Instance variable used}}
+ }
+ return self; // expected-warning {{Returning 'self'}}
+}
+
+-(id)init14 {
+ if (!(self = [super init]))
+ return 0;
+ if (!(self = _commonInit(self)))
+ return 0;
+ return self;
+}
+
+-(void)doSomething {}
+
+@end
+
+@implementation MyProxyObj
+
+- (id)init { return self; }
+
+@end
diff --git a/test/Analysis/sizeofpointer.c b/test/Analysis/sizeofpointer.c
index 82fda04114d2..6d0a2c4d2c26 100644
--- a/test/Analysis/sizeofpointer.c
+++ b/test/Analysis/sizeofpointer.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -warn-sizeof-pointer -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.SizeofPtr -verify %s
struct s {
};
diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c
index 342b3b1430a2..0ee843408085 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-store=basic -fblocks -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.StackAddrLeak -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.StackAddrLeak -analyzer-store=region -fblocks -verify %s
int* f1() {
int x = 0;
diff --git a/test/Analysis/stack-addr-ps.cpp b/test/Analysis/stack-addr-ps.cpp
index 593ba1df94d3..0c1ffba4f8c5 100644
--- a/test/Analysis/stack-addr-ps.cpp
+++ b/test/Analysis/stack-addr-ps.cpp
@@ -6,3 +6,89 @@ const int& g() {
int s;
return s; // expected-warning{{reference to stack memory associated with local variable 's' returned}}
}
+
+const int& g2() {
+ int s1;
+ int &s2 = s1; // expected-note {{binding reference variable 's2' here}}
+ return s2; // expected-warning {{reference to stack memory associated with local variable 's1' returned}}
+}
+
+const int& g3() {
+ int s1;
+ int &s2 = s1; // expected-note {{binding reference variable 's2' here}}
+ int &s3 = s2; // expected-note {{binding reference variable 's3' here}}
+ return s3; // expected-warning {{reference to stack memory associated with local variable 's1' returned}}
+}
+
+int get_value();
+
+const int &get_reference1() { return get_value(); } // expected-warning {{returning reference to local temporary}}
+
+const int &get_reference2() {
+ const int &x = get_value(); // expected-note {{binding reference variable 'x' here}}
+ return x; // expected-warning {{returning reference to local temporary}}
+}
+
+const int &get_reference3() {
+ const int &x1 = get_value(); // expected-note {{binding reference variable 'x1' here}}
+ const int &x2 = x1; // expected-note {{binding reference variable 'x2' here}}
+ return x2; // expected-warning {{returning reference to local temporary}}
+}
+
+int global_var;
+int *f1() {
+ int &y = global_var;
+ return &y;
+}
+
+int *f2() {
+ int x1;
+ int &x2 = x1; // expected-note {{binding reference variable 'x2' here}}
+ return &x2; // expected-warning {{address of stack memory associated with local variable 'x1' returned}}
+}
+
+int *f3() {
+ int x1;
+ int *const &x2 = &x1; // expected-note {{binding reference variable 'x2' here}}
+ return x2; // expected-warning {{address of stack memory associated with local variable 'x1' returned}}
+}
+
+const int *f4() {
+ const int &x1 = get_value(); // expected-note {{binding reference variable 'x1' here}}
+ const int &x2 = x1; // expected-note {{binding reference variable 'x2' here}}
+ return &x2; // expected-warning {{returning address of local temporary}}
+}
+
+struct S {
+ int x;
+};
+
+int *mf() {
+ S s1;
+ S &s2 = s1; // expected-note {{binding reference variable 's2' here}}
+ int &x = s2.x; // expected-note {{binding reference variable 'x' here}}
+ return &x; // expected-warning {{address of stack memory associated with local variable 's1' returned}}
+}
+
+void *lf() {
+ label:
+ void *const &x = &&label; // expected-note {{binding reference variable 'x' here}}
+ return x; // expected-warning {{returning address of label, which is local}}
+}
+
+typedef void (^bptr)(void);
+
+bptr bf(int j) {
+ __block int i;
+ const bptr &qq = ^{ i=0; }; // expected-note {{binding reference variable 'qq' here}}
+ return qq; // expected-error {{returning block that lives on the local stack}}
+}
+
+template <typename T>
+struct TS {
+ int *get();
+ int *m() {
+ int *&x = get();
+ return x;
+ }
+};
diff --git a/test/Analysis/stackaddrleak.c b/test/Analysis/stackaddrleak.c
index 39808ed873c8..359e482c8cff 100644
--- a/test/Analysis/stackaddrleak.c
+++ b/test/Analysis/stackaddrleak.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=core.StackAddrLeak -analyzer-store region -verify %s
char const *p;
diff --git a/test/Analysis/stream.c b/test/Analysis/stream.c
index 73bbc13cfbbc..7dfd49b39dc0 100644
--- a/test/Analysis/stream.c
+++ b/test/Analysis/stream.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-experimental-checks -analyzer-store region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.experimental.Stream -analyzer-store region -verify %s
typedef __typeof__(sizeof(int)) size_t;
typedef struct _IO_FILE FILE;
@@ -77,3 +77,9 @@ FILE *f9(void) {
void pr7831(FILE *fp) {
fclose(fp); // no-warning
}
+
+// PR 8081 - null pointer crash when 'whence' is not an integer constant
+void pr8081(FILE *stream, long offset, int whence) {
+ fseek(stream, offset, whence);
+}
+
diff --git a/test/Analysis/string.c b/test/Analysis/string.c
index 35ed7106f745..baf48930d7e8 100644
--- a/test/Analysis/string.c
+++ b/test/Analysis/string.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
-// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-experimental-checks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.CString -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -analyzer-checker=core.experimental.CString -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -DVARIANT -analyzer-checker=core.experimental.CString -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -DUSE_BUILTINS -DVARIANT -analyzer-checker=core.experimental.CString -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-store=region -verify %s
//===----------------------------------------------------------------------===
// Declarations
diff --git a/test/Analysis/temp-obj-dtors-cfg-output.cpp b/test/Analysis/temp-obj-dtors-cfg-output.cpp
new file mode 100644
index 000000000000..5ed782c690a1
--- /dev/null
+++ b/test/Analysis/temp-obj-dtors-cfg-output.cpp
@@ -0,0 +1,591 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -cfg-add-implicit-dtors -cfg-add-initializers %s 2>&1 | FileCheck %s
+// XPASS: *
+
+class A {
+public:
+ A() {}
+ ~A() {}
+
+ static A make() { return A(); }
+
+ operator bool() { return false; }
+ operator int() { return 0; }
+};
+
+class B {
+public:
+ B() {}
+ ~B() {}
+
+ operator bool() { return true; }
+ operator int() { return 1; }
+ operator A() { return A(); }
+};
+
+void foo(int);
+void foo(bool);
+void foo(const A&);
+
+void test_binary() {
+ int a = int(A()) + int(B());
+ foo(int(A()) + int(B()));
+ int b;
+}
+
+void test_and() {
+ bool a = A() && B();
+ foo(A() && B());
+ int b;
+}
+
+void test_or() {
+ bool a = A() || B();
+ foo(A() || B());
+ int b;
+}
+
+void test_cond() {
+ A a = B() ? A() : A(B());
+ if (B()) { foo(0); } else { foo(0); }
+ int b;
+}
+
+void test_cond_cref() {
+ const A& a = B() ? A() : A(B());
+ foo(B() ? A() : A(B()));
+ int b;
+}
+
+void test_cond_implicit() {
+ A a = A() ?: A();
+ int b;
+}
+
+void test_cond_implicit_cref() {
+ const A& a = A() ?: A();
+ foo(A() ?: A());
+ int b;
+}
+
+void test_copy_init() {
+ A a = A();
+ int b;
+}
+
+void test_cref_init() {
+ const A& a = A();
+ foo(A());
+ int b;
+}
+
+void test_call_copy_init() {
+ A a = A::make();
+ int b;
+}
+
+void test_call_cref_init() {
+ const A& a = A::make();
+ foo(A::make());
+ int b;
+}
+
+void test_assign() {
+ int a;
+ a = A();
+ int b;
+}
+
+class TestCtorInits {
+ int a;
+ int b;
+public:
+ TestCtorInits();
+};
+
+TestCtorInits::TestCtorInits()
+ : a(int(A()) + int(B()))
+ , b() {}
+
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: A()
+// CHECK: 2: [B1.1].operator int()
+// CHECK: 3: B()
+// CHECK: 4: [B1.3].operator int()
+// CHECK: 5: int a = int(A().operator int()) + int(B().operator int());
+// CHECK: 6: ~B() (Temporary object destructor)
+// CHECK: 7: ~A() (Temporary object destructor)
+// CHECK: 8: A()
+// CHECK: 9: [B1.8].operator int()
+// CHECK: 10: B()
+// CHECK: 11: [B1.10].operator int()
+// CHECK: 12: foo(int([B1.9]) + int([B1.11]))
+// CHECK: 13: ~B() (Temporary object destructor)
+// CHECK: 14: ~A() (Temporary object destructor)
+// CHECK: 15: int b;
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B10 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B8
+// CHECK: [ B1 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: int b;
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B3
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: [B4.3] && [B5.2]
+// CHECK: 2: foo([B3.1])
+// CHECK: T: [B4.3] && ...
+// CHECK: Predecessors (2): B5 B4
+// CHECK: Successors (2): B2 B1
+// CHECK: [ B4 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: A()
+// CHECK: 3: [B4.2].operator _Bool()
+// CHECK: T: [B4.3] && ...
+// CHECK: Predecessors (2): B6 B7
+// CHECK: Successors (2): B5 B3
+// CHECK: [ B5 ]
+// CHECK: 1: B()
+// CHECK: 2: [B5.1].operator _Bool()
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B3
+// CHECK: [ B6 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B7 ]
+// CHECK: 1: [B8.2] && [B9.2]
+// CHECK: 2: bool a = A().operator _Bool() && B().operator _Bool();
+// CHECK: T: [B8.2] && ...
+// CHECK: Predecessors (2): B9 B8
+// CHECK: Successors (2): B6 B4
+// CHECK: [ B8 ]
+// CHECK: 1: A()
+// CHECK: 2: [B8.1].operator _Bool()
+// CHECK: T: [B8.2] && ...
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (2): B9 B7
+// CHECK: [ B9 ]
+// CHECK: 1: B()
+// CHECK: 2: [B9.1].operator _Bool()
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (1): B7
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B10 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B8
+// CHECK: [ B1 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: int b;
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B3
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: [B4.3] || [B5.2]
+// CHECK: 2: foo([B3.1])
+// CHECK: T: [B4.3] || ...
+// CHECK: Predecessors (2): B5 B4
+// CHECK: Successors (2): B1 B2
+// CHECK: [ B4 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: A()
+// CHECK: 3: [B4.2].operator _Bool()
+// CHECK: T: [B4.3] || ...
+// CHECK: Predecessors (2): B6 B7
+// CHECK: Successors (2): B3 B5
+// CHECK: [ B5 ]
+// CHECK: 1: B()
+// CHECK: 2: [B5.1].operator _Bool()
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B3
+// CHECK: [ B6 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B7 ]
+// CHECK: 1: [B8.2] || [B9.2]
+// CHECK: 2: bool a = A().operator _Bool() || B().operator _Bool();
+// CHECK: T: [B8.2] || ...
+// CHECK: Predecessors (2): B9 B8
+// CHECK: Successors (2): B4 B6
+// CHECK: [ B8 ]
+// CHECK: 1: A()
+// CHECK: 2: [B8.1].operator _Bool()
+// CHECK: T: [B8.2] || ...
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (2): B7 B9
+// CHECK: [ B9 ]
+// CHECK: 1: B()
+// CHECK: 2: [B9.1].operator _Bool()
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (1): B7
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B11 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B10
+// CHECK: [ B1 ]
+// CHECK: 1: int b;
+// CHECK: 2: [B7.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: foo(0)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: foo(0)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: 2: B()
+// CHECK: 3: [B4.2].operator _Bool()
+// CHECK: 4: ~B() (Temporary object destructor)
+// CHECK: T: if [B4.3]
+// CHECK: Predecessors (2): B5 B6
+// CHECK: Successors (2): B3 B2
+// CHECK: [ B5 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B6 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: 3: ~A() (Temporary object destructor)
+// CHECK: 4: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B7 ]
+// CHECK: 1: [B10.2] ? [B8.2] : [B9.3]
+// CHECK: 2: A a = B().operator _Bool() ? A() : A(B().operator A());
+// CHECK: T: [B10.2] ? ... : ...
+// CHECK: Predecessors (2): B8 B9
+// CHECK: Successors (2): B5 B6
+// CHECK: [ B8 ]
+// CHECK: 1: A()
+// CHECK: 2: [B8.1] (BindTemporary)
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (1): B7
+// CHECK: [ B9 ]
+// CHECK: 1: B()
+// CHECK: 2: [B9.1].operator A()
+// CHECK: 3: A([B9.2]) (BindTemporary)
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (1): B7
+// CHECK: [ B10 ]
+// CHECK: 1: B()
+// CHECK: 2: [B10.1].operator _Bool()
+// CHECK: T: [B10.2] ? ... : ...
+// CHECK: Predecessors (1): B11
+// CHECK: Successors (2): B8 B9
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B14 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B13
+// CHECK: [ B1 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: 2: int b;
+// CHECK: 3: [B10.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: 3: ~A() (Temporary object destructor)
+// CHECK: 4: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1: [B7.3] ? [B5.2] : [B6.3]
+// CHECK: 2: foo([B4.1])
+// CHECK: T: [B7.3] ? ... : ...
+// CHECK: Predecessors (2): B5 B6
+// CHECK: Successors (2): B2 B3
+// CHECK: [ B5 ]
+// CHECK: 1: A()
+// CHECK: 2: [B5.1] (BindTemporary)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B6 ]
+// CHECK: 1: B()
+// CHECK: 2: [B6.1].operator A()
+// CHECK: 3: A([B6.2]) (BindTemporary)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B7 ]
+// CHECK: 1: ~B() (Temporary object destructor)
+// CHECK: 2: B()
+// CHECK: 3: [B7.2].operator _Bool()
+// CHECK: T: [B7.3] ? ... : ...
+// CHECK: Predecessors (2): B8 B9
+// CHECK: Successors (2): B5 B6
+// CHECK: [ B8 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (1): B7
+// CHECK: [ B9 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: 3: ~B() (Temporary object destructor)
+// CHECK: Predecessors (1): B10
+// CHECK: Successors (1): B7
+// CHECK: [ B10 ]
+// CHECK: 1: [B13.2] ? [B11.2] : [B12.3]
+// CHECK: 2: const A &a = B().operator _Bool() ? A() : A(B().operator A());
+// CHECK: T: [B13.2] ? ... : ...
+// CHECK: Predecessors (2): B11 B12
+// CHECK: Successors (2): B8 B9
+// CHECK: [ B11 ]
+// CHECK: 1: A()
+// CHECK: 2: [B11.1] (BindTemporary)
+// CHECK: Predecessors (1): B13
+// CHECK: Successors (1): B10
+// CHECK: [ B12 ]
+// CHECK: 1: B()
+// CHECK: 2: [B12.1].operator A()
+// CHECK: 3: A([B12.2]) (BindTemporary)
+// CHECK: Predecessors (1): B13
+// CHECK: Successors (1): B10
+// CHECK: [ B13 ]
+// CHECK: 1: B()
+// CHECK: 2: [B13.1].operator _Bool()
+// CHECK: T: [B13.2] ? ... : ...
+// CHECK: Predecessors (1): B14
+// CHECK: Successors (2): B11 B12
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B8 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B7
+// CHECK: [ B1 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: int b;
+// CHECK: 3: [B4.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1: [B7.2] ?: [B6.2]
+// CHECK: 2: A a = A() ?: A();
+// CHECK: T: [B7.3] ? ... : ...
+// CHECK: Predecessors (2): B5 B6
+// CHECK: Successors (2): B2 B3
+// CHECK: [ B5 ]
+// CHECK: 1:
+// CHECK: 2: [B5.1] (BindTemporary)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B6 ]
+// CHECK: 1: A()
+// CHECK: 2: [B6.1] (BindTemporary)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B7 ]
+// CHECK: 1: A()
+// CHECK: 2: [B7.1] (BindTemporary)
+// CHECK: 3: .operator _Bool()
+// CHECK: T: [B7.3] ? ... : ...
+// CHECK: Predecessors (1): B8
+// CHECK: Successors (2): B5 B6
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B13 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B12
+// CHECK: [ B1 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: int b;
+// CHECK: 3: [B9.2].~A() (Implicit destructor)
+// CHECK: Predecessors (2): B2 B3
+// CHECK: Successors (1): B0
+// CHECK: [ B2 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B3 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B4
+// CHECK: Successors (1): B1
+// CHECK: [ B4 ]
+// CHECK: 1: [B7.3] ?: [B6.2]
+// CHECK: 2: foo([B4.1])
+// CHECK: T: [B7.4] ? ... : ...
+// CHECK: Predecessors (2): B5 B6
+// CHECK: Successors (2): B2 B3
+// CHECK: [ B5 ]
+// CHECK: 1:
+// CHECK: 2: [B5.1] (BindTemporary)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B6 ]
+// CHECK: 1: A()
+// CHECK: 2: [B6.1] (BindTemporary)
+// CHECK: Predecessors (1): B7
+// CHECK: Successors (1): B4
+// CHECK: [ B7 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: 2: A()
+// CHECK: 3: [B7.2] (BindTemporary)
+// CHECK: 4: .operator _Bool()
+// CHECK: T: [B7.4] ? ... : ...
+// CHECK: Predecessors (2): B9 B8
+// CHECK: Successors (2): B5 B6
+// CHECK: [ B8 ]
+// CHECK: 1: ~A() (Temporary object destructor)
+// CHECK: Predecessors (1): B9
+// CHECK: Successors (1): B7
+// CHECK: [ B9 ]
+// CHECK: 1: [B12.2] ?: [B11.2]
+// CHECK: 2: const A &a = A() ?: A();
+// CHECK: T: [B12.3] ? ... : ...
+// CHECK: Predecessors (2): B10 B11
+// CHECK: Successors (2): B7 B8
+// CHECK: [ B10 ]
+// CHECK: 1:
+// CHECK: 2: [B10.1] (BindTemporary)
+// CHECK: Predecessors (1): B12
+// CHECK: Successors (1): B9
+// CHECK: [ B11 ]
+// CHECK: 1: A()
+// CHECK: 2: [B11.1] (BindTemporary)
+// CHECK: Predecessors (1): B12
+// CHECK: Successors (1): B9
+// CHECK: [ B12 ]
+// CHECK: 1: A()
+// CHECK: 2: [B12.1] (BindTemporary)
+// CHECK: 3: .operator _Bool()
+// CHECK: T: [B12.3] ? ... : ...
+// CHECK: Predecessors (1): B13
+// CHECK: Successors (2): B10 B11
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: A()
+// CHECK: 2: A a = A();
+// CHECK: 3: ~A() (Temporary object destructor)
+// CHECK: 4: int b;
+// CHECK: 5: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: A()
+// CHECK: 2: const A &a = A();
+// CHECK: 3: A()
+// CHECK: 4: foo([B1.3])
+// CHECK: 5: ~A() (Temporary object destructor)
+// CHECK: 6: int b;
+// CHECK: 7: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: A::make()
+// CHECK: 2: A a = A::make();
+// CHECK: 3: ~A() (Temporary object destructor)
+// CHECK: 4: int b;
+// CHECK: 5: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: A::make()
+// CHECK: 2: const A &a = A::make();
+// CHECK: 3: A::make()
+// CHECK: 4: foo([B1.3])
+// CHECK: 5: ~A() (Temporary object destructor)
+// CHECK: 6: int b;
+// CHECK: 7: [B1.2].~A() (Implicit destructor)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: int a;
+// CHECK: 2: A()
+// CHECK: 3: [B1.2].operator int()
+// CHECK: 4: a = [B1.3]
+// CHECK: 5: ~A() (Temporary object destructor)
+// CHECK: 6: int b;
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
+// CHECK: [ B2 (ENTRY) ]
+// CHECK: Predecessors (0):
+// CHECK: Successors (1): B1
+// CHECK: [ B1 ]
+// CHECK: 1: A()
+// CHECK: 2: [B1.1].operator int()
+// CHECK: 3: B()
+// CHECK: 4: [B1.3].operator int()
+// CHECK: 5: a(int([B1.2]) + int([B1.4])) (Member initializer)
+// CHECK: 6: ~B() (Temporary object destructor)
+// CHECK: 7: ~A() (Temporary object destructor)
+// CHECK: 8: b(/*implicit*/int()) (Member initializer)
+// CHECK: Predecessors (1): B2
+// CHECK: Successors (1): B0
+// CHECK: [ B0 (EXIT) ]
+// CHECK: Predecessors (1): B1
+// CHECK: Successors (0):
diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m
index 4061150ec553..a8e2f1b65592 100644
--- a/test/Analysis/uninit-msg-expr.m
+++ b/test/Analysis/uninit-msg-expr.m
@@ -42,7 +42,7 @@ extern NSString * const NSUndoManagerCheckpointNotification;
unsigned f1() {
NSString *aString;
- return [aString length]; // expected-warning {{Receiver in message expression is a garbage value}}
+ return [aString length]; // expected-warning {{Receiver in message expression is an uninitialized value}}
}
unsigned f2() {
@@ -53,5 +53,5 @@ unsigned f2() {
void f3() {
NSMutableArray *aArray = [NSArray array];
NSString *aString;
- [aArray addObject:aString]; // expected-warning {{Pass-by-value argument in message expression is undefined.}}
+ [aArray addObject:aString]; // expected-warning {{Argument in message expression is an uninitialized value}}
}
diff --git a/test/Analysis/uninit-ps-rdar6145427.m b/test/Analysis/uninit-ps-rdar6145427.m
index 1409dbd1df5e..ccaf2e8105bf 100644
--- a/test/Analysis/uninit-ps-rdar6145427.m
+++ b/test/Analysis/uninit-ps-rdar6145427.m
@@ -30,7 +30,7 @@ extern NSString * const NSUndoManagerCheckpointNotification;
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- id someUnintializedPointer = [someUnintializedPointer objectAtIndex:0]; // expected-warning{{Receiver in message expression is a garbage value}}
+ id someUnintializedPointer = [someUnintializedPointer objectAtIndex:0]; // expected-warning{{Receiver in message expression is an uninitialized value}}
NSLog(@"%@", someUnintializedPointer);
[pool drain];
return 0;
diff --git a/test/Analysis/uninit-vals-ps-region.m b/test/Analysis/uninit-vals-ps-region.m
index 751e91ba8627..2b3b027657f6 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-check-idempotent-operations -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-checker=core.experimental.IdempotentOps -verify %s
struct s {
int data;
diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c
index 4abd413ae5d5..9e53fbc34881 100644
--- a/test/Analysis/uninit-vals-ps.c
+++ b/test/Analysis/uninit-vals-ps.c
@@ -15,7 +15,7 @@ int f1_a(struct FPRec* foo) {
int f1_b() {
int x;
- return bar(x)+1; // expected-warning{{Pass-by-value argument in function call is undefined.}}
+ return bar(x)+1; // expected-warning{{Function call argument is an uninitialized value}}
}
int f2() {
diff --git a/test/Analysis/uninit-vals.c b/test/Analysis/uninit-vals.c
index b0769ba6bce1..e4395e848661 100644
--- a/test/Analysis/uninit-vals.c
+++ b/test/Analysis/uninit-vals.c
@@ -32,7 +32,7 @@ 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 (char const *, ...)'}} \
+ // 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'}}
}
diff --git a/test/Analysis/unix-fns.c b/test/Analysis/unix-fns.c
index 9d036ac7b5c6..9f5362d184ff 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 %s -analyzer-store=region -fblocks -verify
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem %s -analyzer-store=basic -fblocks -verify
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-check-objc-mem -analyzer-checker=unix.API -analyzer-checker=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 -analyzer-checker=macosx.API %s -analyzer-store=basic -fblocks -verify
struct _opaque_pthread_once_t {
long __sig;
@@ -8,6 +8,9 @@ struct _opaque_pthread_once_t {
typedef struct _opaque_pthread_once_t __darwin_pthread_once_t;
typedef __darwin_pthread_once_t pthread_once_t;
int pthread_once(pthread_once_t *, void (*)(void));
+typedef long unsigned int __darwin_size_t;
+typedef __darwin_size_t size_t;
+void *malloc(size_t);
typedef void (^dispatch_block_t)(void);
typedef long dispatch_once_t;
@@ -50,3 +53,17 @@ void test_pthread_once_neg() {
static pthread_once_t pred = {0x30B1BCBA, {0}};
pthread_once(&pred, test_pthread_once_aux); // no-warning
}
+
+// PR 2899 - warn of zero-sized allocations to malloc().
+void pr2899() {
+ char* foo = malloc(0); // expected-warning{{Call to 'malloc' has an allocation size of 0 bytes}}
+ for (unsigned i = 0; i < 100; i++) {
+ foo[i] = 0;
+ }
+}
+void pr2899_nowarn(size_t size) {
+ char* foo = malloc(size); // no-warning
+ for (unsigned i = 0; i < 100; i++) {
+ foo[i] = 0;
+ }
+}
diff --git a/test/Analysis/unreachable-code-path.c b/test/Analysis/unreachable-code-path.c
index 071532739cbe..52e6d3df2c01 100644
--- a/test/Analysis/unreachable-code-path.c
+++ b/test/Analysis/unreachable-code-path.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-check-objc-mem -analyzer-check-dead-stores -verify -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.experimental.UnreachableCode -analyzer-check-objc-mem -analyzer-checker=core.DeadStores -verify -analyzer-opt-analyze-nested-blocks -Wno-unused-value %s
extern void foo(int a);
@@ -93,8 +93,8 @@ void test9(unsigned a) {
switch (a) {
if (a) // expected-warning{{never executed}}
foo(a + 5); // no-warning
- else // no-warning
- foo(a); // no-warning
+ else // no-warning
+ foo(a); // no-warning
case 1:
case 2:
break;
@@ -102,3 +102,23 @@ void test9(unsigned a) {
break;
}
}
+
+// Tests from flow-sensitive version
+void test10() {
+ goto c;
+ d:
+ goto e; // expected-warning {{never executed}}
+ c: ;
+ int i;
+ return;
+ goto b; // expected-warning {{never executed}}
+ goto a; // expected-warning {{never executed}}
+ b:
+ i = 1; // no-warning
+ a:
+ i = 2; // no-warning
+ goto f;
+ e:
+ goto d;
+ f: ;
+}
diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m
index 14c43a86c408..b43ae18694dd 100644
--- a/test/Analysis/unused-ivars.m
+++ b/test/Analysis/unused-ivars.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -analyze -analyzer-check-objc-unused-ivars %s -verify
+// RUN: %clang_cc1 -fobjc-nonfragile-abi -fblocks -analyze -analyzer-checker=cocoa.UnusedIvars %s -verify
//===--- BEGIN: Delta-debugging reduced headers. --------------------------===//
@@ -95,4 +95,16 @@ int radar_7254495(RDar7254495 *a) {
@implementation RDar7353683
@end
+//===----------------------------------------------------------------------===//
+// <rdar://problem/8481311> Unused bitfield ivars trigger cause weird
+// diagnostic: "Instance variable '' in class…"
+//===----------------------------------------------------------------------===//
+@interface RDar8481311 {
+@private
+ unsigned bitfield:1; // expected-warning {{Instance variable 'bitfield' in class 'RDar8481311' is never used}}
+}
+@end
+
+@implementation RDar8481311
+@end
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 611867f73ff2..a32b9943c2a6 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -4,6 +4,7 @@ set(CLANG_TEST_DIRECTORIES
"CodeGen"
"CodeGenCXX"
"CodeGenObjC"
+ "CodeGenOpenCL"
"Coverage"
"CXX"
"Driver"
@@ -18,27 +19,45 @@ set(CLANG_TEST_DIRECTORIES
"Preprocessor"
"Rewriter"
"Sema"
+ "SemaCUDA"
"SemaCXX"
"SemaObjC"
"SemaObjCXX"
+ "SemaOpenCL"
"SemaTemplate")
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
+set(LLVM_BUILD_MODE "%(build_mode)s")
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
+if(BUILD_SHARED_LIBS)
+ set(ENABLE_SHARED 1)
+else()
+ set(ENABLE_SHARED 0)
+endif(BUILD_SHARED_LIBS)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
+ @ONLY)
+
include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
- set(CLANG_TEST_EXTRA_ARGS)
- if (MSVC OR XCODE)
- set(CLANG_TEST_EXTRA_ARGS "--no-progress-bar")
+ if( LLVM_MAIN_SRC_DIR )
+ set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
+ else()
+ set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
+ endif()
+
+ if( PATH_TO_LLVM_BUILD )
+ set(CLANG_TEST_EXTRA_ARGS "--path=${CLANG_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
endif()
option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
@@ -46,13 +65,18 @@ if(PYTHONINTERP_FOUND)
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
endif ()
+ set(LIT_ARGS "${CLANG_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
+ separate_arguments(LIT_ARGS)
+
+ add_custom_target(clang-test.deps)
+
foreach(testdir ${CLANG_TEST_DIRECTORIES})
add_custom_target(clang-test-${testdir}
COMMAND ${PYTHON_EXECUTABLE}
- ${LLVM_SOURCE_DIR}/utils/lit/lit.py
+ ${LIT}
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
- -sv ${CLANG_TEST_EXTRA_ARGS}
+ ${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}/${testdir}
DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests in ${testdir}")
@@ -60,21 +84,47 @@ if(PYTHONINTERP_FOUND)
add_custom_target(clang-test
COMMAND ${PYTHON_EXECUTABLE}
- ${LLVM_SOURCE_DIR}/utils/lit/lit.py
+ ${LIT}
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+ --param clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
- -sv ${CLANG_TEST_EXTRA_ARGS}
+ --param build_mode=${RUNTIME_BUILD_MODE}
+ ${LIT_ARGS}
${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests")
add_custom_target(clang-c++tests
COMMAND ${PYTHON_EXECUTABLE}
- ${LLVM_SOURCE_DIR}/utils/lit/lit.py
+ ${LIT}
--param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
--param build_config=${CMAKE_CFG_INTDIR}
- -sv ${CLANG_TEST_EXTRA_ARGS}
+ ${LIT_ARGS}
${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
DEPENDS clang c-index-test FileCheck not count
COMMENT "Running Clang regression tests")
+
+ if( NOT CLANG_BUILT_STANDALONE )
+ add_custom_target(check-all
+ COMMAND ${PYTHON_EXECUTABLE}
+ ${LIT}
+ --param build_config=${CMAKE_CFG_INTDIR}
+ --param build_mode=${RUNTIME_BUILD_MODE}
+ ${LIT_ARGS}
+ ${LLVM_BINARY_DIR}/test
+ ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Running Clang and LLVM regression tests")
+ add_dependencies(check-all check.deps clang-test.deps)
+ add_dependencies(clang-test.deps
+ ClangUnitTests
+ llvm-dis opt
+ FileCheck count not
+ )
+
+ endif()
+
+ add_dependencies(clang-test clang-test.deps)
+ add_dependencies(clang-test.deps
+ clang clang-headers c-index-test
+ )
+
endif()
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
index df3429ef31c7..1e5a823663ca 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
@@ -44,7 +44,7 @@ namespace Test {
// PR6716
namespace test1 {
template <class T> class A {
- template <class U> friend void foo(A &, U); // expected-note {{not viable: 1st argument ('A<int> const') would lose const qualifier}}
+ template <class U> friend void foo(A &, U); // expected-note {{not viable: 1st argument ('const A<int>') would lose const qualifier}}
};
void test() {
diff --git a/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp b/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
new file mode 100644
index 000000000000..911df989530f
--- /dev/null
+++ b/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar4641403
+namespace N {
+ struct X { // expected-note{{candidate found by name lookup}}
+ float b;
+ };
+}
+
+using namespace N;
+
+typedef struct {
+ int a;
+} X; // expected-note{{candidate found by name lookup}}
+
+
+struct Y { };
+void Y(int) { }
+
+void f() {
+ X *x; // expected-error{{reference to 'X' is ambiguous}}
+ Y(1); // okay
+}
+
diff --git a/test/CXX/basic/basic.start/basic.start.main/p2h.cpp b/test/CXX/basic/basic.start/basic.start.main/p2h.cpp
new file mode 100644
index 000000000000..abf8faa968cf
--- /dev/null
+++ b/test/CXX/basic/basic.start/basic.start.main/p2h.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T>
+int main() { } // expected-error{{'main' cannot be a template}}
+
diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp
index 277b70bee6bd..1668155c1819 100644
--- a/test/CXX/class.access/class.friend/p1.cpp
+++ b/test/CXX/class.access/class.friend/p1.cpp
@@ -258,13 +258,12 @@ namespace test7 {
namespace test8 {
class A {
typedef int I; // expected-note 4 {{declared private here}}
- static const I x = 0;
+ static const I x = 0; // expected-note {{implicitly declared private here}}
friend I f(I i);
template<typename T> friend I g(I i);
};
- // FIXME: This should be on line 264.
- const A::I A::x; // expected-note {{declared private here}}
+ const A::I A::x;
A::I f(A::I i = A::x) {}
template<typename T> A::I g(A::I i) {
T t;
@@ -306,3 +305,39 @@ namespace test10 {
NS::bar->foo(); // expected-error {{private member}}
}
}
+
+// PR8705
+namespace test11 {
+ class A {
+ void test0(int);
+ void test1(int);
+ void test2(int);
+ void test3(int);
+ };
+
+ class B {
+ typedef int private_type; // expected-note 2 {{implicitly declared private here}}
+ friend void A::test0(int);
+ friend void A::test1(int);
+ };
+
+ void A::test0(B::private_type x) {}
+ void A::test1(int x = B::private_type()) {}
+ void A::test2(B::private_type x) {} // expected-error {{'private_type' is a private member of 'test11::B'}}
+ void A::test3(int x = B::private_type()) {} // expected-error {{'private_type' is a private member of 'test11::B'}}
+}
+
+
+// PR9221
+namespace test12 {
+ struct A {
+ void foo();
+ };
+ class B : private A {
+ friend void A::foo();
+ void *mem;
+ };
+ void A::foo() {
+ void *var = static_cast<B*>(this)->mem;
+ }
+}
diff --git a/test/CXX/class.access/class.friend/p11.cpp b/test/CXX/class.access/class.friend/p11.cpp
new file mode 100644
index 000000000000..a05b2d28751e
--- /dev/null
+++ b/test/CXX/class.access/class.friend/p11.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar://problem/8540720
+namespace test0 {
+ void foo() {
+ void bar();
+ class A {
+ friend void bar();
+ };
+ }
+}
+
+namespace test1 {
+ void foo() {
+ class A {
+ friend void bar(); // expected-error {{no matching function found in local scope}}
+ };
+ }
+}
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index 115a22ad4412..84b7b1915f17 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
// C++0x [class.access]p4:
@@ -201,7 +201,7 @@ namespace test4 {
// Implicit copy assignment operator uses.
namespace test5 {
class A {
- void operator=(const A &); // expected-note 2 {{declared private here}}
+ void operator=(const A &); // expected-note 2 {{implicitly declared private here}}
};
class Test1 { A a; }; // expected-error {{private member}}
@@ -450,3 +450,61 @@ namespace test18 {
A<int> member;
};
}
+
+// PR8325
+namespace test19 {
+ class A { ~A(); };
+ // The destructor is not implicitly referenced here. Contrast to test16,
+ // testing PR7281, earlier in this file.
+ void b(A* x) { throw x; }
+}
+
+// PR7930
+namespace test20 {
+ class Foo {
+ Foo(); // expected-note {{implicitly declared private here}}
+ };
+ Foo::Foo() {}
+
+ void test() {
+ Foo a; // expected-error {{calling a private constructor}}
+ }
+}
+
+namespace test21 {
+ template <class T> class A {
+ void foo();
+ void bar();
+ class Inner; // expected-note {{implicitly declared private here}}
+ public:
+ void baz();
+ };
+ template <class T> class A<T>::Inner {};
+ class B {
+ template <class T> class A<T>::Inner;
+ };
+
+ void test() {
+ A<int>::Inner i; // expected-error {{'Inner' is a private member}}
+ }
+}
+
+namespace rdar8876150 {
+ struct A { operator bool(); };
+ struct B : private A { using A::operator bool; };
+
+ bool f() {
+ B b;
+ return !b;
+ }
+}
+
+namespace test23 {
+ template <typename T> class A {
+ A();
+ static A instance;
+ };
+
+ template <typename T> A<T> A<T>::instance;
+ template class A<int>;
+}
diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp
index 87957084747a..fe3304a22253 100644
--- a/test/CXX/class.access/p6.cpp
+++ b/test/CXX/class.access/p6.cpp
@@ -139,3 +139,32 @@ namespace test5 {
template <A::Enum en> class bar {}; // expected-error {{'Enum' is a private member of 'test5::A'}}
};
}
+
+namespace test6 {
+ class A {
+ public: class public_inner {};
+ protected: class protected_inner {};
+ private: class private_inner {}; // expected-note {{declared private here}}
+ };
+
+ class B : A {
+ public_inner a;
+ protected_inner b;
+ private_inner c; // expected-error {{ 'private_inner' is a private member of 'test6::A'}}
+ };
+}
+
+// PR9229
+namespace test7 {
+ void foo(int arg[1]);
+ class A {
+ void check();
+ };
+ class B {
+ friend class A;
+ A ins;
+ };
+ void A::check() {
+ void foo(int arg[__builtin_offsetof(B, ins)]);
+ }
+}
diff --git a/test/CXX/class.derived/class.abstract/p4.cpp b/test/CXX/class.derived/class.abstract/p4.cpp
index ca99bf7f1658..b04de213874f 100644
--- a/test/CXX/class.derived/class.abstract/p4.cpp
+++ b/test/CXX/class.derived/class.abstract/p4.cpp
@@ -24,7 +24,7 @@ namespace PR6631 {
// subobject but not pure in another subobject.
namespace PartlyPure {
struct A {
- virtual void f() = 0; // expected-note{{pure virtual function}}
+ virtual void f() = 0; // expected-note{{unimplemented pure virtual method}}
};
struct B : A {
@@ -36,7 +36,7 @@ namespace PartlyPure {
struct D : B, C { };
void f() {
- (void) new D; // expected-error{{abstract type}}
+ (void) new D; // expected-error{{abstract class}}
}
}
diff --git a/test/CXX/class.derived/class.abstract/p5.cpp b/test/CXX/class.derived/class.abstract/p5.cpp
index 207519d17e4e..cdff93122344 100644
--- a/test/CXX/class.derived/class.abstract/p5.cpp
+++ b/test/CXX/class.derived/class.abstract/p5.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
- virtual void f() = 0; // expected-note{{pure virtual function}}
+ virtual void f() = 0; // expected-note{{unimplemented pure virtual method}}
};
struct B : A {
@@ -9,15 +9,15 @@ struct B : A {
};
struct C : B {
- virtual void f() = 0; // expected-note 2{{pure virtual function}}
+ virtual void f() = 0; // expected-note 2{{unimplemented pure virtual method}}
};
struct D : C {
};
void test() {
- (void)new A; // expected-error{{object of abstract type}}
+ (void)new A; // expected-error{{abstract class}}
(void)new B;
- (void)new C; // expected-error{{object of abstract type}}
- (void)new D; // expected-error{{object of abstract type}}
+ (void)new C; // expected-error{{abstract class}}
+ (void)new D; // expected-error{{abstract class}}
}
diff --git a/test/CXX/class.derived/class.member.lookup/p9.cpp b/test/CXX/class.derived/class.member.lookup/p9.cpp
new file mode 100644
index 000000000000..ba7bd21f8699
--- /dev/null
+++ b/test/CXX/class.derived/class.member.lookup/p9.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace rdar8436162 {
+ class ClsA {
+ public:
+ static void f();
+ void g();
+ };
+
+ class ClsB : virtual private ClsA {
+ public:
+ using ClsA::f;
+ using ClsA::g; // expected-note{{member found by ambiguous name lookup}}
+ };
+
+ class ClsF : virtual private ClsA {
+ public:
+ using ClsA::f;
+ using ClsA::g; // expected-note{{member found by ambiguous name lookup}}
+ };
+
+ class ClsE : public ClsB, public ClsF {
+ void test() {
+ f();
+ g(); // expected-error{{member 'g' found in multiple base classes of different types}}
+ }
+ };
+}
diff --git a/test/CXX/class.derived/class.virtual/p3-0x.cpp b/test/CXX/class.derived/class.virtual/p3-0x.cpp
new file mode 100644
index 000000000000..4bd9efda1f6c
--- /dev/null
+++ b/test/CXX/class.derived/class.virtual/p3-0x.cpp
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+namespace Test1 {
+
+struct B {
+ virtual void f(int);
+};
+
+struct D : B {
+ virtual void f(long) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
+ void f(int) override;
+};
+}
+
+namespace Test2 {
+
+struct A {
+ virtual void f(int, char, int);
+};
+
+template<typename T>
+struct B : A {
+ virtual void f(T) override;
+};
+
+}
+
+namespace Test3 {
+
+struct A {
+ virtual void f(int, char, int);
+};
+
+template<typename... Args>
+struct B : A {
+ virtual void f(Args...) override; // expected-error {{'f' marked 'override' but does not override any member functions}}
+};
+
+template struct B<int, char, int>;
+template struct B<int>; // expected-note {{in instantiation of template class 'Test3::B<int>' requested here}}
+
+}
+
+namespace Test4 {
+struct B {
+ virtual void f() const final; // expected-note {{overridden virtual function is here}}
+};
+
+struct D : B {
+ void f() const; // expected-error {{declaration of 'f' overrides a 'final' function}}
+};
+
+}
diff --git a/test/CXX/class.derived/p8-0x.cpp b/test/CXX/class.derived/p8-0x.cpp
new file mode 100644
index 000000000000..6a667f73ec3f
--- /dev/null
+++ b/test/CXX/class.derived/p8-0x.cpp
@@ -0,0 +1,22 @@
+// 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.friend/p1.cpp b/test/CXX/class/class.friend/p1.cpp
index 3ad4a5f08289..bb1af101d242 100644
--- a/test/CXX/class/class.friend/p1.cpp
+++ b/test/CXX/class/class.friend/p1.cpp
@@ -57,7 +57,8 @@ class A {
friend A operator|(const A& l, const A& r); // okay
friend A operator|(const A& r); // expected-error {{ overloaded 'operator|' must be a binary operator (has 1 parameter) }}
- friend operator bool() const; // expected-error {{ must use a qualified name when declaring a conversion operator as a friend }}
+ friend operator bool() const; // expected-error {{ must use a qualified name when declaring a conversion operator as a friend }} \
+ // expected-error{{type qualifier is not allowed on this function}}
typedef void ftypedef();
friend ftypedef typedeffed_function; // okay (because it's not declared as a member)
diff --git a/test/CXX/class/class.mem/p1.cpp b/test/CXX/class/class.mem/p1.cpp
index 55507d4e9616..a41f1dbb75ec 100644
--- a/test/CXX/class/class.mem/p1.cpp
+++ b/test/CXX/class/class.mem/p1.cpp
@@ -62,3 +62,30 @@ struct S5
};
+
+namespace PR8245 {
+ class X {
+ public:
+ template<class C>
+ class Inner {
+ public:
+ void foo(bool bar = true);
+ int bam;
+ };
+
+ Inner<int> _foo;
+ };
+
+ void f() {
+ X::Inner<int> c2i;
+ X::Inner<float> c2f;
+ c2i.foo();
+ c2f.foo();
+ }
+
+ class Y {
+ class Inner {
+ void foo(int = sizeof(Y));
+ };
+ };
+}
diff --git a/test/CXX/class/class.mem/p13.cpp b/test/CXX/class/class.mem/p13.cpp
new file mode 100644
index 000000000000..7cded23878e6
--- /dev/null
+++ b/test/CXX/class/class.mem/p13.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// If T is the name of a class, then each of the following shall have
+// a name different from T:
+
+// - every static data member of class T;
+struct X0 {
+ static int X0; // expected-error{{member 'X0' has the same name as its class}}
+};
+
+// - every member function of class T
+// (Cannot be tested)
+
+// - every member of class T that is itself a type;
+struct X1 { // expected-note{{previous use is here}}
+ enum X1 { }; // expected-error{{use of 'X1' with tag type that does not match previous declaration}}
+};
+
+struct X2 {
+ typedef int X2; // expected-error{{member 'X2' has the same name as its class)}}
+};
+
+// - every enumerator of every member of class T that is an enumerated type; and
+struct X3 {
+ enum E {
+ X3 // expected-error{{member 'X3' has the same name as its class}}
+ };
+};
+
+// - every member of every anonymous union that is a member of class T.
+struct X4 {
+ union {
+ int X;
+ union {
+ float Y;
+ unsigned X4; // expected-error{{member 'X4' has the same name as its class}}
+ };
+ };
+};
+
diff --git a/test/CXX/class/class.mem/p14.cpp b/test/CXX/class/class.mem/p14.cpp
new file mode 100644
index 000000000000..72b232e8f715
--- /dev/null
+++ b/test/CXX/class/class.mem/p14.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// In addition, if class T has a user-declared constructor (12.1),
+// every non-static data member of class T shall have a name different
+// from T.
+
+struct X0 {
+ int X0; // okay
+};
+
+struct X1 {
+ int X1;
+ X1(); // expected-error{{declarator requires an identifier}}
+};
+
+struct X2 {
+ X2();
+ float X2; // expected-error{{member 'X2' has the same name as its class}}
+};
diff --git a/test/CXX/class/class.mem/p1b.cpp b/test/CXX/class/class.mem/p1b.cpp
new file mode 100644
index 000000000000..d3493f6fd7be
--- /dev/null
+++ b/test/CXX/class/class.mem/p1b.cpp
@@ -0,0 +1,46 @@
+// The first run checks that the correct errors are generated,
+// implicitly checking the order of default argument parsing:
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// The second run checks the order of inline method definitions:
+// RUN: not %clang_cc1 -fsyntax-only %s 2> %t
+// RUN: FileCheck %s < %t
+
+class A {
+public:
+ void a1() {
+ B b = B();
+ }
+
+ class B;
+ void a2(B b = B()); // expected-error{{use of default argument to function 'B' that is declared later in class 'B'}}
+
+ void a3(int a = 42);
+
+ // CHEKC: error: use of undeclared identifier 'first'
+ void a4(int a = first); // expected-error{{use of undeclared identifier 'first'}}
+
+ class B {
+ public:
+ B(int b = 42) { // expected-note{{default argument declared here}}
+ A a;
+ a.a3();
+ a.a6();
+ }
+
+ void b1(A a = A()); // expected-error{{use of default argument to function 'A' that is declared later in class 'A'}}
+
+ // CHECK: error: use of undeclared identifier 'second'
+ void b2(int a = second); // expected-error{{use of undeclared identifier 'second'}}
+ };
+
+ void a5() {
+ B b = B();
+ }
+
+ void a6(B b = B());
+
+ A(int a = 42); // expected-note{{default argument declared here}}
+
+ // CHECK: error: use of undeclared identifier 'third'
+ void a7(int a = third); // expected-error{{use of undeclared identifier 'third'}}
+};
diff --git a/test/CXX/class/class.mem/p8-0x-pedantic.cpp b/test/CXX/class/class.mem/p8-0x-pedantic.cpp
new file mode 100644
index 000000000000..a4b775c191d8
--- /dev/null
+++ b/test/CXX/class/class.mem/p8-0x-pedantic.cpp
@@ -0,0 +1,14 @@
+// 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
new file mode 100644
index 000000000000..bf1b4c177bf8
--- /dev/null
+++ b/test/CXX/class/class.mem/p8-0x.cpp
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+struct Base1 {
+ virtual void g();
+};
+
+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'}}
+};
+
+struct Base2 {
+ virtual void e1(), e2();
+ virtual void f();
+};
+
+struct B : Base2 {
+ virtual void e1() override, e2(int); // No error.
+ virtual void f() override;
+ void g() override; // expected-error {{only virtual member functions can be marked 'override'}}
+ int h override; // expected-error {{only virtual member functions can be marked 'override'}}
+};
+
+struct C {
+ virtual void f() final;
+ void g() final; // expected-error {{only virtual member functions can be marked 'final'}}
+ int h final; // expected-error {{only virtual member functions can be marked 'final'}}
+};
+
+namespace inline_extension {
+ struct Base1 {
+ virtual void g() {}
+ };
+
+ 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'}}
+ };
+
+ struct Base2 {
+ virtual void f();
+ };
+
+ struct B : Base2 {
+ virtual void f() override {}
+ void g() override {} // expected-error {{only virtual member functions can be marked 'override'}}
+ };
+
+ struct C {
+ virtual void f() final {}
+ void g() final {} // expected-error {{only virtual member functions can be marked 'final'}}
+ };
+}
diff --git a/test/CXX/class/class.nest/p1-cxx0x.cpp b/test/CXX/class/class.nest/p1-cxx0x.cpp
new file mode 100644
index 000000000000..f8b06ac5f7e3
--- /dev/null
+++ b/test/CXX/class/class.nest/p1-cxx0x.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+
+class Outer {
+ int x;
+ static int sx;
+ int f();
+
+ // The first case is invalid in the C++03 mode but valid in C++0x (see 5.1.1.10).
+ class Inner {
+ static char a[sizeof(x)]; // okay
+ static char b[sizeof(sx)]; // okay
+ static char c[sizeof(f)]; // expected-error {{ call to non-static member function without an object argument }}
+ };
+};
diff --git a/test/CXX/class/class.nest/p1.cpp b/test/CXX/class/class.nest/p1.cpp
index f1f5496d565b..350cc814e9b2 100644
--- a/test/CXX/class/class.nest/p1.cpp
+++ b/test/CXX/class/class.nest/p1.cpp
@@ -3,12 +3,12 @@
class Outer {
int x;
static int sx;
+ int f();
- // C++0x will likely relax this rule in this specific case, but
- // we'll still need to enforce it in C++03 mode. See N2253 (or
- // successor).
+ // C++0x does relax this rule (see 5.1.1.10) in the first case, but we need to enforce it in C++03 mode.
class Inner {
static char a[sizeof(x)]; // expected-error {{ invalid use of nonstatic data member 'x' }}
static char b[sizeof(sx)]; // okay
+ static char c[sizeof(f)]; // 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 e974d825d6ef..b5dd4dfd705d 100644
--- a/test/CXX/class/class.union/p1.cpp
+++ b/test/CXX/class/class.union/p1.cpp
@@ -90,6 +90,14 @@ union U3 {
} m7;
};
+union U4 {
+ static int i1; // expected-error {{static data member 'i1' not allowed in union}}
+};
+
+union U5 {
+ int& i1; // expected-error {{union member 'i1' has reference type 'int &'}}
+};
+
template <class A, class B> struct Either {
bool tag;
union {
diff --git a/test/CXX/class/p1-0x.cpp b/test/CXX/class/p1-0x.cpp
new file mode 100644
index 000000000000..5851de6cc395
--- /dev/null
+++ b/test/CXX/class/p1-0x.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+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/class/p2-0x.cpp b/test/CXX/class/p2-0x.cpp
new file mode 100644
index 000000000000..630aa7e70f90
--- /dev/null
+++ b/test/CXX/class/p2-0x.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+namespace Test1 {
+
+class A final { }; // expected-note {{'A' declared here}}
+class B : A { }; // expected-error {{base 'A' is marked 'final'}}
+
+}
+
+namespace Test2 {
+
+template<typename T> struct A final { }; // expected-note 2 {{'A' declared here}}
+struct B : A<int> { }; // expected-error {{base 'A' is marked 'final'}}
+
+template<typename T> struct C : A<T> { }; // expected-error {{base 'A' is marked 'final'}}
+struct D : C<int> { }; // expected-note {{in instantiation of template class 'Test2::C<int>' requested here}}
+
+}
+
+namespace Test3 {
+
+template<typename T> struct A { };
+template<> struct A<int> final { }; // expected-note {{'A' declared here}}
+
+struct B : A<bool> { };
+struct C : A<int> { }; // expected-error {{base 'A' is marked 'final'}}
+
+}
+
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
index ddcbe785a739..069ca0a92588 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only %s -verify
// C++'0x [namespace.memdef] p3:
// Every name first declared in a namespace is a member of that namespace. If
@@ -66,3 +66,28 @@ namespace N3 {
}
// FIXME: Woefully inadequate for testing
+
+// Friends declared as template-ids aren't subject to the restriction
+// on innermost namespaces.
+// rdar://problem/8552377
+namespace test5 {
+ template <class T> void f(T);
+ namespace ns {
+ class A {
+ friend void f<int>(int);
+ static void foo(); // expected-note 2 {{declared private here}}
+ };
+
+ // Note that this happens without instantiation.
+ template <class T> void f(T) {
+ A::foo(); // expected-error {{'foo' is a private member of 'test5::ns::A'}}
+ }
+ }
+
+ template <class T> void f(T) {
+ ns::A::foo(); // expected-error {{'foo' is a private member of 'test5::ns::A'}}
+ }
+
+ template void f<int>(int);
+ template void f<long>(long); //expected-note {{instantiation}}
+}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp
new file mode 100644
index 000000000000..411c16cd8dfb
--- /dev/null
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p2.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR8430
+namespace N {
+ class A { };
+}
+
+namespace M { }
+
+using namespace M;
+
+namespace N {
+ namespace M {
+ }
+}
+
+namespace M {
+ namespace N {
+ }
+}
+
+namespace N {
+ A *getA();
+}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
index bb1d67f51a6c..634369dd5230 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
@@ -89,6 +89,7 @@ namespace test2 {
namespace test3 {
class A {
+ public:
~A();
};
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
index 082a32d8caf3..24780c68322c 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
void f() {
auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}}
+ auto *b = b; // expected-error{{variable 'b' declared with 'auto' type cannot appear in its own initializer}}
+ const auto c = c; // expected-error{{variable 'c' declared with 'auto' type cannot appear in its own initializer}}
}
void g() {
@@ -8,3 +10,32 @@ void g() {
auto *b; // expected-error{{declaration of variable 'b' with type 'auto *' requires an initializer}}
}
+
+auto n(1,2,3); // expected-error{{initializer for variable 'n' with type 'auto' contains multiple expressions}}
+
+namespace N
+{
+ auto a = "const char [16]", *p = &a;
+}
+
+void h() {
+ auto b = 42ULL;
+
+ for (auto c = 0; c < 100; ++c) {
+ }
+}
+
+template<typename T, typename U> struct same;
+template<typename T> struct same<T, T> {};
+
+void p3example() {
+ auto x = 5;
+ const auto *v = &x, u = 6;
+ static auto y = 0.0;
+ auto int r; // expected-error{{cannot combine with previous}} expected-error{{requires an initializer}}
+
+ same<decltype(x), int> xHasTypeInt;
+ same<decltype(v), const int*> vHasTypeConstIntPtr;
+ same<decltype(u), const int> uHasTypeConstInt;
+ same<decltype(y), double> yHasTypeDouble;
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
new file mode 100644
index 000000000000..34a178400706
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+template<typename T>
+struct only {
+ only(T);
+ template<typename U> only(U) = delete;
+};
+
+void f() {
+ if (auto a = true) {
+ }
+
+ switch (auto a = 0) {
+ }
+
+ while (auto a = false) {
+ }
+
+ for (; auto a = false; ) {
+ }
+
+ new const auto (0);
+ new (auto) (0.0);
+
+#if 0
+ // When clang supports for-range:
+ for (auto i : {1,2,3}) {
+ }
+
+ // When clang supports inline initialization of members.
+ class X {
+ static const auto &n = 'x';
+ };
+#endif
+}
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 e73925479324..836ccda6f9d7 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,13 +1,72 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-void f() {
- auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}}
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s -std=c++0x
+
+struct S {
+ virtual ~S();
+
+ auto a; // expected-error{{'auto' not allowed in struct member}}
+ auto *b; // expected-error{{'auto' not allowed in struct member}}
+ const auto c; // expected-error{{'auto' not allowed in struct member}}
+
+ void f() throw (auto); // expected-error{{'auto' not allowed here}}
+
+ friend auto; // expected-error{{'auto' not allowed in struct member}}
+
+ operator auto(); // expected-error{{'auto' not allowed here}}
+};
+
+void g(auto a) { // expected-error{{'auto' not allowed in function prototype}}
+ try { }
+ catch (auto &a) { } // expected-error{{'auto' not allowed in exception declaration}}
+ catch (const auto a) { } // expected-error{{'auto' not allowed in exception declaration}}
+ try { } catch (auto a) { } // expected-error{{'auto' not allowed in exception declaration}}
+}
+
+void h(auto a[10]) { // expected-error{{'auto' not allowed in function prototype}}
}
-struct S { auto a; }; // expected-error{{'auto' not allowed in struct member}}
+void i(const auto a) { // expected-error{{'auto' not allowed in function prototype}}
+}
-void f(auto a) // expected-error{{'auto' not allowed in function prototype}}
-{
- try { } catch (auto a) { } // expected-error{{'auto' not allowed in exception declaration}}
+namespace std {
+ class type_info;
+}
+
+template<typename T> struct U {};
+
+void j() {
+ (void)typeid(auto); // expected-error{{'auto' not allowed here}}
+ (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}}
+
+ int n;
+ (void)dynamic_cast<auto&>(S()); // expected-error{{'auto' not allowed here}}
+ (void)static_cast<auto*>(&n); // expected-error{{'auto' not allowed here}}
+ (void)reinterpret_cast<auto*>(&n); // expected-error{{'auto' not allowed here}}
+ (void)const_cast<auto>(n); // expected-error{{'auto' not allowed here}}
+ (void)*(auto*)(&n); // expected-error{{'auto' not allowed here}}
+ (void)auto(n); // expected-error{{expected expression}}
+ (void)auto{n}; // expected-error{{expected expression}}
}
template <auto a = 10> class C { }; // expected-error{{'auto' not allowed in template parameter}}
+int ints[] = {1, 2, 3};
+template <const auto (*a)[3] = &ints> class D { }; // expected-error{{'auto' not allowed in template parameter}}
+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}}
+
+// Whether this is illegal depends on the interpretation of [decl.spec.auto]p2 and p3,
+// and in particular the "Otherwise, ..." at the start of p3.
+namespace TrailingReturnType {
+ // FIXME: don't issue the second diagnostic for this error.
+ auto f() -> auto; // expected-error{{'auto' not allowed here}} unexpected-error{{without trailing return type}}
+ int g();
+ auto (*h)() -> auto = &g; // expected-error{{'auto' not allowed here}}
+ auto (*i)() = &g; // ok; auto deduced as int.
+ auto (*j)() -> int = i; // ok; no deduction.
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
new file mode 100644
index 000000000000..06aeaa690a1a
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+template<typename T>
+struct only {
+ only(T);
+ template<typename U> only(U) = delete;
+};
+
+namespace N
+{
+ auto a = "const char [16]", *p = &a;
+
+ only<const char [16]> testA = a;
+ only<const char **> testP = p;
+}
+
+void h() {
+ auto b = 42ULL;
+ only<unsigned long long> testB = b;
+
+ for (auto c = 0; c < 100; ++c) {
+ only<int> testC = c;
+ }
+}
+
+void p3example() {
+ auto x = 5;
+ const auto *v = &x, u = 6;
+ static auto y = 0.0;
+
+ only<int> testX = x;
+ only<const int*> testV = v;
+ only<const int> testU = u;
+ only<double> testY = y;
+}
+
+void f() {
+ if (auto a = true) {
+ only<bool> testA = a;
+ }
+
+ switch (auto a = 0) {
+ case 0:
+ only<int> testA = a;
+ }
+
+ while (auto a = false) {
+ only<bool> testA = a;
+ }
+
+ for (; auto a = "test"; ) {
+ only<const char[5]> testA = a;
+ }
+
+ auto *fail1 = 0; // expected-error {{variable 'fail1' with type 'auto *' has incompatible initializer of type 'int'}}
+ int **p;
+ // FIXME: due to PR9233, we get the wrong diagnostic here.
+ const auto **fail2(p); // desired-error {{variable 'fail2' with type 'auto const **' has incompatible initializer of type 'int **'}} expected-error {{cannot initialize}}
+}
+
+struct S {
+ void f();
+ char g(int);
+ float g(double);
+ int m;
+
+ void test() {
+ auto p1 = &S::f;
+ auto S::*p2 = &S::f;
+ auto (S::*p3)() = &S::f;
+ auto p4 = &S::g; // expected-error {{incompatible initializer of type '<overloaded function type>'}}
+ auto S::*p5 = &S::g; // expected-error {{incompatible initializer of type '<overloaded function type>'}}
+ auto (S::*p6)(int) = &S::g;
+ auto p7 = &S::m;
+ auto S::*p8 = &S::m;
+
+ only<void (S::*)()> test1 = p1;
+ only<void (S::*)()> test2 = p2;
+ only<void (S::*)()> test3 = p3;
+ only<char (S::*)(int)> test6 = p6;
+ only<int (S::*)> test7 = p7;
+ only<int (S::*)> test8 = p8;
+ }
+};
+
+// TODO: if the initializer is a braced-init-list, deduce auto as std::initializer_list<T>.
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
new file mode 100644
index 000000000000..de87a93a2bc1
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+void f() {
+ auto a = 0, b = 0, c = 0;
+ auto d = 0, e = 0.0; // expected-error {{'int' in declaration of 'd' and deduced as 'double' in declaration of 'e'}}
+
+ auto v1 = 0, *p1 = &v1;
+ auto *p2 = 0, v2 = *p2; // expected-error {{incompatible initializer}}
+
+ const int k = 0;
+ auto &f = k, &g = a; // expected-error {{'const int' in declaration of 'f' and deduced as 'int' in declaration of 'g'}}
+
+ typedef int I;
+ I x;
+ auto xa = x, xb = 0;
+
+ auto &&ra1 = a, rb1 = b; // expected-error {{'int &' in declaration of 'ra1' and deduced as 'int' in declaration of 'rb1'}}
+ auto &&ra2 = +a, rb2 = b;
+}
+
+void g() {
+ auto a = 0, (*b)() -> void, c = 0;
+ auto d = 0, (*e)() -> void, f = 0.0; // expected-error {{'auto' deduced as 'int' in declaration of 'd' and deduced as 'double' in declaration of 'f'}}
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
new file mode 100644
index 000000000000..7b0fb9c52ba4
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
@@ -0,0 +1,164 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify -pedantic %s
+
+// Test the C++0x-specific reference initialization rules, e.g., the
+// rules for rvalue references.
+template<typename T> T prvalue();
+template<typename T> T&& xvalue();
+template<typename T> T& lvalue();
+
+struct Base { };
+struct Derived : Base { };
+
+struct HasArray {
+ int array[5];
+};
+
+int f(int);
+
+template<typename T>
+struct ConvertsTo {
+ operator T(); // expected-note 4{{candidate function}}
+};
+
+void test_rvalue_refs() {
+ // If the initializer expression...
+ // - is an xvalue, class prvalue, array prvalue or function lvalue
+ // and "cv1 T1" is reference-compatible with "cv2 T2", or
+
+ // xvalue case
+ Base&& base0 = xvalue<Base>();
+ Base&& base1 = xvalue<Derived>();
+ int&& int0 = xvalue<int>();
+
+ // class prvalue case
+ Base&& base2 = prvalue<Base>();
+ Base&& base3 = prvalue<Derived>();
+
+ // array prvalue case
+ int (&&array0)[5] = HasArray().array;
+
+ // function lvalue case
+ int (&&function0)(int) = f;
+
+ // - has a class type (i.e., T2 is a class type), where T1 is not
+ // reference-related to T2, and can be implicitly converted to
+ // an xvalue, class prvalue, or function lvalue of type "cv3
+ // T3", where "cv1 T1" is reference-compatible with "cv3 T3",
+
+ // xvalue
+ Base&& base4 = ConvertsTo<Base&&>();
+ Base&& base5 = ConvertsTo<Derived&&>();
+ int && int1 = ConvertsTo<int&&>();
+
+ // class prvalue
+ Base&& base6 = ConvertsTo<Base>();
+ Base&& base7 = ConvertsTo<Derived>();
+
+ // function lvalue
+ int (&&function1)(int) = ConvertsTo<int(&)(int)>();
+
+ // In the second case, if the reference is an rvalue reference and
+ // the second standard conversion sequence of the user-defined
+ // conversion sequence includes an lvalue-to-rvalue conversion, the
+ // program is ill-formed.
+ int &&int2 = ConvertsTo<int&>(); // expected-error{{no viable conversion from 'ConvertsTo<int &>' to 'int'}}
+ int &&int3 = ConvertsTo<float&>(); // expected-error{{no viable conversion from 'ConvertsTo<float &>' to 'int'}}
+}
+
+class NonCopyable {
+ NonCopyable(const NonCopyable&);
+};
+
+class NonCopyableDerived : public NonCopyable {
+ NonCopyableDerived(const NonCopyableDerived&);
+};
+
+// Make sure we get direct bindings with no copies.
+void test_direct_binding() {
+ NonCopyable &&nc0 = prvalue<NonCopyable>();
+ NonCopyable &&nc1 = prvalue<NonCopyableDerived>();
+ NonCopyable &&nc2 = xvalue<NonCopyable>();
+ NonCopyable &&nc3 = xvalue<NonCopyableDerived>();
+ const NonCopyable &nc4 = prvalue<NonCopyable>();
+ const NonCopyable &nc5 = prvalue<NonCopyableDerived>();
+ const NonCopyable &nc6 = xvalue<NonCopyable>();
+ const NonCopyable &nc7 = xvalue<NonCopyableDerived>();
+ NonCopyable &&nc8 = ConvertsTo<NonCopyable&&>();
+ NonCopyable &&nc9 = ConvertsTo<NonCopyableDerived&&>();
+ const NonCopyable &nc10 = ConvertsTo<NonCopyable&&>();
+ const NonCopyable &nc11 = ConvertsTo<NonCopyableDerived&&>();
+}
+
+namespace std_example_1 {
+ double d = 2.0;
+ double& rd = d;
+ const double& rcd = d;
+ struct A { };
+ struct B : A {
+ operator int&();
+ } b;
+ A& ra = b;
+ const A& rca = b;
+ int& ir = B();
+}
+
+namespace std_example_2 {
+ double& rd2 = 2.0; // expected-error{{non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'}}
+ int i = 2;
+ double& rd3 = i; // expected-error{{non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'}}
+ struct A { };
+ struct B : A { } b;
+ extern B f();
+ const A& rca = f();
+ A&& rra = f();
+ struct X {
+ operator B(); // expected-note{{candidate function}}
+ operator int&(); // expected-note{{candidate function}}
+ } x;
+ const A& r = x;
+ int&& rri = static_cast<int&&>(i);
+ B&& rrb = x;
+ int&& rri2 = X(); // expected-error{{no viable conversion from 'std_example_2::X' to 'int'}}
+
+ const double& rcd2 = 2;
+ double&& rrd = 2;
+ const volatile int cvi = 1;
+ const int& r2 = cvi; // expected-error{{binding of reference to type 'const int' to a value of type 'const volatile int' drops qualifiers}}
+
+ double d;
+ double&& rrd2 = d; // expected-error{{rvalue reference to type 'double' cannot bind to lvalue of type 'double'}}
+ double&& rrd3 = i;
+}
+
+namespace argument_passing {
+ void base_rvalue_ref(Base&&);
+ void int_rvalue_ref(int&&); // expected-note 2{{passing argument to parameter here}}
+ void array_rvalue_ref(int (&&)[5]);
+ void function_rvalue_ref(int (&&)(int));
+
+ void test() {
+ base_rvalue_ref(xvalue<Base>());
+ base_rvalue_ref(xvalue<Derived>());
+ int_rvalue_ref(xvalue<int>());
+
+ base_rvalue_ref(prvalue<Base>());
+ base_rvalue_ref(prvalue<Derived>());
+
+ array_rvalue_ref(HasArray().array);
+
+ function_rvalue_ref(f);
+
+ base_rvalue_ref(ConvertsTo<Base&&>());
+ base_rvalue_ref(ConvertsTo<Derived&&>());
+ int_rvalue_ref(ConvertsTo<int&&>());
+
+ base_rvalue_ref(ConvertsTo<Base>());
+ base_rvalue_ref(ConvertsTo<Derived>());
+
+ function_rvalue_ref(ConvertsTo<int(&)(int)>());
+
+ int_rvalue_ref(ConvertsTo<int&>()); // expected-error{{no viable conversion from 'ConvertsTo<int &>' to 'int'}}
+ int_rvalue_ref(ConvertsTo<float&>()); // expected-error{{no viable conversion from 'ConvertsTo<float &>' to 'int'}}
+ }
+
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
index ae59598f691e..8c654110fa24 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
@@ -53,7 +53,7 @@ void g4(const X4<int>&);
void g5(const X5&);
void test() {
- g1(X1()); // expected-warning{{no viable constructor copying parameter of type 'X1'; C++98 requires a copy constructor when binding a reference to a temporary [-Wbind-to-temporary-copy]}}
+ g1(X1());
g2(X2()); // expected-warning{{C++98 requires an accessible copy constructor for class 'X2' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy]}}
g3(X3()); // expected-warning{{no viable constructor copying parameter of type 'X3'}}
g4(X4<int>());
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
index 9b3925969c45..08d963951c1d 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-examples.cpp
@@ -6,8 +6,8 @@ void example0() {
// CHECK: double &rd =
// CHECK-NEXT: DeclRefExpr
double &rd = d;
- // CHECK: double const &rcd =
- // CHECK-NEXT: ImplicitCastExpr{{.*}}'double const' <NoOp>
+ // CHECK: const double &rcd =
+ // CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' lvalue <NoOp>
const double &rcd = d;
}
@@ -17,11 +17,11 @@ struct B : A { } b;
// CHECK: example1
void example1() {
// CHECK: A &ra =
- // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)> lvalue
+ // CHECK: ImplicitCastExpr{{.*}}'struct A' lvalue <DerivedToBase (A)>
A &ra = b;
- // CHECK: A const &rca =
- // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
- // CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
+ // CHECK: const A &rca =
+ // CHECK: ImplicitCastExpr{{.*}}'const struct A' lvalue <NoOp>
+ // CHECK: ImplicitCastExpr{{.*}}'struct A' lvalue <DerivedToBase (A)>
const A& rca = b;
}
@@ -33,13 +33,13 @@ struct X {
// CHECK: example2
void example2() {
- // CHECK: A const &rca =
- // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
+ // CHECK: const A &rca =
+ // CHECK: ImplicitCastExpr{{.*}}'const struct A' <NoOp>
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
// CHECK: CallExpr{{.*}}B
const A &rca = f();
- // CHECK: A const &r =
- // CHECK: ImplicitCastExpr{{.*}}'struct A const' <NoOp>
+ // CHECK: const A &r =
+ // CHECK: ImplicitCastExpr{{.*}}'const struct A' <NoOp>
// CHECK: ImplicitCastExpr{{.*}}'struct A' <DerivedToBase (A)>
// CHECK: CXXMemberCallExpr{{.*}}'struct B'
const A& r = x;
@@ -47,7 +47,7 @@ void example2() {
// CHECK: example3
void example3() {
- // CHECK: double const &rcd2 =
- // CHECK: ImplicitCastExpr{{.*}}<IntegralToFloating>
+ // CHECK: const double &rcd2 =
+ // CHECK: ImplicitCastExpr{{.*}} <IntegralToFloating>
const double& rcd2 = 2;
}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
index 6a039b93ebfa..fee5f96c389f 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct Base { }; // expected-note{{candidate is the implicit copy constructor}}
+struct Base { };
struct Derived : Base { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable}}
struct Unrelated { };
struct Derived2 : Base { };
@@ -64,10 +64,10 @@ void bind_lvalue_quals(volatile Base b, volatile Derived d,
volatile const int ivc) {
volatile Base &bvr1 = b;
volatile Base &bvr2 = d;
- volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'Base volatile' to a value of type 'Base const volatile' drops qualifiers}}
- volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'Base volatile' to a value of type 'Derived const volatile' drops qualifiers}}
+ volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'volatile Base' to a value of type 'const volatile Base' drops qualifiers}}
+ volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'volatile Base' to a value of type 'const volatile Derived' drops qualifiers}}
- volatile int &ir = ivc; // expected-error{{binding of reference to type 'int volatile' to a value of type 'int const volatile' drops qualifiers}}
+ volatile int &ir = ivc; // expected-error{{binding of reference to type 'volatile int' to a value of type 'const volatile int' drops qualifiers}}
const volatile Base &bcvr1 = b;
const volatile Base &bcvr2 = d;
@@ -76,15 +76,15 @@ void bind_lvalue_quals(volatile Base b, volatile Derived d,
void bind_lvalue_to_rvalue() {
Base &br1 = Base(); // expected-error{{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Base'}}
Base &br2 = Derived(); // expected-error{{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Derived'}}
- const volatile Base &br3 = Base(); // expected-error{{volatile lvalue reference to type 'Base const volatile' cannot bind to a temporary of type 'Base'}}
- const volatile Base &br4 = Derived(); // expected-error{{volatile lvalue reference to type 'Base const volatile' cannot bind to a temporary of type 'Derived'}}
+ const volatile Base &br3 = Base(); // expected-error{{volatile lvalue reference to type 'const volatile Base' cannot bind to a temporary of type 'Base'}}
+ const volatile Base &br4 = Derived(); // expected-error{{volatile lvalue reference to type 'const volatile Base' cannot bind to a temporary of type 'Derived'}}
int &ir = 17; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
}
void bind_lvalue_to_unrelated(Unrelated ur) {
Base &br1 = ur; // expected-error{{non-const lvalue reference to type 'Base' cannot bind to a value of unrelated type 'Unrelated'}}
- const volatile Base &br2 = ur; // expected-error{{volatile lvalue reference to type 'Base const volatile' cannot bind to a value of unrelated type 'Unrelated'}}
+ const volatile Base &br2 = ur; // expected-error{{volatile lvalue reference to type 'const volatile Base' cannot bind to a value of unrelated type 'Unrelated'}}
}
void bind_lvalue_to_conv_lvalue() {
@@ -118,8 +118,8 @@ void bind_const_lvalue_to_rvalue() {
const Base &br3 = create<const Base>();
const Base &br4 = create<const Derived>();
- const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'Base const' to a value of type 'Base const volatile' drops qualifiers}}
- const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'Base const' to a value of type 'Derived const volatile' drops qualifiers}}
+ const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'const Base' to a value of type 'const volatile Base' drops qualifiers}}
+ const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'const Base' to a value of type 'const volatile Derived' drops qualifiers}}
const int &ir = create<int>();
}
@@ -131,5 +131,5 @@ void bind_const_lvalue_to_class_conv_temporary() {
}
void bind_lvalue_to_conv_rvalue_ambig(ConvertibleToBothDerived both) {
const Derived &dr1 = both;
- const Base &br1 = both; // expected-error{{reference initialization of type 'Base const &' with initializer of type 'ConvertibleToBothDerived' is ambiguous}}
+ const Base &br1 = both; // expected-error{{reference initialization of type 'const Base &' with initializer of type 'ConvertibleToBothDerived' is ambiguous}}
}
diff --git a/test/CXX/dcl.decl/dcl.init/p6.cpp b/test/CXX/dcl.decl/dcl.init/p6.cpp
index c542dac1db1d..da6f5b5369d0 100644
--- a/test/CXX/dcl.decl/dcl.init/p6.cpp
+++ b/test/CXX/dcl.decl/dcl.init/p6.cpp
@@ -10,7 +10,7 @@ struct NoUserDefault : public MakeNonPOD { };
struct HasUserDefault { HasUserDefault(); };
void test_const_default_init() {
- const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'NoUserDefault const' requires a user-provided default constructor}}
+ const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'const NoUserDefault' requires a user-provided default constructor}}
const HasUserDefault x2;
- const int x3; // expected-error{{default initialization of an object of const type 'int const'}}
+ const int x3; // expected-error{{default initialization of an object of const type 'const int'}}
}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
index 00e59e0bd792..b0575b8236bb 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
@@ -3,4 +3,5 @@
void f() {
int b[5];
auto a[5] = b; // expected-error{{'a' declared as array of 'auto'}}
+ auto *c[5] = b; // expected-error{{'c' declared as array of 'auto *'}}
}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp
index ac0ec85db060..bb4a48eb5b91 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp
@@ -5,7 +5,7 @@ int ar1[10];
// Element type cannot be:
// - (cv) void
-volatile void ar2[10]; // expected-error {{incomplete element type 'void volatile'}}
+volatile void ar2[10]; // expected-error {{incomplete element type 'volatile void'}}
// - a reference
int& ar3[10]; // expected-error {{array of references}}
// - a function type
@@ -16,7 +16,7 @@ struct Abstract { virtual void fn() = 0; }; // expected-note {{pure virtual}}
Abstract ar5[10]; // expected-error {{abstract class}}
// If we have a size, it must be greater than zero.
-int ar6[-1]; // expected-error {{array size is negative}}
+int ar6[-1]; // expected-error {{array with a negative size}}
int ar7[0u]; // expected-warning {{zero size arrays are an extension}}
// An array with unknown bound is incomplete.
@@ -42,3 +42,13 @@ template <typename T> struct S {
typename T::type x; // expected-error {{has no members}}
};
S<int> ar10[10]; // expected-note {{requested here}}
+
+// Ensure that negative array size errors include the name of the declared
+// array as this is often used to simulate static_assert with template
+// instantiations, placing the 'error message' in the declarator name.
+int
+user_error_message
+[-1]; // expected-error {{user_error_message}}
+typedef int
+another_user_error_message
+[-1]; // expected-error {{another_user_error_message}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
new file mode 100644
index 000000000000..5fb35ba9622b
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
+
+// When it is part of a parameter-declaration-clause, the parameter
+// pack is a function parameter pack.
+template<typename ...Types>
+void f0(Types ...args);
+
+template<typename ...Types>
+void f1(const Types &...args);
+
+// [ Note: Otherwise, the parameter-declaration is part of a
+// template-parameter-list and the parameter pack is a template
+// parameter pack; see 14.1. -- end note ]
+template<int ...N>
+struct X0 { };
+
+template<typename ...Types>
+struct X1 {
+ template<Types ...Values> struct Inner;
+};
+
+// A declarator-id or abstract-declarator containing an ellipsis shall
+// only be used in a parameter-declaration.
+int (...f2)(int); // expected-error{{only function and template parameters can be parameter packs}}
+
+void f3() {
+ int ...x; // expected-error{{only function and template parameters can be parameter packs}}
+ if (int ...y = 17) { } // expected-error{{only function and template parameters can be parameter packs}}
+
+ for (int ...z = 0; z < 10; ++z) { } // expected-error{{only function and template parameters can be parameter packs}}
+
+ try {
+ } catch (int ...e) { // expected-error{{only function and template parameters can be parameter packs}}
+ }
+}
+
+template<typename ...Types>
+struct X2 {
+ Types ...members; // expected-error{{only function and template parameters can be parameter packs}} \
+ // expected-error{{data member type contains unexpanded parameter pack}}
+};
+
+// The type T of the declarator-id of the function parameter pack
+// shall contain a template parameter pack; each template parameter
+// pack in T is expanded by the function parameter pack.
+template<typename T>
+void f4(T ...args); // expected-error{{type 'T' of function parameter pack does not contain any unexpanded parameter packs}}
+
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
new file mode 100644
index 000000000000..1293a067576a
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T> struct identity;
+template<typename ...Types> struct tuple;
+
+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;
+};
+
+// There is a syntactic ambiguity when an ellipsis occurs at the end
+// of a parameter-declaration-clause without a preceding comma. In
+// this case, the ellipsis is parsed as part of the
+// abstract-declarator if the type of the parameter names a template
+// parameter pack that has not been expanded; otherwise, it is parsed
+// as part of the parameter-declaration-clause.
+
+template<typename T, typename ...Types>
+struct X0 {
+ typedef identity<T(Types...)> function_pack_1;
+ typedef identity<T(Types......)> variadic_function_pack_1;
+ typedef identity<T(T...)> variadic_1;
+ typedef tuple<T(Types, ...)...> template_arg_expansion_1;
+};
+
+
+
+// FIXME: Once function parameter packs are implemented, we can test all of the disambiguation
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
new file mode 100644
index 000000000000..4dc393da9f41
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+auto a() -> int; // ok
+const auto b() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'auto const'}}
+auto *c() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'auto *'}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
new file mode 100644
index 000000000000..c81c844f3448
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+void f0() &; // expected-error{{ref-qualifier '&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
+void f1() &&; // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
+
+struct X {
+ void f0() &;
+ void f1() &&;
+ static void f2() &; // expected-error{{ref-qualifier '&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
+ static void f3() &&; // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
+};
+
+typedef void func_type_lvalue() &;
+typedef void func_type_rvalue() &&;
+
+func_type_lvalue f2; // expected-error{{nonmember function cannot have a ref-qualifier '&'}}
+func_type_rvalue f3; // expected-error{{nonmember function cannot have a ref-qualifier '&&'}}
+
+struct Y {
+ func_type_lvalue f0;
+ func_type_rvalue f1;
+};
+
+void (X::*mpf1)() & = &X::f0;
+void (X::*mpf2)() && = &X::f1;
+
+
+void (f() &&); // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp
new file mode 100644
index 000000000000..4873c095a0eb
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f() const; // expected-error{{type qualifier is not allowed on this function}}
+
+struct X {
+ void f() const;
+ friend void g() const; // expected-error{{type qualifier is not allowed on this function}}
+ static void h() const; // expected-error{{type qualifier is not allowed on this function}}
+};
+
+struct Y {
+ friend void X::f() const;
+ friend void ::f() const; // expected-error{{type qualifier is not allowed on this function}}
+};
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8.cpp
new file mode 100644
index 000000000000..34a8c854a6b6
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A { };
+A::A (enum { e1 }) {} // expected-error{{can not be defined in a parameter}} \
+// expected-error{{out-of-line definition}}
+void A::f(enum { e2 }) {} // expected-error{{can not be defined in a parameter}} \
+// expected-error{{out-of-line definition}}
+
+enum { e3 } A::g() { } // expected-error{{can not be defined in the result type}} \
+// expected-error{{out-of-line definition}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
new file mode 100644
index 000000000000..789cde75241a
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -std=c++0x -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;
+};
+#define JOIN2(X,Y) X##Y
+#define JOIN(X,Y) JOIN2(X,Y)
+#define CHECK_EQUAL_TYPES(T1, T2) \
+ int JOIN(array,__LINE__)[is_same<T1, T2>::value? 1 : -1]
+
+int i;
+typedef int& LRI;
+typedef int&& RRI;
+
+typedef LRI& r1; CHECK_EQUAL_TYPES(r1, int&);
+typedef const LRI& r2; CHECK_EQUAL_TYPES(r2, int&);
+typedef const LRI&& r3; CHECK_EQUAL_TYPES(r3, int&);
+
+typedef RRI& r4; CHECK_EQUAL_TYPES(r4, int&);
+typedef RRI&& r5; CHECK_EQUAL_TYPES(r5, int&&);
diff --git a/test/CXX/dcl.decl/p4-0x.cpp b/test/CXX/dcl.decl/p4-0x.cpp
new file mode 100644
index 000000000000..9fa2ea19d411
--- /dev/null
+++ b/test/CXX/dcl.decl/p4-0x.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+struct X {
+ void f() &;
+ void g() &&;
+};
+
+void (X::*pmf)() & = &X::f;
diff --git a/test/CXX/except/except.handle/p16.cpp b/test/CXX/except/except.handle/p16.cpp
index 4950a2f6aab0..24f0db08cd8d 100644
--- a/test/CXX/except/except.handle/p16.cpp
+++ b/test/CXX/except/except.handle/p16.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -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/p14-ir.cpp b/test/CXX/except/except.spec/p14-ir.cpp
index 4d8d1f7c4018..c681727e8ccf 100644
--- a/test/CXX/except/except.spec/p14-ir.cpp
+++ b/test/CXX/except/except.spec/p14-ir.cpp
@@ -26,17 +26,17 @@ struct X4 {
struct X5 : X0, X4 { };
void test(X2 x2, X3 x3, X5 x5) {
- // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_
+ // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_(%struct.X0* %this, %struct.X0*) unnamed_addr
// CHECK: call void @_ZN2X2C2ERKS_({{.*}}) nounwind
// CHECK-NEXT: ret void
// CHECK-NEXT: }
X2 x2a(x2);
- // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_
+ // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_(%struct.X0* %this, %struct.X0*) unnamed_addr
// CHECK: call void @_ZN2X3C2ERKS_({{.*}}) nounwind
// CHECK-NEXT: ret void
// CHECK-NEXT: }
X3 x3a(x3);
- // CHECK: define linkonce_odr void @_ZN2X5C1ERS_
+ // CHECK: define linkonce_odr void @_ZN2X5C1ERS_({{.*}}) unnamed_addr
// CHECK-NOT: call void @__cxa_call_unexpected
// CHECK: ret void
X5 x5a(x5);
@@ -55,24 +55,24 @@ struct X8 : X6 { };
struct X9 : X6, X7 { };
void test() {
- // CHECK: define linkonce_odr void @_ZN2X8C1Ev
+ // CHECK: define linkonce_odr void @_ZN2X8C1Ev(%struct.X0* %this) unnamed_addr
// CHECK: call void @_ZN2X8C2Ev({{.*}}) nounwind
// CHECK-NEXT: ret void
X8();
- // CHECK: define linkonce_odr void @_ZN2X9C1Ev
+ // CHECK: define linkonce_odr void @_ZN2X9C1Ev(%struct.X0* %this) unnamed_addr
// FIXME: check that this is the end of the line here:
// CHECK: call void @_ZN2X9C2Ev({{.*}})
// CHECK-NEXT: ret void
X9();
- // CHECK: define linkonce_odr void @_ZN2X9C2Ev
+ // CHECK: define linkonce_odr void @_ZN2X9C2Ev(%struct.X0* %this) unnamed_addr
// CHECK: call void @_ZN2X6C2Ev({{.*}}) nounwind
// FIXME: and here:
// CHECK-NEXT: call void @_ZN2X7C2Ev({{.*}})
// CHECK: ret void
- // CHECK: define linkonce_odr void @_ZN2X8C2Ev
+ // CHECK: define linkonce_odr void @_ZN2X8C2Ev(%struct.X0* %this) unnamed_addr
// CHECK: call void @_ZN2X6C2Ev({{.*}}) nounwind
// CHECK-NEXT: ret void
}
diff --git a/test/CXX/expr/expr.cast/p4-0x.cpp b/test/CXX/expr/expr.cast/p4-0x.cpp
new file mode 100644
index 000000000000..5824cd21f1e7
--- /dev/null
+++ b/test/CXX/expr/expr.cast/p4-0x.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+struct X { };
+struct Y : X { };
+
+void test_lvalue_to_rvalue_drop_cvquals(const X &x, const Y &y, const int &i) {
+ (void)(X&&)x;
+ (void)(int&&)i;
+ (void)(X&&)y;
+ (void)(Y&&)x;
+}
diff --git a/test/CXX/expr/expr.cast/p4.cpp b/test/CXX/expr/expr.cast/p4.cpp
new file mode 100644
index 000000000000..907e00872442
--- /dev/null
+++ b/test/CXX/expr/expr.cast/p4.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+
+struct A { int x; };
+struct B { int y; };
+struct C : A, B { };
+
+// CHECK: casting_away_constness
+void casting_away_constness(const B &b, const C &c, const B *bp, const C *cp) {
+ // CHECK: DerivedToBase (B)
+ // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'c'
+ (void)(B&)c;
+ // CHECK: BaseToDerived (B)
+ // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'b'
+ (void)(C&)b;
+ // CHECK: DerivedToBase (B)
+ // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'cp'
+ (void)(B*)cp;
+ // CHECK: BaseToDerived (B)
+ // CHECK: DeclRefExpr {{.*}} ParmVar {{.*}} 'bp'
+ (void)(C*)bp;
+ // CHECK: ReturnStmt
+ return;
+}
diff --git a/test/CXX/expr/expr.mptr.oper/p5.cpp b/test/CXX/expr/expr.mptr.oper/p5.cpp
new file mode 100644
index 000000000000..7380b5d4805d
--- /dev/null
+++ b/test/CXX/expr/expr.mptr.oper/p5.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct X0 {
+ void f0();
+ void f1() const;
+ void f2() volatile;
+ void f3() const volatile;
+};
+
+void test_object_cvquals(void (X0::*pm)(),
+ void (X0::*pmc)() const,
+ void (X0::*pmv)() volatile,
+ void (X0::*pmcv)() const volatile,
+ X0 *p,
+ const X0 *pc,
+ volatile X0 *pv,
+ const volatile X0 *pcv,
+ X0 &o,
+ const X0 &oc,
+ volatile X0 &ov,
+ const volatile X0 &ocv) {
+ (p->*pm)();
+ (p->*pmc)();
+ (p->*pmv)();
+ (p->*pmcv)();
+
+ (pc->*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const' qualifier}}
+ (pc->*pmc)();
+ (pc->*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
+ (pc->*pmcv)();
+
+ (pv->*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'volatile' qualifier}}
+ (pv->*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
+ (pv->*pmv)();
+ (pv->*pmcv)();
+
+ (pcv->*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const volatile' qualifiers}}
+ (pcv->*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
+ (pcv->*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
+ (pcv->*pmcv)();
+
+ (o.*pm)();
+ (o.*pmc)();
+ (o.*pmv)();
+ (o.*pmcv)();
+
+ (oc.*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const' qualifier}}
+ (oc.*pmc)();
+ (oc.*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
+ (oc.*pmcv)();
+
+ (ov.*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'volatile' qualifier}}
+ (ov.*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
+ (ov.*pmv)();
+ (ov.*pmcv)();
+
+ (ocv.*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const volatile' qualifiers}}
+ (ocv.*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
+ (ocv.*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
+ (ocv.*pmcv)();
+}
diff --git a/test/CXX/expr/expr.mptr.oper/p6-0x.cpp b/test/CXX/expr/expr.mptr.oper/p6-0x.cpp
new file mode 100644
index 000000000000..d5dc7d2cbe58
--- /dev/null
+++ b/test/CXX/expr/expr.mptr.oper/p6-0x.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+struct X { };
+
+template<typename T> T& lvalue();
+template<typename T> T&& xvalue();
+template<typename T> T prvalue();
+
+// In a .* expression whose object expression is an rvalue, the
+// program is ill-formed if the second operand is a pointer to member
+// function with ref-qualifier &. In a ->* expression or in a .*
+// expression whose object expression is an lvalue, the program is
+// ill-formed if the second operand is a pointer to member function
+// with ref-qualifier &&.
+void test(X *xp, int (X::*pmf)(int), int (X::*l_pmf)(int) &,
+ int (X::*r_pmf)(int) &&) {
+ // No ref-qualifier.
+ (lvalue<X>().*pmf)(17);
+ (xvalue<X>().*pmf)(17);
+ (prvalue<X>().*pmf)(17);
+ (xp->*pmf)(17);
+
+ // Lvalue ref-qualifier.
+ (lvalue<X>().*l_pmf)(17);
+ (xvalue<X>().*l_pmf)(17); // expected-error{{pointer-to-member function type 'int (X::*)(int) &' can only be called on an lvalue}}
+ (prvalue<X>().*l_pmf)(17); // expected-error{{pointer-to-member function type 'int (X::*)(int) &' can only be called on an lvalue}}
+ (xp->*l_pmf)(17);
+
+ // Rvalue ref-qualifier.
+ (lvalue<X>().*r_pmf)(17); // expected-error{{pointer-to-member function type 'int (X::*)(int) &&' can only be called on an rvalue}}
+ (xvalue<X>().*r_pmf)(17);
+ (prvalue<X>().*r_pmf)(17);
+ (xp->*r_pmf)(17); // expected-error{{pointer-to-member function type 'int (X::*)(int) &&' can only be called on an rvalue}}
+}
diff --git a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
new file mode 100644
index 000000000000..d46488107ba6
--- /dev/null
+++ b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// The result of the expression const_cast<T>(v) is of type T. If T is
+// an lvalue reference to object type, the result is an lvalue; if T
+// is an rvalue reference to object type, the result is an xvalue;.
+
+unsigned int f(int);
+
+template<typename T> T& lvalue();
+template<typename T> T&& xvalue();
+template<typename T> T prvalue();
+
+void test_classification(const int *ptr) {
+ int *ptr0 = const_cast<int *&&>(ptr);
+ int *ptr1 = const_cast<int *&&>(xvalue<const int*>());
+ int *ptr2 = const_cast<int *&&>(prvalue<const int*>());
+}
diff --git a/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp
new file mode 100644
index 000000000000..3b448a80db2b
--- /dev/null
+++ b/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+struct X { virtual ~X(); };
+struct Y : public X { };
+struct Z; // expected-note{{forward declaration of 'Z'}}
+
+void test(X &x, Y &y, Z &z) {
+ // If T is an rvalue reference type, v shall be an expression having
+ // a complete class type, and the result is an xvalue of the type
+ // referred to by T.
+ Y &&yr0 = dynamic_cast<Y&&>(x);
+ Y &&yr1 = dynamic_cast<Y&&>(static_cast<X&&>(x));
+ Y &&yr2 = dynamic_cast<Y&&>(z); // expected-error{{'Z' is an incomplete type}}
+}
diff --git a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp
new file mode 100644
index 000000000000..e80082a0408a
--- /dev/null
+++ b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// If T is an lvalue reference type or an rvalue reference to function
+// type, the result is an lvalue; if T is an rvalue reference to
+// object type, the result is an xvalue;
+
+unsigned int f(int);
+
+template<typename T> T&& xvalue();
+void test_classification(char *ptr) {
+ int (&fr0)(int) = reinterpret_cast<int (&&)(int)>(f);
+ int &&ir0 = reinterpret_cast<int &&>(*ptr);
+ int &&ir1 = reinterpret_cast<int &&>(0);
+ int &&ir2 = reinterpret_cast<int &&>('a');
+ int &&ir3 = reinterpret_cast<int &&>(xvalue<char>());
+}
diff --git a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp
new file mode 100644
index 000000000000..c10335183e21
--- /dev/null
+++ b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// A glvalue of type "cv1 T1" can be cast to type "rvalue reference to
+// cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1" (8.5.3).
+struct A { };
+struct B : A { };
+
+template<typename T> T& lvalue();
+template<typename T> T&& xvalue();
+
+void test(A &a, B &b) {
+ A &&ar0 = static_cast<A&&>(a);
+ A &&ar1 = static_cast<A&&>(b);
+ A &&ar2 = static_cast<A&&>(lvalue<A>());
+ A &&ar3 = static_cast<A&&>(lvalue<B>());
+ A &&ar4 = static_cast<A&&>(xvalue<A>());
+ A &&ar5 = static_cast<A&&>(xvalue<B>());
+ const A &&ar6 = static_cast<const A&&>(a);
+ const A &&ar7 = static_cast<const A&&>(b);
+ const A &&ar8 = static_cast<const A&&>(lvalue<A>());
+ const A &&ar9 = static_cast<const A&&>(lvalue<B>());
+ const A &&ar10 = static_cast<const A&&>(xvalue<A>());
+ const A &&ar11 = static_cast<const A&&>(xvalue<B>());
+}
diff --git a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp
new file mode 100644
index 000000000000..4acafb89acaf
--- /dev/null
+++ b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+enum class EC { ec1 };
+
+void test0(EC ec) {
+ (void)static_cast<bool>(ec);
+ (void)static_cast<bool>(EC::ec1);
+ (void)static_cast<char>(ec);
+ (void)static_cast<char>(EC::ec1);
+ (void)static_cast<int>(ec);
+ (void)static_cast<int>(EC::ec1);
+ (void)static_cast<unsigned long>(ec);
+ (void)static_cast<unsigned long>(EC::ec1);
+ (void)static_cast<float>(ec);
+ (void)static_cast<float>(EC::ec1);
+ (void)static_cast<double>(ec);
+ (void)static_cast<double>(EC::ec1);
+}
+
+namespace PR9107 {
+ enum E {};
+ template <class _Tp> inline _Tp* addressof(_Tp& __x) {
+ return (_Tp*)&(char&)__x;
+ }
+ void test() {
+ E a;
+ addressof(a);
+ }
+}
diff --git a/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
index 2fa30e59dca5..ecb29189af60 100644
--- a/test/CXX/expr/expr.unary/expr.delete/p5.cpp
+++ b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
@@ -24,11 +24,23 @@ void f0(T2_A *a) { T2_C x; x.f0(a); }
class T2_A { };
// An alternate version of the same.
-//
-// FIXME: Revisit this case when we have access control.
class T3_A;
template<typename T>
-struct T3_B { void f0(T *a) { delete a; } };
-struct T3_C { T3_B<T3_A> x; void f0(T3_A *a) { x.f0(a); } };
+struct T3_B {
+ void f0(T *a) {
+ delete a; // expected-error{{calling a private destructor of class 'T3_A'}}
+ }
+};
+
+struct T3_C {
+ T3_B<T3_A> x;
+ void f0(T3_A *a) {
+ x.f0(a); // expected-note{{in instantiation of member function 'T3_B<T3_A>::f0' requested here}}
+ }
+};
+
void f0(T3_A *a) { T3_C x; x.f0(a); }
-class T3_A { private: ~T3_A(); };
+class T3_A {
+private:
+ ~T3_A(); // expected-note{{declared private here}}
+};
diff --git a/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp b/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp
new file mode 100644
index 000000000000..c9a8887d2644
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+template<typename T>
+struct only {
+ only(T);
+ template<typename U> only(U) = delete;
+};
+
+void f() {
+ only<const int*> p = new const auto (0);
+ only<double*> q = new (auto) (0.0);
+
+ new auto; // expected-error{{new expression for type 'auto' requires a constructor argument}}
+ new (const auto)(); // expected-error{{new expression for type 'auto const' requires a constructor argument}}
+ new (auto) (1,2,3); // expected-error{{new expression for type 'auto' contains multiple constructor arguments}}
+}
+
+void p2example() {
+ only<int*> r = new auto(1);
+ auto x = new auto('a');
+
+ only<char*> testX = x;
+}
diff --git a/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp b/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp
new file mode 100644
index 000000000000..382461541546
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Test parsing + semantic analysis
+template<typename ...Types> struct count_types {
+ static const unsigned value = sizeof...(Types);
+};
+
+template<int ...Values> struct count_ints {
+ static const unsigned value = sizeof...(Values);
+};
+
+// Test instantiation
+int check_types[count_types<short, int, long>::value == 3? 1 : -1];
+int check_ints[count_ints<1, 2, 3, 4, 5>::value == 5? 1 : -1];
+
+// Test instantiation involving function parameter packs.
+struct any {
+ template<typename T> any(T);
+};
+
+template<typename ...Inits>
+void init_me(Inits ...inits) {
+ any array[sizeof...(inits)] = { inits... };
+}
+
+template void init_me<int, float, double*>(int, float, double*);
+
+// Test parser and semantic recovery.
+template<int Value> struct count_ints_2 {
+ static const unsigned value = sizeof...(Value); // expected-error{{'Value' does not refer to the name of a parameter pack}}
+};
+
+template<typename ...Types> // expected-note{{parameter pack 'Types' declared here}}
+struct count_types_2 {
+ static const unsigned value = sizeof... Type; // expected-error{{missing parentheses around the size of parameter pack 'Type'}} \
+ // expected-error{{Type' does not refer to the name of a parameter pack; did you mean 'Types'?}}
+};
+
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
new file mode 100644
index 000000000000..6aec3a2781ef
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
@@ -0,0 +1,26 @@
+// 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
+
+struct D {
+ ~D() throw();
+};
+struct E {
+ ~E() throw();
+};
+
+void test() {
+ bool b;
+ // CHECK: store i8 1
+ b = noexcept(0);
+ // CHECK: store i8 0
+ b = noexcept(throw 0);
+ b = f1();
+ b = f2();
+
+ // CHECK-NOT: call void @_ZN1ED1Ev
+ // CHECK: call void @_ZN1DD1Ev
+ D(), noexcept(E());
+}
+// CHECK: ret i1 true
+// CHECK: ret i1 false
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
new file mode 100644
index 000000000000..98c6f4e09f51
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
@@ -0,0 +1,172 @@
+// RUN: %clang_cc1 -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")
+#define B(b, e) static_assert(b == noexcept(e), "expectation failed")
+
+void simple() {
+ P(0);
+ P(0 + 0);
+ int i;
+ P(i);
+ P(sizeof(0));
+ P(static_cast<int>(0));
+ N(throw 0);
+ N((throw 0, 0));
+}
+
+void nospec();
+void allspec() throw(...);
+void intspec() throw(int);
+void emptyspec() throw();
+void nothrowattr() __attribute__((nothrow));
+
+void call() {
+ N(nospec());
+ N(allspec());
+ N(intspec());
+ P(emptyspec());
+ P(nothrowattr());
+}
+
+void (*pnospec)();
+void (*pallspec)() throw(...);
+void (*pintspec)() throw(int);
+void (*pemptyspec)() throw();
+
+void callptr() {
+ N(pnospec());
+ N((*pnospec)());
+ N(pallspec());
+ N((*pallspec)());
+ N(pintspec());
+ N((*pintspec)());
+ P(pemptyspec());
+ P((*pemptyspec)());
+}
+
+struct S1 {
+ void nospec();
+ void allspec() throw(...);
+ void intspec() throw(int);
+ void emptyspec() throw();
+};
+
+void callmem() {
+ S1 s;
+ N(s.nospec());
+ N(s.allspec());
+ N(s.intspec());
+ P(s.emptyspec());
+}
+
+void (S1::*mpnospec)();
+void (S1::*mpallspec)() throw(...);
+void (S1::*mpintspec)() throw(int);
+void (S1::*mpemptyspec)() throw();
+
+void callmemptr() {
+ S1 s;
+ N((s.*mpnospec)());
+ N((s.*mpallspec)());
+ N((s.*mpintspec)());
+ P((s.*mpemptyspec)());
+}
+
+struct S2 {
+ S2();
+ S2(int, int) throw();
+ void operator +();
+ void operator -() throw();
+ void operator +(int);
+ void operator -(int) throw();
+ operator int();
+ operator float() throw();
+};
+
+void *operator new(__typeof__(sizeof(int)) sz, int) throw();
+
+struct Bad1 {
+ ~Bad1() throw(int);
+};
+struct Bad2 {
+ void operator delete(void*) throw(int);
+};
+
+void implicits() {
+ N(new int);
+ P(new (0) int);
+ P(delete (int*)0);
+ N(delete (Bad1*)0);
+ N(delete (Bad2*)0);
+ N(S2());
+ P(S2(0, 0));
+ S2 s;
+ N(+s);
+ P(-s);
+ N(s + 0);
+ P(s - 0);
+ N(static_cast<int>(s));
+ P(static_cast<float>(s));
+ N(Bad1());
+}
+
+struct V {
+ virtual ~V() throw();
+};
+struct D : V {};
+
+void dyncast() {
+ V *pv = 0;
+ D *pd = 0;
+ P(dynamic_cast<V&>(*pd));
+ P(dynamic_cast<V*>(pd));
+ N(dynamic_cast<D&>(*pv));
+ P(dynamic_cast<D*>(pv));
+}
+
+namespace std {
+ struct type_info {};
+}
+
+void idtype() {
+ P(typeid(V));
+ P(typeid((V*)0));
+ P(typeid(*(S1*)0));
+ N(typeid(*(V*)0));
+}
+
+void uneval() {
+ P(sizeof(typeid(*(V*)0)));
+ P(typeid(typeid(*(V*)0)));
+}
+
+struct G1 {};
+struct G2 { int i; };
+struct G3 { S2 s; };
+
+void gencon() {
+ P(G1());
+ P(G2());
+ N(G3());
+}
+
+template <typename T, bool b>
+void late() {
+ B(b, typeid(*(T*)0));
+ B(b, T(1));
+ B(b, static_cast<T>(S2(0, 0)));
+ B(b, S1() + T());
+}
+struct S3 {
+ virtual ~S3() throw();
+ S3() throw();
+ explicit S3(int);
+ S3(const S2&);
+};
+void operator +(const S1&, float) throw();
+void operator +(const S1&, const S3&);
+void tlate() {
+ late<float, true>();
+ late<S3, false>();
+}
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h b/test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h
new file mode 100644
index 000000000000..e6e7b795d25a
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h
@@ -0,0 +1,8 @@
+// Serialization testing helper for noexcept, included by cg.cpp.
+
+inline bool f1() {
+ return noexcept(0);
+}
+inline bool f2() {
+ return noexcept(throw 0);
+}
diff --git a/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp b/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp
index 170c734fd307..06cc61074026 100644
--- a/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.op/p4.cpp
@@ -7,8 +7,7 @@ namespace test0 {
template<typename T> void g(T);
void test() {
- // FIXME: this diagnostic is terrible
- foo(&g<int>); // expected-error {{cannot initialize a parameter of type 'void (test0::A::*)(int)' with an rvalue of type '<overloaded function type>'}}
+ foo(&g<int>); // expected-error {{can't form member pointer of type 'void (test0::A::*)(int)' without '&' and class name}}
}
};
}
@@ -39,7 +38,6 @@ namespace test2 {
};
void A::test() {
- // FIXME: This diagnostic is terrible.
- int (A::*ptr)(int) = &(A::foo); // expected-error {{cannot initialize a variable of type 'int (test2::A::*)(int)' with an rvalue of type '<overloaded function type>'}}
+ int (A::*ptr)(int) = &(A::foo); // expected-error {{can't form member pointer of type 'int (test2::A::*)(int)' without '&' and class name}}
}
}
diff --git a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
new file mode 100644
index 000000000000..543a86d4e351
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// -- prvalue of arithmetic
+
+bool b = !0;
+
+bool b2 = !1.2;
+
+bool b3 = !4;
+
+// -- unscoped enumeration
+enum { E, F };
+
+bool b4 = !E;
+bool b5 = !F;
+
+// -- pointer,
+bool b6 = !&b4;
+void f();
+bool b61 = !&f;
+
+// -- or pointer to member type can be converted to a prvalue of type bool.
+struct S { void f() { } };
+
+bool b7 = !&S::f;
+
+
+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}}
+
+}
diff --git a/test/CXX/over/over.built/p1.cpp b/test/CXX/over/over.built/p1.cpp
new file mode 100644
index 000000000000..6000f5b01ca4
--- /dev/null
+++ b/test/CXX/over/over.built/p1.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+enum E1 { one };
+enum E2 { two };
+
+bool operator >= (E1, E1) {
+ return false;
+}
+
+bool operator >= (E1, const E2) {
+ return false;
+}
+
+bool test(E1 a, E1 b, E2 c) {
+ return a >= b || a >= c;
+}
diff --git a/test/CXX/over/over.built/p25.cpp b/test/CXX/over/over.built/p25.cpp
new file mode 100644
index 000000000000..c185fb4fb96d
--- /dev/null
+++ b/test/CXX/over/over.built/p25.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+enum class Color { Red, Green, Blue };
+
+struct ConvertsToColorA {
+ operator Color();
+};
+
+struct ConvertsToColorB {
+ operator Color();
+};
+
+Color foo(bool cond, ConvertsToColorA ca, ConvertsToColorB cb) {
+ return cond? ca : cb;
+}
diff --git a/test/CXX/over/over.load/p2-0x.cpp b/test/CXX/over/over.load/p2-0x.cpp
new file mode 100644
index 000000000000..f0ace9044a2d
--- /dev/null
+++ b/test/CXX/over/over.load/p2-0x.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Member function declarations with the same name and the same
+// parameter-type-list as well as mem- ber function template
+// declarations with the same name, the same parameter-type-list, and
+// the same template parameter lists cannot be overloaded if any of
+// them, but not all, have a ref-qualifier (8.3.5).
+
+class Y {
+ void h() &;
+ void h() const &;
+ void h() &&;
+ void i() &; // expected-note{{previous declaration}}
+ void i() const; // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}}
+
+ template<typename T> void f(T*) &;
+ template<typename T> void f(T*) &&;
+
+ template<typename T> void g(T*) &; // expected-note{{previous declaration}}
+ template<typename T> void g(T*); // expected-error{{cannot overload a member function without a ref-qualifier with a member function with ref-qualifier '&'}}
+
+ void k(); // expected-note{{previous declaration}}
+ void k() &&; // expected-error{{cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier}}
+};
diff --git a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
new file mode 100644
index 000000000000..ab171bc3f6f4
--- /dev/null
+++ b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+namespace std_example {
+ int i;
+ int f1();
+ int&& f2();
+ int &g(const int &);
+ float &g(const int &&);
+ int &j = g(i);
+ float &k = g(f1());
+ float &l = g(f2());
+
+ int &g2(const int &);
+ float &g2(int &&);
+ int &j2 = g2(i);
+ float &k2 = g2(f1());
+ float &l2 = g2(f2());
+
+ // FIXME: We don't support ref-qualifiers yet.
+#if 0
+ struct A {
+ A& operator<<(int);
+ void p() &;
+ void p() &&;
+ };
+
+ A& operator<<(A&&, char);
+ A() << 1;
+ A() << 'c';
+ A a;
+ a << 1;
+ a << 'c';
+ A().p();
+ a.p();
+#endif
+}
+
+template<typename T>
+struct remove_reference {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_reference<T&> {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_reference<T&&> {
+ typedef T type;
+};
+
+namespace FunctionReferencesOverloading {
+ template<typename T> int &f(typename remove_reference<T>::type&);
+ template<typename T> float &f(typename remove_reference<T>::type&&);
+
+ void test_f(int (&func_ref)(int)) {
+ int &ir = f<int (&)(int)>(func_ref);
+ }
+}
diff --git a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp
new file mode 100644
index 000000000000..8ccc5b6204d0
--- /dev/null
+++ b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T> T &lvalue();
+template<typename T> T &&xvalue();
+template<typename T> T prvalue();
+
+struct X0 {
+ int &f() &;
+ float &f() &&;
+
+ template<typename T> int &ft(T) &;
+ template<typename T> float &ft(T) &&;
+
+ typedef int &(*func_int_ref)();
+ typedef float &(*func_float_ref)();
+
+ operator func_int_ref() &;
+ operator func_float_ref() &&;
+
+ void g();
+
+ int &operator+(const X0&) &;
+ float &operator+(const X0&) &&;
+
+ template<typename T> int &operator+(const T&) &;
+ template<typename T> float &operator+(const T&) &&;
+
+ int &h() const&;
+ float &h() &&;
+ int &h2() const&;
+ float &h2() const&&;
+};
+
+void X0::g() {
+ int &ir1 = f();
+ int &ir2 = X0::f();
+}
+
+void test_ref_qualifier_binding() {
+ int &ir1 = lvalue<X0>().f();
+ float &fr1 = xvalue<X0>().f();
+ float &fr2 = prvalue<X0>().f();
+ int &ir2 = lvalue<X0>().ft(1);
+ float &fr3 = xvalue<X0>().ft(2);
+ float &fr4 = prvalue<X0>().ft(3);
+}
+
+void test_ref_qualifier_binding_with_surrogates() {
+ int &ir1 = lvalue<X0>()();
+ float &fr1 = xvalue<X0>()();
+ float &fr2 = prvalue<X0>()();
+}
+
+void test_ref_qualifier_binding_operators() {
+ int &ir1 = lvalue<X0>() + prvalue<X0>();
+ float &fr1 = xvalue<X0>() + prvalue<X0>();
+ float &fr2 = prvalue<X0>() + prvalue<X0>();
+ int &ir2 = lvalue<X0>() + 1;
+ float &fr3 = xvalue<X0>() + 2;
+ float &fr4 = prvalue<X0>() + 3;
+}
+
+void test_ref_qualifier_overloading() {
+ int &ir1 = lvalue<X0>().h();
+ float &fr1 = xvalue<X0>().h();
+ float &fr2 = prvalue<X0>().h();
+ int &ir2 = lvalue<X0>().h2();
+ float &fr3 = xvalue<X0>().h2();
+ float &fr4 = prvalue<X0>().h2();
+}
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
new file mode 100644
index 000000000000..f38a74e6e495
--- /dev/null
+++ b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
@@ -0,0 +1,95 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t;
+
+namespace DontResolveTooEarly_WaitForOverloadResolution
+{
+ template <class T> T* f(int); // #1
+ template <class T, class U> T& f(U); // #2
+
+ void g() {
+ int *ip = f<int>(1); // calls #1
+ }
+
+ template <class T>
+ T* f2(int);
+ template <class T, class U>
+ T& f2(U);
+
+ void g2() {
+ int*ip = (f2<int>)(1); // ok
+ }
+
+} // End namespace
+
+ template<typename T>
+ void twoT() { }
+ template<typename T, typename U>
+ void twoT(T) { }
+
+
+ void two() { }; //expected-note 5{{candidate}}
+ void two(int) { }; //expected-note 5{{candidate}}
+
+
+
+ void one() { }
+ template<class T>
+ void oneT() { }
+
+ template<class T>
+ void cant_resolve() { } //expected-note 3{{candidate}}
+
+ template<class T> void cant_resolve(T) { }//expected-note 3{{candidate}}
+
+
+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>(twoT<int>); }
+ { (void)(twoT<int>); }
+
+
+ { ptrdiff_t x = reinterpret_cast<ptrdiff_t>(oneT<int>); }
+ { (void) reinterpret_cast<int (*)(char, double)>(oneT<int>); }
+ { (void) reinterpret_cast<ptrdiff_t>(one); }
+ { (void) reinterpret_cast<int (*)(char, double)>(one); }
+
+ { ptrdiff_t x = reinterpret_cast<ptrdiff_t>(twoT<int>); }
+ { (void) reinterpret_cast<int (*)(char, double)>(twoT<int>); }
+ { (void) reinterpret_cast<void (*)(int)>(two); } //expected-error {{reinterpret_cast}}
+ { (void) static_cast<void (*)(int)>(two); } //ok
+
+ { (void) reinterpret_cast<int>(two); } //expected-error {{reinterpret_cast}}
+ { (void) reinterpret_cast<int (*)(char, double)>(two); } //expected-error {{reinterpret_cast}}
+
+ { bool b = (twoT<int>); } // ok
+ { bool b = (twoT<int, int>); } //ok
+
+ { bool b = &twoT<int>; //&foo<int>; }
+ b = &(twoT<int>); }
+
+ { ptrdiff_t x = (ptrdiff_t) &twoT<int>;
+ x = (ptrdiff_t) &twoT<int>; }
+
+ { ptrdiff_t x = (ptrdiff_t) twoT<int>;
+ x = (ptrdiff_t) twoT<int>; }
+
+
+ { ptrdiff_t x = (ptrdiff_t) &twoT<int,int>;
+ x = (ptrdiff_t) &twoT<int>; }
+
+ { oneT<int>; &oneT<int>; } //expected-warning 2{{ expression result unused }}
+ { static_cast<void>(cant_resolve<int>); } // expected-error {{address of overload}}
+ { bool b = cant_resolve<int>; } // expected-error {{address of overload}}
+ { (void) cant_resolve<int>; } // expected-error {{address of overload}}
+
+}
+
+
diff --git a/test/CXX/over/over.over/p2.cpp b/test/CXX/over/over.over/p2.cpp
index e8840d205e87..3e8d0f1d8cdd 100644
--- a/test/CXX/over/over.over/p2.cpp
+++ b/test/CXX/over/over.over/p2.cpp
@@ -1,10 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<typename T> T f0(T, T);
+template<typename T> T f0(T, T); //expected-note{{candidate}}
void test_f0() {
int (*f0a)(int, int) = f0;
int (*f0b)(int, int) = &f0;
- int (*f0c)(int, float) = f0; // expected-error{{cannot initialize}}
- // FIXME: poor error message above!
+ int (*f0c)(int, float) = f0; // expected-error{{address of overloaded function 'f0' does not match required type 'int (int, float)'}}
}
diff --git a/test/CXX/over/over.over/p4.cpp b/test/CXX/over/over.over/p4.cpp
index 4189218f6521..27d070eff209 100644
--- a/test/CXX/over/over.over/p4.cpp
+++ b/test/CXX/over/over.over/p4.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<typename T> T f0(T);
+template<typename T> T f0(T); // expected-note{{candidate function}}
int f0(int); // expected-note{{candidate function}}
void test_f0() {
@@ -13,11 +13,8 @@ namespace N {
int f0(int); // expected-note{{candidate function}}
}
-int f0(int);
-
void test_f0_2() {
using namespace N;
- int (*fp0)(int) = f0; // expected-error{{ambiguous}} \
- // expected-error{{cannot initialize}}
+ int (*fp0)(int) = f0; // expected-error{{address of overloaded function 'f0' is ambiguous}}
float (*fp1)(float) = f0;
}
diff --git a/test/CXX/special/class.copy/p33-0x.cpp b/test/CXX/special/class.copy/p33-0x.cpp
new file mode 100644
index 000000000000..262809e35cb1
--- /dev/null
+++ b/test/CXX/special/class.copy/p33-0x.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fexceptions -std=c++0x -fsyntax-only -verify %s
+class X {
+ X(const X&);
+
+public:
+ X();
+ X(X&&);
+};
+
+X return_by_move(int i, X x) {
+ X x2;
+ if (i == 0)
+ return x;
+ else if (i == 1)
+ return x2;
+ else
+ return x;
+}
+
+void throw_move_only(X x) {
+ X x2;
+ throw x;
+ throw x2;
+}
+
diff --git a/test/CXX/special/class.copy/p9.cpp b/test/CXX/special/class.copy/p9.cpp
index d03794420e01..77ab19e21069 100644
--- a/test/CXX/special/class.copy/p9.cpp
+++ b/test/CXX/special/class.copy/p9.cpp
@@ -15,30 +15,30 @@ struct VirtualInheritsNonConstCopy : virtual NonConstCopy {
VirtualInheritsNonConstCopy(const VirtualInheritsNonConstCopy&);
};
-struct ImplicitNonConstCopy1 : NonConstCopy {
- ImplicitNonConstCopy1();
+struct ImplicitNonConstCopy1 : NonConstCopy { // expected-note {{candidate constructor}}
+ ImplicitNonConstCopy1(); // expected-note {{candidate constructor}}
};
-struct ImplicitNonConstCopy2 {
- ImplicitNonConstCopy2();
+struct ImplicitNonConstCopy2 { // expected-note {{candidate constructor}}
+ ImplicitNonConstCopy2(); // expected-note {{candidate constructor}}
NonConstCopy ncc;
};
-struct ImplicitNonConstCopy3 {
- ImplicitNonConstCopy3();
+struct ImplicitNonConstCopy3 { // expected-note {{candidate constructor}}
+ ImplicitNonConstCopy3(); // expected-note {{candidate constructor}}
NonConstCopy ncc_array[2][3];
};
-struct ImplicitNonConstCopy4 : VirtualInheritsNonConstCopy {
- ImplicitNonConstCopy4();
+struct ImplicitNonConstCopy4 : VirtualInheritsNonConstCopy { // expected-note {{candidate constructor}}
+ ImplicitNonConstCopy4(); // expected-note {{candidate constructor}}
};
void test_non_const_copy(const ImplicitNonConstCopy1 &cincc1,
const ImplicitNonConstCopy2 &cincc2,
const ImplicitNonConstCopy3 &cincc3,
const ImplicitNonConstCopy4 &cincc4) {
- (void)sizeof(ImplicitNonConstCopy1(cincc1)); // expected-error{{functional-style cast from 'ImplicitNonConstCopy1 const' to 'ImplicitNonConstCopy1' is not allowed}}
- (void)sizeof(ImplicitNonConstCopy2(cincc2)); // expected-error{{functional-style cast from 'ImplicitNonConstCopy2 const' to 'ImplicitNonConstCopy2' is not allowed}}
- (void)sizeof(ImplicitNonConstCopy3(cincc3)); // expected-error{{functional-style cast from 'ImplicitNonConstCopy3 const' to 'ImplicitNonConstCopy3' is not allowed}}
- (void)sizeof(ImplicitNonConstCopy4(cincc4)); // expected-error{{functional-style cast from 'ImplicitNonConstCopy4 const' to 'ImplicitNonConstCopy4' is not allowed}}
+ (void)sizeof(ImplicitNonConstCopy1(cincc1)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy1' to 'ImplicitNonConstCopy1'}}
+ (void)sizeof(ImplicitNonConstCopy2(cincc2)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy2' to 'ImplicitNonConstCopy2'}}
+ (void)sizeof(ImplicitNonConstCopy3(cincc3)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy3' to 'ImplicitNonConstCopy3'}}
+ (void)sizeof(ImplicitNonConstCopy4(cincc4)); // expected-error{{no matching conversion for functional-style cast from 'const ImplicitNonConstCopy4' to 'ImplicitNonConstCopy4'}}
}
diff --git a/test/CXX/special/class.ctor/p4-0x.cpp b/test/CXX/special/class.ctor/p4-0x.cpp
new file mode 100644
index 000000000000..e3508e2e8c47
--- /dev/null
+++ b/test/CXX/special/class.ctor/p4-0x.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// A constructor shall not be declared with a ref-qualifier.
+struct X {
+ X() &; // expected-error{{ref-qualifier '&' is not allowed on a constructor}}
+ X(int) &&; // expected-error{{ref-qualifier '&&' is not allowed on a constructor}}
+};
diff --git a/test/CXX/special/class.dtor/p2-0x.cpp b/test/CXX/special/class.dtor/p2-0x.cpp
new file mode 100644
index 000000000000..53a2e033efc1
--- /dev/null
+++ b/test/CXX/special/class.dtor/p2-0x.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// A destructor shall not be declared with a ref-qualifier.
+struct X {
+ ~X() &; // expected-error{{ref-qualifier '&' is not allowed on a destructor}}
+};
+
+struct Y {
+ ~Y() &&; // expected-error{{ref-qualifier '&&' is not allowed on a destructor}}
+};
diff --git a/test/CXX/special/class.inhctor/elsewhere.cpp b/test/CXX/special/class.inhctor/elsewhere.cpp
new file mode 100644
index 000000000000..82944d65dfd1
--- /dev/null
+++ b/test/CXX/special/class.inhctor/elsewhere.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Tests related to constructor inheriting, but not specified in [class.inhctor]
+
+// [namespace.udecl]p8:
+// A using-declaration for a class member shall be a member-declaration.
+
+struct B1 {
+ B1(int);
+};
+
+using B1::B1; // expected-error {{using declaration can not refer to class member}}
+
+// C++0x [namespace.udecl]p10:
+// A using-declaration is a declaration and can therefore be used repeatedly
+// where (and only where) multiple declarations are allowed.
+
+struct I1 : B1 {
+ using B1::B1; // expected-note {{previous using declaration}}
+ using B1::B1; // expected-error {{redeclaration of using decl}}
+};
+
+// C++0x [namespace.udecl]p3:
+// In a using declaration used as a member-declaration, the nested-name-
+// specifier shall name a base class of the class being defined.
+// If such a using-declaration names a constructor, the nested-name-specifier
+// shall name a direct base class of the class being defined.
+
+struct D1 : I1 {
+ using B1::B1; // expected-error {{'B1' is not a direct base of 'D1', can not inherit constructors}}
+};
diff --git a/test/CXX/special/class.inhctor/p3.cpp b/test/CXX/special/class.inhctor/p3.cpp
new file mode 100644
index 000000000000..021f701ab495
--- /dev/null
+++ b/test/CXX/special/class.inhctor/p3.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+struct B1 {
+ B1(int);
+ B1(int, int);
+};
+struct D1 : B1 {
+ using B1::B1;
+};
+D1 d1a(1), d1b(1, 1);
+
+D1 fd1() { return 1; }
+
+struct B2 {
+ explicit B2(int, int = 0, int = 0);
+};
+struct D2 : B2 { // expected-note {{candidate constructor}}
+ using B2::B2;
+};
+D2 d2a(1), d2b(1, 1), d2c(1, 1, 1);
+
+D2 fd2() { return 1; } // expected-error {{no viable conversion}}
+
+struct B3 {
+ B3(void*); // expected-note {{inherited from here}}
+};
+struct D3 : B3 { // expected-note {{candidate constructor}}
+ using B3::B3; // expected-note {{candidate constructor (inherited)}}
+};
+D3 fd3() { return 1; } // expected-error {{no viable conversion}}
diff --git a/test/CXX/special/class.inhctor/p7.cpp b/test/CXX/special/class.inhctor/p7.cpp
new file mode 100644
index 000000000000..3ad761f08baa
--- /dev/null
+++ b/test/CXX/special/class.inhctor/p7.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Straight from the standard
+struct B1 {
+ B1(int); // expected-note {{previous constructor}}
+};
+struct B2 {
+ B2(int); // expected-note {{conflicting constructor}}
+};
+struct D1 : B1, B2 {
+ using B1::B1; // expected-note {{inherited here}}
+ using B2::B2; // expected-error {{already inherited constructor with the same signature}}
+};
+struct D2 : B1, B2 {
+ using B1::B1;
+ using B2::B2;
+ D2(int);
+};
diff --git a/test/CXX/stmt.stmt/stmt.label/p1.cpp b/test/CXX/stmt.stmt/stmt.label/p1.cpp
new file mode 100644
index 000000000000..90367f829566
--- /dev/null
+++ b/test/CXX/stmt.stmt/stmt.label/p1.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f()
+{
+ int x = 0;
+ goto label1;
+
+label1: // expected-note{{previous definition is here}}
+ x = 1;
+ goto label2; // expected-error{{use of undeclared label 'label2'}}
+
+label1: // expected-error{{redefinition of label 'label1'}}
+ x = 2;
+}
+
+void h()
+{
+ int x = 0;
+ switch (x)
+ {
+ case 1:;
+ default:; // expected-error{{multiple default labels in one switch}}
+ default:; // expected-note{{previous case defined here}}
+ }
+}
diff --git a/test/CXX/stmt.stmt/stmt.select/p3.cpp b/test/CXX/stmt.stmt/stmt.select/p3.cpp
index 31de685ed35f..35e5c919fb6c 100644
--- a/test/CXX/stmt.stmt/stmt.select/p3.cpp
+++ b/test/CXX/stmt.stmt/stmt.select/p3.cpp
@@ -16,4 +16,4 @@ void h() {
int x; // expected-error{{redefinition of 'x'}}
else
int x; // expected-error{{redefinition of 'x'}}
-} \ No newline at end of file
+}
diff --git a/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp b/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
index b0f1c46a5226..9b9b532ff134 100644
--- a/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
+++ b/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
@@ -53,7 +53,7 @@ namespace pointer_to_object_parameters {
A2<X_ptr> *a12; // expected-error{{must have its address taken}}
A2<array_of_Xs> *a13;
A2<&an_X> *a13_2;
- A2<(&an_X)> *a13_3; // expected-error{{non-type template argument cannot be surrounded by parentheses}}
+ A2<(&an_X)> *a13_3; // expected-warning{{address non-type template argument cannot be surrounded by parentheses}}
// PR6244
struct X1 {} X1v;
@@ -88,19 +88,19 @@ namespace reference_parameters {
extern const volatile int cvi;
void test() {
S0<i> s0;
- S0<ci> s0c; // expected-error{{reference binding of non-type template parameter of type 'int &' to template argument of type 'int const' ignores qualifiers}}
- S0<vi> s0v; // expected-error{{reference binding of non-type template parameter of type 'int &' to template argument of type 'int volatile' ignores qualifiers}}
- S0<cvi> s0cv; // expected-error{{reference binding of non-type template parameter of type 'int &' to template argument of type 'int const volatile' ignores qualifiers}}
+ S0<ci> s0c; // expected-error{{reference binding of non-type template parameter of type 'int &' to template argument of type 'const int' ignores qualifiers}}
+ S0<vi> s0v; // expected-error{{reference binding of non-type template parameter of type 'int &' to template argument of type 'volatile int' ignores qualifiers}}
+ S0<cvi> s0cv; // expected-error{{reference binding of non-type template parameter of type 'int &' to template argument of type 'const volatile int' ignores qualifiers}}
S1<i> s1;
S1<ci> s1c;
- S1<vi> s1v; // expected-error{{reference binding of non-type template parameter of type 'int const &' to template argument of type 'int volatile' ignores qualifiers}}
- S1<cvi> s1cv; // expected-error{{reference binding of non-type template parameter of type 'int const &' to template argument of type 'int const volatile' ignores qualifiers}}
+ S1<vi> s1v; // expected-error{{reference binding of non-type template parameter of type 'const int &' to template argument of type 'volatile int' ignores qualifiers}}
+ S1<cvi> s1cv; // expected-error{{reference binding of non-type template parameter of type 'const int &' to template argument of type 'const volatile int' ignores qualifiers}}
S2<i> s2;
- S2<ci> s2c; // expected-error{{reference binding of non-type template parameter of type 'int volatile &' to template argument of type 'int const' ignores qualifiers}}
+ S2<ci> s2c; // expected-error{{reference binding of non-type template parameter of type 'volatile int &' to template argument of type 'const int' ignores qualifiers}}
S2<vi> s2v;
- S2<cvi> s2cv; // expected-error{{reference binding of non-type template parameter of type 'int volatile &' to template argument of type 'int const volatile' ignores qualifiers}}
+ S2<cvi> s2cv; // expected-error{{reference binding of non-type template parameter of type 'volatile int &' to template argument of type 'const volatile int' ignores qualifiers}}
S3<i> s3;
S3<ci> s3c;
diff --git a/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp b/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
new file mode 100644
index 000000000000..794a0502582b
--- /dev/null
+++ b/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template <class T> struct eval; // expected-note 3{{template is declared here}}
+
+template <template <class, class...> class TT, class T1, class... Rest>
+struct eval<TT<T1, Rest...>> { };
+
+template <class T1> struct A;
+template <class T1, class T2> struct B;
+template <int N> struct C;
+template <class T1, int N> struct D;
+template <class T1, class T2, int N = 17> struct E;
+
+eval<A<int>> eA;
+eval<B<int, float>> eB;
+eval<C<17>> eC; // expected-error{{implicit instantiation of undefined template 'eval<C<17> >'}}
+eval<D<int, 17>> eD; // expected-error{{implicit instantiation of undefined template 'eval<D<int, 17> >'}}
+eval<E<int, float>> eE; // expected-error{{implicit instantiation of undefined template 'eval<E<int, float, 17> >}}
+
+template<template <int ...N> class TT> struct X0 { }; // expected-note{{previous non-type template parameter with type 'int' is here}}
+template<int I, int J, int ...Rest> struct X0a;
+template<int ...Rest> struct X0b;
+template<int I, long J> struct X0c; // expected-note{{template non-type parameter has a different type 'long' in template argument}}
+
+X0<X0a> inst_x0a;
+X0<X0b> inst_x0b;
+X0<X0c> inst_x0c; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
+
+template<typename T,
+ template <T ...N> class TT> // expected-note{{previous non-type template parameter with type 'short' is here}}
+struct X1 { };
+template<int I, int J, int ...Rest> struct X1a;
+template<long I, long ...Rest> struct X1b;
+template<short I, short J> struct X1c;
+template<short I, long J> struct X1d; // expected-note{{template non-type parameter has a different type 'long' in template argument}}
+
+X1<int, X1a> inst_x1a;
+X1<long, X1b> inst_x1b;
+X1<short, X1c> inst_x1c;
+X1<short, X1d> inst_x1d; // expected-error{{template template argument has different template parameters than its corresponding template template paramete}}
diff --git a/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp b/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp
new file mode 100644
index 000000000000..0fd9a7e884b9
--- /dev/null
+++ b/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<class T> struct A {
+ static T t; // expected-error{{static data member instantiated with function type 'int ()'}}
+};
+typedef int function();
+A<function> a; // expected-note{{instantiation of}}
+
+template<typename T> struct B {
+ B() { T t; } // expected-error{{variable instantiated with function type 'int ()'}}
+};
+B<function> b; // expected-note{{instantiation of}}
+
+template <typename T> int f0(void *, const T&); // expected-note{{candidate template ignored: substitution failure}}
+enum {e}; // expected-note{{unnamed type used in template argument was declared here}}
+
+void test_f0(int n) {
+ int i = f0(0, e); // expected-warning{{template argument uses unnamed type}}
+ int vla[n];
+ f0(0, vla); // expected-error{{no matching function for call to 'f0'}}
+}
+
+namespace N0 {
+ template <typename R, typename A1> void f0(R (*)(A1));
+ template <typename T> int f1(T);
+ template <typename T, typename U> int f1(T, U);
+ enum {e1}; // expected-note 2{{unnamed type used in template argument was declared here}}
+ enum {e2}; // expected-note 2{{unnamed type used in template argument was declared here}}
+ enum {e3}; // expected-note{{unnamed type used in template argument was declared here}}
+
+ template<typename T> struct X;
+ template<typename T> struct X<T*> { };
+
+ void f() {
+ f0( // expected-warning{{template argument uses unnamed type}}
+ &f1<__typeof__(e1)>); // expected-warning{{template argument uses unnamed type}}
+ int (*fp1)(int, __typeof__(e2)) = f1; // expected-warning{{template argument uses unnamed type}}
+ f1(e2); // expected-warning{{template argument uses unnamed type}}
+ f1(e2);
+
+ X<__typeof__(e3)*> x; // expected-warning{{template argument uses unnamed type}}
+ }
+}
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
index a93249e2268d..d0fc797f5002 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp
@@ -53,3 +53,24 @@ struct X0<float>::Inner0<Z*> {
int array3[X0<float>::Inner0<int>::value == 0? 1 : -1];
int array4[X0<float>::Inner0<int*>::value == 3? 1 : -1];
int array5[X0<float>::Inner0<const int*>::value == 2? 1 : -1];
+
+namespace rdar8651930 {
+ template<typename OuterT>
+ struct Outer {
+ template<typename T, typename U>
+ struct Inner;
+
+ template<typename T>
+ struct Inner<T, T> {
+ static const bool value = true;
+ };
+
+ template<typename T, typename U>
+ struct Inner {
+ static const bool value = false;
+ };
+ };
+
+ int array0[Outer<int>::Inner<int, int>::value? 1 : -1];
+ int array1[Outer<int>::Inner<int, float>::value? -1 : 1];
+}
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
new file mode 100644
index 000000000000..14152cf339a8
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<int ...Values> struct X1;
+
+template<int ...Values>
+struct X1<0, Values+1 ...>; // expected-error{{non-type template argument depends on a template parameter of the partial specialization}}
+
+
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp
new file mode 100644
index 000000000000..d8e07b83e1be
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// -- The argument list of the specialization shall not be identical
+// to the implicit argument list of the primary template.
+
+template<typename T, typename ...Types>
+struct X1;
+
+template<typename T, typename ...Types>
+struct X1<T, Types...> // expected-error{{class template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
+{ };
+
+
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp
new file mode 100644
index 000000000000..2a3e9142169c
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p9.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR8905
+template<char C1, char C2>
+struct X {
+ static const bool value = 0;
+};
+
+template<int C1>
+struct X<C1, C1> {
+ static const bool value = 1;
+};
+
+int check0[X<1, 2>::value == 0? 1 : -1];
+int check1[X<1, 1>::value == 1? 1 : -1];
+
+template<int, int, int> struct int_values {
+ static const unsigned value = 0;
+};
+
+template<unsigned char C1, unsigned char C3>
+struct int_values<C1, 12, C3> {
+ static const unsigned value = 1;
+};
+
+int check2[int_values<256, 12, 3>::value == 0? 1 : -1];
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
new file mode 100644
index 000000000000..11ec28918e42
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+// Core DR 532.
+namespace PR8130 {
+ struct A { };
+
+ template<class T> struct B {
+ template<class R> int &operator*(R&);
+ };
+
+ template<class T, class R> float &operator*(T&, R&);
+ void test() {
+ A a;
+ B<A> b;
+ int &ir = b * a;
+ }
+}
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp
new file mode 100644
index 000000000000..2ffdd9579ecd
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace DeduceVsMember {
+ template<typename T>
+ struct X {
+ template<typename U>
+ int &operator==(const U& other) const;
+ };
+
+ template<typename T, typename U>
+ float &operator==(const T&, const X<U>&);
+
+ void test(X<int> xi, X<float> xf) {
+ float& ir = (xi == xf);
+ }
+}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
index 073b2a146354..578de2952d94 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
@@ -293,3 +293,42 @@ namespace test13 {
template class Foo<0>;
}
+
+namespace test14 {
+ template <class T> class B;
+ template <class T> class A {
+ friend void B<T>::foo();
+ static void foo(); // expected-note {{declared private here}}
+ };
+
+ template <class T> class B {
+ void foo() { return A<long>::foo(); } // expected-error {{'foo' is a private member of 'test14::A<long>'}}
+ };
+
+ template class B<int>; // expected-note {{in instantiation}}
+}
+
+namespace test15 {
+ template <class T> class B;
+ template <class T> class A {
+ friend void B<T>::foo();
+
+ // This shouldn't be misrecognized as a templated-scoped reference.
+ template <class U> friend void B<T>::bar(U);
+
+ static void foo(); // expected-note {{declared private here}}
+ };
+
+ template <class T> class B {
+ void foo() { return A<long>::foo(); } // expected-error {{'foo' is a private member of 'test15::A<long>'}}
+ };
+
+ template <> class B<float> {
+ void foo() { return A<float>::foo(); }
+ template <class U> void bar(U u) {
+ (void) A<float>::foo();
+ }
+ };
+
+ template class B<int>; // expected-note {{in instantiation}}
+}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p5.cpp b/test/CXX/temp/temp.decls/temp.friend/p5.cpp
index f23611bd505e..63fd3df26900 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p5.cpp
@@ -1,13 +1,103 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-template <class T> class A {
- class Member {
+namespace test0 {
+ template <class T> class A {
+ class Member {};
};
-};
-class B {
- template <class T> friend class A<T>::Member;
-};
+ class B {
+ template <class T> friend class A<T>::Member;
+ };
+
+ A<int> a;
+ B b;
+}
+
+// rdar://problem/8204127
+namespace test1 {
+ template <class T> struct A;
+
+ class C {
+ static void foo();
+ template <class T> friend void A<T>::f();
+ };
+
+ template <class T> struct A {
+ void f() { C::foo(); }
+ };
+
+ template <class T> struct A<T*> {
+ void f() { C::foo(); }
+ };
+
+ template <> struct A<char> {
+ void f() { C::foo(); }
+ };
+}
+
+// FIXME: these should fail!
+namespace test2 {
+ template <class T> struct A;
+
+ class C {
+ static void foo();
+ template <class T> friend void A<T>::g();
+ };
+
+ template <class T> struct A {
+ void f() { C::foo(); }
+ };
+
+ template <class T> struct A<T*> {
+ void f() { C::foo(); }
+ };
+
+ template <> struct A<char> {
+ void f() { C::foo(); }
+ };
+}
+
+// Tests 3, 4 and 5 were all noted in <rdar://problem/8540527>.
+namespace test3 {
+ template <class T> struct A {
+ struct Inner {
+ static int foo();
+ };
+ };
+
+ template <class U> class C {
+ int i;
+ template <class T> friend struct A<T>::Inner;
+ };
+
+ template <class T> int A<T>::Inner::foo() {
+ C<int> c;
+ c.i = 0;
+ return 0;
+ }
+
+ int test = A<int>::Inner::foo();
+}
+
+namespace test4 {
+ template <class T> struct X {
+ template <class U> void operator+=(U);
+
+ template <class V>
+ template <class U>
+ friend void X<V>::operator+=(U);
+ };
+
+ void test() {
+ X<int>() += 1.0;
+ }
+}
+
+namespace test5 {
+ template<template <class> class T> struct A {
+ template<template <class> class T> friend void A<T>::foo();
+ };
-A<int> a;
-B b;
+ template <class> struct B {};
+ template class A<B>;
+}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p8.cpp b/test/CXX/temp/temp.decls/temp.friend/p8.cpp
new file mode 100644
index 000000000000..d0221a3668d7
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.friend/p8.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+template<class T> class A { };
+
+class X {
+ template<class T> friend class A<T*>; // expected-error{{partial specialization cannot be declared as a friend}}
+};
diff --git a/test/CXX/temp/temp.decls/temp.mem/p3.cpp b/test/CXX/temp/temp.decls/temp.mem/p3.cpp
new file mode 100644
index 000000000000..0eb747be207d
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.mem/p3.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template <class T> struct AA {
+ template <class C> virtual void g(C); // expected-error{{'virtual' can not be specified on member function templates}}
+ virtual void f();
+};
diff --git a/test/CXX/temp/temp.decls/temp.mem/p5.cpp b/test/CXX/temp/temp.decls/temp.mem/p5.cpp
index b0078d4bdb6d..a188f05d535e 100644
--- a/test/CXX/temp/temp.decls/temp.mem/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.mem/p5.cpp
@@ -63,12 +63,12 @@ struct X0 {
template<typename T> operator const T*() const {
T x = T();
- return x; // expected-error{{cannot initialize return object of type 'char const *' with an lvalue of type 'char'}}
+ return x; // expected-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}}
}
};
-template X0::operator const char*() const; // expected-note{{'X0::operator char const *<char>' requested here}}
-template X0::operator const int*(); // expected-note{{'X0::operator int const *<int const>' requested here}}
+template X0::operator const char*() const; // expected-note{{'X0::operator const char *<char>' requested here}}
+template X0::operator const int*(); // expected-note{{'X0::operator const int *<const int>' requested here}}
template X0::operator float*() const; // expected-error{{explicit instantiation of undefined function template}}
void test_X0(X0 x0, const X0 &x0c) {
diff --git a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp
new file mode 100644
index 000000000000..383e268054b6
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+namespace DeductionForInstantiation {
+ template<unsigned I, typename ...Types>
+ struct X { };
+
+ template<typename ...Types>
+ void f0(X<sizeof...(Types), Types&...>) { }
+
+ // No explicitly-specified arguments
+ template void f0(X<0>);
+ template void f0(X<1, int&>);
+ template void f0(X<2, int&, short&>);
+
+ // One explicitly-specified argument
+ template void f0<float>(X<1, float&>);
+ template void f0<double>(X<1, double&>);
+
+ // Two explicitly-specialized arguments
+ template void f0<char, unsigned char>(X<2, char&, unsigned char&>);
+ template void f0<signed char, char>(X<2, signed char&, char&>);
+
+ // FIXME: Extension of explicitly-specified arguments
+ // template void f0<short, int>(X<3, short&, int&, long&>);
+}
+
+namespace DeductionWithConversion {
+ template<char...> struct char_values {
+ static const unsigned value = 0;
+ };
+
+ template<int C1, char C3>
+ struct char_values<C1, 12, C3> {
+ static const unsigned value = 1;
+ };
+
+ int check0[char_values<1, 12, 3>::value == 1? 1 : -1];
+
+ template<int...> struct int_values {
+ static const unsigned value = 0;
+ };
+
+ template<unsigned char C1, unsigned char C3>
+ struct int_values<C1, 12, C3> {
+ static const unsigned value = 1;
+ };
+
+ int check1[int_values<256, 12, 3>::value == 0? 1 : -1];
+ int check2[int_values<3, 12, 3>::value == 1? 1 : -1];
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp
new file mode 100644
index 000000000000..83db1719b769
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp
@@ -0,0 +1,352 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Example bind implementation from the variadic templates proposal,
+// ISO C++ committee document number N2080.
+
+// Helper type traits
+template<typename T>
+struct add_reference {
+ typedef T &type;
+};
+
+template<typename T>
+struct add_reference<T&> {
+ typedef T &type;
+};
+
+template<typename T>
+struct add_const_reference {
+ typedef T const &type;
+};
+
+template<typename T>
+struct add_const_reference<T&> {
+ typedef T &type;
+};
+
+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;
+};
+
+template<typename T>
+class reference_wrapper {
+ T *ptr;
+
+public:
+ reference_wrapper(T& t) : ptr(&t) { }
+ operator T&() const { return *ptr; }
+};
+
+template<typename T> reference_wrapper<T> ref(T& t) {
+ return reference_wrapper<T>(t);
+}
+template<typename T> reference_wrapper<const T> cref(const T& t) {
+ return reference_wrapper<const T>(t);
+}
+
+template<typename... Values> class tuple;
+
+// Basis case: zero-length tuple
+template<> class tuple<> { };
+
+template<typename Head, typename... Tail>
+class tuple<Head, Tail...> : private tuple<Tail...> {
+ typedef tuple<Tail...> inherited;
+
+public:
+ tuple() { }
+ // implicit copy-constructor is okay
+
+ // Construct tuple from separate arguments.
+ tuple(typename add_const_reference<Head>::type v,
+ typename add_const_reference<Tail>::type... vtail)
+ : m_head(v), inherited(vtail...) { }
+
+ // Construct tuple from another tuple.
+ template<typename... VValues> tuple(const tuple<VValues...>& other)
+ : m_head(other.head()), inherited(other.tail()) { }
+
+ template<typename... VValues> tuple&
+ operator=(const tuple<VValues...>& other) {
+ m_head = other.head();
+ tail() = other.tail();
+ return *this;
+ }
+
+ typename add_reference<Head>::type head() { return m_head; }
+ typename add_reference<const Head>::type head() const { return m_head; }
+ inherited& tail() { return *this; }
+ const inherited& tail() const { return *this; }
+
+protected:
+ Head m_head;
+};
+
+// Creation functions
+template<typename T>
+struct make_tuple_result {
+ typedef T type;
+};
+
+template<typename T>
+struct make_tuple_result<reference_wrapper<T> > {
+ typedef T& type;
+};
+
+template<typename... Values>
+tuple<typename make_tuple_result<Values>::type...>
+make_tuple(const Values&... values) {
+ return tuple<typename make_tuple_result<Values>::type...>(values...);
+}
+
+template<typename... Values>
+tuple<Values&...> tie(Values&... values) {
+ return tuple<Values&...>(values...);
+}
+
+// Helper classes
+template<typename Tuple> struct tuple_size;
+
+template<typename... Values> struct tuple_size<tuple<Values...> > {
+ static const int value = sizeof...(Values);
+};
+
+template<int I, typename Tuple> struct tuple_element;
+
+template<int I, typename Head, typename... Tail>
+struct tuple_element<I, tuple<Head, Tail...> > {
+ typedef typename tuple_element<I-1, tuple<Tail...> >::type type;
+};
+
+template<typename Head, typename... Tail>
+struct tuple_element<0, tuple<Head, Tail...> > {
+ typedef Head type;
+};
+
+// Element access
+template<int I, typename Tuple> class get_impl;
+template<int I, typename Head, typename... Values>
+class get_impl<I, tuple<Head, Values...> > {
+ typedef typename tuple_element<I-1, tuple<Values...> >::type Element;
+ typedef typename add_reference<Element>::type RJ;
+ typedef typename add_const_reference<Element>::type PJ;
+ typedef get_impl<I-1, tuple<Values...> > Next;
+public:
+ static RJ get(tuple<Head, Values...>& t) { return Next::get(t.tail()); }
+ static PJ get(const tuple<Head, Values...>& t) { return Next::get(t.tail()); }
+};
+
+template<typename Head, typename... Values>
+class get_impl<0, tuple<Head, Values...> > {
+ typedef typename add_reference<Head>::type RJ;
+ typedef typename add_const_reference<Head>::type PJ;
+public:
+ static RJ get(tuple<Head, Values...>& t) { return t.head(); }
+ static PJ get(const tuple<Head, Values...>& t) { return t.head(); }
+};
+
+template<int I, typename... Values> typename add_reference<
+typename tuple_element<I, tuple<Values...> >::type >::type
+get(tuple<Values...>& t) {
+ return get_impl<I, tuple<Values...> >::get(t);
+}
+
+template<int I, typename... Values> typename add_const_reference<
+typename tuple_element<I, tuple<Values...> >::type >::type
+get(const tuple<Values...>& t) {
+ return get_impl<I, tuple<Values...> >::get(t);
+}
+
+// Relational operators
+inline bool operator==(const tuple<>&, const tuple<>&) { return true; }
+
+template<typename T, typename... TTail, typename U, typename... UTail>
+bool operator==(const tuple<T, TTail...>& t, const tuple<U, UTail...>& u) {
+ return t.head() == u.head() && t.tail() == u.tail();
+}
+
+template<typename... TValues, typename... UValues>
+bool operator!=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return !(t == u);
+}
+
+inline bool operator<(const tuple<>&, const tuple<>&) { return false; }
+
+template<typename T, typename... TTail, typename U, typename... UTail>
+bool operator<(const tuple<T, TTail...>& t, const tuple<U, UTail...>& u) {
+ return (t.head() < u.head() || (!(t.head() < u.head()) && t.tail() < u.tail()));
+}
+
+template<typename... TValues, typename... UValues>
+bool operator>(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return u < t;
+}
+
+template<typename... TValues, typename... UValues>
+bool operator<=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return !(u < t);
+}
+
+template<typename... TValues, typename... UValues>
+bool operator>=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return !(t < u);
+}
+
+// make_indices helper
+template<int...> struct int_tuple {};
+// make_indexes impl is a helper for make_indexes
+template<int I, typename IntTuple, typename... Types> struct make_indexes_impl;
+
+template<int I, int... Indexes, typename T, typename... Types>
+struct make_indexes_impl<I, int_tuple<Indexes...>, T, Types...> {
+ typedef typename make_indexes_impl<I+1, int_tuple<Indexes..., I>, Types...>::type type;
+};
+
+template<int I, int... Indexes>
+struct make_indexes_impl<I, int_tuple<Indexes...> > {
+ typedef int_tuple<Indexes...> type;
+};
+
+template<typename... Types>
+struct make_indexes : make_indexes_impl<0, int_tuple<>, Types...> {
+};
+
+// Bind
+template<typename T> struct is_bind_expression {
+ static const bool value = false;
+};
+
+template<typename T> struct is_placeholder {
+ static const int value = 0;
+};
+
+
+template<typename F, typename... BoundArgs> class bound_functor {
+ typedef typename make_indexes<BoundArgs...>::type indexes;
+public:
+ typedef typename F::result_type result_type;
+ explicit bound_functor(const F& f, const BoundArgs&... bound_args)
+ : f(f), bound_args(bound_args...) { } template<typename... Args>
+ typename F::result_type operator()(Args&... args);
+private: F f;
+ tuple<BoundArgs...> bound_args;
+};
+
+template<typename F, typename... BoundArgs>
+inline bound_functor<F, BoundArgs...> bind(const F& f, const BoundArgs&... bound_args) {
+ return bound_functor<F, BoundArgs...>(f, bound_args...);
+}
+
+template<typename F, typename ...BoundArgs>
+struct is_bind_expression<bound_functor<F, BoundArgs...> > {
+ static const bool value = true;
+};
+
+// enable_if helper
+template<bool Cond, typename T = void>
+struct enable_if;
+
+template<typename T>
+struct enable_if<true, T> {
+ typedef T type;
+};
+
+template<typename T>
+struct enable_if<false, T> { };
+
+// safe_tuple_element helper
+template<int I, typename Tuple, typename = void>
+struct safe_tuple_element { };
+
+template<int I, typename... Values>
+struct safe_tuple_element<I, tuple<Values...>,
+ typename enable_if<(I >= 0 && I < tuple_size<tuple<Values...> >::value)>::type> {
+ typedef typename tuple_element<I, tuple<Values...> >::type type;
+};
+
+// mu
+template<typename Bound, typename... Args>
+inline typename safe_tuple_element<is_placeholder<Bound>::value -1,
+ tuple<Args...> >::type
+mu(Bound& bound_arg, const tuple<Args&...>& args) {
+ return get<is_placeholder<Bound>::value-1>(args);
+}
+
+template<typename T, typename... Args>
+inline T& mu(reference_wrapper<T>& bound_arg, const tuple<Args&...>&) {
+ return bound_arg.get();
+}
+
+template<typename F, int... Indexes, typename... Args>
+inline typename F::result_type
+unwrap_and_forward(F& f, int_tuple<Indexes...>, const tuple<Args&...>& args) {
+ return f(get<Indexes>(args)...);
+}
+
+template<typename Bound, typename... Args>
+inline typename enable_if<is_bind_expression<Bound>::value,
+ typename Bound::result_type>::type
+mu(Bound& bound_arg, const tuple<Args&...>& args) {
+ typedef typename make_indexes<Args...>::type Indexes;
+ return unwrap_and_forward(bound_arg, Indexes(), args);
+}
+
+template<typename T>
+struct is_reference_wrapper {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_reference_wrapper<reference_wrapper<T>> {
+ static const bool value = true;
+};
+
+template<typename Bound, typename... Args>
+inline typename enable_if<(!is_bind_expression<Bound>::value
+ && !is_placeholder<Bound>::value
+ && !is_reference_wrapper<Bound>::value),
+ Bound&>::type
+mu(Bound& bound_arg, const tuple<Args&...>&) {
+ return bound_arg;
+}
+
+template<typename F, typename... BoundArgs, int... Indexes, typename... Args>
+typename F::result_type apply_functor(F& f, tuple<BoundArgs...>& bound_args,
+ int_tuple<Indexes...>,
+ const tuple<Args&...>& args) {
+ return f(mu(get<Indexes>(bound_args), args)...);
+}
+
+template<typename F, typename... BoundArgs>
+template<typename... Args>
+typename F::result_type bound_functor<F, BoundArgs...>::operator()(Args&... args) {
+ return apply_functor(f, bound_args, indexes(), tie(args...));
+}
+
+template<int N> struct placeholder { };
+template<int N>
+struct is_placeholder<placeholder<N>> {
+ static const int value = N;
+};
+
+template<typename T>
+struct plus {
+ typedef T result_type;
+
+ T operator()(T x, T y) { return x + y; }
+};
+
+placeholder<1> _1;
+
+// Test bind
+void test_bind() {
+ int x = 17;
+ int y = 25;
+ bind(plus<int>(), x, _1)(y);
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp
new file mode 100644
index 000000000000..b3d010c88d95
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Example function implementation from the variadic templates proposal,
+// ISO C++ committee document number N2080.
+
+template<typename Signature> class function;
+
+template<typename R, typename... Args> class invoker_base {
+public:
+ virtual ~invoker_base() { }
+ virtual R invoke(Args...) = 0;
+ virtual invoker_base* clone() = 0;
+};
+
+template<typename F, typename R, typename... Args>
+class functor_invoker : public invoker_base<R, Args...> {
+public:
+ explicit functor_invoker(const F& f) : f(f) { }
+ R invoke(Args... args) { return f(args...); }
+ functor_invoker* clone() { return new functor_invoker(f); }
+
+private:
+ F f;
+};
+
+template<typename R, typename... Args>
+class function<R (Args...)> {
+public:
+ typedef R result_type;
+ function() : invoker (0) { }
+ function(const function& other) : invoker(0) {
+ if (other.invoker)
+ invoker = other.invoker->clone();
+ }
+
+ template<typename F> function(const F& f) : invoker(0) {
+ invoker = new functor_invoker<F, R, Args...>(f);
+ }
+
+ ~function() {
+ if (invoker)
+ delete invoker;
+ }
+
+ function& operator=(const function& other) {
+ function(other).swap(*this);
+ return *this;
+ }
+
+ template<typename F>
+ function& operator=(const F& f) {
+ function(f).swap(*this);
+ return *this;
+ }
+
+ void swap(function& other) {
+ invoker_base<R, Args...>* tmp = invoker;
+ invoker = other.invoker;
+ other.invoker = tmp;
+ }
+
+ result_type operator()(Args... args) const {
+ return invoker->invoke(args...);
+ }
+
+private:
+ invoker_base<R, Args...>* invoker;
+};
+
+template<typename T>
+struct add {
+ T operator()(T x, T y) { return x + y; }
+};
+
+int add_ints(int x, int y) { return x + y; }
+
+void test_function() {
+ function<int(int, int)> f2a;
+ function<int(int, int)> f2b = add<int>();
+ function<int(int, int)> f2c = add<float>();
+ function<int(int, int)> f2d(f2b);
+ function<int(int, int)> f2e = &add_ints;
+ f2c = f2d;
+ f2d = &add_ints;
+ f2c(1.0, 3);
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp
new file mode 100644
index 000000000000..3b4bd7777d55
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp
@@ -0,0 +1,260 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Example tuple implementation from the variadic templates proposal,
+// ISO C++ committee document number N2080.
+
+// Helper type traits
+template<typename T>
+struct add_reference {
+ typedef T &type;
+};
+
+template<typename T>
+struct add_reference<T&> {
+ typedef T &type;
+};
+
+template<typename T>
+struct add_const_reference {
+ typedef T const &type;
+};
+
+template<typename T>
+struct add_const_reference<T&> {
+ typedef T &type;
+};
+
+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;
+};
+
+template<typename T>
+class reference_wrapper {
+ T *ptr;
+
+public:
+ reference_wrapper(T& t) : ptr(&t) { }
+ operator T&() const { return *ptr; }
+};
+
+template<typename T> reference_wrapper<T> ref(T& t) {
+ return reference_wrapper<T>(t);
+}
+template<typename T> reference_wrapper<const T> cref(const T& t) {
+ return reference_wrapper<const T>(t);
+}
+
+template<typename... Values> class tuple;
+
+// Basis case: zero-length tuple
+template<> class tuple<> { };
+
+template<typename Head, typename... Tail>
+class tuple<Head, Tail...> : private tuple<Tail...> {
+ typedef tuple<Tail...> inherited;
+
+public:
+ tuple() { }
+ // implicit copy-constructor is okay
+
+ // Construct tuple from separate arguments.
+ tuple(typename add_const_reference<Head>::type v,
+ typename add_const_reference<Tail>::type... vtail)
+ : m_head(v), inherited(vtail...) { }
+
+ // Construct tuple from another tuple.
+ template<typename... VValues> tuple(const tuple<VValues...>& other)
+ : m_head(other.head()), inherited(other.tail()) { }
+
+ template<typename... VValues> tuple&
+ operator=(const tuple<VValues...>& other) {
+ m_head = other.head();
+ tail() = other.tail();
+ return *this;
+ }
+
+ typename add_reference<Head>::type head() { return m_head; }
+ typename add_reference<const Head>::type head() const { return m_head; }
+ inherited& tail() { return *this; }
+ const inherited& tail() const { return *this; }
+
+protected:
+ Head m_head;
+};
+
+void test_tuple() {
+ tuple<> t0a;
+ tuple<> t0b(t0a);
+ t0a = t0b;
+
+ tuple<int> t1a;
+ tuple<int> t1b(17);
+ tuple<int> t1c(t1b);
+ t1a = t1b;
+
+ tuple<float> t1d(3.14159);
+ tuple<float> t1e(t1d);
+ t1d = t1e;
+
+ int i;
+ float f;
+ double d;
+ tuple<int*, float*, double*> t3a(&i, &f, &d);
+}
+
+// Creation functions
+template<typename T>
+struct make_tuple_result {
+ typedef T type;
+};
+
+template<typename T>
+struct make_tuple_result<reference_wrapper<T> > {
+ typedef T& type;
+};
+
+template<typename... Values>
+tuple<typename make_tuple_result<Values>::type...>
+make_tuple(const Values&... values) {
+ return tuple<typename make_tuple_result<Values>::type...>(values...);
+}
+
+template<typename... Values>
+tuple<Values&...> tie(Values&... values) {
+ return tuple<Values&...>(values...);
+}
+
+template<typename T> const T *addr(const T& ref) { return &ref; }
+void test_creation_functions() {
+ int i;
+ float f;
+ double d;
+ const tuple<int, float&, const double&> *t3p = addr(make_tuple(i, ref(f), cref(d)));
+ const tuple<int&, float&, double&> *t3q = addr(tie(i, f, d));
+}
+
+// Helper classes
+template<typename Tuple> struct tuple_size;
+
+template<typename... Values> struct tuple_size<tuple<Values...> > {
+ static const int value = sizeof...(Values);
+};
+
+int check_tuple_size_0[tuple_size<tuple<> >::value == 0? 1 : -1];
+int check_tuple_size_1[tuple_size<tuple<int>>::value == 1? 1 : -1];
+int check_tuple_size_2[tuple_size<tuple<float, double>>::value == 2? 1 : -1];
+int check_tuple_size_3[tuple_size<tuple<char, unsigned char, signed char>>::value == 3? 1 : -1];
+
+template<int I, typename Tuple> struct tuple_element;
+
+template<int I, typename Head, typename... Tail>
+struct tuple_element<I, tuple<Head, Tail...> > {
+ typedef typename tuple_element<I-1, tuple<Tail...> >::type type;
+};
+
+template<typename Head, typename... Tail>
+struct tuple_element<0, tuple<Head, Tail...> > {
+ typedef Head type;
+};
+
+int check_tuple_element_0[is_same<tuple_element<0, tuple<int&, float, double>>::type,
+ int&>::value? 1 : -1];
+
+int check_tuple_element_1[is_same<tuple_element<1, tuple<int&, float, double>>::type,
+ float>::value? 1 : -1];
+
+int check_tuple_element_2[is_same<tuple_element<2, tuple<int&, float, double>>::type,
+ double>::value? 1 : -1];
+
+// Element access
+template<int I, typename Tuple> class get_impl;
+template<int I, typename Head, typename... Values>
+class get_impl<I, tuple<Head, Values...> > {
+ typedef typename tuple_element<I-1, tuple<Values...> >::type Element;
+ typedef typename add_reference<Element>::type RJ;
+ typedef typename add_const_reference<Element>::type PJ;
+ typedef get_impl<I-1, tuple<Values...> > Next;
+public:
+ static RJ get(tuple<Head, Values...>& t) { return Next::get(t.tail()); }
+ static PJ get(const tuple<Head, Values...>& t) { return Next::get(t.tail()); }
+};
+
+template<typename Head, typename... Values>
+class get_impl<0, tuple<Head, Values...> > {
+ typedef typename add_reference<Head>::type RJ;
+ typedef typename add_const_reference<Head>::type PJ;
+public:
+ static RJ get(tuple<Head, Values...>& t) { return t.head(); }
+ static PJ get(const tuple<Head, Values...>& t) { return t.head(); }
+};
+
+template<int I, typename... Values> typename add_reference<
+typename tuple_element<I, tuple<Values...> >::type >::type
+get(tuple<Values...>& t) {
+ return get_impl<I, tuple<Values...> >::get(t);
+}
+
+template<int I, typename... Values> typename add_const_reference<
+typename tuple_element<I, tuple<Values...> >::type >::type
+get(const tuple<Values...>& t) {
+ return get_impl<I, tuple<Values...> >::get(t);
+}
+
+void test_element_access(tuple<int*, float*, double*&> t3) {
+ int i;
+ float f;
+ double d;
+ get<0>(t3) = &i;
+ get<1>(t3) = &f;
+ get<2>(t3) = &d;
+}
+
+// Relational operators
+inline bool operator==(const tuple<>&, const tuple<>&) { return true; }
+
+template<typename T, typename... TTail, typename U, typename... UTail>
+bool operator==(const tuple<T, TTail...>& t, const tuple<U, UTail...>& u) {
+ return t.head() == u.head() && t.tail() == u.tail();
+}
+
+template<typename... TValues, typename... UValues>
+bool operator!=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return !(t == u);
+}
+
+inline bool operator<(const tuple<>&, const tuple<>&) { return false; }
+
+template<typename T, typename... TTail, typename U, typename... UTail>
+bool operator<(const tuple<T, TTail...>& t, const tuple<U, UTail...>& u) {
+ return (t.head() < u.head() || (!(t.head() < u.head()) && t.tail() < u.tail()));
+}
+
+template<typename... TValues, typename... UValues>
+bool operator>(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return u < t;
+}
+
+template<typename... TValues, typename... UValues>
+bool operator<=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return !(u < t);
+}
+
+template<typename... TValues, typename... UValues>
+bool operator>=(const tuple<TValues...>& t, const tuple<UValues...>& u) {
+ return !(t < u);
+}
+
+void test_relational_operators(tuple<int*, float*, double*> t3) {
+ (void)(t3 == t3);
+ (void)(t3 != t3);
+ (void)(t3 < t3);
+ (void)(t3 <= t3);
+ (void)(t3 >= t3);
+ (void)(t3 > t3);
+};
diff --git a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
new file mode 100644
index 000000000000..62cf4298f717
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -std=c++0x -fblocks -fsyntax-only -verify %s
+
+// Tests the use of blocks with variadic templates.
+template<typename ...Args>
+int f0(Args ...args) {
+ return ^ {
+ return sizeof...(Args);
+ }() + ^ {
+ return sizeof...(args);
+ }();
+}
+
+template<typename ...Args>
+int f1(Args ...args) {
+ return ^ {
+ return f0(args...);
+ }();
+}
+
+template int f0(int, float, double);
+template int f1(const char*, int, float, double);
+
+template<typename ...Args>
+int f2(Args ...args) {
+ return ^(Args ...block_args) {
+ return f1(block_args...);
+ }(args + 0 ...);
+}
+
+template int f2(const char*, int, float, double);
+
+template<typename ...Args>
+int f3(Args ...args) {
+ return ^(Args *...block_args) {
+ return f1(block_args...);
+ }(&args...);
+}
+
+template int f3(const char*, int, float, double);
diff --git a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp
new file mode 100644
index 000000000000..a76ef8067dfd
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp
@@ -0,0 +1,75 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Check for declaration matching with out-of-line declarations and
+// variadic templates, which involves proper computation of the
+// injected-class-name.
+template<typename T, typename ...Types>
+struct X0 {
+ typedef T type;
+
+ void f0(T);
+ type f1(T);
+};
+
+template<typename T, typename ...Types>
+void X0<T, Types...>::f0(T) { }
+
+template<typename T, typename ...Types>
+typename X0<T, Types...>::type X0<T, Types...>::f1(T) { }
+
+template<typename T, typename ...Types>
+struct X0<T, T, Types...> {
+ typedef T* result;
+ result f3();
+
+ template<typename... InnerTypes>
+ struct Inner;
+};
+
+template<typename T, typename ...Types>
+typename X0<T, T, Types...>::result X0<T, T, Types...>::f3() { return 0; }
+
+template<typename T, typename ...Types>
+template<typename ...InnerTypes>
+struct X0<T, T, Types...>::Inner {
+ template<typename ...ReallyInner> void f4();
+};
+
+template<typename T, typename ...Types>
+template<typename ...InnerTypes>
+template<typename ...ReallyInner>
+void X0<T, T, Types...>::Inner<InnerTypes...>::f4() { }
+
+namespace rdar8848837 {
+ // Out-of-line definitions that cause rebuilding in the current
+ // instantiation.
+ template<typename F> struct X;
+
+ template<typename R, typename ...ArgTypes>
+ struct X<R(ArgTypes...)> {
+ X<R(ArgTypes...)> f();
+ };
+
+ template<typename R, typename ...ArgTypes>
+ X<R(ArgTypes...)> X<R(ArgTypes...)>::f() { return *this; }
+
+
+ X<int(float, double)> xif;
+
+ template<unsigned> struct unsigned_c { };
+ template<typename ...ArgTypes> int g(ArgTypes...);
+
+ template<typename F> struct X1;
+
+ template<typename R, typename ...ArgTypes>
+ struct X1<R(ArgTypes...)> {
+ unsigned_c<sizeof(1 + g(ArgTypes()...))> f();
+ };
+
+ template<typename R, typename ...ArgTypes>
+ unsigned_c<sizeof(1 + g(ArgTypes()...))> X1<R(ArgTypes...)>::f() {
+ return unsigned_c<sizeof(int)>();
+ }
+
+ X1<int(float, double)> xif2;
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
new file mode 100644
index 000000000000..d80182c1b657
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
@@ -0,0 +1,274 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// This is a collection of various template metafunctions involving
+// variadic templates, which are meant to exercise common use cases.
+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;
+};
+
+template<typename...> struct tuple { };
+template<int ...> struct int_tuple { };
+template<typename T, typename U> struct pair { };
+
+namespace Count {
+ template<typename Head, typename ...Tail>
+ struct count {
+ static const unsigned value = 1 + count<Tail...>::value;
+ };
+
+ template<typename T>
+ struct count<T> {
+ static const unsigned value = 1;
+ };
+
+ int check1[count<int>::value == 1? 1 : -1];
+ int check2[count<float, double>::value == 2? 1 : -1];
+ int check3[count<char, signed char, unsigned char>::value == 3? 1 : -1];
+}
+
+namespace CountWithPackExpansion {
+ template<typename ...> struct count;
+
+ template<typename Head, typename ...Tail>
+ struct count<Head, Tail...> {
+ static const unsigned value = 1 + count<Tail...>::value;
+ };
+
+ template<>
+ struct count<> {
+ static const unsigned value = 0;
+ };
+
+ int check0[count<>::value == 0? 1 : -1];
+ int check1[count<int>::value == 1? 1 : -1];
+ int check2[count<float, double>::value == 2? 1 : -1];
+ int check3[count<char, signed char, unsigned char>::value == 3? 1 : -1];
+}
+
+namespace Replace {
+ // Simple metafunction that replaces the template arguments of
+ // template template parameters with 'int'.
+ template<typename T>
+ struct EverythingToInt;
+
+ template<template<typename ...> class TT, typename T1, typename T2>
+ struct EverythingToInt<TT<T1, T2> > {
+ typedef TT<int, int> type;
+ };
+
+ int check0[is_same<EverythingToInt<tuple<double, float>>::type,
+ tuple<int, int>>::value? 1 : -1];
+}
+
+namespace Math {
+ template<int ...Values>
+ struct double_values {
+ typedef int_tuple<Values*2 ...> type;
+ };
+
+ int check0[is_same<double_values<1, 2, -3>::type,
+ int_tuple<2, 4, -6>>::value? 1 : -1];
+
+ template<int ...Values>
+ struct square {
+ typedef int_tuple<(Values*Values)...> type;
+ };
+
+ int check1[is_same<square<1, 2, -3>::type,
+ int_tuple<1, 4, 9>>::value? 1 : -1];
+
+ template<typename IntTuple> struct square_tuple;
+
+ template<int ...Values>
+ struct square_tuple<int_tuple<Values...>> {
+ typedef int_tuple<(Values*Values)...> type;
+ };
+
+ int check2[is_same<square_tuple<int_tuple<1, 2, -3> >::type,
+ int_tuple<1, 4, 9>>::value? 1 : -1];
+
+ template<int ...Values> struct sum;
+
+ template<int First, int ...Rest>
+ struct sum<First, Rest...> {
+ static const int value = First + sum<Rest...>::value;
+ };
+
+ template<>
+ struct sum<> {
+ static const int value = 0;
+ };
+
+ int check3[sum<1, 2, 3, 4, 5>::value == 15? 1 : -1];
+
+ template<int ... Values>
+ struct lazy_sum {
+ int operator()() {
+ return sum<Values...>::value;
+ }
+ };
+
+ void f() {
+ lazy_sum<1, 2, 3, 4, 5>()();
+ }
+}
+
+namespace ListMath {
+ template<typename T, T ... V> struct add;
+
+ template<typename T, T i, T ... V>
+ struct add<T, i, V...> {
+ static const T value = i + add<T, V...>::value;
+ };
+
+ template<typename T>
+ struct add<T> {
+ static const T value = T();
+ };
+
+ template<typename T, T ... V>
+ struct List {
+ struct sum {
+ static const T value = add<T, V...>::value;
+ };
+ };
+
+ template<int ... V>
+ struct ListI : public List<int, V...> {
+ };
+
+ int check0[ListI<1, 2, 3>::sum::value == 6? 1 : -1];
+}
+
+namespace Indices {
+ template<unsigned I, unsigned N, typename IntTuple>
+ struct build_indices_impl;
+
+ template<unsigned I, unsigned N, int ...Indices>
+ struct build_indices_impl<I, N, int_tuple<Indices...> >
+ : build_indices_impl<I+1, N, int_tuple<Indices..., I> > {
+ };
+
+ template<unsigned N, int ...Indices>
+ struct build_indices_impl<N, N, int_tuple<Indices...> > {
+ typedef int_tuple<Indices...> type;
+ };
+
+ template<unsigned N>
+ struct build_indices : build_indices_impl<0, N, int_tuple<> > { };
+
+ int check0[is_same<build_indices<5>::type,
+ int_tuple<0, 1, 2, 3, 4>>::value? 1 : -1];
+}
+
+namespace TemplateTemplateApply {
+ template<typename T, template<class> class ...Meta>
+ struct apply_each {
+ typedef tuple<typename Meta<T>::type...> type;
+ };
+
+ template<typename T>
+ struct add_reference {
+ typedef T& type;
+ };
+
+ template<typename T>
+ struct add_pointer {
+ typedef T* type;
+ };
+
+ template<typename T>
+ struct add_const {
+ typedef const T type;
+ };
+
+ int check0[is_same<apply_each<int,
+ add_reference, add_pointer, add_const>::type,
+ tuple<int&, int*, int const>>::value? 1 : -1];
+
+ template<typename T, template<class> class ...Meta>
+ struct apply_each_indirect {
+ typedef typename apply_each<T, Meta...>::type type;
+ };
+
+ int check1[is_same<apply_each_indirect<int, add_reference, add_pointer,
+ add_const>::type,
+ tuple<int&, int*, int const>>::value? 1 : -1];
+
+ template<typename T, typename ...Meta>
+ struct apply_each_nested {
+ typedef typename apply_each<T, Meta::template apply...>::type type;
+ };
+
+ struct add_reference_meta {
+ template<typename T>
+ struct apply {
+ typedef T& type;
+ };
+ };
+
+ struct add_pointer_meta {
+ template<typename T>
+ struct apply {
+ typedef T* type;
+ };
+ };
+
+ struct add_const_meta {
+ template<typename T>
+ struct apply {
+ typedef const T type;
+ };
+ };
+
+ int check2[is_same<apply_each_nested<int, add_reference_meta,
+ add_pointer_meta, add_const_meta>::type,
+ tuple<int&, int*, int const>>::value? 1 : -1];
+
+}
+
+namespace FunctionTypes {
+ template<typename FunctionType>
+ struct Arity;
+
+ template<typename R, typename ...Types>
+ struct Arity<R(Types...)> {
+ static const unsigned value = sizeof...(Types);
+ };
+
+ template<typename R, typename ...Types>
+ struct Arity<R(Types......)> {
+ static const unsigned value = sizeof...(Types);
+ };
+
+ template<typename R, typename T1, typename T2, typename T3, typename T4>
+ struct Arity<R(T1, T2, T3, T4)>; // expected-note{{template is declared here}}
+
+ int check0[Arity<int()>::value == 0? 1 : -1];
+ int check1[Arity<int(float, double)>::value == 2? 1 : -1];
+ int check2[Arity<int(float...)>::value == 1? 1 : -1];
+ int check3[Arity<int(float, double, long double...)>::value == 3? 1 : -1];
+ Arity<int(float, double, long double, char)> check4; // expected-error{{implicit instantiation of undefined template 'FunctionTypes::Arity<int (float, double, long double, char)>'}}
+}
+
+namespace SuperReplace {
+ template<typename T>
+ struct replace_with_int {
+ typedef int type;
+ };
+
+ template<template<typename ...> class TT, typename ...Types>
+ struct replace_with_int<TT<Types...>> {
+ typedef TT<typename replace_with_int<Types>::type...> type;
+ };
+
+ int check0[is_same<replace_with_int<pair<tuple<float, double, short>,
+ pair<char, unsigned char>>>::type,
+ pair<tuple<int, int, int>, pair<int, int>>>::value? 1 : -1];
+}
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
new file mode 100644
index 000000000000..2df6d33a8904
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
@@ -0,0 +1,218 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T, T ...Values> struct value_tuple {};
+template<typename...> struct tuple { };
+template<typename T, typename U> struct pair { };
+
+template<typename T, T Value> struct value_c;
+
+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;
+};
+
+template<typename T>
+struct X0 {
+ template<T ...Values>
+ void f(value_tuple<T, Values...> * = 0);
+};
+
+void test_X0() {
+ X0<int>().f<1, 2, 3, 4, 5>();
+}
+
+namespace PacksAtDifferentLevels {
+
+ template<typename ...Types>
+ struct X {
+ template<typename> struct Inner {
+ static const unsigned value = 1;
+ };
+
+ template<typename ...YTypes>
+ struct Inner<tuple<pair<Types, YTypes>...> > {
+ static const unsigned value = sizeof...(Types) - sizeof...(YTypes);
+ };
+ };
+
+ int check0[X<short, int, long>::Inner<tuple<pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>>
+ >::value == 0? 1 : -1];
+
+ int check1[X<short, int>::Inner<tuple<pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>>
+ >::value == 1? 1 : -1];
+
+ template<unsigned ...Values> struct unsigned_tuple { };
+ template<typename ...Types>
+ struct X1 {
+ template<typename, typename> struct Inner {
+ static const unsigned value = 0;
+ };
+
+ template<typename ...YTypes>
+ struct Inner<tuple<pair<Types, YTypes>...>,
+ unsigned_tuple<sizeof(Types) + sizeof(YTypes)...>> {
+ static const unsigned value = 1;
+ };
+ };
+
+ int check2[X1<short, int, long>::Inner<tuple<pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>>,
+ unsigned_tuple<sizeof(short) + sizeof(unsigned short),
+ sizeof(int) + sizeof(unsigned int),
+ sizeof(long) + sizeof(unsigned long)>
+ >::value == 1? 1 : -1];
+ int check3[X1<short, int>::Inner<tuple<pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>>,
+ unsigned_tuple<sizeof(short) + sizeof(unsigned short),
+ sizeof(int) + sizeof(unsigned int),
+ sizeof(long) + sizeof(unsigned long)>
+ >::value == 0? 1 : -1];
+
+ template<typename ...Types>
+ struct X2 {
+ template<typename> struct Inner {
+ static const unsigned value = 1;
+ };
+
+ template<typename R, typename ...YTypes>
+ struct Inner<R(pair<Types, YTypes>...)> {
+ static const unsigned value = sizeof...(Types) - sizeof...(YTypes);
+ };
+ };
+
+ int check4[X2<short, int, long>::Inner<int(pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>)
+ >::value == 0? 1 : -1];
+
+ int check5[X2<short, int>::Inner<int(pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>)
+ >::value == 1? 1 : -1];
+
+ template<typename T, typename U>
+ struct some_function_object {
+ template<typename>
+ struct result_of;
+ };
+
+ template<template<class> class...> struct metafun_tuple { };
+
+ template<typename ...Types1>
+ struct X3 {
+ template<typename, typename> struct Inner {
+ static const unsigned value = 0;
+ };
+
+ template<typename ...Types2>
+ struct Inner<tuple<pair<Types1, Types2>...>,
+ metafun_tuple<some_function_object<Types1, Types2>::template result_of...> > {
+ static const unsigned value = 1;
+ };
+ };
+
+ int check6[X3<short, int, long>::Inner<tuple<pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>>,
+ metafun_tuple<
+ some_function_object<short, unsigned short>::result_of,
+ some_function_object<int, unsigned int>::result_of,
+ some_function_object<long, unsigned long>::result_of>
+ >::value == 1? 1 : -1];
+ int check7[X3<short, int>::Inner<tuple<pair<short, unsigned short>,
+ pair<int, unsigned int>,
+ pair<long, unsigned long>>,
+ metafun_tuple<
+ some_function_object<short, unsigned short>::result_of,
+ some_function_object<int, unsigned int>::result_of,
+ some_function_object<long, unsigned long>::result_of>
+ >::value == 0? 1 : -1];
+
+ template<unsigned I, unsigned J> struct unsigned_pair { };
+
+ template<unsigned ...Values1>
+ struct X4 {
+ template<typename> struct Inner {
+ static const unsigned value = 0;
+ };
+
+ template<unsigned ...Values2>
+ struct Inner<tuple<unsigned_pair<Values1, Values2>...>> {
+ static const unsigned value = 1;
+ };
+ };
+
+ int check8[X4<1, 3, 5>::Inner<tuple<unsigned_pair<1, 2>,
+ unsigned_pair<3, 4>,
+ unsigned_pair<5, 6>>
+ >::value == 1? 1 : -1];
+ int check9[X4<1, 3>::Inner<tuple<unsigned_pair<1, 2>,
+ unsigned_pair<3, 4>,
+ unsigned_pair<5, 6>>
+ >::value == 0? 1 : -1];
+
+ template<class> struct add_reference;
+ template<class> struct add_pointer;
+ template<class> struct add_const;
+
+ template<template<class> class ...Templates>
+ struct X5 {
+ template<typename> struct Inner {
+ static const unsigned value = 0;
+ };
+
+ template<typename ...Types>
+ struct Inner<tuple<Templates<Types>...>> {
+ static const unsigned value = 1;
+ };
+ };
+
+ int check10[X5<add_reference, add_pointer, add_const>
+ ::Inner<tuple<add_reference<int>,
+ add_pointer<float>,
+ add_const<double>>>::value == 1? 1 : -1];
+ int check11[X5<add_reference, add_pointer>
+ ::Inner<tuple<add_reference<int>,
+ add_pointer<float>,
+ add_const<double>>>::value == 0? 1 : -1];
+
+}
+
+namespace ExpandingNonTypeTemplateParameters {
+ template<typename ...Types>
+ struct tuple_of_values {
+ template<Types ...Values> // expected-error{{a non-type template parameter cannot have type 'float'}} \
+ // expected-note{{template parameter is declared here}}
+ struct apply { // expected-note 2{{template is declared here}}
+ typedef tuple<value_c<Types, Values>...> type;
+ };
+ };
+
+ int i;
+ float f;
+ int check_tuple_of_values_1[
+ is_same<tuple_of_values<int&, float&, char, int>::apply<i, f, 'a', 17>
+ ::type,
+ tuple<value_c<int&, i>, value_c<float&, f>, value_c<char, 'a'>,
+ value_c<int, 17>>
+ >::value? 1 : -1];
+
+ tuple_of_values<int, float> tv1; // expected-note{{in instantiation of template class 'ExpandingNonTypeTemplateParameters::tuple_of_values<int, float>' requested here}}
+
+ tuple_of_values<int&, float&>::apply<i, i>::type tv2; // expected-error{{non-type template parameter of reference type 'float &' cannot bind to template argument of type 'int'}}
+
+ tuple_of_values<int&, float&>::apply<i>::type tv3; // expected-error{{too few template arguments for class template 'apply'}}
+
+ tuple_of_values<int&, float&>::apply<i, f, i>::type tv4; // expected-error{{too many template arguments for class template 'apply'}}
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p1.cpp b/test/CXX/temp/temp.decls/temp.variadic/p1.cpp
new file mode 100644
index 000000000000..02f4c59b760b
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/p1.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<class ...Types> struct Tuple;
+
+Tuple<> *t0;
+Tuple<int> *t1;
+Tuple<int, char> *t2a;
+Tuple<int, float> *t2b = t2a; // expected-error{{cannot initialize a variable of type 'Tuple<int, float> *' with an lvalue of type 'Tuple<int, char> *'}}
+Tuple<int, float, double> *t3;
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p2.cpp b/test/CXX/temp/temp.decls/temp.variadic/p2.cpp
new file mode 100644
index 000000000000..100ae2c52f9a
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/p2.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<class ... Types> void f(Types ... args);
+
+void test() {
+ f();
+ f(1);
+ f(2, 1.0);
+}
+
+// Test simple recursive variadic function template
+template<typename Head, typename ...Tail>
+void recurse_until_fail(const Head &, const Tail &...tail) { // expected-note{{candidate function template not viable: requires at least 1 argument, but 0 were provided}}
+ recurse_until_fail(tail...); // expected-error{{no matching function for call to 'recurse_until_fail'}} \
+ // expected-note{{in instantiation of function template specialization 'recurse_until_fail<char [7], >' requested here}} \
+ // expected-note{{in instantiation of function template specialization 'recurse_until_fail<double, char [7]>' requested here}}
+}
+
+void test_recurse_until_fail() {
+ recurse_until_fail(1, 3.14159, "string"); // expected-note{{in instantiation of function template specialization 'recurse_until_fail<int, double, char [7]>' requested here}}
+
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
new file mode 100644
index 000000000000..e2fa12293725
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
@@ -0,0 +1,135 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -verify %s
+
+template<typename... Types> struct tuple;
+template<int I> struct int_c;
+
+template<typename T>
+struct identity {
+ typedef T type;
+};
+
+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;
+};
+
+// FIXME: Several more bullets to go
+
+// In an initializer-list (8.5); the pattern is an initializer-clause.
+// Note: this also covers expression-lists, since expression-list is
+// just defined as initializer-list.
+void five_args(int, int, int, int, int); // expected-note{{candidate function not viable: requires 5 arguments, but 6 were provided}}
+
+template<int ...Values>
+void initializer_list_expansion() {
+ int values[5] = { Values... }; // expected-error{{excess elements in array initializer}}
+ five_args(Values...); // expected-error{{no matching function for call to 'five_args'}}
+}
+
+template void initializer_list_expansion<1, 2, 3, 4, 5>();
+template void initializer_list_expansion<1, 2, 3, 4, 5, 6>(); // expected-note{{in instantiation of function template specialization 'initializer_list_expansion<1, 2, 3, 4, 5, 6>' requested here}}
+
+namespace PR8977 {
+ struct A { };
+ template<typename T, typename... Args> void f(Args... args) {
+ T t(args...);
+ };
+
+ template void f<A>();
+}
+
+// In a base-specifier-list (Clause 10); the pattern is a base-specifier.
+template<typename ...Mixins>
+struct HasMixins : public Mixins... {
+ HasMixins();
+ HasMixins(const HasMixins&);
+ HasMixins(int i);
+};
+
+struct A { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const A' for 1st argument}} \
+// expected-note{{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
+struct B { };
+struct C { };
+struct D { };
+
+A *checkA = new HasMixins<A, B, C, D>;
+B *checkB = new HasMixins<A, B, C, D>;
+D *checkD = new HasMixins<A, B, C, D>;
+C *checkC = new HasMixins<A, B, D>; // expected-error{{cannot initialize a variable of type 'C *' with an rvalue of type 'HasMixins<A, B, D> *'}}
+HasMixins<> *checkNone = new HasMixins<>;
+
+template<typename Mixins>
+struct BrokenMixins : public Mixins... { }; // expected-error{{pack expansion does not contain any unexpanded parameter packs}}
+
+// In a mem-initializer-list (12.6.2); the pattern is a mem-initializer.
+template<typename ...Mixins>
+HasMixins<Mixins...>::HasMixins(): Mixins()... { }
+
+template<typename ...Mixins>
+HasMixins<Mixins...>::HasMixins(const HasMixins &other): Mixins(other)... { }
+
+template<typename ...Mixins>
+HasMixins<Mixins...>::HasMixins(int i): Mixins(i)... { } // expected-error{{no matching constructor for initialization of 'A'}}
+
+void test_has_mixins() {
+ HasMixins<A, B> ab;
+ HasMixins<A, B> ab2 = ab;
+ HasMixins<A, B> ab3(17); // expected-note{{in instantiation of member function 'HasMixins<A, B>::HasMixins' requested here}}
+}
+
+template<typename T>
+struct X {
+ T member;
+
+ X() : member()... { } // expected-error{{pack expansion for initialization of member 'member'}}
+};
+
+// In a template-argument-list (14.3); the pattern is a template-argument.
+template<typename ...Types>
+struct tuple_of_refs {
+ typedef tuple<Types& ...> types;
+};
+
+tuple<int&, float&> *t_int_ref_float_ref;
+tuple_of_refs<int&, float&>::types *t_int_ref_float_ref_2 = t_int_ref_float_ref;
+
+template<typename ...Types>
+struct extract_nested_types {
+ typedef tuple<typename Types::type...> types;
+};
+
+tuple<int, float> *t_int_float;
+extract_nested_types<identity<int>, identity<float> >::types *t_int_float_2
+ = t_int_float;
+
+template<int ...N>
+struct tuple_of_ints {
+ typedef tuple<int_c<N>...> type;
+};
+
+int check_temp_arg_1[is_same<tuple_of_ints<1, 2, 3, 4, 5>::type,
+ tuple<int_c<1>, int_c<2>, int_c<3>, int_c<4>,
+ int_c<5>>>::value? 1 : -1];
+
+// In a dynamic-exception-specification (15.4); the pattern is a type-id.
+template<typename ...Types>
+struct f_with_except {
+ virtual void f() throw(Types...); // expected-note{{overridden virtual function is here}}
+};
+
+struct check_f_with_except_1 : f_with_except<int, float> {
+ virtual void f() throw(int, float);
+};
+
+struct check_f_with_except_2 : f_with_except<int, float> {
+ virtual void f() throw(int);
+};
+
+struct check_f_with_except_3 : f_with_except<int, float> {
+ virtual void f() throw(int, float, double); // expected-error{{exception specification of overriding function is more lax than base version}}
+};
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
new file mode 100644
index 000000000000..1acc21eb4fd5
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -0,0 +1,393 @@
+// RUN: %clang_cc1 -fexceptions -std=c++0x -fblocks -fms-extensions -fsyntax-only -verify %s
+
+template<typename T, typename U> struct pair;
+template<typename ...> struct tuple;
+
+// A parameter pack whose name appears within the pattern of a pack
+// expansion is expanded by that pack expansion. An appearance of the
+// name of a parameter pack is only expanded by the innermost
+// enclosing pack expansion. The pattern of a pack expansion shall
+// name one or more parameter packs that are not expanded by a nested
+// pack expansion.
+template<typename... Types>
+struct Expansion {
+ typedef pair<Types..., int> expand_with_pacs; // okay
+ typedef pair<Types, int...> expand_no_packs; // expected-error{{pack expansion does not contain any unexpanded parameter packs}}
+ typedef pair<pair<Types..., int>..., int> expand_with_expanded_nested; // expected-error{{pack expansion does not contain any unexpanded parameter packs}}
+};
+
+// All of the parameter packs expanded by a pack expansion shall have
+// the same number of arguments specified.
+template<typename ...Types>
+struct ExpansionLengthMismatch {
+ template<typename ...OtherTypes>
+ struct Inner {
+ typedef tuple<pair<Types, OtherTypes>...> type; // expected-error{{pack expansion contains parameter packs 'Types' and 'OtherTypes' that have different lengths (3 vs. 2)}}
+ };
+};
+
+ExpansionLengthMismatch<int, long>::Inner<unsigned int, unsigned long>::type
+ *il_pairs;
+tuple<pair<int, unsigned int>, pair<long, unsigned long> >*il_pairs_2 = il_pairs;
+
+ExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>::type // expected-note{{in instantiation of template class 'ExpansionLengthMismatch<short, int, long>::Inner<unsigned int, unsigned long>' requested here}}
+ *il_pairs_bad;
+
+
+// An appearance of a name of a parameter pack that is not expanded is
+// ill-formed.
+
+// Test for unexpanded parameter packs in each of the type nodes.
+template<typename T, int N, typename ... Types>
+struct TestPPName
+ : public Types, public T // expected-error{{base type contains unexpanded parameter pack 'Types'}}
+{
+ // BuiltinType is uninteresting
+ // FIXME: ComplexType is uninteresting?
+ // PointerType
+ typedef Types *types_pointer; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // BlockPointerType
+ typedef Types (^block_pointer_1)(int); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ typedef int (^block_pointer_2)(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // LValueReferenceType
+ typedef Types &lvalue_ref; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // RValueReferenceType
+ typedef Types &&rvalue_ref; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // MemberPointerType
+ typedef Types TestPPName::* member_pointer_1; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ typedef int Types::*member_pointer_2; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // ConstantArrayType
+ typedef Types constant_array[17]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // IncompleteArrayType
+ typedef Types incomplete_array[]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // VariableArrayType
+ void f(int i) {
+ Types variable_array[i]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ }
+
+ // DependentSizedArrayType
+ typedef Types dependent_sized_array[N]; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // DependentSizedExtVectorType
+ typedef Types dependent_sized_ext_vector __attribute__((ext_vector_type(N))); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // VectorType is uninteresting
+
+ // ExtVectorType
+ typedef Types ext_vector __attribute__((ext_vector_type(4))); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // FunctionProtoType
+ typedef Types (function_type_1)(int); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ typedef int (function_type_2)(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // FunctionNoProtoType is uninteresting
+ // UnresolvedUsingType is uninteresting
+ // ParenType is uninteresting
+ // TypedefType is uninteresting
+
+ // TypeOfExprType
+ typedef __typeof__((static_cast<Types>(0))) typeof_expr; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // TypeOfType
+ typedef __typeof__(Types) typeof_type; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // DecltypeType
+ typedef decltype((static_cast<Types>(0))) typeof_expr; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // RecordType is uninteresting
+ // EnumType is uninteresting
+ // ElaboratedType is uninteresting
+
+ // TemplateTypeParmType
+ typedef Types template_type_parm; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // SubstTemplateTypeParmType is uninteresting
+
+ // TemplateSpecializationType
+ typedef pair<Types, int> template_specialization; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // InjectedClassName is uninteresting.
+
+ // DependentNameType
+ typedef typename Types::type dependent_name; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // DependentTemplateSpecializationType
+ typedef typename Types::template apply<int> dependent_name_1; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ typedef typename T::template apply<Types> dependent_name_2; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+
+ // ObjCObjectType is uninteresting
+ // ObjCInterfaceType is uninteresting
+ // ObjCObjectPointerType is uninteresting
+};
+
+// FIXME: Test for unexpanded parameter packs in each of the expression nodes.
+template<int ...Values>
+void test_unexpanded_in_exprs() {
+ // PredefinedExpr is uninteresting
+ // DeclRefExpr
+ Values; // expected-error{{expression contains unexpanded parameter pack 'Values'}}
+ // IntegerLiteral is uninteresting
+ // FloatingLiteral is uninteresting
+ // ImaginaryLiteral is uninteresting
+ // StringLiteral is uninteresting
+ // CharacterLiteral is uninteresting
+ (Values); // expected-error{{expression contains unexpanded parameter pack 'Values'}}
+ // UnaryOperator
+ -Values; // expected-error{{expression contains unexpanded parameter pack 'Values'}}
+ // OffsetOfExpr
+ struct OffsetMe {
+ int array[17];
+ };
+ __builtin_offsetof(OffsetMe, array[Values]); // expected-error{{expression contains unexpanded parameter pack 'Values'}}
+ // FIXME: continue this...
+}
+
+template<typename ... Types>
+void TestPPNameFunc(int i) {
+ f(static_cast<Types>(i)); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+}
+
+template<typename T, template<class> class ...Meta>
+struct TestUnexpandedTTP {
+ typedef tuple<typename Meta<T>::type> type; // expected-error{{declaration type contains unexpanded parameter pack 'Meta'}}
+};
+
+// Test for unexpanded parameter packs in declarations.
+// FIXME: Attributes?
+template<typename T, typename... Types>
+struct TestUnexpandedDecls : T{
+ void member_function(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ void member_function () throw(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ operator Types() const; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ Types data_member; // expected-error{{data member type contains unexpanded parameter pack 'Types'}}
+ static Types static_data_member; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ unsigned bit_field : static_cast<Types>(0); // expected-error{{bit-field size contains unexpanded parameter pack 'Types'}}
+ static_assert(static_cast<Types>(0), "Boom"); // expected-error{{static assertion contains unexpanded parameter pack 'Types'}}
+
+ enum E0 : Types { // expected-error{{fixed underlying type contains unexpanded parameter pack 'Types'}}
+ EnumValue = static_cast<Types>(0) // expected-error{{enumerator value contains unexpanded parameter pack 'Types'}}
+ };
+
+ using typename Types::type; // expected-error{{using declaration contains unexpanded parameter pack 'Types'}}
+ using Types::value; // expected-error{{using declaration contains unexpanded parameter pack 'Types'}}
+ using T::operator Types; // expected-error{{using declaration contains unexpanded parameter pack 'Types'}}
+
+ friend class Types::foo; // expected-error{{friend declaration contains unexpanded parameter pack 'Types'}}
+ friend void friend_func(Types); // expected-error{{friend declaration contains unexpanded parameter pack 'Types'}}
+ friend void Types::other_friend_func(int); // expected-error{{friend declaration contains unexpanded parameter pack 'Types'}}
+
+ void test_initializers() {
+ T copy_init = static_cast<Types>(0); // expected-error{{initializer contains unexpanded parameter pack 'Types'}}
+ T direct_init(0, static_cast<Types>(0)); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ T list_init = { static_cast<Types>(0) }; // expected-error{{initializer contains unexpanded parameter pack 'Types'}}
+ }
+
+ void default_function_args(T = static_cast<Types>(0)); // expected-error{{default argument contains unexpanded parameter pack 'Types'}}
+
+ template<typename = Types*> // expected-error{{default argument contains unexpanded parameter pack 'Types'}}
+ struct default_template_args_1;
+ template<int = static_cast<Types>(0)> // expected-error{{default argument contains unexpanded parameter pack 'Types'}}
+ struct default_template_args_2;
+ template<template<typename> class = Types::template apply> // expected-error{{default argument contains unexpanded parameter pack 'Types'}}
+ struct default_template_args_3;
+
+ template<Types value> // expected-error{{non-type template parameter type contains unexpanded parameter pack 'Types'}}
+ struct non_type_template_param_type;
+
+ void decls_in_stmts() {
+ 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'}}
+ 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'}}
+ try {
+ } catch (Types*) { // expected-error{{exception type contains unexpanded parameter pack 'Types'}}
+ }
+ }
+};
+
+// FIXME: Test for unexpanded parameter packs in each of the statements.
+struct X {
+ void f(int, int);
+ template<typename ...Types>
+ void f(Types...);
+};
+
+namespace std {
+ class type_info;
+}
+
+typedef struct _GUID {
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[ 8 ];
+} GUID;
+
+template<typename T, typename ...Types>
+void test_unexpanded_exprs(Types ...values) {
+ // CXXOperatorCallExpr
+ (void)(values + 0); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ (void)(0 + values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXMemberCallExpr
+ values.f(); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ X x;
+ x.f(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ x.Types::f(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ x.f<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // CXXStaticCastExpr
+ (void)static_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}}
+
+ // CXXDynamicCastExpr
+ (void)dynamic_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}}
+
+ // CXXReinterpretCastExpr
+ (void)reinterpret_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}}
+
+ // CXXConstCastExpr
+ (void)const_cast<Types&>(values); // expected-error{{expression contains unexpanded parameter packs 'Types' and 'values'}}
+
+ // CXXTypeidExpr
+ (void)typeid(Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ (void)typeid(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXUuidofExpr
+ (void)__uuidof(Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ (void)__uuidof(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXThisExpr is uninteresting
+
+ // CXXThrowExpr
+ throw Types(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ throw values; // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXDefaultArgExpr is uninteresting
+
+ // CXXBindTemporaryExpr is uninteresting
+
+ // CXXConstructExpr is uninteresting
+
+ // CXXFunctionalCastExpr
+ (void)Types(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // CXXTemporaryObjectExpr
+ (void)X(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXScalarValueInitExpr is uninteresting
+
+ // CXXNewExpr
+ (void)new Types; // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ (void)new X(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ (void)new (values) X(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ (void)new X [values]; // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXDeleteExpr
+ delete values; // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ delete [] values; // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXPseudoDestructorExpr
+ T t;
+ values.~T(); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ t.~Types(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ t.Types::~T(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // UnaryTypeTraitExpr
+ __is_pod(Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // BinaryTypeTraitExpr
+ __is_base_of(Types, T); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ __is_base_of(T, Types); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // UnresolvedLookupExpr
+ test_unexpanded_exprs(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ test_unexpanded_exprs<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // DependentScopeDeclRefExpr
+ Types::test_unexpanded_exprs(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ T::template test_unexpanded_exprs<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // CXXUnresolvedConstructExpr
+ Types(5); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // CXXDependentScopeMemberExpr
+ values.foo(); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ t.foo(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // FIXME: There's an evil ambiguity here, because we don't know if
+ // Types refers to the template type parameter pack in scope or a
+ // non-pack member.
+ // t.Types::foo();
+
+ t.template foo<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+
+ // UnresolvedMemberExpr
+ x.f<Types>(); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
+ x.f(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // CXXNoexceptExpr
+ noexcept(values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
+
+ // PackExpansionExpr is uninteresting
+ // SizeOfPackExpr is uninteresting
+
+ // FIXME: Objective-C expressions will need to go elsewhere
+}
+
+// Test unexpanded parameter packs in partial specializations.
+template<typename ...Types>
+struct TestUnexpandedDecls<int, Types>; // expected-error{{partial specialization contains unexpanded parameter pack 'Types'}}
+
+// Test for diagnostics in the presence of multiple unexpanded
+// parameter packs.
+template<typename T, typename U> struct pair;
+
+template<typename ...OuterTypes>
+struct MemberTemplatePPNames {
+ template<typename ...InnerTypes>
+ struct Inner {
+ typedef pair<OuterTypes, InnerTypes>* types; // expected-error{{declaration type contains unexpanded parameter packs 'OuterTypes' and 'InnerTypes'}}
+
+ template<typename ...VeryInnerTypes>
+ struct VeryInner {
+ typedef pair<pair<VeryInnerTypes, OuterTypes>, pair<InnerTypes, OuterTypes> > types; // expected-error{{declaration type contains unexpanded parameter packs 'VeryInnerTypes', 'OuterTypes', ...}}
+ };
+ };
+};
+
+// Example from working paper
+namespace WorkingPaperExample {
+ template<typename...> struct Tuple {};
+ template<typename T1, typename T2> struct Pair {};
+
+ template<class ... Args1> struct zip {
+ template<class ... Args2> struct with {
+ typedef Tuple<Pair<Args1, Args2> ... > type; // expected-error{{pack expansion contains parameter packs 'Args1' and 'Args2' that have different lengths (1 vs. 2)}}
+ };
+ };
+
+ typedef zip<short, int>::with<unsigned short, unsigned>::type T1; // T1 is Tuple<Pair<short, unsigned short>, Pair<int, unsigned>>
+ typedef Tuple<Pair<short, unsigned short>, Pair<int, unsigned>> T1;
+
+ typedef zip<short>::with<unsigned short, unsigned>::type T2; // expected-note{{in instantiation of template class}}
+
+ template<class ... Args> void f(Args...);
+ template<class ... Args> void h(Args...);
+
+ template<class ... Args>
+ void g(Args ... args) {
+ f(const_cast<const Args*>(&args)...); // OK: "Args" and "args" are expanded within f
+ f(5 ...); // expected-error{{pack expansion does not contain any unexpanded parameter packs}}
+ f(args); // expected-error{{expression contains unexpanded parameter pack 'args'}}
+ f(h(args ...) + args ...);
+ }
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp
index 7352be2d72f0..989ff9f6d9f5 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp
@@ -11,11 +11,33 @@ template<typename T> struct X1t; // expected-error{{template type parameter conf
template<typename T> struct X2t; // expected-note{{previous template type parameter declared here}}
template<typename ...T> struct X2t; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
-template<template<typename ...T> class> struct X0tt;
-template<template<typename ...T> class> struct X0tt;
+template<template<typename ...T> class> struct X0t_intt;
+template<template<typename ...T> class> struct X0t_intt;
-template<template<typename ...T> class> struct X1tt; // expected-note{{previous template type parameter pack declared here}}
-template<template<typename T> class> struct X1tt; // expected-error{{template type parameter conflicts with previous template type parameter pack}}
+template<template<typename ...T> class> struct X1t_intt; // expected-note{{previous template type parameter pack declared here}}
+template<template<typename T> class> struct X1t_intt; // expected-error{{template type parameter conflicts with previous template type parameter pack}}
-template<template<typename T> class> struct X2tt; // expected-note{{previous template type parameter declared here}}
-template<template<typename ...T> class> struct X2tt; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
+template<template<typename T> class> struct X2t_intt; // expected-note{{previous template type parameter declared here}}
+template<template<typename ...T> class> struct X2t_intt; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
+
+template<int ...Values> struct X1nt; // expected-note{{previous non-type template parameter pack declared here}}
+template<int Values> struct X1nt; // expected-error{{non-type template parameter conflicts with previous non-type template parameter pack}}
+
+template<template<class T> class> class X1tt; // expected-note{{previous template template parameter declared here}}
+template<template<class T> class...> class X1tt; // expected-error{{template template parameter pack conflicts with previous template template parameter}}
+
+// Check for matching with out-of-line definitions
+namespace rdar8859985 {
+ template<typename ...> struct tuple { };
+ template<int ...> struct int_tuple { };
+
+ template<typename T>
+ struct X {
+ template<typename ...Args1, int ...Indices1>
+ X(tuple<Args1...>, int_tuple<Indices1...>);
+ };
+
+ template<typename T>
+ template<typename ...Args1, int ...Indices1>
+ X<T>::X(tuple<Args1...>, int_tuple<Indices1...>) {}
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp
new file mode 100644
index 000000000000..372317838e74
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Various tests related to partial ordering of variadic templates.
+template<typename ...Types> struct tuple;
+
+template<typename Tuple>
+struct X1 {
+ static const unsigned value = 0;
+};
+
+template<typename Head, typename ...Tail>
+struct X1<tuple<Head, Tail...> > {
+ static const unsigned value = 1;
+};
+
+template<typename Head, typename ...Tail>
+struct X1<tuple<Head, Tail&...> > {
+ static const unsigned value = 2;
+};
+
+template<typename Head, typename ...Tail>
+struct X1<tuple<Head&, Tail&...> > {
+ static const unsigned value = 3;
+};
+
+int check0[X1<tuple<>>::value == 0? 1 : -1];
+int check1[X1<tuple<int>>::value == 2? 1 : -1];
+int check2[X1<tuple<int, int>>::value == 1? 1 : -1];
+int check3[X1<tuple<int, int&>>::value == 2? 1 : -1];
+int check4[X1<tuple<int&, int&>>::value == 3? 1 : -1];
+
+// Partial ordering of function templates.
+template<typename T1, typename T2, typename ...Rest>
+int &f0(T1, T2, Rest...);
+
+template<typename T1, typename T2>
+float &f0(T1, T2);
+
+void test_f0() {
+ int &ir1 = f0(1, 2.0, 'a');
+ float &fr1 = f0(1, 2.0);
+}
+
+template<typename T1, typename T2, typename ...Rest>
+int &f1(T1, T2, Rest...);
+
+template<typename T1, typename T2>
+float &f1(T1, T2, ...);
+
+void test_f1() {
+ int &ir1 = f1(1, 2.0, 'a');
+}
+
+template<typename T1, typename T2, typename ...Rest>
+int &f2(T1, T2, Rest...);
+
+float &f2(...);
+
+void test_f2() {
+ int &ir1 = f2(1, 2.0, 'a');
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
new file mode 100644
index 000000000000..46d70b671f6e
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+namespace ParameterPacksWithFunctions {
+ template<typename ...> struct count;
+
+ template<typename Head, typename ...Tail>
+ struct count<Head, Tail...> {
+ static const unsigned value = 1 + count<Tail...>::value;
+ };
+
+ template<>
+ struct count<> {
+ static const unsigned value = 0;
+ };
+
+ template<unsigned> struct unsigned_c { };
+
+ template<typename ... Types>
+ unsigned_c<count<Types...>::value> f();
+
+ void test_f() {
+ unsigned_c<0> uc0a = f(); // okay, deduced to an empty pack
+ unsigned_c<0> uc0b = f<>();
+ unsigned_c<1> uc1 = f<int>();
+ unsigned_c<2> uc2 = f<float, double>();
+ }
+}
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 eb5465cc19bb..9ec8f0c90e17 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
@@ -33,4 +33,4 @@ template <typename T> void g(T);
template <typename T> void g(T, T);
int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \
- // expected-error{{cannot determine the type of an overloaded function}}
+ // expected-error{{cannot resolve overloaded function from context}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
new file mode 100644
index 000000000000..b38cc2760937
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Metafunction to extract the Nth type from a set of types.
+template<unsigned N, typename ...Types> struct get_nth_type;
+
+template<unsigned N, typename Head, typename ...Tail>
+struct get_nth_type<N, Head, Tail...> : get_nth_type<N-1, Tail...> { };
+
+template<typename Head, typename ...Tail>
+struct get_nth_type<0, Head, Tail...> {
+ typedef Head type;
+};
+
+// Placeholder type when get_nth_type fails.
+struct no_type {};
+
+template<unsigned N>
+struct get_nth_type<N> {
+ typedef no_type type;
+};
+
+template<typename ...Args>
+typename get_nth_type<0, Args...>::type first_arg(Args...);
+
+template<typename ...Args>
+typename get_nth_type<1, Args...>::type second_arg(Args...);
+
+// Test explicit specification of function template arguments.
+void test_explicit_spec_simple() {
+ int *ip1 = first_arg<int *>(0);
+ int *ip2 = first_arg<int *, float*>(0, 0);
+ float *fp1 = first_arg<float *, double*, int*>(0, 0, 0);
+}
+
+// Template argument deduction can extend the sequence of template
+// arguments corresponding to a template parameter pack, even when the
+// sequence contains explicitly specified template arguments.
+void test_explicit_spec_extension(double *dp) {
+ int *ip1 = first_arg<int *>(0, 0);
+ int *ip2 = first_arg<int *, float*>(0, 0, 0, 0);
+ float *fp1 = first_arg<float *, double*, int*>(0, 0, 0);
+ int *i1 = second_arg<float *>(0, (int*)0, 0);
+ double *dp1 = first_arg<>(dp);
+}
+
+template<typename ...Types>
+struct tuple { };
+
+template<typename ...Types>
+void accept_tuple(tuple<Types...>);
+
+void test_explicit_spec_extension_targs(tuple<int, float, double> t3) {
+ accept_tuple(t3);
+ accept_tuple<int, float, double>(t3);
+ accept_tuple<int>(t3);
+ accept_tuple<int, float>(t3);
+}
+
+template<typename R, typename ...ParmTypes>
+void accept_function_ptr(R(*)(ParmTypes...));
+
+void test_explicit_spec_extension_funcparms(int (*f3)(int, float, double)) {
+ accept_function_ptr(f3);
+ accept_function_ptr<int>(f3);
+ accept_function_ptr<int, int>(f3);
+ accept_function_ptr<int, int, float>(f3);
+ accept_function_ptr<int, int, float, double>(f3);
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
new file mode 100644
index 000000000000..8933b63ee6df
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
@@ -0,0 +1,88 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Metafunction to extract the Nth type from a set of types.
+template<unsigned N, typename ...Types> struct get_nth_type;
+
+template<unsigned N, typename Head, typename ...Tail>
+struct get_nth_type<N, Head, Tail...> : get_nth_type<N-1, Tail...> { };
+
+template<typename Head, typename ...Tail>
+struct get_nth_type<0, Head, Tail...> {
+ typedef Head type;
+};
+
+// Placeholder type when get_nth_type fails.
+struct no_type {};
+
+template<unsigned N>
+struct get_nth_type<N> {
+ typedef no_type type;
+};
+
+template<typename T, typename U> struct pair { };
+template<typename T, typename U> pair<T, U> make_pair(T, U);
+
+// For a function parameter pack that occurs at the end of the
+// parameter-declaration-list, the type A of each remaining argument
+// of the call is compared with the type P of the declarator-id of the
+// function parameter pack.
+template<typename ...Args>
+typename get_nth_type<0, Args...>::type first_arg(Args...);
+
+template<typename ...Args>
+typename get_nth_type<1, Args...>::type second_arg(Args...);
+
+void test_simple_deduction(int *ip, float *fp, double *dp) {
+ int *ip1 = first_arg(ip);
+ int *ip2 = first_arg(ip, fp);
+ int *ip3 = first_arg(ip, fp, dp);
+ no_type nt1 = first_arg();
+}
+
+template<typename ...Args>
+typename get_nth_type<0, Args...>::type first_arg_ref(Args&...);
+
+template<typename ...Args>
+typename get_nth_type<1, Args...>::type second_arg_ref(Args&...);
+
+void test_simple_ref_deduction(int *ip, float *fp, double *dp) {
+ int *ip1 = first_arg_ref(ip);
+ int *ip2 = first_arg_ref(ip, fp);
+ int *ip3 = first_arg_ref(ip, fp, dp);
+ no_type nt1 = first_arg_ref();
+}
+
+
+template<typename ...Args1, typename ...Args2>
+typename get_nth_type<0, Args1...>::type first_arg_pair(pair<Args1, Args2>...); // expected-note{{candidate template ignored: failed template argument deduction}}
+
+template<typename ...Args1, typename ...Args2>
+typename get_nth_type<1, Args1...>::type second_arg_pair(pair<Args1, Args2>...);
+
+void test_pair_deduction(int *ip, float *fp, double *dp) {
+ int *ip1 = first_arg_pair(make_pair(ip, 17));
+ int *ip2 = first_arg_pair(make_pair(ip, 17), make_pair(fp, 17));
+ int *ip3 = first_arg_pair(make_pair(ip, 17), make_pair(fp, 17),
+ make_pair(dp, 17));
+ float *fp1 = second_arg_pair(make_pair(ip, 17), make_pair(fp, 17));
+ float *fp2 = second_arg_pair(make_pair(ip, 17), make_pair(fp, 17),
+ make_pair(dp, 17));
+ no_type nt1 = first_arg_pair();
+ no_type nt2 = second_arg_pair();
+ no_type nt3 = second_arg_pair(make_pair(ip, 17));
+
+
+ first_arg_pair(make_pair(ip, 17), 16); // expected-error{{no matching function for call to 'first_arg_pair'}}
+}
+
+// For a function parameter pack that does not occur at the end of the
+// parameter-declaration-list, the type of the parameter pack is a
+// non-deduced context.
+template<typename ...Types> struct tuple { };
+
+template<typename ...Types>
+void pack_not_at_end(tuple<Types...>, Types... values, int);
+
+void test_pack_not_at_end(tuple<int*, double*> t2) {
+ pack_not_at_end(t2, 0, 0, 0);
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
new file mode 100644
index 000000000000..f18a74a1e4ef
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+
+// If P is an rvalue reference to a cv-unqualified template parameter
+// and the argument is an lvalue, the type "lvalue reference to A" is
+// used in place of A for type deduction.
+template<typename T> struct X { };
+
+template<typename T> X<T> f0(T&&);
+
+struct Y { };
+
+template<typename T> T prvalue();
+template<typename T> T&& xvalue();
+template<typename T> T& lvalue();
+
+void test_f0() {
+ X<int> xi0 = f0(prvalue<int>());
+ X<int> xi1 = f0(xvalue<int>());
+ X<int&> xi2 = f0(lvalue<int>());
+ X<Y> xy0 = f0(prvalue<Y>());
+ X<Y> xy1 = f0(xvalue<Y>());
+ X<Y&> xy2 = f0(lvalue<Y>());
+}
+
+template<typename T> X<T> f1(const T&&); // expected-note{{candidate function [with T = int] not viable: no known conversion from 'int' to 'const int &&' for 1st argument}} \
+// expected-note{{candidate function [with T = Y] not viable: no known conversion from 'Y' to 'const Y &&' for 1st argument}}
+
+void test_f1() {
+ X<int> xi0 = f1(prvalue<int>());
+ X<int> xi1 = f1(xvalue<int>());
+ f1(lvalue<int>()); // expected-error{{no matching function for call to 'f1'}}
+ X<Y> xy0 = f1(prvalue<Y>());
+ X<Y> xy1 = f1(xvalue<Y>());
+ f1(lvalue<Y>()); // expected-error{{no matching function for call to 'f1'}}
+}
+
+namespace std_example {
+ template <class T> int f(T&&);
+ template <class T> int g(const T&&); // expected-note{{candidate function [with T = int] not viable: no known conversion from 'int' to 'const int &&' for 1st argument}}
+
+ int i;
+ int n1 = f(i);
+ int n2 = f(0);
+ int n3 = g(i); // expected-error{{no matching function for call to 'g'}}
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
index 19962c534909..3c22cf349c9f 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
@@ -101,3 +101,25 @@ void test_f4(D d, E e, F f, G g) {
C<int, 1> *ci3c = f4c(&g);
int *ip1 = f4c(&f);
}
+
+// PR8462
+namespace N {
+ struct T0;
+ struct T1;
+
+ template<typename X, typename Y> struct B {};
+
+ struct J : B<T0,T0> {};
+ struct K : B<T1,T1> {};
+
+ struct D : J, K {};
+
+ template<typename X, typename Y> void F(B<Y,X>);
+
+ void test()
+ {
+ D d;
+ N::F<T0>(d); // Fails
+ N::F<T1>(d); // OK
+ }
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
index 99ade4bc9974..01155e136aad 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p11.cpp
@@ -13,10 +13,35 @@ struct identity {
};
template <class T>
- T* f2(int, typename identity<T>::type = 0); // expected-note{{candidate}}
+ T* f2(int, typename identity<T>::type = 0);
template <class T, class U>
- T& f2(U, typename identity<T>::type = 0); // expected-note{{candidate}}
+ T& f2(U, typename identity<T>::type = 0);
void g2() {
- f2<int>(1); // expected-error{{ambiguous}}
+ int* ip = f2<int>(1);
+}
+
+template<class T, class U> struct A { };
+
+template<class T, class U> inline int *f3( U, A<U,T>* p = 0 ); // #1 expected-note{{candidate function [with T = int, U = int]}}
+template< class U> inline float *f3( U, A<U,U>* p = 0 ); // #2 expected-note{{candidate function [with U = int]}}
+
+void g3() {
+ float *fp = f3<int>( 42, (A<int,int>*)0 ); // Ok, picks #2.
+ f3<int>( 42 ); // expected-error{{call to 'f3' is ambiguous}}
+
+}
+
+namespace PR9006 {
+ struct X {
+ template <class Get>
+ int &f(char const* name, Get fget, char const* docstr = 0);
+
+ template <class Get, class Set>
+ float &f(char const* name, Get fget, Set fset, char const* docstr = 0);
+ };
+
+ void test(X x) {
+ int &ir = x.f("blah", 0, "blah");
+ }
}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
new file mode 100644
index 000000000000..116810082d9f
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Note: Partial ordering of function templates containing template
+// parameter packs is independent of the number of deduced arguments
+// for those template parameter packs.
+template<class ...> struct Tuple { };
+template<class ... Types> int &g(Tuple<Types ...>); // #1
+template<class T1, class ... Types> float &g(Tuple<T1, Types ...>); // #2
+template<class T1, class ... Types> double &g(Tuple<T1, Types& ...>); // #3
+
+void test_g() {
+ int &ir1 = g(Tuple<>());
+ float &fr1 = g(Tuple<int, float>());
+ double &dr1 = g(Tuple<int, float&>());
+ double &dr2 = g(Tuple<int>());
+}
+
+template<class ... Types> int &h(int (*)(Types ...)); // #1
+template<class T1, class ... Types> float &h(int (*)(T1, Types ...)); // #2
+template<class T1, class ... Types> double &h(int (*)(T1, Types& ...)); // #3
+
+void test_h() {
+ int &ir1 = h((int(*)())0);
+ float &fr1 = h((int(*)(int, float))0);
+ double &dr1 = h((int(*)(int, float&))0);
+ double &dr2 = h((int(*)(int))0);
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
new file mode 100644
index 000000000000..46ea4db779ce
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T> int &f0(T&);
+template<typename T> float &f0(T&&);
+
+// Core issue 1164
+void test_f0(int i) {
+ int &ir0 = f0(i);
+ float &fr0 = f0(5);
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
new file mode 100644
index 000000000000..9d342c8f8ed6
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+template<typename T> void f(T&&);
+template<> void f(int&) { }
+void (*fp)(int&) = &f;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
new file mode 100644
index 000000000000..198f11fe5298
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// If type deduction cannot be done for any P/A pair, or if for any
+// pair the deduction leads to more than one possible set of deduced
+// values, or if different pairs yield different deduced values, or if
+// any template argument remains neither deduced nor explicitly
+// specified, template argument deduction fails.
+
+template<typename ...> struct tuple;
+
+template<typename T, typename U>
+struct same_tuple {
+ static const bool value = false;
+};
+
+template<typename ...Types1>
+struct same_tuple<tuple<Types1...>, tuple<Types1...> > {
+ static const bool value = true;
+};
+
+int same_tuple_check1[same_tuple<tuple<int, float>, tuple<int, double>>::value? -1 : 1];
+int same_tuple_check2[same_tuple<tuple<float, double>, tuple<float, double>>::value? 1 : -1];
+
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
new file mode 100644
index 000000000000..247b98113ae5
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Note: Template argument deduction involving parameter packs
+// (14.5.3) can deduce zero or more arguments for each parameter pack.
+
+template<class> struct X {
+ static const unsigned value = 0;
+};
+
+template<class R, class ... ArgTypes> struct X<R(int, ArgTypes ...)> {
+ static const unsigned value = 1;
+};
+
+template<class ... Types> struct Y {
+ static const unsigned value = 0;
+};
+
+template<class T, class ... Types> struct Y<T, Types& ...> {
+ static const unsigned value = 1;
+};
+
+template<class ... Types> int f(void (*)(Types ...));
+void g(int, float);
+
+int check0[X<int>::value == 0? 1 : -1]; // uses primary template
+int check1[X<int(int, float, double)>::value == 1? 1 : -1]; // uses partial specialization
+int check2[X<int(float, int)>::value == 0? 1 : -1]; // uses primary template
+int check3[Y<>::value == 0? 1 : -1]; // uses primary template
+int check4[Y<int&, float&, double&>::value == 1? 1 : -1]; // uses partial specialization
+int check5[Y<int, float, double>::value == 0? 1 : -1]; // uses primary template
+int fv = f(g); // okay
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
new file mode 100644
index 000000000000..4326a691cb2e
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// If the original function parameter associated with A is a function
+// parameter pack and the function parameter associated with P is not
+// a function parameter pack, then template argument deduction fails.
+template<class ... Args> int& f(Args ... args);
+template<class T1, class ... Args> float& f(T1 a1, Args ... args);
+template<class T1, class T2> double& f(T1 a1, T2 a2);
+
+void test_f() {
+ int &ir1 = f();
+ float &fr1 = f(1, 2, 3);
+ double &dr1 = f(1, 2);
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
new file mode 100644
index 000000000000..cf68a01a3593
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// FIXME: More bullets to go!
+
+template<typename T, typename U>
+struct has_nondeduced_pack_test {
+ static const bool value = false;
+};
+
+template<typename R, typename FirstType, typename ...Types>
+struct has_nondeduced_pack_test<R(FirstType, Types..., int),
+ R(FirstType, Types...)> {
+ static const bool value = true;
+};
+
+// - A function parameter pack that does not occur at the end of the
+// parameter-declaration-clause.
+int check_nondeduced_pack_test0[
+ has_nondeduced_pack_test<int(float, double, int),
+ int(float, double)>::value? 1 : -1];
+
+
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
new file mode 100644
index 000000000000..a9173fd6be86
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// Deductions specific to C++0x.
+
+template<typename T>
+struct member_pointer_kind {
+ static const unsigned value = 0;
+};
+
+template<class C, typename R, typename ...Args>
+struct member_pointer_kind<R (C::*)(Args...)> {
+ static const unsigned value = 1;
+};
+
+template<class C, typename R, typename ...Args>
+struct member_pointer_kind<R (C::*)(Args...) &> {
+ static const unsigned value = 2;
+};
+
+template<class C, typename R, typename ...Args>
+struct member_pointer_kind<R (C::*)(Args...) &&> {
+ static const unsigned value = 3;
+};
+
+template<class C, typename R, typename ...Args>
+struct member_pointer_kind<R (C::*)(Args...) const> {
+ static const unsigned value = 4;
+};
+
+template<class C, typename R, typename ...Args>
+struct member_pointer_kind<R (C::*)(Args...) const &> {
+ static const unsigned value = 5;
+};
+
+template<class C, typename R, typename ...Args>
+struct member_pointer_kind<R (C::*)(Args...) const &&> {
+ static const unsigned value = 6;
+};
+
+struct X { };
+
+static_assert(member_pointer_kind<int (X::*)(int)>::value == 1, "");
+static_assert(member_pointer_kind<int (X::*)(int) &>::value == 2, "");
+static_assert(member_pointer_kind<int (X::*)(int) &&>::value == 3, "");
+static_assert(member_pointer_kind<int (X::*)(int) const>::value == 4, "");
+static_assert(member_pointer_kind<int (X::*)(int) const&>::value == 5, "");
+static_assert(member_pointer_kind<int (X::*)(int) const&&>::value == 6, "");
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
new file mode 100644
index 000000000000..508722437c39
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename ...Types> struct tuple;
+template<unsigned> struct unsigned_c;
+
+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 PackExpansionNotAtEnd {
+ template<typename T, typename U>
+ struct tuple_same_with_int {
+ static const bool value = false;
+ };
+
+ template<typename ...Types>
+ struct tuple_same_with_int<tuple<Types...>, tuple<Types..., int>> {
+ static const bool value = true;
+ };
+
+ int tuple_same_with_int_1[tuple_same_with_int<tuple<int, float, double>,
+ tuple<int, float, double, int>
+ >::value? 1 : -1];
+
+ template<typename ... Types> struct UselessPartialSpec;
+
+ template<typename ... Types, // expected-note{{non-deducible template parameter 'Types'}}
+ typename Tail> // expected-note{{non-deducible template parameter 'Tail'}}
+ struct UselessPartialSpec<Types..., Tail>; // expected-warning{{class template partial specialization contains template parameters that can not be deduced; this partial specialization will never be used}}
+}
+
+namespace DeduceNonTypeTemplateArgsInArray {
+ template<typename ...ArrayTypes>
+ struct split_arrays;
+
+ template<typename ...ElementTypes, unsigned ...Bounds>
+ struct split_arrays<ElementTypes[Bounds]...> {
+ typedef tuple<ElementTypes...> element_types;
+
+ // FIXME: Would like to have unsigned_tuple<Bounds...> here.
+ typedef tuple<unsigned_c<Bounds>...> bounds_types;
+ };
+
+ int check1[is_same<split_arrays<int[1], float[2], double[3]>::element_types,
+ tuple<int, float, double>>::value? 1 : -1];
+ int check2[is_same<split_arrays<int[1], float[2], double[3]>::bounds_types,
+ tuple<unsigned_c<1>, unsigned_c<2>, unsigned_c<3>>
+ >::value? 1 : -1];
+}
diff --git a/test/CXX/temp/temp.param/p1.cpp b/test/CXX/temp/temp.param/p1.cpp
index 676bffe31dc5..e9a978961769 100644
--- a/test/CXX/temp/temp.param/p1.cpp
+++ b/test/CXX/temp/temp.param/p1.cpp
@@ -1,4 +1,12 @@
// Suppress 'no run line' failure.
-// RUN: echo ok
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-// Paragraph 1 is descriptive, and therefore requires no tests.
+template<template<> class C> class D; // expected-error{{template template parameter must have its own template parameters}}
+
+
+struct A {};
+template<class M,
+ class T = A, // expected-note{{previous default template argument defined here}}
+ class C> // expected-error{{template parameter missing a default argument}}
+class X0 {}; // expected-note{{template is declared here}}
+X0<int> x0; // expected-error{{too few template arguments for class template 'X0'}}
diff --git a/test/CXX/temp/temp.param/p11-0x.cpp b/test/CXX/temp/temp.param/p11-0x.cpp
new file mode 100644
index 000000000000..0bf4341cf8d7
--- /dev/null
+++ b/test/CXX/temp/temp.param/p11-0x.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// If a template-parameter of a class template has a default
+// template-argument, each subsequent template-parameter shall either
+// have a default template-argument supplied or be a template
+// parameter pack.
+template<typename> struct vector;
+
+template<typename T = int, typename ...Types> struct X2t;
+template<int V = 0, int ...Values> struct X2nt;
+template<template<class> class M = vector, template<class> class... Metas>
+ struct X2tt;
+
+// If a template-parameter of a primary class template is a template
+// parameter pack, it shall be the last template-parameter .
+template<typename ...Types, // expected-error{{template parameter pack must be the last template parameter}}
+ int After>
+struct X0t;
+
+template<int ...Values, // expected-error{{template parameter pack must be the last template parameter}}
+ int After>
+struct X0nt;
+
+template<template<typename> class ...Templates, // expected-error{{template parameter pack must be the last template parameter}}
+ int After>
+struct X0tt;
+
+// [ Note: These are not requirements for function templates or class
+// template partial specializations because template arguments can be
+// deduced (14.8.2). -- end note]
+template<typename... Types> struct X1t;
+template<typename ...Types, typename T> struct X1t<T, Types...> { };
+
+template<int... Values> struct X1nt;
+template<int ...Values, int V> struct X1nt<V, Values...> { };
+
+template<template<int> class... Meta> struct X1tt;
+template<template<int> class... Meta, template<int> class M>
+ struct X1tt<M, Meta...> { };
+
+template<typename ...Types, typename T>
+void f1t(X1t<T, Types...>);
+
+template<int ...Values, int V>
+void f1nt(X1nt<V, Values...>);
+
+template<template<int> class... Meta, template<int> class M>
+void f1tt(X1tt<M, Meta...>);
+
+namespace DefaultTemplateArgsInFunction {
+ template<typename T = int, typename U> T &f0(U) { T *x = 0; return *x; }
+
+ void test_f0() {
+ int &ir0 = f0(3.14159);
+ int &ir1 = f0<int>(3.14159);
+ float &fr0 = f0<float>(3.14159);
+ }
+
+ template<> int &f0(int*);
+ template int &f0(double&);
+}
diff --git a/test/CXX/temp/temp.param/p15-cxx0x.cpp b/test/CXX/temp/temp.param/p15-cxx0x.cpp
index 0ce669979c11..f4be5b960b6c 100644
--- a/test/CXX/temp/temp.param/p15-cxx0x.cpp
+++ b/test/CXX/temp/temp.param/p15-cxx0x.cpp
@@ -20,3 +20,5 @@ void f(const X<int> x) {
X<X<int>> *x1;
}
+template<typename T = void> struct X1 { };
+X1<X1<>> x1a;
diff --git a/test/CXX/temp/temp.param/p9-0x.cpp b/test/CXX/temp/temp.param/p9-0x.cpp
new file mode 100644
index 000000000000..17eca7f7e85d
--- /dev/null
+++ b/test/CXX/temp/temp.param/p9-0x.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// A default template-argument may be specified for any kind of
+// template-parameter that is not a template parameter pack.
+template<typename ...Types = int> // expected-error{{template parameter pack cannot have a default argument}}
+struct X0;
+
+template<int ...Values = 0> // expected-error{{template parameter pack cannot have a default argument}}
+struct X1;
+
+template<typename T> struct vector;
+
+template<template<class> class ...Templates = vector> // expected-error{{template parameter pack cannot have a default argument}}
+struct X2;
+
+struct X3 {
+ template<typename T = int> // expected-error{{default template argument not permitted on a friend template}}
+ friend void f0(X3);
+
+ template<typename T = int>
+ friend void f1(X3) {
+ }
+};
+
+namespace PR8748 {
+ // Testcase 1
+ struct A0 { template<typename U> struct B; };
+ template<typename U = int> struct A0::B { };
+
+ // Testcase 2
+ template<typename T> struct A1 { template<typename U> struct B; };
+ template<typename T> template<typename U = int> struct A1<T>::B { }; // expected-error{{cannot add a default template argument to the definition of a member of a class template}}
+
+ // Testcase 3
+ template<typename T>
+ struct X2 {
+ void f0();
+ template<typename U> void f1();
+ };
+
+ template<typename T = int> void X2<T>::f0() { } // expected-error{{cannot add a default template argument to the definition of a member of a class template}}
+ template<typename T> template<typename U = int> void X2<T>::f1() { } // expected-error{{cannot add a default template argument to the definition of a member of a class template}}
+
+ namespace Inner {
+ template<typename T> struct X3;
+ template<typename T> void f2();
+ }
+
+ // Okay; not class members.
+ template<typename T = int> struct Inner::X3 { };
+ template<typename T = int> void Inner::f2() {}
+}
diff --git a/test/CXX/temp/temp.param/p9.cpp b/test/CXX/temp/temp.param/p9.cpp
index 625477c4e7b6..62af522cd2c9 100644
--- a/test/CXX/temp/temp.param/p9.cpp
+++ b/test/CXX/temp/temp.param/p9.cpp
@@ -2,9 +2,9 @@
// A default template-argument shall not be specified in a function
// template declaration or a function template definition
-template<typename T = int> // expected-error{{cannot have a default argument}}
+template<typename T = int> // expected-warning{{default template arguments for a function template are a C++0x extension}}
void foo0(T);
-template<typename T = int> // expected-error{{cannot have a default argument}}
+template<typename T = int> // expected-warning{{default template arguments for a function template are a C++0x extension}}
void foo1(T) { }
// [...] nor in the template-parameter-list of the definition of a
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
new file mode 100644
index 000000000000..ed600e4ad999
--- /dev/null
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
@@ -0,0 +1,239 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+// This test creates cases where implicit instantiations of various entities
+// would cause a diagnostic, but provides expliict specializations for those
+// entities that avoid the diagnostic. The specializations are alternately
+// declarations and definitions, and the intent of this test is to verify
+// that we allow specializations only in the appropriate namespaces (and
+// nowhere else).
+struct NonDefaultConstructible {
+ NonDefaultConstructible(int);
+};
+
+
+// C++ [temp.expl.spec]p1:
+// An explicit specialization of any of the following:
+
+// -- function template
+namespace N0 {
+ template<typename T> void f0(T) {
+ T t;
+ }
+
+ template<> void f0(NonDefaultConstructible) { }
+
+ void test_f0(NonDefaultConstructible NDC) {
+ f0(NDC);
+ }
+
+ template<> void f0(int);
+ template<> void f0(long);
+}
+
+template<> void N0::f0(int) { } // okay
+
+namespace N1 {
+ template<> void N0::f0(long) { } // expected-error{{not in a namespace enclosing}}
+}
+
+template<> void N0::f0(double) { }
+
+struct X1 {
+ template<typename T> void f(T);
+
+ template<> void f(int); // expected-error{{in class scope}}
+};
+
+// -- class template
+namespace N0 {
+
+template<typename T>
+struct X0 { // expected-note {{here}}
+ static T member;
+
+ void f1(T t) {
+ t = 17;
+ }
+
+ struct Inner : public T { }; // expected-note 2{{here}}
+
+ template<typename U>
+ struct InnerTemplate : public T { }; // expected-note 1{{explicitly specialized}} \
+ // expected-error{{base specifier}}
+
+ template<typename U>
+ void ft1(T t, U u);
+};
+
+}
+
+template<typename T>
+template<typename U>
+void N0::X0<T>::ft1(T t, U u) {
+ t = u;
+}
+
+template<typename T> T N0::X0<T>::member;
+
+template<> struct N0::X0<void> { };
+N0::X0<void> test_X0;
+
+namespace N1 {
+ template<> struct N0::X0<const void> { }; // expected-error{{class template specialization of 'X0' must originally be declared in namespace 'N0'}}
+}
+
+namespace N0 {
+ template<> struct X0<volatile void>;
+}
+
+template<> struct N0::X0<volatile void> {
+ void f1(void *);
+};
+
+// -- member function of a class template
+template<> void N0::X0<void*>::f1(void *) { }
+
+void test_spec(N0::X0<void*> xvp, void *vp) {
+ xvp.f1(vp);
+}
+
+namespace N0 {
+ template<> void X0<volatile void>::f1(void *) { } // expected-error{{no function template matches}}
+
+ template<> void X0<const volatile void*>::f1(const volatile void*);
+}
+
+void test_x0_cvvoid(N0::X0<const volatile void*> x0, const volatile void *cvp) {
+ x0.f1(cvp); // okay: we've explicitly specialized
+}
+
+// -- static data member of a class template
+namespace N0 {
+ // This actually tests p15; the following is a declaration, not a definition.
+ template<>
+ NonDefaultConstructible X0<NonDefaultConstructible>::member;
+
+ template<> long X0<long>::member = 17;
+
+ template<> float X0<float>::member;
+
+ template<> double X0<double>::member;
+}
+
+NonDefaultConstructible &get_static_member() {
+ return N0::X0<NonDefaultConstructible>::member;
+}
+
+template<> int N0::X0<int>::member;
+
+template<> float N0::X0<float>::member = 3.14f;
+
+namespace N1 {
+ template<> double N0::X0<double>::member = 3.14; // expected-error{{not in a namespace enclosing}}
+}
+
+// -- member class of a class template
+namespace N0 {
+
+ template<>
+ struct X0<void*>::Inner { };
+
+ template<>
+ struct X0<int>::Inner { };
+
+ template<>
+ struct X0<unsigned>::Inner;
+
+ template<>
+ struct X0<float>::Inner;
+
+ template<>
+ struct X0<double>::Inner; // expected-note{{forward declaration}}
+}
+
+template<>
+struct N0::X0<long>::Inner { };
+
+template<>
+struct N0::X0<float>::Inner { };
+
+namespace N1 {
+ template<>
+ struct N0::X0<unsigned>::Inner { }; // expected-error{{member class specialization}}
+
+ template<>
+ struct N0::X0<unsigned long>::Inner { }; // expected-error{{member class specialization}}
+};
+
+N0::X0<void*>::Inner inner0;
+N0::X0<int>::Inner inner1;
+N0::X0<long>::Inner inner2;
+N0::X0<float>::Inner inner3;
+N0::X0<double>::Inner inner4; // expected-error{{incomplete}}
+
+// -- member class template of a class template
+namespace N0 {
+ template<>
+ template<>
+ struct X0<void*>::InnerTemplate<int> { };
+
+ template<> template<>
+ struct X0<int>::InnerTemplate<int>; // expected-note{{forward declaration}}
+
+ template<> template<>
+ struct X0<int>::InnerTemplate<long>;
+
+ template<> template<>
+ struct X0<int>::InnerTemplate<double>;
+}
+
+template<> template<>
+struct N0::X0<int>::InnerTemplate<long> { }; // okay
+
+template<> template<>
+struct N0::X0<int>::InnerTemplate<float> { };
+
+namespace N1 {
+ template<> template<>
+ struct N0::X0<int>::InnerTemplate<double> { }; // expected-error{{enclosing}}
+}
+
+N0::X0<void*>::InnerTemplate<int> inner_template0;
+N0::X0<int>::InnerTemplate<int> inner_template1; // expected-error{{incomplete}}
+N0::X0<int>::InnerTemplate<long> inner_template2;
+N0::X0<int>::InnerTemplate<unsigned long> inner_template3; // expected-note{{instantiation}}
+
+// -- member function template of a class template
+namespace N0 {
+ template<>
+ template<>
+ void X0<void*>::ft1(void*, const void*) { }
+
+ template<> template<>
+ void X0<void*>::ft1(void *, int);
+
+ template<> template<>
+ void X0<void*>::ft1(void *, unsigned);
+
+ template<> template<>
+ void X0<void*>::ft1(void *, long);
+}
+
+template<> template<>
+void N0::X0<void*>::ft1(void *, unsigned) { } // okay
+
+template<> template<>
+void N0::X0<void*>::ft1(void *, float) { }
+
+namespace N1 {
+ template<> template<>
+ void N0::X0<void*>::ft1(void *, long) { } // expected-error{{enclosing}}
+}
+
+
+void test_func_template(N0::X0<void *> xvp, void *vp, const void *cvp,
+ int i, unsigned u) {
+ xvp.ft1(vp, cvp);
+ xvp.ft1(vp, i);
+ xvp.ft1(vp, u);
+}
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 654f5abb8a54..1032a87def13 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
@@ -36,7 +36,7 @@ namespace N1 {
template<> void N0::f0(long) { } // expected-error{{not in a namespace enclosing}}
}
-template<> void N0::f0(double) { } // expected-error{{originally be declared}}
+template<> void N0::f0(double) { } // expected-warning{{originally be declared}}
struct X1 {
template<typename T> void f(T);
@@ -75,7 +75,7 @@ void N0::X0<T>::ft1(T t, U u) {
template<typename T> T N0::X0<T>::member;
-template<> struct N0::X0<void> { }; // expected-error{{originally}}
+template<> struct N0::X0<void> { }; // expected-warning{{originally}}
N0::X0<void> test_X0;
namespace N1 {
@@ -91,7 +91,7 @@ template<> struct N0::X0<volatile void> {
};
// -- member function of a class template
-template<> void N0::X0<void*>::f1(void *) { } // expected-error{{member function specialization}}
+template<> void N0::X0<void*>::f1(void *) { } // expected-warning{{member function specialization}}
void test_spec(N0::X0<void*> xvp, void *vp) {
xvp.f1(vp);
@@ -124,7 +124,7 @@ NonDefaultConstructible &get_static_member() {
return N0::X0<NonDefaultConstructible>::member;
}
-template<> int N0::X0<int>::member; // expected-error{{originally}}
+template<> int N0::X0<int>::member; // expected-warning{{originally}}
template<> float N0::X0<float>::member = 3.14f;
@@ -152,7 +152,7 @@ namespace N0 {
}
template<>
-struct N0::X0<long>::Inner { }; // expected-error{{originally}}
+struct N0::X0<long>::Inner { }; // expected-warning{{originally}}
template<>
struct N0::X0<float>::Inner { };
@@ -191,7 +191,7 @@ template<> template<>
struct N0::X0<int>::InnerTemplate<long> { }; // okay
template<> template<>
-struct N0::X0<int>::InnerTemplate<float> { }; // expected-error{{class template specialization}}
+struct N0::X0<int>::InnerTemplate<float> { }; // expected-warning{{class template specialization}}
namespace N1 {
template<> template<>
@@ -223,7 +223,7 @@ template<> template<>
void N0::X0<void*>::ft1(void *, unsigned) { } // okay
template<> template<>
-void N0::X0<void*>::ft1(void *, float) { } // expected-error{{function template specialization}}
+void N0::X0<void*>::ft1(void *, float) { } // expected-warning{{function template specialization}}
namespace N1 {
template<> template<>
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p12.cpp b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
index 912b8e17bb98..c7564868f8ad 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp
@@ -2,5 +2,5 @@
char* p = 0;
template<class T> T g(T x = &p) { return x; }
-template int g<int>(int); // OK even though &p isn’t an int.
+template int g<int>(int); // OK even though &p isn't an int.
diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c
index 0807b74b12c4..dda7bb018a0f 100644
--- a/test/CodeCompletion/ordinary-name.c
+++ b/test/CodeCompletion/ordinary-name.c
@@ -12,3 +12,6 @@ void foo() {
// CHECK-CC1: foo
// CHECK-CC1: TYPEDEF
// CHECK-CC1: y
+
+ // PR8744
+ // RUN: %clang_cc1 -isystem %S/Inputs -fsyntax-only -code-completion-at=%s:1:11 %s
diff --git a/test/CodeCompletion/ordinary-name.cpp b/test/CodeCompletion/ordinary-name.cpp
index 7e08c728fab6..6771dd226518 100644
--- a/test/CodeCompletion/ordinary-name.cpp
+++ b/test/CodeCompletion/ordinary-name.cpp
@@ -20,7 +20,7 @@ void foo() {
// CHECK-CC1-NEXT: COMPLETION: false
// CHECK-CC1-NEXT: COMPLETION: float
// CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
- // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){<#statements#>
+ // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
// CHECK-CC1: COMPLETION: Pattern : goto <#label#>
// CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
// CHECK-CC1: COMPLETION: int
diff --git a/test/CodeCompletion/stdin.c b/test/CodeCompletion/stdin.c
new file mode 100644
index 000000000000..46495b2cd3ad
--- /dev/null
+++ b/test/CodeCompletion/stdin.c
@@ -0,0 +1,7 @@
+enum X { x };
+enum Y { y };
+
+enum
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=-:4:6 < %s -o - | FileCheck -check-prefix=CC1 %s
+ // CHECK-CC1: X
+ // CHECK-CC1: Y
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 0452325a790d..855ede7ab02b 100644
--- a/test/CodeGen/2008-07-17-no-emit-on-error.c
+++ b/test/CodeGen/2008-07-17-no-emit-on-error.c
@@ -1,6 +1,7 @@
// RUN: rm -f %t1.bc
// RUN: %clang_cc1 -DPASS %s -emit-llvm-bc -o %t1.bc
// RUN: test -f %t1.bc
+// RUN: rm -f %t1.bc
// RUN: not %clang_cc1 %s -emit-llvm-bc -o %t1.bc
// RUN: not test -f %t1.bc
diff --git a/test/CodeGen/2008-07-29-override-alias-decl.c b/test/CodeGen/2008-07-29-override-alias-decl.c
index dbe10b395f4f..0c2d0c6ca576 100644
--- a/test/CodeGen/2008-07-29-override-alias-decl.c
+++ b/test/CodeGen/2008-07-29-override-alias-decl.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
int x() { return 1; }
diff --git a/test/CodeGen/2010-03-09-DbgInfo.c b/test/CodeGen/2010-03-09-DbgInfo.c
index 04ee02e43719..3541e5f561fd 100644
--- a/test/CodeGen/2010-03-09-DbgInfo.c
+++ b/test/CodeGen/2010-03-09-DbgInfo.c
@@ -1,2 +1,2 @@
-// RUN: %clang -dA -S -O0 -g %s -o - | grep DW_TAG_variable
+// RUN: %clang -emit-llvm -S -O0 -g %s -o - | grep DW_TAG_variable
unsigned char ctable1[1] = { 0001 };
diff --git a/test/CodeGen/annotate.c b/test/CodeGen/annotate.c
index 84d564a61f71..ffaeebbca515 100644
--- a/test/CodeGen/annotate.c
+++ b/test/CodeGen/annotate.c
@@ -5,4 +5,6 @@ void a(char *a) {
__attribute__((annotate("bar"))) static char bar;
}
+// CHECK: private unnamed_addr global
+// CHECK: private unnamed_addr global
// CHECK: @llvm.global.annotations = appending global [2 x %0]
diff --git a/test/CodeGen/arm-vector-arguments.c b/test/CodeGen/arm-vector-arguments.c
new file mode 100644
index 000000000000..c5ac0a7ad1b7
--- /dev/null
+++ b/test/CodeGen/arm-vector-arguments.c
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin9 \
+// 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>
+
+// CHECK: define void @f0(%struct.int8x16x2_t* sret %agg.result, <16 x i8> %{{.*}}, <16 x i8> %{{.*}})
+int8x16x2_t f0(int8x16_t a0, int8x16_t a1) {
+ return vzipq_s8(a0, a1);
+}
+
+// Test direct vector passing.
+
+typedef float T_float32x2 __attribute__ ((__vector_size__ (8)));
+typedef float T_float32x4 __attribute__ ((__vector_size__ (16)));
+typedef float T_float32x8 __attribute__ ((__vector_size__ (32)));
+typedef float T_float32x16 __attribute__ ((__vector_size__ (64)));
+
+// CHECK: define <2 x float> @f1_0(<2 x float> %{{.*}})
+T_float32x2 f1_0(T_float32x2 a0) { return a0; }
+// CHECK: define <4 x float> @f1_1(<4 x float> %{{.*}})
+T_float32x4 f1_1(T_float32x4 a0) { return a0; }
+// CHECK: define void @f1_2(<8 x float>* sret %{{.*}}, <8 x float> %{{.*}})
+T_float32x8 f1_2(T_float32x8 a0) { return a0; }
+// CHECK: define void @f1_3(<16 x float>* sret %{{.*}}, <16 x float> %{{.*}})
+T_float32x16 f1_3(T_float32x16 a0) { return a0; }
diff --git a/test/CodeGen/asm-errors.c b/test/CodeGen/asm-errors.c
index aea5cb247fa8..c5b36c7fed40 100644
--- a/test/CodeGen/asm-errors.c
+++ b/test/CodeGen/asm-errors.c
@@ -2,7 +2,7 @@
// RUN: FileCheck %s < %t
int test1(int X) {
-// CHECK: error: unrecognized instruction
+// CHECK: error: invalid instruction mnemonic 'abc'
__asm__ ("abc incl %0" : "+r" (X));
return X;
}
diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c
index f04276693e2c..5b0a5f7ef16a 100644
--- a/test/CodeGen/asm-inout.c
+++ b/test/CodeGen/asm-inout.c
@@ -17,3 +17,15 @@ void test2() {
// CHECK: store i32 {{%[a-zA-Z0-9\.]+}}, i32* [[REGCALLRESULT]]
asm ("foobar" : "+r"(*foo()));
}
+
+// PR7338
+void test3(int *vout, int vin)
+{
+ // CHECK: call void asm "opr $0,$1", "=*r|m|r,r|m|r,~{di},~{dirflag},~{fpsr},~{flags}"
+asm(
+ "opr %[vout],%[vin]"
+ : [vout] "=r,=m,=r" (*vout)
+ : [vin] "r,m,r" (vin)
+ : "edi"
+ );
+}
diff --git a/test/CodeGen/asm-variable.c b/test/CodeGen/asm-variable.c
new file mode 100644
index 000000000000..a37132d16c23
--- /dev/null
+++ b/test/CodeGen/asm-variable.c
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+unsigned long long foo(unsigned long long addr, unsigned long long a0,
+ unsigned long long a1, unsigned long long a2,
+ unsigned long long a3, unsigned long long a4,
+ unsigned long long a5) {
+ register unsigned long long result asm("rax");
+ register unsigned long long b0 asm("rdi");
+ register unsigned long long b1 asm("rsi");
+ register unsigned long long b2 asm("rdx");
+ register unsigned long long b3 asm("rcx");
+ register unsigned long long b4 asm("r8");
+ register unsigned long long b5 asm("r9");
+
+ b0 = a0;
+ b1 = a1;
+ b2 = a2;
+ b3 = a3;
+ b4 = a4;
+ b5 = a5;
+
+ asm("call *%1" : "=r" (result)
+ : "r"(addr), "r" (b0), "r" (b1), "r" (b2), "r" (b3), "r" (b4), "r" (b5));
+ return result;
+}
+
+// CHECK: call i64 asm "call *$1", "={rax},r,{rdi},{rsi},{rdx},{rcx},{r8},{r9},~{dirflag},~{fpsr},~{flags}"
+
+unsigned long long foo2(unsigned long long addr, double a0,
+ double a1, double a2,
+ double a3, double a4,
+ double a5, double a6, double a7) {
+ register double b0 asm("xmm0");
+ register double b1 asm("xmm1");
+ register double b2 asm("xmm2");
+ register double b3 asm("xmm3");
+ register double b4 asm("xmm4");
+ register double b5 asm("xmm5");
+ register double b6 asm("xmm6");
+ register double b7 asm("xmm7");
+
+ register unsigned long long result asm("rax");
+
+ b0 = a0;
+ b1 = a1;
+ b2 = a2;
+ b3 = a3;
+ b4 = a4;
+ b5 = a5;
+ b6 = a6;
+ b7 = a7;
+
+ asm("call *%1" : "=r" (result)
+ : "r"(addr), "x" (b0), "x" (b1), "x" (b2), "x" (b3), "x" (b4), "x" (b5), "x" (b6),
+ "x" (b7));
+ return result;
+}
+
+// CHECK: call i64 asm "call *$1", "={rax},r,{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},~{dirflag},~{fpsr},~{flags}
diff --git a/test/CodeGen/assign.c b/test/CodeGen/assign.c
index eab3d357692d..05141bb0bb60 100644
--- a/test/CodeGen/assign.c
+++ b/test/CodeGen/assign.c
@@ -15,15 +15,15 @@ void f0() {
y = (x = 1);
}
-// Check that we do generate reloads for volatile access.
+// This used to test that we generate reloads for volatile access,
+// but that does not appear to be correct behavior for C.
//
// CHECK: define void @f1()
// CHECK: [[x_1:%.*]] = alloca i32, align 4
// CHECK-NEXT: [[y_1:%.*]] = alloca i32, align 4
// CHECK-NEXT: volatile store i32 1, i32* [[x_1]]
// CHECK-NEXT: volatile store i32 1, i32* [[x_1]]
-// CHECK-NEXT: [[tmp_1:%.*]] = volatile load i32* [[x_1]]
-// CHECK-NEXT: volatile store i32 [[tmp_1]], i32* [[y_1]]
+// CHECK-NEXT: volatile store i32 1, i32* [[y_1]]
// CHECK: }
void f1() {
volatile int x, y;
diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c
index d0a7e04eaa92..4a7c13f03c41 100644
--- a/test/CodeGen/atomic.c
+++ b/test/CodeGen/atomic.c
@@ -1,20 +1,6 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1
-// RUN: grep @llvm.memory.barrier %t1 | count 42
-// RUN: grep @llvm.atomic.load.add.i32 %t1 | count 3
-// RUN: grep @llvm.atomic.load.sub.i8 %t1 | count 2
-// RUN: grep @llvm.atomic.load.min.i32 %t1
-// RUN: grep @llvm.atomic.load.max.i32 %t1
-// RUN: grep @llvm.atomic.load.umin.i32 %t1
-// RUN: grep @llvm.atomic.load.umax.i32 %t1
-// RUN: grep @llvm.atomic.swap.i32 %t1
-// RUN: grep @llvm.atomic.cmp.swap.i32 %t1 | count 5
-// RUN: grep @llvm.atomic.load.and.i32 %t1
-// RUN: grep @llvm.atomic.load.or.i8 %t1
-// RUN: grep @llvm.atomic.load.xor.i8 %t1
-
-
-int atomic(void)
-{
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | FileCheck %s
+
+int atomic(void) {
// non-sensical test for sync functions
int old;
int val = 1;
@@ -24,38 +10,144 @@ int atomic(void)
int cmp = 0;
old = __sync_fetch_and_add(&val, 1);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.add.i32.p0i32(i32* %val, i32 1)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_sub(&valc, 2);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i8 @llvm.atomic.load.sub.i8.p0i8(i8* %valc, i8 2)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_min(&val, 3);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.min.i32.p0i32(i32* %val, i32 3)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_max(&val, 4);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.max.i32.p0i32(i32* %val, i32 4)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_umin(&uval, 5u);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.umin.i32.p0i32(i32* %uval, i32 5)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_umax(&uval, 6u);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.umax.i32.p0i32(i32* %uval, i32 6)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_lock_test_and_set(&val, 7);
+ // 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 7)
+ // 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)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_bool_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)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_and(&val, 0x9);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.and.i32.p0i32(i32* %val, i32 9)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_fetch_and_or(&val, 0xa);
- old = __sync_fetch_and_xor(&val, 0xb);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.or.i32.p0i32(i32* %val, i32 10)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ old = __sync_fetch_and_xor(&val, 0xb);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %val, i32 11)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_add_and_fetch(&val, 1);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.add.i32.p0i32(i32* %val, i32 1)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_sub_and_fetch(&val, 2);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %val, i32 2)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_and_and_fetch(&valc, 3);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i8 @llvm.atomic.load.and.i8.p0i8(i8* %valc, i8 3)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
old = __sync_or_and_fetch(&valc, 4);
- old = __sync_xor_and_fetch(&valc, 5);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i8 @llvm.atomic.load.or.i8.p0i8(i8* %valc, i8 4)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ old = __sync_xor_and_fetch(&valc, 5);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i8 @llvm.atomic.load.xor.i8.p0i8(i8* %valc, i8 5)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
__sync_val_compare_and_swap((void **)0, (void *)0, (void *)0);
+ // 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* null, i32 0, i32 0)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
if ( __sync_val_compare_and_swap(&valb, 0, 1)) {
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* %valb, i8 0, i8 1)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
old = 42;
}
+
__sync_bool_compare_and_swap((void **)0, (void *)0, (void *)0);
+ // 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* null, i32 0, i32 0)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
__sync_lock_release(&val);
+ // CHECK: volatile store i32 0, i32*
+
__sync_synchronize ();
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 false)
return old;
}
+// CHECK: @release_return
void release_return(int *lock) {
// Ensure this is actually returning void all the way through.
return __sync_lock_release(lock);
+ // CHECK: volatile store i32 0, i32*
+}
+
+
+// rdar://8461279 - Atomics with address spaces.
+// CHECK: @addrspace
+void addrspace(int __attribute__((address_space(256))) * P) {
+ __sync_bool_compare_and_swap(P, 0, 1);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p256i32(i32 addrspace(256)*{{.*}}, i32 0, i32 1)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
+
+ __sync_val_compare_and_swap(P, 0, 1);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p256i32(i32 addrspace(256)*{{.*}}, i32 0, i32 1)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
+
+ __sync_xor_and_fetch(P, 123);
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+ // CHECK: call i32 @llvm.atomic.load.xor.i32.p256i32(i32 addrspace(256)* {{.*}}, i32 123)
+ // CHECK: call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true)
+
}
+
diff --git a/test/CodeGen/attr-naked.c b/test/CodeGen/attr-naked.c
new file mode 100644
index 000000000000..bccacc9916f1
--- /dev/null
+++ b/test/CodeGen/attr-naked.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -g -emit-llvm -o %t %s
+// RUN: grep 'naked' %t
+
+void t1() __attribute__((naked));
+
+void t1()
+{
+}
+
diff --git a/test/CodeGen/blocks-1.c b/test/CodeGen/blocks-1.c
index 71b4de8beff5..350f7a3bafb8 100644
--- a/test/CodeGen/blocks-1.c
+++ b/test/CodeGen/blocks-1.c
@@ -1,9 +1,9 @@
// RUN: %clang_cc1 %s -emit-llvm -o %t -fblocks
// RUN: grep "_Block_object_dispose" %t | count 17
-// RUN: grep "__copy_helper_block_" %t | count 16
-// RUN: grep "__destroy_helper_block_" %t | count 16
-// RUN: grep "__Block_byref_id_object_copy_" %t | count 2
-// RUN: grep "__Block_byref_id_object_dispose_" %t | count 2
+// RUN: grep "__copy_helper_block_" %t | count 14
+// RUN: grep "__destroy_helper_block_" %t | count 14
+// RUN: grep "__Block_byref_object_copy_" %t | count 2
+// RUN: grep "__Block_byref_object_dispose_" %t | count 2
// RUN: grep "i32 135)" %t | count 2
// RUN: grep "_Block_object_assign" %t | count 10
@@ -14,7 +14,7 @@ void test1() {
int b=2;
a=1;
printf("a is %d, b is %d\n", a, b);
- ^{ a = 10; printf("a is %d, b is %d\n", a, b); }();
+ ^{ a = 10; printf("a is %d, b is %d\n", a, b); }(); // needs copy/dispose
printf("a is %d, b is %d\n", a, b);
a = 1;
printf("a is %d, b is %d\n", a, b);
@@ -24,8 +24,8 @@ void test2() {
__block int a;
a=1;
printf("a is %d\n", a);
- ^{
- ^{
+ ^{ // needs copy/dispose
+ ^{ // needs copy/dispose
a = 10;
}();
}();
@@ -37,13 +37,13 @@ void test2() {
void test3() {
__block int k;
__block int (^j)(int);
- ^{j=0; k=0;}();
+ ^{j=0; k=0;}(); // needs copy/dispose
}
int test4() {
extern int g;
static int i = 1;
- ^(int j){ i = j; g = 0; }(0);
+ ^(int j){ i = j; g = 0; }(0); // does not need copy/dispose
return i + g;
}
@@ -51,19 +51,19 @@ int g;
void test5() {
__block struct { int i; } i;
- ^{ (void)i; }();
+ ^{ (void)i; }(); // needs copy/dispose
}
void test6() {
__block int i;
- ^{ i=1; }();
- ^{}();
+ ^{ i=1; }(); // needs copy/dispose
+ ^{}(); // does not need copy/dispose
}
void test7() {
- ^{
+ ^{ // does not need copy/dispose
__block int i;
- ^{ i = 1; }();
+ ^{ i = 1; }(); // needs copy/dispose
}();
}
diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c
index 6888356a5a1d..b7b6a2d505ef 100644
--- a/test/CodeGen/blocks.c
+++ b/test/CodeGen/blocks.c
@@ -33,3 +33,10 @@ typedef double ftype(double);
ftype ^test2 = ^ftype {
return 0;
};
+
+// rdar://problem/8605032
+void f3_helper(void (^)(void));
+void f3() {
+ _Bool b = 0;
+ f3_helper(^{ if (b) {} });
+}
diff --git a/test/CodeGen/blocksignature.c b/test/CodeGen/blocksignature.c
index 6ed8750e9b1e..7526f19468ed 100644
--- a/test/CodeGen/blocksignature.c
+++ b/test/CodeGen/blocksignature.c
@@ -1,14 +1,16 @@
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X64
// RUN: %clang_cc1 -fblocks -triple i686-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X32
-// X64: @.str = private constant [6 x i8] c"v8@?0\00"
+// X64: @.str = private unnamed_addr constant [6 x i8] c"v8@?0\00"
// X64: @__block_literal_global = internal constant %1 { i8** @_NSConcreteGlobalBlock, i32 1342177280,
-// X64: @.str1 = private constant [12 x i8] c"i16@?0c8f12\00"
+// X64: @.str1 = private unnamed_addr constant [12 x i8] c"i16@?0c8f12\00"
// X64: store i32 1073741824, i32*
-// X32: @.str = private constant [6 x i8] c"v4@?0\00"
-// X32: @__block_literal_global = internal constant %1 { i8** @_NSConcreteGlobalBlock, i32 1342177280,
-// X32: @.str1 = private constant [11 x i8] c"i12@?0c4f8\00"
+// X32: [[STR1:@.*]] = private unnamed_addr constant [6 x i8] c"v4@?0\00"
+// X32: @__block_descriptor_tmp = internal constant [[FULL_DESCRIPTOR_T:%.*]] { i32 0, i32 20, i8* getelementptr inbounds ([6 x i8]* [[STR1]], i32 0, i32 0), i8* null }
+// X32: @__block_literal_global = internal constant [[GLOBAL_LITERAL_T:%.*]] { i8** @_NSConcreteGlobalBlock, i32 1342177280, i32 0, i8* bitcast (void (i8*)* @__block_global_{{.*}} to i8*), [[DESCRIPTOR_T:%.*]]* bitcast ([[FULL_DESCRIPTOR_T]]* @__block_descriptor_tmp to {{%.*}}*) }
+// X32: [[STR2:@.*]] = private unnamed_addr constant [11 x i8] c"i12@?0c4f8\00"
+// X32: @__block_descriptor_tmp{{.*}} = internal constant [[FULL_DESCRIPTOR_T]] { i32 0, i32 24, i8* getelementptr inbounds ([11 x i8]* [[STR2]], i32 0, i32 0), i8* null }
// X32: store i32 1073741824, i32*
// rdar://7635294
diff --git a/test/CodeGen/blockstret.c b/test/CodeGen/blockstret.c
index f630f22b1676..e49b52a18853 100644
--- a/test/CodeGen/blockstret.c
+++ b/test/CodeGen/blockstret.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X64
// RUN: %clang_cc1 -fblocks -triple i686-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X32
-// X64: internal constant %2 { i8** @_NSConcreteGlobalBlock, i32 1879048192
+// X64: internal constant {{%.*}} { i8** @_NSConcreteGlobalBlock, i32 1879048192
// X64: store i32 1610612736, i32* %want
// X32: @_NSConcreteGlobalBlock, i32 1879048192, i32 0,
diff --git a/test/CodeGen/blockwithlocalstatic.c b/test/CodeGen/blockwithlocalstatic.c
new file mode 100644
index 000000000000..1fdaaf37a1b3
--- /dev/null
+++ b/test/CodeGen/blockwithlocalstatic.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-llvm -o - %s | FileCheck %s
+// pr8707
+
+// CHECK: @__block_global_0.test = internal global i32
+int (^block)(void) = ^ {
+ static int test=0;
+ return test;
+};
+// CHECK: @__block_global_1.test = internal global i32
+void (^block1)(void) = ^ {
+ static int test = 2;
+ return;
+};
+// CHECK: @__block_global_2.test = internal global i32
+int (^block2)(void) = ^ {
+ static int test = 5;
+ return test;
+};
+
diff --git a/test/CodeGen/bool_test.c b/test/CodeGen/bool_test.c
new file mode 100644
index 000000000000..ffaaef8123cc
--- /dev/null
+++ b/test/CodeGen/bool_test.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple powerpc-apple-darwin -emit-llvm -o - %s| FileCheck -check-prefix=DARWINPPC-CHECK %s
+
+int boolsize = sizeof(_Bool);
+//DARWINPPC-CHECK: boolsize = global i32 4, align 4
+
diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c
index 8627499cdc77..e03e69c28cfe 100644
--- a/test/CodeGen/builtins-ppc-altivec.c
+++ b/test/CodeGen/builtins-ppc-altivec.c
@@ -32,7 +32,13 @@ int param_i;
unsigned int param_ui;
float param_f;
+int res_sc;
+int res_uc;
+int res_s;
+int res_us;
int res_i;
+int res_ui;
+int res_f;
// CHECK: define void @test1
void test1() {
@@ -1761,9 +1767,958 @@ void test6() {
res_vf = vec_vxor(vbi, vf); // CHECK: xor <4 x i32>
res_vf = vec_vxor(vf, vbi); // CHECK: xor <4 x i32>
+ /* ------------------------------ extensions -------------------------------------- */
+
+ /* vec_extract */
+ res_sc = vec_extract(vsc, param_i); // CHECK: extractelement <16 x i8>
+ res_uc = vec_extract(vuc, param_i); // CHECK: extractelement <16 x i8>
+ res_s = vec_extract(vs, param_i); // CHECK: extractelement <8 x i16>
+ res_us = vec_extract(vus, param_i); // CHECK: extractelement <8 x i16>
+ res_i = vec_extract(vi, param_i); // CHECK: extractelement <4 x i32>
+ res_ui = vec_extract(vui, param_i); // CHECK: extractelement <4 x i32>
+ res_f = vec_extract(vf, param_i); // CHECK: extractelement <4 x float>
+
+ /* vec_insert */
+ res_vsc = vec_insert(param_sc, vsc, param_i); // CHECK: insertelement <16 x i8>
+ res_vuc = vec_insert(param_uc, vuc, param_i); // CHECK: insertelement <16 x i8>
+ res_vs = vec_insert(param_s, vs, param_i); // CHECK: insertelement <8 x i16>
+ res_vus = vec_insert(param_us, vus, param_i); // CHECK: insertelement <8 x i16>
+ res_vi = vec_insert(param_i, vi, param_i); // CHECK: insertelement <4 x i32>
+ res_vui = vec_insert(param_ui, vui, param_i); // CHECK: insertelement <4 x i32>
+ res_vf = vec_insert(param_f, vf, param_i); // CHECK: insertelement <4 x float>
+
+ /* 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+
+ res_vbc = vec_lvlx(0, &vbc); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+
+ res_vbs = vec_lvlx(0, &vbs); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vp = vec_lvlx(0, &vp); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+
+ res_vbi = vec_lvlx(0, &vbi); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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: @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: @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: @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: @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: @llvm.ppc.altivec.vperm
+
+ res_vbc = vec_lvlxl(0, &vbc); // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+
+ res_vbs = vec_lvlxl(0, &vbs); // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vp = vec_lvlxl(0, &vp); // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+
+ res_vbi = vec_lvlxl(0, &vbi); // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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: @llvm.ppc.altivec.vperm
+
+ /* vec_lvrx */
+ res_vsc = vec_lvrx(0, &param_sc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vsc = vec_lvrx(0, &vsc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vuc = vec_lvrx(0, &param_uc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vuc = vec_lvrx(0, &vuc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vbc = vec_lvrx(0, &vbc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vs = vec_lvrx(0, &vs); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vus = vec_lvrx(0, &param_us); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vus = vec_lvrx(0, &vus); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vbs = vec_lvrx(0, &vbs); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vp = vec_lvrx(0, &vp); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vi = vec_lvrx(0, &vi); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vui = vec_lvrx(0, &param_ui); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vui = vec_lvrx(0, &vui); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vbi = vec_lvrx(0, &vbi); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vsc = vec_lvrxl(0, &vsc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vuc = vec_lvrxl(0, &param_uc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vuc = vec_lvrxl(0, &vuc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vbc = vec_lvrxl(0, &vbc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vs = vec_lvrxl(0, &vs); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vus = vec_lvrxl(0, &param_us); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vus = vec_lvrxl(0, &vus); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vbs = vec_lvrxl(0, &vbs); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vp = vec_lvrxl(0, &vp); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vi = vec_lvrxl(0, &vi); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vui = vec_lvrxl(0, &param_ui); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vui = vec_lvrxl(0, &vui); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ res_vbi = vec_lvrxl(0, &vbi); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvxl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+
+ /* vec_stvlx */
+ vec_stvlx(vsc, 0, &param_sc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvlx(vbc, 0, &vbc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvlx(vbs, 0, &vbs); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvlx(vp, 0, &vp); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvlx(vbi, 0, &vbi); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvlxl(vbc, 0, &vbc); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvlxl(vbs, 0, &vbs); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvlxl(vp, 0, &vp); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvlxl(vbi, 0, &vbi); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // 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
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ /* 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvrx(vbc, 0, &vbc); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvrx(vbs, 0, &vbs); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvrx(vp, 0, &vp); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ vec_stvrx(vbi, 0, &vbi); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // 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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvx
+
+ /* 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvrxl(vbc, 0, &vbc); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvrxl(vbs, 0, &vbs); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvrxl(vp, 0, &vp); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // 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: @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: @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: @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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ vec_stvrxl(vbi, 0, &vbi); // CHECK: @llvm.ppc.altivec.lvx
+ // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: @llvm.ppc.altivec.lvsl
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // 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: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.lvsr
+ // CHECK: @llvm.ppc.altivec.vperm
+ // CHECK: @llvm.ppc.altivec.stvxl
+
+ /* vec_promote */
+ res_vsc = vec_promote(param_sc, 0); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: insertelement <16 x i8>
+
+ res_vuc = vec_promote(param_uc, 0); // CHECK: store <16 x i8> zeroinitializer
+ // CHECK: insertelement <16 x i8>
+
+ res_vs = vec_promote(param_s, 0); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: insertelement <8 x i16>
+
+ res_vus = vec_promote(param_us, 0); // CHECK: store <8 x i16> zeroinitializer
+ // CHECK: insertelement <8 x i16>
+
+ res_vi = vec_promote(param_i, 0); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: insertelement <4 x i32>
+
+ res_vui = vec_promote(param_ui, 0); // CHECK: store <4 x i32> zeroinitializer
+ // CHECK: insertelement <4 x i32>
+
+ res_vf = vec_promote(param_f, 0); // CHECK: store <4 x float> zeroinitializer
+ // CHECK: insertelement <4 x float>
+
+ /* vec_splats */
+ res_vsc = vec_splats(param_sc); // CHECK: insertelement <16 x i8>
+
+ res_vuc = vec_splats(param_uc); // CHECK: insertelement <16 x i8>
+
+ res_vs = vec_splats(param_s); // CHECK: insertelement <8 x i16>
+
+ res_vus = vec_splats(param_us); // CHECK: insertelement <8 x i16>
+
+ res_vi = vec_splats(param_i); // CHECK: insertelement <4 x i32>
+
+ res_vui = vec_splats(param_ui); // CHECK: insertelement <4 x i32>
+
+ res_vf = vec_splats(param_f); // CHECK: insertelement <4 x float>
+
/* ------------------------------ predicates -------------------------------------- */
- /* vec_all_eq */
+ /* vec_all_eq */
res_i = vec_all_eq(vsc, vsc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
res_i = vec_all_eq(vsc, vbc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
res_i = vec_all_eq(vuc, vuc); // CHECK: @llvm.ppc.altivec.vcmpequb.p
@@ -2097,3 +3052,75 @@ void test6() {
/* vec_any_out */
res_i = vec_any_out(vf, vf); // CHECK: @llvm.ppc.altivec.vcmpbfp.p
}
+
+/* ------------------------------ Relational Operators------------------------------- */
+// CHECK: define void @test7
+void test7() {
+ vector signed char vsc1 = (vector signed char)(-1);
+ vector signed char vsc2 = (vector signed char)(-2);
+ res_i = (vsc1 == vsc2); // CHECK: @llvm.ppc.altivec.vcmpequb.p(i32 2
+ res_i = (vsc1 != vsc2); // CHECK: @llvm.ppc.altivec.vcmpequb.p(i32 0
+ res_i = (vsc1 < vsc2); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p(i32 2
+ res_i = (vsc1 > vsc2); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p(i32 2
+ res_i = (vsc1 <= vsc2); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p(i32 0
+ res_i = (vsc1 >= vsc2); // CHECK: @llvm.ppc.altivec.vcmpgtsb.p(i32 0
+ vector unsigned char vuc1 = (vector unsigned char)(1);
+ vector unsigned char vuc2 = (vector unsigned char)(2);
+ res_i = (vuc1 == vuc2); // CHECK: @llvm.ppc.altivec.vcmpequb.p(i32 2
+ res_i = (vuc1 != vuc2); // CHECK: @llvm.ppc.altivec.vcmpequb.p(i32 0
+ res_i = (vuc1 < vuc2); // CHECK: @llvm.ppc.altivec.vcmpgtub.p(i32 2
+ res_i = (vuc1 > vuc2); // CHECK: @llvm.ppc.altivec.vcmpgtub.p(i32 2
+ res_i = (vuc1 <= vuc2); // CHECK: @llvm.ppc.altivec.vcmpgtub.p(i32 0
+ res_i = (vuc1 >= vuc2); // CHECK: @llvm.ppc.altivec.vcmpgtub.p(i32 0
+ vector short vs1 = (vector short)(-1);
+ vector short vs2 = (vector short)(-2);
+ res_i = (vs1 == vs2); // CHECK: @llvm.ppc.altivec.vcmpequh.p(i32 2
+ res_i = (vs1 != vs2); // CHECK: @llvm.ppc.altivec.vcmpequh.p(i32 0
+ res_i = (vs1 < vs2); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p(i32 2
+ res_i = (vs1 > vs2); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p(i32 2
+ res_i = (vs1 <= vs2); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p(i32 0
+ res_i = (vs1 >= vs2); // CHECK: @llvm.ppc.altivec.vcmpgtsh.p(i32 0
+ vector unsigned short vus1 = (vector unsigned short)(1);
+ vector unsigned short vus2 = (vector unsigned short)(2);
+ res_i = (vus1 == vus2); // CHECK: @llvm.ppc.altivec.vcmpequh.p(i32 2
+ res_i = (vus1 != vus2); // CHECK: @llvm.ppc.altivec.vcmpequh.p(i32 0
+ res_i = (vus1 < vus2); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p(i32 2
+ res_i = (vus1 > vus2); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p(i32 2
+ res_i = (vus1 <= vus2); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p(i32 0
+ res_i = (vus1 >= vus2); // CHECK: @llvm.ppc.altivec.vcmpgtuh.p(i32 0
+ vector int vi1 = (vector int)(-1);
+ vector int vi2 = (vector int)(-2);
+ res_i = (vi1 == vi2); // CHECK: @llvm.ppc.altivec.vcmpequw.p(i32 2
+ res_i = (vi1 != vi2); // CHECK: @llvm.ppc.altivec.vcmpequw.p(i32 0
+ res_i = (vi1 < vi2); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p(i32 2
+ res_i = (vi1 > vi2); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p(i32 2
+ res_i = (vi1 <= vi2); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p(i32 0
+ res_i = (vi1 >= vi2); // CHECK: @llvm.ppc.altivec.vcmpgtsw.p(i32 0
+ vector unsigned int vui1 = (vector unsigned int)(1);
+ vector unsigned int vui2 = (vector unsigned int)(2);
+ res_i = (vui1 == vui2); // CHECK: @llvm.ppc.altivec.vcmpequw.p(i32 2
+ res_i = (vui1 != vui2); // CHECK: @llvm.ppc.altivec.vcmpequw.p(i32 0
+ res_i = (vui1 < vui2); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p(i32 2
+ res_i = (vui1 > vui2); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p(i32 2
+ res_i = (vui1 <= vui2); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p(i32 0
+ res_i = (vui1 >= vui2); // CHECK: @llvm.ppc.altivec.vcmpgtuw.p(i32 0
+ vector float vf1 = (vector float)(1.0);
+ vector float vf2 = (vector float)(2.0);
+ res_i = (vf1 == vf2); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p(i32 2
+ res_i = (vf1 != vf2); // CHECK: @llvm.ppc.altivec.vcmpeqfp.p(i32 0
+ res_i = (vf1 < vf2); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p(i32 2
+ res_i = (vf1 > vf2); // CHECK: @llvm.ppc.altivec.vcmpgtfp.p(i32 2
+ 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-x86.c b/test/CodeGen/builtins-x86.c
index 1b4e68b01ede..56f220b8a6e8 100644
--- a/test/CodeGen/builtins-x86.c
+++ b/test/CodeGen/builtins-x86.c
@@ -261,6 +261,7 @@ void f0() {
tmp_V8c = __builtin_ia32_packsswb(tmp_V4s, tmp_V4s);
tmp_V4s = __builtin_ia32_packssdw(tmp_V2i, tmp_V2i);
tmp_V8c = __builtin_ia32_packuswb(tmp_V4s, tmp_V4s);
+ tmp_i = __builtin_ia32_vec_ext_v2si(tmp_V2i, 0);
(void) __builtin_ia32_ldmxcsr(tmp_Ui);
tmp_Ui = __builtin_ia32_stmxcsr();
diff --git a/test/CodeGen/char-literal.c b/test/CodeGen/char-literal.c
new file mode 100644
index 000000000000..aff76d280d30
--- /dev/null
+++ b/test/CodeGen/char-literal.c
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -x c++ -triple i386-unknown-unkown -emit-llvm %s -o - | FileCheck %s
+// Runs in c++ mode so that wchar_t is available.
+
+int main() {
+ // CHECK: store i8 97
+ char a = 'a';
+
+ // Should pick second character.
+ // CHECK: store i8 98
+ char b = 'ab';
+
+ // CHECK: store i32 97
+ wchar_t wa = L'a';
+
+ // Should pick second character.
+ // CHECK: store i32 98
+ wchar_t wb = L'ab';
+
+ // Should pick last character and store its lowest byte.
+ // This does not match gcc, which takes the last character, converts it to
+ // utf8, and then picks the second-lowest byte of that (they probably store
+ // the utf8 in uint16_ts internally and take the lower byte of that).
+ // CHECK: store i8 48
+ char c = '\u1120\u0220\U00102030';
+
+ // CHECK: store i32 61451
+ wchar_t wc = L'\uF00B';
+
+ // CHECK: store i32 1110027
+ wchar_t wd = L'\U0010F00B';
+
+ // Should pick second character.
+ // CHECK: store i32 1110027
+ wchar_t we = L'\u1234\U0010F00B';
+}
diff --git a/test/CodeGen/conditional-gnu-ext.c b/test/CodeGen/conditional-gnu-ext.c
index f4ac81bf5934..2e32d3a01669 100644
--- a/test/CodeGen/conditional-gnu-ext.c
+++ b/test/CodeGen/conditional-gnu-ext.c
@@ -10,3 +10,27 @@ float test(float x, int Y) {
return Y != 0 ? : x;
}
+// rdar://8446940
+extern void abort();
+void test1 () {
+ char x[1];
+ char *y = x ? : 0;
+
+ if (x != y)
+ abort();
+}
+
+// rdar://8453812
+_Complex int getComplex(_Complex int val) {
+ static int count;
+ if (count++)
+ abort();
+ return val;
+}
+
+_Complex int complx() {
+ _Complex int cond;
+ _Complex int rhs;
+
+ return getComplex(1+2i) ? : rhs;
+}
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index ac26b65e688d..32b762d646e6 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -118,7 +118,7 @@ struct g23 {char a; short b; char c; struct g22 d;};
struct g23 g24 = {1,2,3,4};
// CHECK: @g25.g26 = internal global i8* getelementptr inbounds ([4 x i8]* @__func__.g25, i32 0, i32 0)
-// CHECK: @__func__.g25 = private constant [4 x i8] c"g25\00"
+// CHECK: @__func__.g25 = private unnamed_addr constant [4 x i8] c"g25\00"
int g25() {
static const char *g26 = __func__;
return *g26;
diff --git a/test/CodeGen/darwin-string-literals.c b/test/CodeGen/darwin-string-literals.c
index 87342956378b..ef5601e8f224 100644
--- a/test/CodeGen/darwin-string-literals.c
+++ b/test/CodeGen/darwin-string-literals.c
@@ -1,14 +1,14 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s
-// CHECK-LSB: @.str = private constant [8 x i8] c"string0\00"
-// CHECK-LSB: @.str1 = private constant [8 x i8] c"string1\00"
-// CHECK-LSB: @.str2 = internal 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
+// 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: @.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 constant [8 x i8] c"string0\00"
-// CHECK-MSB: @.str1 = private constant [8 x i8] c"string1\00"
-// CHECK-MSB: @.str2 = internal 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
+// 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: @.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";
const void *g1 = __builtin___CFStringMakeConstantString("string1");
diff --git a/test/CodeGen/debug-info-crash.c b/test/CodeGen/debug-info-crash.c
index e0c9dd415bbe..8d6a360c64d2 100644
--- a/test/CodeGen/debug-info-crash.c
+++ b/test/CodeGen/debug-info-crash.c
@@ -19,3 +19,12 @@ dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq,
}
);
}
+
+// radar://9008853
+typedef struct P {
+ int x;
+} PS;
+# 1 ""
+void foo() {
+ PS p2;
+}
diff --git a/test/CodeGen/debug-info-line.c b/test/CodeGen/debug-info-line.c
new file mode 100644
index 000000000000..b255d90b34c8
--- /dev/null
+++ b/test/CodeGen/debug-info-line.c
@@ -0,0 +1,15 @@
+// RUN: %clang -emit-llvm -S -g %s -o %t
+// RUN: grep DW_TAG_lexical_block %t | count 3
+
+// Radar 8396182
+// There are three lexical blocks in this test case.
+
+int foo() {
+ int i = 1;
+# 4 "m.c"
+# 1 "m.h" 1
+ int j = 2;
+# 2 "m.h"
+# 5 "m.c" 2
+ return i + j;
+}
diff --git a/test/CodeGen/debug-info-var-location.c b/test/CodeGen/debug-info-var-location.c
new file mode 100644
index 000000000000..12edb0898274
--- /dev/null
+++ b/test/CodeGen/debug-info-var-location.c
@@ -0,0 +1,21 @@
+// RUN: %clang -S -g -fverbose-asm %s -o - | FileCheck %s
+// Radar 8461032
+// CHECK: DW_AT_location
+// CHECK-NEXT: byte 145
+
+// 145 is DW_OP_fbreg
+struct s {
+ int a;
+ struct s *next;
+};
+
+int foo(struct s *s) {
+ switch (s->a) {
+ case 1:
+ case 2: {
+ struct s *sp = s->next;
+ }
+ break;
+ }
+ return 1;
+}
diff --git a/test/CodeGen/designated-initializers.c b/test/CodeGen/designated-initializers.c
index 312d78565294..d928296ef230 100644
--- a/test/CodeGen/designated-initializers.c
+++ b/test/CodeGen/designated-initializers.c
@@ -19,6 +19,39 @@ int b[2] = {
[1] = 22
};
+// PR6955
+
+struct ds {
+ struct {
+ struct {
+ short a;
+ };
+ short b;
+ struct {
+ short c;
+ };
+ };
+};
+
+// Traditional C anonymous member init
+struct ds ds0 = { { { .a = 0 } } };
+// C1X lookup-based anonymous member init cases
+struct ds ds1 = { { .a = 1 } };
+struct ds ds2 = { { .b = 1 } };
+struct ds ds3 = { .a = 0 };
+// CHECK: @ds4 = global %3 { %4 { %struct.anon zeroinitializer, i16 0, %struct.anon { i16 1 } } }
+struct ds ds4 = { .c = 1 };
+struct ds ds5 = { { { .a = 0 } }, .b = 1 };
+struct ds ds6 = { { .a = 0, .b = 1 } };
+// CHECK: @ds7 = global %3 { %4 { %struct.anon { i16 2 }, i16 3, %struct.anon zeroinitializer } }
+struct ds ds7 = {
+ { {
+ .a = 1
+ } },
+ .a = 2,
+ .b = 3
+};
+
void test1(int argc, char **argv)
{
// CHECK: internal global %struct.foo { i8* null, i32 1024 }
diff --git a/test/CodeGen/enum.c b/test/CodeGen/enum.c
index 87b0e1e67144..0e239f1a8ee3 100644
--- a/test/CodeGen/enum.c
+++ b/test/CodeGen/enum.c
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | grep 'ret i32 6'
// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | grep 'ret i32 7'
+// This test case illustrates a peculiarity of the promotion of
+// enumeration types in C and C++. In particular, the enumeration type
+// "z" below promotes to an unsigned int in C but int in C++.
static enum { foo, bar = 1U } z;
int main (void)
diff --git a/test/CodeGen/exceptions.c b/test/CodeGen/exceptions.c
new file mode 100644
index 000000000000..018b975395b9
--- /dev/null
+++ b/test/CodeGen/exceptions.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fexceptions -fblocks | FileCheck %s
+// RUN: %clang_cc1 -triple armv7-apple-unknown -emit-llvm -o - %s -fexceptions -fsjlj-exceptions -fblocks | FileCheck %s -check-prefix=CHECK-ARM
+
+// rdar://problem/8621849
+void test1() {
+ extern void test1_helper(void (^)(int));
+
+ // CHECK: define void @test1()
+ // CHECK-ARM: define arm_aapcscc void @test1()
+
+ __block int x = 10;
+
+ // CHECK: invoke void @test1_helper(
+ // CHECK-ARM: invoke arm_aapcscc void @test1_helper(
+ test1_helper(^(int v) { x = v; });
+
+ // CHECK: call {{.*}} @llvm.eh.selector({{.*}}, i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
+ // CHECK-ARM: call {{.*}} @llvm.eh.selector({{.*}}, i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*)
+}
diff --git a/test/CodeGen/exprs.c b/test/CodeGen/exprs.c
index c9978b851642..cc03be6a922a 100644
--- a/test/CodeGen/exprs.c
+++ b/test/CodeGen/exprs.c
@@ -147,8 +147,30 @@ double f13(double X) {
}
// Check operations on incomplete types.
-struct s14;
-void f14(struct s13 *a) {
+void f14(struct s14 *a) {
(void) &*a;
}
+// CHECK: define void @f15
+void f15() {
+ extern void f15_start(void);
+ f15_start();
+ // CHECK: call void @f15_start()
+
+ extern void *f15_v(void);
+ extern const void *f15_cv(void);
+ extern volatile void *f15_vv(void);
+ *f15_v(); *f15_v(), *f15_v(); f15_v() ? *f15_v() : *f15_v();
+ *f15_cv(); *f15_cv(), *f15_cv(); f15_cv() ? *f15_cv() : *f15_cv();
+ *f15_vv(); *f15_vv(), *f15_vv(); f15_vv() ? *f15_vv() : *f15_vv();
+ // CHECK-NOT: load
+ // CHECK: ret void
+}
+
+// PR8967: this was crashing
+// CHECK: define void @f16()
+void f16() {
+ __extension__({ goto lbl; });
+ lbl:
+ ;
+}
diff --git a/test/CodeGen/frame-pointer-elim.c b/test/CodeGen/frame-pointer-elim.c
index 79c0599467a9..e9dc22b3aa1f 100644
--- a/test/CodeGen/frame-pointer-elim.c
+++ b/test/CodeGen/frame-pointer-elim.c
@@ -1,13 +1,22 @@
-// RUN: %clang -ccc-host-triple i386 -S -o - %s | \
-// RUN: FileCheck --check-prefix=DEFAULT %s
-// DEFAULT: f0:
-// DEFAULT: pushl %ebp
-// DEFAULT: ret
-// DEFAULT: f1:
-// DEFAULT: pushl %ebp
-// DEFAULT: ret
+// RUN: %clang -ccc-host-triple i386-apple-darwin -S -o - %s | \
+// RUN: FileCheck --check-prefix=DARWIN %s
+// DARWIN: f0:
+// DARWIN: pushl %ebp
+// DARWIN: ret
+// DARWIN: f1:
+// DARWIN: pushl %ebp
+// DARWIN: ret
-// RUN: %clang -ccc-host-triple i386 -S -o - -fomit-frame-pointer %s | \
+// RUN: %clang -ccc-host-triple i386-pc-linux-gnu -S -o - %s | \
+// RUN: FileCheck --check-prefix=LINUX %s
+// LINUX: f0:
+// LINUX-NOT: pushl %ebp
+// LINUX: ret
+// LINUX: f1:
+// LINUX: pushl %ebp
+// LINUX: ret
+
+// RUN: %clang -ccc-host-triple i386-darwin -S -o - -fomit-frame-pointer %s | \
// RUN: FileCheck --check-prefix=OMIT_ALL %s
// OMIT_ALL: f0:
// OMIT_ALL-NOT: pushl %ebp
@@ -16,7 +25,7 @@
// OMIT_ALL-NOT: pushl %ebp
// OMIT_ALL: ret
-// RUN: %clang -ccc-host-triple i386 -S -o - -momit-leaf-frame-pointer %s | \
+// RUN: %clang -ccc-host-triple i386-darwin -S -o - -momit-leaf-frame-pointer %s | \
// RUN: FileCheck --check-prefix=OMIT_LEAF %s
// OMIT_LEAF: f0:
// OMIT_LEAF-NOT: pushl %ebp
diff --git a/test/CodeGen/func-in-block.c b/test/CodeGen/func-in-block.c
index 7e65ff92df05..19001357d517 100644
--- a/test/CodeGen/func-in-block.c
+++ b/test/CodeGen/func-in-block.c
@@ -15,5 +15,5 @@ int main()
return 0; // not reached
}
-// CHECK: @__func__.__main_block_invoke_0 = private constant [22 x i8] c"__main_block_invoke_0\00"
+// CHECK: @__func__.__main_block_invoke_0 = private unnamed_addr constant [22 x i8] c"__main_block_invoke_0\00"
// CHECK: call void @PRINTF({{.*}}@__func__.__main_block_invoke_
diff --git a/test/CodeGen/illegal-UTF8.m b/test/CodeGen/illegal-UTF8.m
index 871e6e5956a8..4762e800259f 100644
--- a/test/CodeGen/illegal-UTF8.m
+++ b/test/CodeGen/illegal-UTF8.m
@@ -2,7 +2,5 @@
@class NSString;
-// FIXME: GCC emits the following warning:
-// CodeGen/illegal-UTF8.m:4: warning: input conversion stopped due to an input byte that does not belong to the input codeset UTF-8
-NSString *S = @"\xff\xff___WAIT___";
+NSString *S = @"\xff\xff___WAIT___"; // expected-warning {{input conversion stopped due to an input byte that does not belong to the input codeset UTF-8}}
diff --git a/test/CodeGen/imaginary.c b/test/CodeGen/imaginary.c
new file mode 100644
index 000000000000..2649cebb20fd
--- /dev/null
+++ b/test/CodeGen/imaginary.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -emit-llvm-only %s
+
+// Just verify that we don't crash until we support _Imaginary.
+double _Imaginary foo; // expected-error {{imaginary types are not supported}}
diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c
index c8de99d90177..0f94729a949e 100644
--- a/test/CodeGen/init.c
+++ b/test/CodeGen/init.c
@@ -46,3 +46,72 @@ void f6() {
int x;
long ids[] = { (long) &x };
}
+
+
+
+
+// CHECK: @test7 = global{{.*}}{ i32 0, [4 x i8] c"bar\00" }
+// PR8217
+struct a7 {
+ int b;
+ char v[];
+};
+
+struct a7 test7 = { .b = 0, .v = "bar" };
+
+
+// PR279 comment #3
+char test8(int X) {
+ char str[100000] = "abc"; // tail should be memset.
+ return str[X];
+// CHECK: @test8(
+// CHECK: call void @llvm.memset
+// CHECK: store i8 97
+// CHECK: store i8 98
+// CHECK: store i8 99
+}
+
+void bar(void*);
+
+// PR279
+int test9(int X) {
+ int Arr[100] = { X }; // Should use memset
+ bar(Arr);
+// CHECK: @test9
+// CHECK: call void @llvm.memset
+// CHECK-NOT: store i32 0
+// CHECK: call void @bar
+}
+
+struct a {
+ int a, b, c, d, e, f, g, h, i, j, k, *p;
+};
+
+struct b {
+ struct a a,b,c,d,e,f,g;
+};
+
+int test10(int X) {
+ struct b S = { .a.a = X, .d.e = X, .f.e = 0, .f.f = 0, .f.p = 0 };
+ bar(&S);
+
+ // CHECK: @test10
+ // CHECK: call void @llvm.memset
+ // CHECK-NOT: store i32 0
+ // CHECK: call void @bar
+}
+
+
+// PR9257
+struct test11S {
+ int A[10];
+};
+void test11(struct test11S *P) {
+ *P = (struct test11S) { .A = { [0 ... 3] = 4 } };
+ // CHECK: @test11
+ // CHECK: store i32 4
+ // CHECK: store i32 4
+ // CHECK: store i32 4
+ // CHECK: store i32 4
+ // CHECK: ret void
+}
diff --git a/test/CodeGen/integer-overflow.c b/test/CodeGen/integer-overflow.c
index 9bed741b3236..103cc8427bb0 100644
--- a/test/CodeGen/integer-overflow.c
+++ b/test/CodeGen/integer-overflow.c
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang_cc1 %s -emit-llvm -o - -fwrapv | FileCheck %s --check-prefix=WRAPV
// RUN: %clang_cc1 %s -emit-llvm -o - -ftrapv | FileCheck %s --check-prefix=TRAPV
+// RUN: %clang_cc1 %s -emit-llvm -o - -ftrapv -ftrapv-handler foo | FileCheck %s --check-prefix=TRAPV_HANDLER
// Tests for signed integer overflow stuff.
@@ -14,21 +15,25 @@ void test1() {
// DEFAULT: add nsw i32
// WRAPV: add i32
// TRAPV: llvm.sadd.with.overflow.i32
+ // TRAPV_HANDLER: foo(
f11G = a + b;
// DEFAULT: sub nsw i32
// WRAPV: sub i32
// TRAPV: llvm.ssub.with.overflow.i32
+ // TRAPV_HANDLER: foo(
f11G = a - b;
// DEFAULT: mul nsw i32
// WRAPV: mul i32
// TRAPV: llvm.smul.with.overflow.i32
+ // TRAPV_HANDLER: foo(
f11G = a * b;
// DEFAULT: sub nsw i32 0,
// WRAPV: sub i32 0,
// TRAPV: llvm.ssub.with.overflow.i32(i32 0
+ // TRAPV_HANDLER: foo(
f11G = -a;
// PR7426 - Overflow checking for increments.
@@ -36,10 +41,12 @@ void test1() {
// DEFAULT: add nsw i32 {{.*}}, 1
// WRAPV: add i32 {{.*}}, 1
// TRAPV: llvm.sadd.with.overflow.i32({{.*}}, i32 1)
+ // TRAPV_HANDLER: foo(
++a;
// DEFAULT: add nsw i32 {{.*}}, -1
// WRAPV: add i32 {{.*}}, -1
// TRAPV: llvm.sadd.with.overflow.i32({{.*}}, i32 -1)
+ // TRAPV_HANDLER: foo(
--a;
}
diff --git a/test/CodeGen/lineno-dbginfo.c b/test/CodeGen/lineno-dbginfo.c
index 176d4157f39d..72fa337eaf83 100644
--- a/test/CodeGen/lineno-dbginfo.c
+++ b/test/CodeGen/lineno-dbginfo.c
@@ -1,4 +1,4 @@
-// RUN: echo "#include <stdio.h>" > %t.h
+// RUN: echo "#include <stddef.h>" > %t.h
// RUN: %clang -S -g -include %t.h %s -emit-llvm -o %t.ll
// RUN: grep "i32 5" %t.ll
// outer is at line number 5.
diff --git a/test/CodeGen/mangle.c b/test/CodeGen/mangle.c
index 93d424a85dad..3bbd9c8b807e 100644
--- a/test/CodeGen/mangle.c
+++ b/test/CodeGen/mangle.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
-// CHECK: @"\01foo"
+// CHECK: @foo
// Make sure we mangle overloadable, even in C system headers.
# 1 "somesystemheader.h" 1 3 4
@@ -9,7 +9,7 @@ void __attribute__((__overloadable__)) f0(int a) {}
// CHECK: @_Z2f0l
void __attribute__((__overloadable__)) f0(long b) {}
-// CHECK: @"\01bar"
+// CHECK: @bar
// These should get merged.
void foo() __asm__("bar");
@@ -55,7 +55,7 @@ float foo8 __asm__("foo7") = 42;
int func(void);
extern int func (void) __asm__ ("FUNC");
-// CHECK: @"\01FUNC"
+// CHECK: @FUNC
int func(void) {
return 42;
}
diff --git a/test/CodeGen/may-alias.c b/test/CodeGen/may-alias.c
new file mode 100644
index 000000000000..f3ea792da36c
--- /dev/null
+++ b/test/CodeGen/may-alias.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 -disable-llvm-optzns -o %t %s
+// RUN: FileCheck < %t %s
+
+// Types with the may_alias attribute should be considered equivalent
+// to char for aliasing.
+
+typedef int __attribute__((may_alias)) aliasing_int;
+
+void test0(aliasing_int *ai, int *i)
+{
+ *ai = 0;
+ *i = 1;
+}
+
+// CHECK: store i32 0, i32* %{{.*}}, !tbaa !1
+// CHECK: store i32 1, i32* %{{.*}}, !tbaa !3
+
+// CHECK: !0 = metadata !{metadata !"any pointer", metadata !1}
+// CHECK: !1 = metadata !{metadata !"omnipotent char", metadata !2}
+// CHECK: !2 = metadata !{metadata !"Simple C/C++ TBAA", null}
+// CHECK: !3 = metadata !{metadata !"int", metadata !1}
diff --git a/test/CodeGen/mcount.c b/test/CodeGen/mcount.c
new file mode 100644
index 000000000000..1cf3d6a07162
--- /dev/null
+++ b/test/CodeGen/mcount.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -pg -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+void foo(void) {
+// CHECK: call void @mcount()
+}
diff --git a/test/CodeGen/mms-bitfields.c b/test/CodeGen/mms-bitfields.c
new file mode 100644
index 000000000000..1617e8ac40d9
--- /dev/null
+++ b/test/CodeGen/mms-bitfields.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -mms-bitfields -emit-llvm %s -o - | FileCheck %s
+
+struct s1 {
+ int f32;
+ long long f64;
+} s1;
+
+// CHECK: %struct.s1 = type { i32, [4 x i8], i64 }
+
+struct s2 {
+ int f32;
+ long long f64[4];
+} s2;
+
+// CHECK: %struct.s2 = type { i32, [4 x i8], [4 x i64] }
+
+struct s3 {
+ int f32;
+ struct s1 s;
+} s3;
+
+// CHECK: %struct.s3 = type { i32, [4 x i8], %struct.s1 }
diff --git a/test/CodeGen/mmx-builtins.c b/test/CodeGen/mmx-builtins.c
new file mode 100644
index 000000000000..7934e77890b3
--- /dev/null
+++ b/test/CodeGen/mmx-builtins.c
@@ -0,0 +1,452 @@
+// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +ssse3 -S -o - | FileCheck %s
+
+// FIXME: Disable inclusion of mm_malloc.h, our current implementation is broken
+// on win32 since we don't generally know how to find errno.h.
+#define __MM_MALLOC_H
+
+#include <tmmintrin.h>
+
+__m64 test1(__m64 a, __m64 b) {
+ // CHECK: phaddw
+ return _mm_hadd_pi16(a, b);
+}
+
+__m64 test2(__m64 a, __m64 b) {
+ // CHECK: phaddd
+ return _mm_hadd_pi32(a, b);
+}
+
+__m64 test3(__m64 a, __m64 b) {
+ // CHECK: phaddsw
+ return _mm_hadds_pi16(a, b);
+}
+
+__m64 test4(__m64 a, __m64 b) {
+ // CHECK: phsubw
+ return _mm_hsub_pi16(a, b);
+}
+
+__m64 test5(__m64 a, __m64 b) {
+ // CHECK: phsubd
+ return _mm_hsub_pi32(a, b);
+}
+
+__m64 test6(__m64 a, __m64 b) {
+ // CHECK: phsubsw
+ return _mm_hsubs_pi16(a, b);
+}
+
+__m64 test7(__m64 a, __m64 b) {
+ // CHECK: pmaddubsw
+ return _mm_maddubs_pi16(a, b);
+}
+
+__m64 test8(__m64 a, __m64 b) {
+ // CHECK: pmulhrsw
+ return _mm_mulhrs_pi16(a, b);
+}
+
+__m64 test9(__m64 a, __m64 b) {
+ // CHECK: pshufb
+ return _mm_shuffle_pi8(a, b);
+}
+
+__m64 test10(__m64 a, __m64 b) {
+ // CHECK: psignb
+ return _mm_sign_pi8(a, b);
+}
+
+__m64 test11(__m64 a, __m64 b) {
+ // CHECK: psignw
+ return _mm_sign_pi16(a, b);
+}
+
+__m64 test12(__m64 a, __m64 b) {
+ // CHECK: psignd
+ return _mm_sign_pi32(a, b);
+}
+
+__m64 test13(__m64 a) {
+ // CHECK: pabsb
+ return _mm_abs_pi8(a);
+}
+
+__m64 test14(__m64 a) {
+ // CHECK: pabsw
+ return _mm_abs_pi16(a);
+}
+
+__m64 test15(__m64 a) {
+ // CHECK: pabsd
+ return _mm_abs_pi32(a);
+}
+
+__m64 test16(__m64 a, __m64 b) {
+ // CHECK: palignr
+ return _mm_alignr_pi8(a, b, 2);
+}
+
+__m64 test17(__m128d a) {
+ // CHECK: cvtpd2pi
+ return _mm_cvtpd_pi32(a);
+}
+
+__m64 test18(__m128d a) {
+ // CHECK: cvttpd2pi
+ return _mm_cvttpd_pi32(a);
+}
+
+__m128d test19(__m64 a) {
+ // CHECK: cvtpi2pd
+ return _mm_cvtpi32_pd(a);
+}
+
+__m64 test20(__m64 a, __m64 b) {
+ // CHECK: pmuludq
+ return _mm_mul_su32(a, b);
+}
+
+__m64 test21(__m64 a) {
+ // CHECK: pshufw
+ return _mm_shuffle_pi16(a, 3);
+}
+
+__m64 test22(__m64 a, __m64 b) {
+ // CHECK: pmulhuw
+ return _mm_mulhi_pu16(a, b);
+}
+
+void test23(__m64 d, __m64 n, char *p) {
+ // CHECK: maskmovq
+ _mm_maskmove_si64(d, n, p);
+}
+
+int test24(__m64 a) {
+ // CHECK: pmovmskb
+ return _mm_movemask_pi8(a);
+}
+
+void test25(__m64 *p, __m64 a) {
+ // CHECK: movntq
+ _mm_stream_pi(p, a);
+}
+
+__m64 test26(__m64 a, __m64 b) {
+ // CHECK: pavgb
+ return _mm_avg_pu8(a, b);
+}
+
+__m64 test27(__m64 a, __m64 b) {
+ // CHECK: pavgw
+ return _mm_avg_pu16(a, b);
+}
+
+__m64 test28(__m64 a, __m64 b) {
+ // CHECK: pmaxub
+ return _mm_max_pu8(a, b);
+}
+
+__m64 test29(__m64 a, __m64 b) {
+ // CHECK: pmaxsw
+ return _mm_max_pi16(a, b);
+}
+
+__m64 test30(__m64 a, __m64 b) {
+ // CHECK: pminub
+ return _mm_min_pu8(a, b);
+}
+
+__m64 test31(__m64 a, __m64 b) {
+ // CHECK: pminsw
+ return _mm_min_pi16(a, b);
+}
+
+__m64 test32(__m64 a, __m64 b) {
+ // CHECK: psadbw
+ return _mm_sad_pu8(a, b);
+}
+
+__m64 test33(__m64 a, __m64 b) {
+ // CHECK: paddb
+ return _mm_add_pi8(a, b);
+}
+
+__m64 test34(__m64 a, __m64 b) {
+ // CHECK: paddw
+ return _mm_add_pi16(a, b);
+}
+
+__m64 test35(__m64 a, __m64 b) {
+ // CHECK: paddd
+ return _mm_add_pi32(a, b);
+}
+
+__m64 test36(__m64 a, __m64 b) {
+ // CHECK: paddq
+ return __builtin_ia32_paddq(a, b);
+}
+
+__m64 test37(__m64 a, __m64 b) {
+ // CHECK: paddsb
+ return _mm_adds_pi8(a, b);
+}
+
+__m64 test38(__m64 a, __m64 b) {
+ // CHECK: paddsw
+ return _mm_adds_pi16(a, b);
+}
+
+__m64 test39(__m64 a, __m64 b) {
+ // CHECK: paddusb
+ return _mm_adds_pu8(a, b);
+}
+
+__m64 test40(__m64 a, __m64 b) {
+ // CHECK: paddusw
+ return _mm_adds_pu16(a, b);
+}
+
+__m64 test41(__m64 a, __m64 b) {
+ // CHECK: psubb
+ return _mm_sub_pi8(a, b);
+}
+
+__m64 test42(__m64 a, __m64 b) {
+ // CHECK: psubw
+ return _mm_sub_pi16(a, b);
+}
+
+__m64 test43(__m64 a, __m64 b) {
+ // CHECK: psubd
+ return _mm_sub_pi32(a, b);
+}
+
+__m64 test44(__m64 a, __m64 b) {
+ // CHECK: psubq
+ return __builtin_ia32_psubq(a, b);
+}
+
+__m64 test45(__m64 a, __m64 b) {
+ // CHECK: psubsb
+ return _mm_subs_pi8(a, b);
+}
+
+__m64 test46(__m64 a, __m64 b) {
+ // CHECK: psubsw
+ return _mm_subs_pi16(a, b);
+}
+
+__m64 test47(__m64 a, __m64 b) {
+ // CHECK: psubusb
+ return _mm_subs_pu8(a, b);
+}
+
+__m64 test48(__m64 a, __m64 b) {
+ // CHECK: psubusw
+ return _mm_subs_pu16(a, b);
+}
+
+__m64 test49(__m64 a, __m64 b) {
+ // CHECK: pmaddwd
+ return _mm_madd_pi16(a, b);
+}
+
+__m64 test50(__m64 a, __m64 b) {
+ // CHECK: pmulhw
+ return _mm_mulhi_pi16(a, b);
+}
+
+__m64 test51(__m64 a, __m64 b) {
+ // CHECK: pmullw
+ return _mm_mullo_pi16(a, b);
+}
+
+__m64 test52(__m64 a, __m64 b) {
+ // CHECK: pmullw
+ return _mm_mullo_pi16(a, b);
+}
+
+__m64 test53(__m64 a, __m64 b) {
+ // CHECK: pand
+ return _mm_and_si64(a, b);
+}
+
+__m64 test54(__m64 a, __m64 b) {
+ // CHECK: pandn
+ return _mm_andnot_si64(a, b);
+}
+
+__m64 test55(__m64 a, __m64 b) {
+ // CHECK: por
+ return _mm_or_si64(a, b);
+}
+
+__m64 test56(__m64 a, __m64 b) {
+ // CHECK: pxor
+ return _mm_xor_si64(a, b);
+}
+
+__m64 test57(__m64 a, __m64 b) {
+ // CHECK: pavgb
+ return _mm_avg_pu8(a, b);
+}
+
+__m64 test58(__m64 a, __m64 b) {
+ // CHECK: pavgw
+ return _mm_avg_pu16(a, b);
+}
+
+__m64 test59(__m64 a, __m64 b) {
+ // CHECK: psllw
+ return _mm_sll_pi16(a, b);
+}
+
+__m64 test60(__m64 a, __m64 b) {
+ // CHECK: pslld
+ return _mm_sll_pi32(a, b);
+}
+
+__m64 test61(__m64 a, __m64 b) {
+ // CHECK: psllq
+ return _mm_sll_si64(a, b);
+}
+
+__m64 test62(__m64 a, __m64 b) {
+ // CHECK: psrlw
+ return _mm_srl_pi16(a, b);
+}
+
+__m64 test63(__m64 a, __m64 b) {
+ // CHECK: psrld
+ return _mm_srl_pi32(a, b);
+}
+
+__m64 test64(__m64 a, __m64 b) {
+ // CHECK: psrlq
+ return _mm_srl_si64(a, b);
+}
+
+__m64 test65(__m64 a, __m64 b) {
+ // CHECK: psraw
+ return _mm_sra_pi16(a, b);
+}
+
+__m64 test66(__m64 a, __m64 b) {
+ // CHECK: psrad
+ return _mm_sra_pi32(a, b);
+}
+
+__m64 test67(__m64 a) {
+ // CHECK: psllw
+ return _mm_slli_pi16(a, 3);
+}
+
+__m64 test68(__m64 a) {
+ // CHECK: pslld
+ return _mm_slli_pi32(a, 3);
+}
+
+__m64 test69(__m64 a) {
+ // CHECK: psllq
+ return _mm_slli_si64(a, 3);
+}
+
+__m64 test70(__m64 a) {
+ // CHECK: psrlw
+ return _mm_srli_pi16(a, 3);
+}
+
+__m64 test71(__m64 a) {
+ // CHECK: psrld
+ return _mm_srli_pi32(a, 3);
+}
+
+__m64 test72(__m64 a) {
+ // CHECK: psrlq
+ return _mm_srli_si64(a, 3);
+}
+
+__m64 test73(__m64 a) {
+ // CHECK: psraw
+ return _mm_srai_pi16(a, 3);
+}
+
+__m64 test74(__m64 a) {
+ // CHECK: psrad
+ return _mm_srai_pi32(a, 3);
+}
+
+__m64 test75(__m64 a, __m64 b) {
+ // CHECK: packsswb
+ return _mm_packs_pi16(a, b);
+}
+
+__m64 test76(__m64 a, __m64 b) {
+ // CHECK: packssdw
+ return _mm_packs_pi32(a, b);
+}
+
+__m64 test77(__m64 a, __m64 b) {
+ // CHECK: packuswb
+ return _mm_packs_pu16(a, b);
+}
+
+__m64 test78(__m64 a, __m64 b) {
+ // CHECK: punpckhbw
+ return _mm_unpackhi_pi8(a, b);
+}
+
+__m64 test79(__m64 a, __m64 b) {
+ // CHECK: punpckhwd
+ return _mm_unpackhi_pi16(a, b);
+}
+
+__m64 test80(__m64 a, __m64 b) {
+ // CHECK: punpckhdq
+ return _mm_unpackhi_pi32(a, b);
+}
+
+__m64 test81(__m64 a, __m64 b) {
+ // CHECK: punpcklbw
+ return _mm_unpacklo_pi8(a, b);
+}
+
+__m64 test82(__m64 a, __m64 b) {
+ // CHECK: punpcklwd
+ return _mm_unpacklo_pi16(a, b);
+}
+
+__m64 test83(__m64 a, __m64 b) {
+ // CHECK: punpckldq
+ return _mm_unpacklo_pi32(a, b);
+}
+
+__m64 test84(__m64 a, __m64 b) {
+ // CHECK: pcmpeqb
+ return _mm_cmpeq_pi8(a, b);
+}
+
+__m64 test85(__m64 a, __m64 b) {
+ // CHECK: pcmpeqw
+ return _mm_cmpeq_pi16(a, b);
+}
+
+__m64 test86(__m64 a, __m64 b) {
+ // CHECK: pcmpeqd
+ return _mm_cmpeq_pi32(a, b);
+}
+
+__m64 test87(__m64 a, __m64 b) {
+ // CHECK: pcmpgtb
+ return _mm_cmpgt_pi8(a, b);
+}
+
+__m64 test88(__m64 a, __m64 b) {
+ // CHECK: pcmpgtw
+ return _mm_cmpgt_pi16(a, b);
+}
+
+__m64 test89(__m64 a, __m64 b) {
+ // CHECK: pcmpgtd
+ return _mm_cmpgt_pi32(a, b);
+}
diff --git a/test/CodeGen/mmx-shift-with-immediate.c b/test/CodeGen/mmx-shift-with-immediate.c
new file mode 100644
index 000000000000..f430d2e4a253
--- /dev/null
+++ b/test/CodeGen/mmx-shift-with-immediate.c
@@ -0,0 +1,23 @@
+// RUN: %clang -mmmx -ccc-host-triple i386-unknown-unknown -emit-llvm -S %s -o - | FileCheck %s
+#include <mmintrin.h>
+
+void shift(__m64 a, __m64 b, int c) {
+ // CHECK: x86_mmx @llvm.x86.mmx.pslli.w(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_slli_pi16(a, c);
+ // CHECK: x86_mmx @llvm.x86.mmx.pslli.d(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_slli_pi32(a, c);
+ // CHECK: x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_slli_si64(a, c);
+
+ // CHECK: x86_mmx @llvm.x86.mmx.psrli.w(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_srli_pi16(a, c);
+ // CHECK: x86_mmx @llvm.x86.mmx.psrli.d(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_srli_pi32(a, c);
+ // CHECK: x86_mmx @llvm.x86.mmx.psrli.q(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_srli_si64(a, c);
+
+ // CHECK: x86_mmx @llvm.x86.mmx.psrai.w(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_srai_pi16(a, c);
+ // CHECK: x86_mmx @llvm.x86.mmx.psrai.d(x86_mmx %{{.*}}, i32 {{.*}})
+ _mm_srai_pi32(a, c);
+}
diff --git a/test/CodeGen/ms-anonymous-struct.c b/test/CodeGen/ms-anonymous-struct.c
new file mode 100644
index 000000000000..3afe440cafe7
--- /dev/null
+++ b/test/CodeGen/ms-anonymous-struct.c
@@ -0,0 +1,99 @@
+// RUN: %clang_cc1 -fms-extensions -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: %struct.nested1 = type { i32, i32 }
+typedef struct nested1 {
+ int a1;
+ int b1;
+} NESTED1;
+
+// CHECK: %struct.nested2 = type { i32, %struct.nested1, i32 }
+struct nested2 {
+ int a;
+ NESTED1;
+ int b;
+};
+
+// CHECK: %struct.test = type { i32, %struct.nested2, i32 }
+struct test {
+ int x;
+ struct nested2;
+ int y;
+};
+
+
+void foo()
+{
+ // CHECK: %var = alloca %struct.test, align 4
+ struct test var;
+
+ // CHECK: getelementptr inbounds %struct.test* %var, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 0
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var.a;
+
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %var, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 2
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var.b;
+
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %var, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested1* %{{.*}}, i32 0, i32 0
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var.a1;
+
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}var, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested1* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var.b1;
+
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %var, i32 0, i32 0
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var.x;
+
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %var, i32 0, i32 2
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var.y;
+}
+
+void foo2(struct test* var)
+{
+ // CHECK: alloca %struct.test*, align
+ // CHECK-NEXT: store %struct.test* %var, %struct.test** %{{.*}}, align
+ // CHECK-NEXT: load %struct.test** %{{.*}}, align
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 0
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var->a;
+
+ // CHECK-NEXT: load %struct.test** %{{.*}}, align
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 2
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var->b;
+
+ // CHECK-NEXT: load %struct.test** %{{.*}}, align
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested1* %{{.*}}, i32 0, i32 0
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var->a1;
+
+ // CHECK-NEXT: load %struct.test** %{{.*}}, align
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested2* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: getelementptr inbounds %struct.nested1* %{{.*}}, i32 0, i32 1
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var->b1;
+
+ // CHECK-NEXT: load %struct.test** %{{.*}}, align
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}, i32 0, i32 0
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var->x;
+
+ // CHECK-NEXT: load %struct.test** %{{.*}}, align
+ // CHECK-NEXT: getelementptr inbounds %struct.test* %{{.*}}, i32 0, i32 2
+ // CHECK-NEXT: load i32* %{{.*}}, align 4
+ var->y;
+}
diff --git a/test/CodeGen/mult-alt-generic.c b/test/CodeGen/mult-alt-generic.c
new file mode 100644
index 000000000000..9ae1bbfcb1f6
--- /dev/null
+++ b/test/CodeGen/mult-alt-generic.c
@@ -0,0 +1,283 @@
+// RUN: %clang_cc1 -triple i686 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple arm %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple bfin %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple cellspu %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple mblaze %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple mips %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple mipsel %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple s390x %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple sparc %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple thumb %s -emit-llvm -o - | FileCheck %s
+
+int mout0;
+int min1;
+int marray[2];
+
+// CHECK: @single_m
+void single_m()
+{
+ // CHECK: call void asm "foo $1,$0", "=*m,*m[[CLOBBERS:[a-zA-Z0-9@%{},~_ ]*\"]](i32* {{[a-zA-Z0-9@%]+}}, i32* {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=m" (mout0) : "m" (min1));
+}
+
+// CHECK: @single_o
+void single_o()
+{
+ register int out0 = 0;
+ register int index = 1;
+ // Doesn't really do an offset...
+ //asm("foo %1, %2,%0" : "=r" (out0) : "o" (min1));
+}
+
+// CHECK: @single_V
+void single_V()
+{
+// asm("foo %1,%0" : "=m" (mout0) : "V" (min1));
+}
+
+// CHECK: @single_lt
+void single_lt()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r,<r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "<r" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,r<[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "r<" (in1));
+}
+
+// CHECK: @single_gt
+void single_gt()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r,>r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : ">r" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,r>[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "r>" (in1));
+}
+
+// CHECK: @single_r
+void single_r()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r,r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "r" (in1));
+}
+
+// CHECK: @single_i
+void single_i()
+{
+ register int out0 = 0;
+ // CHECK: call i32 asm "foo $1,$0", "=r,i[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r" (out0) : "i" (1));
+}
+
+// CHECK: @single_n
+void single_n()
+{
+ register int out0 = 0;
+ // CHECK: call i32 asm "foo $1,$0", "=r,n[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r" (out0) : "n" (1));
+}
+
+// CHECK: @single_E
+void single_E()
+{
+ register double out0 = 0.0;
+ // CHECK: call double asm "foo $1,$0", "=r,E[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r" (out0) : "E" (1.0e+01));
+}
+
+// CHECK: @single_F
+void single_F()
+{
+ register double out0 = 0.0;
+ // CHECK: call double asm "foo $1,$0", "=r,F[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r" (out0) : "F" (1.0));
+}
+
+// CHECK: @single_s
+void single_s()
+{
+ register int out0 = 0;
+ //asm("foo %1,%0" : "=r" (out0) : "s" (single_s));
+}
+
+// CHECK: @single_g
+void single_g()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "g" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "g" (min1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,imr[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r" (out0) : "g" (1));
+}
+
+// CHECK: @single_X
+void single_X()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "X" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r" (out0) : "X" (min1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r" (out0) : "X" (1));
+ // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
+ asm("foo %1,%0" : "=r" (out0) : "X" (marray));
+ // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r" (out0) : "X" (1.0e+01));
+ // CHECK: call i32 asm "foo $1,$0", "=r,X[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r" (out0) : "X" (1.0));
+}
+
+// CHECK: @single_p
+void single_p()
+{
+ register int out0 = 0;
+ // Constraint converted differently on different platforms moved to platform-specific.
+ // : call i32 asm "foo $1,$0", "=r,im[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
+ asm("foo %1,%0" : "=r" (out0) : "p" (marray));
+}
+
+// CHECK: @multi_m
+void multi_m()
+{
+ // CHECK: call void asm "foo $1,$0", "=*m|r,m|r[[CLOBBERS]](i32* {{[a-zA-Z0-9@%]+}}, i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=m,r" (mout0) : "m,r" (min1));
+}
+
+// CHECK: @multi_o
+void multi_o()
+{
+ register int out0 = 0;
+ register int index = 1;
+ // Doesn't really do an offset...
+ //asm("foo %1, %2,%0" : "=r,r" (out0) : "r,o" (min1));
+}
+
+// CHECK: @multi_V
+void multi_V()
+{
+// asm("foo %1,%0" : "=m,r" (mout0) : "r,V" (min1));
+}
+
+// CHECK: @multi_lt
+void multi_lt()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|<r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,<r" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|r<[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,r<" (in1));
+}
+
+// CHECK: @multi_gt
+void multi_gt()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|>r[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,>r" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|r>[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,r>" (in1));
+}
+
+// CHECK: @multi_r
+void multi_r()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|m[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,m" (in1));
+}
+
+// CHECK: @multi_i
+void multi_i()
+{
+ register int out0 = 0;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|i[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r,r" (out0) : "r,i" (1));
+}
+
+// CHECK: @multi_n
+void multi_n()
+{
+ register int out0 = 0;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|n[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r,r" (out0) : "r,n" (1));
+}
+
+// CHECK: @multi_E
+void multi_E()
+{
+ register double out0 = 0.0;
+ // CHECK: call double asm "foo $1,$0", "=r|r,r|E[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,E" (1.0e+01));
+}
+
+// CHECK: @multi_F
+void multi_F()
+{
+ register double out0 = 0.0;
+ // CHECK: call double asm "foo $1,$0", "=r|r,r|F[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,F" (1.0));
+}
+
+// CHECK: @multi_s
+void multi_s()
+{
+ register int out0 = 0;
+ //asm("foo %1,%0" : "=r,r" (out0) : "r,s" (multi_s));
+}
+
+// CHECK: @multi_g
+void multi_g()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,g" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,g" (min1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|imr[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r,r" (out0) : "r,g" (1));
+}
+
+// CHECK: @multi_X
+void multi_X()
+{
+ register int out0 = 0;
+ register int in1 = 1;
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,X" (in1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,X" (min1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32 1)
+ asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
+ asm("foo %1,%0" : "=r,r" (out0) : "r,X" (marray));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1.0e+01));
+ // CHECK: call i32 asm "foo $1,$0", "=r|r,r|X[[CLOBBERS]](double {{[0-9.eE+-]+}})
+ asm("foo %1,%0" : "=r,r" (out0) : "r,X" (1.0));
+}
+
+// CHECK: @multi_p
+void multi_p()
+{
+ register int out0 = 0;
+ // Constraint converted differently on different platforms moved to platform-specific.
+ // : call i32 asm "foo $1,$0", "=r|r,r|im[[CLOBBERS]](i32* getelementptr inbounds ([2 x i32]* {{[a-zA-Z0-9@%]+}}, i32 0, i32 0))
+ asm("foo %1,%0" : "=r,r" (out0) : "r,p" (marray));
+}
diff --git a/test/CodeGen/mult-alt-x86.c b/test/CodeGen/mult-alt-x86.c
new file mode 100644
index 000000000000..84011f2d5303
--- /dev/null
+++ b/test/CodeGen/mult-alt-x86.c
@@ -0,0 +1,374 @@
+// RUN: %clang_cc1 -triple i686 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64 -emit-llvm %s -o - | FileCheck %s
+
+int mout0;
+int min1;
+int marray[2];
+double dout0;
+double din1;
+
+// CHECK: @single_R
+void single_R()
+{
+ // CHECK: asm "foo $1,$0", "=R,R[[CLOBBERS:[a-zA-Z0-9@%{},~_ ]*\"]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=R" (mout0) : "R" (min1));
+}
+
+// CHECK: @single_q
+void single_q()
+{
+ // CHECK: asm "foo $1,$0", "=q,q[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=q" (mout0) : "q" (min1));
+}
+
+// CHECK: @single_Q
+void single_Q()
+{
+ // CHECK: asm "foo $1,$0", "=Q,Q[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=Q" (mout0) : "Q" (min1));
+}
+
+// CHECK: @single_a
+void single_a()
+{
+ // CHECK: asm "foo $1,$0", "={ax},{ax}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=a" (mout0) : "a" (min1));
+}
+
+// CHECK: @single_b
+void single_b()
+{
+ // CHECK: asm "foo $1,$0", "={bx},{bx}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=b" (mout0) : "b" (min1));
+}
+
+// CHECK: @single_c
+void single_c()
+{
+ // CHECK: asm "foo $1,$0", "={cx},{cx}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=c" (mout0) : "c" (min1));
+}
+
+// CHECK: @single_d
+void single_d()
+{
+ // CHECK: asm "foo $1,$0", "={dx},{dx}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=d" (mout0) : "d" (min1));
+}
+
+// CHECK: @single_S
+void single_S()
+{
+ // CHECK: asm "foo $1,$0", "={si},{si}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=S" (mout0) : "S" (min1));
+}
+
+// CHECK: @single_D
+void single_D()
+{
+ // CHECK: asm "foo $1,$0", "={di},{di}[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=D" (mout0) : "D" (min1));
+}
+
+// CHECK: @single_A
+void single_A()
+{
+ // CHECK: asm "foo $1,$0", "=A,A[[CLOBBERS]](i32 {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=A" (mout0) : "A" (min1));
+}
+
+// CHECK: @single_f
+void single_f()
+{
+//FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
+}
+
+// CHECK: @single_t
+void single_t()
+{
+//FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
+}
+
+// CHECK: @single_u
+void single_u()
+{
+//FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
+}
+
+// CHECK: @single_y
+void single_y()
+{
+ // CHECK: call double asm "foo $1,$0", "=y,y[[CLOBBERS]](double {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=y" (dout0) : "y" (din1));
+}
+
+// CHECK: @single_x
+void single_x()
+{
+ // CHECK: asm "foo $1,$0", "=x,x[[CLOBBERS]](double {{[a-zA-Z0-9@%]+}})
+ asm("foo %1,%0" : "=x" (dout0) : "x" (din1));
+}
+
+// CHECK: @single_Y
+void single_Y0()
+{
+ // Y constraint currently broken.
+ //asm("foo %1,%0" : "=Y0" (mout0) : "Y0" (min1));
+ //asm("foo %1,%0" : "=Yz" (mout0) : "Yz" (min1));
+ //asm("foo %1,%0" : "=Yt" (mout0) : "Yt" (min1));
+ //asm("foo %1,%0" : "=Yi" (mout0) : "Yi" (min1));
+ //asm("foo %1,%0" : "=Ym" (mout0) : "Ym" (min1));
+}
+
+// CHECK: @single_I
+void single_I()
+{
+ // CHECK: asm "foo $1,$0", "=*m,I[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "I" (1));
+}
+
+// CHECK: @single_J
+void single_J()
+{
+ // CHECK: asm "foo $1,$0", "=*m,J[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "J" (1));
+}
+
+// CHECK: @single_K
+void single_K()
+{
+ // CHECK: asm "foo $1,$0", "=*m,K[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "K" (1));
+}
+
+// CHECK: @single_L
+void single_L()
+{
+ // CHECK: asm "foo $1,$0", "=*m,L[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "L" (1));
+}
+
+// CHECK: @single_M
+void single_M()
+{
+ // CHECK: asm "foo $1,$0", "=*m,M[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "M" (1));
+}
+
+// CHECK: @single_N
+void single_N()
+{
+ // CHECK: asm "foo $1,$0", "=*m,N[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "N" (1));
+}
+
+// CHECK: @single_G
+void single_G()
+{
+ // CHECK: asm "foo $1,$0", "=*m,G[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
+ asm("foo %1,%0" : "=m" (mout0) : "G" (1.0));
+}
+
+// CHECK: @single_C
+void single_C()
+{
+ // CHECK: asm "foo $1,$0", "=*m,C[[CLOBBERS]](i32* @mout0, double {{1.[0]+e[+]*[0]+}})
+ asm("foo %1,%0" : "=m" (mout0) : "C" (1.0));
+}
+
+// CHECK: @single_e
+void single_e()
+{
+ // CHECK: asm "foo $1,$0", "=*m,e[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "e" (1));
+}
+
+// CHECK: @single_Z
+void single_Z()
+{
+ // CHECK: asm "foo $1,$0", "=*m,Z[[CLOBBERS]](i32* @mout0, i32 1)
+ asm("foo %1,%0" : "=m" (mout0) : "Z" (1));
+}
+
+// CHECK: @multi_R
+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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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: @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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// CHECK: @multi_f
+void multi_f()
+{
+//FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
+}
+
+// CHECK: @multi_t
+void multi_t()
+{
+//FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
+}
+
+// CHECK: @multi_u
+void multi_u()
+{
+//FIXME: I don't know how to do an 80387 floating point stack register operation, which I think is fp80.
+}
+
+// CHECK: @multi_y
+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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
+
+// 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));
+}
diff --git a/test/CodeGen/no-common.c b/test/CodeGen/no-common.c
index 03a5bb064c31..7beefc7b690d 100644
--- a/test/CodeGen/no-common.c
+++ b/test/CodeGen/no-common.c
@@ -1,6 +1,15 @@
-// RUN: %clang -emit-llvm -S -o %t %s
-// RUN: grep '@x = common global' %t
-// RUN: %clang -fno-common -emit-llvm -S -o %t %s
-// RUN: grep '@x = global' %t
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-DEFAULT
+// RUN: %clang_cc1 %s -fno-common -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-NOCOMMON
+// CHECK-DEFAULT: @x = common global
+// CHECK-NOCOMMON: @x = global
int x;
+
+// CHECK-DEFAULT: @ABC = global
+// CHECK-NOCOMMON: @ABC = global
+typedef void* (*fn_t)(long a, long b, char *f, int c);
+fn_t ABC __attribute__ ((nocommon));
+
+// CHECK-DEFAULT: @y = common global
+// CHECK-NOCOMMON: @y = common global
+int y __attribute__((common)); \ No newline at end of file
diff --git a/test/CodeGen/packed-structure.c b/test/CodeGen/packed-structure.c
index 2934d01d6496..731a50bb0772 100644
--- a/test/CodeGen/packed-structure.c
+++ b/test/CodeGen/packed-structure.c
@@ -87,3 +87,16 @@ int s2_load_y(struct s2 *a) { return a->y; }
// CHECK-FUNCTIONS: define void @s2_copy
// CHECK-FUNCTIONS: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 8, i32 2, i1 false)
void s2_copy(struct s2 *a, struct s2 *b) { *b = *a; }
+
+struct __attribute__((packed, aligned)) s3 {
+ short aShort;
+ int anInt;
+};
+// CHECK-GLOBAL: @s3_1 = global i32 2
+int s3_1 = __alignof(((struct s3*) 0)->anInt);
+// CHECK-FUNCTIONS: define i32 @test3(
+int test3(struct s3 *ptr) {
+ // CHECK-FUNCTIONS: [[PTR:%.*]] = getelementptr inbounds {{%.*}}* {{%.*}}, i32 0, i32 1
+ // CHECK-FUNCTIONS-NEXT: load i32* [[PTR]], align 2
+ return ptr->anInt;
+}
diff --git a/test/CodeGen/palignr.c b/test/CodeGen/palignr.c
index e9c1dbd012b5..ed86c9ec13cb 100644
--- a/test/CodeGen/palignr.c
+++ b/test/CodeGen/palignr.c
@@ -17,13 +17,13 @@ int4 align4(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 32); }
#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n)))
typedef __attribute__((vector_size(8))) int int2;
-// CHECK-NOT: palignr
+// CHECK: palignr
int2 align5(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 8); }
-// CHECK: psrlq
+// CHECK: palignr
int2 align6(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 9); }
-// CHECK: xor
+// CHECK: palignr
int2 align7(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 16); }
// CHECK: palignr
diff --git a/test/CodeGen/pascal-wchar-string.c b/test/CodeGen/pascal-wchar-string.c
index 89e4de489f09..7a03463d2cf1 100644
--- a/test/CodeGen/pascal-wchar-string.c
+++ b/test/CodeGen/pascal-wchar-string.c
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -emit-llvm -o - %s -fpascal-strings -fshort-wchar | FileCheck %s
-// rdar: // 8020384
+// rdar://8020384
+
+#include <stddef.h>
extern void abort (void);
@@ -29,3 +31,11 @@ int main(int argc, char* argv[])
// CHECK: c"\03\00b\00a\00r\00\00\00"
// CHECK: c"\04\00g\00o\00r\00f\00\00\00"
+
+
+// PR8856 - -fshort-wchar makes wchar_t be unsigned.
+// CHECK: @test2
+// CHECK: volatile store i32 1, i32* %isUnsigned
+void test2() {
+ volatile int isUnsigned = (wchar_t)-1 > (wchar_t)0;
+}
diff --git a/test/CodeGen/pointer-arithmetic.c b/test/CodeGen/pointer-arithmetic.c
index 33465e0aa137..f67a36d66e4b 100644
--- a/test/CodeGen/pointer-arithmetic.c
+++ b/test/CodeGen/pointer-arithmetic.c
@@ -9,6 +9,7 @@ int f1(const char *a, char *b) { return b - a; }
// GNU extensions
typedef void (*FP)(void);
void *f2(void *a, int b) { return a + b; }
+void *f2_0(void *a, int b) { return &a[b]; }
void *f2_1(void *a, int b) { return (a += b); }
void *f3(int a, void *b) { return a + b; }
void *f3_1(int a, void *b) { return (a += b); }
@@ -20,3 +21,5 @@ FP f6(int a, FP b) { return a + b; }
FP f6_1(int a, FP b) { return (a += b); }
FP f7(FP a, int b) { return a - b; }
FP f7_1(FP a, int b) { return (a -= b); }
+void f8(void *a, int b) { return *(a + b); }
+void f8_1(void *a, int b) { return a[b]; }
diff --git a/test/CodeGen/pointer-signext.c b/test/CodeGen/pointer-signext.c
new file mode 100644
index 000000000000..e809effb2b10
--- /dev/null
+++ b/test/CodeGen/pointer-signext.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s
+
+// Under Windows 64, int and long are 32-bits. Make sure pointer math doesn't
+// cause any sign extensions.
+
+// CHECK: [[P:%.*]] = add i64 %param, -8
+// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*\*]]
+// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]] [[Q]], i64 0, i32 0
+
+#define CR(Record, TYPE, Field) \
+ ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))
+
+typedef struct _LIST_ENTRY {
+ struct _LIST_ENTRY *ForwardLink;
+ struct _LIST_ENTRY *BackLink;
+} LIST_ENTRY;
+
+typedef struct {
+ unsigned long long Signature;
+ LIST_ENTRY Link;
+} MEMORY_MAP;
+
+int test(unsigned long long param)
+{
+ LIST_ENTRY *Link;
+ MEMORY_MAP *Entry;
+
+ Link = (LIST_ENTRY *) param;
+
+ Entry = CR (Link, MEMORY_MAP, Link);
+ return (int) Entry->Signature;
+}
diff --git a/test/CodeGen/pragma-weak.c b/test/CodeGen/pragma-weak.c
index 5c2866e3d35f..1de60e106a95 100644
--- a/test/CodeGen/pragma-weak.c
+++ b/test/CodeGen/pragma-weak.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -verify | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm %s -o - -verify | FileCheck %s
// CHECK: @weakvar = weak global
// CHECK: @__weakvar_alias = common global
diff --git a/test/CodeGen/predefined-expr.c b/test/CodeGen/predefined-expr.c
index 9be5754114bf..e2826b68d7df 100644
--- a/test/CodeGen/predefined-expr.c
+++ b/test/CodeGen/predefined-expr.c
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-// CHECK: @__func__.plainFunction = private constant [14 x i8] c"plainFunction\00"
-// CHECK: @__PRETTY_FUNCTION__.plainFunction = private constant [21 x i8] c"void plainFunction()\00"
-// CHECK: @__func__.externFunction = private constant [15 x i8] c"externFunction\00"
-// CHECK: @__PRETTY_FUNCTION__.externFunction = private constant [22 x i8] c"void externFunction()\00"
-// CHECK: @__func__.privateExternFunction = private constant [22 x i8] c"privateExternFunction\00"
-// CHECK: @__PRETTY_FUNCTION__.privateExternFunction = private constant [29 x i8] c"void privateExternFunction()\00"
-// CHECK: @__func__.staticFunction = private constant [15 x i8] c"staticFunction\00"
-// CHECK: @__PRETTY_FUNCTION__.staticFunction = private constant [22 x i8] c"void staticFunction()\00"
+// CHECK: @__func__.plainFunction = private unnamed_addr constant [14 x i8] c"plainFunction\00"
+// CHECK: @__PRETTY_FUNCTION__.plainFunction = private unnamed_addr constant [21 x i8] c"void plainFunction()\00"
+// CHECK: @__func__.externFunction = private unnamed_addr constant [15 x i8] c"externFunction\00"
+// CHECK: @__PRETTY_FUNCTION__.externFunction = private unnamed_addr constant [22 x i8] c"void externFunction()\00"
+// CHECK: @__func__.privateExternFunction = private unnamed_addr constant [22 x i8] c"privateExternFunction\00"
+// CHECK: @__PRETTY_FUNCTION__.privateExternFunction = private unnamed_addr constant [29 x i8] c"void privateExternFunction()\00"
+// CHECK: @__func__.staticFunction = private unnamed_addr constant [15 x i8] c"staticFunction\00"
+// CHECK: @__PRETTY_FUNCTION__.staticFunction = private unnamed_addr constant [22 x i8] c"void staticFunction()\00"
int printf(const char *, ...);
diff --git a/test/CodeGen/regparm-flag.c b/test/CodeGen/regparm-flag.c
new file mode 100644
index 000000000000..f37239e473cd
--- /dev/null
+++ b/test/CodeGen/regparm-flag.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -mregparm 4 %s -emit-llvm -o %t
+// RUN: FileCheck < %t %s
+
+void f1(int a, int b, int c, int d,
+ int e, int f, int g, int h);
+
+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: declare void @f1(i32 inreg, i32 inreg, i32 inreg, i32 inreg,
+// CHECK: i32, i32, i32, i32)
+
diff --git a/test/CodeGen/regparm.c b/test/CodeGen/regparm.c
index ec5cbab16a5b..d628b685f94a 100644
--- a/test/CodeGen/regparm.c
+++ b/test/CodeGen/regparm.c
@@ -11,8 +11,7 @@ typedef struct {
typedef void (*FType)(int, int) __attribute ((regparm (3), stdcall));
FType bar;
-static void FASTCALL
-reduced(char b, double c, foo* d, double e, int f);
+extern void FASTCALL reduced(char b, double c, foo* d, double e, int f);
// PR7025
void FASTCALL f1(int i, int j, int k);
@@ -21,7 +20,7 @@ void f1(int i, int j, int k) { }
int
main(void) {
- // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.anon* inreg null
+ // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.foo* inreg null
reduced(0, 0.0, 0, 0.0, 0);
// CHECK: call x86_stdcallcc void {{.*}}(i32 inreg 1, i32 inreg 2)
bar(1,2);
diff --git a/test/CodeGen/sizeof-vla.c b/test/CodeGen/sizeof-vla.c
index b0c514fd0161..c5fc91251933 100644
--- a/test/CodeGen/sizeof-vla.c
+++ b/test/CodeGen/sizeof-vla.c
@@ -2,7 +2,7 @@
// PR3442
-static void *g(unsigned long len);
+void *g(unsigned long len);
void
f(int n)
diff --git a/test/CodeGen/statements.c b/test/CodeGen/statements.c
index 0ea0597835cb..1d4f633f6172 100644
--- a/test/CodeGen/statements.c
+++ b/test/CodeGen/statements.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wreturn-type %s -emit-llvm -o /dev/null
+// RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only
void test1(int x) {
switch (x) {
diff --git a/test/CodeGen/string-literal-short-wstring.c b/test/CodeGen/string-literal-short-wstring.c
new file mode 100644
index 000000000000..8c2e412f22ba
--- /dev/null
+++ b/test/CodeGen/string-literal-short-wstring.c
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -x c++ -emit-llvm -fshort-wchar %s -o - | FileCheck %s
+// Runs in c++ mode so that wchar_t is available.
+
+int main() {
+ // This should convert to utf8.
+ // CHECK: internal constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
+ char b[10] = "\u1120\u0220\U00102030";
+
+ // CHECK: private unnamed_addr constant [6 x i8] c"A\00B\00\00\00"
+ const wchar_t *foo = L"AB";
+
+ // This should convert to utf16.
+ // CHECK: private unnamed_addr constant [10 x i8] c" \11 \02\C8\DB0\DC\00\00"
+ const wchar_t *bar = L"\u1120\u0220\U00102030";
+
+
+
+ // Should pick second character.
+ // CHECK: store i8 98
+ char c = 'ab';
+
+ // CHECK: store i16 97
+ wchar_t wa = L'a';
+
+ // Should pick second character.
+ // CHECK: store i16 98
+ wchar_t wb = L'ab';
+
+ // -4085 == 0xf00b
+ // CHECK: store i16 -4085
+ wchar_t wc = L'\uF00B';
+
+ // Should take lower word of the 4byte UNC sequence. This does not match
+ // gcc. I don't understand what gcc does (it looks like it converts to utf16,
+ // then takes the second (!) utf16 word, swaps the lower two nibbles, and
+ // stores that?).
+ // CHECK: store i16 -4085
+ wchar_t wd = L'\U0010F00B'; // has utf16 encoding dbc8 dcb0
+
+ // Should pick second character. (gcc: -9205)
+ // CHECK: store i16 -4085
+ wchar_t we = L'\u1234\U0010F00B';
+}
diff --git a/test/CodeGen/string-literal.c b/test/CodeGen/string-literal.c
index 22a81e718551..6d02b0fdaf95 100644
--- a/test/CodeGen/string-literal.c
+++ b/test/CodeGen/string-literal.c
@@ -1,7 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm %s -o -
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
int main() {
+ // CHECK: internal constant [10 x i8] c"abc\00\00\00\00\00\00\00", align 1
char a[10] = "abc";
+ // This should convert to utf8.
+ // CHECK: internal constant [10 x i8] c"\E1\84\A0\C8\A0\F4\82\80\B0\00", align 1
+ char b[10] = "\u1120\u0220\U00102030";
+
+ // CHECK: private unnamed_addr constant [12 x i8] c"A\00\00\00B\00\00\00\00\00\00\00"
void *foo = L"AB";
+
+ // CHECK: private unnamed_addr constant [12 x i8] c"4\12\00\00\0B\F0\10\00\00\00\00\00"
+ void *bar = L"\u1234\U0010F00B";
}
diff --git a/test/CodeGen/struct-init.c b/test/CodeGen/struct-init.c
index 926e5a7f5dd9..861c41e59cc3 100644
--- a/test/CodeGen/struct-init.c
+++ b/test/CodeGen/struct-init.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o -
+// RUN: %clang_cc1 %s -emit-llvm-only
typedef struct _zend_ini_entry zend_ini_entry;
struct _zend_ini_entry {
@@ -18,3 +18,14 @@ struct GLGENH {
};
struct GLGENH ABHFBF = {1};
+
+typedef __attribute__(( ext_vector_type(2) )) unsigned int uint2;
+typedef __attribute__(( __vector_size__(8) )) unsigned int __neon_uint32x2_t;
+
+// rdar://8183908
+typedef struct __simd64_uint32_t {
+ __neon_uint32x2_t val;
+} uint32x2_t;
+void foo() {
+ const uint32x2_t signBit = { (uint2) 0x80000000 };
+}
diff --git a/test/CodeGen/struct-passing.c b/test/CodeGen/struct-passing.c
index cbc14d5b7819..3e173be6511f 100644
--- a/test/CodeGen/struct-passing.c
+++ b/test/CodeGen/struct-passing.c
@@ -1,11 +1,8 @@
-// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
-// RUN: grep 'declare i32 @f0() readnone' %t
-// RUN: grep 'declare i32 @f1() readonly' %t
-// RUN: grep 'declare void @f2(.* sret)' %t
-// RUN: grep 'declare void @f3(.* sret)' %t
-// RUN: grep 'declare void @f4(.* byval)' %t
-// RUN: grep 'declare void @f5(.* byval)' %t
-// PR3835
+// This verifies that structs returned from functions by value are passed
+// correctly according to their attributes and the ABI.
+// SEE: PR3835
+
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
typedef int T0;
typedef struct { int a[16]; } T1;
@@ -18,3 +15,10 @@ void __attribute__((const)) f4(T1 a);
void __attribute__((pure)) f5(T1 a);
void *ps[] = { f0, f1, f2, f3, f4, f5 };
+
+// CHECK: declare i32 @f0() readnone
+// CHECK: declare i32 @f1() readonly
+// CHECK: declare void @f2({{.*}} sret)
+// CHECK: declare void @f3({{.*}} sret)
+// CHECK: declare void @f4({{.*}} byval)
+// CHECK: declare void @f5({{.*}} byval)
diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c
index dc2d27bc16da..8b94a0976e6e 100644
--- a/test/CodeGen/switch.c
+++ b/test/CodeGen/switch.c
@@ -194,3 +194,20 @@ int f13(unsigned x) {
return 0;
}
}
+
+// Don't delete a basic block that we want to introduce later references to.
+// This isn't really specific to switches, but it's easy to show with them.
+// rdar://problem/8837067
+int f14(int x) {
+ switch (x) {
+
+ // case range so that the case block has no predecessors
+ case 0 ... 15:
+ // any expression which doesn't introduce a new block
+ (void) 0;
+ // kaboom
+
+ default:
+ return x;
+ }
+}
diff --git a/test/CodeGen/thread-specifier.c b/test/CodeGen/thread-specifier.c
index a16103f08f6d..a1f3e168000e 100644
--- a/test/CodeGen/thread-specifier.c
+++ b/test/CodeGen/thread-specifier.c
@@ -1,11 +1,15 @@
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | grep thread_local | count 4
-// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | not grep common
+// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// CHECK: @b = external thread_local global
+// CHECK: @d.e = internal thread_local global
+// CHECK: @d.f = internal thread_local global
+// CHECK: @a = thread_local global
__thread int a;
extern __thread int b;
-int c() { return &b; }
+int c() { return *&b; }
int d() {
__thread static int e;
__thread static union {float a; int b;} f = {.b = 1};
+ return 0;
}
diff --git a/test/CodeGen/transparent-union.c b/test/CodeGen/transparent-union.c
new file mode 100644
index 000000000000..97a731855c73
--- /dev/null
+++ b/test/CodeGen/transparent-union.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -o %t %s
+// RUN: FileCheck < %t %s
+//
+// FIXME: Note that we don't currently get the ABI right here. f0() should be
+// f0(i8*).
+
+typedef union {
+ void *f0;
+} transp_t0 __attribute__((transparent_union));
+
+void f0(transp_t0 obj);
+
+// CHECK: define void @f1_0(i32* %a0)
+// CHECK: call void @f0(%union.transp_t0* byval %{{.*}})
+// CHECK: call void %{{.*}}(i8* %{{[a-z0-9]*}})
+// CHECK: }
+void f1_0(int *a0) {
+ void (*f0p)(void *) = f0;
+ f0(a0);
+ f0p(a0);
+}
+
+void f1_1(int *a0) {
+ f0((transp_t0) { a0 });
+}
diff --git a/test/CodeGen/va_list_test.c b/test/CodeGen/va_list_test.c
new file mode 100644
index 000000000000..74f7837d2d3c
--- /dev/null
+++ b/test/CodeGen/va_list_test.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-unknown-freebsd -emit-llvm -o - %s| FileCheck -check-prefix=SVR4-CHECK %s
+
+#include <stdarg.h>
+
+int va_list_size = sizeof(va_list);
+// SVR4-CHECK: va_list_size = global i32 12, align 4
diff --git a/test/CodeGen/visibility.c b/test/CodeGen/visibility.c
index 8f81c8f3a990..fa4b5993092c 100644
--- a/test/CodeGen/visibility.c
+++ b/test/CodeGen/visibility.c
@@ -1,33 +1,38 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility default -emit-llvm -o %t %s
-// RUN: grep '@g_com = common global i32 0' %t
-// RUN: grep '@g_def = global i32 0' %t
-// RUN: grep '@g_ext = external global i32' %t
-// RUN: grep '@g_deferred = internal global' %t
-// RUN: grep 'declare void @f_ext()' %t
-// RUN: grep 'define internal void @f_deferred()' %t
-// RUN: grep 'define i32 @f_def()' %t
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility protected -emit-llvm -o %t %s
-// RUN: grep '@g_com = common protected global i32 0' %t
-// RUN: grep '@g_def = protected global i32 0' %t
-// RUN: grep '@g_ext = external global i32' %t
-// RUN: grep '@g_deferred = internal global' %t
-// RUN: grep 'declare void @f_ext()' %t
-// RUN: grep 'define internal void @f_deferred()' %t
-// RUN: grep 'define protected i32 @f_def()' %t
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fvisibility hidden -emit-llvm -o %t %s
-// RUN: grep '@g_com = common hidden global i32 0' %t
-// RUN: grep '@g_def = hidden global i32 0' %t
-// RUN: grep '@g_ext = external global i32' %t
-// RUN: grep '@g_deferred = internal global' %t
-// RUN: grep 'declare void @f_ext()' %t
-// RUN: grep 'define internal void @f_deferred()' %t
-// RUN: grep 'define hidden i32 @f_def()' %t
+// RUN: %clang_cc1 %s -triple i386-unknown-unknown -fvisibility default -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-DEFAULT
+// RUN: %clang_cc1 %s -triple i386-unknown-unknown -fvisibility protected -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-PROTECTED
+// RUN: %clang_cc1 %s -triple i386-unknown-unknown -fvisibility hidden -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-HIDDEN
+// CHECK-DEFAULT: @g_def = global i32 0
+// CHECK-DEFAULT: @g_com = common global i32 0
+// CHECK-DEFAULT: @g_ext = external global i32
+// CHECK-DEFAULT: @g_deferred = internal global
+// CHECK-PROTECTED: @g_def = protected global i32 0
+// CHECK-PROTECTED: @g_com = common protected global i32 0
+// CHECK-PROTECTED: @g_ext = external global i32
+// CHECK-PROTECTED: @g_deferred = internal global
+// CHECK-HIDDEN: @g_def = hidden global i32 0
+// CHECK-HIDDEN: @g_com = common hidden global i32 0
+// CHECK-HIDDEN: @g_ext = external global i32
+// CHECK-HIDDEN: @g_deferred = internal global
int g_com;
int g_def = 0;
extern int g_ext;
static char g_deferred[] = "hello";
+// CHECK-DEFAULT: @test4 = hidden global i32 10
+// CHECK-PROTECTED: @test4 = hidden global i32 10
+// CHECK-HIDDEN: @test4 = hidden global i32 10
+
+// CHECK-DEFAULT: define i32 @f_def()
+// CHECK-DEFAULT: declare void @f_ext()
+// CHECK-DEFAULT: define internal void @f_deferred()
+// CHECK-PROTECTED: define protected i32 @f_def()
+// CHECK-PROTECTED: declare void @f_ext()
+// CHECK-PROTECTED: define internal void @f_deferred()
+// CHECK-HIDDEN: define hidden i32 @f_def()
+// CHECK-HIDDEN: declare void @f_ext()
+// CHECK-HIDDEN: define internal void @f_deferred()
+
extern void f_ext(void);
static void f_deferred(void) {
@@ -38,3 +43,27 @@ int f_def(void) {
f_deferred();
return g_com + g_def + g_ext + g_deferred[0];
}
+
+// PR8457
+// CHECK-DEFAULT: define void @test1(
+// CHECK-PROTECTED: define void @test1(
+// CHECK-HIDDEN: define void @test1(
+struct Test1 { int field; };
+void __attribute__((visibility("default"))) test1(struct Test1 *v) { }
+
+// rdar://problem/8595231
+// CHECK-DEFAULT: define void @test2()
+// CHECK-PROTECTED: define void @test2()
+// CHECK-HIDDEN: define void @test2()
+void test2(void);
+void __attribute__((visibility("default"))) test2(void) {}
+
+// CHECK-DEFAULT: define hidden void @test3()
+// CHECK-PROTECTED: define hidden void @test3()
+// CHECK-HIDDEN: define hidden void @test3()
+extern void test3(void);
+__private_extern__ void test3(void) {}
+
+// Top of file.
+extern int test4;
+__private_extern__ int test4 = 10;
diff --git a/test/CodeGen/vla.c b/test/CodeGen/vla.c
index 0c539003842a..e5114a5b0db9 100644
--- a/test/CodeGen/vla.c
+++ b/test/CodeGen/vla.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o %t
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
int b(char* x);
@@ -35,3 +35,66 @@ void g(int count) {
int (*a[5])[count];
int (*b)[][count];
}
+
+// rdar://8403108
+// CHECK: define void @f_8403108
+void f_8403108(unsigned x) {
+ // CHECK: call i8* @llvm.stacksave()
+ char s1[x];
+ while (1) {
+ // CHECK: call i8* @llvm.stacksave()
+ char s2[x];
+ if (1)
+ break;
+ // CHECK: call void @llvm.stackrestore(i8*
+ }
+ // CHECK: call void @llvm.stackrestore(i8*
+}
+
+// pr7827
+void function(short width, int data[][width]) {} // expected-note {{passing argument to parameter 'data' here}}
+
+void test() {
+ int bork[4][13];
+ // CHECK: call void @function(i16 signext 1, i32* null)
+ function(1, 0);
+ // CHECK: call void @function(i16 signext 1, i32* inttoptr
+ function(1, 0xbadbeef); // expected-warning {{incompatible integer to pointer conversion passing}}
+ // CHECK: call void @function(i16 signext 1, i32* {{.*}})
+ function(1, bork);
+}
+
+void function1(short width, int data[][width][width]) {}
+void test1() {
+ int bork[4][13][15];
+ // CHECK: call void @function1(i16 signext 1, i32* {{.*}})
+ function1(1, bork);
+ // CHECK: call void @function(i16 signext 1, i32* {{.*}})
+ function(1, bork[2]);
+}
+
+// rdar://8476159
+static int GLOB;
+int test2(int n)
+{
+ GLOB = 0;
+ char b[1][n+3]; /* Variable length array. */
+ // CHECK: [[tmp_1:%.*]] = load i32* @GLOB, align 4
+ // CHECK-NEXT: add nsw i32 [[tmp_1]], 1
+ __typeof__(b[GLOB++]) c;
+ return GLOB;
+}
+
+// http://llvm.org/PR8567
+// CHECK: define double @test_PR8567
+double test_PR8567(int n, double (*p)[n][5]) {
+ // CHECK: store [[vla_type:.*]] %p,
+ // CHECK: load i32*
+ // CHECK-NEXT: mul i32 40
+ // CHECK-NEXT: [[byte_idx:%.*]] = mul i32 1
+ // CHECK-NEXT: [[tmp_1:%.*]] = load [[vla_type]]*
+ // CHECK-NEXT: [[tmp_2:%.*]] = bitcast [[vla_type]] [[tmp_1]] to i8*
+ // CHECK-NEXT: [[idx:%.*]] = getelementptr inbounds i8* [[tmp_2]], i32 [[byte_idx]]
+ // CHECK-NEXT: bitcast i8* [[idx]] to [[vla_type]]
+ return p[1][2][3];
+}
diff --git a/test/CodeGen/volatile-1.c b/test/CodeGen/volatile-1.c
index e0c672b41eae..f54afffdadab 100644
--- a/test/CodeGen/volatile-1.c
+++ b/test/CodeGen/volatile-1.c
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -Wno-unused-value -emit-llvm < %s -o %t
-// RUN: grep volatile %t | count 145
-// RUN: grep memcpy %t | count 4
+// RUN: %clang_cc1 -Wno-return-type -Wno-unused-value -emit-llvm %s -o - | FileCheck %s
+// CHECK: @i = common global [[INT:i[0-9]+]] 0
volatile int i, j, k;
volatile int ar[5];
volatile char c;
+// CHECK: @ci = common global [[CINT:%.*]] zeroinitializer
volatile _Complex int ci;
volatile struct S {
#ifdef __cplusplus
@@ -16,67 +16,190 @@ volatile struct S {
//void operator =(volatile struct S&o1, volatile struct S&o2) volatile;
int printf(const char *, ...);
-int main() {
- // A use.
+
+// Note that these test results are very much specific to C!
+// Assignments in C++ yield l-values, not r-values, and the situations
+// that do implicit lvalue-to-rvalue conversion are substantially
+// reduced.
+
+// CHECK: define void @test()
+void test() {
+ // CHECK: volatile load [[INT]]* @i
i;
- // A use of the real part
+ // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: sitofp [[INT]]
(float)(ci);
- // A use.
+ // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
(void)ci;
- // A use.
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: memcpy
(void)a;
- // Not a use.
+ // CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
(void)(ci=ci);
- // Not a use.
+ // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j
+ // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i
(void)(i=j);
+ // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // Not sure why they're ordered this way.
+ // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
+ // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
+ // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
ci+=ci;
+
+ // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
+ // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
+ // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // These additions can be elided
+ // CHECK-NEXT: add [[INT]] [[R]], [[R2]]
+ // CHECK-NEXT: add [[INT]] [[I]], [[I2]]
(ci += ci) + ci;
+ // CHECK-NEXT: call void asm
asm("nop");
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
(i += j) + k;
+ // CHECK-NEXT: call void asm
asm("nop");
- // A use
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: add nsw [[INT]]
(i += j) + 1;
+ // CHECK-NEXT: call void asm
asm("nop");
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add [[INT]]
+ // CHECK-NEXT: add [[INT]]
ci+ci;
- // A use.
+
+ // CHECK-NEXT: volatile load
__real i;
- // A use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ci;
+ // CHECK-NEXT: call void asm
asm("nop");
- // Not a use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
(void)(i=i);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: sitofp
(float)(i=i);
- // A use.
+ // CHECK-NEXT: volatile load
(void)i;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
i=i;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
i=i=i;
#ifndef __cplusplus
- // Not a use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
(void)__builtin_choose_expr(0, i=i, j=j);
#endif
- // A use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: icmp
+ // CHECK-NEXT: br i1
+ // CHECK: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: br label
+ // CHECK: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: br label
k ? (i=i) : (j=j);
+ // CHECK: phi
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
(void)(i,(i=i));
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
i=i,i;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
(i=j,k=j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
(i=j,k);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
(i,j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: trunc
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: sext
+ // CHECK-NEXT: volatile store
i=c=k;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+ // CHECK-NEXT: volatile store
i+=k;
- // A use of both.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
ci;
#ifndef __cplusplus
- // A use of _real.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
(int)ci;
- // A use of both.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: icmp ne
+ // CHECK-NEXT: icmp ne
+ // CHECK-NEXT: or i1
(_Bool)ci;
#endif
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
ci=ci;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
ci=ci=ci;
+ // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
__imag ci = __imag ci = __imag ci;
- // Not a use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
__real (i = j);
- // Not a use.
+ // CHECK-NEXT: volatile load
__imag i;
// ============================================================
@@ -91,6 +214,9 @@ int main() {
// gcc.
// Not a use. gcc forgets to do the assignment.
+ // CHECK-NEXT: call void @llvm.memcpy{{.*}}, i1 true
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: call void @llvm.memcpy{{.*}}, i1 true
((a=a),a);
// Not a use. gcc gets this wrong, it doesn't emit the copy!
@@ -98,38 +224,72 @@ int main() {
// Not a use. gcc got this wrong in 4.2 and omitted the side effects
// entirely, but it is fixed in 4.4.0.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
__imag (i = j);
#ifndef __cplusplus
// A use of the real part
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: sitofp
(float)(ci=ci);
// Not a use, bug? gcc treats this as not a use, that's probably a bug due to
// tree folding ignoring volatile.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
(int)(ci=ci);
#endif
// A use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: sitofp
(float)(i=i);
// A use. gcc treats this as not a use, that's probably a bug due to tree
// folding ignoring volatile.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
(int)(i=i);
// A use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: sub
-(i=j);
// A use. gcc treats this a not a use, that's probably a bug due to tree
// folding ignoring volatile.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+(i=k);
// A use. gcc treats this a not a use, that's probably a bug due to tree
// folding ignoring volatile.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
__real (ci=ci);
// A use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add
i + 0;
// A use.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add
(i=j) + i;
// A use. gcc treats this as not a use, that's probably a bug due to tree
// folding ignoring volatile.
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: add
(i=j) + 0;
#ifdef __cplusplus
@@ -141,3 +301,15 @@ int main() {
printf("s.x is at %p\n", &((s = s1).x));
#endif
}
+
+extern volatile enum X x;
+// CHECK: define void @test1()
+void test1() {
+ extern void test1_helper(void);
+ test1_helper();
+ // CHECK: call void @test1_helper()
+ // CHECK-NEXT: ret void
+ x;
+ (void) x;
+ return x;
+}
diff --git a/test/CodeGen/volatile-2.c b/test/CodeGen/volatile-2.c
new file mode 100644
index 000000000000..1ceaf17dfcb4
--- /dev/null
+++ b/test/CodeGen/volatile-2.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+void test0() {
+ // CHECK: define void @test0()
+ // CHECK: [[F:%.*]] = alloca float
+ // CHECK-NEXT: [[REAL:%.*]] = volatile load float* getelementptr inbounds ({{%.*}} @test0_v, i32 0, i32 0)
+ // CHECK-NEXT: volatile load float* getelementptr inbounds ({{%.*}} @test0_v, i32 0, i32 1)
+ // CHECK-NEXT: store float [[REAL]], float* [[F]], align 4
+ // CHECK-NEXT: ret void
+ extern volatile _Complex float test0_v;
+ float f = (float) test0_v;
+}
+
+void test1() {
+ // CHECK: define void @test1()
+ // CHECK: [[REAL:%.*]] = volatile load float* getelementptr inbounds ({{%.*}} @test1_v, i32 0, i32 0)
+ // CHECK-NEXT: [[IMAG:%.*]] = volatile load float* getelementptr inbounds ({{%.*}} @test1_v, i32 0, i32 1)
+ // CHECK-NEXT: volatile store float [[REAL]], float* getelementptr inbounds ({{%.*}} @test1_v, i32 0, i32 0)
+ // CHECK-NEXT: volatile store float [[IMAG]], float* getelementptr inbounds ({{%.*}} @test1_v, i32 0, i32 1)
+ // CHECK-NEXT: ret void
+ extern volatile _Complex float test1_v;
+ test1_v = test1_v;
+}
diff --git a/test/CodeGen/x86_32-arguments.c b/test/CodeGen/x86_32-arguments-darwin.c
index 75dfb82b32ad..cf89de30a242 100644
--- a/test/CodeGen/x86_32-arguments.c
+++ b/test/CodeGen/x86_32-arguments-darwin.c
@@ -94,11 +94,11 @@ T16 f16(void) { while (1) {} }
// 128-bits).
// CHECK: i32 @f17()
-// CHECK: void @f18(%2* sret %agg.result)
-// CHECK: void @f19(%3* sret %agg.result)
-// CHECK: void @f20(%4* sret %agg.result)
-// CHECK: void @f21(%5* sret %agg.result)
-// CHECK: void @f22(%6* sret %agg.result)
+// CHECK: void @f18(%{{.*}}* sret %agg.result)
+// CHECK: void @f19(%{{.*}}* sret %agg.result)
+// CHECK: void @f20(%{{.*}}* sret %agg.result)
+// CHECK: void @f21(%{{.*}}* sret %agg.result)
+// CHECK: void @f22(%{{.*}}* sret %agg.result)
struct { T11 a; } f17(void) { while (1) {} }
struct { T12 a; } f18(void) { while (1) {} }
struct { T13 a; } f19(void) { while (1) {} }
@@ -202,13 +202,13 @@ void f50(struct s50 a0) { }
struct s51 { vvbp f0; int f1; };
void f51(struct s51 a0) { }
-// CHECK: define void @f52(%struct.s52* byval align 16 %x)
+// CHECK: define void @f52(%struct.s52* byval align 4)
struct s52 {
long double a;
};
void f52(struct s52 x) {}
-// CHECK: define void @f53(%struct.s53* byval align 32 %x)
+// CHECK: define void @f53(%struct.s53* byval align 4)
struct __attribute__((aligned(32))) s53 {
int x;
int y;
@@ -228,3 +228,51 @@ typedef int v4i32 __attribute__((__vector_size__(16)));
// PR8029
v4i32 f55(v4i32 arg) { return arg+arg; }
+// CHECK: define void @f56(
+// CHECK: i8 signext %a0, %struct.s56_0* byval %a1,
+// CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4,
+// CHECK: i64 %a4.coerce, %struct.s56_2* byval align 4,
+// CHECK: <4 x i32> %a6, %struct.s39* byval align 16 %a7,
+// CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9,
+// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
+// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
+
+// CHECK: call void (i32, ...)* @f56_0(i32 1,
+// CHECK: i32 %{{[^ ]*}}, %struct.s56_0* byval %{{[^ ]*}},
+// CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
+// CHECK: i64 %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
+// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s39* byval align 16 %{{[^ ]*}},
+// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}},
+// CHECK: <8 x i32> {{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
+// CHECK: <4 x double> {{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
+// CHECK: }
+//
+// <rdar://problem/7964854> [i386] clang misaligns long double in structures
+// when passed byval
+// <rdar://problem/8431367> clang misaligns parameters on stack
+typedef int __attribute__((vector_size (8))) t56_v2i;
+typedef double __attribute__((vector_size (8))) t56_v1d;
+typedef int __attribute__((vector_size (16))) t56_v4i;
+typedef double __attribute__((vector_size (16))) t56_v2d;
+typedef int __attribute__((vector_size (32))) t56_v8i;
+typedef double __attribute__((vector_size (32))) t56_v4d;
+
+struct s56_0 { char a; };
+struct s56_1 { t56_v2i a; };
+struct s56_2 { t56_v1d a; };
+struct s56_3 { t56_v4i a; };
+struct s56_4 { t56_v2d a; };
+struct s56_5 { t56_v8i a; };
+struct s56_6 { t56_v4d a; };
+
+void f56(char a0, struct s56_0 a1,
+ t56_v2i a2, struct s56_1 a3,
+ t56_v1d a4, struct s56_2 a5,
+ t56_v4i a6, struct s56_3 a7,
+ t56_v2d a8, struct s56_4 a9,
+ t56_v8i a10, struct s56_5 a11,
+ t56_v4d a12, struct s56_6 a13) {
+ extern void f56_0(int x, ...);
+ f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+ a10, a11, a12, a13);
+}
diff --git a/test/CodeGen/x86_32-arguments-linux.c b/test/CodeGen/x86_32-arguments-linux.c
new file mode 100644
index 000000000000..230a20d13992
--- /dev/null
+++ b/test/CodeGen/x86_32-arguments-linux.c
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -w -fblocks -triple i386-pc-linux-gnu -emit-llvm -o %t %s
+// RUN: FileCheck < %t %s
+
+// CHECK: define void @f56(
+// CHECK: i8 signext %a0, %struct.s56_0* byval %a1,
+// CHECK: x86_mmx %a2.coerce, %struct.s56_1* byval align 4,
+// CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
+// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
+// CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
+// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
+// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
+
+// CHECK: call void (i32, ...)* @f56_0(i32 1,
+// CHECK: i32 %{{.*}}, %struct.s56_0* byval %{{[^ ]*}},
+// CHECK: x86_mmx %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
+// CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
+// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 4 %{{[^ ]*}},
+// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 4 %{{[^ ]*}},
+// CHECK: <8 x i32> %{{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
+// CHECK: <4 x double> %{{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
+// CHECK: }
+//
+// <rdar://problem/7964854> [i386] clang misaligns long double in structures
+// when passed byval
+// <rdar://problem/8431367> clang misaligns parameters on stack
+typedef int __attribute__((vector_size (8))) t56_v2i;
+typedef double __attribute__((vector_size (8))) t56_v1d;
+typedef int __attribute__((vector_size (16))) t56_v4i;
+typedef double __attribute__((vector_size (16))) t56_v2d;
+typedef int __attribute__((vector_size (32))) t56_v8i;
+typedef double __attribute__((vector_size (32))) t56_v4d;
+
+struct s56_0 { char a; };
+struct s56_1 { t56_v2i a; };
+struct s56_2 { t56_v1d a; };
+struct s56_3 { t56_v4i a; };
+struct s56_4 { t56_v2d a; };
+struct s56_5 { t56_v8i a; };
+struct s56_6 { t56_v4d a; };
+
+void f56(char a0, struct s56_0 a1,
+ t56_v2i a2, struct s56_1 a3,
+ t56_v1d a4, struct s56_2 a5,
+ t56_v4i a6, struct s56_3 a7,
+ t56_v2d a8, struct s56_4 a9,
+ t56_v8i a10, struct s56_5 a11,
+ t56_v4d a12, struct s56_6 a13) {
+ extern void f56_0(int x, ...);
+ f56_0(1, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
+ a10, a11, a12, a13);
+}
diff --git a/test/CodeGen/x86_32-arguments-realign.c b/test/CodeGen/x86_32-arguments-realign.c
new file mode 100644
index 000000000000..b08862ee43e4
--- /dev/null
+++ b/test/CodeGen/x86_32-arguments-realign.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -w -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s
+// RUN: FileCheck < %t %s
+
+// CHECK: define void @f0(%struct.s0* byval align 4)
+// CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 16, i32 4, i1 false)
+// CHECK: }
+struct s0 { long double a; };
+void f0(struct s0 a0) {
+ extern long double f0_g0;
+ f0_g0 = a0.a;
+}
diff --git a/test/CodeGenCXX/PR5050-constructor-conversion.cpp b/test/CodeGenCXX/PR5050-constructor-conversion.cpp
index 9103b8321f84..aa75ea45929e 100644
--- a/test/CodeGenCXX/PR5050-constructor-conversion.cpp
+++ b/test/CodeGenCXX/PR5050-constructor-conversion.cpp
@@ -13,6 +13,6 @@ A f(const B &b) {
// CHECK-LP64: callq __ZN1AC1ERKS_i
-// CHECK-LP32: call L__ZN1AC1ERKS_i
+// CHECK-LP32: calll L__ZN1AC1ERKS_i
diff --git a/test/CodeGenCXX/PR5863-unreachable-block.cpp b/test/CodeGenCXX/PR5863-unreachable-block.cpp
index 77096153992b..4829b5277aad 100644
--- a/test/CodeGenCXX/PR5863-unreachable-block.cpp
+++ b/test/CodeGenCXX/PR5863-unreachable-block.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only %s
+// RUN: %clang_cc1 -fexceptions -emit-llvm-only %s
// PR5863
class E { };
diff --git a/test/CodeGenCXX/anonymous-namespaces.cpp b/test/CodeGenCXX/anonymous-namespaces.cpp
index 3ec7032ee5f5..0198ed0e3e23 100644
--- a/test/CodeGenCXX/anonymous-namespaces.cpp
+++ b/test/CodeGenCXX/anonymous-namespaces.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - > %t
+// RUN: %clang_cc1 -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 9ba38052e172..d97a2ae366b3 100644
--- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
@@ -1,4 +1,18 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+// rdar://8818236
+namespace rdar8818236 {
+struct S {
+ char c2;
+ union {
+ char c;
+ int i;
+ };
+};
+
+// CHECK: @_ZN11rdar88182363fooE = global i64 4
+char S::*foo = &S::c;
+}
struct A {
union {
@@ -67,7 +81,7 @@ namespace test3 {
};
A::A() : callback(0), callback_value(0) {}
- // CHECK: define void @ZN5test31AC2Ev(
+ // CHECK: define void @_ZN5test31AC2Ev(
// CHECK: [[THIS:%.*]] = load
// CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0
// CHECK-NEXT: [[STRUCT:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0
@@ -75,8 +89,8 @@ namespace test3 {
// CHECK-NEXT: store void (i8*)* null, void (i8*)** [[CALLBACK]]
// CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0
// CHECK-NEXT: [[STRUCT:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0
- // CHECK-NEXT: [[CVALUE:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 0
- // CHECK-NEXT: store i8* null, void i8** [[CVALUE]]
+ // CHECK-NEXT: [[CVALUE:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 1
+ // CHECK-NEXT: store i8* null, i8** [[CVALUE]]
}
struct S {
@@ -90,3 +104,16 @@ struct S {
};
};
} s;
+
+
+ //PR8760
+ template <typename T>
+ struct Foo {
+ Foo() : ptr(__nullptr) {}
+ union {
+ T *ptr;
+ };
+ };
+ Foo<int> f;
+
+
diff --git a/test/CodeGenCXX/apple-kext-indirect-call-2.C b/test/CodeGenCXX/apple-kext-indirect-call-2.C
new file mode 100644
index 000000000000..7e252006e4ad
--- /dev/null
+++ b/test/CodeGenCXX/apple-kext-indirect-call-2.C
@@ -0,0 +1,77 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -fno-rtti -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: @_ZTV1A = unnamed_addr constant [4 x i8*] [i8* null, i8* null, i8* bitcast (i8* (%struct.A*)* @_ZNK1A3abcEv to i8*), i8* null]
+// CHECK: @_ZTV4Base = unnamed_addr constant [4 x i8*] [i8* null, i8* null, i8* bitcast (i8* (%struct.A*)* @_ZNK4Base3abcEv to i8*), i8* null]
+// CHECK: @_ZTV8Derived2 = unnamed_addr constant [5 x i8*] [i8* null, i8* null, i8* null, i8* bitcast (i8* (%struct.A*)* @_ZNK8Derived23efgEv to i8*), i8* null]
+// CHECK: @_ZTV2D2 = unnamed_addr constant [5 x i8*] [i8* null, i8* null, i8* null, i8* bitcast (i8* (%struct.A*)* @_ZNK2D23abcEv to i8*), i8* null]
+
+struct A {
+ virtual const char* abc(void) const;
+};
+
+const char* A::abc(void) const {return "A"; };
+
+struct B : virtual A {
+ virtual void VF();
+};
+
+void B::VF() {}
+
+void FUNC(B* p) {
+// CHECK: [[T1:%.*]] = load i8* (%struct.A*)** getelementptr inbounds (i8* (%struct.A*)** bitcast ([4 x i8*]* @_ZTV1A to i8* (%struct.A*)**), i64 2)
+// CHECK-NEXT: [[T2:%.*]] = call i8* [[T1]]
+ const char* c = p->A::abc();
+}
+
+
+// Test2
+struct Base { virtual char* abc(void) const; };
+
+char* Base::abc() const { return 0; }
+
+struct Derived : public Base {
+};
+
+void FUNC1(Derived* p) {
+// CHECK: [[U1:%.*]] = load i8* (%struct.A*)** getelementptr inbounds (i8* (%struct.A*)** bitcast ([4 x i8*]* @_ZTV4Base to i8* (%struct.A*)**), i64 2)
+// CHECK-NEXT: [[U2:%.*]] = call i8* [[U1]]
+ char* c = p->Base::abc();
+}
+
+
+// Test3
+struct Base2 { };
+
+struct Derived2 : virtual Base2 {
+ virtual char* efg(void) const;
+};
+
+char* Derived2::efg(void) const { return 0; }
+
+void FUNC2(Derived2* p) {
+// CHECK: [[V1:%.*]] = load i8* (%struct.A*)** getelementptr inbounds (i8* (%struct.A*)** bitcast ([5 x i8*]* @_ZTV8Derived2 to i8* (%struct.A*)**), i64 3)
+// CHECK-NEXT: [[V2:%.*]] = call i8* [[V1]]
+ char* c = p->Derived2::efg();
+}
+
+// Test4
+struct Base3 { };
+
+struct D1 : virtual Base3 {
+};
+
+struct D2 : virtual Base3 {
+ virtual char *abc(void) const;
+};
+
+struct Sub : D1, D2 {
+};
+
+char* D2::abc(void) const { return 0; }
+
+void FUNC3(Sub* p) {
+// CHECK: [[W1:%.*]] = load i8* (%struct.A*)** getelementptr inbounds (i8* (%struct.A*)** bitcast ([5 x i8*]* @_ZTV2D2 to i8* (%struct.A*)**), i64 3)
+// CHECK-NEXT: [[W2:%.*]] = call i8* [[W1]]
+ char* c = p->D2::abc();
+}
+
diff --git a/test/CodeGenCXX/apple-kext-indirect-call.C b/test/CodeGenCXX/apple-kext-indirect-call.C
new file mode 100644
index 000000000000..2dbb0b83954d
--- /dev/null
+++ b/test/CodeGenCXX/apple-kext-indirect-call.C
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -emit-llvm -o - %s | FileCheck %s
+
+struct Base {
+ virtual void abc(void) const;
+};
+
+void Base::abc(void) const {}
+
+void FUNC(Base* p) {
+ p->Base::abc();
+}
+
+// CHECK: getelementptr inbounds (void (%struct.Base*)** bitcast ([3 x i8*]* @_ZTV4Base to void (%struct.Base*)**), i64 2)
+// CHECK-NOT: call void @_ZNK4Base3abcEv
diff --git a/test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp b/test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp
new file mode 100644
index 000000000000..bd275f1c4da2
--- /dev/null
+++ b/test/CodeGenCXX/apple-kext-indirect-virtual-dtor-call.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -fno-rtti -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: define void @_ZN2B1D0Ev
+// CHECK: [[T1:%.*]] = load void (%struct.B1*)** getelementptr inbounds (void (%struct.B1*)** bitcast ([5 x i8*]* @_ZTV2B1 to void (%struct.B1*)**), i64 2)
+// CHECK-NEXT: call void [[T1]](%struct.B1* [[T2:%.*]])
+// CHECK: define void @_Z6DELETEP2B1
+// CHECK: [[T3:%.*]] = load void (%struct.B1*)** getelementptr inbounds (void (%struct.B1*)** bitcast ([5 x i8*]* @_ZTV2B1 to void (%struct.B1*)**), i64 2)
+// CHECK-NEXT: call void [[T3]](%struct.B1* [[T4:%.*]])
+
+
+struct B1 {
+ virtual ~B1();
+};
+
+B1::~B1() {}
+
+void DELETE(B1 *pb1) {
+ pb1->B1::~B1();
+}
diff --git a/test/CodeGenCXX/apple-kext-linkage.C b/test/CodeGenCXX/apple-kext-linkage.C
new file mode 100644
index 000000000000..9df11511762c
--- /dev/null
+++ b/test/CodeGenCXX/apple-kext-linkage.C
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -emit-llvm -o - %s | FileCheck %s
+
+struct Base {
+ virtual ~Base();
+} ;
+
+struct Derived : Base {
+ void operator delete(void *) { }
+ Derived();
+};
+
+void foo() {
+ Derived d1; // ok
+}
+
+inline unsigned f(unsigned n) { return n == 0 ? 0 : n + f(n-1); }
+
+unsigned g(unsigned n) { return f(n); }
+
+
+template <typename X> X ident(X x) { return x; }
+int foo(int n) { return ident(n); }
+
+// CHECK-NOT: define linkonce_odr
+// CHECK 5 : define internal
diff --git a/test/CodeGenCXX/apple-kext-no-staticinit-section.C b/test/CodeGenCXX/apple-kext-no-staticinit-section.C
new file mode 100644
index 000000000000..0401d4917902
--- /dev/null
+++ b/test/CodeGenCXX/apple-kext-no-staticinit-section.C
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -fno-rtti -emit-llvm -o - %s | FileCheck %s
+// rdar://8825235
+/**
+1) Normally, global object construction code ends up in __StaticInit segment of text section
+ .section __TEXT,__StaticInit,regular,pure_instructions
+ In kext mode, they end up in the __text segment.
+*/
+
+class foo {
+public:
+ foo();
+ virtual ~foo();
+};
+
+foo a;
+foo b;
+foo c;
+foo::~foo() {}
+
+// CHECK-NOT: __TEXT,__StaticInit,regular,pure_instructions
diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp
index 44c0affa5a8f..672ca0100788 100644
--- a/test/CodeGenCXX/arm.cpp
+++ b/test/CodeGenCXX/arm.cpp
@@ -1,5 +1,10 @@
// RUN: %clang_cc1 %s -triple=thumbv7-apple-darwin3.0.0-iphoneos -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
+// CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4
+// CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0
+// CHECK: @_ZZN5test84testEvE1x = internal global [[TEST8A:.*]] zeroinitializer, align 1
+// CHECK: @_ZGVZN5test84testEvE1x = internal global i32 0
+
typedef typeof(sizeof(int)) size_t;
class foo {
@@ -39,7 +44,7 @@ namespace test1 {
a.bar();
}
- // CHECK: define linkonce_odr [[A]]* @_ZN5test11AC1Ei([[A]]*
+ // CHECK: define linkonce_odr [[A]]* @_ZN5test11AC1Ei([[A]]* %this, i32 %i) unnamed_addr
// CHECK: [[RET:%.*]] = alloca [[A]]*, align 4
// CHECK: [[THIS:%.*]] = alloca [[A]]*, align 4
// CHECK: store [[A]]* {{.*}}, [[A]]** [[THIS]]
@@ -49,7 +54,7 @@ namespace test1 {
// CHECK: [[THIS2:%.*]] = load [[A]]** [[RET]]
// CHECK: ret [[A]]* [[THIS2]]
- // CHECK: define linkonce_odr [[A]]* @_ZN5test11AD1Ev([[A]]*
+ // CHECK: define linkonce_odr [[A]]* @_ZN5test11AD1Ev([[A]]* %this) unnamed_addr
// CHECK: [[RET:%.*]] = alloca [[A]]*, align 4
// CHECK: [[THIS:%.*]] = alloca [[A]]*, align 4
// CHECK: store [[A]]* {{.*}}, [[A]]** [[THIS]]
@@ -277,6 +282,76 @@ namespace test6 {
}
}
+namespace test7 {
+ int foo();
+
+ // Static and guard tested at top of file
+
+ // CHECK: define void @_ZN5test74testEv()
+ void test() {
+ // CHECK: [[T0:%.*]] = load i32* @_ZGVZN5test74testEvE1x
+ // CHECK-NEXT: [[T1:%.*]] = and i32 [[T0]], 1
+ // CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
+ // CHECK-NEXT: br i1 [[T2]]
+ // -> fallthrough, end
+ // CHECK: [[T3:%.*]] = call i32 @__cxa_guard_acquire(i32* @_ZGVZN5test74testEvE1x)
+ // CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0
+ // CHECK-NEXT: br i1 [[T4]]
+ // -> fallthrough, end
+ // CHECK: [[INIT:%.*]] = invoke i32 @_ZN5test73fooEv()
+ // CHECK: store i32 [[INIT]], i32* @_ZZN5test74testEvE1x, align 4
+ // CHECK-NEXT: call void @__cxa_guard_release(i32* @_ZGVZN5test74testEvE1x)
+ // CHECK-NEXT: br label
+ // -> end
+ // end:
+ // CHECK: ret void
+ static int x = foo();
+
+ // CHECK: call i8* @llvm.eh.exception()
+ // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test74testEvE1x)
+ // CHECK: call void @_Unwind_Resume_or_Rethrow
+ }
+}
+
+namespace test8 {
+ struct A {
+ A();
+ ~A();
+ };
+
+ // Static and guard tested at top of file
+
+ // CHECK: define void @_ZN5test84testEv()
+ void test() {
+ // CHECK: [[T0:%.*]] = load i32* @_ZGVZN5test84testEvE1x
+ // CHECK-NEXT: [[T1:%.*]] = and i32 [[T0]], 1
+ // CHECK-NEXT: [[T2:%.*]] = icmp eq i32 [[T1]], 0
+ // CHECK-NEXT: br i1 [[T2]]
+ // -> fallthrough, end
+ // CHECK: [[T3:%.*]] = call i32 @__cxa_guard_acquire(i32* @_ZGVZN5test84testEvE1x)
+ // CHECK-NEXT: [[T4:%.*]] = icmp ne i32 [[T3]], 0
+ // CHECK-NEXT: br i1 [[T4]]
+ // -> fallthrough, end
+ // CHECK: [[INIT:%.*]] = invoke [[TEST8A]]* @_ZN5test81AC1Ev([[TEST8A]]* @_ZZN5test84testEvE1x)
+
+ // FIXME: Here we register a global destructor that
+ // unconditionally calls the destructor. That's what we've always
+ // done for -fno-use-cxa-atexit here, but that's really not
+ // semantically correct at all.
+
+ // CHECK: call void @__cxa_guard_release(i32* @_ZGVZN5test84testEvE1x)
+ // CHECK-NEXT: br label
+ // -> end
+ // end:
+ // CHECK: ret void
+ static A x;
+
+ // CHECK: call i8* @llvm.eh.exception()
+ // CHECK: call void @__cxa_guard_abort(i32* @_ZGVZN5test84testEvE1x)
+ // CHECK: call void @_Unwind_Resume_or_Rethrow
+ }
+}
+
// CHECK: define linkonce_odr [[C:%.*]]* @_ZTv0_n12_N5test21CD1Ev(
// CHECK: call [[C]]* @_ZN5test21CD1Ev(
// CHECK: ret [[C]]* undef
diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp
index ab46be72d879..d044ac597828 100644
--- a/test/CodeGenCXX/array-construction.cpp
+++ b/test/CodeGenCXX/array-construction.cpp
@@ -32,5 +32,5 @@ int main() {
// CHECK-LP64: callq __ZN4xptoC1Ev
-// CHECK-LP32: call L__ZN4xptoC1Ev
+// CHECK-LP32: calll L__ZN4xptoC1Ev
diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp
index acb85d23b3d9..ad60cf6a6733 100644
--- a/test/CodeGenCXX/array-operator-delete-call.cpp
+++ b/test/CodeGenCXX/array-operator-delete-call.cpp
@@ -59,5 +59,5 @@ COST c2;
// CHECK-LP64: callq __ZdaPv
-// CHECK-LP32: call L__ZdaPv
+// CHECK-LP32: calll L__ZdaPv
diff --git a/test/CodeGenCXX/array-value-initialize.cpp b/test/CodeGenCXX/array-value-initialize.cpp
index 8a3d5ff8b6f5..27607c1c7544 100644
--- a/test/CodeGenCXX/array-value-initialize.cpp
+++ b/test/CodeGenCXX/array-value-initialize.cpp
@@ -49,4 +49,4 @@ int main()
Stuff b = a;
return 0;
-} \ No newline at end of file
+}
diff --git a/test/CodeGenCXX/asm.cpp b/test/CodeGenCXX/asm.cpp
new file mode 100644
index 000000000000..3b745a7336f2
--- /dev/null
+++ b/test/CodeGenCXX/asm.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+struct A
+{
+ ~A();
+};
+int foo(A);
+
+void bar(A &a)
+{
+ // CHECK: call void asm
+ asm("" : : "r"(foo(a)) ); // rdar://8540491
+ // CHECK: call void @_ZN1AD1Ev
+}
diff --git a/test/CodeGenCXX/attr-used.cpp b/test/CodeGenCXX/attr-used.cpp
new file mode 100644
index 000000000000..26109e7c6300
--- /dev/null
+++ b/test/CodeGenCXX/attr-used.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// <rdar://problem/8684363>: clang++ not respecting __attribute__((used)) on destructors
+struct X0 {
+ // CHECK: define linkonce_odr void @_ZN2X0C1Ev
+ __attribute__((used)) X0() {}
+ // CHECK: define linkonce_odr void @_ZN2X0D1Ev
+ __attribute__((used)) ~X0() {}
+};
diff --git a/test/CodeGenCXX/attr.cpp b/test/CodeGenCXX/attr.cpp
index d689a4fdf493..9e8740e54700 100644
--- a/test/CodeGenCXX/attr.cpp
+++ b/test/CodeGenCXX/attr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
// CHECK: @test2 = alias i32 ()* @_Z5test1v
diff --git a/test/CodeGenCXX/block-byref-cxx-objc.cpp b/test/CodeGenCXX/block-byref-cxx-objc.cpp
new file mode 100644
index 000000000000..a4fbd6cb6233
--- /dev/null
+++ b/test/CodeGenCXX/block-byref-cxx-objc.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks | FileCheck %s
+// rdar://8594790
+
+struct A {
+ int x;
+ A(const A &);
+ A();
+ ~A();
+};
+
+int main()
+{
+ __block A BYREF_VAR;
+ ^{ BYREF_VAR.x = 1234; };
+ return 0;
+}
+
+// CHECK: define internal void @__Block_byref_object_copy_
+// CHECK: call void @_ZN1AC1ERKS_
+// CHECK: define internal void @__Block_byref_object_dispose_
+// CHECK: call void @_ZN1AD1Ev
+// CHECK: define internal void @__copy_helper_block_
+// CHECK: call void @_Block_object_assign
+// CHECK: define internal void @__destroy_helper_block_
+// CHECK: call void @_Block_object_dispose
diff --git a/test/CodeGenCXX/blocks.cpp b/test/CodeGenCXX/blocks.cpp
new file mode 100644
index 000000000000..ea174b57e44d
--- /dev/null
+++ b/test/CodeGenCXX/blocks.cpp
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+
+namespace test0 {
+ // CHECK: define void @_ZN5test04testEi(
+ // CHECK: define internal void @__test_block_invoke_{{.*}}(
+ // CHECK: define internal void @__block_global_{{.*}}(
+ void test(int x) {
+ ^{ ^{ (void) x; }; };
+ }
+}
+
+extern void (^out)();
+
+namespace test1 {
+ // Capturing const objects doesn't require a local block.
+ // CHECK: define void @_ZN5test15test1Ev()
+ // CHECK: store void ()* bitcast ({{.*}} @__block_literal_global{{.*}} to void ()*), void ()** @out
+ void test1() {
+ const int NumHorsemen = 4;
+ out = ^{ (void) NumHorsemen; };
+ }
+
+ // That applies to structs too...
+ // CHECK: define void @_ZN5test15test2Ev()
+ // CHECK: store void ()* bitcast ({{.*}} @__block_literal_global{{.*}} to void ()*), void ()** @out
+ struct loc { double x, y; };
+ void test2() {
+ const loc target = { 5, 6 };
+ out = ^{ (void) target; };
+ }
+
+ // ...unless they have mutable fields...
+ // CHECK: define void @_ZN5test15test3Ev()
+ // CHECK: [[BLOCK:%.*]] = alloca [[BLOCK_T:%.*]],
+ // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()*
+ // CHECK: store void ()* [[T0]], void ()** @out
+ struct mut { mutable int x; };
+ void test3() {
+ const mut obj = { 5 };
+ out = ^{ (void) obj; };
+ }
+
+ // ...or non-trivial destructors...
+ // CHECK: define void @_ZN5test15test4Ev()
+ // CHECK: [[OBJ:%.*]] = alloca
+ // CHECK: [[BLOCK:%.*]] = alloca [[BLOCK_T:%.*]],
+ // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()*
+ // CHECK: store void ()* [[T0]], void ()** @out
+ struct scope { int x; ~scope(); };
+ void test4() {
+ const scope obj = { 5 };
+ out = ^{ (void) obj; };
+ }
+
+ // ...or non-trivial copy constructors, but it's not clear how to do
+ // that and still have a constant initializer in '03.
+}
diff --git a/test/CodeGenCXX/builtins.cpp b/test/CodeGenCXX/builtins.cpp
new file mode 100644
index 000000000000..0629c31015c7
--- /dev/null
+++ b/test/CodeGenCXX/builtins.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// PR8839
+extern "C" char memmove();
+
+int main() {
+ // CHECK: call signext i8 @memmove()
+ return memmove();
+}
diff --git a/test/CodeGenCXX/c99-variable-length-array.cpp b/test/CodeGenCXX/c99-variable-length-array.cpp
index 66c14ff579f2..76f99c7b4137 100644
--- a/test/CodeGenCXX/c99-variable-length-array.cpp
+++ b/test/CodeGenCXX/c99-variable-length-array.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
struct X {
X();
~X();
diff --git a/test/CodeGenCXX/call-arg-zero-temp.cpp b/test/CodeGenCXX/call-arg-zero-temp.cpp
index ed8118e07d92..88e74523f532 100644
--- a/test/CodeGenCXX/call-arg-zero-temp.cpp
+++ b/test/CodeGenCXX/call-arg-zero-temp.cpp
@@ -19,4 +19,4 @@ int main() {
// CHECK-LP64: callq __Z3foo3obj
-// CHECK-LP32: call __Z3foo3obj
+// CHECK-LP32: calll __Z3foo3obj
diff --git a/test/CodeGenCXX/cast-conversion.cpp b/test/CodeGenCXX/cast-conversion.cpp
index 6dc6de601848..27e34b9d32f5 100644
--- a/test/CodeGenCXX/cast-conversion.cpp
+++ b/test/CodeGenCXX/cast-conversion.cpp
@@ -24,9 +24,9 @@ int main () {
// CHECK-LP64: callq __ZN1AC1Ei
// CHECK-LP64: callq __ZN1BC1E1A
-// CHECK-LP32: call L__ZN1AC1Ei
-// CHECK-LP32: call L__ZN1BC1E1A
-// CHECK-LP32: call L__ZN1AC1Ei
-// CHECK-LP32: call L__ZN1BC1E1A
-// CHECK-LP32: call L__ZN1AC1Ei
-// CHECK-LP32: call L__ZN1BC1E1A
+// CHECK-LP32: calll L__ZN1AC1Ei
+// CHECK-LP32: calll L__ZN1BC1E1A
+// CHECK-LP32: calll L__ZN1AC1Ei
+// CHECK-LP32: calll L__ZN1BC1E1A
+// CHECK-LP32: calll L__ZN1AC1Ei
+// CHECK-LP32: calll L__ZN1BC1E1A
diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp
index 9303bdaba8bc..6675b4963bd2 100644
--- a/test/CodeGenCXX/class-layout.cpp
+++ b/test/CodeGenCXX/class-layout.cpp
@@ -1,13 +1,19 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
// An extra byte should be allocated for an empty class.
-// CHECK: %struct.A = type { i8 }
-struct A { } a;
+namespace Test1 {
+ // CHECK: %"struct.Test1::A" = type { i8 }
+ struct A { } *a;
+}
-// No need to add tail padding here.
-// CHECK: %struct.B = type { i8*, i32 }
-struct B { void *a; int b; } b;
+namespace Test2 {
+ // No need to add tail padding here.
+ // CHECK: %"struct.Test2::A" = type { i8*, i32 }
+ struct A { void *a; int b; } *a;
+}
-// C should have a vtable pointer.
-// CHECK: %struct.C = type { i32 (...)**, i32 }
-struct C { virtual void f(); int a; } *c;
+namespace Test3 {
+ // C should have a vtable pointer.
+ // CHECK: %"struct.Test3::A" = type { i32 (...)**, i32 }
+ struct A { virtual void f(); int a; } *a;
+}
diff --git a/test/CodeGenCXX/const-init.cpp b/test/CodeGenCXX/const-init.cpp
index 9cfce7ace86b..a8c6f304980b 100644
--- a/test/CodeGenCXX/const-init.cpp
+++ b/test/CodeGenCXX/const-init.cpp
@@ -24,3 +24,15 @@ public:
// CHECK: @_ZN6PR55812g0E = global %1 { i32 1 }
C g0 = { C::e1 };
}
+
+namespace test2 {
+ struct A {
+ static const double d = 1.0;
+ static const float f = d / 2;
+ };
+
+ // CHECK: @_ZN5test22t0E = global double {{1\.0+e\+0+}}, align 8
+ // CHECK: @_ZN5test22t1E = global [2 x double] [double {{1\.0+e\+0+}}, double {{5\.0+e-0*}}1], align 16
+ double t0 = A::d;
+ double t1[] = { A::d, A::f };
+}
diff --git a/test/CodeGenCXX/constructor-attr.cpp b/test/CodeGenCXX/constructor-attr.cpp
new file mode 100644
index 000000000000..691795f77619
--- /dev/null
+++ b/test/CodeGenCXX/constructor-attr.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: @llvm.global_ctors
+
+// PR6521
+void bar();
+struct Foo {
+ // CHECK: define linkonce_odr void @_ZN3Foo3fooEv
+ static void foo() __attribute__((constructor)) {
+ bar();
+ }
+};
diff --git a/test/CodeGenCXX/constructor-conversion.cpp b/test/CodeGenCXX/constructor-conversion.cpp
index f135da5e85db..405bba67e862 100644
--- a/test/CodeGenCXX/constructor-conversion.cpp
+++ b/test/CodeGenCXX/constructor-conversion.cpp
@@ -49,6 +49,6 @@ int main() {
// CHECK-LP64: callq __ZN1XC1EPKci
// CHECK-LP64: callq __ZN1XC1Ev
-// CHECK-LP32: call L__ZN1XC1Ei
-// CHECK-LP32: call L__ZN1XC1EPKci
-// CHECK-LP32: call L__ZN1XC1Ev
+// CHECK-LP32: calll L__ZN1XC1Ei
+// CHECK-LP32: calll L__ZN1XC1EPKci
+// CHECK-LP32: calll L__ZN1XC1Ev
diff --git a/test/CodeGenCXX/constructor-convert.cpp b/test/CodeGenCXX/constructor-convert.cpp
index 338febbe97a9..9122dae128ec 100644
--- a/test/CodeGenCXX/constructor-convert.cpp
+++ b/test/CodeGenCXX/constructor-convert.cpp
@@ -5,7 +5,7 @@ class Twine {
Twine(const char *Str) { }
};
-static void error(const Twine &Message);
+static void error(const Twine &Message) {}
template<typename>
struct opt_storage {
diff --git a/test/CodeGenCXX/constructor-default-arg.cpp b/test/CodeGenCXX/constructor-default-arg.cpp
index ec0b8da69b3d..0c08c7694e39 100644
--- a/test/CodeGenCXX/constructor-default-arg.cpp
+++ b/test/CodeGenCXX/constructor-default-arg.cpp
@@ -34,6 +34,6 @@ int main() {
// CHECK-LP64: callq __ZN1XC1ERKS_iii
// CHECK-LP64: callq __ZN1XC1ERKS_iii
-// CHECK-LP32: call L__ZN1XC1ERKS_iii
-// CHECK-LP32: call L__ZN1XC1ERKS_iii
-// CHECK-LP32: call L__ZN1XC1ERKS_iii
+// CHECK-LP32: calll L__ZN1XC1ERKS_iii
+// CHECK-LP32: calll L__ZN1XC1ERKS_iii
+// CHECK-LP32: calll L__ZN1XC1ERKS_iii
diff --git a/test/CodeGenCXX/constructor-direct-call.cpp b/test/CodeGenCXX/constructor-direct-call.cpp
new file mode 100644
index 000000000000..75e6f216ca51
--- /dev/null
+++ b/test/CodeGenCXX/constructor-direct-call.cpp
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -Wmicrosoft %s -emit-llvm -o - | FileCheck %s
+
+class Test1 {
+public:
+ int a;
+};
+
+void f1() {
+ Test1 var;
+ var.Test1::Test1();
+
+ // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 4, i32 4, i1 false)
+ var.Test1::Test1(var);
+}
+
+class Test2 {
+public:
+ Test2() { a = 10; b = 10; }
+ int a;
+ int b;
+};
+
+void f2() {
+ // CHECK: %var = alloca %class.Test2, align 4
+ // CHECK-NEXT: call void @_ZN5Test2C1Ev(%class.Test2* %var)
+ Test2 var;
+
+ // CHECK-NEXT: call void @_ZN5Test2C1Ev(%class.Test2* %var)
+ var.Test2::Test2();
+
+ // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 8, i32 4, i1 false)
+ var.Test2::Test2(var);
+}
+
+
+
+
+class Test3 {
+public:
+ Test3() { a = 10; b = 15; c = 20; }
+ Test3(const Test3& that) { a = that.a; b = that.b; c = that.c; }
+ int a;
+ int b;
+ int c;
+};
+
+void f3() {
+ // CHECK: call void @_ZN5Test3C1Ev(%class.Test3* %var)
+ Test3 var;
+
+ // CHECK-NEXT: call void @_ZN5Test3C1Ev(%class.Test3* %var2)
+ Test3 var2;
+
+ // CHECK-NEXT: call void @_ZN5Test3C1Ev(%class.Test3* %var)
+ var.Test3::Test3();
+
+ // CHECK-NEXT: call void @_ZN5Test3C1ERKS_(%class.Test3* %var, %class.Test3* %var2)
+ var.Test3::Test3(var2);
+}
+
diff --git a/test/CodeGenCXX/constructor-for-array-members.cpp b/test/CodeGenCXX/constructor-for-array-members.cpp
index b981da497364..fd6dc6dc15dc 100644
--- a/test/CodeGenCXX/constructor-for-array-members.cpp
+++ b/test/CodeGenCXX/constructor-for-array-members.cpp
@@ -40,4 +40,4 @@ int main() {
// CHECK-LP64: callq __ZN1SC1Ev
-// CHECK-LP32: call L__ZN1SC1Ev
+// CHECK-LP32: calll L__ZN1SC1Ev
diff --git a/test/CodeGenCXX/constructor-init.cpp b/test/CodeGenCXX/constructor-init.cpp
index 284b8b5938f9..47e3b7b0bb90 100644
--- a/test/CodeGenCXX/constructor-init.cpp
+++ b/test/CodeGenCXX/constructor-init.cpp
@@ -81,6 +81,38 @@ void f() {
// CHECK: ret void
}
+// Make sure we initialize the vtable pointer if it's required by a
+// base initializer.
+namespace InitVTable {
+ struct A { A(int); };
+ struct B : A {
+ virtual int foo();
+ B();
+ B(int);
+ };
+
+ // CHECK: define void @_ZN10InitVTable1BC2Ev(%"struct.InitVTable::B"* %this) unnamed_addr
+ // CHECK: [[T0:%.*]] = bitcast [[B:%.*]]* [[THIS:%.*]] to i8***
+ // CHECK-NEXT: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN10InitVTable1BE, i64 0, i64 2), i8*** [[T0]]
+ // CHECK: [[VTBL:%.*]] = load i32 ([[B]]*)*** {{%.*}}
+ // CHECK-NEXT: [[FNP:%.*]] = getelementptr inbounds i32 ([[B]]*)** [[VTBL]], i64 0
+ // CHECK-NEXT: [[FN:%.*]] = load i32 ([[B]]*)** [[FNP]]
+ // CHECK-NEXT: [[ARG:%.*]] = call i32 [[FN]]([[B]]* [[THIS]])
+ // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei({{.*}}* {{%.*}}, i32 [[ARG]])
+ // CHECK-NEXT: [[T0:%.*]] = bitcast [[B]]* [[THIS]] to i8***
+ // CHECK-NEXT: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN10InitVTable1BE, i64 0, i64 2), i8*** [[T0]]
+ // CHECK-NEXT: ret void
+ B::B() : A(foo()) {}
+
+ // CHECK: define void @_ZN10InitVTable1BC2Ei(%"struct.InitVTable::B"* %this, i32 %x) unnamed_addr
+ // CHECK: [[ARG:%.*]] = add nsw i32 {{%.*}}, 5
+ // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei({{.*}}* {{%.*}}, i32 [[ARG]])
+ // CHECK-NEXT: [[T0:%.*]] = bitcast [[B]]* {{%.*}} to i8***
+ // CHECK-NEXT: store i8** getelementptr inbounds ([3 x i8*]* @_ZTVN10InitVTable1BE, i64 0, i64 2), i8*** [[T0]]
+ // CHECK-NEXT: ret void
+ B::B(int x) : A(x + 5) {}
+}
+
template<typename T>
struct X {
X(const X &);
@@ -93,7 +125,7 @@ template<typename T> struct X;
// Make sure that the instantiated constructor initializes start and
// end properly.
-// CHECK: define linkonce_odr void @_ZN1XIiEC2ERKS0_
+// CHECK: define linkonce_odr void @_ZN1XIiEC2ERKS0_(%struct.X* %this, %struct.X* %other) unnamed_addr
// CHECK: {{store.*null}}
// CHECK: {{store.*null}}
// CHECK: ret
diff --git a/test/CodeGenCXX/constructors.cpp b/test/CodeGenCXX/constructors.cpp
index a8dc7fcec703..75588ce06ce0 100644
--- a/test/CodeGenCXX/constructors.cpp
+++ b/test/CodeGenCXX/constructors.cpp
@@ -21,18 +21,18 @@ struct A {
A::A(struct Undeclared &ref) : mem(0) {}
// Check that delegation works.
-// CHECK: define void @_ZN1AC1ER10Undeclared(
+// CHECK: define void @_ZN1AC1ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
// CHECK: call void @_ZN1AC2ER10Undeclared(
-// CHECK: define void @_ZN1AC2ER10Undeclared(
+// CHECK: define void @_ZN1AC2ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
// CHECK: call void @_ZN6MemberC1Ei(
A::A(ValueClass v) : mem(v.y - v.x) {}
-// CHECK: define void @_ZN1AC1E10ValueClass(
+// CHECK: define void @_ZN1AC1E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
// CHECK: call void @_ZN1AC2E10ValueClass(
-// CHECK: define void @_ZN1AC2E10ValueClass(
+// CHECK: define void @_ZN1AC2E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
// CHECK: call void @_ZN6MemberC1Ei(
@@ -44,10 +44,10 @@ struct B : A {
B::B(struct Undeclared &ref) : A(ref), mem(1) {}
-// CHECK: define void @_ZN1BC1ER10Undeclared(
+// CHECK: define void @_ZN1BC1ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
// CHECK: call void @_ZN1BC2ER10Undeclared(
-// CHECK: define void @_ZN1BC2ER10Undeclared(
+// CHECK: define void @_ZN1BC2ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
// CHECK: call void @_ZN1AC2ER10Undeclared(
// CHECK: call void @_ZN6MemberC1Ei(
@@ -64,12 +64,12 @@ struct C : virtual A {
};
C::C(int x) : A(ValueClass(x, x+1)), mem(x * x) {}
-// CHECK: define void @_ZN1CC1Ei(
+// CHECK: define void @_ZN1CC1Ei(%struct.C* %this, i32 %x) unnamed_addr
// CHECK: call void @_ZN10ValueClassC1Eii(
// CHECK: call void @_ZN1AC2E10ValueClass(
// CHECK: call void @_ZN6MemberC1Ei(
-// CHECK: define void @_ZN1CC2Ei(
+// CHECK: define void @_ZN1CC2Ei(%struct.C* %this, i8** %vtt, i32 %x) unnamed_addr
// CHECK: call void @_ZN6MemberC1Ei(
@@ -83,12 +83,12 @@ struct D : A {
D::D(int x, ...) : A(ValueClass(x, x+1)), mem(x*x) {}
-// CHECK: define void @_ZN1DC1Eiz(
+// CHECK: define void @_ZN1DC1Eiz(%struct.B* %this, i32 %x, ...) unnamed_addr
// CHECK: call void @_ZN10ValueClassC1Eii(
// CHECK: call void @_ZN1AC2E10ValueClass(
// CHECK: call void @_ZN6MemberC1Ei(
-// CHECK: define void @_ZN1DC2Eiz(
+// CHECK: define void @_ZN1DC2Eiz(%struct.B* %this, i32 %x, ...) unnamed_addr
// CHECK: call void @_ZN10ValueClassC1Eii(
// CHECK: call void @_ZN1AC2E10ValueClass(
// CHECK: call void @_ZN6MemberC1Ei(
diff --git a/test/CodeGenCXX/convert-to-fptr.cpp b/test/CodeGenCXX/convert-to-fptr.cpp
index dc49401af929..f895dbcaf6f0 100644
--- a/test/CodeGenCXX/convert-to-fptr.cpp
+++ b/test/CodeGenCXX/convert-to-fptr.cpp
@@ -41,6 +41,6 @@ int main()
// CHECK-LP64: callq __ZN1AcvPFiiEEv
// CHECK-LP64: callq __ZN1BcvRFiiEEv
-// CHECK-LP32: call L__ZN1AcvPFiiEEv
-// CHECK-LP32: call L__ZN1BcvRFiiEEv
+// CHECK-LP32: calll L__ZN1AcvPFiiEEv
+// CHECK-LP32: calll L__ZN1BcvRFiiEEv
diff --git a/test/CodeGenCXX/copy-constructor-elim-2.cpp b/test/CodeGenCXX/copy-constructor-elim-2.cpp
index 73e9b94bcd11..4f4a8e998bee 100644
--- a/test/CodeGenCXX/copy-constructor-elim-2.cpp
+++ b/test/CodeGenCXX/copy-constructor-elim-2.cpp
@@ -21,7 +21,7 @@ namespace no_elide_base {
Derived(const Other &O);
};
- // CHECK: define void @_ZN13no_elide_base7DerivedC1ERKNS_5OtherE
+ // CHECK: define void @_ZN13no_elide_base7DerivedC1ERKNS_5OtherE(%"struct.no_elide_base::Derived"* %this, %"struct.PR8683::A"* %O) unnamed_addr
Derived::Derived(const Other &O)
// CHECK: call void @_ZNK13no_elide_base5OthercvNS_4BaseEEv
// CHECK: call void @_ZN13no_elide_base4BaseC2ERKS0_
@@ -31,3 +31,25 @@ namespace no_elide_base {
// CHECK: ret void
}
}
+
+// PR8683.
+
+namespace PR8683 {
+
+struct A {
+ A();
+ A(const A&);
+ A& operator=(const A&);
+};
+
+struct B {
+ A a;
+};
+
+void f() {
+ // Verify that we don't mark the copy constructor in this expression as elidable.
+ // CHECK: call void @_ZN6PR86831AC1ERKS0_
+ A a = (B().a);
+}
+
+}
diff --git a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
index 2f7c79b90303..a5566797d48b 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis-2.cpp
@@ -3,5 +3,5 @@
struct A { virtual void a(); };
A x(A& y) { return y; }
-// CHECK: define linkonce_odr void @_ZN1AC1ERKS_(
+// CHECK: define linkonce_odr void @_ZN1AC1ERKS_(%struct.A* %this, %struct.A*) unnamed_addr
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
diff --git a/test/CodeGenCXX/copy-constructor-synthesis.cpp b/test/CodeGenCXX/copy-constructor-synthesis.cpp
index 9cafd0accdb6..68f680574b75 100644
--- a/test/CodeGenCXX/copy-constructor-synthesis.cpp
+++ b/test/CodeGenCXX/copy-constructor-synthesis.cpp
@@ -21,7 +21,7 @@ struct P {
};
-// CHECK: define linkonce_odr void @_ZN1XC1ERKS_
+// CHECK: define linkonce_odr void @_ZN1XC1ERKS_(%struct.X* %this, %struct.X*) unnamed_addr
struct X : M, N, P { // ...
X() : f1(1.0), d1(2.0), i1(3), name("HELLO"), bf1(0xff), bf2(0xabcd),
au_i1(1234), au1_4("MASKED") {}
@@ -136,7 +136,7 @@ void f(B b1) {
B b2 = b1;
}
-// CHECK: define linkonce_odr void @_ZN6PR66281BC2ERKS0_
+// CHECK: define linkonce_odr void @_ZN6PR66281BC2ERKS0_(%"struct.PR6628::B"* %this, %"struct.PR6628::B"*) unnamed_addr
// CHECK: call void @_ZN6PR66281TC1Ev
// CHECK: call void @_ZN6PR66281TC1Ev
// CHECK: call void @_ZN6PR66281AC2ERKS0_RKNS_1TES5_
diff --git a/test/CodeGenCXX/cxx-block-objects.cpp b/test/CodeGenCXX/cxx-block-objects.cpp
new file mode 100644
index 000000000000..b98906599603
--- /dev/null
+++ b/test/CodeGenCXX/cxx-block-objects.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+// rdar://8594790
+
+extern "C" {
+extern "C" void *_Block_copy(const void *aBlock);
+extern "C" void _Block_release(const void *aBlock);
+}
+
+class A {
+public:
+ int x;
+ A(const A &o);
+ A();
+ virtual ~A();
+ void hello() const;
+};
+
+int
+main()
+{
+ A a;
+ void (^c)(void) = ((__typeof(^{ a.hello(); }))_Block_copy((const void *)(^{ a.hello(); })));
+ c();
+ _Block_release((const void *)(c));
+ return 0;
+}
+
+// CHECK: define internal void @__copy_helper_block_
+// CHECK: call void @_ZN1AC1ERKS_
+
+
+// CHECK:define internal void @__destroy_helper_block_
+// CHECK: call void @_ZN1AD1Ev
diff --git a/test/CodeGenCXX/debug-info-ctor2.cpp b/test/CodeGenCXX/debug-info-ctor2.cpp
new file mode 100644
index 000000000000..19bd64b3cdad
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-ctor2.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang -fverbose-asm -g -S %s -o - | grep AT_explicit
+
+
+class MyClass
+{
+public:
+ explicit MyClass (int i) :
+ m_i (i)
+ {}
+private:
+ int m_i;
+};
+
+MyClass m(1);
+
diff --git a/test/CodeGenCXX/debug-info-large-constant.cpp b/test/CodeGenCXX/debug-info-large-constant.cpp
new file mode 100644
index 000000000000..2daa1894e15d
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-large-constant.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -g -triple=x86_64-apple-darwin %s -o /dev/null
+// PR 8913
+
+typedef __uint128_t word128;
+static const word128 m126 = 0xffffffffffffffffULL;
+word128 foo() {
+ return m126;
+}
diff --git a/test/CodeGenCXX/debug-info-member.cpp b/test/CodeGenCXX/debug-info-member.cpp
new file mode 100644
index 000000000000..5052a6cafb79
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-member.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang -fverbose-asm -cc1 -g -S %s -o - | grep DW_ACCESS_public
+class A {
+public:
+ int x;
+};
+A a;
diff --git a/test/CodeGenCXX/debug-info-method.cpp b/test/CodeGenCXX/debug-info-method.cpp
new file mode 100644
index 000000000000..593572785155
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-method.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang -fverbose-asm -cc1 -g -S %s -o - | grep DW_ACCESS_protected
+class A {
+protected:
+ int foo();
+};
+A a;
diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp
new file mode 100644
index 000000000000..2e0a96d56660
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-namespace.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang -g -S %s -o - | FileCheck %s
+
+// CHECK: TAG_namespace
+namespace A {
+ enum numbers {
+ ZERO,
+ ONE
+ };
+}
+
+using namespace A;
+numbers n;
diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp
index 233090c04992..0ddfc242b10e 100644
--- a/test/CodeGenCXX/debug-info-template.cpp
+++ b/test/CodeGenCXX/debug-info-template.cpp
@@ -1,4 +1,8 @@
-// RUN: %clang_cc1 -emit-llvm-only -g -S %s -o - | grep "TC<int>"
+// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
+
+//CHECK: TC<int>
+//CHECK: DW_TAG_template_type_parameter
+
template<typename T>
class TC {
public:
@@ -7,3 +11,12 @@ public:
};
TC<int> tci;
+
+//CHECK: TU<2>
+//CHECK: DW_TAG_template_value_parameter
+template<unsigned >
+class TU {
+ int b;
+};
+
+TU<2> u2;
diff --git a/test/CodeGenCXX/decl-ref-init.cpp b/test/CodeGenCXX/decl-ref-init.cpp
index c215b1b9be67..58fdedabc333 100644
--- a/test/CodeGenCXX/decl-ref-init.cpp
+++ b/test/CodeGenCXX/decl-ref-init.cpp
@@ -26,5 +26,5 @@ int main() {
// CHECK-LP64: callq __ZN1BcvR1AEv
// CHECK-LP64: callq __ZN1BcvR1AEv
-// CHECK-LP32: call L__ZN1BcvR1AEv
-// CHECK-LP32: call L__ZN1BcvR1AEv
+// CHECK-LP32: calll L__ZN1BcvR1AEv
+// CHECK-LP32: calll L__ZN1BcvR1AEv
diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp
index c4419850f12d..3d741d502834 100644
--- a/test/CodeGenCXX/default-arg-temps.cpp
+++ b/test/CodeGenCXX/default-arg-temps.cpp
@@ -61,7 +61,7 @@ namespace test1 {
C c;
A a;
- // CHECK: define linkonce_odr void @_ZN5test11DC2Ev(
+ // CHECK: define linkonce_odr void @_ZN5test11DC2Ev(%"struct.test1::D"* %this) unnamed_addr
// CHECK: call void @_ZN5test11BC1Ev(
// CHECK-NEXT: call void @_ZN5test11CC1ERKNS_1BE(
// CHECK-NEXT: call void @_ZN5test11BD1Ev(
diff --git a/test/CodeGenCXX/default-arguments.cpp b/test/CodeGenCXX/default-arguments.cpp
index 2ed1567697ca..6560d3514f55 100644
--- a/test/CodeGenCXX/default-arguments.cpp
+++ b/test/CodeGenCXX/default-arguments.cpp
@@ -42,10 +42,10 @@ struct C {
C();
};
-// CHECK: define void @_ZN1CC1Ev(
+// CHECK: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr
// CHECK: call void @_ZN1CC2Ev(
-// CHECK: define void @_ZN1CC2Ev(
+// CHECK: define void @_ZN1CC2Ev(%struct.C* %this) unnamed_addr
// CHECK: call void @_ZN2A1C1Ev(
// CHECK: call void @_ZN2A2C1Ev(
// CHECK: call void @_ZN1BC1ERK2A1RK2A2(
diff --git a/test/CodeGenCXX/default-constructor-for-members.cpp b/test/CodeGenCXX/default-constructor-for-members.cpp
index 1f177460236c..a97764ddcf02 100644
--- a/test/CodeGenCXX/default-constructor-for-members.cpp
+++ b/test/CodeGenCXX/default-constructor-for-members.cpp
@@ -20,4 +20,4 @@ int main() {
// CHECK-LP64: callq __ZN1SC1Ev
-// CHECK-LP32: call L__ZN1SC1Ev
+// CHECK-LP32: calll L__ZN1SC1Ev
diff --git a/test/CodeGenCXX/default-constructor-template-member.cpp b/test/CodeGenCXX/default-constructor-template-member.cpp
index e74fb6da69a6..422cc099ad6c 100644
--- a/test/CodeGenCXX/default-constructor-template-member.cpp
+++ b/test/CodeGenCXX/default-constructor-template-member.cpp
@@ -6,5 +6,5 @@ void a() {
B b;
}
// CHECK: call void @_ZN1BC1Ev
-// CHECK: define linkonce_odr void @_ZN1BC1Ev
+// CHECK: define linkonce_odr void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
// CHECK: call void @_ZN1AIiEC1Ev
diff --git a/test/CodeGenCXX/delete-two-arg.cpp b/test/CodeGenCXX/delete-two-arg.cpp
index 5358747fed7b..b82e9ba63ddc 100644
--- a/test/CodeGenCXX/delete-two-arg.cpp
+++ b/test/CodeGenCXX/delete-two-arg.cpp
@@ -1,6 +1,70 @@
// RUN: %clang_cc1 -triple i686-pc-linux-gnu %s -o - -emit-llvm -verify | FileCheck %s
-struct A { void operator delete(void*,__typeof(sizeof(int))); int x; };
-void a(A* x) { delete x; }
+typedef __typeof(sizeof(int)) size_t;
-// CHECK: call void @_ZN1AdlEPvj(i8* %{{.*}}, i32 4)
+namespace test1 {
+ struct A { void operator delete(void*,size_t); int x; };
+
+ // CHECK: define void @_ZN5test11aEPNS_1AE(
+ void a(A *x) {
+ // CHECK: load
+ // CHECK-NEXT: icmp eq {{.*}}, null
+ // CHECK-NEXT: br i1
+ // CHECK: call void @_ZN5test11AdlEPvj(i8* %{{.*}}, i32 4)
+ delete x;
+ }
+}
+
+// Check that we make cookies for the two-arg delete even when using
+// the global allocator and deallocator.
+namespace test2 {
+ struct A {
+ int x;
+ void *operator new[](size_t);
+ void operator delete[](void *, size_t);
+ };
+
+ // CHECK: define [[A:%.*]]* @_ZN5test24testEv()
+ A *test() {
+ // CHECK: [[NEW:%.*]] = call noalias i8* @_Znaj(i32 44)
+ // CHECK-NEXT: [[T0:%.*]] = bitcast i8* [[NEW]] to i32*
+ // CHECK-NEXT: store i32 10, i32* [[T0]]
+ // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8* [[NEW]], i64 4
+ // CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to [[A]]*
+ // CHECK-NEXT: ret [[A]]* [[T2]]
+ return ::new A[10];
+ }
+
+ // CHECK: define void @_ZN5test24testEPNS_1AE(
+ void test(A *p) {
+ // CHECK: [[P:%.*]] = alloca [[A]]*, align 4
+ // CHECK-NEXT: store [[A]]* {{%.*}}, [[A]]** [[P]], align 4
+ // CHECK-NEXT: [[T0:%.*]] = load [[A]]** [[P]], align 4
+ // CHECK-NEXT: [[T1:%.*]] = icmp eq [[A]]* [[T0]], null
+ // CHECK-NEXT: br i1 [[T1]],
+ // CHECK: [[T2:%.*]] = bitcast [[A]]* [[T0]] to i8*
+ // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds i8* [[T2]], i64 -4
+ // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to i32*
+ // CHECK-NEXT: [[T5:%.*]] = load i32* [[T4]]
+ // CHECK-NEXT: call void @_ZdaPv(i8* [[T3]])
+ // CHECK-NEXT: br label
+ ::delete[] p;
+ }
+}
+
+// rdar://problem/8913519
+namespace test3 {
+ struct A {
+ int x;
+ void operator delete[](void *, size_t);
+ };
+ struct B : A {};
+
+ // CHECK: define void @_ZN5test34testEv()
+ void test() {
+ // CHECK: call noalias i8* @_Znaj(i32 24)
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: store i32 5
+ (void) new B[5];
+ }
+}
diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp
index 1f52a783e628..ddc7bb8dac28 100644
--- a/test/CodeGenCXX/delete.cpp
+++ b/test/CodeGenCXX/delete.cpp
@@ -54,7 +54,7 @@ namespace test0 {
delete a;
}
- // CHECK: define linkonce_odr void @_ZN5test01AD1Ev
+ // CHECK: define linkonce_odr void @_ZN5test01AD1Ev(%class.A* %this) unnamed_addr
// CHECK: define linkonce_odr void @_ZN5test01AdlEPv
}
@@ -105,3 +105,10 @@ namespace test2 {
delete [] b;
}
}
+
+namespace test3 {
+ void f(int a[10][20]) {
+ // CHECK: call void @_ZdaPv(i8*
+ delete a;
+ }
+}
diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp
index f2835b7a299e..006f26433712 100644
--- a/test/CodeGenCXX/derived-to-base-conv.cpp
+++ b/test/CodeGenCXX/derived-to-base-conv.cpp
@@ -78,7 +78,7 @@ void test(Derived bb)
// CHECK-LP64: callq __ZN1XcvR1BEv
// CHECK-LP64: callq __ZN1AC1ERKS_
-// CHECK-LP32: call L__ZN1XcvR1BEv
-// CHECK-LP32: call L__ZN1AC1ERKS_
+// CHECK-LP32: calll L__ZN1XcvR1BEv
+// CHECK-LP32: calll L__ZN1AC1ERKS_
diff --git a/test/CodeGenCXX/derived-to-base.cpp b/test/CodeGenCXX/derived-to-base.cpp
index e44fdc5ed2de..76b79fc3a8d5 100644
--- a/test/CodeGenCXX/derived-to-base.cpp
+++ b/test/CodeGenCXX/derived-to-base.cpp
@@ -34,3 +34,14 @@ A *f(B* b) {
}
+// Don't crash on a derived-to-base conversion of an r-value
+// aggregate.
+namespace test3 {
+ struct A {};
+ struct B : A {};
+
+ void foo(A a);
+ void test() {
+ foo(B());
+ }
+}
diff --git a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
new file mode 100644
index 000000000000..e332f4020001
--- /dev/null
+++ b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+struct A { int i; };
+struct B { int j; };
+struct C : A, B { int k; };
+
+struct D final : virtual C {
+ D();
+ virtual void f();
+};
+
+// CHECK: define %struct.B* @_Z1fR1D
+B &f(D &d) {
+ // CHECK-NOT: load i8**
+ return d;
+}
diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp
index 2eba30f778c2..f382413cba41 100644
--- a/test/CodeGenCXX/destructors.cpp
+++ b/test/CodeGenCXX/destructors.cpp
@@ -40,11 +40,11 @@ namespace PR7526 {
struct allocator_derived : allocator { };
- // CHECK: define void @_ZN6PR75269allocatorD2Ev
+ // CHECK: define void @_ZN6PR75269allocatorD2Ev(%"struct.PR5529::A"* %this) unnamed_addr
// CHECK: call void @__cxa_call_unexpected
allocator::~allocator() throw() { foo(); }
- // CHECK: define linkonce_odr void @_ZN6PR752617allocator_derivedD1Ev
+ // CHECK: define linkonce_odr void @_ZN6PR752617allocator_derivedD1Ev(%"struct.PR5529::A"* %this) unnamed_addr
// CHECK-NOT: call void @__cxa_call_unexpected
// CHECK: }
void foo() {
@@ -93,7 +93,7 @@ namespace test0 {
// complete destructor alias tested above
-// CHECK: define void @_ZN5test01AD2Ev
+// CHECK: define void @_ZN5test01AD2Ev(%"struct.test0::A"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test06MemberD1Ev
// CHECK: unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
// CHECK: invoke void @_ZN5test04BaseD2Ev
@@ -106,7 +106,7 @@ namespace test0 {
B::~B() try { } catch (int i) {}
// It will suppress the delegation optimization here, though.
-// CHECK: define void @_ZN5test01BD1Ev
+// CHECK: define void @_ZN5test01BD1Ev(%"struct.test0::B"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test06MemberD1Ev
// CHECK: unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
// CHECK: invoke void @_ZN5test04BaseD2Ev
@@ -114,7 +114,7 @@ namespace test0 {
// CHECK: invoke void @_ZN5test05VBaseD2Ev
// CHECK: unwind label [[VBASE_UNWIND:%[a-zA-Z0-9.]+]]
-// CHECK: define void @_ZN5test01BD2Ev
+// CHECK: define void @_ZN5test01BD2Ev(%"struct.test0::B"* %this, i8** %vtt) unnamed_addr
// CHECK: invoke void @_ZN5test06MemberD1Ev
// CHECK: unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
// CHECK: invoke void @_ZN5test04BaseD2Ev
@@ -142,24 +142,24 @@ namespace test1 {
O::~O() {} // alias tested above
struct P : NonEmpty, A { ~P(); };
- P::~P() {} // CHECK: define void @_ZN5test11PD2Ev
+ P::~P() {} // CHECK: define void @_ZN5test11PD2Ev(%"struct.test1::P"* %this) unnamed_addr
struct Q : A, B { ~Q(); };
- Q::~Q() {} // CHECK: define void @_ZN5test11QD2Ev
+ Q::~Q() {} // CHECK: define void @_ZN5test11QD2Ev(%"struct.test1::M"* %this) unnamed_addr
struct R : A { ~R(); };
- R::~R() { A a; } // CHECK: define void @_ZN5test11RD2Ev
+ R::~R() { A a; } // CHECK: define void @_ZN5test11RD2Ev(%"struct.test1::M"* %this) unnamed_addr
struct S : A { ~S(); int x; };
S::~S() {} // alias tested above
struct T : A { ~T(); B x; };
- T::~T() {} // CHECK: define void @_ZN5test11TD2Ev
+ T::~T() {} // CHECK: define void @_ZN5test11TD2Ev(%"struct.test1::T"* %this) unnamed_addr
// The VTT parameter prevents this. We could still make this work
// for calling conventions that are safe against extra parameters.
struct U : A, virtual B { ~U(); };
- U::~U() {} // CHECK: define void @_ZN5test11UD2Ev
+ U::~U() {} // CHECK: define void @_ZN5test11UD2Ev(%"struct.test1::U"* %this, i8** %vtt) unnamed_addr
}
// PR6471
@@ -168,7 +168,7 @@ namespace test2 {
struct B : A { ~B(); };
B::~B() {}
- // CHECK: define void @_ZN5test21BD2Ev
+ // CHECK: define void @_ZN5test21BD2Ev(%"struct.test1::M"* %this) unnamed_addr
// CHECK: call void @_ZN5test21AD2Ev
}
@@ -273,7 +273,7 @@ namespace test6 {
};
C::C() { opaque(); }
- // CHECK: define void @_ZN5test61CC1Ev
+ // CHECK: define void @_ZN5test61CC1Ev(%"struct.test6::C"* %this) unnamed_addr
// CHECK: call void @_ZN5test61BILj2EEC2Ev
// CHECK: invoke void @_ZN5test61BILj3EEC2Ev
// CHECK: invoke void @_ZN5test61BILj0EEC2Ev
@@ -283,7 +283,7 @@ namespace test6 {
// FIXME: way too much EH cleanup code follows
C::~C() { opaque(); }
- // CHECK: define void @_ZN5test61CD1Ev
+ // CHECK: define void @_ZN5test61CD1Ev(%"struct.test6::C"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test61CD2Ev
// CHECK: invoke void @_ZN5test61BILj3EED2Ev
// CHECK: call void @_ZN5test61BILj2EED2Ev
@@ -291,7 +291,7 @@ namespace test6 {
// CHECK: invoke void @_ZN5test61BILj3EED2Ev
// CHECK: invoke void @_ZN5test61BILj2EED2Ev
- // CHECK: define void @_ZN5test61CD2Ev
+ // CHECK: define void @_ZN5test61CD2Ev(%"struct.test6::C"* %this, i8** %vtt) unnamed_addr
// CHECK: invoke void @_ZN5test66opaqueEv
// CHECK: invoke void @_ZN5test61AD1Ev
// CHECK: invoke void @_ZN5test61AD1Ev
@@ -306,9 +306,29 @@ namespace test6 {
// CHECK: invoke void @_ZN5test61BILj0EED2Ev
}
+// PR 9197
+namespace test7 {
+ struct D { ~D(); };
+
+ struct A { ~A(); };
+ A::~A() { }
+
+ struct B : public A {
+ ~B();
+ D arr[1];
+ };
+
+ // Verify that this doesn't get emitted as an alias
+ // CHECK: define void @_ZN5test71BD2Ev(
+ // CHECK: invoke void @_ZN5test71DD1Ev(
+ // CHECK: call void @_ZN5test71AD2Ev(
+ B::~B() {}
+
+}
+
// Checks from test3:
- // CHECK: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(
+ // CHECK: define internal void @_ZN5test312_GLOBAL__N_11DD0Ev(%"struct.test3::<anonymous namespace>::D"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test312_GLOBAL__N_11DD1Ev(
// CHECK: call void @_ZdlPv({{.*}}) nounwind
// CHECK: ret void
@@ -330,7 +350,7 @@ namespace test6 {
// CHECK: call void @_ZN5test312_GLOBAL__N_11DD0Ev(
// CHECK: ret void
- // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(
+ // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD2Ev(%"struct.test3::<anonymous namespace>::C"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test31BD2Ev(
// CHECK: call void @_ZN5test31AD2Ev(
// CHECK: ret void
@@ -338,7 +358,7 @@ namespace test6 {
// CHECK: declare void @_ZN5test31BD2Ev(
// CHECK: declare void @_ZN5test31AD2Ev(
- // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(
+ // CHECK: define internal void @_ZN5test312_GLOBAL__N_11CD0Ev(%"struct.test3::<anonymous namespace>::C"* %this) unnamed_addr
// CHECK: invoke void @_ZN5test312_GLOBAL__N_11CD1Ev(
// CHECK: call void @_ZdlPv({{.*}}) nounwind
// CHECK: ret void
diff --git a/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp b/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp
new file mode 100644
index 000000000000..3de75ed3db54
--- /dev/null
+++ b/test/CodeGenCXX/devirtualize-virtual-function-calls-final.cpp
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+namespace Test1 {
+ struct A {
+ virtual int f() final;
+ };
+
+ // CHECK: define i32 @_ZN5Test11fEPNS_1AE
+ int f(A *a) {
+ // CHECK: call i32 @_ZN5Test11A1fEv
+ return a->f();
+ }
+}
+
+namespace Test2 {
+ struct A final {
+ virtual int f();
+ };
+
+ // CHECK: define i32 @_ZN5Test21fEPNS_1AE
+ int f(A *a) {
+ // CHECK: call i32 @_ZN5Test21A1fEv
+ return a->f();
+ }
+}
+
+namespace Test3 {
+ struct A {
+ virtual int f();
+ };
+
+ struct B final : A { };
+
+ // CHECK: define i32 @_ZN5Test31fEPNS_1BE
+ int f(B *b) {
+ // CHECK: call i32 @_ZN5Test31A1fEv
+ return b->f();
+ }
+
+ // CHECK: define i32 @_ZN5Test31fERNS_1BE
+ int f(B &b) {
+ // CHECK: call i32 @_ZN5Test31A1fEv
+ return b.f();
+ }
+
+ // CHECK: define i32 @_ZN5Test31fEPv
+ int f(void *v) {
+ // CHECK: call i32 @_ZN5Test31A1fEv
+ return static_cast<B*>(v)->f();
+ }
+}
diff --git a/test/CodeGenCXX/dyncast.cpp b/test/CodeGenCXX/dyncast.cpp
index 723e12b15fdc..7fd5899225c2 100644
--- a/test/CodeGenCXX/dyncast.cpp
+++ b/test/CodeGenCXX/dyncast.cpp
@@ -1,6 +1,5 @@
// 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
-// XFAIL: win32
#include <typeinfo>
diff --git a/test/CodeGenCXX/eh.cpp b/test/CodeGenCXX/eh.cpp
index 0960ec381b89..5ae65ccfaab6 100644
--- a/test/CodeGenCXX/eh.cpp
+++ b/test/CodeGenCXX/eh.cpp
@@ -10,16 +10,10 @@ void test1() {
}
// CHECK: define void @_Z5test1v()
-// CHECK: [[FREEVAR:%.*]] = alloca i1
-// CHECK-NEXT: [[EXNOBJVAR:%.*]] = alloca i8*
-// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
-// CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8)
-// CHECK-NEXT: store i8* [[EXNOBJ]], i8** [[EXNOBJVAR]]
-// CHECK-NEXT: store i1 true, i1* [[FREEVAR]]
+// CHECK: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8)
// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]]
// CHECK-NEXT: [[EXN2:%.*]] = bitcast [[DSTAR]] [[EXN]] to i8*
// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[EXN2]], i8* bitcast ([[DSTAR]] @d1 to i8*), i64 8, i32 8, i1 false)
-// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
// CHECK-NEXT: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%0* @_ZTI7test1_D to i8*), i8* null) noreturn
// CHECK-NEXT: unreachable
@@ -36,20 +30,14 @@ void test2() {
}
// CHECK: define void @_Z5test2v()
-// CHECK: [[FREEVAR:%.*]] = alloca i1
-// CHECK-NEXT: [[EXNOBJVAR:%.*]] = alloca i8*
-// CHECK-NEXT: [[EXNSLOTVAR:%.*]] = alloca i8*
+// CHECK: [[EXNSLOTVAR:%.*]] = alloca i8*
// CHECK-NEXT: [[CLEANUPDESTVAR:%.*]] = alloca i32
-// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
// CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 16)
-// CHECK-NEXT: store i8* [[EXNOBJ]], i8** [[EXNOBJVAR]]
-// CHECK-NEXT: store i1 true, i1* [[FREEVAR]]
// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]]
// CHECK-NEXT: invoke void @_ZN7test2_DC1ERKS_([[DSTAR]] [[EXN]], [[DSTAR]] @d2)
// CHECK-NEXT: to label %[[CONT:.*]] unwind label %{{.*}}
// : [[CONT]]: (can't check this in Release-Asserts builds)
-// CHECK: store i1 false, i1* [[FREEVAR]]
-// CHECK-NEXT: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%{{.*}}* @_ZTI7test2_D to i8*), i8* null) noreturn
+// CHECK: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%{{.*}}* @_ZTI7test2_D to i8*), i8* null) noreturn
// CHECK-NEXT: unreachable
@@ -64,15 +52,9 @@ void test3() {
}
// CHECK: define void @_Z5test3v()
-// CHECK: [[FREEVAR:%.*]] = alloca i1
-// CHECK-NEXT: [[EXNOBJVAR:%.*]] = alloca i8*
-// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
-// CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8)
-// CHECK-NEXT: store i8* [[EXNOBJ]], i8** [[EXNOBJVAR]]
-// CHECK-NEXT: store i1 true, i1* [[FREEVAR]]
-// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSS:%[^*]*\*]]*
-// CHECK-NEXT: store [[DSS]] null, [[DSS]]* [[EXN]]
-// CHECK-NEXT: store i1 false, i1* [[FREEVAR]]
+// CHECK: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 8)
+// CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[D:%[^*]+]]**
+// CHECK-NEXT: store [[D]]* null, [[D]]** [[EXN]]
// CHECK-NEXT: call void @__cxa_throw(i8* [[EXNOBJ]], i8* bitcast (%1* @_ZTIPV7test3_D to i8*), i8* null) noreturn
// CHECK-NEXT: unreachable
@@ -121,20 +103,14 @@ namespace test6 {
namespace test7 {
// CHECK: define i32 @_ZN5test73fooEv()
int foo() {
-// CHECK: [[FREEEXNOBJ:%.*]] = alloca i1
-// CHECK-NEXT: [[EXNALLOCVAR:%.*]] = alloca i8*
-// CHECK-NEXT: [[CAUGHTEXNVAR:%.*]] = alloca i8*
+// CHECK: [[CAUGHTEXNVAR:%.*]] = alloca i8*
// CHECK-NEXT: [[INTCATCHVAR:%.*]] = alloca i32
// CHECK-NEXT: [[EHCLEANUPDESTVAR:%.*]] = alloca i32
-// CHECK-NEXT: store i1 false, i1* [[FREEEXNOBJ]]
try {
try {
// CHECK-NEXT: [[EXNALLOC:%.*]] = call i8* @__cxa_allocate_exception
-// CHECK-NEXT: store i8* [[EXNALLOC]], i8** [[EXNALLOCVAR]]
-// CHECK-NEXT: store i1 true, i1* [[FREEEXNOBJ]]
// CHECK-NEXT: bitcast i8* [[EXNALLOC]] to i32*
// CHECK-NEXT: store i32 1, i32*
-// CHECK-NEXT: store i1 false, i1* [[FREEEXNOBJ]]
// CHECK-NEXT: invoke void @__cxa_throw(i8* [[EXNALLOC]], i8* bitcast (i8** @_ZTIi to i8*), i8* null
throw 1;
}
@@ -197,11 +173,11 @@ namespace test9 {
struct A { A(); };
- // CHECK: define void @_ZN5test91AC1Ev
+ // CHECK: define void @_ZN5test91AC1Ev(%"struct.test10::A"* %this) unnamed_addr
// CHECK: call void @_ZN5test91AC2Ev
// CHECK-NEXT: ret void
- // CHECK: define void @_ZN5test91AC2Ev(
+ // CHECK: define void @_ZN5test91AC2Ev(%"struct.test10::A"* %this) unnamed_addr
A::A() try {
// CHECK: invoke void @_ZN5test96opaqueEv()
opaque();
@@ -414,3 +390,49 @@ namespace test15 {
// CHECK: call void @_ZN6test151AD1Ev
}
}
+
+namespace test16 {
+ struct A { A(); ~A(); };
+ struct B { int x; B(const A &); ~B(); };
+ void foo();
+ bool cond();
+
+ // CHECK: define void @_ZN6test163barEv()
+ void bar() {
+ // CHECK: [[EXN_SAVE:%.*]] = alloca i8*
+ // CHECK-NEXT: [[EXN_ACTIVE:%.*]] = alloca i1
+ // CHECK-NEXT: [[TEMP:%.*]] = alloca [[A:%.*]],
+ // CHECK-NEXT: [[EXNSLOT:%.*]] = alloca i8*
+ // CHECK-NEXT: [[EHDEST:%.*]] = alloca i32
+ // CHECK-NEXT: [[TEMP_ACTIVE:%.*]] = alloca i1
+
+ cond() ? throw B(A()) : foo();
+
+ // CHECK-NEXT: [[COND:%.*]] = call zeroext i1 @_ZN6test164condEv()
+ // CHECK-NEXT: store i1 false, i1* [[EXN_ACTIVE]]
+ // CHECK-NEXT: store i1 false, i1* [[TEMP_ACTIVE]]
+ // CHECK-NEXT: br i1 [[COND]],
+
+ // CHECK: [[EXN:%.*]] = call i8* @__cxa_allocate_exception(i64 4)
+ // CHECK-NEXT: store i8* [[EXN]], i8** [[EXN_SAVE]]
+ // CHECK-NEXT: store i1 true, i1* [[EXN_ACTIVE]]
+ // CHECK-NEXT: [[T0:%.*]] = bitcast i8* [[EXN]] to [[B:%.*]]*
+ // CHECK-NEXT: invoke void @_ZN6test161AC1Ev([[A]]* [[TEMP]])
+ // CHECK: store i1 true, i1* [[TEMP_ACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN6test161BC1ERKNS_1AE([[B]]* [[T0]], [[A]]* [[TEMP]])
+ // CHECK: store i1 false, i1* [[EXN_ACTIVE]]
+ // CHECK-NEXT: invoke void @__cxa_throw(i8* [[EXN]],
+
+ // CHECK: invoke void @_ZN6test163fooEv()
+ // CHECK: br label
+
+ // CHECK: invoke void @_ZN6test161AD1Ev([[A]]* [[TEMP]])
+ // CHECK: ret void
+
+ // CHECK: [[T0:%.*]] = load i1* [[EXN_ACTIVE]]
+ // CHECK-NEXT: br i1 [[T0]]
+ // CHECK: [[T1:%.*]] = load i8** [[EXN_SAVE]]
+ // CHECK-NEXT: call void @__cxa_free_exception(i8* [[T1]])
+ // CHECK-NEXT: br label
+ }
+}
diff --git a/test/CodeGenCXX/empty-classes.cpp b/test/CodeGenCXX/empty-classes.cpp
index 59124e3d55b2..1ce1dad40ffa 100644
--- a/test/CodeGenCXX/empty-classes.cpp
+++ b/test/CodeGenCXX/empty-classes.cpp
@@ -53,6 +53,19 @@ int f() {
return 0;
}
+namespace PR8796 {
+ struct FreeCell {
+ };
+ union ThingOrCell {
+ FreeCell t;
+ FreeCell cell;
+ };
+ struct Things {
+ ThingOrCell things;
+ };
+ Things x;
+}
+
#ifdef HARNESS
extern "C" void printf(const char *, ...);
diff --git a/test/CodeGenCXX/exceptions-no-rtti.cpp b/test/CodeGenCXX/exceptions-no-rtti.cpp
index 66b4c4ac33b1..bbbc1b8a8bb6 100644
--- a/test/CodeGenCXX/exceptions-no-rtti.cpp
+++ b/test/CodeGenCXX/exceptions-no-rtti.cpp
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -fno-rtti -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
-// CHECK: @_ZTIN5test11AE = weak_odr constant
-// CHECK: @_ZTIN5test11BE = weak_odr constant
-// CHECK: @_ZTIN5test11CE = weak_odr constant
-// CHECK: @_ZTIN5test11DE = weak_odr constant
-// CHECK: @_ZTIPN5test11DE = weak_odr constant {{.*}} @_ZTIN5test11DE
+// CHECK: @_ZTIN5test11AE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTIN5test11BE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTIN5test11CE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTIN5test11DE = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTIPN5test11DE = linkonce_odr unnamed_addr constant {{.*}} @_ZTIN5test11DE
// PR6974: this shouldn't crash
namespace test0 {
diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp
index 4d8fb809ab9c..84d55c8f1907 100644
--- a/test/CodeGenCXX/exceptions.cpp
+++ b/test/CodeGenCXX/exceptions.cpp
@@ -1,18 +1,295 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions | FileCheck %s
-struct allocator {
- allocator();
- allocator(const allocator&);
- ~allocator();
-};
+typedef typeof(sizeof(0)) size_t;
-void f();
-void g(bool b, bool c) {
- if (b) {
- if (!c)
- throw allocator();
+// This just shouldn't crash.
+namespace test0 {
+ struct allocator {
+ allocator();
+ allocator(const allocator&);
+ ~allocator();
+ };
- return;
+ void f();
+ void g(bool b, bool c) {
+ if (b) {
+ if (!c)
+ throw allocator();
+
+ return;
+ }
+ f();
+ }
+}
+
+namespace test1 {
+ struct A { A(int); A(int, int); ~A(); void *p; };
+
+ A *a() {
+ // CHECK: define [[A:%.*]]* @_ZN5test11aEv()
+ // CHECK: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 5)
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: call void @_ZdlPv(i8* [[NEW]])
+ return new A(5);
+ }
+
+ A *b() {
+ // CHECK: define [[A:%.*]]* @_ZN5test11bEv()
+ // CHECK: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: [[FOO:%.*]] = invoke i32 @_ZN5test13fooEv()
+ // CHECK: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[FOO]])
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: call void @_ZdlPv(i8* [[NEW]])
+ extern int foo();
+ return new A(foo());
+ }
+
+ struct B { B(); ~B(); operator int(); int x; };
+ B makeB();
+
+ A *c() {
+ // CHECK: define [[A:%.*]]* @_ZN5test11cEv()
+ // CHECK: [[ACTIVE:%.*]] = alloca i1
+ // CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
+ // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test11BC1Ev([[B:%.*]]* [[T0:%.*]])
+ // CHECK: [[T1:%.*]] = getelementptr inbounds [[B]]* [[T0]], i32 0, i32 0
+ // CHECK-NEXT: [[T2:%.*]] = load i32* [[T1]], align 4
+ // CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T2]])
+ // CHECK: store i1 false, i1* [[ACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: [[ISACTIVE:%.*]] = load i1* [[ACTIVE]]
+ // CHECK-NEXT: br i1 [[ISACTIVE]]
+ // CHECK: call void @_ZdlPv(i8* [[NEW]])
+ return new A(B().x);
+ }
+
+ A *d() {
+ // CHECK: define [[A:%.*]]* @_ZN5test11dEv()
+ // CHECK: [[ACTIVE:%.*]] = alloca i1
+ // CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
+ // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test11BC1Ev([[B:%.*]]* [[T0:%.*]])
+ // CHECK: [[T1:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T0]])
+ // CHECK: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T1]])
+ // CHECK: store i1 false, i1* [[ACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: [[ISACTIVE:%.*]] = load i1* [[ACTIVE]]
+ // CHECK-NEXT: br i1 [[ISACTIVE]]
+ // CHECK: call void @_ZdlPv(i8* [[NEW]])
+ return new A(B());
+ }
+
+ A *e() {
+ // CHECK: define [[A:%.*]]* @_ZN5test11eEv()
+ // CHECK: [[ACTIVE:%.*]] = alloca i1
+ // CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
+ // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test11BC1Ev([[B:%.*]]* [[T0:%.*]])
+ // CHECK: [[T1:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T0]])
+ // CHECK: invoke void @_ZN5test11BC1Ev([[B]]* [[T2:%.*]])
+ // CHECK: [[T3:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T2]])
+ // CHECK: invoke void @_ZN5test11AC1Eii([[A]]* [[CAST]], i32 [[T1]], i32 [[T3]])
+ // CHECK: store i1 false, i1* [[ACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
+ // CHECK: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: [[ISACTIVE:%.*]] = load i1* [[ACTIVE]]
+ // CHECK-NEXT: br i1 [[ISACTIVE]]
+ // CHECK: call void @_ZdlPv(i8* [[NEW]])
+ return new A(B(), B());
+ }
+ A *f() {
+ return new A(makeB().x);
+ }
+ A *g() {
+ return new A(makeB());
+ }
+ A *h() {
+ return new A(makeB(), makeB());
+ }
+
+ A *i() {
+ // CHECK: define [[A:%.*]]* @_ZN5test11iEv()
+ // CHECK: [[X:%.*]] = alloca [[A]]*, align 8
+ // CHECK: [[ACTIVE:%.*]] = alloca i1
+ // CHECK: store i1 true, i1* [[ACTIVE]]
+ // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test15makeBEv([[B:%.*]]* sret [[T0:%.*]])
+ // CHECK: [[T1:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T0]])
+ // CHECK: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T1]])
+ // CHECK: store i1 false, i1* [[ACTIVE]]
+ // CHECK-NEXT: store [[A]]* [[CAST]], [[A]]** [[X]], align 8
+ // CHECK: invoke void @_ZN5test15makeBEv([[B:%.*]]* sret [[T2:%.*]])
+ // CHECK: [[RET:%.*]] = load [[A]]** [[X]], align 8
+ // CHECK: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
+ // CHECK: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+ // CHECK: ret [[A]]* [[RET]]
+ // CHECK: [[ISACTIVE:%.*]] = load i1* [[ACTIVE]]
+ // CHECK-NEXT: br i1 [[ISACTIVE]]
+ // CHECK: call void @_ZdlPv(i8* [[NEW]])
+ A *x;
+ return (x = new A(makeB()), makeB(), x);
+ }
+}
+
+namespace test2 {
+ struct A {
+ A(int); A(int, int); ~A();
+ void *p;
+ void *operator new(size_t);
+ void operator delete(void*, size_t);
+ };
+
+ A *a() {
+ // CHECK: define [[A:%.*]]* @_ZN5test21aEv()
+ // CHECK: [[NEW:%.*]] = call i8* @_ZN5test21AnwEm(i64 8)
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test21AC1Ei([[A]]* [[CAST]], i32 5)
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: invoke void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
+ // CHECK: call void @_ZSt9terminatev()
+ return new A(5);
+ }
+}
+
+namespace test3 {
+ struct A {
+ A(int); A(int, int); A(const A&); ~A();
+ void *p;
+ void *operator new(size_t, void*, double);
+ void operator delete(void*, void*, double);
+ };
+
+ void *foo();
+ double bar();
+ A makeA(), *makeAPtr();
+
+ A *a() {
+ // CHECK: define [[A:%.*]]* @_ZN5test31aEv()
+ // CHECK: [[FOO:%.*]] = call i8* @_ZN5test33fooEv()
+ // CHECK: [[BAR:%.*]] = call double @_ZN5test33barEv()
+ // CHECK: [[NEW:%.*]] = call i8* @_ZN5test31AnwEmPvd(i64 8, i8* [[FOO]], double [[BAR]])
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test31AC1Ei([[A]]* [[CAST]], i32 5)
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: invoke void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
+ // CHECK: call void @_ZSt9terminatev()
+ return new(foo(),bar()) A(5);
+ }
+
+ // rdar://problem/8439196
+ A *b(bool cond) {
+
+ // CHECK: define [[A:%.*]]* @_ZN5test31bEb(i1 zeroext
+ // CHECK: [[SAVED0:%.*]] = alloca i8*
+ // CHECK-NEXT: [[SAVED1:%.*]] = alloca i8*
+ // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
+ // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]], align 8
+ // CHECK: [[TMPACTIVE:%.*]] = alloca i1
+ // CHECK-NEXT: store i1 false, i1* [[CLEANUPACTIVE]]
+
+ // CHECK: [[COND:%.*]] = trunc i8 {{.*}} to i1
+ // CHECK-NEXT: store i1 false, i1* [[TMPACTIVE]]
+ // CHECK-NEXT: br i1 [[COND]]
+ return (cond ?
+
+ // CHECK: [[FOO:%.*]] = call i8* @_ZN5test33fooEv()
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_ZN5test31AnwEmPvd(i64 8, i8* [[FOO]], double [[CONST:.*]])
+ // CHECK-NEXT: store i8* [[NEW]], i8** [[SAVED0]]
+ // CHECK-NEXT: store i8* [[FOO]], i8** [[SAVED1]]
+ // CHECK-NEXT: store i1 true, i1* [[CLEANUPACTIVE]]
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: invoke void @_ZN5test35makeAEv([[A]]* sret [[TMP]])
+ // CHECK: store i1 true, i1* [[TMPACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN5test31AC1ERKS0_([[A]]* [[CAST]], [[A]]* [[TMP]])
+ // CHECK: store i1 false, i1* [[CLEANUPACTIVE]]
+ // CHECK-NEXT: br label
+ // -> cond.end
+ new(foo(),10.0) A(makeA()) :
+
+ // CHECK: [[MAKE:%.*]] = invoke [[A]]* @_ZN5test38makeAPtrEv()
+ // CHECK: br label
+ // -> cond.end
+ makeAPtr());
+
+ // cond.end:
+ // CHECK: [[RESULT:%.*]] = phi [[A]]* {{.*}}[[CAST]]{{.*}}[[MAKE]]
+ // CHECK-NEXT: [[ISACTIVE:%.*]] = load i1* [[TMPACTIVE]]
+ // CHECK-NEXT: br i1 [[ISACTIVE]]
+ // CHECK: invoke void @_ZN5test31AD1Ev
+ // CHECK: ret [[A]]* [[RESULT]]
+
+ // in the EH path:
+ // CHECK: [[ISACTIVE:%.*]] = load i1* [[CLEANUPACTIVE]]
+ // CHECK-NEXT: br i1 [[ISACTIVE]]
+ // CHECK: [[V0:%.*]] = load i8** [[SAVED0]]
+ // CHECK-NEXT: [[V1:%.*]] = load i8** [[SAVED1]]
+ // CHECK-NEXT: invoke void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
+ }
+}
+
+namespace test4 {
+ struct A {
+ A(int); A(int, int); ~A();
+ void *p;
+ void *operator new(size_t, void*, void*);
+ void operator delete(void*, size_t, void*, void*); // not a match
+ };
+
+ A *a() {
+ // CHECK: define [[A:%.*]]* @_ZN5test41aEv()
+ // CHECK: [[FOO:%.*]] = call i8* @_ZN5test43fooEv()
+ // CHECK-NEXT: [[BAR:%.*]] = call i8* @_ZN5test43barEv()
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_ZN5test41AnwEmPvS1_(i64 8, i8* [[FOO]], i8* [[BAR]])
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
+ // CHECK-NEXT: call void @_ZN5test41AC1Ei([[A]]* [[CAST]], i32 5)
+ // CHECK-NEXT: ret [[A]]* [[CAST]]
+ extern void *foo(), *bar();
+
+ return new(foo(),bar()) A(5);
+ }
+}
+
+// PR7908
+namespace test5 {
+ struct T { T(); ~T(); };
+
+ struct A {
+ A(const A &x, const T &t = T());
+ ~A();
+ };
+
+ void foo();
+
+ // CHECK: define void @_ZN5test54testEv()
+ // CHECK: [[EXNSLOT:%.*]] = alloca i8*
+ // CHECK-NEXT: [[A:%.*]] = alloca [[A_T:%.*]], align 1
+ // CHECK-NEXT: [[T:%.*]] = alloca [[T_T:%.*]], align 1
+ // CHECK-NEXT: alloca i32
+ // CHECK-NEXT: invoke void @_ZN5test53fooEv()
+ // CHECK: [[EXN:%.*]] = load i8** [[EXNSLOT]]
+ // CHECK-NEXT: [[ADJ:%.*]] = call i8* @__cxa_get_exception_ptr(i8* [[EXN]])
+ // CHECK-NEXT: [[SRC:%.*]] = bitcast i8* [[ADJ]] to [[A_T]]*
+ // CHECK-NEXT: invoke void @_ZN5test51TC1Ev([[T_T]]* [[T]])
+ // CHECK: invoke void @_ZN5test51AC1ERKS0_RKNS_1TE([[A_T]]* [[A]], [[A_T]]* [[SRC]], [[T_T]]* [[T]])
+ // CHECK: invoke void @_ZN5test51TD1Ev([[T_T]]* [[T]])
+ // CHECK: call i8* @__cxa_begin_catch(i8* [[EXN]]) nounwind
+ // CHECK-NEXT: invoke void @_ZN5test51AD1Ev([[A_T]]* [[A]])
+ // CHECK: call void @__cxa_end_catch()
+ void test() {
+ try {
+ foo();
+ } catch (A a) {
+ }
}
- f();
}
diff --git a/test/CodeGenCXX/friend-redecl.cpp b/test/CodeGenCXX/friend-redecl.cpp
new file mode 100644
index 000000000000..18292cd17103
--- /dev/null
+++ b/test/CodeGenCXX/friend-redecl.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s
+// PR8864
+
+struct Foo {
+ friend bool TryFoo(Foo *f2) { return TryFoo(0, f2); }
+
+// CHECK: define{{.*}}Z6TryFooP3Foo
+// CHECK-NOT: ret
+// CHECK: call{{.*}}Z6TryFooiP3Foo
+// CHECK: ret
+
+ friend bool TryFoo(int, Foo *f3);
+};
+bool TryFoo(Foo *f5);
+int main(void) {
+ Foo f;
+ TryFoo(&f);
+}
diff --git a/test/CodeGenCXX/global-init.cpp b/test/CodeGenCXX/global-init.cpp
index 6ff9598afce1..600327081681 100644
--- a/test/CodeGenCXX/global-init.cpp
+++ b/test/CodeGenCXX/global-init.cpp
@@ -12,11 +12,17 @@ struct C { void *field; };
struct D { ~D(); };
+// CHECK: @__dso_handle = external unnamed_addr global i8*
// CHECK: @c = global %struct.C zeroinitializer, align 8
// It's okay if we ever implement the IR-generation optimization to remove this.
// CHECK: @_ZN5test3L3varE = internal constant i8* getelementptr inbounds ([7 x i8]*
+// 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: 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*))
A a;
@@ -64,6 +70,17 @@ namespace test3 {
const char *test() { return var; }
}
+namespace PR5974 {
+ struct A { int a; };
+ struct B { int b; };
+ struct C : A, B { int c; };
+
+ extern C c;
+
+ // These should not require global initializers.
+ A* a = &c;
+ B* b = &c;
+}
// CHECK: define internal void [[TEST1_Z_INIT:@.*]]()
// CHECK: load i32* @_ZN5test1L1yE
// CHECK-NEXT: xor
diff --git a/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp b/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp
new file mode 100644
index 000000000000..fea83645a5cf
--- /dev/null
+++ b/test/CodeGenCXX/gnu-conditional-scalar-ext.cpp
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// rdar: // 8353567
+// pr7726
+
+extern "C" int printf(...);
+
+void test0() {
+// CHECK: call i32 (...)* @printf({{.*}}, i8* inttoptr (i64 3735928559 to i8*))
+ printf("%p\n", (void *)0xdeadbeef ? : (void *)0xaaaaaa);
+}
+
+// rdar://8446940
+namespace radar8446940 {
+extern "C" void abort();
+
+int main () {
+ char x[1];
+ char *y = x ? : 0;
+
+ if (x != y)
+ abort();
+}
+}
+
+namespace radar8453812 {
+extern "C" void abort();
+_Complex int getComplex(_Complex int val) {
+ static int count;
+ if (count++)
+ abort();
+ return val;
+}
+
+_Complex int cmplx() {
+ _Complex int cond;
+ _Complex int rhs;
+
+ return getComplex(1+2i) ? : rhs;
+}
+
+// lvalue test
+void foo (int& lv) {
+ ++lv;
+}
+
+int global = 1;
+
+int &cond() {
+ static int count;
+ if (count++)
+ abort();
+ return global;
+}
+
+
+int main() {
+ cmplx();
+ int rhs = 10;
+ foo (cond()? : rhs);
+ return global-2;
+}
+}
diff --git a/test/CodeGenCXX/goto.cpp b/test/CodeGenCXX/goto.cpp
new file mode 100644
index 000000000000..938d4e12d8d5
--- /dev/null
+++ b/test/CodeGenCXX/goto.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fexceptions -emit-llvm -o - | FileCheck %s
+
+// Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
+namespace test0 {
+ struct A { A(); ~A(); };
+ struct V { V(const A &a = A()); ~V(); };
+
+ // CHECK: define linkonce_odr i32 @_ZN5test04testILi0EEEii
+ template<int X> int test(int x) {
+ // CHECK: [[RET:%.*]] = alloca i32
+ // CHECK-NEXT: [[X:%.*]] = alloca i32
+ // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]],
+ // CHECK-NEXT: [[Z:%.*]] = alloca [[A]]
+ // CHECK-NEXT: [[EXN:%.*]] = alloca i8*
+ // CHECK-NEXT: alloca i32
+ // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*,
+ // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]
+ // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
+ // CHECK: store i1 true, i1* [[CLEANUPACTIVE]]
+ // CHECK: call void @_ZN5test01AC1Ev([[A]]* [[Y]])
+ // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[Z]])
+ // CHECK: [[NEW:%.*]] = invoke noalias i8* @_Znwm(i64 1)
+ // CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]*
+ // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]])
+ // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* [[TMP]])
+ // CHECK: store i1 false, i1* [[CLEANUPACTIVE]]
+ // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]])
+ A y;
+ try {
+ A z;
+ V *v = new V();
+
+ if (x) return 1;
+ } catch (int ex) {
+ return 1;
+ }
+ return 0;
+ }
+
+ int test() {
+ return test<0>(5);
+ }
+}
diff --git a/test/CodeGenCXX/implicit-copy-constructor.cpp b/test/CodeGenCXX/implicit-copy-constructor.cpp
index a343dd154cd9..500860182ecc 100644
--- a/test/CodeGenCXX/implicit-copy-constructor.cpp
+++ b/test/CodeGenCXX/implicit-copy-constructor.cpp
@@ -40,7 +40,7 @@ void f(D d) {
D d2(d);
}
-// CHECK: define linkonce_odr void @_ZN1DC1ERS_
+// CHECK: define linkonce_odr void @_ZN1DC1ERS_(%struct.D* %this, %struct.D*) unnamed_addr
// CHECK: call void @_ZN1AC1Ev
// CHECK: call void @_ZN1CC2ERS_1A
// CHECK: call void @_ZN1AD1Ev
diff --git a/test/CodeGenCXX/inline-functions.cpp b/test/CodeGenCXX/inline-functions.cpp
index 8d046a2f4a9b..69dfe0db98f0 100644
--- a/test/CodeGenCXX/inline-functions.cpp
+++ b/test/CodeGenCXX/inline-functions.cpp
@@ -21,3 +21,35 @@ void B<char>::f() { }
// CHECK: define void @_Z1fv
void f() { }
+
+// <rdar://problem/8740363>
+inline void f1(int);
+
+// CHECK: define linkonce_odr void @_Z2f1i
+void f1(int) { }
+
+void test_f1() { f1(17); }
+
+// PR8789
+namespace test1 {
+ template <typename T> class ClassTemplate {
+ private:
+ friend void T::func();
+ void g() {}
+ };
+
+ // CHECK: define linkonce_odr void @_ZN5test11C4funcEv(
+
+ class C {
+ public:
+ void func() {
+ ClassTemplate<C> ct;
+ ct.g();
+ }
+ };
+
+ void f() {
+ C c;
+ c.func();
+ }
+}
diff --git a/test/CodeGenCXX/internal-linkage.cpp b/test/CodeGenCXX/internal-linkage.cpp
index 9fdb7274e146..39bce8545ff5 100644
--- a/test/CodeGenCXX/internal-linkage.cpp
+++ b/test/CodeGenCXX/internal-linkage.cpp
@@ -1,11 +1,11 @@
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
struct Global { Global(); };
-template<typename T> struct X { X(); };
+template<typename T> struct X { X() {} };
namespace {
- struct Anon { Anon(); };
+ struct Anon { Anon() {} };
// CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global
Global anon0;
diff --git a/test/CodeGenCXX/key-function-vtable.cpp b/test/CodeGenCXX/key-function-vtable.cpp
index 15c058da9460..8e474bdf95f1 100644
--- a/test/CodeGenCXX/key-function-vtable.cpp
+++ b/test/CodeGenCXX/key-function-vtable.cpp
@@ -30,6 +30,7 @@ void testf::a() {}
namespace {
struct testg { virtual void a(); };
}
+void testg::a() {}
testg *testgvar = new testg;
struct X0 { virtual ~X0(); };
@@ -43,9 +44,9 @@ void use_X1(X1 *x1) { x1->f(); }
// FIXME: The checks are extremely difficult to get right when the globals
// aren't alphabetized
-// CHECK: @_ZTV2X1 = weak_odr constant
-// CHECK: @_ZTV5testa = constant [3 x i8*] [i8* null
-// CHECK: @_ZTV5testc = weak_odr constant [3 x i8*] [i8* null
-// CHECK: @_ZTVN12_GLOBAL__N_15testgE = internal constant [3 x i8*] [i8* null
-// CHECK: @_ZTV5teste = weak_odr constant [3 x i8*] [i8* null
-// CHECK: @_ZTV5testb = weak_odr constant [3 x i8*] [i8* null
+// CHECK: @_ZTV2X1 = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTV5testa = unnamed_addr constant [3 x i8*] [i8* null
+// CHECK: @_ZTV5testc = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null
+// CHECK: @_ZTVN12_GLOBAL__N_15testgE = internal unnamed_addr constant [3 x i8*] [i8* null
+// CHECK: @_ZTV5teste = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null
+// CHECK: @_ZTV5testb = linkonce_odr unnamed_addr constant [3 x i8*] [i8* null
diff --git a/test/CodeGenCXX/mangle-abi-examples.cpp b/test/CodeGenCXX/mangle-abi-examples.cpp
new file mode 100644
index 000000000000..7124078320b0
--- /dev/null
+++ b/test/CodeGenCXX/mangle-abi-examples.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: @_ZTVZ3foovEN1C1DE =
+// CHECK: @_ZTVZN1A3fooEiE1B =
+// CHECK: define {{.*}} @_ZZZ3foovEN1C3barEvEN1E3bazEv(
+
+// Itanium C++ ABI examples.
+struct A {
+ void foo (int) {
+ struct B { virtual ~B() {} };
+ B();
+ }
+};
+void foo () {
+ struct C {
+ struct D { virtual ~D() {} };
+ void bar () {
+ struct E {
+ void baz() { }
+ };
+ E().baz();
+ }
+ };
+ A().foo(0);
+ C::D();
+ C().bar();
+}
diff --git a/test/CodeGenCXX/mangle-local-class-vtables.cpp b/test/CodeGenCXX/mangle-local-class-vtables.cpp
new file mode 100644
index 000000000000..d9d3afe45933
--- /dev/null
+++ b/test/CodeGenCXX/mangle-local-class-vtables.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: @_ZTVZN1J1KEvE1C = {{.*}} @_ZTIZN1J1KEvE1C {{.*}} @_ZZN1J1KEvENK1C1FEv
+// CHECK: @_ZTIZN1J1KEvE1C = {{.*}} @_ZTSZN1J1KEvE1C
+// CHECK: @_ZTVZ1GvE1C_1 = {{.*}} @_ZTIZ1GvE1C_1 {{.*}} @_ZZ1GvENK1C1FE_1v
+// CHECK: @_ZTIZ1GvE1C_1 = {{.*}} @_ZTSZ1GvE1C_1
+// CHECK: @_ZTVZ1GvE1C_0 = {{.*}} @_ZTIZ1GvE1C_0 {{.*}} @_ZZ1GvENK1C1FE_0v
+// CHECK: @_ZTIZ1GvE1C_0 = {{.*}} @_ZTSZ1GvE1C_0
+// CHECK: @_ZTVZ1GvE1C = {{.*}} @_ZTIZ1GvE1C {{.*}} @_ZZ1GvENK1C1FEv
+// CHECK: @_ZTIZ1GvE1C = {{.*}} @_ZTSZ1GvE1C
+
+// CHECK: define {{.*}} @_ZZN1J1KEvEN1CC2Ev(
+// CHECK: define {{.*}} @_ZZN1J1KEvENK1C1FEv(
+// CHECK: define {{.*}} @_ZZ1GvEN1CC2E_1v(
+// CHECK: define {{.*}} @_ZZ1GvENK1C1FE_1v(
+// CHECK: define {{.*}} @_ZZ1GvENK1C1HE_1v(
+// CHECK: define {{.*}} @_ZZ1GvEN1CC2E_0v(
+// CHECK: define {{.*}} @_ZZ1GvENK1C1FE_0v(
+// CHECK: define {{.*}} @_ZZ1GvENK1C1GE_0v(
+// CHECK: define {{.*}} @_ZZ1GvEN1CC2Ev(
+// CHECK: define {{.*}} @_ZZ1GvENK1C1FEv(
+
+struct I {
+ virtual void F() const = 0;
+};
+
+void Go(const I &i);
+
+void G() {
+ {
+ struct C : I {
+ void F() const {}
+ };
+ Go(C());
+ }
+ {
+ struct C : I {
+ void F() const { G(); }
+ void G() const {}
+ };
+ Go(C());
+ }
+ {
+ struct C : I {
+ void F() const { H(); }
+ void H() const {}
+ };
+ Go(C());
+ }
+}
+
+struct J {
+ void K();
+};
+
+void J::K() {
+ struct C : I {
+ void F() const {}
+ };
+ Go(C());
+}
diff --git a/test/CodeGenCXX/mangle-local-classes-nested.cpp b/test/CodeGenCXX/mangle-local-classes-nested.cpp
new file mode 100644
index 000000000000..fafa5d4e58e6
--- /dev/null
+++ b/test/CodeGenCXX/mangle-local-classes-nested.cpp
@@ -0,0 +1,81 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: @_ZTVZZ1HvEN1S1IEvE1S =
+
+// CHECK: define {{.*}} @_Z2L1v(
+// CHECK: define {{.*}} @_ZZ2L1vEN1S2L2Ev(
+// CHECK: define {{.*}} @_ZZ2L1vEN1S2L2E_0v(
+// CHECK: define {{.*}} @_ZZ1FvEN1S1T1S1T1GEv(
+// CHECK: define {{.*}} @_ZZZ2L1vEN1S2L2E_0vEN1S3L3cEv(
+// CHECK: define {{.*}} @_ZZZ2L1vEN1S2L2E_0vEN1S3L3dE_0v(
+// CHECK: define {{.*}} @_ZZZ2L1vEN1S2L2EvEN1S3L3aEv(
+// CHECK: define {{.*}} @_ZZZ2L1vEN1S2L2EvEN1S3L3bE_0v(
+
+void L1() {
+ {
+ struct S {
+ void L2() {
+ {
+ struct S {
+ void L3a() {}
+ };
+ S().L3a();
+ }
+ {
+ struct S {
+ void L3b() {}
+ };
+ S().L3b();
+ }
+ }
+ };
+ S().L2();
+ }
+ {
+ struct S {
+ void L2() {
+ {
+ struct S {
+ void L3c() {}
+ };
+ S().L3c();
+ }
+ {
+ struct S {
+ void L3d() {}
+ };
+ S().L3d();
+ }
+ }
+ };
+ S().L2();
+ }
+}
+
+void F() {
+ struct S {
+ struct T {
+ struct S {
+ struct T {
+ void G() {}
+ };
+ };
+ };
+ };
+ S::T::S::T().G();
+}
+
+struct B { virtual void Foo() = 0; };
+void G(const B &);
+
+void H() {
+ struct S {
+ void I() {
+ struct S : B {
+ virtual void Foo() {}
+ };
+ G(S());
+ }
+ };
+ S().I();
+}
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp
index 61f8a595fc4f..d8d75b7d0f0e 100644
--- a/test/CodeGenCXX/mangle-ms.cpp
+++ b/test/CodeGenCXX/mangle-ms.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-apple-darwin10 | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
// CHECK: @"\01?a@@3HA"
// CHECK: @"\01?b@N@@3HA"
@@ -11,7 +11,7 @@
// CHECK: @"\01?i@@3PAY0BE@HA"
// CHECK: @"\01?j@@3P6GHCE@ZA"
// CHECK: @"\01?k@@3PTfoo@@DA"
-// CHECK: @"\01?l@@3P8foo@@AAHH@ZA"
+// CHECK: @"\01?l@@3P8foo@@AEHH@ZA"
int a;
@@ -46,10 +46,8 @@ enum quux {
qthree
};
-// NOTE: The calling convention is supposed to be __thiscall by default,
-// but that needs to be fixed in Sema/AST.
int foo::operator+(int a) {return a;}
-// CHECK: @"\01??Hfoo@@QAAHH@Z"
+// CHECK: @"\01??Hfoo@@QAEHH@Z"
const short foo::d = 0;
volatile long foo::e;
diff --git a/test/CodeGenCXX/mangle-neon-vectors.cpp b/test/CodeGenCXX/mangle-neon-vectors.cpp
new file mode 100644
index 000000000000..3723deb19219
--- /dev/null
+++ b/test/CodeGenCXX/mangle-neon-vectors.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+typedef float float32_t;
+typedef signed char poly8_t;
+typedef short poly16_t;
+typedef unsigned long long uint64_t;
+
+typedef __attribute__((neon_vector_type(2))) int int32x2_t;
+typedef __attribute__((neon_vector_type(4))) int int32x4_t;
+typedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t;
+typedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t;
+typedef __attribute__((neon_vector_type(2))) float32_t float32x2_t;
+typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t;
+typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t;
+typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
+
+// CHECK: 16__simd64_int32_t
+void f1(int32x2_t v) { }
+// CHECK: 17__simd128_int32_t
+void f2(int32x4_t v) { }
+// CHECK: 17__simd64_uint64_t
+void f3(uint64x1_t v) { }
+// CHECK: 18__simd128_uint64_t
+void f4(uint64x2_t v) { }
+// CHECK: 18__simd64_float32_t
+void f5(float32x2_t v) { }
+// CHECK: 19__simd128_float32_t
+void f6(float32x4_t v) { }
+// CHECK: 17__simd128_poly8_t
+void f7(poly8x16_t v) { }
+// CHECK: 18__simd128_poly16_t
+void f8(poly16x8_t v) { }
diff --git a/test/CodeGenCXX/mangle-ref-qualifiers.cpp b/test/CodeGenCXX/mangle-ref-qualifiers.cpp
new file mode 100644
index 000000000000..b3f37d7db31a
--- /dev/null
+++ b/test/CodeGenCXX/mangle-ref-qualifiers.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+struct X {
+ int f() &;
+ int g() &&;
+ int h() const &&;
+};
+
+// CHECK: define i32 @_ZNR1X1fEv
+int X::f() & { return 0; }
+// CHECK: define i32 @_ZNO1X1gEv
+int X::g() && { return 0; }
+// CHECK: define i32 @_ZNKO1X1hEv
+int X::h() const && { return 0; }
+
+// CHECK: define void @_Z1fM1XRFivEMS_OFivEMS_KOFivE
+void f(int (X::*)() &, int (X::*)() &&, int (X::*)() const&&) { }
diff --git a/test/CodeGenCXX/mangle-subst-std.cpp b/test/CodeGenCXX/mangle-subst-std.cpp
index 9c1e978294c8..8d79988da8e3 100644
--- a/test/CodeGenCXX/mangle-subst-std.cpp
+++ b/test/CodeGenCXX/mangle-subst-std.cpp
@@ -3,19 +3,19 @@
// Check mangling of Vtables, VTTs, and construction vtables that
// involve standard substitutions.
-// CHECK: @_ZTVSd = weak_odr constant
+// 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: @_ZTTSd = weak_odr constant
-// CHECK: @_ZTVSo = weak_odr constant
-// CHECK: @_ZTTSo = weak_odr constant
-// CHECK: @_ZTVSi = weak_odr constant
-// CHECK: @_ZTTSi = weak_odr constant
+// CHECK: @_ZTTSo = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTVSo = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTTSi = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTVSi = linkonce_odr unnamed_addr constant
namespace std {
struct A { A(); };
- // CHECK: define void @_ZNSt1AC1Ev
- // CHECK: define void @_ZNSt1AC2Ev
+ // CHECK: define void @_ZNSt1AC1Ev(%"struct.N::std::A"* %this) unnamed_addr
+ // CHECK: define void @_ZNSt1AC2Ev(%"struct.N::std::A"* %this) unnamed_addr
A::A() { }
};
diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp
index 6a2994407167..463f15dc4abe 100644
--- a/test/CodeGenCXX/mangle-template.cpp
+++ b/test/CodeGenCXX/mangle-template.cpp
@@ -82,7 +82,7 @@ namespace test7 {
X(U*, typename int_c<(meta<T>::value + meta<U>::value)>::type *) { }
};
- // CHECK: define weak_odr void @_ZN5test71XIiEC1IdEEPT_PNS_5int_cIXplL_ZNS_4metaIiE5valueEEsrNS6_IS3_EE5valueEE4typeE
+ // CHECK: define weak_odr void @_ZN5test71XIiEC1IdEEPT_PNS_5int_cIXplL_ZNS_4metaIiE5valueEEsrNS6_IS3_EE5valueEE4typeE(%"class.test1::T"* %this, double*, float*) unnamed_addr
template X<int>::X(double*, float*);
}
diff --git a/test/CodeGenCXX/mangle-unnamed.cpp b/test/CodeGenCXX/mangle-unnamed.cpp
index 83b46d69454e..53f381c3a011 100644
--- a/test/CodeGenCXX/mangle-unnamed.cpp
+++ b/test/CodeGenCXX/mangle-unnamed.cpp
@@ -69,3 +69,24 @@ int f7() {
// CHECK: _ZZ2f7vE1a
return a.b;
}
+
+// This used to cause an assert because the typedef-for-anonymous-tag
+// code was trying to claim the enum for the template.
+enum { T8 };
+template <class T> struct Test8 {
+ typedef T type;
+ Test8(type t) {} // tested later
+};
+template <class T> void make_test8(T value) { Test8<T> t(value); }
+void test8() { make_test8(T8); }
+
+// CHECK: define internal void @"_ZNV3$_35test9Ev"(
+typedef volatile struct {
+ void test9() volatile {}
+} Test9;
+void test9() {
+ Test9 a;
+ a.test9();
+}
+
+// CHECK: define internal void @"_ZN5Test8I3$_2EC1ES0_"(
diff --git a/test/CodeGenCXX/mangle-variadic-templates.cpp b/test/CodeGenCXX/mangle-variadic-templates.cpp
new file mode 100644
index 000000000000..a987b49a1281
--- /dev/null
+++ b/test/CodeGenCXX/mangle-variadic-templates.cpp
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -std=c++0x -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s
+
+template<unsigned I, typename ...Types>
+struct X { };
+
+template<typename T> struct identity { };
+template<typename T> struct add_reference;
+template<typename ...Types> struct tuple { };
+template<int ...Values> struct int_tuple { };
+template<template<typename> class ...Templates> struct template_tuple { };
+
+// CHECK: define weak_odr void @_Z2f0IJEEv1XIXsZT_EJDpRT_EE
+template<typename ...Types>
+void f0(X<sizeof...(Types), Types&...>) { }
+
+template void f0(X<0>);
+
+// CHECK: define weak_odr void @_Z2f0IJifdEEv1XIXsZT_EJDpRT_EE
+template void f0<int, float, double>(X<3, int&, float&, double&>);
+
+// Mangling for template argument packs
+template<typename ...Types> void f1() {}
+// CHECK: define weak_odr void @_Z2f1IJEEvv
+template void f1<>();
+// CHECK: define weak_odr void @_Z2f1IJiEEvv
+template void f1<int>();
+// CHECK: define weak_odr void @_Z2f1IJifEEvv
+template void f1<int, float>();
+
+// Mangling function parameter packs
+template<typename ...Types> void f2(Types...) {}
+// CHECK: define weak_odr void @_Z2f2IJEEvDpT_
+template void f2<>();
+// CHECK: define weak_odr void @_Z2f2IJiEEvDpT_
+template void f2<int>(int);
+// CHECK: define weak_odr void @_Z2f2IJifEEvDpT_
+template void f2<int, float>(int, float);
+
+// Mangling non-trivial function parameter packs
+template<typename ...Types> void f3(const Types *...) {}
+// CHECK: define weak_odr void @_Z2f3IJEEvDpPKT_
+template void f3<>();
+// CHECK: define weak_odr void @_Z2f3IJiEEvDpPKT_
+template void f3<int>(const int*);
+// CHECK: define weak_odr void @_Z2f3IJifEEvDpPKT_
+template void f3<int, float>(const int*, const float*);
+
+// Mangling of type pack expansions in a template argument
+template<typename ...Types> tuple<Types...> f4() {}
+// CHECK: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv
+template tuple<int, float, double> f4();
+
+// Mangling of type pack expansions in a function type
+template<typename R, typename ...ArgTypes> identity<R(ArgTypes...)> f5() {}
+// CHECK: define weak_odr void @_Z2f5IiJifdEE8identityIFT_DpT0_EEv
+template identity<int(int, float, double)> f5();
+
+// Mangling of non-type template argument expansions
+template<int ...Values> int_tuple<Values...> f6() {}
+// CHECK: define weak_odr void @_Z2f6IJLi1ELi2ELi3EEE9int_tupleIJXspT_EEEv
+template int_tuple<1, 2, 3> f6();
+
+// Mangling of template template argument expansions
+template<template<typename> class ...Templates>
+template_tuple<Templates...> f7() {}
+// CHECK: define weak_odr void @_Z2f7IJ8identity13add_referenceEE14template_tupleIJDpT_EEv
+template template_tuple<identity, add_reference> f7();
diff --git a/test/CodeGenCXX/mangle.cpp b/test/CodeGenCXX/mangle.cpp
index 55357c7d63a4..ec496fe1f753 100644
--- a/test/CodeGenCXX/mangle.cpp
+++ b/test/CodeGenCXX/mangle.cpp
@@ -624,3 +624,26 @@ namespace test20 {
template <class T> void test1(decltype(f<>(T()))) {}
template void test1<int>(decltype(f<>(int())));
}
+
+// rdar:// 8620510
+namespace test21 {
+ // CHECK: define void @_ZN6test2112vla_arg_funcEiPA_i(
+ void vla_arg_func(int X, int a[X][X]) {}
+}
+
+namespace test22 {
+ // CHECK: define void @_ZN6test221fEDn(
+ void f(decltype(nullptr)) { }
+}
+
+// rdar://problem/8913416
+namespace test23 {
+ typedef void * const vpc;
+
+ // CHECK: define void @_ZN6test231fERA10_KPv(
+ void f(vpc (&)[10]) {}
+
+ typedef vpc vpca5[5];
+ void f(vpca5 volatile (&)[10]) {}
+ // CHECK: define void @_ZN6test231fERA10_A5_VKPv(
+}
diff --git a/test/CodeGenCXX/member-functions.cpp b/test/CodeGenCXX/member-functions.cpp
index a60d24ad6212..b95763c0ffac 100644
--- a/test/CodeGenCXX/member-functions.cpp
+++ b/test/CodeGenCXX/member-functions.cpp
@@ -20,9 +20,9 @@ void test1() {
struct S {
- // RUN: grep "define linkonce_odr void @_ZN1SC1Ev" %t
+ // RUN: grep "define linkonce_odr void @_ZN1SC1Ev.*unnamed_addr" %t
inline S() { }
- // RUN: grep "define linkonce_odr void @_ZN1SC1Ev" %t
+ // RUN: grep "define linkonce_odr void @_ZN1SC1Ev.*unnamed_addr" %t
inline ~S() { }
diff --git a/test/CodeGenCXX/member-init-assignment.cpp b/test/CodeGenCXX/member-init-assignment.cpp
index 57ab7ebd1f2f..128cb888f3d4 100644
--- a/test/CodeGenCXX/member-init-assignment.cpp
+++ b/test/CodeGenCXX/member-init-assignment.cpp
@@ -10,7 +10,7 @@ struct Foo {
Foo::Foo(unsigned arg) : file_id(arg = 42)
{ }
-// CHECK: define void @_ZN3FooC2Ej
+// CHECK: define void @_ZN3FooC2Ej(%struct.Foo* %this, i32 %arg) unnamed_addr
// CHECK: [[ARG:%.*]] = alloca i32
// CHECK: store i32 42, i32* [[ARG]]
// CHECK: store i32 42, i32* %{{.*}}
diff --git a/test/CodeGenCXX/member-pointer-type-convert.cpp b/test/CodeGenCXX/member-pointer-type-convert.cpp
index 16c14692f66d..2970a2e39e3f 100644
--- a/test/CodeGenCXX/member-pointer-type-convert.cpp
+++ b/test/CodeGenCXX/member-pointer-type-convert.cpp
@@ -6,5 +6,6 @@ struct {
const char *name;
param_t par;
} *ptr;
+void test_ptr() { (void) ptr; } // forced use
// CHECK: type { i8*, {{i..}} }
diff --git a/test/CodeGenCXX/member-templates.cpp b/test/CodeGenCXX/member-templates.cpp
index bcf1187e623f..7e4bdca77f38 100644
--- a/test/CodeGenCXX/member-templates.cpp
+++ b/test/CodeGenCXX/member-templates.cpp
@@ -15,8 +15,8 @@ struct B {
template<typename T> B::B(T) {}
-// CHECK: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32)
-// CHECK: define weak_odr void @_ZN1BC2IiEET_(%struct.B* %this, i32)
+// CHECK: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32) unnamed_addr
+// CHECK: define weak_odr void @_ZN1BC2IiEET_(%struct.B* %this, i32) unnamed_addr
template B::B(int);
template<typename T>
diff --git a/test/CodeGenCXX/nrvo-noreturn.cc b/test/CodeGenCXX/nrvo-noreturn.cc
new file mode 100644
index 000000000000..a8259cab5f30
--- /dev/null
+++ b/test/CodeGenCXX/nrvo-noreturn.cc
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -emit-llvm-only %s
+// PR9178
+
+void abort() __attribute__((__noreturn__));
+struct CoinModelLink {
+ CoinModelLink();
+ ~CoinModelLink();
+};
+class CoinModel {
+ CoinModelLink firstInQuadraticColumn();
+};
+CoinModelLink CoinModel::firstInQuadraticColumn() {
+ abort();
+ CoinModelLink x;
+ return x;
+}
+
diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp
index 8d19b1effe95..d03b21bacbaf 100644
--- a/test/CodeGenCXX/nrvo.cpp
+++ b/test/CodeGenCXX/nrvo.cpp
@@ -131,3 +131,18 @@ X test4(bool B) {
// CHECK: tail call void @exit(i32 1)
exit(1);
}
+
+#ifdef __EXCEPTIONS
+// CHECK-EH: define void @_Z5test5
+void may_throw();
+X test5() {
+ try {
+ may_throw();
+ } catch (X x) {
+ // CHECK-EH: invoke void @_ZN1XC1ERKS_
+ // CHECK-EH: call void @__cxa_end_catch()
+ // CHECK-EH: ret void
+ return x;
+ }
+}
+#endif
diff --git a/test/CodeGenCXX/nullptr.cpp b/test/CodeGenCXX/nullptr.cpp
index ab63b432bdfa..1ea23ec0a95b 100644
--- a/test/CodeGenCXX/nullptr.cpp
+++ b/test/CodeGenCXX/nullptr.cpp
@@ -1,5 +1,8 @@
-// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -I%S -emit-llvm -o - %s | FileCheck %s
+#include <typeinfo>
+
+// CHECK: @_ZTIDn = external constant i8*
int* a = nullptr;
void f() {
@@ -15,3 +18,7 @@ void g() {
// CHECK: call i8* @_Z11get_nullptrv()
int (X::*pmf)(int) = get_nullptr();
}
+
+const std::type_info& f2() {
+ return typeid(nullptr_t);
+}
diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp
index 38c7d2815a08..40723a856cd6 100644
--- a/test/CodeGenCXX/pointers-to-data-members.cpp
+++ b/test/CodeGenCXX/pointers-to-data-members.cpp
@@ -1,40 +1,47 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 | FileCheck %s
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-darwin10 -O3 | FileCheck --check-prefix=CHECK-O3 %s
+// RUN: %clang_cc1 %s -emit-llvm -o %t.ll -triple=x86_64-apple-darwin10
+// RUN: FileCheck %s < %t.ll
+// RUN: FileCheck -check-prefix=CHECK-GLOBAL %s < %t.ll
+// RUN: %clang_cc1 %s -emit-llvm -o %t-opt.ll -triple=x86_64-apple-darwin10 -O3
+// RUN: FileCheck --check-prefix=CHECK-O3 %s < %t-opt.ll
+
struct A { int a; int b; };
struct B { int b; };
struct C : B, A { };
// Zero init.
namespace ZeroInit {
- // CHECK: @_ZN8ZeroInit1aE = global i64 -1
+ // CHECK-GLOBAL: @_ZN8ZeroInit1aE = global i64 -1
int A::* a;
- // CHECK: @_ZN8ZeroInit2aaE = global [2 x i64] [i64 -1, i64 -1]
+ // CHECK-GLOBAL: @_ZN8ZeroInit2aaE = global [2 x i64] [i64 -1, i64 -1]
int A::* aa[2];
- // CHECK: @_ZN8ZeroInit3aaaE = global [2 x [2 x i64]] {{\[}}[2 x i64] [i64 -1, i64 -1], [2 x i64] [i64 -1, i64 -1]]
+ // CHECK-GLOBAL: @_ZN8ZeroInit3aaaE = global [2 x [2 x i64]] {{\[}}[2 x i64] [i64 -1, i64 -1], [2 x i64] [i64 -1, i64 -1]]
int A::* aaa[2][2];
- // CHECK: @_ZN8ZeroInit1bE = global i64 -1,
+ // CHECK-GLOBAL: @_ZN8ZeroInit1bE = global i64 -1,
int A::* b = 0;
- // CHECK: @_ZN8ZeroInit2saE = global %struct.anon { i64 -1 }
+ // CHECK-GLOBAL: @_ZN8ZeroInit2saE = internal global %struct.anon { i64 -1 }
struct {
int A::*a;
} sa;
+ void test_sa() { (void) sa; } // force emission
- // CHECK: @_ZN8ZeroInit3ssaE =
- // CHECK: [2 x i64] [i64 -1, i64 -1]
+ // CHECK-GLOBAL: @_ZN8ZeroInit3ssaE = internal
+ // CHECK-GLOBAL: [2 x i64] [i64 -1, i64 -1]
struct {
int A::*aa[2];
} ssa[2];
+ void test_ssa() { (void) ssa; }
- // CHECK: @_ZN8ZeroInit2ssE = global %1 { %struct.anon { i64 -1 } }
+ // CHECK-GLOBAL: @_ZN8ZeroInit2ssE = internal global %1 { %struct.anon { i64 -1 } }
struct {
struct {
int A::*pa;
} s;
} ss;
+ void test_ss() { (void) ss; }
struct A {
int A::*a;
@@ -48,13 +55,13 @@ namespace ZeroInit {
};
struct C : A, B { int j; };
- // CHECK: @_ZN8ZeroInit1cE = global %"struct.ZeroInit::C" { [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 {{%.*}} { [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 }
C c;
}
// PR5674
namespace PR5674 {
- // CHECK: @_ZN6PR56742pbE = global i64 4
+ // CHECK-GLOBAL: @_ZN6PR56742pbE = global i64 4
int A::*pb = &A::b;
}
@@ -117,7 +124,7 @@ struct A {
A();
};
-// CHECK: define void @_ZN9ValueInit1AC2Ev
+// CHECK: define void @_ZN9ValueInit1AC2Ev(%"struct.ValueInit::A"* %this) unnamed_addr
// CHECK: store i64 -1, i64*
// CHECK: ret void
A::A() : a() {}
@@ -165,15 +172,15 @@ struct A {
int A::*i;
};
-// FIXME: A::i should be initialized to -1 here.
+// 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" }
struct B : virtual A { };
B b;
-// FIXME: A::i should be initialized to -1 here.
+// 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" }
struct C : virtual A { int A::*i; };
C c;
-// FIXME: C::A::i should be initialized to -1 here.
+ // 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" }
struct D : C { int A::*i; };
D d;
@@ -203,3 +210,23 @@ namespace BoolPtrToMember {
return x.*member;
}
}
+
+namespace PR8507 {
+
+struct S;
+void f(S* p, double S::*pm) {
+ if (0 < p->*pm) {
+ }
+}
+
+}
+
+namespace test4 {
+ struct A { int A_i; };
+ struct B : virtual A { int A::*B_p; };
+ 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 }
+ D d;
+}
diff --git a/test/CodeGenCXX/pr9130.cpp b/test/CodeGenCXX/pr9130.cpp
new file mode 100644
index 000000000000..b28f3940e4e6
--- /dev/null
+++ b/test/CodeGenCXX/pr9130.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+
+class nsOggCodecState {
+ virtual int StartTime() {
+ return -1;
+ }
+};
+class nsVorbisState : public nsOggCodecState {
+ virtual ~nsVorbisState();
+};
+nsVorbisState::~nsVorbisState() {
+}
+
+// CHECK: define linkonce_odr i32 @_ZN15nsOggCodecState9StartTimeEv
diff --git a/test/CodeGenCXX/pragma-pack.cpp b/test/CodeGenCXX/pragma-pack.cpp
new file mode 100644
index 000000000000..c0ddb1d855a9
--- /dev/null
+++ b/test/CodeGenCXX/pragma-pack.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -triple=i686-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+struct Base {
+ virtual ~Base();
+ int x;
+};
+
+#pragma pack(1)
+struct Sub : virtual Base {
+ char c;
+};
+
+// CHECK: %struct.Sub = type <{ i32 (...)**, i8, [8 x i8] }>
+void f(Sub*) { }
diff --git a/test/CodeGenCXX/pragma-visibility.cpp b/test/CodeGenCXX/pragma-visibility.cpp
index 05de78670a04..2dc8bcc74fac 100644
--- a/test/CodeGenCXX/pragma-visibility.cpp
+++ b/test/CodeGenCXX/pragma-visibility.cpp
@@ -63,10 +63,12 @@ namespace n __attribute((visibility("default"))) {
#pragma GCC visibility pop
}
+// We used to test this, but it's insane, so unless it happens in
+// headers, we should not support it.
namespace n __attribute((visibility("hidden"))) {
extern int foofoo; // FIXME: Shouldn't be necessary, but otherwise the pragma
// gets to Sema before the namespace!
#pragma GCC visibility pop
void h() {}
- // CHECK: define void @_ZN1n1hEv
+ // CHECK disabled: define void @_ZN1n1hEv
}
diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp
index f5e5ca95282d..56270b5f6953 100644
--- a/test/CodeGenCXX/predefined-expr.cpp
+++ b/test/CodeGenCXX/predefined-expr.cpp
@@ -1,82 +1,82 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
-// CHECK: private constant [15 x i8] c"externFunction\00"
-// CHECK: private constant [26 x i8] c"void NS::externFunction()\00"
+// CHECK: private unnamed_addr constant [15 x i8] c"externFunction\00"
+// CHECK: private unnamed_addr constant [26 x i8] c"void NS::externFunction()\00"
-// CHECK: private constant [22 x i8] c"classTemplateFunction\00"
-// CHECK: private constant [60 x i8] c"void NS::ClassTemplate<NS::Base *>::classTemplateFunction()\00"
-// CHECK: private constant [53 x i8] c"void NS::ClassTemplate<int>::classTemplateFunction()\00"
+// CHECK: private unnamed_addr constant [22 x i8] c"classTemplateFunction\00"
+// CHECK: private unnamed_addr constant [60 x i8] c"void NS::ClassTemplate<NS::Base *>::classTemplateFunction()\00"
+// CHECK: private unnamed_addr constant [53 x i8] c"void NS::ClassTemplate<int>::classTemplateFunction()\00"
-// CHECK: private constant [18 x i8] c"functionTemplate1\00"
-// CHECK: private constant [45 x i8] c"void NS::Base::functionTemplate1(NS::Base *)\00"
-// CHECK: private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00"
+// CHECK: private unnamed_addr constant [18 x i8] c"functionTemplate1\00"
+// CHECK: private unnamed_addr constant [45 x i8] c"void NS::Base::functionTemplate1(NS::Base *)\00"
+// CHECK: private unnamed_addr constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00"
-// CHECK: private constant [23 x i8] c"anonymousUnionFunction\00"
-// CHECK: private constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous union>::anonymousUnionFunction()\00"
+// CHECK: private unnamed_addr constant [23 x i8] c"anonymousUnionFunction\00"
+// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous union>::anonymousUnionFunction()\00"
-// CHECK: private constant [24 x i8] c"anonymousStructFunction\00"
-// CHECK: private constant [85 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous struct>::anonymousStructFunction()\00"
+// CHECK: private unnamed_addr constant [24 x i8] c"anonymousStructFunction\00"
+// CHECK: private unnamed_addr constant [85 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous struct>::anonymousStructFunction()\00"
-// CHECK: private constant [23 x i8] c"anonymousClassFunction\00"
-// CHECK: private constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous class>::anonymousClassFunction()\00"
+// CHECK: private unnamed_addr constant [23 x i8] c"anonymousClassFunction\00"
+// CHECK: private unnamed_addr constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous class>::anonymousClassFunction()\00"
-// CHECK: private constant [12 x i8] c"~Destructor\00"
-// CHECK: private constant [30 x i8] c"NS::Destructor::~Destructor()\00"
+// CHECK: private unnamed_addr constant [12 x i8] c"~Destructor\00"
+// CHECK: private unnamed_addr constant [30 x i8] c"NS::Destructor::~Destructor()\00"
-// CHECK: private constant [12 x i8] c"Constructor\00"
-// CHECK: private constant [41 x i8] c"NS::Constructor::Constructor(NS::Base *)\00"
-// CHECK: private constant [34 x i8] c"NS::Constructor::Constructor(int)\00"
-// CHECK: private constant [31 x i8] c"NS::Constructor::Constructor()\00"
+// CHECK: private unnamed_addr constant [12 x i8] c"Constructor\00"
+// CHECK: private unnamed_addr constant [41 x i8] c"NS::Constructor::Constructor(NS::Base *)\00"
+// CHECK: private unnamed_addr constant [34 x i8] c"NS::Constructor::Constructor(int)\00"
+// CHECK: private unnamed_addr constant [31 x i8] c"NS::Constructor::Constructor()\00"
-// CHECK: private constant [16 x i8] c"virtualFunction\00"
-// CHECK: private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00"
+// CHECK: private unnamed_addr constant [16 x i8] c"virtualFunction\00"
+// CHECK: private unnamed_addr constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00"
-// CHECK: private constant [22 x i8] c"constVolatileFunction\00"
-// CHECK: private constant [54 x i8] c"void NS::Base::constVolatileFunction() const volatile\00"
+// CHECK: private unnamed_addr constant [22 x i8] c"constVolatileFunction\00"
+// CHECK: private unnamed_addr constant [54 x i8] c"void NS::Base::constVolatileFunction() const volatile\00"
-// CHECK: private constant [17 x i8] c"volatileFunction\00"
-// CHECK: private constant [43 x i8] c"void NS::Base::volatileFunction() volatile\00"
+// CHECK: private unnamed_addr constant [17 x i8] c"volatileFunction\00"
+// CHECK: private unnamed_addr constant [43 x i8] c"void NS::Base::volatileFunction() volatile\00"
-// CHECK: private constant [14 x i8] c"constFunction\00"
-// CHECK: private constant [37 x i8] c"void NS::Base::constFunction() const\00"
+// CHECK: private unnamed_addr constant [14 x i8] c"constFunction\00"
+// CHECK: private unnamed_addr constant [37 x i8] c"void NS::Base::constFunction() const\00"
-// CHECK: private constant [26 x i8] c"functionReturingTemplate2\00"
-// CHECK: private constant [64 x i8] c"ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()\00"
+// CHECK: private unnamed_addr constant [26 x i8] c"functionReturingTemplate2\00"
+// CHECK: private unnamed_addr constant [64 x i8] c"ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()\00"
-// CHECK: private constant [26 x i8] c"functionReturingTemplate1\00"
-// CHECK: private constant [57 x i8] c"ClassTemplate<int> NS::Base::functionReturingTemplate1()\00"
+// CHECK: private unnamed_addr constant [26 x i8] c"functionReturingTemplate1\00"
+// CHECK: private unnamed_addr constant [57 x i8] c"ClassTemplate<int> NS::Base::functionReturingTemplate1()\00"
-// CHECK: private constant [23 x i8] c"withTemplateParameter2\00"
-// CHECK: private constant [65 x i8] c"void NS::Base::withTemplateParameter2(ClassTemplate<NS::Base *>)\00"
+// CHECK: private unnamed_addr constant [23 x i8] c"withTemplateParameter2\00"
+// CHECK: private unnamed_addr constant [65 x i8] c"void NS::Base::withTemplateParameter2(ClassTemplate<NS::Base *>)\00"
-// CHECK: private constant [23 x i8] c"withTemplateParameter1\00"
-// CHECK: private constant [58 x i8] c"void NS::Base::withTemplateParameter1(ClassTemplate<int>)\00"
+// CHECK: private unnamed_addr constant [23 x i8] c"withTemplateParameter1\00"
+// CHECK: private unnamed_addr constant [58 x i8] c"void NS::Base::withTemplateParameter1(ClassTemplate<int>)\00"
-// CHECK: private constant [23 x i8] c"functionReturningClass\00"
-// CHECK: private constant [45 x i8] c"NS::Base *NS::Base::functionReturningClass()\00"
+// CHECK: private unnamed_addr constant [23 x i8] c"functionReturningClass\00"
+// CHECK: private unnamed_addr constant [45 x i8] c"NS::Base *NS::Base::functionReturningClass()\00"
-// CHECK: private constant [23 x i8] c"functionWithParameters\00"
-// CHECK: private constant [64 x i8] c"void NS::Base::functionWithParameters(int, float *, NS::Base *)\00"
+// CHECK: private unnamed_addr constant [23 x i8] c"functionWithParameters\00"
+// CHECK: private unnamed_addr constant [64 x i8] c"void NS::Base::functionWithParameters(int, float *, NS::Base *)\00"
-// CHECK: private constant [17 x i8] c"variadicFunction\00"
-// CHECK: private constant [42 x i8] c"void NS::Base::variadicFunction(int, ...)\00"
+// CHECK: private unnamed_addr constant [17 x i8] c"variadicFunction\00"
+// CHECK: private unnamed_addr constant [42 x i8] c"void NS::Base::variadicFunction(int, ...)\00"
-// CHECK: private constant [41 x i8] c"virtual void NS::Base::virtualFunction()\00"
+// CHECK: private unnamed_addr constant [41 x i8] c"virtual void NS::Base::virtualFunction()\00"
-// CHECK: private constant [15 x i8] c"inlineFunction\00"
-// CHECK: private constant [32 x i8] c"void NS::Base::inlineFunction()\00"
+// CHECK: private unnamed_addr constant [15 x i8] c"inlineFunction\00"
+// CHECK: private unnamed_addr constant [32 x i8] c"void NS::Base::inlineFunction()\00"
-// CHECK: private constant [15 x i8] c"staticFunction\00"
-// CHECK: private constant [39 x i8] c"static void NS::Base::staticFunction()\00"
+// CHECK: private unnamed_addr constant [15 x i8] c"staticFunction\00"
+// CHECK: private unnamed_addr constant [39 x i8] c"static void NS::Base::staticFunction()\00"
-// CHECK: private constant [26 x i8] c"topLevelNamespaceFunction\00"
-// CHECK: private constant [59 x i8] c"void ClassInTopLevelNamespace::topLevelNamespaceFunction()\00"
+// CHECK: private unnamed_addr constant [26 x i8] c"topLevelNamespaceFunction\00"
+// CHECK: private unnamed_addr constant [59 x i8] c"void ClassInTopLevelNamespace::topLevelNamespaceFunction()\00"
-// CHECK: private constant [27 x i8] c"anonymousNamespaceFunction\00"
-// CHECK: private constant [84 x i8] c"void <anonymous namespace>::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
+// CHECK: private unnamed_addr constant [27 x i8] c"anonymousNamespaceFunction\00"
+// CHECK: private unnamed_addr constant [84 x i8] c"void <anonymous namespace>::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00"
-// CHECK: private constant [19 x i8] c"localClassFunction\00"
-// CHECK: private constant [59 x i8] c"void NS::localClass(int)::LocalClass::localClassFunction()\00"
+// CHECK: private unnamed_addr constant [19 x i8] c"localClassFunction\00"
+// CHECK: private unnamed_addr constant [59 x i8] c"void NS::localClass(int)::LocalClass::localClassFunction()\00"
int printf(const char * _Format, ...);
diff --git a/test/CodeGenCXX/ptr-to-member-function.cpp b/test/CodeGenCXX/ptr-to-member-function.cpp
index e3912fe9081c..89db142b9b7b 100644
--- a/test/CodeGenCXX/ptr-to-member-function.cpp
+++ b/test/CodeGenCXX/ptr-to-member-function.cpp
@@ -66,5 +66,5 @@ int main()
// CHECK-LP64: callq __ZN1XcvM1BFvvEEv
// CHECK-LP64: callq __Z1gM1CFvvE
-// CHECK-LP32: call L__ZN1XcvM1BFvvEEv
-// CHECK-LP32: call __Z1gM1CFvvE
+// CHECK-LP32: calll L__ZN1XcvM1BFvvEEv
+// CHECK-LP32: calll __Z1gM1CFvvE
diff --git a/test/CodeGenCXX/rtti-fundamental.cpp b/test/CodeGenCXX/rtti-fundamental.cpp
index 7f80d99b70e1..2495e969bff8 100644
--- a/test/CodeGenCXX/rtti-fundamental.cpp
+++ b/test/CodeGenCXX/rtti-fundamental.cpp
@@ -14,60 +14,103 @@ namespace __cxxabiv1 {
__fundamental_type_info::~__fundamental_type_info() { }
}
-// CHECK: @_ZTIv = constant
-// CHECK: @_ZTIPv = constant
-// CHECK: @_ZTIPKv = constant
-// CHECK: @_ZTIDi = constant
-// CHECK: @_ZTIPDi = constant
-// CHECK: @_ZTIPKDi = constant
-// CHECK: @_ZTIDs = constant
-// CHECK: @_ZTIPDs = constant
-// CHECK: @_ZTIPKDs = constant
-// CHECK: @_ZTIy = constant
-// CHECK: @_ZTIPy = constant
-// CHECK: @_ZTIPKy = constant
-// CHECK: @_ZTIx = constant
-// CHECK: @_ZTIPx = constant
-// CHECK: @_ZTIPKx = constant
-// CHECK: @_ZTIw = constant
-// CHECK: @_ZTIPw = constant
-// CHECK: @_ZTIPKw = constant
-// CHECK: @_ZTIt = constant
-// CHECK: @_ZTIPt = constant
-// CHECK: @_ZTIPKt = constant
-// CHECK: @_ZTIs = constant
-// CHECK: @_ZTIPs = constant
-// CHECK: @_ZTIPKs = constant
-// CHECK: @_ZTIm = constant
-// CHECK: @_ZTIPm = constant
-// CHECK: @_ZTIPKm = constant
-// CHECK: @_ZTIl = constant
-// CHECK: @_ZTIPl = constant
-// CHECK: @_ZTIPKl = constant
-// CHECK: @_ZTIj = constant
-// CHECK: @_ZTIPj = constant
-// CHECK: @_ZTIPKj = constant
-// CHECK: @_ZTIi = constant
-// CHECK: @_ZTIPi = constant
-// CHECK: @_ZTIPKi = constant
-// CHECK: @_ZTIh = constant
-// CHECK: @_ZTIPh = constant
-// CHECK: @_ZTIPKh = constant
-// CHECK: @_ZTIf = constant
-// CHECK: @_ZTIPf = constant
-// CHECK: @_ZTIPKf = constant
-// CHECK: @_ZTIe = constant
-// CHECK: @_ZTIPe = constant
-// CHECK: @_ZTIPKe = constant
-// CHECK: @_ZTId = constant
-// CHECK: @_ZTIPd = constant
-// CHECK: @_ZTIPKd = constant
-// CHECK: @_ZTIc = constant
-// CHECK: @_ZTIPc = constant
-// CHECK: @_ZTIPKc = constant
-// CHECK: @_ZTIb = constant
-// CHECK: @_ZTIPb = constant
-// CHECK: @_ZTIPKb = constant
-// CHECK: @_ZTIa = constant
-// CHECK: @_ZTIPa = constant
-// CHECK: @_ZTIPKa = constant
+// void
+// CHECK: @_ZTIv = unnamed_addr constant
+// CHECK: @_ZTIPv = unnamed_addr constant
+// CHECK: @_ZTIPKv = unnamed_addr constant
+
+// std::nullptr_t
+// CHECK: @_ZTIDn = unnamed_addr constant
+// CHECK: @_ZTIPDn = unnamed_addr constant
+// CHECK: @_ZTIPKDn = unnamed_addr constant
+
+// bool
+// CHECK: @_ZTIb = unnamed_addr constant
+// CHECK: @_ZTIPb = unnamed_addr constant
+// CHECK: @_ZTIPKb = unnamed_addr constant
+
+// wchar_t
+// CHECK: @_ZTIw = unnamed_addr constant
+// CHECK: @_ZTIPw = unnamed_addr constant
+// CHECK: @_ZTIPKw = unnamed_addr constant
+
+// char
+// CHECK: @_ZTIc = unnamed_addr constant
+// CHECK: @_ZTIPc = unnamed_addr constant
+// CHECK: @_ZTIPKc = unnamed_addr constant
+
+// unsigned char
+// CHECK: @_ZTIh = unnamed_addr constant
+// CHECK: @_ZTIPh = unnamed_addr constant
+// CHECK: @_ZTIPKh = unnamed_addr constant
+
+// signed char
+// CHECK: @_ZTIa = unnamed_addr constant
+// CHECK: @_ZTIPa = unnamed_addr constant
+// CHECK: @_ZTIPKa = unnamed_addr constant
+
+// short
+// CHECK: @_ZTIs = unnamed_addr constant
+// CHECK: @_ZTIPs = unnamed_addr constant
+// CHECK: @_ZTIPKs = unnamed_addr constant
+
+// unsigned short
+// CHECK: @_ZTIt = unnamed_addr constant
+// CHECK: @_ZTIPt = unnamed_addr constant
+// CHECK: @_ZTIPKt = unnamed_addr constant
+
+// int
+// CHECK: @_ZTIi = unnamed_addr constant
+// CHECK: @_ZTIPi = unnamed_addr constant
+// CHECK: @_ZTIPKi = unnamed_addr constant
+
+// unsigned int
+// CHECK: @_ZTIj = unnamed_addr constant
+// CHECK: @_ZTIPj = unnamed_addr constant
+// CHECK: @_ZTIPKj = unnamed_addr constant
+
+// long
+// CHECK: @_ZTIl = unnamed_addr constant
+// CHECK: @_ZTIPl = unnamed_addr constant
+// CHECK: @_ZTIPKl = unnamed_addr constant
+
+// unsigned long
+// CHECK: @_ZTIm = unnamed_addr constant
+// CHECK: @_ZTIPm = unnamed_addr constant
+// CHECK: @_ZTIPKm = unnamed_addr constant
+
+// long long
+// CHECK: @_ZTIx = unnamed_addr constant
+// CHECK: @_ZTIPx = unnamed_addr constant
+// CHECK: @_ZTIPKx = unnamed_addr constant
+
+// unsigned long long
+// CHECK: @_ZTIy = unnamed_addr constant
+// CHECK: @_ZTIPy = unnamed_addr constant
+// CHECK: @_ZTIPKy = unnamed_addr constant
+
+// float
+// CHECK: @_ZTIf = unnamed_addr constant
+// CHECK: @_ZTIPf = unnamed_addr constant
+// CHECK: @_ZTIPKf = unnamed_addr constant
+
+// double
+// CHECK: @_ZTId = unnamed_addr constant
+// CHECK: @_ZTIPd = unnamed_addr constant
+// CHECK: @_ZTIPKd = unnamed_addr constant
+
+// long double
+// CHECK: @_ZTIe = unnamed_addr constant
+// CHECK: @_ZTIPe = unnamed_addr constant
+// CHECK: @_ZTIPKe = unnamed_addr constant
+
+// char16_t
+// CHECK: @_ZTIDs = unnamed_addr constant
+// CHECK: @_ZTIPDs = unnamed_addr constant
+// CHECK: @_ZTIPKDs = unnamed_addr constant
+
+// char32_t
+// CHECK: @_ZTIDi = unnamed_addr constant
+// CHECK: @_ZTIPDi = unnamed_addr constant
+// CHECK: @_ZTIPKDi = unnamed_addr constant
+
diff --git a/test/CodeGenCXX/rtti-linkage.cpp b/test/CodeGenCXX/rtti-linkage.cpp
index efa336dda4ec..42fe43523404 100644
--- a/test/CodeGenCXX/rtti-linkage.cpp
+++ b/test/CodeGenCXX/rtti-linkage.cpp
@@ -1,60 +1,60 @@
-// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o - | sort | FileCheck %s
-
-// FIXME: Fails on Win32, dunno why.
-// XFAIL: win32
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fvisibility hidden -fhidden-weak-vtables -emit-llvm -o - | FileCheck -check-prefix=CHECK-WITH-HIDDEN %s
#include <typeinfo>
+// CHECK-WITH-HIDDEN: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK-WITH-HIDDEN: @_ZTSPK2T4 = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTS2T4 = linkonce_odr hidden constant
+// CHECK-WITH-HIDDEN: @_ZTI2T4 = linkonce_odr hidden unnamed_addr constant
+// CHECK-WITH-HIDDEN: @_ZTIPK2T4 = linkonce_odr hidden unnamed_addr constant
-
-// CHECK: _ZTIN12_GLOBAL__N_11DE to
-
-
-
-// CHECK: _ZTI1A = weak_odr hidden constant
-// CHECK: _ZTI1B = constant
-// CHECK: _ZTI1C = internal constant
-// CHECK: _ZTI1TILj0EE = weak_odr constant
-// CHECK: _ZTI1TILj1EE = weak_odr constant
-// CHECK: _ZTI1TILj2EE = external constant
-// CHECK: _ZTIA10_i = weak_odr hidden constant
-// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
-// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
-// CHECK: _ZTIFvvE = weak_odr hidden constant
-// CHECK: _ZTIM1A1C = internal constant
-// CHECK: _ZTIM1AP1C = internal constant
-// CHECK: _ZTIM1CPS_ = internal constant
-// CHECK: _ZTIM1CS_ = internal constant
-// CHECK: _ZTIM1Ci = internal constant
-// CHECK: _ZTIN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTIN12_GLOBAL__N_11EE = internal constant
-// CHECK: _ZTIP1C = internal constant
-// CHECK: _ZTIPFvvE = weak_odr hidden constant
-// CHECK: _ZTIPM1Ci = internal constant
-// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTIPP1C = internal constant
-// CHECK: _ZTS1A = weak_odr constant
-// CHECK: _ZTS1B = constant
+// CHECK: _ZTSP1C = internal constant
// CHECK: _ZTS1C = internal constant
-// CHECK: _ZTS1F = weak_odr constant
-// CHECK: _ZTSA10_i = weak_odr constant
-// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
-// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
-// CHECK: _ZTSFvvE = weak_odr constant
+// CHECK: _ZTI1C = internal unnamed_addr constant
+// CHECK: _ZTIP1C = internal unnamed_addr constant
+// CHECK: _ZTSPP1C = internal constant
+// CHECK: _ZTIPP1C = internal unnamed_addr constant
+// CHECK: _ZTSM1Ci = internal constant
+// CHECK: _ZTIM1Ci = internal unnamed_addr constant
+// CHECK: _ZTSPM1Ci = internal constant
+// CHECK: _ZTIPM1Ci = internal unnamed_addr constant
+// CHECK: _ZTSM1CS_ = internal constant
+// CHECK: _ZTIM1CS_ = internal unnamed_addr constant
+// CHECK: _ZTSM1CPS_ = internal constant
+// CHECK: _ZTIM1CPS_ = internal unnamed_addr constant
// CHECK: _ZTSM1A1C = internal constant
+// CHECK: _ZTS1A = linkonce_odr constant
+// CHECK: _ZTI1A = linkonce_odr hidden unnamed_addr constant
+// CHECK: _ZTIM1A1C = internal unnamed_addr constant
// CHECK: _ZTSM1AP1C = internal constant
-// CHECK: _ZTSM1CPS_ = internal constant
-// CHECK: _ZTSM1CS_ = internal constant
-// CHECK: _ZTSM1Ci = internal constant
+// CHECK: _ZTIM1AP1C = internal unnamed_addr constant
// CHECK: _ZTSN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
-// CHECK: _ZTSP1C = internal constant
-// CHECK: _ZTSPFvvE = weak_odr constant
-// CHECK: _ZTSPM1Ci = internal constant
+// CHECK: _ZTIN12_GLOBAL__N_11DE = internal unnamed_addr constant
// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
-// CHECK: _ZTSPP1C = internal constant
+// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal unnamed_addr constant
+// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal unnamed_addr constant
+// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
+// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal unnamed_addr constant
+// CHECK: _ZTSPFvvE = linkonce_odr constant
+// CHECK: _ZTSFvvE = linkonce_odr constant
+// CHECK: _ZTIFvvE = linkonce_odr hidden unnamed_addr constant
+// CHECK: _ZTIPFvvE = linkonce_odr hidden unnamed_addr constant
+// CHECK: _ZTSN12_GLOBAL__N_11EE = internal constant
+// CHECK: _ZTIN12_GLOBAL__N_11EE = internal unnamed_addr constant
+// CHECK: _ZTSA10_i = linkonce_odr constant
+// CHECK: _ZTIA10_i = linkonce_odr hidden unnamed_addr constant
+// CHECK: _ZTI1TILj0EE = linkonce_odr unnamed_addr constant
+// CHECK: _ZTI1TILj1EE = weak_odr unnamed_addr constant
+// CHECK: _ZTI1TILj2EE = external constant
+// CHECK: _ZTS1B = constant
+// CHECK: _ZTI1B = unnamed_addr constant
+// CHECK: _ZTS1F = linkonce_odr constant
-// A has no key function, so its RTTI data should be weak_odr.
+// CHECK: _ZTIN12_GLOBAL__N_11DE to
+
+// A has no key function, so its RTTI data should be linkonce_odr.
struct A { };
// B has a key function defined in the translation unit, so the RTTI data should
@@ -90,7 +90,7 @@ namespace {
};
// F has a key function defined in the translation unit, but it is inline so the RTTI
-// data should be emitted with weak_odr linkage.
+// data should be emitted with linkonce_odr linkage.
struct F {
virtual void f();
};
@@ -132,3 +132,9 @@ void t3() {
(void) typeid(T<1>);
(void) typeid(T<2>);
}
+
+// rdar://problem/8778973
+struct T4 {};
+void t4(const T4 *ptr) {
+ const void *value = &typeid(ptr);
+}
diff --git a/test/CodeGenCXX/rtti-visibility.cpp b/test/CodeGenCXX/rtti-visibility.cpp
new file mode 100644
index 000000000000..40cee061942a
--- /dev/null
+++ b/test/CodeGenCXX/rtti-visibility.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -o %t
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fhidden-weak-vtables -emit-llvm -o %t.hidden
+// RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-TEST2 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-TEST2-HIDDEN %s < %t.hidden
+
+#include <typeinfo>
+
+namespace Test1 {
+ // A is explicitly marked hidden, so all RTTI data should also be marked hidden.
+ // CHECK-TEST1: @_ZTSN5Test11AE = linkonce_odr hidden constant
+ // CHECK-TEST1: @_ZTIN5Test11AE = linkonce_odr hidden unnamed_addr constant
+ // CHECK-TEST1: @_ZTSPN5Test11AE = linkonce_odr hidden constant
+ // CHECK-TEST1: @_ZTIPN5Test11AE = linkonce_odr hidden unnamed_addr constant
+ struct __attribute__((visibility("hidden"))) A { };
+
+ void f() {
+ (void)typeid(A);
+ (void)typeid(A *);
+ }
+}
+
+namespace Test2 {
+ // A is weak, so its linkage should be linkoce_odr, but not marked hidden.
+ // CHECK-TEST2: @_ZTSN5Test21AE = linkonce_odr constant
+ // CHECK-TEST2: @_ZTIN5Test21AE = linkonce_odr unnamed_addr constant
+ struct A { };
+
+ // With -fhidden-weak-vtables, the typeinfo for A is marked hidden, but not its name.
+ // CHECK-TEST2-HIDDEN: _ZTSN5Test21AE = linkonce_odr constant
+ // CHECK-TEST2-HIDDEN: @_ZTIN5Test21AE = linkonce_odr hidden unnamed_addr constant
+ void f() {
+ (void)typeid(A);
+ }
+}
diff --git a/test/CodeGenCXX/rvalue-references.cpp b/test/CodeGenCXX/rvalue-references.cpp
new file mode 100644
index 000000000000..e15172355ebd
--- /dev/null
+++ b/test/CodeGenCXX/rvalue-references.cpp
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+
+struct Spacer { int x; };
+struct A { double array[2]; };
+struct B : Spacer, A { };
+
+B &getB();
+
+// CHECK: define %struct.A* @_Z4getAv()
+// CHECK: call %struct.B* @_Z4getBv()
+// CHECK-NEXT: bitcast %struct.B*
+// CHECK-NEXT: getelementptr i8*
+// CHECK-NEXT: bitcast i8* {{.*}} to %struct.A*
+// CHECK-NEXT: ret %struct.A*
+A &&getA() { return static_cast<A&&>(getB()); }
+
+int &getIntLValue();
+int &&getIntXValue();
+int getIntPRValue();
+
+// CHECK: define i32* @_Z2f0v()
+// CHECK: call i32* @_Z12getIntLValuev()
+// CHECK-NEXT: ret i32*
+int &&f0() { return static_cast<int&&>(getIntLValue()); }
+
+// CHECK: define i32* @_Z2f1v()
+// CHECK: call i32* @_Z12getIntXValuev()
+// CHECK-NEXT: ret i32*
+int &&f1() { return static_cast<int&&>(getIntXValue()); }
+
+// CHECK: define i32* @_Z2f2v
+// CHECK: call i32 @_Z13getIntPRValuev()
+// CHECK-NEXT: store i32 {{.*}}, i32*
+// CHECK-NEXT: ret i32*
+int &&f2() { return static_cast<int&&>(getIntPRValue()); }
+
+bool ok;
+
+class C
+{
+ int* state_;
+
+ C(const C&) = delete;
+ C& operator=(const C&) = delete;
+public:
+ C(int state) : state_(new int(state)) { }
+
+ C(C&& a) {
+ state_ = a.state_;
+ a.state_ = 0;
+ }
+
+ ~C() {
+ delete state_;
+ state_ = 0;
+ }
+};
+
+C test();
+
+// CHECK: define void @_Z15elide_copy_initv
+void elide_copy_init() {
+ ok = false;
+ // CHECK: call void @_Z4testv
+ C a = test();
+ // CHECK-NEXT: call void @_ZN1CD1Ev
+ // CHECK-NEXT: ret void
+}
+
+// CHECK: define void @_Z16test_move_returnv
+C test_move_return() {
+ // CHECK: call void @_ZN1CC1Ei
+ C a1(3);
+ // CHECK: call void @_ZN1CC1Ei
+ C a2(4);
+ if (ok)
+ // CHECK: call void @_ZN1CC1EOS_
+ return a1;
+ // CHECK: call void @_ZN1CC1EOS_
+ return a2;
+ // CHECK: call void @_ZN1CD1Ev
+ // CHECK: call void @_ZN1CD1Ev
+ //CHECK: ret void
+}
diff --git a/test/CodeGenCXX/specialized-static-data-mem-init.cpp b/test/CodeGenCXX/specialized-static-data-mem-init.cpp
new file mode 100644
index 000000000000..8f5765bcbbe9
--- /dev/null
+++ b/test/CodeGenCXX/specialized-static-data-mem-init.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// rdar: // 8562966
+// pr8409
+
+// CHECK: @_ZN1CIiE11needs_guardE = weak global
+// CHECK: @_ZGVN1CIiE11needs_guardE = weak global
+
+struct K
+{
+ K();
+ K(const K &);
+ ~K();
+ void PrintNumK();
+};
+
+template<typename T>
+struct C
+{
+ void Go() { needs_guard.PrintNumK(); }
+ static K needs_guard;
+};
+
+template<typename T> K C<T>::needs_guard;
+
+void F()
+{
+ C<int>().Go();
+}
+
diff --git a/test/CodeGenCXX/static-data-member.cpp b/test/CodeGenCXX/static-data-member.cpp
index b3a2af2aafe3..64fca2eb6837 100644
--- a/test/CodeGenCXX/static-data-member.cpp
+++ b/test/CodeGenCXX/static-data-member.cpp
@@ -1,18 +1,66 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
-// CHECK: @_ZN1A1aE = constant i32 10
+// 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
// PR5564.
-struct A {
- static const int a = 10;
-};
+namespace test1 {
+ struct A {
+ static const int a = 10;
+ };
-const int A::a;
+ const int A::a;
-struct S {
- static int i;
-};
+ struct S {
+ static int i;
+ };
-void f() {
- int a = S::i;
+ void f() {
+ int a = S::i;
+ }
+}
+
+// Test that we don't use guards for initializing template static data
+// members with internal linkage.
+namespace test2 {
+ int foo();
+
+ namespace {
+ template <class T> struct A {
+ static int x;
+ };
+
+ template <class T> int A<T>::x = foo();
+ template struct A<int>;
+ }
+
+ // CHECK: define internal void @__cxx_global_var_init()
+ // CHECK: [[TMP:%.*]] = call i32 @_ZN5test23fooEv()
+ // CHECK-NEXT: store i32 [[TMP]], i32* @_ZN5test212_GLOBAL__N_11AIiE1xE, align 4
+ // CHECK-NEXT: ret void
+}
+
+// Test that we don't use threadsafe statics when initializing
+// template static data members.
+namespace test3 {
+ int foo();
+
+ template <class T> struct A {
+ static int x;
+ };
+
+ template <class T> int A<T>::x = foo();
+ template struct A<int>;
+
+ // CHECK: define internal void @__cxx_global_var_init1()
+ // CHECK: [[GUARDBYTE:%.*]] = load i8* bitcast (i64* @_ZGVN5test31AIiE1xE to i8*)
+ // CHECK-NEXT: [[UNINITIALIZED:%.*]] = icmp eq i8 [[GUARDBYTE]], 0
+ // CHECK-NEXT: br i1 [[UNINITIALIZED]]
+ // CHECK: [[TMP:%.*]] = call i32 @_ZN5test33fooEv()
+ // CHECK-NEXT: store i32 [[TMP]], i32* @_ZN5test31AIiE1xE, align 4
+ // CHECK-NEXT: store i64 1, i64* @_ZGVN5test31AIiE1xE
+ // CHECK-NEXT: br label
+ // CHECK: ret void
}
diff --git a/test/CodeGenCXX/static-init.cpp b/test/CodeGenCXX/static-init.cpp
index 09b398a530a1..dd9ed61434e2 100644
--- a/test/CodeGenCXX/static-init.cpp
+++ b/test/CodeGenCXX/static-init.cpp
@@ -14,8 +14,8 @@ struct A {
void f() {
// CHECK: call i32 @__cxa_guard_acquire
// CHECK: call void @_ZN1AC1Ev
- // CHECK: call void @__cxa_guard_release
// CHECK: call i32 @__cxa_atexit(void (i8*)* bitcast (void (%struct.A*)* @_ZN1AD1Ev to void (i8*)*), i8* getelementptr inbounds (%struct.A* @_ZZ1fvE1a, i32 0, i32 0), i8* bitcast (i8** @__dso_handle to i8*))
+ // CHECK: call void @__cxa_guard_release
static A a;
}
diff --git a/test/CodeGenCXX/stmtexpr.cpp b/test/CodeGenCXX/stmtexpr.cpp
new file mode 100644
index 000000000000..0828d592fec1
--- /dev/null
+++ b/test/CodeGenCXX/stmtexpr.cpp
@@ -0,0 +1,75 @@
+// RUN: %clang_cc1 -Wno-unused-value -emit-llvm -o - %s | FileCheck %s
+// rdar: //8540501
+extern "C" int printf(...);
+extern "C" void abort();
+
+struct A
+{
+ int i;
+ A (int j) : i(j) {printf("this = %p A(%d)\n", this, j);}
+ A (const A &j) : i(j.i) {printf("this = %p const A&(%d)\n", this, i);}
+ A& operator= (const A &j) { i = j.i; abort(); return *this; }
+ ~A() { printf("this = %p ~A(%d)\n", this, i); }
+};
+
+struct B
+{
+ int i;
+ B (const A& a) { i = a.i; }
+ B() {printf("this = %p B()\n", this);}
+ B (const B &j) : i(j.i) {printf("this = %p const B&(%d)\n", this, i);}
+ ~B() { printf("this = %p ~B(%d)\n", this, i); }
+};
+
+A foo(int j)
+{
+ return ({ j ? A(1) : A(0); });
+}
+
+
+void foo2()
+{
+ A b = ({ A a(1); A a1(2); A a2(3); a1; a2; a; });
+ if (b.i != 1)
+ abort();
+ A c = ({ A a(1); A a1(2); A a2(3); a1; a2; a; A a3(4); a2; a3; });
+ if (c.i != 4)
+ abort();
+}
+
+void foo3()
+{
+ const A &b = ({ A a(1); a; });
+ if (b.i != 1)
+ abort();
+}
+
+void foo4()
+{
+// CHECK: call void @_ZN1AC1Ei
+// CHECK: call void @_ZN1AC1ERKS_
+// CHECK: call void @_ZN1AD1Ev
+// CHECK: call void @_ZN1BC1ERK1A
+// CHECK: call void @_ZN1AD1Ev
+ const B &b = ({ A a(1); a; });
+ if (b.i != 1)
+ abort();
+}
+
+int main()
+{
+ foo2();
+ foo3();
+ foo4();
+ return foo(1).i-1;
+}
+
+// rdar: // 8600553
+int a[128];
+int* foo5() {
+// CHECK-NOT: memcpy
+ // Check that array-to-pointer conversion occurs in a
+ // statement-expression.
+ return (({ a; }));
+}
+
diff --git a/test/CodeGenCXX/template-anonymous-types.cpp b/test/CodeGenCXX/template-anonymous-types.cpp
index 5e7a71fd8772..68bdc0c4a47d 100644
--- a/test/CodeGenCXX/template-anonymous-types.cpp
+++ b/test/CodeGenCXX/template-anonymous-types.cpp
@@ -29,9 +29,9 @@ void test() {
//
// BAR's instantiation of X:
// CHECK: define internal i32 @"_ZN1XIN1S3$_1EE1fEv"(%struct.X* %this)
- // CHECK: define internal void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X* %this, i32 %t)
+ // CHECK: define internal void @"_ZN1XIN1S3$_1EEC2ES1_"(%struct.X* %this, i32 %t) unnamed_addr
//
// FOO's instantiation of X:
// CHECK: define internal i32 @"_ZN1XIN1S3$_0EE1fEv"(%struct.X* %this)
- // CHECK: define internal void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X* %this, i32 %t)
+ // CHECK: define internal void @"_ZN1XIN1S3$_0EEC2ES1_"(%struct.X* %this, i32 %t) unnamed_addr
}
diff --git a/test/CodeGenCXX/template-dependent-bind-temporary.cpp b/test/CodeGenCXX/template-dependent-bind-temporary.cpp
new file mode 100644
index 000000000000..cc1ce866fe2d
--- /dev/null
+++ b/test/CodeGenCXX/template-dependent-bind-temporary.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// rdar: //8620524
+// PR7851
+struct string {
+ string (const string& );
+ string ();
+ ~string();
+};
+
+string operator + (char ch, const string&);
+
+template <class T>
+void IntToString(T a)
+{
+ string result;
+ T digit;
+ char((digit < 10 ? '0' : 'a') + digit) + result;
+}
+
+int main() {
+// CHECK: define linkonce_odr void @_Z11IntToStringIcEvT_(
+ IntToString('a');
+}
+
diff --git a/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp b/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
new file mode 100644
index 000000000000..ca4446cd200e
--- /dev/null
+++ b/test/CodeGenCXX/template-inner-struct-visibility-hidden.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fvisibility hidden -emit-llvm -o - %s | FileCheck %s
+
+// Verify that symbols are hidden.
+// CHECK: @_ZN1CIiE5Inner6Inner26StaticE = weak hidden global
+// CHECK: define weak_odr hidden void @_ZN1CIiE5Inner1fEv
+// CHECK: define weak_odr hidden void @_ZN1CIiE5Inner6Inner21gEv
+
+template<typename T>
+struct C {
+ struct Inner {
+ void f();
+ struct Inner2 {
+ void g();
+ static int Static;
+ };
+ };
+};
+
+template<typename T> void C<T>::Inner::f() { }
+template<typename T> void C<T>::Inner::Inner2::g() { }
+template<typename T> int C<T>::Inner::Inner2::Static;
+
+extern template struct C<int>;
+template struct C<int>;
diff --git a/test/CodeGenCXX/template-instantiation.cpp b/test/CodeGenCXX/template-instantiation.cpp
index cb6c81231641..635e1d2099b8 100644
--- a/test/CodeGenCXX/template-instantiation.cpp
+++ b/test/CodeGenCXX/template-instantiation.cpp
@@ -2,9 +2,12 @@
// CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant
// CHECK-NOT: _ZTVN5test315basic_fstreamXXIcEE
-// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = constant
+// CHECK: @_ZTVN5test018stdio_sync_filebufIwEE = unnamed_addr constant
-// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev(
+// CHECK-NOT: _ZTVN5test31SIiEE
+// CHECK-NOT: _ZTSN5test31SIiEE
+
+// CHECK: define linkonce_odr void @_ZN5test21CIiEC1Ev(%"class.test2::C"* nocapture %this) unnamed_addr
// CHECK: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_(
// CHECK: define available_externally void @_ZN5test21CIiE6zedbarEd(
@@ -75,3 +78,47 @@ namespace test3 {
// (test at the top).
template void basic_fstreamXX<char>::is_open() const;
}
+
+namespace test3 {
+ template <typename T>
+ struct S {
+ virtual void m();
+ };
+
+ template<typename T>
+ void S<T>::m() { }
+
+ // Should not cause us to produce vtable because template instantiations
+ // don't have key functions.
+ template void S<int>::m();
+}
+
+namespace test4 {
+ template <class T> struct A { static void foo(); };
+
+ class B {
+ template <class T> friend void A<T>::foo();
+ B();
+ };
+
+ template <class T> void A<T>::foo() {
+ B b;
+ }
+
+ unsigned test() {
+ A<int>::foo();
+ }
+}
+
+namespace PR8505 {
+// Hits an assertion due to bogus instantiation of class B.
+template <int i> class A {
+ class B* g;
+};
+class B {
+ void f () {}
+};
+// Should not instantiate class B since it is introduced in namespace scope.
+// CHECK-NOT: _ZN6PR85051AILi0EE1B1fEv
+template class A<0>;
+}
diff --git a/test/CodeGenCXX/template-linkage.cpp b/test/CodeGenCXX/template-linkage.cpp
index 63a5c09cd7d8..20508c1596fe 100644
--- a/test/CodeGenCXX/template-linkage.cpp
+++ b/test/CodeGenCXX/template-linkage.cpp
@@ -37,7 +37,7 @@ template<typename T> void X1<T>::blarg() { }
extern template struct X0<char>;
extern template struct X1<char>;
-// CHECK: define linkonce_odr void @_ZN2X1IcED1Ev(
+// CHECK: define linkonce_odr void @_ZN2X1IcED1Ev(%struct.X1* %this) unnamed_addr
void test_X1() {
X1<char> i1c;
}
diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp
index 9a397abfc0cf..348d51e019a6 100644
--- a/test/CodeGenCXX/temporaries.cpp
+++ b/test/CodeGenCXX/temporaries.cpp
@@ -338,3 +338,188 @@ namespace PR7556 {
// CHECK-NEXT: ret void
}
}
+
+namespace Elision {
+ struct A {
+ A(); A(const A &); ~A();
+ void *p;
+ void foo() const;
+ };
+
+ void foo();
+ A fooA();
+ void takeA(A a);
+
+ // CHECK: define void @_ZN7Elision5test0Ev()
+ void test0() {
+ // CHECK: [[I:%.*]] = alloca [[A:%.*]], align 8
+ // CHECK-NEXT: [[J:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[T0:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[K:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[T1:%.*]] = alloca [[A]], align 8
+
+ // CHECK-NEXT: call void @_ZN7Elision3fooEv()
+ // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[I]])
+ A i = (foo(), A());
+
+ // CHECK-NEXT: call void @_ZN7Elision4fooAEv([[A]]* sret [[T0]])
+ // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[J]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[T0]])
+ A j = (fooA(), A());
+
+ // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[T1]])
+ // CHECK-NEXT: call void @_ZN7Elision4fooAEv([[A]]* sret [[K]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[T1]])
+ A k = (A(), fooA());
+
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[K]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[J]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[I]])
+ }
+
+
+ // CHECK: define void @_ZN7Elision5test1EbNS_1AE(
+ void test1(bool c, A x) {
+ // CHECK: [[I:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[J:%.*]] = alloca [[A]], align 8
+
+ // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[I]])
+ // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[I]], [[A]]* [[X:%.*]])
+ A i = (c ? A() : x);
+
+ // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[J]], [[A]]* [[X]])
+ // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[J]])
+ A j = (c ? x : A());
+
+ // CHECK: call void @_ZN7Elision1AD1Ev([[A]]* [[J]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[I]])
+ }
+
+ // CHECK: define void @_ZN7Elision5test2Ev([[A]]* sret
+ A test2() {
+ // CHECK: call void @_ZN7Elision3fooEv()
+ // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[RET:%.*]])
+ // CHECK-NEXT: ret void
+ return (foo(), A());
+ }
+
+ // CHECK: define void @_ZN7Elision5test3EiNS_1AE([[A]]* sret
+ A test3(int v, A x) {
+ if (v < 5)
+ // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[RET:%.*]])
+ // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[RET]], [[A]]* [[X:%.*]])
+ return (v < 0 ? A() : x);
+ else
+ // CHECK: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[RET]], [[A]]* [[X]])
+ // CHECK: call void @_ZN7Elision1AC1Ev([[A]]* [[RET]])
+ return (v > 10 ? x : A());
+
+ // CHECK: ret void
+ }
+
+ // CHECK: define void @_ZN7Elision5test4Ev()
+ void test4() {
+ // CHECK: [[X:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[XS:%.*]] = alloca [2 x [[A]]], align 16
+ // CHECK-NEXT: [[I:%.*]] = alloca i64
+
+ // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[X]])
+ A x;
+
+ // CHECK-NEXT: [[XS0:%.*]] = getelementptr inbounds [2 x [[A]]]* [[XS]], i32 0, i32 0
+ // CHECK-NEXT: call void @_ZN7Elision1AC1Ev([[A]]* [[XS0]])
+ // CHECK-NEXT: [[XS1:%.*]] = getelementptr inbounds [2 x [[A]]]* [[XS]], i32 0, i32 1
+ // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[XS1]], [[A]]* [[X]])
+ // CHECK-NEXT: [[XSB:%.*]] = bitcast [2 x [[A]]]* [[XS]] to [[A]]*
+ A xs[] = { A(), x };
+
+ // CHECK-NEXT: store i64 2, i64* [[I]]
+ // CHECK-NEXT: br label
+ // CHECK: [[I0:%.*]] = load i64* [[I]]
+ // CHECK-NEXT: icmp ne i64 [[I0]], 0
+ // CHECK-NEXT: br i1
+ // CHECK: [[I1:%.*]] = load i64* [[I]]
+ // CHECK-NEXT: [[I2:%.*]] = sub i64 [[I1]], 1
+ // CHECK-NEXT: [[XSI:%.*]] = getelementptr inbounds [[A]]* [[XSB]], i64 [[I2]]
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[XSI]])
+ // CHECK-NEXT: br label
+
+ // CHECK: call void @_ZN7Elision1AD1Ev([[A]]* [[X]])
+ }
+
+ // rdar://problem/8433352
+ // CHECK: define void @_ZN7Elision5test5Ev([[A]]* sret
+ struct B { A a; B(); };
+ A test5() {
+ // CHECK: [[AT0:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[BT0:%.*]] = alloca [[B:%.*]], align 8
+ // CHECK-NEXT: [[X:%.*]] = alloca [[A]], align 8
+ // CHECK-NEXT: [[BT1:%.*]] = alloca [[B]], align 8
+ // CHECK-NEXT: [[BT2:%.*]] = alloca [[B]], align 8
+
+ // CHECK: call void @_ZN7Elision1BC1Ev([[B]]* [[BT0]])
+ // CHECK-NEXT: [[AM:%.*]] = getelementptr inbounds [[B]]* [[BT0]], i32 0, i32 0
+ // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[AT0]], [[A]]* [[AM]])
+ // CHECK-NEXT: call void @_ZN7Elision5takeAENS_1AE([[A]]* [[AT0]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[AT0]])
+ // CHECK-NEXT: call void @_ZN7Elision1BD1Ev([[B]]* [[BT0]])
+ takeA(B().a);
+
+ // CHECK-NEXT: call void @_ZN7Elision1BC1Ev([[B]]* [[BT1]])
+ // CHECK-NEXT: [[AM:%.*]] = getelementptr inbounds [[B]]* [[BT1]], i32 0, i32 0
+ // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[X]], [[A]]* [[AM]])
+ // CHECK-NEXT: call void @_ZN7Elision1BD1Ev([[B]]* [[BT1]])
+ A x = B().a;
+
+ // CHECK-NEXT: call void @_ZN7Elision1BC1Ev([[B]]* [[BT2]])
+ // CHECK-NEXT: [[AM:%.*]] = getelementptr inbounds [[B]]* [[BT2]], i32 0, i32 0
+ // CHECK-NEXT: call void @_ZN7Elision1AC1ERKS0_([[A]]* [[RET:%.*]], [[A]]* [[AM]])
+ // CHECK-NEXT: call void @_ZN7Elision1BD1Ev([[B]]* [[BT2]])
+ return B().a;
+
+ // CHECK: call void @_ZN7Elision1AD1Ev([[A]]* [[X]])
+ }
+
+ // Reduced from webkit.
+ // CHECK: define void @_ZN7Elision5test6EPKNS_1CE([[C:%.*]]*
+ struct C { operator A() const; };
+ void test6(const C *x) {
+ // CHECK: [[T0:%.*]] = alloca [[A]], align 8
+ // CHECK: [[X:%.*]] = load [[C]]** {{%.*}}, align 8
+ // CHECK-NEXT: call void @_ZNK7Elision1CcvNS_1AEEv([[A]]* sret [[T0]], [[C]]* [[X]])
+ // CHECK-NEXT: call void @_ZNK7Elision1A3fooEv([[A]]* [[T0]])
+ // CHECK-NEXT: call void @_ZN7Elision1AD1Ev([[A]]* [[T0]])
+ // CHECK-NEXT: ret void
+ A(*x).foo();
+ }
+}
+
+namespace PR8623 {
+ struct A { A(int); ~A(); };
+
+ // CHECK: define void @_ZN6PR86233fooEb(
+ void foo(bool b) {
+ // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1
+ // CHECK-NEXT: [[LCONS:%.*]] = alloca i1
+ // CHECK-NEXT: [[RCONS:%.*]] = alloca i1
+ // CHECK: store i1 false, i1* [[LCONS]]
+ // CHECK-NEXT: store i1 false, i1* [[RCONS]]
+ // CHECK-NEXT: br i1
+ // CHECK: call void @_ZN6PR86231AC1Ei([[A]]* [[TMP]], i32 2)
+ // CHECK-NEXT: store i1 true, i1* [[LCONS]]
+ // CHECK-NEXT: br label
+ // CHECK: call void @_ZN6PR86231AC1Ei([[A]]* [[TMP]], i32 3)
+ // CHECK-NEXT: store i1 true, i1* [[RCONS]]
+ // CHECK-NEXT: br label
+ // CHECK: load i1* [[RCONS]]
+ // CHECK-NEXT: br i1
+ // CHECK: call void @_ZN6PR86231AD1Ev([[A]]* [[TMP]])
+ // CHECK-NEXT: br label
+ // CHECK: load i1* [[LCONS]]
+ // CHECK-NEXT: br i1
+ // CHECK: call void @_ZN6PR86231AD1Ev([[A]]* [[TMP]])
+ // CHECK-NEXT: br label
+ // CHECK: ret void
+ b ? A(2) : A(3);
+ }
+}
diff --git a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
index c91590fd58b8..87be57295cbd 100644
--- a/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
+++ b/test/CodeGenCXX/threadsafe-statics-exceptions.cpp
@@ -11,8 +11,8 @@ struct Y { };
void f() {
// CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZ1fvE1x)
// CHECK: invoke void @_ZN1XC1Ev
- // CHECK: call void @__cxa_guard_release(i64* @_ZGVZ1fvE1x)
- // CHECK-NEXT: call i32 @__cxa_atexit
+ // CHECK: call i32 @__cxa_atexit
+ // CHECK-NEXT: call void @__cxa_guard_release(i64* @_ZGVZ1fvE1x)
// CHECK: br
static X x;
diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp
index 1670e4450237..1d22ec05c37f 100644
--- a/test/CodeGenCXX/throw-expressions.cpp
+++ b/test/CodeGenCXX/throw-expressions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -verify %s -Wno-unreachable-code
+// RUN: %clang_cc1 -fexceptions -emit-llvm-only -verify %s -Wno-unreachable-code
int val = 42;
int& test1() {
@@ -8,3 +8,8 @@ int& test1() {
int test2() {
return val ? throw val : val;
}
+
+// rdar://problem/8608801
+void test3() {
+ throw false;
+}
diff --git a/test/CodeGenCXX/thunks-available-externally.cpp b/test/CodeGenCXX/thunks-available-externally.cpp
new file mode 100644
index 000000000000..dfdb786b18ee
--- /dev/null
+++ b/test/CodeGenCXX/thunks-available-externally.cpp
@@ -0,0 +1,88 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s
+
+// Check that we don't assert on this case.
+namespace Test1 {
+
+struct Incomplete;
+
+struct A {
+ virtual void f();
+ virtual void g(Incomplete);
+ virtual void h();
+ virtual void i();
+ int a;
+};
+
+struct B {
+ virtual void f();
+ virtual void g(Incomplete);
+ virtual void h();
+ virtual void i();
+ int b;
+};
+
+struct C : A, B {
+ C();
+
+ virtual void f();
+ virtual void g(Incomplete);
+ virtual void h();
+ virtual void i();
+};
+
+void C::h() { }
+
+C::C() { }
+
+void C::i() { }
+
+}
+
+namespace Test2 {
+
+struct A {
+ virtual void f();
+ int a;
+};
+
+struct B {
+ virtual void f();
+ int b;
+};
+
+struct C : A, B {
+ virtual void f();
+};
+
+static void f(B* b) {
+ b->f();
+}
+
+// CHECK: define void @_ZN5Test21fEv()
+// CHECK: call void @_ZN5Test21C1fEv
+// CHECK: ret void
+// CHECK: define available_externally void @_ZThn16_N5Test21C1fEv
+void f() {
+ C c;
+ f(&c);
+}
+
+}
+
+// Test that we don't assert.
+namespace Test3 {
+
+struct A {
+ virtual ~A();
+
+ int a;
+};
+
+struct B : A { };
+struct C : virtual B { };
+
+void f() {
+ C c;
+}
+
+}
diff --git a/test/CodeGenCXX/thunks.cpp b/test/CodeGenCXX/thunks.cpp
index ba60385ab6f3..a74cc053dbe5 100644
--- a/test/CodeGenCXX/thunks.cpp
+++ b/test/CodeGenCXX/thunks.cpp
@@ -88,31 +88,29 @@ void C::f() { }
}
// Check that the thunk gets internal linkage.
-namespace {
-
-struct A {
- virtual void f();
-};
-
-struct B {
- virtual void f();
-};
-
-struct C : A, B {
- virtual void c();
-
- virtual void f();
-};
+namespace Test4B {
+ struct A {
+ virtual void f();
+ };
-void C::f() { }
+ struct B {
+ virtual void f();
+ };
-}
+ namespace {
+ struct C : A, B {
+ virtual void c();
+ virtual void f();
+ };
+ }
+ void C::c() {}
+ void C::f() {}
-// Force C::f to be used.
-void f() {
- C c;
-
- c.f();
+ // Force C::f to be used.
+ void f() {
+ C c;
+ c.f();
+ }
}
namespace Test5 {
@@ -260,8 +258,27 @@ namespace Test10 {
}
}
+// PR7611
+namespace Test11 {
+ struct A { virtual A* f(); };
+ struct B : virtual A { virtual A* f(); };
+ struct C : B { virtual C* f(); };
+ C* C::f() { return 0; }
+
+ // The this-adjustment and return-adjustment thunk required when
+ // C::f appears in a vtable where A is at a nonzero offset from C.
+ // CHECK: define {{.*}} @_ZTcv0_n24_v0_n32_N6Test111C1fEv(
+
+ // C::f itself.
+ // CHECK: define {{.*}} @_ZN6Test111C1fEv(
+
+ // The return-adjustment thunk required when C::f appears in a vtable
+ // where A is at a zero offset from C.
+ // CHECK: define {{.*}} @_ZTch0_v0_n32_N6Test111C1fEv(
+}
+
/**** The following has to go at the end of the file ****/
// This is from Test5:
// CHECK: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv
-// CHECK: define internal void @_ZThn8_N12_GLOBAL__N_11C1fEv(
+// CHECK: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv(
diff --git a/test/CodeGenCXX/value-init.cpp b/test/CodeGenCXX/value-init.cpp
index c4eb1c899096..258d6926e148 100644
--- a/test/CodeGenCXX/value-init.cpp
+++ b/test/CodeGenCXX/value-init.cpp
@@ -133,8 +133,21 @@ namespace zeroinit {
X3<int>().f();
}
- // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev
+ // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev(%struct.B* %this) unnamed_addr
// CHECK: call void @llvm.memset.p0i8.i64
// CHECK-NEXT: call void @_ZN8zeroinit2X2IiEC2Ev
// CHECK-NEXT: ret void
}
+
+namespace PR8726 {
+class C;
+struct S {
+ const C &c1;
+ int i;
+ const C &c2;
+};
+void f(const C& c) {
+ S s = {c, 42, c};
+}
+
+}
diff --git a/test/CodeGenCXX/variadic-templates.cpp b/test/CodeGenCXX/variadic-templates.cpp
new file mode 100644
index 000000000000..4f3cf1fe9db6
--- /dev/null
+++ b/test/CodeGenCXX/variadic-templates.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+template<typename ...Types>
+int get_num_types(Types...) {
+ return sizeof...(Types);
+}
+
+// CHECK: define weak_odr i32 @_Z13get_num_typesIJifdEEiDpT_
+// CHECK: ret i32 3
+template int get_num_types(int, float, double);
+
+
diff --git a/test/CodeGenCXX/virt-dtor-gen.cpp b/test/CodeGenCXX/virt-dtor-gen.cpp
index a4346bade786..1a6c583c34f2 100644
--- a/test/CodeGenCXX/virt-dtor-gen.cpp
+++ b/test/CodeGenCXX/virt-dtor-gen.cpp
@@ -7,4 +7,4 @@ class Foo {
};
Foo::~Foo() {}
-// CHECK: define void @_ZN3FooD0Ev
+// CHECK: define void @_ZN3FooD0Ev(%class.Foo* %this) unnamed_addr
diff --git a/test/CodeGenCXX/virt-dtor-key.cpp b/test/CodeGenCXX/virt-dtor-key.cpp
index 6a58c50b5b79..a8fa371d3fa8 100644
--- a/test/CodeGenCXX/virt-dtor-key.cpp
+++ b/test/CodeGenCXX/virt-dtor-key.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
-// CHECK: @_ZTI3foo = constant
+// CHECK: @_ZTI3foo = unnamed_addr constant
class foo {
foo();
virtual ~foo();
diff --git a/test/CodeGenCXX/virt-template-vtable.cpp b/test/CodeGenCXX/virt-template-vtable.cpp
index d60cfb9043ac..25736fd60309 100644
--- a/test/CodeGenCXX/virt-template-vtable.cpp
+++ b/test/CodeGenCXX/virt-template-vtable.cpp
@@ -16,7 +16,7 @@ extern template class A<short>;
template class A<short>;
-// CHECK: @_ZTV1B = weak_odr constant
-// CHECK: @_ZTV1AIlE = weak_odr constant
-// CHECK: @_ZTV1AIsE = weak_odr constant
-// CHECK: @_ZTV1AIiE = weak_odr constant
+// CHECK: @_ZTV1B = linkonce_odr unnamed_addr constant
+// CHECK: @_ZTV1AIlE = weak_odr unnamed_addr constant
+// CHECK: @_ZTV1AIsE = weak_odr unnamed_addr constant
+// CHECK: @_ZTV1AIiE = linkonce_odr unnamed_addr constant
diff --git a/test/CodeGenCXX/virtual-base-destructor-call.cpp b/test/CodeGenCXX/virtual-base-destructor-call.cpp
index 4618a03b9d3f..807eaff0d1d2 100644
--- a/test/CodeGenCXX/virtual-base-destructor-call.cpp
+++ b/test/CodeGenCXX/virtual-base-destructor-call.cpp
@@ -18,34 +18,34 @@ int main() {
// basic_iostream's complete dtor calls its base dtor, then its
// virtual base's dtor.
-// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED1Ev
+// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED1Ev(%struct.basic_iostream* %this) unnamed_addr
// CHECK: call void @_ZN14basic_iostreamIcED2Ev
// CHECK: call void @_ZN9basic_iosD2Ev
// basic_iostream's base dtor calls its non-virtual base dtor.
-// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED2Ev
+// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED2Ev(%struct.basic_iostream* %this, i8** %vtt) unnamed_addr
// CHECK: call void @_ZN13basic_istreamIcED2Ev
// CHECK: }
// basic_istream's base dtor is a no-op.
-// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED2Ev
+// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED2Ev(%struct.basic_istream* %this, i8** %vtt) unnamed_addr
// CHECK-NOT: call
// CHECK: }
// basic_iostream's deleting dtor calls its complete dtor, then
// operator delete().
-// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED0Ev
+// CHECK: define linkonce_odr void @_ZN14basic_iostreamIcED0Ev(%struct.basic_iostream* %this) unnamed_addr
// CHECK: call void @_ZN14basic_iostreamIcED1Ev
// CHECK: call void @_ZdlPv
// basic_istream's complete dtor calls the base dtor,
// then its virtual base's base dtor.
-// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED1Ev
+// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED1Ev(%struct.basic_istream* %this) unnamed_addr
// CHECK: call void @_ZN13basic_istreamIcED2Ev
// CHECK: call void @_ZN9basic_iosD2Ev
// basic_istream's deleting dtor calls the complete dtor, then
// operator delete().
-// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED0Ev
+// CHECK: define linkonce_odr void @_ZN13basic_istreamIcED0Ev(%struct.basic_istream* %this) unnamed_addr
// CHECK: call void @_ZN13basic_istreamIcED1Ev
// CHECK: call void @_ZdlPv
diff --git a/test/CodeGenCXX/virtual-bases.cpp b/test/CodeGenCXX/virtual-bases.cpp
index 61de3153fd50..cfb4c837162e 100644
--- a/test/CodeGenCXX/virtual-bases.cpp
+++ b/test/CodeGenCXX/virtual-bases.cpp
@@ -5,23 +5,23 @@ struct A {
};
// CHECK: @_ZN1AC1Ev = alias {{.*}} @_ZN1AC2Ev
-// CHECK: define void @_ZN1AC2Ev(%struct.A* %this)
+// CHECK: define void @_ZN1AC2Ev(%struct.A* %this) unnamed_addr
A::A() { }
struct B : virtual A {
B();
};
-// CHECK: define void @_ZN1BC1Ev(%struct.B* %this)
-// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt)
+// CHECK: define void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
+// CHECK: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt) unnamed_addr
B::B() { }
struct C : virtual A {
C(bool);
};
-// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext)
-// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext)
+// CHECK: define void @_ZN1CC1Eb(%struct.B* %this, i1 zeroext) unnamed_addr
+// CHECK: define void @_ZN1CC2Eb(%struct.B* %this, i8** %vtt, i1 zeroext) unnamed_addr
C::C(bool) { }
// PR6251
@@ -39,7 +39,7 @@ struct D : B, C {
D();
};
-// CHECK: define void @_ZN6PR62511DC1Ev
+// CHECK: define void @_ZN6PR62511DC1Ev(%"struct.PR6251::D"* %this) unnamed_addr
// CHECK: call void @_ZN6PR62511AIcEC2Ev
// CHECK-NOT: call void @_ZN6PR62511AIcEC2Ev
// CHECK: ret void
diff --git a/test/CodeGenCXX/virtual-destructor-calls.cpp b/test/CodeGenCXX/virtual-destructor-calls.cpp
index c5b9262a0678..1cc8bcc7753e 100644
--- a/test/CodeGenCXX/virtual-destructor-calls.cpp
+++ b/test/CodeGenCXX/virtual-destructor-calls.cpp
@@ -21,12 +21,12 @@ struct B : A {
// CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
// Deleting dtor: defers to the complete dtor.
-// CHECK: define void @_ZN1BD0Ev
+// CHECK: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
// CHECK: call void @_ZN1BD1Ev
// CHECK: call void @_ZdlPv
// Base dtor: actually calls A's base dtor.
-// CHECK: define void @_ZN1BD2Ev
+// CHECK: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
// CHECK: call void @_ZN6MemberD1Ev
// CHECK: call void @_ZN1AD2Ev
@@ -41,7 +41,7 @@ C::~C() { }
// Complete dtor: just an alias (checked above).
// Deleting dtor: defers to the complete dtor.
-// CHECK: define void @_ZN1CD0Ev
+// CHECK: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr
// CHECK: call void @_ZN1CD1Ev
// CHECK: call void @_ZdlPv
diff --git a/test/CodeGenCXX/visibility-inlines-hidden.cpp b/test/CodeGenCXX/visibility-inlines-hidden.cpp
index bb1574fe9d5f..760879a2a63c 100644
--- a/test/CodeGenCXX/visibility-inlines-hidden.cpp
+++ b/test/CodeGenCXX/visibility-inlines-hidden.cpp
@@ -1,4 +1,9 @@
-// RUN: %clang_cc1 -fvisibility-inlines-hidden -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -fvisibility-inlines-hidden -emit-llvm -o - %s -O2 -disable-llvm-optzns | FileCheck %s
+
+// The trickery with optimization in the run line is to get IR
+// generation to emit available_externally function bodies, but not
+// actually inline them (and thus remove the emitted bodies).
+
struct X0 {
void __attribute__((visibility("default"))) f1() { }
void f2() { }
@@ -29,7 +34,9 @@ struct __attribute__((visibility("default"))) X2 {
void f2() { }
};
-void use(X0 *x0, X1<int> *x1, X2 *x2) {
+extern template struct X1<float>;
+
+void use(X0 *x0, X1<int> *x1, X2 *x2, X1<float> *x3) {
// CHECK: define linkonce_odr void @_ZN2X02f1Ev
x0->f1();
// CHECK: define linkonce_odr hidden void @_ZN2X02f2Ev
@@ -54,4 +61,39 @@ void use(X0 *x0, X1<int> *x1, X2 *x2) {
x1->X1::f6();
// CHECK: define linkonce_odr hidden void @_ZN2X22f2Ev
x2->f2();
+ // CHECK: define available_externally void @_ZN2X1IfE2f2Ev
+ x3->f2();
+}
+
+// rdar://problem/8614470
+namespace test1 {
+ struct __attribute__((visibility("default"))) A {
+ inline void foo();
+ ~A();
+ };
+
+ void test() {
+ A a;
+ a.foo();
+ }
+// CHECK: declare void @_ZN5test11A3fooEv
+// CHECK: declare void @_ZN5test11AD1Ev
+}
+
+// PR8713
+namespace test2 {
+ struct A {};
+ template <class T> class B {};
+ typedef B<A> arg;
+
+ namespace ns __attribute__((visibility("default"))) {
+ template <class T> inline void foo() {}
+ extern template void foo<arg>();
+ }
+
+ void test() {
+ ns::foo<arg>();
+ }
+
+ // CHECK: define available_externally void @_ZN5test22ns3fooINS_1BINS_1AEEEEEvv()
}
diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp
index ee3c1795fbb7..931465060b62 100644
--- a/test/CodeGenCXX/visibility.cpp
+++ b/test/CodeGenCXX/visibility.cpp
@@ -1,11 +1,35 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fvisibility hidden -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-HIDDEN
#define HIDDEN __attribute__((visibility("hidden")))
#define PROTECTED __attribute__((visibility("protected")))
#define DEFAULT __attribute__((visibility("default")))
// CHECK: @_ZN5Test425VariableInHiddenNamespaceE = hidden global i32 10
-// CHECK: @_ZTVN5Test63fooE = weak_odr hidden constant
+// CHECK: @_ZN5Test71aE = hidden global
+// CHECK: @_ZN5Test71bE = global
+// CHECK: @test9_var = global
+// CHECK-HIDDEN: @test9_var = global
+// CHECK: @_ZN6Test121A6hiddenE = external hidden global
+// CHECK: @_ZN6Test121A7visibleE = external global
+// CHECK-HIDDEN: @_ZN6Test121A6hiddenE = external hidden global
+// CHECK-HIDDEN: @_ZN6Test121A7visibleE = external global
+// CHECK: @_ZN6Test131B1aE = hidden global
+// CHECK: @_ZN6Test131C1aE = global
+// CHECK-HIDDEN: @_ZN6Test131B1aE = hidden global
+// CHECK-HIDDEN: @_ZN6Test131C1aE = global
+// CHECK: @_ZN6Test143varE = external global
+// CHECK-HIDDEN: @_ZN6Test143varE = external global
+// CHECK: @_ZN6Test154TempINS_1AEE5Inner6bufferE = external global [0 x i8]
+// CHECK-HIDDEN: @_ZN6Test154TempINS_1AEE5Inner6bufferE = external global [0 x i8]
+// CHECK: @_ZZN6Test193fooIiEEvvE1a = linkonce_odr global
+// CHECK: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr global i64
+// CHECK-HIDDEN: @_ZZN6Test193fooIiEEvvE1a = linkonce_odr hidden global
+// CHECK-HIDDEN: @_ZGVZN6Test193fooIiEEvvE1a = linkonce_odr hidden global i64
+// CHECK-HIDDEN: @_ZTTN6Test161AIcEE = external unnamed_addr constant
+// CHECK-HIDDEN: @_ZTVN6Test161AIcEE = external unnamed_addr constant
+// CHECK: @_ZTVN5Test63fooE = linkonce_odr hidden unnamed_addr constant
+
namespace Test1 {
// CHECK: define hidden void @_ZN5Test11fEv
void HIDDEN f() { }
@@ -82,3 +106,308 @@ namespace Test6 {
barc::barc() {}
}
+
+namespace Test7 {
+ class HIDDEN A {};
+ A a; // top of file
+
+ template <A&> struct Aref {
+ static void foo() {}
+ };
+
+ class B : public A {};
+ B b; // top of file
+
+ // CHECK: define linkonce_odr hidden void @_ZN5Test74ArefILZNS_1aEEE3fooEv()
+ void test() {
+ Aref<a>::foo();
+ }
+}
+
+namespace Test8 {
+ void foo();
+ void bar() {}
+ // CHECK-HIDDEN: define hidden void @_ZN5Test83barEv()
+ // CHECK-HIDDEN: declare void @_ZN5Test83fooEv()
+
+ void test() {
+ foo();
+ bar();
+ }
+}
+
+// PR8457
+namespace Test9 {
+ extern "C" {
+ struct A { int field; };
+ void DEFAULT test9_fun(struct A *a) { }
+ struct A DEFAULT test9_var; // above
+ }
+ // CHECK: define void @test9_fun(
+ // CHECK-HIDDEN: define void @test9_fun(
+
+ void test() {
+ A a = test9_var;
+ test9_fun(&a);
+ }
+}
+
+// PR8478
+namespace Test10 {
+ struct A;
+
+ DEFAULT class B {
+ void foo(A*);
+ };
+
+ // CHECK: define void @_ZN6Test101B3fooEPNS_1AE(
+ // CHECK-HIDDEN: define void @_ZN6Test101B3fooEPNS_1AE(
+ void B::foo(A*) {}
+}
+
+// PR8492
+namespace Test11 {
+ struct A {
+ void foo() {}
+ void DEFAULT bar() {}
+ };
+
+ void test() {
+ A a;
+ a.foo();
+ a.bar();
+ }
+
+ // CHECK: define linkonce_odr void @_ZN6Test111A3fooEv(
+ // CHECK: define linkonce_odr void @_ZN6Test111A3barEv(
+ // CHECK-HIDDEN: define linkonce_odr hidden void @_ZN6Test111A3fooEv(
+ // CHECK-HIDDEN: define linkonce_odr void @_ZN6Test111A3barEv(
+}
+
+// Tested at top of file.
+namespace Test12 {
+ struct A {
+ // This is hidden in all cases: the explicit attribute takes
+ // priority over -fvisibility on the parent.
+ static int hidden HIDDEN;
+
+ // This is default in all cases because it's only a declaration.
+ static int visible;
+ };
+
+ void test() {
+ A::hidden = 0;
+ A::visible = 0;
+ }
+}
+
+// Tested at top of file.
+namespace Test13 {
+ struct HIDDEN A {};
+
+ // Should be hidden in all cases.
+ struct B {
+ static A a;
+ };
+ A B::a;
+
+ // Should be default in all cases.
+ struct DEFAULT C {
+ static A a;
+ };
+ A C::a;
+};
+
+// Tested at top of file.
+namespace Test14 {
+ // Neither the visibility of the type nor -fvisibility=hidden should
+ // apply to declarations.
+ extern struct A *var;
+
+ struct A *test() { return var; }
+}
+
+// rdar://problem/8613093
+namespace Test15 {
+ struct A {};
+ template <class T> struct Temp {
+ struct Inner {
+ static char buffer[0];
+ };
+ };
+
+ char *test() {
+ return Temp<A>::Inner::buffer;
+ }
+}
+
+namespace Test16 {
+ struct Base1 { virtual void foo(); };
+ struct Base2 : virtual Base1 { virtual void foo(); };
+ template <class T> struct A : virtual Base1, Base2 {
+ virtual void foo();
+ };
+ extern template struct A<char>;
+
+ void test() {
+ A<char> a;
+ a.foo();
+ }
+}
+
+namespace Test17 {
+ struct HIDDEN A {
+ static void foo();
+ static void DEFAULT bar();
+ static void HIDDEN baz();
+
+ struct DEFAULT B {
+ static void foo();
+ static void DEFAULT bar();
+ static void HIDDEN baz();
+ };
+ };
+
+ void test() {
+ A::foo();
+ A::bar();
+ A::baz();
+ A::B::foo();
+ A::B::bar();
+ A::B::baz();
+ }
+ // CHECK: declare hidden void @_ZN6Test171A3fooEv()
+ // CHECK: declare void @_ZN6Test171A3barEv()
+ // CHECK: declare hidden void @_ZN6Test171A3bazEv()
+ // CHECK: declare void @_ZN6Test171A1B3fooEv()
+ // CHECK: declare void @_ZN6Test171A1B3barEv()
+ // CHECK: declare hidden void @_ZN6Test171A1B3bazEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test171A3fooEv()
+ // CHECK-HIDDEN: declare void @_ZN6Test171A3barEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test171A3bazEv()
+ // CHECK-HIDDEN: declare void @_ZN6Test171A1B3fooEv()
+ // CHECK-HIDDEN: declare void @_ZN6Test171A1B3barEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test171A1B3bazEv()
+}
+
+namespace Test18 {
+ template <class T> struct HIDDEN A {
+ static void foo();
+ static void DEFAULT bar();
+ static void HIDDEN baz();
+
+ struct DEFAULT B {
+ static void foo();
+ static void DEFAULT bar();
+ static void HIDDEN baz();
+ };
+ };
+ struct HIDDEN H;
+
+ void test() {
+ A<int>::foo();
+ A<int>::bar();
+ A<int>::baz();
+ A<int>::B::foo();
+ A<int>::B::bar();
+ A<int>::B::baz();
+ A<H>::foo();
+ A<H>::bar();
+ A<H>::baz();
+ A<H>::B::foo();
+ A<H>::B::bar();
+ A<H>::B::baz();
+ }
+ // CHECK: declare hidden void @_ZN6Test181AIiE3fooEv()
+ // CHECK: declare void @_ZN6Test181AIiE3barEv()
+ // CHECK: declare hidden void @_ZN6Test181AIiE3bazEv()
+ // CHECK: declare void @_ZN6Test181AIiE1B3fooEv()
+ // CHECK: declare void @_ZN6Test181AIiE1B3barEv()
+ // CHECK: declare hidden void @_ZN6Test181AIiE1B3bazEv()
+ // CHECK: declare hidden void @_ZN6Test181AINS_1HEE3fooEv()
+ // CHECK: declare hidden void @_ZN6Test181AINS_1HEE3barEv()
+ // CHECK: declare hidden void @_ZN6Test181AINS_1HEE3bazEv()
+ // CHECK: declare hidden void @_ZN6Test181AINS_1HEE1B3fooEv()
+ // CHECK: declare hidden void @_ZN6Test181AINS_1HEE1B3barEv()
+ // CHECK: declare hidden void @_ZN6Test181AINS_1HEE1B3bazEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AIiE3fooEv()
+ // CHECK-HIDDEN: declare void @_ZN6Test181AIiE3barEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AIiE3bazEv()
+ // CHECK-HIDDEN: declare void @_ZN6Test181AIiE1B3fooEv()
+ // CHECK-HIDDEN: declare void @_ZN6Test181AIiE1B3barEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AIiE1B3bazEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AINS_1HEE3fooEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AINS_1HEE3barEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AINS_1HEE3bazEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AINS_1HEE1B3fooEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AINS_1HEE1B3barEv()
+ // CHECK-HIDDEN: declare hidden void @_ZN6Test181AINS_1HEE1B3bazEv()
+}
+
+namespace Test19 {
+ struct A { A(); ~A(); };
+
+ // Tested at top of file.
+ template <class T> void foo() {
+ static A a;
+ }
+
+ void test() {
+ foo<int>();
+ }
+}
+
+// Various things with class template specializations.
+namespace Test20 {
+ template <unsigned> struct HIDDEN A {};
+
+ // An explicit specialization inherits the explicit visibility of
+ // the template.
+ template <> struct A<0> {
+ static void test0();
+ static void test1();
+ };
+
+ // CHECK: define hidden void @_ZN6Test201AILj0EE5test0Ev()
+ void A<0>::test0() {}
+
+ // CHECK: declare hidden void @_ZN6Test201AILj0EE5test1Ev()
+ void test1() {
+ A<0>::test1();
+ }
+
+ // ...unless that's explicitly overridden.
+ template <> struct DEFAULT A<1> {
+ static void test2();
+ static void test3();
+ };
+
+ // CHECK: define void @_ZN6Test201AILj1EE5test2Ev()
+ void A<1>::test2() {}
+
+ // CHECK: declare void @_ZN6Test201AILj1EE5test3Ev()
+ void test3() {
+ A<1>::test3();
+ }
+
+ // <rdar://problem/8778497>
+ // But we should assume that an unknown specialization has the
+ // explicit visibility settings of the template.
+ template <class T> struct B {
+ static void test4() {}
+ static void test5();
+ };
+
+ // CHECK: define linkonce_odr hidden void @_ZN6Test201BINS_1AILj2EEEE5test4Ev()
+ void test4() {
+ B<A<2> >::test4();
+ }
+
+ // CHECK: declare void @_ZN6Test201BINS_1AILj2EEEE5test5Ev()
+ // (but explicit visibility on a template argument doesn't count as
+ // explicit visibility for the template for purposes of deciding
+ // whether an external symbol gets visibility)
+ void test5() {
+ B<A<2> >::test5();
+ }
+}
diff --git a/test/CodeGenCXX/volatile-1.cpp b/test/CodeGenCXX/volatile-1.cpp
new file mode 100644
index 000000000000..3ae17bd41b75
--- /dev/null
+++ b/test/CodeGenCXX/volatile-1.cpp
@@ -0,0 +1,352 @@
+// RUN: %clang_cc1 -Wno-unused-value -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: @i = global [[INT:i[0-9]+]] 0
+volatile int i, j, k;
+volatile int ar[5];
+volatile char c;
+// CHECK: @ci = global [[CINT:%.*]] zeroinitializer
+volatile _Complex int ci;
+volatile struct S {
+#ifdef __cplusplus
+ void operator =(volatile struct S&o) volatile;
+#endif
+ int i;
+} a, b;
+
+//void operator =(volatile struct S&o1, volatile struct S&o2) volatile;
+int printf(const char *, ...);
+
+
+// CHECK: define void @{{.*}}test
+void test() {
+
+ asm("nop"); // CHECK: call void asm
+
+ // should not load
+ i;
+
+ (float)(ci);
+ // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: sitofp [[INT]]
+
+ // These are not uses in C++:
+ // [expr.static.cast]p6:
+ // The lvalue-to-rvalue . . . conversions are not applied to the expression.
+ (void)ci;
+ (void)a;
+
+ (void)(ci=ci);
+ // CHECK-NEXT: [[R:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+
+ (void)(i=j);
+ // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* @j
+ // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* @i
+
+ ci+=ci;
+ // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // Not sure why they're ordered this way.
+ // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
+ // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
+ // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+
+ // Note that C++ requires an extra volatile load over C from the LHS of the '+'.
+ (ci += ci) + ci;
+ // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R:%.*]] = add [[INT]] [[R2]], [[R1]]
+ // CHECK-NEXT: [[I:%.*]] = add [[INT]] [[I2]], [[I1]]
+ // CHECK-NEXT: volatile store [[INT]] [[R]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: volatile store [[INT]] [[I]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I1:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[R2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 0)
+ // CHECK-NEXT: [[I2:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // These additions can be elided.
+ // CHECK-NEXT: add [[INT]] [[R1]], [[R2]]
+ // CHECK-NEXT: add [[INT]] [[I1]], [[I2]]
+
+ asm("nop"); // CHECK-NEXT: call void asm
+
+ // Extra volatile load in C++.
+ (i += j) + k;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+
+ asm("nop"); // CHECK-NEXT: call void asm
+
+ // Extra volatile load in C++.
+ (i += j) + 1;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+
+ asm("nop"); // CHECK-NEXT: call void asm
+
+ ci+ci;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add [[INT]]
+ // CHECK-NEXT: add [[INT]]
+
+ __real i;
+
+ +ci;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+
+ asm("nop"); // CHECK-NEXT: call void asm
+
+ (void)(i=i);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ (float)(i=i);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: sitofp
+
+ (void)i;
+
+ i=i;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ // Extra volatile load in C++.
+ i=i=i;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ (void)__builtin_choose_expr(0, i=i, j=j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ k ? (i=i) : (j=j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: icmp
+ // CHECK-NEXT: br i1
+ // CHECK: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: br label
+ // CHECK: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: br label
+ // CHECK: phi
+
+ (void)(i,(i=i));
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ i=i,k;
+ // CHECK-NEXT: volatile load [[INT]]* @i
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
+
+ (i=j,k=j);
+ // CHECK-NEXT: volatile load [[INT]]* @j
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
+ // CHECK-NEXT: volatile load [[INT]]* @j
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @k
+
+ (i=j,k);
+ // CHECK-NEXT: volatile load [[INT]]* @j
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
+
+ (i,j);
+
+ // Extra load in C++.
+ i=c=k;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: trunc
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: sext
+ // CHECK-NEXT: volatile store
+
+ i+=k;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add nsw [[INT]]
+ // CHECK-NEXT: volatile store
+
+ ci;
+
+ asm("nop"); // CHECK-NEXT: call void asm
+
+ (int)ci;
+ // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 0
+ // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 1
+
+ (bool)ci;
+ // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 0
+ // CHECK-NEXT: volatile load {{.*}} @ci, i32 0, i32 1
+ // CHECK-NEXT: icmp ne
+ // CHECK-NEXT: icmp ne
+ // CHECK-NEXT: or i1
+
+ ci=ci;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+
+ asm("nop"); // CHECK-NEXT: call void asm
+
+ // Extra load in C++.
+ ci=ci=ci;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+
+ __imag ci = __imag ci = __imag ci;
+ // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: [[T:%.*]] = volatile load [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+ // CHECK-NEXT: volatile store [[INT]] [[T]], [[INT]]* getelementptr inbounds ([[CINT]]* @ci, i32 0, i32 1)
+
+ __real (i = j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ __imag i;
+
+ // ============================================================
+ // FIXME: Test cases we get wrong.
+
+ // A use. We load all of a into a copy of a, then load i. gcc forgets to do
+ // the assignment.
+ // (a = a).i;
+
+ // ============================================================
+ // Test cases where we intentionally differ from gcc, due to suspected bugs in
+ // gcc.
+
+ // Not a use. gcc forgets to do the assignment.
+ // CHECK-NEXT: call
+ ((a=a),a);
+
+ // Not a use. gcc gets this wrong, it doesn't emit the copy!
+ // CHECK-NEXT: call
+ (void)(a=a);
+
+ // Not a use. gcc got this wrong in 4.2 and omitted the side effects
+ // entirely, but it is fixed in 4.4.0.
+ __imag (i = j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+
+ // C++ does an extra load here. Note that we have to do full loads.
+ (float)(ci=ci);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: sitofp
+
+ // Not a use, bug? gcc treats this as not a use, that's probably a
+ // bug due to tree folding ignoring volatile.
+ (int)(ci=ci);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+
+ // A use.
+ (float)(i=i);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: sitofp
+
+ // A use. gcc treats this as not a use, that's probably a bug due to tree
+ // folding ignoring volatile.
+ (int)(i=i);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+
+ // A use.
+ -(i=j);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: sub
+
+ // A use. gcc treats this a not a use, that's probably a bug due to tree
+ // folding ignoring volatile.
+ +(i=k);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+
+ // A use. gcc treats this a not a use, that's probably a bug due to tree
+ // folding ignoring volatile.
+ __real (ci=ci);
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile store
+
+ // A use.
+ i + 0;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add
+
+ // A use.
+ (i=j) + i;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add
+
+ // A use. gcc treats this as not a use, that's probably a bug due to tree
+ // folding ignoring volatile.
+ (i=j) + 0;
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: volatile store
+ // CHECK-NEXT: volatile load
+ // CHECK-NEXT: add
+
+ (i,j)=k;
+ // CHECK-NEXT: volatile load [[INT]]* @k
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @j
+
+ (j=k,i)=i;
+ // CHECK-NEXT: volatile load [[INT]]* @i
+ // CHECK-NEXT: volatile load [[INT]]* @k
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @j
+ // CHECK-NEXT: volatile store {{.*}}, [[INT]]* @i
+
+ // CHECK-NEXT: ret void
+}
diff --git a/test/CodeGenCXX/volatile.cpp b/test/CodeGenCXX/volatile.cpp
index 58f433f1e15c..6ebb2f11fca5 100644
--- a/test/CodeGenCXX/volatile.cpp
+++ b/test/CodeGenCXX/volatile.cpp
@@ -27,8 +27,6 @@ namespace test1 {
// CHECK: define void @_ZN5test14testEv()
void test() {
// CHECK: [[TMP:%.*]] = load i32** @_ZN5test11xE, align 8
- // *** FIXME: no! bad! should not be loaded! ***
- // CHECK-NEXT: [[TMP1:%.*]] = volatile load i32* [[TMP]]
// CHECK-NEXT: ret void
*x;
}
diff --git a/test/CodeGenCXX/vtable-available-externally.cpp b/test/CodeGenCXX/vtable-available-externally.cpp
new file mode 100644
index 000000000000..23baac968c7e
--- /dev/null
+++ b/test/CodeGenCXX/vtable-available-externally.cpp
@@ -0,0 +1,171 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o %t
+// RUN: FileCheck --check-prefix=CHECK-TEST1 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-TEST2 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-TEST5 %s < %t
+// RUN: FileCheck --check-prefix=CHECK-TEST7 %s < %t
+
+#include <typeinfo>
+
+// Test1::A's key function (f) is not defined in this translation unit, but in
+// order to devirtualize calls, we emit the class related data with
+// available_externally linkage.
+
+// CHECK-TEST1: @_ZTVN5Test11AE = available_externally
+// CHECK-TEST1: @_ZTSN5Test11AE = available_externally
+// CHECK-TEST1: @_ZTIN5Test11AE = available_externally
+namespace Test1 {
+
+struct A {
+ A();
+ virtual void f();
+ virtual ~A() { }
+};
+
+A::A() { }
+
+void f(A* a) {
+ a->f();
+};
+
+// CHECK: define void @_ZN5Test11gEv
+// CHECK: call void @_ZN5Test11A1fEv
+void g() {
+ A a;
+ f(&a);
+}
+
+}
+
+// Test2::A's key function (f) is defined in this translation unit, but when
+// we're doing codegen for the typeid(A) call, we don't know that yet.
+// This tests mainly that the typeinfo and typename constants have their linkage
+// updated correctly.
+
+// CHECK-TEST2: @_ZTSN5Test21AE = constant
+// CHECK-TEST2: @_ZTIN5Test21AE = unnamed_addr constant
+// CHECK-TEST2: @_ZTVN5Test21AE = unnamed_addr constant
+namespace Test2 {
+ struct A {
+ virtual void f();
+ };
+
+ const std::type_info &g() {
+ return typeid(A);
+ };
+
+ void A::f() { }
+}
+
+// Test that we don't assert on this test.
+namespace Test3 {
+
+struct A {
+ virtual void f();
+ virtual ~A() { }
+};
+
+struct B : A {
+ B();
+ virtual void f();
+};
+
+B::B() { }
+
+void g(A* a) {
+ a->f();
+};
+
+}
+
+// PR9114, test that we don't try to instantiate RefPtr<Node>.
+namespace Test4 {
+
+template <class T> struct RefPtr {
+ T* p;
+ ~RefPtr() {
+ p->deref();
+ }
+};
+
+struct A {
+ virtual ~A();
+};
+
+struct Node;
+
+struct B : A {
+ virtual void deref();
+ RefPtr<Node> m;
+};
+
+void f() {
+ RefPtr<B> b;
+}
+
+}
+
+// PR9130, test that we emit a definition of A::f.
+// CHECK-TEST5: define linkonce_odr void @_ZN5Test51A1fEv
+namespace Test5 {
+
+struct A {
+ virtual void f() { }
+};
+
+struct B : A {
+ virtual ~B();
+};
+
+B::~B() { }
+
+}
+
+// Check that we don't assert on this test.
+namespace Test6 {
+
+struct A {
+ virtual ~A();
+ int a;
+};
+
+struct B {
+ virtual ~B();
+ int b;
+};
+
+struct C : A, B {
+ C();
+};
+
+struct D : C {
+ virtual void f();
+ D();
+};
+
+D::D() { }
+
+}
+
+namespace Test7 {
+
+struct c1 {};
+struct c10 : c1{
+ virtual void foo ();
+};
+struct c11 : c10, c1{
+ virtual void f6 ();
+};
+struct c28 : virtual c11{
+ void f6 ();
+};
+
+// CHECK-TEST7: define void @_ZN5Test79check_c28Ev
+// CHECK-TEST7: call void @_ZN5Test73c282f6Ev
+// CHECK-TEST7: ret void
+void check_c28 () {
+ c28 obj;
+ c11 *ptr = &obj;
+ ptr->f6 ();
+}
+
+}
diff --git a/test/CodeGenCXX/vtable-debug-info.cpp b/test/CodeGenCXX/vtable-debug-info.cpp
new file mode 100644
index 000000000000..c355406fae4a
--- /dev/null
+++ b/test/CodeGenCXX/vtable-debug-info.cpp
@@ -0,0 +1,318 @@
+// RUN: %clang -c -g %s -o /dev/null
+// Radar 8730409
+// XFAIL: win32
+
+// FIXME: This test crashes on Windows.
+#ifdef _WIN32
+
+#error this test must xfail
+
+#else
+class foo {
+public:
+#define x(a) virtual void v ## a (void)
+x(1);
+x(2);
+x(3);
+x(4);
+x(5);
+x(6);
+x(7);
+x(8);
+x(9);
+x(10);
+x(11);
+x(12);
+x(13);
+x(14);
+x(15);
+x(16);
+x(17);
+x(18);
+x(19);
+x(20);
+x(21);
+x(22);
+x(23);
+x(24);
+x(25);
+x(26);
+x(27);
+x(28);
+x(29);
+x(30);
+x(31);
+x(32);
+x(33);
+x(34);
+x(35);
+x(36);
+x(37);
+x(38);
+x(39);
+x(40);
+x(41);
+x(42);
+x(43);
+x(44);
+x(45);
+x(46);
+x(47);
+x(48);
+x(49);
+x(50);
+x(51);
+x(52);
+x(53);
+x(54);
+x(55);
+x(56);
+x(57);
+x(58);
+x(59);
+x(60);
+x(61);
+x(62);
+x(63);
+x(64);
+x(65);
+x(66);
+x(67);
+x(68);
+x(69);
+x(70);
+x(71);
+x(72);
+x(73);
+x(74);
+x(75);
+x(76);
+x(77);
+x(78);
+x(79);
+x(80);
+x(81);
+x(82);
+x(83);
+x(84);
+x(85);
+x(86);
+x(87);
+x(88);
+x(89);
+x(90);
+x(91);
+x(92);
+x(93);
+x(94);
+x(95);
+x(96);
+x(97);
+x(98);
+x(99);
+x(100);
+x(101);
+x(102);
+x(103);
+x(104);
+x(105);
+x(106);
+x(107);
+x(108);
+x(109);
+x(110);
+x(111);
+x(112);
+x(113);
+x(114);
+x(115);
+x(116);
+x(117);
+x(118);
+x(119);
+x(120);
+x(121);
+x(122);
+x(123);
+x(124);
+x(125);
+x(126);
+x(127);
+x(128);
+x(129);
+x(130);
+x(131);
+x(132);
+x(133);
+x(134);
+x(135);
+x(136);
+x(137);
+x(138);
+x(139);
+x(140);
+x(141);
+x(142);
+x(143);
+x(144);
+x(145);
+x(146);
+x(147);
+x(148);
+x(149);
+x(150);
+x(151);
+x(152);
+x(153);
+x(154);
+x(155);
+x(156);
+x(157);
+x(158);
+x(159);
+x(160);
+x(161);
+x(162);
+x(163);
+x(164);
+x(165);
+x(166);
+x(167);
+x(168);
+x(169);
+x(170);
+x(171);
+x(172);
+x(173);
+x(174);
+x(175);
+x(176);
+x(177);
+x(178);
+x(179);
+x(180);
+x(181);
+x(182);
+x(183);
+x(184);
+x(185);
+x(186);
+x(187);
+x(188);
+x(189);
+x(190);
+x(191);
+x(192);
+x(193);
+x(194);
+x(195);
+x(196);
+x(197);
+x(198);
+x(199);
+x(200);
+x(201);
+x(202);
+x(203);
+x(204);
+x(205);
+x(206);
+x(207);
+x(208);
+x(209);
+x(210);
+x(211);
+x(212);
+x(213);
+x(214);
+x(215);
+x(216);
+x(217);
+x(218);
+x(219);
+x(220);
+x(221);
+x(222);
+x(223);
+x(224);
+x(225);
+x(226);
+x(227);
+x(228);
+x(229);
+x(230);
+x(231);
+x(232);
+x(233);
+x(234);
+x(235);
+x(236);
+x(237);
+x(238);
+x(239);
+x(240);
+x(241);
+x(242);
+x(243);
+x(244);
+x(245);
+x(246);
+x(247);
+x(248);
+x(249);
+x(250);
+x(251);
+x(252);
+x(253);
+x(254);
+x(255);
+x(256);
+x(257);
+x(258);
+x(259);
+x(260);
+x(261);
+x(262);
+x(263);
+x(264);
+x(265);
+x(266);
+x(267);
+x(268);
+x(269);
+x(270);
+x(271);
+x(272);
+x(273);
+x(274);
+x(275);
+x(276);
+x(277);
+x(278);
+x(279);
+x(280);
+x(281);
+x(282);
+x(283);
+x(284);
+x(285);
+x(286);
+x(287);
+x(288);
+x(289);
+x(290);
+x(291);
+x(292);
+x(293);
+x(294);
+x(295);
+x(296);
+x(297);
+x(298);
+x(299);
+x(300);
+};
+
+foo b;
+
+#endif
diff --git a/test/CodeGenCXX/vtable-key-function.cpp b/test/CodeGenCXX/vtable-key-function.cpp
index 97a546f8c932..bf2e6798d214 100644
--- a/test/CodeGenCXX/vtable-key-function.cpp
+++ b/test/CodeGenCXX/vtable-key-function.cpp
@@ -9,7 +9,7 @@ struct A {
// A does not have a key function, so the first constructor we emit should
// cause the vtable to be defined (without assertions.)
-// CHECK: @_ZTVN6PR56971AE = weak_odr constant
+// CHECK: @_ZTVN6PR56971AE = linkonce_odr unnamed_addr constant
A::A() { }
A::A(int) { }
}
diff --git a/test/CodeGenCXX/vtable-layout.cpp b/test/CodeGenCXX/vtable-layout.cpp
index 60b46fec39b3..1cf8a52d44b9 100644
--- a/test/CodeGenCXX/vtable-layout.cpp
+++ b/test/CodeGenCXX/vtable-layout.cpp
@@ -78,7 +78,7 @@ namespace Test2 {
// CHECK-2-NEXT: 5 | Test2::A::~A() [complete]
// CHECK-2-NEXT: 6 | Test2::A::~A() [deleting]
// CHECK-2-NEXT: 7 | void Test2::A::h()
-// CHECK-2-NEXT: 8 | Test2::A &Test2::A::operator=(Test2::A const &)
+// CHECK-2-NEXT: 8 | Test2::A &Test2::A::operator=(const Test2::A &)
struct A {
virtual void f();
virtual void f() const;
diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp
index cf988d131222..fc14c71a0e48 100644
--- a/test/CodeGenCXX/vtable-linkage.cpp
+++ b/test/CodeGenCXX/vtable-linkage.cpp
@@ -32,7 +32,7 @@ struct B {
B::B() { }
-struct C {
+struct C : virtual B {
C();
virtual void f() { }
};
@@ -99,92 +99,94 @@ void use_F() {
// B has a key function that is not defined in this translation unit so its vtable
// has external linkage.
-// CHECK-1: @_ZTV1B = external constant
+// CHECK-1: @_ZTV1B = external unnamed_addr constant
// C has no key function, so its vtable should have weak_odr linkage
// and hidden visibility (rdar://problem/7523229).
-// CHECK-2: @_ZTV1C = weak_odr constant
-// CHECK-2: @_ZTS1C = weak_odr constant
-// CHECK-2: @_ZTI1C = weak_odr constant
-// CHECK-2-HIDDEN: @_ZTV1C = weak_odr hidden constant
-// CHECK-2-HIDDEN: @_ZTS1C = weak_odr constant
-// CHECK-2-HIDDEN: @_ZTI1C = weak_odr hidden constant
+// CHECK-2: @_ZTV1C = linkonce_odr unnamed_addr constant
+// CHECK-2: @_ZTS1C = linkonce_odr constant
+// CHECK-2: @_ZTI1C = linkonce_odr unnamed_addr constant
+// CHECK-2: @_ZTT1C = linkonce_odr unnamed_addr constant
+// CHECK-2-HIDDEN: @_ZTV1C = linkonce_odr hidden unnamed_addr constant
+// CHECK-2-HIDDEN: @_ZTS1C = linkonce_odr constant
+// CHECK-2-HIDDEN: @_ZTI1C = linkonce_odr hidden unnamed_addr constant
+// CHECK-2-HIDDEN: @_ZTT1C = linkonce_odr hidden unnamed_addr constant
// D has a key function that is defined in this translation unit so its vtable is
// defined in the translation unit.
-// CHECK-3: @_ZTV1D = constant
+// CHECK-3: @_ZTV1D = unnamed_addr constant
// CHECK-3: @_ZTS1D = constant
-// CHECK-3: @_ZTI1D = constant
+// CHECK-3: @_ZTI1D = unnamed_addr constant
// E<char> is an explicit specialization with a key function defined
// in this translation unit, so its vtable should have external
// linkage.
-// CHECK-4: @_ZTV1EIcE = constant
+// CHECK-4: @_ZTV1EIcE = unnamed_addr constant
// CHECK-4: @_ZTS1EIcE = constant
-// CHECK-4: @_ZTI1EIcE = constant
+// CHECK-4: @_ZTI1EIcE = unnamed_addr constant
// E<short> is an explicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
// weak_odr linkage.
-// CHECK-5: @_ZTV1EIsE = weak_odr constant
+// CHECK-5: @_ZTV1EIsE = weak_odr unnamed_addr constant
// CHECK-5: @_ZTS1EIsE = weak_odr constant
-// CHECK-5: @_ZTI1EIsE = weak_odr constant
-// CHECK-5-HIDDEN: @_ZTV1EIsE = weak_odr constant
+// CHECK-5: @_ZTI1EIsE = weak_odr unnamed_addr constant
+// CHECK-5-HIDDEN: @_ZTV1EIsE = weak_odr unnamed_addr constant
// CHECK-5-HIDDEN: @_ZTS1EIsE = weak_odr constant
-// CHECK-5-HIDDEN: @_ZTI1EIsE = weak_odr constant
+// CHECK-5-HIDDEN: @_ZTI1EIsE = weak_odr unnamed_addr constant
// F<short> is an explicit template instantiation without a key
// function, so its vtable should have weak_odr linkage
-// CHECK-6: @_ZTV1FIsE = weak_odr constant
+// CHECK-6: @_ZTV1FIsE = weak_odr unnamed_addr constant
// CHECK-6: @_ZTS1FIsE = weak_odr constant
-// CHECK-6: @_ZTI1FIsE = weak_odr constant
-// CHECK-6-HIDDEN: @_ZTV1FIsE = weak_odr constant
+// CHECK-6: @_ZTI1FIsE = weak_odr unnamed_addr constant
+// CHECK-6-HIDDEN: @_ZTV1FIsE = weak_odr unnamed_addr constant
// CHECK-6-HIDDEN: @_ZTS1FIsE = weak_odr constant
-// CHECK-6-HIDDEN: @_ZTI1FIsE = weak_odr constant
+// CHECK-6-HIDDEN: @_ZTI1FIsE = weak_odr unnamed_addr constant
// E<long> is an implicit template instantiation with a key function
// defined in this translation unit, so its vtable should have
-// weak_odr linkage.
-// CHECK-7: @_ZTV1EIlE = weak_odr constant
-// CHECK-7: @_ZTS1EIlE = weak_odr constant
-// CHECK-7: @_ZTI1EIlE = weak_odr constant
+// linkonce_odr linkage.
+// CHECK-7: @_ZTV1EIlE = linkonce_odr unnamed_addr constant
+// CHECK-7: @_ZTS1EIlE = linkonce_odr constant
+// CHECK-7: @_ZTI1EIlE = linkonce_odr unnamed_addr constant
// F<long> is an implicit template instantiation with no key function,
-// so its vtable should have weak_odr linkage.
-// CHECK-8: @_ZTV1FIlE = weak_odr constant
-// CHECK-8: @_ZTS1FIlE = weak_odr constant
-// CHECK-8: @_ZTI1FIlE = weak_odr constant
+// so its vtable should have linkonce_odr linkage.
+// CHECK-8: @_ZTV1FIlE = linkonce_odr unnamed_addr constant
+// CHECK-8: @_ZTS1FIlE = linkonce_odr constant
+// CHECK-8: @_ZTI1FIlE = linkonce_odr unnamed_addr constant
// F<int> is an explicit template instantiation declaration without a
// key function, so its vtable should have external linkage.
-// CHECK-9: @_ZTV1FIiE = external constant
+// CHECK-9: @_ZTV1FIiE = external unnamed_addr constant
// E<int> is an explicit template instantiation declaration. It has a
// key function that is not instantiated, so we should only reference
// its vtable, not define it.
-// CHECK-10: @_ZTV1EIiE = external constant
+// CHECK-10: @_ZTV1EIiE = external unnamed_addr constant
// The anonymous struct for e has no linkage, so the vtable should have
// internal linkage.
-// CHECK-11: @"_ZTV3$_0" = internal constant
+// CHECK-11: @"_ZTV3$_0" = internal unnamed_addr constant
// CHECK-11: @"_ZTS3$_0" = internal constant
-// CHECK-11: @"_ZTI3$_0" = internal constant
+// CHECK-11: @"_ZTI3$_0" = internal unnamed_addr constant
// The A vtable should have internal linkage since it is inside an anonymous
// namespace.
-// CHECK-12: @_ZTVN12_GLOBAL__N_11AE = internal constant
+// CHECK-12: @_ZTVN12_GLOBAL__N_11AE = internal unnamed_addr constant
// CHECK-12: @_ZTSN12_GLOBAL__N_11AE = internal constant
-// CHECK-12: @_ZTIN12_GLOBAL__N_11AE = internal constant
+// CHECK-12: @_ZTIN12_GLOBAL__N_11AE = internal unnamed_addr constant
// F<char> is an explicit specialization without a key function, so
-// its vtable should have weak_odr linkage.
-// CHECK-13: @_ZTV1FIcE = weak_odr constant
-// CHECK-13: @_ZTS1FIcE = weak_odr constant
-// CHECK-13: @_ZTI1FIcE = weak_odr constant
+// its vtable should have linkonce_odr linkage.
+// CHECK-13: @_ZTV1FIcE = linkonce_odr unnamed_addr constant
+// CHECK-13: @_ZTS1FIcE = linkonce_odr constant
+// CHECK-13: @_ZTI1FIcE = linkonce_odr unnamed_addr constant
// RUN: FileCheck --check-prefix=CHECK-G %s < %t
//
-// CHECK-G: @_ZTV1GIiE = weak_odr constant
+// CHECK-G: @_ZTV1GIiE = linkonce_odr unnamed_addr constant
template <typename T>
class G {
public:
@@ -197,3 +199,18 @@ void G<int>::f1() {}
template <typename T>
void G<T>::f0() {}
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.
+// CHECK-H: @_ZTV1HIiE = linkonce_odr unnamed_addr constant
+template <typename T>
+class H {
+public:
+ virtual ~H();
+};
+
+void use_H() {
+ H<int> h;
+}
diff --git a/test/CodeGenCXX/vtable-pointer-initialization.cpp b/test/CodeGenCXX/vtable-pointer-initialization.cpp
index 75620ab8e62a..f629c2db79ca 100644
--- a/test/CodeGenCXX/vtable-pointer-initialization.cpp
+++ b/test/CodeGenCXX/vtable-pointer-initialization.cpp
@@ -19,14 +19,14 @@ struct A : Base {
Field field;
};
-// CHECK: define void @_ZN1AC2Ev(
+// CHECK: define void @_ZN1AC2Ev(%struct.A* %this) unnamed_addr
// CHECK: call void @_ZN4BaseC2Ev(
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
// CHECK: call void @_ZN5FieldC1Ev(
// CHECK: ret void
A::A() { }
-// CHECK: define void @_ZN1AD2Ev(
+// CHECK: define void @_ZN1AD2Ev(%struct.A* %this) unnamed_addr
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
// CHECK: call void @_ZN5FieldD1Ev(
// CHECK: call void @_ZN4BaseD2Ev(
@@ -41,16 +41,16 @@ struct B : Base {
void f() { B b; }
-// CHECK: define linkonce_odr void @_ZN1BC1Ev(
+// CHECK: define linkonce_odr void @_ZN1BC1Ev(%struct.A* %this) unnamed_addr
// CHECK: call void @_ZN1BC2Ev(
-// CHECK: define linkonce_odr void @_ZN1BD1Ev(
+// CHECK: define linkonce_odr void @_ZN1BD1Ev(%struct.A* %this) unnamed_addr
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 0, i64 2)
// CHECK: call void @_ZN5FieldD1Ev(
// CHECK: call void @_ZN4BaseD2Ev(
// CHECK: ret void
-// CHECK: define linkonce_odr void @_ZN1BC2Ev(
+// CHECK: define linkonce_odr void @_ZN1BC2Ev(%struct.A* %this) unnamed_addr
// CHECK: call void @_ZN4BaseC2Ev(
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1B, i64 0, i64 2)
// CHECK: call void @_ZN5FieldC1Ev
diff --git a/test/CodeGenCXX/vtt-layout.cpp b/test/CodeGenCXX/vtt-layout.cpp
index 814adf0e94ff..ace7b74b2dee 100644
--- a/test/CodeGenCXX/vtt-layout.cpp
+++ b/test/CodeGenCXX/vtt-layout.cpp
@@ -58,7 +58,7 @@ namespace Test4 {
D d;
}
-// CHECK: @_ZTTN5Test11BE = constant [1 x i8*] [i8* bitcast (i8** getelementptr inbounds ([4 x i8*]* @_ZTVN5Test11BE, i64 0, i64 3) to i8*)]
-// CHECK: @_ZTTN5Test41DE = weak_odr constant [19 x i8*] [i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 10) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 12) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 15) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 18) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 17) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 20) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 1, i64 0) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test41DE40_NS_2V1E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test41DE40_NS_2V1E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 10) to i8*)]
-// CHECK: @_ZTTN5Test31DE = weak_odr constant [13 x i8*] [i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 5) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE0_NS_2C1E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE0_NS_2C1E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 10) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 15) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 11) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 11) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 1, i64 0) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE64_NS_2V2E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE64_NS_2V2E, i64 0, i64 6) to i8*)]
-// CHECK: @_ZTTN5Test21CE = weak_odr constant [2 x i8*] [i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*)]
+// CHECK: @_ZTTN5Test11BE = unnamed_addr constant [1 x i8*] [i8* bitcast (i8** getelementptr inbounds ([4 x i8*]* @_ZTVN5Test11BE, i64 0, i64 3) to i8*)]
+// CHECK: @_ZTTN5Test41DE = linkonce_odr unnamed_addr constant [19 x i8*] [i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 10) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 12) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 15) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 18) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 17) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 20) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 1, i64 0) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test41DE40_NS_2V1E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test41DE40_NS_2V1E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 10) to i8*)]
+// CHECK: @_ZTTN5Test31DE = linkonce_odr unnamed_addr constant [13 x i8*] [i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 5) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE0_NS_2C1E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE0_NS_2C1E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 10) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 15) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 11) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 11) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 1, i64 0) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE64_NS_2V2E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE64_NS_2V2E, i64 0, i64 6) to i8*)]
+// CHECK: @_ZTTN5Test21CE = linkonce_odr unnamed_addr constant [2 x i8*] [i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*)]
diff --git a/test/CodeGenCXX/warn-padded-packed.cpp b/test/CodeGenCXX/warn-padded-packed.cpp
new file mode 100644
index 000000000000..4203bb3dda10
--- /dev/null
+++ b/test/CodeGenCXX/warn-padded-packed.cpp
@@ -0,0 +1,76 @@
+// RUN: %clang_cc1 -triple=x86_64-none-none -Wpadded -Wpacked -verify %s -emit-llvm-only
+
+struct S1 {
+ char c;
+ short s; // expected-warning {{padding struct 'S1' with 1 byte to align 's'}}
+ long l; // expected-warning {{padding struct 'S1' with 4 bytes to align 'l'}}
+};
+
+struct S2 { // expected-warning {{padding size of 'S2' with 3 bytes to alignment boundary}}
+ int i;
+ char c;
+};
+
+struct S3 {
+ char c;
+ int i;
+} __attribute__((packed));
+
+struct S4 {
+ int i; // expected-warning {{packed attribute is unnecessary for 'i'}}
+ char c;
+} __attribute__((packed));
+
+struct S5 {
+ char c;
+ union {
+ char c;
+ int i;
+ } u; // expected-warning {{padding struct 'S5' with 3 bytes to align 'u'}}
+};
+
+struct S6 { // expected-warning {{padding size of 'S6' with 30 bits to alignment boundary}}
+ int i : 2;
+};
+
+struct S7 { // expected-warning {{padding size of 'S7' with 7 bytes to alignment boundary}}
+ char c;
+ virtual void m();
+};
+
+struct B {
+ char c;
+};
+
+struct S8 : B {
+ int i; // expected-warning {{padding struct 'S8' with 3 bytes to align 'i'}}
+};
+
+struct S9 { // expected-warning {{packed attribute is unnecessary for 'S9'}}
+ int x; // expected-warning {{packed attribute is unnecessary for 'x'}}
+ int y; // expected-warning {{packed attribute is unnecessary for 'y'}}
+} __attribute__((packed));
+
+struct S10 { // expected-warning {{packed attribute is unnecessary for 'S10'}}
+ int x; // expected-warning {{packed attribute is unnecessary for 'x'}}
+ char a,b,c,d;
+} __attribute__((packed));
+
+
+struct S11 {
+ bool x;
+ char a,b,c,d;
+} __attribute__((packed));
+
+struct S12 {
+ bool b : 1;
+ char c; // expected-warning {{padding struct 'S12' with 7 bits to align 'c'}}
+};
+
+struct S13 { // expected-warning {{padding size of 'S13' with 6 bits to alignment boundary}}
+ char c;
+ bool b : 10; // expected-warning {{size of bit-field 'b' (10 bits) exceeds the size of its type}}
+};
+
+// The warnings are emitted when the layout of the structs is computed, so we have to use them.
+void f(S1*, S2*, S3*, S4*, S5*, S6*, S7*, S8*, S9*, S10*, S11*, S12*, S13*) { }
diff --git a/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m b/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m
new file mode 100644
index 000000000000..2515c706a9bf
--- /dev/null
+++ b/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple armv7-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-ARM %s
+// rdar://7761305
+
+@interface I
+@property long long LONG_PROP;
+@end
+
+@implementation I
+@synthesize LONG_PROP;
+@end
+// CHECK-ARM: call arm_aapcscc void @objc_copyStruct(i8* %{{.*}}, i8* %{{.*}}, i32 8, i1 zeroext true, i1 zeroext false)
+// CHECK-ARM: call arm_aapcscc void @objc_copyStruct(i8* %{{.*}}, i8* %{{.*}}, i32 8, i1 zeroext true, i1 zeroext false)
+
diff --git a/test/CodeGenObjC/bitfield-gnu.m b/test/CodeGenObjC/bitfield-gnu.m
new file mode 100644
index 000000000000..7935bdaacf04
--- /dev/null
+++ b/test/CodeGenObjC/bitfield-gnu.m
@@ -0,0 +1,5 @@
+// RUN: %clang -S -emit-llvm -fgnu-runtime -o %t %s
+typedef enum { A1, A2 } A;
+typedef struct { A a : 1; } B;
+@interface Obj { B *b; } @end
+@implementation Obj @end
diff --git a/test/CodeGenObjC/block-6.m b/test/CodeGenObjC/block-6.m
new file mode 100644
index 000000000000..3720a87b9e56
--- /dev/null
+++ b/test/CodeGenObjC/block-6.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s
+// rdar://8893785
+
+void MYFUNC() {
+// CHECK: [[T1:%.*]] = bitcast i8* ()*
+// CHECK-NEXT: [[FORWARDING:%.*]] = getelementptr inbounds [[N_T:%.*]]* [[N:%.*]], i32 0, i32 1
+// CHECK-NEXT: [[T0:%.*]] = load [[N_T]]** [[FORWARDING]]
+// CHECK-NEXT: [[OBSERVER:%.*]] = getelementptr inbounds [[N_T]]* [[T0]], i32 0, i32 6
+// CHECK-NEXT: store i8* [[T1]], i8** [[OBSERVER]]
+ __block id observer = ^{ return observer; };
+}
+
diff --git a/test/CodeGenObjC/block-var-layout.m b/test/CodeGenObjC/block-var-layout.m
index bf9ba8df75e2..466dee1e9e96 100644
--- a/test/CodeGenObjC/block-var-layout.m
+++ b/test/CodeGenObjC/block-var-layout.m
@@ -1,6 +1,4 @@
-// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
+// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
struct S {
@@ -18,19 +16,38 @@ __weak id wid;
void x(id y) {}
void y(int a) {}
+extern id opaque_id();
+
void f() {
__block int byref_int = 0;
char ch = 'a';
char ch1 = 'b';
char ch2 = 'c';
short sh = 2;
- const id bar = (id)0;
+ const id bar = (id) opaque_id();
id baz = 0;
__strong void *strong_void_sta;
__block id byref_bab = (id)0;
__block void *bl_var1;
int i; double dob;
+// The patterns here are a sequence of bytes, each saying first how
+// many sizeof(void*) chunks to skip (high nibble) and then how many
+// to scan (low nibble). A zero byte says that we've reached the end
+// of the pattern.
+//
+// All of these patterns start with 01 3x because the block header on
+// LP64 consists of an isa pointer (which we're supposed to scan for
+// some reason) followed by three words (2 ints, a function pointer,
+// and a descriptor pointer).
+
+// FIXME: do these really have to be named L_OBJC_CLASS_NAME_xxx?
+// FIXME: sequences should never end in x0 00 instead of just 00
+
+// Test 1
+// byref int, short, char, char, char, id, id, strong void*, byref id
+// 01 35 10 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\015\10\00"
void (^b)() = ^{
byref_int = sh + ch+ch1+ch2 ;
x(bar);
@@ -41,6 +58,9 @@ void f() {
b();
// Test 2
+// byref int, short, char, char, char, id, id, strong void*, byref void*, byref id
+// 01 36 10 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\016\10\00"
void (^c)() = ^{
byref_int = sh + ch+ch1+ch2 ;
x(bar);
@@ -53,7 +73,11 @@ void f() {
c();
// Test 3
-void (^d)() = ^{
+// byref int, short, char, char, char, id, id, byref void*, int, double, byref id
+// 01 34 11 30 00
+// FIXME: we'd get a better format here if we sorted by scannability, not just alignment
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\014\11 \00"
+ void (^d)() = ^{
byref_int = sh + ch+ch1+ch2 ;
x(bar);
x(baz);
@@ -64,7 +88,10 @@ void (^d)() = ^{
};
d();
-// Test4
+// Test 4
+// struct S (int, id, int, id, int, id)
+// 01 41 11 11
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\01A\11\11\00"
struct S s2;
void (^e)() = ^{
x(s2.o1);
@@ -74,7 +101,7 @@ void (^d)() = ^{
// Test 5 (unions/structs and their nesting):
void Test5() {
-struct S5 {
+ struct S5 {
int i1;
id o1;
struct V {
@@ -88,36 +115,52 @@ struct S5 {
int i3;
id o3;
}ui;
-};
+ };
-union U {
+ union U {
void * i1;
id o1;
int i3;
id o3;
-}ui;
+ }ui;
-struct S5 s2;
-union U u2;
-void (^c)() = ^{
+ struct S5 s2;
+ union U u2;
+
+// struct s2 (int, id, int, id, int, id?), union u2 (id?)
+// 01 41 11 12 70 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [6 x i8] c"\01A\11\12p\00"
+ void (^c)() = ^{
x(s2.ui.o1);
x(u2.o1);
-};
-c();
-
+ };
+ c();
}
-// CHECK-LP64: L_OBJC_CLASS_NAME_:
-// CHECK-LP64-NEXT: .asciz "A\024"
-
-// CHECK-LP64: L_OBJC_CLASS_NAME_1:
-// CHECK-LP64-NEXT: .asciz "A\025"
-
-// CHECK-LP64: L_OBJC_CLASS_NAME_6:
-// CHECK-LP64-NEXT: .asciz "A\023!"
-
-// CHECK-LP64: L_OBJC_CLASS_NAME_11:
-// CHECK-LP64-NEXT: .asciz "Q\021\021"
+// rdar: //8417746
+void CFRelease(id);
+void notifyBlock(id dependentBlock) {
+ id singleObservationToken;
+ id token;
+ void (^b)();
+
+// id, id, void(^)()
+// 01 33 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [3 x i8] c"\013\00"
+ void (^wrapperBlock)() = ^() {
+ CFRelease(singleObservationToken);
+ CFRelease(singleObservationToken);
+ CFRelease(token);
+ CFRelease(singleObservationToken);
+ b();
+ };
+ wrapperBlock();
+}
-// CHECK-LP64: L_OBJC_CLASS_NAME_14:
-// CHECK-LP64-NEXT: .asciz "Q\021\022p"
+void test_empty_block() {
+// 01 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [2 x i8] c"\01\00"
+ void (^wrapperBlock)() = ^() {
+ };
+ wrapperBlock();
+}
diff --git a/test/CodeGenObjC/blocks-1.m b/test/CodeGenObjC/blocks-1.m
index 1ac9c30c8a00..55ce38fe9ef9 100644
--- a/test/CodeGenObjC/blocks-1.m
+++ b/test/CodeGenObjC/blocks-1.m
@@ -2,8 +2,8 @@
// RUN: grep "_Block_object_dispose" %t | count 6
// RUN: grep "__copy_helper_block_" %t | count 4
// RUN: grep "__destroy_helper_block_" %t | count 4
-// RUN: grep "__Block_byref_id_object_copy_" %t | count 2
-// RUN: grep "__Block_byref_id_object_dispose_" %t | count 2
+// RUN: grep "__Block_byref_object_copy_" %t | count 2
+// RUN: grep "__Block_byref_object_dispose_" %t | count 2
// RUN: grep "i32 135)" %t | count 0
// RUN: grep "_Block_object_assign" %t | count 4
// RUN: grep "objc_read_weak" %t | count 2
@@ -12,8 +12,8 @@
// RUN: grep "_Block_object_dispose" %t | count 6
// RUN: grep "__copy_helper_block_" %t | count 4
// RUN: grep "__destroy_helper_block_" %t | count 4
-// RUN: grep "__Block_byref_id_object_copy_" %t | count 2
-// RUN: grep "__Block_byref_id_object_dispose_" %t | count 2
+// RUN: grep "__Block_byref_object_copy_" %t | count 2
+// RUN: grep "__Block_byref_object_dispose_" %t | count 2
// RUN: grep "i32 135)" %t | count 0
// RUN: grep "_Block_object_assign" %t | count 4
// RUN: grep "objc_read_weak" %t | count 2
diff --git a/test/CodeGenObjC/blocks-2.m b/test/CodeGenObjC/blocks-2.m
index 0062e842648b..38b863560998 100644
--- a/test/CodeGenObjC/blocks-2.m
+++ b/test/CodeGenObjC/blocks-2.m
@@ -1,12 +1,37 @@
-// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
-// RUN: grep "objc_assign_strongCast" %t | count 2
-// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
-// RUN: grep "objc_assign_strongCast" %t | count 2
+// We run this twice, once as Objective-C and once as Objective-C++.
+// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -fexceptions -triple i386-apple-darwin10 -x objective-c++ | FileCheck %s
-// This should generate a strong cast.
-id test3(id x) {
+// CHECK: define i8* @{{.*}}test0
+// CHECK: define internal void @__test0_block_invoke_0(
+// CHECK: call i8* @objc_assign_strongCast(
+// CHECK-NEXT: ret void
+id test0(id x) {
__block id result;
^{ result = x; }();
return result;
}
+
+// <rdar://problem/8224178>: cleanup __block variables on EH path
+// CHECK: define void @{{.*}}test1
+void test1() {
+ extern void test1_help(void (^x)(void));
+
+ // CHECK: [[N:%.*]] = alloca [[N_T:%.*]], align 8
+ // CHECK: [[T0:%.*]] = getelementptr inbounds [[N_T]]* [[N]], i32 0, i32 4
+ // CHECK-NEXT: store double 1.000000e+{{0?}}01, double* [[T0]], align 8
+ __block double n = 10;
+
+ // CHECK: invoke void @{{.*}}test1_help
+ test1_help(^{ n = 20; });
+
+ // CHECK: [[T1:%.*]] = bitcast [[N_T]]* [[N]] to i8*
+ // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T1]], i32 8)
+ // CHECK-NEXT: ret void
+
+ // CHECK: call i8* @llvm.eh.exception()
+ // CHECK: [[T1:%.*]] = bitcast [[N_T]]* [[N]] to i8*
+ // CHECK-NEXT: call void @_Block_object_dispose(i8* [[T1]], i32 8)
+ // CHECK: call void @_Unwind_Resume_or_Rethrow(
+}
diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m
index b96a8d942fac..11fb55b58c48 100644
--- a/test/CodeGenObjC/blocks.m
+++ b/test/CodeGenObjC/blocks.m
@@ -1,13 +1,12 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s
-// rdar://6676764
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o - %s | FileCheck %s
+// test1. All of this is somehow testing rdar://6676764
struct S {
void (^F)(struct S*);
} P;
@interface T
-
- (int)foo: (T (^)(T*)) x;
@end
@@ -19,7 +18,7 @@ void foo(T *P) {
-(void) im0;
@end
-// RUN: grep 'define internal i32 @"__8-\[A im0\]_block_invoke_0"' %t
+// CHECK: define internal i32 @"__8-[A im0]_block_invoke_0"(
@implementation A
-(void) im0 {
(void) ^{ return 1; }();
@@ -39,3 +38,52 @@ void foo(T *P) {
}
@end
+// rdar://problem/9006315
+// In-depth test for the initialization of a __weak __block variable.
+@interface Test2 -(void) destroy; @end
+void test2(Test2 *x) {
+ extern void test2_helper(void (^)(void));
+ // CHECK: define void @test2(
+ // CHECK: [[X:%.*]] = alloca [[TEST2:%.*]]*,
+ // CHECK-NEXT: [[WEAKX:%.*]] = alloca [[WEAK_T:%.*]],
+ // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:%.*]],
+ // CHECK-NEXT: store [[TEST2]]*
+
+ // isa=1 for weak byrefs.
+ // CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 0
+ // CHECK-NEXT: store i8* inttoptr (i32 1 to i8*), i8** [[T0]]
+
+ // Forwarding.
+ // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 1
+ // CHECK-NEXT: store [[WEAK_T]]* [[WEAKX]], [[WEAK_T]]** [[T1]]
+
+ // Flags. This is just BLOCK_HAS_COPY_DISPOSE.
+ // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 2
+ // CHECK-NEXT: store i32 33554432, i32* [[T2]]
+
+ // Size.
+ // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 3
+ // CHECK-NEXT: store i32 28, i32* [[T3]]
+
+ // Copy and dipose helpers.
+ // CHECK-NEXT: [[T4:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 4
+ // CHECK-NEXT: store i8* bitcast (void (i8*, i8*)* @__Block_byref_object_copy_{{.*}} to i8*), i8** [[T4]]
+ // CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 5
+ // CHECK-NEXT: store i8* bitcast (void (i8*)* @__Block_byref_object_dispose_{{.*}} to i8*), i8** [[T5]]
+
+ // Actually capture the value.
+ // CHECK-NEXT: [[CAPTURE:%.*]] = load [[TEST2]]** [[X]]
+ // CHECK-NEXT: [[T6:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 6
+ // CHECK-NEXT: store [[TEST2]]* [[CAPTURE]], [[TEST2]]** [[T6]]
+
+ // Then we initialize the block, blah blah blah.
+ // CHECK: call void @test2_helper(
+
+ // Finally, kill the variable with BLOCK_FIELD_IS_BYREF. We're not
+ // supposed to pass BLOCK_FIELD_IS_WEAK here.
+ // CHECK: [[T0:%.*]] = bitcast [[WEAK_T]]* [[WEAKX]] to i8*
+ // CHECK: call void @_Block_object_dispose(i8* [[T0]], i32 8)
+
+ __weak __block Test2 *weakX = x;
+ test2_helper(^{ [weakX destroy]; });
+}
diff --git a/test/CodeGenObjC/constant-string-class.m b/test/CodeGenObjC/constant-string-class.m
new file mode 100644
index 000000000000..12253d6c70f3
--- /dev/null
+++ b/test/CodeGenObjC/constant-string-class.m
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fno-constant-cfstrings -fconstant-string-class Foo -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-FRAGILE < %t %s
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fno-constant-cfstrings -fconstant-string-class Foo -emit-llvm -o %t %s
+// RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s
+
+// rdar: // 8564463
+// PR6056
+
+@interface Object {
+ id isa;
+}
+@end
+
+@interface Foo : Object{
+ char *cString;
+ unsigned int len;
+}
+- (char *)customString;
+@end
+
+id _FooClassReference[20];
+
+@implementation Foo
+- (char *)customString { return cString ; }
+@end
+
+int main () {
+ Foo *string = @"bla";
+ return 0;
+}
+
+// CHECK-FRAGILE: @_FooClassReference = common global
+// CHECK-NONFRAGILE: @"OBJC_CLASS_$_Object" = external global
+// CHECK-NONFRAGILE: "OBJC_CLASS_$_Foo" = unnamed_addr global
diff --git a/test/CodeGenObjC/debug-info-default-synth-ivar.m b/test/CodeGenObjC/debug-info-default-synth-ivar.m
new file mode 100644
index 000000000000..967a361d6c48
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-default-synth-ivar.m
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t
+// RUN: grep DW_TAG_member %t | count 5
+// rdar://8493239
+
+@class NSString;
+
+@interface InstanceVariablesEverywhereButTheInterface
+@end
+
+@interface InstanceVariablesEverywhereButTheInterface()
+{
+ NSString *_someString;
+}
+
+@property(readonly) NSString *someString;
+@property(readonly) unsigned long someNumber;
+@end
+
+@implementation InstanceVariablesEverywhereButTheInterface
+{
+ unsigned long _someNumber;
+}
+@synthesize someString = _someString, someNumber = _someNumber;
+@end
+
+@interface AutomaticSynthesis
+{
+ int real_ivar;
+}
+@property(copy) NSString *someString;
+@property unsigned long someNumber;
+@end
+
+@implementation AutomaticSynthesis
+@end
diff --git a/test/CodeGenObjC/debug-info-fnname.m b/test/CodeGenObjC/debug-info-fnname.m
new file mode 100644
index 000000000000..f336d6b26875
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-fnname.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -emit-llvm -Os -g %s -o - | FileCheck %s
+// Radar 8653152
+@interface A {
+}
+@end
+
+
+// CHECK: llvm.dbg.lv.-.A.title.
+@implementation A
+-(int) title {
+ int x = 1;
+ return x;
+}
+@end
+
diff --git a/test/CodeGenObjC/debug-info-foreach.m b/test/CodeGenObjC/debug-info-foreach.m
new file mode 100644
index 000000000000..c056e0e249de
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-foreach.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t
+// RUN: grep DW_TAG_lexical_block %t | count 5
+// rdar://8757124
+
+@class NSArray;
+
+void f(NSArray *a) {
+ id keys;
+ for (id thisKey in keys) {
+ }
+ for (id thisKey in keys) {
+ }
+}
diff --git a/test/CodeGenObjC/debug-info-getter-name.m b/test/CodeGenObjC/debug-info-getter-name.m
new file mode 100644
index 000000000000..0263f112aeb4
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-getter-name.m
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -g %s -o %t
+// RUN: grep "\[InstanceVariablesEverywhereButTheInterface someString\]" %t | count 6
+
+//rdar: //8498026
+
+@class NSString;
+
+@interface InstanceVariablesEverywhereButTheInterface
+@end
+
+@interface InstanceVariablesEverywhereButTheInterface()
+{
+ NSString *_someString;
+}
+
+@property(readonly) NSString *someString;
+@property(readonly) unsigned long someNumber;
+@end
+
+@implementation InstanceVariablesEverywhereButTheInterface
+{
+ unsigned long _someNumber;
+}
+
+@synthesize someString = _someString, someNumber = _someNumber;
+
+- init {
+ return self;
+}
+@end
+
+@interface AutomaticSynthesis
+{
+ int real_ivar;
+}
+@property(copy) NSString *someString;
+@property unsigned long someNumber;
+@end
+
+@implementation AutomaticSynthesis
+- init
+{
+ return self;
+}
+@end
+
+int main()
+{
+ return 0;
+}
diff --git a/test/CodeGenObjC/debug-info-selector.m b/test/CodeGenObjC/debug-info-selector.m
new file mode 100644
index 000000000000..67642ac3bebe
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-selector.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
+// Radar 8494540
+
+// CHECK: objc_selector
+@interface MyClass {
+}
+- (id)init;
+@end
+
+@implementation MyClass
+- (id) init
+{
+ return self;
+}
+@end
diff --git a/test/CodeGenObjC/debug-info-self.m b/test/CodeGenObjC/debug-info-self.m
new file mode 100644
index 000000000000..9146ab3973c6
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-self.m
@@ -0,0 +1,16 @@
+// RUN: %clang -fverbose-asm -g -S %s -o - | grep DW_AT_artificial | count 3
+// self and _cmd are marked as DW_AT_artificial.
+// abbrev code emits another DT_artificial comment.
+// myarg is not marked as DW_AT_artificial.
+
+@interface MyClass {
+}
+- (id)init:(int) myarg;
+@end
+
+@implementation MyClass
+- (id) init:(int) myarg
+{
+ return self;
+}
+@end
diff --git a/test/CodeGenObjC/debug-info-static-var.m b/test/CodeGenObjC/debug-info-static-var.m
new file mode 100644
index 000000000000..3bcf5fd9e1f4
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-static-var.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -g -triple x86_64-apple-darwin10 -S -masm-verbose -o - %s | FileCheck %s
+// Radar 8801045
+// Do not emit AT_MIPS_linkage_name for static variable i
+
+// CHECK: DW_TAG_variable
+// CHECK-NEXT: .byte 105 ## DW_AT_name
+// CHECK-NEXT: .byte 0
+// CHECK-NEXT: DW_AT_type
+// CHECK-NEXT: DW_AT_decl_file
+// CHECK-NEXT: DW_AT_decl_line
+// CHECK-NEXT: DW_AT_location
+
+@interface A {
+}
+-(void) foo;
+@end
+
+@implementation A
+-(void)foo {
+ static int i = 1;
+}
+@end
+
diff --git a/test/CodeGenObjC/default-property-synthesis.m b/test/CodeGenObjC/default-property-synthesis.m
index b3eeb22004ae..72acb768a11a 100644
--- a/test/CodeGenObjC/default-property-synthesis.m
+++ b/test/CodeGenObjC/default-property-synthesis.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// rdar://7923851.
// Superclass declares property. Subclass redeclares the same property.
diff --git a/test/CodeGenObjC/encode-test-1.m b/test/CodeGenObjC/encode-test-1.m
deleted file mode 100644
index af7ad26d2f4b..000000000000
--- a/test/CodeGenObjC/encode-test-1.m
+++ /dev/null
@@ -1,36 +0,0 @@
-// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep -e "{Base=b2b3b4b5}" %t | count 1
-// RUN: grep -e "{Derived=b2b3b4b5b5b4b3}" %t | count 1
-
-enum Enum { one, two, three, four };
-
-@interface Base {
- unsigned a: 2;
- int b: 3;
- enum Enum c: 4;
- unsigned d: 5;
-}
-@end
-
-@interface Derived: Base {
- signed e: 5;
- int f: 4;
- enum Enum g: 3;
-}
-@end
-
-@implementation Base @end
-
-@implementation Derived @end
-
-int main(void)
-{
-
- const char *en = @encode(Base);
-// printf ("%s\n", en);
-
- const char *ed = @encode(Derived);
- // printf ("%s\n", ed);
-
- return 0;
-}
diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m
index 9d1cf6cec3c4..24a90a0b4b99 100644
--- a/test/CodeGenObjC/encode-test.m
+++ b/test/CodeGenObjC/encode-test.m
@@ -1,10 +1,7 @@
// RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep -e "\^{Innermost=CC}" %t | count 1
-// RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1
-// RUN: grep -e "{B1=#@c}" %t | count 1
-// RUN: grep -e "v12@0:4\[3\[4@]]8" %t | count 1
-// RUN: grep -e "r\^{S=i}" %t | count 1
-// RUN: grep -e "\^{Object=#}" %t | count 1
+// RUN: FileCheck < %t %s
+//
+// CHECK: @"\01L_OBJC_METH_VAR_TYPE_34" = internal global [16 x i8] c"v12@0:4[3[4@]]8\00"
@class Int1;
@@ -95,3 +92,55 @@ int main()
const char *ee = @encode(MyObj *const);
}
+// CHECK: @g0 = constant [15 x i8] c"{Innermost=CC}\00"
+const char g0[] = @encode(struct Innermost);
+
+// CHECK: @g1 = constant [38 x i8] c"{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}\00"
+const char g1[] = @encode(Derived);
+
+// CHECK: @g2 = constant [9 x i8] c"{B1=#@c}\00"
+const char g2[] = @encode(B1);
+
+// CHECK: @g3 = constant [8 x i8] c"r^{S=i}\00"
+const char g3[] = @encode(const struct S *);
+
+// CHECK: @g4 = constant [6 x i8] c"{S=i}\00"
+const char g4[] = @encode(const struct S);
+
+// CHECK: @g5 = constant [12 x i8] c"^{Object=#}\00"
+const char g5[] = @encode(MyObj * const);
+
+////
+
+enum Enum1X { one, two, three, four };
+
+@interface Base1X {
+ unsigned a: 2;
+ int b: 3;
+ enum Enum1X c: 4;
+ unsigned d: 5;
+}
+@end
+
+@interface Derived1X: Base1X {
+ signed e: 5;
+ int f: 4;
+ enum Enum1X g: 3;
+}
+@end
+
+@implementation Base1X @end
+
+@implementation Derived1X @end
+
+// CHECK: @g6 = constant [18 x i8] c"{Base1X=b2b3b4b5}\00"
+const char g6[] = @encode(Base1X);
+
+// CHECK: @g7 = constant [27 x i8] c"{Derived1X=b2b3b4b5b5b4b3}\00"
+const char g7[] = @encode(Derived1X);
+
+// CHECK: @g8 = constant [7 x i8] c"{s8=D}\00"
+struct s8 {
+ long double x;
+};
+const char g8[] = @encode(struct s8);
diff --git a/test/CodeGenObjC/exceptions-nonfragile.m b/test/CodeGenObjC/exceptions-nonfragile.m
new file mode 100644
index 000000000000..57ed1d9da9dd
--- /dev/null
+++ b/test/CodeGenObjC/exceptions-nonfragile.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -O2 -o - %s | FileCheck %s
+
+// rdar://problem/8535238
+// CHECK: declare void @objc_exception_rethrow()
+
+void protos() {
+ extern void foo();
+ @try {
+ foo();
+ } @catch (id e) {
+ @throw;
+ }
+}
+
+void throwing() {
+ @throw(@"error!");
+}
diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m
index b431e3712473..31805cb8df4e 100644
--- a/test/CodeGenObjC/exceptions.m
+++ b/test/CodeGenObjC/exceptions.m
@@ -29,10 +29,8 @@ void f1() {
// CHECK-NEXT: call void @foo()
foo();
// CHECK-NEXT: call void @objc_exception_try_exit
- // CHECK-NEXT: ret void
// CHECK: call void asm sideeffect "", "=*m"
- // CHECK-NEXT: ret void
} @finally {
break;
}
@@ -65,7 +63,6 @@ int f2() {
// CHECK-NEXT: call void @foo()
// CHECK-NEXT: call void @objc_exception_try_exit
// CHECK-NEXT: [[T:%.*]] = load i32* [[X]]
- // CHECK-NEXT: ret i32 [[T]]
foo();
} @catch (id) {
// Landing pad. Note that we elide the re-enter.
@@ -76,10 +73,9 @@ int f2() {
// This store is dead.
// CHECK-NEXT: store i32 [[T2]], i32* [[X]]
-
- // CHECK-NEXT: ret i32 [[T2]]
x--;
}
+
return x;
}
@@ -133,3 +129,59 @@ void f3() {
// CHECK-NEXT: ret void
f3_helper(4, &x);
}
+
+// rdar://problem/8440970
+void f4() {
+ extern void f4_help(int);
+
+ // CHECK: define void @f4()
+ // CHECK: [[EXNDATA:%.*]] = alloca [[EXNDATA_T:%.*]], align
+ // CHECK: call void @objc_exception_try_enter([[EXNDATA_T]]* [[EXNDATA]])
+ // CHECK: call i32 @_setjmp
+ @try {
+ // CHECK: call void @f4_help(i32 0)
+ f4_help(0);
+
+ // The finally cleanup has two threaded entrypoints after optimization:
+
+ // finally.no-call-exit: Predecessor is when the catch throws.
+ // CHECK: call i8* @objc_exception_extract([[EXNDATA_T]]* [[EXNDATA]])
+ // CHECK-NEXT: call void @f4_help(i32 2)
+ // CHECK-NEXT: br label
+ // -> rethrow
+
+ // finally.call-exit: Predecessors are the @try and @catch fallthroughs
+ // as well as the no-match case in the catch mechanism. The i1 is whether
+ // to rethrow and should be true only in the last case.
+ // CHECK: phi i1
+ // CHECK-NEXT: phi i8*
+ // CHECK-NEXT: call void @objc_exception_try_exit([[EXNDATA_T]]* [[EXNDATA]])
+ // CHECK-NEXT: call void @f4_help(i32 2)
+ // CHECK-NEXT: br i1
+ // -> ret, rethrow
+
+ // ret:
+ // CHECK: ret void
+
+ // Catch mechanism:
+ // CHECK: call i8* @objc_exception_extract([[EXNDATA_T]]* [[EXNDATA]])
+ // CHECK-NEXT: call void @objc_exception_try_enter([[EXNDATA_T]]* [[EXNDATA]])
+ // CHECK: call i32 @_setjmp
+ // -> next, finally.no-call-exit
+ // CHECK: call i32 @objc_exception_match
+ // -> finally.call-exit, match
+ } @catch (NSArray *a) {
+ // match:
+ // CHECK: call void @f4_help(i32 1)
+ // CHECK-NEXT: br label
+ // -> finally.call-exit
+ f4_help(1);
+ } @finally {
+ f4_help(2);
+ }
+
+ // rethrow:
+ // CHECK: phi i8*
+ // CHECK-NEXT: call void @objc_exception_throw(i8*
+ // CHECK-NEXT: unreachable
+}
diff --git a/test/CodeGenObjC/implicit-objc_msgSend.m b/test/CodeGenObjC/implicit-objc_msgSend.m
index a21e869229a7..322f82e920a0 100644
--- a/test/CodeGenObjC/implicit-objc_msgSend.m
+++ b/test/CodeGenObjC/implicit-objc_msgSend.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep -F 'declare i8* @objc_msgSend(...)' %t
+// RUN: grep -F 'declare i8* @objc_msgSend(i8*, i8*, ...)' %t
typedef struct objc_selector *SEL;
id f0(id x, SEL s) {
diff --git a/test/CodeGenObjC/interface-layout-64.m b/test/CodeGenObjC/interface-layout-64.m
index 2800b41c5246..af898bbedd81 100644
--- a/test/CodeGenObjC/interface-layout-64.m
+++ b/test/CodeGenObjC/interface-layout-64.m
@@ -5,8 +5,8 @@
// RUN: grep '@"OBJC_IVAR_$_I3._iv3" = global i64 12, section "__DATA, __objc_const", align 8' %t
// RUN: grep '@"OBJC_IVAR_$_I4._iv4" = global i64 13, section "__DATA, __objc_const", align 8' %t
// RUN: grep '@"OBJC_IVAR_$_I5._iv5" = global i64 14, section "__DATA, __objc_const", align 8' %t
-// RUN: grep '@"OBJC_IVAR_$_I5._iv6_synth" = global i64 16, section "__DATA, __objc_const", align 8' %t
-// RUN: grep '@"OBJC_IVAR_$_I5._iv7_synth" = global i64 20, section "__DATA, __objc_const", align 8' %t
+// RUN: grep '@"OBJC_IVAR_$_I5._iv6_synth" = hidden global i64 16, section "__DATA, __objc_const", align 8' %t
+// RUN: grep '@"OBJC_IVAR_$_I5._iv7_synth" = hidden global i64 20, section "__DATA, __objc_const", align 8' %t
// RUN: grep '@"OBJC_IVAR_$_I6.iv0" = global i64 0, section "__DATA, __objc_const", align 8' %t
// RUN: grep '@"OBJC_IVAR_$_I8.b" = global i64 8, section "__DATA, __objc_const", align 8' %t
// RUN: grep '@"OBJC_IVAR_$_I9.iv0" = global i64 0, section "__DATA, __objc_const", align 8' %t
diff --git a/test/CodeGenObjC/ivar-layout-64-bitfields.m b/test/CodeGenObjC/ivar-layout-64-bitfields.m
index 9710e16172df..700ce18d74cb 100644
--- a/test/CodeGenObjC/ivar-layout-64-bitfields.m
+++ b/test/CodeGenObjC/ivar-layout-64-bitfields.m
@@ -1,5 +1,10 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+
+#ifdef __cplusplus
+typedef bool _Bool;
+#endif
+
@interface I
{
struct {
diff --git a/test/CodeGenObjC/ivar-layout-array0-struct.m b/test/CodeGenObjC/ivar-layout-array0-struct.m
new file mode 100644
index 000000000000..4300db36415a
--- /dev/null
+++ b/test/CodeGenObjC/ivar-layout-array0-struct.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
+
+// rdar://8800513
+@interface NSObject {
+ id isa;
+}
+@end
+
+typedef struct {
+ id b;
+} st;
+
+@interface Test : NSObject {
+ int a;
+ st b[0];
+}
+@end
+
+@implementation Test @end
+// CHECK-LP64: L_OBJC_CLASS_NAME_4:
+// CHECK-LP64-NEXT: .asciz "\001\020"
diff --git a/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m b/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m
index b474caa7a48a..012ccadd9f92 100644
--- a/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m
+++ b/test/CodeGenObjC/ivar-layout-nonfragile-abi2.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -emit-llvm -o %t %s
-// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// rdar: // 7824380
@interface Super {
diff --git a/test/CodeGenObjC/ivars.m b/test/CodeGenObjC/ivars.m
index fe178aba14bd..98c39b7a844b 100644
--- a/test/CodeGenObjC/ivars.m
+++ b/test/CodeGenObjC/ivars.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s
// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s
+// RUN: %clang_cc1 -fobjc-gc -emit-llvm -o - %s
// rdar://6800926
@interface ITF {
@@ -12,3 +13,17 @@
void foo(ITF *P) {
P->boolfield = 1;
}
+
+// rdar://8368320
+@interface R {
+ struct {
+ union {
+ int x;
+ char c;
+ };
+ } _union;
+}
+@end
+
+@implementation R
+@end
diff --git a/test/CodeGenObjC/local-static-block.m b/test/CodeGenObjC/local-static-block.m
new file mode 100644
index 000000000000..a40abb26ea79
--- /dev/null
+++ b/test/CodeGenObjC/local-static-block.m
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -emit-llvm %s -o %t-64.ll
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.ll %s
+// rdar: // 8390455
+
+@class NSArray;
+
+static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
+
+ for(id rawAddress in addresses)
+ {
+ NSArray *separatedAddresses = ((NSArray*)0);
+ separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
+ }
+ return (NSArray *)0;
+};
+
+void FUNC()
+{
+ static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
+
+ for(id rawAddress in addresses)
+ {
+ NSArray *separatedAddresses = ((NSArray*)0);
+ separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
+ }
+ return (NSArray *)0;
+ };
+
+ if (ArrayRecurs) {
+ static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
+
+ for(id rawAddress in addresses)
+ {
+ NSArray *separatedAddresses = ((NSArray*)0);
+ separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
+ }
+ return (NSArray *)0;
+ };
+ }
+}
+
+void FUNC1()
+{
+ static NSArray *(^ArrayRecurs)(NSArray *addresses, unsigned long level) = ^(NSArray *addresses, unsigned long level) {
+
+ for(id rawAddress in addresses)
+ {
+ NSArray *separatedAddresses = ((NSArray*)0);
+ separatedAddresses = ArrayRecurs((NSArray *)rawAddress, level+1);
+ }
+ return (NSArray *)0;
+ };
+}
+// CHECK-LP64: @ArrayRecurs = internal global
+// CHECK-LP64: @FUNC.ArrayRecurs = internal global
+// CHECK-LP64: @FUNC.ArrayRecurs3 = internal global
+// CHECK-LP64: @FUNC1.ArrayRecurs = internal global
diff --git a/test/CodeGenObjC/ns-constant-strings.m b/test/CodeGenObjC/ns-constant-strings.m
index 3ef5f558422c..389132bd05ee 100644
--- a/test/CodeGenObjC/ns-constant-strings.m
+++ b/test/CodeGenObjC/ns-constant-strings.m
@@ -31,3 +31,9 @@ int main() {
// CHECK-FRAGILE: @_NSConstantStringClassReference = external global
// CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global
+
+// CHECK-FRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00"
+// CHECK-FRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00"
+
+// CHECK-NONFRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00"
+// CHECK-NONFRAGILE: @.str1 = private unnamed_addr constant [7 x i8] c"MyApp1\00"
diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m
index 1ddbcaffac6f..fa7a6f982131 100644
--- a/test/CodeGenObjC/objc-read-weak-byref.m
+++ b/test/CodeGenObjC/objc-read-weak-byref.m
@@ -21,5 +21,5 @@ int main() {
// CHECK-LP64: callq _objc_read_weak
// CHECK-LP64: callq _objc_read_weak
-// CHECK-LP32: call L_objc_read_weak
-// CHECK-LP32: call L_objc_read_weak
+// CHECK-LP32: calll L_objc_read_weak
+// CHECK-LP32: calll L_objc_read_weak
diff --git a/test/CodeGenObjC/objc2-nonfragile-abi-impl.m b/test/CodeGenObjC/objc2-nonfragile-abi-impl.m
index ff943303b746..cb830b8dcc92 100644
--- a/test/CodeGenObjC/objc2-nonfragile-abi-impl.m
+++ b/test/CodeGenObjC/objc2-nonfragile-abi-impl.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s
// rdar://7547942.
@interface Base @end
diff --git a/test/CodeGenObjC/objc2-weak-block-call.m b/test/CodeGenObjC/objc2-weak-block-call.m
index a3514b0caa0c..8cd233e286b2 100644
--- a/test/CodeGenObjC/objc2-weak-block-call.m
+++ b/test/CodeGenObjC/objc2-weak-block-call.m
@@ -1,7 +1,5 @@
-// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s
-// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
-// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s
-// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
+// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s
+// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s
@interface MyView
- (void)MyView_sharedInit;
@@ -21,9 +19,6 @@ void foo(MyView *(^obj)(void)) ;
}
@end
-// CHECK-LP64: callq _objc_read_weak
-// CHECK-LP64: callq _objc_read_weak
-
-// CHECK-LP32: call L_objc_read_weak
-// CHECK-LP32: call L_objc_read_weak
+// CHECK-LP64: call i8* @objc_read_weak
+// CHECK-LP32: call i8* @objc_read_weak
diff --git a/test/CodeGenObjC/predefined-expr.m b/test/CodeGenObjC/predefined-expr.m
index 772093bd8a0e..43d329e2ab1d 100644
--- a/test/CodeGenObjC/predefined-expr.m
+++ b/test/CodeGenObjC/predefined-expr.m
@@ -1,15 +1,15 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck %s
-// CHECK: @"__func__.-[Foo instanceTest1]" = private constant [21 x i8] c"-[Foo instanceTest1]\00"
-// CHECK: @"__func__.-[Foo instanceTest2:]" = private constant [22 x i8] c"-[Foo instanceTest2:]\00"
-// CHECK: @"__func__.-[Foo instanceTest3:withB:]" = private constant [28 x i8] c"-[Foo instanceTest3:withB:]\00"
-// CHECK: @"__func__.-[Foo instanceTest4]" = private constant [21 x i8] c"-[Foo instanceTest4]\00"
-// CHECK: @"__func__.+[Foo classTest1]" = private constant [18 x i8] c"+[Foo classTest1]\00"
-// CHECK: @"__func__.+[Foo classTest2:]" = private constant [19 x i8] c"+[Foo classTest2:]\00"
-// CHECK: @"__func__.+[Foo classTest3:withB:]" = private constant [25 x i8] c"+[Foo classTest3:withB:]\00"
-// CHECK: @"__func__.+[Foo classTest4]" = private constant [18 x i8] c"+[Foo classTest4]\00"
-// CHECK: @"__func__.-[Foo(Category) instanceTestWithCategory]" = private constant [42 x i8] c"-[Foo(Category) instanceTestWithCategory]\00"
-// CHECK: @"__func__.+[Foo(Category) classTestWithCategory]" = private constant [39 x i8] c"+[Foo(Category) classTestWithCategory]\00"
+// CHECK: @"__func__.-[Foo instanceTest1]" = private unnamed_addr constant [21 x i8] c"-[Foo instanceTest1]\00"
+// CHECK: @"__func__.-[Foo instanceTest2:]" = private unnamed_addr constant [22 x i8] c"-[Foo instanceTest2:]\00"
+// CHECK: @"__func__.-[Foo instanceTest3:withB:]" = private unnamed_addr constant [28 x i8] c"-[Foo instanceTest3:withB:]\00"
+// CHECK: @"__func__.-[Foo instanceTest4]" = private unnamed_addr constant [21 x i8] c"-[Foo instanceTest4]\00"
+// CHECK: @"__func__.+[Foo classTest1]" = private unnamed_addr constant [18 x i8] c"+[Foo classTest1]\00"
+// CHECK: @"__func__.+[Foo classTest2:]" = private unnamed_addr constant [19 x i8] c"+[Foo classTest2:]\00"
+// CHECK: @"__func__.+[Foo classTest3:withB:]" = private unnamed_addr constant [25 x i8] c"+[Foo classTest3:withB:]\00"
+// CHECK: @"__func__.+[Foo classTest4]" = private unnamed_addr constant [18 x i8] c"+[Foo classTest4]\00"
+// CHECK: @"__func__.-[Foo(Category) instanceTestWithCategory]" = private unnamed_addr constant [42 x i8] c"-[Foo(Category) instanceTestWithCategory]\00"
+// CHECK: @"__func__.+[Foo(Category) classTestWithCategory]" = private unnamed_addr constant [39 x i8] c"+[Foo(Category) classTestWithCategory]\00"
int printf(const char * _Format, ...);
diff --git a/test/CodeGenObjC/property-ref-cast-to-void.m b/test/CodeGenObjC/property-ref-cast-to-void.m
new file mode 100644
index 000000000000..a365aa56e84d
--- /dev/null
+++ b/test/CodeGenObjC/property-ref-cast-to-void.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
+
+// rdar: // 8399655
+@interface TestClass
+@property (readonly) int myProperty;
+- (int)myProperty;
+- (double)myGetter;
+@end
+
+void FUNC () {
+ TestClass *obj;
+ (void)obj.myProperty;
+ (void)obj.myGetter;
+}
+
+// CHECK: call i32 bitcast
+// CHECK: call double bitcast
diff --git a/test/CodeGenObjC/property-type-mismatch.m b/test/CodeGenObjC/property-type-mismatch.m
new file mode 100644
index 000000000000..7045947b1abf
--- /dev/null
+++ b/test/CodeGenObjC/property-type-mismatch.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s
+// rdar://8966864
+
+@interface Foo
+-(float)myfo;
+-(void)setMyfo: (int)p;
+@end
+
+void bar(Foo *x) {
+ x.myfo++;
+}
+
+// CHECK: [[C1:%.*]] = call float bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK: [[I:%.*]] = fadd float [[C1]], 1.000000e+00
+// CHECK: [[CONV:%.*]] = fptosi float [[I]] to i32
+// CHECK: [[T3:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_2"
+// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m
index 7160b16c447e..dd0786eb30ee 100644
--- a/test/CodeGenObjC/property.m
+++ b/test/CodeGenObjC/property.m
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// TODO: actually test most of this instead of just emitting it
int printf(const char *, ...);
@@ -50,3 +52,54 @@ int printf(const char *, ...);
return 10;
}
@end
+
+// Test that compound operations only compute the base once.
+// CHECK: define void @test2
+A *test2_helper(void);
+void test2() {
+ // CHECK: [[BASE:%.*]] = call [[A:%.*]]* @test2_helper()
+ // CHECK-NEXT: [[SEL:%.*]] = load i8**
+ // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8*
+ // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[BASETMP]], i8* [[SEL]])
+ // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[LD]], 1
+ // CHECK-NEXT: [[SEL:%.*]] = load i8**
+ // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8*
+ // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* [[BASETMP]], i8* [[SEL]], i32 [[ADD]])
+ test2_helper().dyn++;
+
+ // CHECK: [[BASE:%.*]] = call [[A]]* @test2_helper()
+ // CHECK-NEXT: [[SEL:%.*]] = load i8**
+ // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8*
+ // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[BASETMP]], i8* [[SEL]])
+ // CHECK-NEXT: [[ADD:%.*]] = mul nsw i32 [[LD]], 10
+ // CHECK-NEXT: [[SEL:%.*]] = load i8**
+ // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8*
+ // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* [[BASETMP]], i8* [[SEL]], i32 [[ADD]])
+ test2_helper().dyn *= 10;
+}
+
+// Test aggregate initialization from property reads.
+// Not crashing is good enough for the property-specific test.
+struct test3_struct { int x,y,z; };
+struct test3_nested { struct test3_struct t; };
+@interface test3_object
+@property struct test3_struct s;
+@end
+void test3(test3_object *p) {
+ struct test3_struct array[1] = { p.s };
+ struct test3_nested agg = { p.s };
+}
+
+// PR8742
+@interface Test4 {}
+@property float f;
+@end
+// CHECK: define void @test4
+void test4(Test4 *t) {
+ extern int test4_printf(const char *, ...);
+ // CHECK: [[TMP:%.*]] = call float {{.*}} @objc_msgSend
+ // CHECK-NEXT: [[EXT:%.*]] = fpext float [[TMP]] to double
+ // CHECK-NEXT: call i32 (i8*, ...)* @test4_printf(i8* {{.*}}, double [[EXT]])
+ // CHECK-NEXT: ret void
+ test4_printf("%.2f", t.f);
+}
diff --git a/test/CodeGenObjCXX/block-var-layout.mm b/test/CodeGenObjCXX/block-var-layout.mm
new file mode 100644
index 000000000000..363e21497ec7
--- /dev/null
+++ b/test/CodeGenObjCXX/block-var-layout.mm
@@ -0,0 +1,157 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -emit-llvm %s -o %t-64.ll
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.ll %s
+
+// See commentary in test/CodeGenObjC/block-var-layout.m, from which
+// this is largely cloned.
+
+struct S {
+ int i1;
+ id o1;
+ struct V {
+ int i2;
+ id o2;
+ } v1;
+ int i3;
+ id o3;
+};
+
+__weak id wid;
+void x(id y) {}
+void y(int a) {}
+
+extern id opaque_id();
+
+void f() {
+ __block int byref_int = 0;
+ char ch = 'a';
+ char ch1 = 'b';
+ char ch2 = 'c';
+ short sh = 2;
+ const id bar = (id) opaque_id();
+ id baz = 0;
+ __strong void *strong_void_sta;
+ __block id byref_bab = (id)0;
+ __block void *bl_var1;
+ int i; double dob;
+
+// Test 1
+// byref int, short, char, char, char, id, id, strong void*, byref id
+// 01 35 10 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\015\10\00"
+ void (^b)() = ^{
+ byref_int = sh + ch+ch1+ch2 ;
+ x(bar);
+ x(baz);
+ x((id)strong_void_sta);
+ x(byref_bab);
+ };
+ b();
+
+// Test 2
+// byref int, short, char, char, char, id, id, strong void*, byref void*, byref id
+// 01 36 10 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [4 x i8] c"\016\10\00"
+ void (^c)() = ^{
+ byref_int = sh + ch+ch1+ch2 ;
+ x(bar);
+ x(baz);
+ x((id)strong_void_sta);
+ x(wid);
+ bl_var1 = 0;
+ x(byref_bab);
+ };
+ c();
+
+// Test 3
+// byref int, short, char, char, char, id, id, byref void*, int, double, byref id
+// 01 34 11 30 00
+// FIXME: we'd get a better format here if we sorted by scannability, not just alignment
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\014\11 \00"
+void (^d)() = ^{
+ byref_int = sh + ch+ch1+ch2 ;
+ x(bar);
+ x(baz);
+ x(wid);
+ bl_var1 = 0;
+ y(i + dob);
+ x(byref_bab);
+ };
+ d();
+
+// Test4
+// struct S (int, id, int, id, int, id)
+// 01 41 11 11
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\01A\11\11\00"
+ struct S s2;
+ void (^e)() = ^{
+ x(s2.o1);
+ };
+ e();
+}
+
+// Test 5 (unions/structs and their nesting):
+void Test5() {
+ struct S5 {
+ int i1;
+ id o1;
+ struct V {
+ int i2;
+ id o2;
+ } v1;
+ int i3;
+ union UI {
+ void * i1;
+ id o1;
+ int i3;
+ id o3;
+ }ui;
+ };
+
+ union U {
+ void * i1;
+ id o1;
+ int i3;
+ id o3;
+ }ui;
+
+ struct S5 s2;
+ union U u2;
+
+// struct s2 (int, id, int, id, int, id?), union u2 (id?)
+// 01 41 11 12 70 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [6 x i8] c"\01A\11\12p\00"
+ void (^c)() = ^{
+ x(s2.ui.o1);
+ x(u2.o1);
+ };
+ c();
+
+}
+
+// rdar: //8417746
+void CFRelease(id);
+void notifyBlock(id dependentBlock) {
+ id singleObservationToken;
+ id token;
+ void (^b)();
+
+// id, id, void(^)()
+// 01 33 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [3 x i8] c"\013\00"
+ void (^wrapperBlock)() = ^() {
+ CFRelease(singleObservationToken);
+ CFRelease(singleObservationToken);
+ CFRelease(token);
+ CFRelease(singleObservationToken);
+ b();
+ };
+ wrapperBlock();
+}
+
+void test_empty_block() {
+// 01 00
+// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [2 x i8] c"\01\00"
+ void (^wrapperBlock)() = ^() {
+ };
+ wrapperBlock();
+}
diff --git a/test/CodeGenObjCXX/blocks.mm b/test/CodeGenObjCXX/blocks.mm
new file mode 100644
index 000000000000..ffb916bf0388
--- /dev/null
+++ b/test/CodeGenObjCXX/blocks.mm
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -triple x86_64-apple-darwin %s
+// rdar://8979379
+
+@interface A
+@end
+
+@interface B : A
+@end
+
+void f(int (^bl)(B* b));
+
+// Test1
+void g() {
+ f(^(A* a) { return 0; });
+}
+
+// Test2
+void g1() {
+ int (^bl)(B* b) = ^(A* a) { return 0; };
+}
+
+// Test3
+@protocol NSObject;
+
+void bar(id(^)(void));
+
+void foo(id <NSObject>(^objectCreationBlock)(void)) {
+ return bar(objectCreationBlock);
+}
+
diff --git a/test/CodeGenObjCXX/encode.mm b/test/CodeGenObjCXX/encode.mm
index 83fb31e16d58..5a49feb706c9 100644
--- a/test/CodeGenObjCXX/encode.mm
+++ b/test/CodeGenObjCXX/encode.mm
@@ -50,3 +50,15 @@ class Int3 { int x, y, z; };
- (void) foo: (int (Int3::*)) member {
}
@end
+
+// rdar: // 8519948
+typedef float HGVec4f __attribute__ ((vector_size(16)));
+
+@interface RedBalloonHGXFormWrapper {
+ HGVec4f m_Transform[4];
+}
+@end
+
+@implementation RedBalloonHGXFormWrapper
+@end
+
diff --git a/test/CodeGenObjCXX/implicit-copy-constructor.mm b/test/CodeGenObjCXX/implicit-copy-constructor.mm
index 489fd9758e16..10eb644ddb22 100644
--- a/test/CodeGenObjCXX/implicit-copy-constructor.mm
+++ b/test/CodeGenObjCXX/implicit-copy-constructor.mm
@@ -41,7 +41,7 @@ void f(D d) {
D d2(d);
}
-// CHECK: define linkonce_odr void @_ZN1DC1ERS_
+// CHECK: define linkonce_odr void @_ZN1DC1ERS_(%struct.D* %this, %struct.D*) unnamed_addr
// CHECK: call void @_ZN1AC1Ev
// CHECK: call void @_ZN1CC2ERS_1A
// CHECK: call void @_ZN1AD1Ev
diff --git a/test/CodeGenObjCXX/property-derived-to-base-conv.mm b/test/CodeGenObjCXX/property-derived-to-base-conv.mm
index ada1202848a8..d7c743c69068 100644
--- a/test/CodeGenObjCXX/property-derived-to-base-conv.mm
+++ b/test/CodeGenObjCXX/property-derived-to-base-conv.mm
@@ -1,7 +1,11 @@
// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s
// rdar: // 7501812
-struct A { int member; };
+struct A {
+ int member;
+ void foo();
+ A *operator->();
+};
struct B : A { };
@interface BInt {
@@ -14,6 +18,8 @@ struct B : A { };
@end
void g(BInt *bint) {
- bint.value.member = 17;
+ bint.value.foo();
+ bint.value->member = 17;
+ int x = bint.value.member;
}
diff --git a/test/CodeGenObjCXX/property-dot-copy.mm b/test/CodeGenObjCXX/property-dot-copy.mm
new file mode 100644
index 000000000000..9b23c58ca17b
--- /dev/null
+++ b/test/CodeGenObjCXX/property-dot-copy.mm
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s
+// rdar://8427922
+
+struct Vector3D
+{
+ float x, y, z;
+ Vector3D();
+ Vector3D(const Vector3D &inVector);
+ Vector3D(float initX, float initY, float initZ);
+ Vector3D &operator=(const Vector3D & rhs);
+};
+
+@interface Object3D
+{
+ Vector3D position;
+ Vector3D length;
+}
+@property (assign) Vector3D position;
+- (Vector3D) length;
+- (void) setLength: (Vector3D)arg;
+@end
+
+int main ()
+{
+ Object3D *myObject;
+ Vector3D V3D(1.0f, 1.0f, 1.0f);
+// CHECK: call void @_ZN8Vector3DC1ERKS_
+ myObject.position = V3D;
+
+// CHECK: call void @_ZN8Vector3DC1ERKS_
+ myObject.length = V3D;
+
+ return 0;
+}
+
+// rdar: // 8437253
+extern "C" void exit(...);
+
+struct CGPoint {
+ float x;
+ float y;
+};
+typedef struct CGPoint CGPoint;
+
+extern "C" const CGPoint CGPointZero;
+
+bool operator==(const CGPoint& a, const CGPoint& b);
+
+@interface TIconViewSettings
+@property (assign, nonatomic) CGPoint gridOffset;
+@end
+
+@implementation TIconViewSettings
+- (CGPoint) gridOffset
+{
+ return CGPointZero;
+}
+
+- (void) foo
+{
+ if ((self.gridOffset) == CGPointZero)
+ exit(1);
+
+ if (self.gridOffset == CGPointZero)
+ exit(1);
+}
+@end
+
diff --git a/test/CodeGenObjCXX/property-dot-reference.mm b/test/CodeGenObjCXX/property-dot-reference.mm
new file mode 100644
index 000000000000..6b53639f54cb
--- /dev/null
+++ b/test/CodeGenObjCXX/property-dot-reference.mm
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s
+// rdar://8409336
+
+struct TFENode {
+void GetURL() const;
+};
+
+@interface TNodeIconAndNameCell
+- (const TFENode&) node;
+@end
+
+@implementation TNodeIconAndNameCell
+- (const TFENode&) node {
+// CHECK: call %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* %{{.*}})
+ self.node.GetURL();
+} // expected-warning {{control reaches end of non-void function}}
+@end
+
+// rdar://8437240
+struct X {
+ int x;
+};
+
+void f0(const X &parent);
+@interface A
+- (const X&) target;
+@end
+void f1(A *a) {
+// CHECK: [[PRP:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[PRP]])
+ f0(a.target);
+
+// CHECK: [[MSG:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[MSG]])
+ f0([a target]);
+}
+
+@interface Test2
+@property (readonly) int myProperty;
+- (int) myProperty;
+- (double) myGetter;
+@end
+void test2() {
+ Test2 *obj;
+ (void) obj.myProperty;
+ (void) obj.myGetter;
+ static_cast<void>(obj.myProperty);
+ static_cast<void>(obj.myGetter);
+ void(obj.myProperty);
+ void(obj.myGetter);
+}
+// CHECK: define void @_Z5test2v()
+// CHECK: call i32 bitcast
+// CHECK: call double bitcast
+// CHECK: call i32 bitcast
+// CHECK: call double bitcast
+// CHECK: call i32 bitcast
+// CHECK: call double bitcast
+
+// PR8751
+int test3(Test2 *obj) { return obj.myProperty; }
diff --git a/test/CodeGenObjCXX/property-object-conditional-exp.mm b/test/CodeGenObjCXX/property-object-conditional-exp.mm
new file mode 100644
index 000000000000..826c351e79ef
--- /dev/null
+++ b/test/CodeGenObjCXX/property-object-conditional-exp.mm
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+struct CGRect {
+ char* origin;
+ unsigned size;
+};
+typedef struct CGRect CGRect;
+
+extern "C" bool CGRectIsEmpty(CGRect);
+
+@interface Foo {
+ CGRect out;
+}
+@property CGRect bounds;
+- (CGRect) out;
+@end
+
+
+@implementation Foo
+
+- (void)bar {
+ CGRect dataRect;
+ CGRect virtualBounds;
+
+// CHECK: [[SRC:%.*]] = call %struct.CGRect bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT:store %struct.CGRect [[SRC]], %struct.CGRect*
+ dataRect = CGRectIsEmpty(virtualBounds) ? self.bounds : virtualBounds;
+ dataRect = CGRectIsEmpty(virtualBounds) ? [self bounds] : virtualBounds;
+ dataRect = CGRectIsEmpty(virtualBounds) ? virtualBounds : self.bounds;
+
+ dataRect = CGRectIsEmpty(virtualBounds) ? self.out : virtualBounds;
+ dataRect = CGRectIsEmpty(virtualBounds) ? [self out] : virtualBounds;
+ dataRect = CGRectIsEmpty(virtualBounds) ? virtualBounds : self.out;
+}
+
+@dynamic bounds;
+- (CGRect) out { return out; }
+@end
diff --git a/test/CodeGenObjCXX/property-objects.mm b/test/CodeGenObjCXX/property-objects.mm
index 724cf6826822..8e98b0dae7e4 100644
--- a/test/CodeGenObjCXX/property-objects.mm
+++ b/test/CodeGenObjCXX/property-objects.mm
@@ -57,3 +57,22 @@ int main() {
return 0;
}
+// rdar://8379892
+// CHECK: define void @_Z1fP1A
+// CHECK: @objc_msgSend to void
+struct X {
+ X();
+ X(const X&);
+ ~X();
+};
+
+@interface A {
+ X xval;
+}
+- (X)x;
+- (void)setX:(X)x;
+@end
+
+void f(A* a) {
+ a.x = X();
+}
diff --git a/test/CodeGenObjCXX/refence-assign-write-barrier.mm b/test/CodeGenObjCXX/refence-assign-write-barrier.mm
new file mode 100644
index 000000000000..b295eb25672f
--- /dev/null
+++ b/test/CodeGenObjCXX/refence-assign-write-barrier.mm
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// rdar://8681766
+
+@interface NSArray
+- (NSArray*) retain;
+- (void) release;
+@end
+
+void NSAssignArray(NSArray*& target, NSArray* newValue)
+{
+ if (target == newValue)
+ return;
+
+ NSArray* oldValue = target;
+
+ target = [newValue retain];
+
+ [oldValue release];
+}
+// CHECK: {{call.* @objc_assign_strongCast}}
diff --git a/test/CodeGenObjCXX/rtti.mm b/test/CodeGenObjCXX/rtti.mm
index 27d24cb68ee5..72de3ac98016 100644
--- a/test/CodeGenObjCXX/rtti.mm
+++ b/test/CodeGenObjCXX/rtti.mm
@@ -4,19 +4,19 @@
namespace std { class type_info; }
-// CHECK: @_ZTI1A = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A
+// CHECK: @_ZTI1A = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A
@interface A
@end
-// CHECK: @_ZTI1B = weak_odr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A
+// CHECK: @_ZTI1B = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A
@interface B : A
@end
-// CHECK: @_ZTIP1B = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B
-// CHECK: @_ZTI11objc_object = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object
-// CHECK: @_ZTIP11objc_object = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object
-// CHECK: @_ZTI10objc_class = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class
-// CHECK: @_ZTIP10objc_class = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class
+// CHECK: @_ZTIP1B = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B
+// CHECK: @_ZTI11objc_object = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object
+// CHECK: @_ZTIP11objc_object = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object
+// CHECK: @_ZTI10objc_class = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class
+// CHECK: @_ZTIP10objc_class = linkonce_odr unnamed_addr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class
@protocol P;
diff --git a/test/CodeGenObjCXX/write-barrier-global-assign.mm b/test/CodeGenObjCXX/write-barrier-global-assign.mm
new file mode 100644
index 000000000000..a14804ffe104
--- /dev/null
+++ b/test/CodeGenObjCXX/write-barrier-global-assign.mm
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+// rdar://8761767
+
+@class CPDestUser;
+
+CPDestUser* FUNC();
+
+// CHECK: {{call.* @objc_assign_global}}
+CPDestUser* globalUser = FUNC();
+
+// CHECK: {{call.* @objc_assign_weak}}
+__weak CPDestUser* weakUser = FUNC();
+
+
+// CHECK: {{call.* @objc_assign_global}}
+static CPDestUser* staticUser = FUNC();
+
+CPDestUser* GetDestUser()
+{
+// CHECK: {{call.* @objc_assign_global}}
+ static CPDestUser* gUser = FUNC();
+// CHECK: {{call.* @objc_assign_weak}}
+ static __weak CPDestUser* wUser = FUNC();
+ if (wUser)
+ return wUser;
+ if (staticUser)
+ return staticUser;
+ return gUser;
+}
diff --git a/test/CodeGen/ext-vector-shuffle.c b/test/CodeGenOpenCL/ext-vector-shuffle.cl
index 1d147a3b3e32..ee88ba3c06d1 100644
--- a/test/CodeGen/ext-vector-shuffle.c
+++ b/test/CodeGenOpenCL/ext-vector-shuffle.cl
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | not grep 'extractelement'
-// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | not grep 'insertelement'
-// RUN: %clang_cc1 %s -x cl -emit-llvm -o - | grep 'shufflevector'
+// RUN: %clang_cc1 %s -cl-opt-disable -emit-llvm -o - | not grep 'extractelement'
+// RUN: %clang_cc1 %s -cl-opt-disable -emit-llvm -o - | not grep 'insertelement'
+// RUN: %clang_cc1 %s -cl-opt-disable -emit-llvm -o - | grep 'shufflevector'
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef __attribute__(( ext_vector_type(4) )) float float4;
diff --git a/test/CodeGenOpenCL/kernel-metadata.cl b/test/CodeGenOpenCL/kernel-metadata.cl
new file mode 100644
index 000000000000..3e10a119d044
--- /dev/null
+++ b/test/CodeGenOpenCL/kernel-metadata.cl
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+void normal_function() {
+}
+
+__kernel void kernel_function() {
+}
+
+// CHECK: !opencl.kernels = !{!0}
+// CHECK: !0 = metadata !{void ()* @kernel_function}
diff --git a/test/CodeGenOpenCL/single-precision-constant.cl b/test/CodeGenOpenCL/single-precision-constant.cl
new file mode 100644
index 000000000000..62b37c136137
--- /dev/null
+++ b/test/CodeGenOpenCL/single-precision-constant.cl
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 %s -cl-single-precision-constant -emit-llvm -o - | FileCheck %s
+
+float fn(float f) {
+ // CHECK: fmul float
+ // CHECK: fadd float
+ return f*2. + 1.;
+}
diff --git a/test/Coverage/c-language-features.inc b/test/Coverage/c-language-features.inc
index 3548132500f9..0ff1237b12e8 100644
--- a/test/Coverage/c-language-features.inc
+++ b/test/Coverage/c-language-features.inc
@@ -188,3 +188,11 @@ void f10() {
x = (struct f10_s0) { .iv0 = "name" };
}
+
+// Nested structures.
+struct s11 {
+ struct s11_2 {
+ int f0;
+ } f0;
+ int f1;
+};
diff --git a/test/Coverage/cxx-language-features.inc b/test/Coverage/cxx-language-features.inc
index 51c11046a84c..31b50be33589 100644
--- a/test/Coverage/cxx-language-features.inc
+++ b/test/Coverage/cxx-language-features.inc
@@ -19,3 +19,9 @@ class Base1 {
class Base2 { };
class Derived1 : Base1, virtual public Base2 { };
+
+/* Template classes, template functions */
+enum E1 { EC1 };
+template <E1 v> class C1 {};
+template <E1 v> C1<v> f1() { return C1<v>(); }
+void f2() { f1<EC1>(); }
diff --git a/test/Coverage/html-diagnostics.c b/test/Coverage/html-diagnostics.c
index 81b2cfa588e3..be820fb90f29 100644
--- a/test/Coverage/html-diagnostics.c
+++ b/test/Coverage/html-diagnostics.c
@@ -3,7 +3,10 @@
// RUN: cat %t/*.html | FileCheck %s
// CHECK: <h3>Annotated Source Code</h3>
-// CHECK: Dereference of null pointer
+
+// Without tweaking expr, the expr would hit to the line below
+// emitted to the output as comment.
+// CHECK: {{[D]ereference of null pointer}}
void f0(int x) {
int *p = &x;
diff --git a/test/Coverage/targets.c b/test/Coverage/targets.c
index c9f6f8d88d59..d2a111241cb2 100644
--- a/test/Coverage/targets.c
+++ b/test/Coverage/targets.c
@@ -6,7 +6,6 @@
// RUN: %clang_cc1 -g -triple i686-unknown-dragonfly -emit-llvm -o %t %s
// RUN: %clang_cc1 -g -triple i686-unknown-unknown -emit-llvm -o %t %s
// RUN: %clang_cc1 -g -triple i686-unknown-win32 -emit-llvm -o %t %s
-// RUN: %clang_cc1 -g -triple pic16-unknown-unknown -emit-llvm -o %t %s
// RUN: %clang_cc1 -g -triple powerpc-apple-darwin9 -emit-llvm -o %t %s
// RUN: %clang_cc1 -g -triple powerpc-unknown-unknown -emit-llvm -o %t %s
// RUN: %clang_cc1 -g -triple powerpc64-apple-darwin9 -emit-llvm -o %t %s
diff --git a/test/Driver/apple-kext-mkernel.c b/test/Driver/apple-kext-mkernel.c
new file mode 100644
index 000000000000..712dfc8d0eba
--- /dev/null
+++ b/test/Driver/apple-kext-mkernel.c
@@ -0,0 +1,6 @@
+// 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
diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c
index 50bce3b274ca..8e6b0fe850de 100644
--- a/test/Driver/clang_f_opts.c
+++ b/test/Driver/clang_f_opts.c
@@ -1,6 +1,5 @@
// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
-// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
-// RUN: %clang -### -fshort-enums %s 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s
+// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-enums -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
// CHECK-OPTIONS1: -fgnu-keywords
// CHECK-OPTIONS1: -fblocks
@@ -9,8 +8,7 @@
// CHECK_OPTIONS2: -fno-gnu-keywords
// CHECK-OPTIONS2: -fmath-errno
// CHECK-OPTIONS2: -fno-builtin
+// CHECK-OPTIONS2: -fshort-enums
// CHECK-OPTIONS2: -fshort-wchar
// CHECK-OPTIONS2: -fno-common
// CHECK-OPTIONS2: -fno-show-source-location
-
-// CHECK-SHORT-ENUMS: compiler does not support '-fshort-enums'
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index 074957d625a1..206e665a2cf3 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -28,15 +28,15 @@
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -bundle %t.o 2>> %t.log
// RUN: FileCheck -check-prefix=LINK_IPHONE_3_0 %s < %t.log
-// LINK_IPHONE_3_0: ld"
+// LINK_IPHONE_3_0: {{ld(.exe)?"}}
// LINK_IPHONE_3_0-NOT: -lcrt1.3.1.o
// LINK_IPHONE_3_0: -lcrt1.o
// LINK_IPHONE_3_0: -lSystem
-// LINK_IPHONE_3_0: ld"
+// LINK_IPHONE_3_0: {{ld(.exe)?"}}
// LINK_IPHONE_3_0: -dylib
// LINK_IPHONE_3_0: -ldylib1.o
// LINK_IPHONE_3_0: -lSystem
-// LINK_IPHONE_3_0: ld"
+// LINK_IPHONE_3_0: {{ld(.exe)?"}}
// LINK_IPHONE_3_0: -lbundle1.o
// LINK_IPHONE_3_0: -lSystem
@@ -45,42 +45,42 @@
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -bundle %t.o 2>> %t.log
// RUN: FileCheck -check-prefix=LINK_IPHONE_3_1 %s < %t.log
-// LINK_IPHONE_3_1: ld"
+// LINK_IPHONE_3_1: {{ld(.exe)?"}}
// LINK_IPHONE_3_1-NOT: -lcrt1.o
// LINK_IPHONE_3_1: -lcrt1.3.1.o
// LINK_IPHONE_3_1: -lSystem
-// LINK_IPHONE_3_1: ld"
+// LINK_IPHONE_3_1: {{ld(.exe)?"}}
// LINK_IPHONE_3_1: -dylib
// LINK_IPHONE_3_1-NOT: -ldylib1.o
// LINK_IPHONE_3_1: -lSystem
-// LINK_IPHONE_3_1: ld"
+// LINK_IPHONE_3_1: {{ld(.exe)?"}}
// LINK_IPHONE_3_1-NOT: -lbundle1.o
// LINK_IPHONE_3_1: -lSystem
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -fpie %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_EXPLICIT_PIE %s < %t.log
//
-// LINK_EXPLICIT_PIE: ld"
+// LINK_EXPLICIT_PIE: {{ld(.exe)?"}}
// LINK_EXPLICIT_PIE: "-pie"
// RUN: %clang -ccc-host-triple i386-apple-darwin9 -### -fno-pie %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_EXPLICIT_NO_PIE %s < %t.log
//
-// LINK_EXPLICIT_NO_PIE: ld"
+// LINK_EXPLICIT_NO_PIE: {{ld(.exe)?"}}
// LINK_EXPLICIT_NO_PIE: "-no_pie"
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \
// RUN: -mlinker-version=100 2> %t.log
// RUN: FileCheck -check-prefix=LINK_NEWER_DEMANGLE %s < %t.log
//
-// LINK_NEWER_DEMANGLE: ld"
+// LINK_NEWER_DEMANGLE: {{ld(.exe)?"}}
// LINK_NEWER_DEMANGLE: "-demangle"
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### %t.o \
// RUN: -mlinker-version=100 -Wl,--no-demangle 2> %t.log
// RUN: FileCheck -check-prefix=LINK_NEWER_NODEMANGLE %s < %t.log
//
-// LINK_NEWER_NODEMANGLE: ld"
+// LINK_NEWER_NODEMANGLE: {{ld(.exe)?"}}
// LINK_NEWER_NODEMANGLE-NOT: "-demangle"
// LINK_NEWER_NODEMANGLE: "-lSystem"
@@ -88,6 +88,6 @@
// RUN: -mlinker-version=95 2> %t.log
// RUN: FileCheck -check-prefix=LINK_OLDER_NODEMANGLE %s < %t.log
//
-// LINK_OLDER_NODEMANGLE: ld"
+// LINK_OLDER_NODEMANGLE: {{ld(.exe)?"}}
// LINK_OLDER_NODEMANGLE-NOT: "-demangle"
// LINK_OLDER_NODEMANGLE: "-lSystem"
diff --git a/test/Driver/darwin-xarch.c b/test/Driver/darwin-xarch.c
index cd7fa845d03e..84201ceb835a 100644
--- a/test/Driver/darwin-xarch.c
+++ b/test/Driver/darwin-xarch.c
@@ -2,7 +2,13 @@
// RUN: -arch i386 -Xarch_i386 -mmacosx-version-min=10.4 \
// RUN: -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 \
// RUN: -c %s 2> %t
-// RUN: FileCheck < %t %s
+// RUN: FileCheck --check-prefix=CHECK-COMPILE < %t %s
//
-// CHECK: clang{{.*}}" "-cc1" "-triple" "i386-apple-darwin8.0.0"
-// CHECK: clang{{.*}}" "-cc1" "-triple" "x86_64-apple-darwin9.0.0"
+// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "i386-apple-darwin8.0.0"
+// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "x86_64-apple-darwin9.0.0"
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### \
+// RUN: -arch i386 -Xarch_i386 -Wl,-some-linker-arg -filelist X 2> %t
+// RUN: FileCheck --check-prefix=CHECK-LINK < %t %s
+//
+// CHECK-LINK: ld"{{.*}} "-some-linker-arg"
diff --git a/test/Driver/dragonfly.c b/test/Driver/dragonfly.c
index d7b954d586d7..d768fe656b72 100644
--- a/test/Driver/dragonfly.c
+++ b/test/Driver/dragonfly.c
@@ -2,7 +2,6 @@
// RUN: FileCheck -input-file %t.log %s
// CHECK: clang{{.*}}" "-cc1" "-triple" "amd64-pc-dragonfly"
-// CHECK: as{{.*}}" "-o" "{{.*}}.o" "{{.*}}.s
// CHECK: ld{{.*}}" "-dynamic-linker" "{{.*}}ld-elf.{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}/gcc{{.*}}" {{.*}} "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
diff --git a/test/Driver/emit-llvm.c b/test/Driver/emit-llvm.c
index 3439b58d85d7..76ea05926c96 100644
--- a/test/Driver/emit-llvm.c
+++ b/test/Driver/emit-llvm.c
@@ -1,6 +1,3 @@
-// RUN: not %clang -ccc-host-triple i386-pc-linux-gnu -emit-llvm -o %t %s 2> %t.log
-// RUN: grep 'unable to pass LLVM bit-code files to linker' %t.log
-
// Check that -O4 is only honored as the effective -O option.
// <rdar://problem/7046672> clang/loader problem
diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c
index e8bc22345713..87ac6d754ee6 100644
--- a/test/Driver/freebsd.c
+++ b/test/Driver/freebsd.c
@@ -2,8 +2,7 @@
// RUN: FileCheck --check-prefix=CHECK-PPC < %t %s
//
// CHECK-PPC: clang{{.*}}" "-cc1" "-triple" "powerpc64-pc-freebsd8"
-// CHECK-PPC: as{{.*}}" "-o" "{{.*}}.o" "{{.*}}.s
-// CHECK-PPC: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o"
+// CHECK-PPC: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o"
// Check that -m32 properly adjusts the toolchain flags.
@@ -12,10 +11,9 @@
// RUN: FileCheck --check-prefix=CHECK-LIB32 < %t %s
//
// CHECK-LIB32: clang{{.*}}" "-cc1" "-triple" "i386-pc-freebsd8"
-// CHECK-LIB32: as{{.*}}" "--32"
// CHECK-LIB32: ld{{.*}}" {{.*}} "-m" "elf_i386_fbsd"
//
// RUN: %clang -ccc-host-triple x86_64-pc-freebsd8 -m32 -print-search-dirs %s > %t
// RUN: FileCheck --check-prefix=CHECK-LIB32PATHS < %t %s
//
-// CHECK-LIB32PATHS: libraries: ={{.*}}:/usr/lib32
+// CHECK-LIB32PATHS: libraries: ={{.*:?}}/usr/lib32
diff --git a/test/Driver/m_and_mm.c b/test/Driver/m_and_mm.c
new file mode 100644
index 000000000000..eab2a04986a9
--- /dev/null
+++ b/test/Driver/m_and_mm.c
@@ -0,0 +1,3 @@
+// RUN: %clang -### \
+// RUN: -M -MM %s 2> %t
+// RUN: grep '"-sys-header-deps"' %t | count 0
diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c
index 6024461069a1..34f6988c68e1 100644
--- a/test/Driver/openbsd.c
+++ b/test/Driver/openbsd.c
@@ -2,5 +2,4 @@
// RUN: FileCheck -input-file %t.log %s
// CHECK: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
-// CHECK: as{{.*}}" "-o" "{{.*}}.o" "{{.*}}.s
// CHECK: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
diff --git a/test/Driver/sysroot-flags.c b/test/Driver/sysroot-flags.c
new file mode 100644
index 000000000000..461c451e1293
--- /dev/null
+++ b/test/Driver/sysroot-flags.c
@@ -0,0 +1,28 @@
+// Check for proper handling of --sysroot and -isysroot flags.
+
+// RUN: %clang -### -fsyntax-only -isysroot /foo/bar %s 2>&1 | \
+// RUN: FileCheck %s -check-prefix=ISYSROOT
+// 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"
+
+// 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"
+
+// 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"
diff --git a/test/FixIt/fixit-errors.c b/test/FixIt/fixit-errors.c
index ff063635f693..f8e2295d496a 100644
--- a/test/FixIt/fixit-errors.c
+++ b/test/FixIt/fixit-errors.c
@@ -1,5 +1,5 @@
// RUN: cp %s %t
-// RUN: %clang_cc1 -pedantic -verify -fixit -x c %t || true
+// RUN: true || %clang_cc1 -pedantic -verify -fixit -x c %t
// RUN: %clang_cc1 -pedantic -Werror -x c %t
// XFAIL: *
diff --git a/test/FixIt/fixit-objc-message.m b/test/FixIt/fixit-objc-message.m
new file mode 100644
index 000000000000..1fef3cc56d5e
--- /dev/null
+++ b/test/FixIt/fixit-objc-message.m
@@ -0,0 +1,38 @@
+// Objective-C recovery
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -Wall -fixit -x objective-c %t || true
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x objective-c %t
+
+// Objective-C++ recovery
+// RUN: cp %s %t
+// RUN: %clang_cc1 -pedantic -Wall -fixit -x objective-c++ %t || true
+// RUN: %clang_cc1 -fsyntax-only -pedantic -Wall -Werror -x objective-c++ %t
+
+@interface A
+- (int)method1:(int)x second:(float)y;
++ (int)method2:(int)x second:(double)y;
+- (int)getBlah;
+@end
+
+void f(A *a, int i, int j) {
+ a method1:5+2 second:+(3.14159)];
+ a method1:[a method1:3 second:j] second:i++]
+ a getBlah];
+
+ int array[17];
+ (void)array[a method1:5+2 second:+(3.14159)]];
+ (A method2:5+2 second:3.14159]);
+ A method2:5+2 second:3.14159]
+ if (A method2:5+2 second:3.14159]) { }
+}
+
+@interface B : A
+- (int)method1:(int)x second:(float)y;
+@end
+
+@implementation B
+- (int)method1:(int)x second:(float)y {
+ super method1:x second:y];
+ return super getBlah];
+}
+@end
diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m
index 03f28a1b586a..bf704c66a027 100644
--- a/test/FixIt/fixit-objc.m
+++ b/test/FixIt/fixit-objc.m
@@ -1,6 +1,7 @@
+// RUN: %clang_cc1 -pedantic -verify %s
// RUN: cp %s %t
-// RUN: %clang_cc1 -pedantic -fixit -x objective-c %t
-// RUN: %clang_cc1 -pedantic -verify -x objective-c %t
+// RUN: not %clang_cc1 -pedantic -fixit -x objective-c %t
+// RUN: %clang_cc1 -pedantic -Werror -x objective-c %t
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
@@ -10,28 +11,31 @@
@protocol X;
void foo() {
- <X> *P; // should be fixed to 'id<X>'.
+ <X> *P; // expected-warning{{protocol qualifiers without 'id' is archaic}}
}
@class A;
@class NSString;
@interface Test
-- (void)test:(NSString *)string;
+- (void)test:(NSString *)string; // expected-note{{passing argument to parameter 'string' here}}
@property (copy) NSString *property;
@end
-void g(NSString *a);
-void h(id a);
+void g(NSString *a); // expected-note{{passing argument to parameter 'a' here}}
+void h(id a); // expected-note 2{{passing argument to parameter 'a' here}}
void f(Test *t) {
- NSString *a = "Foo";
- id b = "Foo";
- A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'A *' with an expression of type 'char [4]'}}
- g("Foo");
- h("Foo");
- h(("Foo"));
- [t test:"Foo"];
- t.property = "Foo";
+ NSString *a = "Foo"; // expected-warning {{incompatible pointer types initializing 'NSString *' with an expression of type 'char [4]'}}
+ id b = "Foo"; // expected-warning {{incompatible pointer types initializing 'id' with an expression of type 'char [4]'}}
+ g("Foo"); // expected-warning{{incompatible pointer types passing 'char [4]' to parameter of type 'NSString *'}}
+ h("Foo"); // expected-warning{{incompatible pointer types passing 'char [4]' to parameter of type 'id'}}
+ h(("Foo")); // expected-warning{{incompatible pointer types passing 'char [4]' to parameter of type 'id'}}
+ [t test:"Foo"]; // expected-warning{{incompatible pointer types sending 'char [4]' to parameter of type 'NSString *'}}
+ t.property = "Foo"; // expected-warning{{incompatible pointer types assigning to 'NSString *' from 'char [4]'}}
+
+ // <rdar://problem/6896493>
+ [t test:@"Foo"]]; // expected-error{{extraneous ']' before ';'}}
+ g(@"Foo")); // expected-error{{extraneous ')' before ';'}}
}
diff --git a/test/FixIt/fixit-unrecoverable.cpp b/test/FixIt/fixit-unrecoverable.cpp
index 00ed8978c610..1e1f1b8db210 100644
--- a/test/FixIt/fixit-unrecoverable.cpp
+++ b/test/FixIt/fixit-unrecoverable.cpp
@@ -6,6 +6,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
float f(int y) {
- return static_cst<float>(y); // expected-error{{use of undeclared identifier 'static_cst'; did you mean 'static_cast'?}}
+ return static_cst<float>(y); // expected-error{{use of undeclared identifier 'static_cst'; did you mean 'static_cast'?}} \
+ // expected-error{{for function-style cast or type construction}}
}
diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c
index 890fb10b41d5..9c7443594283 100644
--- a/test/FixIt/fixit.c
+++ b/test/FixIt/fixit.c
@@ -41,3 +41,10 @@ int test_cond(int y, int fooBar) {
// CHECK: typedef int int_t;
typedef typedef int int_t;
+
+// <rdar://problem/7159693>
+enum Color {
+ Red // expected-error{{missing ',' between enumerators}}
+ Green = 17 // expected-error{{missing ',' between enumerators}}
+ Blue,
+};
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index b9282c4d9481..41b187b0718c 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -51,3 +51,30 @@ namespace rdar7853795 {
}
};
}
+
+namespace rdar7796492 {
+ class A { int x, y; A(); };
+
+ A::A()
+ : x(1) y(2) { // expected-error{{missing ',' between base or member initializers}}
+ }
+
+}
+
+// extra qualification on member
+class C {
+ int C::foo();
+};
+
+namespace rdar8488464 {
+int x == 0; // expected-error {{invalid '==' at end of declaration; did you mean '='?}}
+
+void f() {
+ int x == 0; // expected-error {{invalid '==' at end of declaration; did you mean '='?}}
+ (void)x;
+ if (int x == 0) { // expected-error {{invalid '==' at end of declaration; did you mean '='?}}
+ (void)x;
+ }
+}
+}
+
diff --git a/test/FixIt/typo.cpp b/test/FixIt/typo.cpp
index 077aa9c6f78f..d1e732fd1dba 100644
--- a/test/FixIt/typo.cpp
+++ b/test/FixIt/typo.cpp
@@ -2,6 +2,7 @@
// RUN: cp %s %t
// RUN: %clang_cc1 -fsyntax-only -fixit -x c++ %t || true
// RUN: %clang_cc1 -fsyntax-only -pedantic -Werror -x c++ %t
+
namespace std {
template<typename T> class basic_string { // expected-note 2{{'basic_string' declared here}}
public:
diff --git a/test/FixIt/typo.m b/test/FixIt/typo.m
index 6853ab693afb..8a474ab16879 100644
--- a/test/FixIt/typo.m
+++ b/test/FixIt/typo.m
@@ -1,7 +1,10 @@
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -DNON_FIXITS -verify %s
-// RUN: %clang -E -P %s -o %t
-// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fixit %t || true
-// RUN: %clang_cc1 -x objective-c -fsyntax-only -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -pedantic -Werror %t
+// 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: %clang_cc1 -x objective-c -fsyntax-only -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -pedantic -Werror %t
+// RUN: false
+// XFAIL: *
+
@interface NSString // expected-note{{'NSString' declared here}}
+ (int)method:(int)x;
@@ -10,7 +13,8 @@
#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'?}}
+ NSstring *str = @"A string"; // expected-error{{use of undeclared identifier 'NSstring'; did you mean 'NSString'?}} \
+ // expected-error{{use of undeclared identifier 'str'}}
}
#endif
@@ -101,6 +105,7 @@ void test2(Collide *a) {
@interface Super
- (int)method; // expected-note{{using}}
- (int)method2;
+- (int)method3:(id)x;
@end
@interface Sub : Super
@@ -154,3 +159,15 @@ void f(A *a) {
[A methodA] // expected-error{{expected ';' after expression}}
}
+#ifdef NON_FIXITS
+@interface Sub3 : Super
+- (int)method3;
+@end
+
+@implementation Sub3
+- (int)method3 {
+ int x = super; // expected-note{{use of undeclared identifier 'super'}}
+ return 0;
+}
+@end
+#endif
diff --git a/test/Headers/arm-neon-header.c b/test/Headers/arm-neon-header.c
new file mode 100644
index 000000000000..90ea22bc96fe
--- /dev/null
+++ b/test/Headers/arm-neon-header.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -fno-lax-vector-conversions -ffreestanding %s
+// RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s
+
+#include <arm_neon.h>
diff --git a/test/Headers/stdbool.cpp b/test/Headers/stdbool.cpp
new file mode 100644
index 000000000000..a252cca1a6a7
--- /dev/null
+++ b/test/Headers/stdbool.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -E -dM %s | FileCheck --check-prefix=CHECK-GNU-COMPAT %s
+// RUN: %clang_cc1 -std=c++98 -E -dM %s | FileCheck --check-prefix=CHECK-CONFORMING %s
+#include <stdbool.h>
+#define zzz
+
+// CHECK-GNU-COMPAT: #define _Bool bool
+// CHECK-GNU-COMPAT: #define bool bool
+// CHECK-GNU-COMPAT: #define false false
+// CHECK-GNU-COMPAT: #define true true
+
+// CHECK-CONFORMING-NOT: #define _Bool
+// CHECK-CONFORMING: #define __CHAR_BIT__
+// CHECK-CONFORMING-NOT: #define false false
+// CHECK-CONFORMING: #define zzz
diff --git a/test/Headers/x86-intrinsics-headers.c b/test/Headers/x86-intrinsics-headers.c
index ba833ec03893..bdffddedfc7b 100644
--- a/test/Headers/x86-intrinsics-headers.c
+++ b/test/Headers/x86-intrinsics-headers.c
@@ -1,13 +1,9 @@
-// RUN: %clang -fsyntax-only %s
-// RUN: %clang -fsyntax-only -fno-lax-vector-conversions %s
-// RUN: %clangxx -fsyntax-only -x c++ %s
+// RUN: %clang -fsyntax-only -ffreestanding %s
+// RUN: %clang -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s
+// RUN: %clangxx -fsyntax-only -ffreestanding -x c++ %s
#if defined(i386) || defined(__x86_64__)
-#ifdef __MMX__
-#include <mm_malloc.h>
-#endif
-
#ifdef __SSE4_2__
// nmmintrin forwards to smmintrin.
#include <nmmintrin.h>
diff --git a/test/Index/Inputs/a.h b/test/Index/Inputs/a.h
new file mode 100644
index 000000000000..70ace8c90ee3
--- /dev/null
+++ b/test/Index/Inputs/a.h
@@ -0,0 +1,4 @@
+#ifndef A_H
+#define A_H
+typedef int A;
+#endif
diff --git a/test/Index/Inputs/b.h b/test/Index/Inputs/b.h
new file mode 100644
index 000000000000..02591d253299
--- /dev/null
+++ b/test/Index/Inputs/b.h
@@ -0,0 +1 @@
+typedef float B;
diff --git a/test/Index/Inputs/get-cursor-includes-1.h b/test/Index/Inputs/get-cursor-includes-1.h
new file mode 100644
index 000000000000..48439d2ae265
--- /dev/null
+++ b/test/Index/Inputs/get-cursor-includes-1.h
@@ -0,0 +1,6 @@
+#ifndef GET_CURSOR_INCLUDES_1_H
+#define GET_CURSOR_INCLUDES_1_H
+
+extern int blah;
+
+#endif // GET_CURSOR_INCLUDES_1_H
diff --git a/test/Index/Inputs/get-cursor-includes-2.h b/test/Index/Inputs/get-cursor-includes-2.h
new file mode 100644
index 000000000000..cf95c1828be7
--- /dev/null
+++ b/test/Index/Inputs/get-cursor-includes-2.h
@@ -0,0 +1,2 @@
+#include "get-cursor-includes-1.h"
+#include "get-cursor-includes-1.h"
diff --git a/test/Index/TestClassDecl.m b/test/Index/TestClassDecl.m
index 09a7d48cfdd3..1aa26ac77c12 100644
--- a/test/Index/TestClassDecl.m
+++ b/test/Index/TestClassDecl.m
@@ -16,12 +16,12 @@ void function(Foo * arg)
}
// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound
-// CHECK-scan: [8:1 - 8:8] UnexposedDecl=:8:1
+// CHECK-scan: [8:1 - 8:8] UnexposedDecl=[10:12]
// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:10:12
// CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound
// CHECK-scan: [10:1 - 11:5] ObjCInterfaceDecl=Foo:10:12
-// CHECK-scan: [11:5 - 13:6] Invalid Cursor => NoDeclFound
-// CHECK-scan: [13:6 - 13:15] FunctionDecl=function:13:6 (Definition)
+// CHECK-scan: [11:5 - 13:1] Invalid Cursor => NoDeclFound
+// CHECK-scan: [13:1 - 13:15] FunctionDecl=function:13:6 (Definition)
// CHECK-scan: [13:15 - 13:18] ObjCClassRef=Foo:10:12
// CHECK-scan: [13:18 - 13:24] ParmDecl=arg:13:21 (Definition)
// CHECK-scan: [13:24 - 14:1] FunctionDecl=function:13:6 (Definition)
diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m
index 325a4236a511..8a8314078999 100644
--- a/test/Index/TestClassForwardDecl.m
+++ b/test/Index/TestClassForwardDecl.m
@@ -13,10 +13,10 @@ void function(Foo * arg)
}
// CHECK-scan: [1:1 - 8:1] Invalid Cursor => NoDeclFound
-// CHECK-scan: [8:1 - 8:8] UnexposedDecl=:8:1
+// CHECK-scan: [8:1 - 8:8] UnexposedDecl=[8:8]
// CHECK-scan: [8:8 - 8:11] ObjCClassRef=Foo:8:8
-// CHECK-scan: [8:11 - 10:6] Invalid Cursor => NoDeclFound
-// CHECK-scan: [10:6 - 10:15] FunctionDecl=function:10:6 (Definition)
+// CHECK-scan: [8:11 - 10:1] Invalid Cursor => NoDeclFound
+// CHECK-scan: [10:1 - 10:15] FunctionDecl=function:10:6 (Definition)
// CHECK-scan: [10:15 - 10:18] ObjCClassRef=Foo:8:8
// CHECK-scan: [10:18 - 10:24] ParmDecl=arg:10:21 (Definition)
// CHECK-scan: [10:24 - 11:1] FunctionDecl=function:10:6 (Definition)
diff --git a/test/Index/annotate-tokens-cxx0x.cpp b/test/Index/annotate-tokens-cxx0x.cpp
new file mode 100644
index 000000000000..5dea3514c2b8
--- /dev/null
+++ b/test/Index/annotate-tokens-cxx0x.cpp
@@ -0,0 +1,8 @@
+template<typename ...Args>
+int f(Args ...args) {
+ return sizeof...(args) + sizeof...(Args);
+}
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:1 -std=c++0x %s | FileCheck %s
+// CHECK: Identifier: "args" [3:20 - 3:24] UnexposedExpr=args:2:15
+// CHECK: Identifier: "Args" [3:38 - 3:42] TypeRef=Args:1:22
diff --git a/test/Index/annotate-tokens-include.c b/test/Index/annotate-tokens-include.c
index 3c3c43b746d6..2190125c098f 100644
--- a/test/Index/annotate-tokens-include.c
+++ b/test/Index/annotate-tokens-include.c
@@ -1,6 +1,7 @@
#include "annotate-tokens-include.h"
// RUN: c-index-test -test-annotate-tokens=%s:1:1:2:1 %s | FileCheck %s
-// CHECK: Identifier: "include" [1:2 - 1:9] preprocessing directive=
-// CHECK: Literal: ""annotate-tokens-include.h"" [1:10 - 1:37] preprocessing directive=
+// CHECK: Punctuation: "#" [1:1 - 1:2] inclusion directive=annotate-tokens-include.h
+// CHECK: Identifier: "include" [1:2 - 1:9] inclusion directive=annotate-tokens-include.h
+// CHECK: Literal: ""annotate-tokens-include.h"" [1:10 - 1:37] inclusion directive=annotate-tokens-include.h
diff --git a/test/Index/annotate-tokens-pp.c b/test/Index/annotate-tokens-pp.c
index 55ee7630eb36..3dd9ffeddcbe 100644
--- a/test/Index/annotate-tokens-pp.c
+++ b/test/Index/annotate-tokens-pp.c
@@ -29,27 +29,27 @@ void test() {
// CHECK: Punctuation: "#" [2:1 - 2:2] preprocessing directive=
// CHECK: Identifier: "define" [2:2 - 2:8] preprocessing directive=
// CHECK: Identifier: "STILL_NOTHING" [2:9 - 2:22] macro definition=STILL_NOTHING
-// CHECK: Identifier: "NOTHING" [2:23 - 2:30] preprocessing directive=
-// CHECK: Punctuation: "(" [2:30 - 2:31] preprocessing directive=
-// CHECK: Identifier: "honk" [2:31 - 2:35] preprocessing directive=
-// CHECK: Punctuation: "," [2:35 - 2:36] preprocessing directive=
-// CHECK: Identifier: "warble" [2:36 - 2:42] preprocessing directive=
-// CHECK: Punctuation: ")" [2:42 - 2:43] preprocessing directive=
+// CHECK: Identifier: "NOTHING" [2:23 - 2:30] macro definition=STILL_NOTHING
+// CHECK: Punctuation: "(" [2:30 - 2:31] macro definition=STILL_NOTHING
+// CHECK: Identifier: "honk" [2:31 - 2:35] macro definition=STILL_NOTHING
+// CHECK: Punctuation: "," [2:35 - 2:36] macro definition=STILL_NOTHING
+// CHECK: Identifier: "warble" [2:36 - 2:42] macro definition=STILL_NOTHING
+// CHECK: Punctuation: ")" [2:42 - 2:43] macro definition=STILL_NOTHING
// CHECK: Punctuation: "#" [3:1 - 3:2] preprocessing directive=
// CHECK: Identifier: "define" [3:2 - 3:8] preprocessing directive=
// CHECK: Identifier: "BAR" [3:9 - 3:12] macro definition=BAR
-// CHECK: Identifier: "baz" [3:13 - 3:16] preprocessing directive=
+// CHECK: Identifier: "baz" [3:13 - 3:16] macro definition=BAR
// CHECK: Punctuation: "#" [4:1 - 4:2] preprocessing directive=
// CHECK: Identifier: "define" [4:2 - 4:8] preprocessing directive=
// CHECK: Identifier: "WIBBLE" [4:9 - 4:15] macro definition=WIBBLE
-// CHECK: Punctuation: "(" [4:15 - 4:16] preprocessing directive=
-// CHECK: Identifier: "X" [4:16 - 4:17] preprocessing directive=
-// CHECK: Punctuation: "," [4:17 - 4:18] preprocessing directive=
-// CHECK: Identifier: "Y" [4:19 - 4:20] preprocessing directive=
-// CHECK: Punctuation: ")" [4:20 - 4:21] preprocessing directive=
-// CHECK: Identifier: "X" [4:22 - 4:23] preprocessing directive=
-// CHECK: Punctuation: "##" [4:23 - 4:25] preprocessing directive=
-// CHECK: Identifier: "Y" [4:25 - 4:26] preprocessing directive=
+// CHECK: Punctuation: "(" [4:15 - 4:16] macro definition=WIBBLE
+// CHECK: Identifier: "X" [4:16 - 4:17] macro definition=WIBBLE
+// CHECK: Punctuation: "," [4:17 - 4:18] macro definition=WIBBLE
+// CHECK: Identifier: "Y" [4:19 - 4:20] macro definition=WIBBLE
+// CHECK: Punctuation: ")" [4:20 - 4:21] macro definition=WIBBLE
+// CHECK: Identifier: "X" [4:22 - 4:23] macro definition=WIBBLE
+// CHECK: Punctuation: "##" [4:23 - 4:25] macro definition=WIBBLE
+// CHECK: Identifier: "Y" [4:25 - 4:26] macro definition=WIBBLE
// CHECK: Identifier: "NOTHING" [5:1 - 5:8] macro instantiation=NOTHING:1:9
// CHECK: Punctuation: "(" [5:8 - 5:9]
// CHECK: Identifier: "more" [5:9 - 5:13]
@@ -68,32 +68,32 @@ void test() {
// CHECK: Identifier: "BAR" [6:5 - 6:8] macro instantiation=BAR:3:9
// CHECK: Identifier: "STILL_NOTHING" [6:9 - 6:22] macro instantiation=STILL_NOTHING:2:9
// CHECK: Punctuation: ";" [6:22 - 6:23]
-// CHECK: Punctuation: "#" [7:1 - 7:2] preprocessing directive=
-// CHECK: Identifier: "include" [7:2 - 7:9] preprocessing directive=
-// CHECK: Literal: ""foo.h"" [7:10 - 7:17] preprocessing directive=
+// CHECK: Punctuation: "#" [7:1 - 7:2] inclusion directive=foo.h
+// CHECK: Identifier: "include" [7:2 - 7:9] inclusion directive=foo.h
+// CHECK: Literal: ""foo.h"" [7:10 - 7:17] inclusion directive=foo.h
// CHECK: Punctuation: "#" [8:1 - 8:2] preprocessing directive=
// CHECK: Identifier: "undef" [8:2 - 8:7] preprocessing directive=
// CHECK: Identifier: "BAR" [8:8 - 8:11] preprocessing directive=
// CHECK: Punctuation: "#" [10:1 - 10:2] preprocessing directive=
// CHECK: Identifier: "define" [10:2 - 10:8] preprocessing directive=
// CHECK: Identifier: "REVERSE_MACRO" [10:9 - 10:22] macro definition=REVERSE_MACRO
-// CHECK: Punctuation: "(" [10:22 - 10:23] preprocessing directive=
-// CHECK: Identifier: "x" [10:23 - 10:24] preprocessing directive=
-// CHECK: Punctuation: "," [10:24 - 10:25] preprocessing directive=
-// CHECK: Identifier: "y" [10:25 - 10:26] preprocessing directive=
-// CHECK: Punctuation: ")" [10:26 - 10:27] preprocessing directive=
-// CHECK: Identifier: "y" [10:28 - 10:29] preprocessing directive=
-// CHECK: Punctuation: "+" [10:30 - 10:31] preprocessing directive=
-// CHECK: Identifier: "x" [10:32 - 10:33] preprocessing directive=
+// CHECK: Punctuation: "(" [10:22 - 10:23] macro definition=REVERSE_MACRO
+// CHECK: Identifier: "x" [10:23 - 10:24] macro definition=REVERSE_MACRO
+// CHECK: Punctuation: "," [10:24 - 10:25] macro definition=REVERSE_MACRO
+// CHECK: Identifier: "y" [10:25 - 10:26] macro definition=REVERSE_MACRO
+// CHECK: Punctuation: ")" [10:26 - 10:27] macro definition=REVERSE_MACRO
+// CHECK: Identifier: "y" [10:28 - 10:29] macro definition=REVERSE_MACRO
+// CHECK: Punctuation: "+" [10:30 - 10:31] macro definition=REVERSE_MACRO
+// CHECK: Identifier: "x" [10:32 - 10:33] macro definition=REVERSE_MACRO
// CHECK: Punctuation: "#" [11:1 - 11:2] preprocessing directive=
// CHECK: Identifier: "define" [11:2 - 11:8] preprocessing directive=
// CHECK: Identifier: "TWICE_MACRO" [11:9 - 11:20] macro definition=TWICE_MACRO
-// CHECK: Punctuation: "(" [11:20 - 11:21] preprocessing directive=
-// CHECK: Identifier: "y" [11:21 - 11:22] preprocessing directive=
-// CHECK: Punctuation: ")" [11:22 - 11:23] preprocessing directive=
-// CHECK: Identifier: "y" [11:24 - 11:25] preprocessing directive=
-// CHECK: Punctuation: "+" [11:26 - 11:27] preprocessing directive=
-// CHECK: Identifier: "y" [11:28 - 11:29] preprocessing directive=
+// CHECK: Punctuation: "(" [11:20 - 11:21] macro definition=TWICE_MACRO
+// CHECK: Identifier: "y" [11:21 - 11:22] macro definition=TWICE_MACRO
+// CHECK: Punctuation: ")" [11:22 - 11:23] macro definition=TWICE_MACRO
+// CHECK: Identifier: "y" [11:24 - 11:25] macro definition=TWICE_MACRO
+// CHECK: Punctuation: "+" [11:26 - 11:27] macro definition=TWICE_MACRO
+// CHECK: Identifier: "y" [11:28 - 11:29] macro definition=TWICE_MACRO
// CHECK: Keyword: "void" [13:1 - 13:5] FunctionDecl=test_macro_args:13:6 (Definition)
// CHECK: Identifier: "test_macro_args" [13:6 - 13:21] FunctionDecl=test_macro_args:13:6 (Definition)
// CHECK: Punctuation: "(" [13:21 - 13:22] FunctionDecl=test_macro_args:13:6 (Definition)
@@ -140,23 +140,23 @@ void test() {
// CHECK: Punctuation: "#" [21:1 - 21:2] preprocessing directive=
// CHECK: Identifier: "define" [21:2 - 21:8] preprocessing directive=
// CHECK: Identifier: "fun_with_macro_bodies" [21:9 - 21:30] macro definition=fun_with_macro_bodies
-// CHECK: Punctuation: "(" [21:30 - 21:31] preprocessing directive=
-// CHECK: Identifier: "x" [21:31 - 21:32] preprocessing directive=
-// CHECK: Punctuation: "," [21:32 - 21:33] preprocessing directive=
-// CHECK: Identifier: "y" [21:34 - 21:35] preprocessing directive=
-// CHECK: Punctuation: ")" [21:35 - 21:36] preprocessing directive=
-// CHECK: Keyword: "do" [21:37 - 21:39] preprocessing directive=
-// CHECK: Punctuation: "{" [21:40 - 21:41] preprocessing directive=
-// CHECK: Keyword: "if" [21:42 - 21:44] preprocessing directive=
-// CHECK: Punctuation: "(" [21:45 - 21:46] preprocessing directive=
-// CHECK: Identifier: "x" [21:46 - 21:47] preprocessing directive=
-// CHECK: Punctuation: ")" [21:47 - 21:48] preprocessing directive=
-// CHECK: Identifier: "y" [21:49 - 21:50] preprocessing directive=
-// CHECK: Punctuation: "}" [21:51 - 21:52] preprocessing directive=
-// CHECK: Keyword: "while" [21:53 - 21:58] preprocessing directive=
-// CHECK: Punctuation: "(" [21:59 - 21:60] preprocessing directive=
-// CHECK: Literal: "0" [21:60 - 21:61] preprocessing directive=
-// CHECK: Punctuation: ")" [21:61 - 21:62] preprocessing directive=
+// CHECK: Punctuation: "(" [21:30 - 21:31] macro definition=fun_with_macro_bodies
+// CHECK: Identifier: "x" [21:31 - 21:32] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: "," [21:32 - 21:33] macro definition=fun_with_macro_bodies
+// CHECK: Identifier: "y" [21:34 - 21:35] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: ")" [21:35 - 21:36] macro definition=fun_with_macro_bodies
+// CHECK: Keyword: "do" [21:37 - 21:39] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: "{" [21:40 - 21:41] macro definition=fun_with_macro_bodies
+// CHECK: Keyword: "if" [21:42 - 21:44] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: "(" [21:45 - 21:46] macro definition=fun_with_macro_bodies
+// CHECK: Identifier: "x" [21:46 - 21:47] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: ")" [21:47 - 21:48] macro definition=fun_with_macro_bodies
+// CHECK: Identifier: "y" [21:49 - 21:50] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: "}" [21:51 - 21:52] macro definition=fun_with_macro_bodies
+// CHECK: Keyword: "while" [21:53 - 21:58] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: "(" [21:59 - 21:60] macro definition=fun_with_macro_bodies
+// CHECK: Literal: "0" [21:60 - 21:61] macro definition=fun_with_macro_bodies
+// CHECK: Punctuation: ")" [21:61 - 21:62] macro definition=fun_with_macro_bodies
// CHECK: Keyword: "void" [23:1 - 23:5] FunctionDecl=test:23:6 (Definition)
// CHECK: Identifier: "test" [23:6 - 23:10] FunctionDecl=test:23:6 (Definition)
// CHECK: Punctuation: "(" [23:10 - 23:11] FunctionDecl=test:23:6 (Definition)
@@ -173,7 +173,7 @@ void test() {
// CHECK: Punctuation: "," [25:26 - 25:27] UnexposedStmt=
// CHECK: Punctuation: "{" [25:28 - 25:29] UnexposedStmt=
// CHECK: Keyword: "int" [25:30 - 25:33] UnexposedStmt=
-// CHECK: Identifier: "z" [25:34 - 25:35] VarDecl=z:25:3 (Definition)
+// CHECK: Identifier: "z" [25:34 - 25:35] VarDecl=z:25:34 (Definition)
// CHECK: Punctuation: "=" [25:36 - 25:37] UnexposedStmt=
// CHECK: Identifier: "x" [25:38 - 25:39] DeclRefExpr=x:24:7
// CHECK: Punctuation: ";" [25:39 - 25:40] UnexposedStmt=
diff --git a/test/Index/annotate-tokens.c b/test/Index/annotate-tokens.c
index e251596c8002..d692bd3bbac6 100644
--- a/test/Index/annotate-tokens.c
+++ b/test/Index/annotate-tokens.c
@@ -14,9 +14,14 @@ void g(int i, ...) {
__builtin_va_list va;
(void)__builtin_va_arg(va, Int);
(void)__builtin_types_compatible_p(Int, Int);
+
+ struct X x = { 0, 0 };
+ do {
+ x.a++;
+ } while (x.a < 10);
}
-// RUN: c-index-test -test-annotate-tokens=%s:4:1:17:1 %s | FileCheck %s
+// RUN: c-index-test -test-annotate-tokens=%s:4:1:22: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)
@@ -74,5 +79,21 @@ 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: 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=
+// CHECK: Identifier: "x" [20:5 - 20:6] DeclRefExpr=x:18:12
+// CHECK: Punctuation: "." [20:6 - 20:7] MemberRefExpr=a:2:16
+// CHECK: Identifier: "a" [20:7 - 20:8] MemberRefExpr=a:2:16
+// CHECK: Punctuation: "++" [20:8 - 20:10] UnexposedExpr=
+// CHECK: Punctuation: ";" [20:10 - 20:11] UnexposedStmt=
+// CHECK: Punctuation: "}" [21:3 - 21:4] UnexposedStmt=
+// CHECK: Keyword: "while" [21:5 - 21:10] UnexposedStmt=
+// CHECK: Punctuation: "(" [21:11 - 21:12] UnexposedStmt=
+// CHECK: Identifier: "x" [21:12 - 21:13] DeclRefExpr=x:18:12
+// CHECK: Punctuation: "." [21:13 - 21:14] MemberRefExpr=a:2:16
+// CHECK: Identifier: "a" [21:14 - 21:15] MemberRefExpr=a:2:16
+
// 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 dca7af2bf740..3138babf0aaf 100644
--- a/test/Index/annotate-tokens.cpp
+++ b/test/Index/annotate-tokens.cpp
@@ -1,9 +1,10 @@
struct bonk { };
void test(bonk X) {
X = X;
+ __is_base_of(bonk, bonk);
}
-// RUN: c-index-test -test-annotate-tokens=%s:1:1:5:5 %s
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:6:5 %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)
@@ -17,7 +18,14 @@ void test(bonk X) {
// CHECK: Punctuation: ")" [2:17 - 2:18] FunctionDecl=test:2:6 (Definition)
// CHECK: Punctuation: "{" [2:19 - 2:20] UnexposedStmt=
// CHECK: Identifier: "X" [3:5 - 3:6] DeclRefExpr=X:2:16
-// CHECK: Punctuation: "=" [3:7 - 3:8] DeclRefExpr=operator=:1:8
+// CHECK: Punctuation: "=" [3:7 - 3:8] CallExpr=operator=:1:8
// CHECK: Identifier: "X" [3:9 - 3:10] DeclRefExpr=X:2:16
// CHECK: Punctuation: ";" [3:10 - 3:11] UnexposedStmt=
-// CHECK: Punctuation: "}" [4:1 - 4:2] UnexposedStmt=
+// CHECK: Keyword: "__is_base_of" [4:5 - 4:17] UnexposedExpr=
+// CHECK: Punctuation: "(" [4:17 - 4:18] UnexposedExpr=
+// CHECK: Identifier: "bonk" [4:18 - 4:22] TypeRef=struct bonk:1:8
+// CHECK: Punctuation: "," [4:22 - 4:23] UnexposedExpr=
+// CHECK: Identifier: "bonk" [4:24 - 4:28] TypeRef=struct bonk:1:8
+// CHECK: Punctuation: ")" [4:28 - 4:29] UnexposedExpr=
+// CHECK: Punctuation: ";" [4:29 - 4:30] UnexposedStmt=
+// CHECK: Punctuation: "}" [5:1 - 5:2] UnexposedStmt=
diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m
index 336951b7fe1a..f4d47ac4ae55 100644
--- a/test/Index/annotate-tokens.m
+++ b/test/Index/annotate-tokens.m
@@ -77,9 +77,66 @@ extern int ibaction_test(void);
int second = [self foo:0];
return local;
}
+- (int)othermethod:(IBOutletTests *)ibt {
+ return *ibt.aPropOutlet;
+}
+@end
+
+@protocol Proto @end
+
+void f() {
+ (void)@protocol(Proto);
+}
+
+// <rdar://problem/8595462> - Properly annotate functions and variables
+// declared within an @implementation.
+@class Rdar8595462_A;
+@interface Rdar8595462_B
+@end
+
+@implementation Rdar8595462_B
+Rdar8595462_A * Rdar8595462_aFunction() {
+ Rdar8595462_A * localVar = 0;
+ return localVar;
+}
+static Rdar8595462_A * Rdar8595462_staticVar;
+@end
+
+// <rdar://problem/8595386> Issues doing syntax coloring of properties
+@interface Rdar8595386 {
+ Foo *_foo;
+}
+
+@property (readonly, copy) Foo *foo;
+@property (readonly) Foo *foo2;
@end
-// RUN: c-index-test -test-annotate-tokens=%s:1:1:80:4 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s
+@implementation Rdar8595386
+@synthesize foo = _foo;
+@dynamic foo2;
+@end
+
+// <rdar://problem/8778404> Blocks don't get colored if annotation starts within the block itself
+@interface Rdar8778404
+@end
+
+@implementation Rdar8778404
+- (int)blah:(int)arg, ... { return arg; }
+- (int)blarg:(int)x {
+ (void)^ {
+ int result = [self blah:5, x];
+ Rdar8778404 *a = self;
+ return 0;
+ };
+}
+@end
+
+@interface Rdar8062781
++ (Foo*)getB;
+@property (readonly, nonatomic) Foo *blah;
+@end
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:118:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s
// CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12
// CHECK: Keyword: "interface" [1:2 - 1:11] ObjCInterfaceDecl=Foo:1:12
// CHECK: Identifier: "Foo" [1:12 - 1:15] ObjCInterfaceDecl=Foo:1:12
@@ -253,22 +310,22 @@ extern int ibaction_test(void);
// CHECK: Identifier: "anOutlet" [53:21 - 53:29] ObjCIvarDecl=anOutlet:53:21 (Definition)
// CHECK: Punctuation: ";" [53:29 - 53:30] ObjCInterfaceDecl=IBOutletTests:51:12
// CHECK: Punctuation: "}" [54:1 - 54:2] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: "-" [55:1 - 55:2] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: "(" [55:3 - 55:4] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: "-" [55:1 - 55:2] ObjCInstanceMethodDecl=actionMethod::55:1
+// CHECK: Punctuation: "(" [55:3 - 55:4] ObjCInstanceMethodDecl=actionMethod::55:1
// CHECK: Identifier: "IBAction" [55:4 - 55:12] macro instantiation=IBAction
-// CHECK: Punctuation: ")" [55:12 - 55:13] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Identifier: "actionMethod" [55:14 - 55:26] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: ":" [55:26 - 55:27] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: "(" [55:27 - 55:28] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Identifier: "id" [55:28 - 55:30] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: ")" [55:30 - 55:31] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Identifier: "arg" [55:31 - 55:34] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: ";" [55:34 - 55:35] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: "@" [56:1 - 56:2] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Keyword: "property" [56:2 - 56:10] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Punctuation: ")" [55:12 - 55:13] ObjCInstanceMethodDecl=actionMethod::55:1
+// CHECK: Identifier: "actionMethod" [55:14 - 55:26] ObjCInstanceMethodDecl=actionMethod::55:1
+// CHECK: Punctuation: ":" [55:26 - 55:27] ObjCInstanceMethodDecl=actionMethod::55:1
+// CHECK: Punctuation: "(" [55:27 - 55:28] ObjCInstanceMethodDecl=actionMethod::55:1
+// CHECK: Identifier: "id" [55:28 - 55:30] TypeRef=id:0:0
+// CHECK: Punctuation: ")" [55:30 - 55:31] ParmDecl=arg:55:31 (Definition)
+// CHECK: Identifier: "arg" [55:31 - 55:34] ParmDecl=arg:55:31 (Definition)
+// CHECK: Punctuation: ";" [55:34 - 55:35] ObjCInstanceMethodDecl=actionMethod::55:1
+// CHECK: Punctuation: "@" [56:1 - 56:2] ObjCPropertyDecl=aPropOutlet:56:26
+// CHECK: Keyword: "property" [56:2 - 56:10] ObjCPropertyDecl=aPropOutlet:56:26
// CHECK: Identifier: "IBOutlet" [56:11 - 56:19] macro instantiation=IBOutlet
-// CHECK: Keyword: "int" [56:20 - 56:23] ObjCInterfaceDecl=IBOutletTests:51:12
-// CHECK: Punctuation: "*" [56:24 - 56:25] ObjCInterfaceDecl=IBOutletTests:51:12
+// CHECK: Keyword: "int" [56:20 - 56:23] ObjCPropertyDecl=aPropOutlet:56:26
+// CHECK: Punctuation: "*" [56:24 - 56:25] ObjCPropertyDecl=aPropOutlet:56:26
// CHECK: Identifier: "aPropOutlet" [56:26 - 56:37] ObjCPropertyDecl=aPropOutlet:56:26
// CHECK: Punctuation: ";" [56:37 - 56:38] ObjCInterfaceDecl=IBOutletTests:51:12
// CHECK: Punctuation: "@" [57:1 - 57:2] ObjCInterfaceDecl=IBOutletTests:51:12
@@ -276,7 +333,7 @@ extern int ibaction_test(void);
// CHECK: Punctuation: "#" [63:1 - 63:2] preprocessing directive=
// CHECK: Identifier: "define" [63:2 - 63:8] preprocessing directive=
// CHECK: Identifier: "VAL" [63:9 - 63:12] macro definition=VAL
-// CHECK: Literal: "0" [63:13 - 63:14] preprocessing directive=
+// CHECK: Literal: "0" [63:13 - 63:14] macro definition=VAL
// CHECK: Punctuation: "@" [65:1 - 65:2] ObjCInterfaceDecl=R7974151:65:12
// CHECK: Keyword: "interface" [65:2 - 65:11] ObjCInterfaceDecl=R7974151:65:12
// CHECK: Identifier: "R7974151" [65:12 - 65:20] ObjCInterfaceDecl=R7974151:65:12
@@ -347,5 +404,147 @@ extern int ibaction_test(void);
// CHECK: Identifier: "local" [78:12 - 78:17] DeclRefExpr=local:76:9
// CHECK: Punctuation: ";" [78:17 - 78:18] UnexposedStmt=
// CHECK: Punctuation: "}" [79:1 - 79:2] UnexposedStmt=
-// CHECK: Punctuation: "@" [80:1 - 80:2] ObjCImplementationDecl=R7974151:70:1 (Definition)
-// CHECK: Keyword: "end" [80:2 - 80:5]
+// CHECK: Punctuation: "-" [80:1 - 80:2] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Punctuation: "(" [80:3 - 80:4] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Keyword: "int" [80:4 - 80:7] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Punctuation: ")" [80:7 - 80:8] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Identifier: "othermethod" [80:8 - 80:19] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Punctuation: ":" [80:19 - 80:20] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Punctuation: "(" [80:20 - 80:21] ObjCInstanceMethodDecl=othermethod::80:1 (Definition)
+// CHECK: Identifier: "IBOutletTests" [80:21 - 80:34] ObjCClassRef=IBOutletTests:51:12
+// CHECK: Punctuation: "*" [80:35 - 80:36] ParmDecl=ibt:80:37 (Definition)
+// CHECK: Punctuation: ")" [80:36 - 80:37] ParmDecl=ibt:80:37 (Definition)
+// CHECK: Identifier: "ibt" [80:37 - 80:40] ParmDecl=ibt:80:37 (Definition)
+// CHECK: Punctuation: "{" [80:41 - 80:42] UnexposedStmt=
+// CHECK: Keyword: "return" [81:3 - 81:9] UnexposedStmt=
+// CHECK: Punctuation: "*" [81:10 - 81:11] UnexposedExpr=
+// CHECK: Identifier: "ibt" [81:11 - 81:14] DeclRefExpr=ibt:80:37
+// CHECK: Punctuation: "." [81:14 - 81:15] MemberRefExpr=aPropOutlet:56:26
+// CHECK: Identifier: "aPropOutlet" [81:15 - 81:26] MemberRefExpr=aPropOutlet:56:26
+// CHECK: Punctuation: ";" [81:26 - 81:27] UnexposedStmt=
+// CHECK: Punctuation: "}" [82:1 - 82:2] UnexposedStmt=
+// CHECK: Punctuation: "@" [83:1 - 83:2] ObjCImplementationDecl=R7974151:70:1 (Definition)
+// CHECK: Keyword: "end" [83:2 - 83:5]
+// CHECK: Punctuation: "@" [85:1 - 85:2] ObjCProtocolDecl=Proto:85:1 (Definition)
+// CHECK: Keyword: "protocol" [85:2 - 85:10] ObjCProtocolDecl=Proto:85:1 (Definition)
+// CHECK: Identifier: "Proto" [85:11 - 85:16] ObjCProtocolDecl=Proto:85:1 (Definition)
+// CHECK: Punctuation: "@" [85:17 - 85:18] ObjCProtocolDecl=Proto:85:1 (Definition)
+// CHECK: Keyword: "end" [85:18 - 85:21] ObjCProtocolDecl=Proto:85:1 (Definition)
+// CHECK: Keyword: "void" [87:1 - 87:5] FunctionDecl=f:87:6 (Definition)
+// CHECK: Identifier: "f" [87:6 - 87:7] FunctionDecl=f:87:6 (Definition)
+// CHECK: Punctuation: "(" [87:7 - 87:8] FunctionDecl=f:87:6 (Definition)
+// CHECK: Punctuation: ")" [87:8 - 87:9] FunctionDecl=f:87:6 (Definition)
+// CHECK: Punctuation: "{" [87:10 - 87:11] UnexposedStmt=
+// CHECK: Punctuation: "(" [88:3 - 88:4] UnexposedExpr=Proto:85:1
+// CHECK: Keyword: "void" [88:4 - 88:8] UnexposedExpr=Proto:85:1
+// CHECK: Punctuation: ")" [88:8 - 88:9] UnexposedExpr=Proto:85:1
+// CHECK: Punctuation: "@" [88:9 - 88:10] UnexposedExpr=Proto:85:1
+// CHECK: Keyword: "protocol" [88:10 - 88:18] UnexposedExpr=Proto:85:1
+// CHECK: Punctuation: "(" [88:18 - 88:19] UnexposedExpr=Proto:85:1
+// CHECK: Identifier: "Proto" [88:19 - 88:24] UnexposedExpr=Proto:85:1
+// CHECK: Punctuation: ")" [88:24 - 88:25] UnexposedExpr=Proto:85:1
+// CHECK: Punctuation: ";" [88:25 - 88:26] UnexposedStmt=
+// CHECK: Punctuation: "}" [89:1 - 89:2] UnexposedStmt=
+// CHECK: Punctuation: "@" [93:1 - 93:2] UnexposedDecl=[93:8]
+// CHECK: Keyword: "class" [93:2 - 93:7] UnexposedDecl=[93:8]
+// CHECK: Identifier: "Rdar8595462_A" [93:8 - 93:21] ObjCClassRef=Rdar8595462_A:93:8
+// CHECK: Punctuation: ";" [93:21 - 93:22]
+// CHECK: Punctuation: "@" [94:1 - 94:2] ObjCInterfaceDecl=Rdar8595462_B:94:12
+// CHECK: Keyword: "interface" [94:2 - 94:11] ObjCInterfaceDecl=Rdar8595462_B:94:12
+// CHECK: Identifier: "Rdar8595462_B" [94:12 - 94:25] ObjCInterfaceDecl=Rdar8595462_B:94:12
+// CHECK: Punctuation: "@" [95:1 - 95:2] ObjCInterfaceDecl=Rdar8595462_B:94:12
+// CHECK: Keyword: "end" [95:2 - 95:5] ObjCInterfaceDecl=Rdar8595462_B:94:12
+// CHECK: Punctuation: "@" [97:1 - 97:2] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition)
+// CHECK: Keyword: "implementation" [97:2 - 97:16] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition)
+// CHECK: Identifier: "Rdar8595462_B" [97:17 - 97:30] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition)
+// CHECK: Identifier: "Rdar8595462_A" [98:1 - 98:14] ObjCClassRef=Rdar8595462_A:93:8
+// CHECK: Punctuation: "*" [98:15 - 98:16] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition)
+// CHECK: Identifier: "Rdar8595462_aFunction" [98:17 - 98:38] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition)
+// CHECK: Punctuation: "(" [98:38 - 98:39] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition)
+// CHECK: Punctuation: ")" [98:39 - 98:40] FunctionDecl=Rdar8595462_aFunction:98:17 (Definition)
+// CHECK: Punctuation: "{" [98:41 - 98:42] UnexposedStmt=
+// CHECK: Identifier: "Rdar8595462_A" [99:3 - 99:16] ObjCClassRef=Rdar8595462_A:93:8
+// CHECK: Punctuation: "*" [99:17 - 99:18] VarDecl=localVar:99:19 (Definition)
+// CHECK: Identifier: "localVar" [99:19 - 99:27] VarDecl=localVar:99:19 (Definition)
+// CHECK: Punctuation: "=" [99:28 - 99:29] VarDecl=localVar:99:19 (Definition)
+// CHECK: Literal: "0" [99:30 - 99:31] UnexposedExpr=
+// CHECK: Punctuation: ";" [99:31 - 99:32] UnexposedStmt=
+// CHECK: Keyword: "return" [100:3 - 100:9] UnexposedStmt=
+// CHECK: Identifier: "localVar" [100:10 - 100:18] DeclRefExpr=localVar:99:19
+// CHECK: Punctuation: ";" [100:18 - 100:19] UnexposedStmt=
+// CHECK: Punctuation: "}" [101:1 - 101:2] UnexposedStmt=
+// CHECK: Keyword: "static" [102:1 - 102:7] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition)
+// CHECK: Identifier: "Rdar8595462_A" [102:8 - 102:21] ObjCClassRef=Rdar8595462_A:93:8
+// CHECK: Punctuation: "*" [102:22 - 102:23] VarDecl=Rdar8595462_staticVar:102:24
+// CHECK: Identifier: "Rdar8595462_staticVar" [102:24 - 102:45] VarDecl=Rdar8595462_staticVar:102:24
+// CHECK: Punctuation: ";" [102:45 - 102:46] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition)
+// CHECK: Punctuation: "@" [103:1 - 103:2] ObjCImplementationDecl=Rdar8595462_B:97:1 (Definition)
+// CHECK: Keyword: "end" [103:2 - 103:5]
+
+// 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: Punctuation: "," [110:20 - 110:21] ObjCPropertyDecl=foo:110:33
+// CHECK: Identifier: "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: 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
+// CHECK: Identifier: "foo2" [111:27 - 111:31] ObjCPropertyDecl=foo2:111:27
+
+// CHECK: Punctuation: "@" [115:1 - 115:2] UnexposedDecl=foo:110:33 (Definition)
+// CHECK: Keyword: "synthesize" [115:2 - 115:12] UnexposedDecl=foo:110:33 (Definition)
+// CHECK: Identifier: "foo" [115:13 - 115:16] UnexposedDecl=foo:110:33 (Definition)
+// CHECK: Punctuation: "=" [115:17 - 115:18] UnexposedDecl=foo:110:33 (Definition)
+// CHECK: Identifier: "_foo" [115:19 - 115:23] MemberRef=_foo:107:8
+// CHECK: Punctuation: ";" [115:23 - 115:24] ObjCImplementationDecl=Rdar8595386:114:1 (Definition)
+
+// RUN: c-index-test -test-annotate-tokens=%s:127:1:130:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-INSIDE_BLOCK %s
+// CHECK-INSIDE_BLOCK: Keyword: "int" [127:5 - 127:8] VarDecl=result:127:9 (Definition)
+// CHECK-INSIDE_BLOCK: Identifier: "result" [127:9 - 127:15] VarDecl=result:127:9 (Definition)
+// CHECK-INSIDE_BLOCK: Punctuation: "=" [127:16 - 127:17] VarDecl=result:127:9 (Definition)
+// CHECK-INSIDE_BLOCK: Punctuation: "[" [127:18 - 127:19] ObjCMessageExpr=blah::124:1
+// CHECK-INSIDE_BLOCK: Identifier: "self" [127:19 - 127:23] DeclRefExpr=self:0:0
+// CHECK-INSIDE_BLOCK: Identifier: "blah" [127:24 - 127:28] ObjCMessageExpr=blah::124:1
+// CHECK-INSIDE_BLOCK: Punctuation: ":" [127:28 - 127:29] ObjCMessageExpr=blah::124:1
+// CHECK-INSIDE_BLOCK: Literal: "5" [127:29 - 127:30] UnexposedExpr=
+// CHECK-INSIDE_BLOCK: Punctuation: "," [127:30 - 127:31] ObjCMessageExpr=blah::124:1
+// CHECK-INSIDE_BLOCK: Identifier: "x" [127:32 - 127:33] DeclRefExpr=x:125:19
+// CHECK-INSIDE_BLOCK: Punctuation: "]" [127:33 - 127:34] ObjCMessageExpr=blah::124:1
+// CHECK-INSIDE_BLOCK: Punctuation: ";" [127:34 - 127:35] UnexposedStmt=
+// CHECK-INSIDE_BLOCK: Identifier: "Rdar8778404" [128:5 - 128:16] ObjCClassRef=Rdar8778404:120:12
+// CHECK-INSIDE_BLOCK: Punctuation: "*" [128:17 - 128:18] VarDecl=a:128:18 (Definition)
+// CHECK-INSIDE_BLOCK: Identifier: "a" [128:18 - 128:19] VarDecl=a:128:18 (Definition)
+// CHECK-INSIDE_BLOCK: Punctuation: "=" [128:20 - 128:21] VarDecl=a:128:18 (Definition)
+// CHECK-INSIDE_BLOCK: Identifier: "self" [128:22 - 128:26] DeclRefExpr=self:0:0
+
+// RUN: c-index-test -test-annotate-tokens=%s:134:1:137:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck -check-prefix=CHECK-PROP-AFTER-METHOD %s
+// CHECK-PROP-AFTER-METHOD: Punctuation: "@" [134:1 - 134:2] ObjCInterfaceDecl=Rdar8062781:134:12
+// CHECK-PROP-AFTER-METHOD: Keyword: "interface" [134:2 - 134:11] ObjCInterfaceDecl=Rdar8062781:134:12
+// CHECK-PROP-AFTER-METHOD: Identifier: "Rdar8062781" [134:12 - 134:23] ObjCInterfaceDecl=Rdar8062781:134:12
+// CHECK-PROP-AFTER-METHOD: Punctuation: "+" [135:1 - 135:2] ObjCClassMethodDecl=getB:135:1
+// CHECK-PROP-AFTER-METHOD: Punctuation: "(" [135:3 - 135:4] ObjCClassMethodDecl=getB:135:1
+// CHECK-PROP-AFTER-METHOD: Identifier: "Foo" [135:4 - 135:7] ObjCClassRef=Foo:1:12
+// CHECK-PROP-AFTER-METHOD: Punctuation: "*" [135:7 - 135:8] ObjCClassMethodDecl=getB:135:1
+// CHECK-PROP-AFTER-METHOD: Punctuation: ")" [135:8 - 135:9] ObjCClassMethodDecl=getB:135:1
+// CHECK-PROP-AFTER-METHOD: Identifier: "getB" [135:9 - 135:13] ObjCClassMethodDecl=getB:135:1
+// CHECK-PROP-AFTER-METHOD: Punctuation: ";" [135:13 - 135:14] ObjCClassMethodDecl=getB:135:1
+// 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: 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: 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
+// CHECK-PROP-AFTER-METHOD: Identifier: "blah" [136:38 - 136:42] ObjCPropertyDecl=blah:136:38
+// CHECK-PROP-AFTER-METHOD: Punctuation: ";" [136:42 - 136:43] ObjCInterfaceDecl=Rdar8062781:134:12
+// CHECK-PROP-AFTER-METHOD: Punctuation: "@" [137:1 - 137:2] ObjCInterfaceDecl=Rdar8062781:134:12
diff --git a/test/Index/blocks.c b/test/Index/blocks.c
index 08241cbcd196..a8965d2aa670 100644
--- a/test/Index/blocks.c
+++ b/test/Index/blocks.c
@@ -5,25 +5,30 @@ struct foo { long x; };
void test() {
static struct foo _foo;
- ^ int_t(struct foo *foo) { return (int_t) foo->x; }(&_foo);
+ __block i = 0;
+ ^ int_t(struct foo *foo) { return (int_t) foo->x + i; }(&_foo);
}
-// TODO: expose the BlockExpr, CastExpr, and UnaryOperatorExpr here
-
-// CHECK: blocks.c:3:13: TypedefDecl=int_t:3:13 (Definition) Extent=[3:13 - 3:18]
-// CHECK: blocks.c:4:8: StructDecl=foo:4:8 (Definition) Extent=[4:1 - 4:23]
-// CHECK: blocks.c:4:19: FieldDecl=x:4:19 (Definition) Extent=[4:19 - 4:20]
-// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:6 - 9:2]
+// CHECK: blocks.c:6:6: FunctionDecl=test:6:6 (Definition) Extent=[6:6 - 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:17: TypeRef=struct foo:4:8 Extent=[7:17 - 7:20]
-// CHECK: blocks.c:8:3: CallExpr= Extent=[8:3 - 8:61]
-// CHECK: blocks.c:8:3: UnexposedExpr= Extent=[8:3 - 8:54]
-// CHECK: blocks.c:8:5: TypeRef=int_t:3:13 Extent=[8:5 - 8:10]
-// CHECK: blocks.c:8:23: ParmDecl=foo:8:23 (Definition) Extent=[8:18 - 8:26]
-// CHECK: blocks.c:8:18: TypeRef=struct foo:4:8 Extent=[8:18 - 8:21]
-// CHECK: blocks.c:8:37: UnexposedExpr=x:4:19 Extent=[8:37 - 8:51]
-// CHECK: blocks.c:8:38: TypeRef=int_t:3:13 Extent=[8:38 - 8:43]
-// CHECK: blocks.c:8:50: MemberRefExpr=x:4:19 Extent=[8:45 - 8:51]
-// CHECK: blocks.c:8:45: DeclRefExpr=foo:8:23 Extent=[8:45 - 8:48]
-// CHECK: blocks.c:8:55: UnexposedExpr= Extent=[8:55 - 8:60]
-// CHECK: blocks.c:8:56: DeclRefExpr=_foo:7:21 Extent=[8:56 - 8:60]
+// CHECK: blocks.c:8:11: VarDecl=i:8:11 (Definition) Extent=[8:11 - 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: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]
+// CHECK: blocks.c:9:37: UnexposedExpr= Extent=[9:37 - 9:55]
+// CHECK: blocks.c:9:37: UnexposedExpr=x:4:19 Extent=[9:37 - 9:51]
+// CHECK: blocks.c:9:38: TypeRef=int_t:3:13 Extent=[9:38 - 9:43]
+// CHECK: blocks.c:9:50: MemberRefExpr=x:4:19 Extent=[9:45 - 9:51]
+// CHECK: blocks.c:9:45: DeclRefExpr=foo:9:23 Extent=[9:45 - 9:48]
+// CHECK: blocks.c:9:54: DeclRefExpr=i:8:11 Extent=[9:54 - 9:55]
+// CHECK: blocks.c:9:59: UnexposedExpr= Extent=[9:59 - 9:64]
+// CHECK: blocks.c:9:60: DeclRefExpr=_foo:7:21 Extent=[9:60 - 9:64]
+
diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m
index 5fe7cd669bc2..f34593f3e85e 100644
--- a/test/Index/c-index-api-loadTU-test.m
+++ b/test/Index/c-index-api-loadTU-test.m
@@ -103,23 +103,18 @@ struct X0 {};
// 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: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: <invalid loc>:0:0: UnexposedStmt= Extent=[46:42 - 55:2]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[47:2 - 47:12]
// 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: <invalid loc>:0:0: UnexposedStmt= Extent=[48:2 - 48:19]
// CHECK: c-index-api-loadTU-test.m:48:5: VarDecl=a:48:5 (Definition) Extent=[48:2 - 48:18]
// CHECK: c-index-api-loadTU-test.m:48:2: TypeRef=id:0:0 Extent=[48:2 - 48:4]
// CHECK: c-index-api-loadTU-test.m:48:9: ObjCMessageExpr=foo:9:1 Extent=[48:9 - 48:18]
// CHECK: c-index-api-loadTU-test.m:48:10: DeclRefExpr=bee:47:8 Extent=[48:10 - 48:13]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[49:2 - 49:27]
// CHECK: c-index-api-loadTU-test.m:49:12: VarDecl=c:49:12 (Definition) Extent=[49:2 - 49:26]
// CHECK: c-index-api-loadTU-test.m:49:2: TypeRef=id:0:0 Extent=[49:2 - 49:4]
// CHECK: c-index-api-loadTU-test.m:49:6: ObjCProtocolRef=SubP:29:1 Extent=[49:6 - 49:10]
// CHECK: c-index-api-loadTU-test.m:49:16: UnexposedExpr=fooC:10:1 Extent=[49:16 - 49:26]
// CHECK: c-index-api-loadTU-test.m:49:16: ObjCMessageExpr=fooC:10:1 Extent=[49:16 - 49:26]
// CHECK: c-index-api-loadTU-test.m:49:17: ObjCClassRef=Foo:4:12 Extent=[49:17 - 49:20]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[50:2 - 50:15]
// CHECK: c-index-api-loadTU-test.m:50:13: VarDecl=d:50:13 (Definition) Extent=[50:2 - 50:14]
// CHECK: c-index-api-loadTU-test.m:50:2: TypeRef=id:0:0 Extent=[50:2 - 50:4]
// CHECK: c-index-api-loadTU-test.m:50:6: ObjCProtocolRef=Proto:25:1 Extent=[50:6 - 50:11]
diff --git a/test/Index/c-index-getCursor-pp.c b/test/Index/c-index-getCursor-pp.c
index 67fcfef2e4be..8f986912cd6b 100644
--- a/test/Index/c-index-getCursor-pp.c
+++ b/test/Index/c-index-getCursor-pp.c
@@ -6,13 +6,30 @@ void OBSCURE(func)(int x) {
OBSCURE(T) DECORATION value;
}
-// RUN: c-index-test -cursor-at=%s:1:11 %s | FileCheck -check-prefix=CHECK-1 %s
+#include "a.h"
+
+#define A(X) X
+#define B(X) A(X)
+
+B(int x);
+
+// RUN: c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s
// CHECK-1: macro definition=OBSCURE
-// RUN: c-index-test -cursor-at=%s:2:14 %s | FileCheck -check-prefix=CHECK-2 %s
+// RUN: c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s
// CHECK-2: macro definition=DECORATION
-// RUN: c-index-test -cursor-at=%s:5:7 %s | FileCheck -check-prefix=CHECK-3 %s
+// RUN: c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s
// CHECK-3: macro instantiation=OBSCURE:1:9
-// RUN: c-index-test -cursor-at=%s:6:6 %s | FileCheck -check-prefix=CHECK-4 %s
+// RUN: c-index-test -cursor-at=%s:6:6 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-4 %s
// CHECK-4: macro instantiation=OBSCURE:1:9
-// RUN: c-index-test -cursor-at=%s:6:19 %s | FileCheck -check-prefix=CHECK-5 %s
+// RUN: c-index-test -cursor-at=%s:6:19 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-5 %s
// CHECK-5: macro instantiation=DECORATION:2:9
+// RUN: c-index-test -cursor-at=%s:9:10 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-6 %s
+// CHECK-6: inclusion directive=a.h
+// RUN: c-index-test -cursor-at=%s:14:1 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-7 %s
+// CHECK-7: macro instantiation=B:12:9
+
+// Same tests, but with "editing" optimizations
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:1:11 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-1 %s
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:2:14 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-2 %s
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:5:7 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-3 %s
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -cursor-at=%s:9:10 -I%S/Inputs %s | FileCheck -check-prefix=CHECK-6 %s
diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m
index 3cf1b6dcfa0d..91482eb798a4 100644
--- a/test/Index/c-index-getCursor-test.m
+++ b/test/Index/c-index-getCursor-test.m
@@ -94,8 +94,8 @@ void f() {
// CHECK: [31:18 - 31:21] ObjCSuperClassRef=Bar:12:12
// CHECK: [31:21 - 31:23] ObjCInterfaceDecl=Baz:31:12
// CHECK: [31:23 - 31:27] ObjCProtocolRef=SubP:27:1
-// CHECK: [31:27 - 33:9] ObjCInterfaceDecl=Baz:31:12
-// CHECK: [33:9 - 33:16] ObjCIvarDecl=_anIVar:33:9 (Definition)
+// CHECK: [31:27 - 33:5] ObjCInterfaceDecl=Baz:31:12
+// CHECK: [33:5 - 33:16] ObjCIvarDecl=_anIVar:33:9 (Definition)
// CHECK: [33:16 - 36:1] ObjCInterfaceDecl=Baz:31:12
// CHECK: [36:1 - 36:4] ObjCInstanceMethodDecl=bazMethod:36:1
// CHECK: [36:4 - 36:7] ObjCClassRef=Foo:3:12
@@ -105,8 +105,8 @@ void f() {
// CHECK: [40:1 - 41:3] EnumDecl=:40:1 (Definition)
// CHECK: [41:3 - 41:11] EnumConstantDecl=someEnum:41:3 (Definition)
// CHECK: [41:11 - 42:2] EnumDecl=:40:1 (Definition)
-// CHECK: [42:2 - 44:5] Invalid Cursor => NoDeclFound
-// CHECK: [44:5 - 44:11] FunctionDecl=main:44:5 (Definition)
+// 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)
@@ -163,6 +163,6 @@ void f() {
// CHECK: [52:36 - 52:37] CallExpr=main:44:5
// CHECK: [52:37 - 53:2] UnexposedStmt=
// CHECK: [55:9 - 55:26] macro definition=CONCAT
-// CHECK: [57:6 - 57:10] FunctionDecl=f:57:6 (Definition)
+// CHECK: [57:1 - 57:10] FunctionDecl=f:57:6 (Definition)
// CHECK: [58:4 - 58:8] VarDecl=my_var:58:8 (Definition)
// CHECK: [58:8 - 58:14] macro instantiation=CONCAT:55:9
diff --git a/test/Index/c-index-redecls.c b/test/Index/c-index-redecls.c
new file mode 100644
index 000000000000..0cf2f032a3c7
--- /dev/null
+++ b/test/Index/c-index-redecls.c
@@ -0,0 +1,107 @@
+// RUN: %clang_cc1 -emit-pch -o %t.ast %s
+// RUN: c-index-test -test-load-tu %t.ast all
+
+// rdar://8956193 - We would blow the thread stack because of nested calls due
+// to redeclarations.
+
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
+void socrates(void);
diff --git a/test/Index/cindex-on-invalid-usrs.m b/test/Index/cindex-on-invalid-usrs.m
new file mode 100644
index 000000000000..01002bc30f3c
--- /dev/null
+++ b/test/Index/cindex-on-invalid-usrs.m
@@ -0,0 +1,7 @@
+// RUN: c-index-test -test-load-source-usrs local %s 2>&1 | FileCheck %s
+
+// <rdar://problem/8452791> - Crash when generating USRs.
+@interface Rdar8452791 () - (void)rdar8452791;
+
+// CHECK: error: cannot find interface declaration for 'Rdar8452791'
+// CHECK: missing @end
diff --git a/test/Index/code-complete-errors.c b/test/Index/code-complete-errors.c
deleted file mode 100644
index 01c298c01d99..000000000000
--- a/test/Index/code-complete-errors.c
+++ /dev/null
@@ -1,16 +0,0 @@
-_Complex cd; // CHECK: code-complete-errors.c:1:1: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'
-// CHECK: FIX-IT: Insert " double" at 1:9
-struct s {
- int x, y;; // CHECK: code-complete-errors.c:4:12: warning: extra ';' inside a struct
-}; // CHECK: FIX-IT: Remove [4:12 - 4:13]
-
-struct s s0 = { y: 5 }; // CHECK: code-complete-errors.c:7:20: warning: use of GNU old-style field designator extension
-// CHECK: FIX-IT: Replace [7:17 - 7:19] with ".y = "
-int f(int *ptr1, float *ptr2) {
- return ptr1 != ptr2; // CHECK: code-complete-errors.c:10:15:{10:10-10:14}{10:18-10:22}: warning: comparison of distinct pointer types ('int *' and 'float *')
-}
-
-void g() { }
-
-// RUN: c-index-test -code-completion-at=%s:13:12 -pedantic %s 2> %t
-// RUN: FileCheck -check-prefix=CHECK %s < %t
diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp
index 7b0c8d75d81e..62b9e4dd1adc 100644
--- a/test/Index/code-completion.cpp
+++ b/test/Index/code-completion.cpp
@@ -41,10 +41,10 @@ Z::operator int() const {
// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member}
// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member}
// CHECK-MEMBER: CXXMethod:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
-// CHECK-MEMBER: CXXConversion:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
-// CHECK-MEMBER: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder Z const &}{RightParen )}
-// CHECK-MEMBER: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder X const &}{RightParen )}
-// CHECK-MEMBER: CXXMethod:{ResultType Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder Y const &}{RightParen )}
+// CHECK-MEMBER: CXXConversion:{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
+// CHECK-MEMBER: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )}
+// CHECK-MEMBER: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )}
+// CHECK-MEMBER: CXXMethod:{ResultType Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )}
// CHECK-MEMBER: EnumConstantDecl:{ResultType X::E}{Informative E::}{TypedText Val1}
// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
@@ -58,10 +58,10 @@ Z::operator int() const {
// CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
// RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s
-// CHECK-EXPR: NotImplemented:{TypedText int} (65)
-// CHECK-EXPR: NotImplemented:{TypedText long} (65)
-// CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (10)
-// CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (5)
-// CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (11)
-// CHECK-EXPR: CXXMethod:{ResultType void}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} (22)
+// CHECK-EXPR: NotImplemented:{TypedText int} (50)
+// CHECK-EXPR: NotImplemented:{TypedText long} (50)
+// CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (17)
+// CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (9)
+// CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (18)
+// CHECK-EXPR: CXXMethod:{ResultType void}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} (37)
// CHECK-EXPR: Namespace:{TypedText N}{Text ::} (75)
diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m
index 219d434ea4da..1e97d45162be 100644
--- a/test/Index/complete-at-directives.m
+++ b/test/Index/complete-at-directives.m
@@ -5,25 +5,25 @@
@implementation MyClass
@end
-// RUN: c-index-test -code-completion-at=%s:2:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder name}
// CHECK-CC1: {TypedText compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText implementation}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText interface}{HorizontalSpace }{Placeholder class}
// CHECK-CC1: {TypedText protocol}{HorizontalSpace }{Placeholder protocol}
-// RUN: c-index-test -code-completion-at=%s:3:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:3:2 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: {TypedText end}
// CHECK-CC2: {TypedText optional}
// CHECK-CC2: {TypedText property}
// CHECK-CC2: {TypedText required}
-// RUN: c-index-test -code-completion-at=%s:6:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:6:2 %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: {TypedText dynamic}{HorizontalSpace }{Placeholder property}
// CHECK-CC3: {TypedText end}
// CHECK-CC3: {TypedText synthesize}{HorizontalSpace }{Placeholder property}
-// RUN: c-index-test -code-completion-at=%s:2:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:1 %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder name}
// CHECK-CC4: NotImplemented:{TypedText @compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
// CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace }{Placeholder class}
@@ -34,19 +34,19 @@
// CHECK-CC4: TypedefDecl:{TypedText id}
// CHECK-CC4: TypedefDecl:{TypedText SEL}
-// RUN: c-index-test -code-completion-at=%s:3:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:3:1 %s | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: {TypedText @end}
// CHECK-CC5: {TypedText @optional}
// CHECK-CC5: {TypedText @property}
// CHECK-CC5: {TypedText @required}
-// RUN: c-index-test -code-completion-at=%s:2:23 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:23 %s | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: NotImplemented:{TypedText package}
// CHECK-CC6: NotImplemented:{TypedText private}
// CHECK-CC6: NotImplemented:{TypedText protected}
// CHECK-CC6: NotImplemented:{TypedText public}
-// RUN: c-index-test -code-completion-at=%s:2:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:2:22 %s | FileCheck -check-prefix=CHECK-CC7 %s
// CHECK-CC7: NotImplemented:{TypedText @package}
// CHECK-CC7: NotImplemented:{TypedText @private}
// CHECK-CC7: NotImplemented:{TypedText @protected}
diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m
index cccfa261ca79..7532bbb14d71 100644
--- a/test/Index/complete-at-exprstmt.m
+++ b/test/Index/complete-at-exprstmt.m
@@ -19,18 +19,18 @@ void f() {
@selector(add:to:);
}
-// RUN: c-index-test -code-completion-at=%s:9:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:4 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC1: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC1: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
// CHECK-CC1: {TypedText synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
// CHECK-CC1: {TypedText throw}{HorizontalSpace }{Placeholder expression}
// CHECK-CC1: {TypedText try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
-// RUN: c-index-test -code-completion-at=%s:9:19 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:19 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
-// RUN: c-index-test -code-completion-at=%s:9:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
@@ -46,10 +46,10 @@ void f() {
// CHECK-CC3: TypedefDecl:{TypedText SEL}
// CHECK-CC3: NotImplemented:{ResultType MyClass *}{TypedText self}
// RUN: c-index-test -code-completion-at=%s:19:13 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText add:to:} (30)
-// CHECK-CC4: NotImplemented:{TypedText add:to:plus:} (30)
-// CHECK-CC4: NotImplemented:{TypedText myMethod:} (30)
+// CHECK-CC4: NotImplemented:{TypedText add:to:} (40)
+// CHECK-CC4: NotImplemented:{TypedText add:to:plus:} (40)
+// CHECK-CC4: NotImplemented:{TypedText myMethod:} (40)
// RUN: c-index-test -code-completion-at=%s:19:17 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:} (30)
-// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:plus:} (30)
+// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:} (40)
+// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:plus:} (40)
diff --git a/test/Index/complete-blocks.m b/test/Index/complete-blocks.m
index 7233efb8b00f..e7919efb0eb8 100644
--- a/test/Index/complete-blocks.m
+++ b/test/Index/complete-blocks.m
@@ -16,9 +16,38 @@ void test_f() {
void test_A(A *a) {
[a method:0];
}
+
+@interface B
+- method3:(int (^)(void))b;
+@end
+
+void test_B(B *b) {
+ [b method3:^int(void){ return 0; }];
+}
+
+@interface C
+- method4:(void(^)(void))arg { };
+- method5:(void(^)())arg5 { };
+@end
+
+void test_C(C *c) {
+ [c method4:^{}];
+}
+
// RUN: c-index-test -code-completion-at=%s:8:1 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder int (^)(int x, int y)}{RightParen )} (45)
-// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder void (^)(float f, double d)}{RightParen )} (45)
+// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50)
+// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder ^(float f, double d)b}{RightParen )} (50)
// RUN: c-index-test -code-completion-at=%s:17:6 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method2:}{Placeholder void (^)(float f, double d)} (20)
-// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method:}{Placeholder int (^)(int x, int y)} (20)
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method2:}{Placeholder ^(float f, double d)b} (35)
+// CHECK-CC2: ObjCInstanceMethodDecl:{ResultType id}{TypedText method:}{Placeholder ^int(int x, int y)b} (35)
+// RUN: c-index-test -code-completion-at=%s:25:6 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType id}{TypedText method3:}{Placeholder ^int(void)b} (35)
+// RUN: c-index-test -code-completion-at=%s:34:6 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method4:}{Placeholder ^(void)arg} (35)
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType id}{TypedText method5:}{Placeholder ^(void)arg5} (35)
+// RUN: c-index-test -code-completion-at=%s:25:15 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: TypedefDecl:{TypedText block_t} (50)
+// CHECK-CC5: TypedefDecl:{TypedText Class} (50)
+// CHECK-CC5-NOT: test_A
+// CHECK-CC5: {TypedText union} (50)
+
diff --git a/test/Index/complete-ctor-inits.cpp b/test/Index/complete-ctor-inits.cpp
index f9cc7022eafb..f50621466f1e 100644
--- a/test/Index/complete-ctor-inits.cpp
+++ b/test/Index/complete-ctor-inits.cpp
@@ -18,23 +18,23 @@ struct Z : public X<int>, public Y {
Z::Z() : ::X<int>(0), Virt(), b(), c() { }
// RUN: c-index-test -code-completion-at=%s:18:10 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC1: NotImplemented:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC1: NotImplemented:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC1: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} (20)
+// CHECK-CC1: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC1: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC1: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC1: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} (35)
// CHECK-CC1: NotImplemented:{TypedText X<int>}{LeftParen (}{Placeholder args}{RightParen )} (7)
-// CHECK-CC1: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (20)
+// CHECK-CC1: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (35)
// RUN: c-index-test -code-completion-at=%s:18:23 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC2: NotImplemented:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC2: NotImplemented:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC2: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} (20)
+// CHECK-CC2: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC2: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC2: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC2: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} (35)
// CHECK-CC2: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (7)
// RUN: c-index-test -code-completion-at=%s:18:36 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: NotImplemented:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (20)
-// CHECK-CC3-NOT: NotImplemented:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )}
-// CHECK-CC3: NotImplemented:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (7)
+// CHECK-CC3: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35)
+// CHECK-CC3-NOT: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )}
+// CHECK-CC3: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (7)
// CHECK-CC3-NOT: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )}
-// CHECK-CC3: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (20)
+// CHECK-CC3: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (35)
diff --git a/test/Index/complete-declarators.cpp b/test/Index/complete-declarators.cpp
index 8fba4db2f988..ccbfde1641c7 100644
--- a/test/Index/complete-declarators.cpp
+++ b/test/Index/complete-declarators.cpp
@@ -15,25 +15,29 @@ struct Z {
};
// RUN: c-index-test -code-completion-at=%s:8:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText const} (30)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:8:5 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{TypedText const} (40)
// CHECK-CC1: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC1: NotImplemented:{TypedText operator} (30)
-// CHECK-CC1: NotImplemented:{TypedText volatile} (30)
+// CHECK-CC1: NotImplemented:{TypedText operator} (40)
+// CHECK-CC1: NotImplemented:{TypedText volatile} (40)
// RUN: c-index-test -code-completion-at=%s:8:11 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText const} (30)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:8:11 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: NotImplemented:{TypedText const} (40)
// CHECK-CC2-NOT: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC2-NOT: NotImplemented:{TypedText operator} (30)
-// CHECK-CC2: NotImplemented:{TypedText volatile} (30)
+// CHECK-CC2-NOT: NotImplemented:{TypedText operator} (40)
+// CHECK-CC2: NotImplemented:{TypedText volatile} (40)
// RUN: c-index-test -code-completion-at=%s:13:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: NotImplemented:{TypedText const} (30)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:13:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: NotImplemented:{TypedText const} (40)
// CHECK-CC3-NOT: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC3: NotImplemented:{TypedText operator} (30)
-// CHECK-CC3: NotImplemented:{TypedText volatile} (30)
+// CHECK-CC3: NotImplemented:{TypedText operator} (40)
+// CHECK-CC3: NotImplemented:{TypedText volatile} (40)
// RUN: c-index-test -code-completion-at=%s:14:14 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText const} (30)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:14 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: NotImplemented:{TypedText const} (40)
// CHECK-CC4: Namespace:{TypedText N}{Text ::} (75)
-// CHECK-CC4: NotImplemented:{TypedText operator} (30)
-// CHECK-CC4: NotImplemented:{TypedText volatile} (30)
-// CHECK-CC4: StructDecl:{TypedText Y} (65)
-// CHECK-CC4: StructDecl:{TypedText Z} (20)
+// CHECK-CC4: NotImplemented:{TypedText operator} (40)
+// CHECK-CC4: NotImplemented:{TypedText volatile} (40)
+// CHECK-CC4: StructDecl:{TypedText Y}{Text ::} (75)
+// CHECK-CC4: StructDecl:{TypedText Z}{Text ::} (75)
diff --git a/test/Index/complete-declarators.m b/test/Index/complete-declarators.m
index 3a69282df437..747da018af50 100644
--- a/test/Index/complete-declarators.m
+++ b/test/Index/complete-declarators.m
@@ -19,27 +19,54 @@
for(q in param1) {
int y;
}
+
+ static P *p = 0;
}
@end
// RUN: c-index-test -code-completion-at=%s:7:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1-NOT: NotImplemented:{TypedText extern} (30)
-// CHECK-CC1: NotImplemented:{TypedText param1} (30)
+// CHECK-CC1-NOT: NotImplemented:{TypedText extern} (40)
+// CHECK-CC1: NotImplemented:{TypedText param1} (40)
// RUN: c-index-test -code-completion-at=%s:9:15 %s | FileCheck -check-prefix=CHECK-CC2 %s
// RUN: c-index-test -code-completion-at=%s:15:10 %s | FileCheck -check-prefix=CHECK-CC2 %s
// RUN: c-index-test -code-completion-at=%s:16:9 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText const} (30)
+// CHECK-CC2: NotImplemented:{TypedText const} (40)
// CHECK-CC2-NOT: int
-// CHECK-CC2: NotImplemented:{TypedText restrict} (30)
-// CHECK-CC2: NotImplemented:{TypedText volatile} (30)
+// CHECK-CC2: NotImplemented:{TypedText restrict} (40)
+// CHECK-CC2: NotImplemented:{TypedText volatile} (40)
// RUN: c-index-test -code-completion-at=%s:15:15 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: ParmDecl:{ResultType id}{TypedText param1} (8)
-// CHECK-CC3-NOT: VarDecl:{ResultType int}{TypedText q2} (8)
-// CHECK-CC3-NOT: VarDecl:{ResultType id}{TypedText q} (8)
-// CHECK-CC3: NotImplemented:{ResultType A *}{TypedText self} (8)
-// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC3: ParmDecl:{ResultType id}{TypedText param1} (34)
+// CHECK-CC3-NOT: VarDecl:{ResultType int}{TypedText q2}
+// CHECK-CC3-NOT: VarDecl:{ResultType id}{TypedText q}
+// CHECK-CC3: NotImplemented:{ResultType A *}{TypedText self} (34)
+// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// RUN: c-index-test -code-completion-at=%s:15:15 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ParmDecl:{ResultType id}{TypedText param1} (8)
-// CHECK-CC4-NOT: VarDecl:{ResultType int}{TypedText q2} (8)
-// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (8)
-// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC4: ParmDecl:{ResultType id}{TypedText param1} (34)
+// CHECK-CC4-NOT: VarDecl:{ResultType int}{TypedText q2}
+// CHECK-CC4: NotImplemented:{ResultType A *}{TypedText self} (34)
+// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
+// RUN: c-index-test -code-completion-at=%s:23:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: NotImplemented:{TypedText _Bool} (50)
+// CHECK-CC5: NotImplemented:{TypedText _Complex} (50)
+// CHECK-CC5: NotImplemented:{TypedText _Imaginary} (50)
+// CHECK-CC5: ObjCInterfaceDecl:{TypedText A} (50)
+// CHECK-CC5: NotImplemented:{TypedText char} (50)
+// CHECK-CC5: TypedefDecl:{TypedText Class} (50)
+// CHECK-CC5: NotImplemented:{TypedText const} (50)
+// CHECK-CC5: NotImplemented:{TypedText double} (50)
+// CHECK-CC5: NotImplemented:{TypedText enum} (50)
+// CHECK-CC5: NotImplemented:{TypedText float} (50)
+// CHECK-CC5: TypedefDecl:{TypedText id} (50)
+// CHECK-CC5: NotImplemented:{TypedText int} (50)
+// CHECK-CC5: NotImplemented:{TypedText long} (50)
+// CHECK-CC5: NotImplemented:{TypedText restrict} (50)
+// CHECK-CC5: TypedefDecl:{TypedText SEL} (50)
+// CHECK-CC5: NotImplemented:{TypedText short} (50)
+// CHECK-CC5: NotImplemented:{TypedText signed} (50)
+// CHECK-CC5: NotImplemented:{TypedText struct} (50)
+// CHECK-CC5: NotImplemented:{TypedText typeof}{HorizontalSpace }{Placeholder expression} (40)
+// CHECK-CC5: NotImplemented:{TypedText typeof}{LeftParen (}{Placeholder type}{RightParen )} (40)
+// CHECK-CC5: NotImplemented:{TypedText union} (50)
+// CHECK-CC5: NotImplemented:{TypedText unsigned} (50)
+// CHECK-CC5: NotImplemented:{TypedText void} (50)
+// CHECK-CC5: NotImplemented:{TypedText volatile} (50)
diff --git a/test/Index/complete-driver-errors.c b/test/Index/complete-driver-errors.c
new file mode 100644
index 000000000000..566090c26064
--- /dev/null
+++ b/test/Index/complete-driver-errors.c
@@ -0,0 +1,24 @@
+int *blah = 1;
+
+int
+
+// CHECK-RESULTS: NotImplemented:{TypedText const} (40)
+// CHECK-RESULTS: NotImplemented:{TypedText restrict} (40)
+// CHECK-RESULTS: NotImplemented:{TypedText volatile} (40)
+// CHECK-DIAGS: error: invalid value '' in '-std='
+// CHECK-DIAGS: complete-driver-errors.c:1:6:{1:13-1:14}: warning: incompatible integer to pointer conversion initializing 'int *' with an expression of type 'int'
+
+// Test driver errors with code completion
+// RUN: c-index-test -code-completion-at=%s:4:1 -std= %s 2> %t | FileCheck -check-prefix=CHECK-RESULTS %s
+// RUN: FileCheck -check-prefix=CHECK-DIAGS %s < %t
+
+// Test driver errors with parsing
+// RUN: c-index-test -test-load-source all -std= %s 2> %t | FileCheck -check-prefix=CHECK-LOAD %s
+// RUN: FileCheck -check-prefix=CHECK-DIAGS %s < %t
+// CHECK-LOAD: complete-driver-errors.c:1:6: VarDecl=blah:1:6
+
+// Test driver errors with code completion and precompiled preamble
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:1 -std= %s 2> %t | FileCheck -check-prefix=CHECK-RESULTS %s
+// RUN: FileCheck -check-prefix=CHECK-DIAGS %s < %t
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source all -std= %s 2> %t | FileCheck -check-prefix=CHECK-LOAD %s
+// RUN: FileCheck -check-prefix=CHECK-DIAGS %s < %t
diff --git a/test/Index/complete-enums.c b/test/Index/complete-enums.c
index 5e712a11227f..33a4cd42811c 100644
--- a/test/Index/complete-enums.c
+++ b/test/Index/complete-enums.c
@@ -1,15 +1,22 @@
// Note: the run lines follow their respective tests, since line/column
// matter in this test.
-enum {
- Red = 17,
- Green,
- Blue
+enum Color {
+ Color_Red = 17,
+ Color_Green,
+ Color_Blue
};
-
-void f() {
-
+int Greeby();
+void f(Color color) {
+ switch (color) {
+ case Red:
+ }
}
// RUN: c-index-test -code-completion-at=%s:11:1 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: EnumConstantDecl:{ResultType enum <anonymous>}{TypedText Red}
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red}
+
+// RUN: c-index-test -code-completion-at=%s:12:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Blue} (7)
+// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Green} (7)
+// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red} (7)
diff --git a/test/Index/complete-exprs.c b/test/Index/complete-exprs.c
index 2a7a1e212122..aa22e776221e 100644
--- a/test/Index/complete-exprs.c
+++ b/test/Index/complete-exprs.c
@@ -18,21 +18,27 @@ void f3(const char*, ...) __attribute__((sentinel(0)));
void f4(const char* str) {
f3(str, NULL);
}
+
+typedef int type;
+void f5(float f) {
+ (type)f;
+}
+
// RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
-// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (60)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (65)
// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
-// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (2)
-// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
+// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
-// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
-// CHECK-CC3-NOT: NotImplemented:{TypedText float} (65)
-// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (8)
+// CHECK-CC3-NOT: NotImplemented:{TypedText float}
+// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (34)
// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio
// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
@@ -40,14 +46,24 @@ void f4(const char* str) {
// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
-// CHECK-CC2: NotImplemented:{TypedText float} (65)
-// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (8)
-// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC2: NotImplemented:{TypedText float} (50)
+// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)
+// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
// RUN: c-index-test -code-completion-at=%s:19:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder char const *, ...}{Text , NULL}{RightParen )} (45)
-// CHECK-CC6: NotImplemented:{TypedText void} (65)
-// CHECK-CC6: NotImplemented:{TypedText volatile} (65)
+// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
+// CHECK-CC6: NotImplemented:{TypedText void} (50)
+// CHECK-CC6: NotImplemented:{TypedText volatile} (50)
+
+// RUN: c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
+// CHECK-CC7: ParmDecl:{ResultType float}{TypedText f} (34)
+// CHECK-CC7: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
+// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f2}{LeftParen (}{RightParen )} (50)
+// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
+// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f4}{LeftParen (}{Placeholder const char *str}{RightParen )} (50)
+// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f5}{LeftParen (}{Placeholder float f}{RightParen )} (50)
+// CHECK-CC7: TypedefDecl:{TypedText type}
diff --git a/test/Index/complete-exprs.cpp b/test/Index/complete-exprs.cpp
new file mode 100644
index 000000000000..a8100653b2aa
--- /dev/null
+++ b/test/Index/complete-exprs.cpp
@@ -0,0 +1,53 @@
+// Line- and column-sensitive test; run lines follow.
+
+class string {
+ public:
+ string();
+ string(const char *);
+ string(const char *, int n);
+};
+
+template<typename T>
+class vector {
+public:
+ vector(const T &, unsigned n);
+ template<typename InputIterator>
+ vector(InputIterator first, InputIterator last);
+ void push_back(const T&);
+};
+template<typename T> void vector<T>::push_back(const T&) { }
+void f() {
+
+}
+
+int foo();
+
+void g() {
+ vector<int>(foo(), foo());
+}
+
+// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{TypedText operator} (40)
+// CHECK-CC1-NOT: push_back
+// CHECK-CC1: ClassDecl:{TypedText string} (50)
+// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50)
+// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{RightParen )} (50)
+// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{Comma , }{Placeholder int n}{RightParen )} (50)
+// CHECK-CC1: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
+// CHECK-CC1: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50)
+// CHECK-CC1: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
+
+// RUN: c-index-test -code-completion-at=%s:19:1 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:19:1 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: ClassDecl:{TypedText string} (50)
+// CHECK-CC2-NOT: CXXConstructor
+// CHECK-CC2: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
+
+// RUN: c-index-test -code-completion-at=%s:26:15 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: NotImplemented:{TypedText float} (50)
+// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText foo}{LeftParen (}{RightParen )} (50)
+// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{RightParen )} (50)
+// CHECK-CC3: ClassTemplate:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
+// CHECK-CC3: CXXConstructor:{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder const T &}{Comma , }{Placeholder unsigned int n}{RightParen )} (50)
+// CHECK-CC3: FunctionTemplate:{ResultType void}{TypedText vector}{LeftAngle <}{Placeholder typename T}{RightAngle >}{LeftParen (}{Placeholder InputIterator first}{Comma , }{Placeholder InputIterator last}{RightParen )} (50)
diff --git a/test/Index/complete-exprs.m b/test/Index/complete-exprs.m
new file mode 100644
index 000000000000..0446dcd2fbdf
--- /dev/null
+++ b/test/Index/complete-exprs.m
@@ -0,0 +1,29 @@
+typedef signed char BOOL;
+#define YES ((BOOL)1)
+#define NO ((BOOL)0)
+#define bool _Bool
+@interface A
+- (int)method:(id)param1;
+
+@property int prop1;
+@end
+
+@implementation A
+- (int)method:(id)param1 {
+
+ for(BOOL B = YES; ; ) { }
+}
+@end
+
+// RUN: c-index-test -code-completion-at=%s:13:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{ResultType SEL}{TypedText _cmd} (80)
+// CHECK-CC1: TypedefDecl:{TypedText BOOL} (50)
+// CHECK-CC1: macro definition:{TypedText bool} (51)
+// CHECK-CC1: macro definition:{TypedText NO} (65)
+// CHECK-CC1: NotImplemented:{ResultType A *}{TypedText self} (34)
+// CHECK-CC1: macro definition:{TypedText YES} (65)
+// RUN: c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: TypedefDecl:{TypedText BOOL} (50)
+// CHECK-CC2: NotImplemented:{TypedText char} (50)
+// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
diff --git a/test/Index/complete-hiding.c b/test/Index/complete-hiding.c
index f2e177571c0c..1da20e64b849 100644
--- a/test/Index/complete-hiding.c
+++ b/test/Index/complete-hiding.c
@@ -16,14 +16,17 @@ void f() {
struct StructA sa = { };
}
-// RUN: c-index-test -code-completion-at=%s:16:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:16:3 %s > %t
+// RUN: FileCheck -check-prefix=CHECK-CC1 -input-file=%t %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:16:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: VarDecl:{ResultType int}{TypedText StructA} (8)
-// CHECK-CC1: VarDecl:{ResultType int}{TypedText ValueA} (8)
+// CHECK-CC1: VarDecl:{ResultType int}{TypedText StructA} (34)
+// CHECK-CC1: VarDecl:{ResultType int}{TypedText ValueA} (34)
// CHECK-CC1-NOT: VarDecl:{ResultType int}{TypedText ValueA} (50)
// CHECK-CC1: VarDecl:{ResultType int}{TypedText ValueB} (50)
-// RUN: c-index-test -code-completion-at=%s:16:10 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: StructDecl:{TypedText StructA} (65)
-// CHECK-CC2-NOT: StructDecl:{TypedText StructB} (65)
-// CHECK-CC2: StructDecl:{TypedText StructC} (65)
-// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:16:10 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: c-index-test -code-completion-at=%s:16:10 %s > %t
+// RUN: FileCheck -check-prefix=CHECK-CC2 -input-file=%t %s
+// CHECK-CC2: StructDecl:{TypedText StructA} (50)
+// CHECK-CC2-NOT: StructDecl:{TypedText StructB} (50)
+// CHECK-CC2: StructDecl:{TypedText StructC} (50)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:16:10 %s > %t
+// RUN: FileCheck -check-prefix=CHECK-CC2 -input-file=%t %s
diff --git a/test/Index/complete-kvc.m b/test/Index/complete-kvc.m
new file mode 100644
index 000000000000..43a874b55311
--- /dev/null
+++ b/test/Index/complete-kvc.m
@@ -0,0 +1,87 @@
+// Test for code completions related to Key-Value Coding and Key-Value Observing.
+// Since this test is line- and column-sensitive, the run lines are at the end.
+
+typedef signed char BOOL;
+
+@interface NSSet
+@end
+
+@interface NSMutableSet : NSSet
+@end
+
+@interface MySet : NSMutableSet
+@end
+
+@interface NSArray
+@end
+
+@interface NSMutableArray : NSArray
+@end
+
+@interface MyArray : NSMutableArray
+@end
+
+@interface MyClass
+@property int intProperty;
+@property BOOL boolProperty;
+@property int* intPointerProperty;
+
+@property NSSet *setProperty;
+@property NSMutableSet *mutableSetProperty;
+@property MySet *mySetProperty;
+
+@property NSArray *arrayProperty;
+@property NSMutableArray *mutableArrayProperty;
+@property MyArray *myArrayProperty;
+@end
+
+@implementation MyClass
+- (int)intProperty { return 0; }
+- (void)setIntProperty:(int)newValue { }
++ (NSSet *)keyPathsForValuesAffectingIntProperty { return 0; }
+@end
+
+// RUN: c-index-test -code-completion-at=%s:39:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText addMutableArrayPropertyObject:}{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{Text object} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText addMutableSetProperty:}{LeftParen (}{Text NSSet *}{RightParen )}{Text objects} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText arrayProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText arrayPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text BOOL}{RightParen )}{TypedText boolProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText boolPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSUInteger}{RightParen )}{TypedText countOfArrayProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSUInteger}{RightParen )}{TypedText countOfBoolProperty} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSUInteger}{RightParen )}{TypedText countOfSetProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSEnumerator *}{RightParen )}{TypedText enumeratorOfMutableArrayProperty} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSEnumerator *}{RightParen )}{TypedText enumeratorOfMutableSetProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText getMyArrayProperty:}{LeftParen (}{Placeholder object-type}{Text **}{RightParen )}{Text buffer}{HorizontalSpace }{TypedText range:}{LeftParen (}{Text NSRange}{RightParen )}{Text inRange} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText getMySetProperty:}{LeftParen (}{Placeholder object-type}{Text **}{RightParen )}{Text buffer}{HorizontalSpace }{TypedText range:}{LeftParen (}{Text NSRange}{RightParen )}{Text inRange} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertIntProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array}{HorizontalSpace }{TypedText atIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertMutableArrayProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array}{HorizontalSpace }{TypedText atIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertObject:}{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{Text object}{HorizontalSpace }{TypedText inMyArrayPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText insertObject:}{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{Text object}{HorizontalSpace }{TypedText inMySetPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText intersectMySetProperty:}{LeftParen (}{Text NSSet *}{RightParen )}{Text objects} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText intersectSetProperty:}{LeftParen (}{Text NSSet *}{RightParen )}{Text objects} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int *}{RightParen )}{TypedText intPointerProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText intProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text BOOL}{RightParen )}{TypedText isBoolProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text BOOL}{RightParen )}{TypedText isIntProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{TypedText memberOfMyArrayProperty:}{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{Text object} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{TypedText memberOfMySetProperty:}{LeftParen (}{Placeholder object-type}{Text *}{RightParen )}{Text object} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSMutableArray *}{RightParen )}{TypedText mutableArrayProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSMutableSet *}{RightParen )}{TypedText mutableSetProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText mutableSetPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text MyArray *}{RightParen )}{TypedText myArrayProperty} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text NSArray *}{RightParen )}{TypedText myArrayPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText objectInMutableSetPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText objectInMyArrayPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeMyArrayPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeMySetPropertyAtIndexes:}{LeftParen (}{Text NSIndexSet *}{RightParen )}{Text indexes} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeObjectFromIntPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText removeObjectFromMutableArrayPropertyAtIndex:}{LeftParen (}{Text NSUInteger}{RightParen )}{Text index} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceMyArrayPropertyAtIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes}{HorizontalSpace }{TypedText withMyArrayProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceMySetPropertyAtIndexes:}{LeftParen (}{Placeholder NSIndexSet *}{RightParen )}{Text indexes}{HorizontalSpace }{TypedText withMySetProperty:}{LeftParen (}{Text NSArray *}{RightParen )}{Text array} (55)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceObjectInMyArrayPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index}{HorizontalSpace }{TypedText withObject:}{LeftParen (}{Text id}{RightParen )}{Text object} (40)
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText replaceObjectInMySetPropertyAtIndex:}{LeftParen (}{Placeholder NSUInteger}{RightParen )}{Text index}{HorizontalSpace }{TypedText withObject:}{LeftParen (}{Text id}{RightParen )}{Text object} (55)
+
+// RUN: c-index-test -code-completion-at=%s:41:3 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: ObjCInstanceMethodDecl:{LeftParen (}{Text NSSet *}{RightParen )}{TypedText keyPathsForValuesAffectingMutableArrayProperty} (40)
diff --git a/test/Index/complete-macros.c b/test/Index/complete-macros.c
index 26a63b151b7b..eff42cad75a1 100644
--- a/test/Index/complete-macros.c
+++ b/test/Index/complete-macros.c
@@ -21,7 +21,7 @@ void f2() {
// RUN: c-index-test -code-completion-at=%s:13:13 %s | FileCheck -check-prefix=CHECK-CC2 %s
// RUN: c-index-test -code-completion-at=%s:14:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: macro definition:{TypedText nil} (30)
+// CHECK-CC2: macro definition:{TypedText nil} (32)
// RUN: c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: macro definition:{TypedText nil} (60)
+// CHECK-CC3: macro definition:{TypedText nil} (65)
diff --git a/test/Index/complete-member-access.m b/test/Index/complete-member-access.m
index 82efb9511586..ad2998cbf1c5 100644
--- a/test/Index/complete-member-access.m
+++ b/test/Index/complete-member-access.m
@@ -26,5 +26,5 @@ void test_props(Int* ptr) {
// CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText prop1}
// CHECK-CC1: ObjCPropertyDecl:{ResultType float}{TypedText ProtoProp}
// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (20)
-// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (22)
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText IVar} (35)
+// CHECK-CC2: ObjCIvarDecl:{ResultType int}{TypedText SuperIVar} (37)
diff --git a/test/Index/complete-memfunc-cvquals.cpp b/test/Index/complete-memfunc-cvquals.cpp
index 4e2e8200ab51..9068ef840bda 100644
--- a/test/Index/complete-memfunc-cvquals.cpp
+++ b/test/Index/complete-memfunc-cvquals.cpp
@@ -41,46 +41,46 @@ void Foo::bingo() volatile {
// RUN: c-index-test -code-completion-at=%s:19:5 %s | FileCheck -check-prefix=CHECK-NOQUALS %s
// RUN: c-index-test -code-completion-at=%s:20:7 %s | FileCheck -check-prefix=CHECK-NOQUALS %s
// RUN: c-index-test -code-completion-at=%s:23:7 %s | FileCheck -check-prefix=CHECK-NOQUALS %s
-// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (20)
-// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{RightParen )} (19)
-// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (20)
-// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (20)
+// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (35)
+// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{RightParen )} (34)
+// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (35)
+// CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (35)
// RUN: c-index-test -code-completion-at=%s:21:6 %s | FileCheck -check-prefix=CHECK-CONST %s
// RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CONST %s
// RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CONST %s
-// CHECK-CONST: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (20)
+// CHECK-CONST: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (35)
// CHECK-CONST-NOT: bar
-// CHECK-CONST: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (19)
+// CHECK-CONST: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (34)
// CHECK-CONST-NOT: bingo
// CHECK-CONST: theend
// RUN: c-index-test -code-completion-at=%s:25:8 %s | FileCheck -check-prefix=CHECK-VOLATILE %s
-// CHECK-VOLATILE: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (20)
+// CHECK-VOLATILE: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (35)
// CHECK-VOLATILE-NOT: baz
-// CHECK-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (19)
+// CHECK-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (34)
// Check implicit member access expressions.
// RUN: c-index-test -code-completion-at=%s:29:2 %s | FileCheck -check-prefix=CHECK-IMPLICIT-NOQUALS %s
-// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (15)
-// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{RightParen )} (14)
-// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (15)
-// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (15)
+// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (35)
+// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{RightParen )} (34)
+// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (35)
+// CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (35)
// RUN: c-index-test -code-completion-at=%s:33:1 %s | FileCheck -check-prefix=CHECK-IMPLICIT-CONST %s
-// CHECK-IMPLICIT-CONST: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (15)
+// CHECK-IMPLICIT-CONST: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (35)
// CHECK-IMPLICIT-CONST-NOT: bar
-// CHECK-IMPLICIT-CONST: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (14)
+// CHECK-IMPLICIT-CONST: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative const} (34)
// CHECK-IMPLICIT-CONST-NOT: bingo
// CHECK-IMPLICIT-CONST: theend
// RUN: c-index-test -code-completion-at=%s:37:1 %s | FileCheck -check-prefix=CHECK-IMPLICIT-VOLATILE %s
-// CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (15)
+// CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative const volatile} (35)
// CHECK-IMPLICIT-VOLATILE-NOT: baz
-// CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (14)
+// CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative volatile} (34)
// RUN: c-index-test -code-completion-at=%s:4:17 %s | FileCheck -check-prefix=CHECK-CVQUAL-AFTER %s
-// CHECK-CVQUAL-AFTER: NotImplemented:{TypedText const} (30)
-// CHECK-CVQUAL-AFTER: NotImplemented:{TypedText volatile} (30)
+// CHECK-CVQUAL-AFTER: NotImplemented:{TypedText const} (40)
+// CHECK-CVQUAL-AFTER: NotImplemented:{TypedText volatile} (40)
// RUN: c-index-test -code-completion-at=%s:4:23 %s | FileCheck -check-prefix=CHECK-CVQUAL-AFTER2 %s
-// CHECK-CVQUAL-AFTER2-NOT: NotImplemented:{TypedText const} (30)
-// CHECK-CVQUAL-AFTER2: NotImplemented:{TypedText volatile} (30)
+// CHECK-CVQUAL-AFTER2-NOT: NotImplemented:{TypedText const} (40)
+// CHECK-CVQUAL-AFTER2: NotImplemented:{TypedText volatile} (40)
diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m
index 1324ae4a6970..2ab119795347 100644
--- a/test/Index/complete-method-decls.m
+++ b/test/Index/complete-method-decls.m
@@ -1,6 +1,6 @@
/* Note: the RUN lines are near the end of the file, since line/column
matter for this test. */
-
+#define IBAction void
@protocol P1
- (id)abc;
- (id)initWithInt:(int)x;
@@ -60,100 +60,117 @@
- (oneway void)method:(in id x);
@end
+@interface Gaps
+- (void)method:(int)x :(int)y;
+@end
+
+@implementation Gaps
+- (void)method:(int)x :(int)y;
+@end
+
// RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}
// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}
// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}
-// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
-// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}
+// CHECK-CC1: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}
// RUN: c-index-test -code-completion-at=%s:17:7 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText abc}
// CHECK-CC2-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf}
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
-// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
+// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}
+// CHECK-CC2: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}
// RUN: c-index-test -code-completion-at=%s:24:7 %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText abc}
// CHECK-CC3-NEXT: ObjCInstanceMethodDecl:{TypedText getSelf}
// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText init}
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}
-// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}
-// RUN: c-index-test -code-completion-at=%s:33:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (32)
+// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}
+// CHECK-CC3: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:33:3 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42)
// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace
// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (30)
-// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// RUN: c-index-test -code-completion-at=%s:33:8 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40)
+// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC4: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText setValue}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getInt}{HorizontalSpace }{LeftBrace {}{VerticalSpace
// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText getSecondValue}{HorizontalSpace }{LeftBrace {}{VerticalSpace
// CHECK-CC5-NOT: {TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText setValue}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// RUN: c-index-test -code-completion-at=%s:37:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
+// CHECK-CC5: ObjCInstanceMethodDecl:{TypedText setValue}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:37:7 %s | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// CHECK-CC6-NOT: getSelf
-// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithInt}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// RUN: c-index-test -code-completion-at=%s:42:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
-// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
-// RUN: c-index-test -code-completion-at=%s:52:21 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{Text third:}{Text (double)z} (20)
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{Text third:}{Text (double)z} (20)
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5)
-// RUN: c-index-test -code-completion-at=%s:52:19 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC9 %s
-// CHECK-CC9: NotImplemented:{TypedText x} (30)
-// CHECK-CC9: NotImplemented:{TypedText xx} (30)
-// CHECK-CC9: NotImplemented:{TypedText xxx} (30)
-// RUN: c-index-test -code-completion-at=%s:52:36 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CCA %s
-// CHECK-CCA: NotImplemented:{TypedText y2} (30)
+// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (40)
+// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithInt}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC6: ObjCInstanceMethodDecl:{TypedText initWithTwoInts}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second:}{LeftParen (}{Text int}{RightParen )}{Text y}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:42:3 %s | FileCheck -check-prefix=CHECK-CC7 %s
+// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText abc}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42)
+// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText categoryFunction}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{LeftBrace {}{VerticalSpace
+// CHECK-CC7: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText getSelf}{HorizontalSpace }{LeftBrace {}{VerticalSpace }{Text return}{HorizontalSpace }{Placeholder expression}{SemiColon ;}{VerticalSpace }{RightBrace }} (42)
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:21 %s | FileCheck -check-prefix=CHECK-CC8 %s
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{TypedText third:}{Text (double)z} (35)
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{TypedText third:}{Text (double)z} (35)
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{TypedText third:}{Text (double)z} (8)
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:19 %s | FileCheck -check-prefix=CHECK-CC9 %s
+// CHECK-CC9: NotImplemented:{TypedText x} (40)
+// CHECK-CC9: NotImplemented:{TypedText xx} (40)
+// CHECK-CC9: NotImplemented:{TypedText xxx} (40)
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:52:36 %s | FileCheck -check-prefix=CHECK-CCA %s
+// CHECK-CCA: NotImplemented:{TypedText y2} (40)
// RUN: c-index-test -code-completion-at=%s:56:3 %s | FileCheck -check-prefix=CHECK-CCB %s
-// CHECK-CCB: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText first}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second2}{Colon :}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{Text third}{Colon :}{LeftParen (}{Text double}{RightParen )}{Text z} (30)
+// CHECK-CCB: ObjCInstanceMethodDecl:{LeftParen (}{Text int}{RightParen )}{TypedText first}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second2:}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{TypedText third:}{LeftParen (}{Text double}{RightParen )}{Text z} (40)
// RUN: c-index-test -code-completion-at=%s:56:8 %s | FileCheck -check-prefix=CHECK-CCC %s
-// CHECK-CCC: ObjCInstanceMethodDecl:{TypedText first}{Colon :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{Text second2}{Colon :}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{Text third}{Colon :}{LeftParen (}{Text double}{RightParen )}{Text z} (30)
+// CHECK-CCC: ObjCInstanceMethodDecl:{TypedText first}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText second2:}{LeftParen (}{Text float}{RightParen )}{Text y}{HorizontalSpace }{TypedText third:}{LeftParen (}{Text double}{RightParen )}{Text z} (40)
// RUN: c-index-test -code-completion-at=%s:56:21 %s | FileCheck -check-prefix=CHECK-CCD %s
-// FIXME: These results could be more precise.
-// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{Text third:}{Text (double)z} (20)
-// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second2:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5)
-// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{Text third:}{Text (double)z} (20)
-// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{Text third:}{Text (double)z} (5)
+// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{TypedText second2:}{Text (float)y2}{HorizontalSpace }{TypedText third:}{Text (double)z} (35)
+// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second2:}{Text (float)y}{HorizontalSpace }{TypedText third:}{Text (double)z} (8)
+// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType void *}{Informative first:}{TypedText second3:}{Text (float)y3}{HorizontalSpace }{TypedText third:}{Text (double)z} (35)
+// CHECK-CCD: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{TypedText second:}{Text (float)y}{HorizontalSpace }{TypedText third:}{Text (double)z} (8)
// RUN: c-index-test -code-completion-at=%s:56:38 %s | FileCheck -check-prefix=CHECK-CCE %s
-// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (20)
-// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (5)
+// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (35)
+// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (8)
// RUN: c-index-test -code-completion-at=%s:60:4 %s | FileCheck -check-prefix=CHECK-CCF %s
-// CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (65)
-// CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (65)
-// CHECK-CCF: NotImplemented:{TypedText bycopy} (30)
-// CHECK-CCF: NotImplemented:{TypedText byref} (30)
-// CHECK-CCF: NotImplemented:{TypedText in} (30)
-// CHECK-CCF: NotImplemented:{TypedText inout} (30)
-// CHECK-CCF: NotImplemented:{TypedText oneway} (30)
-// CHECK-CCF: NotImplemented:{TypedText out} (30)
-// CHECK-CCF: NotImplemented:{TypedText unsigned} (65)
-// CHECK-CCF: NotImplemented:{TypedText void} (65)
-// CHECK-CCF: NotImplemented:{TypedText volatile} (65)
+// CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (50)
+// CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (50)
+// CHECK-CCF: NotImplemented:{TypedText bycopy} (40)
+// CHECK-CCF: NotImplemented:{TypedText byref} (40)
+// CHECK-CCF: NotImplemented:{TypedText in} (40)
+// CHECK-CCF: NotImplemented:{TypedText inout} (40)
+// CHECK-CCF: NotImplemented:{TypedText oneway} (40)
+// CHECK-CCF: NotImplemented:{TypedText out} (40)
+// CHECK-CCF: NotImplemented:{TypedText unsigned} (50)
+// CHECK-CCF: NotImplemented:{TypedText void} (50)
+// CHECK-CCF: NotImplemented:{TypedText volatile} (50)
// RUN: c-index-test -code-completion-at=%s:60:11 %s | FileCheck -check-prefix=CHECK-CCG %s
-// CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (65)
-// CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (65)
-// CHECK-CCG-NOT: NotImplemented:{TypedText bycopy} (30)
-// CHECK-CCG-NOT: NotImplemented:{TypedText byref} (30)
-// CHECK-CCG: NotImplemented:{TypedText in} (30)
-// CHECK-CCG: NotImplemented:{TypedText inout} (30)
-// CHECK-CCG-NOT: NotImplemented:{TypedText oneway} (30)
-// CHECK-CCG: NotImplemented:{TypedText out} (30)
-// CHECK-CCG: NotImplemented:{TypedText unsigned} (65)
-// CHECK-CCG: NotImplemented:{TypedText void} (65)
-// CHECK-CCG: NotImplemented:{TypedText volatile} (65)
+// CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (50)
+// CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (50)
+// CHECK-CCG-NOT: NotImplemented:{TypedText bycopy} (40)
+// CHECK-CCG-NOT: NotImplemented:{TypedText byref} (40)
+// CHECK-CCG: NotImplemented:{TypedText in} (40)
+// CHECK-CCG: NotImplemented:{TypedText inout} (40)
+// CHECK-CCG-NOT: NotImplemented:{TypedText oneway} (40)
+// CHECK-CCG: NotImplemented:{TypedText out} (40)
+// CHECK-CCG: NotImplemented:{TypedText unsigned} (50)
+// CHECK-CCG: NotImplemented:{TypedText void} (50)
+// CHECK-CCG: NotImplemented:{TypedText volatile} (50)
// RUN: c-index-test -code-completion-at=%s:60:24 %s | FileCheck -check-prefix=CHECK-CCF %s
// RUN: c-index-test -code-completion-at=%s:60:26 %s | FileCheck -check-prefix=CHECK-CCH %s
-// CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (65)
-// CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (65)
-// CHECK-CCH: NotImplemented:{TypedText bycopy} (30)
-// CHECK-CCH: NotImplemented:{TypedText byref} (30)
-// CHECK-CCH-NOT: NotImplemented:{TypedText in} (30)
-// CHECK-CCH: NotImplemented:{TypedText inout} (30)
-// CHECK-CCH: NotImplemented:{TypedText oneway} (30)
-// CHECK-CCH: NotImplemented:{TypedText out} (30)
-// CHECK-CCH: NotImplemented:{TypedText unsigned} (65)
-// CHECK-CCH: NotImplemented:{TypedText void} (65)
-// CHECK-CCH: NotImplemented:{TypedText volatile} (65)
+// CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (50)
+// CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (50)
+// CHECK-CCH: NotImplemented:{TypedText bycopy} (40)
+// CHECK-CCH: NotImplemented:{TypedText byref} (40)
+// CHECK-CCH-NOT: NotImplemented:{TypedText in} (40)
+// CHECK-CCH: NotImplemented:{TypedText inout} (40)
+// CHECK-CCH: NotImplemented:{TypedText oneway} (40)
+// CHECK-CCH: NotImplemented:{TypedText out} (40)
+// CHECK-CCH: NotImplemented:{TypedText unsigned} (50)
+// CHECK-CCH: NotImplemented:{TypedText void} (50)
+// CHECK-CCH: NotImplemented:{TypedText volatile} (50)
+
+// IBAction completion
+// RUN: c-index-test -code-completion-at=%s:5:4 %s | FileCheck -check-prefix=CHECK-IBACTION %s
+// CHECK-IBACTION: NotImplemented:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40)
+
+// <rdar://problem/8939352>
+// RUN: c-index-test -code-completion-at=%s:68:9 %s | FileCheck -check-prefix=CHECK-8939352 %s
+// CHECK-8939352: ObjCInstanceMethodDecl:{TypedText method}{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text x}{HorizontalSpace }{TypedText :}{LeftParen (}{Text int}{RightParen )}{Text y} (40)
diff --git a/test/Index/complete-objc-message-id.m b/test/Index/complete-objc-message-id.m
index be42b9b855ef..415e0ff02195 100644
--- a/test/Index/complete-objc-message-id.m
+++ b/test/Index/complete-objc-message-id.m
@@ -31,6 +31,22 @@ void message_id(B *b) {
return [A alloc];
}
@end
+
+@protocol P1
+- (int)P1_method1;
++ (int)P1_method2;
+@end
+
+@protocol P2 <P1>
+- (int)P2_method1;
++ (int)P2_method2;
+@end
+
+void message_qualified_id(id<P2> ip2) {
+ [ip2 P1_method];
+ ip2 P1_method];
+}
+
// RUN: c-index-test -code-completion-at=%s:24:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
// CHECK-CC1-NOT: B_method
@@ -46,9 +62,13 @@ void message_id(B *b) {
// RUN: c-index-test -code-completion-at=%s:31:13 %s | FileCheck -check-prefix=CHECK-SELECTOR-PREF %s
-// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText alloc} (17)
-// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText class} (20)
-// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText init} (20)
-// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText new} (20)
-// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText superclass} (20)
+// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText alloc} (32)
+// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText class} (35)
+// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText init} (35)
+// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText new} (35)
+// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText superclass} (35)
+// RUN: c-index-test -code-completion-at=%s:46:7 %s | FileCheck -check-prefix=CHECK-INSTANCE-QUAL-ID %s
+// RUN: c-index-test -code-completion-at=%s:47:7 %s | FileCheck -check-prefix=CHECK-INSTANCE-QUAL-ID %s
+// CHECK-INSTANCE-QUAL-ID: ObjCInstanceMethodDecl:{ResultType int}{TypedText P1_method1} (37)
+// CHECK-INSTANCE-QUAL-ID: ObjCInstanceMethodDecl:{ResultType int}{TypedText P2_method1} (35)
diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m
index f9d671037ba5..0658d53c651b 100644
--- a/test/Index/complete-objc-message.m
+++ b/test/Index/complete-objc-message.m
@@ -132,11 +132,52 @@ void msg_id(id x) {
void test_ranking(B *b) {
[b method1];
+ b method1];
+}
+
+void test_overload3(Overload *ovl) {
+ ovl Method:1 Arg1:1 OtherArg:ovl];
+ Overload2 Method:1 Arg1:1 OtherArg:ovl];
+ (Overload2 Method:1 Arg1:1 OtherArg:ovl]);
+}
+
+@interface C : B
+- (void)method2;
+- (void)method3;
+@end
+
+void test_redundancy(C *c) {
+ [c method2];
+};
+
+@protocol P
+- (Class)class;
+@end
+
+@interface A () <P>
+@end
+
+@interface A ()
++ (void)class_method3;
+@end
+
+@interface A (Cat)
++ (void)class_method4;
+@end
+
+@implementation A
+- (void)method5:(A*)a {
+ [[self class] class_method4];
+}
+@end
+
+void test_missing_open_more() {
+ A *a = A class_method3];
}
// 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 }{Text withKeyword:}{Placeholder (int)}
+// CHECK-CC1: {TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)}
// CHECK-CC1: {TypedText classMethod2}
// CHECK-CC1: {TypedText new}
// CHECK-CC1: {TypedText protocolClassMethod}
@@ -148,10 +189,10 @@ void test_ranking(B *b) {
// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
// CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{Text second:}{Placeholder (id)}
+// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
// CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{Text second:}{Placeholder (id)}
+// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
// CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
// RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)}
@@ -159,15 +200,15 @@ void test_ranking(B *b) {
// RUN: c-index-test -code-completion-at=%s:95:8 %s | FileCheck -check-prefix=CHECK-CC7 %s
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
-// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
-// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
-// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{Text SomeArg:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
-// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CC7: ObjCInstanceMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
// RUN: c-index-test -code-completion-at=%s:95:17 %s | FileCheck -check-prefix=CHECK-CC8 %s
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText }
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
-// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CC8-NOT: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{TypedText }
// RUN: c-index-test -code-completion-at=%s:95:24 %s | FileCheck -check-prefix=CHECK-CC9 %s
// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)}
// CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)}
@@ -187,15 +228,15 @@ void test_ranking(B *b) {
// RUN: c-index-test -code-completion-at=%s:116:14 %s | FileCheck -check-prefix=CHECK-CCC %s
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
-// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
-// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
-// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{Text SomeArg:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
-// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (float)}{HorizontalSpace }{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CCC: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
// RUN: c-index-test -code-completion-at=%s:116:23 %s | FileCheck -check-prefix=CHECK-CCD %s
-// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText }
-// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
-// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
-// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{Text OtherArg:}{Placeholder (id)}
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CCD: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText SomeArg:}{Placeholder (int)}{HorizontalSpace }{TypedText OtherArg:}{Placeholder (id)}
+// CHECK-CCD-NOT: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{TypedText }
// RUN: c-index-test -code-completion-at=%s:116:30 %s | FileCheck -check-prefix=CHECK-CCE %s
// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText Arg2:}{Placeholder (int)}
// CHECK-CCE: ObjCClassMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)}
@@ -212,7 +253,7 @@ void test_ranking(B *b) {
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText categoryInstanceMethod}
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText instanceMethod1}
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method}
-// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{Text second:}{Placeholder (id)}
+// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace }{TypedText second:}{Placeholder (id)}
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
// CHECK-CCG: ObjCInstanceMethodDecl:{ResultType id}{TypedText protocolInstanceMethod:}{Placeholder (int)}
@@ -220,7 +261,7 @@ void test_ranking(B *b) {
// RUN: c-index-test -code-completion-at=%s:121:14 %s | FileCheck -check-prefix=CHECK-CCG %s
// RUN: c-index-test -code-completion-at=%s:122:7 %s | FileCheck -check-prefix=CHECK-CCH %s
// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText categoryClassMethod}
-// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{Text withKeyword:}{Placeholder (int)}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText classMethod1:}{Placeholder (id)}{HorizontalSpace }{TypedText withKeyword:}{Placeholder (int)}
// CHECK-CCH: ObjCClassMethodDecl:{ResultType void}{TypedText classMethod2}
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method}
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)}
@@ -229,8 +270,32 @@ void test_ranking(B *b) {
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubClassMethod}
// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText MySubPrivateMethod}
// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText new}
-// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{Text Arg1:}{Placeholder (int)}{HorizontalSpace }{Text Arg2:}{Placeholder (int)}
+// CHECK-CCH: ObjCClassMethodDecl:{ResultType int}{TypedText OtherMethod:}{Placeholder (float)}{HorizontalSpace }{TypedText Arg1:}{Placeholder (int)}{HorizontalSpace }{TypedText Arg2:}{Placeholder (int)}
// CHECK-CCH: ObjCClassMethodDecl:{ResultType id}{TypedText protocolClassMethod}
// RUN: c-index-test -code-completion-at=%s:134:6 %s | FileCheck -check-prefix=CHECK-CCI %s
-// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method1} (22)
-// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (20)
+// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method1} (37)
+// CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (35)
+
+// RUN: c-index-test -code-completion-at=%s:150:5 %s | FileCheck -check-prefix=CHECK-REDUNDANT %s
+// CHECK-REDUNDANT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2} (35)
+// CHECK-REDUNDANT-NOT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method2}
+// CHECK-REDUNDANT: ObjCInstanceMethodDecl:{ResultType void}{TypedText method3} (35)
+
+// RUN: c-index-test -code-completion-at=%s:170:16 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s
+// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method3} (35)
+// CHECK-CLASS-RESULT: ObjCClassMethodDecl:{ResultType void}{TypedText class_method4} (35)
+
+// 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
+// RUN: c-index-test -code-completion-at=%s:139:16 %s | FileCheck -check-prefix=CHECK-CC8 %s
+// RUN: c-index-test -code-completion-at=%s:139:23 %s | FileCheck -check-prefix=CHECK-CC9 %s
+
+// RUN: c-index-test -code-completion-at=%s:140:14 %s | FileCheck -check-prefix=CHECK-CCC %s
+// RUN: c-index-test -code-completion-at=%s:140:23 %s | FileCheck -check-prefix=CHECK-CCD %s
+// RUN: c-index-test -code-completion-at=%s:140:30 %s | FileCheck -check-prefix=CHECK-CCE %s
+// RUN: c-index-test -code-completion-at=%s:141:14 %s | FileCheck -check-prefix=CHECK-CCC %s
+// RUN: c-index-test -code-completion-at=%s:141:23 %s | FileCheck -check-prefix=CHECK-CCD %s
+// RUN: c-index-test -code-completion-at=%s:141:30 %s | FileCheck -check-prefix=CHECK-CCE %s
+
+// RUN: c-index-test -code-completion-at=%s:175:12 %s | FileCheck -check-prefix=CHECK-CLASS-RESULT %s
diff --git a/test/Index/complete-preprocessor.m b/test/Index/complete-preprocessor.m
index 1873dad6f359..bea9d32d1a55 100644
--- a/test/Index/complete-preprocessor.m
+++ b/test/Index/complete-preprocessor.m
@@ -14,63 +14,63 @@
FOO(in,t) value;
// RUN: c-index-test -code-completion-at=%s:4:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText error}{HorizontalSpace }{Placeholder message} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText if}{HorizontalSpace }{Placeholder condition} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText ifdef}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText ifndef}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number}{HorizontalSpace }{Text "}{Placeholder filename}{Text "} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText pragma}{HorizontalSpace }{Placeholder arguments} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText undef}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC1-NEXT: NotImplemented:{TypedText warning}{HorizontalSpace }{Placeholder message} (30)
+// CHECK-CC1: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText error}{HorizontalSpace }{Placeholder message} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText if}{HorizontalSpace }{Placeholder condition} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText ifdef}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText ifndef}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number}{HorizontalSpace }{Text "}{Placeholder filename}{Text "} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText pragma}{HorizontalSpace }{Placeholder arguments} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText undef}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC1-NEXT: NotImplemented:{TypedText warning}{HorizontalSpace }{Placeholder message} (40)
// RUN: c-index-test -code-completion-at=%s:5:2 %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText elif}{HorizontalSpace }{Placeholder condition} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText else} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText endif} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText error}{HorizontalSpace }{Placeholder message} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText if}{HorizontalSpace }{Placeholder condition} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText ifdef}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText ifndef}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number}{HorizontalSpace }{Text "}{Placeholder filename}{Text "} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText pragma}{HorizontalSpace }{Placeholder arguments} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText undef}{HorizontalSpace }{Placeholder macro} (30)
-// CHECK-CC2-NEXT: NotImplemented:{TypedText warning}{HorizontalSpace }{Placeholder message} (30)
+// CHECK-CC2: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText define}{HorizontalSpace }{Placeholder macro}{LeftParen (}{Placeholder args}{RightParen )} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText elif}{HorizontalSpace }{Placeholder condition} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText else} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText endif} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText error}{HorizontalSpace }{Placeholder message} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText if}{HorizontalSpace }{Placeholder condition} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText ifdef}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText ifndef}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText import}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText include}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text "}{Placeholder header}{Text "} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText include_next}{HorizontalSpace }{Text <}{Placeholder header}{Text >} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText line}{HorizontalSpace }{Placeholder number}{HorizontalSpace }{Text "}{Placeholder filename}{Text "} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText pragma}{HorizontalSpace }{Placeholder arguments} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText undef}{HorizontalSpace }{Placeholder macro} (40)
+// CHECK-CC2-NEXT: NotImplemented:{TypedText warning}{HorizontalSpace }{Placeholder message} (40)
// RUN: c-index-test -code-completion-at=%s:9:8 %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: NotImplemented:{TypedText BAR} (30)
-// CHECK-CC3: NotImplemented:{TypedText FOO} (30)
+// CHECK-CC3: NotImplemented:{TypedText BAR} (40)
+// CHECK-CC3: NotImplemented:{TypedText FOO} (40)
// RUN: c-index-test -code-completion-at=%s:11:12 %s | FileCheck -check-prefix=CHECK-CC3 %s
// RUN: c-index-test -code-completion-at=%s:11:13 %s | FileCheck -check-prefix=CHECK-CC3 %s
// RUN: c-index-test -code-completion-at=%s:11:5 %s | FileCheck -check-prefix=CHECK-CC4 %s
// CHECK-CC4: macro definition:{TypedText BAR} (70)
// CHECK-CC4: macro definition:{TypedText FOO}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (70)
// RUN: c-index-test -code-completion-at=%s:14:5 %s | FileCheck -check-prefix=CHECK-CC5 %s
-// CHECK-CC5: NotImplemented:{TypedText const} (65)
-// CHECK-CC5: NotImplemented:{TypedText double} (65)
-// CHECK-CC5: NotImplemented:{TypedText enum} (65)
-// CHECK-CC5: NotImplemented:{TypedText extern} (30)
-// CHECK-CC5: NotImplemented:{TypedText float} (65)
+// CHECK-CC5: NotImplemented:{TypedText const} (50)
+// CHECK-CC5: NotImplemented:{TypedText double} (50)
+// CHECK-CC5: NotImplemented:{TypedText enum} (50)
+// CHECK-CC5: NotImplemented:{TypedText extern} (40)
+// CHECK-CC5: NotImplemented:{TypedText float} (50)
// CHECK-CC5: macro definition:{TypedText FOO}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (70)
-// CHECK-CC5: TypedefDecl:{TypedText id} (65)
-// CHECK-CC5: NotImplemented:{TypedText inline} (30)
-// CHECK-CC5: NotImplemented:{TypedText int} (65)
-// CHECK-CC5: NotImplemented:{TypedText long} (65)
+// CHECK-CC5: TypedefDecl:{TypedText id} (50)
+// CHECK-CC5: NotImplemented:{TypedText inline} (40)
+// CHECK-CC5: NotImplemented:{TypedText int} (50)
+// CHECK-CC5: NotImplemented:{TypedText long} (50)
// Same tests as above, but with completion caching.
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:4:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
diff --git a/test/Index/complete-properties.m b/test/Index/complete-properties.m
index 80e10e7822c7..725f180f7c29 100644
--- a/test/Index/complete-properties.m
+++ b/test/Index/complete-properties.m
@@ -1,6 +1,6 @@
/* Note: the RUN lines are near the end of the file, since line/column
matter for this test. */
-
+@class MyClass;
@interface I1
{
id StoredProp3;
@@ -21,6 +21,14 @@
@dynamic Prop4;
@end
+@interface I3 : I2
+@property id Prop3;
+@end
+
+id test(I3 *i3) {
+ return i3.Prop3;
+}
+
// 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}
@@ -38,3 +46,14 @@
// 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}
+
+// RUN: c-index-test -code-completion-at=%s:29:13 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5: ObjCPropertyDecl:{ResultType int}{TypedText Prop0} (35)
+// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText Prop1} (35)
+// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType float}{TypedText Prop2} (35)
+// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop3} (35)
+// CHECK-CC5-NEXT: ObjCPropertyDecl:{ResultType id}{TypedText Prop4} (35)
+
+// RUN: c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC6 %s
+// CHECK-CC6: ObjCInterfaceDecl:{TypedText MyClass} (50)
+
diff --git a/test/Index/complete-protocols.m b/test/Index/complete-protocols.m
index 89f61bcf9ac9..6af0198baae0 100644
--- a/test/Index/complete-protocols.m
+++ b/test/Index/complete-protocols.m
@@ -16,10 +16,12 @@ void f(id<Protocol1,Protocol2>);
// RUN: c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: ObjCProtocolDecl:{TypedText Protocol1}
-// CHECK-CC1: ObjCProtocolDecl:{TypedText Protocol2}
+// CHECK-CC1-NEXT: ObjCProtocolDecl:{TypedText Protocol2}
// RUN: c-index-test -code-completion-at=%s:9:21 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2-NOT: ObjCProtocolDecl:{TypedText Protocol1}
// CHECK-CC2: ObjCProtocolDecl:{TypedText Protocol2}
// RUN: c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: ObjCProtocolDecl:{TypedText Protocol0}
// CHECK-CC3-NEXT: ObjCProtocolDecl:{TypedText Protocol2}
+
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:9:11 %s | FileCheck -check-prefix=CHECK-CC1 %s
diff --git a/test/Index/complete-recovery.m b/test/Index/complete-recovery.m
index fbd92c794d8f..9300a7999217 100644
--- a/test/Index/complete-recovery.m
+++ b/test/Index/complete-recovery.m
@@ -7,19 +7,29 @@
@implementation A
- (void)method:(int)x {
A *a = [A method:1];
- blarg * blah = wibble
+ blarg * blah = wibble;
+ A *a2;
+ z = [a2 method:1];
+ blah ? blech : [a2 method:1];
+ (a * a2)([a2 method:1]);
+ B *a = [a2 method:1];
}
@end
-// RUN: c-index-test -code-completion-at=%s:9:20 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
// RUN: not grep error %t
// CHECK-CC1: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC1-NOT: NotImplemented:{TypedText _Bool}
// CHECK-CC1: VarDecl:{ResultType A *}{TypedText a}
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
-// RUN: c-index-test -code-completion-at=%s:10:24 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
// CHECK-CC2: NotImplemented:{TypedText _Bool}
// CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:12:11 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (int)} (32)
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:13:22 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:14:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:15:14 %s | FileCheck -check-prefix=CHECK-CC3 %s
diff --git a/test/Index/complete-super.cpp b/test/Index/complete-super.cpp
index 49f94e40d245..71c22ad00d1e 100644
--- a/test/Index/complete-super.cpp
+++ b/test/Index/complete-super.cpp
@@ -21,13 +21,13 @@ void B::bar(float real) {
}
// RUN: c-index-test -code-completion-at=%s:16:3 %s | FileCheck -check-prefix=CHECK-FOO-UNQUAL %s
-// CHECK-FOO-UNQUAL: CXXMethod:{Text A::}{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (8)
+// CHECK-FOO-UNQUAL: CXXMethod:{Text A::}{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (20)
// RUN: c-index-test -code-completion-at=%s:20:3 %s | FileCheck -check-prefix=CHECK-BAR-UNQUAL %s
-// CHECK-BAR-UNQUAL: CXXMethod:{Text A::}{TypedText bar}{LeftParen (}{Placeholder real}{RightParen )} (8)
-// CHECK-BAR-UNQUAL: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{Placeholder float real}{RightParen )} (14)
-// CHECK-BAR-UNQUAL: CXXMethod:{ResultType void}{Text A::}{TypedText bar}{LeftParen (}{Placeholder double x}{RightParen )} (16)
+// CHECK-BAR-UNQUAL: CXXMethod:{Text A::}{TypedText bar}{LeftParen (}{Placeholder real}{RightParen )} (20)
+// CHECK-BAR-UNQUAL: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{Placeholder float real}{RightParen )} (34)
+// CHECK-BAR-UNQUAL: CXXMethod:{ResultType void}{Text A::}{TypedText bar}{LeftParen (}{Placeholder double x}{RightParen )} (36)
// RUN: c-index-test -code-completion-at=%s:16:6 %s | FileCheck -check-prefix=CHECK-FOO-QUAL %s
-// CHECK-FOO-QUAL: CXXMethod:{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (8)
+// CHECK-FOO-QUAL: CXXMethod:{TypedText foo}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (20)
diff --git a/test/Index/complete-super.m b/test/Index/complete-super.m
index fc60c6c42d6a..6c2daa808206 100644
--- a/test/Index/complete-super.m
+++ b/test/Index/complete-super.m
@@ -22,34 +22,60 @@ typedef int Bool;
+ (void)select:(Bool)condition first:(int)a second:(int)b {
[super selector:condition first:a second:b];
+ super selector:condition first:a second:b];
+}
+@end
+
+@interface A (Cat)
+- (void)multiply:(int)x by:(int)y;
+@end
+
+@interface C : A
+@end
+
+@implementation C
+- (void)multiply:(int)a by:(int)b {
+ [super multiply:a by:b];
}
@end
// Check "super" completion as a message receiver.
// RUN: c-index-test -code-completion-at=%s:20:4 %s | FileCheck -check-prefix=CHECK-ADD-RECEIVER %s
-// CHECK-ADD-RECEIVER: ObjCInstanceMethodDecl:{ResultType void}{TypedText super}{HorizontalSpace }{Text add:}{Placeholder a}{HorizontalSpace }{Text to:}{Placeholder b} (8)
+// CHECK-ADD-RECEIVER: ObjCInstanceMethodDecl:{ResultType void}{TypedText super}{HorizontalSpace }{Text add:}{Placeholder a}{HorizontalSpace }{Text to:}{Placeholder b} (20)
// RUN: c-index-test -code-completion-at=%s:24:4 %s | FileCheck -check-prefix=CHECK-SELECT-RECEIVER %s
-// CHECK-SELECT-RECEIVER: ObjCClassMethodDecl:{ResultType void}{TypedText super}{HorizontalSpace }{Text select:}{Placeholder condition}{HorizontalSpace }{Text first:}{Placeholder a}{HorizontalSpace }{Text second:}{Placeholder b} (8)
+// CHECK-SELECT-RECEIVER: ObjCClassMethodDecl:{ResultType void}{TypedText super}{HorizontalSpace }{Text select:}{Placeholder condition}{HorizontalSpace }{Text first:}{Placeholder a}{HorizontalSpace }{Text second:}{Placeholder b} (20)
// Check "super" completion at the first identifier
// RUN: c-index-test -code-completion-at=%s:20:10 %s | FileCheck -check-prefix=CHECK-ADD-ADD %s
-// CHECK-ADD-ADD: ObjCInstanceMethodDecl:{ResultType void}{TypedText add:}{Placeholder a}{HorizontalSpace }{Text to:}{Placeholder b} (8)
+// CHECK-ADD-ADD: ObjCInstanceMethodDecl:{ResultType void}{TypedText add:}{Placeholder a}{HorizontalSpace }{Text to:}{Placeholder b} (20)
// CHECK-ADD-ADD-NOT: add
-// CHECK-ADD-ADD: ObjCInstanceMethodDecl:{ResultType void}{TypedText last} (20)
+// CHECK-ADD-ADD: ObjCInstanceMethodDecl:{ResultType void}{TypedText last} (35)
// RUN: c-index-test -code-completion-at=%s:24:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
// CHECK-SELECTOR-SELECTOR-NOT: x
-// CHECK-SELECTOR-SELECTOR: ObjCClassMethodDecl:{ResultType void}{TypedText last} (20)
-// CHECK-SELECTOR-SELECTOR: ObjCClassMethodDecl:{ResultType void}{TypedText select:}{Placeholder condition}{HorizontalSpace }{Text first:}{Placeholder a}{HorizontalSpace }{Text second:}{Placeholder b} (8)
+// CHECK-SELECTOR-SELECTOR: ObjCClassMethodDecl:{ResultType void}{TypedText last} (35)
+// CHECK-SELECTOR-SELECTOR: ObjCClassMethodDecl:{ResultType void}{TypedText select:}{Placeholder condition}{HorizontalSpace }{Text first:}{Placeholder a}{HorizontalSpace }{Text second:}{Placeholder b} (20)
// Check "super" completion at the second identifier
// RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
-// CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (8)
+// CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
-// CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace }{Text second:}{Placeholder b} (8)
+// CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace }{Text second:}{Placeholder b} (20)
// Check "super" completion at the third identifier
// RUN: c-index-test -code-completion-at=%s:24:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
-// CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (8)
+// CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (20)
+
+// Check "super" completion with missing '['.
+// RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
+// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
+
+// Check "super" completion for a method declared in a category.
+// RUN: c-index-test -code-completion-at=%s:38:10 %s | FileCheck -check-prefix=CHECK-IN-CATEGORY %s
+// CHECK-IN-CATEGORY: ObjCInstanceMethodDecl:{ResultType void}{TypedText add:}{Placeholder (int)}{HorizontalSpace }{TypedText to:}{Placeholder (int)} (35)
+// CHECK-IN-CATEGORY: ObjCInstanceMethodDecl:{ResultType void}{TypedText last} (35)
+// CHECK-IN-CATEGORY: ObjCInstanceMethodDecl:{ResultType void}{TypedText multiply:}{Placeholder a}{HorizontalSpace }{Text by:}{Placeholder b} (20)
+
diff --git a/test/Index/complete-synthesized.m b/test/Index/complete-synthesized.m
new file mode 100644
index 000000000000..1a4858449f42
--- /dev/null
+++ b/test/Index/complete-synthesized.m
@@ -0,0 +1,56 @@
+// Note: this test is line- and column-sensitive. Test commands are at
+// the end.
+
+
+@interface A
+@property int prop1;
+@end
+
+@interface B : A {
+ float _prop2;
+}
+@property float prop2;
+@property short prop3;
+@end
+
+@interface B ()
+@property double prop4;
+@end
+
+@implementation B
+@synthesize prop2 = _prop2;
+
+- (int)method {
+ return _prop2;
+}
+
+@dynamic prop3;
+
+- (short)method2 {
+ return prop4;
+}
+
+- (short)method3 {
+ return prop3;
+}
+@end
+
+// RUN: c-index-test -code-completion-at=%s:24:1 -Xclang -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{TypedText _Bool} (50)
+// CHECK-CC1: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35)
+// CHECK-CC1-NOT: prop2
+// CHECK-CC1: ObjCPropertyDecl:{ResultType short}{TypedText prop3} (35)
+// CHECK-CC1: ObjCPropertyDecl:{ResultType double}{TypedText prop4} (35)
+
+// RUN: c-index-test -code-completion-at=%s:30:2 -Xclang -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: NotImplemented:{TypedText _Bool} (50)
+// CHECK-CC2: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35)
+// CHECK-CC2-NOT: prop3
+// CHECK-CC2: ObjCPropertyDecl:{ResultType double}{TypedText prop4} (35)
+
+// RUN: c-index-test -code-completion-at=%s:34:2 -Xclang -fobjc-nonfragile-abi %s | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: NotImplemented:{TypedText _Bool} (50)
+// CHECK-CC3: ObjCIvarDecl:{ResultType float}{TypedText _prop2} (35)
+// CHECK-CC3: ObjCPropertyDecl:{ResultType double}{TypedText prop4}
+// CHECK-CC3-NOT: ObjCPropertyDecl:{ResultType double}{TypedText prop4} (35)
+// CHECK-CC1: restrict
diff --git a/test/Index/complete-templates.cpp b/test/Index/complete-templates.cpp
index 2f2302d08d82..d2279b1fa733 100644
--- a/test/Index/complete-templates.cpp
+++ b/test/Index/complete-templates.cpp
@@ -15,5 +15,5 @@ void test() {
}
// RUN: c-index-test -code-completion-at=%s:14:2 %s | FileCheck %s
-// CHECK: FunctionTemplate:{ResultType void}{TypedText f}{LeftParen (}{Placeholder T}{RightParen )} (45)
+// CHECK: FunctionTemplate:{ResultType void}{TypedText f}{LeftParen (}{Placeholder T}{RightParen )} (50)
// CHECK: ClassTemplate:{TypedText X}{LeftAngle <}{Placeholder typename T}{RightAngle >} (50)
diff --git a/test/Index/complete-type-factors.m b/test/Index/complete-type-factors.m
index 2048cd35233a..b7bafb46712b 100644
--- a/test/Index/complete-type-factors.m
+++ b/test/Index/complete-type-factors.m
@@ -22,86 +22,116 @@ enum Priority test1(enum Priority priority, enum Color color, int integer) {
c = color;
}
-// FIXME: It would be great for message sends to have the same
-// benefits as function calls, but we don't quite have the
-// infrastructure yet.
+@interface A
++ (void)method:(enum Color)color priority:(enum Priority)priority;
+- (void)method:(enum Color)color priority:(enum Priority)priority;
+@end
+
+void test2(A *a) {
+ [a method:Red priority:High];
+ [A method:Red priority:Low];
+}
// RUN: c-index-test -code-completion-at=%s:16:11 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (30)
-// CHECK-CC1: ParmDecl:{ResultType enum Color}{TypedText color} (4)
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (32)
+// CHECK-CC1: ParmDecl:{ResultType enum Color}{TypedText color} (17)
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (12)
// CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (25)
-// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (30)
-// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (30)
-// CHECK-CC1: VarDecl:{ResultType int}{TypedText i} (2)
-// CHECK-CC1: ParmDecl:{ResultType int}{TypedText integer} (2)
-// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (30)
-// CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (4)
-// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (30)
-// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (32)
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (32)
+// CHECK-CC1: VarDecl:{ResultType int}{TypedText i} (8)
+// CHECK-CC1: ParmDecl:{ResultType int}{TypedText integer} (8)
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (32)
+// CHECK-CC1: ParmDecl:{ResultType enum Priority}{TypedText priority} (17)
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (32)
+// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// CHECK-CC1: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (25)
// RUN: c-index-test -code-completion-at=%s:17:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
-// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15)
-// CHECK-CC2: VarDecl:{ResultType enum Color}{TypedText c} (2)
-// CHECK-CC2: ParmDecl:{ResultType enum Color}{TypedText color} (2)
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
+// CHECK-CC2: VarDecl:{ResultType enum Color}{TypedText c} (8)
+// CHECK-CC2: ParmDecl:{ResultType enum Color}{TypedText color} (8)
// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25)
// CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50)
-// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15)
-// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60)
-// CHECK-CC2: VarDecl:{ResultType int}{TypedText i} (4)
-// CHECK-CC2: ParmDecl:{ResultType int}{TypedText integer} (4)
-// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60)
-// CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (8)
-// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15)
-// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16)
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65)
+// CHECK-CC2: VarDecl:{ResultType int}{TypedText i} (17)
+// CHECK-CC2: ParmDecl:{ResultType int}{TypedText integer} (17)
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
+// CHECK-CC2: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
+// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// CHECK-CC2: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
// RUN: c-index-test -code-completion-at=%s:18:10 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
-// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (60)
-// CHECK-CC3: VarDecl:{ResultType enum Color}{TypedText c} (8)
-// CHECK-CC3: ParmDecl:{ResultType enum Color}{TypedText color} (8)
+// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65)
+// CHECK-CC3: VarDecl:{ResultType enum Color}{TypedText c} (34)
+// CHECK-CC3: ParmDecl:{ResultType enum Color}{TypedText color} (34)
// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25)
// CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (12)
// CHECK-CC3: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50)
-// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (60)
-// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (15)
-// CHECK-CC3: VarDecl:{ResultType int}{TypedText i} (4)
-// CHECK-CC3: ParmDecl:{ResultType int}{TypedText integer} (4)
-// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (15)
-// CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (2)
-// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (60)
-// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (65)
+// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (16)
+// CHECK-CC3: VarDecl:{ResultType int}{TypedText i} (17)
+// CHECK-CC3: ParmDecl:{ResultType int}{TypedText integer} (17)
+// CHECK-CC3: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16)
+// CHECK-CC3: ParmDecl:{ResultType enum Priority}{TypedText priority} (8)
+// CHECK-CC3: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65)
+// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// CHECK-CC3: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12)
// RUN: c-index-test -code-completion-at=%s:19:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15)
-// CHECK-CC4: VarDecl:{ResultType enum Color}{TypedText c} (2)
-// CHECK-CC4: ParmDecl:{ResultType enum Color}{TypedText color} (2)
+// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
+// CHECK-CC4: VarDecl:{ResultType enum Color}{TypedText c} (8)
+// CHECK-CC4: ParmDecl:{ResultType enum Color}{TypedText color} (8)
// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25)
// CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC4: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50)
-// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15)
-// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60)
-// CHECK-CC4: VarDecl:{ResultType int}{TypedText i} (4)
-// CHECK-CC4: ParmDecl:{ResultType int}{TypedText integer} (4)
-// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60)
-// CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (8)
-// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15)
-// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16)
+// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65)
+// CHECK-CC4: VarDecl:{ResultType int}{TypedText i} (17)
+// CHECK-CC4: ParmDecl:{ResultType int}{TypedText integer} (17)
+// CHECK-CC4: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
+// CHECK-CC4: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
+// CHECK-CC4: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
+// CHECK-CC4: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// CHECK-CC4: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
// RUN: c-index-test -code-completion-at=%s:21:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
// RUN: c-index-test -code-completion-at=%s:22:7 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
-// CHECK-CC6: VarDecl:{ResultType void (^)(enum Color, int)}{TypedText block} (8)
-// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (15)
-// CHECK-CC6: VarDecl:{ResultType enum Color}{TypedText c} (2)
-// CHECK-CC6: ParmDecl:{ResultType enum Color}{TypedText color} (2)
+// CHECK-CC6: VarDecl:{ResultType void (^)(enum Color, int)}{TypedText block} (34)
+// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
+// CHECK-CC6: VarDecl:{ResultType enum Color}{TypedText c} (8)
+// CHECK-CC6: ParmDecl:{ResultType enum Color}{TypedText color} (8)
// CHECK-CC6: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25)
// CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50)
-// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (15)
-// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (60)
-// CHECK-CC6: VarDecl:{ResultType int}{TypedText i} (4)
-// CHECK-CC6: ParmDecl:{ResultType int}{TypedText integer} (4)
-// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (60)
-// CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (8)
-// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (15)
-// CHECK-CC6: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
+// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16)
+// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65)
+// CHECK-CC6: VarDecl:{ResultType int}{TypedText i} (17)
+// CHECK-CC6: ParmDecl:{ResultType int}{TypedText integer} (17)
+// CHECK-CC6: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
+// CHECK-CC6: ParmDecl:{ResultType enum Priority}{TypedText priority} (34)
+// CHECK-CC6: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
+// CHECK-CC6: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
// CHECK-CC6: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
+// RUN: c-index-test -code-completion-at=%s:31:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
+// RUN: c-index-test -code-completion-at=%s:32:13 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
+// CHECK-CC7: ParmDecl:{ResultType A *}{TypedText a} (34)
+// CHECK-CC7: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (16)
+// CHECK-CC7: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25)
+// CHECK-CC7: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (50)
+// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50)
+// CHECK-CC7: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (16)
+// CHECK-CC7: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (65)
+// CHECK-CC7: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (65)
+// CHECK-CC7: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (16)
+// CHECK-CC7: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (50)
+// RUN: c-index-test -code-completion-at=%s:31:26 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s
+// RUN: c-index-test -code-completion-at=%s:32:26 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC8 %s
+// CHECK-CC8: ParmDecl:{ResultType A *}{TypedText a} (34)
+// CHECK-CC8: EnumConstantDecl:{ResultType enum Color}{TypedText Blue} (65)
+// CHECK-CC8: FunctionDecl:{ResultType int}{TypedText func1}{LeftParen (}{Placeholder enum Color}{RightParen )} (25)
+// CHECK-CC8: FunctionDecl:{ResultType enum Priority}{TypedText func2}{LeftParen (}{Placeholder int}{RightParen )} (12)
+// CHECK-CC8: FunctionDecl:{ResultType void}{TypedText func3}{LeftParen (}{Placeholder float}{RightParen )} (50)
+// CHECK-CC8: EnumConstantDecl:{ResultType enum Color}{TypedText Green} (65)
+// CHECK-CC8: EnumConstantDecl:{ResultType enum Priority}{TypedText High} (16)
+// CHECK-CC8: EnumConstantDecl:{ResultType enum Priority}{TypedText Low} (16)
+// CHECK-CC8: EnumConstantDecl:{ResultType enum Color}{TypedText Red} (65)
+// CHECK-CC8: FunctionDecl:{ResultType enum Priority}{TypedText test1}{LeftParen (}{Placeholder enum Priority priority}{Comma , }{Placeholder enum Color color}{Comma , }{Placeholder int integer}{RightParen )} (12)
diff --git a/test/Index/crash-recovery-code-complete.c b/test/Index/crash-recovery-code-complete.c
index a80bdc2aee80..9cad985364f8 100644
--- a/test/Index/crash-recovery-code-complete.c
+++ b/test/Index/crash-recovery-code-complete.c
@@ -1,8 +1,9 @@
-// RUN: env CINDEXTEST_EDITING=1 \
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_PREAMBLE_FILE=%t-preamble.pch \
// RUN: not c-index-test -code-completion-at=%s:20:1 \
// RUN: "-remap-file=%s;%S/Inputs/crash-recovery-code-complete-remap.c" \
// RUN: %s 2> %t.err
// RUN: FileCheck < %t.err -check-prefix=CHECK-CODE-COMPLETE-CRASH %s
+// RUN: rm %t-preamble.pch
// CHECK-CODE-COMPLETE-CRASH: Unable to perform code completion!
//
// REQUIRES: crash-recovery
diff --git a/test/Index/crash-recovery-reparse.c b/test/Index/crash-recovery-reparse.c
index e394bd18dfb5..243a914ec40d 100644
--- a/test/Index/crash-recovery-reparse.c
+++ b/test/Index/crash-recovery-reparse.c
@@ -1,8 +1,9 @@
-// RUN: env CINDEXTEST_EDITING=1 \
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_PREAMBLE_FILE=%t-preamble.pch \
// RUN: not c-index-test -test-load-source-reparse 1 local \
// RUN: -remap-file="%s;%S/Inputs/crash-recovery-reparse-remap.c" \
// RUN: %s 2> %t.err
// RUN: FileCheck < %t.err -check-prefix=CHECK-REPARSE-SOURCE-CRASH %s
+// RUN: rm %t-preamble.pch
// CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit
//
// REQUIRES: crash-recovery
diff --git a/test/Index/fix-its.c b/test/Index/fix-its.c
new file mode 100644
index 000000000000..d82f2998e6fd
--- /dev/null
+++ b/test/Index/fix-its.c
@@ -0,0 +1,18 @@
+// RUN: c-index-test -test-load-source all -fspell-checking %s 2> %t
+// RUN: FileCheck %s < %t
+struct X {
+ int wibble;
+};
+
+#define MACRO(X) X
+
+void f(struct X *x) {
+ // CHECK: error: no member named 'wobble' in 'struct X'; did you mean 'wibble'?
+ // CHECK-NOT: FIX-IT
+ // CHECK: note: 'wibble' declared here
+ MACRO(x->wobble = 17);
+ // CHECK: error: no member named 'wabble' in 'struct X'; did you mean 'wibble'?
+ // CHECK: FIX-IT: Replace [17:6 - 17:12] with "wibble"
+ // CHECK: note: 'wibble' declared here
+ x->wabble = 17;
+}
diff --git a/test/Index/get-cursor-includes.c b/test/Index/get-cursor-includes.c
new file mode 100644
index 000000000000..68d64f144673
--- /dev/null
+++ b/test/Index/get-cursor-includes.c
@@ -0,0 +1,7 @@
+#include "get-cursor-includes-2.h"
+#include "get-cursor-includes-2.h"
+
+// RUN: c-index-test -write-pch %t.h.pch -I%S/Inputs -Xclang -detailed-preprocessing-record %S/Inputs/get-cursor-includes-2.h
+// RUN: c-index-test -cursor-at=%S/Inputs/get-cursor-includes-2.h:1:5 -I%S/Inputs -include %t.h %s | FileCheck %s
+
+// CHECK: inclusion directive=get-cursor-includes-1.h
diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp
new file mode 100644
index 000000000000..f26d9825a102
--- /dev/null
+++ b/test/Index/get-cursor.cpp
@@ -0,0 +1,63 @@
+// Test is line- and column-sensitive. Run lines are below.
+
+struct X {
+ X();
+ X(int);
+ X(int, int);
+ X(const X&);
+};
+
+X getX(int value) {
+ switch (value) {
+ case 1: return X(value);
+ case 2: return X(value, value);
+ case 3: return (X)value;
+ default: break;
+ }
+ return X();
+}
+
+struct Y {
+ int member;
+
+ X getX();
+};
+
+X Y::getX() {
+ return member;
+}
+
+struct YDerived : Y {
+ X getAnotherX() { return member; }
+};
+
+// RUN: c-index-test -cursor-at=%s:12:20 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
+// RUN: c-index-test -cursor-at=%s:13:21 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
+// RUN: c-index-test -cursor-at=%s:13:28 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
+// RUN: c-index-test -cursor-at=%s:14:23 %s | FileCheck -check-prefix=CHECK-VALUE-REF %s
+// CHECK-VALUE-REF: DeclRefExpr=value:10:12
+
+// RUN: c-index-test -cursor-at=%s:12:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s
+// RUN: c-index-test -cursor-at=%s:13:18 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR2 %s
+// RUN: c-index-test -cursor-at=%s:14:19 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR1 %s
+// RUN: c-index-test -cursor-at=%s:17:10 %s | FileCheck -check-prefix=CHECK-CONSTRUCTOR3 %s
+// CHECK-TYPE-REF: TypeRef=struct X:3:8
+// CHECK-CONSTRUCTOR1: CallExpr=X:5:3
+// CHECK-CONSTRUCTOR2: CallExpr=X:6:3
+// CHECK-CONSTRUCTOR3: CallExpr=X:4:3
+
+// RUN: c-index-test -cursor-at=%s:23:3 %s | FileCheck -check-prefix=CHECK-RETTYPE %s
+// RUN: c-index-test -cursor-at=%s:26:1 %s | FileCheck -check-prefix=CHECK-RETTYPE %s
+// CHECK-RETTYPE: TypeRef=struct X:3:8
+
+// RUN: c-index-test -cursor-at=%s:23:7 %s | FileCheck -check-prefix=CHECK-MEMFUNC-DECL %s
+// CHECK-MEMFUNC-DECL: CXXMethod=getX:23:5
+// RUN: c-index-test -cursor-at=%s:26:7 %s | FileCheck -check-prefix=CHECK-MEMFUNC-DEF %s
+// CHECK-MEMFUNC-DEF: CXXMethod=getX:26:6
+
+// RUN: c-index-test -cursor-at=%s:26:3 %s | FileCheck -check-prefix=CHECK-TYPEREF-Y %s
+// CHECK-TYPEREF-Y: TypeRef=struct Y:20:8
+
+// RUN: c-index-test -cursor-at=%s:27:10 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s
+// RUN: c-index-test -cursor-at=%s:31:28 %s | FileCheck -check-prefix=CHECK-IMPLICIT-MEMREF %s
+// CHECK-IMPLICIT-MEMREF: MemberRefExpr=member:21:7
diff --git a/test/Index/index-templates.cpp b/test/Index/index-templates.cpp
index a4f1ee8d2c80..3def6001a10a 100644
--- a/test/Index/index-templates.cpp
+++ b/test/Index/index-templates.cpp
@@ -55,6 +55,51 @@ void template_exprs() {
Z4().getAs<Unsigned>();
}
+template<typename T> void swap(T&, T&);
+template<typename T, typename U> void swap(Y<T, U>&, Y<T, U>&);
+void swap(Z4&, Z4&);
+
+struct Z5 {
+ int f(int);
+ float f(float);
+};
+
+template<typename T>
+void unresolved_exprs(T &x) {
+ swap(x, x);
+ Z5 z5;
+ z5.f(x);
+ swap<T>(x, x);
+}
+
+template<typename T, typename U>
+struct Pair {
+ T first;
+ U second;
+};
+
+template<typename T, typename U>
+void init_list(T t, U u) {
+ typedef U second_type;
+
+ Pair<T, U> p = { t, second_type(u) };
+}
+
+template<typename T>
+struct compare { };
+
+template<typename Key, typename Value,
+ typename Comparison = compare<Pair<Key, Value> >,
+ typename Allocator = allocator<Pair<Key, Value> > >
+struct map;
+
+void f(map<Z4, Pair<int, Z4> >);
+
+template class Pair<int, int>;
+
+template<typename T, typename U>
+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]
@@ -110,7 +155,6 @@ void template_exprs() {
// 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:53:6: FunctionDecl=template_exprs:53:6 (Definition)
-// CHECK-LOAD: <invalid loc>:0:0: UnexposedStmt=
// 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]
// CHECK-LOAD: index-templates.cpp:54:3: DeclRefExpr=f:4:6 Extent=[54:3 - 54:35]
@@ -118,30 +162,46 @@ void template_exprs() {
// CHECK-LOAD: index-templates.cpp:54:15: DeclRefExpr=OneDimension:35:16 Extent=[54:15 - 54:27]
// CHECK-LOAD: index-templates.cpp:54:29: TemplateRef=array:37:8 Extent=[54:29 - 54:34]
// CHECK-LOAD: index-templates.cpp:55:8: MemberRefExpr=getAs:50:26 Extent=[55:3 - 55:23]
-// CHECK-LOAD: index-templates.cpp:55:3: CallExpr= Extent=[55:3 - 55:7]
+// CHECK-LOAD: index-templates.cpp:55:3: CallExpr=Z4:49:8 Extent=[55:3 - 55:7]
// CHECK-LOAD: index-templates.cpp:55:14: TypeRef=Unsigned:42:18 Extent=[55:14 - 55:22]
+// CHECK-LOAD: index-templates.cpp:68:6: FunctionTemplate=unresolved_exprs:68:6 (Definition)
+// CHECK-LOAD: index-templates.cpp:69:3: OverloadedDeclRef=swap[60:6, 59:39, 58:27]
+// CHECK-LOAD: index-templates.cpp:71:6: OverloadedDeclRef=f[63:7, 64:9]
+// CHECK-LOAD: index-templates.cpp:72:3: OverloadedDeclRef=swap[58:27, 59:39]
+// CHECK-LOAD: index-templates.cpp:82:6: FunctionTemplate=init_list:82:6 (Definition)
+// CHECK-LOAD: index-templates.cpp:85:14: VarDecl=p:85:14 (Definition)
+// CHECK-LOAD: index-templates.cpp:85:20: DeclRefExpr=t:82:18 Extent=[85:20 - 85:21]
+// 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: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.22t0.0# Extent=[3:1 - 4:22]
+// 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@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.22t0.0#@x Extent=[4:8 - 4:21]
+// 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:@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@280@CP>1#T@vector>#*t0.0#>@CT>1#T@allocator1*t0.0 Extent=[13:1 - 14:21]
+// 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:@S@Z1 Extent=[16:1 - 16:14]
-// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z1#$@C@allocator>#$@S@Z1 Extent=[18:1 - 18:22]
+// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z1#$@C@allocator>#S0_ Extent=[18:1 - 18:22]
// 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>#$@S@Z2 Extent=[22:1 - 25:2]
-// CHECK-USRS: index-templates.cpp c:@C@vector>#$@S@Z2#$@C@allocator>#$@S@Z2@F@clear# Extent=[24:8 - 24:15]
+// 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:@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-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/load-decls.c b/test/Index/load-decls.c
index cf88f4285c66..e0617c07df42 100644
--- a/test/Index/load-decls.c
+++ b/test/Index/load-decls.c
@@ -12,5 +12,4 @@ enum Color {
// CHECK: load-decls.c:3:3: EnumConstantDecl=Green:3:3 (Definition) Extent=[3:3 - 3:8]
// CHECK: load-decls.c:4:3: EnumConstantDecl=Blue:4:3 (Definition) Extent=[4:3 - 4:7]
// CHECK: load-decls.c:6:3: EnumConstantDecl=Rouge:6:3 (Definition) Extent=[6:3 - 6:14]
-// CHECK: load-decls.c:6:11: UnexposedExpr=Red:2:3 Extent=[6:11 - 6:14]
// CHECK: load-decls.c:6:11: DeclRefExpr=Red:2:3 Extent=[6:11 - 6:14]
diff --git a/test/Index/load-exprs.c b/test/Index/load-exprs.c
index 248bc6ebf580..01adf62aff49 100644
--- a/test/Index/load-exprs.c
+++ b/test/Index/load-exprs.c
@@ -20,6 +20,17 @@ int test_blocks(int x) {
return y;
}
+struct Y {
+ struct X array[3];
+};
+
+enum { StartIndex = 1 };
+
+void test_members(int aval, int bval) {
+ struct Y y0 = { .array[StartIndex].b = bval, .array[StartIndex].a = aval };
+ __builtin_offsetof(struct Y, array[StartIndex].b);
+}
+
// 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]
@@ -45,11 +56,26 @@ int test_blocks(int x) {
// CHECK: load-exprs.c:11:19: DeclRefExpr=x:10:21 Extent=[11:19 - 11:20]
// CHECK: load-exprs.c:12:3: CallExpr= Extent=[12:3 - 19:7]
// CHECK: load-exprs.c:13:17: VarDecl=z:13:17 (Definition) Extent=[13:13 - 13:22]
-// CHECK: load-exprs.c:14:6: DeclRefExpr= Extent=[14:6 - 14:7]
+// CHECK: load-exprs.c:14: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= Extent=[14:18 - 14:19]
+// CHECK: load-exprs.c:14:18: DeclRefExpr=x:10:21 Extent=[14:18 - 14:19]
// CHECK: load-exprs.c:15:6: CallExpr= Extent=[15:6 - 18:9]
// CHECK: load-exprs.c:16:10: DeclRefExpr=z:13:17 Extent=[16:10 - 16:11]
-// CHECK: load-exprs.c:17:10: DeclRefExpr= Extent=[17:10 - 17:11]
+// CHECK: load-exprs.c: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: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]
+// CHECK: load-exprs.c:30:38: MemberRef=b:2:19 Extent=[30:38 - 30:39]
+// CHECK: load-exprs.c:30:42: DeclRefExpr=bval:29:33 Extent=[30:42 - 30:46]
+// CHECK: load-exprs.c:30:49: MemberRef=array:24:12 Extent=[30:49 - 30:54]
+// CHECK: load-exprs.c:30:55: DeclRefExpr=StartIndex:27:8 Extent=[30:55 - 30:65]
+// CHECK: load-exprs.c:30:67: MemberRef=a:2:16 Extent=[30:67 - 30:68]
+// CHECK: load-exprs.c:30:71: DeclRefExpr=aval:29:23 Extent=[30:71 - 30:75]
+// CHECK: load-exprs.c:31:29: TypeRef=struct Y:23:8 Extent=[31:29 - 31:30]
+// CHECK: load-exprs.c:31:32: MemberRef=array:24:12 Extent=[31:32 - 31:37]
+// CHECK: load-exprs.c:31:38: DeclRefExpr=StartIndex:27:8 Extent=[31:38 - 31:48]
+// CHECK: load-exprs.c:31:50: MemberRef=b:2:19 Extent=[31:50 - 31:51]
diff --git a/test/Index/load-namespaces.cpp b/test/Index/load-namespaces.cpp
index 241e2413a7ac..931a1dc79d2c 100644
--- a/test/Index/load-namespaces.cpp
+++ b/test/Index/load-namespaces.cpp
@@ -41,7 +41,7 @@ namespace my_rel_ops = std::rel_ops;
// 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:19:12: ParmDecl=:19:12 (Definition) Extent=[19:9 - 19:13]
-// CHECK: load-namespaces.cpp:22:12: UsingDeclaration=g:22:12 Extent=[22:1 - 22: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:6: NamespaceRef=std:18:11 Extent=[24:6 - 24:9]
diff --git a/test/Index/load-stmts.cpp b/test/Index/load-stmts.cpp
index 503219f71e15..323b778faf23 100644
--- a/test/Index/load-stmts.cpp
+++ b/test/Index/load-stmts.cpp
@@ -70,6 +70,53 @@ void test_more_dependent_exprs(T t, Y y) {
y.g<type>(t);
}
+struct Pair {
+ Pair(int, int);
+};
+
+void *operator new(__SIZE_TYPE__, void*) throw();
+
+void test_more_exprs(void *mem, int i, int j) {
+ new (mem) Pair(i, j);
+ typedef int Integer;
+ (void)Integer(i);
+ (Integer)i;
+ Integer();
+}
+
+template<typename T>
+void test_even_more_dependent_exprs(T t, Y y) {
+ typedef T type;
+ (void)type(t, y);
+ (void)__has_nothrow_assign(type);
+}
+
+struct Base {
+ Base(int);
+};
+
+struct Derived : public Base {
+ Derived(int x);
+ int member;
+};
+
+Derived::Derived(int x)
+ : member(x), Base(x) {
+}
+
+void considered_harmful(int x) {
+ start_over:
+ void *ptr = &&start_over;
+ if (x > 17)
+ goto *ptr;
+ else
+ goto start_over;
+}
+
+void casts(int *ip) {
+ (void)reinterpret_cast<float *>(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:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23]
@@ -77,9 +124,6 @@ void test_more_dependent_exprs(T t, Y y) {
// 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:3:12: ParmDecl=x:3:12 (Definition) Extent=[3:8 - 3:13]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[3:15 - 11:2]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[4:3 - 5:4]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[4:8 - 4:16]
// 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]
// CHECK: load-stmts.cpp:4:14: DeclRefExpr=x:3:12 Extent=[4:14 - 4:15]
@@ -90,43 +134,34 @@ void test_more_dependent_exprs(T t, Y y) {
// CHECK: load-stmts.cpp:4:19: DeclRefExpr=z:4:19 Extent=[4:19 - 4:20]
// CHECK: load-stmts.cpp:4:26: UnexposedExpr= Extent=[4:26 - 4:29]
// CHECK: load-stmts.cpp:4:28: DeclRefExpr=x:3:12 Extent=[4:28 - 4:29]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[4:31 - 5:4]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[6:3 - 6:22]
// CHECK: load-stmts.cpp:6:10: VarDecl=z2:6:10 (Definition) Extent=[6:7 - 6:17]
// CHECK: load-stmts.cpp:6:7: TypeRef=T:1:13 Extent=[6:7 - 6:8]
// CHECK: load-stmts.cpp:6:15: UnexposedExpr= Extent=[6:15 - 6:17]
// CHECK: load-stmts.cpp:6:16: DeclRefExpr=x:3:12 Extent=[6:16 - 6:17]
// CHECK: load-stmts.cpp:6:10: UnexposedExpr=z2:6:10 Extent=[6:10 - 6:12]
// CHECK: load-stmts.cpp:6:10: DeclRefExpr=z2:6:10 Extent=[6:10 - 6:12]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[6:19 - 6:22]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[7:3 - 7:25]
// CHECK: load-stmts.cpp:7:13: VarDecl=z3:7:13 (Definition) Extent=[7:10 - 7:20]
// CHECK: load-stmts.cpp:7:10: TypeRef=T:1:13 Extent=[7:10 - 7:11]
// CHECK: load-stmts.cpp:7:18: UnexposedExpr= Extent=[7:18 - 7:20]
// CHECK: load-stmts.cpp:7:19: DeclRefExpr=x:3:12 Extent=[7:19 - 7:20]
// CHECK: load-stmts.cpp:7:13: UnexposedExpr=z3:7:13 Extent=[7:13 - 7:15]
// CHECK: load-stmts.cpp:7:13: DeclRefExpr=z3:7:13 Extent=[7:13 - 7:15]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[7:22 - 7:25]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[8:3 - 10:4]
// CHECK: load-stmts.cpp:8:13: VarDecl=z4:8:13 (Definition) Extent=[8:11 - 8:19]
// CHECK: load-stmts.cpp:8:11: TypeRef=T:1:13 Extent=[8:11 - 8:12]
// CHECK: load-stmts.cpp:8:18: DeclRefExpr=x:3:12 Extent=[8:18 - 8:19]
// CHECK: load-stmts.cpp:8:13: DeclRefExpr=z4:8:13 Extent=[8:13 - 8:15]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[8:21 - 10:4]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[9:3 - 9:17]
// CHECK: load-stmts.cpp:9:8: UnexposedExpr= Extent=[9:8 - 9:10]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[9:12 - 9:17]
// 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: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:22:7: ClassDecl=C:22:7 (Definition) Extent=[22:1 - 24:2]
-// CHECK: <invalid loc>:0:0: C++ base class specifier=class A:14:7 [access=public isVirtual=false]
-// CHECK: <invalid loc>:0:0: C++ base class specifier=class B:18:7 [access=private isVirtual=false]
+// 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:26:7: ClassDecl=D:26:7 (Definition) Extent=[26:1 - 26:49]
-// CHECK: <invalid loc>:0:0: C++ base class specifier=class C:22:7 [access=public isVirtual=true]
-// CHECK: <invalid loc>:0:0: C++ base class specifier=class A:14:7 [access=private isVirtual=true]
+// 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]
// CHECK: load-stmts.cpp:33:7: VarDecl=typeid_marker:33:7 (Definition)
// CHECK: load-stmts.cpp:34:10: TypeRef=class C:22:7 Extent=[34:10 - 34:11]
// CHECK: load-stmts.cpp:35:10: DeclRefExpr=c:32:20 Extent=[35:10 - 35:11]
@@ -160,3 +195,35 @@ void test_more_dependent_exprs(T t, Y y) {
// CHECK: load-stmts.cpp:70:3: DeclRefExpr=y:67:39 Extent=[70:3 - 70:4]
// CHECK: load-stmts.cpp:70:7: TypeRef=type:69:13 Extent=[70:7 - 70:11]
// CHECK: load-stmts.cpp:70:13: DeclRefExpr=t:67:34 Extent=[70:13 - 70:14]
+// CHECK: load-stmts.cpp:79:6: FunctionDecl=test_more_exprs:79:6 (Definition)
+// CHECK: load-stmts.cpp:80:8: DeclRefExpr=mem:79:28 Extent=[80:8 - 80:11]
+// CHECK: load-stmts.cpp:80:13: TypeRef=struct Pair:73:8 Extent=[80:13 - 80:17]
+// CHECK: load-stmts.cpp:80:18: DeclRefExpr=i:79:37 Extent=[80:18 - 80:19]
+// CHECK: load-stmts.cpp:80:21: DeclRefExpr=j:79:44 Extent=[80:21 - 80:22]
+// CHECK: load-stmts.cpp:82:9: TypeRef=Integer:81:15 Extent=[82:9 - 82:16]
+// CHECK: load-stmts.cpp:82:17: DeclRefExpr=i:79:37 Extent=[82:17 - 82:18]
+// CHECK: load-stmts.cpp:83:3: UnexposedExpr=i:79:37 Extent=[83:3 - 83:13]
+// CHECK: load-stmts.cpp:83:4: TypeRef=Integer:81:15 Extent=[83:4 - 83:11]
+// CHECK: load-stmts.cpp:83:12: DeclRefExpr=i:79:37 Extent=[83:12 - 83:13]
+// CHECK: load-stmts.cpp:84:3: UnexposedExpr= Extent=[84:3 - 84:12]
+// CHECK: load-stmts.cpp:84:3: TypeRef=Integer:81:15 Extent=[84:3 - 84:10]
+// CHECK: load-stmts.cpp:90:9: TypeRef=type:89:13 Extent=[90:9 - 90:13]
+// CHECK: load-stmts.cpp:90:14: DeclRefExpr=t:88:39 Extent=[90:14 - 90:15]
+// CHECK: load-stmts.cpp:90:17: DeclRefExpr=y:88:44 Extent=[90:17 - 90:18]
+// CHECK: load-stmts.cpp:91:9: UnexposedExpr= Extent=[91:9 - 91:35]
+// CHECK: load-stmts.cpp:91:30: TypeRef=type:89:13 Extent=[91:30 - 91:34]
+// CHECK: load-stmts.cpp:103:10: CXXConstructor=Derived:103:10 (Definition)
+// CHECK: load-stmts.cpp:103:1: TypeRef=struct Derived:98:8 Extent=[103:1 - 103:
+// FIXME: Missing TypeRef for constructor name.
+// CHECK: load-stmts.cpp:103:22: ParmDecl=x:103:22 (Definition)
+// CHECK: load-stmts.cpp:104:5: MemberRef=member:100:7 Extent=[104:5 - 104:11]
+// CHECK: load-stmts.cpp:104:12: DeclRefExpr=x:103:22 Extent=[104:12 - 104:13]
+// CHECK: load-stmts.cpp:104:16: TypeRef=struct Base:94:8 Extent=[104:16 - 104:2
+// CHECK: load-stmts.cpp:104:16: CallExpr=Base:95:3 Extent=[104:16 - 104:23]
+// CHECK: load-stmts.cpp:104:21: DeclRefExpr=x:103:22 Extent=[104:21 - 104:22]
+// CHECK: load-stmts.cpp:107:6: FunctionDecl=considered_harmful:107:6 (Definition)
+// CHECK: load-stmts.cpp:108:2: LabelStmt=start_over Extent=[108:2 - 109:28]
+// CHECK: load-stmts.cpp:109:17: LabelRef=start_over:108:2 Extent=[109:17 - 109:27]
+// CHECK: load-stmts.cpp:113:10: LabelRef=start_over:108:2 Extent=[113:10 - 113:20]
+// CHECK: load-stmts.cpp:117:9: UnexposedExpr=ip:116:17 Extent=[117:9 - 117:38]
+
diff --git a/test/Index/local-symbols.m b/test/Index/local-symbols.m
index b9f4fe2aeabc..af3b601465a8 100644
--- a/test/Index/local-symbols.m
+++ b/test/Index/local-symbols.m
@@ -32,7 +32,7 @@
// CHECK: local-symbols.m:9:1: ObjCInstanceMethodDecl=bar:9:1 Extent=[9:1 - 9:12]
// CHECK: local-symbols.m:9:4: TypeRef=id:0:0 Extent=[9:4 - 9:6]
// CHECK: local-symbols.m:12:1: ObjCImplementationDecl=Foo:12:1 (Definition) Extent=[12:1 - 16:2]
-// CHECK: local-symbols.m:13:1: ObjCInstanceMethodDecl=bar:13:1 (Definition) Extent=[13:1 - 15:2]
+// CHECK: local-symbols.m:13:1: ObjCInstanceMethodDecl=bar:13:1 (Definition) [Overrides @9:1] Extent=[13:1 - 15:2]
// CHECK: local-symbols.m:13:4: TypeRef=id:0:0 Extent=[13:4 - 13:6]
// CHECK: local-symbols.m:14:10: UnexposedExpr= Extent=[14:10 - 14:11]
// CHECK: local-symbols.m:14:10: UnexposedExpr= Extent=[14:10 - 14:11]
diff --git a/test/Index/nested-binaryoperators.cpp b/test/Index/nested-binaryoperators.cpp
new file mode 100644
index 000000000000..d263b9ddbc21
--- /dev/null
+++ b/test/Index/nested-binaryoperators.cpp
@@ -0,0 +1,1982 @@
+typedef unsigned int uint;
+int foo(uint c) {
+ return ((c >= 0x41 && c <= 0x5a)
+ || (c >= 0x61 && c <= 0x7a)
+ || (c >= 0xc0 && c <= 0xd6)
+ || (c >= 0xd8 && c <= 0xf6)
+ || (c >= 0xf8 && c <= 0xff)
+ || (c >= 0x100 && c <= 0x131)
+ || (c >= 0x134 && c <= 0x13e)
+ || (c >= 0x141 && c <= 0x148)
+ || (c >= 0x14a && c <= 0x17e)
+ || (c >= 0x180 && c <= 0x1c3)
+ || (c >= 0x1cd && c <= 0x1f0)
+ || (c >= 0x1f4 && c <= 0x1f5)
+ || (c >= 0x1fa && c <= 0x217)
+ || (c >= 0x250 && c <= 0x2a8)
+ || (c >= 0x2bb && c <= 0x2c1)
+ || c == 0x386 || (c >= 0x388 && c <= 0x38a)
+ || c == 0x38c || (c >= 0x38e && c <= 0x3a1)
+ || (c >= 0x3a3 && c <= 0x3ce)
+ || (c >= 0x3d0 && c <= 0x3d6)
+ || c == 0x3da || c == 0x3dc || c == 0x3de ||
+ c == 0x3e0 || (c >= 0x3e2 && c <= 0x3f3)
+ || (c >= 0x401 && c <= 0x40c)
+ || (c >= 0x40e && c <= 0x44f)
+ || (c >= 0x451 && c <= 0x45c)
+ || (c >= 0x45e && c <= 0x481)
+ || (c >= 0x490 && c <= 0x4c4)
+ || (c >= 0x4c7 && c <= 0x4c8)
+ || (c >= 0x4cb && c <= 0x4cc)
+ || (c >= 0x4d0 && c <= 0x4eb)
+ || (c >= 0x4ee && c <= 0x4f5)
+ || (c >= 0x4f8 && c <= 0x4f9)
+ || (c >= 0x531 && c <= 0x556)
+ || c == 0x559 || (c >= 0x561 && c <= 0x586)
+ || (c >= 0x5d0 && c <= 0x5ea)
+ || (c >= 0x5f0 && c <= 0x5f2)
+ || (c >= 0x621 && c <= 0x63a)
+ || (c >= 0x641 && c <= 0x64a)
+ || (c >= 0x671 && c <= 0x6b7)
+ || (c >= 0x6ba && c <= 0x6be)
+ || (c >= 0x6c0 && c <= 0x6ce)
+ || (c >= 0x6d0 && c <= 0x6d3)
+ || c == 0x6d5 || (c >= 0x6e5 && c <= 0x6e6)
+ || (c >= 0x905 && c <= 0x939)
+ || c == 0x93d || (c >= 0x958 && c <= 0x961)
+ || (c >= 0x985 && c <= 0x98c)
+ || (c >= 0x98f && c <= 0x990)
+ || (c >= 0x993 && c <= 0x9a8)
+ || (c >= 0x9aa && c <= 0x9b0)
+ || c == 0x9b2 || (c >= 0x9b6 && c <= 0x9b9)
+ || (c >= 0x9dc && c <= 0x9dd)
+ || (c >= 0x9df && c <= 0x9e1)
+ || (c >= 0x9f0 && c <= 0x9f1)
+ || (c >= 0xa05 && c <= 0xa0a)
+ || (c >= 0xa0f && c <= 0xa10)
+ || (c >= 0xa13 && c <= 0xa28)
+ || (c >= 0xa2a && c <= 0xa30)
+ || (c >= 0xa32 && c <= 0xa33)
+ || (c >= 0xa35 && c <= 0xa36)
+ || (c >= 0xa38 && c <= 0xa39)
+ || (c >= 0xa59 && c <= 0xa5c)
+ || c == 0xa5e || (c >= 0xa72 && c <= 0xa74)
+ || (c >= 0xa85 && c <= 0xa8b)
+ || c == 0xa8d || (c >= 0xa8f && c <= 0xa91)
+ || (c >= 0xa93 && c <= 0xaa8)
+ || (c >= 0xaaa && c <= 0xab0)
+ || (c >= 0xab2 && c <= 0xab3)
+ || (c >= 0xab5 && c <= 0xab9)
+ || c == 0xabd || c == 0xae0 || (c >= 0xb05 && c <= 0xb0c)
+ || (c >= 0xb0f && c <= 0xb10)
+ || (c >= 0xb13 && c <= 0xb28)
+ || (c >= 0xb2a && c <= 0xb30)
+ || (c >= 0xb32 && c <= 0xb33)
+ || (c >= 0xb36 && c <= 0xb39)
+ || c == 0xb3d || (c >= 0xb5c && c <= 0xb5d)
+ || (c >= 0xb5f && c <= 0xb61)
+ || (c >= 0xb85 && c <= 0xb8a)
+ || (c >= 0xb8e && c <= 0xb90)
+ || (c >= 0xb92 && c <= 0xb95)
+ || (c >= 0xb99 && c <= 0xb9a)
+ || c == 0xb9c || (c >= 0xb9e && c <= 0xb9f)
+ || (c >= 0xba3 && c <= 0xba4)
+ || (c >= 0xba8 && c <= 0xbaa)
+ || (c >= 0xbae && c <= 0xbb5)
+ || (c >= 0xbb7 && c <= 0xbb9)
+ || (c >= 0xc05 && c <= 0xc0c)
+ || (c >= 0xc0e && c <= 0xc10)
+ || (c >= 0xc12 && c <= 0xc28)
+ || (c >= 0xc2a && c <= 0xc33)
+ || (c >= 0xc35 && c <= 0xc39)
+ || (c >= 0xc60 && c <= 0xc61)
+ || (c >= 0xc85 && c <= 0xc8c)
+ || (c >= 0xc8e && c <= 0xc90)
+ || (c >= 0xc92 && c <= 0xca8)
+ || (c >= 0xcaa && c <= 0xcb3)
+ || (c >= 0xcb5 && c <= 0xcb9)
+ || c == 0xcde || (c >= 0xce0 && c <= 0xce1)
+ || (c >= 0xd05 && c <= 0xd0c)
+ || (c >= 0xd0e && c <= 0xd10)
+ || (c >= 0xd12 && c <= 0xd28)
+ || (c >= 0xd2a && c <= 0xd39)
+ || (c >= 0xd60 && c <= 0xd61)
+ || (c >= 0xe01 && c <= 0xe2e)
+ || c == 0xe30 || (c >= 0xe32 && c <= 0xe33)
+ || (c >= 0xe40 && c <= 0xe45)
+ || (c >= 0xe81 && c <= 0xe82)
+ || c == 0xe84 || (c >= 0xe87 && c <= 0xe88)
+ || c == 0xe8a || c == 0xe8d || (c >= 0xe94 && c <= 0xe97)
+ || (c >= 0xe99 && c <= 0xe9f)
+ || (c >= 0xea1 && c <= 0xea3)
+ || c == 0xea5 || c == 0xea7 || (c >= 0xeaa && c <= 0xeab)
+ || (c >= 0xead && c <= 0xeae)
+ || c == 0xeb0 || (c >= 0xeb2 && c <= 0xeb3)
+ || c == 0xebd || (c >= 0xec0 && c <= 0xec4)
+ || (c >= 0xf40 && c <= 0xf47)
+ || (c >= 0xf49 && c <= 0xf69)
+ || (c >= 0x10a0 && c <= 0x10c5)
+ || (c >= 0x10d0 && c <= 0x10f6)
+ || c == 0x1100 || (c >= 0x1102 && c <= 0x1103)
+ || (c >= 0x1105 && c <= 0x1107)
+ || c == 0x1109 || (c >= 0x110b && c <= 0x110c)
+ || (c >= 0x110e && c <= 0x1112)
+ || c == 0x113c || c == 0x113e || c == 0x1140 || c == 0x114c ||
+ c == 0x114e || c == 0x1150 || (c >= 0x1154 && c <= 0x1155)
+ || c == 0x1159 || (c >= 0x115f && c <= 0x1161)
+ || c == 0x1163 || c == 0x1165 || c == 0x1167 || c == 0x1169 ||
+ (c >= 0x116d && c <= 0x116e)
+ || (c >= 0x1172 && c <= 0x1173)
+ || c == 0x1175 || c == 0x119e || c == 0x11a8 || c == 0x11ab ||
+ (c >= 0x11ae && c <= 0x11af)
+ || (c >= 0x11b7 && c <= 0x11b8)
+ || c == 0x11ba || (c >= 0x11bc && c <= 0x11c2)
+ || c == 0x11eb || c == 0x11f0 || c == 0x11f9 || (c >= 0x1e00 && c <= 0x1e9b)
+ || (c >= 0x1ea0 && c <= 0x1ef9)
+ || (c >= 0x1f00 && c <= 0x1f15)
+ || (c >= 0x1f18 && c <= 0x1f1d)
+ || (c >= 0x1f20 && c <= 0x1f45)
+ || (c >= 0x1f48 && c <= 0x1f4d)
+ || (c >= 0x1f50 && c <= 0x1f57)
+ || c == 0x1f59 || c == 0x1f5b || c == 0x1f5d || (c >= 0x1f5f && c <= 0x1f7d)
+ || (c >= 0x1f80 && c <= 0x1fb4)
+ || (c >= 0x1fb6 && c <= 0x1fbc)
+ || c == 0x1fbe || (c >= 0x1fc2 && c <= 0x1fc4)
+ || (c >= 0x1fc6 && c <= 0x1fcc)
+ || (c >= 0x1fd0 && c <= 0x1fd3)
+ || (c >= 0x1fd6 && c <= 0x1fdb)
+ || (c >= 0x1fe0 && c <= 0x1fec)
+ || (c >= 0x1ff2 && c <= 0x1ff4)
+ || (c >= 0x1ff6 && c <= 0x1ffc)
+ || c == 0x2126 || (c >= 0x212a && c <= 0x212b)
+ || c == 0x212e || (c >= 0x2180 && c <= 0x2182)
+ || (c >= 0x3041 && c <= 0x3094)
+ || (c >= 0x30a1 && c <= 0x30fa)
+ || (c >= 0x3105 && c <= 0x312c)
+ || (c >= 0xac00 && c <= 0xd7a3)
+ || (c >= 0x4e00 && c <= 0x9fa5)
+ || c == 0x3007 || (c >= 0x3021 && c <= 0x3029)
+ || (c >= 0x4e00 && c <= 0x9fa5)
+ || c == 0x3007 || (c >= 0x3021 && c <= 0x3029));
+}
+
+// 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: 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]
+// CHECK: 3:3: UnexposedStmt= Extent=[3:3 - 160:52]
+// CHECK: 3:10: UnexposedExpr= Extent=[3:10 - 160:52]
+// CHECK: 3:10: UnexposedExpr= Extent=[3:10 - 160:52]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 160:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 160:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 159:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 158:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 158:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 157:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 156:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 155:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 154:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 153:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 152:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 152:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 151:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 151:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 150:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 149:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 148:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 147:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 146:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 145:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 144:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 144:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 143:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 142:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:81]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:49]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 141:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 140:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 139:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 138:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 137:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 136:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 135:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:81]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:49]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 134:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 133:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 133:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 132:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 131:33]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:64]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:49]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 130:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 129:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 128:33]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:64]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:49]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 127:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 126:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 126:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 125:63]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 125:31]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 125:16]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:64]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:49]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 124:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 123:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 122:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 122:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 121:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 120:51]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 120:19]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 119:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 118:36]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 117:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 116:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 115:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 115:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 114:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 114:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 113:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 112:62]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 112:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 112:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 111:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 110:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 109:62]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 109:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 109:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 108:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 108:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 107:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 106:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 105:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 105:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 104:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 103:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 102:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 101:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 100:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 99:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 98:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 98:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 97:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 96:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 95:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 94:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 93:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 92:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 91:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 90:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 89:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 88:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 87:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 86:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 85:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 84:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 83:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 82:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 82:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 81:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 80:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 79:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 78:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 77:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 76:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 76:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 75:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 74:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 73:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 72:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 71:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 70:62]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 70:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 70:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 69:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 68:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 67:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 66:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 65:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 65:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 64:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 63:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 63:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 62:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 61:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 60:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 59:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 58:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 57:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 56:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 55:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 54:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 53:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 52:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 51:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 51:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 50:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 49:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 48:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 47:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 46:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 46:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 45:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 44:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 44:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 43:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 42:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 41:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 40:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 39:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 38:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 37:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 36:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 35:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 35:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 34:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 33:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 32:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 31:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 30:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 29:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 28:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 27:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 26:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 25:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 24:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 23:45]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 23:15]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 22:46]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 22:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 22:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 21:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 20:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 19:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 19:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 18:48]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 18:18]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 17:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 16:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 15:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 14:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 13:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 12:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 11:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 10:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 9:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 8:34]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 7:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 6:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 5:32]
+// CHECK: 3:11: UnexposedExpr= Extent=[3:11 - 4:32]
+// CHECK: 3:12: UnexposedExpr= Extent=[3:12 - 3:34]
+// CHECK: 3:12: UnexposedExpr= Extent=[3:12 - 3:21]
+// CHECK: 3:12: DeclRefExpr=c:2:14 Extent=[3:12 - 3:13]
+// CHECK: 3:17: UnexposedExpr= Extent=[3:17 - 3:21]
+// CHECK: 3:17: UnexposedExpr= Extent=[3:17 - 3:21]
+// CHECK: 3:25: UnexposedExpr= Extent=[3:25 - 3:34]
+// CHECK: 3:25: DeclRefExpr=c:2:14 Extent=[3:25 - 3:26]
+// CHECK: 3:30: UnexposedExpr= Extent=[3:30 - 3:34]
+// CHECK: 3:30: UnexposedExpr= Extent=[3:30 - 3:34]
+// CHECK: 4:9: UnexposedExpr= Extent=[4:9 - 4:31]
+// CHECK: 4:9: UnexposedExpr= Extent=[4:9 - 4:18]
+// CHECK: 4:9: DeclRefExpr=c:2:14 Extent=[4:9 - 4:10]
+// CHECK: 4:14: UnexposedExpr= Extent=[4:14 - 4:18]
+// CHECK: 4:14: UnexposedExpr= Extent=[4:14 - 4:18]
+// CHECK: 4:22: UnexposedExpr= Extent=[4:22 - 4:31]
+// CHECK: 4:22: DeclRefExpr=c:2:14 Extent=[4:22 - 4:23]
+// CHECK: 4:27: UnexposedExpr= Extent=[4:27 - 4:31]
+// CHECK: 4:27: UnexposedExpr= Extent=[4:27 - 4:31]
+// CHECK: 5:9: UnexposedExpr= Extent=[5:9 - 5:31]
+// CHECK: 5:9: UnexposedExpr= Extent=[5:9 - 5:18]
+// CHECK: 5:9: DeclRefExpr=c:2:14 Extent=[5:9 - 5:10]
+// CHECK: 5:14: UnexposedExpr= Extent=[5:14 - 5:18]
+// CHECK: 5:14: UnexposedExpr= Extent=[5:14 - 5:18]
+// CHECK: 5:22: UnexposedExpr= Extent=[5:22 - 5:31]
+// CHECK: 5:22: DeclRefExpr=c:2:14 Extent=[5:22 - 5:23]
+// CHECK: 5:27: UnexposedExpr= Extent=[5:27 - 5:31]
+// CHECK: 5:27: UnexposedExpr= Extent=[5:27 - 5:31]
+// CHECK: 6:9: UnexposedExpr= Extent=[6:9 - 6:31]
+// CHECK: 6:9: UnexposedExpr= Extent=[6:9 - 6:18]
+// CHECK: 6:9: DeclRefExpr=c:2:14 Extent=[6:9 - 6:10]
+// CHECK: 6:14: UnexposedExpr= Extent=[6:14 - 6:18]
+// CHECK: 6:14: UnexposedExpr= Extent=[6:14 - 6:18]
+// CHECK: 6:22: UnexposedExpr= Extent=[6:22 - 6:31]
+// CHECK: 6:22: DeclRefExpr=c:2:14 Extent=[6:22 - 6:23]
+// CHECK: 6:27: UnexposedExpr= Extent=[6:27 - 6:31]
+// CHECK: 6:27: UnexposedExpr= Extent=[6:27 - 6:31]
+// CHECK: 7:9: UnexposedExpr= Extent=[7:9 - 7:31]
+// CHECK: 7:9: UnexposedExpr= Extent=[7:9 - 7:18]
+// CHECK: 7:9: DeclRefExpr=c:2:14 Extent=[7:9 - 7:10]
+// CHECK: 7:14: UnexposedExpr= Extent=[7:14 - 7:18]
+// CHECK: 7:14: UnexposedExpr= Extent=[7:14 - 7:18]
+// CHECK: 7:22: UnexposedExpr= Extent=[7:22 - 7:31]
+// CHECK: 7:22: DeclRefExpr=c:2:14 Extent=[7:22 - 7:23]
+// CHECK: 7:27: UnexposedExpr= Extent=[7:27 - 7:31]
+// CHECK: 7:27: UnexposedExpr= Extent=[7:27 - 7:31]
+// CHECK: 8:9: UnexposedExpr= Extent=[8:9 - 8:33]
+// CHECK: 8:9: UnexposedExpr= Extent=[8:9 - 8:19]
+// CHECK: 8:9: DeclRefExpr=c:2:14 Extent=[8:9 - 8:10]
+// CHECK: 8:14: UnexposedExpr= Extent=[8:14 - 8:19]
+// CHECK: 8:14: UnexposedExpr= Extent=[8:14 - 8:19]
+// CHECK: 8:23: UnexposedExpr= Extent=[8:23 - 8:33]
+// CHECK: 8:23: DeclRefExpr=c:2:14 Extent=[8:23 - 8:24]
+// CHECK: 8:28: UnexposedExpr= Extent=[8:28 - 8:33]
+// CHECK: 8:28: UnexposedExpr= Extent=[8:28 - 8:33]
+// CHECK: 9:9: UnexposedExpr= Extent=[9:9 - 9:33]
+// CHECK: 9:9: UnexposedExpr= Extent=[9:9 - 9:19]
+// CHECK: 9:9: DeclRefExpr=c:2:14 Extent=[9:9 - 9:10]
+// CHECK: 9:14: UnexposedExpr= Extent=[9:14 - 9:19]
+// CHECK: 9:14: UnexposedExpr= Extent=[9:14 - 9:19]
+// CHECK: 9:23: UnexposedExpr= Extent=[9:23 - 9:33]
+// CHECK: 9:23: DeclRefExpr=c:2:14 Extent=[9:23 - 9:24]
+// CHECK: 9:28: UnexposedExpr= Extent=[9:28 - 9:33]
+// CHECK: 9:28: UnexposedExpr= Extent=[9:28 - 9:33]
+// CHECK: 10:9: UnexposedExpr= Extent=[10:9 - 10:33]
+// CHECK: 10:9: UnexposedExpr= Extent=[10:9 - 10:19]
+// CHECK: 10:9: DeclRefExpr=c:2:14 Extent=[10:9 - 10:10]
+// CHECK: 10:14: UnexposedExpr= Extent=[10:14 - 10:19]
+// CHECK: 10:14: UnexposedExpr= Extent=[10:14 - 10:19]
+// CHECK: 10:23: UnexposedExpr= Extent=[10:23 - 10:33]
+// CHECK: 10:23: DeclRefExpr=c:2:14 Extent=[10:23 - 10:24]
+// CHECK: 10:28: UnexposedExpr= Extent=[10:28 - 10:33]
+// CHECK: 10:28: UnexposedExpr= Extent=[10:28 - 10:33]
+// CHECK: 11:9: UnexposedExpr= Extent=[11:9 - 11:33]
+// CHECK: 11:9: UnexposedExpr= Extent=[11:9 - 11:19]
+// CHECK: 11:9: DeclRefExpr=c:2:14 Extent=[11:9 - 11:10]
+// CHECK: 11:14: UnexposedExpr= Extent=[11:14 - 11:19]
+// CHECK: 11:14: UnexposedExpr= Extent=[11:14 - 11:19]
+// CHECK: 11:23: UnexposedExpr= Extent=[11:23 - 11:33]
+// CHECK: 11:23: DeclRefExpr=c:2:14 Extent=[11:23 - 11:24]
+// CHECK: 11:28: UnexposedExpr= Extent=[11:28 - 11:33]
+// CHECK: 11:28: UnexposedExpr= Extent=[11:28 - 11:33]
+// CHECK: 12:9: UnexposedExpr= Extent=[12:9 - 12:33]
+// CHECK: 12:9: UnexposedExpr= Extent=[12:9 - 12:19]
+// CHECK: 12:9: DeclRefExpr=c:2:14 Extent=[12:9 - 12:10]
+// CHECK: 12:14: UnexposedExpr= Extent=[12:14 - 12:19]
+// CHECK: 12:14: UnexposedExpr= Extent=[12:14 - 12:19]
+// CHECK: 12:23: UnexposedExpr= Extent=[12:23 - 12:33]
+// CHECK: 12:23: DeclRefExpr=c:2:14 Extent=[12:23 - 12:24]
+// CHECK: 12:28: UnexposedExpr= Extent=[12:28 - 12:33]
+// CHECK: 12:28: UnexposedExpr= Extent=[12:28 - 12:33]
+// CHECK: 13:9: UnexposedExpr= Extent=[13:9 - 13:33]
+// CHECK: 13:9: UnexposedExpr= Extent=[13:9 - 13:19]
+// CHECK: 13:9: DeclRefExpr=c:2:14 Extent=[13:9 - 13:10]
+// CHECK: 13:14: UnexposedExpr= Extent=[13:14 - 13:19]
+// CHECK: 13:14: UnexposedExpr= Extent=[13:14 - 13:19]
+// CHECK: 13:23: UnexposedExpr= Extent=[13:23 - 13:33]
+// CHECK: 13:23: DeclRefExpr=c:2:14 Extent=[13:23 - 13:24]
+// CHECK: 13:28: UnexposedExpr= Extent=[13:28 - 13:33]
+// CHECK: 13:28: UnexposedExpr= Extent=[13:28 - 13:33]
+// CHECK: 14:9: UnexposedExpr= Extent=[14:9 - 14:33]
+// CHECK: 14:9: UnexposedExpr= Extent=[14:9 - 14:19]
+// CHECK: 14:9: DeclRefExpr=c:2:14 Extent=[14:9 - 14:10]
+// CHECK: 14:14: UnexposedExpr= Extent=[14:14 - 14:19]
+// CHECK: 14:14: UnexposedExpr= Extent=[14:14 - 14:19]
+// CHECK: 14:23: UnexposedExpr= Extent=[14:23 - 14:33]
+// CHECK: 14:23: DeclRefExpr=c:2:14 Extent=[14:23 - 14:24]
+// CHECK: 14:28: UnexposedExpr= Extent=[14:28 - 14:33]
+// CHECK: 14:28: UnexposedExpr= Extent=[14:28 - 14:33]
+// CHECK: 15:9: UnexposedExpr= Extent=[15:9 - 15:33]
+// CHECK: 15:9: UnexposedExpr= Extent=[15:9 - 15:19]
+// CHECK: 15:9: DeclRefExpr=c:2:14 Extent=[15:9 - 15:10]
+// CHECK: 15:14: UnexposedExpr= Extent=[15:14 - 15:19]
+// CHECK: 15:14: UnexposedExpr= Extent=[15:14 - 15:19]
+// CHECK: 15:23: UnexposedExpr= Extent=[15:23 - 15:33]
+// CHECK: 15:23: DeclRefExpr=c:2:14 Extent=[15:23 - 15:24]
+// CHECK: 15:28: UnexposedExpr= Extent=[15:28 - 15:33]
+// CHECK: 15:28: UnexposedExpr= Extent=[15:28 - 15:33]
+// CHECK: 16:9: UnexposedExpr= Extent=[16:9 - 16:33]
+// CHECK: 16:9: UnexposedExpr= Extent=[16:9 - 16:19]
+// CHECK: 16:9: DeclRefExpr=c:2:14 Extent=[16:9 - 16:10]
+// CHECK: 16:14: UnexposedExpr= Extent=[16:14 - 16:19]
+// CHECK: 16:14: UnexposedExpr= Extent=[16:14 - 16:19]
+// CHECK: 16:23: UnexposedExpr= Extent=[16:23 - 16:33]
+// CHECK: 16:23: DeclRefExpr=c:2:14 Extent=[16:23 - 16:24]
+// CHECK: 16:28: UnexposedExpr= Extent=[16:28 - 16:33]
+// CHECK: 16:28: UnexposedExpr= Extent=[16:28 - 16:33]
+// CHECK: 17:9: UnexposedExpr= Extent=[17:9 - 17:33]
+// CHECK: 17:9: UnexposedExpr= Extent=[17:9 - 17:19]
+// CHECK: 17:9: DeclRefExpr=c:2:14 Extent=[17:9 - 17:10]
+// CHECK: 17:14: UnexposedExpr= Extent=[17:14 - 17:19]
+// CHECK: 17:14: UnexposedExpr= Extent=[17:14 - 17:19]
+// CHECK: 17:23: UnexposedExpr= Extent=[17:23 - 17:33]
+// CHECK: 17:23: DeclRefExpr=c:2:14 Extent=[17:23 - 17:24]
+// CHECK: 17:28: UnexposedExpr= Extent=[17:28 - 17:33]
+// CHECK: 17:28: UnexposedExpr= Extent=[17:28 - 17:33]
+// CHECK: 18:8: UnexposedExpr= Extent=[18:8 - 18:18]
+// CHECK: 18:8: DeclRefExpr=c:2:14 Extent=[18:8 - 18:9]
+// CHECK: 18:13: UnexposedExpr= Extent=[18:13 - 18:18]
+// CHECK: 18:13: UnexposedExpr= Extent=[18:13 - 18:18]
+// CHECK: 18:23: UnexposedExpr= Extent=[18:23 - 18:47]
+// CHECK: 18:23: UnexposedExpr= Extent=[18:23 - 18:33]
+// CHECK: 18:23: DeclRefExpr=c:2:14 Extent=[18:23 - 18:24]
+// CHECK: 18:28: UnexposedExpr= Extent=[18:28 - 18:33]
+// CHECK: 18:28: UnexposedExpr= Extent=[18:28 - 18:33]
+// CHECK: 18:37: UnexposedExpr= Extent=[18:37 - 18:47]
+// CHECK: 18:37: DeclRefExpr=c:2:14 Extent=[18:37 - 18:38]
+// CHECK: 18:42: UnexposedExpr= Extent=[18:42 - 18:47]
+// CHECK: 18:42: UnexposedExpr= Extent=[18:42 - 18:47]
+// CHECK: 19:8: UnexposedExpr= Extent=[19:8 - 19:18]
+// CHECK: 19:8: DeclRefExpr=c:2:14 Extent=[19:8 - 19:9]
+// CHECK: 19:13: UnexposedExpr= Extent=[19:13 - 19:18]
+// CHECK: 19:13: UnexposedExpr= Extent=[19:13 - 19:18]
+// CHECK: 19:23: UnexposedExpr= Extent=[19:23 - 19:47]
+// CHECK: 19:23: UnexposedExpr= Extent=[19:23 - 19:33]
+// CHECK: 19:23: DeclRefExpr=c:2:14 Extent=[19:23 - 19:24]
+// CHECK: 19:28: UnexposedExpr= Extent=[19:28 - 19:33]
+// CHECK: 19:28: UnexposedExpr= Extent=[19:28 - 19:33]
+// CHECK: 19:37: UnexposedExpr= Extent=[19:37 - 19:47]
+// CHECK: 19:37: DeclRefExpr=c:2:14 Extent=[19:37 - 19:38]
+// CHECK: 19:42: UnexposedExpr= Extent=[19:42 - 19:47]
+// CHECK: 19:42: UnexposedExpr= Extent=[19:42 - 19:47]
+// CHECK: 20:9: UnexposedExpr= Extent=[20:9 - 20:33]
+// CHECK: 20:9: UnexposedExpr= Extent=[20:9 - 20:19]
+// CHECK: 20:9: DeclRefExpr=c:2:14 Extent=[20:9 - 20:10]
+// CHECK: 20:14: UnexposedExpr= Extent=[20:14 - 20:19]
+// CHECK: 20:14: UnexposedExpr= Extent=[20:14 - 20:19]
+// CHECK: 20:23: UnexposedExpr= Extent=[20:23 - 20:33]
+// CHECK: 20:23: DeclRefExpr=c:2:14 Extent=[20:23 - 20:24]
+// CHECK: 20:28: UnexposedExpr= Extent=[20:28 - 20:33]
+// CHECK: 20:28: UnexposedExpr= Extent=[20:28 - 20:33]
+// CHECK: 21:9: UnexposedExpr= Extent=[21:9 - 21:33]
+// CHECK: 21:9: UnexposedExpr= Extent=[21:9 - 21:19]
+// CHECK: 21:9: DeclRefExpr=c:2:14 Extent=[21:9 - 21:10]
+// CHECK: 21:14: UnexposedExpr= Extent=[21:14 - 21:19]
+// CHECK: 21:14: UnexposedExpr= Extent=[21:14 - 21:19]
+// CHECK: 21:23: UnexposedExpr= Extent=[21:23 - 21:33]
+// CHECK: 21:23: DeclRefExpr=c:2:14 Extent=[21:23 - 21:24]
+// CHECK: 21:28: UnexposedExpr= Extent=[21:28 - 21:33]
+// CHECK: 21:28: UnexposedExpr= Extent=[21:28 - 21:33]
+// CHECK: 22:8: UnexposedExpr= Extent=[22:8 - 22:18]
+// CHECK: 22:8: DeclRefExpr=c:2:14 Extent=[22:8 - 22:9]
+// CHECK: 22:13: UnexposedExpr= Extent=[22:13 - 22:18]
+// CHECK: 22:13: UnexposedExpr= Extent=[22:13 - 22:18]
+// CHECK: 22:22: UnexposedExpr= Extent=[22:22 - 22:32]
+// CHECK: 22:22: DeclRefExpr=c:2:14 Extent=[22:22 - 22:23]
+// CHECK: 22:27: UnexposedExpr= Extent=[22:27 - 22:32]
+// CHECK: 22:27: UnexposedExpr= Extent=[22:27 - 22:32]
+// CHECK: 22:36: UnexposedExpr= Extent=[22:36 - 22:46]
+// CHECK: 22:36: DeclRefExpr=c:2:14 Extent=[22:36 - 22:37]
+// CHECK: 22:41: UnexposedExpr= Extent=[22:41 - 22:46]
+// CHECK: 22:41: UnexposedExpr= Extent=[22:41 - 22:46]
+// CHECK: 23:5: UnexposedExpr= Extent=[23:5 - 23:15]
+// CHECK: 23:5: DeclRefExpr=c:2:14 Extent=[23:5 - 23:6]
+// CHECK: 23:10: UnexposedExpr= Extent=[23:10 - 23:15]
+// CHECK: 23:10: UnexposedExpr= Extent=[23:10 - 23:15]
+// CHECK: 23:20: UnexposedExpr= Extent=[23:20 - 23:44]
+// CHECK: 23:20: UnexposedExpr= Extent=[23:20 - 23:30]
+// CHECK: 23:20: DeclRefExpr=c:2:14 Extent=[23:20 - 23:21]
+// CHECK: 23:25: UnexposedExpr= Extent=[23:25 - 23:30]
+// CHECK: 23:25: UnexposedExpr= Extent=[23:25 - 23:30]
+// CHECK: 23:34: UnexposedExpr= Extent=[23:34 - 23:44]
+// CHECK: 23:34: DeclRefExpr=c:2:14 Extent=[23:34 - 23:35]
+// CHECK: 23:39: UnexposedExpr= Extent=[23:39 - 23:44]
+// CHECK: 23:39: UnexposedExpr= Extent=[23:39 - 23:44]
+// CHECK: 24:9: UnexposedExpr= Extent=[24:9 - 24:33]
+// CHECK: 24:9: UnexposedExpr= Extent=[24:9 - 24:19]
+// CHECK: 24:9: DeclRefExpr=c:2:14 Extent=[24:9 - 24:10]
+// CHECK: 24:14: UnexposedExpr= Extent=[24:14 - 24:19]
+// CHECK: 24:14: UnexposedExpr= Extent=[24:14 - 24:19]
+// CHECK: 24:23: UnexposedExpr= Extent=[24:23 - 24:33]
+// CHECK: 24:23: DeclRefExpr=c:2:14 Extent=[24:23 - 24:24]
+// CHECK: 24:28: UnexposedExpr= Extent=[24:28 - 24:33]
+// CHECK: 24:28: UnexposedExpr= Extent=[24:28 - 24:33]
+// CHECK: 25:9: UnexposedExpr= Extent=[25:9 - 25:33]
+// CHECK: 25:9: UnexposedExpr= Extent=[25:9 - 25:19]
+// CHECK: 25:9: DeclRefExpr=c:2:14 Extent=[25:9 - 25:10]
+// CHECK: 25:14: UnexposedExpr= Extent=[25:14 - 25:19]
+// CHECK: 25:14: UnexposedExpr= Extent=[25:14 - 25:19]
+// CHECK: 25:23: UnexposedExpr= Extent=[25:23 - 25:33]
+// CHECK: 25:23: DeclRefExpr=c:2:14 Extent=[25:23 - 25:24]
+// CHECK: 25:28: UnexposedExpr= Extent=[25:28 - 25:33]
+// CHECK: 25:28: UnexposedExpr= Extent=[25:28 - 25:33]
+// CHECK: 26:9: UnexposedExpr= Extent=[26:9 - 26:33]
+// CHECK: 26:9: UnexposedExpr= Extent=[26:9 - 26:19]
+// CHECK: 26:9: DeclRefExpr=c:2:14 Extent=[26:9 - 26:10]
+// CHECK: 26:14: UnexposedExpr= Extent=[26:14 - 26:19]
+// CHECK: 26:14: UnexposedExpr= Extent=[26:14 - 26:19]
+// CHECK: 26:23: UnexposedExpr= Extent=[26:23 - 26:33]
+// CHECK: 26:23: DeclRefExpr=c:2:14 Extent=[26:23 - 26:24]
+// CHECK: 26:28: UnexposedExpr= Extent=[26:28 - 26:33]
+// CHECK: 26:28: UnexposedExpr= Extent=[26:28 - 26:33]
+// CHECK: 27:9: UnexposedExpr= Extent=[27:9 - 27:33]
+// CHECK: 27:9: UnexposedExpr= Extent=[27:9 - 27:19]
+// CHECK: 27:9: DeclRefExpr=c:2:14 Extent=[27:9 - 27:10]
+// CHECK: 27:14: UnexposedExpr= Extent=[27:14 - 27:19]
+// CHECK: 27:14: UnexposedExpr= Extent=[27:14 - 27:19]
+// CHECK: 27:23: UnexposedExpr= Extent=[27:23 - 27:33]
+// CHECK: 27:23: DeclRefExpr=c:2:14 Extent=[27:23 - 27:24]
+// CHECK: 27:28: UnexposedExpr= Extent=[27:28 - 27:33]
+// CHECK: 27:28: UnexposedExpr= Extent=[27:28 - 27:33]
+// CHECK: 28:9: UnexposedExpr= Extent=[28:9 - 28:33]
+// CHECK: 28:9: UnexposedExpr= Extent=[28:9 - 28:19]
+// CHECK: 28:9: DeclRefExpr=c:2:14 Extent=[28:9 - 28:10]
+// CHECK: 28:14: UnexposedExpr= Extent=[28:14 - 28:19]
+// CHECK: 28:14: UnexposedExpr= Extent=[28:14 - 28:19]
+// CHECK: 28:23: UnexposedExpr= Extent=[28:23 - 28:33]
+// CHECK: 28:23: DeclRefExpr=c:2:14 Extent=[28:23 - 28:24]
+// CHECK: 28:28: UnexposedExpr= Extent=[28:28 - 28:33]
+// CHECK: 28:28: UnexposedExpr= Extent=[28:28 - 28:33]
+// CHECK: 29:9: UnexposedExpr= Extent=[29:9 - 29:33]
+// CHECK: 29:9: UnexposedExpr= Extent=[29:9 - 29:19]
+// CHECK: 29:9: DeclRefExpr=c:2:14 Extent=[29:9 - 29:10]
+// CHECK: 29:14: UnexposedExpr= Extent=[29:14 - 29:19]
+// CHECK: 29:14: UnexposedExpr= Extent=[29:14 - 29:19]
+// CHECK: 29:23: UnexposedExpr= Extent=[29:23 - 29:33]
+// CHECK: 29:23: DeclRefExpr=c:2:14 Extent=[29:23 - 29:24]
+// CHECK: 29:28: UnexposedExpr= Extent=[29:28 - 29:33]
+// CHECK: 29:28: UnexposedExpr= Extent=[29:28 - 29:33]
+// CHECK: 30:9: UnexposedExpr= Extent=[30:9 - 30:33]
+// CHECK: 30:9: UnexposedExpr= Extent=[30:9 - 30:19]
+// CHECK: 30:9: DeclRefExpr=c:2:14 Extent=[30:9 - 30:10]
+// CHECK: 30:14: UnexposedExpr= Extent=[30:14 - 30:19]
+// CHECK: 30:14: UnexposedExpr= Extent=[30:14 - 30:19]
+// CHECK: 30:23: UnexposedExpr= Extent=[30:23 - 30:33]
+// CHECK: 30:23: DeclRefExpr=c:2:14 Extent=[30:23 - 30:24]
+// CHECK: 30:28: UnexposedExpr= Extent=[30:28 - 30:33]
+// CHECK: 30:28: UnexposedExpr= Extent=[30:28 - 30:33]
+// CHECK: 31:9: UnexposedExpr= Extent=[31:9 - 31:33]
+// CHECK: 31:9: UnexposedExpr= Extent=[31:9 - 31:19]
+// CHECK: 31:9: DeclRefExpr=c:2:14 Extent=[31:9 - 31:10]
+// CHECK: 31:14: UnexposedExpr= Extent=[31:14 - 31:19]
+// CHECK: 31:14: UnexposedExpr= Extent=[31:14 - 31:19]
+// CHECK: 31:23: UnexposedExpr= Extent=[31:23 - 31:33]
+// CHECK: 31:23: DeclRefExpr=c:2:14 Extent=[31:23 - 31:24]
+// CHECK: 31:28: UnexposedExpr= Extent=[31:28 - 31:33]
+// CHECK: 31:28: UnexposedExpr= Extent=[31:28 - 31:33]
+// CHECK: 32:9: UnexposedExpr= Extent=[32:9 - 32:33]
+// CHECK: 32:9: UnexposedExpr= Extent=[32:9 - 32:19]
+// CHECK: 32:9: DeclRefExpr=c:2:14 Extent=[32:9 - 32:10]
+// CHECK: 32:14: UnexposedExpr= Extent=[32:14 - 32:19]
+// CHECK: 32:14: UnexposedExpr= Extent=[32:14 - 32:19]
+// CHECK: 32:23: UnexposedExpr= Extent=[32:23 - 32:33]
+// CHECK: 32:23: DeclRefExpr=c:2:14 Extent=[32:23 - 32:24]
+// CHECK: 32:28: UnexposedExpr= Extent=[32:28 - 32:33]
+// CHECK: 32:28: UnexposedExpr= Extent=[32:28 - 32:33]
+// CHECK: 33:9: UnexposedExpr= Extent=[33:9 - 33:33]
+// CHECK: 33:9: UnexposedExpr= Extent=[33:9 - 33:19]
+// CHECK: 33:9: DeclRefExpr=c:2:14 Extent=[33:9 - 33:10]
+// CHECK: 33:14: UnexposedExpr= Extent=[33:14 - 33:19]
+// CHECK: 33:14: UnexposedExpr= Extent=[33:14 - 33:19]
+// CHECK: 33:23: UnexposedExpr= Extent=[33:23 - 33:33]
+// CHECK: 33:23: DeclRefExpr=c:2:14 Extent=[33:23 - 33:24]
+// CHECK: 33:28: UnexposedExpr= Extent=[33:28 - 33:33]
+// CHECK: 33:28: UnexposedExpr= Extent=[33:28 - 33:33]
+// CHECK: 34:9: UnexposedExpr= Extent=[34:9 - 34:33]
+// CHECK: 34:9: UnexposedExpr= Extent=[34:9 - 34:19]
+// CHECK: 34:9: DeclRefExpr=c:2:14 Extent=[34:9 - 34:10]
+// CHECK: 34:14: UnexposedExpr= Extent=[34:14 - 34:19]
+// CHECK: 34:14: UnexposedExpr= Extent=[34:14 - 34:19]
+// CHECK: 34:23: UnexposedExpr= Extent=[34:23 - 34:33]
+// CHECK: 34:23: DeclRefExpr=c:2:14 Extent=[34:23 - 34:24]
+// CHECK: 34:28: UnexposedExpr= Extent=[34:28 - 34:33]
+// CHECK: 34:28: UnexposedExpr= Extent=[34:28 - 34:33]
+// CHECK: 35:8: UnexposedExpr= Extent=[35:8 - 35:18]
+// CHECK: 35:8: DeclRefExpr=c:2:14 Extent=[35:8 - 35:9]
+// CHECK: 35:13: UnexposedExpr= Extent=[35:13 - 35:18]
+// CHECK: 35:13: UnexposedExpr= Extent=[35:13 - 35:18]
+// CHECK: 35:23: UnexposedExpr= Extent=[35:23 - 35:47]
+// CHECK: 35:23: UnexposedExpr= Extent=[35:23 - 35:33]
+// CHECK: 35:23: DeclRefExpr=c:2:14 Extent=[35:23 - 35:24]
+// CHECK: 35:28: UnexposedExpr= Extent=[35:28 - 35:33]
+// CHECK: 35:28: UnexposedExpr= Extent=[35:28 - 35:33]
+// CHECK: 35:37: UnexposedExpr= Extent=[35:37 - 35:47]
+// CHECK: 35:37: DeclRefExpr=c:2:14 Extent=[35:37 - 35:38]
+// CHECK: 35:42: UnexposedExpr= Extent=[35:42 - 35:47]
+// CHECK: 35:42: UnexposedExpr= Extent=[35:42 - 35:47]
+// CHECK: 36:9: UnexposedExpr= Extent=[36:9 - 36:33]
+// CHECK: 36:9: UnexposedExpr= Extent=[36:9 - 36:19]
+// CHECK: 36:9: DeclRefExpr=c:2:14 Extent=[36:9 - 36:10]
+// CHECK: 36:14: UnexposedExpr= Extent=[36:14 - 36:19]
+// CHECK: 36:14: UnexposedExpr= Extent=[36:14 - 36:19]
+// CHECK: 36:23: UnexposedExpr= Extent=[36:23 - 36:33]
+// CHECK: 36:23: DeclRefExpr=c:2:14 Extent=[36:23 - 36:24]
+// CHECK: 36:28: UnexposedExpr= Extent=[36:28 - 36:33]
+// CHECK: 36:28: UnexposedExpr= Extent=[36:28 - 36:33]
+// CHECK: 37:9: UnexposedExpr= Extent=[37:9 - 37:33]
+// CHECK: 37:9: UnexposedExpr= Extent=[37:9 - 37:19]
+// CHECK: 37:9: DeclRefExpr=c:2:14 Extent=[37:9 - 37:10]
+// CHECK: 37:14: UnexposedExpr= Extent=[37:14 - 37:19]
+// CHECK: 37:14: UnexposedExpr= Extent=[37:14 - 37:19]
+// CHECK: 37:23: UnexposedExpr= Extent=[37:23 - 37:33]
+// CHECK: 37:23: DeclRefExpr=c:2:14 Extent=[37:23 - 37:24]
+// CHECK: 37:28: UnexposedExpr= Extent=[37:28 - 37:33]
+// CHECK: 37:28: UnexposedExpr= Extent=[37:28 - 37:33]
+// CHECK: 38:9: UnexposedExpr= Extent=[38:9 - 38:33]
+// CHECK: 38:9: UnexposedExpr= Extent=[38:9 - 38:19]
+// CHECK: 38:9: DeclRefExpr=c:2:14 Extent=[38:9 - 38:10]
+// CHECK: 38:14: UnexposedExpr= Extent=[38:14 - 38:19]
+// CHECK: 38:14: UnexposedExpr= Extent=[38:14 - 38:19]
+// CHECK: 38:23: UnexposedExpr= Extent=[38:23 - 38:33]
+// CHECK: 38:23: DeclRefExpr=c:2:14 Extent=[38:23 - 38:24]
+// CHECK: 38:28: UnexposedExpr= Extent=[38:28 - 38:33]
+// CHECK: 38:28: UnexposedExpr= Extent=[38:28 - 38:33]
+// CHECK: 39:9: UnexposedExpr= Extent=[39:9 - 39:33]
+// CHECK: 39:9: UnexposedExpr= Extent=[39:9 - 39:19]
+// CHECK: 39:9: DeclRefExpr=c:2:14 Extent=[39:9 - 39:10]
+// CHECK: 39:14: UnexposedExpr= Extent=[39:14 - 39:19]
+// CHECK: 39:14: UnexposedExpr= Extent=[39:14 - 39:19]
+// CHECK: 39:23: UnexposedExpr= Extent=[39:23 - 39:33]
+// CHECK: 39:23: DeclRefExpr=c:2:14 Extent=[39:23 - 39:24]
+// CHECK: 39:28: UnexposedExpr= Extent=[39:28 - 39:33]
+// CHECK: 39:28: UnexposedExpr= Extent=[39:28 - 39:33]
+// CHECK: 40:9: UnexposedExpr= Extent=[40:9 - 40:33]
+// CHECK: 40:9: UnexposedExpr= Extent=[40:9 - 40:19]
+// CHECK: 40:9: DeclRefExpr=c:2:14 Extent=[40:9 - 40:10]
+// CHECK: 40:14: UnexposedExpr= Extent=[40:14 - 40:19]
+// CHECK: 40:14: UnexposedExpr= Extent=[40:14 - 40:19]
+// CHECK: 40:23: UnexposedExpr= Extent=[40:23 - 40:33]
+// CHECK: 40:23: DeclRefExpr=c:2:14 Extent=[40:23 - 40:24]
+// CHECK: 40:28: UnexposedExpr= Extent=[40:28 - 40:33]
+// CHECK: 40:28: UnexposedExpr= Extent=[40:28 - 40:33]
+// CHECK: 41:9: UnexposedExpr= Extent=[41:9 - 41:33]
+// CHECK: 41:9: UnexposedExpr= Extent=[41:9 - 41:19]
+// CHECK: 41:9: DeclRefExpr=c:2:14 Extent=[41:9 - 41:10]
+// CHECK: 41:14: UnexposedExpr= Extent=[41:14 - 41:19]
+// CHECK: 41:14: UnexposedExpr= Extent=[41:14 - 41:19]
+// CHECK: 41:23: UnexposedExpr= Extent=[41:23 - 41:33]
+// CHECK: 41:23: DeclRefExpr=c:2:14 Extent=[41:23 - 41:24]
+// CHECK: 41:28: UnexposedExpr= Extent=[41:28 - 41:33]
+// CHECK: 41:28: UnexposedExpr= Extent=[41:28 - 41:33]
+// CHECK: 42:9: UnexposedExpr= Extent=[42:9 - 42:33]
+// CHECK: 42:9: UnexposedExpr= Extent=[42:9 - 42:19]
+// CHECK: 42:9: DeclRefExpr=c:2:14 Extent=[42:9 - 42:10]
+// CHECK: 42:14: UnexposedExpr= Extent=[42:14 - 42:19]
+// CHECK: 42:14: UnexposedExpr= Extent=[42:14 - 42:19]
+// CHECK: 42:23: UnexposedExpr= Extent=[42:23 - 42:33]
+// CHECK: 42:23: DeclRefExpr=c:2:14 Extent=[42:23 - 42:24]
+// CHECK: 42:28: UnexposedExpr= Extent=[42:28 - 42:33]
+// CHECK: 42:28: UnexposedExpr= Extent=[42:28 - 42:33]
+// CHECK: 43:9: UnexposedExpr= Extent=[43:9 - 43:33]
+// CHECK: 43:9: UnexposedExpr= Extent=[43:9 - 43:19]
+// CHECK: 43:9: DeclRefExpr=c:2:14 Extent=[43:9 - 43:10]
+// CHECK: 43:14: UnexposedExpr= Extent=[43:14 - 43:19]
+// CHECK: 43:14: UnexposedExpr= Extent=[43:14 - 43:19]
+// CHECK: 43:23: UnexposedExpr= Extent=[43:23 - 43:33]
+// CHECK: 43:23: DeclRefExpr=c:2:14 Extent=[43:23 - 43:24]
+// CHECK: 43:28: UnexposedExpr= Extent=[43:28 - 43:33]
+// CHECK: 43:28: UnexposedExpr= Extent=[43:28 - 43:33]
+// CHECK: 44:8: UnexposedExpr= Extent=[44:8 - 44:18]
+// CHECK: 44:8: DeclRefExpr=c:2:14 Extent=[44:8 - 44:9]
+// CHECK: 44:13: UnexposedExpr= Extent=[44:13 - 44:18]
+// CHECK: 44:13: UnexposedExpr= Extent=[44:13 - 44:18]
+// CHECK: 44:23: UnexposedExpr= Extent=[44:23 - 44:47]
+// CHECK: 44:23: UnexposedExpr= Extent=[44:23 - 44:33]
+// CHECK: 44:23: DeclRefExpr=c:2:14 Extent=[44:23 - 44:24]
+// CHECK: 44:28: UnexposedExpr= Extent=[44:28 - 44:33]
+// CHECK: 44:28: UnexposedExpr= Extent=[44:28 - 44:33]
+// CHECK: 44:37: UnexposedExpr= Extent=[44:37 - 44:47]
+// CHECK: 44:37: DeclRefExpr=c:2:14 Extent=[44:37 - 44:38]
+// CHECK: 44:42: UnexposedExpr= Extent=[44:42 - 44:47]
+// CHECK: 44:42: UnexposedExpr= Extent=[44:42 - 44:47]
+// CHECK: 45:9: UnexposedExpr= Extent=[45:9 - 45:33]
+// CHECK: 45:9: UnexposedExpr= Extent=[45:9 - 45:19]
+// CHECK: 45:9: DeclRefExpr=c:2:14 Extent=[45:9 - 45:10]
+// CHECK: 45:14: UnexposedExpr= Extent=[45:14 - 45:19]
+// CHECK: 45:14: UnexposedExpr= Extent=[45:14 - 45:19]
+// CHECK: 45:23: UnexposedExpr= Extent=[45:23 - 45:33]
+// CHECK: 45:23: DeclRefExpr=c:2:14 Extent=[45:23 - 45:24]
+// CHECK: 45:28: UnexposedExpr= Extent=[45:28 - 45:33]
+// CHECK: 45:28: UnexposedExpr= Extent=[45:28 - 45:33]
+// CHECK: 46:8: UnexposedExpr= Extent=[46:8 - 46:18]
+// CHECK: 46:8: DeclRefExpr=c:2:14 Extent=[46:8 - 46:9]
+// CHECK: 46:13: UnexposedExpr= Extent=[46:13 - 46:18]
+// CHECK: 46:13: UnexposedExpr= Extent=[46:13 - 46:18]
+// CHECK: 46:23: UnexposedExpr= Extent=[46:23 - 46:47]
+// CHECK: 46:23: UnexposedExpr= Extent=[46:23 - 46:33]
+// CHECK: 46:23: DeclRefExpr=c:2:14 Extent=[46:23 - 46:24]
+// CHECK: 46:28: UnexposedExpr= Extent=[46:28 - 46:33]
+// CHECK: 46:28: UnexposedExpr= Extent=[46:28 - 46:33]
+// CHECK: 46:37: UnexposedExpr= Extent=[46:37 - 46:47]
+// CHECK: 46:37: DeclRefExpr=c:2:14 Extent=[46:37 - 46:38]
+// CHECK: 46:42: UnexposedExpr= Extent=[46:42 - 46:47]
+// CHECK: 46:42: UnexposedExpr= Extent=[46:42 - 46:47]
+// CHECK: 47:9: UnexposedExpr= Extent=[47:9 - 47:33]
+// CHECK: 47:9: UnexposedExpr= Extent=[47:9 - 47:19]
+// CHECK: 47:9: DeclRefExpr=c:2:14 Extent=[47:9 - 47:10]
+// CHECK: 47:14: UnexposedExpr= Extent=[47:14 - 47:19]
+// CHECK: 47:14: UnexposedExpr= Extent=[47:14 - 47:19]
+// CHECK: 47:23: UnexposedExpr= Extent=[47:23 - 47:33]
+// CHECK: 47:23: DeclRefExpr=c:2:14 Extent=[47:23 - 47:24]
+// CHECK: 47:28: UnexposedExpr= Extent=[47:28 - 47:33]
+// CHECK: 47:28: UnexposedExpr= Extent=[47:28 - 47:33]
+// CHECK: 48:9: UnexposedExpr= Extent=[48:9 - 48:33]
+// CHECK: 48:9: UnexposedExpr= Extent=[48:9 - 48:19]
+// CHECK: 48:9: DeclRefExpr=c:2:14 Extent=[48:9 - 48:10]
+// CHECK: 48:14: UnexposedExpr= Extent=[48:14 - 48:19]
+// CHECK: 48:14: UnexposedExpr= Extent=[48:14 - 48:19]
+// CHECK: 48:23: UnexposedExpr= Extent=[48:23 - 48:33]
+// CHECK: 48:23: DeclRefExpr=c:2:14 Extent=[48:23 - 48:24]
+// CHECK: 48:28: UnexposedExpr= Extent=[48:28 - 48:33]
+// CHECK: 48:28: UnexposedExpr= Extent=[48:28 - 48:33]
+// CHECK: 49:9: UnexposedExpr= Extent=[49:9 - 49:33]
+// CHECK: 49:9: UnexposedExpr= Extent=[49:9 - 49:19]
+// CHECK: 49:9: DeclRefExpr=c:2:14 Extent=[49:9 - 49:10]
+// CHECK: 49:14: UnexposedExpr= Extent=[49:14 - 49:19]
+// CHECK: 49:14: UnexposedExpr= Extent=[49:14 - 49:19]
+// CHECK: 49:23: UnexposedExpr= Extent=[49:23 - 49:33]
+// CHECK: 49:23: DeclRefExpr=c:2:14 Extent=[49:23 - 49:24]
+// CHECK: 49:28: UnexposedExpr= Extent=[49:28 - 49:33]
+// CHECK: 49:28: UnexposedExpr= Extent=[49:28 - 49:33]
+// CHECK: 50:9: UnexposedExpr= Extent=[50:9 - 50:33]
+// CHECK: 50:9: UnexposedExpr= Extent=[50:9 - 50:19]
+// CHECK: 50:9: DeclRefExpr=c:2:14 Extent=[50:9 - 50:10]
+// CHECK: 50:14: UnexposedExpr= Extent=[50:14 - 50:19]
+// CHECK: 50:14: UnexposedExpr= Extent=[50:14 - 50:19]
+// CHECK: 50:23: UnexposedExpr= Extent=[50:23 - 50:33]
+// CHECK: 50:23: DeclRefExpr=c:2:14 Extent=[50:23 - 50:24]
+// CHECK: 50:28: UnexposedExpr= Extent=[50:28 - 50:33]
+// CHECK: 50:28: UnexposedExpr= Extent=[50:28 - 50:33]
+// CHECK: 51:8: UnexposedExpr= Extent=[51:8 - 51:18]
+// CHECK: 51:8: DeclRefExpr=c:2:14 Extent=[51:8 - 51:9]
+// CHECK: 51:13: UnexposedExpr= Extent=[51:13 - 51:18]
+// CHECK: 51:13: UnexposedExpr= Extent=[51:13 - 51:18]
+// CHECK: 51:23: UnexposedExpr= Extent=[51:23 - 51:47]
+// CHECK: 51:23: UnexposedExpr= Extent=[51:23 - 51:33]
+// CHECK: 51:23: DeclRefExpr=c:2:14 Extent=[51:23 - 51:24]
+// CHECK: 51:28: UnexposedExpr= Extent=[51:28 - 51:33]
+// CHECK: 51:28: UnexposedExpr= Extent=[51:28 - 51:33]
+// CHECK: 51:37: UnexposedExpr= Extent=[51:37 - 51:47]
+// CHECK: 51:37: DeclRefExpr=c:2:14 Extent=[51:37 - 51:38]
+// CHECK: 51:42: UnexposedExpr= Extent=[51:42 - 51:47]
+// CHECK: 51:42: UnexposedExpr= Extent=[51:42 - 51:47]
+// CHECK: 52:9: UnexposedExpr= Extent=[52:9 - 52:33]
+// CHECK: 52:9: UnexposedExpr= Extent=[52:9 - 52:19]
+// CHECK: 52:9: DeclRefExpr=c:2:14 Extent=[52:9 - 52:10]
+// CHECK: 52:14: UnexposedExpr= Extent=[52:14 - 52:19]
+// CHECK: 52:14: UnexposedExpr= Extent=[52:14 - 52:19]
+// CHECK: 52:23: UnexposedExpr= Extent=[52:23 - 52:33]
+// CHECK: 52:23: DeclRefExpr=c:2:14 Extent=[52:23 - 52:24]
+// CHECK: 52:28: UnexposedExpr= Extent=[52:28 - 52:33]
+// CHECK: 52:28: UnexposedExpr= Extent=[52:28 - 52:33]
+// CHECK: 53:9: UnexposedExpr= Extent=[53:9 - 53:33]
+// CHECK: 53:9: UnexposedExpr= Extent=[53:9 - 53:19]
+// CHECK: 53:9: DeclRefExpr=c:2:14 Extent=[53:9 - 53:10]
+// CHECK: 53:14: UnexposedExpr= Extent=[53:14 - 53:19]
+// CHECK: 53:14: UnexposedExpr= Extent=[53:14 - 53:19]
+// CHECK: 53:23: UnexposedExpr= Extent=[53:23 - 53:33]
+// CHECK: 53:23: DeclRefExpr=c:2:14 Extent=[53:23 - 53:24]
+// CHECK: 53:28: UnexposedExpr= Extent=[53:28 - 53:33]
+// CHECK: 53:28: UnexposedExpr= Extent=[53:28 - 53:33]
+// CHECK: 54:9: UnexposedExpr= Extent=[54:9 - 54:33]
+// CHECK: 54:9: UnexposedExpr= Extent=[54:9 - 54:19]
+// CHECK: 54:9: DeclRefExpr=c:2:14 Extent=[54:9 - 54:10]
+// CHECK: 54:14: UnexposedExpr= Extent=[54:14 - 54:19]
+// CHECK: 54:14: UnexposedExpr= Extent=[54:14 - 54:19]
+// CHECK: 54:23: UnexposedExpr= Extent=[54:23 - 54:33]
+// CHECK: 54:23: DeclRefExpr=c:2:14 Extent=[54:23 - 54:24]
+// CHECK: 54:28: UnexposedExpr= Extent=[54:28 - 54:33]
+// CHECK: 54:28: UnexposedExpr= Extent=[54:28 - 54:33]
+// CHECK: 55:9: UnexposedExpr= Extent=[55:9 - 55:33]
+// CHECK: 55:9: UnexposedExpr= Extent=[55:9 - 55:19]
+// CHECK: 55:9: DeclRefExpr=c:2:14 Extent=[55:9 - 55:10]
+// CHECK: 55:14: UnexposedExpr= Extent=[55:14 - 55:19]
+// CHECK: 55:14: UnexposedExpr= Extent=[55:14 - 55:19]
+// CHECK: 55:23: UnexposedExpr= Extent=[55:23 - 55:33]
+// CHECK: 55:23: DeclRefExpr=c:2:14 Extent=[55:23 - 55:24]
+// CHECK: 55:28: UnexposedExpr= Extent=[55:28 - 55:33]
+// CHECK: 55:28: UnexposedExpr= Extent=[55:28 - 55:33]
+// CHECK: 56:9: UnexposedExpr= Extent=[56:9 - 56:33]
+// CHECK: 56:9: UnexposedExpr= Extent=[56:9 - 56:19]
+// CHECK: 56:9: DeclRefExpr=c:2:14 Extent=[56:9 - 56:10]
+// CHECK: 56:14: UnexposedExpr= Extent=[56:14 - 56:19]
+// CHECK: 56:14: UnexposedExpr= Extent=[56:14 - 56:19]
+// CHECK: 56:23: UnexposedExpr= Extent=[56:23 - 56:33]
+// CHECK: 56:23: DeclRefExpr=c:2:14 Extent=[56:23 - 56:24]
+// CHECK: 56:28: UnexposedExpr= Extent=[56:28 - 56:33]
+// CHECK: 56:28: UnexposedExpr= Extent=[56:28 - 56:33]
+// CHECK: 57:9: UnexposedExpr= Extent=[57:9 - 57:33]
+// CHECK: 57:9: UnexposedExpr= Extent=[57:9 - 57:19]
+// CHECK: 57:9: DeclRefExpr=c:2:14 Extent=[57:9 - 57:10]
+// CHECK: 57:14: UnexposedExpr= Extent=[57:14 - 57:19]
+// CHECK: 57:14: UnexposedExpr= Extent=[57:14 - 57:19]
+// CHECK: 57:23: UnexposedExpr= Extent=[57:23 - 57:33]
+// CHECK: 57:23: DeclRefExpr=c:2:14 Extent=[57:23 - 57:24]
+// CHECK: 57:28: UnexposedExpr= Extent=[57:28 - 57:33]
+// CHECK: 57:28: UnexposedExpr= Extent=[57:28 - 57:33]
+// CHECK: 58:9: UnexposedExpr= Extent=[58:9 - 58:33]
+// CHECK: 58:9: UnexposedExpr= Extent=[58:9 - 58:19]
+// CHECK: 58:9: DeclRefExpr=c:2:14 Extent=[58:9 - 58:10]
+// CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:19]
+// CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:19]
+// CHECK: 58:23: UnexposedExpr= Extent=[58:23 - 58:33]
+// CHECK: 58:23: DeclRefExpr=c:2:14 Extent=[58:23 - 58:24]
+// CHECK: 58:28: UnexposedExpr= Extent=[58:28 - 58:33]
+// CHECK: 58:28: UnexposedExpr= Extent=[58:28 - 58:33]
+// CHECK: 59:9: UnexposedExpr= Extent=[59:9 - 59:33]
+// CHECK: 59:9: UnexposedExpr= Extent=[59:9 - 59:19]
+// CHECK: 59:9: DeclRefExpr=c:2:14 Extent=[59:9 - 59:10]
+// CHECK: 59:14: UnexposedExpr= Extent=[59:14 - 59:19]
+// CHECK: 59:14: UnexposedExpr= Extent=[59:14 - 59:19]
+// CHECK: 59:23: UnexposedExpr= Extent=[59:23 - 59:33]
+// CHECK: 59:23: DeclRefExpr=c:2:14 Extent=[59:23 - 59:24]
+// CHECK: 59:28: UnexposedExpr= Extent=[59:28 - 59:33]
+// CHECK: 59:28: UnexposedExpr= Extent=[59:28 - 59:33]
+// CHECK: 60:9: UnexposedExpr= Extent=[60:9 - 60:33]
+// CHECK: 60:9: UnexposedExpr= Extent=[60:9 - 60:19]
+// CHECK: 60:9: DeclRefExpr=c:2:14 Extent=[60:9 - 60:10]
+// CHECK: 60:14: UnexposedExpr= Extent=[60:14 - 60:19]
+// CHECK: 60:14: UnexposedExpr= Extent=[60:14 - 60:19]
+// CHECK: 60:23: UnexposedExpr= Extent=[60:23 - 60:33]
+// CHECK: 60:23: DeclRefExpr=c:2:14 Extent=[60:23 - 60:24]
+// CHECK: 60:28: UnexposedExpr= Extent=[60:28 - 60:33]
+// CHECK: 60:28: UnexposedExpr= Extent=[60:28 - 60:33]
+// CHECK: 61:9: UnexposedExpr= Extent=[61:9 - 61:33]
+// CHECK: 61:9: UnexposedExpr= Extent=[61:9 - 61:19]
+// CHECK: 61:9: DeclRefExpr=c:2:14 Extent=[61:9 - 61:10]
+// CHECK: 61:14: UnexposedExpr= Extent=[61:14 - 61:19]
+// CHECK: 61:14: UnexposedExpr= Extent=[61:14 - 61:19]
+// CHECK: 61:23: UnexposedExpr= Extent=[61:23 - 61:33]
+// CHECK: 61:23: DeclRefExpr=c:2:14 Extent=[61:23 - 61:24]
+// CHECK: 61:28: UnexposedExpr= Extent=[61:28 - 61:33]
+// CHECK: 61:28: UnexposedExpr= Extent=[61:28 - 61:33]
+// CHECK: 62:9: UnexposedExpr= Extent=[62:9 - 62:33]
+// CHECK: 62:9: UnexposedExpr= Extent=[62:9 - 62:19]
+// CHECK: 62:9: DeclRefExpr=c:2:14 Extent=[62:9 - 62:10]
+// CHECK: 62:14: UnexposedExpr= Extent=[62:14 - 62:19]
+// CHECK: 62:14: UnexposedExpr= Extent=[62:14 - 62:19]
+// CHECK: 62:23: UnexposedExpr= Extent=[62:23 - 62:33]
+// CHECK: 62:23: DeclRefExpr=c:2:14 Extent=[62:23 - 62:24]
+// CHECK: 62:28: UnexposedExpr= Extent=[62:28 - 62:33]
+// CHECK: 62:28: UnexposedExpr= Extent=[62:28 - 62:33]
+// CHECK: 63:8: UnexposedExpr= Extent=[63:8 - 63:18]
+// CHECK: 63:8: DeclRefExpr=c:2:14 Extent=[63:8 - 63:9]
+// CHECK: 63:13: UnexposedExpr= Extent=[63:13 - 63:18]
+// CHECK: 63:13: UnexposedExpr= Extent=[63:13 - 63:18]
+// CHECK: 63:23: UnexposedExpr= Extent=[63:23 - 63:47]
+// CHECK: 63:23: UnexposedExpr= Extent=[63:23 - 63:33]
+// CHECK: 63:23: DeclRefExpr=c:2:14 Extent=[63:23 - 63:24]
+// CHECK: 63:28: UnexposedExpr= Extent=[63:28 - 63:33]
+// CHECK: 63:28: UnexposedExpr= Extent=[63:28 - 63:33]
+// CHECK: 63:37: UnexposedExpr= Extent=[63:37 - 63:47]
+// CHECK: 63:37: DeclRefExpr=c:2:14 Extent=[63:37 - 63:38]
+// CHECK: 63:42: UnexposedExpr= Extent=[63:42 - 63:47]
+// CHECK: 63:42: UnexposedExpr= Extent=[63:42 - 63:47]
+// CHECK: 64:9: UnexposedExpr= Extent=[64:9 - 64:33]
+// CHECK: 64:9: UnexposedExpr= Extent=[64:9 - 64:19]
+// CHECK: 64:9: DeclRefExpr=c:2:14 Extent=[64:9 - 64:10]
+// CHECK: 64:14: UnexposedExpr= Extent=[64:14 - 64:19]
+// CHECK: 64:14: UnexposedExpr= Extent=[64:14 - 64:19]
+// CHECK: 64:23: UnexposedExpr= Extent=[64:23 - 64:33]
+// CHECK: 64:23: DeclRefExpr=c:2:14 Extent=[64:23 - 64:24]
+// CHECK: 64:28: UnexposedExpr= Extent=[64:28 - 64:33]
+// CHECK: 64:28: UnexposedExpr= Extent=[64:28 - 64:33]
+// CHECK: 65:8: UnexposedExpr= Extent=[65:8 - 65:18]
+// CHECK: 65:8: DeclRefExpr=c:2:14 Extent=[65:8 - 65:9]
+// CHECK: 65:13: UnexposedExpr= Extent=[65:13 - 65:18]
+// CHECK: 65:13: UnexposedExpr= Extent=[65:13 - 65:18]
+// CHECK: 65:23: UnexposedExpr= Extent=[65:23 - 65:47]
+// CHECK: 65:23: UnexposedExpr= Extent=[65:23 - 65:33]
+// CHECK: 65:23: DeclRefExpr=c:2:14 Extent=[65:23 - 65:24]
+// CHECK: 65:28: UnexposedExpr= Extent=[65:28 - 65:33]
+// CHECK: 65:28: UnexposedExpr= Extent=[65:28 - 65:33]
+// CHECK: 65:37: UnexposedExpr= Extent=[65:37 - 65:47]
+// CHECK: 65:37: DeclRefExpr=c:2:14 Extent=[65:37 - 65:38]
+// CHECK: 65:42: UnexposedExpr= Extent=[65:42 - 65:47]
+// CHECK: 65:42: UnexposedExpr= Extent=[65:42 - 65:47]
+// CHECK: 66:9: UnexposedExpr= Extent=[66:9 - 66:33]
+// CHECK: 66:9: UnexposedExpr= Extent=[66:9 - 66:19]
+// CHECK: 66:9: DeclRefExpr=c:2:14 Extent=[66:9 - 66:10]
+// CHECK: 66:14: UnexposedExpr= Extent=[66:14 - 66:19]
+// CHECK: 66:14: UnexposedExpr= Extent=[66:14 - 66:19]
+// CHECK: 66:23: UnexposedExpr= Extent=[66:23 - 66:33]
+// CHECK: 66:23: DeclRefExpr=c:2:14 Extent=[66:23 - 66:24]
+// CHECK: 66:28: UnexposedExpr= Extent=[66:28 - 66:33]
+// CHECK: 66:28: UnexposedExpr= Extent=[66:28 - 66:33]
+// CHECK: 67:9: UnexposedExpr= Extent=[67:9 - 67:33]
+// CHECK: 67:9: UnexposedExpr= Extent=[67:9 - 67:19]
+// CHECK: 67:9: DeclRefExpr=c:2:14 Extent=[67:9 - 67:10]
+// CHECK: 67:14: UnexposedExpr= Extent=[67:14 - 67:19]
+// CHECK: 67:14: UnexposedExpr= Extent=[67:14 - 67:19]
+// CHECK: 67:23: UnexposedExpr= Extent=[67:23 - 67:33]
+// CHECK: 67:23: DeclRefExpr=c:2:14 Extent=[67:23 - 67:24]
+// CHECK: 67:28: UnexposedExpr= Extent=[67:28 - 67:33]
+// CHECK: 67:28: UnexposedExpr= Extent=[67:28 - 67:33]
+// CHECK: 68:9: UnexposedExpr= Extent=[68:9 - 68:33]
+// CHECK: 68:9: UnexposedExpr= Extent=[68:9 - 68:19]
+// CHECK: 68:9: DeclRefExpr=c:2:14 Extent=[68:9 - 68:10]
+// CHECK: 68:14: UnexposedExpr= Extent=[68:14 - 68:19]
+// CHECK: 68:14: UnexposedExpr= Extent=[68:14 - 68:19]
+// CHECK: 68:23: UnexposedExpr= Extent=[68:23 - 68:33]
+// CHECK: 68:23: DeclRefExpr=c:2:14 Extent=[68:23 - 68:24]
+// CHECK: 68:28: UnexposedExpr= Extent=[68:28 - 68:33]
+// CHECK: 68:28: UnexposedExpr= Extent=[68:28 - 68:33]
+// CHECK: 69:9: UnexposedExpr= Extent=[69:9 - 69:33]
+// CHECK: 69:9: UnexposedExpr= Extent=[69:9 - 69:19]
+// CHECK: 69:9: DeclRefExpr=c:2:14 Extent=[69:9 - 69:10]
+// CHECK: 69:14: UnexposedExpr= Extent=[69:14 - 69:19]
+// CHECK: 69:14: UnexposedExpr= Extent=[69:14 - 69:19]
+// CHECK: 69:23: UnexposedExpr= Extent=[69:23 - 69:33]
+// CHECK: 69:23: DeclRefExpr=c:2:14 Extent=[69:23 - 69:24]
+// CHECK: 69:28: UnexposedExpr= Extent=[69:28 - 69:33]
+// CHECK: 69:28: UnexposedExpr= Extent=[69:28 - 69:33]
+// CHECK: 70:8: UnexposedExpr= Extent=[70:8 - 70:18]
+// CHECK: 70:8: DeclRefExpr=c:2:14 Extent=[70:8 - 70:9]
+// CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:18]
+// CHECK: 70:13: UnexposedExpr= Extent=[70:13 - 70:18]
+// CHECK: 70:22: UnexposedExpr= Extent=[70:22 - 70:32]
+// CHECK: 70:22: DeclRefExpr=c:2:14 Extent=[70:22 - 70:23]
+// CHECK: 70:27: UnexposedExpr= Extent=[70:27 - 70:32]
+// CHECK: 70:27: UnexposedExpr= Extent=[70:27 - 70:32]
+// CHECK: 70:37: UnexposedExpr= Extent=[70:37 - 70:61]
+// CHECK: 70:37: UnexposedExpr= Extent=[70:37 - 70:47]
+// CHECK: 70:37: DeclRefExpr=c:2:14 Extent=[70:37 - 70:38]
+// CHECK: 70:42: UnexposedExpr= Extent=[70:42 - 70:47]
+// CHECK: 70:42: UnexposedExpr= Extent=[70:42 - 70:47]
+// CHECK: 70:51: UnexposedExpr= Extent=[70:51 - 70:61]
+// CHECK: 70:51: DeclRefExpr=c:2:14 Extent=[70:51 - 70:52]
+// CHECK: 70:56: UnexposedExpr= Extent=[70:56 - 70:61]
+// CHECK: 70:56: UnexposedExpr= Extent=[70:56 - 70:61]
+// CHECK: 71:9: UnexposedExpr= Extent=[71:9 - 71:33]
+// CHECK: 71:9: UnexposedExpr= Extent=[71:9 - 71:19]
+// CHECK: 71:9: DeclRefExpr=c:2:14 Extent=[71:9 - 71:10]
+// CHECK: 71:14: UnexposedExpr= Extent=[71:14 - 71:19]
+// CHECK: 71:14: UnexposedExpr= Extent=[71:14 - 71:19]
+// CHECK: 71:23: UnexposedExpr= Extent=[71:23 - 71:33]
+// CHECK: 71:23: DeclRefExpr=c:2:14 Extent=[71:23 - 71:24]
+// CHECK: 71:28: UnexposedExpr= Extent=[71:28 - 71:33]
+// CHECK: 71:28: UnexposedExpr= Extent=[71:28 - 71:33]
+// CHECK: 72:9: UnexposedExpr= Extent=[72:9 - 72:33]
+// CHECK: 72:9: UnexposedExpr= Extent=[72:9 - 72:19]
+// CHECK: 72:9: DeclRefExpr=c:2:14 Extent=[72:9 - 72:10]
+// CHECK: 72:14: UnexposedExpr= Extent=[72:14 - 72:19]
+// CHECK: 72:14: UnexposedExpr= Extent=[72:14 - 72:19]
+// CHECK: 72:23: UnexposedExpr= Extent=[72:23 - 72:33]
+// CHECK: 72:23: DeclRefExpr=c:2:14 Extent=[72:23 - 72:24]
+// CHECK: 72:28: UnexposedExpr= Extent=[72:28 - 72:33]
+// CHECK: 72:28: UnexposedExpr= Extent=[72:28 - 72:33]
+// CHECK: 73:9: UnexposedExpr= Extent=[73:9 - 73:33]
+// CHECK: 73:9: UnexposedExpr= Extent=[73:9 - 73:19]
+// CHECK: 73:9: DeclRefExpr=c:2:14 Extent=[73:9 - 73:10]
+// CHECK: 73:14: UnexposedExpr= Extent=[73:14 - 73:19]
+// CHECK: 73:14: UnexposedExpr= Extent=[73:14 - 73:19]
+// CHECK: 73:23: UnexposedExpr= Extent=[73:23 - 73:33]
+// CHECK: 73:23: DeclRefExpr=c:2:14 Extent=[73:23 - 73:24]
+// CHECK: 73:28: UnexposedExpr= Extent=[73:28 - 73:33]
+// CHECK: 73:28: UnexposedExpr= Extent=[73:28 - 73:33]
+// CHECK: 74:9: UnexposedExpr= Extent=[74:9 - 74:33]
+// CHECK: 74:9: UnexposedExpr= Extent=[74:9 - 74:19]
+// CHECK: 74:9: DeclRefExpr=c:2:14 Extent=[74:9 - 74:10]
+// CHECK: 74:14: UnexposedExpr= Extent=[74:14 - 74:19]
+// CHECK: 74:14: UnexposedExpr= Extent=[74:14 - 74:19]
+// CHECK: 74:23: UnexposedExpr= Extent=[74:23 - 74:33]
+// CHECK: 74:23: DeclRefExpr=c:2:14 Extent=[74:23 - 74:24]
+// CHECK: 74:28: UnexposedExpr= Extent=[74:28 - 74:33]
+// CHECK: 74:28: UnexposedExpr= Extent=[74:28 - 74:33]
+// CHECK: 75:9: UnexposedExpr= Extent=[75:9 - 75:33]
+// CHECK: 75:9: UnexposedExpr= Extent=[75:9 - 75:19]
+// CHECK: 75:9: DeclRefExpr=c:2:14 Extent=[75:9 - 75:10]
+// CHECK: 75:14: UnexposedExpr= Extent=[75:14 - 75:19]
+// CHECK: 75:14: UnexposedExpr= Extent=[75:14 - 75:19]
+// CHECK: 75:23: UnexposedExpr= Extent=[75:23 - 75:33]
+// CHECK: 75:23: DeclRefExpr=c:2:14 Extent=[75:23 - 75:24]
+// CHECK: 75:28: UnexposedExpr= Extent=[75:28 - 75:33]
+// CHECK: 75:28: UnexposedExpr= Extent=[75:28 - 75:33]
+// CHECK: 76:8: UnexposedExpr= Extent=[76:8 - 76:18]
+// CHECK: 76:8: DeclRefExpr=c:2:14 Extent=[76:8 - 76:9]
+// CHECK: 76:13: UnexposedExpr= Extent=[76:13 - 76:18]
+// CHECK: 76:13: UnexposedExpr= Extent=[76:13 - 76:18]
+// CHECK: 76:23: UnexposedExpr= Extent=[76:23 - 76:47]
+// CHECK: 76:23: UnexposedExpr= Extent=[76:23 - 76:33]
+// CHECK: 76:23: DeclRefExpr=c:2:14 Extent=[76:23 - 76:24]
+// CHECK: 76:28: UnexposedExpr= Extent=[76:28 - 76:33]
+// CHECK: 76:28: UnexposedExpr= Extent=[76:28 - 76:33]
+// CHECK: 76:37: UnexposedExpr= Extent=[76:37 - 76:47]
+// CHECK: 76:37: DeclRefExpr=c:2:14 Extent=[76:37 - 76:38]
+// CHECK: 76:42: UnexposedExpr= Extent=[76:42 - 76:47]
+// CHECK: 76:42: UnexposedExpr= Extent=[76:42 - 76:47]
+// CHECK: 77:9: UnexposedExpr= Extent=[77:9 - 77:33]
+// CHECK: 77:9: UnexposedExpr= Extent=[77:9 - 77:19]
+// CHECK: 77:9: DeclRefExpr=c:2:14 Extent=[77:9 - 77:10]
+// CHECK: 77:14: UnexposedExpr= Extent=[77:14 - 77:19]
+// CHECK: 77:14: UnexposedExpr= Extent=[77:14 - 77:19]
+// CHECK: 77:23: UnexposedExpr= Extent=[77:23 - 77:33]
+// CHECK: 77:23: DeclRefExpr=c:2:14 Extent=[77:23 - 77:24]
+// CHECK: 77:28: UnexposedExpr= Extent=[77:28 - 77:33]
+// CHECK: 77:28: UnexposedExpr= Extent=[77:28 - 77:33]
+// CHECK: 78:9: UnexposedExpr= Extent=[78:9 - 78:33]
+// CHECK: 78:9: UnexposedExpr= Extent=[78:9 - 78:19]
+// CHECK: 78:9: DeclRefExpr=c:2:14 Extent=[78:9 - 78:10]
+// CHECK: 78:14: UnexposedExpr= Extent=[78:14 - 78:19]
+// CHECK: 78:14: UnexposedExpr= Extent=[78:14 - 78:19]
+// CHECK: 78:23: UnexposedExpr= Extent=[78:23 - 78:33]
+// CHECK: 78:23: DeclRefExpr=c:2:14 Extent=[78:23 - 78:24]
+// CHECK: 78:28: UnexposedExpr= Extent=[78:28 - 78:33]
+// CHECK: 78:28: UnexposedExpr= Extent=[78:28 - 78:33]
+// CHECK: 79:9: UnexposedExpr= Extent=[79:9 - 79:33]
+// CHECK: 79:9: UnexposedExpr= Extent=[79:9 - 79:19]
+// CHECK: 79:9: DeclRefExpr=c:2:14 Extent=[79:9 - 79:10]
+// CHECK: 79:14: UnexposedExpr= Extent=[79:14 - 79:19]
+// CHECK: 79:14: UnexposedExpr= Extent=[79:14 - 79:19]
+// CHECK: 79:23: UnexposedExpr= Extent=[79:23 - 79:33]
+// CHECK: 79:23: DeclRefExpr=c:2:14 Extent=[79:23 - 79:24]
+// CHECK: 79:28: UnexposedExpr= Extent=[79:28 - 79:33]
+// CHECK: 79:28: UnexposedExpr= Extent=[79:28 - 79:33]
+// CHECK: 80:9: UnexposedExpr= Extent=[80:9 - 80:33]
+// CHECK: 80:9: UnexposedExpr= Extent=[80:9 - 80:19]
+// CHECK: 80:9: DeclRefExpr=c:2:14 Extent=[80:9 - 80:10]
+// CHECK: 80:14: UnexposedExpr= Extent=[80:14 - 80:19]
+// CHECK: 80:14: UnexposedExpr= Extent=[80:14 - 80:19]
+// CHECK: 80:23: UnexposedExpr= Extent=[80:23 - 80:33]
+// CHECK: 80:23: DeclRefExpr=c:2:14 Extent=[80:23 - 80:24]
+// CHECK: 80:28: UnexposedExpr= Extent=[80:28 - 80:33]
+// CHECK: 80:28: UnexposedExpr= Extent=[80:28 - 80:33]
+// CHECK: 81:9: UnexposedExpr= Extent=[81:9 - 81:33]
+// CHECK: 81:9: UnexposedExpr= Extent=[81:9 - 81:19]
+// CHECK: 81:9: DeclRefExpr=c:2:14 Extent=[81:9 - 81:10]
+// CHECK: 81:14: UnexposedExpr= Extent=[81:14 - 81:19]
+// CHECK: 81:14: UnexposedExpr= Extent=[81:14 - 81:19]
+// CHECK: 81:23: UnexposedExpr= Extent=[81:23 - 81:33]
+// CHECK: 81:23: DeclRefExpr=c:2:14 Extent=[81:23 - 81:24]
+// CHECK: 81:28: UnexposedExpr= Extent=[81:28 - 81:33]
+// CHECK: 81:28: UnexposedExpr= Extent=[81:28 - 81:33]
+// CHECK: 82:8: UnexposedExpr= Extent=[82:8 - 82:18]
+// CHECK: 82:8: DeclRefExpr=c:2:14 Extent=[82:8 - 82:9]
+// CHECK: 82:13: UnexposedExpr= Extent=[82:13 - 82:18]
+// CHECK: 82:13: UnexposedExpr= Extent=[82:13 - 82:18]
+// CHECK: 82:23: UnexposedExpr= Extent=[82:23 - 82:47]
+// CHECK: 82:23: UnexposedExpr= Extent=[82:23 - 82:33]
+// CHECK: 82:23: DeclRefExpr=c:2:14 Extent=[82:23 - 82:24]
+// CHECK: 82:28: UnexposedExpr= Extent=[82:28 - 82:33]
+// CHECK: 82:28: UnexposedExpr= Extent=[82:28 - 82:33]
+// CHECK: 82:37: UnexposedExpr= Extent=[82:37 - 82:47]
+// CHECK: 82:37: DeclRefExpr=c:2:14 Extent=[82:37 - 82:38]
+// CHECK: 82:42: UnexposedExpr= Extent=[82:42 - 82:47]
+// CHECK: 82:42: UnexposedExpr= Extent=[82:42 - 82:47]
+// CHECK: 83:9: UnexposedExpr= Extent=[83:9 - 83:33]
+// CHECK: 83:9: UnexposedExpr= Extent=[83:9 - 83:19]
+// CHECK: 83:9: DeclRefExpr=c:2:14 Extent=[83:9 - 83:10]
+// CHECK: 83:14: UnexposedExpr= Extent=[83:14 - 83:19]
+// CHECK: 83:14: UnexposedExpr= Extent=[83:14 - 83:19]
+// CHECK: 83:23: UnexposedExpr= Extent=[83:23 - 83:33]
+// CHECK: 83:23: DeclRefExpr=c:2:14 Extent=[83:23 - 83:24]
+// CHECK: 83:28: UnexposedExpr= Extent=[83:28 - 83:33]
+// CHECK: 83:28: UnexposedExpr= Extent=[83:28 - 83:33]
+// CHECK: 84:9: UnexposedExpr= Extent=[84:9 - 84:33]
+// CHECK: 84:9: UnexposedExpr= Extent=[84:9 - 84:19]
+// CHECK: 84:9: DeclRefExpr=c:2:14 Extent=[84:9 - 84:10]
+// CHECK: 84:14: UnexposedExpr= Extent=[84:14 - 84:19]
+// CHECK: 84:14: UnexposedExpr= Extent=[84:14 - 84:19]
+// CHECK: 84:23: UnexposedExpr= Extent=[84:23 - 84:33]
+// CHECK: 84:23: DeclRefExpr=c:2:14 Extent=[84:23 - 84:24]
+// CHECK: 84:28: UnexposedExpr= Extent=[84:28 - 84:33]
+// CHECK: 84:28: UnexposedExpr= Extent=[84:28 - 84:33]
+// CHECK: 85:9: UnexposedExpr= Extent=[85:9 - 85:33]
+// CHECK: 85:9: UnexposedExpr= Extent=[85:9 - 85:19]
+// CHECK: 85:9: DeclRefExpr=c:2:14 Extent=[85:9 - 85:10]
+// CHECK: 85:14: UnexposedExpr= Extent=[85:14 - 85:19]
+// CHECK: 85:14: UnexposedExpr= Extent=[85:14 - 85:19]
+// CHECK: 85:23: UnexposedExpr= Extent=[85:23 - 85:33]
+// CHECK: 85:23: DeclRefExpr=c:2:14 Extent=[85:23 - 85:24]
+// CHECK: 85:28: UnexposedExpr= Extent=[85:28 - 85:33]
+// CHECK: 85:28: UnexposedExpr= Extent=[85:28 - 85:33]
+// CHECK: 86:9: UnexposedExpr= Extent=[86:9 - 86:33]
+// CHECK: 86:9: UnexposedExpr= Extent=[86:9 - 86:19]
+// CHECK: 86:9: DeclRefExpr=c:2:14 Extent=[86:9 - 86:10]
+// CHECK: 86:14: UnexposedExpr= Extent=[86:14 - 86:19]
+// CHECK: 86:14: UnexposedExpr= Extent=[86:14 - 86:19]
+// CHECK: 86:23: UnexposedExpr= Extent=[86:23 - 86:33]
+// CHECK: 86:23: DeclRefExpr=c:2:14 Extent=[86:23 - 86:24]
+// CHECK: 86:28: UnexposedExpr= Extent=[86:28 - 86:33]
+// CHECK: 86:28: UnexposedExpr= Extent=[86:28 - 86:33]
+// CHECK: 87:9: UnexposedExpr= Extent=[87:9 - 87:33]
+// CHECK: 87:9: UnexposedExpr= Extent=[87:9 - 87:19]
+// CHECK: 87:9: DeclRefExpr=c:2:14 Extent=[87:9 - 87:10]
+// CHECK: 87:14: UnexposedExpr= Extent=[87:14 - 87:19]
+// CHECK: 87:14: UnexposedExpr= Extent=[87:14 - 87:19]
+// CHECK: 87:23: UnexposedExpr= Extent=[87:23 - 87:33]
+// CHECK: 87:23: DeclRefExpr=c:2:14 Extent=[87:23 - 87:24]
+// CHECK: 87:28: UnexposedExpr= Extent=[87:28 - 87:33]
+// CHECK: 87:28: UnexposedExpr= Extent=[87:28 - 87:33]
+// CHECK: 88:9: UnexposedExpr= Extent=[88:9 - 88:33]
+// CHECK: 88:9: UnexposedExpr= Extent=[88:9 - 88:19]
+// CHECK: 88:9: DeclRefExpr=c:2:14 Extent=[88:9 - 88:10]
+// CHECK: 88:14: UnexposedExpr= Extent=[88:14 - 88:19]
+// CHECK: 88:14: UnexposedExpr= Extent=[88:14 - 88:19]
+// CHECK: 88:23: UnexposedExpr= Extent=[88:23 - 88:33]
+// CHECK: 88:23: DeclRefExpr=c:2:14 Extent=[88:23 - 88:24]
+// CHECK: 88:28: UnexposedExpr= Extent=[88:28 - 88:33]
+// CHECK: 88:28: UnexposedExpr= Extent=[88:28 - 88:33]
+// CHECK: 89:9: UnexposedExpr= Extent=[89:9 - 89:33]
+// CHECK: 89:9: UnexposedExpr= Extent=[89:9 - 89:19]
+// CHECK: 89:9: DeclRefExpr=c:2:14 Extent=[89:9 - 89:10]
+// CHECK: 89:14: UnexposedExpr= Extent=[89:14 - 89:19]
+// CHECK: 89:14: UnexposedExpr= Extent=[89:14 - 89:19]
+// CHECK: 89:23: UnexposedExpr= Extent=[89:23 - 89:33]
+// CHECK: 89:23: DeclRefExpr=c:2:14 Extent=[89:23 - 89:24]
+// CHECK: 89:28: UnexposedExpr= Extent=[89:28 - 89:33]
+// CHECK: 89:28: UnexposedExpr= Extent=[89:28 - 89:33]
+// CHECK: 90:9: UnexposedExpr= Extent=[90:9 - 90:33]
+// CHECK: 90:9: UnexposedExpr= Extent=[90:9 - 90:19]
+// CHECK: 90:9: DeclRefExpr=c:2:14 Extent=[90:9 - 90:10]
+// CHECK: 90:14: UnexposedExpr= Extent=[90:14 - 90:19]
+// CHECK: 90:14: UnexposedExpr= Extent=[90:14 - 90:19]
+// CHECK: 90:23: UnexposedExpr= Extent=[90:23 - 90:33]
+// CHECK: 90:23: DeclRefExpr=c:2:14 Extent=[90:23 - 90:24]
+// CHECK: 90:28: UnexposedExpr= Extent=[90:28 - 90:33]
+// CHECK: 90:28: UnexposedExpr= Extent=[90:28 - 90:33]
+// CHECK: 91:9: UnexposedExpr= Extent=[91:9 - 91:33]
+// CHECK: 91:9: UnexposedExpr= Extent=[91:9 - 91:19]
+// CHECK: 91:9: DeclRefExpr=c:2:14 Extent=[91:9 - 91:10]
+// CHECK: 91:14: UnexposedExpr= Extent=[91:14 - 91:19]
+// CHECK: 91:14: UnexposedExpr= Extent=[91:14 - 91:19]
+// CHECK: 91:23: UnexposedExpr= Extent=[91:23 - 91:33]
+// CHECK: 91:23: DeclRefExpr=c:2:14 Extent=[91:23 - 91:24]
+// CHECK: 91:28: UnexposedExpr= Extent=[91:28 - 91:33]
+// CHECK: 91:28: UnexposedExpr= Extent=[91:28 - 91:33]
+// CHECK: 92:9: UnexposedExpr= Extent=[92:9 - 92:33]
+// CHECK: 92:9: UnexposedExpr= Extent=[92:9 - 92:19]
+// CHECK: 92:9: DeclRefExpr=c:2:14 Extent=[92:9 - 92:10]
+// CHECK: 92:14: UnexposedExpr= Extent=[92:14 - 92:19]
+// CHECK: 92:14: UnexposedExpr= Extent=[92:14 - 92:19]
+// CHECK: 92:23: UnexposedExpr= Extent=[92:23 - 92:33]
+// CHECK: 92:23: DeclRefExpr=c:2:14 Extent=[92:23 - 92:24]
+// CHECK: 92:28: UnexposedExpr= Extent=[92:28 - 92:33]
+// CHECK: 92:28: UnexposedExpr= Extent=[92:28 - 92:33]
+// CHECK: 93:9: UnexposedExpr= Extent=[93:9 - 93:33]
+// CHECK: 93:9: UnexposedExpr= Extent=[93:9 - 93:19]
+// CHECK: 93:9: DeclRefExpr=c:2:14 Extent=[93:9 - 93:10]
+// CHECK: 93:14: UnexposedExpr= Extent=[93:14 - 93:19]
+// CHECK: 93:14: UnexposedExpr= Extent=[93:14 - 93:19]
+// CHECK: 93:23: UnexposedExpr= Extent=[93:23 - 93:33]
+// CHECK: 93:23: DeclRefExpr=c:2:14 Extent=[93:23 - 93:24]
+// CHECK: 93:28: UnexposedExpr= Extent=[93:28 - 93:33]
+// CHECK: 93:28: UnexposedExpr= Extent=[93:28 - 93:33]
+// CHECK: 94:9: UnexposedExpr= Extent=[94:9 - 94:33]
+// CHECK: 94:9: UnexposedExpr= Extent=[94:9 - 94:19]
+// CHECK: 94:9: DeclRefExpr=c:2:14 Extent=[94:9 - 94:10]
+// CHECK: 94:14: UnexposedExpr= Extent=[94:14 - 94:19]
+// CHECK: 94:14: UnexposedExpr= Extent=[94:14 - 94:19]
+// CHECK: 94:23: UnexposedExpr= Extent=[94:23 - 94:33]
+// CHECK: 94:23: DeclRefExpr=c:2:14 Extent=[94:23 - 94:24]
+// CHECK: 94:28: UnexposedExpr= Extent=[94:28 - 94:33]
+// CHECK: 94:28: UnexposedExpr= Extent=[94:28 - 94:33]
+// CHECK: 95:9: UnexposedExpr= Extent=[95:9 - 95:33]
+// CHECK: 95:9: UnexposedExpr= Extent=[95:9 - 95:19]
+// CHECK: 95:9: DeclRefExpr=c:2:14 Extent=[95:9 - 95:10]
+// CHECK: 95:14: UnexposedExpr= Extent=[95:14 - 95:19]
+// CHECK: 95:14: UnexposedExpr= Extent=[95:14 - 95:19]
+// CHECK: 95:23: UnexposedExpr= Extent=[95:23 - 95:33]
+// CHECK: 95:23: DeclRefExpr=c:2:14 Extent=[95:23 - 95:24]
+// CHECK: 95:28: UnexposedExpr= Extent=[95:28 - 95:33]
+// CHECK: 95:28: UnexposedExpr= Extent=[95:28 - 95:33]
+// CHECK: 96:9: UnexposedExpr= Extent=[96:9 - 96:33]
+// CHECK: 96:9: UnexposedExpr= Extent=[96:9 - 96:19]
+// CHECK: 96:9: DeclRefExpr=c:2:14 Extent=[96:9 - 96:10]
+// CHECK: 96:14: UnexposedExpr= Extent=[96:14 - 96:19]
+// CHECK: 96:14: UnexposedExpr= Extent=[96:14 - 96:19]
+// CHECK: 96:23: UnexposedExpr= Extent=[96:23 - 96:33]
+// CHECK: 96:23: DeclRefExpr=c:2:14 Extent=[96:23 - 96:24]
+// CHECK: 96:28: UnexposedExpr= Extent=[96:28 - 96:33]
+// CHECK: 96:28: UnexposedExpr= Extent=[96:28 - 96:33]
+// CHECK: 97:9: UnexposedExpr= Extent=[97:9 - 97:33]
+// CHECK: 97:9: UnexposedExpr= Extent=[97:9 - 97:19]
+// CHECK: 97:9: DeclRefExpr=c:2:14 Extent=[97:9 - 97:10]
+// CHECK: 97:14: UnexposedExpr= Extent=[97:14 - 97:19]
+// CHECK: 97:14: UnexposedExpr= Extent=[97:14 - 97:19]
+// CHECK: 97:23: UnexposedExpr= Extent=[97:23 - 97:33]
+// CHECK: 97:23: DeclRefExpr=c:2:14 Extent=[97:23 - 97:24]
+// CHECK: 97:28: UnexposedExpr= Extent=[97:28 - 97:33]
+// CHECK: 97:28: UnexposedExpr= Extent=[97:28 - 97:33]
+// CHECK: 98:8: UnexposedExpr= Extent=[98:8 - 98:18]
+// CHECK: 98:8: DeclRefExpr=c:2:14 Extent=[98:8 - 98:9]
+// CHECK: 98:13: UnexposedExpr= Extent=[98:13 - 98:18]
+// CHECK: 98:13: UnexposedExpr= Extent=[98:13 - 98:18]
+// CHECK: 98:23: UnexposedExpr= Extent=[98:23 - 98:47]
+// CHECK: 98:23: UnexposedExpr= Extent=[98:23 - 98:33]
+// CHECK: 98:23: DeclRefExpr=c:2:14 Extent=[98:23 - 98:24]
+// CHECK: 98:28: UnexposedExpr= Extent=[98:28 - 98:33]
+// CHECK: 98:28: UnexposedExpr= Extent=[98:28 - 98:33]
+// CHECK: 98:37: UnexposedExpr= Extent=[98:37 - 98:47]
+// CHECK: 98:37: DeclRefExpr=c:2:14 Extent=[98:37 - 98:38]
+// CHECK: 98:42: UnexposedExpr= Extent=[98:42 - 98:47]
+// CHECK: 98:42: UnexposedExpr= Extent=[98:42 - 98:47]
+// CHECK: 99:9: UnexposedExpr= Extent=[99:9 - 99:33]
+// CHECK: 99:9: UnexposedExpr= Extent=[99:9 - 99:19]
+// CHECK: 99:9: DeclRefExpr=c:2:14 Extent=[99:9 - 99:10]
+// CHECK: 99:14: UnexposedExpr= Extent=[99:14 - 99:19]
+// CHECK: 99:14: UnexposedExpr= Extent=[99:14 - 99:19]
+// CHECK: 99:23: UnexposedExpr= Extent=[99:23 - 99:33]
+// CHECK: 99:23: DeclRefExpr=c:2:14 Extent=[99:23 - 99:24]
+// CHECK: 99:28: UnexposedExpr= Extent=[99:28 - 99:33]
+// CHECK: 99:28: UnexposedExpr= Extent=[99:28 - 99:33]
+// CHECK: 100:9: UnexposedExpr= Extent=[100:9 - 100:33]
+// CHECK: 100:9: UnexposedExpr= Extent=[100:9 - 100:19]
+// CHECK: 100:9: DeclRefExpr=c:2:14 Extent=[100:9 - 100:10]
+// CHECK: 100:14: UnexposedExpr= Extent=[100:14 - 100:19]
+// CHECK: 100:14: UnexposedExpr= Extent=[100:14 - 100:19]
+// CHECK: 100:23: UnexposedExpr= Extent=[100:23 - 100:33]
+// CHECK: 100:23: DeclRefExpr=c:2:14 Extent=[100:23 - 100:24]
+// CHECK: 100:28: UnexposedExpr= Extent=[100:28 - 100:33]
+// CHECK: 100:28: UnexposedExpr= Extent=[100:28 - 100:33]
+// CHECK: 101:9: UnexposedExpr= Extent=[101:9 - 101:33]
+// CHECK: 101:9: UnexposedExpr= Extent=[101:9 - 101:19]
+// CHECK: 101:9: DeclRefExpr=c:2:14 Extent=[101:9 - 101:10]
+// CHECK: 101:14: UnexposedExpr= Extent=[101:14 - 101:19]
+// CHECK: 101:14: UnexposedExpr= Extent=[101:14 - 101:19]
+// CHECK: 101:23: UnexposedExpr= Extent=[101:23 - 101:33]
+// CHECK: 101:23: DeclRefExpr=c:2:14 Extent=[101:23 - 101:24]
+// CHECK: 101:28: UnexposedExpr= Extent=[101:28 - 101:33]
+// CHECK: 101:28: UnexposedExpr= Extent=[101:28 - 101:33]
+// CHECK: 102:9: UnexposedExpr= Extent=[102:9 - 102:33]
+// CHECK: 102:9: UnexposedExpr= Extent=[102:9 - 102:19]
+// CHECK: 102:9: DeclRefExpr=c:2:14 Extent=[102:9 - 102:10]
+// CHECK: 102:14: UnexposedExpr= Extent=[102:14 - 102:19]
+// CHECK: 102:14: UnexposedExpr= Extent=[102:14 - 102:19]
+// CHECK: 102:23: UnexposedExpr= Extent=[102:23 - 102:33]
+// CHECK: 102:23: DeclRefExpr=c:2:14 Extent=[102:23 - 102:24]
+// CHECK: 102:28: UnexposedExpr= Extent=[102:28 - 102:33]
+// CHECK: 102:28: UnexposedExpr= Extent=[102:28 - 102:33]
+// CHECK: 103:9: UnexposedExpr= Extent=[103:9 - 103:33]
+// CHECK: 103:9: UnexposedExpr= Extent=[103:9 - 103:19]
+// CHECK: 103:9: DeclRefExpr=c:2:14 Extent=[103:9 - 103:10]
+// CHECK: 103:14: UnexposedExpr= Extent=[103:14 - 103:19]
+// CHECK: 103:14: UnexposedExpr= Extent=[103:14 - 103:19]
+// CHECK: 103:23: UnexposedExpr= Extent=[103:23 - 103:33]
+// CHECK: 103:23: DeclRefExpr=c:2:14 Extent=[103:23 - 103:24]
+// CHECK: 103:28: UnexposedExpr= Extent=[103:28 - 103:33]
+// CHECK: 103:28: UnexposedExpr= Extent=[103:28 - 103:33]
+// CHECK: 104:9: UnexposedExpr= Extent=[104:9 - 104:33]
+// CHECK: 104:9: UnexposedExpr= Extent=[104:9 - 104:19]
+// CHECK: 104:9: DeclRefExpr=c:2:14 Extent=[104:9 - 104:10]
+// CHECK: 104:14: UnexposedExpr= Extent=[104:14 - 104:19]
+// CHECK: 104:14: UnexposedExpr= Extent=[104:14 - 104:19]
+// CHECK: 104:23: UnexposedExpr= Extent=[104:23 - 104:33]
+// CHECK: 104:23: DeclRefExpr=c:2:14 Extent=[104:23 - 104:24]
+// CHECK: 104:28: UnexposedExpr= Extent=[104:28 - 104:33]
+// CHECK: 104:28: UnexposedExpr= Extent=[104:28 - 104:33]
+// CHECK: 105:8: UnexposedExpr= Extent=[105:8 - 105:18]
+// CHECK: 105:8: DeclRefExpr=c:2:14 Extent=[105:8 - 105:9]
+// CHECK: 105:13: UnexposedExpr= Extent=[105:13 - 105:18]
+// CHECK: 105:13: UnexposedExpr= Extent=[105:13 - 105:18]
+// CHECK: 105:23: UnexposedExpr= Extent=[105:23 - 105:47]
+// CHECK: 105:23: UnexposedExpr= Extent=[105:23 - 105:33]
+// CHECK: 105:23: DeclRefExpr=c:2:14 Extent=[105:23 - 105:24]
+// CHECK: 105:28: UnexposedExpr= Extent=[105:28 - 105:33]
+// CHECK: 105:28: UnexposedExpr= Extent=[105:28 - 105:33]
+// CHECK: 105:37: UnexposedExpr= Extent=[105:37 - 105:47]
+// CHECK: 105:37: DeclRefExpr=c:2:14 Extent=[105:37 - 105:38]
+// CHECK: 105:42: UnexposedExpr= Extent=[105:42 - 105:47]
+// CHECK: 105:42: UnexposedExpr= Extent=[105:42 - 105:47]
+// CHECK: 106:9: UnexposedExpr= Extent=[106:9 - 106:33]
+// CHECK: 106:9: UnexposedExpr= Extent=[106:9 - 106:19]
+// CHECK: 106:9: DeclRefExpr=c:2:14 Extent=[106:9 - 106:10]
+// CHECK: 106:14: UnexposedExpr= Extent=[106:14 - 106:19]
+// CHECK: 106:14: UnexposedExpr= Extent=[106:14 - 106:19]
+// CHECK: 106:23: UnexposedExpr= Extent=[106:23 - 106:33]
+// CHECK: 106:23: DeclRefExpr=c:2:14 Extent=[106:23 - 106:24]
+// CHECK: 106:28: UnexposedExpr= Extent=[106:28 - 106:33]
+// CHECK: 106:28: UnexposedExpr= Extent=[106:28 - 106:33]
+// CHECK: 107:9: UnexposedExpr= Extent=[107:9 - 107:33]
+// CHECK: 107:9: UnexposedExpr= Extent=[107:9 - 107:19]
+// CHECK: 107:9: DeclRefExpr=c:2:14 Extent=[107:9 - 107:10]
+// CHECK: 107:14: UnexposedExpr= Extent=[107:14 - 107:19]
+// CHECK: 107:14: UnexposedExpr= Extent=[107:14 - 107:19]
+// CHECK: 107:23: UnexposedExpr= Extent=[107:23 - 107:33]
+// CHECK: 107:23: DeclRefExpr=c:2:14 Extent=[107:23 - 107:24]
+// CHECK: 107:28: UnexposedExpr= Extent=[107:28 - 107:33]
+// CHECK: 107:28: UnexposedExpr= Extent=[107:28 - 107:33]
+// CHECK: 108:8: UnexposedExpr= Extent=[108:8 - 108:18]
+// CHECK: 108:8: DeclRefExpr=c:2:14 Extent=[108:8 - 108:9]
+// CHECK: 108:13: UnexposedExpr= Extent=[108:13 - 108:18]
+// CHECK: 108:13: UnexposedExpr= Extent=[108:13 - 108:18]
+// CHECK: 108:23: UnexposedExpr= Extent=[108:23 - 108:47]
+// CHECK: 108:23: UnexposedExpr= Extent=[108:23 - 108:33]
+// CHECK: 108:23: DeclRefExpr=c:2:14 Extent=[108:23 - 108:24]
+// CHECK: 108:28: UnexposedExpr= Extent=[108:28 - 108:33]
+// CHECK: 108:28: UnexposedExpr= Extent=[108:28 - 108:33]
+// CHECK: 108:37: UnexposedExpr= Extent=[108:37 - 108:47]
+// CHECK: 108:37: DeclRefExpr=c:2:14 Extent=[108:37 - 108:38]
+// CHECK: 108:42: UnexposedExpr= Extent=[108:42 - 108:47]
+// CHECK: 108:42: UnexposedExpr= Extent=[108:42 - 108:47]
+// CHECK: 109:8: UnexposedExpr= Extent=[109:8 - 109:18]
+// CHECK: 109:8: DeclRefExpr=c:2:14 Extent=[109:8 - 109:9]
+// CHECK: 109:13: UnexposedExpr= Extent=[109:13 - 109:18]
+// CHECK: 109:13: UnexposedExpr= Extent=[109:13 - 109:18]
+// CHECK: 109:22: UnexposedExpr= Extent=[109:22 - 109:32]
+// CHECK: 109:22: DeclRefExpr=c:2:14 Extent=[109:22 - 109:23]
+// CHECK: 109:27: UnexposedExpr= Extent=[109:27 - 109:32]
+// CHECK: 109:27: UnexposedExpr= Extent=[109:27 - 109:32]
+// CHECK: 109:37: UnexposedExpr= Extent=[109:37 - 109:61]
+// CHECK: 109:37: UnexposedExpr= Extent=[109:37 - 109:47]
+// CHECK: 109:37: DeclRefExpr=c:2:14 Extent=[109:37 - 109:38]
+// CHECK: 109:42: UnexposedExpr= Extent=[109:42 - 109:47]
+// CHECK: 109:42: UnexposedExpr= Extent=[109:42 - 109:47]
+// CHECK: 109:51: UnexposedExpr= Extent=[109:51 - 109:61]
+// CHECK: 109:51: DeclRefExpr=c:2:14 Extent=[109:51 - 109:52]
+// CHECK: 109:56: UnexposedExpr= Extent=[109:56 - 109:61]
+// CHECK: 109:56: UnexposedExpr= Extent=[109:56 - 109:61]
+// CHECK: 110:9: UnexposedExpr= Extent=[110:9 - 110:33]
+// CHECK: 110:9: UnexposedExpr= Extent=[110:9 - 110:19]
+// CHECK: 110:9: DeclRefExpr=c:2:14 Extent=[110:9 - 110:10]
+// CHECK: 110:14: UnexposedExpr= Extent=[110:14 - 110:19]
+// CHECK: 110:14: UnexposedExpr= Extent=[110:14 - 110:19]
+// CHECK: 110:23: UnexposedExpr= Extent=[110:23 - 110:33]
+// CHECK: 110:23: DeclRefExpr=c:2:14 Extent=[110:23 - 110:24]
+// CHECK: 110:28: UnexposedExpr= Extent=[110:28 - 110:33]
+// CHECK: 110:28: UnexposedExpr= Extent=[110:28 - 110:33]
+// CHECK: 111:9: UnexposedExpr= Extent=[111:9 - 111:33]
+// CHECK: 111:9: UnexposedExpr= Extent=[111:9 - 111:19]
+// CHECK: 111:9: DeclRefExpr=c:2:14 Extent=[111:9 - 111:10]
+// CHECK: 111:14: UnexposedExpr= Extent=[111:14 - 111:19]
+// CHECK: 111:14: UnexposedExpr= Extent=[111:14 - 111:19]
+// CHECK: 111:23: UnexposedExpr= Extent=[111:23 - 111:33]
+// CHECK: 111:23: DeclRefExpr=c:2:14 Extent=[111:23 - 111:24]
+// CHECK: 111:28: UnexposedExpr= Extent=[111:28 - 111:33]
+// CHECK: 111:28: UnexposedExpr= Extent=[111:28 - 111:33]
+// CHECK: 112:8: UnexposedExpr= Extent=[112:8 - 112:18]
+// CHECK: 112:8: DeclRefExpr=c:2:14 Extent=[112:8 - 112:9]
+// CHECK: 112:13: UnexposedExpr= Extent=[112:13 - 112:18]
+// CHECK: 112:13: UnexposedExpr= Extent=[112:13 - 112:18]
+// CHECK: 112:22: UnexposedExpr= Extent=[112:22 - 112:32]
+// CHECK: 112:22: DeclRefExpr=c:2:14 Extent=[112:22 - 112:23]
+// CHECK: 112:27: UnexposedExpr= Extent=[112:27 - 112:32]
+// CHECK: 112:27: UnexposedExpr= Extent=[112:27 - 112:32]
+// CHECK: 112:37: UnexposedExpr= Extent=[112:37 - 112:61]
+// CHECK: 112:37: UnexposedExpr= Extent=[112:37 - 112:47]
+// CHECK: 112:37: DeclRefExpr=c:2:14 Extent=[112:37 - 112:38]
+// CHECK: 112:42: UnexposedExpr= Extent=[112:42 - 112:47]
+// CHECK: 112:42: UnexposedExpr= Extent=[112:42 - 112:47]
+// CHECK: 112:51: UnexposedExpr= Extent=[112:51 - 112:61]
+// CHECK: 112:51: DeclRefExpr=c:2:14 Extent=[112:51 - 112:52]
+// CHECK: 112:56: UnexposedExpr= Extent=[112:56 - 112:61]
+// CHECK: 112:56: UnexposedExpr= Extent=[112:56 - 112:61]
+// CHECK: 113:9: UnexposedExpr= Extent=[113:9 - 113:33]
+// CHECK: 113:9: UnexposedExpr= Extent=[113:9 - 113:19]
+// CHECK: 113:9: DeclRefExpr=c:2:14 Extent=[113:9 - 113:10]
+// CHECK: 113:14: UnexposedExpr= Extent=[113:14 - 113:19]
+// CHECK: 113:14: UnexposedExpr= Extent=[113:14 - 113:19]
+// CHECK: 113:23: UnexposedExpr= Extent=[113:23 - 113:33]
+// CHECK: 113:23: DeclRefExpr=c:2:14 Extent=[113:23 - 113:24]
+// CHECK: 113:28: UnexposedExpr= Extent=[113:28 - 113:33]
+// CHECK: 113:28: UnexposedExpr= Extent=[113:28 - 113:33]
+// CHECK: 114:8: UnexposedExpr= Extent=[114:8 - 114:18]
+// CHECK: 114:8: DeclRefExpr=c:2:14 Extent=[114:8 - 114:9]
+// CHECK: 114:13: UnexposedExpr= Extent=[114:13 - 114:18]
+// CHECK: 114:13: UnexposedExpr= Extent=[114:13 - 114:18]
+// CHECK: 114:23: UnexposedExpr= Extent=[114:23 - 114:47]
+// CHECK: 114:23: UnexposedExpr= Extent=[114:23 - 114:33]
+// CHECK: 114:23: DeclRefExpr=c:2:14 Extent=[114:23 - 114:24]
+// CHECK: 114:28: UnexposedExpr= Extent=[114:28 - 114:33]
+// CHECK: 114:28: UnexposedExpr= Extent=[114:28 - 114:33]
+// CHECK: 114:37: UnexposedExpr= Extent=[114:37 - 114:47]
+// CHECK: 114:37: DeclRefExpr=c:2:14 Extent=[114:37 - 114:38]
+// CHECK: 114:42: UnexposedExpr= Extent=[114:42 - 114:47]
+// CHECK: 114:42: UnexposedExpr= Extent=[114:42 - 114:47]
+// CHECK: 115:8: UnexposedExpr= Extent=[115:8 - 115:18]
+// CHECK: 115:8: DeclRefExpr=c:2:14 Extent=[115:8 - 115:9]
+// CHECK: 115:13: UnexposedExpr= Extent=[115:13 - 115:18]
+// CHECK: 115:13: UnexposedExpr= Extent=[115:13 - 115:18]
+// CHECK: 115:23: UnexposedExpr= Extent=[115:23 - 115:47]
+// CHECK: 115:23: UnexposedExpr= Extent=[115:23 - 115:33]
+// CHECK: 115:23: DeclRefExpr=c:2:14 Extent=[115:23 - 115:24]
+// CHECK: 115:28: UnexposedExpr= Extent=[115:28 - 115:33]
+// CHECK: 115:28: UnexposedExpr= Extent=[115:28 - 115:33]
+// CHECK: 115:37: UnexposedExpr= Extent=[115:37 - 115:47]
+// CHECK: 115:37: DeclRefExpr=c:2:14 Extent=[115:37 - 115:38]
+// CHECK: 115:42: UnexposedExpr= Extent=[115:42 - 115:47]
+// CHECK: 115:42: UnexposedExpr= Extent=[115:42 - 115:47]
+// CHECK: 116:9: UnexposedExpr= Extent=[116:9 - 116:33]
+// CHECK: 116:9: UnexposedExpr= Extent=[116:9 - 116:19]
+// CHECK: 116:9: DeclRefExpr=c:2:14 Extent=[116:9 - 116:10]
+// CHECK: 116:14: UnexposedExpr= Extent=[116:14 - 116:19]
+// CHECK: 116:14: UnexposedExpr= Extent=[116:14 - 116:19]
+// CHECK: 116:23: UnexposedExpr= Extent=[116:23 - 116:33]
+// CHECK: 116:23: DeclRefExpr=c:2:14 Extent=[116:23 - 116:24]
+// CHECK: 116:28: UnexposedExpr= Extent=[116:28 - 116:33]
+// CHECK: 116:28: UnexposedExpr= Extent=[116:28 - 116:33]
+// CHECK: 117:9: UnexposedExpr= Extent=[117:9 - 117:33]
+// CHECK: 117:9: UnexposedExpr= Extent=[117:9 - 117:19]
+// CHECK: 117:9: DeclRefExpr=c:2:14 Extent=[117:9 - 117:10]
+// CHECK: 117:14: UnexposedExpr= Extent=[117:14 - 117:19]
+// CHECK: 117:14: UnexposedExpr= Extent=[117:14 - 117:19]
+// CHECK: 117:23: UnexposedExpr= Extent=[117:23 - 117:33]
+// CHECK: 117:23: DeclRefExpr=c:2:14 Extent=[117:23 - 117:24]
+// CHECK: 117:28: UnexposedExpr= Extent=[117:28 - 117:33]
+// CHECK: 117:28: UnexposedExpr= Extent=[117:28 - 117:33]
+// CHECK: 118:9: UnexposedExpr= Extent=[118:9 - 118:35]
+// CHECK: 118:9: UnexposedExpr= Extent=[118:9 - 118:20]
+// CHECK: 118:9: DeclRefExpr=c:2:14 Extent=[118:9 - 118:10]
+// CHECK: 118:14: UnexposedExpr= Extent=[118:14 - 118:20]
+// CHECK: 118:14: UnexposedExpr= Extent=[118:14 - 118:20]
+// CHECK: 118:24: UnexposedExpr= Extent=[118:24 - 118:35]
+// CHECK: 118:24: DeclRefExpr=c:2:14 Extent=[118:24 - 118:25]
+// CHECK: 118:29: UnexposedExpr= Extent=[118:29 - 118:35]
+// CHECK: 118:29: UnexposedExpr= Extent=[118:29 - 118:35]
+// CHECK: 119:9: UnexposedExpr= Extent=[119:9 - 119:35]
+// CHECK: 119:9: UnexposedExpr= Extent=[119:9 - 119:20]
+// CHECK: 119:9: DeclRefExpr=c:2:14 Extent=[119:9 - 119:10]
+// CHECK: 119:14: UnexposedExpr= Extent=[119:14 - 119:20]
+// CHECK: 119:14: UnexposedExpr= Extent=[119:14 - 119:20]
+// CHECK: 119:24: UnexposedExpr= Extent=[119:24 - 119:35]
+// CHECK: 119:24: DeclRefExpr=c:2:14 Extent=[119:24 - 119:25]
+// CHECK: 119:29: UnexposedExpr= Extent=[119:29 - 119:35]
+// CHECK: 119:29: UnexposedExpr= Extent=[119:29 - 119:35]
+// CHECK: 120:8: UnexposedExpr= Extent=[120:8 - 120:19]
+// CHECK: 120:8: DeclRefExpr=c:2:14 Extent=[120:8 - 120:9]
+// CHECK: 120:13: UnexposedExpr= Extent=[120:13 - 120:19]
+// CHECK: 120:13: UnexposedExpr= Extent=[120:13 - 120:19]
+// CHECK: 120:24: UnexposedExpr= Extent=[120:24 - 120:50]
+// CHECK: 120:24: UnexposedExpr= Extent=[120:24 - 120:35]
+// CHECK: 120:24: DeclRefExpr=c:2:14 Extent=[120:24 - 120:25]
+// CHECK: 120:29: UnexposedExpr= Extent=[120:29 - 120:35]
+// CHECK: 120:29: UnexposedExpr= Extent=[120:29 - 120:35]
+// CHECK: 120:39: UnexposedExpr= Extent=[120:39 - 120:50]
+// CHECK: 120:39: DeclRefExpr=c:2:14 Extent=[120:39 - 120:40]
+// CHECK: 120:44: UnexposedExpr= Extent=[120:44 - 120:50]
+// CHECK: 120:44: UnexposedExpr= Extent=[120:44 - 120:50]
+// CHECK: 121:9: UnexposedExpr= Extent=[121:9 - 121:35]
+// CHECK: 121:9: UnexposedExpr= Extent=[121:9 - 121:20]
+// CHECK: 121:9: DeclRefExpr=c:2:14 Extent=[121:9 - 121:10]
+// CHECK: 121:14: UnexposedExpr= Extent=[121:14 - 121:20]
+// CHECK: 121:14: UnexposedExpr= Extent=[121:14 - 121:20]
+// CHECK: 121:24: UnexposedExpr= Extent=[121:24 - 121:35]
+// CHECK: 121:24: DeclRefExpr=c:2:14 Extent=[121:24 - 121:25]
+// CHECK: 121:29: UnexposedExpr= Extent=[121:29 - 121:35]
+// CHECK: 121:29: UnexposedExpr= Extent=[121:29 - 121:35]
+// CHECK: 122:8: UnexposedExpr= Extent=[122:8 - 122:19]
+// CHECK: 122:8: DeclRefExpr=c:2:14 Extent=[122:8 - 122:9]
+// CHECK: 122:13: UnexposedExpr= Extent=[122:13 - 122:19]
+// CHECK: 122:13: UnexposedExpr= Extent=[122:13 - 122:19]
+// CHECK: 122:24: UnexposedExpr= Extent=[122:24 - 122:50]
+// CHECK: 122:24: UnexposedExpr= Extent=[122:24 - 122:35]
+// CHECK: 122:24: DeclRefExpr=c:2:14 Extent=[122:24 - 122:25]
+// CHECK: 122:29: UnexposedExpr= Extent=[122:29 - 122:35]
+// CHECK: 122:29: UnexposedExpr= Extent=[122:29 - 122:35]
+// CHECK: 122:39: UnexposedExpr= Extent=[122:39 - 122:50]
+// CHECK: 122:39: DeclRefExpr=c:2:14 Extent=[122:39 - 122:40]
+// CHECK: 122:44: UnexposedExpr= Extent=[122:44 - 122:50]
+// CHECK: 122:44: UnexposedExpr= Extent=[122:44 - 122:50]
+// CHECK: 123:9: UnexposedExpr= Extent=[123:9 - 123:35]
+// CHECK: 123:9: UnexposedExpr= Extent=[123:9 - 123:20]
+// CHECK: 123:9: DeclRefExpr=c:2:14 Extent=[123:9 - 123:10]
+// CHECK: 123:14: UnexposedExpr= Extent=[123:14 - 123:20]
+// CHECK: 123:14: UnexposedExpr= Extent=[123:14 - 123:20]
+// CHECK: 123:24: UnexposedExpr= Extent=[123:24 - 123:35]
+// CHECK: 123:24: DeclRefExpr=c:2:14 Extent=[123:24 - 123:25]
+// CHECK: 123:29: UnexposedExpr= Extent=[123:29 - 123:35]
+// CHECK: 123:29: UnexposedExpr= Extent=[123:29 - 123:35]
+// CHECK: 124:8: UnexposedExpr= Extent=[124:8 - 124:19]
+// CHECK: 124:8: DeclRefExpr=c:2:14 Extent=[124:8 - 124:9]
+// CHECK: 124:13: UnexposedExpr= Extent=[124:13 - 124:19]
+// CHECK: 124:13: UnexposedExpr= Extent=[124:13 - 124:19]
+// CHECK: 124:23: UnexposedExpr= Extent=[124:23 - 124:34]
+// CHECK: 124:23: DeclRefExpr=c:2:14 Extent=[124:23 - 124:24]
+// CHECK: 124:28: UnexposedExpr= Extent=[124:28 - 124:34]
+// CHECK: 124:28: UnexposedExpr= Extent=[124:28 - 124:34]
+// CHECK: 124:38: UnexposedExpr= Extent=[124:38 - 124:49]
+// CHECK: 124:38: DeclRefExpr=c:2:14 Extent=[124:38 - 124:39]
+// CHECK: 124:43: UnexposedExpr= Extent=[124:43 - 124:49]
+// CHECK: 124:43: UnexposedExpr= Extent=[124:43 - 124:49]
+// CHECK: 124:53: UnexposedExpr= Extent=[124:53 - 124:64]
+// CHECK: 124:53: DeclRefExpr=c:2:14 Extent=[124:53 - 124:54]
+// CHECK: 124:58: UnexposedExpr= Extent=[124:58 - 124:64]
+// CHECK: 124:58: UnexposedExpr= Extent=[124:58 - 124:64]
+// CHECK: 125:5: UnexposedExpr= Extent=[125:5 - 125:16]
+// CHECK: 125:5: DeclRefExpr=c:2:14 Extent=[125:5 - 125:6]
+// CHECK: 125:10: UnexposedExpr= Extent=[125:10 - 125:16]
+// CHECK: 125:10: UnexposedExpr= Extent=[125:10 - 125:16]
+// CHECK: 125:20: UnexposedExpr= Extent=[125:20 - 125:31]
+// CHECK: 125:20: DeclRefExpr=c:2:14 Extent=[125:20 - 125:21]
+// CHECK: 125:25: UnexposedExpr= Extent=[125:25 - 125:31]
+// CHECK: 125:25: UnexposedExpr= Extent=[125:25 - 125:31]
+// CHECK: 125:36: UnexposedExpr= Extent=[125:36 - 125:62]
+// CHECK: 125:36: UnexposedExpr= Extent=[125:36 - 125:47]
+// CHECK: 125:36: DeclRefExpr=c:2:14 Extent=[125:36 - 125:37]
+// CHECK: 125:41: UnexposedExpr= Extent=[125:41 - 125:47]
+// CHECK: 125:41: UnexposedExpr= Extent=[125:41 - 125:47]
+// CHECK: 125:51: UnexposedExpr= Extent=[125:51 - 125:62]
+// CHECK: 125:51: DeclRefExpr=c:2:14 Extent=[125:51 - 125:52]
+// CHECK: 125:56: UnexposedExpr= Extent=[125:56 - 125:62]
+// CHECK: 125:56: UnexposedExpr= Extent=[125:56 - 125:62]
+// CHECK: 126:8: UnexposedExpr= Extent=[126:8 - 126:19]
+// CHECK: 126:8: DeclRefExpr=c:2:14 Extent=[126:8 - 126:9]
+// CHECK: 126:13: UnexposedExpr= Extent=[126:13 - 126:19]
+// CHECK: 126:13: UnexposedExpr= Extent=[126:13 - 126:19]
+// CHECK: 126:24: UnexposedExpr= Extent=[126:24 - 126:50]
+// CHECK: 126:24: UnexposedExpr= Extent=[126:24 - 126:35]
+// CHECK: 126:24: DeclRefExpr=c:2:14 Extent=[126:24 - 126:25]
+// CHECK: 126:29: UnexposedExpr= Extent=[126:29 - 126:35]
+// CHECK: 126:29: UnexposedExpr= Extent=[126:29 - 126:35]
+// CHECK: 126:39: UnexposedExpr= Extent=[126:39 - 126:50]
+// CHECK: 126:39: DeclRefExpr=c:2:14 Extent=[126:39 - 126:40]
+// CHECK: 126:44: UnexposedExpr= Extent=[126:44 - 126:50]
+// CHECK: 126:44: UnexposedExpr= Extent=[126:44 - 126:50]
+// CHECK: 127:8: UnexposedExpr= Extent=[127:8 - 127:19]
+// CHECK: 127:8: DeclRefExpr=c:2:14 Extent=[127:8 - 127:9]
+// CHECK: 127:13: UnexposedExpr= Extent=[127:13 - 127:19]
+// CHECK: 127:13: UnexposedExpr= Extent=[127:13 - 127:19]
+// CHECK: 127:23: UnexposedExpr= Extent=[127:23 - 127:34]
+// CHECK: 127:23: DeclRefExpr=c:2:14 Extent=[127:23 - 127:24]
+// CHECK: 127:28: UnexposedExpr= Extent=[127:28 - 127:34]
+// CHECK: 127:28: UnexposedExpr= Extent=[127:28 - 127:34]
+// CHECK: 127:38: UnexposedExpr= Extent=[127:38 - 127:49]
+// CHECK: 127:38: DeclRefExpr=c:2:14 Extent=[127:38 - 127:39]
+// CHECK: 127:43: UnexposedExpr= Extent=[127:43 - 127:49]
+// CHECK: 127:43: UnexposedExpr= Extent=[127:43 - 127:49]
+// CHECK: 127:53: UnexposedExpr= Extent=[127:53 - 127:64]
+// CHECK: 127:53: DeclRefExpr=c:2:14 Extent=[127:53 - 127:54]
+// CHECK: 127:58: UnexposedExpr= Extent=[127:58 - 127:64]
+// CHECK: 127:58: UnexposedExpr= Extent=[127:58 - 127:64]
+// CHECK: 128:6: UnexposedExpr= Extent=[128:6 - 128:32]
+// CHECK: 128:6: UnexposedExpr= Extent=[128:6 - 128:17]
+// CHECK: 128:6: DeclRefExpr=c:2:14 Extent=[128:6 - 128:7]
+// CHECK: 128:11: UnexposedExpr= Extent=[128:11 - 128:17]
+// CHECK: 128:11: UnexposedExpr= Extent=[128:11 - 128:17]
+// CHECK: 128:21: UnexposedExpr= Extent=[128:21 - 128:32]
+// CHECK: 128:21: DeclRefExpr=c:2:14 Extent=[128:21 - 128:22]
+// CHECK: 128:26: UnexposedExpr= Extent=[128:26 - 128:32]
+// CHECK: 128:26: UnexposedExpr= Extent=[128:26 - 128:32]
+// CHECK: 129:9: UnexposedExpr= Extent=[129:9 - 129:35]
+// CHECK: 129:9: UnexposedExpr= Extent=[129:9 - 129:20]
+// CHECK: 129:9: DeclRefExpr=c:2:14 Extent=[129:9 - 129:10]
+// CHECK: 129:14: UnexposedExpr= Extent=[129:14 - 129:20]
+// CHECK: 129:14: UnexposedExpr= Extent=[129:14 - 129:20]
+// CHECK: 129:24: UnexposedExpr= Extent=[129:24 - 129:35]
+// CHECK: 129:24: DeclRefExpr=c:2:14 Extent=[129:24 - 129:25]
+// CHECK: 129:29: UnexposedExpr= Extent=[129:29 - 129:35]
+// CHECK: 129:29: UnexposedExpr= Extent=[129:29 - 129:35]
+// CHECK: 130:8: UnexposedExpr= Extent=[130:8 - 130:19]
+// CHECK: 130:8: DeclRefExpr=c:2:14 Extent=[130:8 - 130:9]
+// CHECK: 130:13: UnexposedExpr= Extent=[130:13 - 130:19]
+// CHECK: 130:13: UnexposedExpr= Extent=[130:13 - 130:19]
+// CHECK: 130:23: UnexposedExpr= Extent=[130:23 - 130:34]
+// CHECK: 130:23: DeclRefExpr=c:2:14 Extent=[130:23 - 130:24]
+// CHECK: 130:28: UnexposedExpr= Extent=[130:28 - 130:34]
+// CHECK: 130:28: UnexposedExpr= Extent=[130:28 - 130:34]
+// CHECK: 130:38: UnexposedExpr= Extent=[130:38 - 130:49]
+// CHECK: 130:38: DeclRefExpr=c:2:14 Extent=[130:38 - 130:39]
+// CHECK: 130:43: UnexposedExpr= Extent=[130:43 - 130:49]
+// CHECK: 130:43: UnexposedExpr= Extent=[130:43 - 130:49]
+// CHECK: 130:53: UnexposedExpr= Extent=[130:53 - 130:64]
+// CHECK: 130:53: DeclRefExpr=c:2:14 Extent=[130:53 - 130:54]
+// CHECK: 130:58: UnexposedExpr= Extent=[130:58 - 130:64]
+// CHECK: 130:58: UnexposedExpr= Extent=[130:58 - 130:64]
+// CHECK: 131:6: UnexposedExpr= Extent=[131:6 - 131:32]
+// CHECK: 131:6: UnexposedExpr= Extent=[131:6 - 131:17]
+// CHECK: 131:6: DeclRefExpr=c:2:14 Extent=[131:6 - 131:7]
+// CHECK: 131:11: UnexposedExpr= Extent=[131:11 - 131:17]
+// CHECK: 131:11: UnexposedExpr= Extent=[131:11 - 131:17]
+// CHECK: 131:21: UnexposedExpr= Extent=[131:21 - 131:32]
+// CHECK: 131:21: DeclRefExpr=c:2:14 Extent=[131:21 - 131:22]
+// CHECK: 131:26: UnexposedExpr= Extent=[131:26 - 131:32]
+// CHECK: 131:26: UnexposedExpr= Extent=[131:26 - 131:32]
+// CHECK: 132:9: UnexposedExpr= Extent=[132:9 - 132:35]
+// CHECK: 132:9: UnexposedExpr= Extent=[132:9 - 132:20]
+// CHECK: 132:9: DeclRefExpr=c:2:14 Extent=[132:9 - 132:10]
+// CHECK: 132:14: UnexposedExpr= Extent=[132:14 - 132:20]
+// CHECK: 132:14: UnexposedExpr= Extent=[132:14 - 132:20]
+// CHECK: 132:24: UnexposedExpr= Extent=[132:24 - 132:35]
+// CHECK: 132:24: DeclRefExpr=c:2:14 Extent=[132:24 - 132:25]
+// CHECK: 132:29: UnexposedExpr= Extent=[132:29 - 132:35]
+// CHECK: 132:29: UnexposedExpr= Extent=[132:29 - 132:35]
+// CHECK: 133:8: UnexposedExpr= Extent=[133:8 - 133:19]
+// CHECK: 133:8: DeclRefExpr=c:2:14 Extent=[133:8 - 133:9]
+// CHECK: 133:13: UnexposedExpr= Extent=[133:13 - 133:19]
+// CHECK: 133:13: UnexposedExpr= Extent=[133:13 - 133:19]
+// CHECK: 133:24: UnexposedExpr= Extent=[133:24 - 133:50]
+// CHECK: 133:24: UnexposedExpr= Extent=[133:24 - 133:35]
+// CHECK: 133:24: DeclRefExpr=c:2:14 Extent=[133:24 - 133:25]
+// CHECK: 133:29: UnexposedExpr= Extent=[133:29 - 133:35]
+// CHECK: 133:29: UnexposedExpr= Extent=[133:29 - 133:35]
+// CHECK: 133:39: UnexposedExpr= Extent=[133:39 - 133:50]
+// CHECK: 133:39: DeclRefExpr=c:2:14 Extent=[133:39 - 133:40]
+// CHECK: 133:44: UnexposedExpr= Extent=[133:44 - 133:50]
+// CHECK: 133:44: UnexposedExpr= Extent=[133:44 - 133:50]
+// CHECK: 134:8: UnexposedExpr= Extent=[134:8 - 134:19]
+// CHECK: 134:8: DeclRefExpr=c:2:14 Extent=[134:8 - 134:9]
+// CHECK: 134:13: UnexposedExpr= Extent=[134:13 - 134:19]
+// CHECK: 134:13: UnexposedExpr= Extent=[134:13 - 134:19]
+// CHECK: 134:23: UnexposedExpr= Extent=[134:23 - 134:34]
+// CHECK: 134:23: DeclRefExpr=c:2:14 Extent=[134:23 - 134:24]
+// CHECK: 134:28: UnexposedExpr= Extent=[134:28 - 134:34]
+// CHECK: 134:28: UnexposedExpr= Extent=[134:28 - 134:34]
+// CHECK: 134:38: UnexposedExpr= Extent=[134:38 - 134:49]
+// CHECK: 134:38: DeclRefExpr=c:2:14 Extent=[134:38 - 134:39]
+// CHECK: 134:43: UnexposedExpr= Extent=[134:43 - 134:49]
+// CHECK: 134:43: UnexposedExpr= Extent=[134:43 - 134:49]
+// CHECK: 134:54: UnexposedExpr= Extent=[134:54 - 134:80]
+// CHECK: 134:54: UnexposedExpr= Extent=[134:54 - 134:65]
+// CHECK: 134:54: DeclRefExpr=c:2:14 Extent=[134:54 - 134:55]
+// CHECK: 134:59: UnexposedExpr= Extent=[134:59 - 134:65]
+// CHECK: 134:59: UnexposedExpr= Extent=[134:59 - 134:65]
+// CHECK: 134:69: UnexposedExpr= Extent=[134:69 - 134:80]
+// CHECK: 134:69: DeclRefExpr=c:2:14 Extent=[134:69 - 134:70]
+// CHECK: 134:74: UnexposedExpr= Extent=[134:74 - 134:80]
+// CHECK: 134:74: UnexposedExpr= Extent=[134:74 - 134:80]
+// CHECK: 135:9: UnexposedExpr= Extent=[135:9 - 135:35]
+// CHECK: 135:9: UnexposedExpr= Extent=[135:9 - 135:20]
+// CHECK: 135:9: DeclRefExpr=c:2:14 Extent=[135:9 - 135:10]
+// CHECK: 135:14: UnexposedExpr= Extent=[135:14 - 135:20]
+// CHECK: 135:14: UnexposedExpr= Extent=[135:14 - 135:20]
+// CHECK: 135:24: UnexposedExpr= Extent=[135:24 - 135:35]
+// CHECK: 135:24: DeclRefExpr=c:2:14 Extent=[135:24 - 135:25]
+// CHECK: 135:29: UnexposedExpr= Extent=[135:29 - 135:35]
+// CHECK: 135:29: UnexposedExpr= Extent=[135:29 - 135:35]
+// CHECK: 136:9: UnexposedExpr= Extent=[136:9 - 136:35]
+// CHECK: 136:9: UnexposedExpr= Extent=[136:9 - 136:20]
+// CHECK: 136:9: DeclRefExpr=c:2:14 Extent=[136:9 - 136:10]
+// CHECK: 136:14: UnexposedExpr= Extent=[136:14 - 136:20]
+// CHECK: 136:14: UnexposedExpr= Extent=[136:14 - 136:20]
+// CHECK: 136:24: UnexposedExpr= Extent=[136:24 - 136:35]
+// CHECK: 136:24: DeclRefExpr=c:2:14 Extent=[136:24 - 136:25]
+// CHECK: 136:29: UnexposedExpr= Extent=[136:29 - 136:35]
+// CHECK: 136:29: UnexposedExpr= Extent=[136:29 - 136:35]
+// CHECK: 137:9: UnexposedExpr= Extent=[137:9 - 137:35]
+// CHECK: 137:9: UnexposedExpr= Extent=[137:9 - 137:20]
+// CHECK: 137:9: DeclRefExpr=c:2:14 Extent=[137:9 - 137:10]
+// CHECK: 137:14: UnexposedExpr= Extent=[137:14 - 137:20]
+// CHECK: 137:14: UnexposedExpr= Extent=[137:14 - 137:20]
+// CHECK: 137:24: UnexposedExpr= Extent=[137:24 - 137:35]
+// CHECK: 137:24: DeclRefExpr=c:2:14 Extent=[137:24 - 137:25]
+// CHECK: 137:29: UnexposedExpr= Extent=[137:29 - 137:35]
+// CHECK: 137:29: UnexposedExpr= Extent=[137:29 - 137:35]
+// CHECK: 138:9: UnexposedExpr= Extent=[138:9 - 138:35]
+// CHECK: 138:9: UnexposedExpr= Extent=[138:9 - 138:20]
+// CHECK: 138:9: DeclRefExpr=c:2:14 Extent=[138:9 - 138:10]
+// CHECK: 138:14: UnexposedExpr= Extent=[138:14 - 138:20]
+// CHECK: 138:14: UnexposedExpr= Extent=[138:14 - 138:20]
+// CHECK: 138:24: UnexposedExpr= Extent=[138:24 - 138:35]
+// CHECK: 138:24: DeclRefExpr=c:2:14 Extent=[138:24 - 138:25]
+// CHECK: 138:29: UnexposedExpr= Extent=[138:29 - 138:35]
+// CHECK: 138:29: UnexposedExpr= Extent=[138:29 - 138:35]
+// CHECK: 139:9: UnexposedExpr= Extent=[139:9 - 139:35]
+// CHECK: 139:9: UnexposedExpr= Extent=[139:9 - 139:20]
+// CHECK: 139:9: DeclRefExpr=c:2:14 Extent=[139:9 - 139:10]
+// CHECK: 139:14: UnexposedExpr= Extent=[139:14 - 139:20]
+// CHECK: 139:14: UnexposedExpr= Extent=[139:14 - 139:20]
+// CHECK: 139:24: UnexposedExpr= Extent=[139:24 - 139:35]
+// CHECK: 139:24: DeclRefExpr=c:2:14 Extent=[139:24 - 139:25]
+// CHECK: 139:29: UnexposedExpr= Extent=[139:29 - 139:35]
+// CHECK: 139:29: UnexposedExpr= Extent=[139:29 - 139:35]
+// CHECK: 140:9: UnexposedExpr= Extent=[140:9 - 140:35]
+// CHECK: 140:9: UnexposedExpr= Extent=[140:9 - 140:20]
+// CHECK: 140:9: DeclRefExpr=c:2:14 Extent=[140:9 - 140:10]
+// CHECK: 140:14: UnexposedExpr= Extent=[140:14 - 140:20]
+// CHECK: 140:14: UnexposedExpr= Extent=[140:14 - 140:20]
+// CHECK: 140:24: UnexposedExpr= Extent=[140:24 - 140:35]
+// CHECK: 140:24: DeclRefExpr=c:2:14 Extent=[140:24 - 140:25]
+// CHECK: 140:29: UnexposedExpr= Extent=[140:29 - 140:35]
+// CHECK: 140:29: UnexposedExpr= Extent=[140:29 - 140:35]
+// CHECK: 141:8: UnexposedExpr= Extent=[141:8 - 141:19]
+// CHECK: 141:8: DeclRefExpr=c:2:14 Extent=[141:8 - 141:9]
+// CHECK: 141:13: UnexposedExpr= Extent=[141:13 - 141:19]
+// CHECK: 141:13: UnexposedExpr= Extent=[141:13 - 141:19]
+// CHECK: 141:23: UnexposedExpr= Extent=[141:23 - 141:34]
+// CHECK: 141:23: DeclRefExpr=c:2:14 Extent=[141:23 - 141:24]
+// CHECK: 141:28: UnexposedExpr= Extent=[141:28 - 141:34]
+// CHECK: 141:28: UnexposedExpr= Extent=[141:28 - 141:34]
+// CHECK: 141:38: UnexposedExpr= Extent=[141:38 - 141:49]
+// CHECK: 141:38: DeclRefExpr=c:2:14 Extent=[141:38 - 141:39]
+// CHECK: 141:43: UnexposedExpr= Extent=[141:43 - 141:49]
+// CHECK: 141:43: UnexposedExpr= Extent=[141:43 - 141:49]
+// CHECK: 141:54: UnexposedExpr= Extent=[141:54 - 141:80]
+// CHECK: 141:54: UnexposedExpr= Extent=[141:54 - 141:65]
+// CHECK: 141:54: DeclRefExpr=c:2:14 Extent=[141:54 - 141:55]
+// CHECK: 141:59: UnexposedExpr= Extent=[141:59 - 141:65]
+// CHECK: 141:59: UnexposedExpr= Extent=[141:59 - 141:65]
+// CHECK: 141:69: UnexposedExpr= Extent=[141:69 - 141:80]
+// CHECK: 141:69: DeclRefExpr=c:2:14 Extent=[141:69 - 141:70]
+// CHECK: 141:74: UnexposedExpr= Extent=[141:74 - 141:80]
+// CHECK: 141:74: UnexposedExpr= Extent=[141:74 - 141:80]
+// CHECK: 142:9: UnexposedExpr= Extent=[142:9 - 142:35]
+// CHECK: 142:9: UnexposedExpr= Extent=[142:9 - 142:20]
+// CHECK: 142:9: DeclRefExpr=c:2:14 Extent=[142:9 - 142:10]
+// CHECK: 142:14: UnexposedExpr= Extent=[142:14 - 142:20]
+// CHECK: 142:14: UnexposedExpr= Extent=[142:14 - 142:20]
+// CHECK: 142:24: UnexposedExpr= Extent=[142:24 - 142:35]
+// CHECK: 142:24: DeclRefExpr=c:2:14 Extent=[142:24 - 142:25]
+// CHECK: 142:29: UnexposedExpr= Extent=[142:29 - 142:35]
+// CHECK: 142:29: UnexposedExpr= Extent=[142:29 - 142:35]
+// CHECK: 143:9: UnexposedExpr= Extent=[143:9 - 143:35]
+// CHECK: 143:9: UnexposedExpr= Extent=[143:9 - 143:20]
+// CHECK: 143:9: DeclRefExpr=c:2:14 Extent=[143:9 - 143:10]
+// CHECK: 143:14: UnexposedExpr= Extent=[143:14 - 143:20]
+// CHECK: 143:14: UnexposedExpr= Extent=[143:14 - 143:20]
+// CHECK: 143:24: UnexposedExpr= Extent=[143:24 - 143:35]
+// CHECK: 143:24: DeclRefExpr=c:2:14 Extent=[143:24 - 143:25]
+// CHECK: 143:29: UnexposedExpr= Extent=[143:29 - 143:35]
+// CHECK: 143:29: UnexposedExpr= Extent=[143:29 - 143:35]
+// CHECK: 144:8: UnexposedExpr= Extent=[144:8 - 144:19]
+// CHECK: 144:8: DeclRefExpr=c:2:14 Extent=[144:8 - 144:9]
+// CHECK: 144:13: UnexposedExpr= Extent=[144:13 - 144:19]
+// CHECK: 144:13: UnexposedExpr= Extent=[144:13 - 144:19]
+// CHECK: 144:24: UnexposedExpr= Extent=[144:24 - 144:50]
+// CHECK: 144:24: UnexposedExpr= Extent=[144:24 - 144:35]
+// CHECK: 144:24: DeclRefExpr=c:2:14 Extent=[144:24 - 144:25]
+// CHECK: 144:29: UnexposedExpr= Extent=[144:29 - 144:35]
+// CHECK: 144:29: UnexposedExpr= Extent=[144:29 - 144:35]
+// CHECK: 144:39: UnexposedExpr= Extent=[144:39 - 144:50]
+// CHECK: 144:39: DeclRefExpr=c:2:14 Extent=[144:39 - 144:40]
+// CHECK: 144:44: UnexposedExpr= Extent=[144:44 - 144:50]
+// CHECK: 144:44: UnexposedExpr= Extent=[144:44 - 144:50]
+// CHECK: 145:9: UnexposedExpr= Extent=[145:9 - 145:35]
+// CHECK: 145:9: UnexposedExpr= Extent=[145:9 - 145:20]
+// CHECK: 145:9: DeclRefExpr=c:2:14 Extent=[145:9 - 145:10]
+// CHECK: 145:14: UnexposedExpr= Extent=[145:14 - 145:20]
+// CHECK: 145:14: UnexposedExpr= Extent=[145:14 - 145:20]
+// CHECK: 145:24: UnexposedExpr= Extent=[145:24 - 145:35]
+// CHECK: 145:24: DeclRefExpr=c:2:14 Extent=[145:24 - 145:25]
+// CHECK: 145:29: UnexposedExpr= Extent=[145:29 - 145:35]
+// CHECK: 145:29: UnexposedExpr= Extent=[145:29 - 145:35]
+// CHECK: 146:9: UnexposedExpr= Extent=[146:9 - 146:35]
+// CHECK: 146:9: UnexposedExpr= Extent=[146:9 - 146:20]
+// CHECK: 146:9: DeclRefExpr=c:2:14 Extent=[146:9 - 146:10]
+// CHECK: 146:14: UnexposedExpr= Extent=[146:14 - 146:20]
+// CHECK: 146:14: UnexposedExpr= Extent=[146:14 - 146:20]
+// CHECK: 146:24: UnexposedExpr= Extent=[146:24 - 146:35]
+// CHECK: 146:24: DeclRefExpr=c:2:14 Extent=[146:24 - 146:25]
+// CHECK: 146:29: UnexposedExpr= Extent=[146:29 - 146:35]
+// CHECK: 146:29: UnexposedExpr= Extent=[146:29 - 146:35]
+// CHECK: 147:9: UnexposedExpr= Extent=[147:9 - 147:35]
+// CHECK: 147:9: UnexposedExpr= Extent=[147:9 - 147:20]
+// CHECK: 147:9: DeclRefExpr=c:2:14 Extent=[147:9 - 147:10]
+// CHECK: 147:14: UnexposedExpr= Extent=[147:14 - 147:20]
+// CHECK: 147:14: UnexposedExpr= Extent=[147:14 - 147:20]
+// CHECK: 147:24: UnexposedExpr= Extent=[147:24 - 147:35]
+// CHECK: 147:24: DeclRefExpr=c:2:14 Extent=[147:24 - 147:25]
+// CHECK: 147:29: UnexposedExpr= Extent=[147:29 - 147:35]
+// CHECK: 147:29: UnexposedExpr= Extent=[147:29 - 147:35]
+// CHECK: 148:9: UnexposedExpr= Extent=[148:9 - 148:35]
+// CHECK: 148:9: UnexposedExpr= Extent=[148:9 - 148:20]
+// CHECK: 148:9: DeclRefExpr=c:2:14 Extent=[148:9 - 148:10]
+// CHECK: 148:14: UnexposedExpr= Extent=[148:14 - 148:20]
+// CHECK: 148:14: UnexposedExpr= Extent=[148:14 - 148:20]
+// CHECK: 148:24: UnexposedExpr= Extent=[148:24 - 148:35]
+// CHECK: 148:24: DeclRefExpr=c:2:14 Extent=[148:24 - 148:25]
+// CHECK: 148:29: UnexposedExpr= Extent=[148:29 - 148:35]
+// CHECK: 148:29: UnexposedExpr= Extent=[148:29 - 148:35]
+// CHECK: 149:9: UnexposedExpr= Extent=[149:9 - 149:35]
+// CHECK: 149:9: UnexposedExpr= Extent=[149:9 - 149:20]
+// CHECK: 149:9: DeclRefExpr=c:2:14 Extent=[149:9 - 149:10]
+// CHECK: 149:14: UnexposedExpr= Extent=[149:14 - 149:20]
+// CHECK: 149:14: UnexposedExpr= Extent=[149:14 - 149:20]
+// CHECK: 149:24: UnexposedExpr= Extent=[149:24 - 149:35]
+// CHECK: 149:24: DeclRefExpr=c:2:14 Extent=[149:24 - 149:25]
+// CHECK: 149:29: UnexposedExpr= Extent=[149:29 - 149:35]
+// CHECK: 149:29: UnexposedExpr= Extent=[149:29 - 149:35]
+// CHECK: 150:9: UnexposedExpr= Extent=[150:9 - 150:35]
+// CHECK: 150:9: UnexposedExpr= Extent=[150:9 - 150:20]
+// CHECK: 150:9: DeclRefExpr=c:2:14 Extent=[150:9 - 150:10]
+// CHECK: 150:14: UnexposedExpr= Extent=[150:14 - 150:20]
+// CHECK: 150:14: UnexposedExpr= Extent=[150:14 - 150:20]
+// CHECK: 150:24: UnexposedExpr= Extent=[150:24 - 150:35]
+// CHECK: 150:24: DeclRefExpr=c:2:14 Extent=[150:24 - 150:25]
+// CHECK: 150:29: UnexposedExpr= Extent=[150:29 - 150:35]
+// CHECK: 150:29: UnexposedExpr= Extent=[150:29 - 150:35]
+// CHECK: 151:8: UnexposedExpr= Extent=[151:8 - 151:19]
+// CHECK: 151:8: DeclRefExpr=c:2:14 Extent=[151:8 - 151:9]
+// CHECK: 151:13: UnexposedExpr= Extent=[151:13 - 151:19]
+// CHECK: 151:13: UnexposedExpr= Extent=[151:13 - 151:19]
+// CHECK: 151:24: UnexposedExpr= Extent=[151:24 - 151:50]
+// CHECK: 151:24: UnexposedExpr= Extent=[151:24 - 151:35]
+// CHECK: 151:24: DeclRefExpr=c:2:14 Extent=[151:24 - 151:25]
+// CHECK: 151:29: UnexposedExpr= Extent=[151:29 - 151:35]
+// CHECK: 151:29: UnexposedExpr= Extent=[151:29 - 151:35]
+// CHECK: 151:39: UnexposedExpr= Extent=[151:39 - 151:50]
+// CHECK: 151:39: DeclRefExpr=c:2:14 Extent=[151:39 - 151:40]
+// CHECK: 151:44: UnexposedExpr= Extent=[151:44 - 151:50]
+// CHECK: 151:44: UnexposedExpr= Extent=[151:44 - 151:50]
+// CHECK: 152:8: UnexposedExpr= Extent=[152:8 - 152:19]
+// CHECK: 152:8: DeclRefExpr=c:2:14 Extent=[152:8 - 152:9]
+// CHECK: 152:13: UnexposedExpr= Extent=[152:13 - 152:19]
+// CHECK: 152:13: UnexposedExpr= Extent=[152:13 - 152:19]
+// CHECK: 152:24: UnexposedExpr= Extent=[152:24 - 152:50]
+// CHECK: 152:24: UnexposedExpr= Extent=[152:24 - 152:35]
+// CHECK: 152:24: DeclRefExpr=c:2:14 Extent=[152:24 - 152:25]
+// CHECK: 152:29: UnexposedExpr= Extent=[152:29 - 152:35]
+// CHECK: 152:29: UnexposedExpr= Extent=[152:29 - 152:35]
+// CHECK: 152:39: UnexposedExpr= Extent=[152:39 - 152:50]
+// CHECK: 152:39: DeclRefExpr=c:2:14 Extent=[152:39 - 152:40]
+// CHECK: 152:44: UnexposedExpr= Extent=[152:44 - 152:50]
+// CHECK: 152:44: UnexposedExpr= Extent=[152:44 - 152:50]
+// CHECK: 153:9: UnexposedExpr= Extent=[153:9 - 153:35]
+// CHECK: 153:9: UnexposedExpr= Extent=[153:9 - 153:20]
+// CHECK: 153:9: DeclRefExpr=c:2:14 Extent=[153:9 - 153:10]
+// CHECK: 153:14: UnexposedExpr= Extent=[153:14 - 153:20]
+// CHECK: 153:14: UnexposedExpr= Extent=[153:14 - 153:20]
+// CHECK: 153:24: UnexposedExpr= Extent=[153:24 - 153:35]
+// CHECK: 153:24: DeclRefExpr=c:2:14 Extent=[153:24 - 153:25]
+// CHECK: 153:29: UnexposedExpr= Extent=[153:29 - 153:35]
+// CHECK: 153:29: UnexposedExpr= Extent=[153:29 - 153:35]
+// CHECK: 154:9: UnexposedExpr= Extent=[154:9 - 154:35]
+// CHECK: 154:9: UnexposedExpr= Extent=[154:9 - 154:20]
+// CHECK: 154:9: DeclRefExpr=c:2:14 Extent=[154:9 - 154:10]
+// CHECK: 154:14: UnexposedExpr= Extent=[154:14 - 154:20]
+// CHECK: 154:14: UnexposedExpr= Extent=[154:14 - 154:20]
+// CHECK: 154:24: UnexposedExpr= Extent=[154:24 - 154:35]
+// CHECK: 154:24: DeclRefExpr=c:2:14 Extent=[154:24 - 154:25]
+// CHECK: 154:29: UnexposedExpr= Extent=[154:29 - 154:35]
+// CHECK: 154:29: UnexposedExpr= Extent=[154:29 - 154:35]
+// CHECK: 155:9: UnexposedExpr= Extent=[155:9 - 155:35]
+// CHECK: 155:9: UnexposedExpr= Extent=[155:9 - 155:20]
+// CHECK: 155:9: DeclRefExpr=c:2:14 Extent=[155:9 - 155:10]
+// CHECK: 155:14: UnexposedExpr= Extent=[155:14 - 155:20]
+// CHECK: 155:14: UnexposedExpr= Extent=[155:14 - 155:20]
+// CHECK: 155:24: UnexposedExpr= Extent=[155:24 - 155:35]
+// CHECK: 155:24: DeclRefExpr=c:2:14 Extent=[155:24 - 155:25]
+// CHECK: 155:29: UnexposedExpr= Extent=[155:29 - 155:35]
+// CHECK: 155:29: UnexposedExpr= Extent=[155:29 - 155:35]
+// CHECK: 156:9: UnexposedExpr= Extent=[156:9 - 156:35]
+// CHECK: 156:9: UnexposedExpr= Extent=[156:9 - 156:20]
+// CHECK: 156:9: DeclRefExpr=c:2:14 Extent=[156:9 - 156:10]
+// CHECK: 156:14: UnexposedExpr= Extent=[156:14 - 156:20]
+// CHECK: 156:14: UnexposedExpr= Extent=[156:14 - 156:20]
+// CHECK: 156:24: UnexposedExpr= Extent=[156:24 - 156:35]
+// CHECK: 156:24: DeclRefExpr=c:2:14 Extent=[156:24 - 156:25]
+// CHECK: 156:29: UnexposedExpr= Extent=[156:29 - 156:35]
+// CHECK: 156:29: UnexposedExpr= Extent=[156:29 - 156:35]
+// CHECK: 157:9: UnexposedExpr= Extent=[157:9 - 157:35]
+// CHECK: 157:9: UnexposedExpr= Extent=[157:9 - 157:20]
+// CHECK: 157:9: DeclRefExpr=c:2:14 Extent=[157:9 - 157:10]
+// CHECK: 157:14: UnexposedExpr= Extent=[157:14 - 157:20]
+// CHECK: 157:14: UnexposedExpr= Extent=[157:14 - 157:20]
+// CHECK: 157:24: UnexposedExpr= Extent=[157:24 - 157:35]
+// CHECK: 157:24: DeclRefExpr=c:2:14 Extent=[157:24 - 157:25]
+// CHECK: 157:29: UnexposedExpr= Extent=[157:29 - 157:35]
+// CHECK: 157:29: UnexposedExpr= Extent=[157:29 - 157:35]
+// CHECK: 158:8: UnexposedExpr= Extent=[158:8 - 158:19]
+// CHECK: 158:8: DeclRefExpr=c:2:14 Extent=[158:8 - 158:9]
+// CHECK: 158:13: UnexposedExpr= Extent=[158:13 - 158:19]
+// CHECK: 158:13: UnexposedExpr= Extent=[158:13 - 158:19]
+// CHECK: 158:24: UnexposedExpr= Extent=[158:24 - 158:50]
+// CHECK: 158:24: UnexposedExpr= Extent=[158:24 - 158:35]
+// CHECK: 158:24: DeclRefExpr=c:2:14 Extent=[158:24 - 158:25]
+// CHECK: 158:29: UnexposedExpr= Extent=[158:29 - 158:35]
+// CHECK: 158:29: UnexposedExpr= Extent=[158:29 - 158:35]
+// CHECK: 158:39: UnexposedExpr= Extent=[158:39 - 158:50]
+// CHECK: 158:39: DeclRefExpr=c:2:14 Extent=[158:39 - 158:40]
+// CHECK: 158:44: UnexposedExpr= Extent=[158:44 - 158:50]
+// CHECK: 158:44: UnexposedExpr= Extent=[158:44 - 158:50]
+// CHECK: 159:9: UnexposedExpr= Extent=[159:9 - 159:35]
+// CHECK: 159:9: UnexposedExpr= Extent=[159:9 - 159:20]
+// CHECK: 159:9: DeclRefExpr=c:2:14 Extent=[159:9 - 159:10]
+// CHECK: 159:14: UnexposedExpr= Extent=[159:14 - 159:20]
+// CHECK: 159:14: UnexposedExpr= Extent=[159:14 - 159:20]
+// CHECK: 159:24: UnexposedExpr= Extent=[159:24 - 159:35]
+// CHECK: 159:24: DeclRefExpr=c:2:14 Extent=[159:24 - 159:25]
+// CHECK: 159:29: UnexposedExpr= Extent=[159:29 - 159:35]
+// CHECK: 159:29: UnexposedExpr= Extent=[159:29 - 159:35]
+// CHECK: 160:8: UnexposedExpr= Extent=[160:8 - 160:19]
+// CHECK: 160:8: DeclRefExpr=c:2:14 Extent=[160:8 - 160:9]
+// CHECK: 160:13: UnexposedExpr= Extent=[160:13 - 160:19]
+// CHECK: 160:13: UnexposedExpr= Extent=[160:13 - 160:19]
+// CHECK: 160:23: UnexposedExpr= Extent=[160:23 - 160:51]
+// CHECK: 160:24: UnexposedExpr= Extent=[160:24 - 160:50]
+// CHECK: 160:24: UnexposedExpr= Extent=[160:24 - 160:35]
+// CHECK: 160:24: DeclRefExpr=c:2:14 Extent=[160:24 - 160:25]
+// CHECK: 160:29: UnexposedExpr= Extent=[160:29 - 160:35]
+// CHECK: 160:29: UnexposedExpr= Extent=[160:29 - 160:35]
+// CHECK: 160:39: UnexposedExpr= Extent=[160:39 - 160:50]
+// CHECK: 160:39: DeclRefExpr=c:2:14 Extent=[160:39 - 160:40]
+// CHECK: 160:44: UnexposedExpr= Extent=[160:44 - 160:50]
+// CHECK: 160:44: UnexposedExpr= Extent=[160:44 - 160:50]
+
diff --git a/test/Index/overrides.cpp b/test/Index/overrides.cpp
new file mode 100644
index 000000000000..3dee607e4318
--- /dev/null
+++ b/test/Index/overrides.cpp
@@ -0,0 +1,20 @@
+struct A {
+ virtual void f(int);
+};
+
+struct B {
+ virtual void f(int);
+ virtual void g();
+};
+
+struct C : B, A {
+ virtual void g();
+};
+
+struct D : C {
+ virtual void f(int);
+};
+
+// 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]
diff --git a/test/Index/overrides.m b/test/Index/overrides.m
new file mode 100644
index 000000000000..2197aaaa3672
--- /dev/null
+++ b/test/Index/overrides.m
@@ -0,0 +1,35 @@
+
+@protocol P1
+- (void)protoMethod;
+- (void)protoMethodWithParam:(int)param;
+@end
+
+@protocol P3
+- (void)protoMethod;
+@end
+
+@protocol P2 <P1>
+- (void)protoMethod;
+@end
+
+@interface A
+- (void)method;
++ (void)methodWithParam:(int)param;
+@end
+
+@interface B : A <P2, P3>
+- (void)method;
+- (void)protoMethod;
+@end
+
+@implementation B
+- (void)method { }
++ (void)methodWithParam:(int)param { }
+@end
+
+// RUN: c-index-test -test-load-source local %s | FileCheck %s
+// CHECK: overrides.m:12:1: ObjCInstanceMethodDecl=protoMethod:12:1 [Overrides @3:1] Extent=[12:1 - 12:21]
+// CHECK: overrides.m:21:1: ObjCInstanceMethodDecl=method:21:1 [Overrides @16:1] Extent=[21:1 - 21:16]
+// CHECK: overrides.m:22:1: ObjCInstanceMethodDecl=protoMethod:22:1 [Overrides @12:1, @8:1] Extent=[22:1 - 22:21]
+// CHECK: overrides.m:26:1: ObjCInstanceMethodDecl=method:26:1 (Definition) [Overrides @21:1] Extent=[26:1 - 26:19]
+// CHECK: overrides.m:27:1: ObjCClassMethodDecl=methodWithParam::27:1 (Definition) [Overrides @17:1] Extent=[27:1 - 27:39]
diff --git a/test/Index/preamble-reparse-chained.c b/test/Index/preamble-reparse-chained.c
new file mode 100644
index 000000000000..5be3b12f01db
--- /dev/null
+++ b/test/Index/preamble-reparse-chained.c
@@ -0,0 +1,10 @@
+// RUN: c-index-test -write-pch %t.h.pch -x c-header %S/Inputs/a.h
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 all -I%S/Inputs -include %t.h %s | FileCheck %s
+#include "a.h"
+#include "b.h"
+
+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]
diff --git a/test/Index/preamble.c b/test/Index/preamble.c
index 54abf99ed149..fb784b389d0a 100644
--- a/test/Index/preamble.c
+++ b/test/Index/preamble.c
@@ -9,20 +9,16 @@ void f(int x) {
// 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: <invalid loc>:0:0: UnexposedStmt= Extent=[1:23 - 6:2]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[2:3 - 2:16]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[3:3 - 3:15]
// 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: <invalid loc>:0:0: UnexposedStmt= Extent=[5:3 - 5:11]
// 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: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
// CHECK-CC: FunctionDecl:{ResultType int}{TypedText bar}{LeftParen (}{Placeholder int i}{RightParen )} (50)
-// CHECK-CC: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder int x}{RightParen )} (45)
+// CHECK-CC: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder int x}{RightParen )} (50)
// CHECK-CC: FunctionDecl:{ResultType int}{TypedText foo}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC: FunctionDecl:{ResultType int}{TypedText wibble}{LeftParen (}{Placeholder int}{RightParen )} (50)
diff --git a/test/Index/print-display-names.cpp b/test/Index/print-display-names.cpp
new file mode 100644
index 000000000000..94fe4665e630
--- /dev/null
+++ b/test/Index/print-display-names.cpp
@@ -0,0 +1,20 @@
+template<typename T, typename>
+class ClassTmpl { };
+
+typedef int Integer;
+
+template class ClassTmpl<Integer, Integer>;
+
+void f(ClassTmpl<float, Integer> p);
+
+template<typename T>
+void g(ClassTmpl<T, T>);
+
+template<> void g<int>(ClassTmpl<int, int>);
+
+// RUN: c-index-test -test-load-source all-display %s | FileCheck %s
+// CHECK: print-display-names.cpp:2:7: ClassTemplate=ClassTmpl<T, typename>:2:7
+// CHECK: print-display-names.cpp:6:16: ClassDecl=ClassTmpl<Integer, Integer>:6:16 (Definition)
+// CHECK: print-display-names.cpp:8:6: FunctionDecl=f(ClassTmpl<float, Integer>):8:6
+// CHECK: print-display-names.cpp:11:6: FunctionTemplate=g(ClassTmpl<T, T>):11:6
+// CHECK: print-display-names.cpp:13:17: FunctionDecl=g<>(ClassTmpl<int, int>):13:17 [Specialization of g:11:6]
diff --git a/test/Index/print-typekind.c b/test/Index/print-typekind.c
index 18189c3c74ac..30bd409b090f 100644
--- a/test/Index/print-typekind.c
+++ b/test/Index/print-typekind.c
@@ -1,9 +1,10 @@
typedef int FooType;
int *p;
int *f(int *p, char *x, FooType z) {
- FooType w = z;
+ const FooType w = z;
return p + z;
}
+typedef double OtherType;
// RUN: c-index-test -test-print-typekind %s | FileCheck %s
// CHECK: TypedefDecl=FooType:1:13 (Definition) typekind=Typedef [canonical=Int] [isPOD=1]
@@ -12,14 +13,15 @@ int *f(int *p, char *x, FooType z) {
// CHECK: ParmDecl=p:3:13 (Definition) typekind=Pointer [isPOD=1]
// CHECK: ParmDecl=x:3:22 (Definition) typekind=Pointer [isPOD=1]
// CHECK: ParmDecl=z:3:33 (Definition) typekind=Typedef [canonical=Int] [isPOD=1]
-// CHECK: TypeRef=FooType:1:13 typekind=Invalid [isPOD=0]
+// CHECK: TypeRef=FooType:1:13 typekind=Typedef [canonical=Int] [isPOD=1]
// CHECK: UnexposedStmt= typekind=Invalid [isPOD=0]
// CHECK: UnexposedStmt= typekind=Invalid [isPOD=0]
-// CHECK: VarDecl=w:4:11 (Definition) typekind=Typedef [canonical=Int] [isPOD=1]
-// CHECK: TypeRef=FooType:1:13 typekind=Invalid [isPOD=0]
+// CHECK: VarDecl=w:4:17 (Definition) typekind=Typedef const [canonical=Int] [isPOD=1]
+// CHECK: TypeRef=FooType:1:13 typekind=Typedef [canonical=Int] [isPOD=1]
// CHECK: DeclRefExpr=z:3:33 typekind=Typedef [canonical=Int] [isPOD=1]
// CHECK: UnexposedStmt= typekind=Invalid [isPOD=0]
// CHECK: UnexposedExpr= typekind=Pointer [isPOD=1]
// CHECK: DeclRefExpr=p:3:13 typekind=Pointer [isPOD=1]
// CHECK: DeclRefExpr=z:3:33 typekind=Typedef [canonical=Int] [isPOD=1]
+// CHECK: TypedefDecl=OtherType:7:16 (Definition) typekind=Typedef [canonical=Double] [isPOD=1]
diff --git a/test/Index/properties-class-extensions.m b/test/Index/properties-class-extensions.m
index 8bca37e7c9de..ecedc60c821d 100644
--- a/test/Index/properties-class-extensions.m
+++ b/test/Index/properties-class-extensions.m
@@ -3,26 +3,97 @@
// @interface (where we have a duplicate declaration - to be removed).
@interface Foo {} @end
@interface Foo (Cat)
- @property int a;
+@property int a;
@end
@interface Foo ()
- @property int b;
- - (void) bar;
+@property int b;
+- (void) bar;
+@end
+
+// Test that 'setter' methods defined by @property in the class extension
+// but not the in @interface are only presented in the class extension.
+@interface Bar
+@property (readonly) id bar;
+@end
+@interface Bar ()
+@property (readwrite) id bar;
+@end
+
+// Another test, this one involving protocols, where the @property should
+// not appear in the @interface.
+@class Rdar8467189_Bar;
+@protocol Rdar8467189_FooProtocol
+@property (readonly) Rdar8467189_Bar *Rdar8467189_Bar;
+@end
+@interface Rdar8467189_Foo <Rdar8467189_FooProtocol>
+@end
+@interface Rdar8467189_Foo ()
+@property (readwrite) Rdar8467189_Bar *Rdar8467189_Bar;
+@end
+
+// Test if the @property added in an extension is not reported in the @interface.
+@interface Qux
+@end
+@interface Qux ()
+@property (assign, readwrite) id qux;
+@end
+
+@implementation Qux
+@dynamic qux;
@end
// RUN: c-index-test -test-load-source local %s | FileCheck %s
// CHECK: properties-class-extensions.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 4:23]
+// CHECK-NOT: properties-class-extensions.m:9:15: ObjCInstanceMethodDecl=setB::9:15 Extent=[9:15 - 9:16]
+// CHECK-NOT: properties-class-extensions.m:9:15: ParmDecl=b:9:15 (Definition) Extent=[9:15 - 9:16]
// CHECK: properties-class-extensions.m:5:12: ObjCCategoryDecl=Cat:5:12 Extent=[5:1 - 7:5]
// CHECK: properties-class-extensions.m:5:12: ObjCClassRef=Foo:4:12 Extent=[5:12 - 5:15]
-// CHECK: properties-class-extensions.m:6:17: ObjCPropertyDecl=a:6:17 Extent=[6:17 - 6:18]
-// CHECK: properties-class-extensions.m:6:17: ObjCInstanceMethodDecl=a:6:17 Extent=[6:17 - 6:18]
-// CHECK: properties-class-extensions.m:6:17: ObjCInstanceMethodDecl=setA::6:17 Extent=[6:17 - 6:18]
-// CHECK: properties-class-extensions.m:6:17: ParmDecl=a:6:17 (Definition) Extent=[6:17 - 6:18]
+// CHECK: properties-class-extensions.m:6:15: ObjCPropertyDecl=a:6:15 Extent=[6:1 - 6:16]
+// CHECK: properties-class-extensions.m:6:15: ObjCInstanceMethodDecl=a:6:15 Extent=[6:15 - 6:16]
+// CHECK: properties-class-extensions.m:6:15: ObjCInstanceMethodDecl=setA::6:15 Extent=[6:15 - 6:16]
+// CHECK: properties-class-extensions.m:6:15: ParmDecl=a:6:15 (Definition) Extent=[6:15 - 6:16]
// CHECK: properties-class-extensions.m:8:12: ObjCCategoryDecl=:8:12 Extent=[8:1 - 11:5]
// CHECK: properties-class-extensions.m:8:12: ObjCClassRef=Foo:4:12 Extent=[8:12 - 8:15]
-// CHECK: properties-class-extensions.m:9:17: ObjCPropertyDecl=b:9:17 Extent=[9:17 - 9:18]
-// CHECK: properties-class-extensions.m:9:17: ObjCInstanceMethodDecl=b:9:17 Extent=[9:17 - 9:18]
-// CHECK: properties-class-extensions.m:9:17: ObjCInstanceMethodDecl=setB::9:17 Extent=[9:17 - 9:18]
-// CHECK: properties-class-extensions.m:9:17: ParmDecl=b:9:17 (Definition) Extent=[9:17 - 9:18]
-// CHECK: properties-class-extensions.m:10:3: ObjCInstanceMethodDecl=bar:10:3 Extent=[10:3 - 10:16]
+// CHECK: properties-class-extensions.m:9:15: ObjCPropertyDecl=b:9:15 Extent=[9:1 - 9:16]
+// CHECK: properties-class-extensions.m:9:15: ObjCInstanceMethodDecl=b:9:15 Extent=[9:15 - 9:16]
+// CHECK: properties-class-extensions.m:9:15: ObjCInstanceMethodDecl=setB::9:15 Extent=[9:15 - 9:16]
+// CHECK: properties-class-extensions.m:9:15: ParmDecl=b:9:15 (Definition) Extent=[9:15 - 9:16]
+// CHECK: properties-class-extensions.m:10:1: ObjCInstanceMethodDecl=bar:10:1 Extent=[10:1 - 10:14]
+// CHECK: properties-class-extensions.m:15:12: ObjCInterfaceDecl=Bar:15:12 Extent=[15:1 - 17:5]
+// CHECK: properties-class-extensions.m:16:25: ObjCPropertyDecl=bar:16:25 Extent=[16:1 - 16:28]
+// CHECK: properties-class-extensions.m:16:22: TypeRef=id:0:0 Extent=[16:22 - 16:24]
+// CHECK: properties-class-extensions.m:16:25: ObjCInstanceMethodDecl=bar:16:25 Extent=[16:25 - 16:28]
+// CHECK: properties-class-extensions.m:18:12: ObjCCategoryDecl=:18:12 Extent=[18:1 - 20:5]
+// CHECK: properties-class-extensions.m:18:12: ObjCClassRef=Bar:15:12 Extent=[18:12 - 18:15]
+// CHECK: properties-class-extensions.m:19:26: ObjCPropertyDecl=bar:19:26 Extent=[19:1 - 19:29]
+// CHECK: properties-class-extensions.m:19:23: TypeRef=id:0:0 Extent=[19:23 - 19:25]
+// CHECK-NOT: properties-class-extensions.m:16:25: ObjCInstanceMethodDecl=bar:16:25 Extent=[16:25 - 16:28]
+// CHECK: properties-class-extensions.m:19:26: ObjCInstanceMethodDecl=setBar::19:26 Extent=[19:26 - 19:29]
+// CHECK: properties-class-extensions.m:19:26: ParmDecl=bar:19:26 (Definition) Extent=[19:26 - 19:29]
+// CHECK: properties-class-extensions.m:24:1: UnexposedDecl=[24:8] Extent=[24:1 - 24:23]
+// CHECK: properties-class-extensions.m:24:8: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[24:8 - 24:23]
+// CHECK: properties-class-extensions.m:25:1: ObjCProtocolDecl=Rdar8467189_FooProtocol:25:1 (Definition) Extent=[25:1 - 27:5]
+// CHECK: properties-class-extensions.m:26:39: ObjCPropertyDecl=Rdar8467189_Bar:26:39 Extent=[26:1 - 26:54]
+// CHECK: properties-class-extensions.m:26:22: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[26:22 - 26:37]
+// CHECK: properties-class-extensions.m:26:39: ObjCInstanceMethodDecl=Rdar8467189_Bar:26:39 Extent=[26:39 - 26:54]
+// CHECK: properties-class-extensions.m:28:12: ObjCInterfaceDecl=Rdar8467189_Foo:28:12 Extent=[28:1 - 29:5]
+// CHECK: properties-class-extensions.m:28:29: ObjCProtocolRef=Rdar8467189_FooProtocol:25:1 Extent=[28:29 - 28:52]
+// CHECK-NOT: properties-class-extensions.m:31:40: ObjCPropertyDecl=Rdar8467189_Bar:31:40 Extent=[31:40 - 31:55]
+// CHECK-NOT: properties-class-extensions.m:31:23: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[31:23 - 31:38]
+// CHECK: properties-class-extensions.m:30:12: ObjCCategoryDecl=:30:12 Extent=[30:1 - 32:5]
+// CHECK: properties-class-extensions.m:30:12: ObjCClassRef=Rdar8467189_Foo:28:12 Extent=[30:12 - 30:27]
+// CHECK: properties-class-extensions.m:31:40: ObjCPropertyDecl=Rdar8467189_Bar:31:40 Extent=[31:1 - 31:55]
+// CHECK: properties-class-extensions.m:31:23: ObjCClassRef=Rdar8467189_Bar:24:8 Extent=[31:23 - 31:38]
+// CHECK: properties-class-extensions.m:31:40: ObjCInstanceMethodDecl=Rdar8467189_Bar:31:40 [Overrides @26:39] Extent=[31:40 - 31:55]
+// CHECK: properties-class-extensions.m:31:40: ObjCInstanceMethodDecl=setRdar8467189_Bar::31:40 Extent=[31:40 - 31:55]
+// CHECK: properties-class-extensions.m:31:40: ParmDecl=Rdar8467189_Bar:31:40 (Definition) Extent=[31:40 - 31:55]
+// CHECK: properties-class-extensions.m:35:12: ObjCInterfaceDecl=Qux:35:12 Extent=[35:1 - 36:5]
+// CHECK: properties-class-extensions.m:37:12: ObjCCategoryDecl=:37:12 Extent=[37:1 - 39:5]
+// CHECK: properties-class-extensions.m:37:12: ObjCClassRef=Qux:35:12 Extent=[37:12 - 37:15]
+// CHECK: properties-class-extensions.m:38:34: ObjCPropertyDecl=qux:38:34 Extent=[38:1 - 38:37]
+// CHECK: properties-class-extensions.m:38:31: TypeRef=id:0:0 Extent=[38:31 - 38:33]
+// CHECK: properties-class-extensions.m:38:34: ObjCInstanceMethodDecl=qux:38:34 Extent=[38:34 - 38:37]
+// CHECK: properties-class-extensions.m:38:34: ObjCInstanceMethodDecl=setQux::38:34 Extent=[38:34 - 38:37]
+// CHECK: properties-class-extensions.m:38:34: ParmDecl=qux:38:34 (Definition) Extent=[38:34 - 38:37]
+// CHECK: properties-class-extensions.m:42:10: UnexposedDecl=qux:38:34 (Definition) Extent=[42:1 - 42:13]
diff --git a/test/Index/recursive-cxx-member-calls.cpp b/test/Index/recursive-cxx-member-calls.cpp
new file mode 100644
index 000000000000..1707491af03e
--- /dev/null
+++ b/test/Index/recursive-cxx-member-calls.cpp
@@ -0,0 +1,2246 @@
+typedef long unsigned int __darwin_size_t;
+typedef __darwin_size_t size_t;
+namespace std {
+ template < class _T1, class _T2 > struct pair { _T2 second; };
+}
+extern "C" {
+ int memcmp(const void *, const void *, size_t);
+ size_t strlen(const char *);
+}
+namespace clang {
+ class IdentifierInfo;
+ class AttributeList {
+ enum Kind {
+ AT_IBAction, AT_IBOutlet, AT_IBOutletCollection,
+ AT_address_space, AT_alias, AT_aligned, AT_always_inline,
+ AT_analyzer_noreturn, AT_annotate, AT_base_check, AT_blocks,
+ AT_carries_dependency, AT_cdecl, AT_cleanup, AT_const, AT_constructor,
+ AT_deprecated, AT_destructor, AT_dllexport, AT_dllimport,
+ AT_ext_vector_type, AT_fastcall, AT_final, AT_format, AT_format_arg,
+ AT_gnu_inline, AT_hiding, AT_malloc, AT_mode, AT_naked, AT_nodebug,
+ AT_noinline, AT_no_instrument_function, AT_nonnull, AT_noreturn,
+ AT_nothrow, AT_nsobject, AT_objc_exception, AT_override,
+ AT_cf_returns_not_retained, AT_cf_returns_retained,
+ AT_ns_returns_not_retained, AT_ns_returns_retained, AT_objc_gc,
+ AT_overloadable, AT_ownership_holds, AT_ownership_returns,
+ AT_ownership_takes, AT_packed, AT_pascal, AT_pure, AT_regparm,
+ AT_section, AT_sentinel, AT_stdcall, AT_thiscall, AT_transparent_union,
+ AT_unavailable, AT_unused, AT_used, AT_vecreturn, AT_vector_size,
+ AT_visibility, AT_warn_unused_result, AT_weak, AT_weakref,
+ AT_weak_import, AT_reqd_wg_size, AT_init_priority,
+ IgnoredAttribute, UnknownAttribute
+ };
+ static Kind getKind(const IdentifierInfo * Name);
+ };
+}
+size_t magic_length(const char *s);
+namespace llvm {
+class StringRef {
+public:
+ typedef const char *iterator;
+ static const size_t npos = ~size_t(0);
+private:
+ const char *Data;
+ size_t Length;
+ static size_t min(size_t a, size_t b) { return a < b ? a : b; }
+public:
+ StringRef(): Data(0), Length(0) {}
+ StringRef(const char *Str) : Data(Str), Length(magic_length(Str)) {}
+ StringRef(const char *data, size_t length) : Data(data), Length(length) {}
+ iterator end() const { return Data; }
+ size_t size() const { return Length; }
+ bool startswith(StringRef Prefix) const {
+ return Length >= Prefix.Length &&
+ memcmp(Data, Prefix.Data, Prefix.Length) == 0;
+ }
+ bool endswith(StringRef Suffix) const {
+ return Length >= Suffix.Length &&
+ memcmp(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0;
+ }
+ StringRef substr(size_t Start, size_t N = npos) const {
+ return StringRef(Data + Start, min(N, Length - Start));
+ }
+};
+}
+namespace clang {
+class IdentifierInfo {
+public:IdentifierInfo();
+ const char *getNameStart() const {
+ typedef std::pair < IdentifierInfo, const char *>actualtype;
+ return ((const actualtype *) this)->second;
+ }
+ unsigned getLength() const {
+ typedef std::pair < IdentifierInfo, const char *>actualtype;
+ const char *p = ((const actualtype *) this)->second - 2;
+ return (((unsigned) p[0]) | (((unsigned) p[1]) << 8)) - 1;
+ }
+ llvm::StringRef getName() const {
+ return llvm::StringRef(getNameStart(), getLength());
+ }
+};
+}
+namespace llvm {
+template < typename T, typename R = T > class StringSwitch {
+ StringRef Str;
+ const T *Result;
+public:
+ explicit StringSwitch(StringRef Str) : Str(Str), Result(0) {}
+ template < unsigned N > StringSwitch & Case(const char (&S)[N],
+ const T & Value) {
+ return *this;
+ }
+ R Default(const T & Value) const {
+ return Value;
+ }
+};
+}
+
+using namespace clang;
+
+AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) {
+ llvm::StringRef AttrName = Name->getName();
+ if (AttrName.startswith("__") && AttrName.endswith("__"))
+ AttrName = AttrName.substr(2, AttrName.size() - 4);
+
+ return llvm::StringSwitch < AttributeList::Kind > (AttrName)
+ .Case("weak", AT_weak)
+ .Case("weakref", AT_weakref)
+ .Case("pure", AT_pure)
+ .Case("mode", AT_mode)
+ .Case("used", AT_used)
+ .Case("alias", AT_alias)
+ .Case("align", AT_aligned)
+ .Case("final", AT_final)
+ .Case("cdecl", AT_cdecl)
+ .Case("const", AT_const)
+ .Case("__const", AT_const)
+ .Case("blocks", AT_blocks)
+ .Case("format", AT_format)
+ .Case("hiding", AT_hiding)
+ .Case("malloc", AT_malloc)
+ .Case("packed", AT_packed)
+ .Case("unused", AT_unused)
+ .Case("aligned", AT_aligned)
+ .Case("cleanup", AT_cleanup)
+ .Case("naked", AT_naked)
+ .Case("nodebug", AT_nodebug)
+ .Case("nonnull", AT_nonnull)
+ .Case("nothrow", AT_nothrow)
+ .Case("objc_gc", AT_objc_gc)
+ .Case("regparm", AT_regparm)
+ .Case("section", AT_section)
+ .Case("stdcall", AT_stdcall)
+ .Case("annotate", AT_annotate)
+ .Case("fastcall", AT_fastcall)
+ .Case("ibaction", AT_IBAction)
+ .Case("iboutlet", AT_IBOutlet)
+ .Case("iboutletcollection", AT_IBOutletCollection)
+ .Case("noreturn", AT_noreturn)
+ .Case("noinline", AT_noinline)
+ .Case("override", AT_override)
+ .Case("sentinel", AT_sentinel)
+ .Case("NSObject", AT_nsobject)
+ .Case("dllimport", AT_dllimport)
+ .Case("dllexport", AT_dllexport)
+ .Case("may_alias", IgnoredAttribute)
+ .Case("base_check", AT_base_check)
+ .Case("deprecated", AT_deprecated)
+ .Case("visibility", AT_visibility)
+ .Case("destructor", AT_destructor)
+ .Case("format_arg", AT_format_arg)
+ .Case("gnu_inline", AT_gnu_inline)
+ .Case("weak_import", AT_weak_import)
+ .Case("vecreturn", AT_vecreturn)
+ .Case("vector_size", AT_vector_size)
+ .Case("constructor", AT_constructor)
+ .Case("unavailable", AT_unavailable)
+ .Case("overloadable", AT_overloadable)
+ .Case("address_space", AT_address_space)
+ .Case("always_inline", AT_always_inline)
+ .Case("returns_twice", IgnoredAttribute)
+ .Case("vec_type_hint", IgnoredAttribute)
+ .Case("objc_exception", AT_objc_exception)
+ .Case("ext_vector_type", AT_ext_vector_type)
+ .Case("transparent_union", AT_transparent_union)
+ .Case("analyzer_noreturn", AT_analyzer_noreturn)
+ .Case("warn_unused_result", AT_warn_unused_result)
+ .Case("carries_dependency", AT_carries_dependency)
+ .Case("ns_returns_not_retained", AT_ns_returns_not_retained)
+ .Case("ns_returns_retained", AT_ns_returns_retained)
+ .Case("cf_returns_not_retained", AT_cf_returns_not_retained)
+ .Case("cf_returns_retained", AT_cf_returns_retained)
+ .Case("ownership_returns", AT_ownership_returns)
+ .Case("ownership_holds", AT_ownership_holds)
+ .Case("ownership_takes", AT_ownership_takes)
+ .Case("reqd_work_group_size", AT_reqd_wg_size)
+ .Case("init_priority", AT_init_priority)
+ .Case("no_instrument_function", AT_no_instrument_function)
+ .Case("thiscall", AT_thiscall)
+ .Case("pascal", AT_pascal)
+ .Case("__cdecl", AT_cdecl)
+ .Case("__stdcall", AT_stdcall)
+ .Case("__fastcall", AT_fastcall)
+ .Case("__thiscall", AT_thiscall)
+ .Case("__pascal", AT_pascal)
+ .Default(UnknownAttribute);
+}
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:186:1 %s 2>&1 | FileCheck -check-prefix=CHECK-tokens %s
+// CHECK-tokens: Keyword: "typedef" [1:1 - 1:8]
+// CHECK-tokens: Keyword: "long" [1:9 - 1:13]
+// CHECK-tokens: Keyword: "unsigned" [1:14 - 1:22]
+// CHECK-tokens: Keyword: "int" [1:23 - 1:26]
+// CHECK-tokens: Identifier: "__darwin_size_t" [1:27 - 1:42] TypedefDecl=__darwin_size_t:1:27 (Definition)
+// CHECK-tokens: Punctuation: ";" [1:42 - 1:43]
+// CHECK-tokens: Keyword: "typedef" [2:1 - 2:8]
+// CHECK-tokens: Identifier: "__darwin_size_t" [2:9 - 2:24]
+// CHECK-tokens: Identifier: "size_t" [2:25 - 2:31] TypedefDecl=size_t:2:25 (Definition)
+// CHECK-tokens: Punctuation: ";" [2:31 - 2:32]
+// CHECK-tokens: Keyword: "namespace" [3:1 - 3:10]
+// CHECK-tokens: Identifier: "std" [3:11 - 3:14] Namespace=std:3:11 (Definition)
+// 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: 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: 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: "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)
+// CHECK-tokens: Punctuation: ";" [4:64 - 4:65] Namespace=std:3:11 (Definition)
+// CHECK-tokens: Punctuation: "}" [5:1 - 5:2] Namespace=std:3:11 (Definition)
+// CHECK-tokens: Keyword: "extern" [6:1 - 6:7]
+// CHECK-tokens: Literal: ""C"" [6:8 - 6:11] UnexposedDecl=:6:8 (Definition)
+// CHECK-tokens: Punctuation: "{" [6:12 - 6:13] UnexposedDecl=:6:8 (Definition)
+// CHECK-tokens: Keyword: "int" [7:3 - 7:6] FunctionDecl=memcmp:7:7
+// CHECK-tokens: Identifier: "memcmp" [7:7 - 7:13] FunctionDecl=memcmp:7:7
+// CHECK-tokens: Punctuation: "(" [7:13 - 7:14] FunctionDecl=memcmp:7:7
+// CHECK-tokens: Keyword: "const" [7:14 - 7:19] FunctionDecl=memcmp:7:7
+// CHECK-tokens: Keyword: "void" [7:20 - 7:24] ParmDecl=:7:26 (Definition)
+// CHECK-tokens: Punctuation: "*" [7:25 - 7:26] ParmDecl=:7:26 (Definition)
+// CHECK-tokens: Punctuation: "," [7:26 - 7:27] ParmDecl=:7:26 (Definition)
+// CHECK-tokens: Keyword: "const" [7:28 - 7:33] FunctionDecl=memcmp:7:7
+// CHECK-tokens: Keyword: "void" [7:34 - 7:38] ParmDecl=:7:40 (Definition)
+// CHECK-tokens: Punctuation: "*" [7:39 - 7:40] ParmDecl=:7:40 (Definition)
+// CHECK-tokens: Punctuation: "," [7:40 - 7:41] ParmDecl=:7:40 (Definition)
+// CHECK-tokens: Identifier: "size_t" [7:42 - 7:48] TypeRef=size_t:2:25
+// CHECK-tokens: Punctuation: ")" [7:48 - 7:49] ParmDecl=:7:48 (Definition)
+// CHECK-tokens: Punctuation: ";" [7:49 - 7:50] UnexposedDecl=:6:8 (Definition)
+// CHECK-tokens: Identifier: "size_t" [8:3 - 8:9] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "strlen" [8:10 - 8:16] FunctionDecl=strlen:8:10
+// CHECK-tokens: Punctuation: "(" [8:16 - 8:17] FunctionDecl=strlen:8:10
+// CHECK-tokens: Keyword: "const" [8:17 - 8:22] FunctionDecl=strlen:8:10
+// CHECK-tokens: Keyword: "char" [8:23 - 8:27] ParmDecl=:8:29 (Definition)
+// CHECK-tokens: Punctuation: "*" [8:28 - 8:29] ParmDecl=:8:29 (Definition)
+// CHECK-tokens: Punctuation: ")" [8:29 - 8:30] ParmDecl=:8:29 (Definition)
+// CHECK-tokens: Punctuation: ";" [8:30 - 8:31]
+// CHECK-tokens: Punctuation: "}" [9:1 - 9:2]
+// CHECK-tokens: Keyword: "namespace" [10:1 - 10:10]
+// CHECK-tokens: Identifier: "clang" [10:17 - 10:22] Namespace=clang:10:17 (Definition)
+// CHECK-tokens: Punctuation: "{" [10:23 - 10:24] Namespace=clang:10:17 (Definition)
+// CHECK-tokens: Keyword: "class" [11:3 - 11:8] ClassDecl=IdentifierInfo:11:9
+// CHECK-tokens: Identifier: "IdentifierInfo" [11:9 - 11:23] ClassDecl=IdentifierInfo:11:9
+// CHECK-tokens: Punctuation: ";" [11:23 - 11:24] Namespace=clang:10:17 (Definition)
+// CHECK-tokens: Keyword: "class" [12:3 - 12:8] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Identifier: "AttributeList" [12:9 - 12:22] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Punctuation: "{" [12:23 - 12:24] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Keyword: "enum" [13:5 - 13:9] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "Kind" [13:10 - 13:14] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Punctuation: "{" [13:15 - 13:16] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_IBAction" [14:7 - 14:18] EnumConstantDecl=AT_IBAction:14:7 (Definition)
+// CHECK-tokens: Punctuation: "," [14:18 - 14:19] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_IBOutlet" [14:20 - 14:31] EnumConstantDecl=AT_IBOutlet:14:20 (Definition)
+// CHECK-tokens: Punctuation: "," [14:31 - 14:32] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_IBOutletCollection" [14:33 - 14:54] EnumConstantDecl=AT_IBOutletCollection:14:33 (Definition)
+// CHECK-tokens: Punctuation: "," [14:54 - 14:55] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_address_space" [15:7 - 15:23] EnumConstantDecl=AT_address_space:15:7 (Definition)
+// CHECK-tokens: Punctuation: "," [15:23 - 15:24] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_alias" [15:25 - 15:33] EnumConstantDecl=AT_alias:15:25 (Definition)
+// CHECK-tokens: Punctuation: "," [15:33 - 15:34] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_aligned" [15:35 - 15:45] EnumConstantDecl=AT_aligned:15:35 (Definition)
+// CHECK-tokens: Punctuation: "," [15:45 - 15:46] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_always_inline" [15:47 - 15:63] EnumConstantDecl=AT_always_inline:15:47 (Definition)
+// CHECK-tokens: Punctuation: "," [15:63 - 15:64] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_analyzer_noreturn" [16:7 - 16:27] EnumConstantDecl=AT_analyzer_noreturn:16:7 (Definition)
+// CHECK-tokens: Punctuation: "," [16:27 - 16:28] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_annotate" [16:29 - 16:40] EnumConstantDecl=AT_annotate:16:29 (Definition)
+// CHECK-tokens: Punctuation: "," [16:40 - 16:41] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_base_check" [16:42 - 16:55] EnumConstantDecl=AT_base_check:16:42 (Definition)
+// CHECK-tokens: Punctuation: "," [16:55 - 16:56] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_blocks" [16:57 - 16:66] EnumConstantDecl=AT_blocks:16:57 (Definition)
+// CHECK-tokens: Punctuation: "," [16:66 - 16:67] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_carries_dependency" [17:7 - 17:28] EnumConstantDecl=AT_carries_dependency:17:7 (Definition)
+// CHECK-tokens: Punctuation: "," [17:28 - 17:29] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_cdecl" [17:30 - 17:38] EnumConstantDecl=AT_cdecl:17:30 (Definition)
+// CHECK-tokens: Punctuation: "," [17:38 - 17:39] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_cleanup" [17:40 - 17:50] EnumConstantDecl=AT_cleanup:17:40 (Definition)
+// CHECK-tokens: Punctuation: "," [17:50 - 17:51] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_const" [17:52 - 17:60] EnumConstantDecl=AT_const:17:52 (Definition)
+// CHECK-tokens: Punctuation: "," [17:60 - 17:61] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_constructor" [17:62 - 17:76] EnumConstantDecl=AT_constructor:17:62 (Definition)
+// CHECK-tokens: Punctuation: "," [17:76 - 17:77] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_deprecated" [18:7 - 18:20] EnumConstantDecl=AT_deprecated:18:7 (Definition)
+// CHECK-tokens: Punctuation: "," [18:20 - 18:21] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_destructor" [18:22 - 18:35] EnumConstantDecl=AT_destructor:18:22 (Definition)
+// CHECK-tokens: Punctuation: "," [18:35 - 18:36] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_dllexport" [18:37 - 18:49] EnumConstantDecl=AT_dllexport:18:37 (Definition)
+// CHECK-tokens: Punctuation: "," [18:49 - 18:50] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_dllimport" [18:51 - 18:63] EnumConstantDecl=AT_dllimport:18:51 (Definition)
+// CHECK-tokens: Punctuation: "," [18:63 - 18:64] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_ext_vector_type" [19:7 - 19:25] EnumConstantDecl=AT_ext_vector_type:19:7 (Definition)
+// CHECK-tokens: Punctuation: "," [19:25 - 19:26] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_fastcall" [19:27 - 19:38] EnumConstantDecl=AT_fastcall:19:27 (Definition)
+// CHECK-tokens: Punctuation: "," [19:38 - 19:39] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_final" [19:40 - 19:48] EnumConstantDecl=AT_final:19:40 (Definition)
+// CHECK-tokens: Punctuation: "," [19:48 - 19:49] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_format" [19:50 - 19:59] EnumConstantDecl=AT_format:19:50 (Definition)
+// CHECK-tokens: Punctuation: "," [19:59 - 19:60] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_format_arg" [19:61 - 19:74] EnumConstantDecl=AT_format_arg:19:61 (Definition)
+// CHECK-tokens: Punctuation: "," [19:74 - 19:75] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_gnu_inline" [20:7 - 20:20] EnumConstantDecl=AT_gnu_inline:20:7 (Definition)
+// CHECK-tokens: Punctuation: "," [20:20 - 20:21] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_hiding" [20:22 - 20:31] EnumConstantDecl=AT_hiding:20:22 (Definition)
+// CHECK-tokens: Punctuation: "," [20:31 - 20:32] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_malloc" [20:33 - 20:42] EnumConstantDecl=AT_malloc:20:33 (Definition)
+// CHECK-tokens: Punctuation: "," [20:42 - 20:43] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_mode" [20:44 - 20:51] EnumConstantDecl=AT_mode:20:44 (Definition)
+// CHECK-tokens: Punctuation: "," [20:51 - 20:52] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_naked" [20:53 - 20:61] EnumConstantDecl=AT_naked:20:53 (Definition)
+// CHECK-tokens: Punctuation: "," [20:61 - 20:62] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_nodebug" [20:63 - 20:73] EnumConstantDecl=AT_nodebug:20:63 (Definition)
+// CHECK-tokens: Punctuation: "," [20:73 - 20:74] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_noinline" [21:7 - 21:18] EnumConstantDecl=AT_noinline:21:7 (Definition)
+// CHECK-tokens: Punctuation: "," [21:18 - 21:19] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_no_instrument_function" [21:20 - 21:45] EnumConstantDecl=AT_no_instrument_function:21:20 (Definition)
+// CHECK-tokens: Punctuation: "," [21:45 - 21:46] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_nonnull" [21:47 - 21:57] EnumConstantDecl=AT_nonnull:21:47 (Definition)
+// CHECK-tokens: Punctuation: "," [21:57 - 21:58] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_noreturn" [21:59 - 21:70] EnumConstantDecl=AT_noreturn:21:59 (Definition)
+// CHECK-tokens: Punctuation: "," [21:70 - 21:71] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_nothrow" [22:7 - 22:17] EnumConstantDecl=AT_nothrow:22:7 (Definition)
+// CHECK-tokens: Punctuation: "," [22:17 - 22:18] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_nsobject" [22:19 - 22:30] EnumConstantDecl=AT_nsobject:22:19 (Definition)
+// CHECK-tokens: Punctuation: "," [22:30 - 22:31] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_objc_exception" [22:32 - 22:49] EnumConstantDecl=AT_objc_exception:22:32 (Definition)
+// CHECK-tokens: Punctuation: "," [22:49 - 22:50] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_override" [22:51 - 22:62] EnumConstantDecl=AT_override:22:51 (Definition)
+// CHECK-tokens: Punctuation: "," [22:62 - 22:63] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_cf_returns_not_retained" [23:7 - 23:33] EnumConstantDecl=AT_cf_returns_not_retained:23:7 (Definition)
+// CHECK-tokens: Punctuation: "," [23:33 - 23:34] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_cf_returns_retained" [23:35 - 23:57] EnumConstantDecl=AT_cf_returns_retained:23:35 (Definition)
+// CHECK-tokens: Punctuation: "," [23:57 - 23:58] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_ns_returns_not_retained" [24:7 - 24:33] EnumConstantDecl=AT_ns_returns_not_retained:24:7 (Definition)
+// CHECK-tokens: Punctuation: "," [24:33 - 24:34] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_ns_returns_retained" [24:35 - 24:57] EnumConstantDecl=AT_ns_returns_retained:24:35 (Definition)
+// CHECK-tokens: Punctuation: "," [24:57 - 24:58] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_objc_gc" [24:59 - 24:69] EnumConstantDecl=AT_objc_gc:24:59 (Definition)
+// CHECK-tokens: Punctuation: "," [24:69 - 24:70] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_overloadable" [25:7 - 25:22] EnumConstantDecl=AT_overloadable:25:7 (Definition)
+// CHECK-tokens: Punctuation: "," [25:22 - 25:23] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_ownership_holds" [25:24 - 25:42] EnumConstantDecl=AT_ownership_holds:25:24 (Definition)
+// CHECK-tokens: Punctuation: "," [25:42 - 25:43] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_ownership_returns" [25:44 - 25:64] EnumConstantDecl=AT_ownership_returns:25:44 (Definition)
+// CHECK-tokens: Punctuation: "," [25:64 - 25:65] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_ownership_takes" [26:7 - 26:25] EnumConstantDecl=AT_ownership_takes:26:7 (Definition)
+// CHECK-tokens: Punctuation: "," [26:25 - 26:26] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_packed" [26:27 - 26:36] EnumConstantDecl=AT_packed:26:27 (Definition)
+// CHECK-tokens: Punctuation: "," [26:36 - 26:37] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_pascal" [26:38 - 26:47] EnumConstantDecl=AT_pascal:26:38 (Definition)
+// CHECK-tokens: Punctuation: "," [26:47 - 26:48] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_pure" [26:49 - 26:56] EnumConstantDecl=AT_pure:26:49 (Definition)
+// CHECK-tokens: Punctuation: "," [26:56 - 26:57] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_regparm" [26:58 - 26:68] EnumConstantDecl=AT_regparm:26:58 (Definition)
+// CHECK-tokens: Punctuation: "," [26:68 - 26:69] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_section" [27:7 - 27:17] EnumConstantDecl=AT_section:27:7 (Definition)
+// CHECK-tokens: Punctuation: "," [27:17 - 27:18] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_sentinel" [27:19 - 27:30] EnumConstantDecl=AT_sentinel:27:19 (Definition)
+// CHECK-tokens: Punctuation: "," [27:30 - 27:31] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_stdcall" [27:32 - 27:42] EnumConstantDecl=AT_stdcall:27:32 (Definition)
+// CHECK-tokens: Punctuation: "," [27:42 - 27:43] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_thiscall" [27:44 - 27:55] EnumConstantDecl=AT_thiscall:27:44 (Definition)
+// CHECK-tokens: Punctuation: "," [27:55 - 27:56] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_transparent_union" [27:57 - 27:77] EnumConstantDecl=AT_transparent_union:27:57 (Definition)
+// CHECK-tokens: Punctuation: "," [27:77 - 27:78] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_unavailable" [28:7 - 28:21] EnumConstantDecl=AT_unavailable:28:7 (Definition)
+// CHECK-tokens: Punctuation: "," [28:21 - 28:22] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_unused" [28:23 - 28:32] EnumConstantDecl=AT_unused:28:23 (Definition)
+// CHECK-tokens: Punctuation: "," [28:32 - 28:33] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_used" [28:34 - 28:41] EnumConstantDecl=AT_used:28:34 (Definition)
+// CHECK-tokens: Punctuation: "," [28:41 - 28:42] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_vecreturn" [28:43 - 28:55] EnumConstantDecl=AT_vecreturn:28:43 (Definition)
+// CHECK-tokens: Punctuation: "," [28:55 - 28:56] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_vector_size" [28:57 - 28:71] EnumConstantDecl=AT_vector_size:28:57 (Definition)
+// CHECK-tokens: Punctuation: "," [28:71 - 28:72] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_visibility" [29:7 - 29:20] EnumConstantDecl=AT_visibility:29:7 (Definition)
+// CHECK-tokens: Punctuation: "," [29:20 - 29:21] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_warn_unused_result" [29:22 - 29:43] EnumConstantDecl=AT_warn_unused_result:29:22 (Definition)
+// CHECK-tokens: Punctuation: "," [29:43 - 29:44] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_weak" [29:45 - 29:52] EnumConstantDecl=AT_weak:29:45 (Definition)
+// CHECK-tokens: Punctuation: "," [29:52 - 29:53] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_weakref" [29:54 - 29:64] EnumConstantDecl=AT_weakref:29:54 (Definition)
+// CHECK-tokens: Punctuation: "," [29:64 - 29:65] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_weak_import" [30:7 - 30:21] EnumConstantDecl=AT_weak_import:30:7 (Definition)
+// CHECK-tokens: Punctuation: "," [30:21 - 30:22] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_reqd_wg_size" [30:23 - 30:38] EnumConstantDecl=AT_reqd_wg_size:30:23 (Definition)
+// CHECK-tokens: Punctuation: "," [30:38 - 30:39] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "AT_init_priority" [30:40 - 30:56] EnumConstantDecl=AT_init_priority:30:40 (Definition)
+// CHECK-tokens: Punctuation: "," [30:56 - 30:57] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "IgnoredAttribute" [31:7 - 31:23] EnumConstantDecl=IgnoredAttribute:31:7 (Definition)
+// CHECK-tokens: Punctuation: "," [31:23 - 31:24] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Identifier: "UnknownAttribute" [31:25 - 31:41] EnumConstantDecl=UnknownAttribute:31:25 (Definition)
+// CHECK-tokens: Punctuation: "}" [32:5 - 32:6] EnumDecl=Kind:13:10 (Definition)
+// CHECK-tokens: Punctuation: ";" [32:6 - 32:7] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Keyword: "static" [33:5 - 33:11] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Identifier: "Kind" [33:12 - 33:16] TypeRef=enum clang::AttributeList::Kind:13:10
+// CHECK-tokens: Identifier: "getKind" [33:17 - 33:24] CXXMethod=getKind:33:17
+// CHECK-tokens: Punctuation: "(" [33:24 - 33:25] CXXMethod=getKind:33:17
+// CHECK-tokens: Keyword: "const" [33:25 - 33:30] CXXMethod=getKind:33:17
+// CHECK-tokens: Identifier: "IdentifierInfo" [33:31 - 33:45] TypeRef=class clang::IdentifierInfo:66:7
+// CHECK-tokens: Punctuation: "*" [33:46 - 33:47] ParmDecl=Name:33:48 (Definition)
+// CHECK-tokens: Identifier: "Name" [33:48 - 33:52] ParmDecl=Name:33:48 (Definition)
+// CHECK-tokens: Punctuation: ")" [33:52 - 33:53] CXXMethod=getKind:33:17
+// CHECK-tokens: Punctuation: ";" [33:53 - 33:54] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Punctuation: "}" [34:3 - 34:4] ClassDecl=AttributeList:12:9 (Definition)
+// CHECK-tokens: Punctuation: ";" [34:4 - 34:5] Namespace=clang:10:17 (Definition)
+// CHECK-tokens: Punctuation: "}" [35:1 - 35:2] Namespace=clang:10:17 (Definition)
+// CHECK-tokens: Identifier: "size_t" [36:1 - 36:7] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "magic_length" [36:8 - 36:20] FunctionDecl=magic_length:36:8
+// CHECK-tokens: Punctuation: "(" [36:20 - 36:21] FunctionDecl=magic_length:36:8
+// CHECK-tokens: Keyword: "const" [36:21 - 36:26] FunctionDecl=magic_length:36:8
+// CHECK-tokens: Keyword: "char" [36:27 - 36:31] ParmDecl=s:36:33 (Definition)
+// CHECK-tokens: Punctuation: "*" [36:32 - 36:33] ParmDecl=s:36:33 (Definition)
+// CHECK-tokens: Identifier: "s" [36:33 - 36:34] ParmDecl=s:36:33 (Definition)
+// CHECK-tokens: Punctuation: ")" [36:34 - 36:35] FunctionDecl=magic_length:36:8
+// CHECK-tokens: Punctuation: ";" [36:35 - 36:36]
+// CHECK-tokens: Keyword: "namespace" [37:1 - 37:10]
+// CHECK-tokens: Identifier: "llvm" [37:11 - 37:15] Namespace=llvm:37:11 (Definition)
+// CHECK-tokens: Punctuation: "{" [37:16 - 37:17] Namespace=llvm:37:11 (Definition)
+// CHECK-tokens: Keyword: "class" [38:1 - 38:6] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [38:7 - 38:16] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Punctuation: "{" [38:17 - 38:18] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Keyword: "public" [39:1 - 39:7] UnexposedDecl=:39:1 (Definition)
+// 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: 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)
+// CHECK-tokens: Keyword: "const" [41:10 - 41:15] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Identifier: "size_t" [41:16 - 41:22] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "npos" [41:23 - 41:27] VarDecl=npos:41:23
+// CHECK-tokens: Punctuation: "=" [41:28 - 41:29] VarDecl=npos:41:23
+// CHECK-tokens: Punctuation: "~" [41:30 - 41:31] UnexposedExpr=
+// CHECK-tokens: Identifier: "size_t" [41:31 - 41:37] TypeRef=size_t:2:25
+// CHECK-tokens: Punctuation: "(" [41:37 - 41:38] UnexposedExpr=
+// CHECK-tokens: Literal: "0" [41:38 - 41:39] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [41:39 - 41:40] UnexposedExpr=
+// CHECK-tokens: Punctuation: ";" [41:40 - 41:41] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Keyword: "private" [42:1 - 42:8] UnexposedDecl=:42:1 (Definition)
+// CHECK-tokens: Punctuation: ":" [42:8 - 42:9] UnexposedDecl=:42:1 (Definition)
+// CHECK-tokens: Keyword: "const" [43:3 - 43:8] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Keyword: "char" [43:9 - 43:13] FieldDecl=Data:43:15 (Definition)
+// CHECK-tokens: Punctuation: "*" [43:14 - 43:15] FieldDecl=Data:43:15 (Definition)
+// CHECK-tokens: Identifier: "Data" [43:15 - 43:19] FieldDecl=Data:43:15 (Definition)
+// CHECK-tokens: Punctuation: ";" [43:19 - 43:20] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Identifier: "size_t" [44:3 - 44:9] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "Length" [44:10 - 44:16] FieldDecl=Length:44:10 (Definition)
+// CHECK-tokens: Punctuation: ";" [44:16 - 44:17] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Keyword: "static" [45:3 - 45:9] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Identifier: "size_t" [45:10 - 45:16] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "min" [45:17 - 45:20] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Punctuation: "(" [45:20 - 45:21] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Identifier: "size_t" [45:21 - 45:27] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "a" [45:28 - 45:29] ParmDecl=a:45:28 (Definition)
+// CHECK-tokens: Punctuation: "," [45:29 - 45:30] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Identifier: "size_t" [45:31 - 45:37] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "b" [45:38 - 45:39] ParmDecl=b:45:38 (Definition)
+// CHECK-tokens: Punctuation: ")" [45:39 - 45:40] CXXMethod=min:45:17 (Definition)
+// CHECK-tokens: Punctuation: "{" [45:41 - 45:42] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [45:43 - 45:49] UnexposedStmt=
+// CHECK-tokens: Identifier: "a" [45:50 - 45:51] DeclRefExpr=a:45:28
+// CHECK-tokens: Punctuation: "<" [45:52 - 45:53] UnexposedExpr=
+// CHECK-tokens: Identifier: "b" [45:54 - 45:55] DeclRefExpr=b:45:38
+// CHECK-tokens: Punctuation: "?" [45:56 - 45:57] UnexposedExpr=
+// CHECK-tokens: Identifier: "a" [45:58 - 45:59] DeclRefExpr=a:45:28
+// CHECK-tokens: Punctuation: ":" [45:60 - 45:61] UnexposedExpr=
+// CHECK-tokens: Identifier: "b" [45:62 - 45:63] DeclRefExpr=b:45:38
+// CHECK-tokens: Punctuation: ";" [45:63 - 45:64] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [45:65 - 45:66] UnexposedStmt=
+// CHECK-tokens: Keyword: "public" [46:1 - 46:7] UnexposedDecl=:46:1 (Definition)
+// CHECK-tokens: Punctuation: ":" [46:7 - 46:8] UnexposedDecl=:46:1 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [47:3 - 47:12] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Punctuation: "(" [47:12 - 47:13] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Punctuation: ")" [47:13 - 47:14] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Punctuation: ":" [47:14 - 47:15] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Identifier: "Data" [47:16 - 47:20] MemberRef=Data:43:15
+// CHECK-tokens: Punctuation: "(" [47:20 - 47:21] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Literal: "0" [47:21 - 47:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [47:22 - 47:23] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Punctuation: "," [47:23 - 47:24] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Identifier: "Length" [47:25 - 47:31] MemberRef=Length:44:10
+// CHECK-tokens: Punctuation: "(" [47:31 - 47:32] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Literal: "0" [47:32 - 47:33] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [47:33 - 47:34] CXXConstructor=StringRef:47:3 (Definition)
+// CHECK-tokens: Punctuation: "{" [47:35 - 47:36] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [47:36 - 47:37] UnexposedStmt=
+// CHECK-tokens: Identifier: "StringRef" [48:3 - 48:12] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Punctuation: "(" [48:12 - 48:13] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Keyword: "const" [48:13 - 48:18] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Keyword: "char" [48:19 - 48:23] ParmDecl=Str:48:25 (Definition)
+// CHECK-tokens: Punctuation: "*" [48:24 - 48:25] ParmDecl=Str:48:25 (Definition)
+// CHECK-tokens: Identifier: "Str" [48:25 - 48:28] ParmDecl=Str:48:25 (Definition)
+// CHECK-tokens: Punctuation: ")" [48:28 - 48:29] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Punctuation: ":" [48:30 - 48:31] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Identifier: "Data" [48:32 - 48:36] MemberRef=Data:43:15
+// CHECK-tokens: Punctuation: "(" [48:36 - 48:37] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Identifier: "Str" [48:37 - 48:40] DeclRefExpr=Str:48:25
+// CHECK-tokens: Punctuation: ")" [48:40 - 48:41] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Punctuation: "," [48:41 - 48:42] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Identifier: "Length" [48:43 - 48:49] MemberRef=Length:44:10
+// CHECK-tokens: Punctuation: "(" [48:49 - 48:50] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Identifier: "magic_length" [48:50 - 48:62] DeclRefExpr=magic_length:36:8
+// CHECK-tokens: Punctuation: "(" [48:62 - 48:63] CallExpr=magic_length:36:8
+// CHECK-tokens: Identifier: "Str" [48:63 - 48:66] DeclRefExpr=Str:48:25
+// CHECK-tokens: Punctuation: ")" [48:66 - 48:67] CallExpr=magic_length:36:8
+// CHECK-tokens: Punctuation: ")" [48:67 - 48:68] CXXConstructor=StringRef:48:3 (Definition)
+// CHECK-tokens: Punctuation: "{" [48:69 - 48:70] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [48:70 - 48:71] UnexposedStmt=
+// CHECK-tokens: Identifier: "StringRef" [49:3 - 49:12] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Punctuation: "(" [49:12 - 49:13] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Keyword: "const" [49:13 - 49:18] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Keyword: "char" [49:19 - 49:23] ParmDecl=data:49:25 (Definition)
+// CHECK-tokens: Punctuation: "*" [49:24 - 49:25] ParmDecl=data:49:25 (Definition)
+// CHECK-tokens: Identifier: "data" [49:25 - 49:29] ParmDecl=data:49:25 (Definition)
+// CHECK-tokens: Punctuation: "," [49:29 - 49:30] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Identifier: "size_t" [49:31 - 49:37] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "length" [49:38 - 49:44] ParmDecl=length:49:38 (Definition)
+// CHECK-tokens: Punctuation: ")" [49:44 - 49:45] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Punctuation: ":" [49:46 - 49:47] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Identifier: "Data" [49:48 - 49:52] MemberRef=Data:43:15
+// CHECK-tokens: Punctuation: "(" [49:52 - 49:53] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Identifier: "data" [49:53 - 49:57] DeclRefExpr=data:49:25
+// CHECK-tokens: Punctuation: ")" [49:57 - 49:58] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Punctuation: "," [49:58 - 49:59] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Identifier: "Length" [49:60 - 49:66] MemberRef=Length:44:10
+// CHECK-tokens: Punctuation: "(" [49:66 - 49:67] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Identifier: "length" [49:67 - 49:73] DeclRefExpr=length:49:38
+// CHECK-tokens: Punctuation: ")" [49:73 - 49:74] CXXConstructor=StringRef:49:3 (Definition)
+// CHECK-tokens: Punctuation: "{" [49:75 - 49:76] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [49:76 - 49:77] UnexposedStmt=
+// CHECK-tokens: Identifier: "iterator" [50:3 - 50:11] TypeRef=iterator:40:23
+// CHECK-tokens: Identifier: "end" [50:12 - 50:15] CXXMethod=end:50:12 (Definition)
+// CHECK-tokens: Punctuation: "(" [50:15 - 50:16] CXXMethod=end:50:12 (Definition)
+// CHECK-tokens: Punctuation: ")" [50:16 - 50:17] CXXMethod=end:50:12 (Definition)
+// CHECK-tokens: Keyword: "const" [50:18 - 50:23] CXXMethod=end:50:12 (Definition)
+// CHECK-tokens: Punctuation: "{" [50:24 - 50:25] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [50:26 - 50:32] UnexposedStmt=
+// CHECK-tokens: Identifier: "Data" [50:33 - 50:37] MemberRefExpr=Data:43:15
+// CHECK-tokens: Punctuation: ";" [50:37 - 50:38] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [50:39 - 50:40] UnexposedStmt=
+// CHECK-tokens: Identifier: "size_t" [51:3 - 51:9] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "size" [51:10 - 51:14] CXXMethod=size:51:10 (Definition)
+// CHECK-tokens: Punctuation: "(" [51:14 - 51:15] CXXMethod=size:51:10 (Definition)
+// CHECK-tokens: Punctuation: ")" [51:15 - 51:16] CXXMethod=size:51:10 (Definition)
+// CHECK-tokens: Keyword: "const" [51:17 - 51:22] CXXMethod=size:51:10 (Definition)
+// CHECK-tokens: Punctuation: "{" [51:23 - 51:24] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [51:25 - 51:31] UnexposedStmt=
+// CHECK-tokens: Identifier: "Length" [51:32 - 51:38] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: ";" [51:38 - 51:39] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [51:40 - 51:41] UnexposedStmt=
+// CHECK-tokens: Keyword: "bool" [52:3 - 52:7] CXXMethod=startswith:52:8 (Definition)
+// CHECK-tokens: Identifier: "startswith" [52:8 - 52:18] CXXMethod=startswith:52:8 (Definition)
+// CHECK-tokens: Punctuation: "(" [52:18 - 52:19] CXXMethod=startswith:52:8 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [52:19 - 52:28] TypeRef=class llvm::StringRef:38:7
+// CHECK-tokens: Identifier: "Prefix" [52:29 - 52:35] ParmDecl=Prefix:52:29 (Definition)
+// CHECK-tokens: Punctuation: ")" [52:35 - 52:36] CXXMethod=startswith:52:8 (Definition)
+// CHECK-tokens: Keyword: "const" [52:37 - 52:42] CXXMethod=startswith:52:8 (Definition)
+// CHECK-tokens: Punctuation: "{" [52:43 - 52:44] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [53:5 - 53:11] UnexposedStmt=
+// CHECK-tokens: Identifier: "Length" [53:12 - 53:18] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: ">=" [53:19 - 53:21] UnexposedExpr=
+// CHECK-tokens: Identifier: "Prefix" [53:22 - 53:28] DeclRefExpr=Prefix:52:29
+// CHECK-tokens: Punctuation: "." [53:28 - 53:29] MemberRefExpr=Length:44:10
+// CHECK-tokens: Identifier: "Length" [53:29 - 53:35] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: "&&" [53:36 - 53:38] UnexposedExpr=
+// CHECK-tokens: Identifier: "memcmp" [54:11 - 54:17] DeclRefExpr=memcmp:7:7
+// CHECK-tokens: Punctuation: "(" [54:17 - 54:18] CallExpr=memcmp:7:7
+// CHECK-tokens: Identifier: "Data" [54:18 - 54:22] MemberRefExpr=Data:43:15
+// CHECK-tokens: Punctuation: "," [54:22 - 54:23] CallExpr=memcmp:7:7
+// CHECK-tokens: Identifier: "Prefix" [54:24 - 54:30] DeclRefExpr=Prefix:52:29
+// CHECK-tokens: Punctuation: "." [54:30 - 54:31] MemberRefExpr=Data:43:15
+// CHECK-tokens: Identifier: "Data" [54:31 - 54:35] MemberRefExpr=Data:43:15
+// CHECK-tokens: Punctuation: "," [54:35 - 54:36] CallExpr=memcmp:7:7
+// CHECK-tokens: Identifier: "Prefix" [54:37 - 54:43] DeclRefExpr=Prefix:52:29
+// CHECK-tokens: Punctuation: "." [54:43 - 54:44] MemberRefExpr=Length:44:10
+// CHECK-tokens: Identifier: "Length" [54:44 - 54:50] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: ")" [54:50 - 54:51] CallExpr=memcmp:7:7
+// CHECK-tokens: Punctuation: "==" [54:52 - 54:54] UnexposedExpr=
+// CHECK-tokens: Literal: "0" [54:55 - 54:56] UnexposedExpr=
+// CHECK-tokens: Punctuation: ";" [54:56 - 54:57] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [55:3 - 55:4] UnexposedStmt=
+// CHECK-tokens: Keyword: "bool" [56:3 - 56:7] CXXMethod=endswith:56:8 (Definition)
+// CHECK-tokens: Identifier: "endswith" [56:8 - 56:16] CXXMethod=endswith:56:8 (Definition)
+// CHECK-tokens: Punctuation: "(" [56:16 - 56:17] CXXMethod=endswith:56:8 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [56:17 - 56:26] TypeRef=class llvm::StringRef:38:7
+// CHECK-tokens: Identifier: "Suffix" [56:27 - 56:33] ParmDecl=Suffix:56:27 (Definition)
+// CHECK-tokens: Punctuation: ")" [56:33 - 56:34] CXXMethod=endswith:56:8 (Definition)
+// CHECK-tokens: Keyword: "const" [56:35 - 56:40] CXXMethod=endswith:56:8 (Definition)
+// CHECK-tokens: Punctuation: "{" [56:41 - 56:42] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [57:5 - 57:11] UnexposedStmt=
+// CHECK-tokens: Identifier: "Length" [57:12 - 57:18] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: ">=" [57:19 - 57:21] UnexposedExpr=
+// CHECK-tokens: Identifier: "Suffix" [57:22 - 57:28] DeclRefExpr=Suffix:56:27
+// CHECK-tokens: Punctuation: "." [57:28 - 57:29] MemberRefExpr=Length:44:10
+// CHECK-tokens: Identifier: "Length" [57:29 - 57:35] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: "&&" [57:36 - 57:38] UnexposedExpr=
+// CHECK-tokens: Identifier: "memcmp" [58:7 - 58:13] DeclRefExpr=memcmp:7:7
+// CHECK-tokens: Punctuation: "(" [58:13 - 58:14] CallExpr=memcmp:7:7
+// CHECK-tokens: Identifier: "end" [58:14 - 58:17] MemberRefExpr=end:50:12
+// CHECK-tokens: Punctuation: "(" [58:17 - 58:18] CallExpr=end:50:12
+// CHECK-tokens: Punctuation: ")" [58:18 - 58:19] CallExpr=end:50:12
+// CHECK-tokens: Punctuation: "-" [58:20 - 58:21] UnexposedExpr=
+// CHECK-tokens: Identifier: "Suffix" [58:22 - 58:28] DeclRefExpr=Suffix:56:27
+// CHECK-tokens: Punctuation: "." [58:28 - 58:29] MemberRefExpr=Length:44:10
+// CHECK-tokens: Identifier: "Length" [58:29 - 58:35] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: "," [58:35 - 58:36] CallExpr=memcmp:7:7
+// CHECK-tokens: Identifier: "Suffix" [58:37 - 58:43] DeclRefExpr=Suffix:56:27
+// CHECK-tokens: Punctuation: "." [58:43 - 58:44] MemberRefExpr=Data:43:15
+// CHECK-tokens: Identifier: "Data" [58:44 - 58:48] MemberRefExpr=Data:43:15
+// CHECK-tokens: Punctuation: "," [58:48 - 58:49] CallExpr=memcmp:7:7
+// CHECK-tokens: Identifier: "Suffix" [58:50 - 58:56] DeclRefExpr=Suffix:56:27
+// CHECK-tokens: Punctuation: "." [58:56 - 58:57] MemberRefExpr=Length:44:10
+// CHECK-tokens: Identifier: "Length" [58:57 - 58:63] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: ")" [58:63 - 58:64] CallExpr=memcmp:7:7
+// CHECK-tokens: Punctuation: "==" [58:65 - 58:67] UnexposedExpr=
+// CHECK-tokens: Literal: "0" [58:68 - 58:69] UnexposedExpr=
+// CHECK-tokens: Punctuation: ";" [58:69 - 58:70] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [59:3 - 59:4] UnexposedStmt=
+// CHECK-tokens: Identifier: "StringRef" [60:3 - 60:12] TypeRef=class llvm::StringRef:38:7
+// CHECK-tokens: Identifier: "substr" [60:13 - 60:19] CXXMethod=substr:60:13 (Definition)
+// CHECK-tokens: Punctuation: "(" [60:19 - 60:20] CXXMethod=substr:60:13 (Definition)
+// CHECK-tokens: Identifier: "size_t" [60:20 - 60:26] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "Start" [60:27 - 60:32] ParmDecl=Start:60:27 (Definition)
+// CHECK-tokens: Punctuation: "," [60:32 - 60:33] CXXMethod=substr:60:13 (Definition)
+// CHECK-tokens: Identifier: "size_t" [60:34 - 60:40] TypeRef=size_t:2:25
+// CHECK-tokens: Identifier: "N" [60:41 - 60:42] ParmDecl=N:60:41 (Definition)
+// CHECK-tokens: Punctuation: "=" [60:43 - 60:44] ParmDecl=N:60:41 (Definition)
+// CHECK-tokens: Identifier: "npos" [60:45 - 60:49] DeclRefExpr=npos:41:23
+// CHECK-tokens: Punctuation: ")" [60:49 - 60:50] CXXMethod=substr:60:13 (Definition)
+// CHECK-tokens: Keyword: "const" [60:51 - 60:56] CXXMethod=substr:60:13 (Definition)
+// CHECK-tokens: Punctuation: "{" [60:57 - 60:58] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [61:5 - 61:11] UnexposedStmt=
+// CHECK-tokens: Identifier: "StringRef" [61:12 - 61:21] TypeRef=class llvm::StringRef:38:7
+// CHECK-tokens: Punctuation: "(" [61:21 - 61:22] CallExpr=StringRef:49:3
+// CHECK-tokens: Identifier: "Data" [61:22 - 61:26] MemberRefExpr=Data:43:15
+// CHECK-tokens: Punctuation: "+" [61:27 - 61:28] UnexposedExpr=
+// CHECK-tokens: Identifier: "Start" [61:29 - 61:34] DeclRefExpr=Start:60:27
+// CHECK-tokens: Punctuation: "," [61:34 - 61:35] CallExpr=StringRef:49:3
+// CHECK-tokens: Identifier: "min" [61:36 - 61:39] DeclRefExpr=min:45:17
+// CHECK-tokens: Punctuation: "(" [61:39 - 61:40] CallExpr=min:45:17
+// CHECK-tokens: Identifier: "N" [61:40 - 61:41] DeclRefExpr=N:60:41
+// CHECK-tokens: Punctuation: "," [61:41 - 61:42] CallExpr=min:45:17
+// CHECK-tokens: Identifier: "Length" [61:43 - 61:49] MemberRefExpr=Length:44:10
+// CHECK-tokens: Punctuation: "-" [61:50 - 61:51] UnexposedExpr=
+// CHECK-tokens: Identifier: "Start" [61:52 - 61:57] DeclRefExpr=Start:60:27
+// CHECK-tokens: Punctuation: ")" [61:57 - 61:58] CallExpr=min:45:17
+// CHECK-tokens: Punctuation: ")" [61:58 - 61:59] CallExpr=StringRef:49:3
+// CHECK-tokens: Punctuation: ";" [61:59 - 61:60] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [62:3 - 62:4] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [63:1 - 63:2] ClassDecl=StringRef:38:7 (Definition)
+// CHECK-tokens: Punctuation: ";" [63:2 - 63:3] Namespace=llvm:37:11 (Definition)
+// CHECK-tokens: Punctuation: "}" [64:1 - 64:2] Namespace=llvm:37:11 (Definition)
+// CHECK-tokens: Keyword: "namespace" [65:1 - 65:10]
+// CHECK-tokens: Identifier: "clang" [65:11 - 65:16] Namespace=clang:65:11 (Definition)
+// CHECK-tokens: Punctuation: "{" [65:17 - 65:18] Namespace=clang:65:11 (Definition)
+// CHECK-tokens: Keyword: "class" [66:1 - 66:6] ClassDecl=IdentifierInfo:66:7 (Definition)
+// CHECK-tokens: Identifier: "IdentifierInfo" [66:7 - 66:21] ClassDecl=IdentifierInfo:66:7 (Definition)
+// CHECK-tokens: Punctuation: "{" [66:22 - 66:23] ClassDecl=IdentifierInfo:66:7 (Definition)
+// CHECK-tokens: Keyword: "public" [67:1 - 67:7] UnexposedDecl=:67:1 (Definition)
+// CHECK-tokens: Punctuation: ":" [67:7 - 67:8] UnexposedDecl=:67:1 (Definition)
+// CHECK-tokens: Identifier: "IdentifierInfo" [67:8 - 67:22] CXXConstructor=IdentifierInfo:67:8
+// CHECK-tokens: Punctuation: "(" [67:22 - 67:23] CXXConstructor=IdentifierInfo:67:8
+// CHECK-tokens: Punctuation: ")" [67:23 - 67:24] CXXConstructor=IdentifierInfo:67:8
+// CHECK-tokens: Punctuation: ";" [67:24 - 67:25] ClassDecl=IdentifierInfo:66:7 (Definition)
+// CHECK-tokens: Keyword: "const" [68:3 - 68:8] ClassDecl=IdentifierInfo:66:7 (Definition)
+// CHECK-tokens: Keyword: "char" [68:9 - 68:13] CXXMethod=getNameStart:68:15 (Definition)
+// CHECK-tokens: Punctuation: "*" [68:14 - 68:15] CXXMethod=getNameStart:68:15 (Definition)
+// CHECK-tokens: Identifier: "getNameStart" [68:15 - 68:27] CXXMethod=getNameStart:68:15 (Definition)
+// CHECK-tokens: Punctuation: "(" [68:27 - 68:28] CXXMethod=getNameStart:68:15 (Definition)
+// CHECK-tokens: Punctuation: ")" [68:28 - 68:29] CXXMethod=getNameStart:68:15 (Definition)
+// 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: "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=
+// CHECK-tokens: Punctuation: "(" [70:12 - 70:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [70:13 - 70:14] UnexposedExpr=
+// CHECK-tokens: Keyword: "const" [70:14 - 70:19] UnexposedExpr=
+// CHECK-tokens: Identifier: "actualtype" [70:20 - 70:30] TypeRef=actualtype:69:54
+// CHECK-tokens: Punctuation: "*" [70:31 - 70:32] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [70:32 - 70:33] UnexposedExpr=
+// CHECK-tokens: Keyword: "this" [70:34 - 70:38] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [70:38 - 70:39] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [70:39 - 70:41] MemberRefExpr=second:4:55
+// CHECK-tokens: Identifier: "second" [70:41 - 70:47] MemberRefExpr=second:4:55
+// CHECK-tokens: Punctuation: ";" [70:47 - 70:48] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [71:3 - 71:4] UnexposedStmt=
+// CHECK-tokens: Keyword: "unsigned" [72:3 - 72:11] CXXMethod=getLength:72:12 (Definition)
+// CHECK-tokens: Identifier: "getLength" [72:12 - 72:21] CXXMethod=getLength:72:12 (Definition)
+// CHECK-tokens: Punctuation: "(" [72:21 - 72:22] CXXMethod=getLength:72:12 (Definition)
+// CHECK-tokens: Punctuation: ")" [72:22 - 72:23] CXXMethod=getLength:72:12 (Definition)
+// 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: "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=
+// CHECK-tokens: Keyword: "char" [74:11 - 74:15] VarDecl=p:74:17 (Definition)
+// CHECK-tokens: Punctuation: "*" [74:16 - 74:17] VarDecl=p:74:17 (Definition)
+// CHECK-tokens: Identifier: "p" [74:17 - 74:18] VarDecl=p:74:17 (Definition)
+// CHECK-tokens: Punctuation: "=" [74:19 - 74:20] VarDecl=p:74:17 (Definition)
+// CHECK-tokens: Punctuation: "(" [74:21 - 74:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [74:22 - 74:23] UnexposedExpr=
+// CHECK-tokens: Keyword: "const" [74:23 - 74:28] UnexposedExpr=
+// CHECK-tokens: Identifier: "actualtype" [74:29 - 74:39] TypeRef=actualtype:73:54
+// CHECK-tokens: Punctuation: "*" [74:40 - 74:41] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [74:41 - 74:42] UnexposedExpr=
+// CHECK-tokens: Keyword: "this" [74:43 - 74:47] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [74:47 - 74:48] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [74:48 - 74:50] MemberRefExpr=second:4:55
+// CHECK-tokens: Identifier: "second" [74:50 - 74:56] MemberRefExpr=second:4:55
+// CHECK-tokens: Punctuation: "-" [74:57 - 74:58] UnexposedExpr=
+// CHECK-tokens: Literal: "2" [74:59 - 74:60] UnexposedExpr=
+// CHECK-tokens: Punctuation: ";" [74:60 - 74:61] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [75:5 - 75:11] UnexposedStmt=
+// CHECK-tokens: Punctuation: "(" [75:12 - 75:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [75:13 - 75:14] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [75:14 - 75:15] UnexposedExpr=
+// CHECK-tokens: Keyword: "unsigned" [75:15 - 75:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [75:23 - 75:24] UnexposedExpr=
+// CHECK-tokens: Identifier: "p" [75:25 - 75:26] DeclRefExpr=p:74:17
+// CHECK-tokens: Punctuation: "[" [75:26 - 75:27] UnexposedExpr=
+// CHECK-tokens: Literal: "0" [75:27 - 75:28] UnexposedExpr=
+// CHECK-tokens: Punctuation: "]" [75:28 - 75:29] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [75:29 - 75:30] UnexposedExpr=
+// CHECK-tokens: Punctuation: "|" [75:31 - 75:32] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [75:33 - 75:34] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [75:34 - 75:35] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [75:35 - 75:36] UnexposedExpr=
+// CHECK-tokens: Keyword: "unsigned" [75:36 - 75:44] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [75:44 - 75:45] UnexposedExpr=
+// CHECK-tokens: Identifier: "p" [75:46 - 75:47] DeclRefExpr=p:74:17
+// CHECK-tokens: Punctuation: "[" [75:47 - 75:48] UnexposedExpr=
+// CHECK-tokens: Literal: "1" [75:48 - 75:49] UnexposedExpr=
+// CHECK-tokens: Punctuation: "]" [75:49 - 75:50] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [75:50 - 75:51] UnexposedExpr=
+// CHECK-tokens: Punctuation: "<<" [75:52 - 75:54] UnexposedExpr=
+// CHECK-tokens: Literal: "8" [75:55 - 75:56] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [75:56 - 75:57] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [75:57 - 75:58] UnexposedExpr=
+// CHECK-tokens: Punctuation: "-" [75:59 - 75:60] UnexposedExpr=
+// 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: 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: "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: Punctuation: "::" [78:16 - 78:18] CallExpr=StringRef:49:3
+// CHECK-tokens: Identifier: "StringRef" [78:18 - 78:27] CallExpr=StringRef:49:3
+// 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
+// CHECK-tokens: Punctuation: ")" [78:41 - 78:42] CallExpr=getNameStart:68:15
+// CHECK-tokens: Punctuation: "," [78:42 - 78:43] CallExpr=StringRef:49:3
+// CHECK-tokens: Identifier: "getLength" [78:44 - 78:53] MemberRefExpr=getLength:72:12
+// CHECK-tokens: Punctuation: "(" [78:53 - 78:54] CallExpr=getLength:72:12
+// CHECK-tokens: Punctuation: ")" [78:54 - 78:55] CallExpr=getLength:72:12
+// CHECK-tokens: Punctuation: ")" [78:55 - 78:56] CallExpr=StringRef:49:3
+// CHECK-tokens: Punctuation: ";" [78:56 - 78:57] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [79:3 - 79:4] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [80:1 - 80:2] ClassDecl=IdentifierInfo:66:7 (Definition)
+// CHECK-tokens: Punctuation: ";" [80:2 - 80:3] Namespace=clang:65:11 (Definition)
+// CHECK-tokens: Punctuation: "}" [81:1 - 81:2] Namespace=clang:65:11 (Definition)
+// CHECK-tokens: Keyword: "namespace" [82:1 - 82:10]
+// CHECK-tokens: Identifier: "llvm" [82:11 - 82:15] Namespace=llvm:82:11 (Definition)
+// 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: 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: 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: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)
+// CHECK-tokens: Punctuation: "{" [83:60 - 83:61] ClassTemplate=StringSwitch:83:47 (Definition)
+// CHECK-tokens: Identifier: "StringRef" [84:3 - 84:12] TypeRef=class llvm::StringRef:38:7
+// 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: 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: 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
+// CHECK-tokens: Identifier: "Str" [87:35 - 87:38] ParmDecl=Str:87:35 (Definition)
+// CHECK-tokens: Punctuation: ")" [87:38 - 87:39] CXXConstructor=StringSwitch<T, R>:87:12 (Definition)
+// CHECK-tokens: Punctuation: ":" [87:40 - 87:41] CXXConstructor=StringSwitch<T, R>:87:12 (Definition)
+// CHECK-tokens: Identifier: "Str" [87:42 - 87:45] MemberRef=Str:84:13
+// CHECK-tokens: Punctuation: "(" [87:45 - 87:46] UnexposedExpr=
+// CHECK-tokens: Identifier: "Str" [87:46 - 87:49] DeclRefExpr=Str:87:35
+// CHECK-tokens: Punctuation: ")" [87:49 - 87:50] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [87:50 - 87:51] CXXConstructor=StringSwitch<T, R>:87:12 (Definition)
+// CHECK-tokens: Identifier: "Result" [87:52 - 87:58] MemberRef=Result:85:12
+// CHECK-tokens: Punctuation: "(" [87:58 - 87:59] UnexposedExpr=
+// CHECK-tokens: Literal: "0" [87:59 - 87:60] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [87:60 - 87:61] UnexposedExpr=
+// CHECK-tokens: Punctuation: "{" [87:62 - 87:63] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [87:63 - 87:64] UnexposedStmt=
+// CHECK-tokens: Keyword: "template" [88:3 - 88:11] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Punctuation: "<" [88:12 - 88:13] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Keyword: "unsigned" [88:14 - 88:22] NonTypeTemplateParameter=N:88:23 (Definition)
+// CHECK-tokens: Identifier: "N" [88:23 - 88:24] NonTypeTemplateParameter=N:88:23 (Definition)
+// CHECK-tokens: Punctuation: ">" [88:25 - 88:26] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Identifier: "StringSwitch" [88:27 - 88:39] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Punctuation: "&" [88:40 - 88:41] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Identifier: "Case" [88:42 - 88:46] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Punctuation: "(" [88:46 - 88:47] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Keyword: "const" [88:47 - 88:52] FunctionTemplate=Case:88:42 (Definition)
+// CHECK-tokens: Keyword: "char" [88:53 - 88:57] ParmDecl=S:88:60 (Definition)
+// CHECK-tokens: Punctuation: "(" [88:58 - 88:59] ParmDecl=S:88:60 (Definition)
+// CHECK-tokens: Punctuation: "&" [88:59 - 88:60] ParmDecl=S:88:60 (Definition)
+// CHECK-tokens: Identifier: "S" [88:60 - 88:61] ParmDecl=S:88:60 (Definition)
+// 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: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: 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)
+// CHECK-tokens: Punctuation: "{" [89:64 - 89:65] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [90:5 - 90:11] UnexposedStmt=
+// CHECK-tokens: Punctuation: "*" [90:12 - 90:13] UnexposedExpr=
+// 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: "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: 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)
+// CHECK-tokens: Keyword: "const" [92:30 - 92:35] CXXMethod=Default:92:5 (Definition)
+// CHECK-tokens: Punctuation: "{" [92:36 - 92:37] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [93:5 - 93:11] UnexposedStmt=
+// CHECK-tokens: Identifier: "Value" [93:12 - 93:17] DeclRefExpr=Value:92:23
+// CHECK-tokens: Punctuation: ";" [93:17 - 93:18] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [94:3 - 94:4] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [95:1 - 95:2] ClassTemplate=StringSwitch:83:47 (Definition)
+// CHECK-tokens: Punctuation: ";" [95:2 - 95:3] Namespace=llvm:82:11 (Definition)
+// CHECK-tokens: Punctuation: "}" [96:1 - 96:2] Namespace=llvm:82:11 (Definition)
+// CHECK-tokens: Keyword: "using" [98:1 - 98:6] UsingDirective=:98:17
+// 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: 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: "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)
+// CHECK-tokens: Punctuation: "(" [100:43 - 100:44] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Keyword: "const" [100:44 - 100:49] CXXMethod=getKind:100:36 (Definition)
+// CHECK-tokens: Identifier: "IdentifierInfo" [100:50 - 100:64] TypeRef=class clang::IdentifierInfo:66:7
+// CHECK-tokens: Punctuation: "*" [100:65 - 100:66] ParmDecl=Name:100:67 (Definition)
+// 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: 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: "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
+// CHECK-tokens: Punctuation: "->" [101:34 - 101:36] MemberRefExpr=getName:77:19
+// CHECK-tokens: Identifier: "getName" [101:36 - 101:43] MemberRefExpr=getName:77:19
+// CHECK-tokens: Punctuation: "(" [101:43 - 101:44] CallExpr=getName:77:19
+// CHECK-tokens: Punctuation: ")" [101:44 - 101:45] CallExpr=getName:77:19
+// CHECK-tokens: Punctuation: ";" [101:45 - 101:46] UnexposedStmt=
+// CHECK-tokens: Keyword: "if" [102:3 - 102:5] UnexposedStmt=
+// CHECK-tokens: Punctuation: "(" [102:6 - 102:7] UnexposedStmt=
+// CHECK-tokens: Identifier: "AttrName" [102:7 - 102:15] DeclRefExpr=AttrName:101:19
+// CHECK-tokens: Punctuation: "." [102:15 - 102:16] MemberRefExpr=startswith:52:8
+// CHECK-tokens: Identifier: "startswith" [102:16 - 102:26] MemberRefExpr=startswith:52:8
+// CHECK-tokens: Punctuation: "(" [102:26 - 102:27] CallExpr=startswith:52:8
+// CHECK-tokens: Literal: ""__"" [102:27 - 102:31] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [102:31 - 102:32] CallExpr=startswith:52:8
+// CHECK-tokens: Punctuation: "&&" [102:33 - 102:35] UnexposedExpr=
+// CHECK-tokens: Identifier: "AttrName" [102:36 - 102:44] DeclRefExpr=AttrName:101:19
+// CHECK-tokens: Punctuation: "." [102:44 - 102:45] MemberRefExpr=endswith:56:8
+// CHECK-tokens: Identifier: "endswith" [102:45 - 102:53] MemberRefExpr=endswith:56:8
+// CHECK-tokens: Punctuation: "(" [102:53 - 102:54] CallExpr=endswith:56:8
+// CHECK-tokens: Literal: ""__"" [102:54 - 102:58] UnexposedExpr=
+// CHECK-tokens: Punctuation: ")" [102:58 - 102:59] CallExpr=endswith:56:8
+// CHECK-tokens: Punctuation: ")" [102:59 - 102:60] UnexposedStmt=
+// CHECK-tokens: Identifier: "AttrName" [103:5 - 103:13] DeclRefExpr=AttrName:101:19
+// CHECK-tokens: Punctuation: "=" [103:14 - 103:15] CallExpr=operator=:38:7
+// CHECK-tokens: Identifier: "AttrName" [103:16 - 103:24] DeclRefExpr=AttrName:101:19
+// CHECK-tokens: Punctuation: "." [103:24 - 103:25] MemberRefExpr=substr:60:13
+// CHECK-tokens: Identifier: "substr" [103:25 - 103:31] MemberRefExpr=substr:60:13
+// CHECK-tokens: Punctuation: "(" [103:31 - 103:32] CallExpr=substr:60:13
+// CHECK-tokens: Literal: "2" [103:32 - 103:33] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [103:33 - 103:34] CallExpr=substr:60:13
+// CHECK-tokens: Identifier: "AttrName" [103:35 - 103:43] DeclRefExpr=AttrName:101:19
+// CHECK-tokens: Punctuation: "." [103:43 - 103:44] MemberRefExpr=size:51:10
+// CHECK-tokens: Identifier: "size" [103:44 - 103:48] MemberRefExpr=size:51:10
+// CHECK-tokens: Punctuation: "(" [103:48 - 103:49] CallExpr=size:51:10
+// CHECK-tokens: Punctuation: ")" [103:49 - 103:50] CallExpr=size:51:10
+// CHECK-tokens: Punctuation: "-" [103:51 - 103:52] UnexposedExpr=
+// CHECK-tokens: Literal: "4" [103:53 - 103:54] UnexposedExpr=
+// 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=
+// 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: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
+// CHECK-tokens: Punctuation: ")" [105:62 - 105:63] UnexposedExpr=StringSwitch:87:12
+// CHECK-tokens: Punctuation: "." [106:5 - 106:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [106:6 - 106:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [106:10 - 106:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""weak"" [106:11 - 106:17] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [106:17 - 106:18] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_weak" [106:19 - 106:26] DeclRefExpr=AT_weak:29:45
+// CHECK-tokens: Punctuation: ")" [106:26 - 106:27] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [107:5 - 107:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [107:6 - 107:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [107:10 - 107:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""weakref"" [107:11 - 107:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [107:20 - 107:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_weakref" [107:22 - 107:32] DeclRefExpr=AT_weakref:29:54
+// CHECK-tokens: Punctuation: ")" [107:32 - 107:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [108:5 - 108:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [108:6 - 108:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [108:10 - 108:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""pure"" [108:11 - 108:17] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [108:17 - 108:18] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_pure" [108:19 - 108:26] DeclRefExpr=AT_pure:26:49
+// CHECK-tokens: Punctuation: ")" [108:26 - 108:27] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [109:5 - 109:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [109:6 - 109:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [109:10 - 109:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""mode"" [109:11 - 109:17] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [109:17 - 109:18] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_mode" [109:19 - 109:26] DeclRefExpr=AT_mode:20:44
+// CHECK-tokens: Punctuation: ")" [109:26 - 109:27] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [110:5 - 110:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [110:6 - 110:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [110:10 - 110:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""used"" [110:11 - 110:17] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [110:17 - 110:18] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_used" [110:19 - 110:26] DeclRefExpr=AT_used:28:34
+// CHECK-tokens: Punctuation: ")" [110:26 - 110:27] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [111:5 - 111:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [111:6 - 111:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [111:10 - 111:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""alias"" [111:11 - 111:18] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [111:18 - 111:19] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_alias" [111:20 - 111:28] DeclRefExpr=AT_alias:15:25
+// CHECK-tokens: Punctuation: ")" [111:28 - 111:29] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [112:5 - 112:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [112:6 - 112:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [112:10 - 112:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""align"" [112:11 - 112:18] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [112:18 - 112:19] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_aligned" [112:20 - 112:30] DeclRefExpr=AT_aligned:15:35
+// CHECK-tokens: Punctuation: ")" [112:30 - 112:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [113:5 - 113:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [113:6 - 113:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [113:10 - 113:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""final"" [113:11 - 113:18] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [113:18 - 113:19] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_final" [113:20 - 113:28] DeclRefExpr=AT_final:19:40
+// CHECK-tokens: Punctuation: ")" [113:28 - 113:29] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [114:5 - 114:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [114:6 - 114:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [114:10 - 114:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""cdecl"" [114:11 - 114:18] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [114:18 - 114:19] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_cdecl" [114:20 - 114:28] DeclRefExpr=AT_cdecl:17:30
+// CHECK-tokens: Punctuation: ")" [114:28 - 114:29] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [115:5 - 115:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [115:6 - 115:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [115:10 - 115:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""const"" [115:11 - 115:18] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [115:18 - 115:19] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_const" [115:20 - 115:28] DeclRefExpr=AT_const:17:52
+// CHECK-tokens: Punctuation: ")" [115:28 - 115:29] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [116:5 - 116:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [116:6 - 116:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [116:10 - 116:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""__const"" [116:11 - 116:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [116:20 - 116:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_const" [116:22 - 116:30] DeclRefExpr=AT_const:17:52
+// CHECK-tokens: Punctuation: ")" [116:30 - 116:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [117:5 - 117:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [117:6 - 117:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [117:10 - 117:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""blocks"" [117:11 - 117:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [117:19 - 117:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_blocks" [117:21 - 117:30] DeclRefExpr=AT_blocks:16:57
+// CHECK-tokens: Punctuation: ")" [117:30 - 117:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [118:5 - 118:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [118:6 - 118:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [118:10 - 118:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""format"" [118:11 - 118:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [118:19 - 118:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_format" [118:21 - 118:30] DeclRefExpr=AT_format:19:50
+// CHECK-tokens: Punctuation: ")" [118:30 - 118:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [119:5 - 119:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [119:6 - 119:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [119:10 - 119:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""hiding"" [119:11 - 119:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [119:19 - 119:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_hiding" [119:21 - 119:30] DeclRefExpr=AT_hiding:20:22
+// CHECK-tokens: Punctuation: ")" [119:30 - 119:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [120:5 - 120:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [120:6 - 120:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [120:10 - 120:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""malloc"" [120:11 - 120:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [120:19 - 120:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_malloc" [120:21 - 120:30] DeclRefExpr=AT_malloc:20:33
+// CHECK-tokens: Punctuation: ")" [120:30 - 120:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [121:5 - 121:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [121:6 - 121:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [121:10 - 121:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""packed"" [121:11 - 121:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [121:19 - 121:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_packed" [121:21 - 121:30] DeclRefExpr=AT_packed:26:27
+// CHECK-tokens: Punctuation: ")" [121:30 - 121:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [122:5 - 122:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [122:6 - 122:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [122:10 - 122:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""unused"" [122:11 - 122:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [122:19 - 122:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_unused" [122:21 - 122:30] DeclRefExpr=AT_unused:28:23
+// CHECK-tokens: Punctuation: ")" [122:30 - 122:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [123:5 - 123:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [123:6 - 123:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [123:10 - 123:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""aligned"" [123:11 - 123:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [123:20 - 123:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_aligned" [123:22 - 123:32] DeclRefExpr=AT_aligned:15:35
+// CHECK-tokens: Punctuation: ")" [123:32 - 123:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [124:5 - 124:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [124:6 - 124:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [124:10 - 124:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""cleanup"" [124:11 - 124:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [124:20 - 124:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_cleanup" [124:22 - 124:32] DeclRefExpr=AT_cleanup:17:40
+// CHECK-tokens: Punctuation: ")" [124:32 - 124:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [125:5 - 125:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [125:6 - 125:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [125:10 - 125:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""naked"" [125:11 - 125:18] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [125:18 - 125:19] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_naked" [125:20 - 125:28] DeclRefExpr=AT_naked:20:53
+// CHECK-tokens: Punctuation: ")" [125:28 - 125:29] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [126:5 - 126:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [126:6 - 126:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [126:10 - 126:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""nodebug"" [126:11 - 126:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [126:20 - 126:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_nodebug" [126:22 - 126:32] DeclRefExpr=AT_nodebug:20:63
+// CHECK-tokens: Punctuation: ")" [126:32 - 126:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [127:5 - 127:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [127:6 - 127:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [127:10 - 127:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""nonnull"" [127:11 - 127:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [127:20 - 127:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_nonnull" [127:22 - 127:32] DeclRefExpr=AT_nonnull:21:47
+// CHECK-tokens: Punctuation: ")" [127:32 - 127:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [128:5 - 128:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [128:6 - 128:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [128:10 - 128:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""nothrow"" [128:11 - 128:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [128:20 - 128:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_nothrow" [128:22 - 128:32] DeclRefExpr=AT_nothrow:22:7
+// CHECK-tokens: Punctuation: ")" [128:32 - 128:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [129:5 - 129:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [129:6 - 129:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [129:10 - 129:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""objc_gc"" [129:11 - 129:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [129:20 - 129:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_objc_gc" [129:22 - 129:32] DeclRefExpr=AT_objc_gc:24:59
+// CHECK-tokens: Punctuation: ")" [129:32 - 129:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [130:5 - 130:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [130:6 - 130:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [130:10 - 130:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""regparm"" [130:11 - 130:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [130:20 - 130:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_regparm" [130:22 - 130:32] DeclRefExpr=AT_regparm:26:58
+// CHECK-tokens: Punctuation: ")" [130:32 - 130:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [131:5 - 131:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [131:6 - 131:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [131:10 - 131:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""section"" [131:11 - 131:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [131:20 - 131:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_section" [131:22 - 131:32] DeclRefExpr=AT_section:27:7
+// CHECK-tokens: Punctuation: ")" [131:32 - 131:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [132:5 - 132:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [132:6 - 132:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [132:10 - 132:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""stdcall"" [132:11 - 132:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [132:20 - 132:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_stdcall" [132:22 - 132:32] DeclRefExpr=AT_stdcall:27:32
+// CHECK-tokens: Punctuation: ")" [132:32 - 132:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [133:5 - 133:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [133:6 - 133:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [133:10 - 133:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""annotate"" [133:11 - 133:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [133:21 - 133:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_annotate" [133:23 - 133:34] DeclRefExpr=AT_annotate:16:29
+// CHECK-tokens: Punctuation: ")" [133:34 - 133:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [134:5 - 134:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [134:6 - 134:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [134:10 - 134:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""fastcall"" [134:11 - 134:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [134:21 - 134:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_fastcall" [134:23 - 134:34] DeclRefExpr=AT_fastcall:19:27
+// CHECK-tokens: Punctuation: ")" [134:34 - 134:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [135:5 - 135:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [135:6 - 135:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [135:10 - 135:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ibaction"" [135:11 - 135:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [135:21 - 135:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_IBAction" [135:23 - 135:34] DeclRefExpr=AT_IBAction:14:7
+// CHECK-tokens: Punctuation: ")" [135:34 - 135:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [136:5 - 136:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [136:6 - 136:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [136:10 - 136:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""iboutlet"" [136:11 - 136:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [136:21 - 136:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_IBOutlet" [136:23 - 136:34] DeclRefExpr=AT_IBOutlet:14:20
+// CHECK-tokens: Punctuation: ")" [136:34 - 136:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [137:5 - 137:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [137:6 - 137:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [137:10 - 137:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""iboutletcollection"" [137:11 - 137:31] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [137:31 - 137:32] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_IBOutletCollection" [137:33 - 137:54] DeclRefExpr=AT_IBOutletCollection:14:33
+// CHECK-tokens: Punctuation: ")" [137:54 - 137:55] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [138:5 - 138:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [138:6 - 138:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [138:10 - 138:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""noreturn"" [138:11 - 138:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [138:21 - 138:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_noreturn" [138:23 - 138:34] DeclRefExpr=AT_noreturn:21:59
+// CHECK-tokens: Punctuation: ")" [138:34 - 138:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [139:5 - 139:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [139:6 - 139:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [139:10 - 139:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""noinline"" [139:11 - 139:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [139:21 - 139:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_noinline" [139:23 - 139:34] DeclRefExpr=AT_noinline:21:7
+// CHECK-tokens: Punctuation: ")" [139:34 - 139:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [140:5 - 140:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [140:6 - 140:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [140:10 - 140:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""override"" [140:11 - 140:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [140:21 - 140:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_override" [140:23 - 140:34] DeclRefExpr=AT_override:22:51
+// CHECK-tokens: Punctuation: ")" [140:34 - 140:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [141:5 - 141:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [141:6 - 141:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [141:10 - 141:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""sentinel"" [141:11 - 141:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [141:21 - 141:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_sentinel" [141:23 - 141:34] DeclRefExpr=AT_sentinel:27:19
+// CHECK-tokens: Punctuation: ")" [141:34 - 141:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [142:5 - 142:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [142:6 - 142:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [142:10 - 142:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""NSObject"" [142:11 - 142:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [142:21 - 142:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_nsobject" [142:23 - 142:34] DeclRefExpr=AT_nsobject:22:19
+// CHECK-tokens: Punctuation: ")" [142:34 - 142:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [143:5 - 143:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [143:6 - 143:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [143:10 - 143:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""dllimport"" [143:11 - 143:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [143:22 - 143:23] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_dllimport" [143:24 - 143:36] DeclRefExpr=AT_dllimport:18:51
+// CHECK-tokens: Punctuation: ")" [143:36 - 143:37] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [144:5 - 144:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [144:6 - 144:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [144:10 - 144:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""dllexport"" [144:11 - 144:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [144:22 - 144:23] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_dllexport" [144:24 - 144:36] DeclRefExpr=AT_dllexport:18:37
+// CHECK-tokens: Punctuation: ")" [144:36 - 144:37] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [145:5 - 145:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [145:6 - 145:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [145:10 - 145:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""may_alias"" [145:11 - 145:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [145:22 - 145:23] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "IgnoredAttribute" [145:24 - 145:40] DeclRefExpr=IgnoredAttribute:31:7
+// CHECK-tokens: Punctuation: ")" [145:40 - 145:41] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [146:5 - 146:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [146:6 - 146:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [146:10 - 146:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""base_check"" [146:11 - 146:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [146:23 - 146:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_base_check" [146:25 - 146:38] DeclRefExpr=AT_base_check:16:42
+// CHECK-tokens: Punctuation: ")" [146:38 - 146:39] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [147:5 - 147:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [147:6 - 147:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [147:10 - 147:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""deprecated"" [147:11 - 147:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [147:23 - 147:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_deprecated" [147:25 - 147:38] DeclRefExpr=AT_deprecated:18:7
+// CHECK-tokens: Punctuation: ")" [147:38 - 147:39] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [148:5 - 148:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [148:6 - 148:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [148:10 - 148:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""visibility"" [148:11 - 148:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [148:23 - 148:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_visibility" [148:25 - 148:38] DeclRefExpr=AT_visibility:29:7
+// CHECK-tokens: Punctuation: ")" [148:38 - 148:39] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [149:5 - 149:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [149:6 - 149:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [149:10 - 149:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""destructor"" [149:11 - 149:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [149:23 - 149:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_destructor" [149:25 - 149:38] DeclRefExpr=AT_destructor:18:22
+// CHECK-tokens: Punctuation: ")" [149:38 - 149:39] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [150:5 - 150:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [150:6 - 150:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [150:10 - 150:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""format_arg"" [150:11 - 150:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [150:23 - 150:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_format_arg" [150:25 - 150:38] DeclRefExpr=AT_format_arg:19:61
+// CHECK-tokens: Punctuation: ")" [150:38 - 150:39] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [151:5 - 151:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [151:6 - 151:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [151:10 - 151:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""gnu_inline"" [151:11 - 151:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [151:23 - 151:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_gnu_inline" [151:25 - 151:38] DeclRefExpr=AT_gnu_inline:20:7
+// CHECK-tokens: Punctuation: ")" [151:38 - 151:39] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [152:5 - 152:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [152:6 - 152:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [152:10 - 152:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""weak_import"" [152:11 - 152:24] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [152:24 - 152:25] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_weak_import" [152:26 - 152:40] DeclRefExpr=AT_weak_import:30:7
+// CHECK-tokens: Punctuation: ")" [152:40 - 152:41] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [153:5 - 153:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [153:6 - 153:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [153:10 - 153:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""vecreturn"" [153:11 - 153:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [153:22 - 153:23] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_vecreturn" [153:24 - 153:36] DeclRefExpr=AT_vecreturn:28:43
+// CHECK-tokens: Punctuation: ")" [153:36 - 153:37] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [154:5 - 154:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [154:6 - 154:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [154:10 - 154:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""vector_size"" [154:11 - 154:24] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [154:24 - 154:25] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_vector_size" [154:26 - 154:40] DeclRefExpr=AT_vector_size:28:57
+// CHECK-tokens: Punctuation: ")" [154:40 - 154:41] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [155:5 - 155:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [155:6 - 155:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [155:10 - 155:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""constructor"" [155:11 - 155:24] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [155:24 - 155:25] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_constructor" [155:26 - 155:40] DeclRefExpr=AT_constructor:17:62
+// CHECK-tokens: Punctuation: ")" [155:40 - 155:41] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [156:5 - 156:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [156:6 - 156:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [156:10 - 156:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""unavailable"" [156:11 - 156:24] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [156:24 - 156:25] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_unavailable" [156:26 - 156:40] DeclRefExpr=AT_unavailable:28:7
+// CHECK-tokens: Punctuation: ")" [156:40 - 156:41] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [157:5 - 157:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [157:6 - 157:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [157:10 - 157:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""overloadable"" [157:11 - 157:25] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [157:25 - 157:26] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_overloadable" [157:27 - 157:42] DeclRefExpr=AT_overloadable:25:7
+// CHECK-tokens: Punctuation: ")" [157:42 - 157:43] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [158:5 - 158:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [158:6 - 158:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [158:10 - 158:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""address_space"" [158:11 - 158:26] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [158:26 - 158:27] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_address_space" [158:28 - 158:44] DeclRefExpr=AT_address_space:15:7
+// CHECK-tokens: Punctuation: ")" [158:44 - 158:45] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [159:5 - 159:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [159:6 - 159:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [159:10 - 159:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""always_inline"" [159:11 - 159:26] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [159:26 - 159:27] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_always_inline" [159:28 - 159:44] DeclRefExpr=AT_always_inline:15:47
+// CHECK-tokens: Punctuation: ")" [159:44 - 159:45] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [160:5 - 160:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [160:6 - 160:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [160:10 - 160:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""returns_twice"" [160:11 - 160:26] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [160:26 - 160:27] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "IgnoredAttribute" [160:28 - 160:44] DeclRefExpr=IgnoredAttribute:31:7
+// CHECK-tokens: Punctuation: ")" [160:44 - 160:45] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [161:5 - 161:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [161:6 - 161:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [161:10 - 161:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""vec_type_hint"" [161:11 - 161:26] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [161:26 - 161:27] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "IgnoredAttribute" [161:28 - 161:44] DeclRefExpr=IgnoredAttribute:31:7
+// CHECK-tokens: Punctuation: ")" [161:44 - 161:45] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [162:5 - 162:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [162:6 - 162:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [162:10 - 162:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""objc_exception"" [162:11 - 162:27] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [162:27 - 162:28] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_objc_exception" [162:29 - 162:46] DeclRefExpr=AT_objc_exception:22:32
+// CHECK-tokens: Punctuation: ")" [162:46 - 162:47] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [163:5 - 163:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [163:6 - 163:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [163:10 - 163:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ext_vector_type"" [163:11 - 163:28] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [163:28 - 163:29] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_ext_vector_type" [163:30 - 163:48] DeclRefExpr=AT_ext_vector_type:19:7
+// CHECK-tokens: Punctuation: ")" [163:48 - 163:49] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [164:5 - 164:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [164:6 - 164:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [164:10 - 164:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""transparent_union"" [164:11 - 164:30] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [164:30 - 164:31] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_transparent_union" [164:32 - 164:52] DeclRefExpr=AT_transparent_union:27:57
+// CHECK-tokens: Punctuation: ")" [164:52 - 164:53] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [165:5 - 165:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [165:6 - 165:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [165:10 - 165:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""analyzer_noreturn"" [165:11 - 165:30] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [165:30 - 165:31] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_analyzer_noreturn" [165:32 - 165:52] DeclRefExpr=AT_analyzer_noreturn:16:7
+// CHECK-tokens: Punctuation: ")" [165:52 - 165:53] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [166:5 - 166:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [166:6 - 166:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [166:10 - 166:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""warn_unused_result"" [166:11 - 166:31] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [166:31 - 166:32] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_warn_unused_result" [166:33 - 166:54] DeclRefExpr=AT_warn_unused_result:29:22
+// CHECK-tokens: Punctuation: ")" [166:54 - 166:55] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [167:5 - 167:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [167:6 - 167:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [167:10 - 167:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""carries_dependency"" [167:11 - 167:31] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [167:31 - 167:32] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_carries_dependency" [167:33 - 167:54] DeclRefExpr=AT_carries_dependency:17:7
+// CHECK-tokens: Punctuation: ")" [167:54 - 167:55] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [168:5 - 168:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [168:6 - 168:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [168:10 - 168:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ns_returns_not_retained"" [168:11 - 168:36] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [168:36 - 168:37] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_ns_returns_not_retained" [168:38 - 168:64] DeclRefExpr=AT_ns_returns_not_retained:24:7
+// CHECK-tokens: Punctuation: ")" [168:64 - 168:65] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [169:5 - 169:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [169:6 - 169:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [169:10 - 169:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ns_returns_retained"" [169:11 - 169:32] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [169:32 - 169:33] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_ns_returns_retained" [169:34 - 169:56] DeclRefExpr=AT_ns_returns_retained:24:35
+// CHECK-tokens: Punctuation: ")" [169:56 - 169:57] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [170:5 - 170:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [170:6 - 170:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [170:10 - 170:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""cf_returns_not_retained"" [170:11 - 170:36] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [170:36 - 170:37] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_cf_returns_not_retained" [170:38 - 170:64] DeclRefExpr=AT_cf_returns_not_retained:23:7
+// CHECK-tokens: Punctuation: ")" [170:64 - 170:65] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [171:5 - 171:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [171:6 - 171:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [171:10 - 171:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""cf_returns_retained"" [171:11 - 171:32] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [171:32 - 171:33] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_cf_returns_retained" [171:34 - 171:56] DeclRefExpr=AT_cf_returns_retained:23:35
+// CHECK-tokens: Punctuation: ")" [171:56 - 171:57] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [172:5 - 172:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [172:6 - 172:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [172:10 - 172:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ownership_returns"" [172:11 - 172:30] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [172:30 - 172:31] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_ownership_returns" [172:32 - 172:52] DeclRefExpr=AT_ownership_returns:25:44
+// CHECK-tokens: Punctuation: ")" [172:52 - 172:53] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [173:5 - 173:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [173:6 - 173:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [173:10 - 173:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ownership_holds"" [173:11 - 173:28] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [173:28 - 173:29] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_ownership_holds" [173:30 - 173:48] DeclRefExpr=AT_ownership_holds:25:24
+// CHECK-tokens: Punctuation: ")" [173:48 - 173:49] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [174:5 - 174:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [174:6 - 174:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [174:10 - 174:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""ownership_takes"" [174:11 - 174:28] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [174:28 - 174:29] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_ownership_takes" [174:30 - 174:48] DeclRefExpr=AT_ownership_takes:26:7
+// CHECK-tokens: Punctuation: ")" [174:48 - 174:49] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [175:5 - 175:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [175:6 - 175:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [175:10 - 175:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""reqd_work_group_size"" [175:11 - 175:33] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [175:33 - 175:34] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_reqd_wg_size" [175:35 - 175:50] DeclRefExpr=AT_reqd_wg_size:30:23
+// CHECK-tokens: Punctuation: ")" [175:50 - 175:51] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [176:5 - 176:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [176:6 - 176:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [176:10 - 176:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""init_priority"" [176:11 - 176:26] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [176:26 - 176:27] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_init_priority" [176:28 - 176:44] DeclRefExpr=AT_init_priority:30:40
+// CHECK-tokens: Punctuation: ")" [176:44 - 176:45] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [177:5 - 177:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [177:6 - 177:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [177:10 - 177:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""no_instrument_function"" [177:11 - 177:35] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [177:35 - 177:36] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_no_instrument_function" [177:37 - 177:62] DeclRefExpr=AT_no_instrument_function:21:20
+// CHECK-tokens: Punctuation: ")" [177:62 - 177:63] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [178:5 - 178:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [178:6 - 178:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [178:10 - 178:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""thiscall"" [178:11 - 178:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [178:21 - 178:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_thiscall" [178:23 - 178:34] DeclRefExpr=AT_thiscall:27:44
+// CHECK-tokens: Punctuation: ")" [178:34 - 178:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [179:5 - 179:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [179:6 - 179:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [179:10 - 179:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""pascal"" [179:11 - 179:19] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [179:19 - 179:20] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_pascal" [179:21 - 179:30] DeclRefExpr=AT_pascal:26:38
+// CHECK-tokens: Punctuation: ")" [179:30 - 179:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [180:5 - 180:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [180:6 - 180:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [180:10 - 180:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""__cdecl"" [180:11 - 180:20] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [180:20 - 180:21] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_cdecl" [180:22 - 180:30] DeclRefExpr=AT_cdecl:17:30
+// CHECK-tokens: Punctuation: ")" [180:30 - 180:31] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [181:5 - 181:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [181:6 - 181:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [181:10 - 181:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""__stdcall"" [181:11 - 181:22] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [181:22 - 181:23] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_stdcall" [181:24 - 181:34] DeclRefExpr=AT_stdcall:27:32
+// CHECK-tokens: Punctuation: ")" [181:34 - 181:35] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [182:5 - 182:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [182:6 - 182:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [182:10 - 182:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""__fastcall"" [182:11 - 182:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [182:23 - 182:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_fastcall" [182:25 - 182:36] DeclRefExpr=AT_fastcall:19:27
+// CHECK-tokens: Punctuation: ")" [182:36 - 182:37] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [183:5 - 183:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [183:6 - 183:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [183:10 - 183:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""__thiscall"" [183:11 - 183:23] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [183:23 - 183:24] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_thiscall" [183:25 - 183:36] DeclRefExpr=AT_thiscall:27:44
+// CHECK-tokens: Punctuation: ")" [183:36 - 183:37] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [184:5 - 184:6] MemberRefExpr=Case:88:42
+// CHECK-tokens: Identifier: "Case" [184:6 - 184:10] MemberRefExpr=Case:88:42
+// CHECK-tokens: Punctuation: "(" [184:10 - 184:11] CallExpr=Case:88:42
+// CHECK-tokens: Literal: ""__pascal"" [184:11 - 184:21] UnexposedExpr=
+// CHECK-tokens: Punctuation: "," [184:21 - 184:22] CallExpr=Case:88:42
+// CHECK-tokens: Identifier: "AT_pascal" [184:23 - 184:32] DeclRefExpr=AT_pascal:26:38
+// CHECK-tokens: Punctuation: ")" [184:32 - 184:33] CallExpr=Case:88:42
+// CHECK-tokens: Punctuation: "." [185:5 - 185:6] MemberRefExpr=Default:92:5
+// CHECK-tokens: Identifier: "Default" [185:6 - 185:13] MemberRefExpr=Default:92:5
+// CHECK-tokens: Punctuation: "(" [185:13 - 185:14] CallExpr=Default:92:5
+// CHECK-tokens: Identifier: "UnknownAttribute" [185:14 - 185:30] DeclRefExpr=UnknownAttribute:31:25
+// CHECK-tokens: Punctuation: ")" [185:30 - 185:31] CallExpr=Default:92:5
+// CHECK-tokens: Punctuation: ";" [185:31 - 185:32] UnexposedStmt=
+// 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: 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: 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: 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: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: 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]
+// CHECK: 14:7: EnumConstantDecl=AT_IBAction:14:7 (Definition) Extent=[14:7 - 14:18]
+// CHECK: 14:20: EnumConstantDecl=AT_IBOutlet:14:20 (Definition) Extent=[14:20 - 14:31]
+// CHECK: 14:33: EnumConstantDecl=AT_IBOutletCollection:14:33 (Definition) Extent=[14:33 - 14:54]
+// CHECK: 15:7: EnumConstantDecl=AT_address_space:15:7 (Definition) Extent=[15:7 - 15:23]
+// CHECK: 15:25: EnumConstantDecl=AT_alias:15:25 (Definition) Extent=[15:25 - 15:33]
+// CHECK: 15:35: EnumConstantDecl=AT_aligned:15:35 (Definition) Extent=[15:35 - 15:45]
+// CHECK: 15:47: EnumConstantDecl=AT_always_inline:15:47 (Definition) Extent=[15:47 - 15:63]
+// CHECK: 16:7: EnumConstantDecl=AT_analyzer_noreturn:16:7 (Definition) Extent=[16:7 - 16:27]
+// CHECK: 16:29: EnumConstantDecl=AT_annotate:16:29 (Definition) Extent=[16:29 - 16:40]
+// CHECK: 16:42: EnumConstantDecl=AT_base_check:16:42 (Definition) Extent=[16:42 - 16:55]
+// CHECK: 16:57: EnumConstantDecl=AT_blocks:16:57 (Definition) Extent=[16:57 - 16:66]
+// CHECK: 17:7: EnumConstantDecl=AT_carries_dependency:17:7 (Definition) Extent=[17:7 - 17:28]
+// CHECK: 17:30: EnumConstantDecl=AT_cdecl:17:30 (Definition) Extent=[17:30 - 17:38]
+// CHECK: 17:40: EnumConstantDecl=AT_cleanup:17:40 (Definition) Extent=[17:40 - 17:50]
+// CHECK: 17:52: EnumConstantDecl=AT_const:17:52 (Definition) Extent=[17:52 - 17:60]
+// CHECK: 17:62: EnumConstantDecl=AT_constructor:17:62 (Definition) Extent=[17:62 - 17:76]
+// CHECK: 18:7: EnumConstantDecl=AT_deprecated:18:7 (Definition) Extent=[18:7 - 18:20]
+// CHECK: 18:22: EnumConstantDecl=AT_destructor:18:22 (Definition) Extent=[18:22 - 18:35]
+// CHECK: 18:37: EnumConstantDecl=AT_dllexport:18:37 (Definition) Extent=[18:37 - 18:49]
+// CHECK: 18:51: EnumConstantDecl=AT_dllimport:18:51 (Definition) Extent=[18:51 - 18:63]
+// CHECK: 19:7: EnumConstantDecl=AT_ext_vector_type:19:7 (Definition) Extent=[19:7 - 19:25]
+// CHECK: 19:27: EnumConstantDecl=AT_fastcall:19:27 (Definition) Extent=[19:27 - 19:38]
+// CHECK: 19:40: EnumConstantDecl=AT_final:19:40 (Definition) Extent=[19:40 - 19:48]
+// CHECK: 19:50: EnumConstantDecl=AT_format:19:50 (Definition) Extent=[19:50 - 19:59]
+// CHECK: 19:61: EnumConstantDecl=AT_format_arg:19:61 (Definition) Extent=[19:61 - 19:74]
+// CHECK: 20:7: EnumConstantDecl=AT_gnu_inline:20:7 (Definition) Extent=[20:7 - 20:20]
+// CHECK: 20:22: EnumConstantDecl=AT_hiding:20:22 (Definition) Extent=[20:22 - 20:31]
+// CHECK: 20:33: EnumConstantDecl=AT_malloc:20:33 (Definition) Extent=[20:33 - 20:42]
+// CHECK: 20:44: EnumConstantDecl=AT_mode:20:44 (Definition) Extent=[20:44 - 20:51]
+// CHECK: 20:53: EnumConstantDecl=AT_naked:20:53 (Definition) Extent=[20:53 - 20:61]
+// CHECK: 20:63: EnumConstantDecl=AT_nodebug:20:63 (Definition) Extent=[20:63 - 20:73]
+// CHECK: 21:7: EnumConstantDecl=AT_noinline:21:7 (Definition) Extent=[21:7 - 21:18]
+// CHECK: 21:20: EnumConstantDecl=AT_no_instrument_function:21:20 (Definition) Extent=[21:20 - 21:45]
+// CHECK: 21:47: EnumConstantDecl=AT_nonnull:21:47 (Definition) Extent=[21:47 - 21:57]
+// CHECK: 21:59: EnumConstantDecl=AT_noreturn:21:59 (Definition) Extent=[21:59 - 21:70]
+// CHECK: 22:7: EnumConstantDecl=AT_nothrow:22:7 (Definition) Extent=[22:7 - 22:17]
+// CHECK: 22:19: EnumConstantDecl=AT_nsobject:22:19 (Definition) Extent=[22:19 - 22:30]
+// CHECK: 22:32: EnumConstantDecl=AT_objc_exception:22:32 (Definition) Extent=[22:32 - 22:49]
+// CHECK: 22:51: EnumConstantDecl=AT_override:22:51 (Definition) Extent=[22:51 - 22:62]
+// CHECK: 23:7: EnumConstantDecl=AT_cf_returns_not_retained:23:7 (Definition) Extent=[23:7 - 23:33]
+// CHECK: 23:35: EnumConstantDecl=AT_cf_returns_retained:23:35 (Definition) Extent=[23:35 - 23:57]
+// CHECK: 24:7: EnumConstantDecl=AT_ns_returns_not_retained:24:7 (Definition) Extent=[24:7 - 24:33]
+// CHECK: 24:35: EnumConstantDecl=AT_ns_returns_retained:24:35 (Definition) Extent=[24:35 - 24:57]
+// CHECK: 24:59: EnumConstantDecl=AT_objc_gc:24:59 (Definition) Extent=[24:59 - 24:69]
+// CHECK: 25:7: EnumConstantDecl=AT_overloadable:25:7 (Definition) Extent=[25:7 - 25:22]
+// CHECK: 25:24: EnumConstantDecl=AT_ownership_holds:25:24 (Definition) Extent=[25:24 - 25:42]
+// CHECK: 25:44: EnumConstantDecl=AT_ownership_returns:25:44 (Definition) Extent=[25:44 - 25:64]
+// CHECK: 26:7: EnumConstantDecl=AT_ownership_takes:26:7 (Definition) Extent=[26:7 - 26:25]
+// CHECK: 26:27: EnumConstantDecl=AT_packed:26:27 (Definition) Extent=[26:27 - 26:36]
+// CHECK: 26:38: EnumConstantDecl=AT_pascal:26:38 (Definition) Extent=[26:38 - 26:47]
+// CHECK: 26:49: EnumConstantDecl=AT_pure:26:49 (Definition) Extent=[26:49 - 26:56]
+// CHECK: 26:58: EnumConstantDecl=AT_regparm:26:58 (Definition) Extent=[26:58 - 26:68]
+// CHECK: 27:7: EnumConstantDecl=AT_section:27:7 (Definition) Extent=[27:7 - 27:17]
+// CHECK: 27:19: EnumConstantDecl=AT_sentinel:27:19 (Definition) Extent=[27:19 - 27:30]
+// CHECK: 27:32: EnumConstantDecl=AT_stdcall:27:32 (Definition) Extent=[27:32 - 27:42]
+// CHECK: 27:44: EnumConstantDecl=AT_thiscall:27:44 (Definition) Extent=[27:44 - 27:55]
+// CHECK: 27:57: EnumConstantDecl=AT_transparent_union:27:57 (Definition) Extent=[27:57 - 27:77]
+// CHECK: 28:7: EnumConstantDecl=AT_unavailable:28:7 (Definition) Extent=[28:7 - 28:21]
+// CHECK: 28:23: EnumConstantDecl=AT_unused:28:23 (Definition) Extent=[28:23 - 28:32]
+// CHECK: 28:34: EnumConstantDecl=AT_used:28:34 (Definition) Extent=[28:34 - 28:41]
+// CHECK: 28:43: EnumConstantDecl=AT_vecreturn:28:43 (Definition) Extent=[28:43 - 28:55]
+// CHECK: 28:57: EnumConstantDecl=AT_vector_size:28:57 (Definition) Extent=[28:57 - 28:71]
+// CHECK: 29:7: EnumConstantDecl=AT_visibility:29:7 (Definition) Extent=[29:7 - 29:20]
+// CHECK: 29:22: EnumConstantDecl=AT_warn_unused_result:29:22 (Definition) Extent=[29:22 - 29:43]
+// CHECK: 29:45: EnumConstantDecl=AT_weak:29:45 (Definition) Extent=[29:45 - 29:52]
+// CHECK: 29:54: EnumConstantDecl=AT_weakref:29:54 (Definition) Extent=[29:54 - 29:64]
+// CHECK: 30:7: EnumConstantDecl=AT_weak_import:30:7 (Definition) Extent=[30:7 - 30:21]
+// CHECK: 30:23: EnumConstantDecl=AT_reqd_wg_size:30:23 (Definition) Extent=[30:23 - 30:38]
+// 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: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: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: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: 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: 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]
+// CHECK: 41:31: TypeRef=size_t:2:25 Extent=[41:31 - 41:37]
+// 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: 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: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]
+// CHECK: 45:38: ParmDecl=b:45:38 (Definition) Extent=[45:31 - 45:39]
+// CHECK: 45:31: TypeRef=size_t:2:25 Extent=[45:31 - 45:37]
+// CHECK: 45:41: UnexposedStmt= Extent=[45:41 - 45:66]
+// CHECK: 45:43: UnexposedStmt= Extent=[45:43 - 45:63]
+// CHECK: 45:50: UnexposedExpr= Extent=[45:50 - 45:63]
+// CHECK: 45:50: UnexposedExpr= Extent=[45:50 - 45:55]
+// CHECK: 45:50: DeclRefExpr=a:45:28 Extent=[45:50 - 45:51]
+// CHECK: 45:54: DeclRefExpr=b:45:38 Extent=[45:54 - 45:55]
+// CHECK: 45:58: DeclRefExpr=a:45:28 Extent=[45:58 - 45:59]
+// CHECK: 45:62: DeclRefExpr=b:45:38 Extent=[45:62 - 45:63]
+// CHECK: 46:1: UnexposedDecl=:46:1 (Definition) Extent=[46:1 - 46:8]
+// CHECK: 47:3: CXXConstructor=StringRef:47:3 (Definition) Extent=[47:3 - 47:37]
+// CHECK: 47:16: MemberRef=Data:43:15 Extent=[47:16 - 47:20]
+// CHECK: 47:21: UnexposedExpr= Extent=[47:21 - 47:22]
+// CHECK: 47:21: UnexposedExpr= Extent=[47:21 - 47:22]
+// CHECK: 47:25: MemberRef=Length:44:10 Extent=[47:25 - 47:31]
+// CHECK: 47:32: UnexposedExpr= Extent=[47:32 - 47:33]
+// 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: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]
+// CHECK: 48:50: CallExpr=magic_length:36:8 Extent=[48:50 - 48:67]
+// CHECK: 48:50: UnexposedExpr=magic_length:36:8 Extent=[48:50 - 48:62]
+// CHECK: 48:50: DeclRefExpr=magic_length:36:8 Extent=[48:50 - 48:62]
+// 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: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]
+// CHECK: 49:53: DeclRefExpr=data:49:25 Extent=[49:53 - 49:57]
+// 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: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: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: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]
+// CHECK: 53:5: UnexposedStmt= Extent=[53:5 - 54:56]
+// CHECK: 53:12: UnexposedExpr= Extent=[53:12 - 54:56]
+// CHECK: 53:12: UnexposedExpr= Extent=[53:12 - 53:35]
+// CHECK: 53:12: UnexposedExpr=Length:44:10 Extent=[53:12 - 53:18]
+// CHECK: 53:12: MemberRefExpr=Length:44:10 Extent=[53:12 - 53:18]
+// CHECK: 53:29: MemberRefExpr=Length:44:10 Extent=[53:22 - 53:35]
+// CHECK: 53:22: DeclRefExpr=Prefix:52:29 Extent=[53:22 - 53:28]
+// CHECK: 54:11: UnexposedExpr= Extent=[54:11 - 54:56]
+// CHECK: 54:11: CallExpr=memcmp:7:7 Extent=[54:11 - 54:51]
+// CHECK: 54:11: UnexposedExpr=memcmp:7:7 Extent=[54:11 - 54:17]
+// CHECK: 54:11: DeclRefExpr=memcmp:7:7 Extent=[54:11 - 54:17]
+// CHECK: 54:18: UnexposedExpr=Data:43:15 Extent=[54:18 - 54:22]
+// CHECK: 54:18: MemberRefExpr=Data:43:15 Extent=[54:18 - 54:22]
+// CHECK: 54:24: UnexposedExpr=Data:43:15 Extent=[54:24 - 54:35]
+// CHECK: 54:31: MemberRefExpr=Data:43:15 Extent=[54:24 - 54:35]
+// CHECK: 54:24: DeclRefExpr=Prefix:52:29 Extent=[54:24 - 54:30]
+// 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: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]
+// CHECK: 57:5: UnexposedStmt= Extent=[57:5 - 58:69]
+// CHECK: 57:12: UnexposedExpr= Extent=[57:12 - 58:69]
+// CHECK: 57:12: UnexposedExpr= Extent=[57:12 - 57:35]
+// CHECK: 57:12: UnexposedExpr=Length:44:10 Extent=[57:12 - 57:18]
+// CHECK: 57:12: MemberRefExpr=Length:44:10 Extent=[57:12 - 57:18]
+// CHECK: 57:29: MemberRefExpr=Length:44:10 Extent=[57:22 - 57:35]
+// CHECK: 57:22: DeclRefExpr=Suffix:56:27 Extent=[57:22 - 57:28]
+// CHECK: 58:7: UnexposedExpr= Extent=[58:7 - 58:69]
+// CHECK: 58:7: CallExpr=memcmp:7:7 Extent=[58:7 - 58:64]
+// CHECK: 58:7: UnexposedExpr=memcmp:7:7 Extent=[58:7 - 58:13]
+// CHECK: 58:7: DeclRefExpr=memcmp:7:7 Extent=[58:7 - 58:13]
+// CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:35]
+// CHECK: 58:14: UnexposedExpr= Extent=[58:14 - 58:35]
+// CHECK: 58:14: CallExpr=end:50:12 Extent=[58:14 - 58:19]
+// CHECK: 58:14: MemberRefExpr=end:50:12 Extent=[58:14 - 58:17]
+// CHECK: 58:29: MemberRefExpr=Length:44:10 Extent=[58:22 - 58:35]
+// CHECK: 58:22: DeclRefExpr=Suffix:56:27 Extent=[58:22 - 58:28]
+// CHECK: 58:37: UnexposedExpr=Data:43:15 Extent=[58:37 - 58:48]
+// CHECK: 58:44: MemberRefExpr=Data:43:15 Extent=[58:37 - 58:48]
+// CHECK: 58:37: DeclRefExpr=Suffix:56:27 Extent=[58:37 - 58:43]
+// 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: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]
+// CHECK: 60:41: ParmDecl=N:60:41 (Definition) Extent=[60:34 - 60:49]
+// CHECK: 60:34: TypeRef=size_t:2:25 Extent=[60:34 - 60:40]
+// CHECK: 60:45: DeclRefExpr=npos:41:23 Extent=[60:45 - 60:49]
+// CHECK: 60:57: UnexposedStmt= Extent=[60:57 - 62:4]
+// CHECK: 61:5: UnexposedStmt= Extent=[61:5 - 61:59]
+// CHECK: 61:12: CallExpr= Extent=[61:12 - 61:59]
+// CHECK: 61:12: UnexposedExpr=StringRef:49:3 Extent=[61:12 - 61:59]
+// CHECK: 61:12: CallExpr=StringRef:49:3 Extent=[61:12 - 61:59]
+// CHECK: 61:12: TypeRef=class llvm::StringRef:38:7 Extent=[61:12 - 61:21]
+// CHECK: 61:22: UnexposedExpr= Extent=[61:22 - 61:34]
+// CHECK: 61:22: UnexposedExpr=Data:43:15 Extent=[61:22 - 61:26]
+// CHECK: 61:22: MemberRefExpr=Data:43:15 Extent=[61:22 - 61:26]
+// CHECK: 61:29: DeclRefExpr=Start:60:27 Extent=[61:29 - 61:34]
+// CHECK: 61:36: CallExpr=min:45:17 Extent=[61:36 - 61:58]
+// CHECK: 61:36: UnexposedExpr=min:45:17 Extent=[61:36 - 61:39]
+// CHECK: 61:36: DeclRefExpr=min:45:17 Extent=[61:36 - 61:39]
+// CHECK: 61:40: DeclRefExpr=N:60:41 Extent=[61:40 - 61:41]
+// CHECK: 61:43: UnexposedExpr= Extent=[61:43 - 61:57]
+// 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: 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: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: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]
+// CHECK: 70:41: MemberRefExpr=second:4:55 Extent=[70:12 - 70:47]
+// CHECK: 70:12: UnexposedExpr= Extent=[70:12 - 70:39]
+// 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: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: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: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]
+// CHECK: 74:21: UnexposedExpr= Extent=[74:21 - 74:48]
+// CHECK: 74:22: UnexposedExpr= Extent=[74:22 - 74:47]
+// CHECK: 74:29: TypeRef=actualtype:73:54 Extent=[74:29 - 74:39]
+// CHECK: 74:43: UnexposedExpr= Extent=[74:43 - 74:47]
+// CHECK: 74:59: UnexposedExpr= Extent=[74:59 - 74:60]
+// CHECK: 75:5: UnexposedStmt= Extent=[75:5 - 75:62]
+// CHECK: 75:12: UnexposedExpr= Extent=[75:12 - 75:62]
+// CHECK: 75:12: UnexposedExpr= Extent=[75:12 - 75:58]
+// CHECK: 75:13: UnexposedExpr= Extent=[75:13 - 75:57]
+// CHECK: 75:13: UnexposedExpr= Extent=[75:13 - 75:30]
+// CHECK: 75:14: UnexposedExpr= Extent=[75:14 - 75:29]
+// CHECK: 75:25: UnexposedExpr= Extent=[75:25 - 75:29]
+// CHECK: 75:25: UnexposedExpr= Extent=[75:25 - 75:29]
+// CHECK: 75:25: UnexposedExpr= Extent=[75:25 - 75:29]
+// CHECK: 75:25: DeclRefExpr=p:74:17 Extent=[75:25 - 75:26]
+// CHECK: 75:27: UnexposedExpr= Extent=[75:27 - 75:28]
+// CHECK: 75:33: UnexposedExpr= Extent=[75:33 - 75:57]
+// CHECK: 75:34: UnexposedExpr= Extent=[75:34 - 75:56]
+// CHECK: 75:34: UnexposedExpr= Extent=[75:34 - 75:51]
+// CHECK: 75:35: UnexposedExpr= Extent=[75:35 - 75:50]
+// CHECK: 75:46: UnexposedExpr= Extent=[75:46 - 75:50]
+// CHECK: 75:46: UnexposedExpr= Extent=[75:46 - 75:50]
+// CHECK: 75:46: UnexposedExpr= Extent=[75:46 - 75:50]
+// CHECK: 75:46: DeclRefExpr=p:74:17 Extent=[75:46 - 75:47]
+// CHECK: 75:48: UnexposedExpr= Extent=[75:48 - 75:49]
+// 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: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]
+// CHECK: 78:12: UnexposedExpr=StringRef:49:3 Extent=[78:12 - 78:56]
+// CHECK: 78:12: CallExpr=StringRef:49:3 Extent=[78:12 - 78:56]
+// CHECK: 78:28: CallExpr=getNameStart:68:15 Extent=[78:28 - 78:42]
+// CHECK: 78:28: MemberRefExpr=getNameStart:68:15 Extent=[78:28 - 78:40]
+// 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: 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: 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: 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: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]
+// CHECK: 87:45: UnexposedExpr= Extent=[87:45 - 87:50]
+// CHECK: 87:46: DeclRefExpr=Str:87:35 Extent=[87:46 - 87:49]
+// CHECK: 87:52: MemberRef=Result:85:12 Extent=[87:52 - 87:58]
+// CHECK: 87:58: UnexposedExpr= Extent=[87:58 - 87:61]
+// CHECK: 87:59: UnexposedExpr= Extent=[87:59 - 87:60]
+// 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: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: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: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: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: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]
+// CHECK: 101:19: VarDecl=AttrName:101:19 (Definition) Extent=[101:3 - 101:45]
+// CHECK: 101:30: CallExpr= Extent=[101:30 - 101:45]
+// CHECK: 101:30: UnexposedExpr=getName:77:19 Extent=[101:30 - 101:45]
+// CHECK: 101:30: CallExpr=getName:77:19 Extent=[101:30 - 101:45]
+// CHECK: 101:36: MemberRefExpr=getName:77:19 Extent=[101:30 - 101:43]
+// CHECK: 101:30: DeclRefExpr=Name:100:67 Extent=[101:30 - 101:34]
+// CHECK: 102:3: UnexposedStmt= Extent=[102:3 - 103:55]
+// CHECK: 102:7: UnexposedExpr= Extent=[102:7 - 102:59]
+// CHECK: 102:7: CallExpr=startswith:52:8 Extent=[102:7 - 102:32]
+// CHECK: 102:16: MemberRefExpr=startswith:52:8 Extent=[102:7 - 102:26]
+// CHECK: 102:7: UnexposedExpr=AttrName:101:19 Extent=[102:7 - 102:15]
+// CHECK: 102:7: DeclRefExpr=AttrName:101:19 Extent=[102:7 - 102:15]
+// CHECK: 102:27: CallExpr= Extent=[102:27 - 102:31]
+// CHECK: 102:27: UnexposedExpr=StringRef:48:3 Extent=[102:27 - 102:31]
+// CHECK: 102:27: UnexposedExpr=StringRef:48:3 Extent=[102:27 - 102:31]
+// CHECK: 102:27: CallExpr=StringRef:48:3 Extent=[102:27 - 102:31]
+// CHECK: 102:27: UnexposedExpr= Extent=[102:27 - 102:31]
+// CHECK: 102:27: UnexposedExpr= Extent=[102:27 - 102:31]
+// CHECK: 102:36: CallExpr=endswith:56:8 Extent=[102:36 - 102:59]
+// CHECK: 102:45: MemberRefExpr=endswith:56:8 Extent=[102:36 - 102:53]
+// CHECK: 102:36: UnexposedExpr=AttrName:101:19 Extent=[102:36 - 102:44]
+// CHECK: 102:36: DeclRefExpr=AttrName:101:19 Extent=[102:36 - 102:44]
+// CHECK: 102:54: CallExpr= Extent=[102:54 - 102:58]
+// CHECK: 102:54: UnexposedExpr=StringRef:48:3 Extent=[102:54 - 102:58]
+// CHECK: 102:54: UnexposedExpr=StringRef:48:3 Extent=[102:54 - 102:58]
+// CHECK: 102:54: CallExpr=StringRef:48:3 Extent=[102:54 - 102:58]
+// CHECK: 102:54: UnexposedExpr= Extent=[102:54 - 102:58]
+// CHECK: 102:54: UnexposedExpr= Extent=[102:54 - 102:58]
+// CHECK: 103:5: CallExpr=operator=:38:7 Extent=[103:5 - 103:55]
+// CHECK: 103:5: DeclRefExpr=AttrName:101:19 Extent=[103:5 - 103:13]
+// CHECK: 103:14: UnexposedExpr=operator=:38:7
+// CHECK: 103:14: DeclRefExpr=operator=:38:7
+// CHECK: 103:16: UnexposedExpr=substr:60:13 Extent=[103:16 - 103:55]
+// CHECK: 103:16: CallExpr=substr:60:13 Extent=[103:16 - 103:55]
+// CHECK: 103:25: MemberRefExpr=substr:60:13 Extent=[103:16 - 103:31]
+// CHECK: 103:16: UnexposedExpr=AttrName:101:19 Extent=[103:16 - 103:24]
+// CHECK: 103:16: DeclRefExpr=AttrName:101:19 Extent=[103:16 - 103:24]
+// CHECK: 103:32: UnexposedExpr= Extent=[103:32 - 103:33]
+// CHECK: 103:32: UnexposedExpr= Extent=[103:32 - 103:33]
+// CHECK: 103:35: UnexposedExpr= Extent=[103:35 - 103:54]
+// CHECK: 103:35: CallExpr=size:51:10 Extent=[103:35 - 103:50]
+// CHECK: 103:44: MemberRefExpr=size:51:10 Extent=[103:35 - 103:48]
+// CHECK: 103:35: UnexposedExpr=AttrName:101:19 Extent=[103:35 - 103:43]
+// CHECK: 103:35: DeclRefExpr=AttrName:101:19 Extent=[103:35 - 103:43]
+// 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:16: TemplateRef=StringSwitch:83:47 Extent=[105:16 - 105:28]
+// CHECK: 105:16: CallExpr=StringSwitch:87:12 Extent=[105:16 - 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]
+// CHECK: 106:11: UnexposedExpr= Extent=[106:11 - 106:17]
+// CHECK: 106:19: DeclRefExpr=AT_weak:29:45 Extent=[106:19 - 106:26]
+// CHECK: 107:11: UnexposedExpr= Extent=[107:11 - 107:20]
+// CHECK: 107:22: DeclRefExpr=AT_weakref:29:54 Extent=[107:22 - 107:32]
+// CHECK: 108:11: UnexposedExpr= Extent=[108:11 - 108:17]
+// CHECK: 108:19: DeclRefExpr=AT_pure:26:49 Extent=[108:19 - 108:26]
+// CHECK: 109:11: UnexposedExpr= Extent=[109:11 - 109:17]
+// CHECK: 109:19: DeclRefExpr=AT_mode:20:44 Extent=[109:19 - 109:26]
+// CHECK: 110:11: UnexposedExpr= Extent=[110:11 - 110:17]
+// CHECK: 110:19: DeclRefExpr=AT_used:28:34 Extent=[110:19 - 110:26]
+// CHECK: 111:11: UnexposedExpr= Extent=[111:11 - 111:18]
+// CHECK: 111:20: DeclRefExpr=AT_alias:15:25 Extent=[111:20 - 111:28]
+// CHECK: 112:11: UnexposedExpr= Extent=[112:11 - 112:18]
+// CHECK: 112:20: DeclRefExpr=AT_aligned:15:35 Extent=[112:20 - 112:30]
+// CHECK: 113:11: UnexposedExpr= Extent=[113:11 - 113:18]
+// CHECK: 113:20: DeclRefExpr=AT_final:19:40 Extent=[113:20 - 113:28]
+// CHECK: 114:11: UnexposedExpr= Extent=[114:11 - 114:18]
+// CHECK: 114:20: DeclRefExpr=AT_cdecl:17:30 Extent=[114:20 - 114:28]
+// CHECK: 115:11: UnexposedExpr= Extent=[115:11 - 115:18]
+// CHECK: 115:20: DeclRefExpr=AT_const:17:52 Extent=[115:20 - 115:28]
+// CHECK: 116:11: UnexposedExpr= Extent=[116:11 - 116:20]
+// CHECK: 116:22: DeclRefExpr=AT_const:17:52 Extent=[116:22 - 116:30]
+// CHECK: 117:11: UnexposedExpr= Extent=[117:11 - 117:19]
+// CHECK: 117:21: DeclRefExpr=AT_blocks:16:57 Extent=[117:21 - 117:30]
+// CHECK: 118:11: UnexposedExpr= Extent=[118:11 - 118:19]
+// CHECK: 118:21: DeclRefExpr=AT_format:19:50 Extent=[118:21 - 118:30]
+// CHECK: 119:11: UnexposedExpr= Extent=[119:11 - 119:19]
+// CHECK: 119:21: DeclRefExpr=AT_hiding:20:22 Extent=[119:21 - 119:30]
+// CHECK: 120:11: UnexposedExpr= Extent=[120:11 - 120:19]
+// CHECK: 120:21: DeclRefExpr=AT_malloc:20:33 Extent=[120:21 - 120:30]
+// CHECK: 121:11: UnexposedExpr= Extent=[121:11 - 121:19]
+// CHECK: 121:21: DeclRefExpr=AT_packed:26:27 Extent=[121:21 - 121:30]
+// CHECK: 122:11: UnexposedExpr= Extent=[122:11 - 122:19]
+// CHECK: 122:21: DeclRefExpr=AT_unused:28:23 Extent=[122:21 - 122:30]
+// CHECK: 123:11: UnexposedExpr= Extent=[123:11 - 123:20]
+// CHECK: 123:22: DeclRefExpr=AT_aligned:15:35 Extent=[123:22 - 123:32]
+// CHECK: 124:11: UnexposedExpr= Extent=[124:11 - 124:20]
+// CHECK: 124:22: DeclRefExpr=AT_cleanup:17:40 Extent=[124:22 - 124:32]
+// CHECK: 125:11: UnexposedExpr= Extent=[125:11 - 125:18]
+// CHECK: 125:20: DeclRefExpr=AT_naked:20:53 Extent=[125:20 - 125:28]
+// CHECK: 126:11: UnexposedExpr= Extent=[126:11 - 126:20]
+// CHECK: 126:22: DeclRefExpr=AT_nodebug:20:63 Extent=[126:22 - 126:32]
+// CHECK: 127:11: UnexposedExpr= Extent=[127:11 - 127:20]
+// CHECK: 127:22: DeclRefExpr=AT_nonnull:21:47 Extent=[127:22 - 127:32]
+// CHECK: 128:11: UnexposedExpr= Extent=[128:11 - 128:20]
+// CHECK: 128:22: DeclRefExpr=AT_nothrow:22:7 Extent=[128:22 - 128:32]
+// CHECK: 129:11: UnexposedExpr= Extent=[129:11 - 129:20]
+// CHECK: 129:22: DeclRefExpr=AT_objc_gc:24:59 Extent=[129:22 - 129:32]
+// CHECK: 130:11: UnexposedExpr= Extent=[130:11 - 130:20]
+// CHECK: 130:22: DeclRefExpr=AT_regparm:26:58 Extent=[130:22 - 130:32]
+// CHECK: 131:11: UnexposedExpr= Extent=[131:11 - 131:20]
+// CHECK: 131:22: DeclRefExpr=AT_section:27:7 Extent=[131:22 - 131:32]
+// CHECK: 132:11: UnexposedExpr= Extent=[132:11 - 132:20]
+// CHECK: 132:22: DeclRefExpr=AT_stdcall:27:32 Extent=[132:22 - 132:32]
+// CHECK: 133:11: UnexposedExpr= Extent=[133:11 - 133:21]
+// CHECK: 133:23: DeclRefExpr=AT_annotate:16:29 Extent=[133:23 - 133:34]
+// CHECK: 134:11: UnexposedExpr= Extent=[134:11 - 134:21]
+// CHECK: 134:23: DeclRefExpr=AT_fastcall:19:27 Extent=[134:23 - 134:34]
+// CHECK: 135:11: UnexposedExpr= Extent=[135:11 - 135:21]
+// CHECK: 135:23: DeclRefExpr=AT_IBAction:14:7 Extent=[135:23 - 135:34]
+// CHECK: 136:11: UnexposedExpr= Extent=[136:11 - 136:21]
+// CHECK: 136:23: DeclRefExpr=AT_IBOutlet:14:20 Extent=[136:23 - 136:34]
+// CHECK: 137:11: UnexposedExpr= Extent=[137:11 - 137:31]
+// CHECK: 137:33: DeclRefExpr=AT_IBOutletCollection:14:33 Extent=[137:33 - 137:54]
+// CHECK: 138:11: UnexposedExpr= Extent=[138:11 - 138:21]
+// CHECK: 138:23: DeclRefExpr=AT_noreturn:21:59 Extent=[138:23 - 138:34]
+// CHECK: 139:11: UnexposedExpr= Extent=[139:11 - 139:21]
+// CHECK: 139:23: DeclRefExpr=AT_noinline:21:7 Extent=[139:23 - 139:34]
+// CHECK: 140:11: UnexposedExpr= Extent=[140:11 - 140:21]
+// CHECK: 140:23: DeclRefExpr=AT_override:22:51 Extent=[140:23 - 140:34]
+// CHECK: 141:11: UnexposedExpr= Extent=[141:11 - 141:21]
+// CHECK: 141:23: DeclRefExpr=AT_sentinel:27:19 Extent=[141:23 - 141:34]
+// CHECK: 142:11: UnexposedExpr= Extent=[142:11 - 142:21]
+// CHECK: 142:23: DeclRefExpr=AT_nsobject:22:19 Extent=[142:23 - 142:34]
+// CHECK: 143:11: UnexposedExpr= Extent=[143:11 - 143:22]
+// CHECK: 143:24: DeclRefExpr=AT_dllimport:18:51 Extent=[143:24 - 143:36]
+// CHECK: 144:11: UnexposedExpr= Extent=[144:11 - 144:22]
+// CHECK: 144:24: DeclRefExpr=AT_dllexport:18:37 Extent=[144:24 - 144:36]
+// CHECK: 145:11: UnexposedExpr= Extent=[145:11 - 145:22]
+// CHECK: 145:24: DeclRefExpr=IgnoredAttribute:31:7 Extent=[145:24 - 145:40]
+// CHECK: 146:11: UnexposedExpr= Extent=[146:11 - 146:23]
+// CHECK: 146:25: DeclRefExpr=AT_base_check:16:42 Extent=[146:25 - 146:38]
+// CHECK: 147:11: UnexposedExpr= Extent=[147:11 - 147:23]
+// CHECK: 147:25: DeclRefExpr=AT_deprecated:18:7 Extent=[147:25 - 147:38]
+// CHECK: 148:11: UnexposedExpr= Extent=[148:11 - 148:23]
+// CHECK: 148:25: DeclRefExpr=AT_visibility:29:7 Extent=[148:25 - 148:38]
+// CHECK: 149:11: UnexposedExpr= Extent=[149:11 - 149:23]
+// CHECK: 149:25: DeclRefExpr=AT_destructor:18:22 Extent=[149:25 - 149:38]
+// CHECK: 150:11: UnexposedExpr= Extent=[150:11 - 150:23]
+// CHECK: 150:25: DeclRefExpr=AT_format_arg:19:61 Extent=[150:25 - 150:38]
+// CHECK: 151:11: UnexposedExpr= Extent=[151:11 - 151:23]
+// CHECK: 151:25: DeclRefExpr=AT_gnu_inline:20:7 Extent=[151:25 - 151:38]
+// CHECK: 152:11: UnexposedExpr= Extent=[152:11 - 152:24]
+// CHECK: 152:26: DeclRefExpr=AT_weak_import:30:7 Extent=[152:26 - 152:40]
+// CHECK: 153:11: UnexposedExpr= Extent=[153:11 - 153:22]
+// CHECK: 153:24: DeclRefExpr=AT_vecreturn:28:43 Extent=[153:24 - 153:36]
+// CHECK: 154:11: UnexposedExpr= Extent=[154:11 - 154:24]
+// CHECK: 154:26: DeclRefExpr=AT_vector_size:28:57 Extent=[154:26 - 154:40]
+// CHECK: 155:11: UnexposedExpr= Extent=[155:11 - 155:24]
+// CHECK: 155:26: DeclRefExpr=AT_constructor:17:62 Extent=[155:26 - 155:40]
+// CHECK: 156:11: UnexposedExpr= Extent=[156:11 - 156:24]
+// CHECK: 156:26: DeclRefExpr=AT_unavailable:28:7 Extent=[156:26 - 156:40]
+// CHECK: 157:11: UnexposedExpr= Extent=[157:11 - 157:25]
+// CHECK: 157:27: DeclRefExpr=AT_overloadable:25:7 Extent=[157:27 - 157:42]
+// CHECK: 158:11: UnexposedExpr= Extent=[158:11 - 158:26]
+// CHECK: 158:28: DeclRefExpr=AT_address_space:15:7 Extent=[158:28 - 158:44]
+// CHECK: 159:11: UnexposedExpr= Extent=[159:11 - 159:26]
+// CHECK: 159:28: DeclRefExpr=AT_always_inline:15:47 Extent=[159:28 - 159:44]
+// CHECK: 160:11: UnexposedExpr= Extent=[160:11 - 160:26]
+// CHECK: 160:28: DeclRefExpr=IgnoredAttribute:31:7 Extent=[160:28 - 160:44]
+// CHECK: 161:11: UnexposedExpr= Extent=[161:11 - 161:26]
+// CHECK: 161:28: DeclRefExpr=IgnoredAttribute:31:7 Extent=[161:28 - 161:44]
+// CHECK: 162:11: UnexposedExpr= Extent=[162:11 - 162:27]
+// CHECK: 162:29: DeclRefExpr=AT_objc_exception:22:32 Extent=[162:29 - 162:46]
+// CHECK: 163:11: UnexposedExpr= Extent=[163:11 - 163:28]
+// CHECK: 163:30: DeclRefExpr=AT_ext_vector_type:19:7 Extent=[163:30 - 163:48]
+// CHECK: 164:11: UnexposedExpr= Extent=[164:11 - 164:30]
+// CHECK: 164:32: DeclRefExpr=AT_transparent_union:27:57 Extent=[164:32 - 164:52]
+// CHECK: 165:11: UnexposedExpr= Extent=[165:11 - 165:30]
+// CHECK: 165:32: DeclRefExpr=AT_analyzer_noreturn:16:7 Extent=[165:32 - 165:52]
+// CHECK: 166:11: UnexposedExpr= Extent=[166:11 - 166:31]
+// CHECK: 166:33: DeclRefExpr=AT_warn_unused_result:29:22 Extent=[166:33 - 166:54]
+// CHECK: 167:11: UnexposedExpr= Extent=[167:11 - 167:31]
+// CHECK: 167:33: DeclRefExpr=AT_carries_dependency:17:7 Extent=[167:33 - 167:54]
+// CHECK: 168:11: UnexposedExpr= Extent=[168:11 - 168:36]
+// CHECK: 168:38: DeclRefExpr=AT_ns_returns_not_retained:24:7 Extent=[168:38 - 168:64]
+// CHECK: 169:11: UnexposedExpr= Extent=[169:11 - 169:32]
+// CHECK: 169:34: DeclRefExpr=AT_ns_returns_retained:24:35 Extent=[169:34 - 169:56]
+// CHECK: 170:11: UnexposedExpr= Extent=[170:11 - 170:36]
+// CHECK: 170:38: DeclRefExpr=AT_cf_returns_not_retained:23:7 Extent=[170:38 - 170:64]
+// CHECK: 171:11: UnexposedExpr= Extent=[171:11 - 171:32]
+// CHECK: 171:34: DeclRefExpr=AT_cf_returns_retained:23:35 Extent=[171:34 - 171:56]
+// CHECK: 172:11: UnexposedExpr= Extent=[172:11 - 172:30]
+// CHECK: 172:32: DeclRefExpr=AT_ownership_returns:25:44 Extent=[172:32 - 172:52]
+// CHECK: 173:11: UnexposedExpr= Extent=[173:11 - 173:28]
+// CHECK: 173:30: DeclRefExpr=AT_ownership_holds:25:24 Extent=[173:30 - 173:48]
+// CHECK: 174:11: UnexposedExpr= Extent=[174:11 - 174:28]
+// CHECK: 174:30: DeclRefExpr=AT_ownership_takes:26:7 Extent=[174:30 - 174:48]
+// CHECK: 175:11: UnexposedExpr= Extent=[175:11 - 175:33]
+// CHECK: 175:35: DeclRefExpr=AT_reqd_wg_size:30:23 Extent=[175:35 - 175:50]
+// CHECK: 176:11: UnexposedExpr= Extent=[176:11 - 176:26]
+// CHECK: 176:28: DeclRefExpr=AT_init_priority:30:40 Extent=[176:28 - 176:44]
+// CHECK: 177:11: UnexposedExpr= Extent=[177:11 - 177:35]
+// CHECK: 177:37: DeclRefExpr=AT_no_instrument_function:21:20 Extent=[177:37 - 177:62]
+// CHECK: 178:11: UnexposedExpr= Extent=[178:11 - 178:21]
+// CHECK: 178:23: DeclRefExpr=AT_thiscall:27:44 Extent=[178:23 - 178:34]
+// CHECK: 179:11: UnexposedExpr= Extent=[179:11 - 179:19]
+// CHECK: 179:21: DeclRefExpr=AT_pascal:26:38 Extent=[179:21 - 179:30]
+// CHECK: 180:11: UnexposedExpr= Extent=[180:11 - 180:20]
+// CHECK: 180:22: DeclRefExpr=AT_cdecl:17:30 Extent=[180:22 - 180:30]
+// CHECK: 181:11: UnexposedExpr= Extent=[181:11 - 181:22]
+// CHECK: 181:24: DeclRefExpr=AT_stdcall:27:32 Extent=[181:24 - 181:34]
+// CHECK: 182:11: UnexposedExpr= Extent=[182:11 - 182:23]
+// CHECK: 182:25: DeclRefExpr=AT_fastcall:19:27 Extent=[182:25 - 182:36]
+// CHECK: 183:11: UnexposedExpr= Extent=[183:11 - 183:23]
+// CHECK: 183:25: DeclRefExpr=AT_thiscall:27:44 Extent=[183:25 - 183:36]
+// CHECK: 184:11: UnexposedExpr= Extent=[184:11 - 184:21]
+// CHECK: 184:23: DeclRefExpr=AT_pascal:26:38 Extent=[184:23 - 184:32]
+// CHECK: 185:14: DeclRefExpr=UnknownAttribute:31:25 Extent=[185:14 - 185:30]
+
diff --git a/test/Index/recursive-member-access.c b/test/Index/recursive-member-access.c
new file mode 100644
index 000000000000..c76fa0e50401
--- /dev/null
+++ b/test/Index/recursive-member-access.c
@@ -0,0 +1,532 @@
+struct rdar8650865 {
+ struct rdar8650865 *first;
+ int x;
+};
+
+int test_rdar8650865(struct rdar8650865 *s) {
+ return ((((((s->first)->first)
+ ->first)
+ ->first)
+ ->first)
+ ->first)
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->first
+ ->x;
+}
+
+// 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: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: 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]
+// CHECK: 123:7: MemberRefExpr=x:3:7 Extent=[7:10 - 123:8]
+// CHECK: 122:7: MemberRefExpr=first:2:23 Extent=[7:10 - 122:12]
+// CHECK: 121:7: MemberRefExpr=first:2:23 Extent=[7:10 - 121:12]
+// CHECK: 120:7: MemberRefExpr=first:2:23 Extent=[7:10 - 120:12]
+// CHECK: 119:7: MemberRefExpr=first:2:23 Extent=[7:10 - 119:12]
+// CHECK: 118:7: MemberRefExpr=first:2:23 Extent=[7:10 - 118:12]
+// CHECK: 117:7: MemberRefExpr=first:2:23 Extent=[7:10 - 117:12]
+// CHECK: 116:7: MemberRefExpr=first:2:23 Extent=[7:10 - 116:12]
+// CHECK: 115:7: MemberRefExpr=first:2:23 Extent=[7:10 - 115:12]
+// CHECK: 114:7: MemberRefExpr=first:2:23 Extent=[7:10 - 114:12]
+// CHECK: 113:7: MemberRefExpr=first:2:23 Extent=[7:10 - 113:12]
+// CHECK: 112:7: MemberRefExpr=first:2:23 Extent=[7:10 - 112:12]
+// CHECK: 111:7: MemberRefExpr=first:2:23 Extent=[7:10 - 111:12]
+// CHECK: 110:7: MemberRefExpr=first:2:23 Extent=[7:10 - 110:12]
+// CHECK: 109:7: MemberRefExpr=first:2:23 Extent=[7:10 - 109:12]
+// CHECK: 108:7: MemberRefExpr=first:2:23 Extent=[7:10 - 108:12]
+// CHECK: 107:7: MemberRefExpr=first:2:23 Extent=[7:10 - 107:12]
+// CHECK: 106:7: MemberRefExpr=first:2:23 Extent=[7:10 - 106:12]
+// CHECK: 105:7: MemberRefExpr=first:2:23 Extent=[7:10 - 105:12]
+// CHECK: 104:7: MemberRefExpr=first:2:23 Extent=[7:10 - 104:12]
+// CHECK: 103:7: MemberRefExpr=first:2:23 Extent=[7:10 - 103:12]
+// CHECK: 102:7: MemberRefExpr=first:2:23 Extent=[7:10 - 102:12]
+// CHECK: 101:7: MemberRefExpr=first:2:23 Extent=[7:10 - 101:12]
+// CHECK: 100:7: MemberRefExpr=first:2:23 Extent=[7:10 - 100:12]
+// CHECK: 99:7: MemberRefExpr=first:2:23 Extent=[7:10 - 99:12]
+// CHECK: 98:7: MemberRefExpr=first:2:23 Extent=[7:10 - 98:12]
+// CHECK: 97:7: MemberRefExpr=first:2:23 Extent=[7:10 - 97:12]
+// CHECK: 96:7: MemberRefExpr=first:2:23 Extent=[7:10 - 96:12]
+// CHECK: 95:7: MemberRefExpr=first:2:23 Extent=[7:10 - 95:12]
+// CHECK: 94:7: MemberRefExpr=first:2:23 Extent=[7:10 - 94:12]
+// CHECK: 93:7: MemberRefExpr=first:2:23 Extent=[7:10 - 93:12]
+// CHECK: 92:7: MemberRefExpr=first:2:23 Extent=[7:10 - 92:12]
+// CHECK: 91:7: MemberRefExpr=first:2:23 Extent=[7:10 - 91:12]
+// CHECK: 90:7: MemberRefExpr=first:2:23 Extent=[7:10 - 90:12]
+// CHECK: 89:7: MemberRefExpr=first:2:23 Extent=[7:10 - 89:12]
+// CHECK: 88:7: MemberRefExpr=first:2:23 Extent=[7:10 - 88:12]
+// CHECK: 87:7: MemberRefExpr=first:2:23 Extent=[7:10 - 87:12]
+// CHECK: 86:7: MemberRefExpr=first:2:23 Extent=[7:10 - 86:12]
+// CHECK: 85:7: MemberRefExpr=first:2:23 Extent=[7:10 - 85:12]
+// CHECK: 84:7: MemberRefExpr=first:2:23 Extent=[7:10 - 84:12]
+// CHECK: 83:7: MemberRefExpr=first:2:23 Extent=[7:10 - 83:12]
+// CHECK: 82:7: MemberRefExpr=first:2:23 Extent=[7:10 - 82:12]
+// CHECK: 81:7: MemberRefExpr=first:2:23 Extent=[7:10 - 81:12]
+// CHECK: 80:7: MemberRefExpr=first:2:23 Extent=[7:10 - 80:12]
+// CHECK: 79:7: MemberRefExpr=first:2:23 Extent=[7:10 - 79:12]
+// CHECK: 78:7: MemberRefExpr=first:2:23 Extent=[7:10 - 78:12]
+// CHECK: 77:7: MemberRefExpr=first:2:23 Extent=[7:10 - 77:12]
+// CHECK: 76:7: MemberRefExpr=first:2:23 Extent=[7:10 - 76:12]
+// CHECK: 75:7: MemberRefExpr=first:2:23 Extent=[7:10 - 75:12]
+// CHECK: 74:7: MemberRefExpr=first:2:23 Extent=[7:10 - 74:12]
+// CHECK: 73:7: MemberRefExpr=first:2:23 Extent=[7:10 - 73:12]
+// CHECK: 72:7: MemberRefExpr=first:2:23 Extent=[7:10 - 72:12]
+// CHECK: 71:7: MemberRefExpr=first:2:23 Extent=[7:10 - 71:12]
+// CHECK: 70:7: MemberRefExpr=first:2:23 Extent=[7:10 - 70:12]
+// CHECK: 69:7: MemberRefExpr=first:2:23 Extent=[7:10 - 69:12]
+// CHECK: 68:7: MemberRefExpr=first:2:23 Extent=[7:10 - 68:12]
+// CHECK: 67:7: MemberRefExpr=first:2:23 Extent=[7:10 - 67:12]
+// CHECK: 66:7: MemberRefExpr=first:2:23 Extent=[7:10 - 66:12]
+// CHECK: 65:7: MemberRefExpr=first:2:23 Extent=[7:10 - 65:12]
+// CHECK: 64:7: MemberRefExpr=first:2:23 Extent=[7:10 - 64:12]
+// CHECK: 63:7: MemberRefExpr=first:2:23 Extent=[7:10 - 63:12]
+// CHECK: 62:7: MemberRefExpr=first:2:23 Extent=[7:10 - 62:12]
+// CHECK: 61:7: MemberRefExpr=first:2:23 Extent=[7:10 - 61:12]
+// CHECK: 60:7: MemberRefExpr=first:2:23 Extent=[7:10 - 60:12]
+// CHECK: 59:7: MemberRefExpr=first:2:23 Extent=[7:10 - 59:12]
+// CHECK: 58:7: MemberRefExpr=first:2:23 Extent=[7:10 - 58:12]
+// CHECK: 57:7: MemberRefExpr=first:2:23 Extent=[7:10 - 57:12]
+// CHECK: 56:7: MemberRefExpr=first:2:23 Extent=[7:10 - 56:12]
+// CHECK: 55:7: MemberRefExpr=first:2:23 Extent=[7:10 - 55:12]
+// CHECK: 54:7: MemberRefExpr=first:2:23 Extent=[7:10 - 54:12]
+// CHECK: 53:7: MemberRefExpr=first:2:23 Extent=[7:10 - 53:12]
+// CHECK: 52:7: MemberRefExpr=first:2:23 Extent=[7:10 - 52:12]
+// CHECK: 51:7: MemberRefExpr=first:2:23 Extent=[7:10 - 51:12]
+// CHECK: 50:7: MemberRefExpr=first:2:23 Extent=[7:10 - 50:12]
+// CHECK: 49:7: MemberRefExpr=first:2:23 Extent=[7:10 - 49:12]
+// CHECK: 48:7: MemberRefExpr=first:2:23 Extent=[7:10 - 48:12]
+// CHECK: 47:7: MemberRefExpr=first:2:23 Extent=[7:10 - 47:12]
+// CHECK: 46:7: MemberRefExpr=first:2:23 Extent=[7:10 - 46:12]
+// CHECK: 45:7: MemberRefExpr=first:2:23 Extent=[7:10 - 45:12]
+// CHECK: 44:7: MemberRefExpr=first:2:23 Extent=[7:10 - 44:12]
+// CHECK: 43:7: MemberRefExpr=first:2:23 Extent=[7:10 - 43:12]
+// CHECK: 42:7: MemberRefExpr=first:2:23 Extent=[7:10 - 42:12]
+// CHECK: 41:7: MemberRefExpr=first:2:23 Extent=[7:10 - 41:12]
+// CHECK: 40:7: MemberRefExpr=first:2:23 Extent=[7:10 - 40:12]
+// CHECK: 39:7: MemberRefExpr=first:2:23 Extent=[7:10 - 39:12]
+// CHECK: 38:7: MemberRefExpr=first:2:23 Extent=[7:10 - 38:12]
+// CHECK: 37:7: MemberRefExpr=first:2:23 Extent=[7:10 - 37:12]
+// CHECK: 36:7: MemberRefExpr=first:2:23 Extent=[7:10 - 36:12]
+// CHECK: 35:7: MemberRefExpr=first:2:23 Extent=[7:10 - 35:12]
+// CHECK: 34:7: MemberRefExpr=first:2:23 Extent=[7:10 - 34:12]
+// CHECK: 33:7: MemberRefExpr=first:2:23 Extent=[7:10 - 33:12]
+// CHECK: 32:7: MemberRefExpr=first:2:23 Extent=[7:10 - 32:12]
+// CHECK: 31:7: MemberRefExpr=first:2:23 Extent=[7:10 - 31:12]
+// CHECK: 30:7: MemberRefExpr=first:2:23 Extent=[7:10 - 30:12]
+// CHECK: 29:7: MemberRefExpr=first:2:23 Extent=[7:10 - 29:12]
+// CHECK: 28:7: MemberRefExpr=first:2:23 Extent=[7:10 - 28:12]
+// CHECK: 27:7: MemberRefExpr=first:2:23 Extent=[7:10 - 27:12]
+// CHECK: 26:7: MemberRefExpr=first:2:23 Extent=[7:10 - 26:12]
+// CHECK: 25:7: MemberRefExpr=first:2:23 Extent=[7:10 - 25:12]
+// CHECK: 24:7: MemberRefExpr=first:2:23 Extent=[7:10 - 24:12]
+// CHECK: 23:7: MemberRefExpr=first:2:23 Extent=[7:10 - 23:12]
+// CHECK: 22:7: MemberRefExpr=first:2:23 Extent=[7:10 - 22:12]
+// CHECK: 21:7: MemberRefExpr=first:2:23 Extent=[7:10 - 21:12]
+// CHECK: 20:7: MemberRefExpr=first:2:23 Extent=[7:10 - 20:12]
+// CHECK: 19:7: MemberRefExpr=first:2:23 Extent=[7:10 - 19:12]
+// CHECK: 18:7: MemberRefExpr=first:2:23 Extent=[7:10 - 18:12]
+// CHECK: 17:7: MemberRefExpr=first:2:23 Extent=[7:10 - 17:12]
+// CHECK: 16:7: MemberRefExpr=first:2:23 Extent=[7:10 - 16:12]
+// CHECK: 15:7: MemberRefExpr=first:2:23 Extent=[7:10 - 15:12]
+// CHECK: 14:7: MemberRefExpr=first:2:23 Extent=[7:10 - 14:12]
+// CHECK: 13:7: MemberRefExpr=first:2:23 Extent=[7:10 - 13:12]
+// CHECK: 12:7: MemberRefExpr=first:2:23 Extent=[7:10 - 12:12]
+// CHECK: 11:7: MemberRefExpr=first:2:23 Extent=[7:11 - 11:12]
+// CHECK: 10:7: MemberRefExpr=first:2:23 Extent=[7:12 - 10:12]
+// CHECK: 9:7: MemberRefExpr=first:2:23 Extent=[7:13 - 9:12]
+// CHECK: 8:7: MemberRefExpr=first:2:23 Extent=[7:14 - 8:12]
+// CHECK: 7:27: MemberRefExpr=first:2:23 Extent=[7:15 - 7:32]
+// CHECK: 7:19: MemberRefExpr=first:2:23 Extent=[7:16 - 7:24]
+// CHECK: 7:16: DeclRefExpr=s:6:42 Extent=[7:16 - 7:17]
+
+// RUN: c-index-test -test-annotate-tokens=%s:1:1:124:1 %s | FileCheck -check-prefix=CHECK-tokens %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: 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)
+// CHECK-tokens: Punctuation: ";" [2:28 - 2:29] StructDecl=rdar8650865:1:8 (Definition)
+// CHECK-tokens: Keyword: "int" [3:3 - 3:6] FieldDecl=x:3:7 (Definition)
+// CHECK-tokens: Identifier: "x" [3:7 - 3:8] FieldDecl=x:3:7 (Definition)
+// CHECK-tokens: Punctuation: ";" [3:8 - 3:9] StructDecl=rdar8650865:1:8 (Definition)
+// CHECK-tokens: Punctuation: "}" [4:1 - 4:2] StructDecl=rdar8650865:1:8 (Definition)
+// CHECK-tokens: Punctuation: ";" [4:2 - 4:3]
+// 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: 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)
+// CHECK-tokens: Punctuation: ")" [6:43 - 6:44] FunctionDecl=test_rdar8650865:6:5 (Definition)
+// CHECK-tokens: Punctuation: "{" [6:45 - 6:46] UnexposedStmt=
+// CHECK-tokens: Keyword: "return" [7:3 - 7:9] UnexposedStmt=
+// CHECK-tokens: Punctuation: "(" [7:10 - 7:11] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [7:11 - 7:12] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [7:12 - 7:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [7:13 - 7:14] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [7:14 - 7:15] UnexposedExpr=
+// CHECK-tokens: Punctuation: "(" [7:15 - 7:16] UnexposedExpr=
+// CHECK-tokens: Identifier: "s" [7:16 - 7:17] DeclRefExpr=s:6:42
+// CHECK-tokens: Punctuation: "->" [7:17 - 7:19] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [7:19 - 7:24] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: ")" [7:24 - 7:25] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [7:25 - 7:27] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [7:27 - 7:32] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: ")" [7:32 - 7:33] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [8:5 - 8:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [8:7 - 8:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: ")" [8:12 - 8:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [9:5 - 9:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [9:7 - 9:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: ")" [9:12 - 9:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [10:5 - 10:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [10:7 - 10:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: ")" [10:12 - 10:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [11:5 - 11:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [11:7 - 11:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: ")" [11:12 - 11:13] UnexposedExpr=
+// CHECK-tokens: Punctuation: "->" [12:5 - 12:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [12:7 - 12:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [13:5 - 13:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [13:7 - 13:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [14:5 - 14:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [14:7 - 14:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [15:5 - 15:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [15:7 - 15:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [16:5 - 16:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [16:7 - 16:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [17:5 - 17:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [17:7 - 17:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [18:5 - 18:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [18:7 - 18:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [19:5 - 19:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [19:7 - 19:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [20:5 - 20:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [20:7 - 20:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [21:5 - 21:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [21:7 - 21:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [22:5 - 22:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [22:7 - 22:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [23:5 - 23:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [23:7 - 23:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [24:5 - 24:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [24:7 - 24:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [25:5 - 25:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [25:7 - 25:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [26:5 - 26:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [26:7 - 26:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [27:5 - 27:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [27:7 - 27:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [28:5 - 28:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [28:7 - 28:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [29:5 - 29:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [29:7 - 29:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [30:5 - 30:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [30:7 - 30:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [31:5 - 31:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [31:7 - 31:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [32:5 - 32:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [32:7 - 32:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [33:5 - 33:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [33:7 - 33:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [34:5 - 34:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [34:7 - 34:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [35:5 - 35:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [35:7 - 35:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [36:5 - 36:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [36:7 - 36:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [37:5 - 37:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [37:7 - 37:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [38:5 - 38:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [38:7 - 38:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [39:5 - 39:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [39:7 - 39:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [40:5 - 40:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [40:7 - 40:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [41:5 - 41:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [41:7 - 41:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [42:5 - 42:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [42:7 - 42:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [43:5 - 43:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [43:7 - 43:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [44:5 - 44:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [44:7 - 44:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [45:5 - 45:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [45:7 - 45:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [46:5 - 46:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [46:7 - 46:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [47:5 - 47:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [47:7 - 47:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [48:5 - 48:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [48:7 - 48:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [49:5 - 49:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [49:7 - 49:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [50:5 - 50:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [50:7 - 50:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [51:5 - 51:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [51:7 - 51:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [52:5 - 52:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [52:7 - 52:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [53:5 - 53:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [53:7 - 53:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [54:5 - 54:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [54:7 - 54:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [55:5 - 55:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [55:7 - 55:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [56:5 - 56:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [56:7 - 56:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [57:5 - 57:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [57:7 - 57:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [58:5 - 58:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [58:7 - 58:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [59:5 - 59:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [59:7 - 59:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [60:5 - 60:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [60:7 - 60:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [61:5 - 61:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [61:7 - 61:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [62:5 - 62:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [62:7 - 62:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [63:5 - 63:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [63:7 - 63:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [64:5 - 64:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [64:7 - 64:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [65:5 - 65:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [65:7 - 65:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [66:5 - 66:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [66:7 - 66:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [67:5 - 67:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [67:7 - 67:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [68:5 - 68:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [68:7 - 68:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [69:5 - 69:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [69:7 - 69:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [70:5 - 70:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [70:7 - 70:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [71:5 - 71:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [71:7 - 71:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [72:5 - 72:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [72:7 - 72:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [73:5 - 73:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [73:7 - 73:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [74:5 - 74:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [74:7 - 74:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [75:5 - 75:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [75:7 - 75:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [76:5 - 76:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [76:7 - 76:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [77:5 - 77:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [77:7 - 77:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [78:5 - 78:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [78:7 - 78:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [79:5 - 79:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [79:7 - 79:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [80:5 - 80:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [80:7 - 80:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [81:5 - 81:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [81:7 - 81:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [82:5 - 82:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [82:7 - 82:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [83:5 - 83:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [83:7 - 83:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [84:5 - 84:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [84:7 - 84:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [85:5 - 85:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [85:7 - 85:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [86:5 - 86:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [86:7 - 86:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [87:5 - 87:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [87:7 - 87:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [88:5 - 88:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [88:7 - 88:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [89:5 - 89:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [89:7 - 89:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [90:5 - 90:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [90:7 - 90:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [91:5 - 91:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [91:7 - 91:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [92:5 - 92:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [92:7 - 92:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [93:5 - 93:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [93:7 - 93:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [94:5 - 94:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [94:7 - 94:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [95:5 - 95:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [95:7 - 95:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [96:5 - 96:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [96:7 - 96:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [97:5 - 97:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [97:7 - 97:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [98:5 - 98:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [98:7 - 98:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [99:5 - 99:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [99:7 - 99:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [100:5 - 100:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [100:7 - 100:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [101:5 - 101:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [101:7 - 101:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [102:5 - 102:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [102:7 - 102:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [103:5 - 103:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [103:7 - 103:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [104:5 - 104:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [104:7 - 104:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [105:5 - 105:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [105:7 - 105:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [106:5 - 106:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [106:7 - 106:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [107:5 - 107:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [107:7 - 107:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [108:5 - 108:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [108:7 - 108:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [109:5 - 109:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [109:7 - 109:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [110:5 - 110:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [110:7 - 110:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [111:5 - 111:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [111:7 - 111:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [112:5 - 112:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [112:7 - 112:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [113:5 - 113:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [113:7 - 113:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [114:5 - 114:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [114:7 - 114:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [115:5 - 115:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [115:7 - 115:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [116:5 - 116:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [116:7 - 116:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [117:5 - 117:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [117:7 - 117:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [118:5 - 118:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [118:7 - 118:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [119:5 - 119:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [119:7 - 119:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [120:5 - 120:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [120:7 - 120:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [121:5 - 121:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [121:7 - 121:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [122:5 - 122:7] MemberRefExpr=first:2:23
+// CHECK-tokens: Identifier: "first" [122:7 - 122:12] MemberRefExpr=first:2:23
+// CHECK-tokens: Punctuation: "->" [123:5 - 123:7] MemberRefExpr=x:3:7
+// CHECK-tokens: Identifier: "x" [123:7 - 123:8] MemberRefExpr=x:3:7
+// CHECK-tokens: Punctuation: ";" [123:8 - 123:9] UnexposedStmt=
+// CHECK-tokens: Punctuation: "}" [124:1 - 124:2] UnexposedStmt=
+
+
diff --git a/test/Index/remap-complete.c b/test/Index/remap-complete.c
index 813d1dfcf41b..93fb6236c243 100644
--- a/test/Index/remap-complete.c
+++ b/test/Index/remap-complete.c
@@ -1,8 +1,4 @@
-// RUN: c-index-test -code-completion-at=%s:6:2 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s 2> %t.err | FileCheck %s
-// RUN: FileCheck -check-prefix=CHECK-DIAGS %s < %t.err
-// XFAIL: win32
+// RUN: c-index-test -code-completion-at=%s:6:2 -remap-file="%s;%S/Inputs/remap-complete-to.c" %s | FileCheck %s
// CHECK: FunctionDecl:{ResultType int}{TypedText f0}{LeftParen (}
void f() { }
-
-// CHECK-DIAGS: remap-complete.c:2:19
diff --git a/test/Index/remap-cursor-at.c b/test/Index/remap-cursor-at.c
index fb97d5d62bc7..c2bed0e69cac 100644
--- a/test/Index/remap-cursor-at.c
+++ b/test/Index/remap-cursor-at.c
@@ -1,5 +1,4 @@
// RUN: c-index-test -cursor-at=%s:1:15 -cursor-at=%s:2:21 -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck %s
-// RUN: env CINDEXTEST_USE_EXTERNAL_AST_GENERATION=1 c-index-test -cursor-at=%s:1:15 -cursor-at=%s:2:21 -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck %s
// CHECK: ParmDecl=parm1:1:13 (Definition)
// CHECK: DeclRefExpr=parm2:1:26
diff --git a/test/Index/remap-load.c b/test/Index/remap-load.c
index d9634a4af676..d54c3a107682 100644
--- a/test/Index/remap-load.c
+++ b/test/Index/remap-load.c
@@ -1,12 +1,8 @@
// RUN: c-index-test -test-load-source all -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck -check-prefix=CHECK %s
-// RUN: env CINDEXTEST_USE_EXTERNAL_AST_GENERATION=1 c-index-test -test-load-source all -remap-file="%s;%S/Inputs/remap-load-to.c" %s | FileCheck -check-prefix=CHECK %s
-// XFAIL: win32
// CHECK: remap-load.c:1:5: FunctionDecl=foo:1:5 (Definition) Extent=[1:5 - 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: <invalid loc>:0:0: UnexposedStmt= Extent=[1:33 - 3:2]
-// CHECK: <invalid loc>:0:0: UnexposedStmt= Extent=[2:3 - 2:23]
// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23]
// CHECK: remap-load.c:2:10: UnexposedExpr= Extent=[2:10 - 2:23]
// CHECK: remap-load.c:2:10: UnexposedExpr=parm1:1:13 Extent=[2:10 - 2:15]
diff --git a/test/Index/retain-target-options.c b/test/Index/retain-target-options.c
new file mode 100644
index 000000000000..d616bc225669
--- /dev/null
+++ b/test/Index/retain-target-options.c
@@ -0,0 +1,8 @@
+// RUN: c-index-test -test-load-source all -ccc-host-triple x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s
+// RUN: c-index-test -test-load-source-reparse 1 all -ccc-host-triple x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s
+// RUN: c-index-test -test-load-source-reparse 5 all -ccc-host-triple x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s
+
+// CHECK: error: #error SSE4_1 used
+#if defined(__SSE4_1__)
+#error SSE4_1 used
+#endif
diff --git a/test/Index/usrs-cxx0x.cpp b/test/Index/usrs-cxx0x.cpp
new file mode 100644
index 000000000000..a0ea6ba69cf0
--- /dev/null
+++ b/test/Index/usrs-cxx0x.cpp
@@ -0,0 +1,8 @@
+template<typename ...Types>
+struct tuple { };
+
+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]
diff --git a/test/Index/usrs.m b/test/Index/usrs.m
index 4b3de5c480ab..edfb81437d87 100644
--- a/test/Index/usrs.m
+++ b/test/Index/usrs.m
@@ -69,6 +69,17 @@ static int local_func(int x) { return x; }
- (id) meth4 { return 0; }
@end
+void aux_1(int, int, int);
+int test_multi_declaration(void) {
+ int foo = 1, bar = 2, baz = 3;
+ aux_1(foo, bar, baz);
+ return 0;
+}
+
+@protocol P1
+- (void)method;
+@end
+
// CHECK: usrs.m c:usrs.m@85@F@my_helper Extent=[3:19 - 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]
@@ -88,9 +99,9 @@ static int local_func(int x) { return x; }
// CHECK: usrs.m c:objc(cs)Foo Extent=[25:1 - 32:5]
// CHECK: usrs.m c:objc(cs)Foo@x Extent=[26:6 - 26:7]
// CHECK: usrs.m c:objc(cs)Foo@y Extent=[27:6 - 27:7]
-// CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[31:15 - 31:17]
// CHECK: usrs.m c:objc(cs)Foo(im)godzilla Extent=[29:1 - 29:17]
// CHECK: usrs.m c:objc(cs)Foo(cm)kingkong Extent=[30:1 - 30:17]
+// CHECK: usrs.m c:objc(cs)Foo(py)d1 Extent=[31:1 - 31:17]
// CHECK: usrs.m c:objc(cs)Foo(im)d1 Extent=[31:15 - 31:17]
// CHECK: usrs.m c:objc(cs)Foo(im)setD1: Extent=[31:15 - 31:17]
// CHECK: usrs.m c:usrs.m@352objc(cs)Foo(im)setD1:@d1 Extent=[31:15 - 31:17]
@@ -112,11 +123,148 @@ static int local_func(int x) { return x; }
// CHECK: usrs.m c:objc(ext)CWithExt@usrs.m@654 Extent=[57:1 - 59:5]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth3 Extent=[58:1 - 58:14]
// CHECK: usrs.m c:objc(cy)CWithExt@Bar Extent=[60:1 - 62:5]
-// CHECK: usrs.m c:objc(cy)CWithExt@Bar(im)meth4 Extent=[61:1 - 61:14]
+// CHECK: usrs.m c:objc(cs)CWithExt(im)meth4 Extent=[61:1 - 61:14]
// CHECK: usrs.m c:objc(cs)CWithExt Extent=[63:1 - 67:2]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth1 Extent=[64:1 - 64:27]
// CHECK: usrs.m c:objc(cs)CWithExt(im)meth2 Extent=[65:1 - 65:27]
// 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(cy)CWithExt@Bar(im)meth4 Extent=[69:1 - 69:27]
+// 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: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]
+// CHECK: usrs.m c:objc(pl)P1 Extent=[79:1 - 81:5]
+// 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: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]
+// CHECK-source: usrs.m:3:45: UnexposedStmt= Extent=[3:45 - 3:57]
+// CHECK-source: usrs.m:3:52: UnexposedExpr= Extent=[3:52 - 3:57]
+// CHECK-source: usrs.m:3:52: DeclRefExpr=x:3:33 Extent=[3:52 - 3:53]
+// CHECK-source: usrs.m:3:56: DeclRefExpr=y:3:40 Extent=[3:56 - 3:57]
+// CHECK-source: usrs.m:5:1: EnumDecl=:5:1 (Definition) Extent=[5:1 - 8:2]
+// CHECK-source: usrs.m:6:3: EnumConstantDecl=ABA:6:3 (Definition) Extent=[6:3 - 6:6]
+// CHECK-source: usrs.m:7:3: EnumConstantDecl=CADABA:7:3 (Definition) Extent=[7:3 - 7:9]
+// CHECK-source: usrs.m:10:1: EnumDecl=:10:1 (Definition) Extent=[10:1 - 13:2]
+// 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: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: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: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]
+// CHECK-source: usrs.m:30:1: ObjCClassMethodDecl=kingkong:30:1 Extent=[30:1 - 30:17]
+// CHECK-source: usrs.m:30:4: TypeRef=id:0:0 Extent=[30:4 - 30:6]
+// CHECK-source: usrs.m:31:15: ObjCPropertyDecl=d1:31:15 Extent=[31:1 - 31:17]
+// CHECK-source: usrs.m:31:15: ObjCInstanceMethodDecl=d1:31:15 Extent=[31:15 - 31:17]
+// CHECK-source: usrs.m:31:15: ObjCInstanceMethodDecl=setD1::31:15 Extent=[31:15 - 31:17]
+// CHECK-source: usrs.m:31:15: ParmDecl=d1:31:15 (Definition) Extent=[31:15 - 31:17]
+// CHECK-source: usrs.m:34:1: ObjCImplementationDecl=Foo:34:1 (Definition) Extent=[34:1 - 45:2]
+// CHECK-source: usrs.m:35:1: ObjCInstanceMethodDecl=godzilla:35:1 (Definition) [Overrides @29:1] Extent=[35:1 - 39:2]
+// 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: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: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]
+// CHECK-source: usrs.m:40:1: ObjCClassMethodDecl=kingkong:40:1 (Definition) [Overrides @30:1] Extent=[40:1 - 43:2]
+// CHECK-source: usrs.m:40:4: TypeRef=id:0:0 Extent=[40:4 - 40:6]
+// CHECK-source: usrs.m:40:17: UnexposedStmt= Extent=[40:17 - 43:2]
+// CHECK-source: usrs.m:41:3: UnexposedStmt= Extent=[41:3 - 41:17]
+// CHECK-source: usrs.m:41:7: VarDecl=local_var:41:7 (Definition) Extent=[41:3 - 41:16]
+// CHECK-source: usrs.m:42:3: UnexposedStmt= Extent=[42:3 - 42:11]
+// CHECK-source: usrs.m:42:10: UnexposedExpr= Extent=[42:10 - 42:11]
+// CHECK-source: usrs.m:42:10: UnexposedExpr= Extent=[42:10 - 42:11]
+// 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: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]
+// CHECK-source: usrs.m:49:39: DeclRefExpr=x:49:27 Extent=[49:39 - 49:40]
+// CHECK-source: usrs.m:51:12: ObjCInterfaceDecl=CWithExt:51:12 Extent=[51:1 - 53:5]
+// CHECK-source: usrs.m:52:1: ObjCInstanceMethodDecl=meth1:52:1 Extent=[52:1 - 52:14]
+// CHECK-source: usrs.m:52:4: TypeRef=id:0:0 Extent=[52:4 - 52:6]
+// CHECK-source: usrs.m:54:12: ObjCCategoryDecl=:54:12 Extent=[54:1 - 56:5]
+// CHECK-source: usrs.m:54:12: ObjCClassRef=CWithExt:51:12 Extent=[54:12 - 54:20]
+// CHECK-source: usrs.m:55:1: ObjCInstanceMethodDecl=meth2:55:1 Extent=[55:1 - 55:14]
+// CHECK-source: usrs.m:55:4: TypeRef=id:0:0 Extent=[55:4 - 55:6]
+// CHECK-source: usrs.m:57:12: ObjCCategoryDecl=:57:12 Extent=[57:1 - 59:5]
+// CHECK-source: usrs.m:57:12: ObjCClassRef=CWithExt:51:12 Extent=[57:12 - 57:20]
+// CHECK-source: usrs.m:58:1: ObjCInstanceMethodDecl=meth3:58:1 Extent=[58:1 - 58:14]
+// CHECK-source: usrs.m:58:4: TypeRef=id:0:0 Extent=[58:4 - 58:6]
+// CHECK-source: usrs.m:60:12: ObjCCategoryDecl=Bar:60:12 Extent=[60:1 - 62:5]
+// CHECK-source: usrs.m:60:12: ObjCClassRef=CWithExt:51:12 Extent=[60:12 - 60:20]
+// CHECK-source: usrs.m:61:1: ObjCInstanceMethodDecl=meth4:61:1 Extent=[61:1 - 61:14]
+// CHECK-source: usrs.m:61:4: TypeRef=id:0:0 Extent=[61:4 - 61:6]
+// CHECK-source: usrs.m:63:1: ObjCImplementationDecl=CWithExt:63:1 (Definition) Extent=[63:1 - 67:2]
+// CHECK-source: usrs.m:64:1: ObjCInstanceMethodDecl=meth1:64:1 (Definition) [Overrides @52:1] Extent=[64:1 - 64:27]
+// CHECK-source: usrs.m:64:4: TypeRef=id:0:0 Extent=[64:4 - 64:6]
+// CHECK-source: usrs.m:64:14: UnexposedStmt= Extent=[64:14 - 64:27]
+// CHECK-source: usrs.m:64:16: UnexposedStmt= Extent=[64:16 - 64:24]
+// CHECK-source: usrs.m:64:23: UnexposedExpr= Extent=[64:23 - 64:24]
+// CHECK-source: usrs.m:64:23: UnexposedExpr= Extent=[64:23 - 64:24]
+// CHECK-source: usrs.m:65:1: ObjCInstanceMethodDecl=meth2:65:1 (Definition) [Overrides @55:1] Extent=[65:1 - 65:27]
+// CHECK-source: usrs.m:65:4: TypeRef=id:0:0 Extent=[65:4 - 65:6]
+// CHECK-source: usrs.m:65:14: UnexposedStmt= Extent=[65:14 - 65:27]
+// CHECK-source: usrs.m:65:16: UnexposedStmt= Extent=[65:16 - 65:24]
+// CHECK-source: usrs.m:65:23: UnexposedExpr= Extent=[65:23 - 65:24]
+// CHECK-source: usrs.m:65:23: UnexposedExpr= Extent=[65:23 - 65:24]
+// CHECK-source: usrs.m:66:1: ObjCInstanceMethodDecl=meth3:66:1 (Definition) [Overrides @58:1] Extent=[66:1 - 66:27]
+// CHECK-source: usrs.m:66:4: TypeRef=id:0:0 Extent=[66:4 - 66:6]
+// CHECK-source: usrs.m:66:14: UnexposedStmt= Extent=[66:14 - 66:27]
+// CHECK-source: usrs.m:66:16: UnexposedStmt= Extent=[66:16 - 66:24]
+// CHECK-source: usrs.m:66:23: UnexposedExpr= Extent=[66:23 - 66:24]
+// CHECK-source: usrs.m:66:23: UnexposedExpr= Extent=[66:23 - 66:24]
+// CHECK-source: usrs.m:68:1: ObjCCategoryImplDecl=Bar:68:1 (Definition) Extent=[68:1 - 70:2]
+// CHECK-source: usrs.m:68:1: ObjCClassRef=CWithExt:51:12 Extent=[68:1 - 68:2]
+// CHECK-source: usrs.m:69:1: ObjCInstanceMethodDecl=meth4:69:1 (Definition) [Overrides @61:1] Extent=[69:1 - 69:27]
+// CHECK-source: usrs.m:69:4: TypeRef=id:0:0 Extent=[69:4 - 69:6]
+// CHECK-source: usrs.m:69:14: UnexposedStmt= Extent=[69:14 - 69:27]
+// 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: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: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]
+// CHECK-source: usrs.m:74:13: UnexposedExpr= Extent=[74:13 - 74:14]
+// CHECK-source: usrs.m:74:16: VarDecl=bar:74:16 Extent=[74:16 - 74:23]
+// CHECK-source: usrs.m:74:22: UnexposedExpr= Extent=[74:22 - 74:23]
+// CHECK-source: usrs.m:74:25: VarDecl=baz:74:25 Extent=[74:25 - 74:32]
+// CHECK-source: usrs.m:74:31: UnexposedExpr= Extent=[74:31 - 74:32]
+// CHECK-source: usrs.m:75:3: CallExpr=aux_1:72:6 Extent=[75:3 - 75:23]
+// CHECK-source: usrs.m:75:3: UnexposedExpr=aux_1:72:6 Extent=[75:3 - 75:8]
+// CHECK-source: usrs.m:75:3: DeclRefExpr=aux_1:72:6 Extent=[75:3 - 75:8]
+// CHECK-source: usrs.m:75:9: DeclRefExpr=foo:74:7 Extent=[75:9 - 75:12]
+// CHECK-source: usrs.m:75:14: DeclRefExpr=bar:74:16 Extent=[75:14 - 75:17]
+// CHECK-source: usrs.m:75:19: DeclRefExpr=baz:74:25 Extent=[75:19 - 75:22]
+// CHECK-source: usrs.m:76:3: UnexposedStmt= Extent=[76:3 - 76:11]
+// CHECK-source: usrs.m:76:10: UnexposedExpr= Extent=[76:10 - 76:11]
+// CHECK-source: usrs.m:79:1: ObjCProtocolDecl=P1:79:1 (Definition) Extent=[79:1 - 81:5]
+// CHECK-source: usrs.m:80:1: ObjCInstanceMethodDecl=method:80:1 Extent=[80:1 - 80:16]
diff --git a/test/Index/warning-flags.c b/test/Index/warning-flags.c
new file mode 100644
index 000000000000..b76662e9eedd
--- /dev/null
+++ b/test/Index/warning-flags.c
@@ -0,0 +1,16 @@
+int foo() { }
+int *bar(float *f) { return f; }
+
+// RUN: c-index-test -test-load-source all %s 2>&1|FileCheck -check-prefix=CHECK-BOTH-WARNINGS %s
+// RUN: c-index-test -test-load-source-reparse 5 all %s 2>&1|FileCheck -check-prefix=CHECK-BOTH-WARNINGS %s
+// RUN: c-index-test -test-load-source all -Wno-return-type %s 2>&1|FileCheck -check-prefix=CHECK-SECOND-WARNING %s
+// RUN: c-index-test -test-load-source-reparse 5 all -Wno-return-type %s 2>&1|FileCheck -check-prefix=CHECK-SECOND-WARNING %s
+// RUN: c-index-test -test-load-source all -w %s 2>&1|not grep warning:
+// RUN: c-index-test -test-load-source-reparse 5 all -w %s 2>&1|not grep warning:
+
+// CHECK-BOTH-WARNINGS: warning: control reaches end of non-void function
+// CHECK-BOTH-WARNINGS: warning: incompatible pointer types returning 'float *' from a function with result type 'int *'
+
+// CHECK-SECOND-WARNING-NOT:control reaches end of non-void
+// CHECK-SECOND-WARNING: warning: incompatible pointer types returning 'float *' from a function with result type 'int *'
+
diff --git a/test/Lexer/11-27-2007-FloatLiterals.c b/test/Lexer/11-27-2007-FloatLiterals.c
index ccd9e2eff592..f3d978b06925 100644
--- a/test/Lexer/11-27-2007-FloatLiterals.c
+++ b/test/Lexer/11-27-2007-FloatLiterals.c
@@ -4,8 +4,10 @@
// CHECK: 2.000000e+{{[0]*}}32
// CHECK: 0x3BFD83C940000000
// CHECK: 2.000000e+{{[0]*}}32
+// CHECK: 0x7FF0000000000000
float F = 1e-19f;
double D = 2e32;
float F2 = 01e-19f;
double D2 = 02e32;
+float F3 = 0xFp100000000000000000000F;
diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c
index f19139710280..d91057257dfb 100644
--- a/test/Lexer/c90.c
+++ b/test/Lexer/c90.c
@@ -27,3 +27,8 @@ void test2() {
"sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
"sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds";
}
+
+void test3() {
+ (void)L"\u1234"; // expected-error {{unicode escape sequences are only valid in C99 or C++}}
+ (void)L'\u1234'; // expected-error {{unicode escape sequences are only valid in C99 or C++}}
+}
diff --git a/test/Lexer/char-escapes.c b/test/Lexer/char-escapes.c
index d918bf4cf07c..32a1c6140d53 100644
--- a/test/Lexer/char-escapes.c
+++ b/test/Lexer/char-escapes.c
@@ -19,3 +19,4 @@ int test['\(' == 40 ? 1 : -1]; // expected-warning {{non-standard escape}}
int test['\{' == 123 ? 1 : -1]; // expected-warning {{non-standard escape}}
int test['\[' == 91 ? 1 : -1]; // expected-warning {{non-standard escape}}
int test['\%' == 37 ? 1 : -1]; // expected-warning {{non-standard escape}}
+const char *format = "abc \m def"; // expected-warning{{unknown escape sequence '\m'}}
diff --git a/test/Lexer/clang-keywords.cpp b/test/Lexer/clang-keywords.cpp
new file mode 100644
index 000000000000..a349b44ade20
--- /dev/null
+++ b/test/Lexer/clang-keywords.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+__char16_t c16;
+void f(__char32_t) { }
diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c
index de0962e97d22..3d2da2c764e6 100644
--- a/test/Lexer/constants.c
+++ b/test/Lexer/constants.c
@@ -15,7 +15,7 @@ float Y = 08.123456;
#endif
-char c[] = {
+int c[] = {
'df', // expected-warning {{multi-character character constant}}
'\t',
'\\
@@ -34,12 +34,12 @@ int m3 = '\\\
#pragma clang diagnostic ignored "-Wmultichar"
-char d = 'df'; // no warning.
-char e = 'abcd'; // still warn: expected-warning {{multi-character character constant}}
+int d = 'df'; // no warning.
+int e = 'abcd'; // still warn: expected-warning {{multi-character character constant}}
#pragma clang diagnostic ignored "-Wfour-char-constants"
-char f = 'abcd'; // ignored.
+int f = 'abcd'; // ignored.
// rdar://problem/6974641
float t0[] = {
diff --git a/test/Lexer/cxx0x_keyword_as_cxx98.cpp b/test/Lexer/cxx0x_keyword_as_cxx98.cpp
index 2bfb8b0b931b..0223b039be92 100644
--- a/test/Lexer/cxx0x_keyword_as_cxx98.cpp
+++ b/test/Lexer/cxx0x_keyword_as_cxx98.cpp
@@ -1,2 +1,3 @@
-// RUN: %clang_cc1 %s -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only
int static_assert;
+int char16_t;
diff --git a/test/Lexer/digraph.c b/test/Lexer/digraph.c
index b8a99bbae151..cf6e4789afa8 100644
--- a/test/Lexer/digraph.c
+++ b/test/Lexer/digraph.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify < %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
%:include <stdint.h>
diff --git a/test/Lexer/has_attribute.cpp b/test/Lexer/has_attribute.cpp
new file mode 100644
index 000000000000..9a58a3013fbe
--- /dev/null
+++ b/test/Lexer/has_attribute.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck %s
+
+// CHECK: always_inline
+#if __has_attribute(always_inline)
+int always_inline();
+#endif
+
+// CHECK: no_dummy_attribute
+#if !__has_attribute(dummy_attribute)
+int no_dummy_attribute();
+#endif
+
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index cc2ae28c58b0..07a3ebd38d3a 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -2,7 +2,7 @@
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
#if __has_feature(cxx_lambdas)
-int lambdas();
+int has_lambdas();
#else
int no_lambdas();
#endif
@@ -21,16 +21,6 @@ int no_nullptr();
// CHECK-NO-0X: no_nullptr
-#if __has_feature(cxx_concepts)
-int concepts();
-#else
-int no_concepts();
-#endif
-
-// CHECK-0X: no_concepts
-// CHECK-NO-0X: no_concepts
-
-
#if __has_feature(cxx_decltype)
int has_decltype();
#else
@@ -42,22 +32,22 @@ int no_decltype();
#if __has_feature(cxx_auto_type)
-int auto_type();
+int has_auto_type();
#else
int no_auto_type();
#endif
-// CHECK-0X: auto_type
+// CHECK-0X: has_auto_type
// CHECK-NO-0X: no_auto_type
#if __has_feature(cxx_attributes)
-int attributes();
+int has_attributes();
#else
int no_attributes();
#endif
-// CHECK-0X: attributes
+// CHECK-0X: has_attributes
// CHECK-NO-0X: no_attributes
@@ -70,42 +60,60 @@ int no_static_assert();
// CHECK-0X: has_static_assert
// CHECK-NO-0X: no_static_assert
-
#if __has_feature(cxx_deleted_functions)
-int deleted_functions();
+int has_deleted_functions();
#else
int no_deleted_functions();
#endif
-// CHECK-0X: deleted_functions
+// CHECK-0X: has_deleted_functions
// CHECK-NO-0X: no_deleted_functions
#if __has_feature(cxx_rvalue_references)
-int rvalue_references();
+int has_rvalue_references();
#else
int no_rvalue_references();
#endif
-// CHECK-0X: no_rvalue_references
+// CHECK-0X: has_rvalue_references
// CHECK-NO-0X: no_rvalue_references
#if __has_feature(cxx_variadic_templates)
-int variadic_templates();
+int has_variadic_templates();
#else
int no_variadic_templates();
#endif
-// CHECK-0X: no_variadic_templates
+// CHECK-0X: has_variadic_templates
// CHECK-NO-0X: no_variadic_templates
#if __has_feature(cxx_inline_namespaces)
-int inline_namespaces();
+int has_inline_namespaces();
#else
int no_inline_namespaces();
#endif
-// CHECK-0X: inline_namespaces
-// CHECK-NO-0X: inline_namespaces
+// CHECK-0X: has_inline_namespaces
+// CHECK-NO-0X: no_inline_namespaces
+
+#if __has_feature(cxx_reference_qualified_functions)
+int has_reference_qualified_functions();
+#else
+int no_reference_qualified_functions();
+#endif
+
+// CHECK-0X: has_reference_qualified_functions
+// CHECK-NO-0X: no_reference_qualified_functions
+
+#if __has_feature(cxx_default_function_template_args)
+int has_default_function_template_args();
+#else
+int no_default_function_template_args();
+#endif
+
+// CHECK-0X: has_default_function_template_args
+// CHECK-NO-0X: no_default_function_template_args
+
diff --git a/test/Lexer/has_feature_type_traits.cpp b/test/Lexer/has_feature_type_traits.cpp
new file mode 100644
index 000000000000..3cfc602be6f7
--- /dev/null
+++ b/test/Lexer/has_feature_type_traits.cpp
@@ -0,0 +1,91 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck %s
+
+#if __has_feature(has_nothrow_assign)
+int has_nothrow_assign();
+#endif
+// CHECK: int has_nothrow_assign();
+
+#if __has_feature(has_nothrow_copy)
+int has_nothrow_copy();
+#endif
+// CHECK: int has_nothrow_copy();
+
+#if __has_feature(has_nothrow_constructor)
+int has_nothrow_constructor();
+#endif
+// CHECK: int has_nothrow_constructor();
+
+#if __has_feature(has_trivial_assign)
+int has_trivial_assign();
+#endif
+// CHECK: int has_trivial_assign();
+
+#if __has_feature(has_trivial_copy)
+int has_trivial_copy();
+#endif
+// CHECK: int has_trivial_copy();
+
+#if __has_feature(has_trivial_constructor)
+int has_trivial_constructor();
+#endif
+// CHECK: int has_trivial_constructor();
+
+#if __has_feature(has_trivial_destructor)
+int has_trivial_destructor();
+#endif
+// CHECK: int has_trivial_destructor();
+
+#if __has_feature(has_virtual_destructor)
+int has_virtual_destructor();
+#endif
+// CHECK: int has_virtual_destructor();
+
+#if __has_feature(is_abstract)
+int is_abstract();
+#endif
+// CHECK: int is_abstract();
+
+#if __has_feature(is_base_of)
+int is_base_of();
+#endif
+// CHECK: int is_base_of();
+
+#if __has_feature(is_class)
+int is_class();
+#endif
+// CHECK: int is_class();
+
+#if __has_feature(is_convertible_to)
+int is_convertible_to();
+#endif
+// CHECK: int is_convertible_to();
+
+#if __has_feature(is_empty)
+int is_empty();
+#endif
+// CHECK: int is_empty();
+
+#if __has_feature(is_enum)
+int is_enum();
+#endif
+// CHECK: int is_enum();
+
+#if __has_feature(is_pod)
+int is_pod();
+#endif
+// CHECK: int is_pod();
+
+#if __has_feature(is_polymorphic)
+int is_polymorphic();
+#endif
+// CHECK: int is_polymorphic();
+
+#if __has_feature(is_union)
+int is_union();
+#endif
+// CHECK: int is_union();
+
+#if __has_feature(is_literal)
+int is_literal();
+#endif
+// CHECK: int is_literal();
diff --git a/test/Lexer/ms-extensions.c b/test/Lexer/ms-extensions.c
index 8b7d2e1efc0c..9cd868e8f3f2 100644
--- a/test/Lexer/ms-extensions.c
+++ b/test/Lexer/ms-extensions.c
@@ -4,6 +4,7 @@ __int8 x1 = 3i8;
__int16 x2 = 4i16;
__int32 x3 = 5i32;
__int64 x5 = 0x42i64;
+__int64 x6 = 0x42I64;
__int64 x4 = 70000000i128;
__int64 y = 0x42i64u; // expected-error {{invalid suffix}}
diff --git a/test/Lexer/pragma-message.c b/test/Lexer/pragma-message.c
new file mode 100644
index 000000000000..710568cc2de6
--- /dev/null
+++ b/test/Lexer/pragma-message.c
@@ -0,0 +1,14 @@
+/* Test pragma message directive from
+ http://msdn.microsoft.com/en-us/library/x7dkzch2.aspx */
+
+// message: Sends a string literal to the standard output without terminating
+// the compilation.
+// #pragma message(messagestring)
+// OR
+// #pragma message messagestring
+//
+// RUN: %clang_cc1 -fsyntax-only -verify %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}}
+#pragma message ":O gcc accepts this! " STRING(__LINE__) // expected-warning {{:O gcc accepts this! 14}}
diff --git a/test/Lexer/pragma-operators.cpp b/test/Lexer/pragma-operators.cpp
new file mode 100644
index 000000000000..d1645adbc252
--- /dev/null
+++ b/test/Lexer/pragma-operators.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fms-extensions -E %s | FileCheck %s
+
+// Test that we properly expand the C99 _Pragma and Microsoft __pragma
+// into #pragma directives, with newlines where needed. <rdar://problem/8412013>
+
+// CHECK: #line
+// CHECK: #pragma warning(push)
+// CHECK: extern "C" {
+// CHECK: #line
+// CHECK: #pragma warning(push)
+// CHECK: int foo() { return 0; } }
+// CHECK: #line
+// CHECK: #pragma warning(pop)
+#define A(X) extern "C" { __pragma(warning(push)) \
+ int X() { return 0; } \
+}
+#define B(X) A(X)
+#pragma warning(push)
+B(foo)
+#pragma warning(pop)
diff --git a/test/Lexer/preamble.c b/test/Lexer/preamble.c
index 69cdbb7f241e..7735b475e1ae 100644
--- a/test/Lexer/preamble.c
+++ b/test/Lexer/preamble.c
@@ -22,7 +22,6 @@ int foo();
// RUN: %clang_cc1 -print-preamble %s > %t
// RUN: echo END. >> %t
// RUN: FileCheck < %t %s
-// XFAIL: win32
// CHECK: // Preamble detection test: see below for comments and test commands.
// CHECK-NEXT: //
diff --git a/test/Lexer/rdar-8914293.c b/test/Lexer/rdar-8914293.c
new file mode 100644
index 000000000000..e39e4f1904c3
--- /dev/null
+++ b/test/Lexer/rdar-8914293.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar://8914293
+// We want be compatible with gcc and warn, not error.
+
+/* expected-warning {{missing terminating}} */ #define FOO "foo
+/* expected-warning {{missing terminating}} */ #define KOO 'k
diff --git a/test/Lexer/rdr-6096838-2.c b/test/Lexer/rdr-6096838-2.c
index f7f5906c8f4c..68aa5e67945d 100644
--- a/test/Lexer/rdr-6096838-2.c
+++ b/test/Lexer/rdr-6096838-2.c
@@ -1,4 +1,4 @@
-/* RUN: %clang_cc1 -pedantic -std=gnu89 -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -triple x86_64-unknown-unknown -pedantic -std=gnu89 -fsyntax-only -verify %s
rdar://6096838
*/
diff --git a/test/Lexer/rdr-6096838.c b/test/Lexer/rdr-6096838.c
index 2f00f47099b7..d1426cca14aa 100644
--- a/test/Lexer/rdr-6096838.c
+++ b/test/Lexer/rdr-6096838.c
@@ -1,5 +1,5 @@
-/* RUN: %clang_cc1 -fsyntax-only -verify %s
- * RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
+/* RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -verify %s
+ * RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=gnu89 -fsyntax-only -verify %s
rdar://6096838
*/
diff --git a/test/Lexer/wchar.c b/test/Lexer/wchar.c
new file mode 100644
index 000000000000..ac82c1f73b4d
--- /dev/null
+++ b/test/Lexer/wchar.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -fshort-wchar -verify %s
+
+void f() {
+ (void)L"\U00010000"; // expected-warning {{character unicode escape sequence too long for its type}}
+
+ (void)L'\U00010000'; // expected-warning {{character unicode escape sequence too long for its type}}
+
+ (void)L'ab'; // expected-warning {{extraneous characters in wide character constant ignored}}
+
+ (void)L'a\u1000'; // expected-warning {{extraneous characters in wide character constant ignored}}
+}
+
diff --git a/test/Makefile b/test/Makefile
index 5bb50c622afd..b0c829c255e6 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -29,7 +29,7 @@ ifdef VG
LIT_ARGS += "--vg"
endif
-all:: lit.site.cfg
+all:: lit.site.cfg Unit/lit.site.cfg
@ echo '--- Running clang tests for $(TARGET_TRIPLE) ---'
@ $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py \
$(LIT_ARGS) $(TESTARGS) $(TESTDIRS)
@@ -47,6 +47,22 @@ lit.site.cfg: FORCE
-e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \
$(PROJ_SRC_DIR)/lit.site.cfg.in > $@
+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 > $@
+
clean::
@ find . -name Output | xargs rm -fr
diff --git a/test/Misc/Inputs/working-directory.h b/test/Misc/Inputs/working-directory.h
new file mode 100644
index 000000000000..061df629d6ad
--- /dev/null
+++ b/test/Misc/Inputs/working-directory.h
@@ -0,0 +1 @@
+typedef int Foo;
diff --git a/test/Misc/diag-aka-types.cpp b/test/Misc/diag-aka-types.cpp
index 7233c4e85b49..e0e6b8c7c7af 100644
--- a/test/Misc/diag-aka-types.cpp
+++ b/test/Misc/diag-aka-types.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++0x
struct X {};
typedef X foo_t;
@@ -7,4 +7,8 @@ foo_t *ptr;
char c1 = ptr; // expected-error{{'foo_t *' (aka 'X *')}}
const foo_t &ref = foo_t();
-char c2 = ref; // expected-error{{'foo_t const' (aka 'X const')}}
+char c2 = ref; // expected-error{{'const foo_t' (aka 'const X')}}
+
+// deduced auto should not produce an aka.
+auto aut = X();
+char c3 = aut; // expected-error{{from 'X' to 'char'}}
diff --git a/test/Misc/predefines.c b/test/Misc/predefines.c
index 8e57c809df20..87f676e89fc4 100644
--- a/test/Misc/predefines.c
+++ b/test/Misc/predefines.c
@@ -1,4 +1,4 @@
-/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic-errors %s
+/* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -ffreestanding -pedantic-errors %s
* rdar://6814950
*/
#include <stdint.h>
diff --git a/test/Misc/working-directory.c b/test/Misc/working-directory.c
new file mode 100644
index 000000000000..5c71d9f3f323
--- /dev/null
+++ b/test/Misc/working-directory.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -working-directory %S working-directory.c -IInputs -fsyntax-only
+
+#include "working-directory.h"
+
+Foo bar;
diff --git a/test/PCH/Inputs/chain-cxx1.h b/test/PCH/Inputs/chain-cxx1.h
deleted file mode 100644
index 7ea3ffb61c8f..000000000000
--- a/test/PCH/Inputs/chain-cxx1.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Primary header for C++ chained PCH test
-
-void f();
-
-// Name not appearing in dependent
-void pf();
-
-namespace ns {
- void g();
-
- void pg();
-}
-
-template <typename T>
-struct S { typedef int G; };
-
-// Partially specialize
-template <typename T>
-struct S<T *> { typedef int H; };
diff --git a/test/PCH/Inputs/chain-cxx2.h b/test/PCH/Inputs/chain-cxx2.h
deleted file mode 100644
index adc10fd83681..000000000000
--- a/test/PCH/Inputs/chain-cxx2.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Dependent header for C++ chained PCH test
-
-// Overload function from primary
-void f(int);
-
-// Add function with different name
-void f2();
-
-// Reopen namespace
-namespace ns {
- // Overload function from primary
- void g(int);
-
- // Add different name
- void g2();
-}
-
-// Specialize template from primary
-template <>
-struct S<int> { typedef int I; };
-
-// Partially specialize
-template <typename T>
-struct S<T &> { typedef int J; };
-
-// Specialize previous partial specialization
-template <>
-struct S<int *> { typedef int K; };
-
-// Specialize the partial specialization from this file
-template <>
-struct S<int &> { typedef int L; };
diff --git a/test/PCH/Inputs/chain-macro-override1.h b/test/PCH/Inputs/chain-macro-override1.h
index 4f9321de93b1..d956396f9160 100644
--- a/test/PCH/Inputs/chain-macro-override1.h
+++ b/test/PCH/Inputs/chain-macro-override1.h
@@ -2,3 +2,4 @@ void f() __attribute__((unavailable));
void g();
#define g() f()
#define h() f()
+#define x x
diff --git a/test/PCH/Inputs/chain-macro-override2.h b/test/PCH/Inputs/chain-macro-override2.h
index f279e2ad48c0..e4bff77294fd 100644
--- a/test/PCH/Inputs/chain-macro-override2.h
+++ b/test/PCH/Inputs/chain-macro-override2.h
@@ -2,3 +2,4 @@
#undef g
#undef h
#define h() g()
+int x;
diff --git a/test/PCH/Inputs/chain-remap-types1.h b/test/PCH/Inputs/chain-remap-types1.h
new file mode 100644
index 000000000000..d105489abd73
--- /dev/null
+++ b/test/PCH/Inputs/chain-remap-types1.h
@@ -0,0 +1,10 @@
+@class X;
+
+struct Y {
+ X *my_X;
+};
+
+@interface X {
+}
+@property X *prop;
+@end
diff --git a/test/PCH/Inputs/chain-remap-types2.h b/test/PCH/Inputs/chain-remap-types2.h
new file mode 100644
index 000000000000..55ca8a9e3190
--- /dev/null
+++ b/test/PCH/Inputs/chain-remap-types2.h
@@ -0,0 +1,8 @@
+void h(X*);
+
+@interface X (Blah) {
+}
+@end
+
+void g(X*);
+
diff --git a/test/PCH/Inputs/chain-selectors1.h b/test/PCH/Inputs/chain-selectors1.h
index 37c1c00b5741..b0b68f8332c1 100644
--- a/test/PCH/Inputs/chain-selectors1.h
+++ b/test/PCH/Inputs/chain-selectors1.h
@@ -10,3 +10,7 @@ void foo1() {
//(void)@selector(x);
(void)@selector(f);
}
+
+@interface X (Blah)
+- (void)blah_method;
+@end
diff --git a/test/PCH/Inputs/chain-selectors2.h b/test/PCH/Inputs/chain-selectors2.h
index 4d6b55663008..973fc107e90e 100644
--- a/test/PCH/Inputs/chain-selectors2.h
+++ b/test/PCH/Inputs/chain-selectors2.h
@@ -9,3 +9,7 @@ void foo2() {
//(void)@selector(y);
//(void)@selector(e);
}
+
+@interface X (Blarg)
+- (void)blarg_method;
+@end
diff --git a/test/PCH/Inputs/namespaces.h b/test/PCH/Inputs/namespaces.h
index 553aadd1f9ed..bd2c3ee98271 100644
--- a/test/PCH/Inputs/namespaces.h
+++ b/test/PCH/Inputs/namespaces.h
@@ -38,3 +38,7 @@ using namespace N2::Inner;
extern "C" {
void ext();
}
+
+inline namespace N4 {
+ struct MemberOfN4;
+}
diff --git a/test/PCH/Inputs/typo.h b/test/PCH/Inputs/typo.h
new file mode 100644
index 000000000000..63b553b91695
--- /dev/null
+++ b/test/PCH/Inputs/typo.h
@@ -0,0 +1,6 @@
+
+
+@interface NSString
++ (id)alloc;
+@end
+
diff --git a/test/PCH/Inputs/va_arg.h b/test/PCH/Inputs/va_arg.h
new file mode 100644
index 000000000000..1244e9faa36a
--- /dev/null
+++ b/test/PCH/Inputs/va_arg.h
@@ -0,0 +1,2 @@
+#include <stdarg.h>
+
diff --git a/test/PCH/attrs-PR8406.c b/test/PCH/attrs-PR8406.c
new file mode 100644
index 000000000000..85225f5a9cf1
--- /dev/null
+++ b/test/PCH/attrs-PR8406.c
@@ -0,0 +1,23 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %s -emit-llvm -o - %s | FileCheck %s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s | FileCheck %s
+
+#ifndef HEADER
+#define HEADER
+
+struct Bar
+{
+ // CHECK: align 512
+ int buffer[123] __attribute__((__aligned__(512)));
+};
+
+#else
+
+void foo() {
+ struct Bar bar;
+}
+
+#endif
diff --git a/test/PCH/attrs.c b/test/PCH/attrs.c
index c9711935c075..2f868ac6624e 100644
--- a/test/PCH/attrs.c
+++ b/test/PCH/attrs.c
@@ -1,8 +1,17 @@
// Test this without pch.
-// RUN: %clang_cc1 -include %S/attrs.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %s -fsyntax-only -verify %s
// Test with pch.
-// RUN: %clang_cc1 -emit-pch -o %t %S/attrs.h
+// RUN: %clang_cc1 -emit-pch -o %t %s
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
-// expected-note{{previous overload}}
+
+#ifndef HEADER
+#define HEADER
+
+int f(int) __attribute__((visibility("default"), overloadable)); // expected-note{{previous overload}}
+
+#else
+
double f(double); // expected-error{{overloadable}}
+
+#endif
diff --git a/test/PCH/attrs.h b/test/PCH/attrs.h
deleted file mode 100644
index 58f058970431..000000000000
--- a/test/PCH/attrs.h
+++ /dev/null
@@ -1,7 +0,0 @@
-// Header for PCH test exprs.c
-
-
-
-
-
-int f(int) __attribute__((visibility("default"), overloadable));
diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp
index 3e46214c70b8..d269de529fba 100644
--- a/test/PCH/chain-cxx.cpp
+++ b/test/PCH/chain-cxx.cpp
@@ -1,13 +1,82 @@
// Test C++ chained PCH functionality
// Without PCH
-// RUN: %clang_cc1 -fsyntax-only -verify -include %S/Inputs/chain-cxx1.h -include %S/Inputs/chain-cxx2.h %s
+// RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s
// With PCH
-// RUN: %clang_cc1 -x c++ -emit-pch -o %t1 %S/Inputs/chain-cxx1.h
-// RUN: %clang_cc1 -x c++ -emit-pch -o %t2 %S/Inputs/chain-cxx2.h -include-pch %t1 -chained-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
+#ifndef HEADER1
+#define HEADER1
+//===----------------------------------------------------------------------===//
+// Primary header for C++ chained PCH test
+
+void f();
+
+// Name not appearing in dependent
+void pf();
+
+namespace ns {
+ void g();
+
+ void pg();
+}
+
+template <typename T>
+struct S { typedef int G; };
+
+// Partially specialize
+template <typename T>
+struct S<T *> { typedef int H; };
+
+template <typename T> struct TS2;
+typedef TS2<int> TS2int;
+
+//===----------------------------------------------------------------------===//
+#elif not defined(HEADER2)
+#define HEADER2
+//===----------------------------------------------------------------------===//
+// Dependent header for C++ chained PCH test
+
+// Overload function from primary
+void f(int);
+
+// Add function with different name
+void f2();
+
+// Reopen namespace
+namespace ns {
+ // Overload function from primary
+ void g(int);
+
+ // Add different name
+ void g2();
+}
+
+// Specialize template from primary
+template <>
+struct S<int> { typedef int I; };
+
+// Partially specialize
+template <typename T>
+struct S<T &> { typedef int J; };
+
+// Specialize previous partial specialization
+template <>
+struct S<int *> { typedef int K; };
+
+// Specialize the partial specialization from this file
+template <>
+struct S<int &> { typedef int L; };
+
+template <typename T> struct TS2 { };
+
+//===----------------------------------------------------------------------===//
+#else
+//===----------------------------------------------------------------------===//
+
void test() {
f();
f(1);
@@ -25,4 +94,9 @@ void test() {
typedef S<double &>::J T4;
typedef S<int *>::K T5;
typedef S<int &>::L T6;
+
+ TS2int ts2;
}
+
+//===----------------------------------------------------------------------===//
+#endif
diff --git a/test/PCH/chain-macro-override.c b/test/PCH/chain-macro-override.c
index 14478af35f19..8e208815fb26 100644
--- a/test/PCH/chain-macro-override.c
+++ b/test/PCH/chain-macro-override.c
@@ -1,13 +1,14 @@
// Test this without pch.
-// RUN: %clang_cc1 -include %S/Inputs/chain-macro-override1.h -include %S/Inputs/chain-macro-override2.h -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include %S/Inputs/chain-macro-override1.h -include %S/Inputs/chain-macro-override2.h -fsyntax-only -verify -detailed-preprocessing-record %s
// Test with pch.
-// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h
-// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -chained-pch
+// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h -detailed-preprocessing-record
+// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -chained-pch -detailed-preprocessing-record
// RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s
-void foo() {
+int foo() {
f();
g();
h();
+ return x;
}
diff --git a/test/PCH/chain-macro.c b/test/PCH/chain-macro.c
index b4dcdfe644d7..68b18deb0811 100644
--- a/test/PCH/chain-macro.c
+++ b/test/PCH/chain-macro.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro1.h
-// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro2.h -include-pch %t1 -chained-pch
+// RUN: %clang_cc1 -emit-pch -o %t1 -detailed-preprocessing-record %S/Inputs/chain-macro1.h
+// RUN: %clang_cc1 -emit-pch -o %t2 -detailed-preprocessing-record %S/Inputs/chain-macro2.h -include-pch %t1 -chained-pch
// RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s
// RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s
diff --git a/test/PCH/chain-remap-types.m b/test/PCH/chain-remap-types.m
new file mode 100644
index 000000000000..a45a79d75c7f
--- /dev/null
+++ b/test/PCH/chain-remap-types.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t1 %S/Inputs/chain-remap-types1.h
+// RUN: %clang_cc1 -emit-pch -x objective-c-header -o %t2 %S/Inputs/chain-remap-types2.h -include-pch %t1 -chained-pch
+// RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s
+
+// CHECK: @class X;
+// CHECK: struct Y
+// CHECK: @property ( assign,readwrite ) X * prop
+// CHECK: void h(X *);
+// CHECK: @interface X(Blah)
+// CHECK: void g(X *);
+
diff --git a/test/PCH/chain-selectors.m b/test/PCH/chain-selectors.m
index 60db3f994b71..3b19172799c5 100644
--- a/test/PCH/chain-selectors.m
+++ b/test/PCH/chain-selectors.m
@@ -22,3 +22,19 @@ void bar() {
(void)@selector(y); // expected-warning {{unimplemented selector}}
(void)@selector(e); // expected-warning {{unimplemented selector}}
}
+
+@implementation X (Blah)
+- (void)test_Blah {
+ [self blah_method];
+}
+
+- (void)blah_method { }
+@end
+
+@implementation X (Blarg)
+- (void)test_Blarg {
+ [self blarg_method];
+}
+
+- (void)blarg_method { }
+@end
diff --git a/test/PCH/check-deserializations.cpp b/test/PCH/check-deserializations.cpp
new file mode 100644
index 000000000000..9f73c95c541e
--- /dev/null
+++ b/test/PCH/check-deserializations.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -error-on-deserialized-decl S1_method -include-pch %t -emit-llvm-only %s
+
+#ifndef HEADER
+#define HEADER
+// Header.
+
+struct S1 {
+ void S1_method(); // This should not be deserialized.
+ virtual void S1_keyfunc();
+};
+
+
+#else
+// Using the header.
+
+void test(S1*) {
+}
+
+#endif
diff --git a/test/PCH/cmdline-include.c b/test/PCH/cmdline-include.c
new file mode 100644
index 000000000000..ad4519279ae3
--- /dev/null
+++ b/test/PCH/cmdline-include.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -include %S/cmdline-include1.h -x c-header %S/cmdline-include2.h -emit-pch -o %t
+// RUN: %clang_cc1 %s -include-pch %t -fsyntax-only -verify
+// RUN: %clang_cc1 -x c-header %S/cmdline-include1.h -emit-pch -o %t
+// RUN: %clang_cc1 %s -include-pch %t -include %S/cmdline-include2.h -fsyntax-only -verify
+
+int g = x1 + x2;
diff --git a/test/PCH/cmdline-include1.h b/test/PCH/cmdline-include1.h
new file mode 100644
index 000000000000..4f7c661c38c5
--- /dev/null
+++ b/test/PCH/cmdline-include1.h
@@ -0,0 +1 @@
+enum { x1 };
diff --git a/test/PCH/cmdline-include2.h b/test/PCH/cmdline-include2.h
new file mode 100644
index 000000000000..cf8e37b467e1
--- /dev/null
+++ b/test/PCH/cmdline-include2.h
@@ -0,0 +1 @@
+enum { x2 };
diff --git a/test/PCH/cuda-kernel-call.cu b/test/PCH/cuda-kernel-call.cu
new file mode 100644
index 000000000000..ef12c5920745
--- /dev/null
+++ b/test/PCH/cuda-kernel-call.cu
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s
+
+#ifndef HEADER
+#define HEADER
+// Header.
+
+#include "../SemaCUDA/cuda.h"
+
+void kcall(void (*kp)()) {
+ kp<<<1, 1>>>();
+}
+
+__global__ void kern() {
+}
+
+#else
+// Using the header.
+
+void test() {
+ kcall(kern);
+ kern<<<1, 1>>>();
+}
+
+#endif
diff --git a/test/PCH/cxx-templates.cpp b/test/PCH/cxx-templates.cpp
index a862ea579e35..05dd6ed0d2be 100644
--- a/test/PCH/cxx-templates.cpp
+++ b/test/PCH/cxx-templates.cpp
@@ -1,11 +1,11 @@
// Test this without pch.
-// RUN: %clang_cc1 -include %S/cxx-templates.h -verify %s -ast-dump -o -
-// RUN: %clang_cc1 -include %S/cxx-templates.h %s -emit-llvm -o - | FileCheck %s
+// 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
// Test with pch.
-// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-templates.h
-// RUN: %clang_cc1 -include-pch %t -verify %s -ast-dump -o -
-// RUN: %clang_cc1 -include-pch %t %s -emit-llvm -o - | FileCheck %s
+// 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
// CHECK: define weak_odr void @_ZN2S4IiE1mEv
// CHECK: define linkonce_odr void @_ZN2S3IiE1mEv
@@ -17,7 +17,7 @@ struct A {
static T my_templf(T x) { return x; }
};
-void test() {
+void test(const int (&a6)[17]) {
int x = templ_f<int, 5>(3);
S<char, float>::templ();
@@ -30,6 +30,16 @@ void test() {
S3<int> s3;
s3.m();
+
+ TS5 ts(0);
+
+ S6<const int[17]>::t2 b6 = a6;
}
template struct S4<int>;
+
+S7<int[5]> s7_5;
+
+namespace ZeroLengthExplicitTemplateArgs {
+ template void f<X>(X*);
+}
diff --git a/test/PCH/cxx-templates.h b/test/PCH/cxx-templates.h
index 978d768acc92..d2c820f877c6 100644
--- a/test/PCH/cxx-templates.h
+++ b/test/PCH/cxx-templates.h
@@ -135,3 +135,61 @@ void S4ImplicitInst() {
S4<int> s;
s.m();
}
+
+struct S5 {
+ S5(int x);
+};
+
+struct TS5 {
+ S5 s;
+ template <typename T>
+ TS5(T y) : s(y) {}
+};
+
+// PR 8134
+template<class T> void f_PR8134(T);
+template<class T> void f_PR8134(T);
+void g_PR8134() { f_PR8134(0); f_PR8134('x'); }
+
+// rdar8580149
+template <typename T>
+struct S6;
+
+template <typename T, unsigned N>
+struct S6<const T [N]>
+{
+private:
+ typedef const T t1[N];
+public:
+ typedef t1& t2;
+};
+
+template<typename T>
+ struct S7;
+
+template<unsigned N>
+struct S7<int[N]> : S6<const int[N]> { };
+
+// Zero-length template argument lists
+namespace ZeroLengthExplicitTemplateArgs {
+ template<typename T> void h();
+
+ struct Y {
+ template<typename T> void f();
+ };
+
+ template<typename T>
+ void f(T *ptr) {
+ T::template g<>(17);
+ ptr->template g2<>(17);
+ h<T>();
+ h<int>();
+ Y y;
+ y.f<int>();
+ }
+
+ struct X {
+ template<typename T> static void g(T);
+ template<typename T> void g2(T);
+ };
+}
diff --git a/test/PCH/cxx-variadic-templates.cpp b/test/PCH/cxx-variadic-templates.cpp
new file mode 100644
index 000000000000..9b1df9a737f9
--- /dev/null
+++ b/test/PCH/cxx-variadic-templates.cpp
@@ -0,0 +1,11 @@
+// Test this without pch.
+// RUN: %clang_cc1 -std=c++0x -include %S/cxx-variadic-templates.h -verify %s -ast-dump -o -
+// RUN: %clang_cc1 -std=c++0x -include %S/cxx-variadic-templates.h %s -emit-llvm -o - | FileCheck %s
+
+// Test with pch.
+// RUN: %clang_cc1 -std=c++0x -x c++-header -emit-pch -o %t %S/cxx-variadic-templates.h
+// RUN: %clang_cc1 -std=c++0x -include-pch %t -verify %s -ast-dump -o -
+// RUN: %clang_cc1 -std=c++0x -include-pch %t %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: allocate_shared
+shared_ptr<int> spi = shared_ptr<int>::allocate_shared(1, 2);
diff --git a/test/PCH/cxx-variadic-templates.h b/test/PCH/cxx-variadic-templates.h
new file mode 100644
index 000000000000..f6ee7876c2c2
--- /dev/null
+++ b/test/PCH/cxx-variadic-templates.h
@@ -0,0 +1,18 @@
+// PR9073
+template<typename _Tp>
+class shared_ptr{
+public:
+ template<class _Alloc, class ..._Args>
+ static
+ shared_ptr<_Tp>
+ allocate_shared(const _Alloc& __a, _Args&& ...__args);
+};
+
+template<class _Tp>
+template<class _Alloc, class ..._Args>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
+{
+ shared_ptr<_Tp> __r;
+ return __r;
+}
diff --git a/test/PCH/cxx_exprs.cpp b/test/PCH/cxx_exprs.cpp
index 2b9a5abbf11a..cf7ae338eba1 100644
--- a/test/PCH/cxx_exprs.cpp
+++ b/test/PCH/cxx_exprs.cpp
@@ -1,9 +1,9 @@
// Test this without pch.
-// RUN: %clang_cc1 -include %S/cxx_exprs.h -std=c++0x -fsyntax-only -verify %s -ast-dump
+// RUN: %clang_cc1 -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 -x c++-header -std=c++0x -emit-pch -o %t %S/cxx_exprs.h
-// RUN: %clang_cc1 -std=c++0x -include-pch %t -fsyntax-only -verify %s -ast-dump
+// 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
int integer;
double floating;
diff --git a/test/PCH/headersearch.cpp b/test/PCH/headersearch.cpp
new file mode 100644
index 000000000000..151756c7071e
--- /dev/null
+++ b/test/PCH/headersearch.cpp
@@ -0,0 +1,44 @@
+// Test reading of PCH with changed location of original input files,
+// i.e. invoking header search.
+// XFAIL: win32
+
+// Generate the original files:
+// 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
+// RUN: echo '#include "orig_sub2_1.h"' > %t_orig/sub2/orig_sub2.h
+// RUN: echo 'template <typename T> void tf() { orig_sub2_1(); T::foo(); }' >> %t_orig/sub2/orig_sub2.h
+// RUN: echo 'void foo() {}' > %t_orig/tmp2.h
+// RUN: echo '#include "tmp2.h"' > %t_orig/all.h
+// RUN: echo '#include "sub/orig_sub.h"' >> %t_orig/all.h
+// RUN: echo '#include "orig_sub2.h"' >> %t_orig/all.h
+// RUN: echo 'int all();' >> %t_orig/all.h
+
+// 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
+
+// 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
+// RUN: grep 'struct orig_sub' %t.stderr
+
+// Check diagnostic with 2nd location in original source:
+// RUN: not %clang_cc1 -DREDECL -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -emit-obj -o %t.o %s 2> %t.stderr
+// RUN: grep 'void foo' %t.stderr
+
+// Check diagnostic with instantiation location in original source:
+// RUN: not %clang_cc1 -DINSTANTIATION -include-pch all.h.pch -I%t_moved -I%t_moved/sub2 -emit-obj -o %t.o %s 2> %t.stderr
+// RUN: grep 'orig_sub2_1' %t.stderr
+
+void qq(orig_sub*) {all();}
+
+#ifdef REDECL
+float foo() {return 0;}
+#endif
+
+#ifdef INSTANTIATION
+void f() {
+ tf<int>();
+}
+#endif
diff --git a/test/PCH/missing-file.cpp b/test/PCH/missing-file.cpp
new file mode 100644
index 000000000000..7d5cd111101c
--- /dev/null
+++ b/test/PCH/missing-file.cpp
@@ -0,0 +1,31 @@
+// Test reading of PCH without original input files.
+
+// Generate the PCH, removing the original file:
+// RUN: echo 'struct S{char c; int i; }; void foo() {}' > %t.h
+// RUN: echo 'template <typename T> void tf() { T::foo(); }' >> %t.h
+// RUN: %clang_cc1 -x c++ -emit-pch -o %t.h.pch %t.h
+// RUN: rm %t.h
+
+// Check diagnostic with location in original source:
+// RUN: %clang_cc1 -include-pch %t.h.pch -Wpadded -emit-obj -o %t.o %s 2> %t.stderr
+// RUN: grep 'bytes to align' %t.stderr
+
+// Check diagnostic with 2nd location in original source:
+// RUN: not %clang_cc1 -DREDECL -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
+// RUN: grep 'previous definition is here' %t.stderr
+
+// Check diagnostic with instantiation location in original source:
+// RUN: not %clang_cc1 -DINSTANTIATION -include-pch %t.h.pch -emit-obj -o %t.o %s 2> %t.stderr
+// RUN: grep 'cannot be used prior to' %t.stderr
+
+void qq(S*) {}
+
+#ifdef REDECL
+float foo() {return 0f;}
+#endif
+
+#ifdef INSTANTIATION
+void f() {
+ tf<int>();
+}
+#endif
diff --git a/test/PCH/namespaces.cpp b/test/PCH/namespaces.cpp
index b8a22e57a06e..6dd447318a0b 100644
--- a/test/PCH/namespaces.cpp
+++ b/test/PCH/namespaces.cpp
@@ -40,3 +40,6 @@ void (*pused)() = used_func;
using N1::used_cls;
used_cls s1;
used_cls* ps1 = &s1;
+
+inline namespace N4 { }
+struct MemberOfN4 *mn4;
diff --git a/test/PCH/opencl-extensions.cl b/test/PCH/opencl-extensions.cl
new file mode 100644
index 000000000000..a22b007f9d54
--- /dev/null
+++ b/test/PCH/opencl-extensions.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -emit-pch -o %t %s
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s
+
+#ifndef HEADER
+#define HEADER
+// Header.
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+#else
+// Using the header.
+
+void test(void) {
+ double d;
+}
+
+#endif
diff --git a/test/PCH/pragma-diag-section.cpp b/test/PCH/pragma-diag-section.cpp
new file mode 100644
index 000000000000..312f720ebd98
--- /dev/null
+++ b/test/PCH/pragma-diag-section.cpp
@@ -0,0 +1,26 @@
+// Test this without pch.
+// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
+
+// Test with pch.
+// RUN: %clang_cc1 %s -emit-pch -o %t
+// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
+
+#ifndef HEADER
+#define HEADER
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-compare"
+template <typename T>
+struct TS {
+ void m() { T b = b==b; }
+};
+#pragma clang diagnostic pop
+
+#else
+
+void f() {
+ TS<int> ts;
+ ts.m();
+}
+
+#endif
diff --git a/test/PCH/pragma-diag.c b/test/PCH/pragma-diag.c
new file mode 100644
index 000000000000..c5171036400f
--- /dev/null
+++ b/test/PCH/pragma-diag.c
@@ -0,0 +1,19 @@
+// Test this without pch.
+// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
+
+// Test with pch.
+// RUN: %clang_cc1 %s -emit-pch -o %t
+// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
+
+#ifndef HEADER
+#define HEADER
+
+#pragma clang diagnostic ignored "-Wtautological-compare"
+
+#else
+
+void f() {
+ int b = b==b;
+}
+
+#endif
diff --git a/test/PCH/rdar8852495.c b/test/PCH/rdar8852495.c
new file mode 100644
index 000000000000..2d49e001b051
--- /dev/null
+++ b/test/PCH/rdar8852495.c
@@ -0,0 +1,25 @@
+// Test this without pch.
+// RUN: %clang_cc1 %s -include %s -verify -fsyntax-only -Wno-sign-compare -Wtautological-compare
+
+// Test with pch.
+// RUN: %clang_cc1 %s -emit-pch -o %t -Wsign-compare -Wtautological-compare
+// RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only -Wno-sign-compare -Wtautological-compare
+
+// This tests that diagnostic mappings from PCH are propagated for #pragma
+// diagnostics but not for command-line flags.
+
+#ifndef HEADER
+#define HEADER
+
+#pragma clang diagnostic ignored "-Wtautological-compare"
+
+#else
+
+int f() {
+ int b = b==b;
+ unsigned x;
+ signed y;
+ return x == y;
+}
+
+#endif
diff --git a/test/PCH/reinclude.cpp b/test/PCH/reinclude.cpp
index 6ab10027c9fa..71f90282ba57 100644
--- a/test/PCH/reinclude.cpp
+++ b/test/PCH/reinclude.cpp
@@ -4,5 +4,7 @@
// RUN: %clang_cc1 -x c++-header %S/reinclude1.h -emit-pch -o %t1
// RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2
// RUN: %clang_cc1 %s -include-pch %t2 -fsyntax-only -verify
+// RUN: %clang_cc1 -x c++-header %S/reinclude2.h -include-pch %t1 -emit-pch -o %t2 -chained-pch
+// RUN: %clang_cc1 %s -include-pch %t2 -fsyntax-only -verify
int q2 = A::y;
diff --git a/test/PCH/reinclude1.h b/test/PCH/reinclude1.h
index 4c8ccaef617e..baeb677b715c 100644
--- a/test/PCH/reinclude1.h
+++ b/test/PCH/reinclude1.h
@@ -2,3 +2,6 @@ namespace A {
int x;
int y;
}
+
+int foo;
+#define foo foo
diff --git a/test/PCH/reloc.c b/test/PCH/reloc.c
index fd78feba6047..51a7c4c87946 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/types.c b/test/PCH/types.c
index 73a2205b78b6..ba00dc6824e1 100644
--- a/test/PCH/types.c
+++ b/test/PCH/types.c
@@ -11,8 +11,7 @@ INT int_value;
__attribute__((address_space(1))) int int_as_one;
// TYPE_EXT_QUAL
-ASInt *as_int_ptr1 = &int_value; // expected-error{{different address spaces}} \
- // FIXME: expected-warning{{discards qualifiers}}
+ASInt *as_int_ptr1 = &int_value; // expected-error{{changes address space of pointer}}
ASInt *as_int_ptr2 = &int_as_one;
// FIXME: TYPE_FIXED_WIDTH_INT
diff --git a/test/PCH/typo.m b/test/PCH/typo.m
new file mode 100644
index 000000000000..c6f0275bc2fd
--- /dev/null
+++ b/test/PCH/typo.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -x objective-c-header -emit-pch -o %t %S/Inputs/typo.h
+// RUN: %clang_cc1 -include-pch %t -verify %s
+// In header: expected-note{{declared here}}
+void f() {
+ [NSstring alloc]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}}
+}
diff --git a/test/PCH/va_arg.cpp b/test/PCH/va_arg.cpp
new file mode 100644
index 000000000000..7c8dc6b316f3
--- /dev/null
+++ b/test/PCH/va_arg.cpp
@@ -0,0 +1,16 @@
+// Test this without pch.
+// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/Inputs/va_arg.h %s -emit-llvm -o -
+
+// Test with pch.
+// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -x c++-header -o %t %S/Inputs/va_arg.h
+// RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t %s -emit-llvm -o -
+
+typedef __SIZE_TYPE__ size_t;
+
+extern "C" {
+int vsnprintf(char * , size_t, const char * , va_list) ;
+}
+
+void f(char *buffer, unsigned count, const char* format, va_list argptr) {
+ vsnprintf(buffer, count, format, argptr);
+}
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index ec272cdf9c80..9df8fa3a4e91 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s
+// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s
__stdcall int func0();
int __stdcall func();
typedef int (__cdecl *tptr)();
@@ -21,6 +21,7 @@ void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
setc al
};
}
+_inline int foo99() { return 99; }
void *_alloca(int);
@@ -30,9 +31,34 @@ void foo() {
typedef bool (__stdcall __stdcall *blarg)(int);
+void local_callconv()
+{
+ bool (__stdcall *p)(int);
+}
// Charify extension.
#define FOO(x) #@x
char x = FOO(a);
typedef enum E { e1 };
+
+
+
+
+
+
+/* Microsoft attribute tests */
+[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
+struct SA_Post{ SA_Post(); int attr; };
+
+[returnvalue:SA_Post( attr=1)]
+int foo1([SA_Post(attr=1)] void *param);
+
+
+
+void ms_intrinsics(int a)
+{
+ __noop();
+ __assume(a);
+
+}
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
new file mode 100644
index 000000000000..fd0d7d50d0eb
--- /dev/null
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
+
+/* Microsoft attribute tests */
+[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
+struct SA_Post{ SA_Post(); int attr; };
+
+[returnvalue:SA_Post( attr=1)]
+int foo1([SA_Post(attr=1)] void *param);
+
+namespace {
+ [returnvalue:SA_Post(attr=1)]
+ int foo2([SA_Post(attr=1)] void *param);
+}
+
+class T {
+ [returnvalue:SA_Post(attr=1)]
+ int foo3([SA_Post(attr=1)] void *param);
+};
+
+extern "C" {
+ [returnvalue:SA_Post(attr=1)]
+ int foo5([SA_Post(attr=1)] void *param);
+}
+
+class class_attr {
+public:
+ class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a)
+ {
+ }
+};
+
+
+
+void uuidof_test1()
+{
+ __uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
+}
+
+typedef struct _GUID
+{
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+
+struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
+struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
+struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };// expected-error {{uuid attribute contains a malformed GUID}}
+struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}}
+struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}
+
+
+
+struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
+struct_with_uuid { };
+struct struct_without_uuid { };
+
+struct __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
+struct_with_uuid2;
+
+struct
+struct_with_uuid2 {} ;
+
+int uuid_sema_test()
+{
+ struct_with_uuid var_with_uuid[1];
+ struct_without_uuid var_without_uuid[1];
+
+ __uuidof(struct_with_uuid);
+ __uuidof(struct_with_uuid2);
+ __uuidof(struct_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
+ __uuidof(struct_with_uuid*);
+ __uuidof(struct_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
+
+ __uuidof(var_with_uuid);
+ __uuidof(var_without_uuid);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+ __uuidof(var_with_uuid[1]);
+ __uuidof(var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+ __uuidof(&var_with_uuid[1]);
+ __uuidof(&var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+
+ __uuidof(0);
+ __uuidof(1);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+}
+
+
+template <class T>
+void template_uuid()
+{
+ T expr;
+
+ __uuidof(T);
+ __uuidof(expr);
+}
+
+
+
+class CtorCall {
+public:
+ CtorCall& operator=(const CtorCall& that);
+
+ int a;
+};
+
+CtorCall& CtorCall::operator=(const CtorCall& that)
+{
+ if (this != &that) {
+ this->CtorCall::~CtorCall();
+ this->CtorCall::CtorCall(that); // expected-warning {{explicit constructor calls are a Microsoft extension}}
+ }
+ return *this;
+}
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
index 92ec688bc01d..64f82f7a563c 100644
--- a/test/Parser/altivec.c
+++ b/test/Parser/altivec.c
@@ -100,6 +100,16 @@ void f() {
__vector unsigned int tv = gccv;
gccv = v;
gccvector unsigned int tgv = v;
+
+ int res_i;
+ // bug 7553 - Problem with '==' and vectors
+ res_i = (vv_sc == vv_sc);
+ res_i = (vv_uc != vv_uc);
+ res_i = (vv_s > vv_s);
+ res_i = (vv_us >= vv_us);
+ res_i = (vv_i < vv_i);
+ res_i = (vv_ui <= vv_ui);
+ res_i = (vv_f <= vv_f);
}
// bug 6895 - Vectorl literal casting confusion.
diff --git a/test/Parser/asm-constraints-pr7869.c b/test/Parser/asm-constraints-pr7869.c
index d6f1725f1a84..db369911cf8c 100644
--- a/test/Parser/asm-constraints-pr7869.c
+++ b/test/Parser/asm-constraints-pr7869.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 %s
int a, b, c, d, e, f, g, h, i, j, k, l;
diff --git a/test/Parser/cuda-kernel-call.cu b/test/Parser/cuda-kernel-call.cu
new file mode 100644
index 000000000000..f95ae9e6195f
--- /dev/null
+++ b/test/Parser/cuda-kernel-call.cu
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void foo(void) {
+ foo<<<1; // expected-error {{expected '>>>'}} expected-note {{to match this '<<<'}}
+
+ foo<<<1,1>>>; // expected-error {{expected '('}}
+
+ foo<<<>>>(); // expected-error {{expected expression}}
+}
diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
index 8f463308112b..4d924503bbb9 100644
--- a/test/Parser/cxx-altivec.cpp
+++ b/test/Parser/cxx-altivec.cpp
@@ -127,27 +127,17 @@ 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)));
-#if 0 // Not ready yet.
// bug 7553 - Problem with '==' and vectors
void func() {
- vector int v10i = (vector int)(1, 2, 3, 4);
- vector int v11i = (vector int)(1, 2, 3, 4);
- bool r10ieq = (v10i == v11i);
- bool r10ine = (v10i != v11i);
- bool r10igt = (v10i > v11i);
- bool r10ige = (v10i >= v11i);
- bool r10ilt = (v10i < v11i);
- bool r10ile = (v10i <= v11i);
- vector float v10f = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
- vector float v11f = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
- bool r10feq = (v10f == v11f);
- bool r10fne = (v10f != v11f);
- bool r10fgt = (v10f > v11f);
- bool r10fge = (v10f >= v11f);
- bool r10flt = (v10f < v11f);
- bool r10fle = (v10f <= v11f);
+ bool res_b;
+ res_b = (vv_sc == vv_sc);
+ res_b = (vv_uc != vv_uc);
+ res_b = (vv_s > vv_s);
+ res_b = (vv_us >= vv_us);
+ res_b = (vv_i < vv_i);
+ res_b = (vv_ui <= vv_ui);
+ res_b = (vv_f <= vv_f);
}
-#endif
// vecreturn attribute test
struct Vector
@@ -161,3 +151,20 @@ Vector Add(Vector lhs, Vector rhs)
result.xyzw = vec_add(lhs.xyzw, rhs.xyzw);
return result; // This will (eventually) be returned in a register
}
+
+// vecreturn attribute test - should error because of virtual function.
+class VectorClassNonPod
+{
+ __vector float xyzw;
+public:
+ VectorClassNonPod() {}
+ virtual ~VectorClassNonPod() {}
+} __attribute__((vecreturn)); // expected-error {{the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)}}
+
+// vecreturn attribute test - should error because of virtual function.
+class VectorClassMultipleMembers
+{
+public:
+ __vector float xyzw;
+ __vector float abcd;
+} __attribute__((vecreturn)); // expected-error {{the vecreturn attribute can only be used on a class or structure with one member, which must be a vector}}
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index 57831a463b9b..f863bd198e50 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
class C;
class C {
public:
@@ -14,7 +14,11 @@ protected:
public:
void m() {
int l = 2;
- }
+ };
+
+ template<typename T> void mt(T) { };
+ ; // expected-warning{{extra ';' inside a class}}
+
virtual int vf() const volatile = 0;
private:
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index e00ffd070fd8..6d720d36a259 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -6,6 +6,9 @@ struct Type {
int Type;
};
+// rdar://8365458
+typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}} \
+ // expected-warning {{declaration does not declare anything}}
// PR4451 - We should recover well from the typo of '::' as ':' in a2.
namespace y {
@@ -83,3 +86,14 @@ struct CodeCompleteConsumer {
void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
}
+
+;
+
+// PR8380
+extern "" // expected-error {{unknown linkage language}}
+test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \
+ // expected-error {{expected ';' after top level declarator}}
+
+ int test6b;
+
+
diff --git a/test/Parser/cxx-in-c.c b/test/Parser/cxx-in-c.c
new file mode 100644
index 000000000000..f5fa39bd0cb9
--- /dev/null
+++ b/test/Parser/cxx-in-c.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR9137
+void f0(int x) : {}; // expected-error{{expected function body after function declarator}}
+void f1(int x) try {}; // expected-error{{expected function body after function declarator}}
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
index 46f9fb07dba0..fae938bcaab0 100644
--- a/test/Parser/cxx-reference.cpp
+++ b/test/Parser/cxx-reference.cpp
@@ -18,4 +18,4 @@ int & volatile Y = val; // expected-error {{'volatile' qualifier may not be appl
int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
expected-error {{'volatile' qualifier may not be applied}} */
-typedef int && RV; // expected-error {{rvalue references are only allowed in C++0x}}
+typedef int && RV; // expected-warning {{rvalue references are a C++0x extension}}
diff --git a/test/Parser/cxx-stmt.cpp b/test/Parser/cxx-stmt.cpp
index fdd573e6bfa5..795aca6e93c0 100644
--- a/test/Parser/cxx-stmt.cpp
+++ b/test/Parser/cxx-stmt.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
void f1()
{
diff --git a/test/Parser/cxx-template-argument.cpp b/test/Parser/cxx-template-argument.cpp
index 532b4c9894b7..c85b1c928111 100644
--- a/test/Parser/cxx-template-argument.cpp
+++ b/test/Parser/cxx-template-argument.cpp
@@ -7,3 +7,6 @@ template<typename T> struct A {};
A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}}
A<int x; // expected-error {{expected '>'}}
+// PR8912
+template <bool> struct S {};
+S<bool(2 > 1)> s;
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
index 3a97efac19ed..4717dbb7dc2d 100644
--- a/test/Parser/cxx-template-decl.cpp
+++ b/test/Parser/cxx-template-decl.cpp
@@ -6,7 +6,9 @@ template x; // expected-error {{C++ requires a type specifier for al
// expected-error {{does not refer}}
export template x; // expected-error {{expected '<' after 'template'}}
export template<class T> class x0; // expected-warning {{exported templates are unsupported}}
-template < ; // expected-error {{parse error}} expected-warning {{declaration does not declare anything}}
+template < ; // expected-error {{parse error}} \
+// expected-error{{expected ',' or '>' in template-parameter-list}} \
+// expected-warning {{declaration does not declare anything}}
template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
// expected-error{{extraneous}}
template <template <typename> > struct Err2; // expected-error {{expected 'class' before '>'}} \
diff --git a/test/Parser/cxx-throw.cpp b/test/Parser/cxx-throw.cpp
index a87881647dd4..20b8f4b754ab 100644
--- a/test/Parser/cxx-throw.cpp
+++ b/test/Parser/cxx-throw.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
int i;
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 67b2ea6f62ea..3147de940418 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x %s
// Declaration syntax checks
[[]] int before_attr;
@@ -29,7 +29,6 @@ extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}}
[[]] using namespace ns;
// Argument tests
-[[final()]] int final_params; // expected-error {{C++0x attribute 'final' cannot have an argument list}}
[[align]] int aligned_no_params; // expected-error {{C++0x attribute 'align' must have an argument list}}
[[align(i)]] int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}}
diff --git a/test/Parser/cxx0x-in-cxx98.cpp b/test/Parser/cxx0x-in-cxx98.cpp
new file mode 100644
index 000000000000..e0cbc23f5811
--- /dev/null
+++ b/test/Parser/cxx0x-in-cxx98.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s
+
+inline namespace N { // expected-warning{{inline namespaces are a C++0x feature}}
+struct X {
+ template<typename ...Args> // expected-warning{{variadic templates are a C++0x extension}}
+ void f(Args &&...) &; // expected-warning{{rvalue references are a C++0x extension}} \
+ // expected-warning{{reference qualifiers on functions are a C++0x extension}}
+};
+}
+
diff --git a/test/Parser/cxx0x-override-control-keywords.cpp b/test/Parser/cxx0x-override-control-keywords.cpp
new file mode 100644
index 000000000000..f959f7a9952c
--- /dev/null
+++ b/test/Parser/cxx0x-override-control-keywords.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+struct Base {
+ virtual void override();
+};
+
+struct S : Base {
+ virtual void final() final;
+ virtual void override() override;
+ virtual void n() new;
+ int i : 3 new;
+ int j new;
+};
+
+struct T {
+ // virt-specifier-seq is only valid in member-declarators, and a function definition is not a member-declarator.
+ // FIXME: This currently doesn't work.
+ // virtual void f() const override { }
+};
+
+struct override;
+struct Base2 {
+ virtual override override(int override);
+};
+
+struct A : Base2 {
+ virtual struct override override(int override) override;
+};
diff --git a/test/Parser/encode.m b/test/Parser/encode.m
index e0e753508119..7b8022e78dc0 100644
--- a/test/Parser/encode.m
+++ b/test/Parser/encode.m
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
int main(void) {
- const char ch = @encode(char *)[2];
- char c = @encode(char *)[2] + 4;
+ const char ch = @encode(char *)[0];
+ char c = @encode(char *)[0] + 4;
return c;
}
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index ffc5c83a0a73..6015e918a340 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -39,7 +39,8 @@ void test_sizeof(){
// PR3418
int test_leading_extension() {
- __extension__ (*(char*)0) = 1;
+ __extension__ (*(char*)0) = 1; // expected-warning {{indirection of non-volatile null pointer}} \
+ // expected-note {{consider using __builtin_trap}}
return 0;
}
diff --git a/test/Parser/for.cpp b/test/Parser/for.cpp
new file mode 100644
index 000000000000..e41383938934
--- /dev/null
+++ b/test/Parser/for.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1() {
+ int n;
+
+ for (n = 0; n < 10; n++);
+
+ for (n = 0 n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (n = 0; n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (int n = 0 n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (int n = 0; n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (n = 0 bool b = n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (n = 0; bool b = n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (n = 0 n < 10 n++); // expected-error 2{{expected ';' in 'for'}}
+
+ for (;); // expected-error {{expected ';' in 'for'}}
+}
diff --git a/test/Parser/goto-ident.c b/test/Parser/goto-ident.c
deleted file mode 100644
index 32051dc677ec..000000000000
--- a/test/Parser/goto-ident.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* RUN: %clang_cc1 -fsyntax-only -verify %s
-*/
-
-void foo() {
- goto ; /* expected-error {{expected identifier}} */
-}
diff --git a/test/Parser/goto.c b/test/Parser/goto.c
new file mode 100644
index 000000000000..a3e01174eb94
--- /dev/null
+++ b/test/Parser/goto.c
@@ -0,0 +1,30 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+*/
+
+void test1() {
+ goto ; /* expected-error {{expected identifier}} */
+}
+
+
+void test2() {
+ l: /* expected-note {{previous definition is here}} */
+
+ {
+ __label__ l;
+ l: goto l;
+ }
+
+ {
+ __label__ l;
+ __label__ h; /* expected-error {{use of undeclared label 'h'}} */
+ l: goto l;
+ }
+
+ /* PR3429 & rdar://8287027
+ */
+ {
+ l: /* expected-error {{redefinition of label 'l'}} */
+ ;
+ }
+
+}
diff --git a/test/Parser/missing-end-2.m b/test/Parser/missing-end-2.m
new file mode 100644
index 000000000000..63dc96558361
--- /dev/null
+++ b/test/Parser/missing-end-2.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: //7824372
+
+@interface A
+-(void) im0;
+
+@implementation A // expected-error {{missing @end}}
+@end
+
+@interface B {
+}
+
+@implementation B // expected-error {{missing @end}}
+@end
+
+@interface C
+@property int P;
+
+@implementation C // expected-error 2 {{missing @end}}
diff --git a/test/Parser/missing-end-3.m b/test/Parser/missing-end-3.m
new file mode 100644
index 000000000000..3b226376dc58
--- /dev/null
+++ b/test/Parser/missing-end-3.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8283484
+@interface blah {
+ @private
+}
+// since I forgot the @end here it should say something
+
+@interface blah // expected-error {{missing @end}}
+@end // and Unknown type name 'end' here
+
diff --git a/test/Parser/objc-forcollection-neg-2.m b/test/Parser/objc-forcollection-neg-2.m
index e02c51c1ba35..6aa74c9c0b45 100644
--- a/test/Parser/objc-forcollection-neg-2.m
+++ b/test/Parser/objc-forcollection-neg-2.m
@@ -1,11 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef struct objc_class *Class;
+struct __objcFastEnumerationState;
typedef struct objc_object {
Class isa;
} *id;
-
@protocol P @end
@interface MyList
diff --git a/test/Parser/objc-forcollection-neg.m b/test/Parser/objc-forcollection-neg.m
index 0ba093efa08a..d896c35f3f69 100644
--- a/test/Parser/objc-forcollection-neg.m
+++ b/test/Parser/objc-forcollection-neg.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+struct __objcFastEnumerationState;
typedef struct objc_class *Class;
typedef struct objc_object {
Class isa;
diff --git a/test/Parser/objc-foreach-syntax.m b/test/Parser/objc-foreach-syntax.m
index 943540ef1f23..cc82725b17d7 100644
--- a/test/Parser/objc-foreach-syntax.m
+++ b/test/Parser/objc-foreach-syntax.m
@@ -1,7 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-
+struct __objcFastEnumerationState;
@implementation MyList // expected-warning {{cannot find interface declaration for 'MyList'}}
- (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount
{
diff --git a/test/Parser/objc-interfaces.m b/test/Parser/objc-interfaces.m
index aac3faa4350a..0ae17f15ee4d 100644
--- a/test/Parser/objc-interfaces.m
+++ b/test/Parser/objc-interfaces.m
@@ -3,6 +3,6 @@
// Test features and error recovery for objc interfaces.
@interface INTF
-- (int*) foo2 __attribute__((deprecated)) : (int) x1 __attribute__((deprecated)); // expected-error {{expected ';' after method prototype}}
+- (int*) foo2 __attribute__((deprecated)) : (int) x1 __attribute__((deprecated)); // expected-error {{expected ';' after method prototype}} expected-error {{method type specifier must start with '-' or '+'}}
@end
diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m
index 064a2090b005..6ef2ad7c527d 100644
--- a/test/Parser/objc-property-syntax.m
+++ b/test/Parser/objc-property-syntax.m
@@ -1,14 +1,17 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@interface MyClass {
-
+ int prop;
};
@property unsigned char bufferedUTF8Bytes[4]; // expected-error {{property cannot have array or function type}}
@property unsigned char bufferedUTFBytes:1; // expected-error {{property name cannot be a bitfield}}
@property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass *ab_defaultToolbarItems; // expected-error {{method name referenced in property setter attribute must end with ':'}}
+
+@property int prop;
@end
@implementation MyClass
-@dynamic ab_defaultToolbarItems;
+@dynamic ab_defaultToolbarItems // expected-error{{expected ';' after @dynamic}}
+@synthesize prop // expected-error{{expected ';' after @synthesize}}
@end
diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m
index b6671d1cf947..591bca222a93 100644
--- a/test/Parser/objc-quirks.m
+++ b/test/Parser/objc-quirks.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
// FIXME: This is a horrible error message here. Fix.
int @"s" = 5; // expected-error {{prefix attribute must be}}
@@ -6,7 +6,9 @@ int @"s" = 5; // expected-error {{prefix attribute must be}}
// rdar://6480479
@interface A
-}; // expected-error {{missing @end}} expected-error {{expected external declaration}}
+}; // expected-error {{missing @end}} \
+// expected-error {{expected external declaration}} \
+// expected-warning{{extra ';' outside of a function}}
@@ -26,3 +28,5 @@ int @"s" = 5; // expected-error {{prefix attribute must be}}
[(super) a]; // expected-error {{use of undeclared identifier 'super'}}
}
@end
+
+@compatibility_alias A3 A2;
diff --git a/test/Parser/opencl-kernel.cl b/test/Parser/opencl-kernel.cl
new file mode 100644
index 000000000000..3abb62b6169c
--- /dev/null
+++ b/test/Parser/opencl-kernel.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+__kernel void test()
+{
+}
+
+kernel void test1()
+{
+}
diff --git a/test/Parser/opencl-pragma.cl b/test/Parser/opencl-pragma.cl
new file mode 100644
index 000000000000..5b6c55ab0743
--- /dev/null
+++ b/test/Parser/opencl-pragma.cl
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+
+#pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */
+
+#pragma OPENCL FP_CONTRACT ON
+#pragma OPENCL FP_CONTRACT OFF
+#pragma OPENCL FP_CONTRACT DEFAULT
+#pragma OPENCL FP_CONTRACT FOO // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
diff --git a/test/Parser/opencl-storage-class.cl b/test/Parser/opencl-storage-class.cl
new file mode 100644
index 000000000000..d479358f0024
--- /dev/null
+++ b/test/Parser/opencl-storage-class.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+void test_storage_class_specs()
+{
+ static int a; // expected-error {{OpenCL does not support the 'static' storage class specifier}}
+ register int b; // expected-error {{OpenCL does not support the 'register' storage class specifier}}
+ extern int c; // expected-error {{OpenCL does not support the 'extern' storage class specifier}}
+ auto int d; // expected-error {{OpenCL does not support the 'auto' storage class specifier}}
+}
diff --git a/test/Parser/placeholder-recovery.m b/test/Parser/placeholder-recovery.m
new file mode 100644
index 000000000000..1fc154955d50
--- /dev/null
+++ b/test/Parser/placeholder-recovery.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// FIXME: We could do much better with this, if we recognized
+// placeholders somehow. However, we're content with not generating
+// bogus 'archaic' warnings with bad location info.
+@protocol <#protocol name#> <NSObject> // expected-error 2{{expected identifier}} \
+// expected-error{{cannot find protocol declaration for 'NSObject'}} \
+// expected-warning{{protocol qualifiers without 'id'}}
+
+<#methods#> // expected-error{{expected identifier}}
+
+@end // expected-error{{prefix attribute}}
diff --git a/test/Parser/recovery.c b/test/Parser/recovery.c
index 6cd95da878d2..1b33f0225bce 100644
--- a/test/Parser/recovery.c
+++ b/test/Parser/recovery.c
@@ -78,3 +78,9 @@ void foo() {
// rdar://7980651
typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
+
+void test1(void) {
+ int x = 2: // expected-error {{expected ';' at end of declaration}}
+ int y = x;
+ int z = y;
+}
diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp
index 8eb4cff4fbe1..f11babc5b600 100644
--- a/test/Parser/switch-recovery.cpp
+++ b/test/Parser/switch-recovery.cpp
@@ -3,10 +3,32 @@
// <rdar://problem/7971948>
struct A {};
struct B {
- void foo() {
+ void foo(int b) {
switch (a) { // expected-error{{use of undeclared identifier 'a'}}
default:
return;
}
+
+ switch (b) {
+ case 17 // expected-error{{expected ':' after 'case'}}
+ break;
+
+ default // expected-error{{expected ':' after 'default'}}
+ return;
+ }
+ }
+
+ void test2() {
+ enum X { Xa, Xb } x;
+
+ switch (x) { // expected-warning {{enumeration value 'Xb' not handled in switch}}
+ case Xa; // expected-error {{expected ':' after 'case'}}
+ break;
+ }
+
+ switch (x) {
+ default; // expected-error {{expected ':' after 'default'}}
+ break;
+ }
}
};
diff --git a/test/Preprocessor/assembler-with-cpp.c b/test/Preprocessor/assembler-with-cpp.c
index 0543077c01c7..a9c42940a310 100644
--- a/test/Preprocessor/assembler-with-cpp.c
+++ b/test/Preprocessor/assembler-with-cpp.c
@@ -72,3 +72,8 @@
11: T11(b)
// CHECK-Identifiers-True: 11: #0
+
+// This should not crash
+// rdar://8823139
+# ##
+// CHECK-Identifiers-False: # ##
diff --git a/test/Preprocessor/clang_headers.c b/test/Preprocessor/clang_headers.c
index f2dec4fbe565..41bd75410458 100644
--- a/test/Preprocessor/clang_headers.c
+++ b/test/Preprocessor/clang_headers.c
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -E %s
+// RUN: %clang_cc1 -ffreestanding -E %s
#include <limits.h>
diff --git a/test/Preprocessor/has_include.c b/test/Preprocessor/has_include.c
index c34c3488036a..fdcae78b751e 100644
--- a/test/Preprocessor/has_include.c
+++ b/test/Preprocessor/has_include.c
@@ -1,23 +1,23 @@
-// RUN: %clang_cc1 -Eonly -verify %s
+// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s
// Try different path permutations of __has_include with existing file.
-#if __has_include("stdio.h")
+#if __has_include("stdint.h")
#else
#error "__has_include failed (1)."
#endif
-#if __has_include(<stdio.h>)
+#if __has_include(<stdint.h>)
#else
#error "__has_include failed (2)."
#endif
// Try unary expression.
-#if !__has_include("stdio.h")
+#if !__has_include("stdint.h")
#error "__has_include failed (5)."
#endif
// Try binary expression.
-#if __has_include("stdio.h") && __has_include("stddef.h")
+#if __has_include("stdint.h") && __has_include("stddef.h")
#else
#error "__has_include failed (6)."
#endif
@@ -44,12 +44,12 @@
#endif
// Try unary expression.
-#if !__has_include_next("stdio.h") // expected-warning {{#include_next in primary source file}}
+#if !__has_include_next("stdint.h") // expected-warning {{#include_next in primary source file}}
#error "__has_include_next failed (5)."
#endif
// Try binary expression.
-#if __has_include_next("stdio.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}}
+#if __has_include_next("stdint.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}}
#else
#error "__has_include_next failed (6)."
#endif
@@ -68,16 +68,16 @@
// FIXME: I don't quite know how to avoid preprocessor side effects.
// Use FileCheck?
// It also assert due to unterminated #if's.
-//#if __has_include("stdio.h"
-//#if __has_include "stdio.h")
-//#if __has_include(stdio.h)
+//#if __has_include("stdint.h"
+//#if __has_include "stdint.h")
+//#if __has_include(stdint.h)
//#if __has_include()
//#if __has_include(
//#if __has_include)
//#if __has_include
-//#if __has_include(<stdio.h>
-//#if __has_include<stdio.h>)
-//#if __has_include("stdio.h)
-//#if __has_include(stdio.h")
-//#if __has_include(<stdio.h)
-//#if __has_include(stdio.h>)
+//#if __has_include(<stdint.h>
+//#if __has_include<stdint.h>)
+//#if __has_include("stdint.h)
+//#if __has_include(stdint.h")
+//#if __has_include(<stdint.h)
+//#if __has_include(stdint.h>)
diff --git a/test/Preprocessor/header_lookup1.c b/test/Preprocessor/header_lookup1.c
index f93d0afe331e..f52e4fe6ce92 100644
--- a/test/Preprocessor/header_lookup1.c
+++ b/test/Preprocessor/header_lookup1.c
@@ -1,2 +1,2 @@
-// RUN: %clang -fno-ms-extensions -I /usr/include %s -E | grep 'stdio.h.*3.*4'
-#include <stdio.h>
+// RUN: %clang -fno-ms-extensions %s -E | grep 'stddef.h.*3.*4'
+#include <stddef.h>
diff --git a/test/Preprocessor/include-directive2.c b/test/Preprocessor/include-directive2.c
index b205325f601e..5f1ee3cfbc26 100644
--- a/test/Preprocessor/include-directive2.c
+++ b/test/Preprocessor/include-directive2.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Eonly -verify %s
+// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s
# define HEADER <float.h>
# include HEADER
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 6c27a6c4316a..98b053552eb1 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -417,6 +417,104 @@
// I386:#define __tune_nocona__ 1
// I386:#define i386 1
//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-pc-linux-gnu < /dev/null | FileCheck -check-prefix I386-LINUX %s
+//
+// I386-LINUX:#define __CHAR16_TYPE__ unsigned short
+// I386-LINUX:#define __CHAR32_TYPE__ unsigned int
+// I386-LINUX:#define __CHAR_BIT__ 8
+// I386-LINUX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// I386-LINUX:#define __DBL_DIG__ 15
+// I386-LINUX:#define __DBL_EPSILON__ 2.2204460492503131e-16
+// I386-LINUX:#define __DBL_HAS_DENORM__ 1
+// I386-LINUX:#define __DBL_HAS_INFINITY__ 1
+// I386-LINUX:#define __DBL_HAS_QUIET_NAN__ 1
+// I386-LINUX:#define __DBL_MANT_DIG__ 53
+// I386-LINUX:#define __DBL_MAX_10_EXP__ 308
+// I386-LINUX:#define __DBL_MAX_EXP__ 1024
+// I386-LINUX:#define __DBL_MAX__ 1.7976931348623157e+308
+// I386-LINUX:#define __DBL_MIN_10_EXP__ (-307)
+// I386-LINUX:#define __DBL_MIN_EXP__ (-1021)
+// I386-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308
+// I386-LINUX:#define __DECIMAL_DIG__ 21
+// I386-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
+// I386-LINUX:#define __FLT_DIG__ 6
+// I386-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
+// I386-LINUX:#define __FLT_EVAL_METHOD__ 0
+// I386-LINUX:#define __FLT_HAS_DENORM__ 1
+// I386-LINUX:#define __FLT_HAS_INFINITY__ 1
+// I386-LINUX:#define __FLT_HAS_QUIET_NAN__ 1
+// I386-LINUX:#define __FLT_MANT_DIG__ 24
+// I386-LINUX:#define __FLT_MAX_10_EXP__ 38
+// I386-LINUX:#define __FLT_MAX_EXP__ 128
+// I386-LINUX:#define __FLT_MAX__ 3.40282347e+38F
+// I386-LINUX:#define __FLT_MIN_10_EXP__ (-37)
+// I386-LINUX:#define __FLT_MIN_EXP__ (-125)
+// I386-LINUX:#define __FLT_MIN__ 1.17549435e-38F
+// I386-LINUX:#define __FLT_RADIX__ 2
+// I386-LINUX:#define __INT16_TYPE__ short
+// I386-LINUX:#define __INT32_TYPE__ int
+// I386-LINUX:#define __INT64_C_SUFFIX__ LL
+// I386-LINUX:#define __INT64_TYPE__ long long int
+// I386-LINUX:#define __INT8_TYPE__ char
+// I386-LINUX:#define __INTMAX_MAX__ 9223372036854775807LL
+// I386-LINUX:#define __INTMAX_TYPE__ long long int
+// I386-LINUX:#define __INTMAX_WIDTH__ 64
+// I386-LINUX:#define __INTPTR_TYPE__ int
+// I386-LINUX:#define __INTPTR_WIDTH__ 32
+// I386-LINUX:#define __INT_MAX__ 2147483647
+// I386-LINUX:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
+// I386-LINUX:#define __LDBL_DIG__ 18
+// I386-LINUX:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L
+// I386-LINUX:#define __LDBL_HAS_DENORM__ 1
+// I386-LINUX:#define __LDBL_HAS_INFINITY__ 1
+// I386-LINUX:#define __LDBL_HAS_QUIET_NAN__ 1
+// I386-LINUX:#define __LDBL_MANT_DIG__ 64
+// I386-LINUX:#define __LDBL_MAX_10_EXP__ 4932
+// I386-LINUX:#define __LDBL_MAX_EXP__ 16384
+// I386-LINUX:#define __LDBL_MAX__ 1.18973149535723176502e+4932L
+// I386-LINUX:#define __LDBL_MIN_10_EXP__ (-4931)
+// I386-LINUX:#define __LDBL_MIN_EXP__ (-16381)
+// I386-LINUX:#define __LDBL_MIN__ 3.36210314311209350626e-4932L
+// I386-LINUX:#define __LITTLE_ENDIAN__ 1
+// I386-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL
+// I386-LINUX:#define __LONG_MAX__ 2147483647L
+// I386-LINUX:#define __NO_INLINE__ 1
+// I386-LINUX:#define __NO_MATH_INLINES 1
+// I386-LINUX:#define __POINTER_WIDTH__ 32
+// I386-LINUX:#define __PTRDIFF_TYPE__ int
+// I386-LINUX:#define __PTRDIFF_WIDTH__ 32
+// I386-LINUX:#define __REGISTER_PREFIX__
+// I386-LINUX:#define __SCHAR_MAX__ 127
+// I386-LINUX:#define __SHRT_MAX__ 32767
+// I386-LINUX:#define __SIG_ATOMIC_WIDTH__ 32
+// I386-LINUX:#define __SIZEOF_DOUBLE__ 8
+// I386-LINUX:#define __SIZEOF_FLOAT__ 4
+// I386-LINUX:#define __SIZEOF_INT__ 4
+// I386-LINUX:#define __SIZEOF_LONG_DOUBLE__ 12
+// I386-LINUX:#define __SIZEOF_LONG_LONG__ 8
+// I386-LINUX:#define __SIZEOF_LONG__ 4
+// I386-LINUX:#define __SIZEOF_POINTER__ 4
+// I386-LINUX:#define __SIZEOF_PTRDIFF_T__ 4
+// I386-LINUX:#define __SIZEOF_SHORT__ 2
+// I386-LINUX:#define __SIZEOF_SIZE_T__ 4
+// I386-LINUX:#define __SIZEOF_WCHAR_T__ 4
+// I386-LINUX:#define __SIZEOF_WINT_T__ 4
+// I386-LINUX:#define __SIZE_TYPE__ unsigned int
+// I386-LINUX:#define __SIZE_WIDTH__ 32
+// I386-LINUX:#define __UINTMAX_TYPE__ long long unsigned int
+// I386-LINUX:#define __USER_LABEL_PREFIX__
+// I386-LINUX:#define __WCHAR_MAX__ 2147483647
+// I386-LINUX:#define __WCHAR_TYPE__ int
+// I386-LINUX:#define __WCHAR_WIDTH__ 32
+// I386-LINUX:#define __WINT_TYPE__ unsigned int
+// I386-LINUX:#define __WINT_WIDTH__ 32
+// I386-LINUX:#define __i386 1
+// I386-LINUX:#define __i386__ 1
+// I386-LINUX:#define __nocona 1
+// I386-LINUX:#define __nocona__ 1
+// I386-LINUX:#define __tune_nocona__ 1
+// I386-LINUX:#define i386 1
+//
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s
//
// MSP430:#define MSP430 1
@@ -508,106 +606,6 @@
// MSP430:#define __WINT_WIDTH__ 16
// MSP430:#define __clang__ 1
//
-// RUN: %clang_cc1 -E -dM -ffreestanding -triple=pic16-none-none < /dev/null | FileCheck -check-prefix PIC16 %s
-//
-// PIC16:#define __CHAR16_TYPE__ unsigned short
-// PIC16:#define __CHAR32_TYPE__ unsigned int
-// PIC16:#define __CHAR_BIT__ 8
-// PIC16:#define __DBL_DENORM_MIN__ 1.40129846e-45F
-// PIC16:#define __DBL_DIG__ 6
-// PIC16:#define __DBL_EPSILON__ 1.19209290e-7F
-// PIC16:#define __DBL_HAS_DENORM__ 1
-// PIC16:#define __DBL_HAS_INFINITY__ 1
-// PIC16:#define __DBL_HAS_QUIET_NAN__ 1
-// PIC16:#define __DBL_MANT_DIG__ 24
-// PIC16:#define __DBL_MAX_10_EXP__ 38
-// PIC16:#define __DBL_MAX_EXP__ 128
-// PIC16:#define __DBL_MAX__ 3.40282347e+38F
-// PIC16:#define __DBL_MIN_10_EXP__ (-37)
-// PIC16:#define __DBL_MIN_EXP__ (-125)
-// PIC16:#define __DBL_MIN__ 1.17549435e-38F
-// PIC16:#define __DECIMAL_DIG__ -1
-// PIC16:#define __FLT_DENORM_MIN__ 1.40129846e-45F
-// PIC16:#define __FLT_DIG__ 6
-// PIC16:#define __FLT_EPSILON__ 1.19209290e-7F
-// PIC16:#define __FLT_EVAL_METHOD__ 0
-// PIC16:#define __FLT_HAS_DENORM__ 1
-// PIC16:#define __FLT_HAS_INFINITY__ 1
-// PIC16:#define __FLT_HAS_QUIET_NAN__ 1
-// PIC16:#define __FLT_MANT_DIG__ 24
-// PIC16:#define __FLT_MAX_10_EXP__ 38
-// PIC16:#define __FLT_MAX_EXP__ 128
-// PIC16:#define __FLT_MAX__ 3.40282347e+38F
-// PIC16:#define __FLT_MIN_10_EXP__ (-37)
-// PIC16:#define __FLT_MIN_EXP__ (-125)
-// PIC16:#define __FLT_MIN__ 1.17549435e-38F
-// PIC16:#define __FLT_RADIX__ 2
-// PIC16:#define __INT16_TYPE__ short
-// PIC16:#define __INT32_C_SUFFIX__ L
-// PIC16:#define __INT32_TYPE__ long int
-// PIC16:#define __INT8_TYPE__ char
-// PIC16:#define __INTMAX_MAX__ 2147483647L
-// PIC16:#define __INTMAX_TYPE__ long int
-// PIC16:#define __INTMAX_WIDTH__ 32
-// PIC16:#define __INTPTR_TYPE__ short
-// PIC16:#define __INTPTR_WIDTH__ 16
-// PIC16:#define __INT_MAX__ 32767
-// PIC16:#define __LDBL_DENORM_MIN__ 1.40129846e-45F
-// PIC16:#define __LDBL_DIG__ 6
-// PIC16:#define __LDBL_EPSILON__ 1.19209290e-7F
-// PIC16:#define __LDBL_HAS_DENORM__ 1
-// PIC16:#define __LDBL_HAS_INFINITY__ 1
-// PIC16:#define __LDBL_HAS_QUIET_NAN__ 1
-// PIC16:#define __LDBL_MANT_DIG__ 24
-// PIC16:#define __LDBL_MAX_10_EXP__ 38
-// PIC16:#define __LDBL_MAX_EXP__ 128
-// PIC16:#define __LDBL_MAX__ 3.40282347e+38F
-// PIC16:#define __LDBL_MIN_10_EXP__ (-37)
-// PIC16:#define __LDBL_MIN_EXP__ (-125)
-// PIC16:#define __LDBL_MIN__ 1.17549435e-38F
-// PIC16:#define __LONG_LONG_MAX__ 2147483647LL
-// PIC16:#define __LONG_MAX__ 2147483647L
-// PIC16:#define __NO_INLINE__ 1
-// PIC16:#define __PIC16 1
-// PIC16:#define __POINTER_WIDTH__ 16
-// PIC16:#define __PTRDIFF_TYPE__ int
-// PIC16:#define __PTRDIFF_WIDTH__ 16
-// PIC16:#define __SCHAR_MAX__ 127
-// PIC16:#define __SHRT_MAX__ 32767
-// PIC16:#define __SIG_ATOMIC_WIDTH__ 32
-// PIC16:#define __SIZEOF_DOUBLE__ 4
-// PIC16:#define __SIZEOF_FLOAT__ 4
-// PIC16:#define __SIZEOF_INT__ 2
-// PIC16:#define __SIZEOF_LONG_DOUBLE__ 4
-// PIC16:#define __SIZEOF_LONG_LONG__ 4
-// PIC16:#define __SIZEOF_LONG__ 4
-// PIC16:#define __SIZEOF_POINTER__ 2
-// PIC16:#define __SIZEOF_PTRDIFF_T__ 2
-// PIC16:#define __SIZEOF_SHORT__ 2
-// PIC16:#define __SIZEOF_SIZE_T__ 2
-// PIC16:#define __SIZEOF_WCHAR_T__ 2
-// PIC16:#define __SIZEOF_WINT_T__ 2
-// PIC16:#define __SIZE_TYPE__ unsigned int
-// PIC16:#define __SIZE_WIDTH__ 16
-// PIC16:#define __UINTMAX_TYPE__ long unsigned int
-// PIC16:#define __USER_LABEL_PREFIX__ _
-// PIC16:#define __WCHAR_MAX__ 32767
-// PIC16:#define __WCHAR_TYPE__ int
-// PIC16:#define __WCHAR_WIDTH__ 16
-// PIC16:#define __WINT_TYPE__ int
-// PIC16:#define __WINT_WIDTH__ 16
-// PIC16:#define __address(Addr) __attribute__((section("Address="#Addr)))
-// PIC16:#define __clang__ 1
-// PIC16:#define __config(conf) asm("CONFIG "#conf)
-// PIC16:#define __idlocs(value) asm("__IDLOCS "#value)
-// PIC16:#define __llvm__ 1
-// PIC16:#define __pic16 1
-// PIC16:#define __section(SectName) __attribute__((section(SectName)))
-// PIC16:#define interrupt __attribute__((section("interrupt=0x4"))) __attribute__((used))
-// PIC16:#define near __attribute__((section("Address=NEAR")))
-// PIC16:#define ram __attribute__((address_space(0)))
-// PIC16:#define rom __attribute__((address_space(1)))
-//
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64 %s
//
// PPC64:#define _ARCH_PPC 1
@@ -1193,6 +1191,112 @@
// X86_64:#define __x86_64 1
// X86_64:#define __x86_64__ 1
//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-linux-gnu < /dev/null | FileCheck -check-prefix X86_64-LINUX %s
+//
+// X86_64-LINUX:#define _LP64 1
+// X86_64-LINUX:#define __CHAR16_TYPE__ unsigned short
+// X86_64-LINUX:#define __CHAR32_TYPE__ unsigned int
+// X86_64-LINUX:#define __CHAR_BIT__ 8
+// X86_64-LINUX:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// X86_64-LINUX:#define __DBL_DIG__ 15
+// X86_64-LINUX:#define __DBL_EPSILON__ 2.2204460492503131e-16
+// X86_64-LINUX:#define __DBL_HAS_DENORM__ 1
+// X86_64-LINUX:#define __DBL_HAS_INFINITY__ 1
+// X86_64-LINUX:#define __DBL_HAS_QUIET_NAN__ 1
+// X86_64-LINUX:#define __DBL_MANT_DIG__ 53
+// X86_64-LINUX:#define __DBL_MAX_10_EXP__ 308
+// X86_64-LINUX:#define __DBL_MAX_EXP__ 1024
+// X86_64-LINUX:#define __DBL_MAX__ 1.7976931348623157e+308
+// X86_64-LINUX:#define __DBL_MIN_10_EXP__ (-307)
+// X86_64-LINUX:#define __DBL_MIN_EXP__ (-1021)
+// X86_64-LINUX:#define __DBL_MIN__ 2.2250738585072014e-308
+// X86_64-LINUX:#define __DECIMAL_DIG__ 21
+// X86_64-LINUX:#define __FLT_DENORM_MIN__ 1.40129846e-45F
+// X86_64-LINUX:#define __FLT_DIG__ 6
+// X86_64-LINUX:#define __FLT_EPSILON__ 1.19209290e-7F
+// X86_64-LINUX:#define __FLT_EVAL_METHOD__ 0
+// X86_64-LINUX:#define __FLT_HAS_DENORM__ 1
+// X86_64-LINUX:#define __FLT_HAS_INFINITY__ 1
+// X86_64-LINUX:#define __FLT_HAS_QUIET_NAN__ 1
+// X86_64-LINUX:#define __FLT_MANT_DIG__ 24
+// X86_64-LINUX:#define __FLT_MAX_10_EXP__ 38
+// X86_64-LINUX:#define __FLT_MAX_EXP__ 128
+// X86_64-LINUX:#define __FLT_MAX__ 3.40282347e+38F
+// X86_64-LINUX:#define __FLT_MIN_10_EXP__ (-37)
+// X86_64-LINUX:#define __FLT_MIN_EXP__ (-125)
+// X86_64-LINUX:#define __FLT_MIN__ 1.17549435e-38F
+// X86_64-LINUX:#define __FLT_RADIX__ 2
+// X86_64-LINUX:#define __INT16_TYPE__ short
+// X86_64-LINUX:#define __INT32_TYPE__ int
+// X86_64-LINUX:#define __INT64_C_SUFFIX__ L
+// X86_64-LINUX:#define __INT64_TYPE__ long int
+// X86_64-LINUX:#define __INT8_TYPE__ char
+// X86_64-LINUX:#define __INTMAX_MAX__ 9223372036854775807L
+// X86_64-LINUX:#define __INTMAX_TYPE__ long int
+// X86_64-LINUX:#define __INTMAX_WIDTH__ 64
+// X86_64-LINUX:#define __INTPTR_TYPE__ long int
+// X86_64-LINUX:#define __INTPTR_WIDTH__ 64
+// X86_64-LINUX:#define __INT_MAX__ 2147483647
+// X86_64-LINUX:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
+// X86_64-LINUX:#define __LDBL_DIG__ 18
+// X86_64-LINUX:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L
+// X86_64-LINUX:#define __LDBL_HAS_DENORM__ 1
+// X86_64-LINUX:#define __LDBL_HAS_INFINITY__ 1
+// X86_64-LINUX:#define __LDBL_HAS_QUIET_NAN__ 1
+// X86_64-LINUX:#define __LDBL_MANT_DIG__ 64
+// X86_64-LINUX:#define __LDBL_MAX_10_EXP__ 4932
+// X86_64-LINUX:#define __LDBL_MAX_EXP__ 16384
+// X86_64-LINUX:#define __LDBL_MAX__ 1.18973149535723176502e+4932L
+// X86_64-LINUX:#define __LDBL_MIN_10_EXP__ (-4931)
+// X86_64-LINUX:#define __LDBL_MIN_EXP__ (-16381)
+// X86_64-LINUX:#define __LDBL_MIN__ 3.36210314311209350626e-4932L
+// X86_64-LINUX:#define __LITTLE_ENDIAN__ 1
+// X86_64-LINUX:#define __LONG_LONG_MAX__ 9223372036854775807LL
+// X86_64-LINUX:#define __LONG_MAX__ 9223372036854775807L
+// X86_64-LINUX:#define __LP64__ 1
+// X86_64-LINUX:#define __MMX__ 1
+// X86_64-LINUX:#define __NO_INLINE__ 1
+// X86_64-LINUX:#define __NO_MATH_INLINES 1
+// X86_64-LINUX:#define __POINTER_WIDTH__ 64
+// X86_64-LINUX:#define __PTRDIFF_TYPE__ long int
+// X86_64-LINUX:#define __PTRDIFF_WIDTH__ 64
+// X86_64-LINUX:#define __REGISTER_PREFIX__
+// X86_64-LINUX:#define __SCHAR_MAX__ 127
+// X86_64-LINUX:#define __SHRT_MAX__ 32767
+// X86_64-LINUX:#define __SIG_ATOMIC_WIDTH__ 32
+// X86_64-LINUX:#define __SIZEOF_DOUBLE__ 8
+// X86_64-LINUX:#define __SIZEOF_FLOAT__ 4
+// X86_64-LINUX:#define __SIZEOF_INT__ 4
+// X86_64-LINUX:#define __SIZEOF_LONG_DOUBLE__ 16
+// X86_64-LINUX:#define __SIZEOF_LONG_LONG__ 8
+// X86_64-LINUX:#define __SIZEOF_LONG__ 8
+// X86_64-LINUX:#define __SIZEOF_POINTER__ 8
+// X86_64-LINUX:#define __SIZEOF_PTRDIFF_T__ 8
+// X86_64-LINUX:#define __SIZEOF_SHORT__ 2
+// X86_64-LINUX:#define __SIZEOF_SIZE_T__ 8
+// X86_64-LINUX:#define __SIZEOF_WCHAR_T__ 4
+// X86_64-LINUX:#define __SIZEOF_WINT_T__ 4
+// X86_64-LINUX:#define __SIZE_TYPE__ long unsigned int
+// X86_64-LINUX:#define __SIZE_WIDTH__ 64
+// X86_64-LINUX:#define __SSE2_MATH__ 1
+// X86_64-LINUX:#define __SSE2__ 1
+// X86_64-LINUX:#define __SSE_MATH__ 1
+// X86_64-LINUX:#define __SSE__ 1
+// X86_64-LINUX:#define __UINTMAX_TYPE__ long unsigned int
+// X86_64-LINUX:#define __USER_LABEL_PREFIX__
+// X86_64-LINUX:#define __WCHAR_MAX__ 2147483647
+// X86_64-LINUX:#define __WCHAR_TYPE__ int
+// X86_64-LINUX:#define __WCHAR_WIDTH__ 32
+// X86_64-LINUX:#define __WINT_TYPE__ unsigned int
+// X86_64-LINUX:#define __WINT_WIDTH__ 32
+// X86_64-LINUX:#define __amd64 1
+// X86_64-LINUX:#define __amd64__ 1
+// X86_64-LINUX:#define __nocona 1
+// X86_64-LINUX:#define __nocona__ 1
+// X86_64-LINUX:#define __tune_nocona__ 1
+// X86_64-LINUX:#define __x86_64 1
+// X86_64-LINUX:#define __x86_64__ 1
+//
// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
// GNUSOURCE:#define _GNU_SOURCE 1
//
diff --git a/test/Preprocessor/objc-pp.m b/test/Preprocessor/objc-pp.m
index 3e093252c644..0ec288c830a0 100644
--- a/test/Preprocessor/objc-pp.m
+++ b/test/Preprocessor/objc-pp.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic -ffreestanding
#import <stdint.h> // no warning on #import in objc mode.
diff --git a/test/Preprocessor/pragma-pushpop-macro.c b/test/Preprocessor/pragma-pushpop-macro.c
index 87cceaa4193a..71b0e0e2600b 100644
--- a/test/Preprocessor/pragma-pushpop-macro.c
+++ b/test/Preprocessor/pragma-pushpop-macro.c
@@ -25,9 +25,17 @@ int pmx3 = X;
#pragma pop_macro("Y")
int pmy1 = Y;
+// Have a stray 'push' to show we don't crash when having inbalanced
+// push/pop
+#pragma push_macro("Y")
+#define Y 4
+int pmy2 = Y;
+
// CHECK: int pmx0 = 1
// CHECK: int pmy0 = 2
// CHECK: int pmx1 = 1
// CHECK: int pmx2 = 2
// CHECK: int pmx3 = 1
// CHECK: int pmy1 = 3
+// CHECK: int pmy2 = 4
+
diff --git a/test/Preprocessor/pragma_diagnostic_sections.cpp b/test/Preprocessor/pragma_diagnostic_sections.cpp
new file mode 100644
index 000000000000..69436b0bd84e
--- /dev/null
+++ b/test/Preprocessor/pragma_diagnostic_sections.cpp
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -fsyntax-only -Wall -Wunused-macros -Wunused-parameter -Wno-uninitialized -verify %s
+
+// rdar://8365684
+struct S {
+ void m1() { int b = b==b; } // expected-warning {{always evaluates to true}}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-compare"
+ void m2() { int b = b==b; }
+#pragma clang diagnostic pop
+
+ void m3() { int b = b==b; } // expected-warning {{always evaluates to true}}
+};
+
+//------------------------------------------------------------------------------
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-compare"
+template <typename T>
+struct TS {
+ void m() { T b = b==b; }
+};
+#pragma clang diagnostic pop
+
+void f() {
+ TS<int> ts;
+ ts.m();
+}
+
+//------------------------------------------------------------------------------
+
+#define UNUSED_MACRO1 // expected-warning {{macro is not used}}
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-macros"
+#define UNUSED_MACRO2
+#pragma clang diagnostic pop
+
+//------------------------------------------------------------------------------
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreturn-type"
+int g() { }
+#pragma clang diagnostic pop
+
+//------------------------------------------------------------------------------
+
+void ww(
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+ int x,
+#pragma clang diagnostic pop
+ int y) // expected-warning {{unused}}
+{
+}
+
+//------------------------------------------------------------------------------
+
+struct S2 {
+ int x, y;
+ S2() :
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreorder"
+ y(),
+ x()
+#pragma clang diagnostic pop
+ {}
+};
+
+//------------------------------------------------------------------------------
+
+// rdar://8790245
+#define MYMACRO \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
+ _Pragma("clang diagnostic pop")
+MYMACRO
+#undef MYMACRO
+
+//------------------------------------------------------------------------------
diff --git a/test/Preprocessor/pragma_unknown.c b/test/Preprocessor/pragma_unknown.c
index c1851534cc33..0672ade66059 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 STDC pragma}}
+#pragma STDC CX_LIMITED_RANGE ON FULL POWER // expected-warning {{expected end of macro 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/predefined-macros.c b/test/Preprocessor/predefined-macros.c
new file mode 100644
index 000000000000..85a0cb80415c
--- /dev/null
+++ b/test/Preprocessor/predefined-macros.c
@@ -0,0 +1,12 @@
+// This test verifies that the correct macros are predefined. It currently
+// only checks for Microsoft macros.
+
+// RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-extensions -fmsc-version=1300 -o - | FileCheck %s
+
+
+// CHECK: #define _INTEGRAL_MAX_BITS 64
+// CHECK: #define _MSC_EXTENSIONS 1
+// CHECK: #define _MSC_VER 1300
+// CHECK: #define _M_IX86 600
+// CHECK: #define _M_IX86_FP
+// CHECK: #define _WIN32 1
diff --git a/test/Preprocessor/print_line_empty_file.c b/test/Preprocessor/print_line_empty_file.c
new file mode 100644
index 000000000000..868d0b7a8b8e
--- /dev/null
+++ b/test/Preprocessor/print_line_empty_file.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -E %s | FileCheck %s
+
+#line 21 ""
+int foo() { return 42; }
+
+#line 4 "bug.c"
+int bar() { return 21; }
+
+// CHECK: # 21 ""
+// CHECK: int foo() { return 42; }
+// CHECK: # 4 "bug.c"
+// CHECK: int bar() { return 21; }
diff --git a/test/Preprocessor/pushable-diagnostics.c b/test/Preprocessor/pushable-diagnostics.c
index 567a866fa339..877eaaa0b366 100644
--- a/test/Preprocessor/pushable-diagnostics.c
+++ b/test/Preprocessor/pushable-diagnostics.c
@@ -4,14 +4,14 @@
#pragma clang diagnostic puhs // expected-warning {{pragma diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'}}
-char a = 'df'; // expected-warning{{multi-character character constant}}
+int a = 'df'; // expected-warning{{multi-character character constant}}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmultichar"
-char b = 'df'; // no warning.
+int b = 'df'; // no warning.
#pragma clang diagnostic pop
-char c = 'df'; // expected-warning{{multi-character character constant}}
+int c = 'df'; // expected-warning{{multi-character character constant}}
#pragma clang diagnostic pop // expected-warning{{pragma diagnostic pop could not pop, no matching push}}
diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c
index f8bb921a68cb..b3ae8438033c 100644
--- a/test/Preprocessor/stdint.c
+++ b/test/Preprocessor/stdint.c
@@ -421,106 +421,6 @@
// MSP430:INTMAX_C_(0) 0L
// MSP430:UINTMAX_C_(0) 0UL
//
-// RUN: %clang_cc1 -E -ffreestanding -triple=pic16-none-none %s | FileCheck -check-prefix PIC16 %s
-//
-// PIC16:typedef signed long int int32_t;
-// PIC16:typedef unsigned long int uint32_t;
-// PIC16:typedef int32_t int_least32_t;
-// PIC16:typedef uint32_t uint_least32_t;
-// PIC16:typedef int32_t int_fast32_t;
-// PIC16:typedef uint32_t uint_fast32_t;
-//
-// PIC16:typedef signed short int16_t;
-// PIC16:typedef unsigned short uint16_t;
-// PIC16:typedef int16_t int_least16_t;
-// PIC16:typedef uint16_t uint_least16_t;
-// PIC16:typedef int16_t int_fast16_t;
-// PIC16:typedef uint16_t uint_fast16_t;
-//
-// PIC16:typedef signed char int8_t;
-// PIC16:typedef unsigned char uint8_t;
-// PIC16:typedef int8_t int_least8_t;
-// PIC16:typedef uint8_t uint_least8_t;
-// PIC16:typedef int8_t int_fast8_t;
-// PIC16:typedef uint8_t uint_fast8_t;
-//
-// PIC16:typedef int16_t intptr_t;
-// PIC16:typedef uint16_t uintptr_t;
-//
-// PIC16:typedef long int intmax_t;
-// PIC16:typedef long unsigned int uintmax_t;
-//
-// PIC16:INT8_MAX_ 127
-// PIC16:INT8_MIN_ (-127 -1)
-// PIC16:UINT8_MAX_ 255
-// PIC16:INT_LEAST8_MIN_ (-127 -1)
-// PIC16:INT_LEAST8_MAX_ 127
-// PIC16:UINT_LEAST8_MAX_ 255
-// PIC16:INT_FAST8_MIN_ (-127 -1)
-// PIC16:INT_FAST8_MAX_ 127
-// PIC16:UINT_FAST8_MAX_ 255
-//
-// PIC16:INT16_MAX_ 32767
-// PIC16:INT16_MIN_ (-32767 -1)
-// PIC16:UINT16_MAX_ 65535
-// PIC16:INT_LEAST16_MIN_ (-32767 -1)
-// PIC16:INT_LEAST16_MAX_ 32767
-// PIC16:UINT_LEAST16_MAX_ 65535
-// PIC16:INT_FAST16_MIN_ (-32767 -1)
-// PIC16:INT_FAST16_MAX_ 32767
-// PIC16:UINT_FAST16_MAX_ 65535
-//
-// PIC16:INT32_MAX_ 2147483647L
-// PIC16:INT32_MIN_ (-2147483647L -1)
-// PIC16:UINT32_MAX_ 4294967295UL
-// PIC16:INT_LEAST32_MIN_ (-2147483647L -1)
-// PIC16:INT_LEAST32_MAX_ 2147483647L
-// PIC16:UINT_LEAST32_MAX_ 4294967295UL
-// PIC16:INT_FAST32_MIN_ (-2147483647L -1)
-// PIC16:INT_FAST32_MAX_ 2147483647L
-// PIC16:UINT_FAST32_MAX_ 4294967295UL
-//
-// PIC16:INT64_MAX_ INT64_MAX
-// PIC16:INT64_MIN_ INT64_MIN
-// PIC16:UINT64_MAX_ UINT64_MAX
-// PIC16:INT_LEAST64_MIN_ INT_LEAST64_MIN
-// PIC16:INT_LEAST64_MAX_ INT_LEAST64_MAX
-// PIC16:UINT_LEAST64_MAX_ UINT_LEAST64_MAX
-// PIC16:INT_FAST64_MIN_ INT_FAST64_MIN
-// PIC16:INT_FAST64_MAX_ INT_FAST64_MAX
-// PIC16:UINT_FAST64_MAX_ UINT_FAST64_MAX
-//
-// PIC16:INTPTR_MIN_ (-32767 -1)
-// PIC16:INTPTR_MAX_ 32767
-// PIC16:UINTPTR_MAX_ 65535
-// PIC16:PTRDIFF_MIN_ (-32767 -1)
-// PIC16:PTRDIFF_MAX_ 32767
-// PIC16:SIZE_MAX_ 65535
-//
-// PIC16:INTMAX_MIN_ (-2147483647L -1)
-// PIC16:INTMAX_MAX_ 2147483647L
-// PIC16:UINTMAX_MAX_ 4294967295UL
-//
-// PIC16:SIG_ATOMIC_MIN_ (-2147483647L -1)
-// PIC16:SIG_ATOMIC_MAX_ 2147483647L
-// PIC16:WINT_MIN_ (-32767 -1)
-// PIC16:WINT_MAX_ 32767
-//
-// PIC16:WCHAR_MAX_ 32767
-// PIC16:WCHAR_MIN_ (-32767 -1)
-//
-// PIC16:INT8_C_(0) 0
-// PIC16:UINT8_C_(0) 0U
-// PIC16:INT16_C_(0) 0
-// PIC16:UINT16_C_(0) 0U
-// PIC16:INT32_C_(0) 0L
-// PIC16:UINT32_C_(0) 0UL
-// PIC16:INT64_C_(0) INT64_C(0)
-// PIC16:UINT64_C_(0) UINT64_C(0)
-//
-// PIC16:INTMAX_C_(0) 0L
-// PIC16:UINTMAX_C_(0) 0UL
-//
// RUN: %clang_cc1 -E -ffreestanding -triple=powerpc64-none-none %s | FileCheck -check-prefix PPC64 %s
//
// PPC64:typedef signed long int int64_t;
diff --git a/test/Preprocessor/warn-macro-unused.c b/test/Preprocessor/warn-macro-unused.c
new file mode 100644
index 000000000000..8a6d7c25ca5f
--- /dev/null
+++ b/test/Preprocessor/warn-macro-unused.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -Wunused-macros -Dfoo -Dfoo -verify
+
+#define unused // expected-warning {{macro is not used}}
+#define unused
+unused
diff --git a/test/Rewriter/blockstruct.m b/test/Rewriter/blockstruct.m
new file mode 100644
index 000000000000..977e0d6ce5a0
--- /dev/null
+++ b/test/Rewriter/blockstruct.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar://8918702
+
+typedef void (^b_t)(void);
+void a(b_t work) { }
+struct _s {
+ int a;
+};
+struct _s *r();
+
+void f() {
+ __block struct _s *s = 0;
+ a(^{
+ s = (struct _s *)r();
+ });
+}
diff --git a/test/Rewriter/dllimport-typedef.c b/test/Rewriter/dllimport-typedef.c
index 441f49866817..72cea70cf2d6 100644
--- a/test/Rewriter/dllimport-typedef.c
+++ b/test/Rewriter/dllimport-typedef.c
@@ -11,7 +11,7 @@ void bar() { return 1; }
// CHECK-NEG: error: void function 'bar' should not return a value
// CHECK-NEG: 1 error generated
-// CHECK-POS: warning: 'dllimport' attribute only applies to variable and function type
+// CHECK-POS: warning: 'dllimport' attribute only applies to variables and functions
// CHECK-POS: error: void function 'bar' should not return a value
// CHECK-POS: 1 warning and 1 error generated
diff --git a/test/Rewriter/finally.m b/test/Rewriter/finally.m
index 67774b5d9cda..7d160cfbdd2b 100644
--- a/test/Rewriter/finally.m
+++ b/test/Rewriter/finally.m
@@ -2,7 +2,7 @@
int main() {
@try {
- printf("executing try"); // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \
+ printf("executing try"); // 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'}}
return(0); // expected-warning{{rewriter doesn't support user-specified control flow semantics for @try/@finally (code may not execute properly)}}
} @finally {
diff --git a/test/Rewriter/properties.m b/test/Rewriter/properties.m
index 44c55b1b69c4..ca4a199cc64f 100644
--- a/test/Rewriter/properties.m
+++ b/test/Rewriter/properties.m
@@ -1,4 +1,7 @@
-// RUN: %clang_cc1 -rewrite-objc %s -o -
+// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+
+void *sel_registerName(const char *);
@interface Foo {
int i;
@@ -35,7 +38,7 @@
@implementation Bar
-static int func(int i);
+static int func(int i) { return 0; }
- (void)baz {
Foo *obj1, *obj2;
diff --git a/test/Rewriter/property-dot-syntax.mm b/test/Rewriter/property-dot-syntax.mm
new file mode 100644
index 000000000000..846bd824b537
--- /dev/null
+++ b/test/Rewriter/property-dot-syntax.mm
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar:// 8520727
+
+void *sel_registerName(const char *);
+
+@class NSString;
+
+@protocol CoreDAVAccountInfoProvider
+- (NSString *)userAgentHeader;
+@end
+
+@interface CoreDAVTask
+{
+ id<CoreDAVAccountInfoProvider> _accountInfoProvider;
+}
+- (void)METHOD;
+@end
+
+@implementation CoreDAVTask
+- (void)METHOD {
+ if ([_accountInfoProvider userAgentHeader]) {
+ }
+ if (_accountInfoProvider.userAgentHeader) {
+ }
+}
+@end
+
+//rdar: // 8541517
+@interface A { }
+@property (retain) NSString *scheme;
+@end
+
+@interface B : A {
+ NSString* _schemeName;
+}
+@end
+
+
+@implementation B
+-(void) test {
+ B *b;
+ b.scheme = _schemeName; // error because of this line
+}
+@end
+
diff --git a/test/Rewriter/rewrite-block-pointer.mm b/test/Rewriter/rewrite-block-pointer.mm
index 212b2365dfcc..abb2f136183c 100644
--- a/test/Rewriter/rewrite-block-pointer.mm
+++ b/test/Rewriter/rewrite-block-pointer.mm
@@ -58,3 +58,33 @@ typedef void (^void_block_t)(void);
@end
+// rdar: //8608902
+@protocol CoreDAVAccountInfoProvider;
+@protocol CodeProvider;
+typedef void (^BDVDiscoveryCompletionHandler)(int success, id<CoreDAVAccountInfoProvider> discoveredInfo);
+typedef void (^BDVDiscoveryCompletion)(id<CodeProvider> codeInfo, int success, id<CoreDAVAccountInfoProvider> discoveredInfo);
+typedef void (^BDVDiscovery)(int success);
+typedef void (^BDVDisc)(id<CoreDAVAccountInfoProvider> discoveredInfo, id<CodeProvider> codeInfo,
+ int success, id<CoreDAVAccountInfoProvider, CodeProvider> Info);
+typedef void (^BLOCK)(id, id<CoreDAVAccountInfoProvider>, id<CodeProvider> codeInfo);
+typedef void (^EMPTY_BLOCK)();
+typedef void (^ BDVDiscoveryCompletion1 )(id<CodeProvider> codeInfo, int success, id<CoreDAVAccountInfoProvider> discoveredInfo);
+
+void (^BL)(void(^arg1)(), int i1, void(^arg)(int));
+
+typedef void (^iscoveryCompletionHandler)(void(^arg1)(), id<CoreDAVAccountInfoProvider> discoveredInfo);
+
+typedef void (^DVDisc)(id<CoreDAVAccountInfoProvider> discoveredInfo, id<CodeProvider> codeInfo,
+ void(^arg1)(), int i1, void(^arg)(id<CoreDAVAccountInfoProvider>),
+ int success, id<CoreDAVAccountInfoProvider, CodeProvider> Info);
+
+
+@interface I @end
+@interface INTF @end
+void (^BLINT)(I<CoreDAVAccountInfoProvider>* ARG, INTF<CodeProvider, CoreDAVAccountInfoProvider>* ARG1);
+
+void test8608902() {
+ BDVDiscoveryCompletionHandler ppp;
+ ppp(1, 0);
+}
+
diff --git a/test/Rewriter/rewrite-captured-nested-bvar.c b/test/Rewriter/rewrite-captured-nested-bvar.c
new file mode 100644
index 000000000000..a48de4bbeae3
--- /dev/null
+++ b/test/Rewriter/rewrite-captured-nested-bvar.c
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -x c -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: FileCheck --input-file=%t-rw.cpp %s
+// rdar://9006279
+
+void q(void (^p)(void)) {
+ p();
+}
+
+void f() {
+ __block char BYREF_VAR_CHECK = 'a';
+ __block char d = 'd';
+ q(^{
+ q(^{
+ __block char e = 'e';
+ char l = 'l';
+ BYREF_VAR_CHECK = 'b';
+ d = 'd';
+ q(^{
+ e = '1';
+ BYREF_VAR_CHECK = '2';
+ d = '3';
+ }
+ );
+ });
+ });
+}
+
+int main() {
+ f();
+ return 0;
+}
+
+// CHECK 2: (__Block_byref_BYREF_VAR_CHECK_0 *)BYREF_VAR_CHECK
+// CHECK: (__Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK
+// CHECK: (struct __Block_byref_BYREF_VAR_CHECK_0 *)&BYREF_VAR_CHECK, (struct __Block_byref_d_1 *)&d, 570425344));
diff --git a/test/Rewriter/rewrite-nested-blocks-2.mm b/test/Rewriter/rewrite-nested-blocks-2.mm
new file mode 100644
index 000000000000..5a8e1ccdcf95
--- /dev/null
+++ b/test/Rewriter/rewrite-nested-blocks-2.mm
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// grep "static void __FUNC_block_copy_" %t-rw.cpp | count 2
+// rdar://8499592
+
+void Outer(void (^bk)());
+void Inner(void (^bk)());
+void INNER_FUNC(id d);
+
+void FUNC() {
+
+ id bar = (id)42;
+ Outer(^{
+ Inner(^{
+ INNER_FUNC(bar);
+ });
+ });
+}
diff --git a/test/Rewriter/rewrite-nested-property-in-blocks.mm b/test/Rewriter/rewrite-nested-property-in-blocks.mm
new file mode 100755
index 000000000000..2dffe66ab326
--- /dev/null
+++ b/test/Rewriter/rewrite-nested-property-in-blocks.mm
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// radar 8608293
+
+void *sel_registerName(const char *);
+
+extern "C" void nowarn(id);
+
+extern "C" void noblockwarn(void (^)());
+
+@interface INTFOFPROP
+@property (readwrite, retain) INTFOFPROP *outer;
+@property (readwrite, retain) id inner;
+@end
+
+@interface NSSet
+- (NSSet *)objectsPassingTest:(char (^)(id obj, char *stop))predicate ;
+@end
+
+@interface INTF
+- (NSSet *)Meth;
+@end
+
+@implementation INTF
+
+- (NSSet *)Meth
+{
+ NSSet *aces;
+
+ noblockwarn(^() {
+ INTFOFPROP *ace;
+ nowarn(ace.outer.inner);
+ noblockwarn(^() {
+ INTFOFPROP *ace;
+ nowarn(ace.outer.inner);
+ });
+ });
+
+ noblockwarn(^() {
+ INTFOFPROP *ace;
+ nowarn(ace.outer.inner);
+ });
+
+return [aces objectsPassingTest:^(id obj, char *stop)
+ {
+ INTFOFPROP *ace = (INTFOFPROP *)obj;
+ nowarn(ace.outer.inner);
+ return (char)0;
+ }];
+
+}
+@end
diff --git a/test/Rewriter/rewrite-property-set-cfstring.mm b/test/Rewriter/rewrite-property-set-cfstring.mm
new file mode 100644
index 000000000000..5e670bf751d3
--- /dev/null
+++ b/test/Rewriter/rewrite-property-set-cfstring.mm
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar:// 8527018
+
+void *sel_registerName(const char *);
+
+@class NSString;
+@interface CoreDAVDiscoveryAccountInfo {
+ NSString *_scheme;
+}
+@property (retain) NSString *scheme;
+- (void) Meth ;
+@end
+
+@implementation CoreDAVDiscoveryAccountInfo
+@synthesize scheme=_scheme;
+- (void) Meth {
+ CoreDAVDiscoveryAccountInfo *discoveryInfo;
+ discoveryInfo.scheme = @"https";
+}
+@end
diff --git a/test/Rewriter/rewrite-protocol-property.mm b/test/Rewriter/rewrite-protocol-property.mm
new file mode 100644
index 000000000000..b70b54fc5381
--- /dev/null
+++ b/test/Rewriter/rewrite-protocol-property.mm
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -Did="void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar:// 8558702
+
+@class NSString;
+@interface NSObject @end
+
+@protocol P
+@property (retain) NSString* test;
+@end
+
+
+@interface A : NSObject <P> {
+ NSString* _test;
+}
+@end
+
+
+@implementation A
+@synthesize test=_test;
+@end
+
diff --git a/test/Rewriter/rewrite-protocol-qualified.mm b/test/Rewriter/rewrite-protocol-qualified.mm
index 5f12010afd4e..fae11a0adfa3 100644
--- a/test/Rewriter/rewrite-protocol-qualified.mm
+++ b/test/Rewriter/rewrite-protocol-qualified.mm
@@ -30,3 +30,21 @@ void f() {
id a;
id b = bar((id <Proto>)a);
}
+
+// rdar://8472487
+@protocol NSObject @end
+@class NSRunLoop;
+
+@protocol CoreDAVTaskManager <NSObject>
+ @property (retain) NSRunLoop *workRunLoop;
+@end
+
+
+// rdar://8475819
+@protocol some_protocol;
+
+void foo (int n)
+{
+ id<some_protocol> array[n];
+}
+
diff --git a/test/Rewriter/rewrite-user-defined-accessors.mm b/test/Rewriter/rewrite-user-defined-accessors.mm
new file mode 100644
index 000000000000..366e53b832f2
--- /dev/null
+++ b/test/Rewriter/rewrite-user-defined-accessors.mm
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -Did="void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar:// 8570020
+
+@interface Foo {
+ Foo *foo;
+}
+
+@property (retain, nonatomic) Foo *foo;
+
+@end
+
+@implementation Foo
+
+- (Foo *)foo {
+ if (!foo) {
+ foo = 0;
+ }
+ return foo;
+}
+
+
+- (void) setFoo : (Foo *) arg {
+ foo = arg;
+}
+
+@synthesize foo;
+
+@end
+
diff --git a/test/Sema/Inputs/conversion.h b/test/Sema/Inputs/conversion.h
index 9f6ed2e70fb2..768190f8d260 100644
--- a/test/Sema/Inputs/conversion.h
+++ b/test/Sema/Inputs/conversion.h
@@ -1,3 +1,4 @@
/* Fake system header for Sema/conversion.c */
#define LONG_MAX __LONG_MAX__
+#define SETBIT(set,bit) do { int i = bit; set[i/(8*sizeof(set[0]))] |= (1 << (i%(8*sizeof(set)))); } while(0)
diff --git a/test/Sema/MicrosoftExtensions.c b/test/Sema/MicrosoftExtensions.c
new file mode 100644
index 000000000000..0ef72855684d
--- /dev/null
+++ b/test/Sema/MicrosoftExtensions.c
@@ -0,0 +1,69 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
+
+
+struct A
+{
+ int a[]; /* expected-warning {{flexible array member 'a' in otherwise empty struct is a Microsoft extension}} */
+};
+
+struct C {
+ int l;
+ union {
+ int c1[]; /* expected-warning {{flexible array member 'c1' in a union is a Microsoft extension}} */
+ char c2[]; /* expected-warning {{flexible array member 'c2' in a union is a Microsoft extension}} */
+ };
+};
+
+
+struct D {
+ int l;
+ int D[];
+};
+
+
+enum ENUM1; // expected-warning {{forward references to 'enum' types are a Microsoft extension}}
+enum ENUM1 var1 = 3;
+enum ENUM1* var2 = 0;
+
+
+enum ENUM2 {
+ ENUM2_a = (enum ENUM2) 4,
+ ENUM2_b = 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
+ ENUM2_c = 0x100000000 // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
+};
+
+
+
+
+typedef struct notnested {
+ long bad1;
+ long bad2;
+} NOTNESTED;
+
+
+typedef struct nested1 {
+ long a;
+ struct notnested var1;
+ NOTNESTED var2;
+} NESTED1;
+
+struct nested2 {
+ long b;
+ NESTED1; // expected-warning {{anonymous structs are a Microsoft extension}}
+};
+
+struct test {
+ int c;
+ struct nested2; // expected-warning {{anonymous structs are a Microsoft extension}}
+};
+
+void foo()
+{
+ struct test var;
+ var.a;
+ var.b;
+ var.c;
+ var.bad1; // expected-error {{no member named 'bad1' in 'struct test'}}
+ var.bad2; // expected-error {{no member named 'bad2' in 'struct test'}}
+}
+
diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c
index 23c1405011a3..a53bb4da0003 100644
--- a/test/Sema/address_spaces.c
+++ b/test/Sema/address_spaces.c
@@ -36,7 +36,11 @@ struct _st {
// rdar://6774906
__attribute__((address_space(256))) void * * const base = 0;
void * get_0(void) {
- return base[0]; // expected-error {{illegal implicit conversion between two pointers with different address spaces}} \
- expected-warning {{returning 'void __attribute__((address_space(256))) *' from a function with result type 'void *' discards qualifiers}}
+ return base[0]; // expected-error {{returning '__attribute__((address_space(256))) void *' from a function with result type 'void *' changes address space of pointer}}
}
+__attribute__((address_space(1))) char test3_array[10];
+void test3(void) {
+ extern void test3_helper(char *p); // expected-note {{passing argument to parameter 'p' here}}
+ test3_helper(test3_array); // expected-error {{changes address space of pointer}}
+}
diff --git a/test/Sema/altivec-init.c b/test/Sema/altivec-init.c
index b5758bc71837..ef6fe4bd9d2f 100644
--- a/test/Sema/altivec-init.c
+++ b/test/Sema/altivec-init.c
@@ -30,6 +30,6 @@ void test()
f(vAltiVec);
vGCC = vAltiVec;
- vGCC = vGCC > vAltiVec;
+ int res = vGCC > vAltiVec;
vAltiVec = 0 ? vGCC : vGCC;
}
diff --git a/test/Sema/arm-neon-types.c b/test/Sema/arm-neon-types.c
new file mode 100644
index 000000000000..152d4c9b9a78
--- /dev/null
+++ b/test/Sema/arm-neon-types.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding -verify %s
+
+#include <arm_neon.h>
+
+// Radar 8228022: Should not report incompatible vector types.
+int32x2_t test(int32x2_t x) {
+ return vshr_n_s32(x, 31);
+}
+
+// ...but should warn when the types really do not match.
+float32x2_t test2(uint32x2_t x) {
+ return vcvt_n_f32_s32(x, 0); // expected-warning {{incompatible vector types}}
+}
diff --git a/test/Sema/array-constraint.c b/test/Sema/array-constraint.c
index 9fcac25abe96..bee33c09efbd 100644
--- a/test/Sema/array-constraint.c
+++ b/test/Sema/array-constraint.c
@@ -36,7 +36,7 @@ pfunc xx(int f[](void)) { // expected-error {{'f' declared as array of functions
void check_size() {
float f;
int size_not_int[f]; // expected-error {{size of array has non-integer type 'float'}}
- int negative_size[1-2]; // expected-error{{array size is negative}}
+ int negative_size[1-2]; // expected-error{{array with a negative size}}
int zero_size[0]; // expected-warning{{zero size arrays are an extension}}
}
@@ -46,7 +46,7 @@ typedef int TA[I]; // expected-error {{variable length array declaration not all
void strFunc(char *); // expected-note{{passing argument to parameter here}}
const char staticAry[] = "test";
void checkStaticAry() {
- strFunc(staticAry); // expected-warning{{passing 'char const [5]' to parameter of type 'char *' discards qualifiers}}
+ strFunc(staticAry); // expected-warning{{passing 'const char [5]' to parameter of type 'char *' discards qualifiers}}
}
diff --git a/test/Sema/asm.c b/test/Sema/asm.c
index 6f2272da9e77..7f0f396b9d82 100644
--- a/test/Sema/asm.c
+++ b/test/Sema/asm.c
@@ -36,7 +36,7 @@ void test3() {
// <rdar://problem/6156893>
void test4(const volatile void *addr)
{
- asm ("nop" : : "r"(*addr)); // expected-error {{invalid type 'void const volatile' in asm input for constraint 'r'}}
+ asm ("nop" : : "r"(*addr)); // expected-error {{invalid type 'const volatile void' in asm input for constraint 'r'}}
asm ("nop" : : "m"(*addr));
asm ("nop" : : "r"(test4(addr))); // expected-error {{invalid type 'void' in asm input for constraint 'r'}}
@@ -79,3 +79,29 @@ int test7(unsigned long long b) {
// <rdar://problem/7574870>
asm volatile (""); // expected-warning {{meaningless 'volatile' on asm outside function}}
+
+// PR3904
+void test8(int i) {
+ // A number in an input constraint can't point to a read-write constraint.
+ asm("" : "+r" (i), "=r"(i) : "0" (i)); // expected-error{{invalid input constraint '0' in asm}}
+}
+
+// PR3905
+void test9(int i) {
+ asm("" : [foo] "=r" (i), "=r"(i) : "1[foo]"(i)); // expected-error{{invalid input constraint '1[foo]' in asm}}
+ asm("" : [foo] "=r" (i), "=r"(i) : "[foo]1"(i)); // expected-error{{invalid input constraint '[foo]1' in asm}}
+}
+
+register int g asm("dx"); // expected-error{{global register variables are not supported}}
+
+void test10(void){
+ static int g asm ("g_asm") = 0;
+ extern int gg asm ("gg_asm");
+ __private_extern__ int ggg asm ("ggg_asm");
+
+ int a asm ("a_asm"); // expected-warning{{ignored asm label 'a_asm' on automatic variable}}
+ auto int aa asm ("aa_asm"); // expected-warning{{ignored asm label 'aa_asm' on automatic variable}}
+
+ register int r asm ("cx");
+ register int rr asm ("rr_asm"); // expected-error{{unknown register name 'rr_asm' in asm}}
+}
diff --git a/test/Sema/attr-alias.c b/test/Sema/attr-alias.c
new file mode 100644
index 000000000000..151052f89e51
--- /dev/null
+++ b/test/Sema/attr-alias.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify %s
+
+void g() {}
+
+// It is important that the following string be in the error message. The gcc
+// testsuite looks for it to decide if a target supports aliases.
+
+void f() __attribute__((alias("g"))); //expected-error {{only weak aliases are supported}}
diff --git a/test/Sema/attr-aligned.c b/test/Sema/attr-aligned.c
index bcb12ee40de7..c094ff172dd5 100644
--- a/test/Sema/attr-aligned.c
+++ b/test/Sema/attr-aligned.c
@@ -13,9 +13,26 @@ struct struct_with_ueber_char {
ueber_aligned_char c;
};
-char c = 0;
+char a = 0;
char a0[__alignof__(ueber_aligned_char) == 8? 1 : -1] = { 0 };
char a1[__alignof__(struct struct_with_ueber_char) == 8? 1 : -1] = { 0 };
-char a2[__alignof__(c) == 1? : -1] = { 0 };
-char a3[sizeof(c) == 1? : -1] = { 0 };
+char a2[__alignof__(a) == 1? : -1] = { 0 };
+char a3[sizeof(a) == 1? : -1] = { 0 };
+
+// rdar://problem/8335865
+int b __attribute__((aligned(2)));
+char b1[__alignof__(b) == 2 ?: -1] = {0};
+
+struct C { int member __attribute__((aligned(2))); } c;
+char c1[__alignof__(c) == 4 ?: -1] = {0};
+char c2[__alignof__(c.member) == 4 ?: -1] = {0};
+
+struct D { int member __attribute__((aligned(2))) __attribute__((packed)); } d;
+char d1[__alignof__(d) == 2 ?: -1] = {0};
+char d2[__alignof__(d.member) == 2 ?: -1] = {0};
+
+struct E { int member __attribute__((aligned(2))); } __attribute__((packed));
+struct E e;
+char e1[__alignof__(e) == 2 ?: -1] = {0};
+char e2[__alignof__(e.member) == 2 ?: -1] = {0};
diff --git a/test/Sema/attr-deprecated-message.c b/test/Sema/attr-deprecated-message.c
new file mode 100644
index 000000000000..5de31d0d13f8
--- /dev/null
+++ b/test/Sema/attr-deprecated-message.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+// rdar: // 6734520
+
+typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
+
+typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));
+
+typedef INT1 INT1a; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
+
+typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));
+
+INT1 should_be_unavailable; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
+INT1a should_not_be_deprecated;
+
+INT1 f1(void) __attribute__ ((deprecated("Please avoid f1")));
+INT1 f2(void); // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
+
+typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));
+
+
+Color c1; // expected-warning {{'Color' is deprecated: Please avoid Color}}
+
+int g1;
+int g2 __attribute__ ((deprecated("Please avoid g2")));
+
+int func1()
+{
+ int (*pf)() = f1; // expected-warning {{'f1' is deprecated: Please avoid f1}}
+ int i = f2();
+ return g1 + g2; // expected-warning {{'g2' is deprecated: Please avoid g2}}
+}
diff --git a/test/Sema/attr-deprecated.c b/test/Sema/attr-deprecated.c
index e7c997f3ee23..b26171b86b0a 100644
--- a/test/Sema/attr-deprecated.c
+++ b/test/Sema/attr-deprecated.c
@@ -98,3 +98,16 @@ unsigned long test16 __attribute__((deprecated))
foo_dep test17, // expected-warning {{'foo_dep' is deprecated}}
test18 __attribute__((deprecated)),
test19;
+
+// rdar://problem/8518751
+enum __attribute__((deprecated)) Test20 {
+ test20_a __attribute__((deprecated)),
+ test20_b
+};
+void test20() {
+ enum Test20 f; // expected-warning {{'Test20' is deprecated}}
+ f = test20_a; // expected-warning {{'test20_a' is deprecated}}
+ f = test20_b;
+}
+
+char test21[__has_feature(attribute_deprecated_with_message) ? 1 : -1];
diff --git a/test/Sema/attr-malloc.c b/test/Sema/attr-malloc.c
index 9970b9de4f95..2cec84de4969 100644
--- a/test/Sema/attr-malloc.c
+++ b/test/Sema/attr-malloc.c
@@ -1,7 +1,10 @@
// RUN: %clang -Xclang -verify -fsyntax-only %s
// RUN: %clang -emit-llvm -S -o %t %s
-#include <stdlib.h>
+#include <stddef.h>
+
+// Declare malloc here explicitly so we don't depend on system headers.
+void * malloc(size_t) __attribute((malloc));
int no_vars __attribute((malloc)); // expected-warning {{functions returning a pointer type}}
diff --git a/test/Sema/attr-naked.c b/test/Sema/attr-naked.c
new file mode 100644
index 000000000000..65d1726da133
--- /dev/null
+++ b/test/Sema/attr-naked.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+int a __attribute__((naked)); // expected-warning {{'naked' attribute only applies to functions}}
+
+void t1() __attribute__((naked));
+
+void t2() __attribute__((naked(2))); // expected-error {{attribute requires 0 argument(s)}}
+
diff --git a/test/Sema/attr-nodebug.c b/test/Sema/attr-nodebug.c
index 203c2a7300ab..6865de060266 100644
--- a/test/Sema/attr-nodebug.c
+++ b/test/Sema/attr-nodebug.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int a __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to function types}}
+int a __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to functions}}
void t1() __attribute__((nodebug));
diff --git a/test/Sema/attr-noinline.c b/test/Sema/attr-noinline.c
index 92dc9007eb19..8c91b65b4f48 100644
--- a/test/Sema/attr-noinline.c
+++ b/test/Sema/attr-noinline.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
-int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only applies to function types}}
+int a __attribute__((noinline)); // expected-warning {{'noinline' attribute only applies to functions}}
void t1() __attribute__((noinline));
diff --git a/test/Sema/attr-unavailable-message.c b/test/Sema/attr-unavailable-message.c
new file mode 100644
index 000000000000..a1e047c8176b
--- /dev/null
+++ b/test/Sema/attr-unavailable-message.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: //6734520
+
+int foo(int) __attribute__((__unavailable__("USE IFOO INSTEAD"))); // expected-note {{function has been explicitly marked unavailable here}}
+double dfoo(double) __attribute__((__unavailable__("NO LONGER"))); // expected-note 2 {{function has been explicitly marked unavailable here}}
+
+void bar() __attribute__((__unavailable__)); // expected-note {{explicitly marked unavailable}}
+
+void test_foo() {
+ int ir = foo(1); // expected-error {{'foo' is unavailable: USE IFOO INSTEAD}}
+ double dr = dfoo(1.0); // expected-error {{'dfoo' is unavailable: NO LONGER}}
+
+ void (*fp)() = &bar; // expected-error {{'bar' is unavailable}}
+
+ double (*fp4)(double) = dfoo; // expected-error {{'dfoo' is unavailable: NO LONGER}}
+}
+
+char test2[__has_feature(attribute_unavailable_with_message) ? 1 : -1];
diff --git a/test/Sema/attr-unused.c b/test/Sema/attr-unused.c
index 28715141b995..6a7ea951a360 100644
--- a/test/Sema/attr-unused.c
+++ b/test/Sema/attr-unused.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -Wunused-variable -fsyntax-only %s
+// RUN: %clang_cc1 -verify -Wunused -Wused-but-marked-unused -Wunused-parameter -Wunused -fsyntax-only %s
static void (*fp0)(void) __attribute__((unused));
@@ -20,8 +20,24 @@ void test0() {
int x; // expected-warning {{unused variable}}
Int_not_unused i0; // expected-warning {{unused variable}}
- Int_unused i1;
+ Int_unused i1; // expected-warning {{'Int_unused' was marked unused but was used}}
struct Test0_not_unused s0; // expected-warning {{unused variable}}
- struct Test0_unused s1;
+ struct Test0_unused s1; // expected-warning {{'Test0_unused' was marked unused but was used}}
+}
+
+int f3(int x) { // expected-warning{{unused parameter 'x'}}
+ return 0;
+}
+
+int f4(int x) {
+ return x;
+}
+
+int f5(int x __attribute__((__unused__))) {
+ return 0;
+}
+
+int f6(int x __attribute__((__unused__))) {
+ return x; // expected-warning{{'x' was marked unused but was used}}
}
diff --git a/test/Sema/attr-used.c b/test/Sema/attr-used.c
index d50f4c09ac85..08388169247e 100644
--- a/test/Sema/attr-used.c
+++ b/test/Sema/attr-used.c
@@ -3,7 +3,7 @@
extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
-struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variable and function types}}
+struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
int x;
};
diff --git a/test/Sema/attr-weak.c b/test/Sema/attr-weak.c
index 8e3e626c5d34..41c9fd7165ab 100644
--- a/test/Sema/attr-weak.c
+++ b/test/Sema/attr-weak.c
@@ -8,8 +8,7 @@ int __attribute__((weak_import)) g4(void);
void __attribute__((weak_import)) g5(void) {
}
-struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variable and function types}}
-struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variable and function types}}
-
-static int x __attribute__((weak)); // expected-error {{weak declaration of 'x' must be public}}
+struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variables and functions}}
+struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variables and functions}}
+static int x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
diff --git a/test/Sema/bitfield-promote-int-16bit.c b/test/Sema/bitfield-promote-int-16bit.c
deleted file mode 100644
index cd9adcffc071..000000000000
--- a/test/Sema/bitfield-promote-int-16bit.c
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -triple pic16-unknown-unknown
-
-// Check that int-sized unsigned bit-fields promote to unsigned int
-// on targets where sizeof(unsigned short) == sizeof(unsigned int)
-
-enum E { ec1, ec2, ec3 };
-struct S {
- enum E e : 16;
- unsigned short us : 16;
- unsigned long ul1 : 8;
- unsigned long ul2 : 16;
-} s;
-
-__typeof(s.e + s.e) x_e;
-unsigned x_e;
-
-__typeof(s.us + s.us) x_us;
-unsigned x_us;
-
-__typeof(s.ul1 + s.ul1) x_ul1;
-signed x_ul1;
-
-__typeof(s.ul2 + s.ul2) x_ul2;
-unsigned x_ul2;
-
diff --git a/test/Sema/bitfield.c b/test/Sema/bitfield.c
index 5bb194b1f3a9..49c1c7d44361 100644
--- a/test/Sema/bitfield.c
+++ b/test/Sema/bitfield.c
@@ -34,3 +34,7 @@ struct {unsigned x : 2;} x2;
__typeof__((x.x+=1)+1) y;
__typeof__(x.x<<1) y;
int y;
+
+struct PR8025 {
+ double : 2; // expected-error{{anonymous bit-field has non-integral type 'double'}}
+};
diff --git a/test/Sema/block-args.c b/test/Sema/block-args.c
index 970c60d51ddb..e2e2d8e44622 100644
--- a/test/Sema/block-args.c
+++ b/test/Sema/block-args.c
@@ -34,3 +34,9 @@ void f0() {
^(int, double d, char) {}(1, 1.34, 'a'); // expected-error {{parameter name omitted}} \
// expected-error {{parameter name omitted}}
}
+
+// rdar://problem/8962770
+void test4() {
+ int (^f)() = ^((x)) { }; // expected-error {{expected ')'}} expected-warning {{type specifier missing}} expected-note {{to match this}}
+}
+
diff --git a/test/Sema/block-call.c b/test/Sema/block-call.c
index 27e4cfc6d46b..2aa1422dd915 100644
--- a/test/Sema/block-call.c
+++ b/test/Sema/block-call.c
@@ -13,7 +13,7 @@ int main() {
int (^IFP) () = PFR; // OK
- const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int const (^)()' with an expression of type 'int (^)()'}}
+ const int (^CIC) () = IFP; // OK - initializing 'const int (^)()' with an expression of type 'int (^)()'}}
const int (^CICC) () = CIC;
diff --git a/test/Sema/block-labels.c b/test/Sema/block-labels.c
index 353a5702eafa..d1b60cc7d31f 100644
--- a/test/Sema/block-labels.c
+++ b/test/Sema/block-labels.c
@@ -3,8 +3,12 @@
void xx();
int a() {
- A:if (1) xx();
- return ^{A:return 1;}();
+ A:
+
+ if (1) xx();
+ return ^{
+ A: return 1;
+ }();
}
int b() {
A: return ^{int a; A:return 1;}();
@@ -15,5 +19,9 @@ int d() {
}
int c() {
- goto A; return ^{ A:return 1;}(); // expected-error {{use of undeclared label 'A'}}
+ goto A; // expected-error {{use of undeclared label 'A'}}
+ return ^{
+ A:
+ return 1;
+ }();
}
diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c
index 5a4ec010d3a2..c6e1e9dc5422 100644
--- a/test/Sema/block-return.c
+++ b/test/Sema/block-return.c
@@ -78,10 +78,10 @@ static int funk(char *s) {
}
void next();
void foo4() {
- int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(char const *)' with an expression of type 'int (^)(char *)'}}
- int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (*)(char const *)' with an expression of type 'int (char *)'}}
+ int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(const char *)' with an expression of type 'int (^)(char *)'}}
+ int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (*)(const char *)' with an expression of type 'int (char *)'}}
- int (^nested)(char *s) = ^(char *str) { void (^nest)(void) = ^(void) { printf("%s\n", str); }; next(); return 1; }; // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \
+ int (^nested)(char *s) = ^(char *str) { void (^nest)(void) = ^(void) { printf("%s\n", str); }; next(); return 1; }; // expected-warning{{implicitly declaring C library function 'printf' with type 'int (const char *, ...)'}} \
// expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
}
@@ -97,7 +97,8 @@ bptr foo5(int j) {
}
int (*funcptr3[5])(long);
-int sz8 = sizeof(^int (*[5])(long) {return funcptr3;}); // expected-error {{block declared as returning an array}}
+int sz8 = sizeof(^int (*[5])(long) {return funcptr3;}); // expected-error {{block cannot return array type}} expected-warning {{incompatible pointer to integer conversion}}
+int sz9 = sizeof(^int(*())()[3]{ }); // expected-error {{function cannot return array type}}
void foo6() {
int (^b)(int) __attribute__((noreturn));
@@ -109,7 +110,7 @@ void foo6() {
void foo7()
{
- const int (^BB) (void) = ^{ const int i = 1; return i; }; // expected-error{{incompatible block pointer types initializing 'int const (^)(void)' with an expression of type 'int (^)(void)'}}
+ const int (^BB) (void) = ^{ const int i = 1; return i; }; // OK - initializing 'const int (^)(void)' with an expression of type 'int (^)(void)'
const int (^CC) (void) = ^const int{ const int i = 1; return i; };
diff --git a/test/Sema/builtin_objc_msgSend.c b/test/Sema/builtin_objc_msgSend.c
new file mode 100644
index 000000000000..357a5bc26eb5
--- /dev/null
+++ b/test/Sema/builtin_objc_msgSend.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar://8632525
+
+typedef struct objc_class *Class;
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+
+typedef struct objc_selector *SEL;
+extern id objc_msgSend(id self, SEL op, ...);
+
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index 787630c1a8c4..4072faa94b9f 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -26,7 +26,7 @@ int test6(float a, long double b) {
#define CFSTR __builtin___CFStringMakeConstantString
void test7() {
const void *X;
- X = CFSTR("\242");
+ X = CFSTR("\242"); // expected-warning {{input conversion stopped}}
X = CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
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}}
@@ -37,7 +37,7 @@ void test7() {
void test9(short v) {
unsigned i, old;
-
+
old = __sync_fetch_and_add(); // expected-error {{too few arguments to function call}}
old = __sync_fetch_and_add(&old); // expected-error {{too few arguments to function call}}
old = __sync_fetch_and_add((unsigned*)0, 42i); // expected-warning {{imaginary constants are an extension}}
@@ -56,14 +56,14 @@ void test9(short v) {
void test10(void) __attribute__((noreturn));
void test10(void) {
- __asm__("int3");
+ __asm__("int3");
__builtin_unreachable();
-
+
// No warning about falling off the end of a noreturn function.
}
void test11(int X) {
- switch (X) {
+ switch (X) {
case __builtin_eh_return_data_regno(0): // constant foldable.
break;
}
@@ -95,3 +95,10 @@ void test14() {
void test15(const char *s) {
__builtin_printf("string is %s\n", s);
}
+
+// PR7885
+int test16() {
+ return __builtin_constant_p() + // expected-error{{too few arguments}}
+ __builtin_constant_p(1, 2); // expected-error {{too many arguments}}
+}
+
diff --git a/test/Sema/cast-to-union.c b/test/Sema/cast-to-union.c
index 6f275e8b505f..c32964dfc0d5 100644
--- a/test/Sema/cast-to-union.c
+++ b/test/Sema/cast-to-union.c
@@ -1,11 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
-union u { int i; };
+union u { int i; unsigned : 3; };
void f(union u);
void test(int x) {
f((union u)x); // expected-warning {{C99 forbids casts to union type}}
f((union u)&x); // expected-error {{cast to union type from type 'int *' not present in union}}
+ f((union u)2U); // expected-error {{cast to union type from type 'unsigned int' not present in union}}
}
union u w = (union u)2; // expected-warning {{C99 forbids casts to union type}}
diff --git a/test/Sema/cast.c b/test/Sema/cast.c
index e52dcaebbddb..71c44b4b816b 100644
--- a/test/Sema/cast.c
+++ b/test/Sema/cast.c
@@ -16,3 +16,144 @@ long bar1(long *next) {
return (long)(*next)++;
}
+typedef _Bool Bool;
+typedef int Int;
+typedef long Long;
+typedef float Float;
+typedef double Double;
+typedef _Complex int CInt;
+typedef _Complex long CLong;
+typedef _Complex float CFloat;
+typedef _Complex double CDouble;
+typedef void *VoidPtr;
+typedef char *CharPtr;
+
+void testBool(Bool v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+ (void) (VoidPtr) v;
+ (void) (CharPtr) v;
+}
+
+void testInt(Int v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+ (void) (VoidPtr) v;
+ (void) (CharPtr) v;
+}
+
+void testLong(Long v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+ (void) (VoidPtr) v;
+ (void) (CharPtr) v;
+}
+
+void testFloat(Float v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+}
+
+void testDouble(Double v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+}
+
+void testCI(CInt v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+}
+
+void testCLong(CLong v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+}
+
+void testCFloat(CFloat v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+}
+
+void testCDouble(CDouble v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (Float) v;
+ (void) (Double) v;
+ (void) (CInt) v;
+ (void) (CLong) v;
+ (void) (CFloat) v;
+ (void) (CDouble) v;
+}
+
+void testVoidPtr(VoidPtr v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (VoidPtr) v;
+ (void) (CharPtr) v;
+}
+
+void testCharPtr(CharPtr v) {
+ (void) (Bool) v;
+ (void) (Int) v;
+ (void) (Long) v;
+ (void) (VoidPtr) v;
+ (void) (CharPtr) v;
+}
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index b2c35633953d..5221b172a602 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -288,3 +288,27 @@ int test6(unsigned i, unsigned power) {
unsigned x = (i < (1 << power) ? i : 0);
return x != 3 ? 1 << power : i;
}
+
+// <rdar://problem/8414119> enum >= (enum)0 comparison should not generate any warnings
+enum rdar8414119_Vals { X, Y, Z };
+#define ZERO 0
+#define CHECK(x) (x >= X)
+void rdar8414119_foo(enum rdar8414119_Vals v) {
+ if (CHECK(v)) // no-warning
+ return;
+ if (v >= X) // no-warning
+ return;
+}
+int rdar8414119_bar(unsigned x) {
+ return x >= ZERO; // no-warning
+}
+#undef ZERO
+#undef CHECK
+
+int rdar8511238() {
+ enum A { A_foo, A_bar };
+ enum A a;
+ if (a < 0) // expected-warning {{comparison of unsigned enum expression < 0 is always false}}
+ return 0;
+ return 20;
+}
diff --git a/test/Sema/complex-int.c b/test/Sema/complex-int.c
index cb76a342c2d0..32249b35e1c5 100644
--- a/test/Sema/complex-int.c
+++ b/test/Sema/complex-int.c
@@ -53,3 +53,15 @@ void test4(_Complex float *x) {
void test5(_Complex int *x) {
(*x)++;
}
+
+int i1[(2+3i)*(5+7i) == 29i-11 ? 1 : -1];
+int i2[(29i-11)/(5+7i) == 2+3i ? 1 : -1];
+int i3[-(2+3i) == +(-3i-2) ? 1 : -1];
+int i4[~(2+3i) == 2-3i ? 1 : -1];
+int i5[(3i == -(-3i) ? ((void)3, 1i - 1) : 0) == 1i - 1 ? 1 : -1];
+
+int f1[(2.0+3.0i)*(5.0+7.0i) == 29.0i-11.0 ? 1 : -1];
+int f2[(29.0i-11.0)/(5.0+7.0i) == 2.0+3.0i ? 1 : -1];
+int f3[-(2.0+3.0i) == +(-3.0i-2.0) ? 1 : -1];
+int f4[~(2.0+3.0i) == 2.0-3.0i ? 1 : -1];
+int f5[(3.0i == -(-3.0i) ? ((void)3.0, __extension__ (1.0i - 1.0)) : 0) == 1.0i - 1.0 ? 1 : -1];
diff --git a/test/Sema/compound-literal.c b/test/Sema/compound-literal.c
index aade4641ace0..41307625999e 100644
--- a/test/Sema/compound-literal.c
+++ b/test/Sema/compound-literal.c
@@ -3,9 +3,10 @@
struct foo { int a, b; };
static struct foo t = (struct foo){0,0};
-static struct foo t2 = {0,0};
+static struct foo t1 = __builtin_choose_expr(0, (struct foo){0,0}, (struct foo){0,0});
+static struct foo t2 = {0,0};
static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
-static int *p = (int []){2,4};
+static int *p = (int []){2,4};
static int x = (int){1};
static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c
index 6e248bc3cfec..7a8c9e9f3612 100644
--- a/test/Sema/conditional-expr.c
+++ b/test/Sema/conditional-expr.c
@@ -75,3 +75,16 @@ int f2(int x) {
// We can suppress this because the immediate context wants an int.
return (x != 0) ? 0U : x;
}
+
+#define NULL (void*)0
+
+void PR9236() {
+ struct A {int i;} A1;
+ (void)(1 ? A1 : NULL); // expected-error{{non-pointer operand type 'struct A' incompatible with NULL}}
+ (void)(1 ? NULL : A1); // expected-error{{non-pointer operand type 'struct A' incompatible with NULL}}
+ (void)(1 ? 0 : A1); // expected-error{{incompatible operand types}}
+ (void)(1 ? (void*)0 : A1); // expected-error{{incompatible operand types}}
+ (void)(1 ? A1: (void*)0); // expected-error{{incompatible operand types}}
+ (void)(1 ? A1 : (NULL)); // expected-error{{non-pointer operand type 'struct A' incompatible with NULL}}
+}
+
diff --git a/test/Sema/const-eval.c b/test/Sema/const-eval.c
index 42097e75f317..aa0cee5da5b3 100644
--- a/test/Sema/const-eval.c
+++ b/test/Sema/const-eval.c
@@ -41,7 +41,7 @@ struct s {
EVAL_EXPR(19, ((int)&*(char*)10 == 10 ? 1 : -1));
-EVAL_EXPR(20, __builtin_constant_p(*((int*) 10), -1, 1));
+EVAL_EXPR(20, __builtin_constant_p(*((int*) 10)));
EVAL_EXPR(21, (__imag__ 2i) == 2 ? 1 : -1);
@@ -80,3 +80,9 @@ EVAL_EXPR(38, __builtin_expect(1,1) == 1 ? 1 : -1)
// PR7884
EVAL_EXPR(39, __real__(1.f) == 1 ? 1 : -1)
EVAL_EXPR(40, __imag__(1.f) == 0 ? 1 : -1)
+
+// rdar://8875946
+void rdar8875946() {
+ double _Complex P;
+ float _Complex P2 = 3.3f + P;
+}
diff --git a/test/Sema/const-ptr-int-ptr-cast.c b/test/Sema/const-ptr-int-ptr-cast.c
index c6e70b8b2455..8beaf9d4947c 100644
--- a/test/Sema/const-ptr-int-ptr-cast.c
+++ b/test/Sema/const-ptr-int-ptr-cast.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
#include <stdint.h>
diff --git a/test/Sema/constant-builtins-2.c b/test/Sema/constant-builtins-2.c
index 23aa314e0c32..68b46bf19ad9 100644
--- a/test/Sema/constant-builtins-2.c
+++ b/test/Sema/constant-builtins-2.c
@@ -50,3 +50,7 @@ int h0 = __builtin_types_compatible_p(int, float);
//int h2 = __builtin_expect(0, 0);
extern long int bi0;
extern __typeof__(__builtin_expect(0, 0)) bi0;
+
+// Strings
+int array1[__builtin_strlen("ab\0cd")];
+int array2[(sizeof(array1)/sizeof(int)) == 2? 1 : -1];
diff --git a/test/Sema/constant-conversion.c b/test/Sema/constant-conversion.c
new file mode 100644
index 000000000000..7c6b9b81bd0f
--- /dev/null
+++ b/test/Sema/constant-conversion.c
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin %s
+
+// This file tests -Wconstant-conversion, a subcategory of -Wconversion
+// which is on by default.
+
+// rdar://problem/6792488
+void test_6792488(void) {
+ int x = 0x3ff0000000000000U; // expected-warning {{implicit conversion from 'unsigned long' to 'int' changes value from 4607182418800017408 to 0}}
+}
+
+void test_7809123(void) {
+ struct { int i5 : 5; } a;
+
+ a.i5 = 36; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 36 to 4}}
+}
+
+void test() {
+ struct { int bit : 1; } a;
+ a.bit = 1; // shouldn't warn
+}
+
+enum Test2 { K_zero, K_one };
+enum Test2 test2(enum Test2 *t) {
+ *t = 20;
+ return 10; // shouldn't warn
+}
+
+void test3() {
+ struct A {
+ unsigned int foo : 2;
+ int bar : 2;
+ };
+
+ struct A a = { 0, 10 }; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+ struct A b[] = { 0, 10, 0, 0 }; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+ struct A c[] = {{10, 0}}; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+ struct A d = (struct A) { 10, 0 }; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+ struct A e = { .foo = 10 }; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+}
+
+void test4() {
+ struct A {
+ char c : 2;
+ } a;
+
+ a.c = 0x101; // expected-warning {{implicit truncation from 'int' to bitfield changes value from 257 to 1}}
+}
+
+void test5() {
+ struct A {
+ _Bool b : 1;
+ } a;
+
+ // Don't warn about this implicit conversion to bool, or at least
+ // don't warn about it just because it's a bitfield.
+ a.b = 100;
+}
diff --git a/test/Sema/constructor-attribute.c b/test/Sema/constructor-attribute.c
index 3dfbbcbe281c..2decebbd284a 100644
--- a/test/Sema/constructor-attribute.c
+++ b/test/Sema/constructor-attribute.c
@@ -1,12 +1,12 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to function types}}
+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.0))); // expected-error {{'constructor' attribute requires parameter 1 to be an integer constant}}
-int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to function types}}
+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)}}
diff --git a/test/Sema/conversion.c b/test/Sema/conversion.c
index 5fbd64de5bb4..e78902332eb1 100644
--- a/test/Sema/conversion.c
+++ b/test/Sema/conversion.c
@@ -40,17 +40,17 @@ void test0(char c, short s, int i, long l, long long ll) {
l = (long) 0;
c = (char) BIG;
- c = (short) BIG; // expected-warning {{implicit conversion loses integer precision}}
- c = (int) BIG; // expected-warning {{implicit conversion loses integer precision}}
- c = (long) BIG; // expected-warning {{implicit conversion loses integer precision}}
+ c = (short) BIG; // expected-warning {{implicit conversion from 'short' to 'char' changes value}}
+ c = (int) BIG; // expected-warning {{implicit conversion from 'int' to 'char' changes value}}
+ c = (long) BIG; // expected-warning {{implicit conversion from 'long' to 'char' changes value}}
s = (char) BIG;
s = (short) BIG;
- s = (int) BIG; // expected-warning {{implicit conversion loses integer precision}}
- s = (long) BIG; // expected-warning {{implicit conversion loses integer precision}}
+ s = (int) BIG; // expected-warning {{implicit conversion from 'int' to 'short' changes value}}
+ s = (long) BIG; // expected-warning {{implicit conversion from 'long' to 'short' changes value}}
i = (char) BIG;
i = (short) BIG;
i = (int) BIG;
- i = (long) BIG; // expected-warning {{implicit conversion loses integer precision}}
+ i = (long) BIG; // expected-warning {{implicit conversion from 'long' to 'int' changes value}}
l = (char) BIG;
l = (short) BIG;
l = (int) BIG;
@@ -63,10 +63,10 @@ char test1(long long ll) {
return (int) ll; // expected-warning {{implicit conversion loses integer precision}}
return (short) ll; // expected-warning {{implicit conversion loses integer precision}}
return (char) ll;
- return (long long) BIG; // expected-warning {{implicit conversion loses integer precision}}
- return (long) BIG; // expected-warning {{implicit conversion loses integer precision}}
- return (int) BIG; // expected-warning {{implicit conversion loses integer precision}}
- return (short) BIG; // expected-warning {{implicit conversion loses integer precision}}
+ return (long long) BIG; // expected-warning {{implicit conversion from 'long long' to 'char' changes value}}
+ return (long) BIG; // expected-warning {{implicit conversion from 'long' to 'char' changes value}}
+ return (int) BIG; // expected-warning {{implicit conversion from 'int' to 'char' changes value}}
+ return (short) BIG; // expected-warning {{implicit conversion from 'short' to 'char' changes value}}
return (char) BIG;
}
@@ -76,9 +76,9 @@ short test2(long long ll) {
return (int) ll; // expected-warning {{implicit conversion loses integer precision}}
return (short) ll;
return (char) ll;
- return (long long) BIG; // expected-warning {{implicit conversion loses integer precision}}
- return (long) BIG; // expected-warning {{implicit conversion loses integer precision}}
- return (int) BIG; // expected-warning {{implicit conversion loses integer precision}}
+ return (long long) BIG; // expected-warning {{implicit conversion from 'long long' to 'short' changes value}}
+ return (long) BIG; // expected-warning {{implicit conversion from 'long' to 'short' changes value}}
+ return (int) BIG; // expected-warning {{implicit conversion from 'int' to 'short' changes value}}
return (short) BIG;
return (char) BIG;
}
@@ -89,8 +89,8 @@ int test3(long long ll) {
return (int) ll;
return (short) ll;
return (char) ll;
- return (long long) BIG; // expected-warning {{implicit conversion loses integer precision}}
- return (long) BIG; // expected-warning {{implicit conversion loses integer precision}}
+ return (long long) BIG; // expected-warning {{implicit conversion from 'long long' to 'int' changes value}}
+ return (long) BIG; // expected-warning {{implicit conversion from 'long' to 'int' changes value}}
return (int) BIG;
return (short) BIG;
return (char) BIG;
@@ -277,7 +277,7 @@ unsigned char test19(unsigned long u64) {
// <rdar://problem/7631400>
void test_7631400(void) {
// This should show up despite the caret being inside a macro substitution
- char s = LONG_MAX; // expected-warning {{implicit conversion loses integer precision: 'long' to 'char'}}
+ char s = LONG_MAX; // expected-warning {{implicit conversion from 'long' to 'char' changes value}}
}
// <rdar://problem/7676608>: assertion for compound operators with non-integral RHS
@@ -297,3 +297,16 @@ void test_7904686(void) {
unsigned u2 = -1; // expected-warning {{implicit conversion changes signedness}}
u2 = -1; // expected-warning {{implicit conversion changes signedness}}
}
+
+// <rdar://problem/8232669>: don't warn about conversions required by
+// contexts in system headers
+void test_8232669(void) {
+ unsigned bitset[20];
+ SETBIT(bitset, 0);
+
+ unsigned y = 50;
+ SETBIT(bitset, y);
+
+#define USER_SETBIT(set,bit) do { int i = bit; set[i/(8*sizeof(set[0]))] |= (1 << (i%(8*sizeof(set)))); } while(0)
+ USER_SETBIT(bitset, 0); // expected-warning 2 {{implicit conversion changes signedness}}
+}
diff --git a/test/Sema/designated-initializers.c b/test/Sema/designated-initializers.c
index 7e4ed6892aee..c9a8482e85db 100644
--- a/test/Sema/designated-initializers.c
+++ b/test/Sema/designated-initializers.c
@@ -249,3 +249,31 @@ struct expr expr0 = {
}
}
};
+
+// PR6955
+
+struct ds {
+ struct {
+ struct {
+ unsigned int a;
+ };
+ unsigned int b;
+ struct {
+ unsigned int c;
+ };
+ };
+};
+
+// C1X lookup-based anonymous member init cases
+struct ds ds0 = {
+ { {
+ .a = 1 // expected-note{{previous initialization is here}}
+ } },
+ .a = 2, // expected-warning{{initializer overrides prior initialization of this subobject}}
+ .b = 3
+};
+struct ds ds1 = { .c = 0 };
+struct ds ds2 = { { {
+ .a = 0,
+ .b = 1 // expected-error{{field designator 'b' does not refer to any field}}
+} } };
diff --git a/test/Sema/dllimport-dllexport.c b/test/Sema/dllimport-dllexport.c
index eea2f6fe9637..f09e3cf69ab5 100644
--- a/test/Sema/dllimport-dllexport.c
+++ b/test/Sema/dllimport-dllexport.c
@@ -10,9 +10,9 @@ void __attribute__((dllimport, dllexport)) foo4(); // expected-warning{{dllimpor
void __attribute__((dllexport)) foo5();
void __attribute__((dllimport)) foo5(); // expected-warning{{dllimport attribute ignored}}
-typedef int __attribute__((dllexport)) type6; // expected-warning{{'dllexport' attribute only applies to variable and function types}}
+typedef int __attribute__((dllexport)) type6; // expected-warning{{'dllexport' attribute only applies to variables and functions}}
-typedef int __attribute__((dllimport)) type7; // expected-warning{{'dllimport' attribute only applies to variable and function}}
+typedef int __attribute__((dllimport)) type7; // expected-warning{{'dllimport' attribute only applies to variables and functions}}
void __attribute__((dllimport)) foo6();
void foo6(){} // expected-warning {{'foo6' redeclared without dllimport attribute: previous dllimport ignored}}
@@ -28,9 +28,9 @@ void __declspec(dllimport) __declspec(dllexport) foo10(); // expected-warning{{d
void __declspec(dllexport) foo11();
void __declspec(dllimport) foo11(); // expected-warning{{dllimport attribute ignored}}
-typedef int __declspec(dllexport) type1; // expected-warning{{'dllexport' attribute only applies to variable and function types}}
+typedef int __declspec(dllexport) type1; // expected-warning{{'dllexport' attribute only applies to variables and functions}}
-typedef int __declspec(dllimport) type2; // expected-warning{{'dllimport' attribute only applies to variable and function}}
+typedef int __declspec(dllimport) type2; // expected-warning{{'dllimport' attribute only applies to variables and functions}}
void __declspec(dllimport) foo12();
void foo12(){} // expected-warning {{'foo12' redeclared without dllimport attribute: previous dllimport ignored}}
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index 64aa31bc4b6f..a95efb035db1 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -102,3 +102,18 @@ extern enum PR7911T PR7911V; // expected-warning{{ISO C forbids forward referenc
void PR7911F() {
switch (PR7911V); // expected-error {{statement requires expression of integer type}}
}
+
+char test5[__has_feature(enumerator_attributes) ? 1 : -1];
+
+// PR8694
+// rdar://8707031
+void PR8694(int* e) // expected-note {{passing argument to parameter 'e' here}}
+{
+}
+
+void crash(enum E* e) // expected-warning {{declaration of 'enum E' will not be visible outside of this function}} \
+ // expected-warning {{ISO C forbids forward references to 'enum' types}}
+{
+ PR8694(e); // expected-warning {{incompatible pointer types passing 'enum E *' to parameter of type 'int *'}}
+}
+
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c
index 56a52bed1bc3..e88f7fc08bce 100644
--- a/test/Sema/exprs.c
+++ b/test/Sema/exprs.c
@@ -150,3 +150,19 @@ int test20(int x) {
// no warning, this is an idiom for "true" in old C style.
return x && (signed char)1;
}
+
+struct Test21; // expected-note 2 {{forward declaration}}
+void test21(volatile struct Test21 *ptr) {
+ void test21_help(void);
+ (test21_help(), *ptr); // expected-error {{incomplete type 'struct Test21' where a complete type is required}}
+ (*ptr, test21_help()); // expected-error {{incomplete type 'struct Test21' where a complete type is required}}
+}
+
+// Make sure we do function/array decay.
+void test22() {
+ if ("help")
+ (void) 0;
+
+ if (test22)
+ (void) 0;
+}
diff --git a/test/Sema/flexible-array-init.c b/test/Sema/flexible-array-init.c
index e03881cdbcbe..12f5d4f5d605 100644
--- a/test/Sema/flexible-array-init.c
+++ b/test/Sema/flexible-array-init.c
@@ -1,13 +1,20 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
struct one {
int a;
- int values[]; // expected-note 3{{initialized flexible array member 'values' is here}}
+ int values[]; // expected-note 4{{initialized flexible array member 'values' is here}}
} x = {5, {1, 2, 3}}; // expected-warning{{flexible array initialization is a GNU extension}}
struct one x2 = { 5, 1, 2, 3 }; // expected-warning{{flexible array initialization is a GNU extension}}
void test() {
- struct one x3 = {5, {1, 2, 3}}; // expected-warning{{flexible array initialization is a GNU extension}}
+ struct one x3 = {5, {1, 2, 3}}; // \
+ // expected-warning{{flexible array initialization is a GNU extension}} \
+ // expected-error {{non-static initialization of a variable with flexible array member}}
+ struct one x3a = { 5 };
+ struct one x3b = { .a = 5 };
+ struct one x3c = { 5, {} }; // expected-warning{{use of GNU empty initializer extension}} \
+ // expected-warning{{flexible array initialization is a GNU extension}} \
+ // expected-warning{{zero size arrays are an extension}}
}
struct foo {
@@ -56,3 +63,18 @@ struct Y {
int e;
struct X xs[]; // expected-warning{{'struct X' may not be used as an array element due to flexible array member}}
};
+
+
+// PR8217
+struct PR8217a {
+ int i;
+ char v[];
+};
+
+void PR8217() {
+ struct PR8217a foo1 = { .i = 0, .v = "foo" }; // expected-error {{non-static initialization of a variable with flexible array member}}
+ struct PR8217a foo2 = { .i = 0 };
+ struct PR8217a foo3 = { .i = 0, .v = { 'b', 'a', 'r', '\0' } }; // expected-error {{non-static initialization of a variable with flexible array member}}
+ struct PR8217a bar;
+}
+
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 2325454c0b75..be506d7c6b19 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -174,7 +174,16 @@ void test10(int x, float f, int i, long long lli) {
printf("%.0Lf", (long double) 1.0); // no-warning
printf("%c\n", "x"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
printf("%c\n", 1.23); // expected-warning{{conversion specifies type 'int' but the argument has type 'double'}}
-}
+ printf("Format %d, is %! %f", 1, 2, 4.4); // expected-warning{{invalid conversion specifier '!'}}
+}
+
+typedef unsigned char uint8_t;
+
+void should_understand_small_integers() {
+ printf("%hhu", (short) 10); // expected-warning{{conversion specifies type 'unsigned char' but the argument has type 'short'}}
+ printf("%hu\n", (unsigned char) 1); // expected-warning{{conversion specifies type 'unsigned short' but the argument has type 'unsigned char'}}
+ printf("%hu\n", (uint8_t)1); // expected-warning{{conversion specifies type 'unsigned short' but the argument has type 'uint8_t'}}
+}
void test11(void *p, char *s) {
printf("%p", p); // no-warning
@@ -301,3 +310,33 @@ void pr7981(wint_t c, wchar_t c2) {
printf("%lc", c2); // no-warning
}
+// <rdar://problem/8269537> -Wformat-security says NULL is not a string literal
+void rdar8269537() {
+ // This is likely to crash in most cases, but -Wformat-nonliteral technically
+ // doesn't warn in this case.
+ printf(0); // no-warning
+}
+
+// Handle functions with multiple format attributes.
+extern void rdar8332221_vprintf_scanf(const char *, va_list, const char *, ...)
+ __attribute__((__format__(__printf__, 1, 0)))
+ __attribute__((__format__(__scanf__, 3, 4)));
+
+void rdar8332221(va_list ap, int *x, long *y) {
+ rdar8332221_vprintf_scanf("%", ap, "%d", x); // expected-warning{{incomplete format specifier}}
+}
+
+// PR8641
+void pr8641() {
+ printf("%#x\n", 10);
+ printf("%#X\n", 10);
+}
+
+void posix_extensions() {
+ // Test %'d, "thousands grouping".
+ // <rdar://problem/8816343>
+ printf("%'d\n", 123456789); // no-warning
+ printf("%'i\n", 123456789); // no-warning
+ printf("%'f\n", (float) 1.0); // no-warning
+ printf("%'p\n", (void*) 0); // expected-warning{{results in undefined behavior with 'p' conversion specifier}}
+}
diff --git a/test/Sema/i-c-e.c b/test/Sema/i-c-e.c
index eb77bbe3b990..4c2962d4b21a 100644
--- a/test/Sema/i-c-e.c
+++ b/test/Sema/i-c-e.c
@@ -1,4 +1,4 @@
-// RUN: %clang %s -fsyntax-only -Xclang -verify -pedantic -fpascal-strings
+// RUN: %clang %s -ffreestanding -fsyntax-only -Xclang -verify -pedantic -fpascal-strings
#include <stdint.h>
#include <limits.h>
@@ -9,6 +9,7 @@ int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // expected-error {{inc
int expr;
char w[__builtin_constant_p(expr) ? expr : 1];
+char v[sizeof(__builtin_constant_p(0)) == sizeof(int) ? 1 : -1];
// __builtin_constant_p as the condition of ?: allows arbitrary foldable
// constants to be transmogrified into i-c-e's.
diff --git a/test/Sema/if-empty-body.c b/test/Sema/if-empty-body.c
deleted file mode 100644
index af1e62f6b1b6..000000000000
--- a/test/Sema/if-empty-body.c
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-void f1(int a) {
- if (a); // expected-warning {{if statement has empty body}}
-}
-
-void f2(int a) {
- if (a) {}
-}
-
-void f3() {
- if (1)
- xx; // expected-error {{use of undeclared identifier}}
- return; // no empty body warning.
-}
-
diff --git a/test/Sema/implicit-builtin-decl.c b/test/Sema/implicit-builtin-decl.c
index 3d920389a228..d80414d5fea0 100644
--- a/test/Sema/implicit-builtin-decl.c
+++ b/test/Sema/implicit-builtin-decl.c
@@ -18,11 +18,11 @@ void g(int malloc) { // okay: these aren't functions
void h() {
int malloc(int); // expected-warning{{incompatible redeclaration of library function 'malloc'}}
int strcpy(int); // expected-warning{{incompatible redeclaration of library function 'strcpy'}} \
- // expected-note{{'strcpy' is a builtin with type 'char *(char *, char const *)'}}
+ // expected-note{{'strcpy' is a builtin with type 'char *(char *, const char *)'}}
}
void f2() {
- fprintf(0, "foo"); // expected-error{{implicit declaration of 'fprintf' requires inclusion of the header <stdio.h>}} \
+ fprintf(0, "foo"); // expected-warning{{declaration of built-in function 'fprintf' requires inclusion of the header <stdio.h>}} \
expected-warning {{implicit declaration of function 'fprintf' is invalid in C99}}
}
@@ -52,3 +52,6 @@ main(int argc, char *argv[])
}
void snprintf() { }
+
+// PR8316
+void longjmp(); // expected-warning{{declaration of built-in function 'longjmp' requires inclusion of the header <setjmp.h>}}
diff --git a/test/Sema/init.c b/test/Sema/init.c
index ac274a4ce227..f8110079d0eb 100644
--- a/test/Sema/init.c
+++ b/test/Sema/init.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -ffreestanding
#include <stddef.h>
#include <stdint.h>
@@ -143,3 +143,4 @@ int PR4386_a = ((void *) PR4386_bar) != 0;
int PR4386_b = ((void *) PR4386_foo) != 0; // expected-error{{initializer element is not a compile-time constant}}
int PR4386_c = ((void *) PR4386_zed) != 0;
int PR4386_zed() __attribute((weak));
+
diff --git a/test/Sema/knr-def-call.c b/test/Sema/knr-def-call.c
index 66f2ec07f287..d054a0476505 100644
--- a/test/Sema/knr-def-call.c
+++ b/test/Sema/knr-def-call.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wconversion -Wliteral-conversion -fsyntax-only -verify %s
// C DR #316, PR 3626.
void f0(a, b, c, d) int a,b,c,d; {}
@@ -23,7 +23,19 @@ void f4() {
}
char *rindex(s, c)
- register char *s, c; // expected-warning{{promoted type 'char *' of K&R function parameter is not compatible with the parameter type 'char const *' declared in a previous prototype}}
+ register char *s, c; // expected-warning{{promoted type 'char *' of K&R function parameter is not compatible with the parameter type 'const char *' declared in a previous prototype}}
{
return 0;
}
+
+// PR8314
+void proto(int);
+void proto(x)
+ int 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}}
+}
diff --git a/test/Sema/neon-vector-types.c b/test/Sema/neon-vector-types.c
new file mode 100644
index 000000000000..1f501776cc8e
--- /dev/null
+++ b/test/Sema/neon-vector-types.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+typedef float float32_t;
+typedef signed char poly8_t;
+typedef short poly16_t;
+typedef unsigned long long uint64_t;
+
+// Define some valid Neon types.
+typedef __attribute__((neon_vector_type(2))) int int32x2_t;
+typedef __attribute__((neon_vector_type(4))) int int32x4_t;
+typedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t;
+typedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t;
+typedef __attribute__((neon_vector_type(2))) float32_t float32x2_t;
+typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t;
+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)}}
+
+// 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}}
+
+// Only certain element types are allowed.
+typedef __attribute__((neon_vector_type(2))) double double_elt; // expected-error{{invalid vector element type}}
+typedef __attribute__((neon_vector_type(4))) void* ptr_elt; // expected-error{{invalid vector element type}}
+typedef __attribute__((neon_polyvector_type(4))) float32_t bad_poly_elt; // expected-error{{invalid vector element type}}
+struct aggr { signed char c; };
+typedef __attribute__((neon_vector_type(8))) struct aggr aggregate_elt; // expected-error{{invalid vector element type}}
+
+// The total vector size must be 64 or 128 bits.
+typedef __attribute__((neon_vector_type(1))) int int32x1_t; // expected-error{{Neon vector size must be 64 or 128 bits}}
+typedef __attribute__((neon_vector_type(3))) int int32x3_t; // expected-error{{Neon vector size must be 64 or 128 bits}}
diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c
index e53f0eb99bc1..6d6fa1d4bd42 100644
--- a/test/Sema/parentheses.c
+++ b/test/Sema/parentheses.c
@@ -25,4 +25,15 @@ void bitwise_rel(unsigned i) {
// Eager logical op
(void)(i == 1 | i == 2 | i == 3);
(void)(i != 1 & i != 2 & i != 3);
+
+ (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.
+ (void)(i || i && "w00t" || i); // expected-warning {{'&&' within '||'}} \
+ // expected-note {{place parentheses around the '&&' expression to silence this warning}}
+ (void)(i || "w00t" && i || i); // expected-warning {{'&&' within '||'}} \
+ // expected-note {{place parentheses around the '&&' expression to silence this warning}}
+ (void)(i && i || 0); // no warning.
+ (void)(0 || i && i); // no warning.
}
diff --git a/test/Sema/pointer-addition.c b/test/Sema/pointer-addition.c
index 34f8bbbfcd6d..aa425a7fd9d9 100644
--- a/test/Sema/pointer-addition.c
+++ b/test/Sema/pointer-addition.c
@@ -9,6 +9,7 @@ void a(S* b, void* c) {
c += 1; // expected-warning {{use of GNU void* extension}}
c--; // expected-warning {{use of GNU void* extension}}
c -= 1; // expected-warning {{use of GNU void* extension}}
+ (void) c[1]; // expected-warning {{use of GNU void* extension}}
b = 1+b; // expected-error {{arithmetic on pointer to incomplete type}}
/* The next couple tests are only pedantic warnings in gcc */
void (*d)(S*,void*) = a;
diff --git a/test/Sema/pragma-unused.c b/test/Sema/pragma-unused.c
index 8a051a3ec9ef..aafac0de206d 100644
--- a/test/Sema/pragma-unused.c
+++ b/test/Sema/pragma-unused.c
@@ -1,16 +1,16 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -Wused-but-marked-unused -Wunused -verify %s
void f1(void) {
int x, y, z;
#pragma unused(x)
#pragma unused(y, z)
- int w; // FIXME: We should emit a warning that 'w' is unused.
+ int w; // expected-warning {{unused}}
#pragma unused w // expected-warning{{missing '(' after '#pragma unused' - ignoring}}
}
void f2(void) {
- int x, y;
+ int x, y; // expected-warning {{unused}} expected-warning {{unused}}
#pragma unused(x,) // expected-warning{{expected '#pragma unused' argument to be a variable name}}
#pragma unused() // expected-warning{{expected '#pragma unused' argument to be a variable name}}
}
@@ -20,15 +20,10 @@ void f3(void) {
}
void f4(void) {
- int w; // FIXME: We should emit a warning that 'w' is unused.
+ int w; // expected-warning {{unused}}
#pragma unused((w)) // expected-warning{{expected '#pragma unused' argument to be a variable name}}
}
-int k;
-void f5(void) {
- #pragma unused(k) // expected-warning{{only local variables can be arguments to '#pragma unused'}}
-}
-
void f6(void) {
int z; // no-warning
{
@@ -41,3 +36,30 @@ void f7() {
#pragma unused(undeclared, undefined, y) // expected-warning{{undeclared variable 'undeclared' used as an argument for '#pragma unused'}} expected-warning{{undeclared variable 'undefined' used as an argument for '#pragma unused'}}
}
+int f8(int x) { // expected-warning{{unused parameter 'x'}}
+ return 0;
+}
+
+int f9(int x) {
+ return x;
+}
+
+int f10(int x) {
+ #pragma unused(x)
+ return 0;
+}
+
+int f11(int x) {
+ #pragma unused(x)
+ return x; // expected-warning{{'x' was marked unused but was used}}
+}
+
+int f12(int x) {
+ int y = x;
+ #pragma unused(x) // expected-warning{{'x' was marked unused but was used}}
+ return y;
+}
+
+// rdar://8793832
+static int glob_var = 0;
+#pragma unused(glob_var)
diff --git a/test/Sema/predef.c b/test/Sema/predef.c
index 08a4a2bf83e9..95bcfb9d8d51 100644
--- a/test/Sema/predef.c
+++ b/test/Sema/predef.c
@@ -6,7 +6,7 @@ void abcdefghi12(void) {
}
char *X = __func__; // expected-warning {{predefined identifier is only valid}} \
- expected-warning {{initializing 'char *' with an expression of type 'char const [1]' discards qualifiers}}
+ expected-warning {{initializing 'char *' with an expression of type 'const char [1]' discards qualifiers}}
void a() {
__func__[0] = 'a'; // expected-error {{variable is not assignable}}
diff --git a/test/Sema/private-extern.c b/test/Sema/private-extern.c
index d3c12651098a..25591dc5b1f2 100644
--- a/test/Sema/private-extern.c
+++ b/test/Sema/private-extern.c
@@ -19,27 +19,23 @@ __private_extern__ int g5; // expected-note{{previous definition}}
static int g5; // expected-error{{static declaration of 'g5' follows non-static declaration}}
void f0() {
- // FIXME: Diagnose this?
- int g6;
- extern int g6;
+ int g6; // expected-note {{previous}}
+ extern int g6; // expected-error {{extern declaration of 'g6' follows non-extern declaration}}
}
void f1() {
- // FIXME: Diagnose this?
- int g7;
- __private_extern__ int g7;
+ int g7; // expected-note {{previous}}
+ __private_extern__ int g7; // expected-error {{extern declaration of 'g7' follows non-extern declaration}}
}
void f2() {
extern int g8; // expected-note{{previous definition}}
- // FIXME: Improve this diagnostic.
- int g8; // expected-error{{redefinition of 'g8'}}
+ int g8; // expected-error {{non-extern declaration of 'g8' follows extern declaration}}
}
void f3() {
__private_extern__ int g9; // expected-note{{previous definition}}
- // FIXME: Improve this diagnostic.
- int g9; // expected-error{{redefinition of 'g9'}}
+ int g9; // expected-error {{non-extern declaration of 'g9' follows extern declaration}}
}
void f4() {
diff --git a/test/Sema/promote-int-16bit.c b/test/Sema/promote-int-16bit.c
deleted file mode 100644
index 6446720a815e..000000000000
--- a/test/Sema/promote-int-16bit.c
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -triple pic16-unknown-unknown
-
-// Check that unsigned short promotes to unsigned int on targets where
-// sizeof(unsigned short) == sizeof(unsigned int)
-__typeof(1+(unsigned short)1) x;
-unsigned x;
diff --git a/test/Sema/rdr6094103-unordered-compare-promote.c b/test/Sema/rdr6094103-unordered-compare-promote.c
index 9991982a20b2..7bb363e797c8 100644
--- a/test/Sema/rdr6094103-unordered-compare-promote.c
+++ b/test/Sema/rdr6094103-unordered-compare-promote.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -ast-dump %s 2>&1 | grep ImplicitCastExpr | count 2
+// RUN: %clang_cc1 -ast-dump %s 2>&1 | grep ImplicitCastExpr | count 4
int foo (double x, long double y) {
// There needs to be an implicit cast on x here.
diff --git a/test/Sema/redefinition.c b/test/Sema/redefinition.c
index 1092b33ca35d..1ee35f7c36ee 100644
--- a/test/Sema/redefinition.c
+++ b/test/Sema/redefinition.c
@@ -8,3 +8,7 @@ int foo(x) {
return 0;
}
int x = 1;
+
+// <rdar://problem/6880464>
+extern inline int g(void) { return 0; } // expected-note{{previous definition}}
+int g(void) { return 0; } // expected-error{{redefinition of a 'extern inline' function 'g' is not supported in C99 mode}}
diff --git a/test/Sema/return.c b/test/Sema/return.c
index 54c340634d39..0c2c72ee537f 100644
--- a/test/Sema/return.c
+++ b/test/Sema/return.c
@@ -203,7 +203,7 @@ int test30() {
if (j)
longjmp(test30_j, 1);
else
-#if defined(_WIN32) || defined(_WIN64)
+#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
longjmp(test30_j, 2);
#else
_longjmp(test30_j, 1);
@@ -242,3 +242,16 @@ static inline int si_forward() {} // expected-warning{{control reaches end of no
// Test warnings on ignored qualifiers on return types.
const int ignored_c_quals(); // expected-warning{{'const' type qualifier on return type has no effect}}
const volatile int ignored_cv_quals(); // expected-warning{{'const volatile' type qualifiers on return type have no effect}}
+
+// Test that for switch(enum) that if the switch statement covers all the cases
+// that we don't consider that for -Wreturn-type.
+enum Cases { C1, C2, C3, C4 };
+int test_enum_cases(enum Cases C) {
+ switch (C) {
+ case C1: return 1;
+ case C2: return 2;
+ case C4: return 3;
+ case C3: return 4;
+ }
+} // no-warning
+
diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c
index 4ccb64c9aa07..a9494d3e3fb4 100644
--- a/test/Sema/scope-check.c
+++ b/test/Sema/scope-check.c
@@ -133,7 +133,7 @@ int test8(int x) {
void test9(int n, void *P) {
int Y;
int Z = 4;
- goto *P; // expected-warning {{indirect goto might cross protected scopes}}
+ goto *P; // expected-error {{indirect goto might cross protected scopes}}
L2: ;
int a[n]; // expected-note {{jump bypasses initialization of variable length array}}
@@ -199,3 +199,36 @@ void test13(int n, void *p) {
a0: ;
static void *ps[] = { &&a0 };
}
+
+int test14(int n) {
+ static void *ps[] = { &&a0, &&a1 };
+ if (n < 0)
+ goto *&&a0;
+
+ if (n > 0) {
+ int vla[n];
+ a1:
+ vla[n-1] = 0;
+ }
+ a0:
+ return 0;
+}
+
+
+// PR8473: IR gen can't deal with indirect gotos past VLA
+// initialization, so that really needs to be a hard error.
+void test15(int n, void *pc) {
+ static const void *addrs[] = { &&L1, &&L2 };
+
+ goto *pc; // expected-error {{indirect goto might cross protected scope}}
+
+ L1:
+ {
+ char vla[n]; // expected-note {{jump bypasses initialization}}
+ L2: // expected-note {{possible target}}
+ vla[0] = 'a';
+ }
+}
+
+// rdar://9024687
+int test16(int [sizeof &&z]); // expected-error {{use of address-of-label extension outside of a function body}}
diff --git a/test/Sema/self-comparison.c b/test/Sema/self-comparison.c
index c5c0611e7c94..edb3a6a4c8a5 100644
--- a/test/Sema/self-comparison.c
+++ b/test/Sema/self-comparison.c
@@ -75,3 +75,14 @@ int array_comparisons() {
}
+// Don't issue a warning when either the left or right side of the comparison
+// results from a macro expansion. <rdar://problem/8435950>
+#define R8435950_A i
+#define R8435950_B i
+
+int R8435950(int i) {
+ if (R8435950_A == R8435950_B) // no-warning
+ return 0;
+ return 1;
+}
+
diff --git a/test/Sema/sentinel-attribute.c b/test/Sema/sentinel-attribute.c
index 4c0927396763..ed0ef89db70b 100644
--- a/test/Sema/sentinel-attribute.c
+++ b/test/Sema/sentinel-attribute.c
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-int x __attribute__((sentinel)); //expected-warning{{'sentinel' attribute only applies to function, method or block types}}
+int x __attribute__((sentinel)); //expected-warning{{'sentinel' attribute only applies to functions, methods and blocks}}
void f1(int a, ...) __attribute__ ((sentinel));
void f2(int a, ...) __attribute__ ((sentinel(1)));
diff --git a/test/Sema/shift.c b/test/Sema/shift.c
index 558a7d20065a..4273cab98ee3 100644
--- a/test/Sema/shift.c
+++ b/test/Sema/shift.c
@@ -1,4 +1,4 @@
-// RUN: %clang -Wall -fsyntax-only -Xclang -verify %s
+// RUN: %clang -Wall -ffreestanding -fsyntax-only -Xclang -verify %s
#include <limits.h>
diff --git a/test/Sema/short-enums.c b/test/Sema/short-enums.c
new file mode 100644
index 000000000000..6605c4e8fc07
--- /dev/null
+++ b/test/Sema/short-enums.c
@@ -0,0 +1,5 @@
+// RUN: not %clang_cc1 -fsyntax-only %s -verify
+// RUN: %clang_cc1 -fshort-enums -fsyntax-only %s -verify
+
+enum x { A };
+int t0[sizeof(enum x) == 1 ? 1 : -1];
diff --git a/test/Sema/statements.c b/test/Sema/statements.c
index e3c41f3e1aaf..963b98fe56ad 100644
--- a/test/Sema/statements.c
+++ b/test/Sema/statements.c
@@ -50,4 +50,53 @@ int test12(enum Numbers num) {
case kThree:
break;
}
-} \ No newline at end of file
+}
+
+
+enum x { a, b, c, d, e, f, g };
+
+void foo(enum x X) {
+ switch (X) { // expected-warning {{enumeration value 'g' not handled in switch}}
+ case a:
+ case b:
+ case c:
+ case d:
+ case e:
+ case f:
+ break;
+ }
+
+ switch (X) { // expected-warning {{enumeration values 'f' and 'g' not handled in switch}}
+ case a:
+ case b:
+ case c:
+ case d:
+ case e:
+ break;
+ }
+
+ switch (X) { // expected-warning {{enumeration values 'e', 'f', and 'g' not handled in switch}}
+ case a:
+ case b:
+ case c:
+ case d:
+ break;
+ }
+
+ switch (X) { // expected-warning {{5 enumeration values not handled in switch: 'c', 'd', 'e'...}}
+ case a:
+ case b:
+ break;
+ }
+}
+
+// PR 8880
+// FIXME: Clang should reject this, since GCC does. Previously this
+// was causing a crash in the CFG builder.
+int test_pr8880() {
+ int first = 1;
+ for ( ; ({ if (first) { first = 0; continue; } 0; }); )
+ return 0;
+ return 1;
+}
+
diff --git a/test/Sema/stdcall-fastcall.c b/test/Sema/stdcall-fastcall.c
index a06952647984..4531eb2a81c8 100644
--- a/test/Sema/stdcall-fastcall.c
+++ b/test/Sema/stdcall-fastcall.c
@@ -5,6 +5,16 @@ int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies t
int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' only applies to function types; type here is 'int'}}
// Different CC qualifiers are not compatible
-void __attribute__((stdcall, fastcall)) foo3(void); // expected-error{{stdcall and fastcall attributes are not compatible}}
+void __attribute__((stdcall, fastcall)) foo3(void); // expected-error{{fastcall and stdcall attributes are not compatible}}
void __attribute__((stdcall)) foo4(); // expected-note{{previous declaration is here}}
void __attribute__((fastcall)) foo4(void); // expected-error{{function declared 'fastcall' here was previously declared 'stdcall'}}
+
+// rdar://8876096
+void rdar8876096foo1(int i, int j) __attribute__((fastcall, cdecl)); // expected-error {{not compatible}}
+void rdar8876096foo2(int i, int j) __attribute__((fastcall, stdcall)); // expected-error {{not compatible}}
+void rdar8876096foo3(int i, int j) __attribute__((fastcall, regparm(2))); // expected-error {{not compatible}}
+void rdar8876096foo4(int i, int j) __attribute__((stdcall, cdecl)); // expected-error {{not compatible}}
+void rdar8876096foo5(int i, int j) __attribute__((stdcall, fastcall)); // expected-error {{not compatible}}
+void rdar8876096foo6(int i, int j) __attribute__((cdecl, fastcall)); // expected-error {{not compatible}}
+void rdar8876096foo7(int i, int j) __attribute__((cdecl, stdcall)); // expected-error {{not compatible}}
+void rdar8876096foo8(int i, int j) __attribute__((regparm(2), fastcall)); // expected-error {{not compatible}}
diff --git a/test/Sema/struct-packed-align.c b/test/Sema/struct-packed-align.c
index 2b9456703c72..6ca6a6096c4e 100644
--- a/test/Sema/struct-packed-align.c
+++ b/test/Sema/struct-packed-align.c
@@ -117,3 +117,18 @@ struct packed_fas2 {
extern int m1[sizeof(struct packed_fas2) == 1 ? 1 : -1];
extern int m2[__alignof(struct packed_fas2) == 1 ? 1 : -1];
+
+// Attribute aligned can round down typedefs. PR9253
+typedef long long __attribute__((aligned(1))) nt;
+
+struct nS {
+ char buf_nr;
+ nt start_lba;
+};
+
+extern int n1[sizeof(struct nS) == 9 ? 1 : -1];
+extern int n2[__alignof(struct nS) == 1 ? 1 : -1];
+
+
+
+
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index bb4822916cc7..96a6eb6e9632 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -77,7 +77,7 @@ void test6() {
}
// PR5606
-int f0(int var) { // expected-note{{'var' declared here}}
+int f0(int var) {
switch (va) { // expected-error{{use of undeclared identifier 'va'}}
case 1:
break;
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index 27d5c2403b43..ab1ba1867f47 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -2,6 +2,8 @@
typedef union {
int *ip;
float *fp;
+ long *__restrict rlp;
+ void *vpa[1];
} TU __attribute__((transparent_union));
void f(TU); // expected-note{{passing argument to parameter here}}
@@ -17,6 +19,30 @@ void g(int *ip, float *fp, char *cp) {
tu.ip = ip;
}
+/* Test ability to redeclare a function taking a transparent_union arg
+ with various compatible and incompatible argument types. */
+
+void fip(TU);
+void fip(int *i) {}
+
+void ffp(TU);
+void ffp(float *f) {}
+
+void flp(TU);
+void flp(long *l) {}
+
+void fvp(TU); // expected-note{{previous declaration is here}}
+void fvp(void *p) {} // expected-error{{conflicting types}}
+
+void fsp(TU); // expected-note{{previous declaration is here}}
+void fsp(short *s) {} // expected-error{{conflicting types}}
+
+void fi(TU); // expected-note{{previous declaration is here}}
+void fi(int i) {} // expected-error{{conflicting types}}
+
+void fvpp(TU); // expected-note{{previous declaration is here}}
+void fvpp(void **v) {} // expected-error{{conflicting types}}
+
/* FIXME: we'd like to just use an "int" here and align it differently
from the normal "int", but if we do so we lose the alignment
information from the typedef within the compiler. */
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
index 5b963c48b2cc..a7173b787791 100644
--- a/test/Sema/typedef-retain.c
+++ b/test/Sema/typedef-retain.c
@@ -24,15 +24,3 @@ int test4(const a y) {
y[0] = 10; // expected-error {{read-only variable is not assignable}}
}
-// PR2189
-int test5() {
- const int s[5]; int t[5];
- return &s == &t; // expected-warning {{comparison of distinct pointer types}}
-}
-
-int test6() {
- const a s;
- a t;
- return &s == &t; // expected-warning {{comparison of distinct pointer types}}
-}
-
diff --git a/test/Sema/typeof-use-deprecated.c b/test/Sema/typeof-use-deprecated.c
new file mode 100644
index 000000000000..238e5019f121
--- /dev/null
+++ b/test/Sema/typeof-use-deprecated.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+struct s { int a; } __attribute__((deprecated)) x; // expected-warning {{'s' is deprecated}}
+
+typeof(x) y; // expected-warning {{'s' is deprecated}}
+
+union un{ int a; } __attribute__((deprecated)) u; // expected-warning {{'un' is deprecated}}
+
+typeof( u) z; // expected-warning {{'un' is deprecated}}
+
+enum E{ one} __attribute__((deprecated)) e; // expected-warning {{'E' is deprecated}}
+
+typeof( e) w; // expected-warning {{'E' is deprecated}}
+
+struct foo { int x; } __attribute__((deprecated));
+typedef struct foo bar __attribute__((deprecated));
+bar x1; // expected-warning {{'bar' is deprecated}}
+
+int main() { typeof(x1) y; } // expected-warning {{'foo' is deprecated}}
+
+struct gorf { int x; };
+typedef struct gorf T __attribute__((deprecated));
+T t; // expected-warning {{'T' is deprecated}}
+void wee() { typeof(t) y; }
+
+
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c
new file mode 100644
index 000000000000..973e504f634d
--- /dev/null
+++ b/test/Sema/uninit-variables.c
@@ -0,0 +1,262 @@
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -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}}
+}
+
+int test2() {
+ int x = 0;
+ return x; // no-warning
+}
+
+int test3() {
+ int x;
+ x = 0;
+ return x; // no-warning
+}
+
+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}}
+ 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}}
+ 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}}
+ return x;
+}
+
+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}}
+}
+
+int test8(int y) {
+ int x;
+ if (y)
+ x = 1;
+ else
+ x = 0;
+ return x;
+}
+
+int test9(int n) {
+ int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (unsigned i = 0 ; i < n; ++i) {
+ if (i == n - 1)
+ break;
+ x = 1;
+ }
+ return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+}
+
+int test10(unsigned n) {
+ int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (unsigned i = 0 ; i < n; ++i) {
+ x = 1;
+ }
+ return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+}
+
+int test11(unsigned n) {
+ int x; // expected-note{{variable 'x' is declared here}} expected-note{{add initialization to silence this warning}}
+ for (unsigned i = 0 ; i <= n; ++i) {
+ x = 1;
+ }
+ return x; // expected-warning{{variable 'x' is possibly 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}}
+}
+
+int test13() {
+ static int i;
+ return i; // no-warning
+}
+
+// Simply don't crash on this test case.
+void test14() {
+ const char *p = 0;
+ 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}}
+}
+
+// Don't warn in the following example; shows dataflow confluence.
+char *test16_aux();
+void test16() {
+ char *p = test16_aux();
+ for (unsigned i = 0 ; i < 100 ; i++)
+ p[i] = 'a'; // no-warning
+}
+
+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; // no-warning
+}
+
+int test18(int x, int y) {
+ int z;
+ if (x && y && (z = 1)) {
+ return z; // no-warning
+ }
+ return 0;
+}
+
+int test19_aux1();
+int test19_aux2();
+int test19_aux3(int *x);
+int test19() {
+ int z;
+ if (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
+ return z; // no-warning
+ return 0;
+}
+
+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 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 0;
+}
+
+int test22() {
+ int z;
+ while (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
+ return z; // no-warning
+ return 0;
+}
+
+int test23() {
+ int z;
+ for ( ; test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z) ; )
+ return z; // no-warning
+ return 0;
+}
+
+// The basic uninitialized value analysis doesn't have enough path-sensitivity
+// to catch initializations relying on control-dependencies spanning multiple
+// conditionals. This possibly can be handled by making the CFG itself
+// represent such control-dependencies, but it is a niche case.
+int test24(int flag) {
+ unsigned val; // expected-note{{variable 'val' is declared here}} expected-note{{add initialization to silence this warning}}
+ if (flag)
+ val = 1;
+ if (!flag)
+ val = 1;
+ return val; // expected-warning{{variable 'val' is possibly 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}}
+}
+
+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}}
+}
+
+// Test handling of sizeof().
+int test27() {
+ struct test_27 { int x; } *y;
+ return sizeof(y->x); // no-warning
+}
+
+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}}
+}
+
+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 test30() {
+ static int x; // no-warning
+ (void) ^{ (void) x; };
+}
+
+void test31() {
+ __block int x; // no-warning
+ (void) ^{ (void) x; };
+}
+
+int test32_x;
+void test32() {
+ (void) ^{ (void) test32_x; }; // no-warning
+}
+
+void test_33() {
+ int x; // no-warning
+ (void) x;
+}
+
+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}}
+}
+
+// Test that this case doesn't crash.
+void test35(int x) {
+ __block int y = 0;
+ ^{ y = (x == 0); }();
+}
+
+// Test handling of indirect goto.
+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}}
+ L2:
+ goto *pc;
+}
+
+// Test && nested in ||.
+int test37_a();
+int test37_b();
+int test37()
+{
+ int identifier;
+ if ((test37_a() && (identifier = 1)) ||
+ (test37_b() && (identifier = 2))) {
+ return identifier; // no-warning
+ }
+ return 0;
+}
+
+// Test merging of path-specific dataflow values (without asserting).
+int test38(int r, int x, int y)
+{
+ int z;
+ return ((r < 0) || ((r == 0) && (x < y)));
+}
+
diff --git a/test/Sema/unused-expr.c b/test/Sema/unused-expr.c
index 15608ec8a4be..9949887b23e7 100644
--- a/test/Sema/unused-expr.c
+++ b/test/Sema/unused-expr.c
@@ -95,7 +95,7 @@ int t6() {
return 0;
}
-int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_result' attribute only applies to function types}}
+int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_result' attribute only applies to functions}}
// PR4010
int (*fn4)(void) __attribute__ ((warn_unused_result));
@@ -118,3 +118,6 @@ void f(int i, ...) {
__builtin_va_arg(ap, int);
__builtin_va_end(ap);
}
+
+// PR8371
+int fn5() __attribute__ ((__const));
diff --git a/test/Sema/varargs-x86-64.c b/test/Sema/varargs-x86-64.c
index 2cfedc1b37e7..2fe9b10cf78d 100644
--- a/test/Sema/varargs-x86-64.c
+++ b/test/Sema/varargs-x86-64.c
@@ -3,6 +3,6 @@
// rdar://6726818
void f1() {
const __builtin_va_list args2;
- (void)__builtin_va_arg(args2, int); // expected-error {{first argument to 'va_arg' is of type '__builtin_va_list const' and not 'va_list'}}
+ (void)__builtin_va_arg(args2, int); // expected-error {{first argument to 'va_arg' is of type 'const __builtin_va_list' and not 'va_list'}}
}
diff --git a/test/Sema/vector-assign.c b/test/Sema/vector-assign.c
index 05fc3b13db0c..8b0dc9288ee0 100644
--- a/test/Sema/vector-assign.c
+++ b/test/Sema/vector-assign.c
@@ -49,5 +49,5 @@ longlongvec;
void test3a(longlongvec *); // expected-note{{passing argument to parameter here}}
void test3(const unsigned *src) {
- test3a(src); // expected-warning {{incompatible pointer types passing 'unsigned int const *' to parameter of type 'longlongvec *'}}
+ test3a(src); // expected-warning {{incompatible pointer types passing 'const unsigned int *' to parameter of type 'longlongvec *'}}
}
diff --git a/test/Sema/vector-init.c b/test/Sema/vector-init.c
index 8f81adc05ba3..5be040ae6c11 100644
--- a/test/Sema/vector-init.c
+++ b/test/Sema/vector-init.c
@@ -33,3 +33,12 @@ __attribute__((vector_size(16))) float f2(
typedef float __attribute__((ext_vector_type (3))) float3;
int test2[sizeof(float3) == sizeof(float4) ? 1 : -1];
+// rdar://problem/8345836
+typedef long long __attribute__((vector_size(16))) longlong2;
+typedef short __attribute__((vector_size(16))) short8;
+typedef short __attribute__((vector_size(8))) short4;
+void test3() {
+ extern short8 test3_helper(void);
+ longlong2 arr1[2] = { test3_helper(), test3_helper() };
+ short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' with an expression of incompatible type 'short8'}}
+}
diff --git a/test/Sema/warn-shadow.c b/test/Sema/warn-shadow.c
index a112210c9693..32aca8d612b2 100644
--- a/test/Sema/warn-shadow.c
+++ b/test/Sema/warn-shadow.c
@@ -48,3 +48,14 @@ void test4(int i) { // expected-warning {{declaration shadows a variable in the
void test5(int i);
void test6(void (*f)(int i)) {}
void test7(void *context, void (*callback)(void *context)) {}
+
+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 scope}}
+}
diff --git a/test/Sema/warn-unreachable.c b/test/Sema/warn-unreachable.c
index 10ed6961a556..20e0c3172401 100644
--- a/test/Sema/warn-unreachable.c
+++ b/test/Sema/warn-unreachable.c
@@ -35,8 +35,8 @@ void test2() {
dead(); // expected-warning {{will never be executed}}
case 3:
- live() // expected-warning {{will never be executed}}
- +
+ live()
+ + // expected-warning {{will never be executed}}
halt();
dead();
@@ -75,8 +75,8 @@ void test2() {
goto c6;
case 7:
halt()
- + // expected-warning {{will never be executed}}
- dead();
+ +
+ dead(); // expected-warning {{will never be executed}}
- // expected-warning {{will never be executed}}
halt();
case 8:
@@ -98,3 +98,19 @@ void test2() {
}
}
}
+
+enum Cases { C1, C2, C3 };
+int test_enum_cases(enum Cases C) {
+ switch (C) {
+ case C1:
+ case C2:
+ case C3:
+ return 1;
+ default: {
+ int i = 0; // expected-warning{{will never be executed}}
+ ++i;
+ return i;
+ }
+ }
+}
+
diff --git a/test/Sema/warn-unused-function.c b/test/Sema/warn-unused-function.c
index 24d4fade9b31..5bbcf18a623d 100644
--- a/test/Sema/warn-unused-function.c
+++ b/test/Sema/warn-unused-function.c
@@ -47,3 +47,10 @@ static void f12(void);
// PR7923
static void unused(void) { unused(); } // expected-warning{{unused}}
+
+// rdar://8728293
+static void cleanupMalloc(char * const * const allocation) { }
+void f13(void) {
+ char * const __attribute__((cleanup(cleanupMalloc))) a;
+ (void)a;
+}
diff --git a/test/Sema/warn-unused-label.c b/test/Sema/warn-unused-label.c
new file mode 100644
index 000000000000..48370a5fd641
--- /dev/null
+++ b/test/Sema/warn-unused-label.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-label -verify %s
+
+void f() {
+ a:
+ goto a;
+ b: // expected-warning{{unused}}
+ c: __attribute__((unused));
+ d: __attribute__((noreturn)); // expected-warning {{'noreturn' attribute only applies to functions}}
+ goto d;
+ return;
+}
diff --git a/test/Sema/warn-unused-value.c b/test/Sema/warn-unused-value.c
index 1a7e745785b3..876eb9e4823e 100644
--- a/test/Sema/warn-unused-value.c
+++ b/test/Sema/warn-unused-value.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused-value -Wunused-label %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall %s
@@ -52,6 +52,9 @@ void pr4806() {
volatile int* pj = &j;
*pi; // expected-warning {{expression result unused}}
*pj;
+
+ foo_label: // expected-warning {{unused label}}
+ i; // expected-warning {{expression result unused}}
}
// Don't warn about unused '||', '&&' expressions that contain assignments.
diff --git a/test/Sema/warn-write-strings.c b/test/Sema/warn-write-strings.c
index c936a1267bf5..dd0bb8a6d83a 100644
--- a/test/Sema/warn-write-strings.c
+++ b/test/Sema/warn-write-strings.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s
// PR4804
-char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'char const [4]' discards qualifiers}}
+char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'const char [4]' discards qualifiers}}
// PR7192
#include <stddef.h>
diff --git a/test/Sema/x86-attr-force-align-arg-pointer.c b/test/Sema/x86-attr-force-align-arg-pointer.c
index b406a77e044c..5d36e9af195b 100644
--- a/test/Sema/x86-attr-force-align-arg-pointer.c
+++ b/test/Sema/x86-attr-force-align-arg-pointer.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-apple-darwin10 -fsyntax-only -verify %s
-int a __attribute__((force_align_arg_pointer)); // expected-warning{{attribute only applies to function types}}
+int a __attribute__((force_align_arg_pointer)); // expected-warning{{attribute only applies to functions}}
// It doesn't matter where the attribute is located.
void b(void) __attribute__((force_align_arg_pointer));
diff --git a/test/Sema/x86-builtin-palignr.c b/test/Sema/x86-builtin-palignr.c
index eedf99bdfb6f..23443065a43e 100644
--- a/test/Sema/x86-builtin-palignr.c
+++ b/test/Sema/x86-builtin-palignr.c
@@ -1,10 +1,14 @@
-// RUN: %clang_cc1 -fsyntax-only -target-feature +ssse3 -verify %s
-// Temporarily xfail this on windows.
-// XFAIL: win32
+// RUN: %clang_cc1 -ffreestanding -fsyntax-only -target-feature +ssse3 -verify %s
#include <tmmintrin.h>
-__m64 foo(__m64 a, __m64 b, int c)
-{
+__m64 test1(__m64 a, __m64 b, int c) {
return _mm_alignr_pi8(a, b, c); // expected-error {{argument to '__builtin_ia32_palignr' must be a constant integer}}
}
+
+int test2(int N) {
+ __m128i white2;
+ white2 = __builtin_ia32_pslldqi128(white2, N); // expected-error {{argument to '__builtin_ia32_pslldqi128' must be a constant integer}}
+ return 0;
+}
+
diff --git a/test/SemaCUDA/config-type.cu b/test/SemaCUDA/config-type.cu
new file mode 100644
index 000000000000..a469d38d3e93
--- /dev/null
+++ b/test/SemaCUDA/config-type.cu
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void cudaConfigureCall(unsigned gridSize, unsigned blockSize); // expected-error {{must have scalar return type}}
diff --git a/test/SemaCUDA/cuda.h b/test/SemaCUDA/cuda.h
new file mode 100644
index 000000000000..e3aeb99ed220
--- /dev/null
+++ b/test/SemaCUDA/cuda.h
@@ -0,0 +1,19 @@
+/* Minimal declarations for CUDA support. Testing purposes only. */
+
+#include <stddef.h>
+
+#define __constant__ __attribute__((constant))
+#define __device__ __attribute__((device))
+#define __global__ __attribute__((global))
+#define __host__ __attribute__((host))
+#define __shared__ __attribute__((shared))
+
+struct dim3 {
+ unsigned x, y, z;
+ dim3(unsigned x, unsigned y = 1, unsigned z = 1) : x(x), y(y), z(z) {}
+};
+
+typedef struct cudaStream *cudaStream_t;
+
+int cudaConfigureCall(dim3 gridSize, dim3 blockSize, size_t sharedSize = 0,
+ cudaStream_t stream = 0);
diff --git a/test/SemaCUDA/kernel-call.cu b/test/SemaCUDA/kernel-call.cu
new file mode 100644
index 000000000000..6d51695522ce
--- /dev/null
+++ b/test/SemaCUDA/kernel-call.cu
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include "cuda.h"
+
+__global__ void g1(int x) {}
+
+template <typename T> void t1(T arg) {
+ g1<<<arg, arg>>>(1);
+}
+
+int main(void) {
+ g1<<<1, 1>>>(42);
+
+ t1(1);
+}
diff --git a/test/SemaCUDA/qualifiers.cu b/test/SemaCUDA/qualifiers.cu
new file mode 100644
index 000000000000..1346d654b8c4
--- /dev/null
+++ b/test/SemaCUDA/qualifiers.cu
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include "cuda.h"
+
+__global__ void g1(int x) {}
+__global__ int g2(int x) { // expected-error {{must have void return type}}
+ return 1;
+}
diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp
index fb3107f44e97..2bcbbcaeb52d 100644
--- a/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/test/SemaCXX/MicrosoftExtensions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -fexceptions
+// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions -fexceptions
// ::type_info is predeclared with forward class declartion
@@ -30,6 +30,48 @@ struct Derived : Base {
virtual void f3();
};
+
+// MSVC allows type definition in anonymous union and struct
+struct A
+{
+ union
+ {
+ int a;
+ struct B // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
+ {
+ int c;
+ } d;
+
+ union C // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
+ {
+ int e;
+ int ee;
+ } f;
+
+ typedef int D; // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
+ struct F; // expected-warning {{types declared in an anonymous union are a Microsoft extension}}
+ };
+
+ struct
+ {
+ int a2;
+
+ struct B2 // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
+ {
+ int c2;
+ } d2;
+
+ union C2 // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
+ {
+ int e2;
+ int ee2;
+ } f2;
+
+ typedef int D2; // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
+ struct F2; // expected-warning {{types declared in an anonymous struct are a Microsoft extension}}
+ };
+};
+
// __stdcall handling
struct M {
int __stdcall addP();
@@ -42,3 +84,28 @@ void m1() {
h1<int>(&M::addP);
h1(&M::subtractP);
}
+
+//MSVC allows forward enum declaration
+enum ENUM; // expected-warning {{forward references to 'enum' types are a Microsoft extension}}
+ENUM *var = 0;
+ENUM var2 = (ENUM)3;
+enum ENUM1* var3 = 0;// expected-warning {{forward references to 'enum' types are a Microsoft extension}}
+
+
+enum ENUM2 {
+ ENUM2_a = (enum ENUM2) 4,
+ ENUM2_b = 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
+ ENUM2_c = 0x100000000 // expected-warning {{enumerator value is not representable in the underlying type 'int'}}
+};
+
+
+void f(long long);
+void f(int);
+
+int main()
+{
+ // This is an ambiguous call in standard C++.
+ // This calls f(long long) in Microsoft mode because LL is always signed.
+ f(0xffffffffffffffffLL);
+ f(0xffffffffffffffffi64);
+}
diff --git a/test/SemaCXX/PR7944.cpp b/test/SemaCXX/PR7944.cpp
new file mode 100644
index 000000000000..fc52d101e871
--- /dev/null
+++ b/test/SemaCXX/PR7944.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// PR7944
+
+#define MACRO(x) x
+
+struct B { int f() { return 0; } };
+struct A { B* b() { return new B; } };
+
+void g() {
+ A a;
+ MACRO(a.b->f()); // expected-error{{base of member reference has function type}}
+}
diff --git a/test/SemaCXX/PR8012.cpp b/test/SemaCXX/PR8012.cpp
new file mode 100644
index 000000000000..f2f07ad36400
--- /dev/null
+++ b/test/SemaCXX/PR8012.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+void foo (int operator+); // expected-error{{cannot be the name of a parameter}}
diff --git a/test/SemaCXX/PR8755.cpp b/test/SemaCXX/PR8755.cpp
new file mode 100644
index 000000000000..07778ddfc900
--- /dev/null
+++ b/test/SemaCXX/PR8755.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template <typename T>
+struct A {
+ typedef int iterator; // expected-note{{declared here}}
+};
+
+template <typename T>
+void f() {
+ class A <T> ::iterator foo; // expected-error{{elaborated type refers to a typedef}}
+}
+
+void g() {
+ f<int>(); // expected-note{{in instantiation of function template}}
+}
+
diff --git a/test/SemaCXX/PR8884.cpp b/test/SemaCXX/PR8884.cpp
new file mode 100644
index 000000000000..4026465a25fd
--- /dev/null
+++ b/test/SemaCXX/PR8884.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+extern "C" {
+ class bar {
+ friend struct foo;
+ static struct foo& baz ();
+ };
+ struct foo {
+ void zed () {
+ bar::baz();
+ }
+ };
+}
diff --git a/test/SemaCXX/__null.cpp b/test/SemaCXX/__null.cpp
index 3583655134a7..1989a45fb5f2 100644
--- a/test/SemaCXX/__null.cpp
+++ b/test/SemaCXX/__null.cpp
@@ -12,3 +12,10 @@ void f() {
// Verify that null is evaluated as 0.
int b[__null ? -1 : 1];
}
+
+struct A {};
+
+void g() {
+ (void)(0 ? __null : A()); // expected-error {{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(0 ? A(): __null); // expected-error {{non-pointer operand type 'A' incompatible with NULL}}
+}
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp
index ad079c27c001..48805e217b6f 100644
--- a/test/SemaCXX/abstract.cpp
+++ b/test/SemaCXX/abstract.cpp
@@ -9,7 +9,7 @@
#endif
class C {
- virtual void f() = 0; // expected-note {{pure virtual function 'f'}}
+ virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f'}}
};
static_assert(__is_abstract(C), "C has a pure virtual function");
@@ -25,7 +25,7 @@ class E : D {
static_assert(!__is_abstract(E), "E inherits from an abstract class but implements f");
-C *d = new C; // expected-error {{allocation of an object of abstract type 'C'}}
+C *d = new C; // expected-error {{allocating an object of abstract class type 'C'}}
C c; // expected-error {{variable type 'C' is an abstract class}}
void t1(C c); // expected-error {{parameter type 'C' is an abstract class}}
@@ -38,8 +38,8 @@ struct S {
void t3(const C&);
void f() {
- C(); // expected-error {{allocation of an object of abstract type 'C'}}
- t3(C()); // expected-error {{allocation of an object of abstract type 'C'}}
+ C(); // expected-error {{allocating an object of abstract class type 'C'}}
+ t3(C()); // expected-error {{allocating an object of abstract class type 'C'}}
}
C e1[2]; // expected-error {{array of abstract class type 'C'}}
@@ -64,7 +64,7 @@ class F {
void u(F c); // expected-error {{parameter type 'F' is an abstract class}}
};
- virtual void f() = 0; // expected-note {{pure virtual function 'f'}}
+ virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f'}}
};
// Diagnosing in these cases is prohibitively expensive. We still
@@ -193,14 +193,14 @@ namespace test1 {
// rdar://problem/8302168
namespace test2 {
struct X1 {
- virtual void xfunc(void) = 0; // expected-note {{pure virtual function}}
+ virtual void xfunc(void) = 0; // expected-note {{unimplemented pure virtual method}}
void g(X1 parm7); // expected-error {{parameter type 'test2::X1' is an abstract class}}
void g(X1 parm8[2]); // expected-error {{array of abstract class type 'test2::X1'}}
};
template <int N>
struct X2 {
- virtual void xfunc(void) = 0; // expected-note {{pure virtual function}}
+ virtual void xfunc(void) = 0; // expected-note {{unimplemented pure virtual method}}
void g(X2 parm10); // expected-error {{parameter type 'X2<N>' is an abstract class}}
void g(X2 parm11[2]); // expected-error {{array of abstract class type 'X2<N>'}}
};
@@ -219,11 +219,11 @@ namespace test3 {
struct C {
static C x; // expected-error {{abstract class}}
- virtual void abstract() = 0; // expected-note {{pure virtual function}}
+ virtual void abstract() = 0; // expected-note {{unimplemented pure virtual method}}
};
struct D {
- virtual void abstract() = 0; // expected-note {{pure virtual function}}
+ virtual void abstract() = 0; // expected-note {{unimplemented pure virtual method}}
static D x; // expected-error {{abstract class}}
};
}
@@ -231,21 +231,21 @@ namespace test3 {
namespace test4 {
template <class T> struct A {
A x; // expected-error {{abstract class}}
- virtual void abstract() = 0; // expected-note {{pure virtual function}}
+ virtual void abstract() = 0; // expected-note {{unimplemented pure virtual method}}
};
template <class T> struct B {
- virtual void abstract() = 0; // expected-note {{pure virtual function}}
+ virtual void abstract() = 0; // expected-note {{unimplemented pure virtual method}}
B x; // expected-error {{abstract class}}
};
template <class T> struct C {
static C x; // expected-error {{abstract class}}
- virtual void abstract() = 0; // expected-note {{pure virtual function}}
+ virtual void abstract() = 0; // expected-note {{unimplemented pure virtual method}}
};
template <class T> struct D {
- virtual void abstract() = 0; // expected-note {{pure virtual function}}
+ virtual void abstract() = 0; // expected-note {{unimplemented pure virtual method}}
static D x; // expected-error {{abstract class}}
};
}
diff --git a/test/SemaCXX/addr-of-overloaded-function-casting.cpp b/test/SemaCXX/addr-of-overloaded-function-casting.cpp
new file mode 100644
index 000000000000..cfd55eed81d5
--- /dev/null
+++ b/test/SemaCXX/addr-of-overloaded-function-casting.cpp
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+void g();
+
+void f(); // expected-note 9{{candidate function}}
+void f(int); // expected-note 9{{candidate function}}
+
+template<class T> void t(T); // expected-note 6{{candidate function}}
+template<class T> void t(T*); // expected-note 6{{candidate function}}
+
+template<class T> void u(T);
+
+int main()
+{
+ { bool b = (void (&)(char))f; } // expected-error{{does not match required type}}
+ { bool b = (void (*)(char))f; } // expected-error{{does not match required type}}
+
+ { bool b = (void (&)(int))f; } //ok
+ { bool b = (void (*)(int))f; } //ok
+
+ { bool b = static_cast<void (&)(char)>(f); } // expected-error{{does not match}}
+ { bool b = static_cast<void (*)(char)>(f); } // expected-error{{address of overloaded function}}
+
+ { bool b = static_cast<void (&)(int)>(f); } //ok
+ { bool b = static_cast<void (*)(int)>(f); } //ok
+
+
+ { bool b = reinterpret_cast<void (&)(char)>(f); } // expected-error{{cannot resolve}}
+ { bool b = reinterpret_cast<void (*)(char)>(f); } // expected-error{{cannot resolve}}
+
+ { bool b = reinterpret_cast<void (*)(char)>(g); } //ok
+ { bool b = static_cast<void (*)(char)>(g); } // expected-error{{not allowed}}
+
+ { bool b = reinterpret_cast<void (&)(int)>(f); } // expected-error{{cannot resolve}}
+ { bool b = reinterpret_cast<void (*)(int)>(f); } // expected-error{{cannot resolve}}
+
+ { bool b = (int (&)(char))t; } // expected-error{{does not match}}
+ { bool b = (int (*)(char))t; } // expected-error{{does not match}}
+
+ { bool b = (void (&)(int))t; } //ok
+ { bool b = (void (*)(int))t; } //ok
+
+ { bool b = static_cast<void (&)(char)>(t); } //ok
+ { bool b = static_cast<void (*)(char)>(t); } //ok
+
+ { bool b = static_cast<void (&)(int)>(t); } //ok
+ { bool b = static_cast<void (*)(int)>(t); } //ok
+
+
+ { bool b = reinterpret_cast<void (&)(char)>(t); } // expected-error{{cannot resolve}}
+ { bool b = reinterpret_cast<void (*)(char)>(t); } // expected-error{{cannot resolve}}
+
+ { bool b = reinterpret_cast<int (*)(char)>(g); } //ok
+ { bool b = static_cast<int (*)(char)>(t); } // expected-error{{cannot be static_cast}}
+ { bool b = static_cast<int (&)(char)>(t); } // expected-error{{does not match required}}
+
+ { bool b = static_cast<void (&)(char)>(f); } // expected-error{{does not match}}
+}
diff --git a/test/SemaCXX/addr-of-overloaded-function.cpp b/test/SemaCXX/addr-of-overloaded-function.cpp
index b581b8a3f649..a1079ff5bac6 100644
--- a/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-int f(double);
-int f(int);
+int f(double); // expected-note{{candidate function}}
+int f(int); // expected-note{{candidate function}}
int (*pfd)(double) = f; // selects f(double)
int (*pfd2)(double) = &f; // selects f(double)
@@ -9,7 +9,7 @@ int (*pfi)(int) = &f; // selects f(int)
// FIXME: This error message is not very good. We need to keep better
// track of what went wrong when the implicit conversion failed to
// give a better error message here.
-int (*pfe)(...) = &f; // expected-error{{cannot initialize a variable of type 'int (*)(...)' with an rvalue of type '<overloaded function type>'}}
+int (*pfe)(...) = &f; // expected-error{{address of overloaded function 'f' does not match required type 'int (...)'}}
int (&rfi)(int) = f; // selects f(int)
int (&rfd)(double) = f; // selects f(double)
@@ -57,11 +57,11 @@ struct B
struct C {
C &getC() {
- return makeAC; // expected-error{{address of overloaded function 'makeAC' cannot be converted to type 'C'}}
+ return makeAC; // expected-error{{address of overloaded function 'makeAC'}}
}
- C &makeAC();
- const C &makeAC() const;
+ C &makeAC(); //expected-note{{candidate function}}
+ const C &makeAC() const; //expected-note{{candidate function}}
static void f(); // expected-note{{candidate function}}
static void f(int); // expected-note{{candidate function}}
@@ -96,3 +96,52 @@ namespace PR7971 {
static bool g(int, char);
};
}
+
+namespace PR8033 {
+ template <typename T1, typename T2> int f(T1 *, const T2 *); // expected-note 2{{candidate function [with T1 = const int, T2 = int]}}
+ template <typename T1, typename T2> int f(const T1 *, T2 *); // expected-note 2{{candidate function [with T1 = int, T2 = const int]}}
+ int (*p)(const int *, const int *) = f; // expected-error{{address of overloaded function 'f' is ambiguous}} \
+ // expected-error{{address of overloaded function 'f' is ambiguous}}
+
+}
+
+namespace PR8196 {
+ template <typename T> struct mcdata {
+ typedef int result_type;
+ };
+ template <class T>
+ typename mcdata<T>::result_type wrap_mean(mcdata<T> const&);
+ void add_property(double(*)(mcdata<double> const &)); // expected-note{{candidate function not viable: no overload of 'wrap_mean' matching}}
+ void f() {
+ add_property(&wrap_mean); // expected-error{{no matching function for call to 'add_property'}}
+ }
+}
+
+namespace PR7425 {
+ template<typename T>
+ void foo()
+ {
+ }
+
+ struct B
+ {
+ template<typename T>
+ B(const T&)
+ {
+ }
+ };
+
+ void bar(const B& b)
+ {
+ }
+
+ void bar2(const B& b = foo<int>)
+ {
+ }
+
+ void test(int argc, char** argv)
+ {
+ bar(foo<int>);
+ bar2();
+ }
+}
diff --git a/test/SemaCXX/address-of-temporary.cpp b/test/SemaCXX/address-of-temporary.cpp
index decdc955b664..eb5dee50598e 100644
--- a/test/SemaCXX/address-of-temporary.cpp
+++ b/test/SemaCXX/address-of-temporary.cpp
@@ -5,8 +5,8 @@ struct X {
X(int, int);
};
-void *f0() { return &X(); } // expected-warning{{taking the address of a temporary object}}
-void *f1() { return &X(1); } // expected-warning{{taking the address of a temporary object}}
-void *f2() { return &X(1, 2); } // expected-warning{{taking the address of a temporary object}}
-void *f3() { return &(X)1; } // expected-warning{{taking the address of a temporary object}}
+void f0() { (void)&X(); } // expected-warning{{taking the address of a temporary object}}
+void f1() { (void)&X(1); } // expected-warning{{taking the address of a temporary object}}
+void f2() { (void)&X(1, 2); } // expected-warning{{taking the address of a temporary object}}
+void f3() { (void)&(X)1; } // expected-warning{{taking the address of a temporary object}}
diff --git a/test/SemaCXX/alignof-sizeof-reference.cpp b/test/SemaCXX/alignof-sizeof-reference.cpp
index dd64d6a23ae3..761edfc6393a 100644
--- a/test/SemaCXX/alignof-sizeof-reference.cpp
+++ b/test/SemaCXX/alignof-sizeof-reference.cpp
@@ -11,5 +11,5 @@ void test() {
void f();
void f(int);
void g() {
- sizeof(&f); // expected-error{{invalid application of 'sizeof' to an overloaded function}}
+ sizeof(&f); // expected-error{{cannot resolve overloaded function from context}}
}
diff --git a/test/SemaCXX/altivec.cpp b/test/SemaCXX/altivec.cpp
index cdfc00a5d43a..921bb73f9ead 100644
--- a/test/SemaCXX/altivec.cpp
+++ b/test/SemaCXX/altivec.cpp
@@ -6,13 +6,33 @@ void f(V4i a)
{
}
-void test()
+void test1()
{
V4i vGCC;
vector int vAltiVec;
f(vAltiVec);
vGCC = vAltiVec;
- vGCC = vGCC > vAltiVec;
+ bool res = vGCC > vAltiVec;
vAltiVec = 0 ? vGCC : vGCC;
}
+
+template<typename T>
+void template_f(T param) {
+ param++;
+}
+
+void test2()
+{
+ vector int vi;
+ ++vi;
+ vi++;
+ --vi;
+ vi--;
+ vector float vf;
+ vf++;
+
+ ++vi=vi;
+ (++vi)[1]=1;
+ template_f(vi);
+}
diff --git a/test/SemaCXX/ambig-user-defined-conversions.cpp b/test/SemaCXX/ambig-user-defined-conversions.cpp
index fdb399b03a21..bf45e5d4d888 100644
--- a/test/SemaCXX/ambig-user-defined-conversions.cpp
+++ b/test/SemaCXX/ambig-user-defined-conversions.cpp
@@ -20,7 +20,7 @@ namespace test0 {
const int Test1() {
func(b1, f()); // expected-error {{call to 'func' is ambiguous}}
- return f(); // expected-error {{conversion from 'test0::B' to 'int const' is ambiguous}}
+ return f(); // expected-error {{conversion from 'test0::B' to 'const int' is ambiguous}}
}
// This used to crash when comparing the two operands.
@@ -57,3 +57,11 @@ namespace test1 {
}
}
+namespace rdar8876150 {
+ struct A { operator bool(); };
+ struct B : A { };
+ struct C : A { };
+ struct D : B, C { };
+
+ bool f(D d) { return !d; } // expected-error{{ambiguous conversion from derived class 'rdar8876150::D' to base class 'rdar8876150::A':}}
+}
diff --git a/test/SemaCXX/ambiguous-builtin-unary-operator.cpp b/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
index 1aa09a6827a0..836e319f8404 100644
--- a/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
+++ b/test/SemaCXX/ambiguous-builtin-unary-operator.cpp
@@ -28,7 +28,7 @@ struct C1 : B1, A1 { };
void test(C1 c) {
++c; // expected-error {{use of overloaded operator '++' is ambiguous}} \
- // expected-note {{built-in candidate operator++(int volatile &)}} \
- // expected-note {{built-in candidate operator++(long volatile &)}}
+ // expected-note {{built-in candidate operator++(volatile int &)}} \
+ // expected-note {{built-in candidate operator++(volatile long &)}}
}
diff --git a/test/SemaCXX/anonymous-union.cpp b/test/SemaCXX/anonymous-union.cpp
index 5f84bcca28db..553ae658e53b 100644
--- a/test/SemaCXX/anonymous-union.cpp
+++ b/test/SemaCXX/anonymous-union.cpp
@@ -155,3 +155,23 @@ namespace test4 {
(void) a.us1; // expected-error {{private member}}
}
}
+
+typedef void *voidPtr;
+
+void f2() {
+ union { int **ctxPtr; void **voidPtr; };
+}
+
+void foo_PR6741() {
+ union {
+ char *m_a;
+ int *m_b;
+ };
+
+ if(1) {
+ union {
+ char *m_a;
+ int *m_b;
+ };
+ }
+}
diff --git a/test/SemaCXX/array-bounds.cpp b/test/SemaCXX/array-bounds.cpp
new file mode 100644
index 000000000000..0286c01d85ff
--- /dev/null
+++ b/test/SemaCXX/array-bounds.cpp
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -verify %s
+
+int foo() {
+ int x[2]; // expected-note 4 {{array 'x' declared here}}
+ int y[2]; // expected-note 2 {{array 'y' declared here}}
+ int *p = &y[2]; // no-warning
+ (void) sizeof(x[2]); // no-warning
+ y[2] = 2; // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}}
+ return x[2] + // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}}
+ y[-1] + // expected-warning {{array index of '-1' indexes before the beginning of the array}}
+ x[sizeof(x)] + // expected-warning {{array index of '8' indexes past the end of an array (that contains 2 elements)}}
+ x[sizeof(x) / sizeof(x[0])] + // expected-warning {{array index of '2' indexes past the end of an array (that contains 2 elements)}}
+ x[sizeof(x) / sizeof(x[0]) - 1] + // no-warning
+ x[sizeof(x[2])]; // expected-warning {{array index of '4' indexes past the end of an array (that contains 2 elements)}}
+}
+
+// This code example tests that -Warray-bounds works with arrays that
+// are template parameters.
+template <char *sz> class Qux {
+ bool test() { return sz[0] == 'a'; }
+};
+
+void f1(int a[1]) {
+ int val = a[3]; // no warning for function argumnet
+}
+
+void f2(const int (&a)[1]) { // expected-note {{declared here}}
+ int val = a[3]; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 elements)}}
+}
+
+void test() {
+ struct {
+ int a[0];
+ } s2;
+ s2.a[3] = 0; // no warning for 0-sized array
+
+ union {
+ short a[2]; // expected-note {{declared here}}
+ char c[4];
+ } u;
+ u.a[3] = 1; // expected-warning {{array index of '3' indexes past the end of an array (that contains 2 elements)}}
+ u.c[3] = 1; // no warning
+
+ const int const_subscript = 3;
+ int array[1]; // expected-note {{declared here}}
+ array[const_subscript] = 0; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 elements)}}
+
+ int *ptr;
+ ptr[3] = 0; // no warning for pointer references
+ int array2[] = { 0, 1, 2 }; // expected-note 2 {{declared here}}
+
+ array2[3] = 0; // expected-warning {{array index of '3' indexes past the end of an array (that contains 3 elements)}}
+ array2[2+2] = 0; // expected-warning {{array index of '4' indexes past the end of an array (that contains 3 elements)}}
+
+ const char *str1 = "foo";
+ char c1 = str1[5]; // no warning for pointers
+
+ const char str2[] = "foo"; // expected-note {{declared here}}
+ char c2 = str2[5]; // expected-warning {{array index of '5' indexes past the end of an array (that contains 4 elements)}}
+
+ int (*array_ptr)[1];
+ (*array_ptr)[3] = 1; // expected-warning {{array index of '3' indexes past the end of an array (that contains 1 elements)}}
+}
+
+template <int I> struct S {
+ char arr[I]; // expected-note 3 {{declared here}}
+};
+template <int I> void f() {
+ S<3> s;
+ s.arr[4] = 0; // expected-warning 2 {{array index of '4' indexes past the end of an array (that contains 3 elements)}}
+ s.arr[I] = 0; // expected-warning {{array index of '5' indexes past the end of an array (that contains 3 elements)}}
+}
+
+void test_templates() {
+ f<5>(); // expected-note {{in instantiation}}
+}
+
+#define SIZE 10
+#define ARR_IN_MACRO(flag, arr, idx) flag ? arr[idx] : 1
+
+int test_no_warn_macro_unreachable() {
+ int arr[SIZE]; // expected-note 2 {{array 'arr' declared here}}
+ // FIXME: We don't want to warn for the first case.
+ return ARR_IN_MACRO(0, arr, SIZE) + // expected-warning{{array index of '10' indexes past the end of an array (that contains 10 elements)}}
+ ARR_IN_MACRO(1, arr, SIZE); // expected-warning{{array index of '10' indexes past the end of an array (that contains 10 elements)}}
+}
+
+// This exhibited an assertion failure for a 32-bit build of Clang.
+int test_pr9240() {
+ short array[100]; // expected-note {{array 'array' declared here}}
+ return array[(unsigned long long) 100]; // expected-warning {{array index of '100' indexes past the end of an array (that contains 100 elements)}}
+}
+
diff --git a/test/SemaCXX/arrow-operator.cpp b/test/SemaCXX/arrow-operator.cpp
index 29b23edad3a1..6535a0a2f201 100644
--- a/test/SemaCXX/arrow-operator.cpp
+++ b/test/SemaCXX/arrow-operator.cpp
@@ -23,3 +23,16 @@ void f(C &c, D& d, E& e) {
d->f();
e->f(); // expected-error{{incomplete definition of type}}
}
+
+// rdar://8875304
+namespace rdar8875304 {
+class Point {};
+class Line_Segment{ public: Line_Segment(const Point&){} };
+class Node { public: Point Location(){ Point p; return p; } };
+
+void f()
+{
+ Node** node1;
+ Line_Segment(node1->Location()); // expected-error {{not a structure or union}}
+}
+}
diff --git a/test/SemaCXX/attr-cxx0x.cpp b/test/SemaCXX/attr-cxx0x.cpp
index 8fbf50c26ec1..40fe0e01c2e6 100644
--- a/test/SemaCXX/attr-cxx0x.cpp
+++ b/test/SemaCXX/attr-cxx0x.cpp
@@ -1,16 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
-int final_fail [[final]]; //expected-error {{'final' attribute only applies to virtual method or class types}}
-
-struct [[final]] final_base { }; // expected-note {{'final_base' declared here}}
-struct final_child : final_base { }; // expected-error {{derivation from 'final' struct final_base}}
-
-struct final_member { virtual void quux [[final]] (); }; // expected-note {{overridden virtual function is here}}
-struct final_override : final_member { virtual void quux (); }; // expected-error {{declaration of 'quux' overrides a 'final' function}}
-
int align_illegal [[align(3)]]; //expected-error {{requested alignment is not a power of 2}}
char align_big [[align(int)]];
-int align_small [[align(1)]];
+int align_small [[align(1)]]; // FIXME: this should be rejected
int align_multiple [[align(1), align(8), align(1)]];
struct align_member {
@@ -18,19 +10,7 @@ struct align_member {
};
static_assert(alignof(align_big) == alignof(int), "k's alignment is wrong");
-static_assert(alignof(align_small) == alignof(int), "j's alignment is wrong");
+static_assert(alignof(align_small) == 1, "j's alignment is wrong");
static_assert(alignof(align_multiple) == 8, "l's alignment is wrong");
static_assert(alignof(align_member) == 8, "quuux's alignment is wrong");
static_assert(sizeof(align_member) == 8, "quuux's size is wrong");
-
-int bc_fail [[base_check]]; // expected-error {{'base_check' attribute only applies to class types}}
-int hiding_fail [[hiding]]; // expected-error {{'hiding' attribute only applies to member types}}
-int override_fail [[override]]; // expected-error {{'override' attribute only applies to virtual method types}}
-
-struct base {
- virtual void function();
- virtual void other_function();
-};
-
-struct [[base_check, base_check]] bc : base { // expected-error {{'base_check' attribute cannot be repeated}}
-};
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
index 2164f9dd17f2..fe7c833d322b 100644
--- a/test/SemaCXX/attr-deprecated.cpp
+++ b/test/SemaCXX/attr-deprecated.cpp
@@ -190,3 +190,46 @@ namespace test5 {
{}
};
}
+
+// rdar://problem/8518751
+namespace test6 {
+ enum __attribute__((deprecated)) A {
+ a0
+ };
+ void testA() {
+ A x; // expected-warning {{'A' is deprecated}}
+ x = a0;
+ }
+
+ enum B {
+ b0 __attribute__((deprecated)),
+ b1
+ };
+ void testB() {
+ B x;
+ x = b0; // expected-warning {{'b0' is deprecated}}
+ x = b1;
+ }
+
+ template <class T> struct C {
+ enum __attribute__((deprecated)) Enum {
+ c0
+ };
+ };
+ void testC() {
+ C<int>::Enum x; // expected-warning {{'Enum' is deprecated}}
+ x = C<int>::c0;
+ }
+
+ template <class T> struct D {
+ enum Enum {
+ d0,
+ d1 __attribute__((deprecated)),
+ };
+ };
+ void testD() {
+ D<int>::Enum x;
+ x = D<int>::d0;
+ x = D<int>::d1; // expected-warning {{'d1' is deprecated}}
+ }
+}
diff --git a/test/SemaCXX/attr-format.cpp b/test/SemaCXX/attr-format.cpp
index 0c1eb53ea07f..da134a136d26 100644
--- a/test/SemaCXX/attr-format.cpp
+++ b/test/SemaCXX/attr-format.cpp
@@ -1,8 +1,35 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wformat-nonliteral -verify %s
struct S {
static void f(const char*, ...) __attribute__((format(printf, 1, 2)));
+ static const char* f2(const char*) __attribute__((format_arg(1)));
// GCC has a hidden 'this' argument in member functions which is why
// the format argument is argument 2 here.
void g(const char*, ...) __attribute__((format(printf, 2, 3)));
+ const char* g2(const char*) __attribute__((format_arg(2)));
+
+ void h(const char*, ...) __attribute__((format(printf, 1, 4))); // \
+ expected-error{{implicit this argument as the format string}}
+ void h2(const char*, ...) __attribute__((format(printf, 2, 1))); // \
+ expected-error{{out of bounds}}
+ const char* h3(const char*) __attribute__((format_arg(1))); // \
+ expected-error{{invalid for the implicit this argument}}
};
+
+// PR5521
+struct A { void a(const char*,...) __attribute((format(printf,2,3))); };
+void b(A x) {
+ x.a("%d", 3);
+}
+
+// PR8625: correctly interpret static member calls as not having an implicit
+// 'this' argument.
+namespace PR8625 {
+ struct S {
+ static void f(const char*, const char*, ...)
+ __attribute__((format(printf, 2, 3)));
+ };
+ void test(S s, const char* str) {
+ s.f(str, "%s", str);
+ }
+}
diff --git a/test/SemaCXX/attr-nonnull.cpp b/test/SemaCXX/attr-nonnull.cpp
new file mode 100644
index 000000000000..19d6642eb553
--- /dev/null
+++ b/test/SemaCXX/attr-nonnull.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+struct S {
+ static void f(const char*, const char*) __attribute__((nonnull(1)));
+
+ // GCC has a hidden 'this' argument in member functions, so the middle
+ // argument is the one that must not be null.
+ void g(const char*, const char*, const char*) __attribute__((nonnull(3)));
+
+ void h(const char*) __attribute__((nonnull(1))); // \
+ expected-error{{invalid for the implicit this argument}}
+};
+
+void test(S s) {
+ s.f(0, ""); // expected-warning{{null passed}}
+ s.f("", 0);
+ s.g("", 0, ""); // expected-warning{{null passed}}
+ s.g(0, "", 0);
+}
+
+namespace rdar8769025 {
+ __attribute__((nonnull)) void f0(int *&p);
+ __attribute__((nonnull)) void f1(int * const &p);
+ __attribute__((nonnull(2))) void f2(int i, int * const &p);
+
+ void test_f1() {
+ f1(0); // expected-warning{{null passed to a callee which requires a non-null argument}}
+ f2(0, 0); // expected-warning{{null passed to a callee which requires a non-null argument}}
+ }
+}
diff --git a/test/SemaCXX/attr-weak.cpp b/test/SemaCXX/attr-weak.cpp
new file mode 100644
index 000000000000..b6a9e0aa840c
--- /dev/null
+++ b/test/SemaCXX/attr-weak.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
+
+static int test0 __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
+static void test1() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
+
+namespace test2 __attribute__((weak)) { // expected-warning {{'weak' attribute only applies to variables and functions}}
+}
+
+namespace {
+ int test3 __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
+ void test4() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
+}
+
+struct Test5 {
+ static void test5() __attribute__((weak)); // no error
+};
+
+namespace {
+ struct Test6 {
+ static void test6() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
+ };
+}
+
+template <class T> struct Test7 {
+ void test7() __attribute__((weak)) {}
+};
+namespace { class Internal; }
+template struct Test7<Internal>;
+template struct Test7<int>;
diff --git a/test/SemaCXX/attr-weakref.cpp b/test/SemaCXX/attr-weakref.cpp
index 5773acc1ab3f..a34579198fef 100644
--- a/test/SemaCXX/attr-weakref.cpp
+++ b/test/SemaCXX/attr-weakref.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
// GCC will accept anything as the argument of weakref. Should we
// check for an existing decl?
@@ -24,8 +24,8 @@ class c {
static int a __attribute__((weakref ("v2"))); // expected-error {{declaration of 'a' must be in a global context}}
static int b() __attribute__((weakref ("f3"))); // expected-error {{declaration of 'b' must be in a global context}}
};
-int a7() __attribute__((weakref ("f1"))); // expected-error {{declaration of 'a7' must be static}}
-int a8 __attribute__((weakref ("v1"))); // expected-error {{declaration of 'a8' must be static}}
+int a7() __attribute__((weakref ("f1"))); // expected-error {{weakref declaration must have internal linkage}}
+int a8 __attribute__((weakref ("v1"))); // expected-error {{weakref declaration must have internal linkage}}
// gcc accepts this
-int a9 __attribute__((weakref)); // expected-error {{declaration of 'a9' must be static}}
+int a9 __attribute__((weakref)); // expected-error {{weakref declaration must have internal linkage}}
diff --git a/test/SemaCXX/block-call.cpp b/test/SemaCXX/block-call.cpp
new file mode 100644
index 000000000000..d519911589a7
--- /dev/null
+++ b/test/SemaCXX/block-call.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -x c++ -fsyntax-only -verify %s -fblocks
+
+int (*FP)();
+int (^IFP) ();
+int (^II) (int);
+int main() {
+ int (*FPL) (int) = FP; // expected-error {{cannot initialize a variable of type 'int (*)(int)' with an lvalue of type 'int (*)()'}}
+
+ // For Blocks, the ASTContext::typesAreBlockCompatible() makes sure this is an error.
+ int (^PFR) (int) = IFP; // expected-error {{cannot initialize a variable of type 'int (^)(int)' with an lvalue of type 'int (^)()'}}
+ PFR = II; // OK
+
+ int (^IFP) () = PFR; // OK
+
+
+ const int (^CIC) () = IFP; // OK - initializing 'const int (^)()' with an expression of type 'int (^)()'}}
+
+ const int (^CICC) () = CIC;
+
+
+ int * const (^IPCC) () = 0;
+
+ int * const (^IPCC1) () = IPCC;
+
+ int * (^IPCC2) () = IPCC; // expected-error {{cannot initialize a variable of type 'int *(^)()' with an lvalue of type 'int *const (^)()'}}
+
+ int (^IPCC3) (const int) = PFR;
+
+ int (^IPCC4) (int, char (^CArg) (double));
+
+ int (^IPCC5) (int, char (^CArg) (double)) = IPCC4;
+
+ int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{cannot initialize a variable of type 'int (^)(int, char (^)(float))' with an lvalue of type}}
+
+ IPCC2 = 0;
+ IPCC2 = 1;
+ int (^x)() = 0;
+ int (^y)() = 3; // expected-error {{cannot initialize a variable of type 'int (^)()' with an rvalue of type 'int'}}
+ int a = 1;
+ int (^z)() = a+4; // expected-error {{cannot initialize a variable of type 'int (^)()' with an rvalue of type 'int'}}
+}
+
+int blah() {
+ int (^IFP) (float);
+ char (^PCP)(double, double, char);
+
+ IFP(1.0);
+ IFP (1.0, 2.0); // expected-error {{too many arguments to block call}}
+
+ char ch = PCP(1.0, 2.0, 'a');
+ return PCP(1.0, 2.0); // expected-error {{too few arguments to block}}
+}
diff --git a/test/SemaCXX/borland-extensions.cpp b/test/SemaCXX/borland-extensions.cpp
index c33527c7a03b..483153004dcb 100644
--- a/test/SemaCXX/borland-extensions.cpp
+++ b/test/SemaCXX/borland-extensions.cpp
@@ -24,3 +24,30 @@ void m2() {
i = h2<int>(&M::addP);
f = h2(&M::subtractP);
}
+
+// 3. test other calling conventions
+int _cdecl fa3();
+int _fastcall fc3();
+int _stdcall fd3();
+
+// 4. test __uuidof()
+typedef struct _GUID {
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[ 8 ];
+} GUID;
+
+struct __declspec(uuid("{12345678-1234-1234-1234-123456789abc}")) Foo;
+struct Data {
+ GUID const* Guid;
+};
+
+void t4() {
+ unsigned long data;
+
+ const GUID guid_inl = __uuidof(Foo);
+ Data ata1 = { &guid_inl};
+ data = ata1.Guid->Data1;
+}
+
diff --git a/test/SemaCXX/builtin-ptrtomember-ambig.cpp b/test/SemaCXX/builtin-ptrtomember-ambig.cpp
index 3e0dfbb48eda..32a893dafcef 100644
--- a/test/SemaCXX/builtin-ptrtomember-ambig.cpp
+++ b/test/SemaCXX/builtin-ptrtomember-ambig.cpp
@@ -19,9 +19,9 @@ struct C : B {
void foo(C c, int A::* pmf) {
// FIXME. Why so many built-in candidates?
int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \
- // expected-note {{built-in candidate operator->*(struct A const *, int const struct A::*)}} \
- // expected-note {{built-in candidate operator->*(struct A const *, int struct A::*)}} \
- // expected-note {{built-in candidate operator->*(struct A *, int const struct A::*)}} \
+ // expected-note {{built-in candidate operator->*(const struct A *, const int struct A::*)}} \
+ // expected-note {{built-in candidate operator->*(const struct A *, int struct A::*)}} \
+ // expected-note {{built-in candidate operator->*(struct A *, const int struct A::*)}} \
// expected-note {{built-in candidate operator->*(struct A *, int struct A::*)}}
}
diff --git a/test/SemaCXX/builtin_objc_msgSend.cpp b/test/SemaCXX/builtin_objc_msgSend.cpp
new file mode 100644
index 000000000000..0e90d54f804f
--- /dev/null
+++ b/test/SemaCXX/builtin_objc_msgSend.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar://8686888
+
+typedef struct objc_selector *SEL;
+typedef struct objc_object *id;
+
+extern "C" __attribute__((visibility("default"))) id objc_msgSend(id self, SEL op, ...)
+ __attribute__((visibility("default")));
+
+inline void TCFReleaseGC(void * object)
+{
+ static SEL SEL_release;
+ objc_msgSend((id)object, SEL_release);
+}
diff --git a/test/SemaCXX/c99-variable-length-array.cpp b/test/SemaCXX/c99-variable-length-array.cpp
index 7dc912a0d5f6..98df1dbfe81e 100644
--- a/test/SemaCXX/c99-variable-length-array.cpp
+++ b/test/SemaCXX/c99-variable-length-array.cpp
@@ -114,3 +114,10 @@ namespace rdar8021385 {
};
B<A> a;
}
+
+namespace PR8209 {
+ void f(int n) {
+ typedef int vla_type[n]; // expected-warning{{variable length arrays are a C99 feature, accepted as an extension}}
+ (void)new vla_type; // expected-error{{variably}}
+ }
+}
diff --git a/test/SemaCXX/c99.cpp b/test/SemaCXX/c99.cpp
index b0bd45dea3d1..cda069cf47fc 100644
--- a/test/SemaCXX/c99.cpp
+++ b/test/SemaCXX/c99.cpp
@@ -1,3 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
void f1(int i[static 5]) { // expected-error{{C99}}
}
+
+struct Point { int x; int y; };
+
+Point p1 = { .x = 17, // expected-warning{{designated initializers are a C99 feature, accepted in C++ as an extension}}
+ y: 25 }; // expected-warning{{designated initializers are a C99 feature, accepted in C++ as an extension}} \
+ // expected-warning{{use of GNU old-style field designator extension}}
diff --git a/test/SemaCXX/cast-conversion.cpp b/test/SemaCXX/cast-conversion.cpp
index d68e789c370f..80707d13d20b 100644
--- a/test/SemaCXX/cast-conversion.cpp
+++ b/test/SemaCXX/cast-conversion.cpp
@@ -8,14 +8,14 @@ struct A {
A(R);
};
-struct B {
- B(A);
+struct B { // expected-note 3 {{candidate constructor (the implicit copy constructor) not viable}}
+ B(A); // expected-note 3 {{candidate constructor not viable}}
};
int main () {
- B(10); // expected-error {{functional-style cast from 'int' to 'B' is not allowed}}
- (B)10; // expected-error {{C-style cast from 'int' to 'B' is not allowed}}
- static_cast<B>(10); // expected-error {{static_cast from 'int' to 'B' is not allowed}} \\
+ B(10); // expected-error {{no matching conversion for functional-style cast from 'int' to 'B'}}
+ (B)10; // expected-error {{no matching conversion for C-style cast from 'int' to 'B'}}
+ static_cast<B>(10); // expected-error {{no matching conversion for static_cast from 'int' to 'B'}} \\
// expected-warning {{expression result unused}}
}
diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp
index 9d9508b8ef4a..52140cb0743d 100644
--- a/test/SemaCXX/class.cpp
+++ b/test/SemaCXX/class.cpp
@@ -12,16 +12,18 @@ public:
}
class NestedC {
+ public:
+ NestedC(int);
void m() {
sx = 0;
- x = 0; // expected-error {{error: invalid use of nonstatic data member 'x'}}
+ x = 0; // expected-error {{invalid use of nonstatic data member 'x'}}
}
};
int b : 1, w : 2;
int : 1, : 2;
typedef int E : 1; // expected-error {{typedef member 'E' cannot be a bit-field}}
- static int sb : 1; // expected-error {{error: static member 'sb' cannot be a bit-field}}
+ static int sb : 1; // expected-error {{static member 'sb' cannot be a bit-field}}
static int vs;
typedef int func();
@@ -32,10 +34,10 @@ public:
enum E1 { en1, en2 };
- int i = 0; // expected-error {{error: 'i' can only be initialized if it is a static const integral data member}}
- static int si = 0; // expected-error {{error: 'si' can only be initialized if it is a static const integral data member}}
- static const NestedC ci = 0; // expected-error {{error: 'ci' can only be initialized if it is a static const integral data member}}
- static const int nci = vs; // expected-error {{in-class initializer is not an integral constant expression}}
+ int i = 0; // expected-error {{fields can only be initialized in constructors}}
+ static int si = 0; // expected-error {{non-const static data member must be initialized out of line}}
+ static const NestedC ci = 0; // expected-error {{static data member of type 'const C::NestedC' must be initialized out of line}}
+ static const int nci = vs; // expected-error {{in-class initializer is not a constant expression}}
static const int vi = 0;
static const E evi = 0;
@@ -89,7 +91,7 @@ struct C3 {
void f()
{
const C3 c3 = { 1, 2 };
- (void)static_cast<int*>(&c3.i); // expected-error {{static_cast from 'int const *' to 'int *' is not allowed}}
+ (void)static_cast<int*>(&c3.i); // expected-error {{static_cast from 'const int *' to 'int *' is not allowed}}
// but no error here
(void)static_cast<int*>(&c3.j);
}
@@ -115,7 +117,7 @@ struct C4 {
struct S
{
void f(); // expected-note 1 {{previous declaration}}
- void S::f() {} // expected-error {{class member cannot be redeclared}} expected-note {{previous declaration}} expected-note {{previous definition}}
+ void S::f() {} // expected-warning {{extra qualification on member}} expected-error {{class member cannot be redeclared}} expected-note {{previous declaration}} expected-note {{previous definition}}
void f() {} // expected-error {{class member cannot be redeclared}} expected-error {{redefinition}}
};
@@ -165,3 +167,24 @@ namespace rdar8066414 {
C() {}
} // expected-error{{expected ';' after class}}
}
+
+namespace rdar8367341 {
+ float foo();
+
+ struct A {
+ static const float x = 5.0f; // expected-warning {{in-class initializer for static data member of type 'const float' is a C++0x extension}}
+ static const float y = foo(); // expected-warning {{in-class initializer for static data member of type 'const float' is a C++0x extension}} expected-error {{in-class initializer is not a constant expression}}
+ };
+}
+
+namespace with_anon {
+struct S {
+ union {
+ char c;
+ };
+};
+
+void f() {
+ S::c; // expected-error {{invalid use of nonstatic data member}}
+}
+}
diff --git a/test/SemaCXX/compare.cpp b/test/SemaCXX/compare.cpp
index ebecc0633eda..ca8af2186f74 100644
--- a/test/SemaCXX/compare.cpp
+++ b/test/SemaCXX/compare.cpp
@@ -206,3 +206,9 @@ void test2(int i, void *vp) {
if (vp < 0) { }
if (test1 < e) { } // expected-error{{comparison between pointer and integer}}
}
+
+// PR7536
+static const unsigned int kMax = 0;
+int pr7536() {
+ return (kMax > 0);
+}
diff --git a/test/SemaCXX/composite-pointer-type.cpp b/test/SemaCXX/composite-pointer-type.cpp
index e8b09204d197..06fc8f43855d 100644
--- a/test/SemaCXX/composite-pointer-type.cpp
+++ b/test/SemaCXX/composite-pointer-type.cpp
@@ -53,8 +53,8 @@ bool f(Matrix4 m1, const Matrix4 m2) {
// PR6346
bool f1(bool b, void **p, const void **q) {
- if (p == q) // expected-warning{{comparison of distinct pointer types ('void **' and 'void const **') uses non-standard composite pointer type 'void const *const *'}}
+ if (p == q) // expected-warning{{comparison of distinct pointer types ('void **' and 'const void **') uses non-standard composite pointer type 'const void *const *'}}
return false;
- return b? p : q; // expected-warning{{incompatible operand types ('void **' and 'void const **') use non-standard composite pointer type 'void const *const *'}}
+ return b? p : q; // expected-warning{{incompatible operand types ('void **' and 'const void **') use non-standard composite pointer type 'const void *const *'}}
}
diff --git a/test/SemaCXX/compound-literal.cpp b/test/SemaCXX/compound-literal.cpp
new file mode 100644
index 000000000000..fe0e45d3c6ab
--- /dev/null
+++ b/test/SemaCXX/compound-literal.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// http://llvm.org/PR7905
+namespace PR7905 {
+struct S; // expected-note {{forward declaration}}
+void foo1() {
+ (void)(S[]) {{3}}; // expected-error {{array has incomplete element type}}
+}
+
+template <typename T> struct M { T m; };
+void foo2() {
+ (void)(M<short> []) {{3}};
+}
+}
diff --git a/test/SemaCXX/condition.cpp b/test/SemaCXX/condition.cpp
index daa86f62fcf0..61d1762be85f 100644
--- a/test/SemaCXX/condition.cpp
+++ b/test/SemaCXX/condition.cpp
@@ -42,3 +42,12 @@ void test2() {
if (int *ip = ip) {
}
}
+
+// Make sure we do function/array decay.
+void test3() {
+ if ("help")
+ (void) 0;
+
+ if (test3)
+ (void) 0;
+}
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index 065179b6da59..1da9a1724d31 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -Wsign-compare %s
+// RUN: %clang_cc1 -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.
@@ -7,7 +7,10 @@
struct ToBool { explicit operator bool(); };
struct B;
-struct A { A(); A(const B&); }; // expected-note 2 {{candidate constructor}}
+struct A {
+ A();
+ A(const B&); // expected-note 2 {{candidate constructor}}
+};
struct B { operator A() const; }; // expected-note 2 {{candidate function}}
struct I { operator int(); };
struct J { operator I(); };
@@ -106,8 +109,8 @@ void test()
i1 = (i1 ? Base() : Derived()).trick();
i1 = (i1 ? Derived() : Base()).trick();
// should fail: const lost
- (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('Base' and 'Derived const')}}
- (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('Derived const' and 'Base')}}
+ (void)(i1 ? Base() : constder()); // expected-error {{incompatible operand types ('Base' and 'const Derived')}}
+ (void)(i1 ? constder() : Base()); // expected-error {{incompatible operand types ('const Derived' and 'Base')}}
Priv priv;
Fin fin;
@@ -304,3 +307,17 @@ namespace PR7598 {
}
}
+
+namespace PR9236 {
+#define NULL 0L
+ void f() {
+ int i;
+ (void)(true ? A() : NULL); // expected-error{{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(true ? NULL : A()); // expected-error{{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(true ? 0 : A()); // expected-error{{incompatible operand types}}
+ (void)(true ? nullptr : A()); // expected-error{{non-pointer operand type 'A' incompatible with nullptr}}
+ (void)(true ? nullptr : i); // expected-error{{non-pointer operand type 'int' incompatible with nullptr}}
+ (void)(true ? __null : A()); // expected-error{{non-pointer operand type 'A' incompatible with NULL}}
+ (void)(true ? (void*)0 : A()); // expected-error{{incompatible operand types}}
+ }
+}
diff --git a/test/SemaCXX/const-cast.cpp b/test/SemaCXX/const-cast.cpp
index 50bd3162780b..62851f81280f 100644
--- a/test/SemaCXX/const-cast.cpp
+++ b/test/SemaCXX/const-cast.cpp
@@ -45,16 +45,16 @@ char ***good_const_cast_test(ccvpcvpp var)
short *bad_const_cast_test(char const *volatile *const volatile *var)
{
// Different pointer levels.
- char **var2 = const_cast<char**>(var); // expected-error {{const_cast from 'char const *volatile *const volatile *' to 'char **' is not allowed}}
+ char **var2 = const_cast<char**>(var); // expected-error {{const_cast from 'const char *volatile *const volatile *' to 'char **' is not allowed}}
// Different final type.
- short ***var3 = const_cast<short***>(var); // expected-error {{const_cast from 'char const *volatile *const volatile *' to 'short ***' is not allowed}}
+ short ***var3 = const_cast<short***>(var); // expected-error {{const_cast from 'const char *volatile *const volatile *' to 'short ***' is not allowed}}
// Rvalue to reference.
char ***&var4 = const_cast<cpppr>(&var2); // expected-error {{const_cast from rvalue to reference type 'cpppr'}}
// Non-pointer.
char v = const_cast<char>(**var2); // expected-error {{const_cast to 'char', which is not a reference, pointer-to-object, or pointer-to-data-member}}
const int *ar[100] = {0};
// Not even lenient g++ accepts this.
- int *(*rar)[100] = const_cast<int *(*)[100]>(&ar); // expected-error {{const_cast from 'int const *(*)[100]' to 'int *(*)[100]' is not allowed}}
+ int *(*rar)[100] = const_cast<int *(*)[100]>(&ar); // expected-error {{const_cast from 'const int *(*)[100]' to 'int *(*)[100]' is not allowed}}
f fp1 = 0;
// Function pointers.
f fp2 = const_cast<f>(fp1); // expected-error {{const_cast to 'f' (aka 'int (*)(int)'), which is not a reference, pointer-to-object, or pointer-to-data-member}}
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index 31d53302bf47..e439a76c17cc 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -144,9 +144,13 @@ int IntWrapper(int i) { return 0; };
class InitializeUsingSelfExceptions {
int A;
int B;
+ int C;
+ void *P;
InitializeUsingSelfExceptions(int B)
: A(IntWrapper(A)), // Due to a conservative implementation, we do not report warnings inside function/ctor calls even though it is possible to do so.
- B(B) {} // Not a warning; B is a local variable.
+ B(B), // Not a warning; B is a local variable.
+ C(sizeof(C)), // sizeof doesn't reference contents, do not warn
+ P(&P) {} // address-of doesn't reference contents (the pointer may be dereferenced in the same expression but it would be rare; and weird)
};
class CopyConstructorTest {
@@ -235,3 +239,32 @@ namespace test3 {
}
};
}
+
+// PR8075
+namespace PR8075 {
+
+struct S1 {
+ enum { FOO = 42 };
+ static const int bar = 42;
+ static int baz();
+ S1(int);
+};
+
+const int S1::bar;
+
+struct S2 {
+ S1 s1;
+ S2() : s1(s1.FOO) {}
+};
+
+struct S3 {
+ S1 s1;
+ S3() : s1(s1.bar) {}
+};
+
+struct S4 {
+ S1 s1;
+ S4() : s1(s1.baz()) {}
+};
+
+}
diff --git a/test/SemaCXX/constructor.cpp b/test/SemaCXX/constructor.cpp
index 9ef5c98e9e2c..f3b910d2f5a3 100644
--- a/test/SemaCXX/constructor.cpp
+++ b/test/SemaCXX/constructor.cpp
@@ -15,7 +15,8 @@ class Foo {
virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}
Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}}
- int Foo(int, int); // expected-error{{constructor cannot have a return type}}
+ int Foo(int, int); // expected-error{{constructor cannot have a return type}} \
+ // expected-error{{member 'Foo' has the same name as its class}}
};
Foo::Foo(const Foo&) { }
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index 07281e16d3f3..61c8ada62fb3 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -50,7 +50,7 @@ class A { };
class B : public A {
public:
operator A&() const; // expected-warning{{conversion function converting 'B' to its base class 'A' will never be used}}
- operator const void() const; // expected-warning{{conversion function converting 'B' to 'void const' will never be used}}
+ operator const void() const; // expected-warning{{conversion function converting 'B' to 'const void' will never be used}}
operator const B(); // expected-warning{{conversion function converting 'B' to itself will never be used}}
};
@@ -325,3 +325,31 @@ namespace rdar8018274 {
int i = ed;
}
}
+
+namespace PR8065 {
+ template <typename T> struct Iterator;
+ template <typename T> struct Container;
+
+ template<>
+ struct Iterator<int> {
+ typedef Container<int> container_type;
+ };
+
+ template <typename T>
+ struct Container {
+ typedef typename Iterator<T>::container_type X;
+ operator X(void) { return X(); }
+ };
+
+ Container<int> test;
+}
+
+namespace PR8034 {
+ struct C {
+ operator int();
+
+ private:
+ template <typename T> operator T();
+ };
+ int x = C().operator int();
+}
diff --git a/test/SemaCXX/conversion.cpp b/test/SemaCXX/conversion.cpp
index f6489438070a..fdda7ac76acd 100644
--- a/test/SemaCXX/conversion.cpp
+++ b/test/SemaCXX/conversion.cpp
@@ -43,3 +43,10 @@ namespace test1 {
return p == foo();
}
}
+
+namespace test2 {
+ struct A {
+ unsigned int x : 2;
+ A() : x(10) {} // expected-warning {{implicit truncation from 'int' to bitfield changes value from 10 to 2}}
+ };
+}
diff --git a/test/SemaCXX/copy-assignment.cpp b/test/SemaCXX/copy-assignment.cpp
index 5730b2af8f3f..f3dadc445040 100644
--- a/test/SemaCXX/copy-assignment.cpp
+++ b/test/SemaCXX/copy-assignment.cpp
@@ -99,13 +99,15 @@ void test() {
// <rdar://problem/8315440>: Don't crash
// FIXME: the recovery here is really bad.
-namespace test1 {
- template<typename T> class A : public unknown::X { // expected-error {{undeclared identifier 'unknown'}} expected-error {{expected class name}}
- A(UndeclaredType n) : X(n) {} // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{undeclared identifier 'n'}} expected-error {{expected ';' at end}} expected-error {{field has incomplete type}}
+namespace test1 { // expected-note{{to match this '{'}}
+ template<typename T> class A : public unknown::X { // expected-error {{undeclared identifier 'unknown'}} expected-error {{expected class name}} \
+ // expected-note{{template parameter is declared here}}
+ A(UndeclaredType n) : X(n) {} // expected-error{{expected ')'}} expected-note{{to match this '('}} \
+ // expected-error{{use of undeclared identifier 'n'}}
};
- template<typename T> class B : public A<T> {
+ template<typename T> class B : public A<T> { // expected-error{{declaration of 'T' shadows template parameter}}
virtual void foo() {}
};
- extern template class A<char>; // expected-note {{in instantiation}} expected-note {{not complete}}
- extern template class B<char>;
-}
+ extern template class A<char>; // expected-error{{expected member name or ';' after declaration specifiers}}
+ extern template class B<char>; // expected-error{{expected member name or ';' after declaration specifiers}}
+} // expected-error{{expected ';' after class}} // expected-error{{expected '}'}}
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp
index 0c4aa964cb66..fb83dcfbd017 100644
--- a/test/SemaCXX/copy-initialization.cpp
+++ b/test/SemaCXX/copy-initialization.cpp
@@ -10,8 +10,8 @@ class Y : public X { };
void f(Y y, int *ip, float *fp) {
X x1 = y; // expected-error{{no matching constructor for initialization of 'X'}}
- X x2 = 0; // expected-error{{no viable constructor copying variable}}
- X x3 = ip; // expected-error{{no viable constructor copying variable}}
+ X x2 = 0;
+ X x3 = ip;
X x4 = fp; // expected-error{{no viable conversion}}
X x2a(0); // expected-error{{call to constructor of 'X' is ambiguous}}
X x3a(ip);
@@ -19,11 +19,11 @@ void f(Y y, int *ip, float *fp) {
}
struct foo {
- void bar();
+ void bar(); // expected-note{{declared here}}
};
// PR3600
-void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize object parameter of type 'foo' with an expression of type 'foo const'}}
+void test(const foo *P) { P->bar(); } // expected-error{{'bar' not viable: 'this' argument has type 'const foo', but function is not marked const}}
namespace PR6757 {
struct Foo {
@@ -38,7 +38,7 @@ namespace PR6757 {
void f(Foo);
void g(Foo foo) {
- f(Bar()); // expected-error{{no viable constructor copying parameter of type 'PR6757::Foo const'}}
+ f(Bar()); // expected-error{{no viable constructor copying parameter of type 'const PR6757::Foo'}}
f(foo);
}
}
diff --git a/test/SemaCXX/crash-8124080.cpp b/test/SemaCXX/crash-8124080.cpp
deleted file mode 100644
index 78a031561a5f..000000000000
--- a/test/SemaCXX/crash-8124080.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-// <rdar://problem/8124080>
-template<typename _Alloc> class allocator;
-template<class _CharT> struct char_traits;
-template<typename _CharT, typename _Traits = char_traits<_CharT>,
- typename _Alloc = allocator<_CharT> >
-class basic_string;
-template<typename _CharT, typename _Traits, typename _Alloc>
-const typename basic_string<_CharT, _Traits, _Alloc>::size_type
-basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_max_size // expected-error{{no member named '_Rep' in 'basic_string<_CharT, _Traits, _Alloc>'}}
- = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4;
-
-// PR7118
-template<typename T>
-class Foo {
- class Bar;
- void f() {
- Bar i;
- }
-};
diff --git a/test/SemaCXX/crash-PR7625.cpp b/test/SemaCXX/crash-PR7625.cpp
deleted file mode 100644
index 3ddf5e5ed249..000000000000
--- a/test/SemaCXX/crash-PR7625.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-template<typename T> struct a : T {
- struct x : T {
- int aa() { return p; } // expected-error{{use of undeclared identifier 'p'}}
- };
-};
diff --git a/test/SemaCXX/crashes.cpp b/test/SemaCXX/crashes.cpp
new file mode 100644
index 000000000000..c75b0401fed6
--- /dev/null
+++ b/test/SemaCXX/crashes.cpp
@@ -0,0 +1,97 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// <rdar://problem/8124080>
+template<typename _Alloc> class allocator;
+template<class _CharT> struct char_traits;
+template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+class basic_string;
+template<typename _CharT, typename _Traits, typename _Alloc>
+const typename basic_string<_CharT, _Traits, _Alloc>::size_type
+basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_max_size // expected-error{{no member named '_Rep' in 'basic_string<_CharT, _Traits, _Alloc>'}}
+ = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4;
+
+// PR7118
+template<typename T>
+class Foo {
+ class Bar;
+ void f() {
+ Bar i;
+ }
+};
+
+// PR7625
+template<typename T> struct a : T {
+ struct x : T {
+ int aa() { return p; } // expected-error{{use of undeclared identifier 'p'}}
+ };
+};
+
+// rdar://8605381
+namespace rdar8605381 {
+struct X {};
+
+struct Y { // expected-note{{candidate}}
+ Y();
+};
+
+struct {
+ Y obj;
+} objs[] = {
+ new Y // expected-error{{no viable conversion}}
+};
+}
+
+// http://llvm.org/PR8234
+namespace PR8234 {
+template<typename Signature>
+class callback
+{
+};
+
+template<typename R , typename ARG_TYPE0>
+class callback<R( ARG_TYPE0)>
+{
+ public:
+ callback() {}
+};
+
+template< typename ARG_TYPE0>
+class callback<void( ARG_TYPE0)>
+{
+ public:
+ callback() {}
+};
+
+void f()
+{
+ callback<void(const int&)> op;
+}
+}
+
+namespace PR9007 {
+ struct bar {
+ enum xxx {
+ yyy = sizeof(struct foo*)
+ };
+ foo *xxx();
+ };
+}
+
+namespace PR9026 {
+ class InfallibleTArray {
+ };
+ class Variant;
+ class CompVariant {
+ operator const InfallibleTArray&() const;
+ };
+ class Variant {
+ operator const CompVariant&() const;
+ };
+ void Write(const Variant& __v);
+ void Write(const InfallibleTArray& __v);
+ Variant x;
+ void Write2() {
+ Write(x);
+ }
+}
diff --git a/test/SemaCXX/cstyle-cast.cpp b/test/SemaCXX/cstyle-cast.cpp
index ccb25f00c24e..12495ecdc5c1 100644
--- a/test/SemaCXX/cstyle-cast.cpp
+++ b/test/SemaCXX/cstyle-cast.cpp
@@ -226,6 +226,6 @@ void memptrs()
void (structure::*psf)() = 0;
(void)(int (structure::*)())(psf);
- (void)(void (structure::*)())(psi); // expected-error {{C-style cast from 'int const structure::*' to 'void (structure::*)()' is not allowed}}
+ (void)(void (structure::*)())(psi); // expected-error {{C-style cast from 'const int structure::*' to 'void (structure::*)()' is not allowed}}
(void)(int structure::*)(psf); // expected-error {{C-style cast from 'void (structure::*)()' to 'int structure::*' is not allowed}}
}
diff --git a/test/SemaCXX/dcl_ambig_res.cpp b/test/SemaCXX/dcl_ambig_res.cpp
index f0ba2978e8d7..fa71b11ba160 100644
--- a/test/SemaCXX/dcl_ambig_res.cpp
+++ b/test/SemaCXX/dcl_ambig_res.cpp
@@ -71,3 +71,6 @@ struct S5 {
int foo8() {
int v(int(S5::value)); // expected-warning{{disambiguated}} expected-error{{parameter declarator cannot be qualified}}
}
+
+template<typename T>
+void rdar8739801( void (T::*)( void ) __attribute__((unused)) );
diff --git a/test/SemaCXX/dcl_init_aggr.cpp b/test/SemaCXX/dcl_init_aggr.cpp
index 8b2866344462..2dbd381e4dba 100644
--- a/test/SemaCXX/dcl_init_aggr.cpp
+++ b/test/SemaCXX/dcl_init_aggr.cpp
@@ -120,4 +120,4 @@ u u1 = { 1 };
u u2 = u1;
u u3 = 1; // expected-error{{no viable conversion}}
u u4 = { 0, "asdf" }; // expected-error{{excess elements in union initializer}}
-u u5 = { "asdf" }; // expected-error{{cannot initialize a member subobject of type 'int' with an lvalue of type 'char const [5]'}}
+u u5 = { "asdf" }; // expected-error{{cannot initialize a member subobject of type 'int' with an lvalue of type 'const char [5]'}}
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp
index 4243c1c0ead4..1ddff8058a3b 100644
--- a/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -7,9 +7,9 @@ void f() {
// Expressions.
T(a)->m = 7;
- int(a)++; // expected-error {{expression is not assignable}}
- __extension__ int(a)++; // expected-error {{expression is not assignable}}
- __typeof(int)(a,5)<<a; // expected-error {{function-style cast to a builtin type can only take one argument}}
+ int(a)++; // expected-error {{assignment to cast is illegal}}
+ __extension__ int(a)++; // expected-error {{assignment to cast is illegal}}
+ __typeof(int)(a,5)<<a; // expected-error {{excess elements in scalar initializer}}
void(a), ++a;
if (int(a)+1) {}
for (int(a)+1;;) {} // expected-warning {{expression result unused}}
diff --git a/test/SemaCXX/decl-init-ref.cpp b/test/SemaCXX/decl-init-ref.cpp
index 7ae043925214..34c4578e9d6d 100644
--- a/test/SemaCXX/decl-init-ref.cpp
+++ b/test/SemaCXX/decl-init-ref.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
-struct A {}; // expected-note {{candidate is the implicit copy constructor}}
+struct A {};
struct BASE {
operator A(); // expected-note {{candidate function}}
@@ -18,10 +18,10 @@ class B : public BASE , public BASE1
extern B f();
-const int& ri = (void)0; // expected-error {{reference to type 'int const' could not bind to an rvalue of type 'void'}}
+const int& ri = (void)0; // expected-error {{reference to type 'const int' could not bind to an rvalue of type 'void'}}
int main() {
- const A& rca = f(); // expected-error {{reference initialization of type 'A const &' with initializer of type 'B' is ambiguous}}
+ const A& rca = f(); // expected-error {{reference initialization of type 'const A &' with initializer of type 'B' is ambiguous}}
A& ra = f(); // expected-error {{non-const lvalue reference to type 'A' cannot bind to a temporary of type 'B'}}
}
diff --git a/test/SemaCXX/decltype-overloaded-functions.cpp b/test/SemaCXX/decltype-overloaded-functions.cpp
index 0aa49b0cec90..c11a47ecdf04 100644
--- a/test/SemaCXX/decltype-overloaded-functions.cpp
+++ b/test/SemaCXX/decltype-overloaded-functions.cpp
@@ -2,10 +2,10 @@
void f();
void f(int);
-decltype(f) a; // expected-error{{cannot determine the declared type of an overloaded function}}
+decltype(f) a; // expected-error{{cannot resolve overloaded function from context}}
template<typename T> struct S {
- decltype(T::f) * f; // expected-error{{cannot determine the declared type of an overloaded function}}
+ decltype(T::f) * f; // expected-error{{cannot resolve overloaded function from context}}
};
struct K { void f(); void f(int); };
diff --git a/test/SemaCXX/default2.cpp b/test/SemaCXX/default2.cpp
index d9f1edf3b2a1..20763229cfdb 100644
--- a/test/SemaCXX/default2.cpp
+++ b/test/SemaCXX/default2.cpp
@@ -68,8 +68,11 @@ struct Y {
Nested* self = this, // expected-error{{invalid use of 'this' outside of a nonstatic member function}}
int m); // expected-error{{missing default argument on parameter 'm'}}
static int c;
+ Nested(int i = 42);
};
+ int mem7(Nested n = Nested());
+
static int b;
};
diff --git a/test/SemaCXX/delete.cpp b/test/SemaCXX/delete.cpp
new file mode 100644
index 000000000000..4567888a37b1
--- /dev/null
+++ b/test/SemaCXX/delete.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fixit -x c++ %t
+// RUN: FileCheck -input-file=%t %s
+
+void f(int a[10][20]) {
+ // CHECK: delete[] a;
+ delete a; // expected-warning {{'delete' applied to a pointer-to-array type}}
+}
diff --git a/test/SemaCXX/deleted-function-extension.cpp b/test/SemaCXX/deleted-function-extension.cpp
new file mode 100644
index 000000000000..fdf5ac8bd584
--- /dev/null
+++ b/test/SemaCXX/deleted-function-extension.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+
+struct A {
+ A(const A&) = delete; // expected-warning {{deleted function definition accepted as a C++0x extension}}
+ A& operator=(const A&) = delete; // expected-warning {{deleted function definition accepted as a C++0x extension}}
+};
+
+void f() = delete; // expected-warning {{deleted function definition accepted as a C++0x extension}}
diff --git a/test/SemaCXX/dependent-auto.cpp b/test/SemaCXX/dependent-auto.cpp
new file mode 100644
index 000000000000..0ea59481d5f3
--- /dev/null
+++ b/test/SemaCXX/dependent-auto.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+template<typename T>
+struct only {
+ only(T);
+ template<typename U> only(U) = delete; // expected-note {{here}}
+};
+
+template<typename ...T>
+void f(T ...t) {
+ auto x(t...); // expected-error {{requires an initializer}} expected-error {{contains multiple expressions}}
+ only<int> check = x;
+}
+
+void g() {
+ f(); // expected-note {{here}}
+ f(0);
+ f(0, 1); // expected-note {{here}}
+}
+
+
+template<typename T>
+bool h(T t) {
+ auto a = t;
+ decltype(a) b;
+ a = a + b;
+
+ auto p = new auto(t);
+
+ only<double*> test = p; // expected-error {{conversion function from 'char *' to 'only<double *>'}}
+ return p;
+}
+
+bool b = h('x'); // expected-note {{here}}
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index cdcae2e4119e..14a4fb891cd3 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wnon-virtual-dtor -verify %s
class A {
public:
~A();
@@ -67,7 +67,7 @@ struct Y {
namespace PR6421 {
class T; // expected-note{{forward declaration}}
- class QGenericArgument
+ class QGenericArgument // expected-note{{declared here}}
{
template<typename U>
void foo(T t) // expected-error{{variable has incomplete type}}
@@ -76,7 +76,8 @@ namespace PR6421 {
void disconnect()
{
T* t;
- bob<QGenericArgument>(t); // expected-error{{undeclared identifier 'bob'}}
+ bob<QGenericArgument>(t); // expected-error{{undeclared identifier 'bob'}} \
+ // expected-error{{does not refer to a value}}
}
};
}
@@ -99,11 +100,11 @@ namespace test6 {
T::deleteIt(p); // expected-error {{type 'int' cannot be used prior to '::'}}
}
- virtual ~A() {} // expected-note {{in instantiation of member function 'test6::A<int>::operator delete' requested here}}
+ virtual ~A() {}
};
- class B : A<int> { B(); };
- B::B() {} // expected-note {{in instantiation of member function 'test6::A<int>::~A' requested here}}
+ class B : A<int> { B(); }; // expected-note {{in instantiation of member function 'test6::A<int>::operator delete' requested here}}
+ B::B() {}
}
// Make sure classes are marked invalid when they have invalid
@@ -119,3 +120,60 @@ namespace test7 {
b->~B();
}
}
+
+namespace nonvirtualdtor {
+struct S1 { // expected-warning {{has virtual functions but non-virtual destructor}}
+ virtual void m();
+};
+
+struct S2 {
+ ~S2(); // expected-warning {{has virtual functions but non-virtual destructor}}
+ virtual void m();
+};
+
+struct S3 : public S1 { // expected-warning {{has virtual functions but non-virtual destructor}}
+ virtual void m();
+};
+
+struct S4 : public S2 { // expected-warning {{has virtual functions but non-virtual destructor}}
+ virtual void m();
+};
+
+struct B {
+ virtual ~B();
+ virtual void m();
+};
+
+struct S5 : public B {
+ virtual void m();
+};
+
+struct S6 {
+ virtual void m();
+private:
+ ~S6();
+};
+
+struct S7 {
+ virtual void m();
+protected:
+ ~S7();
+};
+
+template<class T> class TS : public B {
+ virtual void m();
+};
+
+TS<int> baz;
+
+template<class T> class TS2 { // expected-warning {{'nonvirtualdtor::TS2<int>' has virtual functions but non-virtual destructor}}
+ virtual void m();
+};
+
+TS2<int> foo; // expected-note {{instantiation}}
+}
+
+namespace PR9238 {
+ class B { public: ~B(); };
+ class C : virtual B { public: ~C() { } };
+}
diff --git a/test/SemaCXX/direct-initializer.cpp b/test/SemaCXX/direct-initializer.cpp
index 54cd6cacc0d4..a7899c75e4dc 100644
--- a/test/SemaCXX/direct-initializer.cpp
+++ b/test/SemaCXX/direct-initializer.cpp
@@ -44,7 +44,7 @@ struct Derived : Base {
};
void foo(const Derived cd, Derived d) {
- int *pi = cd; // expected-error {{no viable conversion from 'Derived const' to 'int *'}}
+ int *pi = cd; // expected-error {{no viable conversion from 'const Derived' to 'int *'}}
int *ppi = d;
}
diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp
index 2d0b571e0273..760079f3b0bc 100644
--- a/test/SemaCXX/elaborated-type-specifier.cpp
+++ b/test/SemaCXX/elaborated-type-specifier.cpp
@@ -35,7 +35,8 @@ namespace NS {
}
void test_S5_scope() {
- S4 *s4; // expected-error{{use of undeclared identifier 'S4'}}
+ S4 *s4; // expected-error{{use of undeclared identifier 'S4'}} \
+ // expected-error{{use of undeclared identifier 's4'}}
}
int test_funcparam_scope(struct S5 * s5) {
diff --git a/test/SemaCXX/enum-bitfield.cpp b/test/SemaCXX/enum-bitfield.cpp
new file mode 100644
index 000000000000..a766116b1c3c
--- /dev/null
+++ b/test/SemaCXX/enum-bitfield.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify -triple x86_64-apple-darwin %s
+
+enum E {};
+
+struct Z {};
+typedef int Integer;
+
+struct X {
+ enum E : 1;
+ enum E : Z; // expected-error{{invalid underlying type}}
+ enum E2 : int;
+ enum E3 : Integer;
+};
+
+struct Y {
+ enum E : int(2);
+ enum E : Z(); // expected-error{{not an integer constant}}
+};
diff --git a/test/SemaCXX/enum-scoped.cpp b/test/SemaCXX/enum-scoped.cpp
new file mode 100644
index 000000000000..7fdcf0d573a9
--- /dev/null
+++ b/test/SemaCXX/enum-scoped.cpp
@@ -0,0 +1,98 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify -triple x86_64-apple-darwin %s
+
+enum class E1 {
+ Val1 = 1L
+};
+
+enum struct E2 {
+ Val1 = '\0'
+};
+
+E1 v1 = Val1; // expected-error{{undeclared identifier}}
+E1 v2 = E1::Val1;
+
+static_assert(sizeof(E1) == sizeof(int), "bad size");
+static_assert(sizeof(E1::Val1) == sizeof(int), "bad size");
+static_assert(sizeof(E2) == sizeof(int), "bad size");
+static_assert(sizeof(E2::Val1) == sizeof(int), "bad size");
+
+E1 v3 = E2::Val1; // expected-error{{cannot initialize a variable}}
+int x1 = E1::Val1; // expected-error{{cannot initialize a variable}}
+
+enum E3 : char {
+ Val2 = 1
+};
+
+E3 v4 = Val2;
+E1 v5 = Val2; // expected-error{{cannot initialize a variable}}
+
+static_assert(sizeof(E3) == 1, "bad size");
+
+int x2 = Val2;
+
+int a1[Val2];
+int a2[E1::Val1]; // expected-error{{size of array has non-integer type}}
+
+int* p1 = new int[Val2];
+int* p2 = new int[E1::Val1]; // FIXME Expected-error{{must have integral}}
+
+enum class E4 {
+ e1 = -2147483648, // ok
+ e2 = 2147483647, // ok
+ e3 = 2147483648 // expected-error{{value is not representable}}
+};
+
+enum class E5 {
+ e1 = 2147483647, // ok
+ e2 // expected-error{{2147483648 is not representable in the underlying}}
+};
+
+enum class E6 : bool {
+ e1 = false, e2 = true,
+ e3 // expected-error{{2 is not representable in the underlying}}
+};
+
+enum E7 : bool {
+ e1 = false, e2 = true,
+ e3 // expected-error{{2 is not representable in the underlying}}
+};
+
+template <class T>
+struct X {
+ enum E : T {
+ e1, e2,
+ e3 // expected-error{{2 is not representable in the underlying}}
+ };
+};
+
+X<bool> X2; // expected-note{{in instantiation of template}}
+
+enum Incomplete1; // expected-error{{C++ forbids forward references}}
+
+enum Complete1 : int;
+Complete1 complete1;
+
+enum class Complete2;
+Complete2 complete2;
+
+// All the redeclarations below are done twice on purpose. Tests that the type
+// of the declaration isn't changed.
+
+enum class Redeclare2; // expected-note{{previous use is here}} expected-note{{previous use is here}}
+enum Redeclare2; // expected-error{{previously declared as scoped}}
+enum Redeclare2; // expected-error{{previously declared as scoped}}
+
+enum Redeclare3 : int; // expected-note{{previous use is here}} expected-note{{previous use is here}}
+enum Redeclare3; // expected-error{{previously declared with fixed underlying type}}
+enum Redeclare3; // expected-error{{previously declared with fixed underlying type}}
+
+enum class Redeclare5;
+enum class Redeclare5 : int; // ok
+
+enum Redeclare6 : int; // expected-note{{previous use is here}} expected-note{{previous use is here}}
+enum Redeclare6 : short; // expected-error{{redeclared with different underlying type}}
+enum Redeclare6 : short; // expected-error{{redeclared with different underlying type}}
+
+enum class Redeclare7; // expected-note{{previous use is here}} expected-note{{previous use is here}}
+enum class Redeclare7 : short; // expected-error{{redeclared with different underlying type}}
+enum class Redeclare7 : short; // expected-error{{redeclared with different underlying type}}
diff --git a/test/SemaCXX/enum.cpp b/test/SemaCXX/enum.cpp
index 1dc55e39162b..b4a050cb0908 100644
--- a/test/SemaCXX/enum.cpp
+++ b/test/SemaCXX/enum.cpp
@@ -90,3 +90,8 @@ typedef enum { }; // expected-warning{{typedef requires a name}}
enum PR7921E {
PR7921V = (PR7921E)(123) // expected-error {{expression is not an integer constant expression}}
};
+
+void PR8089() {
+ enum E; // expected-error{{ISO C++ forbids forward references to 'enum' types}}
+ int a = (E)3; // expected-error{{cannot initialize a variable of type 'int' with an rvalue of type 'E'}}
+}
diff --git a/test/SemaCXX/exceptions.cpp b/test/SemaCXX/exceptions.cpp
index 18349d10ef71..bda4a3d2ec54 100644
--- a/test/SemaCXX/exceptions.cpp
+++ b/test/SemaCXX/exceptions.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
struct A; // expected-note 4 {{forward declaration of 'A'}}
-struct Abstract { virtual void f() = 0; }; // expected-note {{pure virtual function 'f'}}
+struct Abstract { virtual void f() = 0; }; // expected-note {{unimplemented pure virtual method 'f'}}
void trys() {
try {
@@ -105,7 +105,7 @@ public:
void bar () {
throw *this; // expected-error{{cannot throw an object of abstract type 'foo'}}
}
- virtual void test () = 0; // expected-note{{pure virtual function 'test'}}
+ virtual void test () = 0; // expected-note{{unimplemented pure virtual method 'test'}}
};
namespace PR6831 {
diff --git a/test/SemaCXX/expressions.cpp b/test/SemaCXX/expressions.cpp
index b51194acd9c3..c4e9dccbf621 100644
--- a/test/SemaCXX/expressions.cpp
+++ b/test/SemaCXX/expressions.cpp
@@ -14,3 +14,21 @@ void f0() {
register int x;
f0_1(&x);
}
+
+namespace test1 {
+ template <class T> void bar(T &x) { T::fail(); }
+ template <class T> void bar(volatile T &x) {}
+
+ void test_ints() {
+ volatile int x;
+ bar(x = 5);
+ bar(x += 5);
+ }
+
+ enum E { E_zero };
+ void test_enums() {
+ volatile E x;
+ bar(x = E_zero);
+ bar(x += E_zero); // expected-error {{incompatible type}}
+ }
+}
diff --git a/test/SemaCXX/format-attribute.cpp b/test/SemaCXX/format-attribute.cpp
deleted file mode 100644
index 92b7cf517eff..000000000000
--- a/test/SemaCXX/format-attribute.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-// PR5521
-struct A { void a(const char*,...) __attribute((format(printf,2,3))); };
-void b(A x) {
- x.a("%d", 3);
-}
-struct X { void a(const char*,...) __attribute((format(printf,1,3))); }; // expected-error {{format argument not a string type}}
diff --git a/test/SemaCXX/friend.cpp b/test/SemaCXX/friend.cpp
index 30abcbbeaa52..1222dd0940da 100644
--- a/test/SemaCXX/friend.cpp
+++ b/test/SemaCXX/friend.cpp
@@ -62,3 +62,71 @@ namespace test4 {
class T4B {};
}
+
+namespace rdar8529993 {
+struct A { ~A(); }; // expected-note {{nearly matches}}
+
+struct B : A
+{
+ template<int> friend A::~A(); // expected-error {{does not match}}
+};
+}
+
+// PR7915
+namespace test5 {
+ struct A;
+ struct A1 { friend void A(); };
+
+ struct B { friend void B(); };
+}
+
+// PR8479
+namespace test6_1 {
+ class A {
+ public:
+ private:
+ friend class vectorA;
+ A() {}
+ };
+ class vectorA {
+ public:
+ vectorA(int i, const A& t = A()) {}
+ };
+ void f() {
+ vectorA v(1);
+ }
+}
+namespace test6_2 {
+ template<class T>
+ class vector {
+ public:
+ vector(int i, const T& t = T()) {}
+ };
+ class A {
+ public:
+ private:
+ friend class vector<A>;
+ A() {}
+ };
+ void f() {
+ vector<A> v(1);
+ }
+}
+namespace test6_3 {
+ template<class T>
+ class vector {
+ public:
+ vector(int i) {}
+ void f(const T& t = T()) {}
+ };
+ class A {
+ public:
+ private:
+ friend void vector<A>::f(const A&);
+ A() {}
+ };
+ void f() {
+ vector<A> v(1);
+ v.f();
+ }
+}
diff --git a/test/SemaCXX/functional-cast.cpp b/test/SemaCXX/functional-cast.cpp
index 3b088645a65b..61e4da3da9b8 100644
--- a/test/SemaCXX/functional-cast.cpp
+++ b/test/SemaCXX/functional-cast.cpp
@@ -23,7 +23,7 @@ void test_cxx_functional_value_init() {
void test_cxx_function_cast_multi() {
(void)NoValueInit(0, 0);
(void)NoValueInit(0, 0, 0); // expected-error{{no matching constructor for initialization}}
- (void)int(1, 2); // expected-error{{function-style cast to a builtin type can only take one argument}}
+ (void)int(1, 2); // expected-error{{excess elements in scalar initializer}}
}
@@ -304,7 +304,7 @@ void memptrs()
(void)structureimfp(psf);
typedef void (structure::*structurevmfp)();
- (void)structurevmfp(psi); // expected-error {{functional-style cast from 'int const structure::*' to 'structurevmfp' (aka 'void (structure::*)()') is not allowed}}
+ (void)structurevmfp(psi); // expected-error {{functional-style cast from 'const int structure::*' to 'structurevmfp' (aka 'void (structure::*)()') is not allowed}}
(void)structureimp(psf); // expected-error {{functional-style cast from 'void (structure::*)()' to 'structureimp' (aka 'int structure::*') is not allowed}}
}
@@ -314,4 +314,7 @@ void crash_on_invalid_1()
{
typedef itn Typo; // expected-error {{unknown type name 'itn'}}
(void)Typo(1); // used to crash
+
+ typedef int &int_ref;
+ (void)int_ref(); // expected-error {{reference to type 'int' requires an initializer}}
}
diff --git a/test/SemaCXX/gnu-case-ranges.cpp b/test/SemaCXX/gnu-case-ranges.cpp
new file mode 100644
index 000000000000..c1c18a89481c
--- /dev/null
+++ b/test/SemaCXX/gnu-case-ranges.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -verify %s
+
+enum E {
+ one,
+ two,
+ three,
+ four
+};
+
+
+int test(enum E e)
+{
+ switch (e)
+ {
+ case one:
+ return 7;
+ case two ... two + 1:
+ return 42;
+ case four:
+ return 25;
+ default:
+ return 0;
+ }
+}
diff --git a/test/SemaCXX/if-empty-body.cpp b/test/SemaCXX/if-empty-body.cpp
new file mode 100644
index 000000000000..ec7f89d68e72
--- /dev/null
+++ b/test/SemaCXX/if-empty-body.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1(int a) {
+ if (a); // expected-warning {{if statement has empty body}}
+}
+
+void f2(int a) {
+ if (a) {}
+}
+
+void f3() {
+ if (1)
+ xx; // expected-error {{use of undeclared identifier}}
+ return; // no empty body warning.
+}
+
+// Don't warn about an empty body if is expanded from a macro.
+void f4(int i) {
+ #define BODY(x)
+ if (i == i) // expected-warning{{self-comparison always evaluates to true}}
+ BODY(0);
+ #undef BODY
+}
+
+template <typename T>
+void tf() {
+ #define BODY(x)
+ if (0)
+ BODY(0);
+ #undef BODY
+}
+
+void f5() {
+ tf<int>();
+}
diff --git a/test/SemaCXX/init-priority-attr.cpp b/test/SemaCXX/init-priority-attr.cpp
index 6ea263d1e59d..7605ee625ed4 100644
--- a/test/SemaCXX/init-priority-attr.cpp
+++ b/test/SemaCXX/init-priority-attr.cpp
@@ -26,11 +26,11 @@ Two coo[2] __attribute__((init_priority(3))); // expected-error {{init_priority
Two koo[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires integer constant}}
-Two func() __attribute__((init_priority(1001))); // expected-error {{can only use ‘init_priority’ attribute on file-scope definitions of objects of class type}}
+Two func() __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
-int i __attribute__((init_priority(1001))); // expected-error {{can only use ‘init_priority’ attribute on file-scope definitions of objects of class type}}
+int i __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
int main() {
- Two foo __attribute__((init_priority(1001))); // expected-error {{can only use ‘init_priority’ attribute on file-scope definitions of objects of class type}}
+ Two foo __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
}
diff --git a/test/SemaCXX/invalid-member-expr.cpp b/test/SemaCXX/invalid-member-expr.cpp
index 7307a47f8282..37025d93344a 100644
--- a/test/SemaCXX/invalid-member-expr.cpp
+++ b/test/SemaCXX/invalid-member-expr.cpp
@@ -7,8 +7,8 @@ void test() {
x.int; // expected-error{{expected unqualified-id}}
x.~int(); // expected-error{{expected a class name}}
- x.operator; // expected-error{{missing type specifier after 'operator'}}
- x.operator typedef; // expected-error{{missing type specifier after 'operator'}}
+ x.operator; // expected-error{{expected a type}}
+ x.operator typedef; // expected-error{{expected a type}}
}
void test2() {
@@ -16,8 +16,8 @@ void test2() {
x->int; // expected-error{{expected unqualified-id}}
x->~int(); // expected-error{{expected a class name}}
- x->operator; // expected-error{{missing type specifier after 'operator'}}
- x->operator typedef; // expected-error{{missing type specifier after 'operator'}}
+ x->operator; // expected-error{{expected a type}}
+ x->operator typedef; // expected-error{{expected a type}}
}
// PR6327
diff --git a/test/SemaCXX/issue547.cpp b/test/SemaCXX/issue547.cpp
new file mode 100644
index 000000000000..03c5b7c978aa
--- /dev/null
+++ b/test/SemaCXX/issue547.cpp
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T>
+struct classify_function {
+ static const unsigned value = 0;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args...)> {
+ static const unsigned value = 1;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args...) const> { // expected-warning{{template argument of 'const' qualified function type is a GNU extension}}
+ static const unsigned value = 2;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args...) volatile> { // expected-warning{{template argument of 'volatile' qualified function type is a GNU extension}}
+ static const unsigned value = 3;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args...) const volatile> { // expected-warning{{template argument of 'const volatile' qualified function type is a GNU extension}}
+ static const unsigned value = 4;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args......)> {
+ static const unsigned value = 5;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args......) const> { // expected-warning{{template argument of 'const' qualified function type is a GNU extension}}
+ static const unsigned value = 6;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args......) volatile> { // expected-warning{{template argument of 'volatile' qualified function type is a GNU extension}}
+ static const unsigned value = 7;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args......) const volatile> { // expected-warning{{template argument of 'const volatile' qualified function type is a GNU extension}}
+ static const unsigned value = 8;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args......) &&> { // expected-warning{{template argument of '&&' qualified function type is a GNU extension}}
+ static const unsigned value = 9;
+};
+
+template<typename R, typename ...Args>
+struct classify_function<R(Args......) const &> { // expected-warning{{template argument of 'const &' qualified function type is a GNU extension}}
+ static const unsigned value = 10;
+};
+
+typedef void f0(int) const;
+typedef void f1(int, float...) const volatile;
+typedef void f2(int, double, ...) &&;
+typedef void f3(int, double, ...) const &;
+
+int check0[classify_function<f0>::value == 2? 1 : -1];
+int check1[classify_function<f1>::value == 8? 1 : -1];
+int check2[classify_function<f2>::value == 9? 1 : -1];
+int check3[classify_function<f3>::value == 10? 1 : -1];
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index 86c3d3e87a4c..b5a10a795ebc 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -86,3 +86,6 @@ namespace N {
}
extern "C++" using N::value;
+
+// PR7076
+extern "C" const char *Version_string = "2.9";
diff --git a/test/SemaCXX/linkage.cpp b/test/SemaCXX/linkage.cpp
new file mode 100644
index 000000000000..ba56318fbd68
--- /dev/null
+++ b/test/SemaCXX/linkage.cpp
@@ -0,0 +1,68 @@
+// This is an IR generation test because the calculation of visibility
+// during IR gen will cause linkage to be implicitly recomputed and
+// compared against the earlier cached value. If we had a way of
+// testing linkage directly in Sema, that would be better.
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
+
+// PR8926
+namespace test0 {
+ typedef struct {
+ void *foo() { return 0; }
+ } A;
+
+ // CHECK: define linkonce_odr i8* @_ZN5test01A3fooEv(
+
+ void test(A *a) {
+ a->foo();
+ }
+}
+
+namespace test1 {
+ typedef struct {
+ template <unsigned n> void *foo() { return 0; }
+
+ void foo() {
+ foo<0>();
+ }
+ } A;
+
+ // CHECK: define linkonce_odr void @_ZN5test11A3fooEv(
+ // another at the end
+
+ void test(A *a) {
+ a->foo();
+ }
+}
+
+namespace test2 {
+ typedef struct {
+ template <unsigned n> struct B {
+ void *foo() { return 0; }
+ };
+
+ void foo(B<0> *b) {
+ b->foo();
+ }
+ } A;
+
+ // CHECK: define linkonce_odr void @_ZN5test21A3fooEPNS0_1BILj0EEE(
+
+ void test(A *a) {
+ a->foo(0);
+ }
+}
+
+namespace test3 {
+ namespace { struct A {}; }
+
+ // CHECK: define internal void @_ZN5test34testENS_12_GLOBAL__N_11AE(
+ void test(A a) {}
+ void force() { test(A()); }
+
+ // CHECK: define void @test3(
+ extern "C" void test3(A a) {}
+}
+
+// CHECK: define linkonce_odr i8* @_ZN5test21A1BILj0EE3fooEv(
+// CHECK: define linkonce_odr i8* @_ZN5test11A3fooILj0EEEPvv(
diff --git a/test/SemaCXX/lookup-member.cpp b/test/SemaCXX/lookup-member.cpp
new file mode 100644
index 000000000000..c75b185bcc42
--- /dev/null
+++ b/test/SemaCXX/lookup-member.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace A {
+ class String;
+};
+
+using A::String;
+class String;
+
+// rdar://8603569
+union value {
+char *String;
+};
diff --git a/test/SemaCXX/member-expr-anonymous-union.cpp b/test/SemaCXX/member-expr-anonymous-union.cpp
index 0f0359667b38..6e35eb2b14d7 100644
--- a/test/SemaCXX/member-expr-anonymous-union.cpp
+++ b/test/SemaCXX/member-expr-anonymous-union.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
// PR5543
-struct A { int x; union { int* y; float& z; }; }; struct B : A {int a;};
+struct A { int x; union { int* y; float* z; }; }; struct B : A {int a;};
int* a(B* x) { return x->y; }
struct x { union { int y; }; }; x y; template <int X> int f() { return X+y.y; }
diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp
index 953ee48aa959..a4a39d780163 100644
--- a/test/SemaCXX/member-expr.cpp
+++ b/test/SemaCXX/member-expr.cpp
@@ -115,3 +115,18 @@ namespace rdar8231724 {
y->N::X1<int>; // expected-error{{'rdar8231724::N::X1' is not a member of class 'rdar8231724::Y'}}
}
}
+
+namespace PR9025 {
+ struct S { int x; };
+ S fun();
+ int fun(int i);
+ int g() {
+ return fun.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call the 0-argument overload?}}
+ }
+
+ S fun2(); // expected-note{{possibly valid overload here}}
+ S fun2(int i); // expected-note{{possibly valid overload here}}
+ int g2() {
+ return fun2.x; // expected-error{{base of member reference is an overloaded function; perhaps you meant to call it?}}
+ }
+}
diff --git a/test/SemaCXX/member-operator-expr.cpp b/test/SemaCXX/member-operator-expr.cpp
index 5e3d0c0a1bc8..ae5f8bb0ddb6 100644
--- a/test/SemaCXX/member-operator-expr.cpp
+++ b/test/SemaCXX/member-operator-expr.cpp
@@ -14,7 +14,7 @@ void test() {
i = x.operator int();
x.operator--(); // expected-error{{no member named 'operator--'}}
x.operator float(); // expected-error{{no member named 'operator float'}}
- x.operator; // expected-error{{missing type specifier after 'operator'}}
+ x.operator; // expected-error{{expected a type}}
}
void test2() {
@@ -25,5 +25,5 @@ void test2() {
i = x->operator int();
x->operator--(); // expected-error{{no member named 'operator--'}}
x->operator float(); // expected-error{{no member named 'operator float'}}
- x->operator; // expected-error{{missing type specifier after 'operator'}}
+ x->operator; // expected-error{{expected a type}}
}
diff --git a/test/SemaCXX/member-pointer.cpp b/test/SemaCXX/member-pointer.cpp
index 795c0b95efd6..31c651a4ad5d 100644
--- a/test/SemaCXX/member-pointer.cpp
+++ b/test/SemaCXX/member-pointer.cpp
@@ -88,7 +88,7 @@ void g() {
void (HasMembers::*pmd)() = &HasMembers::d;
}
-struct Incomplete; // expected-note {{forward declaration}}
+struct Incomplete;
void h() {
HasMembers hm, *phm = &hm;
@@ -121,9 +121,10 @@ void h() {
(void)(hm.*i); // expected-error {{pointer-to-member}}
(void)(phm->*i); // expected-error {{pointer-to-member}}
+ // Okay
Incomplete *inc;
int Incomplete::*pii = 0;
- (void)(inc->*pii); // expected-error {{pointer into incomplete}}
+ (void)(inc->*pii);
}
struct OverloadsPtrMem
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp
index 0dc1097e3867..1eb7014743cb 100644
--- a/test/SemaCXX/nested-name-spec.cpp
+++ b/test/SemaCXX/nested-name-spec.cpp
@@ -244,3 +244,22 @@ namespace PR7133 {
return false;
}
}
+
+class CLASS {
+ void CLASS::foo2(); // expected-warning {{extra qualification on member 'foo2'}}
+};
+
+namespace PR8159 {
+ class B { };
+
+ class A {
+ int A::a; // expected-warning{{extra qualification on member 'a'}}
+ static int A::b; // expected-warning{{extra qualification on member 'b'}}
+ int ::c; // expected-error{{non-friend class member 'c' cannot have a qualified name}}
+ };
+}
+
+namespace rdar7980179 {
+ class A { void f0(); }; // expected-note {{previous}}
+ int A::f0() {} // expected-error {{out-of-line definition of 'rdar7980179::A::f0' differ from the declaration in the return type}}
+}
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 9a64e4c01d7e..13ef461e7c0d 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -62,8 +62,8 @@ struct abstract {
void bad_news(int *ip)
{
int i = 1;
- (void)new; // expected-error {{missing type specifier}}
- (void)new 4; // expected-error {{missing type specifier}}
+ (void)new; // expected-error {{expected a type}}
+ (void)new 4; // expected-error {{expected a type}}
(void)new () int; // expected-error {{expected expression}}
(void)new int[1.1]; // expected-error {{array size expression must have integral or enumerated type, not 'double'}}
(void)new int[1][i]; // expected-error {{only the first dimension}}
@@ -73,7 +73,7 @@ void bad_news(int *ip)
(void)new int(1, 2); // expected-error {{excess elements in scalar initializer}}
(void)new S(1); // expected-error {{no matching constructor}}
(void)new S(1, 1); // expected-error {{call to constructor of 'S' is ambiguous}}
- (void)new const int; // expected-error {{default initialization of an object of const type 'int const'}}
+ (void)new const int; // expected-error {{default initialization of an object of const type 'const int'}}
(void)new float*(ip); // expected-error {{cannot initialize a new value of type 'float *' with an lvalue of type 'int *'}}
// Undefined, but clang should reject it directly.
(void)new int[-1]; // expected-error {{array size is negative}}
@@ -234,6 +234,17 @@ void f(X14 *x14a, X14 *x14b) {
delete x14a;
}
+class X15 {
+private:
+ X15(); // expected-note {{declared private here}}
+ ~X15(); // expected-note {{declared private here}}
+};
+
+void f(X15* x) {
+ new X15(); // expected-error {{calling a private constructor}}
+ delete x; // expected-error {{calling a private destructor}}
+}
+
namespace PR5918 { // Look for template operator new overloads.
struct S { template<typename T> static void* operator new(size_t, T); };
void test() {
@@ -354,3 +365,27 @@ namespace DeleteParam {
void operator delete(void* const);
};
}
+
+// <rdar://problem/8427878>
+// Test that the correct 'operator delete' is selected to pair with
+// the unexpected placement 'operator new'.
+namespace PairedDelete {
+ template <class T> struct A {
+ A();
+ void *operator new(size_t s, double d = 0);
+ void operator delete(void *p, double d);
+ void operator delete(void *p) {
+ T::dealloc(p);
+ }
+ };
+
+ A<int> *test() {
+ return new A<int>();
+ }
+}
+
+namespace PR7702 {
+ void test1() {
+ new DoesNotExist; // expected-error {{expected a type}}
+ }
+}
diff --git a/test/SemaCXX/no-exceptions.cpp b/test/SemaCXX/no-exceptions.cpp
index 019e25c97842..f7395683c3f5 100644
--- a/test/SemaCXX/no-exceptions.cpp
+++ b/test/SemaCXX/no-exceptions.cpp
@@ -19,3 +19,17 @@ namespace test0 {
(void) new Foo();
}
}
+
+namespace test1 {
+void f() {
+ throw; // expected-error {{cannot use 'throw' with exceptions disabled}}
+}
+
+void g() {
+ try { // expected-error {{cannot use 'try' with exceptions disabled}}
+ f();
+ } catch (...) {
+ }
+}
+
+}
diff --git a/test/SemaCXX/non-empty-class-size-zero.cpp b/test/SemaCXX/non-empty-class-size-zero.cpp
new file mode 100644
index 000000000000..6b714dbe038f
--- /dev/null
+++ b/test/SemaCXX/non-empty-class-size-zero.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only %s
+// rdar://8945175
+
+struct X {
+ int array[0];
+ int array1[0];
+ int array2[0];
+ X();
+ ~X();
+};
+
+struct Y {
+ int first;
+ X padding;
+ int second;
+};
+
+int zero_size_array[(sizeof(Y) == 8) -1]; // no error here!
diff --git a/test/SemaCXX/nullptr-98.cpp b/test/SemaCXX/nullptr-98.cpp
new file mode 100644
index 000000000000..0d624c26de70
--- /dev/null
+++ b/test/SemaCXX/nullptr-98.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s
+void f(void *);
+void g() { f(__nullptr); }
diff --git a/test/SemaCXX/nullptr.cpp b/test/SemaCXX/nullptr.cpp
index a3aab7fbe3e0..01f3d9367935 100644
--- a/test/SemaCXX/nullptr.cpp
+++ b/test/SemaCXX/nullptr.cpp
@@ -1,8 +1,7 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x -ffreestanding %s
#include <stdint.h>
-// Don't have decltype yet.
-typedef __typeof__(nullptr) nullptr_t;
+typedef decltype(nullptr) nullptr_t;
struct A {};
@@ -38,11 +37,17 @@ nullptr_t f(nullptr_t null)
(void)((void*)0 == nullptr);
(void)(null <= (void*)0);
(void)((void*)0 <= nullptr);
+ (void)(0 == nullptr);
+ (void)(nullptr == 0);
+ (void)(nullptr <= 0);
+ (void)(0 <= nullptr);
(void)(1 > nullptr); // expected-error {{invalid operands to binary expression}}
(void)(1 != nullptr); // expected-error {{invalid operands to binary expression}}
(void)(1 + nullptr); // expected-error {{invalid operands to binary expression}}
- (void)(0 ? nullptr : 0); // expected-error {{incompatible operand types}}
+ (void)(0 ? nullptr : 0); // expected-error {{non-pointer operand type 'int' incompatible with nullptr}}
(void)(0 ? nullptr : (void*)0);
+ (void)(0 ? nullptr : A()); // expected-error {{non-pointer operand type 'A' incompatible with nullptr}}
+ (void)(0 ? A() : nullptr); // expected-error {{non-pointer operand type 'A' incompatible with nullptr}}
// Overloading
int t = o1(nullptr);
@@ -65,3 +70,37 @@ template <int *PI, void (*PF)(), int A::*PM, void (A::*PMF)()>
struct T {};
typedef T<nullptr, nullptr, nullptr, nullptr> NT;
+
+namespace test1 {
+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;
+};
+
+void *g(void*);
+bool g(bool);
+
+// Test that we prefer g(void*) over g(bool).
+static_assert(is_same<decltype(g(nullptr)), void*>::value, "");
+}
+
+namespace test2 {
+ void f(int, ...) __attribute__((sentinel));
+
+ void g() {
+ // nullptr can be used as the sentinel value.
+ f(10, nullptr);
+ }
+}
+
+namespace test3 {
+ void f(const char*, ...) __attribute__((format(printf, 1, 2)));
+
+ void g() {
+ // Don't warn when using nullptr with %p.
+ f("%p", nullptr);
+ }
+}
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp
index 6bf6965e46bf..81a88a3a9ac3 100644
--- a/test/SemaCXX/overload-call.cpp
+++ b/test/SemaCXX/overload-call.cpp
@@ -317,8 +317,8 @@ namespace PR5756 {
// Tests the exact text used to note the candidates
namespace test1 {
- template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int] not viable: no known conversion from 'char const [6]' to 'unsigned int' for 2nd argument}}
- void foo(int n, char N); // expected-note {{candidate function not viable: no known conversion from 'char const [6]' to 'char' for 2nd argument}}
+ template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int] not viable: no known conversion from 'const char [6]' to 'unsigned int' for 2nd argument}}
+ void foo(int n, char N); // expected-note {{candidate function not viable: no known conversion from 'const char [6]' to 'char' for 2nd argument}}
void foo(int n); // expected-note {{candidate function not viable: requires 1 argument, but 2 were provided}}
void foo(unsigned n = 10); // expected-note {{candidate function not viable: requires at most 1 argument, but 2 were provided}}
void foo(int n, const char *s, int t); // expected-note {{candidate function not viable: requires 3 arguments, but 2 were provided}}
@@ -441,7 +441,7 @@ namespace PR6177 {
void f(bool const volatile&); // expected-note{{passing argument to parameter here}}
void f(String);
- void g() { f(""); } // expected-error{{volatile lvalue reference to type 'bool const volatile' cannot bind to a value of unrelated type 'char const [1]'}}
+ void g() { f(""); } // expected-error{{volatile lvalue reference to type 'const volatile bool' cannot bind to a value of unrelated type 'const char [1]'}}
}
namespace PR7095 {
@@ -490,3 +490,16 @@ namespace NontrivialSubsequence {
foo(a);
}
}
+
+// rdar://rdar8499524
+namespace rdar8499524 {
+ struct W {};
+ struct S {
+ S(...);
+ };
+
+ void g(const S&);
+ void f() {
+ g(W());
+ }
+}
diff --git a/test/SemaCXX/overload-member-call.cpp b/test/SemaCXX/overload-member-call.cpp
index 8016b116812f..37815b9ccce8 100644
--- a/test/SemaCXX/overload-member-call.cpp
+++ b/test/SemaCXX/overload-member-call.cpp
@@ -70,19 +70,19 @@ void test_X2(X2 *x2p, const X2 *cx2p) {
// Tests the exact text used to note the candidates
namespace test1 {
class A {
- template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int] not viable: no known conversion from 'char const [6]' to 'unsigned int' for 2nd argument}}
- void foo(int n, char N); // expected-note {{candidate function not viable: no known conversion from 'char const [6]' to 'char' for 2nd argument}}
+ template <class T> void foo(T t, unsigned N); // expected-note {{candidate function [with T = int] not viable: no known conversion from 'const char [6]' to 'unsigned int' for 2nd argument}}
+ void foo(int n, char N); // expected-note {{candidate function not viable: no known conversion from 'const char [6]' to 'char' for 2nd argument}}
void foo(int n); // expected-note {{candidate function not viable: requires 1 argument, but 2 were provided}}
void foo(unsigned n = 10); // expected-note {{candidate function not viable: requires at most 1 argument, but 2 were provided}}
void foo(int n, const char *s, int t); // expected-note {{candidate function not viable: requires 3 arguments, but 2 were provided}}
void foo(int n, const char *s, int t, ...); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}}
void foo(int n, const char *s, int t, int u = 0); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}}
- void bar(double d); //expected-note {{candidate function not viable: 'this' argument has type 'test1::A const', but method is not marked const}}
- void bar(int i); //expected-note {{candidate function not viable: 'this' argument has type 'test1::A const', but method is not marked const}}
+ void bar(double d); //expected-note {{candidate function not viable: 'this' argument has type 'const test1::A', but method is not marked const}}
+ void bar(int i); //expected-note {{candidate function not viable: 'this' argument has type 'const test1::A', but method is not marked const}}
- void baz(A &d); // expected-note {{candidate function not viable: 1st argument ('test1::A const') would lose const qualifier}}
- void baz(int i); // expected-note {{candidate function not viable: no known conversion from 'test1::A const' to 'int' for 1st argument}}
+ void baz(A &d); // expected-note {{candidate function not viable: 1st argument ('const test1::A') would lose const qualifier}}
+ void baz(int i); // expected-note {{candidate function not viable: no known conversion from 'const test1::A' to 'int' for 1st argument}}
};
void test() {
diff --git a/test/SemaCXX/overloaded-builtin-operators-0x.cpp b/test/SemaCXX/overloaded-builtin-operators-0x.cpp
new file mode 100644
index 000000000000..32f199529064
--- /dev/null
+++ b/test/SemaCXX/overloaded-builtin-operators-0x.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -std=c++0x -verify %s
+
+template <class T>
+struct X
+{
+ operator T() const {return T();}
+};
+
+void test_char16t(X<char16_t> x) {
+ bool b = x == char16_t();
+}
diff --git a/test/SemaCXX/overloaded-builtin-operators.cpp b/test/SemaCXX/overloaded-builtin-operators.cpp
index 8a49671f1ab8..b3c08085a695 100644
--- a/test/SemaCXX/overloaded-builtin-operators.cpp
+++ b/test/SemaCXX/overloaded-builtin-operators.cpp
@@ -200,3 +200,40 @@ namespace PR7319 {
if (e1 > e2) {}
}
}
+
+namespace PR8477 {
+ struct Foo {
+ operator bool();
+ operator const char *();
+ };
+
+ bool doit() {
+ Foo foo;
+ long long zero = 0;
+ (void)(foo + zero);
+ (void)(foo - zero);
+ (void)(zero + foo);
+ (void)(zero[foo]);
+ (void)(foo - foo); // expected-error{{use of overloaded operator '-' is ambiguous}} \
+ // expected-note 4{{built-in candidate operator-}} \
+ // expected-note{{candidates omitted}}
+ return foo[zero] == zero;
+ }
+}
+
+namespace PR7851 {
+ struct X {
+ operator const void *() const;
+ operator void *();
+
+ operator const unsigned *() const;
+ operator unsigned *();
+ };
+
+ void f() {
+ X x;
+ x[0] = 1;
+ *x = 0;
+ (void)(x - x);
+ }
+}
diff --git a/test/SemaCXX/overloaded-name.cpp b/test/SemaCXX/overloaded-name.cpp
new file mode 100644
index 000000000000..289d5c92ecff
--- /dev/null
+++ b/test/SemaCXX/overloaded-name.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int ovl(int);
+float ovl(float);
+
+template<typename T> T ovl(T);
+
+void test(bool b) {
+ (void)((void)0, ovl); // expected-error{{cannot resolve overloaded function 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<float> : ovl<float>);
+}
diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp
index 24f7f66129eb..4399a026eaf4 100644
--- a/test/SemaCXX/overloaded-operator.cpp
+++ b/test/SemaCXX/overloaded-operator.cpp
@@ -24,7 +24,7 @@ bool operator-(Z, Z); // expected-note{{candidate function}}
void g(Y y, Z z) {
y = y + z;
- bool b = y - z; // expected-error{{use of overloaded operator '-' is ambiguous; candidates are:}}
+ bool b = y - z; // expected-error{{use of overloaded operator '-' is ambiguous}}
}
struct A {
@@ -37,8 +37,8 @@ bool operator==(A&, Z&); // expected-note 2{{candidate function}}
void h(A a, const A ac, Z z) {
make_A() == z;
- a == z; // expected-error{{use of overloaded operator '==' is ambiguous; candidates are:}}
- ac == z; // expected-error{{invalid operands to binary expression ('A const' and 'Z')}}
+ a == z; // expected-error{{use of overloaded operator '==' is ambiguous}}
+ ac == z; // expected-error{{invalid operands to binary expression ('const A' and 'Z')}}
}
struct B {
@@ -70,11 +70,11 @@ struct E2 {
// C++ [over.match.oper]p3 - enum restriction.
float& operator==(E1, E2);
-void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) {
+void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2, Enum1 next_enum1) {
float &f1 = (e1 == e2);
float &f2 = (enum1 == e2);
float &f3 = (e1 == enum2);
- float &f4 = (enum1 == enum2); // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}}
+ float &f4 = (enum1 == next_enum1); // expected-error{{non-const lvalue reference to type 'float' cannot bind to a temporary of type 'bool'}}
}
// PR5244 - Argument-dependent lookup would include the two operators below,
diff --git a/test/SemaCXX/pragma-pack.cpp b/test/SemaCXX/pragma-pack.cpp
new file mode 100644
index 000000000000..1bc738b087a9
--- /dev/null
+++ b/test/SemaCXX/pragma-pack.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple i686-apple-darwin9 -fsyntax-only -verify %s
+
+namespace rdar8745206 {
+
+struct Base {
+ int i;
+};
+
+#pragma pack(push, 1)
+struct Sub : public Base {
+ char c;
+};
+#pragma pack(pop)
+
+int check[sizeof(Sub) == 5 ? 1 : -1];
+
+}
+
+namespace check2 {
+
+struct Base {
+ virtual ~Base();
+ int x;
+};
+
+#pragma pack(push, 1)
+struct Sub : virtual Base {
+ char c;
+};
+#pragma pack(pop)
+
+int check[sizeof(Sub) == 13 ? 1 : -1];
+
+}
diff --git a/test/SemaCXX/pragma-unused.cpp b/test/SemaCXX/pragma-unused.cpp
new file mode 100644
index 000000000000..c9ddffafafa9
--- /dev/null
+++ b/test/SemaCXX/pragma-unused.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-parameter -Wunused -verify %s
+
+struct S {
+ void m(int x, int y) {
+ int z;
+ #pragma unused(x,y,z)
+ }
+};
diff --git a/test/SemaCXX/ptrtomember-badcall.cpp b/test/SemaCXX/ptrtomember-badcall.cpp
deleted file mode 100644
index fb774d85e3e4..000000000000
--- a/test/SemaCXX/ptrtomember-badcall.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-
-struct S {
- int i;
-
- int mem(int);
-};
-
-int foo(int S::* ps, S *s)
-{
- return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}}
-}
-
diff --git a/test/SemaCXX/ptrtomember.cpp b/test/SemaCXX/ptrtomember.cpp
new file mode 100644
index 000000000000..1038de9a1d3b
--- /dev/null
+++ b/test/SemaCXX/ptrtomember.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+struct S {
+ int i;
+
+ int mem(int);
+};
+
+int foo(int S::* ps, S *s)
+{
+ return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}}
+}
+
+struct S2 {
+ int bitfield : 1;
+};
+
+int S2::*pf = &S2::bitfield; // expected-error {{address of bit-field requested}}
+
+struct S3 {
+ void m();
+};
+
+void f3(S3* p, void (S3::*m)()) {
+ p->*m; // expected-error {{a bound member function may only be called}}
+ (void)(p->*m); // expected-error {{a bound member function may only be called}}
+ (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}}
+}
diff --git a/test/SemaCXX/qualified-id-lookup.cpp b/test/SemaCXX/qualified-id-lookup.cpp
index dfb059aa36ad..3cd6e1894b0b 100644
--- a/test/SemaCXX/qualified-id-lookup.cpp
+++ b/test/SemaCXX/qualified-id-lookup.cpp
@@ -78,7 +78,7 @@ namespace a {
typedef int f2_type(int, int);
void test_f2() {
- ::f2_type(1, 2); // expected-error {{function-style cast to a builtin type can only take one argument}}
+ ::f2_type(1, 2); // expected-error {{excess elements in scalar initializer}}
}
}
diff --git a/test/SemaCXX/redeclared-auto.cpp b/test/SemaCXX/redeclared-auto.cpp
new file mode 100644
index 000000000000..34de54c0f01d
--- /dev/null
+++ b/test/SemaCXX/redeclared-auto.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+
+extern int a;
+auto a = 0; // expected-note 2{{here}}
+auto a = 0; // expected-error {{redefinition}}
+int a = 0; // expected-error {{redefinition}}
+extern auto a; // expected-error {{requires an initializer}}
+
+extern int b; // expected-note {{here}}
+auto b = 0.0; // expected-error {{different type}}
+
+struct S {
+ static int a;
+ static int b; // expected-note {{here}}
+};
+
+auto S::a = 0; // expected-note 2{{here}}
+auto S::a; // expected-error {{redefinition}} expected-error {{requires an initializer}}
+int S::a = 0; // expected-error {{redefinition}}
+
+auto S::b = 0.0; // expected-error {{different type}}
+
+void f() {
+ extern int a;
+ extern auto a; // expected-error {{requires an initializer}}
+}
diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp
index a8e95a39539d..752a3484d025 100644
--- a/test/SemaCXX/ref-init-ambiguous.cpp
+++ b/test/SemaCXX/ref-init-ambiguous.cpp
@@ -14,15 +14,15 @@ struct C : B, A {
};
void test(C c) {
- const E2 &e2 = c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
+ const E2 &e2 = c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}}
}
void foo(const E2 &);// expected-note{{passing argument to parameter here}}
const E2 & re(C c) {
- foo(c); // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
+ foo(c); // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}}
- return c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
+ return c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}}
}
diff --git a/test/SemaCXX/references.cpp b/test/SemaCXX/references.cpp
index a7aafe41c392..ab44e78453b2 100644
--- a/test/SemaCXX/references.cpp
+++ b/test/SemaCXX/references.cpp
@@ -54,7 +54,7 @@ void test4() {
void test5() {
// const double& rcd2 = 2; // rcd2 refers to temporary with value 2.0
const volatile int cvi = 1;
- const int& r = cvi; // expected-error{{binding of reference to type 'int const' to a value of type 'int const volatile' drops qualifiers}}
+ const int& r = cvi; // expected-error{{binding of reference to type 'const int' to a value of type 'const volatile int' drops qualifiers}}
}
// C++ [dcl.init.ref]p3
@@ -130,3 +130,7 @@ namespace PR7149 {
X0< const int[1]> c(p1);
}
}
+
+namespace PR8608 {
+ bool& f(unsigned char& c) { return (bool&)c; }
+}
diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp
index f054e528d2d8..74dbc01ee5ac 100644
--- a/test/SemaCXX/reinterpret-cast.cpp
+++ b/test/SemaCXX/reinterpret-cast.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
#include <stdint.h>
@@ -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 'int const *' to 'int *' casts away constness}}
+ (void)reinterpret_cast<int*>(icp); // expected-error {{reinterpret_cast from 'const int *' to 'int *' casts away constness}}
// Invalid: T1*** -> T2 const* const**
- int const *const **icpcpp = reinterpret_cast<int const* const**>(ipppc); // expected-error {{reinterpret_cast from 'int ***' to 'int const *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 constness}}
// Valid: T1* -> T2*
int *ip = reinterpret_cast<int*>(icpcpp);
// Valid: T* -> T const*
@@ -77,12 +77,12 @@ 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 'int const 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 constness}}
void (structure::*psf)() = 0;
(void)reinterpret_cast<int (structure::*)()>(psf);
- (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const structure::*' to 'void (structure::*)()' is not allowed}}
+ (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'const int structure::*' to 'void (structure::*)()' is not allowed}}
(void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (structure::*)()' to 'int structure::*' is not allowed}}
// Cannot cast from integers to member pointers, not even the null pointer
@@ -105,6 +105,6 @@ void const_arrays() {
const STRING *s;
const char *c;
- (void)reinterpret_cast<char *>(s); // expected-error {{reinterpret_cast from 'STRING const *' (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 constness}}
(void)reinterpret_cast<const STRING *>(c);
}
diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp
index dfd548732150..7e0a69c266b5 100644
--- a/test/SemaCXX/return-noreturn.cpp
+++ b/test/SemaCXX/return-noreturn.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn -Wno-unreachable-code
+// 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 {
@@ -7,14 +8,11 @@ namespace PR6884 {
~abort_struct() __attribute__((noreturn));
};
- // FIXME: Should either of these actually warn, since the destructor is
- // marked noreturn?
-
int f() {
abort_struct();
- } // expected-warning{{control reaches end of non-void function}}
+ }
int f2() {
abort_struct s;
- } // expected-warning{{control reaches end of non-void function}}
+ }
}
diff --git a/test/SemaCXX/return-stack-addr.cpp b/test/SemaCXX/return-stack-addr.cpp
index 7d4cb964029b..fbbaf836f1ab 100644
--- a/test/SemaCXX/return-stack-addr.cpp
+++ b/test/SemaCXX/return-stack-addr.cpp
@@ -119,5 +119,23 @@ struct PR7999_X {};
PR7999_X& PR7999_f(PR7999<PR7999_X> s) { return s.value; } // no-warning
void test_PR7999(PR7999_X& x) { (void)PR7999_f(x); } // no-warning
+// PR 8774: Don't try to evaluate parameters with default arguments like
+// variables with an initializer, especially in templates where the default
+// argument may not be an expression (yet).
+namespace PR8774 {
+ template <typename U> struct B { };
+ template <typename V> V f(typename B<V>::type const &v = B<V>::value()) {
+ return v;
+ }
+ template <> struct B<const char *> {
+ typedef const char *type;
+ static const char *value();
+ };
+ void g() {
+ const char *t;
+ f<const char*>(t);
+ }
+}
+
// TODO: test case for dynamic_cast. clang does not yet have
// support for C++ classes to write such a test case.
diff --git a/test/SemaCXX/return.cpp b/test/SemaCXX/return.cpp
index 6bdbe52727b2..441c20f152b1 100644
--- a/test/SemaCXX/return.cpp
+++ b/test/SemaCXX/return.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -Wignored-qualifiers -verify
+// RUN: %clang_cc1 %s -fexceptions -fsyntax-only -Wignored-qualifiers -verify
int test1() {
throw;
diff --git a/test/SemaCXX/rval-references-examples.cpp b/test/SemaCXX/rval-references-examples.cpp
new file mode 100644
index 000000000000..f4921a9b5168
--- /dev/null
+++ b/test/SemaCXX/rval-references-examples.cpp
@@ -0,0 +1,112 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T>
+class unique_ptr {
+ T *ptr;
+
+ unique_ptr(const unique_ptr&) = delete; // expected-note 3{{function has been explicitly marked deleted here}}
+ unique_ptr &operator=(const unique_ptr&) = delete; // expected-note{{candidate function has been explicitly deleted}}
+public:
+ unique_ptr() : ptr(0) { }
+ unique_ptr(unique_ptr &&other) : ptr(other.ptr) { other.ptr = 0; }
+ explicit unique_ptr(T *ptr) : ptr(ptr) { }
+
+ ~unique_ptr() { delete ptr; }
+
+ unique_ptr &operator=(unique_ptr &&other) { // expected-note{{candidate function not viable: no known conversion from 'unique_ptr<int>' to 'unique_ptr<int> &&' for 1st argument}}
+ if (this == &other)
+ return *this;
+
+ delete ptr;
+ ptr = other.ptr;
+ other.ptr = 0;
+ return *this;
+ }
+};
+
+template<typename T>
+struct remove_reference {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_reference<T&> {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_reference<T&&> {
+ typedef T type;
+};
+
+
+template <class T> typename remove_reference<T>::type&& move(T&& t) {
+ return static_cast<typename remove_reference<T>::type&&>(t);
+}
+
+template <class T> T&& forward(typename remove_reference<T>::type& t) {
+ return static_cast<T&&>(t);
+}
+
+template <class T> T&& forward(typename remove_reference<T>::type&& t) {
+ return static_cast<T&&>(t);
+}
+
+template<typename T, typename ...Args>
+unique_ptr<T> make_unique_ptr(Args &&...args) {
+ return unique_ptr<T>(new T(forward<Args>(args)...));
+}
+
+template<typename T> void accept_unique_ptr(unique_ptr<T>); // expected-note{{passing argument to parameter here}}
+
+unique_ptr<int> test_unique_ptr() {
+ // Simple construction
+ unique_ptr<int> p;
+ unique_ptr<int> p1(new int);
+
+ // Move construction
+ unique_ptr<int> p2(make_unique_ptr<int>(17));
+ unique_ptr<int> p3 = make_unique_ptr<int>(17);
+
+ // Copy construction (failures)
+ unique_ptr<int> p4(p); // expected-error{{call to deleted constructor of 'unique_ptr<int>'}}
+ unique_ptr<int> p5 = p; // expected-error{{call to deleted constructor of 'unique_ptr<int>'}}
+
+ // Move assignment
+ p2 = move(p);
+ p2 = make_unique_ptr<int>(0);
+
+ // Copy assignment (failures);
+ p2 = p3; // expected-error{{overload resolution selected deleted operator '='}}
+
+ // Implicit copies
+ accept_unique_ptr(make_unique_ptr<double>(0.0));
+ accept_unique_ptr(move(p2));
+
+ // Implicit copies (failures);
+ accept_unique_ptr(p); // expected-error{{call to deleted constructor of 'unique_ptr<int>'}}
+
+ return p;
+}
+
+namespace perfect_forwarding {
+ struct A { };
+
+ struct F0 {
+ void operator()(A&, const A&, A&&, const A&&, A&&, const A&&); // expected-note{{candidate function not viable: 5th argument ('const perfect_forwarding::A') would lose const qualifier}}
+ };
+
+ template<typename F, typename ...Args>
+ void forward(F f, Args &&...args) {
+ f(static_cast<Args&&>(args)...); // expected-error{{no matching function for call to object of type 'perfect_forwarding::F0'}}
+ }
+
+ template<typename T> T get();
+
+ void test_forward() {
+ forward(F0(), get<A&>(), get<A const&>(), get<A>(), get<const A>(),
+ get<A&&>(), get<const A&&>());
+ forward(F0(), get<A&>(), get<A const&>(), get<A>(), get<const A>(), // expected-note{{in instantiation of function template specialization 'perfect_forwarding::forward<perfect_forwarding::F0, perfect_forwarding::A &, const perfect_forwarding::A &, perfect_forwarding::A, const perfect_forwarding::A, const perfect_forwarding::A, const perfect_forwarding::A>' requested here}}
+ get<const A&&>(), get<const A&&>());
+ }
+};
diff --git a/test/SemaCXX/rval-references-xfail.cpp b/test/SemaCXX/rval-references-xfail.cpp
deleted file mode 100644
index d41f8f141cde..000000000000
--- a/test/SemaCXX/rval-references-xfail.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
-// XFAIL: *
-struct MoveOnly {
- MoveOnly();
- MoveOnly(const MoveOnly&) = delete; // expected-note {{candidate function}} \
- // expected-note 3{{explicitly marked deleted here}}
- MoveOnly(MoveOnly&&); // expected-note {{candidate function}}
- MoveOnly(int&&); // expected-note {{candidate function}}
-};
-
-MoveOnly returning() {
- MoveOnly mo;
- return mo;
-}
diff --git a/test/SemaCXX/rval-references.cpp b/test/SemaCXX/rval-references.cpp
index 30622ccbfed0..11187cba5d82 100644
--- a/test/SemaCXX/rval-references.cpp
+++ b/test/SemaCXX/rval-references.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify -std=c++0x %s
typedef int&& irr;
typedef irr& ilr_c1; // Collapses to int&
@@ -6,7 +6,7 @@ typedef int& ilr;
typedef ilr&& ilr_c2; // Collapses to int&
irr ret_irr() {
- return 0;
+ return 0; // expected-warning {{returning reference to local temporary}}
}
struct not_int {};
@@ -28,9 +28,9 @@ fun_type &&make_fun();
void f() {
int &&virr1; // expected-error {{declaration of reference variable 'virr1' requires an initializer}}
int &&virr2 = 0;
- int &&virr3 = virr2; // expected-error {{rvalue reference cannot bind to lvalue}}
+ int &&virr3 = virr2; // expected-error {{rvalue reference to type 'int' cannot bind to lvalue of type 'int'}}
int i1 = 0;
- int &&virr4 = i1; // expected-error {{rvalue reference cannot bind to lvalue}}
+ int &&virr4 = i1; // expected-error {{rvalue reference to type 'int' cannot bind to lvalue of type 'int'}}
int &&virr5 = ret_irr();
int &&virr6 = static_cast<int&&>(i1);
(void)static_cast<not_int&&>(i1); // expected-error {{types are not compatible}}
@@ -47,7 +47,7 @@ void f() {
ilr_c2 vilr2 = i1;
conv_to_not_int_rvalue cnir;
- not_int &&ni4 = cnir; // expected-error {{rvalue reference cannot bind to lvalue}}
+ not_int &&ni4 = cnir;
not_int &ni5 = cnir; // expected-error{{non-const lvalue reference to type 'not_int' cannot bind to a value of unrelated type 'conv_to_not_int_rvalue'}}
not_int &&ni6 = conv_to_not_int_rvalue();
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp
index cdc3868a7be0..d462af06d730 100644
--- a/test/SemaCXX/scope-check.cpp
+++ b/test/SemaCXX/scope-check.cpp
@@ -66,7 +66,7 @@ namespace test4 {
C c0;
- goto *ip; // expected-warning {{indirect goto might cross protected scopes}}
+ goto *ip; // expected-error {{indirect goto might cross protected scopes}}
C c1; // expected-note {{jump bypasses variable initialization}}
lbl1: // expected-note {{possible target of indirect goto}}
return 0;
@@ -90,7 +90,7 @@ namespace test5 {
if (ip[1]) {
D d; // expected-note {{jump exits scope of variable with non-trivial destructor}}
ip += 2;
- goto *ip; // expected-warning {{indirect goto might cross protected scopes}}
+ goto *ip; // expected-error {{indirect goto might cross protected scopes}}
}
return 1;
}
diff --git a/test/SemaCXX/sourceranges.cpp b/test/SemaCXX/sourceranges.cpp
new file mode 100644
index 000000000000..602d76baa9db
--- /dev/null
+++ b/test/SemaCXX/sourceranges.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+
+template<class T>
+class P {
+ public:
+ P(T* t) {}
+};
+
+namespace foo {
+class A {};
+enum B {};
+typedef int C;
+}
+
+int main() {
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::class A *'
+ P<foo::A> p14 = new foo::A;
+ // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::enum 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'
+ return foo::A();
+}
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index 48f641aa997b..46c6eee2c4e8 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/test/SemaCXX/static-cast.cpp
@@ -55,7 +55,7 @@ void t_529_2()
// Bad code below
- (void)static_cast<void*>((const int*)0); // expected-error {{static_cast from 'int const *' to 'void *' is not allowed}}
+ (void)static_cast<void*>((const int*)0); // expected-error {{static_cast from 'const int *' to 'void *' is not allowed}}
(void)static_cast<A*>((E*)0); // expected-error {{cannot cast 'E' to its private base class 'A'}}
(void)static_cast<A*>((H*)0); // expected-error {{ambiguous conversion}}
(void)static_cast<int>((int*)0); // expected-error {{static_cast from 'int *' to 'int' is not allowed}}
@@ -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 'A const *' to 'B *' casts away constness}}
- (void)static_cast<B&>(*((const A*)0)); // expected-error {{static_cast from 'A const' 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 constness}}
(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 'void const *' to 'int *' casts away constness}}
+ (void)static_cast<int*>((const void*)0); // expected-error {{static_cast from 'const void *' to 'int *' casts away constness}}
(void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)()' is not allowed}}
}
@@ -184,7 +184,7 @@ void PR5897() { (void)static_cast<const int(*)[1]>((const void*)0); }
namespace PR6072 {
struct A { };
- struct B : A { void f(int); void f(); };
+ struct B : A { void f(int); void f(); }; // expected-note 2{{candidate function}}
struct C : B { };
struct D { };
@@ -192,6 +192,6 @@ namespace PR6072 {
(void)static_cast<void (A::*)()>(&B::f);
(void)static_cast<void (B::*)()>(&B::f);
(void)static_cast<void (C::*)()>(&B::f);
- (void)static_cast<void (D::*)()>(&B::f); // expected-error{{static_cast from '<overloaded function type>' to 'void (PR6072::D::*)()' is not allowed}}
+ (void)static_cast<void (D::*)()>(&B::f); // expected-error{{address of overloaded function 'f' cannot be static_cast to type 'void (PR6072::D::*)()'}}
}
}
diff --git a/test/SemaCXX/trailing-return-0x.cpp b/test/SemaCXX/trailing-return-0x.cpp
new file mode 100644
index 000000000000..b52b240da35d
--- /dev/null
+++ b/test/SemaCXX/trailing-return-0x.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+template <class T>
+struct only
+{
+ only(T) {}
+
+ template <class U>
+ only(U)
+ {
+ static_assert(sizeof(U) == 0, "expected type failure");
+ }
+};
+
+auto f() -> int
+{
+ return 0;
+}
+
+auto g(); // expected-error{{return without trailing return type}}
+
+int h() -> int; // expected-error{{trailing return type must specify return type 'auto', not 'int'}}
+
+int x;
+
+template <class T>
+auto i(T x) -> decltype(x)
+{
+ return x;
+}
+
+only<double> p1 = i(1.0);
+
+template <class T>
+struct X
+{
+ auto f(T x) -> T { return x; }
+
+ template <class U>
+ auto g(T x, U y) -> decltype(x + y)
+ {
+ return x + y;
+ }
+
+ template<typename U>
+ struct nested {
+ template <class V>
+ auto h(T x, U y, V z) -> decltype(x + y + z)
+ {
+ return x + y + z;
+ }
+ };
+
+ template<typename U>
+ nested<U> get_nested();
+};
+
+X<int> xx;
+only<int> p2 = xx.f(0L);
+only<double> p3 = xx.g(0L, 1.0);
+only<double> p4 = xx.get_nested<double>().h(0L, 1.0, 3.14f);
diff --git a/test/SemaCXX/type-convert-construct.cpp b/test/SemaCXX/type-convert-construct.cpp
index 8f92a035dc7d..479af21476be 100644
--- a/test/SemaCXX/type-convert-construct.cpp
+++ b/test/SemaCXX/type-convert-construct.cpp
@@ -2,7 +2,7 @@
void f() {
float v1 = float(1);
- int v2 = typeof(int)(1,2); // expected-error {{function-style cast to a builtin type can only take one argument}}
+ int v2 = typeof(int)(1,2); // expected-error {{excess elements in scalar initializer}}
typedef int arr[];
int v3 = arr(); // expected-error {{array types cannot be value-initialized}}
int v4 = int();
diff --git a/test/SemaCXX/type-dependent-exprs.cpp b/test/SemaCXX/type-dependent-exprs.cpp
index abe1b4d730ca..398c3cb0339b 100644
--- a/test/SemaCXX/type-dependent-exprs.cpp
+++ b/test/SemaCXX/type-dependent-exprs.cpp
@@ -22,3 +22,14 @@ T f(T x) {
h(1); // expected-error{{use of undeclared identifier 'h'}}
return 0;
}
+
+// This one entered into an infinite loop.
+template <unsigned long N>
+void rdar8520617() {
+ if (N > 1) { }
+}
+
+int f2() {
+ rdar8520617<0>();
+}
+
diff --git a/test/SemaCXX/type-formatting.cpp b/test/SemaCXX/type-formatting.cpp
new file mode 100644
index 000000000000..3fe9278c40b8
--- /dev/null
+++ b/test/SemaCXX/type-formatting.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct X0 { };
+struct X1 { };
+
+template<typename T>
+void f0() {
+ const T *t = (const X0*)0; // expected-error{{cannot initialize a variable of type 'const X1 *' with an rvalue of type 'const X0 *'}}
+}
+template void f0<X1>(); // expected-note{{instantiation of}}
diff --git a/test/SemaCXX/type-traits-incomplete.cpp b/test/SemaCXX/type-traits-incomplete.cpp
index f95982157900..c0a520e16769 100644
--- a/test/SemaCXX/type-traits-incomplete.cpp
+++ b/test/SemaCXX/type-traits-incomplete.cpp
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct S; // expected-note{{forward declaration of 'S'}}
+struct S; // expected-note 2 {{forward declaration of 'S'}}
void f() {
__is_pod(S); // expected-error{{incomplete type 'S' used in type trait expression}}
+ __is_pod(S[]); // expected-error{{incomplete type 'S' used in type trait expression}}
}
diff --git a/test/SemaCXX/type-traits.cpp b/test/SemaCXX/type-traits.cpp
index b05dd07ec2ec..ff9a6bf51a6f 100644
--- a/test/SemaCXX/type-traits.cpp
+++ b/test/SemaCXX/type-traits.cpp
@@ -11,6 +11,7 @@ struct Empty {};
typedef Empty EmptyAr[10];
typedef int Int;
typedef Int IntAr[10];
+typedef Int IntArNB[];
class Statics { static int priv; static NonPOD np; };
union EmptyUnion {};
union Union { int i; float f; };
@@ -19,7 +20,15 @@ struct HasOp { void operator *(); };
struct HasConv { operator int(); };
struct HasAssign { void operator =(int); };
+struct HasAnonymousUnion {
+ union {
+ int i;
+ float f;
+ };
+};
+
// Not PODs
+typedef const void cvoid;
struct Derives : POD {};
struct DerivesEmpty : Empty {};
struct HasCons { HasCons(int); };
@@ -32,6 +41,7 @@ struct HasNonPOD { NonPOD np; };
struct HasVirt { virtual void Virt() {}; };
typedef Derives NonPODAr[10];
typedef HasVirt VirtAr[10];
+typedef HasCons NonPODArNB[];
union NonPODUnion { int i; Derives n; };
struct HasNoThrowCopyAssign {
@@ -80,6 +90,8 @@ void is_pod()
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))];
@@ -92,6 +104,9 @@ void is_pod()
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))];
}
@@ -122,6 +137,9 @@ void is_empty()
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))];
}
@@ -132,6 +150,7 @@ 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 t11[F(__is_class(int))];
int t12[F(__is_class(Enum))];
@@ -139,6 +158,8 @@ void is_class()
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))];
}
typedef Union UnionAr[10];
@@ -154,6 +175,9 @@ void is_union()
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))];
}
typedef Enum EnumType;
@@ -170,6 +194,9 @@ void is_enum()
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))];
}
typedef HasVirt Polymorph;
@@ -188,6 +215,8 @@ void is_polymorphic()
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))];
}
typedef Int& IntRef;
@@ -198,6 +227,13 @@ struct HasCopy {
HasCopy(HasCopy& cp);
};
+struct HasTemplateCons {
+ HasVirt Annoying;
+
+ template <typename T>
+ HasTemplateCons(const T&);
+};
+
void has_trivial_default_constructor() {
int t01[T(__has_trivial_constructor(Int))];
int t02[T(__has_trivial_constructor(IntAr))];
@@ -217,6 +253,9 @@ void has_trivial_default_constructor() {
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))];
}
void has_trivial_copy_constructor() {
@@ -238,6 +277,9 @@ void has_trivial_copy_constructor() {
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))];
}
void has_trivial_copy_assignment() {
@@ -259,6 +301,8 @@ void has_trivial_copy_assignment() {
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))];
}
void has_trivial_destructor() {
@@ -280,14 +324,16 @@ void has_trivial_destructor() {
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))];
}
struct A { ~A() {} };
template<typename> struct B : A { };
void f() {
- int t01[T(!__has_trivial_destructor(A))];
- int t02[T(!__has_trivial_destructor(B<int>))];
+ int t01[F(__has_trivial_destructor(A))];
+ int t02[F(__has_trivial_destructor(B<int>))];
}
void has_nothrow_assign() {
@@ -309,10 +355,12 @@ void has_nothrow_assign() {
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))];
}
void has_nothrow_copy() {
@@ -338,6 +386,10 @@ void has_nothrow_copy() {
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))];
}
void has_nothrow_constructor() {
@@ -362,6 +414,10 @@ void has_nothrow_constructor() {
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))];
}
void has_virtual_destructor() {
@@ -387,4 +443,108 @@ void has_virtual_destructor() {
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))];
+}
+
+
+class Base {};
+class Derived : Base {};
+class Derived2a : Derived {};
+class Derived2b : Derived {};
+class Derived3 : virtual Derived2a, virtual Derived2b {};
+template<typename T> struct BaseA { T a; };
+template<typename T> struct DerivedB : BaseA<T> { };
+template<typename T> struct CrazyDerived : T { };
+
+
+class class_forward; // expected-note {{forward declaration of 'class_forward'}}
+
+template <typename Base, typename Derived>
+void isBaseOfT() {
+ int t[T(__is_base_of(Base, Derived))];
+};
+template <typename Base, typename Derived>
+void isBaseOfF() {
+ int t[F(__is_base_of(Base, Derived))];
+};
+
+template <class T> class DerivedTemp : Base {};
+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 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>'}}
+
+ isBaseOfT<Base, Derived>();
+ isBaseOfF<Derived, Base>();
+
+ isBaseOfT<Base, CrazyDerived<Base> >();
+ isBaseOfF<CrazyDerived<Base>, Base>();
+
+ isBaseOfT<BaseA<int>, DerivedB<int> >();
+ isBaseOfF<DerivedB<int>, BaseA<int> >();
+}
+
+struct FromInt { FromInt(int); };
+struct ToInt { operator int(); };
+typedef void Function();
+
+void is_convertible_to();
+class PrivateCopy {
+ PrivateCopy(const PrivateCopy&);
+ friend void is_convertible_to();
+};
+
+template<typename T>
+struct X0 {
+ template<typename U> X0(const X0<U>&);
+};
+
+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>))];
}
diff --git a/test/SemaCXX/typeid-ref.cpp b/test/SemaCXX/typeid-ref.cpp
index da0016970bee..d01fd316854c 100644
--- a/test/SemaCXX/typeid-ref.cpp
+++ b/test/SemaCXX/typeid-ref.cpp
@@ -6,7 +6,7 @@ namespace std {
struct X { };
void f() {
- // CHECK: @_ZTS1X = weak_odr constant
- // CHECK: @_ZTI1X = weak_odr constant
+ // CHECK: @_ZTS1X = linkonce_odr constant
+ // CHECK: @_ZTI1X = linkonce_odr unnamed_addr constant
(void)typeid(X&);
}
diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp
new file mode 100644
index 000000000000..bb87ce0f126c
--- /dev/null
+++ b/test/SemaCXX/undefined-internal.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Make sure we don't produce invalid IR.
+// RUN: %clang_cc1 -emit-llvm-only %s
+
+namespace test1 {
+ static void foo(); // expected-warning {{function 'test1::foo' has internal linkage but is not defined}}
+ template <class T> static void bar(); // expected-warning {{function 'test1::bar<int>' has internal linkage but is not defined}}
+
+ void test() {
+ foo(); // expected-note {{used here}}
+ bar<int>(); // expected-note {{used here}}
+ }
+}
+
+namespace test2 {
+ namespace {
+ void foo(); // expected-warning {{function 'test2::<anonymous namespace>::foo' has internal linkage but is not defined}}
+ extern int var; // expected-warning {{variable 'test2::<anonymous namespace>::var' has internal linkage but is not defined}}
+ template <class T> void bar(); // expected-warning {{function 'test2::<anonymous namespace>::bar<int>' has internal linkage but is not defined}}
+ }
+ void test() {
+ foo(); // expected-note {{used here}}
+ var = 0; // expected-note {{used here}}
+ bar<int>(); // expected-note {{used here}}
+ }
+}
+
+namespace test3 {
+ namespace {
+ void foo();
+ extern int var;
+ template <class T> void bar();
+ }
+
+ void test() {
+ foo();
+ var = 0;
+ bar<int>();
+ }
+
+ namespace {
+ void foo() {}
+ int var = 0;
+ template <class T> void bar() {}
+ }
+}
+
+namespace test4 {
+ namespace {
+ struct A {
+ A(); // expected-warning {{function 'test4::<anonymous namespace>::A::A' has internal linkage but is not defined}}
+ ~A();// expected-warning {{function 'test4::<anonymous namespace>::A::~A' has internal linkage but is not defined}}
+ virtual void foo(); // expected-warning {{function 'test4::<anonymous namespace>::A::foo' has internal linkage but is not defined}}
+ virtual void bar() = 0;
+ virtual void baz(); // expected-warning {{function 'test4::<anonymous namespace>::A::baz' has internal linkage but is not defined}}
+ };
+ }
+
+ void test(A &a) {
+ a.foo(); // expected-note {{used here}}
+ a.bar();
+ a.baz(); // expected-note {{used here}}
+ }
+
+ struct Test : A {
+ Test() {} // expected-note 2 {{used here}}
+ };
+}
+
+// rdar://problem/9014651
+namespace test5 {
+ namespace {
+ struct A {};
+ }
+
+ template <class N> struct B {
+ static int var; // expected-warning {{variable 'test5::B<test5::<anonymous>::A>::var' has internal linkage but is not defined}}
+ static void foo(); // expected-warning {{function 'test5::B<test5::<anonymous>::A>::foo' has internal linkage but is not defined}}
+ };
+
+ void test() {
+ B<A>::var = 0; // expected-note {{used here}}
+ B<A>::foo(); // expected-note {{used here}}
+ }
+}
diff --git a/test/SemaCXX/uninit-variables.cpp b/test/SemaCXX/uninit-variables.cpp
new file mode 100644
index 000000000000..2bc7fb32547b
--- /dev/null
+++ b/test/SemaCXX/uninit-variables.cpp
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -fsyntax-only %s -verify
+
+int test1_aux(int &x);
+int test1() {
+ int x;
+ test1_aux(x);
+ return x; // no-warning
+}
+
+int test2_aux() {
+ int x;
+ int &y = x;
+ return x; // no-warning
+}
+
+// Handle cases where the CFG may constant fold some branches, thus
+// mitigating the need for some path-sensitivity in the analysis.
+unsigned test3_aux();
+unsigned test3() {
+ unsigned x = 0;
+ const bool flag = true;
+ if (flag && (x = test3_aux()) == 0) {
+ return x;
+ }
+ return x;
+}
+unsigned test3_b() {
+ unsigned x ;
+ const bool flag = true;
+ if (flag && (x = test3_aux()) == 0) {
+ x = 1;
+ }
+ return x; // no-warning
+}
+unsigned test3_c() {
+ unsigned x; // expected-note{{declared here}} expected-note{{add initialization}}
+ const bool flag = false;
+ if (flag && (x = test3_aux()) == 0) {
+ x = 1;
+ }
+ return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
+}
+
+enum test4_A {
+ test4_A_a, test_4_A_b
+};
+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}}
+}
+
diff --git a/test/SemaCXX/uninitialized.cpp b/test/SemaCXX/uninitialized.cpp
new file mode 100644
index 000000000000..26202fbccc81
--- /dev/null
+++ b/test/SemaCXX/uninitialized.cpp
@@ -0,0 +1,14 @@
+// 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
+};
diff --git a/test/SemaCXX/unreachable-catch-clauses.cpp b/test/SemaCXX/unreachable-catch-clauses.cpp
index 9fc4aef44a04..e8158d449555 100644
--- a/test/SemaCXX/unreachable-catch-clauses.cpp
+++ b/test/SemaCXX/unreachable-catch-clauses.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -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 40d0c00b9390..03d44ab8ce47 100644
--- a/test/SemaCXX/unreachable-code.cpp
+++ b/test/SemaCXX/unreachable-code.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunreachable-code -fblocks -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -Wunreachable-code -fblocks -verify %s
int j;
void bar() { }
diff --git a/test/SemaCXX/unused-with-error.cpp b/test/SemaCXX/unused-with-error.cpp
new file mode 100644
index 000000000000..5660007c3bf1
--- /dev/null
+++ b/test/SemaCXX/unused-with-error.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused -verify %s
+
+// Make sure 'unused' warnings are disabled when errors occurred.
+static void foo(int *X) { // expected-note {{candidate}}
+}
+void bar(const int *Y) {
+ foo(Y); // expected-error {{no matching function for call}}
+}
diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp
index 30c4cfd997a1..ebe97f6cca0d 100644
--- a/test/SemaCXX/using-decl-1.cpp
+++ b/test/SemaCXX/using-decl-1.cpp
@@ -95,3 +95,26 @@ namespace test1 {
foo(p); // expected-error {{no matching function}}
}
}
+
+namespace test2 {
+ namespace ns { int foo; }
+ template <class T> using ns::foo; // expected-error {{cannot template a using declaration}}
+
+ // PR8022
+ struct A {
+ template <typename T> void f(T);
+ };
+ class B : A {
+ template <typename T> using A::f<T>; // expected-error {{cannot template a using declaration}}
+ };
+}
+
+// PR8756
+namespace foo
+{
+ class Class1; // expected-note{{forward declaration}}
+ class Class2
+ {
+ using ::foo::Class1::Function; // expected-error{{incomplete type 'foo::Class1' named in nested name specifier}}
+ };
+}
diff --git a/test/SemaCXX/using-decl-templates.cpp b/test/SemaCXX/using-decl-templates.cpp
index 5148ed5bcc71..7b4da9d50d03 100644
--- a/test/SemaCXX/using-decl-templates.cpp
+++ b/test/SemaCXX/using-decl-templates.cpp
@@ -45,3 +45,21 @@ namespace test0 {
template struct E<int>;
}
+
+// PR7896
+namespace PR7896 {
+template <class T> struct Foo {
+ int k (float);
+};
+struct Baz {
+ int k (int);
+};
+template <class T> struct Bar : public Foo<T>, Baz {
+ using Foo<T>::k;
+ using Baz::k;
+ int foo() {
+ return k (1.0f);
+ }
+};
+template int Bar<int>::foo();
+}
diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp
index 162f7fa07a36..22c6e14ce54f 100644
--- a/test/SemaCXX/using-directive.cpp
+++ b/test/SemaCXX/using-directive.cpp
@@ -126,3 +126,10 @@ void f4() { f2(1); }
using namespace std; // expected-warning{{using directive refers to implicitly-defined namespace 'std'}}
using namespace ::std; // expected-warning{{using directive refers to implicitly-defined namespace 'std'}}
+namespace test1 {
+ namespace ns { typedef int test1; }
+ template <class T> using namespace ns; // expected-error {{cannot template a using directive}}
+
+ // Test that we recovered okay.
+ test1 x;
+}
diff --git a/test/SemaCXX/vector-casts.cpp b/test/SemaCXX/vector-casts.cpp
index 4bb580843973..681a07ea4707 100644
--- a/test/SemaCXX/vector-casts.cpp
+++ b/test/SemaCXX/vector-casts.cpp
@@ -3,7 +3,7 @@ typedef int __v2si __attribute__((__vector_size__(8)));
typedef short __v4hi __attribute__((__vector_size__(8)));
typedef short __v8hi __attribute__((__vector_size__(16)));
-struct S { };
+struct S { }; // expected-note 2 {{candidate constructor}}
void f() {
__v2si v2si;
@@ -23,9 +23,9 @@ void f() {
(void)(__v2si)(ll);
(void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'S' is not allowed}}
- (void)(S)v2si; // expected-error {{C-style cast from '__v2si' to 'S' is not allowed}}
+ (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' to 'S'}}
(void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' is not allowed}}
- (void)(__v2si)s; // expected-error {{C-style cast from 'S' to '__v2si' is not allowed}}
+ (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' without a conversion operator}}
(void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' to scalar 'unsigned char' of different size}}
(void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' to scalar 'unsigned char' of different size}}
diff --git a/test/SemaCXX/virtual-override.cpp b/test/SemaCXX/virtual-override.cpp
index e07531f64365..23d86d37426e 100644
--- a/test/SemaCXX/virtual-override.cpp
+++ b/test/SemaCXX/virtual-override.cpp
@@ -32,7 +32,7 @@ struct a { };
struct b : private a { }; // expected-note{{declared private here}}
class A {
- virtual a* f(); // expected-note{{overridden virtual function is here}}
+ virtual a* f(); // FIXME: desired-note{{overridden virtual function is here}}
};
class B : A {
@@ -86,7 +86,7 @@ class A {
class B : A {
virtual a* f();
- virtual const a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides (class type 'T6::a const *' is more qualified than class type 'T6::a *'}}
+ virtual const a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides (class type 'const T6::a *' is more qualified than class type 'T6::a *'}}
};
}
@@ -121,7 +121,7 @@ namespace T9 {
struct a { };
template<typename T> struct b : a {
- int a[sizeof(T) ? -1 : -1]; // expected-error {{array size is negative}}
+ int a[sizeof(T) ? -1 : -1]; // expected-error {{array with a negative size}}
};
class A {
@@ -167,7 +167,7 @@ void test2() {
};
struct Foo3 {
- virtual void f(int) = 0; // expected-note{{pure virtual function}}
+ virtual void f(int) = 0; // expected-note{{unimplemented pure virtual method}}
};
template<typename T>
@@ -276,3 +276,15 @@ namespace T12 {
virtual B& f(); // expected-error {{virtual function 'f' has a different return type ('T12::B &') than the function it overrides (which has return type 'T12::A &&')}}
};
};
+
+namespace PR8168 {
+ class A {
+ public:
+ virtual void foo() {} // expected-note{{overridden virtual function is here}}
+ };
+
+ class B : public A {
+ public:
+ static void foo() {} // expected-error{{'static' member function 'foo' overrides a virtual function}}
+ };
+}
diff --git a/test/SemaCXX/vtable-instantiation.cc b/test/SemaCXX/vtable-instantiation.cc
new file mode 100644
index 000000000000..5a13d9505b3d
--- /dev/null
+++ b/test/SemaCXX/vtable-instantiation.cc
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// PR8640
+
+template<class T1> struct C1 {
+ virtual void c1() {
+ T1 t1 = 3; // expected-error {{cannot initialize a variable}}
+ }
+};
+
+template<class T2> struct C2 {
+ void c2() {
+ new C1<T2>(); // expected-note {{in instantiation of member function}}
+ }
+};
+
+void f() {
+ C2<int*> c2;
+ c2.c2(); // expected-note {{in instantiation of member function}}
+}
+
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp
index e5a3425804b8..27eedb9128d7 100644
--- a/test/SemaCXX/warn-assignment-condition.cpp
+++ b/test/SemaCXX/warn-assignment-condition.cpp
@@ -3,6 +3,7 @@
struct A {
int foo();
friend A operator+(const A&, const A&);
+ A operator|=(const A&);
operator bool();
};
@@ -95,4 +96,32 @@ void test() {
// expected-note{{use '==' to turn this assignment into an equality comparison}} \
// expected-note{{place parentheses around the assignment to silence this warning}}
for (; (a = b + b); ) {}
+
+ // Compound assignments.
+ if (x |= 2) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
+ // expected-note{{use '!=' to turn this compound assignment into an inequality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
+
+ if (a |= b) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \
+ // expected-note{{use '!=' to turn this compound assignment into an inequality comparison}} \
+ // expected-note{{place parentheses around the assignment to silence this warning}}
+
+ if ((x == 5)) {} // 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}}
+ if ((5 == x)) {}
+
+#define EQ(x,y) ((x) == (y))
+ if (EQ(x, 5)) {}
+#undef EQ
}
+
+void (*fn)();
+
+void test2() {
+ if ((fn == test2)) {} // 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}}
+ if ((test2 == fn)) {}
+}
+
diff --git a/test/SemaCXX/warn-enum-compare.cpp b/test/SemaCXX/warn-enum-compare.cpp
new file mode 100644
index 000000000000..52639e70a804
--- /dev/null
+++ b/test/SemaCXX/warn-enum-compare.cpp
@@ -0,0 +1,212 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+enum Foo { FooA, FooB, FooC };
+enum Bar { BarD, BarE, BarF };
+enum { AnonAA = 42, AnonAB = 43 };
+enum { AnonBA = 44, AnonBB = 45 };
+
+namespace name1 {
+ enum Foo {F1, F2, F3};
+ enum Baz {B1, B2, B3};
+}
+
+namespace name2 {
+ enum Baz {B1, B2, B3};
+}
+
+using name1::Baz;
+using name1::B1;
+using name2::B2;
+typedef name1::Foo oneFoo;
+typedef name1::Foo twoFoo;
+Foo getFoo();
+Bar getBar();
+
+void test () {
+ Foo x = FooA;
+ Bar y = BarD;
+ Baz z = name1::B3;
+ name1::Foo a;
+ oneFoo b;
+ twoFoo c;
+
+ while (x == FooA);
+ while (y == BarD);
+ while (a == name1::F1);
+ while (z == name1::B2);
+ while (a == b);
+ while (a == c);
+ while (b == c);
+ while (B1 == name1::B2);
+ while (B2 == name2::B1);
+ while (x == AnonAA);
+ while (AnonBB == y);
+ while (AnonAA == AnonAB);
+ while (AnonAB == AnonBA);
+ while (AnonBB == AnonAA);
+
+ while ((x) == FooA);
+ while ((y) == BarD);
+ while ((a) == name1::F1);
+ while (z == (name1::B2));
+ while (a == (b));
+ while (a == (c));
+ while ((b) == (c));
+ while ((B1) == (name1::B2));
+ while ((B2) == (name2::B1));
+
+ while (((x)) == FooA);
+ while ((y) == (BarD));
+ while ((a) == (name1::F1));
+ while (z == (name1::B2));
+ while ((a) == ((((b)))));
+ while (((a)) == (c));
+ while ((b) == (((c))));
+ while ((((((B1))))) == (((name1::B2))));
+ while (B2 == ((((((name2::B1)))))));
+
+ while (B1 == B2); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+ while (name1::B2 == name2::B3); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+ while (z == name2::B2); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+
+ while (((((B1)))) == B2); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+ while (name1::B2 == (name2::B3)); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+ while (z == ((((name2::B2))))); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+
+ while ((((B1))) == (((B2)))); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+ while ((name1::B2) == (((name2::B3)))); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+ while ((((z))) == (name2::B2)); // expected-warning {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
+
+ while (x == a); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'name1::Foo')}}
+ while (x == b); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'oneFoo' (aka 'name1::Foo'))}}
+ while (x == c); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'twoFoo' (aka 'name1::Foo'))}}
+
+ while (x == y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x != y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x >= y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x <= y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x > y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x < y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (FooB == y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB != y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB >= y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB <= y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB > y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB < y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (FooB == BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB != BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB >= BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB <= BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB > BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB < BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (x == BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x != BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x >= BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x <= BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x > BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x < BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (getFoo() == y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() != y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() >= y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() <= y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() > y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() < y); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (getFoo() == BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() != BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() >= BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() <= BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() > BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() < BarD); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (getFoo() == getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() != getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() >= getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() <= getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() > getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (getFoo() < getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (FooB == getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB != getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB >= getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB <= getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB > getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (FooB < getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+ while (x == getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x != getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x >= getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x <= getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x > getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+ while (x < getBar()); // expected-warning {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
+
+
+
+ while (y == x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y != x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y >= x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y <= x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y > x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y < x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (y == FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y != FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y >= FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y <= FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y > FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y < FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (BarD == FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD != FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD >= FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD <= FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD > FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD <FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (BarD == x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD != x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD >= x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD <= x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD < x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD > x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (y == getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y != getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y >= getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y <= getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y > getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (y < getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (BarD == getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD != getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD >= getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD <= getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD > getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (BarD < getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (getBar() == getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() != getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() >= getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() <= getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() > getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() < getFoo()); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (getBar() == FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() != FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() >= FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() <= FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() > FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() < FooB); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+ while (getBar() == x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() != x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() >= x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() <= x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() > x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+ while (getBar() < x); // expected-warning {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
+
+}
diff --git a/test/SemaCXX/warn-global-constructors.cpp b/test/SemaCXX/warn-global-constructors.cpp
index 107bbe129f67..ad609545ece1 100644
--- a/test/SemaCXX/warn-global-constructors.cpp
+++ b/test/SemaCXX/warn-global-constructors.cpp
@@ -25,8 +25,8 @@ namespace test1 {
A e = A(A());
A f = A(a); // expected-warning {{global constructor}}
A g(a); // expected-warning {{global constructor}}
- A h((A())); // expected-warning {{global constructor}}
- A i((A(A()))); // expected-warning {{global constructor}}
+ A h((A())); // elided
+ A i((A(A()))); // elided
}
namespace test2 {
@@ -72,10 +72,26 @@ namespace test6 {
struct A { ~A(); };
void f1() {
- static A a; // expected-warning {{global destructor}}
+ static A a;
}
void f2() {
static A& a = *new A;
}
+}
+
+namespace pr8095 {
+ struct Foo {
+ int x;
+ Foo(int x1) : x(x1) {}
+ };
+ void foo() {
+ static Foo a(0);
+ }
-} \ No newline at end of file
+ struct Bar {
+ ~Bar();
+ };
+ void bar() {
+ static Bar b;
+ }
+}
diff --git a/test/SemaCXX/warn-large-by-value-copy.cpp b/test/SemaCXX/warn-large-by-value-copy.cpp
new file mode 100644
index 000000000000..39dbd7697d26
--- /dev/null
+++ b/test/SemaCXX/warn-large-by-value-copy.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -Wlarge-by-value-copy=100 %s
+
+// rdar://8548050
+namespace rdar8548050 {
+
+struct S100 {
+ char x[100];
+};
+
+struct S101 {
+ char x[101];
+};
+
+S100 f100(S100 s) { return s; }
+
+S101 f101(S101 s) { return s; } // expected-warning {{return value of 'f101' is a large (101 bytes) pass-by-value object}} \
+ // expected-warning {{'s' is a large (101 bytes) pass-by-value argument}}
+
+typedef int Arr[200];
+void farr(Arr a) { }
+
+struct NonPOD {
+ char x[200];
+ virtual void m();
+};
+
+NonPOD fNonPOD(NonPOD s) { return s; }
+
+template <unsigned size>
+struct TS {
+ char x[size];
+};
+
+template <unsigned size>
+void tf(TS<size> ts) {} // expected-warning {{ts' is a large (300 bytes) pass-by-value argument}}
+
+void g() {
+ TS<300> ts;
+ tf<300>(ts); // expected-note {{instantiation}}
+}
+
+}
diff --git a/test/SemaCXX/warn-literal-conversion.cpp b/test/SemaCXX/warn-literal-conversion.cpp
new file mode 100644
index 000000000000..dab5c01bf6b0
--- /dev/null
+++ b/test/SemaCXX/warn-literal-conversion.cpp
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -fsyntax-only -Wliteral-conversion -verify %s
+
+void foo(int y);
+
+// Warn when a literal float or double is assigned or bound to an integer.
+void test0() {
+ // Float
+ 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}}
+ // 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}}
+
+ // Test assignment to an existing variable.
+ y8 = 2.22F; // expected-warning {{implicit conversion turns literal floating-point number into integer}}
+
+ // Test direct initialization.
+ int y9(1.23F); // expected-warning {{implicit conversion turns literal floating-point number into integer}}
+
+ // Test passing a literal floating-point value to a function that takes an integer.
+ foo(1.2F); // expected-warning {{implicit conversion turns literal floating-point number into integer}}
+
+ // FIXME: -Wconversion-literal doesn't catch "-1.2F".
+ int y10 = -1.2F;
+
+ // -Wconversion-literal does NOT catch const values.
+ // (-Wconversion DOES catch them.)
+ static const float sales_tax_rate = .095F;
+ int z = sales_tax_rate;
+ foo(sales_tax_rate);
+
+ // Expressions, such as those that indicate rounding-down, should NOT produce warnings.
+ int x = 24 * 0.5;
+ int y = (24*60*60) * 0.25;
+ int pennies = 123.45 * 100;
+}
diff --git a/test/SemaCXX/warn-missing-noreturn.cpp b/test/SemaCXX/warn-missing-noreturn.cpp
index f2f9b2e2b751..4caff66af703 100644
--- a/test/SemaCXX/warn-missing-noreturn.cpp
+++ b/test/SemaCXX/warn-missing-noreturn.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type
void f() __attribute__((noreturn));
template<typename T> void g(T) { // expected-warning {{function could be attribute 'noreturn'}}
@@ -50,3 +50,56 @@ void f_R7880658(R7880658 f, R7880658 l) { // no-warning
for (; f != l; ++f) {
}
}
+
+namespace test2 {
+
+ bool g();
+ void *h() __attribute__((noreturn));
+ void *j();
+
+ struct A {
+ void *f;
+
+ A() : f(0) { }
+ A(int) : f(h()) { } // expected-warning {{function could be attribute 'noreturn'}}
+ A(char) : f(j()) { }
+ A(bool b) : f(b ? h() : j()) { }
+ };
+}
+
+namespace test3 {
+ struct A {
+ ~A();
+ };
+
+ struct B {
+ ~B() { }
+
+ A a;
+ };
+
+ struct C : A {
+ ~C() { }
+ };
+}
+
+// <rdar://problem/8875247> - Properly handle CFGs with destructors.
+struct rdar8875247 {
+ ~rdar8875247 ();
+};
+void rdar8875247_aux();
+
+int rdar8875247_test() {
+ rdar8875247 f;
+} // expected-warning{{control reaches end of non-void function}}
+
+struct rdar8875247_B {
+ rdar8875247_B();
+ ~rdar8875247_B();
+};
+
+rdar8875247_B test_rdar8875247_B() {
+ rdar8875247_B f;
+ return f;
+} // no-warning
+
diff --git a/test/SemaCXX/warn-overloaded-virtual.cpp b/test/SemaCXX/warn-overloaded-virtual.cpp
new file mode 100644
index 000000000000..86b1d2365f93
--- /dev/null
+++ b/test/SemaCXX/warn-overloaded-virtual.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fsyntax-only -Woverloaded-virtual -verify %s
+
+struct B1 {
+ virtual void foo(int); // expected-note {{declared here}}
+ virtual void foo(); // expected-note {{declared here}}
+};
+
+struct S1 : public B1 {
+ void foo(float); // expected-warning {{hides overloaded virtual functions}}
+};
+
+struct S2 : public B1 {
+ void foo(); // expected-note {{declared here}}
+};
+
+struct B2 {
+ virtual void foo(void*); // expected-note {{declared here}}
+};
+
+struct MS1 : public S2, public B2 {
+ virtual void foo(int); // expected-warning {{hides overloaded virtual functions}}
+};
+
+struct B3 {
+ virtual void foo(int);
+ virtual void foo();
+};
+
+struct S3 : public B3 {
+ using B3::foo;
+ void foo(float);
+};
+
+struct B4 {
+ virtual void foo();
+};
+
+struct S4 : public B4 {
+ void foo(float);
+ void foo();
+};
+
+namespace PR9182 {
+struct Base {
+ virtual void foo(int);
+};
+
+void Base::foo(int) { }
+
+struct Derived : public Base {
+ virtual void foo(int);
+ void foo(int, int);
+};
+}
diff --git a/test/SemaCXX/warn-self-assign.cpp b/test/SemaCXX/warn-self-assign.cpp
new file mode 100644
index 000000000000..fcdb2ab6bc63
--- /dev/null
+++ b/test/SemaCXX/warn-self-assign.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s
+
+void f() {
+ int a = 42, b = 42;
+ a = a; // expected-warning{{explicitly assigning}}
+ b = b; // expected-warning{{explicitly assigning}}
+ a = b;
+ b = a = b;
+ a = a = a; // expected-warning{{explicitly assigning}}
+ a = b = b = a;
+}
+
+// Dummy type.
+struct S {};
+
+void false_positives() {
+#define OP =
+#define LHS a
+#define RHS a
+ int a = 42;
+ // These shouldn't warn due to the use of the preprocessor.
+ a OP a;
+ LHS = a;
+ a = RHS;
+ LHS OP RHS;
+#undef OP
+#undef LHS
+#undef RHS
+
+ S s;
+ s = s; // Not a builtin assignment operator, no warning.
+
+ // Volatile stores aren't side-effect free.
+ volatile int vol_a;
+ vol_a = vol_a;
+ volatile int &vol_a_ref = vol_a;
+ vol_a_ref = vol_a_ref;
+}
+
+template <typename T> void g() {
+ T a;
+ a = a; // May or may not be a builtin assignment operator, no warning.
+}
+void instantiate() {
+ g<int>();
+ g<S>();
+}
diff --git a/test/SemaCXX/warn-shadow.cpp b/test/SemaCXX/warn-shadow.cpp
index 509c34435560..3bf9af414db0 100644
--- a/test/SemaCXX/warn-shadow.cpp
+++ b/test/SemaCXX/warn-shadow.cpp
@@ -42,3 +42,31 @@ class B : A {
int data;
static int field;
};
+
+// rdar://8900456
+namespace rdar8900456 {
+struct Foo {
+ static void Baz();
+private:
+ int Bar;
+};
+
+void Foo::Baz() {
+ double Bar = 12; // Don't warn.
+}
+}
+
+// http://llvm.org/PR9160
+namespace PR9160 {
+struct V {
+ V(int);
+};
+struct S {
+ V v;
+ static void m() {
+ if (1) {
+ V v(0);
+ }
+ }
+};
+}
diff --git a/test/SemaCXX/warn-unreachable.cpp b/test/SemaCXX/warn-unreachable.cpp
index f5601cd2df08..3c8a429b3e58 100644
--- a/test/SemaCXX/warn-unreachable.cpp
+++ b/test/SemaCXX/warn-unreachable.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks -Wunreachable-code -Wno-unused-value
+// RUN: %clang_cc1 %s -fexceptions -fsyntax-only -verify -fblocks -Wunreachable-code -Wno-unused-value
int &halt() __attribute__((noreturn));
int &live();
@@ -39,8 +39,10 @@ void test2() {
void test3() {
halt()
--; // expected-warning {{will never be executed}}
- halt()
- ? // expected-warning {{will never be executed}}
+ // FIXME: The unreachable part is just the '?', but really all of this
+ // code is unreachable and shouldn't be separately reported.
+ halt() // expected-warning {{will never be executed}}
+ ?
dead() : dead();
live(),
float // expected-warning {{will never be executed}}
diff --git a/test/SemaCXX/warn-unused-filescoped.cpp b/test/SemaCXX/warn-unused-filescoped.cpp
index 75fc6a4da0ba..c32acb0b48be 100644
--- a/test/SemaCXX/warn-unused-filescoped.cpp
+++ b/test/SemaCXX/warn-unused-filescoped.cpp
@@ -54,3 +54,27 @@ namespace {
};
template <> int TS2<int>::x; // expected-warning{{unused}}
}
+
+namespace PR8841 {
+ // Ensure that friends of class templates are considered to have a dependent
+ // context and not marked unused.
+ namespace {
+ template <typename T> struct X {
+ friend bool operator==(const X&, const X&) { return false; }
+ };
+ }
+ template <typename T> void template_test(X<T> x) {
+ (void)(x == x);
+ }
+ void test() {
+ X<int> x;
+ template_test(x);
+ }
+}
+
+namespace test4 {
+ namespace { struct A {}; }
+
+ void test(A a); // expected-warning {{unused function}}
+ extern "C" void test4(A a);
+}
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp
index 6992cdcd0902..8ae7d6ace4da 100644
--- a/test/SemaCXX/warn-unused-variables.cpp
+++ b/test/SemaCXX/warn-unused-variables.cpp
@@ -59,3 +59,9 @@ namespace PR6948 {
X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
}
}
+
+void unused_local_static() {
+ static int x = 0;
+ static int y = 0; // expected-warning{{unused variable 'y'}}
+#pragma unused(x)
+}
diff --git a/test/SemaCXX/warn_false_to_pointer.cpp b/test/SemaCXX/warn_false_to_pointer.cpp
index 3a873d886f0e..fb6f9551a7ac 100644
--- a/test/SemaCXX/warn_false_to_pointer.cpp
+++ b/test/SemaCXX/warn_false_to_pointer.cpp
@@ -5,5 +5,6 @@ int* j = false; // expected-warning{{ initialization of pointer of type 'int *'
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
new file mode 100644
index 000000000000..c89c88256426
--- /dev/null
+++ b/test/SemaCXX/writable-strings-deprecated.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
+// rdar://8827606
+
+char *fun(void)
+{
+ return "foo";
+}
+
+void test(bool b)
+{
+ ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
+}
diff --git a/test/SemaObjC/access-property-getter.m b/test/SemaObjC/access-property-getter.m
index 331bb30dd539..afaf82e73106 100644
--- a/test/SemaObjC/access-property-getter.m
+++ b/test/SemaObjC/access-property-getter.m
@@ -30,7 +30,7 @@
@implementation XCWorkQueueCommandCacheFetchInvocation
- (id)harvestPredictivelyProcessedOutputFiles
{
- _outputStream.release;
+ _outputStream.release; // expected-warning {{property access result unused - getters should not be used for side effects}}
return 0;
}
@end
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index a58068bf8324..d3d5f9537b73 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -97,3 +97,14 @@ __attribute ((deprecated))
@end
+@interface Test2
+@property int test2 __attribute__((deprecated));
+@end
+
+void test(Test2 *foo) {
+ int x;
+ x = foo.test2; // expected-warning {{'test2' is deprecated}}
+ x = [foo test2]; // expected-warning {{'test2' is deprecated}}
+ foo.test2 = x; // expected-warning {{'test2' is deprecated}}
+ [foo setTest2: x]; // expected-warning {{'setTest2:' is deprecated}}
+}
diff --git a/test/SemaObjC/bad-receiver-1.m b/test/SemaObjC/bad-receiver-1.m
index 33e163086475..fe3eecff2bcf 100644
--- a/test/SemaObjC/bad-receiver-1.m
+++ b/test/SemaObjC/bad-receiver-1.m
@@ -16,6 +16,6 @@ typedef const struct __CFString * CFStringRef;
void func() {
CFStringRef obj;
- [obj self]; // expected-warning {{receiver type 'CFStringRef' (aka 'struct __CFString const *') is not 'id'}} \\
+ [obj self]; // expected-warning {{receiver type 'CFStringRef' (aka 'const struct __CFString *') is not 'id'}} \\
expected-warning {{method '-self' not found}}
}
diff --git a/test/SemaObjC/block-attr.m b/test/SemaObjC/block-attr.m
index de203e711ede..80092fc31c1a 100644
--- a/test/SemaObjC/block-attr.m
+++ b/test/SemaObjC/block-attr.m
@@ -6,5 +6,7 @@
@property void(^someBlock)(void); // expected-warning {{'copy' attribute must be specified for the block property}}
@property(copy) void(^OK)(void);
+// rdar://8820813
+@property (readonly) void (^block)(void); // readonly property is OK
@end
diff --git a/test/SemaObjC/block-return.m b/test/SemaObjC/block-return.m
new file mode 100644
index 000000000000..15c3fb64d778
--- /dev/null
+++ b/test/SemaObjC/block-return.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -fblocks -fobjc-gc-only %s
+// rdar://8979379
+
+@interface NSString
+- (__attribute__((objc_gc(strong))) const char *)UTF8String;
+@end
+
+int main() {
+__attribute__((objc_gc(strong))) char const *(^libraryNameForIndex)() = ^() {
+ NSString *moduleName;
+ return [moduleName UTF8String];
+ };
+}
diff --git a/test/SemaObjC/builtin_objc_lib_functions.m b/test/SemaObjC/builtin_objc_lib_functions.m
new file mode 100644
index 000000000000..02b05b95b862
--- /dev/null
+++ b/test/SemaObjC/builtin_objc_lib_functions.m
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify
+// rdar://8592641
+Class f0() { return objc_getClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getClass' with type 'id (const char *)'}} \
+ // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getClass'}}
+
+// rdar://8735023
+Class f1() { return objc_getMetaClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getMetaClass' with type 'id (const char *)'}} \
+ // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getMetaClass'}}
+
+void f2(id val) { objc_enumerationMutation(val); } // expected-warning {{implicitly declaring C library function 'objc_enumerationMutation' with type 'void (id)'}} \
+ // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_enumerationMutation'}}
+
+long double f3(id self, SEL op) { return objc_msgSend_fpret(self, op); } // expected-warning {{implicitly declaring C library function 'objc_msgSend_fpret' with type 'long double (id, SEL, ...)'}} \
+ // expected-note {{please include the header <objc/message.h> or explicitly provide a declaration for 'objc_msgSend_fpret'}}
+
+id f4(struct objc_super *super, SEL op) { // expected-warning {{declaration of 'struct objc_super' will not be visible outside of this function}}
+ return objc_msgSendSuper(super, op); // expected-warning {{implicitly declaring C library function 'objc_msgSendSuper' with type 'id (void *, SEL, ...)'}} \
+ // expected-note {{please include the header <objc/message.h> or explicitly provide a declaration for 'objc_msgSendSuper'}}
+}
+
+id f5(id val, id *dest) {
+ return objc_assign_strongCast(val, dest); // expected-warning {{implicitly declaring C library function 'objc_assign_strongCast' with type 'id (id, id *)'}} \
+ // expected-note {{please include the header </objc/objc-auto.h> or explicitly provide a declaration for 'objc_assign_strongCast'}}
+}
+
+int f6(Class exceptionClass, id exception) {
+ return objc_exception_match(exceptionClass, exception); // expected-warning {{implicitly declaring C library function 'objc_exception_match' with type 'int (id, id)'}} \
+ // expected-note {{please include the header </objc/objc-exception.h> or explicitly provide a declaration for 'objc_exception_match'}}
+}
diff --git a/test/SemaObjC/builtin_objc_msgSend.m b/test/SemaObjC/builtin_objc_msgSend.m
new file mode 100644
index 000000000000..bf17225a0417
--- /dev/null
+++ b/test/SemaObjC/builtin_objc_msgSend.m
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar://8632525
+extern id objc_msgSend(id self, SEL op, ...);
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index 043314d4e182..84a625c404ec 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -35,7 +35,7 @@ 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')}}
+ 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) class_func2
diff --git a/test/SemaObjC/category-1.m b/test/SemaObjC/category-1.m
index 18cbb83fef35..4cc5dafaa91b 100644
--- a/test/SemaObjC/category-1.m
+++ b/test/SemaObjC/category-1.m
@@ -62,7 +62,7 @@
// <rdar://problem/7249233>
@protocol MultipleCat_P
--(void) im0; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+-(void) im0; // expected-note {{method declared here}}
@end
@interface MultipleCat_I @end // expected-note {{required for direct or indirect protocol 'MultipleCat_P'}}
@@ -71,9 +71,27 @@
@interface MultipleCat_I() <MultipleCat_P> @end
-@implementation MultipleCat_I // expected-warning {{incomplete implementation}}
+@implementation MultipleCat_I // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
@end
// <rdar://problem/7680391> - Handle nameless categories with no name that refer
// to an undefined class
@interface RDar7680391 () @end // expected-error{{cannot find interface declaration}}
+
+// <rdar://problem/8891119> - Handle @synthesize being used in conjunction
+// with explicitly declared accessor.
+@interface RDar8891119 {
+ id _name;
+}
+@end
+@interface RDar8891119 ()
+- (id)name;
+@end
+@interface RDar8891119 ()
+@property (copy) id name;
+@end
+@implementation RDar8891119
+@synthesize name = _name;
+@end
+
diff --git a/test/SemaObjC/class-conforming-protocol-2.m b/test/SemaObjC/class-conforming-protocol-2.m
index fcf9146a110f..a3bd0b1d2398 100644
--- a/test/SemaObjC/class-conforming-protocol-2.m
+++ b/test/SemaObjC/class-conforming-protocol-2.m
@@ -1,22 +1,23 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
@protocol NSWindowDelegate @end
-@interface NSWindow
-- (void)setDelegate:(id <NSWindowDelegate>)anObject;
-- (id <NSWindowDelegate>) delegate;
+@protocol IBStringsTableWindowDelegate <NSWindowDelegate>
@end
-@protocol IBStringsTableWindowDelegate <NSWindowDelegate>
+@interface NSWindow
+- (void)setDelegate:(id <NSWindowDelegate>)anObject; // expected-note {{previous definition is here}}
+- (id <IBStringsTableWindowDelegate>) delegate; // expected-note {{previous definition is here}}
@end
+
@interface IBStringsTableWindow : NSWindow {}
@end
@implementation IBStringsTableWindow
-- (void)setDelegate:(id <IBStringsTableWindowDelegate>)delegate {
+- (void)setDelegate:(id <IBStringsTableWindowDelegate>)delegate { // expected-warning {{conflicting parameter types in implementation of 'setDelegate:'}}
}
-- (id <IBStringsTableWindowDelegate>)delegate {
+- (id <NSWindowDelegate>)delegate { // expected-warning {{conflicting return type in implementation of 'delegate':}}
return 0;
}
@end
diff --git a/test/SemaObjC/class-method-lookup.m b/test/SemaObjC/class-method-lookup.m
index f26d692328a2..8c8c21682f1e 100644
--- a/test/SemaObjC/class-method-lookup.m
+++ b/test/SemaObjC/class-method-lookup.m
@@ -20,7 +20,7 @@
[self rootInstanceMethod]; /* class is searched for an instance method */
[MyIntermediate rootInstanceMethod]; /* with the same name. */
- [self instanceMethod];// expected-warning {{'-instanceMethod' not found (return type defaults to 'id')}}
+ [self instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
[MyDerived instanceMethod];// expected-warning {{'+instanceMethod' not found (return type defaults to 'id')}}
}
@end
diff --git a/test/SemaObjC/compare-qualified-class.m b/test/SemaObjC/compare-qualified-class.m
index cb2b26a4f70f..0f415b607dd7 100644
--- a/test/SemaObjC/compare-qualified-class.m
+++ b/test/SemaObjC/compare-qualified-class.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar:// 8191774
+// rdar://8191774
@protocol SomeProtocol
@end
diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m
index 08fb36688309..ce0db191ea9a 100644
--- a/test/SemaObjC/compare-qualified-id.m
+++ b/test/SemaObjC/compare-qualified-id.m
@@ -5,7 +5,7 @@ typedef unsigned int NSUInteger;
typedef struct _NSZone NSZone;
@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
@protocol NSObject - (BOOL)isEqual:(id)object; @end
-@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+@protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end // expected-note {{method declared here}}
@protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end
@protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; @end
@interface NSObject <NSObject> {} @end
@@ -23,7 +23,8 @@ extern NSString * const NSTaskDidTerminateNotification;
- (NSString *)evaluateAsStringInContext:(XCPropertyExpansionContext *)context withNestingState:(const void *)state;
@end
-@implementation XCPropertyExpansionContext // expected-warning {{incomplete implementation}}
+@implementation XCPropertyExpansionContext // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (NSString *)expandedValueForProperty:(NSString *)property {
id <XCPropertyValues> cachedValueNode = [_propNamesToPropValuesCache objectForKey:property]; // expected-warning {{method '-objectForKey:' not found (return type defaults to 'id')}}
if (cachedValueNode == ((void *)0)) { }
diff --git a/test/SemaObjC/comptypes-10.m b/test/SemaObjC/comptypes-10.m
new file mode 100644
index 000000000000..0a2219099fb6
--- /dev/null
+++ b/test/SemaObjC/comptypes-10.m
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+//rdar: //8591619
+// pr8453
+
+@protocol NSCopying @end
+@protocol NSPROTO @end
+@protocol NSPROTO1 @end
+@protocol NSPROTO2 @end
+
+@interface NSObject <NSCopying, NSPROTO, NSPROTO1> {
+ Class isa;
+}
+@end
+
+void gorf(NSObject <NSCopying> *); // expected-note {{passing argument to parameter here}}
+
+NSObject <NSCopying> *foo(id <NSCopying> bar, id id_obj)
+{
+ NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying>'}}
+ NSObject *Init1 = bar; // expected-warning {{initializing 'NSObject *' with an expression of incompatible type 'id<NSCopying>'}}
+
+ NSObject <NSCopying> *I = id_obj;
+ NSObject *I1 = id_obj;
+ gorf(bar); // expected-warning {{passing 'id<NSCopying>' to parameter of incompatible type 'NSObject<NSCopying> *'}}
+
+ gorf(id_obj);
+
+ return bar; // expected-warning {{returning 'id<NSCopying>' from a function with incompatible result type 'NSObject<NSCopying> *'}}
+}
+
+void test(id <NSCopying, NSPROTO, NSPROTO2> bar)
+{
+ NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying,NSPROTO,NSPROTO2>'}}
+}
diff --git a/test/SemaObjC/comptypes-a.m b/test/SemaObjC/comptypes-a.m
index d48dfe4074fc..8480f524dc72 100644
--- a/test/SemaObjC/comptypes-a.m
+++ b/test/SemaObjC/comptypes-a.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -fsyntax-only -Wmethod-signatures -verify -pedantic %s
typedef signed char BOOL;
typedef int NSInteger;
@@ -18,7 +18,8 @@ NSInteger codeAssistantCaseCompareItems(id<PBXCompletionItem> a, id<PBXCompletio
@interface TedWantsToVerifyObjCDoesTheRightThing
-- compareThis:(int)a withThat:(id)b; // expected-note {{previous definition is here}}
+- compareThis:(int)a withThat:(id)b; // expected-note {{previous definition is here}} \
+ // expected-note {{previous definition is here}}
@end
@@ -26,7 +27,7 @@ NSInteger codeAssistantCaseCompareItems(id<PBXCompletionItem> a, id<PBXCompletio
- compareThis:(id<PBXCompletionItem>)
a // expected-warning {{conflicting parameter types in implementation of 'compareThis:withThat:': 'int' vs 'id<PBXCompletionItem>'}}
- withThat:(id<PBXCompletionItem>)b {
+ withThat:(id<PBXCompletionItem>)b { // expected-warning {{conflicting parameter types in implementation of 'compareThis:withThat:': 'id' vs 'id<PBXCompletionItem>'}}
return self;
}
diff --git a/test/SemaObjC/conditional-expr-4.m b/test/SemaObjC/conditional-expr-4.m
index b3317f58061d..56bcfc2de6fd 100644
--- a/test/SemaObjC/conditional-expr-4.m
+++ b/test/SemaObjC/conditional-expr-4.m
@@ -26,7 +26,7 @@ A *f1_a(int cond, A *a) {
}
void *f1_const_a(int x, void *p, const A * q) {
- void *r = x ? p : q; // expected-warning{{initializing 'void *' with an expression of type 'void const *' discards qualifiers}}
+ void *r = x ? p : q; // expected-warning{{initializing 'void *' with an expression of type 'const void *' discards qualifiers}}
return r;
}
diff --git a/test/SemaObjC/conflict-nonfragile-abi2.m b/test/SemaObjC/conflict-nonfragile-abi2.m
index e4b513f75312..86947cf7643c 100644
--- a/test/SemaObjC/conflict-nonfragile-abi2.m
+++ b/test/SemaObjC/conflict-nonfragile-abi2.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fobjc-nonfragile-abi -verify -fsyntax-only %s
-// rdar : // 8225011
+// rdar://8225011
int glob; // expected-note {{global variable declared here}}
@@ -15,7 +15,7 @@ int glob; // expected-note {{global variable declared here}}
@implementation I
- (int) Meth { return glob; } // expected-warning {{when default property synthesis is on, 'glob' lookup will access}}
@synthesize glob;
-// rdar: // 8248681
+// rdar://8248681
- (int) Meth1: (int) p {
extern int le;
int l = 1;
diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m
index 252518239f16..700cf61eedb5 100644
--- a/test/SemaObjC/continuation-class-err.m
+++ b/test/SemaObjC/continuation-class-err.m
@@ -12,7 +12,7 @@
@interface ReadOnly ()
@property(readwrite, copy) id object; // expected-warning {{property attribute in continuation class does not match the primary class}}
-@property(readonly) id object1; // expected-error {{illegal declaration of property in continuation class 'ReadOnly': attribute must be}}
+@property(readonly) id object1; // expected-error {{illegal redeclaration of property in continuation class 'ReadOnly' (attribute must be 'readwrite', while its primary must be 'readonly')}}
@property (readwrite, assign) int indentLevel; // OK. assign the the default in any case.
@end
@@ -31,8 +31,8 @@
@end
@interface Bar ()
-@property (copy) id foo; // expected-error {{illegal declaration of property in continuation class 'Bar': attribute must be}}
-@property (copy) id fee; // expected-error {{illegal declaration of property in continuation class 'Bar': attribute must be}}
+@property (copy) id foo; // expected-error {{illegal redeclaration of property in continuation class 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
+@property (copy) id fee; // expected-error {{illegal redeclaration of property in continuation class 'Bar' (attribute must be 'readwrite', while its primary must be 'readonly')}}
@end
@implementation Bar
diff --git a/test/SemaObjC/crash-label.m b/test/SemaObjC/crash-label.m
index ffcb46344e24..405d6bfd49e4 100644
--- a/test/SemaObjC/crash-label.m
+++ b/test/SemaObjC/crash-label.m
@@ -7,4 +7,4 @@ Exit: [nilArgs release]; // expected-error {{use of undeclared identifier}}
- (NSDictionary *) _setupKernelStandardMode:(NSString *)source { // expected-error 2 {{expected a type}} \
expected-error {{missing context for method declaration}} \
expected-note{{to match this '{'}}
- Exit: if(_ciKernel && !success ) { // expected-error {{use of undeclared identifier}} // expected-error 2 {{expected}} expected-note{{to match this '{'}}
+ Exit: if(_ciKernel && !success ) { // expected-error {{use of undeclared identifier}} // expected-error 2 {{expected}} expected-note{{to match this '{'}} expected-error{{use of undeclared identifier 'success'}}
diff --git a/test/SemaObjC/custom-atomic-property.m b/test/SemaObjC/custom-atomic-property.m
new file mode 100644
index 000000000000..f80119e14903
--- /dev/null
+++ b/test/SemaObjC/custom-atomic-property.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -Wcustom-atomic-properties -verify %s
+
+@interface Foo
+@property (assign) Foo *myProp; // expected-note {{property declared here}} expected-note {{property declared here}}
+@end
+
+@implementation Foo
+ -(Foo*)myProp {return 0;} // expected-warning {{atomic by default property 'myProp' has a user defined getter (property should be marked 'atomic' if this is intended)}}
+ -(void)setMyProp:(Foo*)e {} // expected-warning {{atomic by default property 'myProp' has a user defined setter (property should be marked 'atomic' if this is intended)}}
+@end
+
+@interface Foo2 {
+ Foo *myProp;
+}
+@property (assign) Foo *myProp;
+@end
+
+@implementation Foo2
+@synthesize myProp; // no warnings.
+@end
diff --git a/test/SemaObjC/default-synthesize-1.m b/test/SemaObjC/default-synthesize-1.m
index 374fa8314bfd..a55834dd3016 100644
--- a/test/SemaObjC/default-synthesize-1.m
+++ b/test/SemaObjC/default-synthesize-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
@interface NSObject
- (void) release;
diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m
index 0586daea8796..33e3bd6f3464 100644
--- a/test/SemaObjC/default-synthesize.m
+++ b/test/SemaObjC/default-synthesize.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
@interface NSString @end
@@ -94,7 +94,7 @@
@implementation SubClass @end
-// rdar: // 7920807
+// rdar://7920807
@interface C @end
@interface C (Category)
@property int p; // expected-warning {{property 'p' requires method 'p' to be defined }} \
diff --git a/test/SemaObjC/direct-synthesized-ivar-access.m b/test/SemaObjC/direct-synthesized-ivar-access.m
new file mode 100644
index 000000000000..a72fb5f19c7a
--- /dev/null
+++ b/test/SemaObjC/direct-synthesized-ivar-access.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -Wnonfragile-abi2 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
+// rdar://8673791
+
+@interface I {
+}
+
+@property int IVAR; // expected-note {{property declared here}}
+- (int) OK;
+@end
+
+@implementation I
+- (int) Meth { return IVAR; } // expected-warning {{direct access of synthesized ivar by using property access 'IVAR'}}
+- (int) OK { return self.IVAR; }
+@end
diff --git a/test/SemaObjC/duplicate-ivar-in-class-extension.m b/test/SemaObjC/duplicate-ivar-in-class-extension.m
index b66736f330f4..0507b352f602 100644
--- a/test/SemaObjC/duplicate-ivar-in-class-extension.m
+++ b/test/SemaObjC/duplicate-ivar-in-class-extension.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface Root @end
diff --git a/test/SemaObjC/duplicate-property-class-extension.m b/test/SemaObjC/duplicate-property-class-extension.m
index a84f83f81fd7..bf48ed61d863 100644
--- a/test/SemaObjC/duplicate-property-class-extension.m
+++ b/test/SemaObjC/duplicate-property-class-extension.m
@@ -1,21 +1,24 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7629420
@interface Foo
-@property (readonly) char foo; // expected-note {{property declared here}}
+@property (readonly) char foo;
+@property (readwrite) char bar; // expected-note {{property declared here}}
@end
@interface Foo ()
-@property (readwrite) char foo; // OK
+@property (readwrite) char foo; // expected-note 2 {{property declared here}}
@property (readwrite) char NewProperty; // expected-note 2 {{property declared here}}
+@property (readwrite) char bar; // expected-error{{illegal redeclaration of 'readwrite' property in continuation class 'Foo' (perhaps you intended this to be a 'readwrite' redeclaration of a 'readonly' public property?)}}
@end
@interface Foo ()
-@property (readwrite) char foo; // OK again, make primary property readwrite for 2nd time!
-@property (readwrite) char NewProperty; // expected-error {{illegal declaration of property in continuation class 'Foo': attribute must be readwrite, while its primary must be readonly}}
+@property (readwrite) char foo; // expected-error {{property has a previous declaration}}
+@property (readwrite) char NewProperty; // expected-error {{property has a previous declaration}}
@end
@interface Foo ()
-@property (readonly) char foo; // expected-error {{illegal declaration of property in continuation class 'Foo': attribute must be readwrite, while its primary must be readonly}}
-@property (readwrite) char NewProperty; // expected-error {{illegal declaration of property in continuation class 'Foo': attribute must be readwrite, while its primary must be readonly}}
+@property (readonly) char foo; // expected-error {{property has a previous declaration}}
+@property (readwrite) char NewProperty; // expected-error {{property has a previous declaration}}
@end
diff --git a/test/SemaObjC/error-missing-getter.m b/test/SemaObjC/error-missing-getter.m
new file mode 100644
index 000000000000..3c91ab2ffcd0
--- /dev/null
+++ b/test/SemaObjC/error-missing-getter.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8155806
+
+@interface Subclass
+{
+ int setterOnly;
+}
+- (void) setSetterOnly : (int) arg;
+@end
+
+int func (int arg, Subclass *x) {
+ if (x.setterOnly) { // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+ x.setterOnly = 1;
+ }
+ func(x.setterOnly + 1, x); // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+ int i = x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+ return x.setterOnly + 1; // expected-error {{expected getter method not found on object of type 'Subclass *'}}
+}
+
diff --git a/test/SemaObjC/error-property-gc-attr.m b/test/SemaObjC/error-property-gc-attr.m
index 661638c52e06..a77b68bff0ea 100644
--- a/test/SemaObjC/error-property-gc-attr.m
+++ b/test/SemaObjC/error-property-gc-attr.m
@@ -20,9 +20,9 @@
@implementation INTF
@synthesize pweak=IVAR; // expected-error {{existing ivar 'IVAR' for __weak property 'pweak' must be __weak}}
-@synthesize NOT=II; // expected-error {{existing ivar 'II' for a __strong property 'NOT' must be garbage collectable}}
+@synthesize NOT=II; // expected-error {{property 'NOT' must be declared __weak to match existing ivar 'II' with __weak attribute}}
@synthesize WID;
@synthesize ID;
-@synthesize AWEAK; // expected-error {{existing ivar 'AWEAK' for a __strong property 'AWEAK' must be garbage collectable}}
+@synthesize AWEAK; // expected-error {{property 'AWEAK' must be declared __weak to match existing ivar 'AWEAK' with __weak attribute}}
@synthesize WI;
@end
diff --git a/test/SemaObjC/exprs.m b/test/SemaObjC/exprs.m
index 3370bda0517a..13c34e5650de 100644
--- a/test/SemaObjC/exprs.m
+++ b/test/SemaObjC/exprs.m
@@ -22,3 +22,13 @@ void test2() {
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
void (^foo)(int, int) = ^(int x, int y) { int z = MAX(x, y); };
+
+
+
+// rdar://8445858
+@class Object;
+static Object *g;
+void test3(Object *o) {
+ // this is ok.
+ __sync_bool_compare_and_swap(&g, 0, o);
+}
diff --git a/test/SemaObjC/format-arg-attribute.m b/test/SemaObjC/format-arg-attribute.m
index 264e7a8179da..98dff3aa7a7b 100644
--- a/test/SemaObjC/format-arg-attribute.m
+++ b/test/SemaObjC/format-arg-attribute.m
@@ -9,9 +9,9 @@ extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-err
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)}}
-struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
-union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
-enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to function types}}
+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)}}
diff --git a/test/SemaObjC/ibaction.m b/test/SemaObjC/ibaction.m
index b97e002833c9..bcedf8334047 100644
--- a/test/SemaObjC/ibaction.m
+++ b/test/SemaObjC/ibaction.m
@@ -4,10 +4,12 @@
{
__attribute__((iboutlet)) id myoutlet;
}
++ (void) __attribute__((ibaction)) myClassMethod:(id)msg; // expected-warning{{ibaction attribute can only be applied to Objective-C instance methods}}
- (void) __attribute__((ibaction)) myMessage:(id)msg;
@end
@implementation Foo
++ (void) __attribute__((ibaction)) myClassMethod:(id)msg {} // expected-warning{{ibaction attribute can only be applied to Objective-C instance methods}}
// Normally attributes should not be attached to method definitions, but
// we allow 'ibaction' to be attached because it can be expanded from
// the IBAction macro.
diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m
index fb64e3a9f534..217daa7c3b58 100644
--- a/test/SemaObjC/iboutletcollection-attr.m
+++ b/test/SemaObjC/iboutletcollection-attr.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
-// rdar: // 8308053
+// rdar://8308053
@interface I {
__attribute__((iboutletcollection(I))) id ivar1;
diff --git a/test/SemaObjC/incomplete-implementation.m b/test/SemaObjC/incomplete-implementation.m
new file mode 100644
index 000000000000..612c331ae8c2
--- /dev/null
+++ b/test/SemaObjC/incomplete-implementation.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface I
+- Meth; // expected-note{{method definition for 'Meth' not found}}
+@end
+
+@implementation I // expected-warning{{incomplete implementation}}
+@end
+
+@implementation I(CAT)
+- Meth {return 0;}
+@end
+
+#pragma GCC diagnostic ignored "-Wincomplete-implementation"
+@interface I2
+- Meth;
+@end
+
+@implementation I2
+@end
+
+@implementation I2(CAT)
+- Meth {return 0;}
+@end
+
+
diff --git a/test/SemaObjC/ivar-in-class-extension-error.m b/test/SemaObjC/ivar-in-class-extension-error.m
index 6e0b577976d6..23a7491aafb1 100644
--- a/test/SemaObjC/ivar-in-class-extension-error.m
+++ b/test/SemaObjC/ivar-in-class-extension-error.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar:// 6812436
+// rdar://6812436
@interface A @end
diff --git a/test/SemaObjC/ivar-in-class-extension.m b/test/SemaObjC/ivar-in-class-extension.m
index 4130d8f96252..b5772f6a4ca3 100644
--- a/test/SemaObjC/ivar-in-class-extension.m
+++ b/test/SemaObjC/ivar-in-class-extension.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface SomeClass @end
diff --git a/test/SemaObjC/ivar-in-implementations.m b/test/SemaObjC/ivar-in-implementations.m
index 4060526b44d5..74db3224007a 100644
--- a/test/SemaObjC/ivar-in-implementations.m
+++ b/test/SemaObjC/ivar-in-implementations.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
@interface Super @end
diff --git a/test/SemaObjC/method-arg-decay.m b/test/SemaObjC/method-arg-decay.m
index 012a3eeba0d3..6e11e97898d6 100644
--- a/test/SemaObjC/method-arg-decay.m
+++ b/test/SemaObjC/method-arg-decay.m
@@ -56,7 +56,7 @@ PBXFindMatchContains, PBXFindMatchStartsWith, PBXFindMatchWholeWords,
@interface PBXProjectModule : PBXModule <PBXFindableText> {
}
@end @class PBXBookmark;
-@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+@protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection; // expected-note {{method declared here}}
@end @class XCPropertyDictionary, XCPropertyCondition, XCPropertyConditionSet, XCMutablePropertyConditionSet;
extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExposedModulesOnly);
@interface NSString (StringUtilities) - (NSString *) trimToLength:(NSInteger)length preserveRange:(NSRange)range;
@@ -72,7 +72,8 @@ extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExpos
}
- (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}}
@end
-@implementation XCPerspectiveModule // expected-warning {{incomplete implementation}}
+@implementation XCPerspectiveModule // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+ (void) openForProjectDocument:(PBXProjectDocument *)projectDocument {
}
- (PBXModule *) type:(Class)type inPerspective:(id)perspectiveIdentifer matchingFunction:(BOOL (void *, void *))comparator usingData:(void *)data {
diff --git a/test/SemaObjC/method-arg-qualifier-warning.m b/test/SemaObjC/method-arg-qualifier-warning.m
index 463fb7fd777a..690509e795e5 100644
--- a/test/SemaObjC/method-arg-qualifier-warning.m
+++ b/test/SemaObjC/method-arg-qualifier-warning.m
@@ -12,8 +12,8 @@ static NSString * const Identifier3 = @"Identifier3";
int main () {
- [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
- [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
+ [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers}}
+ [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers}}
[@"Identifier3" isEqualToString:Identifier3];
return 0;
}
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index 324ed342f918..388e44724d5b 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -28,3 +28,17 @@ 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}}
}
+
+// rdar://8421082
+enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
+
+@interface fee {
+}
+- (void)crashMe:(enum bogus)p;
+@end
+
+@implementation fee
+- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}}
+}
+@end
+
diff --git a/test/SemaObjC/method-conflict-1.m b/test/SemaObjC/method-conflict-1.m
new file mode 100644
index 000000000000..3cf2c6b5a908
--- /dev/null
+++ b/test/SemaObjC/method-conflict-1.m
@@ -0,0 +1,83 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// This test case tests the default behavior.
+
+// rdar://7933061
+
+@interface NSObject @end
+
+@interface NSArray : NSObject @end
+
+@interface MyClass : NSObject {
+}
+- (void)myMethod:(NSArray *)object;
+- (void)myMethod1:(NSObject *)object; // broken-note {{previous definition is here}}
+@end
+
+@implementation MyClass
+- (void)myMethod:(NSObject *)object {
+}
+- (void)myMethod1:(NSArray *)object { // broken-warning {{conflicting parameter types in implementation of 'myMethod1:': 'NSObject *' vs 'NSArray *'}}
+}
+@end
+
+
+@protocol MyProtocol @end
+
+@interface MyOtherClass : NSObject <MyProtocol> {
+}
+- (void)myMethod:(id <MyProtocol>)object; // broken-note {{previous definition is here}}
+- (void)myMethod1:(id <MyProtocol>)object; // broken-note {{previous definition is here}}
+@end
+
+@implementation MyOtherClass
+- (void)myMethod:(MyClass *)object { // broken-warning {{conflicting parameter types in implementation of 'myMethod:': 'id<MyProtocol>' vs 'MyClass *'}}
+}
+- (void)myMethod1:(MyClass<MyProtocol> *)object { // broken-warning {{conflicting parameter types in implementation of 'myMethod1:': 'id<MyProtocol>' vs 'MyClass<MyProtocol> *'}}
+}
+@end
+
+
+
+@interface A @end
+@interface B : A @end
+
+@interface Test1 {}
+- (void) test1:(A*) object; // broken-note {{previous definition is here}}
+- (void) test2:(B*) object;
+@end
+
+@implementation Test1
+- (void) test1:(B*) object {} // broken-warning {{conflicting parameter types in implementation of 'test1:': 'A *' vs 'B *'}}
+- (void) test2:(A*) object {}
+@end
+
+// rdar://problem/8597621 wants id -> A* to be an exception
+@interface Test2 {}
+- (void) test1:(id) object; // broken-note {{previous definition is here}}
+- (void) test2:(A*) object;
+@end
+@implementation Test2
+- (void) test1:(A*) object {} // broken-warning {{conflicting parameter types in implementation of 'test1:': 'id' vs 'A *'}}
+- (void) test2:(id) object {}
+@end
+
+@interface Test3 {}
+- (A*) test1;
+- (B*) test2; // broken-note {{previous definition is here}}
+@end
+
+@implementation Test3
+- (B*) test1 { return 0; }
+- (A*) test2 { return 0; } // broken-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
+@end
+
+// The particular case of overriding with an id return is white-listed.
+@interface Test4 {}
+- (id) test1;
+- (A*) test2;
+@end
+@implementation Test4
+- (A*) test1 { return 0; } // id -> A* is rdar://problem/8596987
+- (id) test2 { return 0; }
+@end
diff --git a/test/SemaObjC/method-conflict-2.m b/test/SemaObjC/method-conflict-2.m
new file mode 100644
index 000000000000..7b5a08ad9ee4
--- /dev/null
+++ b/test/SemaObjC/method-conflict-2.m
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
+
+@interface A @end
+@interface B : A @end
+
+@interface Test1 {}
+- (void) test1:(A*) object; // expected-note {{previous definition is here}}
+- (void) test2:(B*) object;
+@end
+
+@implementation Test1
+- (void) test1:(B*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'A *' vs 'B *'}}
+- (void) test2:(A*) object {}
+@end
+
+@interface Test2 {}
+- (void) test1:(id) object; // expected-note {{previous definition is here}}
+- (void) test2:(A*) object;
+@end
+
+@implementation Test2
+- (void) test1:(A*) object {} // expected-warning {{conflicting parameter types in implementation of 'test1:': 'id' vs 'A *'}}
+- (void) test2:(id) object {}
+@end
+
+@interface Test3 {}
+- (A*) test1;
+- (B*) test2; // expected-note {{previous definition is here}}
+@end
+
+@implementation Test3
+- (B*) test1 { return 0; }
+- (A*) test2 { return 0; } // expected-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
+@end
+
+// The particular case of overriding with an id return is white-listed.
+@interface Test4 {}
+- (id) test1;
+- (A*) test2;
+@end
+@implementation Test4
+- (A*) test1 { return 0; } // id -> A* is rdar://problem/8596987
+- (id) test2 { return 0; }
+@end
diff --git a/test/SemaObjC/method-conflict.m b/test/SemaObjC/method-conflict.m
index 5dc886fb7fd2..4eb729061251 100644
--- a/test/SemaObjC/method-conflict.m
+++ b/test/SemaObjC/method-conflict.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@@ -40,7 +40,7 @@ typedef NSUInteger XDSourceLanguage;
@end @class XDSCOperation;
@interface XDSCClassFormatter : NSObject {
}
-+ (NSUInteger) compartmentsForClassifier: (id <XDUMLClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec;
++ (NSUInteger) compartmentsForClassifier: (id <XDUMLClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec; // expected-note {{previous definition is here}}
@end
@class NSString;
@implementation XDSCClassFormatter
@@ -49,7 +49,7 @@ typedef NSUInteger XDSourceLanguage;
{
return 0;
}
-+ (NSUInteger) compartmentsForClassifier: (id <XDSCClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec {
++ (NSUInteger) compartmentsForClassifier: (id <XDSCClassifier>) classifier withSpecification: (XDSCDisplaySpecification *) displaySpec { // expected-warning {{conflicting parameter types in implementation of 'compartmentsForClassifier:withSpecification:'}}
return 0;
}
@end
diff --git a/test/SemaObjC/method-def-1.m b/test/SemaObjC/method-def-1.m
index 7630ad0fbd2b..bc7ea7bc449c 100644
--- a/test/SemaObjC/method-def-1.m
+++ b/test/SemaObjC/method-def-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
@interface foo
- (int)meth;
diff --git a/test/SemaObjC/method-in-class-extension-impl.m b/test/SemaObjC/method-in-class-extension-impl.m
new file mode 100644
index 000000000000..c205322dec9d
--- /dev/null
+++ b/test/SemaObjC/method-in-class-extension-impl.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8530080
+
+@protocol ViewDelegate @end
+
+@interface NSTextView
+- (id <ViewDelegate>)delegate;
+@end
+
+@interface FooTextView : NSTextView
+@end
+
+@interface FooTextView()
+- (id)delegate;
+@end
+
+@implementation FooTextView
+- (id)delegate {return 0; }
+@end
+
diff --git a/test/SemaObjC/method-lookup-5.m b/test/SemaObjC/method-lookup-5.m
new file mode 100644
index 000000000000..13df218144c1
--- /dev/null
+++ b/test/SemaObjC/method-lookup-5.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8592156
+
+typedef struct objc_class *Class;
+@interface A
+-(Class) foo;
+@end
+
+void f0(A *a) { int x = [[a foo] baz]; } // expected-warning {{method '+baz' not found (return type defaults to 'id')}} \
+ // expected-warning {{ncompatible pointer to integer conversion initializing 'int' with an expression of type 'id'}}
diff --git a/test/SemaObjC/method-lookup.m b/test/SemaObjC/method-lookup.m
index e3789584bf59..3091124e66ab 100644
--- a/test/SemaObjC/method-lookup.m
+++ b/test/SemaObjC/method-lookup.m
@@ -22,7 +22,7 @@ typedef int NSInteger;
static NSMutableArray * recentCompletions = ((void *)0);
+ (float) factorForRecentCompletion:(NSString *) completion
{
- for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '-completionItems' not found (return type defaults to 'id')}}
+ for (NSObject<PBXCompletionItem> * item in [self completionItems]) // expected-warning{{method '+completionItems' not found (return type defaults to 'id')}}
{
if ([item respondsToSelector:@selector(setPriority:)])
{
diff --git a/test/SemaObjC/method-prototype-scope.m b/test/SemaObjC/method-prototype-scope.m
new file mode 100644
index 000000000000..2184172f35c9
--- /dev/null
+++ b/test/SemaObjC/method-prototype-scope.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar://8877730
+
+int object;
+
+@class NSString, NSArray;
+
+@interface Test
+- Func:(int)XXXX, id object;
+
+- doSomethingElseWith:(id)object;
+
+- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object; // expected-warning {{redefinition of method parameter 'object'}} \
+ // expected-note {{previous declaration is here}}
+@end
+
+@implementation Test
+
+- (NSString *)doSomethingWith:(NSString *)object and:(NSArray *)object // expected-warning {{redefinition of method parameter 'object'}} \
+ // expected-note {{previous declaration is here}}
+{
+ return object; // expected-warning {{incompatible pointer types returning 'NSArray *' from a function with result type 'NSString *'}}
+}
+
+- Func:(int)XXXX, id object { return object; }
+
+- doSomethingElseWith:(id)object { return object; }
+
+@end
+
+struct P;
+
+@interface Test1
+- doSomethingWith:(struct S *)object and:(struct P *)obj; // expected-warning {{declaration of 'struct S' will not be visible outside of this function}}
+@end
+
+int obj;
diff --git a/test/SemaObjC/method-sentinel-attr.m b/test/SemaObjC/method-sentinel-attr.m
index 6ec362f6f728..5375408a2b66 100644
--- a/test/SemaObjC/method-sentinel-attr.m
+++ b/test/SemaObjC/method-sentinel-attr.m
@@ -16,7 +16,7 @@
- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3))); // expected-error {{attribute requires 0, 1 or 2 argument(s)}}
- (void) foo12 : (int)x, ... ATTR; // expected-note {{method has been explicitly marked sentinel here}}
-// rdar:// 7975788
+// rdar://7975788
- (id) foo13 : (id)firstObj, ... __attribute__((sentinel(0,1)));
- (id) foo14 : (id)firstObj : (Class)secondObj, ... __attribute__((sentinel(0,1)));
- (id) foo15 : (id*)firstObj, ... __attribute__((sentinel(0,1)));
@@ -40,7 +40,7 @@ int main ()
[p foo12:1]; // expected-warning {{not enough variable arguments in 'foo12:' declaration to fit a sentinel}}
- // rdar:// 7975788
+ // rdar://7975788
[ p foo13 : NULL];
[ p foo14 : 0 : NULL];
[ p foo16 : NULL];
diff --git a/test/SemaObjC/method-typecheck-3.m b/test/SemaObjC/method-typecheck-3.m
new file mode 100644
index 000000000000..1999b7d47702
--- /dev/null
+++ b/test/SemaObjC/method-typecheck-3.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -Wmethod-signatures -fsyntax-only -verify %s
+
+@class B;
+@interface A
+- (B*)obj;
+- (B*)a; // expected-note {{previous definition is here}}
+- (void)takesA: (A*)a; // expected-note {{previous definition is here}}
+- (void)takesId: (id)a; // expected-note {{previous definition is here}}
+@end
+
+
+@interface B : A
+@end
+
+@implementation B
+- (id)obj {return self;} // 'id' overrides are white-listed?
+- (A*)a { return self;} // expected-warning {{conflicting return type in implementation of 'a'}}
+- (void)takesA: (B*)a // expected-warning {{conflicting parameter types in implementation of 'takesA:'}}
+{}
+- (void)takesId: (B*)a // expected-warning {{conflicting parameter types in implementation of 'takesId:'}}
+{}
+@end
diff --git a/test/SemaObjC/method-undef-category-warn-1.m b/test/SemaObjC/method-undef-category-warn-1.m
index b367801242e5..532ecfca9e08 100644
--- a/test/SemaObjC/method-undef-category-warn-1.m
+++ b/test/SemaObjC/method-undef-category-warn-1.m
@@ -4,23 +4,25 @@
@end
@protocol P
-- (void) Pmeth; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-- (void) Pmeth1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) Pmeth; // expected-note {{method declared here }}
+- (void) Pmeth1; // expected-note {{method declared here }}
@end
@interface MyClass1(CAT) <P> // expected-note {{required for direct or indirect protocol 'P'}}
- (void) meth2; // expected-note {{method definition for 'meth2' not found}}
@end
-@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}}
+@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void) Pmeth1{}
@end
@interface MyClass1(DOG) <P> // expected-note {{required for direct or indirect protocol 'P'}}
-- (void)ppp; // expected-note {{method definition for 'ppp' not found}}
+- (void)ppp; // expected-note {{method definition for 'ppp' not found}}
@end
-@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}}
+@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void) Pmeth {}
@end
diff --git a/test/SemaObjC/method-undef-extension-warn-1.m b/test/SemaObjC/method-undef-extension-warn-1.m
index 1addcf7df719..ade861e52eec 100644
--- a/test/SemaObjC/method-undef-extension-warn-1.m
+++ b/test/SemaObjC/method-undef-extension-warn-1.m
@@ -5,7 +5,7 @@
@protocol P
- (void)Pmeth;
-- (void)Pmeth1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void)Pmeth1; // expected-note {{method declared here}}
@end
// Class extension
@@ -18,6 +18,7 @@
- (void)categoryMethod;
@end
-@implementation MyClass // expected-warning {{incomplete implementation}}
+@implementation MyClass // expected-warning {{incomplete implementation}} \
+ // expected-warning {{method in protocol not implemented [-Wprotocol]}}
- (void)Pmeth {}
@end
diff --git a/test/SemaObjC/method-undefined-warn-1.m b/test/SemaObjC/method-undefined-warn-1.m
index 1ebc59e96b3b..922a0347992b 100644
--- a/test/SemaObjC/method-undefined-warn-1.m
+++ b/test/SemaObjC/method-undefined-warn-1.m
@@ -40,3 +40,17 @@
- (void) cls_meth1 : (int) arg2{}
@end
+
+// rdar://8850818
+@interface Root @end
+
+@interface Foo : Root @end
+
+@implementation Foo
+
+- (void)someFunction { return; }
+
++ (void)anotherFunction {
+ [self someFunction]; // expected-warning {{method '+someFunction' not found (return type defaults to 'id')}}
+}
+@end
diff --git a/test/SemaObjC/no-objc-exceptions.m b/test/SemaObjC/no-objc-exceptions.m
new file mode 100644
index 000000000000..78419a247557
--- /dev/null
+++ b/test/SemaObjC/no-objc-exceptions.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fno-objc-exceptions -fsyntax-only -verify %s
+
+void f() {
+ @throw @"Hello"; // expected-error {{cannot use '@throw' with Objective-C exceptions disabled}}
+}
+
+void g() {
+ @try { // expected-error {{cannot use '@try' with Objective-C exceptions disabled}}
+ f();
+ } @finally {
+
+ }
+}
diff --git a/test/SemaObjC/nonnull.h b/test/SemaObjC/nonnull.h
new file mode 100644
index 000000000000..f5a038f5adf5
--- /dev/null
+++ b/test/SemaObjC/nonnull.h
@@ -0,0 +1,2 @@
+// rdar: //6857843
+#define NONNULL_ATTR __attribute__((nonnull))
diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m
index 15fee74a3b5f..6c45d97b0660 100644
--- a/test/SemaObjC/nonnull.m
+++ b/test/SemaObjC/nonnull.m
@@ -1,8 +1,11 @@
+#include "nonnull.h"
+
// RUN: %clang_cc1 -fblocks -fsyntax-only -verify %s
@class NSObject;
-int f1(int x) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}}
+NONNULL_ATTR
+int f1(int x); // no warning
int f2(int *x) __attribute__ ((nonnull (1)));
int f3(int *x) __attribute__ ((nonnull (0))); // expected-error {{'nonnull' attribute parameter 1 is out of bounds}}
int f4(int *x, int *y) __attribute__ ((nonnull (1,2)));
@@ -44,4 +47,23 @@ foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
func7((NSObject*) 0); // no-warning
}
-void func5(int) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}}
+void func5(int) NONNULL_ATTR; // no warning
+
+// rdar://6857843
+struct dispatch_object_s {
+ int x;
+};
+
+typedef union {
+ long first;
+ struct dispatch_object_s *_do;
+} dispatch_object_t __attribute__((transparent_union));
+
+__attribute__((nonnull))
+void _dispatch_queue_push_list(dispatch_object_t _head); // no warning
+
+void func6(dispatch_object_t _head) {
+ _dispatch_queue_push_list(0); // expected-warning {{null passed to a callee which requires a non-null argument}}
+ _dispatch_queue_push_list(_head._do); // no warning
+}
+
diff --git a/test/SemaObjC/property-9.m b/test/SemaObjC/property-9.m
index 669f9c0e4bd0..2b6564d29593 100644
--- a/test/SemaObjC/property-9.m
+++ b/test/SemaObjC/property-9.m
@@ -96,3 +96,14 @@ typedef signed char BOOL;
- (float)setMyStyle:(int)style;
@end
+// rdar://8774513
+@class MDAInstance; // expected-note {{forward class is declared here}}
+
+@interface MDATestDocument
+@property(retain) MDAInstance *instance;
+@end
+
+id f0(MDATestDocument *d) {
+ return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance *'}}
+}
+
diff --git a/test/SemaObjC/property-and-class-extension.m b/test/SemaObjC/property-and-class-extension.m
index 51bf8de77e2b..926538af61c9 100644
--- a/test/SemaObjC/property-and-class-extension.m
+++ b/test/SemaObjC/property-and-class-extension.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
/**
When processing @synthesize, treat ivars in a class extension the same as ivars in the class @interface,
diff --git a/test/SemaObjC/property-and-ivar-use.m b/test/SemaObjC/property-and-ivar-use.m
index b9235c1dd3d4..70e553469907 100644
--- a/test/SemaObjC/property-and-ivar-use.m
+++ b/test/SemaObjC/property-and-ivar-use.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
// Do not issue error if 'ivar' used previously belongs to the inherited class
// and has same name as @dynalic property in current class.
diff --git a/test/SemaObjC/property-dot-receiver.m b/test/SemaObjC/property-dot-receiver.m
new file mode 100644
index 000000000000..733ad4288a83
--- /dev/null
+++ b/test/SemaObjC/property-dot-receiver.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// rdar://8962253
+
+@interface Singleton {
+}
++ (Singleton*) instance;
+@end
+
+@implementation Singleton
+
+- (void) someSelector { }
+
++ (Singleton*) instance { return 0; }
+
++ (void) compileError
+{
+ [Singleton.instance someSelector]; // clang issues error here
+}
+
+@end
+
diff --git a/test/SemaObjC/property-impl-misuse.m b/test/SemaObjC/property-impl-misuse.m
index 58c91c59d05e..122afc1d4b5b 100644
--- a/test/SemaObjC/property-impl-misuse.m
+++ b/test/SemaObjC/property-impl-misuse.m
@@ -14,3 +14,23 @@
@synthesize Y; // expected-note {{previous use is here}}
@synthesize Z=Y; // expected-error {{synthesized properties 'Z' and 'Y' both claim ivar 'Y'}}
@end
+
+// rdar://8703553
+@interface IDEPathCell
+{
+@private
+ id _gradientStyle;
+}
+
+@property (readwrite, assign, nonatomic) id gradientStyle;
+@end
+
+@implementation IDEPathCell
+
+@synthesize gradientStyle = _gradientStyle;
+- (void)setGradientStyle:(id)value { }
+
++ (void)_componentCellWithRepresentedObject {
+ self.gradientStyle; // expected-error {{property 'gradientStyle' not found on object of type 'Class'}}
+}
+@end
diff --git a/test/SemaObjC/property-in-class-extension.m b/test/SemaObjC/property-in-class-extension.m
index 3f252d0a29ed..6ae0b8148a3d 100644
--- a/test/SemaObjC/property-in-class-extension.m
+++ b/test/SemaObjC/property-in-class-extension.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar: // 7766184
+// rdar://7766184
@interface Foo @end
@@ -12,4 +12,39 @@ void FUNC () {
foo.bar = 0; // expected-error {{assigning to property with 'readonly' attribute not allowed}}
}
+// rdar://8747333
+@class NSObject;
+
+@interface rdar8747333 {
+@private
+ NSObject *_bar;
+ NSObject *_baz;
+ NSObject *_bam;
+}
+- (NSObject *)baz;
+@end
+
+@interface rdar8747333 ()
+- (NSObject *)bar;
+@end
+
+@interface rdar8747333 ()
+@property (readwrite, assign) NSObject *bar;
+@property (readwrite, assign) NSObject *baz;
+@property (readwrite, assign) NSObject *bam;
+@property (readwrite, assign) NSObject *warn;
+@end
+
+@interface rdar8747333 ()
+- (NSObject *)bam;
+- (NSObject *)warn; // expected-note {{method definition for 'warn' not found}}
+- (void)setWarn : (NSObject *)val; // expected-note {{method definition for 'setWarn:' not found}}
+@end
+
+@implementation rdar8747333 // expected-warning {{incomplete implementation}}
+@synthesize bar = _bar;
+@synthesize baz = _baz;
+@synthesize bam = _bam;
+@dynamic warn;
+@end
diff --git a/test/SemaObjC/property-missing.m b/test/SemaObjC/property-missing.m
index 6ce0beac51c1..bf75601b79bc 100644
--- a/test/SemaObjC/property-missing.m
+++ b/test/SemaObjC/property-missing.m
@@ -20,3 +20,15 @@ void f3(id o)
o.foo; // expected-error{{property 'foo' not found on object of type 'id'}}
}
+// rdar://8851803
+@class SomeOtherClass; // expected-note {{forward class is declared here}}
+
+@interface MyClass {
+ SomeOtherClass *someOtherObject;
+}
+@end
+
+void foo(MyClass *myObject) {
+ myObject.someOtherObject.someProperty = 0; // expected-error {{property 'someOtherObject' refers to an incomplete Objective-C class 'SomeOtherClass' (with no @interface available)}}
+}
+
diff --git a/test/SemaObjC/property-user-setter.m b/test/SemaObjC/property-user-setter.m
index 9479bc6a73b2..2f1e19727a88 100644
--- a/test/SemaObjC/property-user-setter.m
+++ b/test/SemaObjC/property-user-setter.m
@@ -70,7 +70,7 @@ static int g_val;
{
int setterOnly;
}
-- (void) setSetterOnly:(int)value; // expected-note {{or because setter is declared here, but no getter method 'setterOnly' is found}}
+- (void) setSetterOnly:(int)value;
@end
@implementation Subclass
@@ -82,14 +82,14 @@ static int g_val;
@interface C {}
// - (int)Foo;
-- (void)setFoo:(int)value; // expected-note 2 {{or because setter is declared here, but no getter method 'Foo' is found}}
+- (void)setFoo:(int)value;
@end
void g(int);
void f(C *c) {
- c.Foo = 17; // expected-error {{property 'Foo' not found on object of type 'C *'}}
- g(c.Foo); // expected-error {{property 'Foo' not found on object of type 'C *'}}
+ c.Foo = 17; // OK
+ g(c.Foo); // expected-error {{expected getter method not found on object of type 'C *'}}
}
@@ -97,7 +97,7 @@ void abort(void);
int main (void) {
Subclass *x = [[Subclass alloc] init];
- x.setterOnly = 4; // expected-error {{property 'setterOnly' not found on object of type 'Subclass *'}}
+ x.setterOnly = 4; // OK
if (g_val != 4)
abort ();
return 0;
diff --git a/test/SemaObjC/provisional-ivar-lookup.m b/test/SemaObjC/provisional-ivar-lookup.m
new file mode 100644
index 000000000000..04d6a4193095
--- /dev/null
+++ b/test/SemaObjC/provisional-ivar-lookup.m
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -fobjc-nonfragile-abi -verify %s
+
+// rdar:// 8565343
+@interface Foo {
+@private
+ int _foo;
+ int _foo2;
+}
+@property (readwrite, nonatomic) int foo, foo1, foo2, foo3;
+@property (readwrite, nonatomic) int PROP;
+@end
+
+@implementation Foo
+
+@synthesize foo = _foo;
+@synthesize foo1;
+
+- (void)setFoo:(int)value {
+ _foo = foo; // expected-error {{use of undeclared identifier 'foo'}}
+}
+
+- (void)setFoo1:(int)value {
+ _foo = foo1; // OK
+}
+
+- (void)setFoo2:(int)value {
+ _foo = foo2; // expected-error {{use of undeclared identifier 'foo2'}}
+}
+
+- (void)setFoo3:(int)value {
+ _foo = foo3; // OK
+}
+
+@synthesize foo2 = _foo2;
+@synthesize foo3;
+
+@synthesize PROP=PROP;
+- (void)setPROP:(int)value {
+ PROP = PROP; // OK
+}
+
+@end
+
diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m
index 9a7375b8d288..16d44cbb5515 100644
--- a/test/SemaObjC/selector-1.m
+++ b/test/SemaObjC/selector-1.m
@@ -1,22 +1,15 @@
// RUN: %clang_cc1 -verify %s
-@interface Lancelot @end
-@implementation Lancelot
-
-- (void):(int)x {}
-- (void)xx:(int)x :(int)y { }
-
-@end
-
@interface I
- (id) compare: (char) arg1;
+- length;
@end
@interface J
- (id) compare: (id) arg1;
@end
-SEL foo()
+SEL func()
{
return @selector(compare:); // Non warning on multiple selector found.
}
diff --git a/test/SemaObjC/selector-2.m b/test/SemaObjC/selector-2.m
new file mode 100644
index 000000000000..fb75369a9a10
--- /dev/null
+++ b/test/SemaObjC/selector-2.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -Wselector -verify %s
+// rdar://8851684
+@interface I
+- length;
+@end
+
+static inline SEL IsEmpty() {
+ return @selector(length);
+}
+
+int main (int argc, const char * argv[]) {
+ return 0;
+}
+
diff --git a/test/SemaObjC/selector-3.m b/test/SemaObjC/selector-3.m
new file mode 100644
index 000000000000..69a74f830ce5
--- /dev/null
+++ b/test/SemaObjC/selector-3.m
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -Wselector -verify %s
+// rdar://8851684
+
+@interface Foo
+- (void) foo;
+- (void) bar;
+@end
+
+@implementation Foo
+- (void) bar
+{
+}
+
+- (void) foo
+{
+ SEL a,b,c;
+ a = @selector(b1ar); // expected-warning {{unimplemented selector 'b1ar'}}
+ b = @selector(bar);
+}
+@end
+
+@interface I
+- length;
+@end
+
+SEL func()
+{
+ return @selector(length); // expected-warning {{unimplemented selector 'length'}}
+}
diff --git a/test/SemaObjC/self-assign.m b/test/SemaObjC/self-assign.m
new file mode 100644
index 000000000000..f05b028d6718
--- /dev/null
+++ b/test/SemaObjC/self-assign.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@interface A
+@end
+
+@implementation A
+- (id):(int)x :(int)y {
+ int z;
+ // <rdar://problem/8939352>
+ if (self = [self :x :y]) {} // 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}}
+ return self;
+}
+@end
diff --git a/test/SemaObjC/setter-dotsyntax.m b/test/SemaObjC/setter-dotsyntax.m
new file mode 100644
index 000000000000..e0b51e8b51c6
--- /dev/null
+++ b/test/SemaObjC/setter-dotsyntax.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8528170
+
+@interface NSObject @end
+
+@protocol MyProtocol
+- (int) level;
+- (void) setLevel:(int)inLevel;
+@end
+
+@interface MyClass : NSObject <MyProtocol>
+@end
+
+int main ()
+{
+ id<MyProtocol> c;
+ c.level = 10;
+ return 0;
+}
diff --git a/test/SemaObjC/special-dep-unavail-warning.m b/test/SemaObjC/special-dep-unavail-warning.m
new file mode 100644
index 000000000000..b7a2d663441c
--- /dev/null
+++ b/test/SemaObjC/special-dep-unavail-warning.m
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8769853
+
+@interface B
+- (void) depInA;
+- (void) unavailMeth __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depInA1 __attribute__((deprecated));
+- (void) unavailMeth1;
+- (void) depInA2 __attribute__((deprecated));
+- (void) unavailMeth2 __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depunavailInA;
+- (void) depunavailInA1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void)FuzzyMeth __attribute__((deprecated));
+- (void)FuzzyMeth1 __attribute__((unavailable));
+@end
+
+@interface A
+- (void) unavailMeth1 __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depInA __attribute__((deprecated));
+- (void) depInA2 __attribute__((deprecated));
+- (void) depInA1;
+- (void) unavailMeth2 __attribute__((unavailable));
+- (void) depunavailInA __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{function has been explicitly marked unavailable here}}
+- (void) depunavailInA1;
+- (void)FuzzyMeth __attribute__((unavailable));
+- (void)FuzzyMeth1 __attribute__((deprecated));
+@end
+
+
+@class C;
+
+void test(C *c) {
+ [c depInA]; // expected-warning {{'depInA' maybe deprecated because receiver type is unknown}}
+ [c unavailMeth]; // expected-warning {{'unavailMeth' maybe unavailable because receiver type is unknown}}
+ [c depInA1]; // expected-warning {{'depInA1' maybe deprecated because receiver type is unknown}}
+ [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 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/super-class-protocol-conformance.m b/test/SemaObjC/super-class-protocol-conformance.m
index f555c3203dcb..bf19c837f46a 100644
--- a/test/SemaObjC/super-class-protocol-conformance.m
+++ b/test/SemaObjC/super-class-protocol-conformance.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar: // 7884086
+// rdar://7884086
@interface NSObject @end
diff --git a/test/SemaObjC/super.m b/test/SemaObjC/super.m
index 31d8db170254..0c42e99d715d 100644
--- a/test/SemaObjC/super.m
+++ b/test/SemaObjC/super.m
@@ -55,7 +55,7 @@ void f0(int super) {
expected-warning {{method '-m' not found (return type defaults to 'id')}}
}
void f1(id puper) { // expected-note {{'puper' declared here}}
- [super m]; // expected-error{{use of undeclared identifier 'super'; did you mean 'puper'?}}
+ [super m]; // expected-error{{use of undeclared identifier 'super'}}
}
// radar 7400691
diff --git a/test/SemaObjC/synth-provisional-ivars-1.m b/test/SemaObjC/synth-provisional-ivars-1.m
new file mode 100644
index 000000000000..33de173cc14b
--- /dev/null
+++ b/test/SemaObjC/synth-provisional-ivars-1.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
+// rdar://8913053
+
+typedef unsigned char BOOL;
+
+@interface MailApp
+{
+ BOOL _isAppleInternal;
+}
+@property(assign) BOOL isAppleInternal;
+@end
+
+static BOOL isAppleInternal() {return 0; }
+
+@implementation MailApp
+
+- (BOOL)isAppleInternal {
+ return _isAppleInternal;
+}
+
+- (void)setIsAppleInternal:(BOOL)flag {
+ _isAppleInternal= !!flag;
+}
+
+- (void) Meth {
+ self.isAppleInternal = isAppleInternal();
+}
+@end
diff --git a/test/SemaObjC/synth-provisional-ivars.m b/test/SemaObjC/synth-provisional-ivars.m
index 973c771ad779..e8179aaa00dd 100644
--- a/test/SemaObjC/synth-provisional-ivars.m
+++ b/test/SemaObjC/synth-provisional-ivars.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
int bar;
@@ -18,7 +18,7 @@ int bar;
@end
@implementation I
-- (int) Meth { return PROP; } // expected-note {{'PROP' declared here}}
+- (int) Meth { return PROP; } // expected-note 2{{'PROP' declared here}}
@dynamic PROP1;
- (int) Meth1 { return PROP1; } // expected-error {{use of undeclared identifier 'PROP1'}}
diff --git a/test/SemaObjC/synthesized-ivar.m b/test/SemaObjC/synthesized-ivar.m
index 58bcf40a5860..3bc372bcd81e 100644
--- a/test/SemaObjC/synthesized-ivar.m
+++ b/test/SemaObjC/synthesized-ivar.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
@interface I
{
}
@@ -12,5 +12,42 @@
}
@end
-// rdar: // 7823675
-int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is protected}}
+// rdar://7823675
+int f0(I *a) { return a->IP; } // expected-error {{instance variable 'IP' is private}}
+
+// rdar://8769582
+
+@interface I1 {
+ int protected_ivar;
+}
+@property int PROP_INMAIN;
+@end
+
+@interface I1() {
+ int private_ivar;
+}
+@property int PROP_INCLASSEXT;
+@end
+
+@implementation I1
+- (int) Meth {
+ PROP_INMAIN = 1;
+ PROP_INCLASSEXT = 2;
+ protected_ivar = 1; // OK
+ return private_ivar; // OK
+}
+@end
+
+
+@interface DER : I1
+@end
+
+@implementation DER
+- (int) Meth {
+ protected_ivar = 1; // OK
+ PROP_INMAIN = 1; // expected-error {{instance variable 'PROP_INMAIN' is private}}
+ PROP_INCLASSEXT = 2; // expected-error {{instance variable 'PROP_INCLASSEXT' is private}}
+ return private_ivar; // expected-error {{instance variable 'private_ivar' is private}}
+}
+@end
+
diff --git a/test/SemaObjC/undef-protocol-methods-1.m b/test/SemaObjC/undef-protocol-methods-1.m
index cbef3e5f4b5e..44d384c63940 100644
--- a/test/SemaObjC/undef-protocol-methods-1.m
+++ b/test/SemaObjC/undef-protocol-methods-1.m
@@ -1,25 +1,25 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
@protocol P1
-- (void) P1proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) ClsP1Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) P1proto; // expected-note {{method declared here}}
++ (void) ClsP1Proto; // expected-note {{method declared here}}
- (void) DefP1proto;
@end
@protocol P2
-- (void) P2proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) ClsP2Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) P2proto; // expected-note {{method declared here}}
++ (void) ClsP2Proto; // expected-note {{method declared here}}
@end
@protocol P3<P2>
-- (void) P3proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) ClsP3Proto; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) P3proto; // expected-note {{method declared here}}
++ (void) ClsP3Proto; // expected-note {{method declared here}}
+ (void) DefClsP3Proto;
@end
@protocol PROTO<P1, P3>
-- (void) meth; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-- (void) meth : (int) arg1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
-+ (void) cls_meth : (int) arg1; // expected-warning {{method in protocol not implemented [-Wprotocol]}}
+- (void) meth; // expected-note {{method declared here}}
+- (void) meth : (int) arg1; // expected-note {{method declared here}}
++ (void) cls_meth : (int) arg1; // expected-note {{method declared here}}
@end
@interface INTF <PROTO> // expected-note 3 {{required for direct or indirect protocol 'PROTO'}} \
@@ -28,7 +28,8 @@
// expected-note 2 {{required for direct or indirect protocol 'P2'}}
@end
-@implementation INTF // expected-warning {{incomplete implementation}}
+@implementation INTF // expected-warning {{incomplete implementation}} \
+ // expected-warning 9 {{method in protocol not implemented [-Wprotocol}}
- (void) DefP1proto{}
+ (void) DefClsP3Proto{}
diff --git a/test/SemaObjC/undef-superclass-1.m b/test/SemaObjC/undef-superclass-1.m
index 0c2594cc226a..c941f82e435c 100644
--- a/test/SemaObjC/undef-superclass-1.m
+++ b/test/SemaObjC/undef-superclass-1.m
@@ -22,7 +22,7 @@
@implementation SUPER
- (void)dealloc {
- [super dealloc]; // expected-error {{no super class declared in @interface for 'SUPER'}}
+ [super dealloc]; // expected-error {{'SUPER' cannot use 'super' because it is a root class}}
}
@end
diff --git a/test/SemaObjC/uninit-variables.m b/test/SemaObjC/uninit-variables.m
new file mode 100644
index 000000000000..63c214053b00
--- /dev/null
+++ b/test/SemaObjC/uninit-variables.m
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fsyntax-only -Wuninitialized-experimental -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}}
+}
+
+// Test ObjC fast enumeration.
+void test2() {
+ id collection = 0;
+ for (id obj in collection) {
+ if (0 == obj) // no-warning
+ break;
+ }
+}
+
+void test3() {
+ id collection = 0;
+ id obj;
+ for (obj in collection) { // no-warning
+ if (0 == obj) // no-warning
+ break;
+ }
+}
+
diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m
new file mode 100644
index 000000000000..7bcd10cc3e06
--- /dev/null
+++ b/test/SemaObjC/warn-deprecated-implementations.m
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -Wdeprecated-implementations -verify %s
+// rdar://8973810
+
+@protocol P
+- (void) D __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@interface A <P>
++ (void)F __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@interface A()
+- (void) E __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@implementation A
++ (void)F { } // expected-warning {{Implementing deprecated method}}
+- (void) D {} // expected-warning {{Implementing deprecated method}}
+- (void) E {} // expected-warning {{Implementing deprecated method}}
+@end
+
+__attribute__((deprecated))
+@interface CL // expected-note 2 {{class declared here}}
+@end
+
+@implementation CL // expected-warning {{Implementing deprecated class}}
+@end
+
+@implementation CL ( SomeCategory ) // expected-warning {{Implementing deprecated category}}
+@end
+
+@interface CL_SUB : CL // expected-warning {{'CL' is deprecated}}
+@end
+
+@interface BASE
+- (void) B __attribute__((deprecated)); // expected-note {{method declared here}}
+@end
+
+@interface SUB : BASE
+@end
+
+@implementation SUB
+- (void) B {} // expected-warning {{Implementing deprecated method}}
+@end
+
diff --git a/test/SemaObjC/warn-implicit-atomic-property.m b/test/SemaObjC/warn-implicit-atomic-property.m
new file mode 100644
index 000000000000..0b4590a42db7
--- /dev/null
+++ b/test/SemaObjC/warn-implicit-atomic-property.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -Wimplicit-atomic-properties -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -verify %s
+// rdar://8774580
+
+@interface Super
+@property (nonatomic, readwrite) int P; // OK
+@property (atomic, readwrite) int P1; // OK
+@property (readwrite) int P2; // expected-note {{property declared here}}
+@property int P3; // expected-note {{property declared here}}
+@end
+
+@implementation Super // expected-warning {{property is assumed atomic when auto-synthesizing the property [-Wimplicit-atomic-properties]}}
+@synthesize P,P1,P2; // expected-warning {{property is assumed atomic by default [-Wimplicit-atomic-properties]}}
+@end
diff --git a/test/SemaObjC/warn-incompatible-builtin-types.m b/test/SemaObjC/warn-incompatible-builtin-types.m
index 79c8cea66545..fd4fb7d3a11d 100644
--- a/test/SemaObjC/warn-incompatible-builtin-types.m
+++ b/test/SemaObjC/warn-incompatible-builtin-types.m
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// rdar 7634850
+// rdar://7634850
@interface Foo
- (void)foo:(Class)class; // expected-note{{passing argument to parameter 'class' here}}
diff --git a/test/SemaObjC/warn-write-strings.m b/test/SemaObjC/warn-write-strings.m
index 04af00ca2d83..450d0a6fe62e 100644
--- a/test/SemaObjC/warn-write-strings.m
+++ b/test/SemaObjC/warn-write-strings.m
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s
// PR4804
-char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'char const [4]' discards qualifiers}}
+char* x = "foo"; // expected-warning {{initializing 'char *' with an expression of type 'const char [4]' discards qualifiers}}
diff --git a/test/SemaObjCXX/blocks.mm b/test/SemaObjCXX/blocks.mm
index fd0df4e6e225..6c2343df0e09 100644
--- a/test/SemaObjCXX/blocks.mm
+++ b/test/SemaObjCXX/blocks.mm
@@ -3,12 +3,12 @@
void bar(id(^)(void));
void foo(id <NSObject>(^objectCreationBlock)(void)) {
- return bar(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id<NSObject> (^)()' to type 'id (^)()'}}
+ return bar(objectCreationBlock); // OK
}
void bar2(id(*)(void));
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
- return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types converting 'id<NSObject> (*)()' to type 'id (*)()'}}
+ return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id<NSObject> (*)()' to parameter of type 'id (*)()'}}
}
void bar3(id(*)()); // expected-note{{candidate function}}
@@ -50,3 +50,71 @@ void foo6(void *block) {
void (^vb)(id obj, int idx, BOOL *stop) = (void (^)(id, int, BOOL *))block;
BOOL (^bb)(id obj, int idx, BOOL *stop) = (BOOL (^)(id, int, BOOL *))block;
}
+
+// <rdar://problem/8600419>: Require that the types of block
+// parameters are complete.
+namespace N1 {
+ template<class _T> class ptr; // expected-note{{template is declared here}}
+
+ template<class _T>
+ class foo {
+ public:
+ void bar(void (^)(ptr<_T>));
+ };
+
+ class X;
+
+ void test2();
+
+ void test()
+ {
+ foo<X> f;
+ f.bar(^(ptr<X> _f) { // expected-error{{implicit instantiation of undefined template 'N1::ptr<N1::X>'}}
+ test2();
+ });
+ }
+}
+
+// Make sure we successfully instantiate the copy constructor of a
+// __block variable's type.
+namespace N2 {
+ template <int n> struct A {
+ A() {}
+ A(const A &other) {
+ int invalid[-n]; // expected-error 2 {{array with a negative size}}
+ }
+ };
+
+ void test1() {
+ __block A<1> x; // expected-note {{requested here}}
+ }
+
+ template <int n> void test2() {
+ __block A<n> x; // expected-note {{requested here}}
+ }
+ template void test2<2>();
+}
+
+// Handle value-dependent block declaration references.
+namespace N3 {
+ template<int N> struct X { };
+
+ template<int N>
+ void f() {
+ X<N> xN = ^() { return X<N>(); }();
+ }
+}
+
+// rdar://8979379
+
+@interface A
+@end
+
+@interface B : A
+@end
+
+void f(int (^bl)(A* a)); // expected-note {{candidate function not viable: no known conversion from 'int (^)(B *)' to 'int (^)(A *)' for 1st argument}}
+
+void g() {
+ f(^(B* b) { return 0; }); // expected-error {{no matching function for call to 'f'}}
+}
diff --git a/test/SemaObjCXX/conversion-ranking.mm b/test/SemaObjCXX/conversion-ranking.mm
new file mode 100644
index 000000000000..6c1408bf21f6
--- /dev/null
+++ b/test/SemaObjCXX/conversion-ranking.mm
@@ -0,0 +1,89 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@protocol P1
+@end
+
+@interface A <P1>
+@end
+
+@interface B : A
+@end
+
+@interface C : B
+@end
+
+template<typename T>
+struct ConvertsTo {
+ operator T() const;
+};
+
+
+// conversion of C* to B* is better than conversion of C* to A*.
+int &f0(A*);
+float &f0(B*);
+
+void test_f0(C *c) {
+ float &fr1 = f0(c);
+}
+
+// conversion of B* to A* is better than conversion of C* to A*
+void f1(A*);
+
+struct ConvertsToBoth {
+private:
+ operator C*() const;
+
+public:
+ operator B*() const;
+};
+
+void test_f1(ConvertsTo<B*> toB, ConvertsTo<C*> toC, ConvertsToBoth toBoth) {
+ f1(toB);
+ f1(toC);
+ f1(toBoth);
+};
+
+// A conversion to an a non-id object pointer type is better than a
+// conversion to 'id'.
+int &f2(A*);
+float &f2(id);
+
+void test_f2(B *b) {
+ int &ir = f2(b);
+}
+
+// A conversion to an a non-Class object pointer type is better than a
+// conversion to 'Class'.
+int &f3(A*);
+float &f3(Class);
+
+void test_f3(B *b) {
+ int &ir = f3(b);
+}
+
+// When both conversions convert to 'id' or 'Class', pick the most
+// specific type to convert from.
+void f4(id);
+
+void test_f4(ConvertsTo<B*> toB, ConvertsTo<C*> toC, ConvertsToBoth toBoth) {
+ f4(toB);
+ f4(toC);
+ f4(toBoth);
+}
+
+void f5(id<P1>);
+
+void test_f5(ConvertsTo<B*> toB, ConvertsTo<C*> toC, ConvertsToBoth toBoth) {
+ f5(toB);
+ f5(toC);
+ f5(toBoth);
+}
+
+
+// A conversion to an a non-id object pointer type is better than a
+// conversion to qualified 'id'.
+int &f6(A*);
+float &f6(id<P1>);
+
+void test_f6(B *b) {
+ int &ir = f6(b);
+}
diff --git a/test/SemaObjCXX/cstyle-cast.mm b/test/SemaObjCXX/cstyle-cast.mm
index c4b176c975ee..29a8404660c9 100644
--- a/test/SemaObjCXX/cstyle-cast.mm
+++ b/test/SemaObjCXX/cstyle-cast.mm
@@ -18,7 +18,7 @@ void test1(X x) {
I<P> *ip = (I<P>*)cft;
- (id)x; // expected-error {{C-style cast from 'X' to 'id' is not allowed}}
+ (id)x; // expected-error {{cannot convert 'X' to 'id' without a conversion operator}}
id *pid = (id*)ccct;
diff --git a/test/SemaObjCXX/exceptions-fragile.mm b/test/SemaObjCXX/exceptions-fragile.mm
index 11dd8e94c1de..e345ebc70b18 100644
--- a/test/SemaObjCXX/exceptions-fragile.mm
+++ b/test/SemaObjCXX/exceptions-fragile.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
@interface NSException @end
void opaque();
diff --git a/test/SemaObjCXX/message.mm b/test/SemaObjCXX/message.mm
index f92518ad48c1..4f7f8bca5eb1 100644
--- a/test/SemaObjCXX/message.mm
+++ b/test/SemaObjCXX/message.mm
@@ -90,5 +90,38 @@ struct MutableString : public String { };
void test_I5(I5 *i5, String s) {
[i5 method:"hello" other:s];
- [i5 method:s other:"world"]; // expected-error{{non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'char const [6]'}}
+ [i5 method:s other:"world"]; // expected-error{{non-const lvalue reference to type 'String' cannot bind to a value of unrelated type 'const char [6]'}}
+}
+
+// <rdar://problem/8483253>
+@interface A
+
+struct X { };
+
++ (A *)create:(void (*)(void *x, X r, void *data))callback
+ callbackData:(void *)callback_data;
+
+@end
+
+
+void foo(void)
+{
+ void *fun;
+ void *ptr;
+ X r;
+ A *im = [A create:(void (*)(void *cgl_ctx, X r, void *data)) fun
+ callbackData:ptr];
+}
+
+// <rdar://problem/8807070>
+template<typename T> struct X1; // expected-note{{template is declared here}}
+
+@interface B
++ (X1<int>)blah;
++ (X1<float>&)blarg;
+@end
+
+void f() {
+ [B blah]; // expected-error{{implicit instantiation of undefined template 'X1<int>'}}
+ [B blarg];
}
diff --git a/test/SemaObjCXX/objc-pointer-conv.mm b/test/SemaObjCXX/objc-pointer-conv.mm
index af239a8c5b89..209dcfdfd705 100644
--- a/test/SemaObjCXX/objc-pointer-conv.mm
+++ b/test/SemaObjCXX/objc-pointer-conv.mm
@@ -29,18 +29,20 @@ void RandomFunc(CFMDRef theDict, const void *key, const void *value);
- (void) Meth : (I*) Arg; // expected-note{{passing argument to parameter 'Arg' here}}
@end
-void Func (I* arg); // expected-note {{candidate function not viable: no known conversion from 'I const *' to 'I *' for 1st argument}}
+void Func (I* arg); // expected-note {{candidate function not viable: no known conversion from 'const I *' to 'I *' for 1st argument}}
void foo(const I *p, I* sel) {
- [sel Meth : p]; // expected-error {{cannot initialize a parameter of type 'I *' with an lvalue of type 'I const *'}}
+ [sel Meth : p]; // expected-error {{cannot initialize a parameter of type 'I *' with an lvalue of type 'const I *'}}
Func(p); // expected-error {{no matching function for call to 'Func'}}
}
@interface DerivedFromI : I
@end
-void accept_derived(DerivedFromI*); // expected-note{{candidate function not viable: cannot convert from superclass 'I *' to subclass 'DerivedFromI *' for 1st argument}}
+void accept_derived(DerivedFromI*);
void test_base_to_derived(I* i) {
- accept_derived(i); // expected-error{{no matching function for call to 'accept_derived'}}
+ 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 *di2 = (DerivedFromI *)i;
}
diff --git a/test/SemaObjCXX/overload.mm b/test/SemaObjCXX/overload.mm
index 487a42e1a110..7e79a4249cb0 100644
--- a/test/SemaObjCXX/overload.mm
+++ b/test/SemaObjCXX/overload.mm
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-// XFAIL: *
@interface Foo
@end
@@ -28,55 +27,65 @@ void func(id);
@interface C <P1>
@end
-int& f(A*);
-float& f(B*);
+int& f(A*); // expected-note {{candidate}}
+float& f(B*); // expected-note {{candidate}}
void g(A*);
int& h(A*);
float& h(id);
-void test(A* a, B* b, id val) {
+void test0(A* a, B* b, id val) {
int& i1 = f(a);
float& f1 = f(b);
- float& f2 = f(val);
+
+ // GCC succeeds here, which is clearly ridiculous.
+ float& f2 = f(val); // expected-error {{ambiguous}}
+
g(a);
g(b);
g(val);
int& i2 = h(a);
float& f3 = h(val);
- // int& i3 = h(b); FIXME: we match GCC here, but shouldn't this work?
+
+ int& i3 = h(b);
}
-void downcast_test(A* a, A** ap) {
- B* b = a; // expected-warning{{incompatible pointer types initializing 'B *', expected 'A *'}}
- b = a; // expected-warning{{incompatible pointer types assigning 'B *', expected 'A *'}}
+void test1(A* a) {
+ B* b = a; // expected-warning{{incompatible pointer types initializing 'A *' with an expression of type 'B *'}}
+ B *c; c = a; // expected-warning{{incompatible pointer types assigning to 'A *' from 'B *'}}
+}
- B** bp = ap; // expected-warning{{incompatible pointer types initializing 'B **', expected 'A **'}}
- bp = ap; // expected-warning{{incompatible pointer types assigning 'B **', expected 'A **'}}
+void test2(A** ap) {
+ B** bp = ap; // expected-warning{{incompatible pointer types initializing 'A **' with an expression of type 'B **'}}
+ bp = ap; // expected-warning{{incompatible pointer types assigning to 'A **' from 'B **'}}
}
-int& cv(A*);
-float& cv(const A*);
+// FIXME: we should either allow overloading here or give a better diagnostic
+int& cv(A*); // expected-note {{previous declaration}} expected-note 2 {{not viable}}
+float& cv(const A*); // expected-error {{cannot be overloaded}}
+
int& cv2(void*);
float& cv2(const void*);
void cv_test(A* a, B* b, const A* ac, const B* bc) {
int &i1 = cv(a);
int &i2 = cv(b);
- float &f1 = cv(ac);
- float &f2 = cv(bc);
+ float &f1 = cv(ac); // expected-error {{no matching function}}
+ float &f2 = cv(bc); // expected-error {{no matching function}}
int& i3 = cv2(a);
float& f3 = cv2(ac);
}
-
-int& qualid(id<P0>);
-float& qualid(id<P1>); // FIXME: GCC complains that this isn't an overload. Is it?
+// We agree with GCC that these can't be overloaded.
+int& qualid(id<P0>); // expected-note {{previous declaration}} expected-note {{not viable}}
+float& qualid(id<P1>); // expected-error {{cannot be overloaded}}
void qualid_test(A *a, B *b, C *c) {
int& i1 = qualid(a);
int& i2 = qualid(b);
- float& f1 = qualid(c);
+
+ // This doesn't work only because the overload was rejected above.
+ float& f1 = qualid(c); // expected-error {{no matching function}}
id<P0> p1 = 0;
p1 = 0;
@@ -91,7 +100,7 @@ objc_exception_functions_t;
void (*_NSExceptionRaiser(void))(NSException *) {
objc_exception_functions_t exc_funcs;
- return exc_funcs.throw_exc; // expected-warning{{incompatible pointer types returning 'void (*)(NSException *)', expected 'void (*)(id)'}}
+ return exc_funcs.throw_exc; // expected-warning{{incompatible pointer types returning 'void (*)(id)' from a function with result type 'void (*)(NSException *)'}}
}
namespace test5 {
@@ -102,3 +111,41 @@ namespace test5 {
foo(p);
}
}
+
+// rdar://problem/8592139
+namespace test6 {
+ void foo(id); // expected-note{{candidate function}}
+ void foo(A*) __attribute__((unavailable)); // expected-note {{explicitly made unavailable}}
+
+ void test(B *b) {
+ foo(b); // expected-error {{call to unavailable function 'foo'}}
+ }
+}
+
+namespace rdar8714395 {
+ int &f(const void*);
+ float &f(const Foo*);
+
+ int &f2(const void*);
+ float &f2(Foo const* const *);
+
+ int &f3(const void*);
+ float &f3(Foo const**);
+
+ void g(Foo *p) {
+ float &fr = f(p);
+ float &fr2 = f2(&p);
+ int &ir = f3(&p);
+ }
+
+
+}
+
+namespace rdar8734046 {
+ void f1(id);
+ void f2(id<P0>);
+ void g(const A *a) {
+ f1(a);
+ f2(a);
+ }
+}
diff --git a/test/SemaObjCXX/propert-dot-error.mm b/test/SemaObjCXX/propert-dot-error.mm
new file mode 100644
index 000000000000..47b7dc64d5cc
--- /dev/null
+++ b/test/SemaObjCXX/propert-dot-error.mm
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: // 8379892
+
+struct X {
+ X();
+ X(const X&);
+ ~X();
+
+ static int staticData;
+ int data;
+ void method();
+};
+
+@interface A {
+ X xval;
+}
+
+- (X)x;
+- (void)setx:(X)x;
+@end
+
+void f(A* a) {
+ a.x = X(); // expected-error {{setter method is needed to assign to object using property assignment syntax}}
+}
+
+struct Y : X { };
+
+@interface B {
+@private
+ Y *y;
+}
+- (Y)value;
+- (void)setValue : (Y) arg;
+@property Y value;
+@end
+
+void g(B *b) {
+ b.value.data = 17; // expected-error {{not assignable}}
+ b.value.staticData = 17;
+ b.value.method();
+}
diff --git a/test/SemaObjCXX/properties.mm b/test/SemaObjCXX/properties.mm
new file mode 100644
index 000000000000..f148b3395d93
--- /dev/null
+++ b/test/SemaObjCXX/properties.mm
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct X {
+ void f() const;
+ ~X();
+};
+
+@interface A {
+ X x_;
+}
+
+- (const X&)x;
+- (void)setx:(const X&)other;
+@end
+
+@implementation A
+
+- (const X&)x { return x_; }
+- (void)setx:(const X&)other { x_ = other; }
+- (void)method {
+ self.x.f();
+}
+@end
+
diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm
new file mode 100644
index 000000000000..c7a279cfd7a0
--- /dev/null
+++ b/test/SemaObjCXX/property-synthesis-error.mm
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: //8550657
+
+@interface NSArray @end
+
+@interface NSMutableArray : NSArray @end
+
+@interface MyClass
+{
+ NSMutableArray * _array;
+}
+
+@property (readonly) NSArray * array;
+
+@end
+
+@interface MyClass ()
+
+@property (readwrite) NSMutableArray * array;
+
+@end
+
+@implementation MyClass
+
+@synthesize array=_array;
+
+@end
+
+int main(void)
+{
+ return 0;
+}
diff --git a/test/SemaObjCXX/protocol-lookup.mm b/test/SemaObjCXX/protocol-lookup.mm
index ed3fbe0f72bf..bd8444c0ad68 100644
--- a/test/SemaObjCXX/protocol-lookup.mm
+++ b/test/SemaObjCXX/protocol-lookup.mm
@@ -49,3 +49,8 @@
@end
+void rdar8575095(id a) {
+ [id<NSObject>(a) retain];
+ id<NSObject> x(id<NSObject>(0));
+ id<NSObject> x2(id<NSObject>(y)); // expected-warning{{parentheses were disambiguated as a function declarator}}
+}
diff --git a/test/SemaObjCXX/reserved-keyword-methods.mm b/test/SemaObjCXX/reserved-keyword-methods.mm
new file mode 100644
index 000000000000..1302128ac0f0
--- /dev/null
+++ b/test/SemaObjCXX/reserved-keyword-methods.mm
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#define FOR_EACH_KEYWORD(macro) \
+macro(asm) \
+macro(bool) \
+macro(catch) \
+macro(class) \
+macro(const_cast) \
+macro(delete) \
+macro(dynamic_cast) \
+macro(explicit) \
+macro(export) \
+macro(false) \
+macro(friend) \
+macro(mutable) \
+macro(namespace) \
+macro(new) \
+macro(operator) \
+macro(private) \
+macro(protected) \
+macro(public) \
+macro(reinterpret_cast) \
+macro(static_cast) \
+macro(template) \
+macro(this) \
+macro(throw) \
+macro(true) \
+macro(try) \
+macro(typename) \
+macro(typeid) \
+macro(using) \
+macro(virtual) \
+macro(wchar_t)
+
+
+#define DECLARE_METHOD(name) - (void)name;
+#define DECLARE_PROPERTY_WITH_GETTER(name) @property (getter=name) int prop_##name;
+@interface A
+//FOR_EACH_KEYWORD(DECLARE_METHOD)
+FOR_EACH_KEYWORD(DECLARE_PROPERTY_WITH_GETTER)
+@end
+
diff --git a/test/SemaObjCXX/reserved-keyword-selectors.mm b/test/SemaObjCXX/reserved-keyword-selectors.mm
deleted file mode 100644
index 3c4bef595daa..000000000000
--- a/test/SemaObjCXX/reserved-keyword-selectors.mm
+++ /dev/null
@@ -1,35 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-@interface A
-- (void)asm;
-- (void)bool;
-- (void)catch;
-- (void)class;
-- (void)const_cast;
-- (void)delete;
-- (void)dynamic_cast;
-- (void)explicit;
-- (void)export;
-- (void)false;
-- (void)friend;
-- (void)mutable;
-- (void)namespace;
-- (void)new;
-- (void)operator;
-- (void)private;
-- (void)protected;
-- (void)public;
-- (void)reinterpret_cast;
-- (void)static_cast;
-- (void)template;
-- (void)this;
-- (void)throw;
-- (void)true;
-- (void)try;
-- (void)typename;
-- (void)typeid;
-- (void)using;
-- (void)virtual;
-- (void)wchar_t;
-@end
-
diff --git a/test/SemaOpenCL/cond.cl b/test/SemaOpenCL/cond.cl
new file mode 100644
index 000000000000..79dc82db190d
--- /dev/null
+++ b/test/SemaOpenCL/cond.cl
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+typedef __attribute__((ext_vector_type(4))) float float4;
+
+float4 foo(float4 a, float4 b, float4 c, float4 d) { return a < b ? c : d; }
diff --git a/test/SemaOpenCL/extension-fp64.cl b/test/SemaOpenCL/extension-fp64.cl
new file mode 100644
index 000000000000..eaf2509502f2
--- /dev/null
+++ b/test/SemaOpenCL/extension-fp64.cl
@@ -0,0 +1,17 @@
+// 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}}
+}
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+void f2(void) {
+ double d;
+}
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : disable
+
+void f3(void) {
+ double d; // expected-error {{requires cl_khr_fp64 extension}}
+}
diff --git a/test/Sema/opencl-init.c b/test/SemaOpenCL/init.cl
index 3d116bd0dae6..b3ecfecb5db6 100644
--- a/test/Sema/opencl-init.c
+++ b/test/SemaOpenCL/init.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -x cl -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
typedef float float8 __attribute((ext_vector_type(8)));
diff --git a/test/SemaTemplate/anonymous-union.cpp b/test/SemaTemplate/anonymous-union.cpp
index 59d1f25a4fd2..97ecd6e60cca 100644
--- a/test/SemaTemplate/anonymous-union.cpp
+++ b/test/SemaTemplate/anonymous-union.cpp
@@ -17,3 +17,24 @@ struct T1 : public T0, public T {
struct A : public T0 { };
void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}}
+
+namespace rdar8635664 {
+ template<typename T>
+ struct X {
+ struct inner;
+
+ struct inner {
+ union {
+ int x;
+ float y;
+ };
+
+ typedef T type;
+ };
+ };
+
+ void test() {
+ X<int>::inner i;
+ i.x = 0;
+ }
+}
diff --git a/test/SemaTemplate/attributes.cpp b/test/SemaTemplate/attributes.cpp
index f4c1887c25e2..e208bd2b8990 100644
--- a/test/SemaTemplate/attributes.cpp
+++ b/test/SemaTemplate/attributes.cpp
@@ -7,7 +7,7 @@ namespace attribute_aligned {
};
template <bool X> struct check {
- int check_failed[X ? 1 : -1]; // expected-error {{array size is negative}}
+ int check_failed[X ? 1 : -1]; // expected-error {{array with a negative size}}
};
template <int N> struct check_alignment {
diff --git a/test/SemaTemplate/class-template-decl.cpp b/test/SemaTemplate/class-template-decl.cpp
index 1be1bc070a81..e7722123f9c2 100644
--- a/test/SemaTemplate/class-template-decl.cpp
+++ b/test/SemaTemplate/class-template-decl.cpp
@@ -56,3 +56,21 @@ namespace M {
}
template<typename T> class M::C3 { }; // expected-error{{out-of-line definition of 'C3' does not match any declaration in namespace 'M'}}
+
+namespace PR8001 {
+ template<typename T1>
+ struct Foo {
+ template<typename T2> class Bar;
+ typedef Bar<T1> Baz;
+
+ template<typename T2>
+ struct Bar {
+ Bar() {}
+ };
+ };
+
+ void pr8001() {
+ Foo<int>::Baz x;
+ Foo<int>::Bar<int> y(x);
+ }
+}
diff --git a/test/SemaTemplate/class-template-id.cpp b/test/SemaTemplate/class-template-id.cpp
index 50e0b00c1a32..3b027787249b 100644
--- a/test/SemaTemplate/class-template-id.cpp
+++ b/test/SemaTemplate/class-template-id.cpp
@@ -9,7 +9,7 @@ A<int, FLOAT> *foo(A<int> *ptr, A<int> const *ptr2, A<int, double> *ptr3) {
if (ptr)
return ptr; // okay
else if (ptr2)
- return ptr2; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'A<int> const *'}}
+ return ptr2; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'const A<int> *'}}
else {
return ptr3; // expected-error{{cannot initialize return object of type 'A<int, FLOAT> *' with an lvalue of type 'A<int, double> *'}}
}
diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp
index c65802e5c869..07a5e2982c7f 100644
--- a/test/SemaTemplate/class-template-spec.cpp
+++ b/test/SemaTemplate/class-template-spec.cpp
@@ -86,7 +86,7 @@ namespace N {
template<> struct N::B<int> { }; // okay
-template<> struct N::B<float> { }; // expected-error{{originally}}
+template<> struct N::B<float> { }; // expected-warning{{originally}}
namespace M {
template<> struct ::N::B<short> { }; // expected-error{{class template specialization of 'B' not in a namespace enclosing 'N'}}
diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp
index b6ca72e9e149..cf3fdfb7c1ea 100644
--- a/test/SemaTemplate/constructor-template.cpp
+++ b/test/SemaTemplate/constructor-template.cpp
@@ -71,16 +71,16 @@ struct X3 {
template<> X3::X3(X3); // expected-error{{must pass its first argument by reference}}
struct X4 {
- X4(); // expected-note{{candidate constructor}}
+ X4();
~X4();
- X4(X4&); // expected-note {{candidate constructor}}
+ X4(X4&);
template<typename T> X4(const T&, int = 17);
};
X4 test_X4(bool Cond, X4 x4) {
X4 a(x4, 17); // okay, constructor template
X4 b(x4); // okay, copy constructor
- return X4(); // expected-error{{no matching constructor}}
+ return X4();
}
// Instantiation of a non-dependent use of a constructor
@@ -109,3 +109,20 @@ void test_X5_X6() {
X5<X6> tf;
X5<X6> tf2(tf);
}
+
+namespace PR8182 {
+ struct foo {
+ foo();
+ template<class T> foo(T&);
+
+ private:
+ foo(const foo&);
+ };
+
+ void test_foo() {
+ foo f1;
+ foo f2(f1);
+ foo f3 = f1;
+ }
+
+}
diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp
index 8caac9399a87..fe7213f14385 100644
--- a/test/SemaTemplate/current-instantiation.cpp
+++ b/test/SemaTemplate/current-instantiation.cpp
@@ -199,3 +199,19 @@ namespace Expressions {
typename Enable_If<Is_Same<U, Class<T> >::value, void>::type
Class<T>::foo() {}
}
+
+namespace PR9255 {
+ template<typename T>
+ class X0 {
+ public:
+ class Inner1;
+
+ class Inner2 {
+ public:
+ void f()
+ {
+ Inner1::f.g();
+ }
+ };
+ };
+}
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index 9400a0aba96b..15c061c26198 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -107,7 +107,7 @@ namespace PR7463 {
}
namespace test0 {
- template <class T> void make(const T *(*fn)()); // expected-note {{candidate template ignored: can't deduce a type for 'T' which would make 'T const' equal 'char'}}
+ template <class T> void make(const T *(*fn)()); // expected-note {{candidate template ignored: can't deduce a type for 'T' which would make 'const T' equal 'char'}}
char *char_maker();
void test() {
make(char_maker); // expected-error {{no matching function for call to 'make'}}
@@ -134,3 +134,19 @@ namespace test2 {
f(0, p);
}
}
+
+// rdar://problem/8537391
+namespace test3 {
+ struct Foo {
+ template <void F(char)> static inline void foo();
+ };
+
+ class Bar {
+ template<typename T> static inline void wobble(T ch);
+
+ public:
+ static void madness() {
+ Foo::foo<wobble<char> >();
+ }
+ };
+}
diff --git a/test/SemaTemplate/default-expr-arguments-2.cpp b/test/SemaTemplate/default-expr-arguments-2.cpp
index 88cc43d6445e..378999d0d3c4 100644
--- a/test/SemaTemplate/default-expr-arguments-2.cpp
+++ b/test/SemaTemplate/default-expr-arguments-2.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
// This is a wacky test to ensure that we're actually instantiating
-// the default rguments of the constructor when the function type is
+// the default arguments of the constructor when the function type is
// otherwise non-dependent.
namespace PR6733 {
template <class T>
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index 7c3525a1fb15..5d301be2fb13 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -151,7 +151,7 @@ namespace pr5301 {
namespace PR5810 {
template<typename T>
struct allocator {
- allocator() { int a[sizeof(T) ? -1 : -1]; } // expected-error2 {{array size is negative}}
+ allocator() { int a[sizeof(T) ? -1 : -1]; } // expected-error2 {{array with a negative size}}
};
template<typename T>
@@ -206,3 +206,89 @@ namespace InstForInit {
Holder<int> h(i);
}
};
+
+namespace PR5810b {
+ template<typename T>
+ T broken() {
+ T t;
+ double**** not_it = t;
+ }
+
+ void f(int = broken<int>());
+ void g() { f(17); }
+}
+
+namespace PR5810c {
+ template<typename T>
+ struct X {
+ X() {
+ T t;
+ double *****p = t; // expected-error{{cannot initialize a variable of type 'double *****' with an lvalue of type 'int'}}
+ }
+ X(const X&) { }
+ };
+
+ struct Y : X<int> { // expected-note{{instantiation of}}
+ };
+
+ void f(Y y = Y());
+
+ void g() { f(); }
+}
+
+namespace PR8127 {
+ template< typename T > class PointerClass {
+ public:
+ PointerClass( T * object_p ) : p_( object_p ) {
+ p_->acquire();
+ }
+ private:
+ T * p_;
+ };
+
+ class ExternallyImplementedClass;
+
+ class MyClass {
+ void foo( PointerClass<ExternallyImplementedClass> = 0 );
+ };
+}
+
+namespace rdar8427926 {
+ template<typename T>
+ struct Boom {
+ ~Boom() {
+ T t;
+ double *******ptr = t; // expected-error 2{{cannot initialize}}
+ }
+ };
+
+ Boom<float> *bfp;
+
+ struct X {
+ void f(Boom<int> = Boom<int>()) { } // expected-note{{requested here}}
+ void g(int x = (delete bfp, 0)); // expected-note{{requested here}}
+ };
+
+ void test(X *x) {
+ x->f();
+ x->g();
+ }
+}
+
+namespace PR8401 {
+ template<typename T>
+ struct A {
+ A() { T* x = 1; } // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+ };
+
+ template<typename T>
+ struct B {
+ B(const A<T>& a = A<T>()); // expected-note{{in instantiation of}}
+ };
+
+ void f(B<int> b = B<int>());
+
+ void g() {
+ f();
+ }
+}
diff --git a/test/SemaTemplate/dependent-base-classes.cpp b/test/SemaTemplate/dependent-base-classes.cpp
index e64d62301ea2..895eacc87edd 100644
--- a/test/SemaTemplate/dependent-base-classes.cpp
+++ b/test/SemaTemplate/dependent-base-classes.cpp
@@ -105,7 +105,9 @@ namespace PR6081 {
void f0(const X & k)
{
this->template f1<int>()(k); // expected-error{{'f1' following the 'template' keyword does not refer to a template}} \
- // FIXME: expected-error{{unqualified-id}}
+ // FIXME: expected-error{{unqualified-id}} \
+ // expected-error{{function-style cast or type construction}} \
+ // expected-error{{expected expression}}
}
};
}
diff --git a/test/SemaTemplate/dependent-expr.cpp b/test/SemaTemplate/dependent-expr.cpp
index e25afce77a6b..a1ddd249f7fe 100644
--- a/test/SemaTemplate/dependent-expr.cpp
+++ b/test/SemaTemplate/dependent-expr.cpp
@@ -45,3 +45,29 @@ namespace PR7724 {
template<typename OT> int myMethod()
{ return 2 && sizeof(OT); }
}
+
+namespace test4 {
+ template <typename T> T *addressof(T &v) {
+ return reinterpret_cast<T*>(
+ &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
+ }
+}
+
+namespace test5 {
+ template <typename T> class chained_map {
+ int k;
+ void lookup() const {
+ int &v = (int &)k;
+ }
+ };
+}
+
+namespace PR8795 {
+ template <class _CharT> int test(_CharT t)
+ {
+ int data [] = {
+ sizeof(_CharT) > sizeof(char)
+ };
+ return data[0];
+ }
+}
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
index 77961069c5a2..5776ddca2c49 100644
--- a/test/SemaTemplate/dependent-names.cpp
+++ b/test/SemaTemplate/dependent-names.cpp
@@ -102,3 +102,30 @@ namespace test1 {
template struct Derived<int>; // expected-note {{requested here}}
}
+
+namespace PR8966 {
+ template <class T>
+ class MyClassCore
+ {
+ };
+
+ template <class T>
+ class MyClass : public MyClassCore<T>
+ {
+ public:
+ enum {
+ N
+ };
+
+ // static member declaration
+ static const char* array [N];
+
+ void f() {
+ MyClass<T>::InBase = 17;
+ }
+ };
+
+ // static member definition
+ template <class T>
+ const char* MyClass<T>::array [MyClass<T>::N] = { "A", "B", "C" };
+}
diff --git a/test/SemaTemplate/elaborated-type-specifier.cpp b/test/SemaTemplate/elaborated-type-specifier.cpp
index b34660acbea0..514c5f2d57f4 100644
--- a/test/SemaTemplate/elaborated-type-specifier.cpp
+++ b/test/SemaTemplate/elaborated-type-specifier.cpp
@@ -34,3 +34,7 @@ namespace PR6649 {
class T::bar { int x; }; // expected-error{{nested name specifier for a declaration cannot depend on a template parameter}}
};
}
+
+namespace rdar8568507 {
+ template <class T> struct A *makeA(T t);
+}
diff --git a/test/SemaTemplate/enum-forward.cpp b/test/SemaTemplate/enum-forward.cpp
new file mode 100644
index 000000000000..3a4f05c0baa4
--- /dev/null
+++ b/test/SemaTemplate/enum-forward.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -fms-extensions %s
+
+template<typename T>
+struct X {
+ enum E *e;
+};
+
+X<int> xi;
diff --git a/test/SemaTemplate/explicit-instantiation.cpp b/test/SemaTemplate/explicit-instantiation.cpp
index 3a1446e8dd67..ffec3c2b97f0 100644
--- a/test/SemaTemplate/explicit-instantiation.cpp
+++ b/test/SemaTemplate/explicit-instantiation.cpp
@@ -84,6 +84,10 @@ namespace explicit_instantiation_after_implicit_instantiation {
template struct X0<1>;
}
+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}}
template<typename,typename=int>
struct basic_streambuf;
diff --git a/test/SemaTemplate/explicit-specialization-member.cpp b/test/SemaTemplate/explicit-specialization-member.cpp
index 417cdc1f1987..7fe6bf37d752 100644
--- a/test/SemaTemplate/explicit-specialization-member.cpp
+++ b/test/SemaTemplate/explicit-specialization-member.cpp
@@ -13,11 +13,9 @@ template<> void X0<char>::f1(type);
namespace PR6161 {
template<typename _CharT>
class numpunct : public locale::facet // expected-error{{use of undeclared identifier 'locale'}} \
- // expected-error{{expected class name}} \
- // expected-note{{attempt to specialize declaration here}}
+ // expected-error{{expected class name}}
{
static locale::id id; // expected-error{{use of undeclared identifier}}
};
- numpunct<char>::~numpunct(); // expected-error{{template specialization requires 'template<>'}} \
- // expected-error{{specialization of member 'PR6161::numpunct<char>::~numpunct' does not specialize an instantiated member}}
+ numpunct<char>::~numpunct(); // expected-error{{expected the class name after '~' to name a destructor}}
}
diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp
index 1d62804f68ac..703daea3e630 100644
--- a/test/SemaTemplate/friend-template.cpp
+++ b/test/SemaTemplate/friend-template.cpp
@@ -93,7 +93,7 @@ namespace test4 {
};
template<typename T> void f(const A<T>&) {
- int a[sizeof(T) ? -1 : -1]; // expected-error {{array size is negative}}
+ int a[sizeof(T) ? -1 : -1]; // expected-error {{array with a negative size}}
}
void f() {
@@ -207,3 +207,12 @@ namespace PR7013b {
}
}
+
+namespace PR8649 {
+ template<typename T, typename U, unsigned N>
+ struct X {
+ template<unsigned M> friend class X<T, U, M>; // expected-error{{partial specialization cannot be declared as a friend}}
+ };
+
+ X<int, float, 7> x;
+}
diff --git a/test/SemaTemplate/fun-template-def.cpp b/test/SemaTemplate/fun-template-def.cpp
index 309921c0a664..04277812187f 100644
--- a/test/SemaTemplate/fun-template-def.cpp
+++ b/test/SemaTemplate/fun-template-def.cpp
@@ -42,7 +42,7 @@ T f1(T t1, U u1, int i1)
dummy d1 = sizeof(t1); // expected-error {{no viable conversion}}
dummy d2 = offsetof(T, foo); // expected-error {{no viable conversion}}
dummy d3 = __alignof(u1); // expected-error {{no viable conversion}}
- i1 = typeid(t1); // expected-error {{assigning to 'int' from incompatible type 'std::type_info const'}}
+ i1 = typeid(t1); // expected-error {{assigning to 'int' from incompatible type 'const std::type_info'}}
return u1;
}
diff --git a/test/SemaTemplate/function-template-specialization.cpp b/test/SemaTemplate/function-template-specialization.cpp
index 9afc99fe7d5e..a0d41b205344 100644
--- a/test/SemaTemplate/function-template-specialization.cpp
+++ b/test/SemaTemplate/function-template-specialization.cpp
@@ -41,3 +41,8 @@ namespace PR5833 {
}
template <> bool PR5833::f0<float>(float &t1) {}
+// PR8295
+namespace PR8295 {
+ template <typename T> void f(T t) {}
+ template <typename T> void f<T*>(T* t) {} // expected-error{{function template partial specialization is not allowed}}
+}
diff --git a/test/SemaTemplate/inject-templated-friend-post.cpp b/test/SemaTemplate/inject-templated-friend-post.cpp
index 98ac38edfac0..39c445ca0f99 100644
--- a/test/SemaTemplate/inject-templated-friend-post.cpp
+++ b/test/SemaTemplate/inject-templated-friend-post.cpp
@@ -2,8 +2,8 @@
// RUN: %clang %s -S -emit-llvm -o - -DPROTOTYPE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
// RUN: %clang %s -S -emit-llvm -o - -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
// RUN: %clang %s -S -emit-llvm -o - -DPROTOTYPE -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang -cc1 %s -DREDEFINE -verify
-// RUN: %clang -cc1 %s -DPROTOTYPE -DREDEFINE -verify
+// RUN: %clang_cc1 %s -DREDEFINE -verify
+// RUN: %clang_cc1 %s -DPROTOTYPE -DREDEFINE -verify
// PR8007: friend function not instantiated, reordered version.
// Corresponds to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38392
diff --git a/test/SemaTemplate/inject-templated-friend.cpp b/test/SemaTemplate/inject-templated-friend.cpp
index fbe86d96389e..7be613b6d314 100644
--- a/test/SemaTemplate/inject-templated-friend.cpp
+++ b/test/SemaTemplate/inject-templated-friend.cpp
@@ -1,5 +1,5 @@
// RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang -cc1 %s -DREDEFINE -verify
+// RUN: %clang_cc1 %s -DREDEFINE -verify
// PR8007: friend function not instantiated.
struct std_ostream
diff --git a/test/SemaTemplate/instantiate-anonymous-union.cpp b/test/SemaTemplate/instantiate-anonymous-union.cpp
index f2862db6bb7f..68b233a7fda7 100644
--- a/test/SemaTemplate/instantiate-anonymous-union.cpp
+++ b/test/SemaTemplate/instantiate-anonymous-union.cpp
@@ -66,3 +66,24 @@ namespace PR7402 {
X x(42.0);
}
+
+namespace PR9188 {
+ struct X0 {
+ union {
+ int member;
+ };
+ };
+
+ static union {
+ int global;
+ };
+
+ struct X1 : X0 {
+ template<typename T>
+ int f() {
+ return this->X0::member + PR9188::global;
+ }
+ };
+
+ template int X1::f<int>();
+}
diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp
index 9669b2035a1f..abf1b3c31d74 100644
--- a/test/SemaTemplate/instantiate-cast.cpp
+++ b/test/SemaTemplate/instantiate-cast.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-struct A { int x; };
+struct A { int x; }; // expected-note 2 {{candidate constructor}}
class Base {
public:
@@ -23,7 +23,7 @@ struct Constructible {
template<typename T, typename U>
struct CStyleCast0 {
void f(T t) {
- (void)((U)t); // expected-error{{C-style cast from 'A' to 'int' is not allowed}}
+ (void)((U)t); // expected-error{{cannot convert 'A' to 'int' without a conversion operator}}
}
};
@@ -36,7 +36,7 @@ template struct CStyleCast0<A, int>; // expected-note{{instantiation}}
template<typename T, typename U>
struct StaticCast0 {
void f(T t) {
- (void)static_cast<U>(t); // expected-error{{static_cast from 'int' to 'A' is not allowed}}
+ (void)static_cast<U>(t); // expected-error{{no matching conversion for static_cast from 'int' to 'A'}}
}
};
@@ -89,7 +89,7 @@ template struct ConstCast0<int const *, float *>; // expected-note{{instantiatio
template<typename T, typename U>
struct FunctionalCast1 {
void f(T t) {
- (void)U(t); // expected-error{{functional-style cast from 'A' to 'int' is not allowed}}
+ (void)U(t); // expected-error{{cannot convert 'A' to 'int' without a conversion operator}}
}
};
diff --git a/test/SemaTemplate/instantiate-complete.cpp b/test/SemaTemplate/instantiate-complete.cpp
index c13930d108c4..4b27da7349f9 100644
--- a/test/SemaTemplate/instantiate-complete.cpp
+++ b/test/SemaTemplate/instantiate-complete.cpp
@@ -11,8 +11,7 @@ struct X {
// expected-error{{data member instantiated with function type 'int (int)'}} \
// expected-error{{data member instantiated with function type 'char (char)'}} \
// expected-error{{data member instantiated with function type 'short (short)'}} \
- // expected-error{{data member instantiated with function type 'float (float)'}} \
- // expected-error{{data member instantiated with function type 'long (long)'}}
+ // expected-error{{data member instantiated with function type 'float (float)'}}
};
X<int> f() { return 0; }
@@ -44,7 +43,6 @@ void test_memptr(X<long> *p1, long X<long>::*pm1,
X<long(long)> *p2,
long (X<long(long)>::*pm2)(long)) {
(void)(p1->*pm1);
- (void)((p2->*pm2)(0)); // expected-note{{in instantiation of template class 'X<long (long)>' requested here}}
}
// Reference binding to a base
@@ -128,3 +126,23 @@ namespace pr7199 {
template class B<int>; // expected-note {{in instantiation}}
}
+
+namespace PR8425 {
+ template <typename T>
+ class BaseT {};
+
+ template <typename T>
+ class DerivedT : public BaseT<T> {};
+
+ template <typename T>
+ class FromT {
+ public:
+ operator DerivedT<T>() const { return DerivedT<T>(); }
+ };
+
+ void test() {
+ FromT<int> ft;
+ BaseT<int> bt(ft);
+ }
+}
+
diff --git a/test/SemaTemplate/instantiate-default-assignment-operator.cpp b/test/SemaTemplate/instantiate-default-assignment-operator.cpp
index 8b97f59e87ed..31cdef59d9fd 100644
--- a/test/SemaTemplate/instantiate-default-assignment-operator.cpp
+++ b/test/SemaTemplate/instantiate-default-assignment-operator.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename> struct PassRefPtr { };
template<typename T> struct RefPtr {
- RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array size is negative}}
+ RefPtr& operator=(const RefPtr&) { int a[sizeof(T) ? -1 : -1];} // expected-error 2 {{array with a negative size}}
RefPtr& operator=(const PassRefPtr<T>&);
};
diff --git a/test/SemaTemplate/instantiate-expr-4.cpp b/test/SemaTemplate/instantiate-expr-4.cpp
index adae1da26aaf..74eb5e5fff3d 100644
--- a/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/test/SemaTemplate/instantiate-expr-4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
// ---------------------------------------------------------------------
// C++ Functional Casts
@@ -46,8 +46,8 @@ template struct Temporaries0<5, 7>;
// Ensure that both the constructor and the destructor are instantiated by
// checking for parse errors from each.
template<int N> struct BadX {
- BadX() { int a[-N]; } // expected-error {{array size is negative}}
- ~BadX() { int a[-N]; } // expected-error {{array size is negative}}
+ BadX() { int a[-N]; } // expected-error {{array with a negative size}}
+ ~BadX() { int a[-N]; } // expected-error {{array with a negative size}}
};
template<int N>
@@ -319,7 +319,7 @@ template struct NonDepMemberCall0<float&>; // expected-note{{instantiation}}
template<typename T>
struct QualifiedDeclRef0 {
T f() {
- return is_pod<X>::value; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'bool const'}}
+ return is_pod<X>::value; // expected-error{{non-const lvalue reference to type 'int' cannot bind to a value of unrelated type 'const bool'}}
}
};
diff --git a/test/SemaTemplate/instantiate-field.cpp b/test/SemaTemplate/instantiate-field.cpp
index d825cd7cc613..a148ee4e55ed 100644
--- a/test/SemaTemplate/instantiate-field.cpp
+++ b/test/SemaTemplate/instantiate-field.cpp
@@ -90,3 +90,15 @@ namespace PR7355 {
A<int> ai; // expected-note{{in instantiation of}}
}
+
+namespace PR8712 {
+ template <int dim>
+ class B {
+ public:
+ B(const unsigned char i);
+ unsigned char value : (dim > 0 ? dim : 1);
+ };
+
+ template <int dim>
+ inline B<dim>::B(const unsigned char i) : value(i) {}
+}
diff --git a/test/SemaTemplate/instantiate-function-1.cpp b/test/SemaTemplate/instantiate-function-1.cpp
index 651c02c6cdcf..dbd1e6930382 100644
--- a/test/SemaTemplate/instantiate-function-1.cpp
+++ b/test/SemaTemplate/instantiate-function-1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -verify %s
template<typename T, typename U>
struct X0 {
void f(T x, U y) {
diff --git a/test/SemaTemplate/instantiate-local-class.cpp b/test/SemaTemplate/instantiate-local-class.cpp
index d57ba8a68288..20b62c1e537e 100644
--- a/test/SemaTemplate/instantiate-local-class.cpp
+++ b/test/SemaTemplate/instantiate-local-class.cpp
@@ -50,3 +50,18 @@ namespace local_class_with_virtual_functions {
struct S { };
void test() { f<S>(); }
}
+
+namespace PR8801 {
+ template<typename T>
+ void foo() {
+ class X;
+ typedef int (X::*pmf_type)();
+ class X : public T { };
+
+ pmf_type pmf = &T::foo;
+ }
+
+ struct Y { int foo(); };
+
+ template void foo<Y>();
+}
diff --git a/test/SemaTemplate/instantiate-member-expr.cpp b/test/SemaTemplate/instantiate-member-expr.cpp
index 188705ce2139..a31569a0c395 100644
--- a/test/SemaTemplate/instantiate-member-expr.cpp
+++ b/test/SemaTemplate/instantiate-member-expr.cpp
@@ -6,10 +6,10 @@ struct S {
template<typename T>
struct vector {
- void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}}
+ void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array with a negative size}}
};
-class GRExprEngine {
+class ExprEngine {
public:
typedef vector<S<void *> >CheckersOrdered;
CheckersOrdered Checkers;
@@ -22,8 +22,8 @@ public:
class RetainReleaseChecker { };
-void f(GRExprEngine& Eng) {
- Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<RetainReleaseChecker>' requested here}}
+void f(ExprEngine& Eng) {
+ Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'ExprEngine::registerCheck<RetainReleaseChecker>' requested here}}
}
// PR 5838
@@ -49,3 +49,20 @@ namespace test1 {
};
template struct O::B<int>; // expected-note {{in instantiation}}
}
+
+// PR7248
+namespace test2 {
+ template <class T> struct A {
+ void foo() {
+ T::bar(); // expected-error {{type 'int' cannot}}
+ }
+ };
+
+ template <class T> class B {
+ void foo(A<T> a) {
+ a.test2::template A<T>::foo(); // expected-note {{in instantiation}}
+ }
+ };
+
+ template class B<int>;
+}
diff --git a/test/SemaTemplate/instantiate-member-pointers.cpp b/test/SemaTemplate/instantiate-member-pointers.cpp
index dca0f6217054..0db90e3cbf12 100644
--- a/test/SemaTemplate/instantiate-member-pointers.cpp
+++ b/test/SemaTemplate/instantiate-member-pointers.cpp
@@ -61,7 +61,7 @@ namespace ValueDepMemberPointer {
typedef instantiate_function<&S::instantiate> x; // expected-note{{instantiation}}
};
template <typename T> void S<T>::instantiate() {
- int a[(int)sizeof(T)-42]; // expected-error{{array size is negative}}
+ int a[(int)sizeof(T)-42]; // expected-error{{array with a negative size}}
}
S<int> s;
}
diff --git a/test/SemaTemplate/instantiate-member-template.cpp b/test/SemaTemplate/instantiate-member-template.cpp
index 8f4063bc71cb..e2f72756189c 100644
--- a/test/SemaTemplate/instantiate-member-template.cpp
+++ b/test/SemaTemplate/instantiate-member-template.cpp
@@ -203,3 +203,15 @@ namespace PR7669 {
X<int>::Y<int>::Z<0,int>();
}
}
+
+namespace PR8489 {
+ template <typename CT>
+ class C {
+ template<typename FT>
+ void F() {} // expected-note{{FT}}
+ };
+ void f() {
+ C<int> c;
+ c.F(); // expected-error{{no matching member function}}
+ }
+}
diff --git a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
index cbadcde2c1c1..027c1e8bb769 100644
--- a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
+++ b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp
@@ -34,3 +34,22 @@ namespace PR6986 {
ckey_m m;
}
}
+
+namespace rdar8980215 {
+ enum E { E1, E2, E3 };
+
+ template<typename T, E e = E2>
+ struct X0 {
+ X0() {}
+ template<typename U> X0(const X0<U, e> &);
+ };
+
+ template<typename T>
+ struct X1 : X0<T> {
+ X1() {}
+ template<typename U> X1(const X1<U> &x) : X0<T>(x) { }
+ };
+
+ X1<int> x1i;
+ X1<float> x1f(x1i);
+}
diff --git a/test/SemaTemplate/instantiate-static-var.cpp b/test/SemaTemplate/instantiate-static-var.cpp
index e90ac5223d98..0c0607524834 100644
--- a/test/SemaTemplate/instantiate-static-var.cpp
+++ b/test/SemaTemplate/instantiate-static-var.cpp
@@ -2,7 +2,7 @@
template<typename T, T Divisor>
class X {
public:
- static const T value = 10 / Divisor; // expected-error{{in-class initializer is not an integral constant expression}}
+ static const T value = 10 / Divisor; // expected-error{{in-class initializer is not a constant expression}}
};
int array1[X<int, 2>::value == 5? 1 : -1];
@@ -11,7 +11,7 @@ X<int, 0> xi0; // expected-note{{in instantiation of template class 'X<int, 0>'
template<typename T>
class Y {
- static const T value = 0; // expected-error{{'value' can only be initialized if it is a static const integral data member}}
+ static const T value = 0; // expected-warning{{in-class initializer for static data member of type 'const float' is a C++0x extension}}
};
Y<float> fy; // expected-note{{in instantiation of template class 'Y<float>' requested here}}
diff --git a/test/SemaTemplate/instantiate-template-template-parm.cpp b/test/SemaTemplate/instantiate-template-template-parm.cpp
index f48a0c7a7145..a70c7e8b081a 100644
--- a/test/SemaTemplate/instantiate-template-template-parm.cpp
+++ b/test/SemaTemplate/instantiate-template-template-parm.cpp
@@ -44,3 +44,54 @@ template<long V> struct X3l { }; // expected-note{{different type 'long'}}
X2<int, X3i> x2okay;
X2<long, X3l> x2bad; // expected-note{{instantiation}}
+
+template <typename T, template <T, T> class TT, class R = TT<1, 2> >
+struct Comp {
+ typedef R r1;
+ template <T x, T y> struct gt {
+ static const bool result = x > y;
+ };
+ typedef gt<2, 1> r2;
+};
+
+template <int x, int y> struct lt {
+ static const bool result = x < y;
+};
+
+Comp<int, lt> c0;
+
+namespace PR8629 {
+ template<template<int> class TT> struct X0
+ {
+ static void apply();
+ };
+ template<int> struct Type { };
+
+ template<class T> struct X1
+ {
+ template<class U> struct Inner;
+
+ template<class U> void g()
+ {
+ typedef Inner<U> Init;
+ X0<Init::template VeryInner>::apply();
+ }
+ template<int N> void f ()
+ {
+ g<Type<N> >();
+ }
+ };
+ template<class T> template<class U> struct X1<T>::Inner
+ {
+ template<int> struct VeryInner {
+ };
+ };
+ struct X1Container
+ {
+ X1Container()
+ {
+ simplex_.f<0>();
+ }
+ X1<double> simplex_;
+ };
+}
diff --git a/test/SemaTemplate/instantiate-try-catch.cpp b/test/SemaTemplate/instantiate-try-catch.cpp
index aa809e4bf949..f1ffd06334c3 100644
--- a/test/SemaTemplate/instantiate-try-catch.cpp
+++ b/test/SemaTemplate/instantiate-try-catch.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fexceptions -fsyntax-only -std=c++0x -verify %s
template<typename T> struct TryCatch0 {
void f() {
diff --git a/test/SemaTemplate/instantiate-using-decl.cpp b/test/SemaTemplate/instantiate-using-decl.cpp
index 257904490daa..1bfcb7a86508 100644
--- a/test/SemaTemplate/instantiate-using-decl.cpp
+++ b/test/SemaTemplate/instantiate-using-decl.cpp
@@ -61,3 +61,22 @@ namespace test2 {
template void bar(char *);
}
+
+namespace test3 {
+ template <typename T> struct t {
+ struct s1 {
+ T f1() const;
+ };
+ struct s2 : s1 {
+ using s1::f1;
+ T f1() const;
+ };
+ };
+
+ void f2()
+ {
+ t<int>::s2 a;
+ t<int>::s2 const & b = a;
+ b.f1();
+ }
+}
diff --git a/test/SemaTemplate/instantiation-default-1.cpp b/test/SemaTemplate/instantiation-default-1.cpp
index 6f5a660d99f1..99154a5cc460 100644
--- a/test/SemaTemplate/instantiation-default-1.cpp
+++ b/test/SemaTemplate/instantiation-default-1.cpp
@@ -36,7 +36,7 @@ typedef int& int_ref_t;
Def2<int_ref_t> *d2; // expected-note{{in instantiation of default argument for 'Def2<int &>' required here}}
-template<> struct Def1<const int, const int> { }; // expected-error{{redefinition of 'Def1<int const>'}}
+template<> struct Def1<const int, const int> { }; // expected-error{{redefinition of 'Def1<const int>'}}
template<typename T, typename T2 = T&> struct Def3;
diff --git a/test/SemaTemplate/member-access-ambig.cpp b/test/SemaTemplate/member-access-ambig.cpp
new file mode 100644
index 000000000000..bf190435ecd5
--- /dev/null
+++ b/test/SemaTemplate/member-access-ambig.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR8439
+class A
+{
+};
+
+class B
+{
+public:
+ A & m;
+};
+
+class Base
+{
+public:
+ B &f();
+};
+
+class Derived1 : public Base { };
+
+class Derived2 : public Base { };
+
+class X : public B, public Derived2, public Derived1
+{
+public:
+ virtual void g();
+};
+
+void X::g()
+{
+ m.f<int>(); // expected-error{{no member named 'f' in 'A'}} \
+ // expected-error{{expected '(' for function-style cast}} \
+ // expected-error{{expected expression}}
+}
diff --git a/test/SemaTemplate/member-access-expr.cpp b/test/SemaTemplate/member-access-expr.cpp
index 16b9515a15dc..f1aa30ec32a6 100644
--- a/test/SemaTemplate/member-access-expr.cpp
+++ b/test/SemaTemplate/member-access-expr.cpp
@@ -132,3 +132,18 @@ namespace test5 {
}
};
}
+
+// PR8739
+namespace test6 {
+ struct A {};
+ struct B {};
+ template <class T> class Base;
+ template <class T> class Derived : public Base<T> {
+ A *field;
+ void get(B **ptr) {
+ // It's okay if at some point we figure out how to diagnose this
+ // at instantiation time.
+ *ptr = field;
+ }
+ };
+}
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index 6f515916e45f..5be5a1303136 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wconversion -verify %s
template<int N> struct A; // expected-note 5{{template parameter is declared here}}
A<0> *a0;
@@ -58,7 +58,7 @@ template<X const &AnX> struct A4; // expected-note 2{{template parameter is decl
X an_X;
A4<an_X> *a15_1; // okay
A4<*X_volatile_ptr> *a15_2; // expected-error{{non-type template argument does not refer to any declaration}}
-A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'X const &' cannot bind to template argument of type 'struct Y'}} \
+A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'const X &' cannot bind to template argument of type 'struct Y'}} \
// FIXME: expected-error{{expected unqualified-id}}
template<int (&fr)(int)> struct A5; // expected-note{{template parameter is declared here}}
@@ -87,7 +87,7 @@ template<int Z::*pm> struct A7c;
A7<&Z::int_member> *a18_1;
A7c<&Z::int_member> *a18_2;
A7<&Z::float_member> *a18_3; // expected-error{{non-type template argument of type 'float Z::*' cannot be converted to a value of type 'int Z::*'}}
-A7c<(&Z::int_member)> *a18_3; // expected-error{{non-type template argument cannot be surrounded by parentheses}}
+A7c<(&Z::int_member)> *a18_4; // expected-warning{{address non-type template argument cannot be surrounded by parentheses}}
template<unsigned char C> struct Overflow; // expected-note{{template parameter is declared here}}
@@ -169,7 +169,8 @@ namespace pr6249 {
}
namespace PR6723 {
- template<unsigned char C> void f(int (&a)[C]); // expected-note 2{{candidate template ignored}}
+ template<unsigned char C> void f(int (&a)[C]); // expected-note {{candidate template ignored}} \
+ // expected-note{{candidate function [with C = '\x00'] not viable: no known conversion from 'int [512]' to 'int (&)[0]' for 1st argument}}
void g() {
int arr512[512];
f(arr512); // expected-error{{no matching function for call}}
@@ -243,3 +244,22 @@ namespace test8 {
B<&c03> b03;
}
}
+
+namespace PR8372 {
+ template <int I> void foo() { } // expected-note{{template parameter is declared here}}
+ void bar() { foo <0x80000000> (); } // expected-warning{{non-type template argument value '2147483648' truncated to '-2147483648' for template parameter of type 'int'}}
+}
+
+namespace PR9227 {
+ template <bool B> struct enable_if_bool { };
+ template <> struct enable_if_bool<true> { typedef int type; };
+ void test_bool() { enable_if_bool<false>::type i; } // expected-error{{enable_if_bool<false>}}
+
+ template <char C> struct enable_if_char { };
+ template <> struct enable_if_char<'a'> { typedef int type; };
+ void test_char_0() { enable_if_char<0>::type i; } // expected-error{{enable_if_char<'\x00'>}}
+ void test_char_b() { enable_if_char<'b'>::type i; } // expected-error{{enable_if_char<'b'>}}
+ void test_char_possibly_negative() { enable_if_char<'\x02'>::type i; } // expected-error{{enable_if_char<'\x02'>}}
+ void test_char_single_quote() { enable_if_char<'\''>::type i; } // expected-error{{enable_if_char<'\''>}}
+ void test_char_backslash() { enable_if_char<'\\'>::type i; } // expected-error{{enable_if_char<'\\'>}}
+}
diff --git a/test/SemaTemplate/temp_class_spec_neg.cpp b/test/SemaTemplate/temp_class_spec_neg.cpp
index c8e8a57f278b..6b129a5369fb 100644
--- a/test/SemaTemplate/temp_class_spec_neg.cpp
+++ b/test/SemaTemplate/temp_class_spec_neg.cpp
@@ -9,7 +9,7 @@ namespace N {
}
template<typename T>
-struct N::M::A<T*> { }; // expected-error{{originally}}
+struct N::M::A<T*> { }; // expected-warning{{originally}}
// C++ [temp.class.spec]p9
// bullet 1
diff --git a/test/SemaTemplate/typename-specifier-4.cpp b/test/SemaTemplate/typename-specifier-4.cpp
index 5a313bf2256a..38045e0a31bf 100644
--- a/test/SemaTemplate/typename-specifier-4.cpp
+++ b/test/SemaTemplate/typename-specifier-4.cpp
@@ -117,3 +117,40 @@ namespace PR6463 {
return x;
}
}
+
+namespace PR7419 {
+ template <typename T> struct S {
+ typedef typename T::Y T2;
+ typedef typename T2::Z T3;
+ typedef typename T3::W T4;
+ T4 *f();
+
+ typedef typename T::template Y<int> TT2;
+ typedef typename TT2::template Z<float> TT3;
+ typedef typename TT3::template W<double> TT4;
+ TT4 g();
+ };
+
+ template <typename T> typename T::Y::Z::W *S<T>::f() { }
+ template <typename T> typename T::template Y<int>::template Z<float>::template W<double> S<T>::g() { }
+}
+
+namespace rdar8740998 {
+ template<typename T>
+ struct X : public T {
+ using T::iterator; // expected-note{{add 'typename' to treat this using declaration as a type}} \
+ // expected-error{{dependent using declaration resolved to type without 'typename'}}
+
+ void f() {
+ typename X<T>::iterator i; // expected-error{{typename specifier refers to a dependent using declaration for a value 'iterator' in 'X<T>'}}
+ }
+ };
+
+ struct HasIterator {
+ typedef int *iterator; // expected-note{{target of using declaration}}
+ };
+
+ void test_X(X<HasIterator> xi) { // expected-note{{in instantiation of template class}}
+ xi.f();
+ }
+}
diff --git a/test/SemaTemplate/variadic-class-template-1.cpp b/test/SemaTemplate/variadic-class-template-1.cpp
deleted file mode 100644
index 6da64fb55f70..000000000000
--- a/test/SemaTemplate/variadic-class-template-1.cpp
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-
-template<typename ... Args = int> struct S1 { }; // expected-error{{template parameter pack cannot have a default argument}}
-template<typename ... Args, typename T> struct S2 { }; // expected-error{{template parameter pack must be the last template parameter}}
diff --git a/test/SemaTemplate/variadic-class-template-2.cpp b/test/SemaTemplate/variadic-class-template-2.cpp
deleted file mode 100644
index 509977121f4b..000000000000
--- a/test/SemaTemplate/variadic-class-template-2.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-
-// Type parameters packs
-template <typename ...> struct TS1 {}; // expected-note{{template parameter is declared here}}
-template struct TS1<>;
-template struct TS1<int>;
-template struct TS1<int, int>;
-template struct TS1<int, 10>; // expected-error{{template argument for template type parameter must be a type}}
-
-template <typename, typename ...> struct TS2 {}; // expected-note{{template is declared here}}
-template struct TS2<>; // expected-error{{too few template arguments for class template 'TS2'}}
-template struct TS2<int>;
-template struct TS2<int, int>;
-
-template <typename = int, typename ...> struct TS3 {}; // expected-note{{template parameter is declared here}}
-template struct TS3<>; // expected-note{{previous explicit instantiation is here}}
-template struct TS3<int>; // expected-error{{duplicate explicit instantiation of 'TS3}}
-template struct TS3<int, int>;
-template struct TS3<10>; // expected-error{{template argument for template type parameter must be a type}}
diff --git a/test/SemaTemplate/variadic-parse.cpp b/test/SemaTemplate/variadic-parse.cpp
deleted file mode 100644
index d8b77b3f423e..000000000000
--- a/test/SemaTemplate/variadic-parse.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
-
-// Parsing type parameter packs.
-template <typename ... Args> struct T1 {};
-template <typename ... > struct T2 {};
-
diff --git a/test/SemaTemplate/variadic-unsupported.cpp b/test/SemaTemplate/variadic-unsupported.cpp
deleted file mode 100644
index 9f2b0807d2d6..000000000000
--- a/test/SemaTemplate/variadic-unsupported.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-// Type parameter packs.
-template <typename ... > struct T1 {}; // expected-error{{variadic templates are only allowed in C++0x}}
-
diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
new file mode 100644
index 000000000000..794234ce5575
--- /dev/null
+++ b/test/Unit/lit.cfg
@@ -0,0 +1,86 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+import os
+
+# name: The name of this test suite.
+config.name = 'Clang-Unit'
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes = []
+
+# test_source_root: The root path where tests are located.
+# test_exec_root: The root path where tests should be run.
+clang_obj_root = getattr(config, 'clang_obj_root', None)
+if clang_obj_root is not None:
+ config.test_exec_root = os.path.join(clang_obj_root, 'unittests')
+ config.test_source_root = config.test_exec_root
+
+# testFormat: The test format to use to interpret tests.
+llvm_build_mode = getattr(config, 'llvm_build_mode', "Debug")
+config.test_format = lit.formats.GoogleTest(llvm_build_mode, 'Tests')
+
+# Propagate the temp directory. Windows requires this because it uses \Windows\
+# if none of these are present.
+if 'TMP' in os.environ:
+ config.environment['TMP'] = os.environ['TMP']
+if 'TEMP' in os.environ:
+ config.environment['TEMP'] = os.environ['TEMP']
+
+###
+
+# If necessary, point the dynamic loader at libLLVM.so.
+if config.enable_shared:
+ shlibpath = config.environment.get(config.shlibpath_var,'')
+ if shlibpath:
+ shlibpath = os.pathsep + shlibpath
+ shlibpath = config.shlibdir + shlibpath
+ config.environment[config.shlibpath_var] = shlibpath
+
+# Check that the object root is known.
+if config.test_exec_root is None:
+ # Otherwise, we haven't loaded the site specific configuration (the user is
+ # probably trying to run on a test file directly, and either the site
+ # configuration hasn't been created by the build system, or we are in an
+ # out-of-tree build situation).
+
+ # Check for 'clang_unit_site_config' user parameter, and use that if available.
+ site_cfg = lit.params.get('clang_unit_site_config', None)
+ if site_cfg and os.path.exists(site_cfg):
+ lit.load_config(config, site_cfg)
+ raise SystemExit
+
+ # Try to detect the situation where we are using an out-of-tree build by
+ # looking for 'llvm-config'.
+ #
+ # FIXME: I debated (i.e., wrote and threw away) adding logic to
+ # automagically generate the lit.site.cfg if we are in some kind of fresh
+ # build situation. This means knowing how to invoke the build system
+ # though, and I decided it was too much magic.
+
+ llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
+ if not llvm_config:
+ lit.fatal('No site specific configuration available!')
+
+ # Get the source and object roots.
+ llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
+ llvm_obj_root = lit.util.capture(['llvm-config', '--obj-root']).strip()
+ clang_src_root = os.path.join(llvm_src_root, "tools", "clang")
+ clang_obj_root = os.path.join(llvm_obj_root, "tools", "clang")
+
+ # Validate that we got a tree which points to here, using the standard
+ # tools/clang layout.
+ this_src_root = os.path.dirname(config.test_source_root)
+ if os.path.realpath(clang_src_root) != os.path.realpath(this_src_root):
+ lit.fatal('No site specific configuration available!')
+
+ # Check that the site specific configuration exists.
+ site_cfg = os.path.join(clang_obj_root, 'test', 'Unit', 'lit.site.cfg')
+ if not os.path.exists(site_cfg):
+ lit.fatal('No site specific configuration available!')
+
+ # Okay, that worked. Notify the user of the automagic, and reconfigure.
+ lit.note('using out-of-tree build at %r' % clang_obj_root)
+ lit.load_config(config, site_cfg)
+ raise SystemExit
diff --git a/test/Unit/lit.site.cfg.in b/test/Unit/lit.site.cfg.in
new file mode 100644
index 000000000000..9f4d224eb655
--- /dev/null
+++ b/test/Unit/lit.site.cfg.in
@@ -0,0 +1,26 @@
+## Autogenerated by LLVM/Clang configuration.
+# Do not edit!
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+config.clang_obj_root = "@CLANG_BINARY_DIR@"
+config.enable_shared = @ENABLE_SHARED@
+config.shlibdir = "@SHLIBDIR@"
+config.shlibpath_var = "@SHLIBPATH_VAR@"
+config.target_triple = "@TARGET_TRIPLE@"
+
+# Support substitution of the tools_dir, libs_dirs, and build_mode with user
+# parameters. This is used when we can't determine the tool dir at
+# configuration time.
+try:
+ config.llvm_tools_dir = config.llvm_tools_dir % lit.params
+ config.llvm_libs_dir = config.llvm_libs_dir % lit.params
+ config.llvm_build_mode = config.llvm_build_mode % lit.params
+except KeyError,e:
+ key, = e.args
+ lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
+# Let the main config do the real work.
+lit.load_config(config, "@CLANG_SOURCE_DIR@/test/Unit/lit.cfg")
diff --git a/test/lit.cfg b/test/lit.cfg
index 80f8d5a544af..6567c6d229cb 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -8,6 +8,18 @@ import platform
# name: The name of this test suite.
config.name = 'Clang'
+# Tweak PATH for Win32
+if platform.system() == 'Windows':
+ # Seek sane tools in directories and set to $PATH.
+ path = getattr(config, 'lit_tools_dir', None)
+ path = lit.getToolsPath(path,
+ config.environment['PATH'],
+ ['cmp.exe', 'grep.exe', 'sed.exe'])
+ if path is not None:
+ path = os.path.pathsep.join((path,
+ config.environment['PATH']))
+ config.environment['PATH'] = path
+
# testFormat: The test format to use to interpret tests.
#
# For now we require '&&' between commands, until they get globally killed and
@@ -16,7 +28,7 @@ execute_external = platform.system() != 'Windows'
config.test_format = lit.formats.ShTest(execute_external)
# suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.m', '.mm']
+config.suffixes = ['.c', '.cpp', '.m', '.mm', '.cu', '.ll', '.cl']
# test_source_root: The root path where tests are located.
config.test_source_root = os.path.dirname(__file__)
@@ -88,7 +100,8 @@ if config.test_exec_root is None:
# Check that the site specific configuration exists.
site_cfg = os.path.join(clang_obj_root, 'test', 'lit.site.cfg')
if not os.path.exists(site_cfg):
- lit.fatal('No site specific configuration available!')
+ lit.fatal('No site specific configuration available! You may need to '
+ 'run "make test" in your Clang build directory.')
# Okay, that worked. Notify the user of the automagic, and reconfigure.
lit.note('using out-of-tree build at %r' % clang_obj_root)
@@ -131,12 +144,13 @@ config.substitutions.append( ('%clang_cc1', config.clang + ' -cc1') )
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' -ccc-clang-cxx -ccc-cxx '))
config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )
+config.substitutions.append( ('%test_debuginfo', ' ' + config.llvm_src_root + '/utils/test_debuginfo.pl ') )
# FIXME: Find nicer way to prohibit this.
config.substitutions.append(
(' clang ', """*** Do not use 'clang' in tests, use '%clang'. ***""") )
config.substitutions.append(
- (' clang++ ', """*** Do not use 'clang++' in tests, use '%clangxx'. ***"""))
+ (' clang\+\+ ', """*** Do not use 'clang++' in tests, use '%clangxx'. ***"""))
config.substitutions.append(
(' clang-cc ',
"""*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***""") )
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 0d452ef6b55a..df90b81055f8 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -4,6 +4,7 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.clang_obj_root = "@CLANG_BINARY_DIR@"
config.target_triple = "@TARGET_TRIPLE@"