From b3d5a323a5ca92ea73443499cee2f15db1ff0fb3 Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Wed, 18 Nov 2009 14:59:57 +0000 Subject: Update clang to r89205. --- test/Analysis/CFDateGC.m | 10 +- test/Analysis/CFNumber.c | 8 +- test/Analysis/CFRetainRelease_NSAssertionHandler.m | 8 +- test/Analysis/CGColorSpace.c | 8 +- test/Analysis/CheckNSError.m | 8 +- test/Analysis/MissingDealloc.m | 2 +- test/Analysis/NSPanel.m | 8 +- test/Analysis/NSString.m | 19 +- test/Analysis/NSWindow.m | 8 +- test/Analysis/NoReturn.m | 8 +- test/Analysis/ObjCProperties.m | 8 +- test/Analysis/ObjCRetSigs.m | 4 +- test/Analysis/PR2599.m | 8 +- test/Analysis/PR2978.m | 2 +- test/Analysis/PR3991.m | 19 +- test/Analysis/array-struct.c | 12 +- test/Analysis/casts.c | 2 +- test/Analysis/casts.m | 4 +- test/Analysis/cfref_PR2519.c | 8 +- test/Analysis/cfref_rdar6080742.c | 8 +- test/Analysis/complex.c | 8 +- test/Analysis/concrete-address.c | 4 +- test/Analysis/conditional-op-missing-lhs.c | 2 +- test/Analysis/dead-stores.c | 10 +- test/Analysis/dead-stores.cpp | 10 +- test/Analysis/dead-stores.m | 2 +- test/Analysis/delegates.m | 4 +- test/Analysis/elementtype.c | 2 +- test/Analysis/exercise-ps.c | 4 +- test/Analysis/fields.c | 4 +- test/Analysis/func.c | 4 +- test/Analysis/malloc.c | 37 ++ test/Analysis/misc-ps-64.m | 8 +- test/Analysis/misc-ps-basic-store.m | 2 +- test/Analysis/misc-ps-eager-assume.m | 2 +- test/Analysis/misc-ps-ranges.m | 6 +- test/Analysis/misc-ps-region-store-i386.m | 2 +- test/Analysis/misc-ps-region-store-x86_64.m | 2 +- test/Analysis/misc-ps-region-store.m | 45 +- test/Analysis/misc-ps.m | 38 +- ...il-receiver-undefined-larger-than-voidptr-ret.m | 4 +- test/Analysis/no-exit-cfg.c | 4 +- test/Analysis/no-outofbounds.c | 5 +- test/Analysis/null-deref-ps-region.c | 2 +- test/Analysis/null-deref-ps.c | 8 +- test/Analysis/outofbound.c | 5 +- test/Analysis/override-werror.c | 4 +- test/Analysis/plist-output.m | 122 ++++ test/Analysis/pr4209.m | 14 +- test/Analysis/pr_2542_rdar_6793404.m | 4 +- test/Analysis/pr_4164.c | 4 +- test/Analysis/ptr-arith.c | 33 +- test/Analysis/rdar-6442306-1.m | 4 +- test/Analysis/rdar-6540084.m | 2 +- test/Analysis/rdar-6541136-region.c | 17 +- test/Analysis/rdar-6541136.c | 2 +- test/Analysis/rdar-6562655.m | 4 +- test/Analysis/rdar-6582778-basic-store.c | 2 +- ...dar-6600344-nil-receiver-undefined-struct-ret.m | 4 +- test/Analysis/rdar-7168531.m | 4 +- test/Analysis/refcnt_naming.m | 4 +- test/Analysis/region-1.m | 5 +- test/Analysis/retain-release-gc-only.m | 4 +- test/Analysis/retain-release.m | 2 +- test/Analysis/security-syntax-checks.m | 7 + test/Analysis/sizeofpointer.c | 8 + test/Analysis/stack-addr-ps.c | 4 +- test/Analysis/uninit-msg-expr.m | 2 +- test/Analysis/uninit-ps-rdar6145427.m | 2 +- test/Analysis/uninit-vals-ps.c | 2 +- test/Analysis/uninit-vals.m | 2 +- test/Analysis/unused-ivars.m | 2 +- test/CMakeLists.txt | 44 +- .../basic/basic.lookup/basic.lookup.udir/p1.cpp | 35 ++ .../namespace.def/namespace.unnamed/p1.cpp | 24 + .../dcl.dcl/basic.namespace/namespace.udecl/p1.cpp | 67 ++ .../dcl.dcl/basic.namespace/namespace.udir/p1.cpp | 141 +++++ test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp | 44 ++ .../dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp | 2 +- test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp | 2 +- test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp | 4 +- test/CXX/expr/expr.unary/expr.delete/p5.cpp | 34 ++ test/CXX/special/class.free/p1.cpp | 11 + test/CXX/special/class.free/p6.cpp | 11 + test/CXX/temp/temp.param/p1.cpp | 2 +- test/CXX/temp/temp.param/p12.cpp | 4 +- test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp | 2 +- test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp | 5 +- test/CodeCompletion/call.cpp | 5 +- test/CodeCompletion/enum-switch-case-qualified.cpp | 3 +- test/CodeCompletion/enum-switch-case.c | 3 +- test/CodeCompletion/enum-switch-case.cpp | 3 +- test/CodeCompletion/function-templates.cpp | 3 +- test/CodeCompletion/functions.cpp | 3 +- test/CodeCompletion/macros.c | 5 +- test/CodeCompletion/member-access.c | 3 +- test/CodeCompletion/member-access.cpp | 3 +- test/CodeCompletion/namespace-alias.cpp | 3 +- test/CodeCompletion/namespace.cpp | 3 +- test/CodeCompletion/nested-name-specifier.cpp | 3 +- test/CodeCompletion/objc-message.m | 35 ++ test/CodeCompletion/operator.cpp | 3 +- test/CodeCompletion/ordinary-name.c | 3 +- test/CodeCompletion/property.m | 2 +- test/CodeCompletion/tag.c | 3 +- test/CodeCompletion/tag.cpp | 3 +- test/CodeCompletion/templates.cpp | 3 +- test/CodeCompletion/truncation.c | 5 +- test/CodeCompletion/using-namespace.cpp | 3 +- test/CodeCompletion/using.cpp | 3 +- test/CodeGen/2008-07-17-no-emit-on-error.c | 4 +- ...2008-07-22-bitfield-init-after-zero-len-array.c | 2 +- test/CodeGen/2008-07-29-override-alias-decl.c | 18 +- test/CodeGen/2008-07-30-implicit-initialization.c | 4 +- test/CodeGen/2008-07-31-asm-labels.c | 14 +- test/CodeGen/2009-10-20-GlobalDebug.c | 2 +- test/CodeGen/PR2001-bitfield-reload.c | 4 +- test/CodeGen/PR3589-freestanding-libcalls.c | 6 +- test/CodeGen/PR3613-static-decl.c | 2 +- test/CodeGen/PR4611-bitfield-layout.c | 2 +- test/CodeGen/address-space-field1.c | 33 +- test/CodeGen/address-space.c | 8 +- test/CodeGen/alias.c | 12 +- test/CodeGen/alignof.c | 2 +- test/CodeGen/always_inline.c | 8 +- test/CodeGen/arm-arguments.c | 2 +- test/CodeGen/asm-2.c | 2 +- test/CodeGen/asm-inout.c | 2 +- test/CodeGen/asm.c | 6 +- test/CodeGen/atomic.c | 22 +- test/CodeGen/attr-nodebug.c | 2 +- test/CodeGen/attr-noinline.c | 2 +- test/CodeGen/attr-used.c | 6 +- test/CodeGen/attributes.c | 5 +- test/CodeGen/bitfield-assign.c | 10 +- test/CodeGen/bitfield-promote.c | 7 +- test/CodeGen/bitfield.c | 4 +- test/CodeGen/blocks-1.c | 16 +- test/CodeGen/blocks-2.c | 6 +- test/CodeGen/blocks-aligned-byref-variable.c | 2 +- test/CodeGen/blocks-seq.c | 12 +- test/CodeGen/blocks.c | 5 +- test/CodeGen/builtin-count-zeros.c | 2 +- test/CodeGen/builtin-memfns.c | 8 +- test/CodeGen/builtin-nanf.c | 2 +- test/CodeGen/builtin-stackaddress.c | 2 +- test/CodeGen/builtins-ffs_parity_popcount.c | 2 +- test/CodeGen/builtins-powi.c | 2 +- test/CodeGen/builtins-x86.c | 2 +- test/CodeGen/builtins.c | 4 +- test/CodeGen/c-strings.c | 8 +- test/CodeGen/cleanup-stack.c | 2 +- test/CodeGen/compound-type.c | 4 +- test/CodeGen/conditional.c | 8 + test/CodeGen/const-init.c | 12 + test/CodeGen/constant-comparison.c | 2 +- test/CodeGen/constructor-attribute.c | 10 +- test/CodeGen/darwin-string-literals.c | 2 +- test/CodeGen/debug-info.c | 2 +- test/CodeGen/designated-initializers.c | 4 +- test/CodeGen/dllimport-dllexport.c | 4 +- test/CodeGen/emit-all-decls.c | 6 +- test/CodeGen/ext-vector-shuffle.c | 4 +- test/CodeGen/flexible-array-init.c | 6 +- test/CodeGen/functions.c | 8 +- test/CodeGen/global-decls.c | 13 +- test/CodeGen/init.c | 4 +- test/CodeGen/inline.c | 74 +-- test/CodeGen/inline2.c | 2 +- test/CodeGen/libcalls.c | 10 +- test/CodeGen/lineno-dbginfo.c | 6 +- test/CodeGen/mandel.c | 2 +- test/CodeGen/no-common.c | 6 +- test/CodeGen/object-size.c | 24 +- test/CodeGen/packed-union.c | 4 +- test/CodeGen/parameter-passing.c | 13 +- test/CodeGen/pragma-pack-2.c | 2 +- test/CodeGen/pragma-pack-3.c | 2 +- test/CodeGen/predefined-expr.c | 2 +- test/CodeGen/private-extern.c | 4 +- test/CodeGen/rdr-6098585-default-after-caserange.c | 4 +- .../rdr-6098585-default-fallthrough-to-caserange.c | 2 +- test/CodeGen/rdr-6098585-empty-case-range.c | 4 +- .../rdr-6098585-fallthrough-to-empty-range.c | 2 +- test/CodeGen/rdr-6098585-unsigned-caserange.c | 4 +- test/CodeGen/stack-protector.c | 19 +- test/CodeGen/staticinit.c | 4 +- test/CodeGen/stdcall-fastcall.c | 2 +- test/CodeGen/string-init.c | 6 +- test/CodeGen/struct-passing.c | 15 +- test/CodeGen/struct-x86-darwin.c | 18 +- test/CodeGen/target-data.c | 13 +- test/CodeGen/tentative-decls.c | 15 +- test/CodeGen/trapv.c | 2 +- test/CodeGen/unreachable.c | 2 +- test/CodeGen/unwind-attr.c | 2 +- test/CodeGen/visibility.c | 49 +- test/CodeGen/volatile-1.c | 6 +- test/CodeGen/volatile.c | 4 +- test/CodeGen/x86.c | 16 +- test/CodeGen/x86_32-arguments.c | 111 ++-- test/CodeGen/x86_64-arguments.c | 51 +- test/CodeGenCXX/PR5050-constructor-conversion.cpp | 9 +- test/CodeGenCXX/array-construction.cpp | 9 +- test/CodeGenCXX/array-operator-delete-call.cpp | 63 ++ test/CodeGenCXX/array-value-initialize.cpp | 28 + test/CodeGenCXX/assign-operator.cpp | 9 + test/CodeGenCXX/attr.cpp | 2 +- test/CodeGenCXX/call-arg-zero-temp.cpp | 9 +- test/CodeGenCXX/cast-conversion.cpp | 9 +- test/CodeGenCXX/class-layout.cpp | 2 +- test/CodeGenCXX/constructor-conversion.cpp | 9 +- test/CodeGenCXX/constructor-default-arg.cpp | 9 +- test/CodeGenCXX/constructor-for-array-members.cpp | 9 +- test/CodeGenCXX/constructor-template.cpp | 9 +- test/CodeGenCXX/conversion-function.cpp | 9 +- test/CodeGenCXX/convert-to-fptr.cpp | 9 +- test/CodeGenCXX/copy-assign-synthesis-1.cpp | 9 +- test/CodeGenCXX/copy-assign-synthesis.cpp | 2 +- test/CodeGenCXX/copy-constructor-elim.cpp | 7 +- test/CodeGenCXX/copy-constructor-synthesis.cpp | 11 +- test/CodeGenCXX/debug-info.cpp | 13 + test/CodeGenCXX/decl-ref-init.cpp | 9 +- test/CodeGenCXX/default-arg-temps.cpp | 6 +- test/CodeGenCXX/default-arguments.cpp | 13 + .../default-constructor-default-argument.cpp | 8 + .../CodeGenCXX/default-constructor-for-members.cpp | 9 +- test/CodeGenCXX/default-destructor-synthesis.cpp | 9 +- test/CodeGenCXX/delete-two-arg.cpp | 6 + test/CodeGenCXX/delete.cpp | 2 +- test/CodeGenCXX/derived-to-base-conv.cpp | 9 +- test/CodeGenCXX/destructors.cpp | 14 + test/CodeGenCXX/dyncast.cpp | 414 +++++++++++++ test/CodeGenCXX/empty-union.cpp | 10 + test/CodeGenCXX/explicit-instantiation.cpp | 2 +- test/CodeGenCXX/extern-c.cpp | 6 +- test/CodeGenCXX/global-array-destruction.cpp | 33 + test/CodeGenCXX/implicit-instantiation-1.cpp | 11 +- test/CodeGenCXX/init-incomplete-type.cpp | 12 + test/CodeGenCXX/instantiate-init-list.cpp | 13 + test/CodeGenCXX/mangle-subst.cpp | 8 + test/CodeGenCXX/mangle-system-header.cpp | 7 + test/CodeGenCXX/mangle.cpp | 6 + test/CodeGenCXX/member-expressions.cpp | 19 + test/CodeGenCXX/member-function-pointers.cpp | 6 +- test/CodeGenCXX/member-functions.cpp | 20 +- test/CodeGenCXX/member-init-struct.cpp | 18 + test/CodeGenCXX/member-init-union.cpp | 10 + test/CodeGenCXX/member-pointers-zero-init.cpp | 16 +- test/CodeGenCXX/new-operator-phi.cpp | 11 + test/CodeGenCXX/new.cpp | 3 +- test/CodeGenCXX/ptr-to-member-function.cpp | 9 +- test/CodeGenCXX/reinterpret-cast.cpp | 5 + test/CodeGenCXX/rtti.cpp | 207 +++++++ test/CodeGenCXX/static-init-1.cpp | 23 + test/CodeGenCXX/static-init-2.cpp | 6 + test/CodeGenCXX/static-init.cpp | 4 +- test/CodeGenCXX/temporaries.cpp | 87 +++ test/CodeGenCXX/trivial-constructor-init.cpp | 5 +- test/CodeGenCXX/typeinfo | 16 + test/CodeGenCXX/vararg-conversion-ctor.cpp | 23 + test/CodeGenCXX/virt-dtor-gen.cpp | 10 + test/CodeGenCXX/virt.cpp | 675 +++++++-------------- test/CodeGenCXX/virtual-operator-call.cpp | 10 + test/CodeGenCXX/virtual-pseudo-destructor-call.cpp | 10 + test/CodeGenCXX/x86_64-arguments.cpp | 7 +- test/CodeGenObjC/bitfield-1.m | 4 +- test/CodeGenObjC/bitfield-ivar-metadata.m | 2 +- test/CodeGenObjC/bitfield-ivar-offsets.m | 19 +- test/CodeGenObjC/blocks-1.m | 18 +- test/CodeGenObjC/blocks-2.m | 5 +- test/CodeGenObjC/blocks-3.m | 4 +- test/CodeGenObjC/blocks.m | 5 +- test/CodeGenObjC/category-super-class-meth.m | 2 +- test/CodeGenObjC/class-getter-dotsyntax.m | 2 +- test/CodeGenObjC/class-type.m | 4 +- test/CodeGenObjC/constant-strings.m | 4 +- test/CodeGenObjC/continuation-class.m | 2 +- test/CodeGenObjC/deadcode_strip_used_var.m | 6 +- test/CodeGenObjC/debug-info-linkagename.m | 2 +- test/CodeGenObjC/dot-syntax-1.m | 4 +- test/CodeGenObjC/dot-syntax.m | 4 +- test/CodeGenObjC/encode-test-1.m | 4 +- test/CodeGenObjC/encode-test-2.m | 10 +- test/CodeGenObjC/encode-test-3.m | 4 +- test/CodeGenObjC/encode-test-5.m | 10 +- test/CodeGenObjC/encode-test.m | 12 +- test/CodeGenObjC/forward-class-impl-metadata.m | 2 +- test/CodeGenObjC/hidden-visibility.m | 25 + test/CodeGenObjC/hidden.m | 2 +- test/CodeGenObjC/image-info.m | 2 +- test/CodeGenObjC/implicit-objc_msgSend.m | 2 +- test/CodeGenObjC/interface-layout-64.m | 45 +- test/CodeGenObjC/interface.m | 2 +- test/CodeGenObjC/ivar-layout-64.m | 11 +- test/CodeGenObjC/ivar-layout-no-optimize.m | 5 +- test/CodeGenObjC/ivars.m | 2 +- test/CodeGenObjC/link-errors.m | 10 +- test/CodeGenObjC/message-arrays.m | 2 +- test/CodeGenObjC/messages-2.m | 4 +- test/CodeGenObjC/messages.m | 13 +- test/CodeGenObjC/metadata-symbols-32.m | 51 +- test/CodeGenObjC/metadata-symbols-64.m | 69 ++- test/CodeGenObjC/metadata_symbols.m | 45 +- test/CodeGenObjC/missing-atend-metadata.m | 24 + test/CodeGenObjC/newproperty-nested-synthesis-1.m | 2 +- test/CodeGenObjC/non-lazy-classes.m | 7 +- test/CodeGenObjC/objc-align.m | 21 +- test/CodeGenObjC/objc-assign-ivar.m | 5 +- test/CodeGenObjC/objc-gc-aggr-assign.m | 2 +- test/CodeGenObjC/objc-read-weak-byref.m | 9 +- test/CodeGenObjC/objc2-assign-global.m | 5 +- test/CodeGenObjC/objc2-ivar-assign.m | 5 +- test/CodeGenObjC/objc2-new-gc-api-strongcast.m | 5 +- test/CodeGenObjC/objc2-no-write-barrier.m | 2 +- test/CodeGenObjC/objc2-property-encode.m | 2 +- test/CodeGenObjC/objc2-protocol-enc.m | 8 +- test/CodeGenObjC/objc2-strong-cast.m | 2 +- test/CodeGenObjC/objc2-weak-assign.m | 2 +- test/CodeGenObjC/objc2-weak-compare.m | 2 +- test/CodeGenObjC/objc2-weak-import-attribute.m | 34 ++ test/CodeGenObjC/objc2-weak-ivar-debug.m | 2 +- test/CodeGenObjC/objc2-write-barrier-2.m | 9 +- test/CodeGenObjC/objc2-write-barrier-3.m | 7 +- test/CodeGenObjC/objc2-write-barrier-4.m | 7 +- test/CodeGenObjC/objc2-write-barrier-5.m | 7 +- test/CodeGenObjC/objc2-write-barrier.m | 7 +- test/CodeGenObjC/object-incr-decr-1.m | 2 +- test/CodeGenObjC/overloadable.m | 4 +- test/CodeGenObjC/property-aggr-type.m | 2 +- test/CodeGenObjC/property-agrr-getter.m | 2 +- test/CodeGenObjC/property-complex.m | 2 +- test/CodeGenObjC/property-getter-dot-syntax.m | 2 +- test/CodeGenObjC/property-incr-decr-1.m | 2 +- test/CodeGenObjC/property-setter-attr.m | 2 +- test/CodeGenObjC/property.m | 4 +- test/CodeGenObjC/protocol-in-extended-class.m | 9 +- test/CodeGenObjC/protocol-property-synth.m | 2 +- test/CodeGenObjC/protocols-lazy.m | 27 +- test/CodeGenObjC/protocols.m | 2 +- test/CodeGenObjC/runtime-fns.m | 6 +- test/CodeGenObjC/super-classmethod-category.m | 2 +- test/CodeGenObjC/super-message-fragileabi.m | 32 + test/CodeGenObjC/synchronized.m | 4 +- test/CodeGenObjC/synthesize_ivar-cont-class.m | 2 +- test/CodeGenObjC/synthesize_ivar.m | 2 +- test/CodeGenObjC/try.m | 2 +- test/CodeGenObjC/unname-bf-metadata.m | 2 +- test/CodeGenObjC/variadic-sends.m | 4 +- test/Coverage/ast-printing.c | 6 +- test/Coverage/ast-printing.cpp | 4 +- test/Coverage/ast-printing.m | 4 +- test/Coverage/codegen-next.m | 4 +- test/Coverage/codegen.c | 8 +- test/Coverage/html-diagnostics.c | 4 +- test/Coverage/parse-callbacks.c | 2 +- test/Coverage/parse-callbacks.m | 2 +- test/Coverage/targets.c | 39 +- test/Driver/Xarch.c | 17 +- test/Driver/analyze.c | 2 +- test/Driver/arm-darwin-builtin.c | 4 +- test/Driver/ast.c | 12 +- test/Driver/bindings.c | 97 ++- test/Driver/clang-translation.c | 31 +- test/Driver/clang_cpp.c | 2 +- test/Driver/clang_f_opts.c | 21 +- test/Driver/cxx-pth.cpp | 8 +- test/Driver/darwin-as.c | 6 +- test/Driver/darwin-cc.c | 7 +- test/Driver/darwin-ld.c | 49 +- test/Driver/default-toolchain.c | 10 +- test/Driver/dragonfly.c | 2 +- test/Driver/emit-llvm.c | 2 +- test/Driver/flags.c | 10 +- test/Driver/freebsd.c | 4 +- test/Driver/hello.c | 6 +- test/Driver/immediate-options.c | 9 +- test/Driver/lto.c | 31 +- test/Driver/openbsd.c | 2 +- test/Driver/parsing.c | 35 +- test/Driver/phases.c | 25 +- test/Driver/preprocessor.c | 2 +- test/Driver/pth.c | 8 +- test/Driver/redzone.c | 6 +- test/Driver/std.c | 4 +- test/Driver/unknown-gcc-arch.c | 14 +- test/Driver/x86_features.c | 2 +- test/FixIt/fixit-at.c | 2 +- test/FixIt/fixit-c90.c | 2 +- test/FixIt/fixit-errors-1.c | 2 +- test/FixIt/fixit-errors.c | 12 +- test/FixIt/fixit-objc.m | 32 +- test/FixIt/fixit-pmem.cpp | 2 +- test/FixIt/fixit.c | 14 +- test/FixIt/fixit.cpp | 11 +- test/Frontend/ast-codegen.c | 2 +- test/Frontend/ast-main.c | 6 +- test/Frontend/cpp-output.c | 13 +- test/Frontend/darwin-version.c | 45 +- test/Frontend/dependency-gen.c | 10 +- test/Frontend/rewrite-macros.c | 11 +- test/Frontend/stdin.c | 2 +- test/Index/Inputs/c-index-pch.h | 7 + test/Index/Inputs/foo.h | 8 + test/Index/Inputs/lit.local.cfg | 1 + test/Index/Inputs/objc.h | 11 + test/Index/Inputs/t1.c | 28 + test/Index/Inputs/t1.m | 20 + test/Index/Inputs/t2.c | 11 + test/Index/Inputs/t2.m | 13 + test/Index/TestClassDecl.m | 52 ++ test/Index/TestClassForwardDecl.m | 46 ++ test/Index/c-index-api-loadTU-test.m | 224 +++++++ test/Index/c-index-api-test.m | 2 +- test/Index/c-index-getCursor-test.m | 160 +++++ test/Index/c-index-pch.c | 8 +- test/Index/code-completion.cpp | 53 ++ test/Index/comments.c | 18 +- test/Index/complete-member-access.m | 30 + test/Index/complete-objc-message.m | 107 ++++ test/Index/complete-protocols.m | 25 + test/Index/find-decls.c | 34 +- test/Index/find-defs.c | 26 +- test/Index/find-refs.c | 80 +-- test/Index/multiple-redecls.c | 4 +- test/Index/objc-decls.m | 24 +- test/Index/objc-message.m | 60 +- test/Index/resolve-loc.c | 32 +- test/Lexer/block_cmt_end.c | 8 +- test/Lexer/counter.c | 8 +- test/Lexer/digraph.c | 2 +- test/Lexer/dollar-idents.c | 6 +- test/Lexer/escape_newline.c | 4 +- test/Lexer/rdr-6096838.c | 2 +- test/Lexer/token-concat.c | 2 +- test/Misc/caret-diags-macros.c | 14 +- test/Misc/diag-mapping.c | 16 +- test/Misc/diag-mapping2.c | 12 +- test/Misc/message-length.c | 2 +- test/PCH/asm.c | 4 +- test/PCH/attrs.c | 4 +- test/PCH/blocks.c | 4 +- test/PCH/builtins.c | 4 +- test/PCH/enum.c | 4 +- test/PCH/exprs.c | 4 +- test/PCH/ext_vector.c | 4 +- test/PCH/external-defs.c | 14 +- test/PCH/functions.c | 4 +- test/PCH/fuzzy-pch.c | 6 +- test/PCH/line-directive.c | 4 +- test/PCH/method_pool.m | 4 +- test/PCH/multiple_decls.c | 4 +- test/PCH/nonvisible-external-defs.c | 4 +- test/PCH/objc_exprs.m | 4 +- test/PCH/objc_import.m | 4 +- test/PCH/objc_methods.m | 4 +- test/PCH/objc_property.m | 4 +- test/PCH/pr4489.c | 4 +- test/PCH/preprocess.c | 11 +- test/PCH/reloc.c | 4 +- test/PCH/stmts.c | 4 +- test/PCH/struct.c | 4 +- test/PCH/tentative-defs.c | 6 +- test/PCH/types.c | 4 +- test/PCH/va_arg.c | 4 +- test/PCH/variables.c | 4 +- test/Parser/2008-10-31-parse-noop-failure.c | 2 +- test/Parser/block-block-storageclass.c | 2 +- test/Parser/control-scope.c | 2 +- test/Parser/cxx-using-declaration.cpp | 4 +- test/Parser/objc-init.m | 18 + test/Parser/objc-try-catch-1.m | 2 +- test/Preprocessor/_Pragma-dependency.c | 2 +- test/Preprocessor/_Pragma-physloc.c | 2 +- test/Preprocessor/assembler-with-cpp.c | 5 +- test/Preprocessor/builtin_line.c | 2 +- test/Preprocessor/comment_save_macro.c | 4 +- test/Preprocessor/cxx_and.cpp | 6 +- test/Preprocessor/cxx_bitand.cpp | 4 +- test/Preprocessor/cxx_bitor.cpp | 8 +- test/Preprocessor/cxx_compl.cpp | 4 +- test/Preprocessor/cxx_not.cpp | 2 +- test/Preprocessor/cxx_not_eq.cpp | 4 +- test/Preprocessor/cxx_oper_keyword.cpp | 2 +- test/Preprocessor/cxx_or.cpp | 6 +- test/Preprocessor/cxx_true.cpp | 4 +- test/Preprocessor/cxx_xor.cpp | 8 +- test/Preprocessor/dependencies-and-pp.c | 8 +- test/Preprocessor/dump-options.c | 2 +- test/Preprocessor/dump_macros.c | 16 +- test/Preprocessor/expr_comma.c | 2 +- test/Preprocessor/expr_invalid_tok.c | 4 +- test/Preprocessor/expr_liveness.c | 2 +- test/Preprocessor/feature_tests.c | 2 +- test/Preprocessor/hash_line.c | 4 +- test/Preprocessor/header_lookup1.c | 2 +- test/Preprocessor/if_warning.c | 2 +- test/Preprocessor/include-pth.c | 2 +- test/Preprocessor/init.c | 83 +-- test/Preprocessor/line-directive.c | 4 +- test/Preprocessor/macro-multiline.c | 6 +- test/Preprocessor/macro_disable.c | 2 +- test/Preprocessor/macro_expand.c | 4 +- test/Preprocessor/macro_fn_comma_swallow.c | 6 +- test/Preprocessor/macro_fn_disable_expand.c | 2 +- test/Preprocessor/macro_fn_lparen_scan.c | 6 +- test/Preprocessor/macro_fn_preexpand.c | 2 +- test/Preprocessor/macro_fn_varargs_iso.c | 4 +- test/Preprocessor/macro_fn_varargs_named.c | 4 +- test/Preprocessor/macro_paste_c_block_comment.c | 4 +- test/Preprocessor/macro_paste_commaext.c | 8 +- test/Preprocessor/macro_paste_empty.c | 4 +- test/Preprocessor/macro_paste_hard.c | 4 +- test/Preprocessor/macro_rescan.c | 2 +- test/Preprocessor/macro_rescan2.c | 2 +- test/Preprocessor/objc-pp.m | 2 +- test/Preprocessor/optimize.c | 4 +- test/Preprocessor/pic.c | 19 +- test/Preprocessor/pragma_unknown.c | 2 +- test/Preprocessor/print_line_track.c | 8 +- test/Preprocessor/stdint.c | 593 +++++++++--------- test/Preprocessor/x86_target_features.c | 55 +- test/Rewriter/objc-ivar-receiver-1.m | 2 +- test/Sema/128bitint.c | 5 +- test/Sema/PR2727.c | 2 +- test/Sema/PR2728.c | 2 +- test/Sema/attr-format_arg.c | 2 +- test/Sema/attr-malloc.c | 6 +- test/Sema/block-byref-args.c | 2 +- test/Sema/block-storageclass.c | 2 +- test/Sema/builtin-object-size.c | 2 +- test/Sema/callingconv.c | 4 + test/Sema/check-increment.c | 2 +- test/Sema/compare.c | 207 ++++++- test/Sema/conditional-expr.c | 2 +- test/Sema/const-eval.c | 7 + test/Sema/conversion-64-32.c | 5 + test/Sema/conversion.c | 237 ++++++++ test/Sema/expr-comma-c89.c | 1 - test/Sema/expr-comma.c | 1 - test/Sema/format-attr-pr4470.c | 2 +- test/Sema/format-strings.c | 19 +- test/Sema/i-c-e.c | 2 +- test/Sema/implicit-builtin-redecl.c | 2 +- test/Sema/implicit-def.c | 2 +- test/Sema/parentheses.c | 2 +- test/Sema/pointer-conversion.c | 10 + test/Sema/pragma-pack-4.c | 2 +- test/Sema/return.c | 2 +- test/Sema/shift.c | 2 +- test/Sema/ucn-cstring.c | 2 +- test/Sema/varargs.c | 2 +- test/Sema/wchar.c | 20 +- test/Sema/x86-intrinsics-headers.c | 4 +- test/SemaCXX/__null.cpp | 2 +- test/SemaCXX/arrow-operator.cpp | 7 +- test/SemaCXX/builtins.cpp | 7 + test/SemaCXX/cast-conversion.cpp | 25 + test/SemaCXX/compare.cpp | 204 ++++++- test/SemaCXX/composite-pointer-type.cpp | 12 +- test/SemaCXX/conditional-expr.cpp | 2 +- test/SemaCXX/constructor-initializer.cpp | 26 +- test/SemaCXX/conversion-function.cpp | 30 +- test/SemaCXX/decltype-this.cpp | 3 +- test/SemaCXX/default-constructor-initializers.cpp | 16 +- test/SemaCXX/dependent-types.cpp | 2 +- test/SemaCXX/format-attribute.cpp | 8 + test/SemaCXX/friend-class-nodecl.cpp | 2 +- test/SemaCXX/linkage-spec.cpp | 9 +- test/SemaCXX/member-expr.cpp | 3 +- test/SemaCXX/member-pointer-size.cpp | 2 +- test/SemaCXX/new-delete.cpp | 57 +- test/SemaCXX/overload-call.cpp | 13 + test/SemaCXX/overloaded-builtin-operators.cpp | 13 + test/SemaCXX/overloaded-operator.cpp | 9 +- test/SemaCXX/pseudo-destructors.cpp | 2 +- test/SemaCXX/static-cast.cpp | 42 +- test/SemaCXX/using-decl-1.cpp | 21 + test/SemaCXX/using-decl-templates.cpp | 4 +- test/SemaCXX/value-initialization.cpp | 4 +- test/SemaCXX/vararg-default-arg.cpp | 10 + test/SemaCXX/vararg-non-pod.cpp | 2 +- test/SemaCXX/warn-for-var-in-else.cpp | 14 + test/SemaCXX/warn-unused-variables.cpp | 28 + test/SemaObjC/atomoic-property-synnthesis-rules.m | 369 +++++++++++ test/SemaObjC/call-super-2.m | 10 + test/SemaObjC/class-method-lookup.m | 2 +- test/SemaObjC/compare-qualified-id.m | 5 +- test/SemaObjC/continuation-class-err.m | 2 + test/SemaObjC/deref-interface.m | 2 +- test/SemaObjC/idiomatic-parentheses.m | 35 ++ test/SemaObjC/ivar-sem-check-2.m | 2 +- test/SemaObjC/method-arg-decay.m | 5 +- test/SemaObjC/objc-string-constant.m | 2 +- test/SemaObjC/property-category-1.m | 1 + test/SemaObjC/property-nonfragile-abi.m | 2 +- test/SemaObjC/sizeof-interface.m | 2 +- test/SemaObjC/static-ivar-ref-1.m | 2 +- test/SemaObjC/string.m | 2 +- test/SemaObjC/synthesized-ivar.m | 2 +- test/SemaObjC/unused.m | 5 +- test/SemaObjC/warn-selector-selection.m | 2 +- test/SemaTemplate/class-template-decl.cpp | 8 +- test/SemaTemplate/class-template-spec.cpp | 7 +- test/SemaTemplate/constructor-template.cpp | 32 +- test/SemaTemplate/deduction.cpp | 83 +++ test/SemaTemplate/default-arguments.cpp | 81 ++- test/SemaTemplate/default-expr-arguments.cpp | 40 +- test/SemaTemplate/enum-argument.cpp | 16 + test/SemaTemplate/example-dynarray.cpp | 2 +- test/SemaTemplate/instantiate-attr.cpp | 7 + test/SemaTemplate/instantiate-decl-init.cpp | 22 + test/SemaTemplate/instantiate-member-pointers.cpp | 30 +- test/SemaTemplate/instantiate-member-template.cpp | 13 + test/SemaTemplate/instantiate-overloaded-arrow.cpp | 20 + .../instantiate-template-template-parm.cpp | 27 +- test/SemaTemplate/instantiate-using-decl.cpp | 3 + test/SemaTemplate/instantiation-default-2.cpp | 2 +- test/SemaTemplate/member-function-template.cpp | 24 + test/SemaTemplate/nested-name-spec-template.cpp | 17 +- test/SemaTemplate/nested-template.cpp | 18 + test/SemaTemplate/operator-template.cpp | 2 +- test/SemaTemplate/temp_arg_nontype.cpp | 3 +- test/SemaTemplate/temp_arg_template.cpp | 7 +- .../value-dependent-null-pointer-constant.cpp | 2 +- test/lit.cfg | 8 +- test/lit.site.cfg.in | 9 + 627 files changed, 6999 insertions(+), 2802 deletions(-) create mode 100644 test/Analysis/malloc.c create mode 100644 test/Analysis/plist-output.m create mode 100644 test/Analysis/sizeofpointer.c create mode 100644 test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp create mode 100644 test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp create mode 100644 test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp create mode 100644 test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp create mode 100644 test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp create mode 100644 test/CXX/expr/expr.unary/expr.delete/p5.cpp create mode 100644 test/CXX/special/class.free/p1.cpp create mode 100644 test/CXX/special/class.free/p6.cpp create mode 100644 test/CodeCompletion/objc-message.m create mode 100644 test/CodeGenCXX/array-operator-delete-call.cpp create mode 100644 test/CodeGenCXX/array-value-initialize.cpp create mode 100644 test/CodeGenCXX/assign-operator.cpp create mode 100644 test/CodeGenCXX/debug-info.cpp create mode 100644 test/CodeGenCXX/default-arguments.cpp create mode 100644 test/CodeGenCXX/default-constructor-default-argument.cpp create mode 100644 test/CodeGenCXX/delete-two-arg.cpp create mode 100644 test/CodeGenCXX/dyncast.cpp create mode 100644 test/CodeGenCXX/empty-union.cpp create mode 100644 test/CodeGenCXX/global-array-destruction.cpp create mode 100644 test/CodeGenCXX/init-incomplete-type.cpp create mode 100644 test/CodeGenCXX/instantiate-init-list.cpp create mode 100644 test/CodeGenCXX/mangle-system-header.cpp create mode 100644 test/CodeGenCXX/member-expressions.cpp create mode 100644 test/CodeGenCXX/member-init-struct.cpp create mode 100644 test/CodeGenCXX/member-init-union.cpp create mode 100644 test/CodeGenCXX/new-operator-phi.cpp create mode 100644 test/CodeGenCXX/rtti.cpp create mode 100644 test/CodeGenCXX/static-init-1.cpp create mode 100644 test/CodeGenCXX/static-init-2.cpp create mode 100644 test/CodeGenCXX/typeinfo create mode 100644 test/CodeGenCXX/vararg-conversion-ctor.cpp create mode 100644 test/CodeGenCXX/virt-dtor-gen.cpp create mode 100644 test/CodeGenCXX/virtual-operator-call.cpp create mode 100644 test/CodeGenCXX/virtual-pseudo-destructor-call.cpp create mode 100644 test/CodeGenObjC/hidden-visibility.m create mode 100644 test/CodeGenObjC/missing-atend-metadata.m create mode 100644 test/CodeGenObjC/objc2-weak-import-attribute.m create mode 100644 test/CodeGenObjC/super-message-fragileabi.m create mode 100644 test/Index/Inputs/c-index-pch.h create mode 100644 test/Index/Inputs/foo.h create mode 100644 test/Index/Inputs/lit.local.cfg create mode 100644 test/Index/Inputs/objc.h create mode 100644 test/Index/Inputs/t1.c create mode 100644 test/Index/Inputs/t1.m create mode 100644 test/Index/Inputs/t2.c create mode 100644 test/Index/Inputs/t2.m create mode 100644 test/Index/TestClassDecl.m create mode 100644 test/Index/TestClassForwardDecl.m create mode 100644 test/Index/c-index-api-loadTU-test.m create mode 100644 test/Index/c-index-getCursor-test.m create mode 100644 test/Index/code-completion.cpp create mode 100644 test/Index/complete-member-access.m create mode 100644 test/Index/complete-objc-message.m create mode 100644 test/Index/complete-protocols.m create mode 100644 test/Sema/conversion-64-32.c create mode 100644 test/Sema/conversion.c create mode 100644 test/Sema/pointer-conversion.c create mode 100644 test/SemaCXX/builtins.cpp create mode 100644 test/SemaCXX/format-attribute.cpp create mode 100644 test/SemaCXX/vararg-default-arg.cpp create mode 100644 test/SemaObjC/atomoic-property-synnthesis-rules.m create mode 100644 test/SemaObjC/idiomatic-parentheses.m create mode 100644 test/SemaTemplate/deduction.cpp create mode 100644 test/SemaTemplate/instantiate-attr.cpp create mode 100644 test/SemaTemplate/instantiate-decl-init.cpp create mode 100644 test/SemaTemplate/instantiate-overloaded-arrow.cpp (limited to 'test') diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index 557e7e8f915c..b23998cfc68f 100644 --- a/test/Analysis/CFDateGC.m +++ b/test/Analysis/CFDateGC.m @@ -1,8 +1,8 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from diff --git a/test/Analysis/CFNumber.c b/test/Analysis/CFNumber.c index f62d2ab569d4..f3d371cbde46 100644 --- a/test/Analysis/CFNumber.c +++ b/test/Analysis/CFNumber.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s typedef signed long CFIndex; typedef const struct __CFAllocator * CFAllocatorRef; diff --git a/test/Analysis/CFRetainRelease_NSAssertionHandler.m b/test/Analysis/CFRetainRelease_NSAssertionHandler.m index 1ff950725c02..04e9add58b5a 100644 --- a/test/Analysis/CFRetainRelease_NSAssertionHandler.m +++ b/test/Analysis/CFRetainRelease_NSAssertionHandler.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic && -// RUN: clang-cc -analyze -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic && -// RUN: clang-cc -analyze -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=region && -// RUN: clang-cc -analyze -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=region +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=region +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=region typedef struct objc_selector *SEL; typedef signed char BOOL; diff --git a/test/Analysis/CGColorSpace.c b/test/Analysis/CGColorSpace.c index 2887d47c5118..ae628989cd61 100644 --- a/test/Analysis/CGColorSpace.c +++ b/test/Analysis/CGColorSpace.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s typedef struct CGColorSpace *CGColorSpaceRef; extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void); diff --git a/test/Analysis/CheckNSError.m b/test/Analysis/CheckNSError.m index 5f92594f30d8..219354b20fdf 100644 --- a/test/Analysis/CheckNSError.m +++ b/test/Analysis/CheckNSError.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s typedef signed char BOOL; diff --git a/test/Analysis/MissingDealloc.m b/test/Analysis/MissingDealloc.m index 41498e56ec1d..3942391ee982 100644 --- a/test/Analysis/MissingDealloc.m +++ b/test/Analysis/MissingDealloc.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s --verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s --verify typedef signed char BOOL; @protocol NSObject - (BOOL)isEqual:(id)object; diff --git a/test/Analysis/NSPanel.m b/test/Analysis/NSPanel.m index 801620a181bf..20e3efff4c60 100644 --- a/test/Analysis/NSPanel.m +++ b/test/Analysis/NSPanel.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s // BEGIN delta-debugging reduced header stuff diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m index a360075645f8..481a94055ffd 100644 --- a/test/Analysis/NSString.m +++ b/test/Analysis/NSString.m @@ -1,13 +1,13 @@ -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s && -// RUN: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s // ==-- FIXME: -analyzer-store=basic fails on this file (false negatives). --== -// NOTWORK: clang-cc -triple i386-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// NOTWORK: clang-cc -triple i386-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// NOTWORK: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// NOTWORK: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// NOTWORK: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && +// NOTWORK: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && +// NOTWORK: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && +// NOTWORK: clang-cc -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from @@ -371,5 +371,4 @@ void test_synchronized(id x) { NSString *string = [[NSString stringWithFormat:@"%ld", (long) 100] retain]; // expected-warning {{leak}} } } - - +@end diff --git a/test/Analysis/NSWindow.m b/test/Analysis/NSWindow.m index 9609c5260f53..5eb6cf1e4770 100644 --- a/test/Analysis/NSWindow.m +++ b/test/Analysis/NSWindow.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -warn-dead-stores -analyzer-store=region -analyzer-constraints=range -verify %s // These declarations were reduced using Delta-Debugging from Foundation.h // on Mac OS X. The test cases are below. diff --git a/test/Analysis/NoReturn.m b/test/Analysis/NoReturn.m index 5f5ce281a794..cf708b4f8970 100644 --- a/test/Analysis/NoReturn.m +++ b/test/Analysis/NoReturn.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s #include diff --git a/test/Analysis/ObjCProperties.m b/test/Analysis/ObjCProperties.m index 3ad256914a42..6c367f427d46 100644 --- a/test/Analysis/ObjCProperties.m +++ b/test/Analysis/ObjCProperties.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range %s -verify // The point of this test cases is to exercise properties in the static // analyzer diff --git a/test/Analysis/ObjCRetSigs.m b/test/Analysis/ObjCRetSigs.m index 0d699168a551..60a85fd791ed 100644 --- a/test/Analysis/ObjCRetSigs.m +++ b/test/Analysis/ObjCRetSigs.m @@ -1,6 +1,6 @@ -// RUN: clang-cc -analyze -warn-objc-methodsigs -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-objc-methodsigs -verify %s -#include +int printf(const char *, ...); @interface MyBase -(long long)length; diff --git a/test/Analysis/PR2599.m b/test/Analysis/PR2599.m index 098bfe8e8539..fd5ae95d5842 100644 --- a/test/Analysis/PR2599.m +++ b/test/Analysis/PR2599.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s && -// RUN: clang-cc -analyze -analyzer-constraints=range -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s && -// RUN: clang-cc -analyze -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s && -// RUN: clang-cc -analyze -analyzer-constraints=range -analyzer-store=region -checker-cfref -fobjc-gc -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=basic -analyzer-store=basic -checker-cfref -fobjc-gc -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -analyzer-constraints=range -analyzer-store=region -checker-cfref -fobjc-gc -verify %s typedef const void * CFTypeRef; typedef const struct __CFString * CFStringRef; diff --git a/test/Analysis/PR2978.m b/test/Analysis/PR2978.m index 0cb3dea8ea86..8a94fe848993 100644 --- a/test/Analysis/PR2978.m +++ b/test/Analysis/PR2978.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-objc-missing-dealloc %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-objc-missing-dealloc %s -verify // Tests for the checker which checks missing/extra ivar 'release' calls // in dealloc. diff --git a/test/Analysis/PR3991.m b/test/Analysis/PR3991.m index bbc1377b0415..53a6b5257a77 100644 --- a/test/Analysis/PR3991.m +++ b/test/Analysis/PR3991.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s //===----------------------------------------------------------------------===// // Delta-debugging produced forward declarations. @@ -42,7 +42,15 @@ typedef struct _NSZone NSZone; - (unsigned int)currentPathComponentIndex; - (void)setCurrentPathComponentIndex:(unsigned int)aCurrentPathComponentIndex; - (NSURL *)folderFeedURL; -@end @implementation IHGoogleDocsAdapter - (id)initWithUsername:(NSString *)inUsername password:(NSString *)inPassword owner:(NSObject *)owner { +@end + +@implementation IHGoogleDocsAdapter - (id)initWithUsername:(NSString *)inUsername password:(NSString *)inPassword owner:(NSObject *)owner { // expected-warning {{incomplete implementation}} \ +// expected-warning {{method definition for 'entries' not found}} \ +// expected-warning {{method definition for 'feedDocList' not found}} \ +// expected-warning {{method definition for 'directoryPathComponents' not found}} \ +// expected-warning {{method definition for 'currentPathComponentIndex' not found}} \ +// expected-warning {{method definition for 'setCurrentPathComponentIndex:' not found}} \ +// expected-warning {{method definition for 'folderFeedURL' not found}} return 0; } @@ -66,3 +74,4 @@ typedef struct _NSZone NSZone; } } } +@end diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c index d6b6076a14b2..c3822cdb443a 100644 --- a/test/Analysis/array-struct.c +++ b/test/Analysis/array-struct.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s struct s { int data; @@ -120,7 +120,7 @@ struct s1 { // building: a->e, e->d. Only then 'a' could be added to live region roots. void f13(double timeout) { struct s1 a; - a.e.d = (long) timeout; + a.e.d = (int) timeout; if (a.e.d == 10) a.e.d = 4; } @@ -153,7 +153,7 @@ struct s3 p[1]; // an ElementRegion of type 'char'. Then load a nonloc::SymbolVal from it and // assigns to 'a'. void f16(struct s3 *p) { - struct s3 a = *((struct s3*) ((char*) &p[0])); + struct s3 a = *((struct s3*) ((char*) &p[0])); // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.}} } void inv(struct s1 *); diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c index ae51ffb69aa5..fc9e27bfe755 100644 --- a/test/Analysis/casts.c +++ b/test/Analysis/casts.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref -analyzer-store=region --verify %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region --verify %s // Test if the 'storage' region gets properly initialized after it is cast to // 'struct sockaddr *'. diff --git a/test/Analysis/casts.m b/test/Analysis/casts.m index 82c29fac904f..4e201bf7eb4c 100644 --- a/test/Analysis/casts.m +++ b/test/Analysis/casts.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic --verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region --verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic --verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region --verify %s // Test function pointer casts. Currently we track function addresses using // loc::FunctionVal. Because casts can be arbitrary, do we need to model diff --git a/test/Analysis/cfref_PR2519.c b/test/Analysis/cfref_PR2519.c index 695123b53345..ee1da1fff972 100644 --- a/test/Analysis/cfref_PR2519.c +++ b/test/Analysis/cfref_PR2519.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=range -verify %s typedef unsigned char Boolean; typedef signed long CFIndex; diff --git a/test/Analysis/cfref_rdar6080742.c b/test/Analysis/cfref_rdar6080742.c index 9bbaf9b5ae06..a2b7477db8bc 100644 --- a/test/Analysis/cfref_rdar6080742.c +++ b/test/Analysis/cfref_rdar6080742.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s // This test case was reported in . // It tests path-sensitivity with respect to '!(cfstring != 0)' (negation of inequality). diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c index 3633b2148413..6b71a93e65a9 100644 --- a/test/Analysis/complex.c +++ b/test/Analysis/complex.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s #include diff --git a/test/Analysis/concrete-address.c b/test/Analysis/concrete-address.c index 84ebb21805a2..31802d038019 100644 --- a/test/Analysis/concrete-address.c +++ b/test/Analysis/concrete-address.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic --verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region --verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic --verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region --verify %s void foo() { int *p = (int*) 0x10000; // Should not crash here. diff --git a/test/Analysis/conditional-op-missing-lhs.c b/test/Analysis/conditional-op-missing-lhs.c index bebf155f4640..ed81d7b67200 100644 --- a/test/Analysis/conditional-op-missing-lhs.c +++ b/test/Analysis/conditional-op-missing-lhs.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-dead-stores -warn-uninit-values -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -warn-uninit-values -verify %s void f1() { diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index c4ff7fa0e860..811ac813c7e2 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -1,8 +1,8 @@ -// RUN: clang-cc -analyze -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s void f1() { int k, y; diff --git a/test/Analysis/dead-stores.cpp b/test/Analysis/dead-stores.cpp index 9ddb7979ca69..0bf32567f9db 100644 --- a/test/Analysis/dead-stores.cpp +++ b/test/Analysis/dead-stores.cpp @@ -1,8 +1,8 @@ -// RUN: clang-cc -analyze -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -verify %s int j; void f1() { diff --git a/test/Analysis/dead-stores.m b/test/Analysis/dead-stores.m index 218cb4458580..0a5c0f837301 100644 --- a/test/Analysis/dead-stores.m +++ b/test/Analysis/dead-stores.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s typedef signed char BOOL; typedef unsigned int NSUInteger; diff --git a/test/Analysis/delegates.m b/test/Analysis/delegates.m index 440f31113cff..b854da6ec330 100644 --- a/test/Analysis/delegates.m +++ b/test/Analysis/delegates.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c index 2bdaad423a39..b6873ad89980 100644 --- a/test/Analysis/elementtype.c +++ b/test/Analysis/elementtype.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s typedef struct added_obj_st { int type; diff --git a/test/Analysis/exercise-ps.c b/test/Analysis/exercise-ps.c index 1e31b1888e1f..098ec48f4ea3 100644 --- a/test/Analysis/exercise-ps.c +++ b/test/Analysis/exercise-ps.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s // // Just exercise the analyzer on code that has at one point caused issues // (i.e., no assertions or crashes). diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c index 900a6d6869ac..d6bc84575ef4 100644 --- a/test/Analysis/fields.c +++ b/test/Analysis/fields.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=basic -verify && -// RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=region -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s --analyzer-store=basic -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s --analyzer-store=region -verify unsigned foo(); typedef struct bf { unsigned x:2; } bf; diff --git a/test/Analysis/func.c b/test/Analysis/func.c index 2b4e7b0db076..390a2793a497 100644 --- a/test/Analysis/func.c +++ b/test/Analysis/func.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s void f(void) { void (*p)(void); diff --git a/test/Analysis/malloc.c b/test/Analysis/malloc.c new file mode 100644 index 000000000000..6a17cba3497b --- /dev/null +++ b/test/Analysis/malloc.c @@ -0,0 +1,37 @@ +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-experimental-checks -analyzer-store=region -verify %s +typedef __typeof(sizeof(int)) size_t; +void *malloc(size_t); +void free(void *); + +void f1() { + int *p = malloc(10); + return; // expected-warning{{Allocated memory never released. Potential memory leak.}} +} + +void f1_b() { + int *p = malloc(10); // expected-warning{{Allocated memory never released. Potential memory leak.}} +} + +void f2() { + int *p = malloc(10); + free(p); + free(p); // expected-warning{{Try to free a memory block that has been released}} +} + +// This case tests that storing malloc'ed memory to a static variable which is +// then returned is not leaked. In the absence of known contracts for functions +// or inter-procedural analysis, this is a conservative answer. +int *f3() { + static int *p = 0; + p = malloc(10); + return p; // no-warning +} + +// This case tests that storing malloc'ed memory to a static global variable +// which is then returned is not leaked. In the absence of known contracts for +// functions or inter-procedural analysis, this is a conservative answer. +static int *p_f4 = 0; +int *f4() { + p_f4 = malloc(10); + return p_f4; // no-warning +} diff --git a/test/Analysis/misc-ps-64.m b/test/Analysis/misc-ps-64.m index 163da4b4abeb..506dc8b0e530 100644 --- a/test/Analysis/misc-ps-64.m +++ b/test/Analysis/misc-ps-64.m @@ -1,7 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=basic -analyzer-constraints=basic --verify -fblocks %s && -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=basic -analyzer-constraints=range --verify -fblocks %s && -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=basic --verify -fblocks %s && -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -analyzer-constraints=basic --verify -fblocks %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -analyzer-constraints=range --verify -fblocks %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=basic --verify -fblocks %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s // - A bunch of misc. failures involving evaluating // these expressions and building CFGs. These tests are here to prevent diff --git a/test/Analysis/misc-ps-basic-store.m b/test/Analysis/misc-ps-basic-store.m index c6ae20c86a36..2b9913461718 100644 --- a/test/Analysis/misc-ps-basic-store.m +++ b/test/Analysis/misc-ps-basic-store.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=basic --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic --verify -fblocks %s //--------------------------------------------------------------------------- // Test case 'checkaccess_union' differs for region store and basic store. diff --git a/test/Analysis/misc-ps-eager-assume.m b/test/Analysis/misc-ps-eager-assume.m index db1a80b8efd9..66eb1256f42a 100644 --- a/test/Analysis/misc-ps-eager-assume.m +++ b/test/Analysis/misc-ps-eager-assume.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s -analyzer-eagerly-assume +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s -analyzer-eagerly-assume // Delta-reduced header stuff (needed for test cases). typedef signed char BOOL; diff --git a/test/Analysis/misc-ps-ranges.m b/test/Analysis/misc-ps-ranges.m index a191bec3cfb1..49cc5933ccad 100644 --- a/test/Analysis/misc-ps-ranges.m +++ b/test/Analysis/misc-ps-ranges.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=basic -analyzer-constraints=range --verify -fblocks %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -analyzer-constraints=range --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s // // main's 'argc' argument is always > 0 @@ -20,4 +20,4 @@ int main(int argc, char* argv[]) { } return *p; // no-warning -} \ No newline at end of file +} diff --git a/test/Analysis/misc-ps-region-store-i386.m b/test/Analysis/misc-ps-region-store-i386.m index c2c4d5b9413c..a833a653a425 100644 --- a/test/Analysis/misc-ps-region-store-i386.m +++ b/test/Analysis/misc-ps-region-store-i386.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s +// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region --verify -fblocks %s // Here is a case where a pointer is treated as integer, invalidated as an // integer, and then used again as a pointer. This test just makes sure diff --git a/test/Analysis/misc-ps-region-store-x86_64.m b/test/Analysis/misc-ps-region-store-x86_64.m index 154ffaf3a003..7e614fd24833 100644 --- a/test/Analysis/misc-ps-region-store-x86_64.m +++ b/test/Analysis/misc-ps-region-store-x86_64.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region --verify -fblocks %s // Here is a case where a pointer is treated as integer, invalidated as an // integer, and then used again as a pointer. This test just makes sure diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 4cde7726b49b..7ebc4a9fe5e5 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s && -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s +// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region --verify -fblocks %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region --verify -fblocks %s typedef struct objc_selector *SEL; typedef signed char BOOL; @@ -286,7 +286,7 @@ struct WrappedStruct { unsigned z; }; int test_handle_array_wrapper() { struct ArrayWrapper x; test_handle_array_wrapper(&x); - struct WrappedStruct *p = (struct WrappedStruct*) x.y; + struct WrappedStruct *p = (struct WrappedStruct*) x.y; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.}} return p->z; // no-warning } @@ -431,3 +431,42 @@ pr5316_REFRESH_ELEMENT; static void pr5316(pr5316_REFRESH_ELEMENT *dst, const pr5316_REFRESH_ELEMENT *src) { while ((*dst++ = *src++).chr != L'\0') ; } + +//===----------------------------------------------------------------------===// +// Exercise creating ElementRegion with symbolic super region. +//===----------------------------------------------------------------------===// +void element_region_with_symbolic_superregion(int* p) { + int *x; + int a; + if (p[0] == 1) + x = &a; + if (p[0] == 1) + (void)*x; // no-warning +} + +//===----------------------------------------------------------------------===// +// Test returning an out-of-bounds pointer (CWE-466) +//===----------------------------------------------------------------------===// + +static int test_cwe466_return_outofbounds_pointer_a[10]; +int *test_cwe466_return_outofbounds_pointer() { + int *p = test_cwe466_return_outofbounds_pointer_a+10; + return p; // expected-warning{{Returned pointer value points outside the original object}} +} + +//===----------------------------------------------------------------------===// +// PR 3135 - Test case that shows that a variable may get invalidated when its +// address is included in a structure that is passed-by-value to an unknown function. +//===----------------------------------------------------------------------===// + +typedef struct { int *a; } pr3135_structure; +int pr3135_bar(pr3135_structure *x); +int pr3135() { + int x; + pr3135_structure y = { &x }; + // the call to pr3135_bar may initialize x + if (pr3135_bar(&y) && x) // no-warning + return 1; + return 0; +} + diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index 80e20c1ebb00..d2eef0d7fdbd 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -1,8 +1,8 @@ // NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued. -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=basic -fobjc-gc -analyzer-constraints=basic --verify -fblocks %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=basic -analyzer-constraints=range --verify -fblocks %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=basic --verify -fblocks %s && -// RUN: clang-cc -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -fobjc-gc -analyzer-constraints=basic --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=basic -analyzer-constraints=range --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=basic --verify -fblocks %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s typedef struct objc_ivar *Ivar; typedef struct objc_selector *SEL; @@ -692,7 +692,6 @@ void *rdar7152418_bar(); // conversions of the symbol as necessary. //===----------------------------------------------------------------------===// - // Previously this would crash once we started eagerly evaluating symbols whose // values were constrained to a single value. void test_symbol_fold_1(signed char x) { @@ -722,5 +721,32 @@ unsigned test_symbol_fold_3(void) { if (x == 54) return (x << 8) | 0x5; return 0; -} +} + +//===----------------------------------------------------------------------===// +// Tests for the warning of casting a non-struct type to a struct type +//===----------------------------------------------------------------------===// + +typedef struct {unsigned int v;} NSSwappedFloat; +NSSwappedFloat test_cast_nonstruct_to_struct(float x) { + struct hodor { + float number; + NSSwappedFloat sf; + }; + return ((struct hodor *)&x)->sf; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}} +} + +NSSwappedFloat test_cast_nonstruct_to_union(float x) { + union bran { + float number; + NSSwappedFloat sf; + }; + return ((union bran *)&x)->sf; // no-warning +} + +void test_undefined_array_subscript() { + int i, a[10]; + int *p = &a[i]; // expected-warning{{Array subscript is undefined}} +} +@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 87faab6bfbac..536c4a1b6731 100644 --- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m +++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify && -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify +// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify +// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify @interface MyClass {} - (void *)voidPtrM; diff --git a/test/Analysis/no-exit-cfg.c b/test/Analysis/no-exit-cfg.c index cad2127b2082..af8db135926f 100644 --- a/test/Analysis/no-exit-cfg.c +++ b/test/Analysis/no-exit-cfg.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s // This is a test case for the issue reported in PR 2819: // http://llvm.org/bugs/show_bug.cgi?id=2819 diff --git a/test/Analysis/no-outofbounds.c b/test/Analysis/no-outofbounds.c index 94052806f0aa..475a2116a7c8 100644 --- a/test/Analysis/no-outofbounds.c +++ b/test/Analysis/no-outofbounds.c @@ -1,5 +1,6 @@ -// RUN: clang-cc -checker-cfref -analyze -analyzer-store=basic -verify %s && -// RUN: clang-cc -checker-cfref -analyze -analyzer-store=region -verify %s +// RUN: clang-cc -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=basic -verify %s +// RUN: clang-cc -checker-cfref -analyze -analyzer-experimental-internal-checks -analyzer-store=region -verify %s +// XFAIL: * //===----------------------------------------------------------------------===// // This file tests cases where we should not flag out-of-bounds warnings. diff --git a/test/Analysis/null-deref-ps-region.c b/test/Analysis/null-deref-ps-region.c index 80a5f9212fac..ab1151382573 100644 --- a/test/Analysis/null-deref-ps-region.c +++ b/test/Analysis/null-deref-ps-region.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -std=gnu99 -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -verify %s // The store for 'a[1]' should not be removed mistakenly. SymbolicRegions may diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c index f37b4416f2a1..4604db542980 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic && -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic && -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-purge-dead=false -verify %s && -// RUN: clang-cc -triple i386-apple-darwin10 -analyze -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-purge-dead=false -verify %s +// RUN: clang-cc -triple i386-apple-darwin10 -analyze -analyzer-experimental-internal-checks -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s typedef unsigned uintptr_t; diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c index e676ea3b3889..d1a07abf527f 100644 --- a/test/Analysis/outofbound.c +++ b/test/Analysis/outofbound.c @@ -1,8 +1,7 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s -// XFAIL: * +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s char f1() { char* s = "abcd"; char c = s[4]; // no-warning - return s[5] + c; // expected-warning{{Load or store into an out-of-bound memory position.}} + return s[5] + c; // expected-warning{{Access out-of-bound array element (buffer overflow)}} } diff --git a/test/Analysis/override-werror.c b/test/Analysis/override-werror.c index f928ee031fe3..e8ce7bdc66dd 100644 --- a/test/Analysis/override-werror.c +++ b/test/Analysis/override-werror.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -Werror %s -analyzer-store=basic -verify && -// RUN: clang-cc -analyze -checker-cfref -Werror %s -analyzer-store=region -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=basic -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -Werror %s -analyzer-store=region -verify // This test case illustrates that using '-analyze' overrides the effect of // -Werror. This allows basic warnings not to interfere with producing diff --git a/test/Analysis/plist-output.m b/test/Analysis/plist-output.m new file mode 100644 index 000000000000..8bd616ade0e8 --- /dev/null +++ b/test/Analysis/plist-output.m @@ -0,0 +1,122 @@ +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref --analyzer-store=region -analyzer-constraints=range -fblocks --analyzer-output=plist -o - %s | FileCheck %s + +void test_null_init(void) { + int *p = 0; + *p = 0xDEADBEEF; +} +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: files +// CHECK: +// CHECK: +// CHECK: diagnostics +// CHECK: +// CHECK: +// CHECK: path +// CHECK: +// CHECK: +// CHECK: kindevent +// CHECK: location +// CHECK: +// CHECK: line4 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: ranges +// CHECK: +// CHECK: +// CHECK: +// CHECK: line4 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line4 +// CHECK: col8 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: extended_message +// CHECK: Variable 'p' initialized to a null pointer value +// CHECK: message +// CHECK: Variable 'p' initialized to a null pointer value +// CHECK: +// CHECK: +// CHECK: kindcontrol +// CHECK: edges +// CHECK: +// CHECK: +// CHECK: start +// CHECK: +// CHECK: +// CHECK: line4 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line4 +// CHECK: col8 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: end +// CHECK: +// CHECK: +// CHECK: line5 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line5 +// CHECK: col4 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: kindevent +// CHECK: location +// CHECK: +// CHECK: line5 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: ranges +// CHECK: +// CHECK: +// CHECK: +// CHECK: line5 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: line5 +// CHECK: col4 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: extended_message +// CHECK: Dereference of null pointer +// CHECK: message +// CHECK: Dereference of null pointer +// CHECK: +// CHECK: +// CHECK: descriptionDereference of null pointer +// CHECK: categoryLogic error +// CHECK: typeNull pointer dereference +// CHECK: location +// CHECK: +// CHECK: line5 +// CHECK: col3 +// CHECK: file0 +// CHECK: +// CHECK: +// CHECK: +// CHECK: +// CHECK: diff --git a/test/Analysis/pr4209.m b/test/Analysis/pr4209.m index 991d0d68f704..60161b1b08a8 100644 --- a/test/Analysis/pr4209.m +++ b/test/Analysis/pr4209.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -triple i386-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s // This test case was crashing due to how CFRefCount.cpp resolved the // ObjCInterfaceDecl* and ClassName in EvalObjCMessageExpr. @@ -49,17 +49,20 @@ CMProfileLocation; GSEbayCategory *rootCategory; } - (NSMutableDictionary*)categoryDictionaryForCategoryID:(int)inID inRootTreeCategories:(NSMutableArray*)inRootTreeCategories; --(NSString*) categoryID; +-(NSString*) categoryID; @end @interface GSEbayCategory : NSObject { } - (int) categoryID; - (GSEbayCategory *) parent; - (GSEbayCategory*) subcategoryWithID:(int) inID; -@end @implementation GBCategoryChooserPanelController + (int) chooseCategoryIDFromCategories:(NSArray*) inCategories searchRequest:(GBSearchRequest*)inRequest parentWindow:(NSWindow*) inParent { +@end @implementation GBCategoryChooserPanelController + (int) chooseCategoryIDFromCategories:(NSArray*) inCategories searchRequest:(GBSearchRequest*)inRequest parentWindow:(NSWindow*) inParent { // expected-warning {{incomplete implementation}} \ +// expected-warning {{method definition for 'categoryDictionaryForCategoryID:inRootTreeCategories:' not found}} \ +// expected-warning {{method definition for 'categoryID' not found}} return 0; } - (void) addCategory:(EBayCategoryType*)inCategory toRootTreeCategory:(NSMutableArray*)inRootTreeCategories { - GSEbayCategory *category = [rootCategory subcategoryWithID:[[inCategory categoryID] intValue]]; + GSEbayCategory *category = [rootCategory subcategoryWithID:[[inCategory categoryID] intValue]]; + if (rootCategory != category) { GSEbayCategory *parent = category; while ((((void*)0) != (parent = [parent parent])) && ([parent categoryID] != 0)) { @@ -69,3 +72,4 @@ CMProfileLocation; } } } +@end diff --git a/test/Analysis/pr_2542_rdar_6793404.m b/test/Analysis/pr_2542_rdar_6793404.m index 82a028d652d1..ebb69028a709 100644 --- a/test/Analysis/pr_2542_rdar_6793404.m +++ b/test/Analysis/pr_2542_rdar_6793404.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -pedantic -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -pedantic -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -pedantic -analyzer-store=region -verify %s // BEGIN delta-debugging reduced header stuff diff --git a/test/Analysis/pr_4164.c b/test/Analysis/pr_4164.c index cc2479c3e49c..176871773959 100644 --- a/test/Analysis/pr_4164.c +++ b/test/Analysis/pr_4164.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s // PR 4164: http://llvm.org/bugs/show_bug.cgi?id=4164 // diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c index 4f2c7d9edb0b..b585c85d67fe 100644 --- a/test/Analysis/ptr-arith.c +++ b/test/Analysis/ptr-arith.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s void f1() { int a[10]; @@ -31,3 +31,32 @@ domain_port (const char *domain_b, const char *domain_e, port = 10 * port + (*p - '0'); return port; } + +void f3() { + int x, y; + int d = &y - &x; // expected-warning{{Subtraction of two pointers that do not point to the same memory chunk may cause incorrect result.}} + + int a[10]; + int *p = &a[2]; + int *q = &a[8]; + d = q-p; // no-warning +} + +void f4() { + int *p; + p = (int*) 0x10000; // expected-warning{{Using a fixed address is not portable because that address will probably not be valid in all environments or platforms.}} +} + +void f5() { + int x, y; + int *p; + p = &x + 1; // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous.}} + + int a[10]; + p = a + 1; // no-warning +} + +// Allow arithmetic on different symbolic regions. +void f6(int *p, int *q) { + int d = q - p; // no-warning +} diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m index bfda115360e4..7b0a1a685bdf 100644 --- a/test/Analysis/rdar-6442306-1.m +++ b/test/Analysis/rdar-6442306-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=basic -verify && -// RUN: clang-cc -analyze -checker-cfref %s --analyzer-store=region -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s --analyzer-store=basic -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref %s --analyzer-store=region -verify typedef int bar_return_t; typedef struct { diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m index cfe522074ed3..4d191d2f1e35 100644 --- a/test/Analysis/rdar-6540084.m +++ b/test/Analysis/rdar-6540084.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -warn-dead-stores -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -warn-dead-stores -verify %s // // This test exercises the live variables analysis (LiveVariables.cpp). // The case originally identified a non-termination bug. diff --git a/test/Analysis/rdar-6541136-region.c b/test/Analysis/rdar-6541136-region.c index e2779e8d914f..5190a032df8a 100644 --- a/test/Analysis/rdar-6541136-region.c +++ b/test/Analysis/rdar-6541136-region.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=region %s +// RUN: clang-cc -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region %s struct tea_cheese { unsigned magic; }; typedef struct tea_cheese kernel_tea_cheese_t; @@ -6,17 +6,22 @@ extern kernel_tea_cheese_t _wonky_gesticulate_cheese; // This test case exercises the ElementRegion::getRValueType() logic. - -void foo( void ) -{ +void test1( void ) { kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese; struct load_wine *cmd = (void*) &wonky[1]; cmd = cmd; char *p = (void*) &wonky[1]; - *p = 1; // no-warning kernel_tea_cheese_t *q = &wonky[1]; // This test case tests both the RegionStore logic (doesn't crash) and // the out-of-bounds checking. We don't expect the warning for now since // out-of-bound checking is temporarily disabled. - kernel_tea_cheese_t r = *q; // eventually-warning{{out-of-bound memory position}} + kernel_tea_cheese_t r = *q; // expected-warning{{Access out-of-bound array element (buffer overflow)}} +} + +void test1_b( void ) { + kernel_tea_cheese_t *wonky = &_wonky_gesticulate_cheese; + struct load_wine *cmd = (void*) &wonky[1]; + cmd = cmd; + char *p = (void*) &wonky[1]; + *p = 1; // expected-warning{{Access out-of-bound array element (buffer overflow)}} } diff --git a/test/Analysis/rdar-6541136.c b/test/Analysis/rdar-6541136.c index 6e6a479136b9..d5fc2e0ff1bd 100644 --- a/test/Analysis/rdar-6541136.c +++ b/test/Analysis/rdar-6541136.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -verify -analyze -checker-cfref -analyzer-store=basic %s +// RUN: clang-cc -verify -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic %s struct tea_cheese { unsigned magic; }; typedef struct tea_cheese kernel_tea_cheese_t; diff --git a/test/Analysis/rdar-6562655.m b/test/Analysis/rdar-6562655.m index 3c1c281a830d..0b837c6fa6e7 100644 --- a/test/Analysis/rdar-6562655.m +++ b/test/Analysis/rdar-6562655.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region -verify %s // // This test case mainly checks that the retain/release checker doesn't crash // on this file. diff --git a/test/Analysis/rdar-6582778-basic-store.c b/test/Analysis/rdar-6582778-basic-store.c index 9ec38ef7a5f0..a4850c133201 100644 --- a/test/Analysis/rdar-6582778-basic-store.c +++ b/test/Analysis/rdar-6582778-basic-store.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s typedef const void * CFTypeRef; typedef double CFTimeInterval; diff --git a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m index 49ef7c381545..7230f21c08c3 100644 --- a/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m +++ b/test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify && -// RUN: clang-cc -analyze -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=basic %s -verify +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-constraints=basic -analyzer-store=region %s -verify typedef struct Foo { int x; } Bar; diff --git a/test/Analysis/rdar-7168531.m b/test/Analysis/rdar-7168531.m index bdbd22d24e2c..6c34125d056c 100644 --- a/test/Analysis/rdar-7168531.m +++ b/test/Analysis/rdar-7168531.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -triple i386-apple-darwin10 -analyzer-store=region && -// RUN: clang-cc -analyze -checker-cfref -triple i386-apple-darwin10 -analyzer-store=basic +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=region +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -triple i386-apple-darwin10 -analyzer-store=basic // Note that the target triple is important for this test case. It specifies that we use the // fragile Objective-C ABI. diff --git a/test/Analysis/refcnt_naming.m b/test/Analysis/refcnt_naming.m index 2ce00b2a8cca..a4c290442a57 100644 --- a/test/Analysis/refcnt_naming.m +++ b/test/Analysis/refcnt_naming.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s typedef const struct __CFString * CFStringRef; typedef const struct __CFAllocator * CFAllocatorRef; diff --git a/test/Analysis/region-1.m b/test/Analysis/region-1.m index 68a375b7126c..6a8ae49bba4b 100644 --- a/test/Analysis/region-1.m +++ b/test/Analysis/region-1.m @@ -1,5 +1,5 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify %s +// RUN: clang-cc -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -verify %s // // This test case simply should not crash. It evaluates the logic of not // using MemRegion::getRValueType in incorrect places. @@ -89,3 +89,4 @@ Dos_CharacterRangeType = 0, Dos_LineRangeType = 1 } symbol = [HancodeFett symbolFromClass:(JabaSCClass *) selectedClassifier]; } } +@end diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m index e27cfe758aaf..3eeebc4a8f0a 100644 --- a/test/Analysis/retain-release-gc-only.m +++ b/test/Analysis/retain-release-gc-only.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc-only %s && +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify -fobjc-gc-only %s // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -fobjc-gc-only -verify %s //===----------------------------------------------------------------------===// @@ -372,4 +372,4 @@ CFDateRef returnsRetainedCFDate() { - (NSDate*) returnsNSRetained { return (NSDate*) returnsRetainedCFDate(); // expected-warning{{leak}} } -@end \ No newline at end of file +@end diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 879e8a0413b4..dfea2e7738d0 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -verify %s && +// RUN: clang-cc -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=basic -verify %s // RUN: clang-cc -triple x86_64-apple-darwin10 -analyze -checker-cfref -analyzer-store=region -verify %s #if __has_feature(attribute_ns_returns_retained) diff --git a/test/Analysis/security-syntax-checks.m b/test/Analysis/security-syntax-checks.m index ebd7d172b5b4..bcdc65ebd459 100644 --- a/test/Analysis/security-syntax-checks.m +++ b/test/Analysis/security-syntax-checks.m @@ -30,6 +30,13 @@ void test_gets() { gets(buff); // expected-warning{{Call to function 'gets' is extremely insecure as it can always result in a buffer overflow}} } +int getpw(unsigned int uid, char *buf); + +void test_getpw() { + char buff[1024]; + getpw(2, buff); // expected-warning{{The getpw() function is dangerous as it may overflow the provided buffer. It is obsoleted by getpwuid().}} +} + // CWE-273: Failure to Check Whether Privileges Were // Dropped Successfully typedef unsigned int __uint32_t; diff --git a/test/Analysis/sizeofpointer.c b/test/Analysis/sizeofpointer.c new file mode 100644 index 000000000000..e40c71857242 --- /dev/null +++ b/test/Analysis/sizeofpointer.c @@ -0,0 +1,8 @@ +// RUN: clang-cc -analyze -warn-sizeof-pointer -verify %s + +struct s { +}; + +int f(struct s *p) { + return sizeof(p); // expected-warning{{The code calls sizeof() on a pointer type. This can produce an unexpected result.}} +} diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c index 0d7a70373c9a..f26e2f0c6352 100644 --- a/test/Analysis/stack-addr-ps.c +++ b/test/Analysis/stack-addr-ps.c @@ -1,8 +1,6 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s -#include - int* f1() { int x = 0; return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}} diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m index 5ec878ea3c37..c2b73668dd95 100644 --- a/test/Analysis/uninit-msg-expr.m +++ b/test/Analysis/uninit-msg-expr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s //===----------------------------------------------------------------------===// diff --git a/test/Analysis/uninit-ps-rdar6145427.m b/test/Analysis/uninit-ps-rdar6145427.m index 49eb26984a0b..d9e73188003f 100644 --- a/test/Analysis/uninit-ps-rdar6145427.m +++ b/test/Analysis/uninit-ps-rdar6145427.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -verify -analyzer-store=basic -checker-cfref %s && +// RUN: clang-cc -analyze -verify -analyzer-store=basic -checker-cfref %s // RUN: clang-cc -analyze -verify -analyzer-store=region -checker-cfref %s // Delta-Debugging reduced preamble. diff --git a/test/Analysis/uninit-vals-ps.c b/test/Analysis/uninit-vals-ps.c index 759c7edbcc57..c8632a50300a 100644 --- a/test/Analysis/uninit-vals-ps.c +++ b/test/Analysis/uninit-vals-ps.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s struct FPRec { diff --git a/test/Analysis/uninit-vals.m b/test/Analysis/uninit-vals.m index 7be247e7ca9e..6d1561eeb511 100644 --- a/test/Analysis/uninit-vals.m +++ b/test/Analysis/uninit-vals.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s typedef unsigned int NSUInteger; diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m index 9e9360da50c6..754799b2dbd8 100644 --- a/test/Analysis/unused-ivars.m +++ b/test/Analysis/unused-ivars.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -analyze -warn-objc-unused-ivars %s -verify +// RUN: clang-cc -fblocks -analyze -warn-objc-unused-ivars %s -verify //===--- BEGIN: Delta-debugging reduced headers. --------------------------===// diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8b3c738ed78b..cd822f623a79 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,11 +22,19 @@ set(CLANG_TEST_DIRECTORIES "SemaObjCXX" "SemaTemplate") +set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}") +set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}") +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}/..") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) + include(FindPythonInterp) if(PYTHONINTERP_FOUND) - get_target_triple(TARGET_TRIPLE) - get_target_property(LLVM_TOOLS_PATH clang RUNTIME_OUTPUT_DIRECTORY) - get_target_property(LLVM_LIBS_PATH clang LIBRARY_OUTPUT_DIRECTORY) set(CLANG_TEST_EXTRA_ARGS) if (MSVC OR XCODE) set(CLANG_TEST_EXTRA_ARGS "--no-progress-bar") @@ -34,18 +42,10 @@ if(PYTHONINTERP_FOUND) foreach(testdir ${CLANG_TEST_DIRECTORIES}) add_custom_target(clang-test-${testdir} - COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#" - -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#" - -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#" - -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#" - -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#" - -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" - -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#" - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg COMMAND ${PYTHON_EXECUTABLE} ${LLVM_SOURCE_DIR}/utils/lit/lit.py --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + --param build_config=${CMAKE_CFG_INTDIR} -sv ${CLANG_TEST_EXTRA_ARGS} ${CMAKE_CURRENT_BINARY_DIR}/${testdir} DEPENDS clang clang-cc index-test c-index-test @@ -53,36 +53,20 @@ if(PYTHONINTERP_FOUND) endforeach() add_custom_target(clang-test - COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#" - -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#" - -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#" - -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#" - -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#" - -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" - -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#" - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg COMMAND ${PYTHON_EXECUTABLE} ${LLVM_SOURCE_DIR}/utils/lit/lit.py --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + --param build_config=${CMAKE_CFG_INTDIR} -sv ${CLANG_TEST_EXTRA_ARGS} ${CMAKE_CURRENT_BINARY_DIR} DEPENDS clang clang-cc index-test c-index-test COMMENT "Running Clang regression tests") add_custom_target(clang-c++tests - COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#" - -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#" - -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#" - -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#" - -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#" - -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" - -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#" - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg COMMAND ${PYTHON_EXECUTABLE} ${LLVM_SOURCE_DIR}/utils/lit/lit.py --param clang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg + --param build_config=${CMAKE_CFG_INTDIR} -sv ${CLANG_TEST_EXTRA_ARGS} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests DEPENDS clang clang-cc index-test c-index-test diff --git a/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp b/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp new file mode 100644 index 000000000000..04aef1e39e40 --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.udir/p1.cpp @@ -0,0 +1,35 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// When looking up a namespace-name in a using-directive or +// namespace-alias-definition, only namespace names are considered. + +struct ns1 {}; +void ns2(); +int ns3 = 0; + +namespace ns0 { + namespace ns1 { + struct test0 {}; + } + namespace ns2 { + struct test1 {}; + } + namespace ns3 { + struct test2 {}; + } +} + +using namespace ns0; + +namespace test3 = ns1; +namespace test4 = ns2; +namespace test5 = ns3; + +using namespace ns1; +using namespace ns2; +using namespace ns3; + +test0 a; +test1 b; +test2 c; + diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp new file mode 100644 index 000000000000..dd30d6ad4f98 --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.unnamed/p1.cpp @@ -0,0 +1,24 @@ +// RUN: clang-cc -emit-llvm-only -verify %s + +// This lame little test was ripped straight from the standard. + +namespace { + int i; // expected-note {{candidate}} +} +void test0() { i++; } + +namespace A { + namespace { + int i; // expected-note {{candidate}} + int j; + } + void test1() { i++; } +} + +using namespace A; + +void test2() { + i++; // expected-error {{reference to 'i' is ambiguous}} + A::i++; + j++; +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp new file mode 100644 index 000000000000..35e8c08a112f --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp @@ -0,0 +1,67 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// We have to avoid ADL for this test. + +template class test {}; + +class foo {}; +test<0> foo(foo); // expected-note {{candidate}} + +namespace Test0 { + class foo { int x; }; + test<1> foo(class foo); + + namespace A { + test<2> foo(class ::foo); // expected-note {{candidate}} + + void test0() { + using ::foo; + + class foo a; + test<0> _ = (foo)(a); + } + + void test1() { + using Test0::foo; + + class foo a; + test<1> _ = (foo)(a); + }; + + void test2() { + class ::foo a; + + // Argument-dependent lookup is ambiguous between B:: and ::. + test<0> _0 = foo(a); // expected-error {{call to 'foo' is ambiguous}} + + // But basic unqualified lookup is not. + test<2> _1 = (foo)(a); + + class Test0::foo b; + test<2> _2 = (foo)(b); // expected-error {{incompatible type passing}} + } + } +} + +namespace Test1 { + namespace A { + class a {}; + } + + namespace B { + typedef class {} b; + } + + namespace C { + int c(); // expected-note {{target of using declaration}} + } + + namespace D { + using typename A::a; + using typename B::b; + using typename C::c; // expected-error {{'typename' keyword used on a non-type}} + + a _1 = A::a(); + b _2 = B::b(); + } +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp new file mode 100644 index 000000000000..fbd205833cad --- /dev/null +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udir/p1.cpp @@ -0,0 +1,141 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// (this actually occurs before paragraph 1) +namespace test0 { + namespace A {} + class B { + using namespace A; // expected-error {{'using namespace' is not allowed in classes}} + }; +} + + +struct opaque0 {}; +struct opaque1 {}; + +// Test that names appear as if in deepest common ancestor. +namespace test1 { + namespace A { + namespace B { + opaque0 foo(); // expected-note {{candidate}} + } + } + + namespace C { + opaque1 foo(); // expected-note {{candidate}} + + opaque1 test() { + using namespace A::B; + return foo(); // C::foo + } + } + + opaque1 test() { + using namespace A::B; + using namespace C; + return foo(); // expected-error {{call to 'foo' is ambiguous}} + } +} + +// Same thing, but with the directives in namespaces. +namespace test2 { + namespace A { + namespace B { + opaque0 foo(); // expected-note {{candidate}} + } + } + + namespace C { + opaque1 foo(); // expected-note {{candidate}} + + namespace test { + using namespace A::B; + + opaque1 test() { + return foo(); // C::foo + } + } + } + + namespace test { + using namespace A::B; + using namespace C; + + opaque1 test() { + return foo(); // expected-error {{call to 'foo' is ambiguous}} + } + } +} + +// Transitivity. +namespace test3 { + namespace A { + namespace B { + opaque0 foo(); + } + } + namespace C { + using namespace A; + } + + opaque0 test0() { + using namespace C; + using namespace B; + return foo(); + } + + namespace D { + using namespace C; + } + namespace A { + opaque1 foo(); + } + + opaque1 test1() { + using namespace D; + return foo(); + } +} + +// Transitivity acts like synthetic using directives. +namespace test4 { + namespace A { + namespace B { + opaque0 foo(); // expected-note {{candidate}} + } + } + + namespace C { + using namespace A::B; + } + + opaque1 foo(); // expected-note {{candidate}} + + namespace A { + namespace D { + using namespace C; + } + + opaque0 test() { + using namespace D; + return foo(); + } + } + + opaque0 test() { + using namespace A::D; + return foo(); // expected-error {{call to 'foo' is ambiguous}} + } +} + +// Bug: using directives should be followed when parsing default +// arguments in scoped declarations. +class test5 { + int inc(int x); +}; +namespace Test5 { + int default_x = 0; +} +using namespace Test5; +int test5::inc(int x = default_x) { + return x+1; +} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp new file mode 100644 index 000000000000..a3c147db5ee2 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1.cpp @@ -0,0 +1,44 @@ +// RUN: clang-cc -fsyntax-only -pedantic -verify %s + +// Simple form +int ar1[10]; + +// Element type cannot be: +// - (cv) void +volatile void ar2[10]; // expected-error {{incomplete element type 'void volatile'}} +// - a reference +int& ar3[10]; // expected-error {{array of references}} +// - a function type +typedef void Fn(); +Fn ar4[10]; // expected-error {{array of functions}} +// - an abstract class +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 ar7[0u]; // expected-warning {{zero size arrays are an extension}} + +// An array with unknown bound is incomplete. +int ar8[]; // expected-error {{needs an explicit size or an initializer}} +// So is an array with an incomplete element type. +struct Incomplete; // expected-note {{forward declaration}} +Incomplete ar9[10]; // expected-error {{incomplete type}} +// Neither of which should be a problem in situations where no complete type +// is required. (PR5048) +void fun(int p1[], Incomplete p2[10]); +extern int ear1[]; +extern Incomplete ear2[10]; + +// cv migrates to element type +typedef const int cint; +extern cint car1[10]; +typedef int intar[10]; +// thus this is a valid redeclaration +extern const intar car1; + +// Check that instantiation works properly when the element type is a template. +template struct S { + typename T::type x; // expected-error {{has no members}} +}; +S ar10[10]; // expected-note {{requested here}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp index bbfaf909392a..4b1582840c39 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp @@ -52,4 +52,4 @@ namespace N1 { { f2(6); // okay } -} \ No newline at end of file +} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp index 6f71978c4e46..01fa6ac35548 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p3.cpp @@ -1,3 +1,3 @@ // RUN: clang-cc -fsyntax-only -verify %s void f(int) { } // expected-note {{previous definition is here}} -void f(const int) { } // expected-error {{redefinition of 'f'}} \ No newline at end of file +void f(const int) { } // expected-error {{redefinition of 'f'}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp index 101d75fc0f48..5f9a5345cf1c 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.mptr/p3.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %t +// RUN: clang-cc -fsyntax-only -verify %s class A { public: int& i; @@ -20,7 +20,7 @@ void f() { a.*&A::s = 10; // expected-error{{right hand operand to .* has non pointer-to-member type 'int *'}} a.*&A::i = 10; // expected-error{{cannot form a pointer-to-member to member 'i' of reference type 'int &'}} - ft(a); // expected-note{{in instantiation of function template specialization 'ft' requested here}} + ft(a); // expected-note{{in instantiation of function template specialization 'ft' requested here}} void A::*p = 0; // expected-error{{'p' declared as a member pointer to void}} } diff --git a/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/test/CXX/expr/expr.unary/expr.delete/p5.cpp new file mode 100644 index 000000000000..91e77bcb8bf7 --- /dev/null +++ b/test/CXX/expr/expr.unary/expr.delete/p5.cpp @@ -0,0 +1,34 @@ +// RUN: clang-cc -verify %s + +// If the object being deleted has incomplete class type at the point of +// deletion and the complete class has a non-trivial destructor or a +// deallocation function, the behavior is undefined. + +// The trivial case. +class T0; // expected-note {{forward declaration}} +void f0(T0 *a) { delete a; } // expected-warning {{deleting pointer to incomplete type}} +class T0 { ~T0(); }; + +// The trivial case, inside a template instantiation. +template +class T1_A { T *x; ~T1_A() { delete x; } }; // expected-warning {{deleting pointer to incomplete type}} +class T1_B; // expected-note {{forward declaration}} +void f0() { T1_A x; } // expected-note {{in instantiation of member function}} + +// This case depends on when we check T2_C::f0. +class T2_A; +template +struct T2_B { void f0(T *a) { delete a; } }; +struct T2_C { T2_B x; void f0(T2_A *a) { x.f0(a); } }; +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 +struct T3_B { void f0(T *a) { delete a; } }; +struct T3_C { T3_B x; void f0(T3_A *a) { x.f0(a); } }; +void f0(T3_A *a) { T3_C x; x.f0(a); } +class T3_A { private: ~T3_A(); }; diff --git a/test/CXX/special/class.free/p1.cpp b/test/CXX/special/class.free/p1.cpp new file mode 100644 index 000000000000..bf99a2782bd5 --- /dev/null +++ b/test/CXX/special/class.free/p1.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -fsyntax-only -verify %s +#include + +struct A { + void *operator new(size_t) { + return this; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} + } + void *operator new[](size_t) { + return this; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} + } +}; diff --git a/test/CXX/special/class.free/p6.cpp b/test/CXX/special/class.free/p6.cpp new file mode 100644 index 000000000000..8334817ca2b5 --- /dev/null +++ b/test/CXX/special/class.free/p6.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -fsyntax-only -verify %s +#include + +struct A { + void operator delete(size_t) { + (void)this; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} + } + void operator delete[](void*) { + (void)this; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} + } +}; diff --git a/test/CXX/temp/temp.param/p1.cpp b/test/CXX/temp/temp.param/p1.cpp index a6638b4f60f2..676bffe31dc5 100644 --- a/test/CXX/temp/temp.param/p1.cpp +++ b/test/CXX/temp/temp.param/p1.cpp @@ -1,4 +1,4 @@ // Suppress 'no run line' failure. -// RUN: true +// RUN: echo ok // Paragraph 1 is descriptive, and therefore requires no tests. diff --git a/test/CXX/temp/temp.param/p12.cpp b/test/CXX/temp/temp.param/p12.cpp index 5511224ebe94..3864fbeaa11e 100644 --- a/test/CXX/temp/temp.param/p12.cpp +++ b/test/CXX/temp/temp.param/p12.cpp @@ -34,4 +34,6 @@ template class // expected-note{{previous template template parameter is here}} = Y1> // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} - class C1; + class C1 {}; + +C1<> c1; // expected-note{{while checking a default template argument}} diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp index 33fb93bacfaf..de05a926338c 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp @@ -10,4 +10,4 @@ namespace N { template<> class X { /* ... */ }; // OK: X is a template -} \ No newline at end of file +} diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp index 8d91068f9b99..ad0d50621367 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp @@ -12,7 +12,7 @@ struct X { // expected-note{{here}} void g() { } - struct Inner { + struct Inner { // expected-error{{implicit default}} T value; // expected-note {{member is declared here}} }; @@ -26,8 +26,7 @@ IntHolder &test_X_IntHolderInt(X xih) { xih.g(); // okay xih.f(); // expected-note{{instantiation}} - // FIXME: diagnostic here has incorrect reason (PR5154) - X::Inner inner; // expected-error{{implicit default}} + X::Inner inner; // expected-note {{first required here}} return X::value; // expected-note{{instantiation}} } diff --git a/test/CodeCompletion/call.cpp b/test/CodeCompletion/call.cpp index 90bf82bff307..8c7bf83e2a3a 100644 --- a/test/CodeCompletion/call.cpp +++ b/test/CodeCompletion/call.cpp @@ -17,12 +17,11 @@ void f(); void test() { f(Y(), 0, 0); - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: f(struct N::Y y, <#int ZZ#>) // CHECK-CC1-NEXT: f(int i, <#int j#>, int k) // CHECK-CC1-NEXT: f(float x, <#float y#>) - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:13 %s -o - | FileCheck -check-prefix=CC2 %s // CHECK-CC2-NOT: f(struct N::Y y, int ZZ) // CHECK-CC2: f(int i, int j, <#int k#>) - // RUN: true } diff --git a/test/CodeCompletion/enum-switch-case-qualified.cpp b/test/CodeCompletion/enum-switch-case-qualified.cpp index 223aca8b9323..3e8d75d940d7 100644 --- a/test/CodeCompletion/enum-switch-case-qualified.cpp +++ b/test/CodeCompletion/enum-switch-case-qualified.cpp @@ -21,8 +21,7 @@ namespace M { void test(enum N::C::Color color) { switch (color) { case - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s && - // RUN: true + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: Blue : 0 : N::C::Blue // CHECK-CC1-NEXT: Green : 0 : N::C::Green // CHECK-CC1-NEXT: Indigo : 0 : N::C::Indigo diff --git a/test/CodeCompletion/enum-switch-case.c b/test/CodeCompletion/enum-switch-case.c index d8bb5e8ca474..b7a3676170bf 100644 --- a/test/CodeCompletion/enum-switch-case.c +++ b/test/CodeCompletion/enum-switch-case.c @@ -19,11 +19,10 @@ void test(enum Color color) { case Green: break; - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: Blue : 0 // CHECK-CC1-NEXT: Green : 0 // CHECK-CC1-NEXT: Indigo : 0 // CHECK-CC1-NEXT: Orange : 0 // CHECK-CC1-NEXT: Violet : 0 - // RUN: true diff --git a/test/CodeCompletion/enum-switch-case.cpp b/test/CodeCompletion/enum-switch-case.cpp index 7a388fce0e39..3a010a83dee5 100644 --- a/test/CodeCompletion/enum-switch-case.cpp +++ b/test/CodeCompletion/enum-switch-case.cpp @@ -19,11 +19,10 @@ void test(enum N::Color color) { break; case - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: Blue : 0 : N::Blue // CHECK-CC1-NEXT: Green : 0 : N::Green // CHECK-CC1-NEXT: Indigo : 0 : N::Indigo // CHECK-CC1-NEXT: Orange : 0 : N::Orange // CHECK-CC1-NEXT: Violet : 0 : N::Violet - // RUN: true diff --git a/test/CodeCompletion/function-templates.cpp b/test/CodeCompletion/function-templates.cpp index 52cba71bd2f9..d291bbe12bad 100644 --- a/test/CodeCompletion/function-templates.cpp +++ b/test/CodeCompletion/function-templates.cpp @@ -8,8 +8,7 @@ namespace std { void f() { std:: - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: dyn_cast<<#class X#>>(<#Y *Val#>) // CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>) - // RUN: true diff --git a/test/CodeCompletion/functions.cpp b/test/CodeCompletion/functions.cpp index 2e1bc6edf8c4..85292e4d3076 100644 --- a/test/CodeCompletion/functions.cpp +++ b/test/CodeCompletion/functions.cpp @@ -3,7 +3,6 @@ void f(float x, float y...); void test() { :: - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: f(<#int i#>{#, <#int j#>{#, <#int k#>#}#}) // CHECK-CC1: f(<#float x#>, <#float y#><#, ...#>) - // RUN: true diff --git a/test/CodeCompletion/macros.c b/test/CodeCompletion/macros.c index d5c1f8f17fce..20d26f2f773a 100644 --- a/test/CodeCompletion/macros.c +++ b/test/CodeCompletion/macros.c @@ -13,9 +13,9 @@ struct Point { }; void test(struct Point *p) { - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-macros -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s switch (p->IDENTITY(color)) { - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s && + // RUN: clang-cc -fsyntax-only -code-completion-macros -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s case } // CC1: color @@ -33,5 +33,4 @@ void test(struct Point *p) { // CC2: FOO // CC2: IDENTITY(<#X#>) // CC2: WIBBLE - // RUN: true } diff --git a/test/CodeCompletion/member-access.c b/test/CodeCompletion/member-access.c index 1e8e5630981f..c9ac58f295d4 100644 --- a/test/CodeCompletion/member-access.c +++ b/test/CodeCompletion/member-access.c @@ -6,8 +6,7 @@ struct Point { void test(struct Point *p) { p-> - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:8:6 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: x // CHECK-CC1: y // CHECK-CC1: z - // RUN: true diff --git a/test/CodeCompletion/member-access.cpp b/test/CodeCompletion/member-access.cpp index b810366209f5..e445b4503aa3 100644 --- a/test/CodeCompletion/member-access.cpp +++ b/test/CodeCompletion/member-access.cpp @@ -27,7 +27,7 @@ public: void test(const Proxy &p) { p-> - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: member1 : 0 : [#Base1::#]member1 // CHECK-CC1: member1 : 0 : [#Base2::#]member1 // CHECK-CC1: member2 : 0 : [#Base1::#]member2 @@ -39,5 +39,4 @@ void test(const Proxy &p) { // CHECK-CC1: memfun3 : 0 : memfun3(<#int#>) // CHECK-CC1: Base1 : 0 : Base1:: // CHECK-CC1: memfun1 : 0 (Hidden) : Base2::memfun1(<#int#>) - // RUN: true diff --git a/test/CodeCompletion/namespace-alias.cpp b/test/CodeCompletion/namespace-alias.cpp index 0fa2ec20209c..c1f34178c3ec 100644 --- a/test/CodeCompletion/namespace-alias.cpp +++ b/test/CodeCompletion/namespace-alias.cpp @@ -11,11 +11,10 @@ namespace N2 { namespace I1 { } namespace New = - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: I1 : 1 // CHECK-CC1: I4 : 1 // CHECK-CC1: I5 : 1 // CHECK-CC1: N2 : 3 // CHECK-CC1-NEXT: N4 : 3 - // RUN: true diff --git a/test/CodeCompletion/namespace.cpp b/test/CodeCompletion/namespace.cpp index d4ed639f8a05..ff90b85b5a57 100644 --- a/test/CodeCompletion/namespace.cpp +++ b/test/CodeCompletion/namespace.cpp @@ -8,8 +8,7 @@ namespace N2 { namespace I1 { } namespace - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: I1 : 0 // CHECK-CC1-NEXT: I5 : 0 - // RUN: true diff --git a/test/CodeCompletion/nested-name-specifier.cpp b/test/CodeCompletion/nested-name-specifier.cpp index 0cc5a19421c7..8da7c37d95e9 100644 --- a/test/CodeCompletion/nested-name-specifier.cpp +++ b/test/CodeCompletion/nested-name-specifier.cpp @@ -10,9 +10,8 @@ namespace N { } N:: -// RUN: clang-cc -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CC1 %s && +// RUN: clang-cc -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: A : 0 // CHECK-CC1: B : 0 // CHECK-CC1: M : 0 -// RUN: true diff --git a/test/CodeCompletion/objc-message.m b/test/CodeCompletion/objc-message.m new file mode 100644 index 000000000000..d16a745b71f5 --- /dev/null +++ b/test/CodeCompletion/objc-message.m @@ -0,0 +1,35 @@ +// Note: the run lines follow their respective tests, since line/column +// matter in this test. + +@protocol FooTestProtocol ++ protocolClassMethod; +- protocolInstanceMethod; +@end +@interface Foo { + void *isa; +} ++ (int)classMethod1:a withKeyword:b; ++ (void)classMethod2; ++ new; +- instanceMethod1; +@end + +@interface Foo (FooTestCategory) ++ categoryClassMethod; +- categoryInstanceMethod; +@end + +void func() { + Foo *obj = [Foo new]; + [obj xx]; +} +// RUN: clang-cc -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: categoryClassMethod : 0 +// CHECK-CC1: classMethod1:withKeyword: : 0 +// CHECK-CC1: classMethod2 : 0 +// CHECK-CC1: new : 0 +// CHECK-CC1: protocolClassMethod : 0 +// RUN: clang-cc -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: categoryInstanceMethod : 0 +// CHECK-CC2: instanceMethod1 : 0 +// CHECK-CC2: protocolInstanceMethod : 0 diff --git a/test/CodeCompletion/operator.cpp b/test/CodeCompletion/operator.cpp index a3950f6b8913..20ba5ba3fbc8 100644 --- a/test/CodeCompletion/operator.cpp +++ b/test/CodeCompletion/operator.cpp @@ -8,11 +8,10 @@ void f() { typedef float Float; operator - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: Float : 0 // CHECK-CC1: + : 0 // CHECK-CC1: short : 0 // CHECK-CC1: Integer : 2 // CHECK-CC1: T : 2 // CHECK-CC1: N : 6 - // RUN: true diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c index 586e2b371bd7..680d6dc989c7 100644 --- a/test/CodeCompletion/ordinary-name.c +++ b/test/CodeCompletion/ordinary-name.c @@ -4,9 +4,8 @@ typedef struct t TYPEDEF; void foo() { int y; - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: y : 0 // CHECK-CC1: foo : 2 // CHECK-NOT-CC1: y : 2 // CHECK-CC1-NEXT: TYPEDEF : 2 - // RUN: true diff --git a/test/CodeCompletion/property.m b/test/CodeCompletion/property.m index 7f2321ee1395..184519b408fa 100644 --- a/test/CodeCompletion/property.m +++ b/test/CodeCompletion/property.m @@ -6,7 +6,7 @@ } @property(copy) Foo *myprop; @property(retain, nonatomic) id xx; -// RUN: clang-cc -fsyntax-only -code-completion-at=%s:7:11 %s -o - | FileCheck -check-prefix=CC1 %s && +// RUN: clang-cc -fsyntax-only -code-completion-at=%s:7:11 %s -o - | FileCheck -check-prefix=CC1 %s // CC1: assign // CC1-NEXT: copy // CC1-NEXT: getter diff --git a/test/CodeCompletion/tag.c b/test/CodeCompletion/tag.c index e7250f540c4f..6d9c1eabd561 100644 --- a/test/CodeCompletion/tag.c +++ b/test/CodeCompletion/tag.c @@ -7,7 +7,6 @@ void X(); void test() { enum X { x }; enum - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:9:7 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:9:7 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: X : 0 // CHECK-CC1: Y : 2 - // RUN: true diff --git a/test/CodeCompletion/tag.cpp b/test/CodeCompletion/tag.cpp index b00ff1fabdaa..17c9707db1a3 100644 --- a/test/CodeCompletion/tag.cpp +++ b/test/CodeCompletion/tag.cpp @@ -15,7 +15,7 @@ namespace N { void test() { class - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:17:10 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:17:10 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: Y : 2 // CHECK-CC1: Z : 2 // CHECK-CC1: A : 4 @@ -23,4 +23,3 @@ namespace N { // CHECK-CC1: Y : 4 // CHECK-CC1: M : 9 : M:: // CHECK-CC1: N : 9 : N:: - // RUN: true diff --git a/test/CodeCompletion/templates.cpp b/test/CodeCompletion/templates.cpp index 22cca65bea98..d35e0bb8dcde 100644 --- a/test/CodeCompletion/templates.cpp +++ b/test/CodeCompletion/templates.cpp @@ -8,10 +8,9 @@ namespace std { void f() { std:: - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: allocator<<#typename T#>> // CHECK-CC1: vector<<#typename T#>{#, <#typename Alloc#>#}> - // RUN: true diff --git a/test/CodeCompletion/truncation.c b/test/CodeCompletion/truncation.c index b72aa7facf79..5af3c4b6d6c9 100644 --- a/test/CodeCompletion/truncation.c +++ b/test/CodeCompletion/truncation.c @@ -2,11 +2,10 @@ struct -// RUN: clang-cc -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s && +// RUN: clang-cc -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s // CHECK-CC1: X : 1 // CHECK-CC1-NEXT: Y : 1 -// RUN: clang-cc -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s && +// RUN: clang-cc -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s // CHECK-CC2: X : 1 // CHECK-CC2: Xa : 1 // CHECK-CC2: Y : 1 -// RUN: true diff --git a/test/CodeCompletion/using-namespace.cpp b/test/CodeCompletion/using-namespace.cpp index a332b880074e..57383d5db427 100644 --- a/test/CodeCompletion/using-namespace.cpp +++ b/test/CodeCompletion/using-namespace.cpp @@ -12,10 +12,9 @@ namespace N2 { void foo() { using namespace - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:14:20 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:14:20 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: I1 : 2 // CHECK-CC1: I4 : 2 // CHECK-CC1: I5 : 2 // CHECK-CC1: N2 : 4 // CHECK-CC1-NEXT: N4 : 4 - // RUN: true diff --git a/test/CodeCompletion/using.cpp b/test/CodeCompletion/using.cpp index 57b3aa7880a2..305afda2e6dd 100644 --- a/test/CodeCompletion/using.cpp +++ b/test/CodeCompletion/using.cpp @@ -14,12 +14,11 @@ namespace N2 { int N3; using - // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:10 %s -o - | FileCheck -check-prefix=CC1 %s && + // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:10 %s -o - | FileCheck -check-prefix=CC1 %s // CHECK-CC1: I1 : 2 // CHECK-CC1: I4 : 2 // CHECK-CC1: I5 : 2 // CHECK-CC1: N2 : 4 // CHECK-CC1: N3 : 4 // CHECK-CC1-NEXT: N4 : 4 - // RUN: true 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 51ba2b45d063..fbff54149bcc 100644 --- a/test/CodeGen/2008-07-17-no-emit-on-error.c +++ b/test/CodeGen/2008-07-17-no-emit-on-error.c @@ -1,5 +1,5 @@ -// RUN: rm -f %t1.bc && -// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc && +// RUN: rm -f %t1.bc +// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc // RUN: not test -f %t1.bc void f() { diff --git a/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c b/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c index 348ea75ea295..db3c4b25d375 100644 --- a/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c +++ b/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c @@ -9,4 +9,4 @@ struct et7 { }; // CHECK: @yv7 = global -// CHECK: i8 52, \ No newline at end of file +// CHECK: i8 52, diff --git a/test/CodeGen/2008-07-29-override-alias-decl.c b/test/CodeGen/2008-07-29-override-alias-decl.c index 872950029618..18e8982832e0 100644 --- a/test/CodeGen/2008-07-29-override-alias-decl.c +++ b/test/CodeGen/2008-07-29-override-alias-decl.c @@ -2,10 +2,10 @@ int x() { return 1; } -// CHECK: %retval = alloca i32 -// CHECK: store i32 1, i32* %retval -// CHECK: %0 = load i32* %retval -// CHECK: ret i32 %0 +// CHECK: [[retval:%.*]] = alloca i32 +// CHECK: store i32 1, i32* [[retval]] +// CHECK: [[load:%.*]] = load i32* [[retval]] +// CHECK: ret i32 [[load]] int f() __attribute__((weak, alias("x"))); @@ -17,9 +17,9 @@ int h() { return f(); } -// CHECK: %retval = alloca i32 -// CHECK: %call = call i32 (...)* @f() -// CHECK: store i32 %call, i32* %retval -// CHECK: %0 = load i32* %retval -// CHECK: ret i32 %0 +// CHECK: [[retval:%.*]] = alloca i32 +// CHECK: [[call:%.*]] = call i32 (...)* @f() +// CHECK: store i32 [[call]], i32* [[retval]] +// CHECK: [[load:%.*]] = load i32* [[retval]] +// CHECK: ret i32 [[load]] diff --git a/test/CodeGen/2008-07-30-implicit-initialization.c b/test/CodeGen/2008-07-30-implicit-initialization.c index 2f4c14eb728b..9cd530045bca 100644 --- a/test/CodeGen/2008-07-30-implicit-initialization.c +++ b/test/CodeGen/2008-07-30-implicit-initialization.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t && -// RUN: grep "ret i32" %t | count 2 && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t +// RUN: grep "ret i32" %t | count 2 // RUN: grep "ret i32 0" %t | count 2 // diff --git a/test/CodeGen/2008-07-31-asm-labels.c b/test/CodeGen/2008-07-31-asm-labels.c index f114f65eded2..d2dcc04bf584 100644 --- a/test/CodeGen/2008-07-31-asm-labels.c +++ b/test/CodeGen/2008-07-31-asm-labels.c @@ -1,10 +1,10 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: grep "@pipe()" %t | count 0 && -// RUN: grep '_thisIsNotAPipe' %t | count 3 && -// RUN: grep 'g0' %t | count 0 && -// RUN: grep '_renamed' %t | count 2 && -// RUN: clang-cc -DUSE_DEF -emit-llvm -o %t %s && -// RUN: grep "@pipe()" %t | count 0 && +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: grep "@pipe()" %t | count 0 +// RUN: grep '_thisIsNotAPipe' %t | count 3 +// RUN: grep 'g0' %t | count 0 +// RUN: grep '_renamed' %t | count 2 +// RUN: clang-cc -DUSE_DEF -emit-llvm -o %t %s +// RUN: grep "@pipe()" %t | count 0 // RUN: grep '_thisIsNotAPipe' %t | count 3 // diff --git a/test/CodeGen/2009-10-20-GlobalDebug.c b/test/CodeGen/2009-10-20-GlobalDebug.c index eea3fb5307b4..fddc76c14da8 100644 --- a/test/CodeGen/2009-10-20-GlobalDebug.c +++ b/test/CodeGen/2009-10-20-GlobalDebug.c @@ -1,4 +1,4 @@ // RUN: clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s int global; -// CHECK: asciz "global" ## DW_AT_MIPS_linkage_name +// CHECK: asciz "global" ## DW_AT_name int main() { return 0;} diff --git a/test/CodeGen/PR2001-bitfield-reload.c b/test/CodeGen/PR2001-bitfield-reload.c index 797b494cf823..1fef3c56b53d 100644 --- a/test/CodeGen/PR2001-bitfield-reload.c +++ b/test/CodeGen/PR2001-bitfield-reload.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t && -// RUN: grep "ret i32" %t | count 1 && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t +// RUN: grep "ret i32" %t | count 1 // RUN: grep "ret i32 1" %t | count 1 // PR2001 diff --git a/test/CodeGen/PR3589-freestanding-libcalls.c b/test/CodeGen/PR3589-freestanding-libcalls.c index 90b5fff1620f..14608137188e 100644 --- a/test/CodeGen/PR3589-freestanding-libcalls.c +++ b/test/CodeGen/PR3589-freestanding-libcalls.c @@ -1,8 +1,8 @@ -// RUN: clang-cc -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1 && -// RUN: clang-cc -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1 && +// RUN: clang-cc -emit-llvm %s -o - | grep 'declare i32 @printf' | count 1 +// RUN: clang-cc -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 1 // RUN: clang-cc -ffreestanding -O2 -emit-llvm %s -o - | grep 'declare i32 @puts' | count 0 -#include +int printf(const char *, ...); void f0() { printf("hello\n"); diff --git a/test/CodeGen/PR3613-static-decl.c b/test/CodeGen/PR3613-static-decl.c index 208358130000..a9dc74458926 100644 --- a/test/CodeGen/PR3613-static-decl.c +++ b/test/CodeGen/PR3613-static-decl.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s && +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s // RUN: grep '@g0 = internal global %.truct.s0 { i32 3 }' %t | count 1 struct s0 { diff --git a/test/CodeGen/PR4611-bitfield-layout.c b/test/CodeGen/PR4611-bitfield-layout.c index 83ce4ffdbd6d..bc514bf4dfe2 100644 --- a/test/CodeGen/PR4611-bitfield-layout.c +++ b/test/CodeGen/PR4611-bitfield-layout.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t && +// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t // RUN: grep "struct.object_entry = type { i8, \[2 x i8\], i8 }" %t struct object_entry { diff --git a/test/CodeGen/address-space-field1.c b/test/CodeGen/address-space-field1.c index f8ec83ca71cf..b041cf55d0b0 100644 --- a/test/CodeGen/address-space-field1.c +++ b/test/CodeGen/address-space-field1.c @@ -1,23 +1,22 @@ // RUN: clang-cc -emit-llvm < %s -o - | FileCheck %s // CHECK:%struct.S = type { i32, i32 } // CHECK:define void @test_addrspace(%struct.S addrspace(1)* %p1, %struct.S addrspace(2)* %p2) nounwind -// CHECK:entry: -// CHECK: %p1.addr = alloca %struct.S addrspace(1)* ; <%struct.S addrspace(1)**> [#uses=3] -// CHECK: %p2.addr = alloca %struct.S addrspace(2)* ; <%struct.S addrspace(2)**> [#uses=3] -// CHECK: store %struct.S addrspace(1)* %p1, %struct.S addrspace(1)** %p1.addr -// CHECK: store %struct.S addrspace(2)* %p2, %struct.S addrspace(2)** %p2.addr -// CHECK: %tmp = load %struct.S addrspace(2)** %p2.addr ; <%struct.S addrspace(2)*> [#uses=1] -// CHECK: %tmp1 = getelementptr inbounds %struct.S addrspace(2)* %tmp, i32 0, i32 1 ; [#uses=1] -// CHECK: %tmp2 = load i32 addrspace(2)* %tmp1 ; [#uses=1] -// CHECK: %tmp3 = load %struct.S addrspace(1)** %p1.addr ; <%struct.S addrspace(1)*> [#uses=1] -// CHECK: %tmp4 = getelementptr inbounds %struct.S addrspace(1)* %tmp3, i32 0, i32 0 ; [#uses=1] -// CHECK: store i32 %tmp2, i32 addrspace(1)* %tmp4 -// CHECK: %tmp5 = load %struct.S addrspace(2)** %p2.addr ; <%struct.S addrspace(2)*> [#uses=1] -// CHECK: %tmp6 = getelementptr inbounds %struct.S addrspace(2)* %tmp5, i32 0, i32 0 ; [#uses=1] -// CHECK: %tmp7 = load i32 addrspace(2)* %tmp6 ; [#uses=1] -// CHECK: %tmp8 = load %struct.S addrspace(1)** %p1.addr ; <%struct.S addrspace(1)*> [#uses=1] -// CHECK: %tmp9 = getelementptr inbounds %struct.S addrspace(1)* %tmp8, i32 0, i32 1 ; [#uses=1] -// CHECK: store i32 %tmp7, i32 addrspace(1)* %tmp9 +// CHECK: [[p1addr:%.*]] = alloca %struct.S addrspace(1)* ; <%struct.S addrspace(1)**> [#uses=3] +// CHECK: [[p2addr:%.*]] = alloca %struct.S addrspace(2)* ; <%struct.S addrspace(2)**> [#uses=3] +// CHECK: store %struct.S addrspace(1)* %p1, %struct.S addrspace(1)** [[p1addr]] +// CHECK: store %struct.S addrspace(2)* %p2, %struct.S addrspace(2)** [[p2addr]] +// CHECK: [[t0:%.*]] = load %struct.S addrspace(2)** [[p2addr]] ; <%struct.S addrspace(2)*> [#uses=1] +// CHECK: [[t1:%.*]] = getelementptr inbounds %struct.S addrspace(2)* [[t0]], i32 0, i32 1 ; [#uses=1] +// CHECK: [[t2:%.*]] = load i32 addrspace(2)* [[t1]] ; [#uses=1] +// CHECK: [[t3:%.*]] = load %struct.S addrspace(1)** [[p1addr]] ; <%struct.S addrspace(1)*> [#uses=1] +// CHECK: [[t4:%.*]] = getelementptr inbounds %struct.S addrspace(1)* [[t3]], i32 0, i32 0 ; [#uses=1] +// CHECK: store i32 [[t2]], i32 addrspace(1)* [[t4]] +// CHECK: [[t5:%.*]] = load %struct.S addrspace(2)** [[p2addr]] ; <%struct.S addrspace(2)*> [#uses=1] +// CHECK: [[t6:%.*]] = getelementptr inbounds %struct.S addrspace(2)* [[t5]], i32 0, i32 0 ; [#uses=1] +// CHECK: [[t7:%.*]] = load i32 addrspace(2)* [[t6]] ; [#uses=1] +// CHECK: [[t8:%.*]] = load %struct.S addrspace(1)** [[p1addr]] ; <%struct.S addrspace(1)*> [#uses=1] +// CHECK: [[t9:%.*]] = getelementptr inbounds %struct.S addrspace(1)* [[t8]], i32 0, i32 1 ; [#uses=1] +// CHECK: store i32 [[t7]], i32 addrspace(1)* [[t9]] // CHECK: ret void // CHECK:} diff --git a/test/CodeGen/address-space.c b/test/CodeGen/address-space.c index 3b6a8e654167..8536f161533b 100644 --- a/test/CodeGen/address-space.c +++ b/test/CodeGen/address-space.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -emit-llvm < %s | grep '@foo.*global.*addrspace(1)' && -// RUN: clang-cc -emit-llvm < %s | grep '@ban.*global.*addrspace(1)' && -// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(1)' | count 2 && -// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @A' && +// RUN: clang-cc -emit-llvm < %s | grep '@foo.*global.*addrspace(1)' +// RUN: clang-cc -emit-llvm < %s | grep '@ban.*global.*addrspace(1)' +// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(1)' | count 2 +// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @A' // RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @B' int foo __attribute__((address_space(1))); diff --git a/test/CodeGen/alias.c b/test/CodeGen/alias.c index b0c71fbdfca4..f8836e6f605f 100644 --- a/test/CodeGen/alias.c +++ b/test/CodeGen/alias.c @@ -1,8 +1,8 @@ -// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s && -// RUN: grep '@g0 = common global i32 0' %t && -// RUN: grep '@f1 = alias void ()\* @f0' %t && -// RUN: grep '@g1 = alias i32\* @g0' %t && -// RUN: grep 'define void @f0() nounwind {' %t && +// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s +// RUN: grep '@g0 = common global i32 0' %t +// RUN: grep '@f1 = alias void ()\* @f0' %t +// RUN: grep '@g1 = alias i32\* @g0' %t +// RUN: grep 'define void @f0() nounwind {' %t void f0(void) { } extern void f1(void); @@ -14,7 +14,7 @@ extern int g1 __attribute((alias("g0"))); // Make sure that aliases cause referenced values to be emitted. // PR3200 -// RUN: grep 'define internal i32 @foo1()' %t && +// RUN: grep 'define internal i32 @foo1()' %t static inline int foo1() { return 0; } int foo() __attribute__((alias("foo1"))); diff --git a/test/CodeGen/alignof.c b/test/CodeGen/alignof.c index d39f4e418eb1..71c275018ed5 100644 --- a/test/CodeGen/alignof.c +++ b/test/CodeGen/alignof.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown -O1 -emit-llvm -o %t %s && +// RUN: clang-cc -triple i386-unknown-unknown -O1 -emit-llvm -o %t %s // RUN: grep 'ret i32 4' %t enum e0 { E0 }; diff --git a/test/CodeGen/always_inline.c b/test/CodeGen/always_inline.c index c12b45404d2d..d995ea11be09 100644 --- a/test/CodeGen/always_inline.c +++ b/test/CodeGen/always_inline.c @@ -1,7 +1,7 @@ -// RUN: clang -emit-llvm -S -o %t %s && -// RUN: not grep '@f0' %t && -// RUN: not grep 'call ' %t && -// RUN: clang -mllvm -disable-llvm-optzns -emit-llvm -S -o %t %s && +// RUN: clang -emit-llvm -S -o %t %s +// RUN: not grep '@f0' %t +// RUN: not grep 'call ' %t +// RUN: clang -mllvm -disable-llvm-optzns -emit-llvm -S -o %t %s // RUN: grep '@f0' %t | count 2 //static int f0() { diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c index c43ede2ca05e..3b2c433a89ff 100644 --- a/test/CodeGen/arm-arguments.c +++ b/test/CodeGen/arm-arguments.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s && +// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s // RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s // APCS-GNU: define arm_apcscc signext i8 @f0() diff --git a/test/CodeGen/asm-2.c b/test/CodeGen/asm-2.c index f5b378eb1017..72b23b150592 100644 --- a/test/CodeGen/asm-2.c +++ b/test/CodeGen/asm-2.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o %t -triple i386-pc-linux-gnu -O2 && +// RUN: clang-cc -emit-llvm %s -o %t -triple i386-pc-linux-gnu -O2 // RUN: not grep "load" %t // diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c index bd287ad0ee69..8ddd2acaf87c 100644 --- a/test/CodeGen/asm-inout.c +++ b/test/CodeGen/asm-inout.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t && +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t // RUN: grep "load i8\*\*\* %p.addr" %t | count 1 // XFAIL: * diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index 52afc9152748..41951b8ac21f 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t && +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t void t1(int len) { __asm__ volatile("" : "=&r"(len), "+&r"(len)); } @@ -28,12 +28,12 @@ void t6(void) { __asm__ volatile("" : : "i" (t6)); } -// RUN: grep "T7 NAMED: \$1" %t && +// RUN: grep "T7 NAMED: \$1" %t void t7(int a) { __asm__ volatile("T7 NAMED: %[input]" : "+r"(a): [input] "i" (4)); } -// RUN: grep "T8 NAMED MODIFIER: \${0:c}" %t && +// RUN: grep "T8 NAMED MODIFIER: \${0:c}" %t void t8() { __asm__ volatile("T8 NAMED MODIFIER: %c[input]" :: [input] "i" (4)); } diff --git a/test/CodeGen/atomic.c b/test/CodeGen/atomic.c index 66dc702bfee9..355f7b83231e 100644 --- a/test/CodeGen/atomic.c +++ b/test/CodeGen/atomic.c @@ -1,14 +1,14 @@ -// RUN: clang-cc %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1 && -// 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 4 && -// RUN: grep @llvm.atomic.load.and.i32 %t1 | count 2 && -// RUN: grep @llvm.atomic.load.or.i8 %t1 && +// RUN: clang-cc %s -emit-llvm -o - -triple=i686-apple-darwin9 > %t1 +// 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 4 +// RUN: grep @llvm.atomic.load.and.i32 %t1 | count 2 +// RUN: grep @llvm.atomic.load.or.i8 %t1 // RUN: grep @llvm.atomic.load.xor.i8 %t1 diff --git a/test/CodeGen/attr-nodebug.c b/test/CodeGen/attr-nodebug.c index b96ad26d6d04..e0c813399fb9 100644 --- a/test/CodeGen/attr-nodebug.c +++ b/test/CodeGen/attr-nodebug.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -g -emit-llvm -o %t %s && +// RUN: clang-cc -g -emit-llvm -o %t %s // RUN: not grep 'call void @llvm.dbg.func.start' %t void t1() __attribute__((nodebug)); diff --git a/test/CodeGen/attr-noinline.c b/test/CodeGen/attr-noinline.c index 199c2918d425..719d6eb88fb3 100644 --- a/test/CodeGen/attr-noinline.c +++ b/test/CodeGen/attr-noinline.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -g -emit-llvm -o %t %s && +// RUN: clang-cc -g -emit-llvm -o %t %s // RUN: grep 'noinline' %t void t1() __attribute__((noinline)); diff --git a/test/CodeGen/attr-used.c b/test/CodeGen/attr-used.c index 8521ffd2e4bb..5537ec2f4cef 100644 --- a/test/CodeGen/attr-used.c +++ b/test/CodeGen/attr-used.c @@ -1,6 +1,6 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: grep '@llvm.used = .*@g0' %t && -// RUN: grep '@llvm.used = .*@f0' %t && +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: grep '@llvm.used = .*@g0' %t +// RUN: grep '@llvm.used = .*@f0' %t // RUN: grep '@llvm.used = .*@f1.l0' %t diff --git a/test/CodeGen/attributes.c b/test/CodeGen/attributes.c index d539e033a7e9..29672c2ecb3d 100644 --- a/test/CodeGen/attributes.c +++ b/test/CodeGen/attributes.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -triple i386-linux-gnu -o %t %s && +// RUN: clang-cc -emit-llvm -triple i386-linux-gnu -o %t %s // RUN: FileCheck --input-file=%t %s // CHECK: @t5 = weak global i32 2 @@ -69,8 +69,7 @@ int t19(void) { } // CHECK:define void @t20() nounwind { -// CHECK-NEXT:entry: -// CHECK-NEXT: call void @abort() +// CHECK: call void @abort() // CHECK-NEXT: unreachable void t20(void) { __builtin_abort(); diff --git a/test/CodeGen/bitfield-assign.c b/test/CodeGen/bitfield-assign.c index 05d4dda353c7..575a9fb766cf 100644 --- a/test/CodeGen/bitfield-assign.c +++ b/test/CodeGen/bitfield-assign.c @@ -4,13 +4,13 @@ /* Check that we get one load for each simple assign and two for the compound assign (load the old value before the add then load again to store back). Also check that our g0 pattern is good. */ -// RUN: clang-cc -triple i386-unknown-unknown -O0 -emit-llvm -o %t %s && -// RUN: grep 'load ' %t | count 5 && -// RUN: grep "@g0" %t | count 4 && +// RUN: clang-cc -triple i386-unknown-unknown -O0 -emit-llvm -o %t %s +// RUN: grep 'load ' %t | count 5 +// RUN: grep "@g0" %t | count 4 // Check that we got the right value. -// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o %t %s && -// RUN: grep 'load ' %t | count 0 && +// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o %t %s +// RUN: grep 'load ' %t | count 0 // RUN: grep "@g0" %t | count 0 struct s0 { diff --git a/test/CodeGen/bitfield-promote.c b/test/CodeGen/bitfield-promote.c index 5894e51626da..1290a1ecd33b 100644 --- a/test/CodeGen/bitfield-promote.c +++ b/test/CodeGen/bitfield-promote.c @@ -1,7 +1,6 @@ -// RUN: clang -O3 -emit-llvm -S -o %t %s && -// RUN: grep 'ret i64 4294967292' %t | count 2 && -// RUN: grep 'ret i64 -4' %t | count 1 && -// RUN: true +// RUN: clang -O3 -emit-llvm -S -o %t %s +// RUN: grep 'ret i64 4294967292' %t | count 2 +// RUN: grep 'ret i64 -4' %t | count 1 long long f0(void) { struct { unsigned f0 : 32; } x = { 18 }; diff --git a/test/CodeGen/bitfield.c b/test/CodeGen/bitfield.c index 02f2de79f6bc..9cd79d3d5870 100644 --- a/test/CodeGen/bitfield.c +++ b/test/CodeGen/bitfield.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t -O3 && -// RUN: grep "ret i32" %t | count 4 && +// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t -O3 +// RUN: grep "ret i32" %t | count 4 // RUN: grep "ret i32 1" %t | count 4 static int f0(int n) { diff --git a/test/CodeGen/blocks-1.c b/test/CodeGen/blocks-1.c index 10498cb00495..ae5a74aab6f0 100644 --- a/test/CodeGen/blocks-1.c +++ b/test/CodeGen/blocks-1.c @@ -1,13 +1,13 @@ -// RUN: clang-cc %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 "i32 135)" %t | count 2 && +// RUN: clang-cc %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 "i32 135)" %t | count 2 // RUN: grep "_Block_object_assign" %t | count 10 -#include +int printf(const char *, ...); void test1() { __block int a; diff --git a/test/CodeGen/blocks-2.c b/test/CodeGen/blocks-2.c index acbaafd95605..c22e882f1b79 100644 --- a/test/CodeGen/blocks-2.c +++ b/test/CodeGen/blocks-2.c @@ -1,5 +1,9 @@ -// RUN: clang-cc -g %s -emit-llvm -o %t -fblocks && +// RUN: clang-cc -g %s -emit-llvm -o %t -fblocks // RUN: grep "func.start" %t | count 4 +// RUN: clang-cc -g %s -triple i386-unknown-unknown -emit-llvm -o %t -fblocks -fblock-introspection +// RUN: grep "v8@?0i4" %t | count 1 +// RUN: clang-cc -g %s -triple i386-unknown-unknown -emit-llvm -o %t -fblocks +// RUN: grep "v8@?0i4" %t | count 0 // 1 declaration, 1 bar, 1 test_block_dbg and 1 for the block. // XFAIL: * diff --git a/test/CodeGen/blocks-aligned-byref-variable.c b/test/CodeGen/blocks-aligned-byref-variable.c index 1ae306254157..61522fd2da77 100644 --- a/test/CodeGen/blocks-aligned-byref-variable.c +++ b/test/CodeGen/blocks-aligned-byref-variable.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o - -triple x86_64-apple-darwin10 && +// RUN: clang-cc -emit-llvm -o - -triple x86_64-apple-darwin10 // RUN: clang-cc -emit-llvm -o - -triple i386-apple-darwin10 typedef int __attribute__((aligned(32))) ai; diff --git a/test/CodeGen/blocks-seq.c b/test/CodeGen/blocks-seq.c index 3ff241e3f6e3..4006b715f464 100644 --- a/test/CodeGen/blocks-seq.c +++ b/test/CodeGen/blocks-seq.c @@ -1,12 +1,12 @@ // FIXME: We forcibly strip the names so that the test doesn't vary between // builds with and without asserts. We need a better solution for this. -// RUN: clang-cc -fblocks -triple x86_64-apple-darwin10 -emit-llvm-bc -o - %s | opt -strip | llvm-dis > %t && -// RUN: grep '%6 = call i32 (...)\* @rhs()' %t | count 1 && -// RUN: grep '%7 = getelementptr inbounds %0\* %1, i32 0, i32 1' %t | count 1 && -// RUN: grep '%8 = load %0\*\* %7' %t | count 1 && -// RUN: grep '%10 = call i32 (...)\* @rhs()' %t | count 1 && -// RUN: grep '%11 = getelementptr inbounds %0\* %1, i32 0, i32 1' %t | count 1 && +// RUN: clang-cc -fblocks -triple x86_64-apple-darwin10 -emit-llvm-bc -o - %s | opt -strip | llvm-dis > %t +// RUN: grep '%6 = call i32 (...)\* @rhs()' %t | count 1 +// RUN: grep '%7 = getelementptr inbounds %0\* %1, i32 0, i32 1' %t | count 1 +// RUN: grep '%8 = load %0\*\* %7' %t | count 1 +// RUN: grep '%10 = call i32 (...)\* @rhs()' %t | count 1 +// RUN: grep '%11 = getelementptr inbounds %0\* %1, i32 0, i32 1' %t | count 1 // RUN: grep '%12 = load %0\*\* %11' %t | count 1 int rhs(); diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c index 39c5b06b1727..eddf25c74a83 100644 --- a/test/CodeGen/blocks.c +++ b/test/CodeGen/blocks.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t -fblocks && +// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t -fblocks void (^f)(void) = ^{}; // rdar://6768379 @@ -12,7 +12,7 @@ struct s0 { int a[64]; }; -// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* noalias sret .*, .*, .* byval .*)' %t && +// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* noalias sret .*, .*, .* byval .*)' %t struct s0 f2(struct s0 a0) { return ^(struct s0 a1){ return a1; }(a0); } @@ -27,4 +27,3 @@ void (^test1)(void) = ^(void) { ^ { i = 1; }(); }; -// RUN: true diff --git a/test/CodeGen/builtin-count-zeros.c b/test/CodeGen/builtin-count-zeros.c index 374acc43ae58..ff08bd108357 100644 --- a/test/CodeGen/builtin-count-zeros.c +++ b/test/CodeGen/builtin-count-zeros.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o - | grep 'cttz' | count 2 && +// RUN: clang-cc -emit-llvm %s -o - | grep 'cttz' | count 2 // RUN: clang-cc -emit-llvm %s -o - | grep 'ctlz' | count 2 int a(int a) {return __builtin_ctz(a) + __builtin_clz(a);} diff --git a/test/CodeGen/builtin-memfns.c b/test/CodeGen/builtin-memfns.c index 9ae380c5455b..f1d092502dc2 100644 --- a/test/CodeGen/builtin-memfns.c +++ b/test/CodeGen/builtin-memfns.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s && -// RUN: grep '@llvm.memset.i32' %t && -// RUN: grep '@llvm.memcpy.i32' %t && -// RUN: grep '@llvm.memmove.i32' %t && +// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s +// RUN: grep '@llvm.memset.i32' %t +// RUN: grep '@llvm.memcpy.i32' %t +// RUN: grep '@llvm.memmove.i32' %t // RUN: grep __builtin %t | count 0 int main(int argc, char **argv) { diff --git a/test/CodeGen/builtin-nanf.c b/test/CodeGen/builtin-nanf.c index e048c7a1aa5a..8f7d2a1e443b 100644 --- a/test/CodeGen/builtin-nanf.c +++ b/test/CodeGen/builtin-nanf.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s && +// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s // RUN: grep 'float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000020000000, float 0x7FF8000000000000, float 0x7FF80001E0000000, float 0x7FF8001E00000000, float 0x7FF801E000000000, float 0x7FF81E0000000000, float 0x7FF9E00000000000, float 0x7FFFFFFFE0000000' %t float n[] = { diff --git a/test/CodeGen/builtin-stackaddress.c b/test/CodeGen/builtin-stackaddress.c index 5c6d540172a0..d8e58c4f6be7 100644 --- a/test/CodeGen/builtin-stackaddress.c +++ b/test/CodeGen/builtin-stackaddress.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm < %s | grep "llvm.returnaddress" && +// RUN: clang-cc -emit-llvm < %s | grep "llvm.returnaddress" // RUN: clang-cc -emit-llvm < %s | grep "llvm.frameaddress" void* a(unsigned x) { return __builtin_return_address(0); diff --git a/test/CodeGen/builtins-ffs_parity_popcount.c b/test/CodeGen/builtins-ffs_parity_popcount.c index e3fa4d2d8212..74e104b437c6 100644 --- a/test/CodeGen/builtins-ffs_parity_popcount.c +++ b/test/CodeGen/builtins-ffs_parity_popcount.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o - %s > %t && +// RUN: clang-cc -emit-llvm -o - %s > %t // RUN: not grep "__builtin" %t #include diff --git a/test/CodeGen/builtins-powi.c b/test/CodeGen/builtins-powi.c index 57fa81a3ad12..945ec5dd13ea 100644 --- a/test/CodeGen/builtins-powi.c +++ b/test/CodeGen/builtins-powi.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o - %s > %t && +// RUN: clang-cc -emit-llvm -o - %s > %t // RUN: not grep "__builtin" %t #include diff --git a/test/CodeGen/builtins-x86.c b/test/CodeGen/builtins-x86.c index f49e7b670dec..c82ecde1ff39 100644 --- a/test/CodeGen/builtins-x86.c +++ b/test/CodeGen/builtins-x86.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -DUSE_64 -triple x86_64-unknown-unknown -emit-llvm -o %t %s && +// RUN: clang-cc -DUSE_64 -triple x86_64-unknown-unknown -emit-llvm -o %t %s // RUN: clang-cc -DUSE_ALL -triple x86_64-unknown-unknown -fsyntax-only -o %t %s #ifdef USE_ALL diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c index 359d5070ccc1..11bcc14249ac 100644 --- a/test/CodeGen/builtins.c +++ b/test/CodeGen/builtins.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -emit-llvm -o %t %s && +// RUN: clang-cc -emit-llvm -o %t %s // RUN: not grep __builtin %t -#include +int printf(const char *, ...); void p(char *str, int x) { printf("%s: %d\n", str, x); diff --git a/test/CodeGen/c-strings.c b/test/CodeGen/c-strings.c index ee85f60ed15a..2cf4036cb675 100644 --- a/test/CodeGen/c-strings.c +++ b/test/CodeGen/c-strings.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: grep "hello" %t | count 3 && -// RUN: grep 'c"hello\\00"' %t | count 2 && -// RUN: grep 'c"hello\\00\\00\\00"' %t | count 1 && +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: grep "hello" %t | count 3 +// RUN: grep 'c"hello\\00"' %t | count 2 +// RUN: grep 'c"hello\\00\\00\\00"' %t | count 1 // RUN: grep 'c"ola"' %t | count 1 /* Should be 3 hello string, two global (of different sizes), the rest diff --git a/test/CodeGen/cleanup-stack.c b/test/CodeGen/cleanup-stack.c index b0c5e88d55ec..3954d85de2b0 100644 --- a/test/CodeGen/cleanup-stack.c +++ b/test/CodeGen/cleanup-stack.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t && +// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t // RUN: grep "ret i32 9" %t struct s0 { diff --git a/test/CodeGen/compound-type.c b/test/CodeGen/compound-type.c index 352f6cc3ce65..47eb3a6e57b6 100644 --- a/test/CodeGen/compound-type.c +++ b/test/CodeGen/compound-type.c @@ -1,5 +1,5 @@ -// RUN: clang-cc < %s -emit-llvm -triple i686-pc-linux-gnu > %t && -// RUN: grep "div i32" %t && +// RUN: clang-cc < %s -emit-llvm -triple i686-pc-linux-gnu > %t +// RUN: grep "div i32" %t // RUN: grep "shl i32" %t unsigned char a,b; diff --git a/test/CodeGen/conditional.c b/test/CodeGen/conditional.c index 8a30463cb7e4..f55d59071a2f 100644 --- a/test/CodeGen/conditional.c +++ b/test/CodeGen/conditional.c @@ -39,3 +39,11 @@ void _php_stream_free3() { void _php_stream_free4() { 1 ? _efree(0) : free(0); } + +// PR5526 +struct test9 { int a; }; +void* test9spare(); +void test9(struct test9 *p) { + p ? p : test9spare(); +} + diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c index e25da9c6eba0..06cdde9c9575 100644 --- a/test/CodeGen/const-init.c +++ b/test/CodeGen/const-init.c @@ -111,3 +111,15 @@ void *g20(void) { // PR4108 struct g21 {int g21;}; const struct g21 g21 = (struct g21){1}; + +// PR5474 +struct g22 {int x;} __attribute((packed)); +struct g23 {char a; short b; char c; struct g22 d;}; +struct g23 g24 = {1,2,3,4}; + +// CHECK: @__func__.g25 = private constant [4 x i8] c"g25\00" +// CHECK: @g25.g26 = internal global i8* getelementptr inbounds ([4 x i8]* @__func__.g25, i32 0, i32 0) +int g25() { + static const char *g26 = __func__; + return *g26; +} diff --git a/test/CodeGen/constant-comparison.c b/test/CodeGen/constant-comparison.c index ea3e8962b333..3089ae48e6e7 100644 --- a/test/CodeGen/constant-comparison.c +++ b/test/CodeGen/constant-comparison.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o - 2>&1 | not grep warning && +// RUN: clang-cc -emit-llvm %s -o - 2>&1 | not grep warning // RUN: clang-cc -emit-llvm %s -o - | grep @b | count 1 int a, b; diff --git a/test/CodeGen/constructor-attribute.c b/test/CodeGen/constructor-attribute.c index 9a1fa76c622a..b715201dc53b 100644 --- a/test/CodeGen/constructor-attribute.c +++ b/test/CodeGen/constructor-attribute.c @@ -1,10 +1,10 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: grep -e "global_ctors.*@A" %t && -// RUN: grep -e "global_dtors.*@B" %t && -// RUN: grep -e "global_ctors.*@C" %t && +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: grep -e "global_ctors.*@A" %t +// RUN: grep -e "global_dtors.*@B" %t +// RUN: grep -e "global_ctors.*@C" %t // RUN: grep -e "global_dtors.*@D" %t -#include +int printf(const char *, ...); void A() __attribute__((constructor)); void B() __attribute__((destructor)); diff --git a/test/CodeGen/darwin-string-literals.c b/test/CodeGen/darwin-string-literals.c index 04e43a234d19..427e9c2e1b20 100644 --- a/test/CodeGen/darwin-string-literals.c +++ b/test/CodeGen/darwin-string-literals.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix LSB %s && +// RUN: clang-cc -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" diff --git a/test/CodeGen/debug-info.c b/test/CodeGen/debug-info.c index 85ad988bc216..856b91964ebc 100644 --- a/test/CodeGen/debug-info.c +++ b/test/CodeGen/debug-info.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -o %t --emit-llvm -g %s && +// RUN: clang-cc -o %t --emit-llvm -g %s // RUN: FileCheck --input-file=%t %s // PR3023 diff --git a/test/CodeGen/designated-initializers.c b/test/CodeGen/designated-initializers.c index f20bc782b6ac..cc88cef0dcdf 100644 --- a/test/CodeGen/designated-initializers.c +++ b/test/CodeGen/designated-initializers.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t && -// RUN: grep "{ i8\* null, i32 1024 }" %t && +// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t +// RUN: grep "{ i8\* null, i32 1024 }" %t // RUN: grep "i32 0, i32 22" %t struct foo { diff --git a/test/CodeGen/dllimport-dllexport.c b/test/CodeGen/dllimport-dllexport.c index fe49ae7a32af..6e259058b7a1 100644 --- a/test/CodeGen/dllimport-dllexport.c +++ b/test/CodeGen/dllimport-dllexport.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -emit-llvm < %s -o %t && -// RUN: grep 'dllexport' %t | count 1 && +// RUN: clang-cc -emit-llvm < %s -o %t +// RUN: grep 'dllexport' %t | count 1 // RUN: not grep 'dllimport' %t void __attribute__((dllimport)) foo1(); diff --git a/test/CodeGen/emit-all-decls.c b/test/CodeGen/emit-all-decls.c index 775cb6f118a8..3e7927d8ef79 100644 --- a/test/CodeGen/emit-all-decls.c +++ b/test/CodeGen/emit-all-decls.c @@ -1,6 +1,6 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: not grep "@foo" %t && -// RUN: clang-cc -femit-all-decls -emit-llvm -o %t %s && +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: not grep "@foo" %t +// RUN: clang-cc -femit-all-decls -emit-llvm -o %t %s // RUN: grep "@foo" %t static void foo() { diff --git a/test/CodeGen/ext-vector-shuffle.c b/test/CodeGen/ext-vector-shuffle.c index 765551596401..88f8c242e880 100644 --- a/test/CodeGen/ext-vector-shuffle.c +++ b/test/CodeGen/ext-vector-shuffle.c @@ -1,5 +1,5 @@ -// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'extractelement' && -// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'insertelement' && +// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'extractelement' +// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'insertelement' // RUN: clang-cc %s -x cl -emit-llvm -o - | grep 'shufflevector' typedef __attribute__(( ext_vector_type(2) )) float float2; diff --git a/test/CodeGen/flexible-array-init.c b/test/CodeGen/flexible-array-init.c index fb98a8ec07a6..2f0df9057a9a 100644 --- a/test/CodeGen/flexible-array-init.c +++ b/test/CodeGen/flexible-array-init.c @@ -1,6 +1,6 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 7 | count 1 && -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 11 | count 1 && -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 13 | count 1 && +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 7 | count 1 +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 11 | count 1 +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 13 | count 1 // RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 15 | count 1 struct { int x; int y[]; } a = { 1, 7, 11 }; diff --git a/test/CodeGen/functions.c b/test/CodeGen/functions.c index dba29316e1a3..1c53db411961 100644 --- a/test/CodeGen/functions.c +++ b/test/CodeGen/functions.c @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o %t && +// RUN: clang-cc %s -emit-llvm -o %t int g(); @@ -19,15 +19,15 @@ void test3(T f) { int a(int); int a() {return 1;} -// RUN: grep 'define void @f0()' %t && +// RUN: grep 'define void @f0()' %t void f0() {} void f1(); -// RUN: grep 'call void @f1()' %t && +// RUN: grep 'call void @f1()' %t void f2(void) { f1(1, 2, 3); } -// RUN: grep 'define void @f1()' %t && +// RUN: grep 'define void @f1()' %t void f1() {} // RUN: grep 'define .* @f3' %t | not grep -F '...' diff --git a/test/CodeGen/global-decls.c b/test/CodeGen/global-decls.c index decb6a981c7f..c7a70fa237ac 100644 --- a/test/CodeGen/global-decls.c +++ b/test/CodeGen/global-decls.c @@ -1,16 +1,16 @@ -// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s && +// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s -// RUN: grep '@g0_ext = extern_weak global i32' %t && +// RUN: grep '@g0_ext = extern_weak global i32' %t extern int g0_ext __attribute__((weak)); -// RUN: grep 'declare extern_weak i32 @g1_ext()' %t && +// RUN: grep 'declare extern_weak i32 @g1_ext()' %t extern int __attribute__((weak)) g1_ext (void); -// RUN: grep '@g0_common = weak global i32' %t && +// RUN: grep '@g0_common = weak global i32' %t int g0_common __attribute__((weak)); -// RUN: grep '@g0_def = weak global i32' %t && +// RUN: grep '@g0_def = weak global i32' %t int g0_def __attribute__((weak)) = 52; -// RUN: grep 'define weak i32 @g1_def()' %t && +// RUN: grep 'define weak i32 @g1_def()' %t int __attribute__((weak)) g1_def (void) { return 0; } // Force _ext references @@ -19,4 +19,3 @@ void f0() { int b = g1_ext(); } -// RUN: true diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c index 2e239cf5438c..b0537ae5b077 100644 --- a/test/CodeGen/init.c +++ b/test/CodeGen/init.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t && +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t void f1() { // Scalars in braces. @@ -22,7 +22,7 @@ void f3() { } // Constants -// RUN: grep '@g3 = constant i32 10' %t && +// RUN: grep '@g3 = constant i32 10' %t // RUN: grep '@f4.g4 = internal constant i32 12' %t const int g3 = 10; int f4() { diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c index bf17fd7c22ba..76d90eda2100 100644 --- a/test/CodeGen/inline.c +++ b/test/CodeGen/inline.c @@ -1,40 +1,40 @@ -// RUN: echo "GNU89 tests:" && -// RUN: clang %s -emit-llvm -S -o %t -std=gnu89 && -// RUN: grep "define available_externally i32 @ei()" %t && -// RUN: grep "define i32 @foo()" %t && -// RUN: grep "define i32 @bar()" %t && -// RUN: grep "define void @unreferenced1()" %t && -// RUN: not grep unreferenced2 %t && -// RUN: grep "define void @gnu_inline()" %t && -// RUN: grep "define available_externally void @gnu_ei_inline()" %t && -// RUN: grep "define i32 @test1" %t && -// RUN: grep "define i32 @test2" %t && -// RUN: grep "define void @test3()" %t && -// RUN: grep "define available_externally i32 @test4" %t && -// RUN: grep "define available_externally i32 @test5" %t && - -// RUN: echo "\nC99 tests:" && -// RUN: clang %s -emit-llvm -S -o %t -std=c99 && -// RUN: grep "define i32 @ei()" %t && -// RUN: grep "define available_externally i32 @foo()" %t && -// RUN: grep "define i32 @bar()" %t && -// RUN: not grep unreferenced1 %t && -// RUN: grep "define void @unreferenced2()" %t && -// RUN: grep "define void @gnu_inline()" %t && -// RUN: grep "define available_externally void @gnu_ei_inline()" %t && -// RUN: grep "define i32 @test1" %t && -// RUN: grep "define i32 @test2" %t && -// RUN: grep "define void @test3" %t && -// RUN: grep "define available_externally i32 @test4" %t && -// RUN: grep "define available_externally i32 @test5" %t && - -// RUN: echo "\nC++ tests:" && -// RUN: clang %s -emit-llvm -S -o %t -std=c++98 && -// RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t && -// RUN: grep "define linkonce_odr i32 @_Z3foov()" %t && -// RUN: grep "define i32 @_Z3barv()" %t && -// RUN: not grep unreferenced %t && -// RUN: grep "define void @_Z10gnu_inlinev()" %t && +// RUN: echo "GNU89 tests:" +// RUN: clang %s -emit-llvm -S -o %t -std=gnu89 +// RUN: grep "define available_externally i32 @ei()" %t +// RUN: grep "define i32 @foo()" %t +// RUN: grep "define i32 @bar()" %t +// RUN: grep "define void @unreferenced1()" %t +// RUN: not grep unreferenced2 %t +// RUN: grep "define void @gnu_inline()" %t +// RUN: grep "define available_externally void @gnu_ei_inline()" %t +// RUN: grep "define i32 @test1" %t +// RUN: grep "define i32 @test2" %t +// RUN: grep "define void @test3()" %t +// RUN: grep "define available_externally i32 @test4" %t +// RUN: grep "define available_externally i32 @test5" %t + +// RUN: echo "\nC99 tests:" +// RUN: clang %s -emit-llvm -S -o %t -std=c99 +// RUN: grep "define i32 @ei()" %t +// RUN: grep "define available_externally i32 @foo()" %t +// RUN: grep "define i32 @bar()" %t +// RUN: not grep unreferenced1 %t +// RUN: grep "define void @unreferenced2()" %t +// RUN: grep "define void @gnu_inline()" %t +// RUN: grep "define available_externally void @gnu_ei_inline()" %t +// RUN: grep "define i32 @test1" %t +// RUN: grep "define i32 @test2" %t +// RUN: grep "define void @test3" %t +// RUN: grep "define available_externally i32 @test4" %t +// RUN: grep "define available_externally i32 @test5" %t + +// RUN: echo "\nC++ tests:" +// RUN: clang %s -emit-llvm -S -o %t -std=c++98 +// RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t +// RUN: grep "define linkonce_odr i32 @_Z3foov()" %t +// RUN: grep "define i32 @_Z3barv()" %t +// RUN: not grep unreferenced %t +// RUN: grep "define void @_Z10gnu_inlinev()" %t // RUN: grep "define available_externally void @_Z13gnu_ei_inlinev()" %t extern __inline int ei() { return 123; } diff --git a/test/CodeGen/inline2.c b/test/CodeGen/inline2.c index 6f165f50f8b7..304d6168578c 100644 --- a/test/CodeGen/inline2.c +++ b/test/CodeGen/inline2.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s && +// RUN: clang-cc -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s // RUN: clang-cc -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s // CHECK-GNU89: define i32 @f0() diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c index ea9e0c3dd91b..cbbde8a9f3fd 100644 --- a/test/CodeGen/libcalls.c +++ b/test/CodeGen/libcalls.c @@ -1,8 +1,8 @@ -// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s -triple i386-unknown-unknown && -// RUN: grep "declare " %t | count 6 && -// RUN: grep "declare " %t | grep "@llvm." | count 1 && -// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s -triple i386-unknown-unknown && -// RUN: grep "declare " %t | count 6 && +// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s -triple i386-unknown-unknown +// RUN: grep "declare " %t | count 6 +// RUN: grep "declare " %t | grep "@llvm." | count 1 +// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s -triple i386-unknown-unknown +// RUN: grep "declare " %t | count 6 // RUN: grep "declare " %t | grep -v "@llvm." | count 0 // IRgen only pays attention to const; it should always call llvm for diff --git a/test/CodeGen/lineno-dbginfo.c b/test/CodeGen/lineno-dbginfo.c index 12c32ce9dd4b..b78dd21d72b3 100644 --- a/test/CodeGen/lineno-dbginfo.c +++ b/test/CodeGen/lineno-dbginfo.c @@ -1,6 +1,6 @@ -// RUN: echo "#include " > %t.h && -// RUN: clang -S -save-temps -g -include %t.h %s -emit-llvm -o %t.ll && -// RUN: grep "i32 5" %t.ll && +// RUN: echo "#include " > %t.h +// RUN: clang -S -save-temps -g -include %t.h %s -emit-llvm -o %t.ll +// RUN: grep "i32 5" %t.ll // RUN: rm -f lineno-dbginfo.i // outer is at line number 5. int outer = 42; diff --git a/test/CodeGen/mandel.c b/test/CodeGen/mandel.c index 27993f0559e9..9d7956c56d1b 100644 --- a/test/CodeGen/mandel.c +++ b/test/CodeGen/mandel.c @@ -25,7 +25,7 @@ int main() { return 0; } #define I 1.0iF -#include +int putchar(char c); volatile double __complex__ accum; diff --git a/test/CodeGen/no-common.c b/test/CodeGen/no-common.c index 190873c745fe..64e37d78f964 100644 --- a/test/CodeGen/no-common.c +++ b/test/CodeGen/no-common.c @@ -1,6 +1,6 @@ -// 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: 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 int x; diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c index 61d85419fc69..038d8f98e5d5 100644 --- a/test/CodeGen/object-size.c +++ b/test/CodeGen/object-size.c @@ -15,39 +15,39 @@ int gi, gj; void test1() { // CHECK: movabsq $59, %rdx - // CHECK-NEXT: movq %rax, %rdi - // CHECK-NEXT: movq %rcx, %rsi + // CHECK-NEXT: movq + // CHECK-NEXT: movq // CHECK-NEXT: call ___strcpy_chk strcpy(&gbuf[4], "Hi there"); } void test2() { // CHECK: movabsq $63, %rdx - // CHECK-NEXT: movq %rax, %rdi - // CHECK-NEXT: movq %rcx, %rsi + // CHECK-NEXT: movq + // CHECK-NEXT: movq // CHECK-NEXT: call ___strcpy_chk strcpy(gbuf, "Hi there"); } void test3() { // CHECK: movabsq $0, %rdx - // CHECK-NEXT: movq %rax, %rdi - // CHECK-NEXT: movq %rcx, %rsi + // CHECK-NEXT: movq + // CHECK-NEXT: movq // CHECK-NEXT: call ___strcpy_chk strcpy(&gbuf[100], "Hi there"); } void test4() { // CHECK: movabsq $0, %rdx - // CHECK-NEXT: movq %rax, %rdi - // CHECK-NEXT: movq %rcx, %rsi + // CHECK-NEXT: movq + // CHECK-NEXT: movq // CHECK-NEXT: call ___strcpy_chk strcpy((char*)(void*)&gbuf[-1], "Hi there"); } void test5() { - // CHECK: movb $0, %al - // CHECK-NEXT: testb %al, %al + // CHECK: movq $-1, %rax + // CHECK-NEXT: cmpq $-1, %rax // CHECK: call ___inline_strcpy_chk strcpy(gp, "Hi there"); } @@ -56,8 +56,8 @@ void test6() { char buf[57]; // CHECK: movabsq $53, %rdx - // CHECK-NEXT: movq %rax, %rdi - // CHECK-NEXT: movq %rcx, %rsi + // CHECK-NEXT: movq + // CHECK-NEXT: movq // CHECK-NEXT: call ___strcpy_chk strcpy(&buf[4], "Hi there"); } diff --git a/test/CodeGen/packed-union.c b/test/CodeGen/packed-union.c index d11d3a490234..41dc94c7a410 100644 --- a/test/CodeGen/packed-union.c +++ b/test/CodeGen/packed-union.c @@ -1,6 +1,6 @@ -// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm %s -o %t && +// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm %s -o %t -// RUN: grep "struct._attrs = type <{ i32, i8 }>" %t && +// RUN: grep "struct._attrs = type <{ i32, i8 }>" %t typedef struct _attrs { unsigned file_attributes; unsigned char filename_length; diff --git a/test/CodeGen/parameter-passing.c b/test/CodeGen/parameter-passing.c index dce0ff80cdc4..966223a39f56 100644 --- a/test/CodeGen/parameter-passing.c +++ b/test/CodeGen/parameter-passing.c @@ -5,15 +5,14 @@ // We also check _Bool and empty structures, as these can have annoying // corner cases. -// RUN: clang-cc %s -triple i386-unknown-unknown -O3 -emit-llvm -o %t && -// RUN: not grep '@g0' %t && +// RUN: clang-cc %s -triple i386-unknown-unknown -O3 -emit-llvm -o %t +// RUN: not grep '@g0' %t -// RUN: clang-cc %s -triple x86_64-unknown-unknown -O3 -emit-llvm -o %t && -// RUN: not grep '@g0' %t && +// RUN: clang-cc %s -triple x86_64-unknown-unknown -O3 -emit-llvm -o %t +// RUN: not grep '@g0' %t -// RUN: clang-cc %s -triple powerpc-unknown-unknown -O3 -emit-llvm -o %t && -// RUN: not grep '@g0' %t && -// RUN: true +// RUN: clang-cc %s -triple powerpc-unknown-unknown -O3 -emit-llvm -o %t +// RUN: not grep '@g0' %t typedef _Bool BoolTy; typedef int ScalarTy; diff --git a/test/CodeGen/pragma-pack-2.c b/test/CodeGen/pragma-pack-2.c index 306f02dd8cfe..bfc5dc943c5e 100644 --- a/test/CodeGen/pragma-pack-2.c +++ b/test/CodeGen/pragma-pack-2.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s && +// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s // CHECK-X32: %struct.s0 = type { i64, i64, i32, [12 x i32] } // CHECK-X32: %struct.s1 = type { [15 x i32], %struct.s0 } diff --git a/test/CodeGen/pragma-pack-3.c b/test/CodeGen/pragma-pack-3.c index b9166ae5d390..56a6be3874fa 100644 --- a/test/CodeGen/pragma-pack-3.c +++ b/test/CodeGen/pragma-pack-3.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s && +// RUN: clang-cc -triple i386-apple-darwin9 %s -emit-llvm -o - | FileCheck -check-prefix X32 %s // CHECK-X32: %struct.menu = type <{ i8*, i8, i8 }> // CHECK-X32: %union.command = type <{ i8*, [2 x i8] }> diff --git a/test/CodeGen/predefined-expr.c b/test/CodeGen/predefined-expr.c index 9b645931a4a7..1a5dcb4fc6ff 100644 --- a/test/CodeGen/predefined-expr.c +++ b/test/CodeGen/predefined-expr.c @@ -9,7 +9,7 @@ // CHECK: @__func__.staticFunction = private constant [15 x i8] c"staticFunction\00" // CHECK: @__PRETTY_FUNCTION__.staticFunction = private constant [22 x i8] c"void staticFunction()\00" -#include +int printf(const char *, ...); void plainFunction() { printf("__func__ %s\n", __func__); diff --git a/test/CodeGen/private-extern.c b/test/CodeGen/private-extern.c index f3ffe5461d06..a9bb28bfad4e 100644 --- a/test/CodeGen/private-extern.c +++ b/test/CodeGen/private-extern.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: grep '@g0 = external hidden constant i32' %t && +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: grep '@g0 = external hidden constant i32' %t // RUN: grep '@g1 = hidden constant i32 1' %t __private_extern__ const int g0; diff --git a/test/CodeGen/rdr-6098585-default-after-caserange.c b/test/CodeGen/rdr-6098585-default-after-caserange.c index 3a11ad64299c..239383a4bdca 100644 --- a/test/CodeGen/rdr-6098585-default-after-caserange.c +++ b/test/CodeGen/rdr-6098585-default-after-caserange.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && -// RUN: grep "ret i32" %t | count 1 && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t +// RUN: grep "ret i32" %t | count 1 // RUN: grep "ret i32 10" %t | count 1 // Ensure that default after a case range is not ignored. diff --git a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c index f1d15dcd4fd5..39a6bc662dcb 100644 --- a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c +++ b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t // RUN: grep "ret i32 10" %t // Ensure that this doesn't compile to infinite loop in g() due to diff --git a/test/CodeGen/rdr-6098585-empty-case-range.c b/test/CodeGen/rdr-6098585-empty-case-range.c index ca5ff1b71225..f80b599ed5a0 100644 --- a/test/CodeGen/rdr-6098585-empty-case-range.c +++ b/test/CodeGen/rdr-6098585-empty-case-range.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && -// RUN: grep "ret i32" %t | count 2 && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t +// RUN: grep "ret i32" %t | count 2 // RUN: grep "ret i32 3" %t | count 2 // This generated incorrect code because of poor switch chaining. diff --git a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c index b34744970610..6c51a3706716 100644 --- a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c +++ b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t // RUN: grep "ret i32 %" %t // Make sure return is not constant (if empty range is skipped or miscompiled) diff --git a/test/CodeGen/rdr-6098585-unsigned-caserange.c b/test/CodeGen/rdr-6098585-unsigned-caserange.c index 80035982e1f4..3b4384bdd70f 100644 --- a/test/CodeGen/rdr-6098585-unsigned-caserange.c +++ b/test/CodeGen/rdr-6098585-unsigned-caserange.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && -// RUN: grep "ret i32" %t | count 1 && +// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t +// RUN: grep "ret i32" %t | count 1 // RUN: grep "ret i32 3" %t | count 1 int f2(unsigned x) { diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c index 0b5924d81112..c29d1f7f33d9 100644 --- a/test/CodeGen/stack-protector.c +++ b/test/CodeGen/stack-protector.c @@ -1,16 +1,9 @@ -// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s && -// RUN: not grep 'ssp' %t && -// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s && -// RUN: not grep 'ssp' %t && -// RUN: clang-cc -triple i686-apple-darwin10 -emit-llvm -o %t %s && -// RUN: grep 'ssp' %t && -// RUN: clang -fstack-protector-all -emit-llvm -S -o %t %s && -// RUN: grep 'sspreq' %t && -// RUN: clang -fstack-protector -emit-llvm -S -o %t %s && -// RUN: grep 'ssp' %t && -// RUN: clang -fno-stack-protector -emit-llvm -S -o %t %s && -// RUN: not grep 'ssp' %t && -// RUN: true +// RUN: clang-cc -emit-llvm -o - %s -stack-protector=0 | FileCheck -check-prefix=NOSSP %s +// NOSSP: define void @test1(i8* %msg) nounwind { +// RUN: clang-cc -emit-llvm -o - %s -stack-protector=1 | FileCheck -check-prefix=WITHSSP %s +// WITHSSP: define void @test1(i8* %msg) nounwind ssp { +// RUN: clang-cc -emit-llvm -o - %s -stack-protector=2 | FileCheck -check-prefix=SSPREQ %s +// SSPREQ: define void @test1(i8* %msg) nounwind sspreq { int printf(const char * _Format, ...); diff --git a/test/CodeGen/staticinit.c b/test/CodeGen/staticinit.c index c68366f2ea77..8b87ccd6b905 100644 --- a/test/CodeGen/staticinit.c +++ b/test/CodeGen/staticinit.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s && -// RUN: grep "g.b = internal global i8. getelementptr" %t && +// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s +// RUN: grep "g.b = internal global i8. getelementptr" %t struct AStruct { int i; diff --git a/test/CodeGen/stdcall-fastcall.c b/test/CodeGen/stdcall-fastcall.c index 89ed8c9ef672..11b652178ca8 100644 --- a/test/CodeGen/stdcall-fastcall.c +++ b/test/CodeGen/stdcall-fastcall.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm < %s | grep 'fastcallcc' | count 4 && +// RUN: clang-cc -emit-llvm < %s | grep 'fastcallcc' | count 4 // RUN: clang-cc -emit-llvm < %s | grep 'stdcallcc' | count 4 void __attribute__((fastcall)) f1(void); diff --git a/test/CodeGen/string-init.c b/test/CodeGen/string-init.c index 4a808512601e..0cb6afff611d 100644 --- a/test/CodeGen/string-init.c +++ b/test/CodeGen/string-init.c @@ -1,6 +1,6 @@ -// RUN: clang-cc -emit-llvm %s -o %t && -// RUN: grep 'private constant \[10 x i8\]' %t && -// RUN: not grep -F "[5 x i8]" %t && +// RUN: clang-cc -emit-llvm %s -o %t +// RUN: grep 'private constant \[10 x i8\]' %t +// RUN: not grep -F "[5 x i8]" %t // RUN: not grep "store " %t void test(void) { diff --git a/test/CodeGen/struct-passing.c b/test/CodeGen/struct-passing.c index 9a4f47651b74..772077a5964f 100644 --- a/test/CodeGen/struct-passing.c +++ b/test/CodeGen/struct-passing.c @@ -1,11 +1,10 @@ -// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s && -// RUN: grep 'declare i32 @f0() readnone$' %t && -// RUN: grep 'declare i32 @f1() readonly$' %t && -// RUN: grep 'declare void @f2(.* noalias sret)$' %t && -// RUN: grep 'declare void @f3(.* noalias sret)$' %t && -// RUN: grep 'declare void @f4(.* byval)$' %t && -// RUN: grep 'declare void @f5(.* byval)$' %t && -// RUN: true +// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s +// RUN: grep 'declare i32 @f0() readnone$' %t +// RUN: grep 'declare i32 @f1() readonly$' %t +// RUN: grep 'declare void @f2(.* noalias sret)$' %t +// RUN: grep 'declare void @f3(.* noalias sret)$' %t +// RUN: grep 'declare void @f4(.* byval)$' %t +// RUN: grep 'declare void @f5(.* byval)$' %t // PR3835 typedef int T0; diff --git a/test/CodeGen/struct-x86-darwin.c b/test/CodeGen/struct-x86-darwin.c index c61005f1bebd..e7822f073d2a 100644 --- a/test/CodeGen/struct-x86-darwin.c +++ b/test/CodeGen/struct-x86-darwin.c @@ -1,12 +1,12 @@ -// RUN: clang-cc < %s -emit-llvm > %t1 -triple=i686-apple-darwin9 && -// RUN: grep "STest1 = type { i32, \[4 x i16\], double }" %t1 && -// RUN: grep "STest2 = type { i16, i16, i32, i32 }" %t1 && -// RUN: grep "STest3 = type { i8, i16, i32 }" %t1 && -// RUN: grep "STestB1 = type { i8, i8 }" %t1 && -// RUN: grep "STestB2 = type { i8, i8, i8 }" %t1 && -// RUN: grep "STestB3 = type { i8, i8 }" %t1 && -// RUN: grep "STestB4 = type { i8, i8, i8, i8 }" %t1 && -// RUN: grep "STestB5 = type { i8, i8, \[2 x i8\], i8, i8 }" %t1 && +// RUN: clang-cc < %s -emit-llvm > %t1 -triple=i686-apple-darwin9 +// RUN: grep "STest1 = type { i32, \[4 x i16\], double }" %t1 +// RUN: grep "STest2 = type { i16, i16, i32, i32 }" %t1 +// RUN: grep "STest3 = type { i8, i16, i32 }" %t1 +// RUN: grep "STestB1 = type { i8, i8 }" %t1 +// RUN: grep "STestB2 = type { i8, i8, i8 }" %t1 +// RUN: grep "STestB3 = type { i8, i8 }" %t1 +// RUN: grep "STestB4 = type { i8, i8, i8, i8 }" %t1 +// RUN: grep "STestB5 = type { i8, i8, \[2 x i8\], i8, i8 }" %t1 // RUN: grep "STestB6 = type { i8, i8, \[2 x i8\] }" %t1 // Test struct layout for x86-darwin target diff --git a/test/CodeGen/target-data.c b/test/CodeGen/target-data.c index 9d73d5c6300d..26775f98117c 100644 --- a/test/CodeGen/target-data.c +++ b/test/CodeGen/target-data.c @@ -1,7 +1,6 @@ -// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s && -// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"' %t && -// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s && -// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"' %t && -// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s && -// RUN: grep 'target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"' %t && -// RUN: true +// RUN: clang-cc -triple i686-unknown-unknown -emit-llvm -o %t %s +// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"' %t +// RUN: clang-cc -triple i686-apple-darwin9 -emit-llvm -o %t %s +// RUN: grep 'target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"' %t +// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s +// RUN: grep 'target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"' %t diff --git a/test/CodeGen/tentative-decls.c b/test/CodeGen/tentative-decls.c index 3301c234c55a..b72c5850ac2c 100644 --- a/test/CodeGen/tentative-decls.c +++ b/test/CodeGen/tentative-decls.c @@ -1,16 +1,16 @@ -// RUN: clang-cc -emit-llvm -o %t %s && +// RUN: clang-cc -emit-llvm -o %t %s -// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t && +// RUN: grep '@r = common global \[1 x .*\] zeroinitializer' %t int r[]; int (*a)[] = &r; struct s0; struct s0 x; -// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t && +// RUN: grep '@x = common global .struct.s0 zeroinitializer' %t struct s0 y; -// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t && +// RUN: grep '@y = common global .struct.s0 zeroinitializer' %t struct s0 *f0() { return &y; } @@ -19,21 +19,20 @@ struct s0 { int x; }; -// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t && +// RUN: grep '@b = common global \[1 x .*\] zeroinitializer' %t int b[]; int *f1() { return b; } // Check that the most recent tentative definition wins. -// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t && +// RUN: grep '@c = common global \[4 x .*\] zeroinitializer' %t int c[]; int c[4]; // Check that we emit static tentative definitions -// RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t && +// RUN: grep '@c5 = internal global \[1 x .*\] zeroinitializer' %t static int c5[]; static int func() { return c5[0]; } int callfunc() { return func(); } -// RUN: true diff --git a/test/CodeGen/trapv.c b/test/CodeGen/trapv.c index c96488b8e99b..6045ed908d0e 100644 --- a/test/CodeGen/trapv.c +++ b/test/CodeGen/trapv.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -ftrapv %s -emit-llvm -o %t && +// RUN: clang-cc -ftrapv %s -emit-llvm -o %t // RUN: grep "__overflow_handler" %t | count 2 unsigned int ui, uj, uk; diff --git a/test/CodeGen/unreachable.c b/test/CodeGen/unreachable.c index ea4f0478bbd4..3f39a27def97 100644 --- a/test/CodeGen/unreachable.c +++ b/test/CodeGen/unreachable.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s && +// RUN: clang-cc -emit-llvm -o %t %s // RUN: grep '@unreachable' %t | count 0 extern void abort() __attribute__((noreturn)); diff --git a/test/CodeGen/unwind-attr.c b/test/CodeGen/unwind-attr.c index 86036f94b981..1148ba10315e 100644 --- a/test/CodeGen/unwind-attr.c +++ b/test/CodeGen/unwind-attr.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fexceptions -emit-llvm -o - %s | grep "@foo()" | not grep nounwind && +// RUN: clang-cc -fexceptions -emit-llvm -o - %s | grep "@foo()" | not grep nounwind // RUN: clang-cc -emit-llvm -o - %s | grep "@foo()" | grep nounwind int foo(void) { diff --git a/test/CodeGen/visibility.c b/test/CodeGen/visibility.c index 958eb618ee70..7c837ba823e9 100644 --- a/test/CodeGen/visibility.c +++ b/test/CodeGen/visibility.c @@ -1,28 +1,27 @@ -// RUN: clang-cc -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-cc -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-cc -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: true +// RUN: clang-cc -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-cc -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-cc -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 int g_com; int g_def = 0; diff --git a/test/CodeGen/volatile-1.c b/test/CodeGen/volatile-1.c index ac3b4c2e97b2..3203326ecebf 100644 --- a/test/CodeGen/volatile-1.c +++ b/test/CodeGen/volatile-1.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -Wno-unused-value -emit-llvm < %s -o %t && -// RUN: grep volatile %t | count 145 && +// RUN: clang-cc -Wno-unused-value -emit-llvm < %s -o %t +// RUN: grep volatile %t | count 145 // RUN: grep memcpy %t | count 4 volatile int i, j, k; @@ -14,7 +14,7 @@ volatile struct S { } a, b; //void operator =(volatile struct S&o1, volatile struct S&o2) volatile; -#include +int printf(const char *, ...); int main() { // A use. diff --git a/test/CodeGen/volatile.c b/test/CodeGen/volatile.c index e17669008a39..a0cc891ccd88 100644 --- a/test/CodeGen/volatile.c +++ b/test/CodeGen/volatile.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -emit-llvm < %s -o %t && -// RUN: grep volatile %t | count 29 && +// RUN: clang-cc -emit-llvm < %s -o %t +// RUN: grep volatile %t | count 29 // RUN: grep memcpy %t | count 7 // The number 29 comes from the current codegen for volatile loads; diff --git a/test/CodeGen/x86.c b/test/CodeGen/x86.c index be0930237c82..0420a4cd97de 100644 --- a/test/CodeGen/x86.c +++ b/test/CodeGen/x86.c @@ -1,11 +1,11 @@ -// RUN: clang-cc %s -triple=i686-pc-linux-gnu -emit-llvm -o - > %t1 && -// RUN: grep "ax" %t1 && -// RUN: grep "bx" %t1 && -// RUN: grep "cx" %t1 && -// RUN: grep "dx" %t1 && -// RUN: grep "di" %t1 && -// RUN: grep "si" %t1 && -// RUN: grep "st" %t1 && +// RUN: clang-cc %s -triple=i686-pc-linux-gnu -emit-llvm -o - > %t1 +// RUN: grep "ax" %t1 +// RUN: grep "bx" %t1 +// RUN: grep "cx" %t1 +// RUN: grep "dx" %t1 +// RUN: grep "di" %t1 +// RUN: grep "si" %t1 +// RUN: grep "st" %t1 // RUN: grep "st(1)" %t1 void test1() { diff --git a/test/CodeGen/x86_32-arguments.c b/test/CodeGen/x86_32-arguments.c index 78fb8342eebd..33f635c31ae1 100644 --- a/test/CodeGen/x86_32-arguments.c +++ b/test/CodeGen/x86_32-arguments.c @@ -1,14 +1,14 @@ -// RUN: clang-cc -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s && -// RUN: grep 'define signext i8 @f0()' %t && -// RUN: grep 'define signext i16 @f1()' %t && -// RUN: grep 'define i32 @f2()' %t && -// RUN: grep 'define float @f3()' %t && -// RUN: grep 'define double @f4()' %t && -// RUN: grep 'define x86_fp80 @f5()' %t && -// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t && -// RUN: grep 'define void @f7(i32 %a0)' %t && -// RUN: grep 'define i64 @f8_1()' %t && -// RUN: grep 'define void @f8_2(i32 %a0.0, i32 %a0.1)' %t && +// RUN: clang-cc -fblocks -triple i386-apple-darwin9 -emit-llvm -o %t %s +// RUN: grep 'define signext i8 @f0()' %t +// RUN: grep 'define signext i16 @f1()' %t +// RUN: grep 'define i32 @f2()' %t +// RUN: grep 'define float @f3()' %t +// RUN: grep 'define double @f4()' %t +// RUN: grep 'define x86_fp80 @f5()' %t +// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t +// RUN: grep 'define void @f7(i32 %a0)' %t +// RUN: grep 'define i64 @f8_1()' %t +// RUN: grep 'define void @f8_2(i32 %a0.0, i32 %a0.1)' %t char f0(void) { return 0; @@ -49,11 +49,11 @@ void f8_2(struct s8 a0) {} // This should be passed just as s8. -// RUN: grep 'define i64 @f9_1()' %t && +// RUN: grep 'define i64 @f9_1()' %t // FIXME: llvm-gcc expands this, this may have some value for the // backend in terms of optimization but doesn't change the ABI. -// RUN: grep 'define void @f9_2(%.truct.s9\* byval %a0)' %t && +// RUN: grep 'define void @f9_2(%.truct.s9\* byval %a0)' %t struct s9 { int a : 17; int b; @@ -63,7 +63,7 @@ void f9_2(struct s9 a0) {} // Return of small structures and unions -// RUN: grep 'float @f10()' %t && +// RUN: grep 'float @f10()' %t struct s10 { union { }; float f; @@ -71,12 +71,12 @@ struct s10 { // Small vectors and 1 x {i64,double} are returned in registers -// RUN: grep 'i32 @f11()' %t && -// RUN: grep -F 'void @f12(<2 x i32>* noalias sret %agg.result)' %t && -// RUN: grep 'i64 @f13()' %t && -// RUN: grep 'i64 @f14()' %t && -// RUN: grep '<2 x i64> @f15()' %t && -// RUN: grep '<2 x i64> @f16()' %t && +// RUN: grep 'i32 @f11()' %t +// RUN: grep -F 'void @f12(<2 x i32>* noalias sret %agg.result)' %t +// RUN: grep 'i64 @f13()' %t +// RUN: grep 'i64 @f14()' %t +// RUN: grep '<2 x i64> @f15()' %t +// RUN: grep '<2 x i64> @f16()' %t typedef short T11 __attribute__ ((vector_size (4))); T11 f11(void) { while (1) {} } typedef int T12 __attribute__ ((vector_size (8))); @@ -93,12 +93,12 @@ T16 f16(void) { while (1) {} } // And when the single element in a struct (but not for 64 and // 128-bits). -// RUN: grep 'i32 @f17()' %t && -// RUN: grep -F 'void @f18(%2* noalias sret %agg.result)' %t && -// RUN: grep -F 'void @f19(%3* noalias sret %agg.result)' %t && -// RUN: grep -F 'void @f20(%4* noalias sret %agg.result)' %t && -// RUN: grep -F 'void @f21(%5* noalias sret %agg.result)' %t && -// RUN: grep -F 'void @f22(%6* noalias sret %agg.result)' %t && +// RUN: grep 'i32 @f17()' %t +// RUN: grep -F 'void @f18(%2* noalias sret %agg.result)' %t +// RUN: grep -F 'void @f19(%3* noalias sret %agg.result)' %t +// RUN: grep -F 'void @f20(%4* noalias sret %agg.result)' %t +// RUN: grep -F 'void @f21(%5* noalias sret %agg.result)' %t +// RUN: grep -F 'void @f22(%6* noalias sret %agg.result)' %t struct { T11 a; } f17(void) { while (1) {} } struct { T12 a; } f18(void) { while (1) {} } struct { T13 a; } f19(void) { while (1) {} } @@ -108,98 +108,97 @@ struct { T16 a; } f22(void) { while (1) {} } // Single element structures are handled specially -// RUN: grep -F 'float @f23()' %t && -// RUN: grep -F 'float @f24()' %t && -// RUN: grep -F 'float @f25()' %t && +// RUN: grep -F 'float @f23()' %t +// RUN: grep -F 'float @f24()' %t +// RUN: grep -F 'float @f25()' %t struct { float a; } f23(void) { while (1) {} } struct { float a[1]; } f24(void) { while (1) {} } struct { struct {} a; struct { float a[1]; } b; } f25(void) { while (1) {} } // Small structures are handled recursively -// RUN: grep -F 'i32 @f26()' %t && -// RUN: grep 'void @f27(%.truct.s27\* noalias sret %agg.result)' %t && +// RUN: grep -F 'i32 @f26()' %t +// RUN: grep 'void @f27(%.truct.s27\* noalias sret %agg.result)' %t struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} } struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} } -// RUN: grep 'void @f28(%.truct.s28\* noalias sret %agg.result)' %t && +// RUN: grep 'void @f28(%.truct.s28\* noalias sret %agg.result)' %t struct s28 { int a; int b[]; } f28(void) { while (1) {} } -// RUN: grep 'define i16 @f29()' %t && +// RUN: grep 'define i16 @f29()' %t struct s29 { struct { } a[1]; char b; char c; } f29(void) { while (1) {} } -// RUN: grep 'define i16 @f30()' %t && +// RUN: grep 'define i16 @f30()' %t struct s30 { char a; char b : 4; } f30(void) { while (1) {} } -// RUN: grep 'define float @f31()' %t && +// RUN: grep 'define float @f31()' %t struct s31 { char : 0; float b; char : 0; } f31(void) { while (1) {} } -// RUN: grep 'define i32 @f32()' %t && +// RUN: grep 'define i32 @f32()' %t struct s32 { char a; unsigned : 0; } f32(void) { while (1) {} } -// RUN: grep 'define float @f33()' %t && +// RUN: grep 'define float @f33()' %t struct s33 { float a; long long : 0; } f33(void) { while (1) {} } -// RUN: grep 'define float @f34()' %t && +// RUN: grep 'define float @f34()' %t struct s34 { struct { int : 0; } a; float b; } f34(void) { while (1) {} } -// RUN: grep 'define i16 @f35()' %t && +// RUN: grep 'define i16 @f35()' %t struct s35 { struct { int : 0; } a; char b; char c; } f35(void) { while (1) {} } -// RUN: grep 'define i16 @f36()' %t && +// RUN: grep 'define i16 @f36()' %t struct s36 { struct { int : 0; } a[2][10]; char b; char c; } f36(void) { while (1) {} } -// RUN: grep 'define float @f37()' %t && +// RUN: grep 'define float @f37()' %t struct s37 { float c[1][1]; } f37(void) { while (1) {} } -// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t && +// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t struct s38 { char a[3]; short b; } f38(void) { while (1) {} } -// RUN: grep 'define void @f39(.struct.s39. byval align 16 .x)' %t && +// RUN: grep 'define void @f39(.struct.s39. byval align 16 .x)' %t typedef int v39 __attribute((vector_size(16))); struct s39 { v39 x; }; void f39(struct s39 x) {} // -// RUN: grep 'define i32 @f40()' %t && +// RUN: grep 'define i32 @f40()' %t enum e40 { ec0 = 0 }; enum e40 f40(void) { } -// RUN: grep 'define void ()\* @f41()' %t && +// RUN: grep 'define void ()\* @f41()' %t typedef void (^vvbp)(void); vvbp f41(void) { } -// RUN: grep 'define i32 @f42()' %t && +// RUN: grep 'define i32 @f42()' %t struct s42 { enum e40 f0; } f42(void) { } -// RUN: grep 'define i64 @f43()' %t && +// RUN: grep 'define i64 @f43()' %t struct s43 { enum e40 f0; int f1; } f43(void) { } -// RUN: grep 'define i32 @f44()' %t && +// RUN: grep 'define i32 @f44()' %t struct s44 { vvbp f0; } f44(void) { } -// RUN: grep 'define i64 @f45()' %t && +// RUN: grep 'define i64 @f45()' %t struct s45 { vvbp f0; int f1; } f45(void) { } -// RUN: grep 'define void @f46(i32 %a0)' %t && +// RUN: grep 'define void @f46(i32 %a0)' %t void f46(enum e40 a0) { } -// RUN: grep 'define void @f47(void ()\* %a1)' %t && +// RUN: grep 'define void @f47(void ()\* %a1)' %t void f47(vvbp a1) { } -// RUN: grep 'define void @f48(i32 %a0.0)' %t && +// RUN: grep 'define void @f48(i32 %a0.0)' %t struct s48 { enum e40 f0; }; void f48(struct s48 a0) { } -// RUN: grep 'define void @f49(i32 %a0.0, i32 %a0.1)' %t && +// RUN: grep 'define void @f49(i32 %a0.0, i32 %a0.1)' %t struct s49 { enum e40 f0; int f1; }; void f49(struct s49 a0) { } -// RUN: grep 'define void @f50(void ()\* %a0.0)' %t && +// RUN: grep 'define void @f50(void ()\* %a0.0)' %t struct s50 { vvbp f0; }; void f50(struct s50 a0) { } -// RUN: grep 'define void @f51(void ()\* %a0.0, i32 %a0.1)' %t && +// RUN: grep 'define void @f51(void ()\* %a0.0, i32 %a0.1)' %t struct s51 { vvbp f0; int f1; }; void f51(struct s51 a0) { } -// RUN: true diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c index 19f9cdaa2918..1a848ead356f 100644 --- a/test/CodeGen/x86_64-arguments.c +++ b/test/CodeGen/x86_64-arguments.c @@ -1,15 +1,15 @@ -// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s && -// RUN: grep 'define signext i8 @f0()' %t && -// RUN: grep 'define signext i16 @f1()' %t && -// RUN: grep 'define i32 @f2()' %t && -// RUN: grep 'define float @f3()' %t && -// RUN: grep 'define double @f4()' %t && -// RUN: grep 'define x86_fp80 @f5()' %t && -// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t && -// RUN: grep 'define void @f7(i32 %a0)' %t && -// RUN: grep '.0 = type { i64, double }' %t && -// RUN: grep 'define .0 @f8_1()' %t && -// RUN: grep 'define void @f8_2(.0)' %t && +// RUN: clang-cc -triple x86_64-unknown-unknown -emit-llvm -o %t %s +// RUN: grep 'define signext i8 @f0()' %t +// RUN: grep 'define signext i16 @f1()' %t +// RUN: grep 'define i32 @f2()' %t +// RUN: grep 'define float @f3()' %t +// RUN: grep 'define double @f4()' %t +// RUN: grep 'define x86_fp80 @f5()' %t +// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t +// RUN: grep 'define void @f7(i32 %a0)' %t +// RUN: grep '.0 = type { i64, double }' %t +// RUN: grep 'define .0 @f8_1()' %t +// RUN: grep 'define void @f8_2(.0)' %t char f0(void) { return 0; @@ -51,49 +51,48 @@ union u8 { union u8 f8_1() { while (1) {} } void f8_2(union u8 a0) {} -// RUN: grep 'define i64 @f9()' %t && +// RUN: grep 'define i64 @f9()' %t struct s9 { int a; int b; int : 0; } f9(void) { while (1) {} } -// RUN: grep 'define void @f10(i64)' %t && +// RUN: grep 'define void @f10(i64)' %t struct s10 { int a; int b; int : 0; }; void f10(struct s10 a0) {} -// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t && +// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t union { long double a; float b; } f11() { while (1) {} } -// RUN: grep 'define i64 @f12_0()' %t && -// RUN: grep 'define void @f12_1(i64)' %t && +// RUN: grep 'define i64 @f12_0()' %t +// RUN: grep 'define void @f12_1(i64)' %t struct s12 { int a __attribute__((aligned(16))); }; struct s12 f12_0(void) { while (1) {} } void f12_1(struct s12 a0) {} // Check that sret parameter is accounted for when checking available integer // registers. -// RUN: grep 'define void @f13(.struct.s13_0. noalias sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t && +// RUN: grep 'define void @f13(.struct.s13_0. noalias sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t struct s13_0 { long long f0[3]; }; struct s13_1 { long long f0[2]; }; struct s13_0 f13(int a, int b, int c, int d, struct s13_1 e, int f) { while (1) {} } -// RUN: grep 'define void @f14(.*, i8 signext .X)' %t && +// RUN: grep 'define void @f14(.*, i8 signext .X)' %t void f14(int a, int b, int c, int d, int e, int f, char X) {} -// RUN: grep 'define void @f15(.*, i8\* .X)' %t && +// RUN: grep 'define void @f15(.*, i8\* .X)' %t void f15(int a, int b, int c, int d, int e, int f, void *X) {} -// RUN: grep 'define void @f16(.*, float .X)' %t && +// RUN: grep 'define void @f16(.*, float .X)' %t void f16(float a, float b, float c, float d, float e, float f, float g, float h, float X) {} -// RUN: grep 'define void @f17(.*, x86_fp80 .X)' %t && +// RUN: grep 'define void @f17(.*, x86_fp80 .X)' %t void f17(float a, float b, float c, float d, float e, float f, float g, float h, long double X) {} // Check for valid coercion. -// RUN: grep '.. = bitcast i64. .* to .struct.f18_s0.' %t && -// RUN: grep '.. = load .struct.f18_s0. .., align 1' %t && -// RUN: grep 'store .struct.f18_s0 .., .struct.f18_s0. .f18_arg1' %t && +// RUN: grep '.. = bitcast i64. .* to .struct.f18_s0.' %t +// RUN: grep '.. = load .struct.f18_s0. .., align 1' %t +// RUN: grep 'store .struct.f18_s0 .., .struct.f18_s0. .f18_arg1' %t struct f18_s0 { int f0; }; void f18(int a, struct f18_s0 f18_arg1) { while (1) {} } -// RUN: true diff --git a/test/CodeGenCXX/PR5050-constructor-conversion.cpp b/test/CodeGenCXX/PR5050-constructor-conversion.cpp index e5f722c513de..c0b53d5f6e55 100644 --- a/test/CodeGenCXX/PR5050-constructor-conversion.cpp +++ b/test/CodeGenCXX/PR5050-constructor-conversion.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s struct A { A(const A&, int i1 = 1); }; diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp index 5b6bc2e5b511..2f82872d6c9e 100644 --- a/test/CodeGenCXX/array-construction.cpp +++ b/test/CodeGenCXX/array-construction.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/array-operator-delete-call.cpp b/test/CodeGenCXX/array-operator-delete-call.cpp new file mode 100644 index 000000000000..c23d33632a38 --- /dev/null +++ b/test/CodeGenCXX/array-operator-delete-call.cpp @@ -0,0 +1,63 @@ +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s + +extern "C" int printf(...); + +int count; + +struct S { + S() : iS (++count) { printf("S::S(%d)\n", iS); } + ~S() { printf("S::~S(%d)\n", iS); } + int iS; +}; + +struct V { + V() : iV (++count) { printf("V::V(%d)\n", iV); } + virtual ~V() { printf("V::~V(%d)\n", iV); } + int iV; +}; + +struct COST +{ + S *cost; + V *vcost; + unsigned *cost_val; + + ~COST(); + COST(); +}; + + +COST::COST() +{ + cost = new S[3]; + vcost = new V[4]; + cost_val = new unsigned[10]; +} + +COST::~COST() +{ + if (cost) { + delete [] cost; + } + if (vcost) { + delete [] vcost; + } + if (cost_val) + delete [] cost_val; +} + +COST c1; + +int main() +{ + COST c3; +} +COST c2; + +// CHECK-LP64: call __ZdaPv + +// CHECK-LP32: call L__ZdaPv + diff --git a/test/CodeGenCXX/array-value-initialize.cpp b/test/CodeGenCXX/array-value-initialize.cpp new file mode 100644 index 000000000000..f041bc584b12 --- /dev/null +++ b/test/CodeGenCXX/array-value-initialize.cpp @@ -0,0 +1,28 @@ +// RUN: clang-cc -emit-llvm -o - %s + +// PR5463 +extern "C" int printf(...); + +struct S { + double filler; +}; + +struct Foo { + Foo(void) : bar_(), dbar_(), sbar_() { + for (int i = 0; i < 5; i++) { + printf("bar_[%d] = %d\n", i, bar_[i]); + printf("dbar_[%d] = %f\n", i, dbar_[i]); + printf("sbar_[%d].filler = %f\n", i, sbar_[i].filler); + } + } + + int bar_[5]; + double dbar_[5]; + S sbar_[5]; +}; + +int main(void) +{ + Foo a; +} + diff --git a/test/CodeGenCXX/assign-operator.cpp b/test/CodeGenCXX/assign-operator.cpp new file mode 100644 index 000000000000..3e0be4519438 --- /dev/null +++ b/test/CodeGenCXX/assign-operator.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc %s -emit-llvm-only -verify + +class x { +int operator=(int); +}; +void a() { + x a; + a = 1u; +} diff --git a/test/CodeGenCXX/attr.cpp b/test/CodeGenCXX/attr.cpp index 8077b7839d88..695e9e72f1a1 100644 --- a/test/CodeGenCXX/attr.cpp +++ b/test/CodeGenCXX/attr.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -O0 -S %s -o %t.s && +// RUN: clang-cc -triple x86_64-apple-darwin -O0 -S %s -o %t.s // RUN: FileCheck --input-file=%t.s %s int foo() __attribute__((aligned(1024))); diff --git a/test/CodeGenCXX/call-arg-zero-temp.cpp b/test/CodeGenCXX/call-arg-zero-temp.cpp index 2c44f69d975e..e066927ad702 100644 --- a/test/CodeGenCXX/call-arg-zero-temp.cpp +++ b/test/CodeGenCXX/call-arg-zero-temp.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/cast-conversion.cpp b/test/CodeGenCXX/cast-conversion.cpp index f571f549d094..fa8487ac66b9 100644 --- a/test/CodeGenCXX/cast-conversion.cpp +++ b/test/CodeGenCXX/cast-conversion.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s struct A { A(int); diff --git a/test/CodeGenCXX/class-layout.cpp b/test/CodeGenCXX/class-layout.cpp index 7255d3e4f94d..7663d2e541b2 100644 --- a/test/CodeGenCXX/class-layout.cpp +++ b/test/CodeGenCXX/class-layout.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o %t && +// RUN: clang-cc %s -emit-llvm -o %t // An extra byte shoudl be allocated for an empty class. // RUN: grep '%.truct.A = type { i8 }' %t diff --git a/test/CodeGenCXX/constructor-conversion.cpp b/test/CodeGenCXX/constructor-conversion.cpp index 980b230118d8..dcc9535315ab 100644 --- a/test/CodeGenCXX/constructor-conversion.cpp +++ b/test/CodeGenCXX/constructor-conversion.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/constructor-default-arg.cpp b/test/CodeGenCXX/constructor-default-arg.cpp index 7e6a7cd8f71a..c494149d1110 100644 --- a/test/CodeGenCXX/constructor-default-arg.cpp +++ b/test/CodeGenCXX/constructor-default-arg.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/constructor-for-array-members.cpp b/test/CodeGenCXX/constructor-for-array-members.cpp index fbb13e0aa3c2..5160a8975488 100644 --- a/test/CodeGenCXX/constructor-for-array-members.cpp +++ b/test/CodeGenCXX/constructor-for-array-members.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/constructor-template.cpp b/test/CodeGenCXX/constructor-template.cpp index 8c4f2c912709..66ec9eac212c 100644 --- a/test/CodeGenCXX/constructor-template.cpp +++ b/test/CodeGenCXX/constructor-template.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s // PR4826 struct A { diff --git a/test/CodeGenCXX/conversion-function.cpp b/test/CodeGenCXX/conversion-function.cpp index 0bfd4af7e265..c93587675ba1 100644 --- a/test/CodeGenCXX/conversion-function.cpp +++ b/test/CodeGenCXX/conversion-function.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); struct S { diff --git a/test/CodeGenCXX/convert-to-fptr.cpp b/test/CodeGenCXX/convert-to-fptr.cpp index c0bd2f7b856e..7cc8c08444aa 100644 --- a/test/CodeGenCXX/convert-to-fptr.cpp +++ b/test/CodeGenCXX/convert-to-fptr.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/copy-assign-synthesis-1.cpp b/test/CodeGenCXX/copy-assign-synthesis-1.cpp index d4a93afefbfa..14fbe30703d3 100644 --- a/test/CodeGenCXX/copy-assign-synthesis-1.cpp +++ b/test/CodeGenCXX/copy-assign-synthesis-1.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/copy-assign-synthesis.cpp b/test/CodeGenCXX/copy-assign-synthesis.cpp index f9baa8f03f3c..65a84f414a93 100644 --- a/test/CodeGenCXX/copy-assign-synthesis.cpp +++ b/test/CodeGenCXX/copy-assign-synthesis.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s && +// RUN: clang-cc -emit-llvm -o %t %s // RUN: grep "_ZN1XaSERK1X" %t | count 0 extern "C" int printf(...); diff --git a/test/CodeGenCXX/copy-constructor-elim.cpp b/test/CodeGenCXX/copy-constructor-elim.cpp index daef92cdb767..953effe77af1 100644 --- a/test/CodeGenCXX/copy-constructor-elim.cpp +++ b/test/CodeGenCXX/copy-constructor-elim.cpp @@ -1,7 +1,6 @@ -// RUN: clang-cc -emit-llvm -o %t %s && -// RUN: grep "_ZN1CC1ERK1C" %t | count 0 && -// RUN: grep "_ZN1SC1ERK1S" %t | count 0 && -// RUN: true +// RUN: clang-cc -emit-llvm -o %t %s +// RUN: grep "_ZN1CC1ERK1C" %t | count 0 +// RUN: grep "_ZN1SC1ERK1S" %t | count 0 extern "C" int printf(...); diff --git a/test/CodeGenCXX/copy-constructor-synthesis.cpp b/test/CodeGenCXX/copy-constructor-synthesis.cpp index 47971afe61d4..3b8f7821abcf 100644 --- a/test/CodeGenCXX/copy-constructor-synthesis.cpp +++ b/test/CodeGenCXX/copy-constructor-synthesis.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); @@ -45,6 +44,8 @@ struct X : M, N, P { // ... const char *name; unsigned bf1 : 8; unsigned bf2 : 16; + int arr[2]; + _Complex float complex; union { int au_i1; diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp new file mode 100644 index 000000000000..b89435a99044 --- /dev/null +++ b/test/CodeGenCXX/debug-info.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -emit-llvm-only -g +template struct Identity { + typedef T Type; +}; + +void f(Identity::Type a) {} +void f(Identity a) {} +void f(int& a) { } + +template struct A { + A *next; +}; +void f(A) { } diff --git a/test/CodeGenCXX/decl-ref-init.cpp b/test/CodeGenCXX/decl-ref-init.cpp index 27d200f4635b..fd93b7b21e04 100644 --- a/test/CodeGenCXX/decl-ref-init.cpp +++ b/test/CodeGenCXX/decl-ref-init.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s struct A {}; diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp index 8385aff6291c..0ec5b582c95b 100644 --- a/test/CodeGenCXX/default-arg-temps.cpp +++ b/test/CodeGenCXX/default-arg-temps.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 && +// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 struct T { T(); @@ -14,8 +14,8 @@ public: }; void g() { - // RUN: grep "call void @_ZN1TC1Ev" %t | count 4 && - // RUN: grep "call void @_ZN1TD1Ev" %t | count 4 && + // RUN: grep "call void @_ZN1TC1Ev" %t | count 4 + // RUN: grep "call void @_ZN1TD1Ev" %t | count 4 f(); f(); diff --git a/test/CodeGenCXX/default-arguments.cpp b/test/CodeGenCXX/default-arguments.cpp new file mode 100644 index 000000000000..5028ce99c7b7 --- /dev/null +++ b/test/CodeGenCXX/default-arguments.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 + +// PR5484 +namespace PR5484 { +struct A { }; +extern A a; + +void f(const A & = a); + +void g() { + f(); +} +} diff --git a/test/CodeGenCXX/default-constructor-default-argument.cpp b/test/CodeGenCXX/default-constructor-default-argument.cpp new file mode 100644 index 000000000000..f53732e471fe --- /dev/null +++ b/test/CodeGenCXX/default-constructor-default-argument.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s + +// Check that call to constructor for struct A is generated correctly. +struct A { A(int x = 2); }; +struct B : public A {}; +B x; + +// CHECK: call void @_ZN1AC1Ei diff --git a/test/CodeGenCXX/default-constructor-for-members.cpp b/test/CodeGenCXX/default-constructor-for-members.cpp index 2d04bc941427..d972d63d3cbc 100644 --- a/test/CodeGenCXX/default-constructor-for-members.cpp +++ b/test/CodeGenCXX/default-constructor-for-members.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/default-destructor-synthesis.cpp b/test/CodeGenCXX/default-destructor-synthesis.cpp index 9cc802c85dfa..fef9c03d7ac1 100644 --- a/test/CodeGenCXX/default-destructor-synthesis.cpp +++ b/test/CodeGenCXX/default-destructor-synthesis.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -O0 -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -O0 -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 -input-file=%t-32.s %s extern "C" int printf(...); diff --git a/test/CodeGenCXX/delete-two-arg.cpp b/test/CodeGenCXX/delete-two-arg.cpp new file mode 100644 index 000000000000..a5b18ba06fc3 --- /dev/null +++ b/test/CodeGenCXX/delete-two-arg.cpp @@ -0,0 +1,6 @@ +// RUN: clang-cc -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; } + +// CHECK: call void @_ZN1AdlEPvj(i8* %0, i32 4) diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp index 9e3feefefeda..78c83cf0df62 100644 --- a/test/CodeGenCXX/delete.cpp +++ b/test/CodeGenCXX/delete.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o %t && +// RUN: clang-cc %s -emit-llvm -o %t void t1(int *a) { delete a; diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp index 0c890195119f..70948b0ff933 100644 --- a/test/CodeGenCXX/derived-to-base-conv.cpp +++ b/test/CodeGenCXX/derived-to-base-conv.cpp @@ -1,8 +1,7 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && -// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && -// RUN: true +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s extern "C" int printf(...); extern "C" void exit(int); diff --git a/test/CodeGenCXX/destructors.cpp b/test/CodeGenCXX/destructors.cpp index 44d2b2936864..a196c13f8f42 100644 --- a/test/CodeGenCXX/destructors.cpp +++ b/test/CodeGenCXX/destructors.cpp @@ -28,3 +28,17 @@ class A1 { }; template<> A1::~A1(); + +// PR5529 +namespace PR5529 { + struct A { + ~A(); + }; + + A::~A() { } + struct B : A { + virtual ~B(); + }; + + B::~B() {} +} diff --git a/test/CodeGenCXX/dyncast.cpp b/test/CodeGenCXX/dyncast.cpp new file mode 100644 index 000000000000..4719f80a5b41 --- /dev/null +++ b/test/CodeGenCXX/dyncast.cpp @@ -0,0 +1,414 @@ +// RUN: clang-cc -I%S -triple x86_64-apple-darwin -std=c++0x -emit-llvm %s -o %t.ll +// RUN: FileCheck -check-prefix LL --input-file=%t.ll %s + +#include + +class test1_A { virtual void f() { } }; +class test1_B { virtual void g() { } }; +class test1_D : public virtual test1_A, private test1_B {}; +class test1_E : public test1_D, public test1_B {}; +class test1_F : public test1_E, public test1_D {}; + +extern test1_D test1_d; +extern test1_F test1_f; + +extern "C" int printf(const char *str...); + +#define S(V, N) if (V) printf("PASS: %d\n", N); else printf("FAIL: %d\n", N) + +void test1() { + test1_B* bp = (test1_B*)&test1_d; + test1_A* ap = &test1_d; + // This throws + // test1_D& dr = dynamic_cast(*bp); + test1_D* dp = dynamic_cast(bp); + S(dp == 0, 1); + ap = dynamic_cast(bp); + S(ap == 0, 2); + bp = dynamic_cast(ap); + S(bp == 0, 3); + ap = dynamic_cast(&test1_d); + S(ap != 0, 4); + // FIXME: Doesn't work yet, gcc fails this at compile time. We'd need access + // control for this to work. + // bp = dynamic_cast(&test1_d); + // S(bp == 0, 5); + { + test1_A* ap = &test1_f; + S(ap != 0, 6); + test1_D* dp = dynamic_cast(ap); + S(dp == 0, 7); + // cast from virtual base + test1_E* ep1 = dynamic_cast(ap); + S(ep1 != 0, 8); + } + dp = dynamic_cast(&test1_d); + S(dp == &test1_d, 9); + const test1_D *cdp = dynamic_cast(&test1_d); + S(cdp == &test1_d, 10); + dp = dynamic_cast((test1_A*)0); + S(dp == 0, 11); + ap = dynamic_cast(&test1_d); + S(ap == (test1_A*)&test1_d, 12); + test1_E* ep = dynamic_cast(&test1_f); + S(ep == (test1_E*)&test1_f, 13); + void *vp = dynamic_cast(ap); + S(vp == &test1_d, 14); + const void *cvp = dynamic_cast(ap); + S(cvp == &test1_d, 15); +} + +// CHECK-LL: define void @_Z5test1v() nounwind { +// CHECK-LL-NEXT:entry: +// CHECK-LL-NEXT: %bp = alloca %class.test1_A*, align 8 +// CHECK-LL-NEXT: %ap = alloca %class.test1_A*, align 8 +// CHECK-LL-NEXT: %dp = alloca %class.test1_D*, align 8 +// CHECK-LL-NEXT: %ap37 = alloca %class.test1_A*, align 8 +// CHECK-LL-NEXT: %dp53 = alloca %class.test1_D*, align 8 +// CHECK-LL-NEXT: %ep1 = alloca %class.test1_E*, align 8 +// CHECK-LL-NEXT: %cdp = alloca %class.test1_D*, align 8 +// CHECK-LL-NEXT: %ep = alloca %class.test1_E*, align 8 +// CHECK-LL-NEXT: %vp = alloca i8*, align 8 +// CHECK-LL-NEXT: %cvp = alloca i8*, align 8 +// CHECK-LL-NEXT: br i1 false, label %cast.null, label %cast.notnull +// CHECK-LL: cast.notnull: +// CHECK-LL-NEXT: br label %cast.end +// CHECK-LL: cast.null: +// CHECK-LL-NEXT: br label %cast.end +// CHECK-LL: cast.end: +// CHECK-LL-NEXT: %0 = phi %class.test1_A* [ bitcast (%class.test1_D* @test1_d to %class.test1_A*), %cast.notnull ], [ null, %cast.null ] +// CHECK-LL-NEXT: store %class.test1_A* %0, %class.test1_A** %bp +// CHECK-LL-NEXT: br i1 false, label %cast.null2, label %cast.notnull1 +// CHECK-LL: cast.notnull1: +// CHECK-LL-NEXT: %vtable = load i8** bitcast (%class.test1_D* @test1_d to i8**) +// CHECK-LL-NEXT: %vbase.offset.ptr = getelementptr i8* %vtable, i64 -24 +// CHECK-LL-NEXT: %1 = bitcast i8* %vbase.offset.ptr to i64* +// CHECK-LL-NEXT: %vbase.offset = load i64* %1 +// CHECK-LL-NEXT: %add.ptr = getelementptr i8* getelementptr inbounds (%class.test1_D* @test1_d, i32 0, i32 0, i32 0), i64 %vbase.offset +// CHECK-LL-NEXT: %2 = bitcast i8* %add.ptr to %class.test1_A* +// CHECK-LL-NEXT: br label %cast.end3 +// CHECK-LL: cast.null2: +// CHECK-LL-NEXT: br label %cast.end3 +// CHECK-LL: cast.end3: +// CHECK-LL-NEXT: %3 = phi %class.test1_A* [ %2, %cast.notnull1 ], [ null, %cast.null2 ] +// CHECK-LL-NEXT: store %class.test1_A* %3, %class.test1_A** %ap +// CHECK-LL-NEXT: %tmp = load %class.test1_A** %bp +// CHECK-LL-NEXT: %4 = icmp ne %class.test1_A* %tmp, null +// CHECK-LL-NEXT: br i1 %4, label %5, label %9 +// CHECK-LL: ;