summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* More test for "void *" argument as index of a dictionary literal.Fariborz Jahanian2014-09-101-0/+5
| | | | llvm-svn: 217555
* Remove a couple of fixed paths that snuck into my test from 217550Ben Langmuir2014-09-101-2/+2
| | | | | | I forgot to fix these again the second time I copy-and-pasted. llvm-svn: 217552
* Avoid a couple of assertions when preprocessing with modulesBen Langmuir2014-09-104-0/+26
| | | | | | | | | | | | | | | | 1. We were hitting the NextIsPrevious assertion because we were trying to merge decl chains that were independent of each other because we had no Sema object to allow them to find existing decls. This is fixed by delaying loading the "preloaded" decls until Sema is available. 2. We were trying to get identifier info from an annotation token, which asserts. The fix is to special-case the module annotations in the preprocessed output printer. Fixed in a single commit because when you hit 1 you almost invariably hit 2 as well. llvm-svn: 217550
* Only override the target architecture on -m32 and friends if it isJoerg Sonnenberger2014-09-101-0/+41
| | | | | | | | actually different. Fixes a surprising link error with nodejs on rpi, where armv6-netbsd-eabihf turned into armv5e-netbsd-eabihf, which doesn't lacks the necessary VFP support. llvm-svn: 217546
* Objective-C. Accept 'nil' as indexing argument toFariborz Jahanian2014-09-101-0/+10
| | | | | | | dictionary literals since the API which implements them accepts it too. // rdar://18254621 llvm-svn: 217543
* MS ABI: Emit dynamic initializers for selectany globals in ↵Hans Wennborg2014-09-101-6/+20
| | | | | | | | | | comdat-associative sections (PR20889) This prevents initializers for comdat-folded globals from running multiple times. Differential Revision: http://reviews.llvm.org/D5281 llvm-svn: 217534
* Objective-C arc. Fixes a crash when issuing diagnostic forFariborz Jahanian2014-09-101-0/+24
| | | | | | passing parameter to an audited CF API. rdar://18222007 llvm-svn: 217530
* Add a test for an operator access decl.Nico Weber2014-09-101-1/+7
| | | | | | | | | | In Parser::ParseCXXClassMemberDeclaration(), it was possible to change isAccessDecl = NextToken().is(tok::kw_operator); to isAccessDecl = false; and no tests would fail. Now there's coverage for this. llvm-svn: 217519
* [analyzer] Fix pthread lock tests so that the API comes from a system header.Jordan Rose2014-09-102-23/+45
| | | | | | | | ...and verify that a global mutex in user code can be used without warnings. Patch by Aleksei Sidorin! llvm-svn: 217515
* CodeGen: Use a fixed alignment for vtables.Benjamin Kramer2014-09-101-0/+14
| | | | | | | | | | | | | | | Pointer-sized alignment is sufficient as we only ever read single values from the table. Otherwise we'd bump the alignment to 16 bytes in the backend if the vtable is larger than 16 bytes. This is great for structures that are accessed with vector instructions or copied around, but that's simply not the case for vtables. Shrinks the data segment of a Release x86_64 clang by 0.3%. The wins are larger for i386 and code bases that use vtables more often than we do. This matches the behavior of GCC 5. llvm-svn: 217495
* Don't crash on access decls with invalid scope specifier, PR20887.Nico Weber2014-09-101-0/+5
| | | | llvm-svn: 217472
* Objective-C. Under a special flag, -Wcstring-format-directive,Fariborz Jahanian2014-09-091-0/+60
| | | | | | | | off by default, issue a warning if %s directive is used in certain CF/NS formatting APIs, to assist user in deprecating use of such %s in these APIs. rdar://18182443 llvm-svn: 217467
* Teach the analyzer that __builtin_assume_aligned returns its first argument.Jordan Rose2014-09-091-0/+28
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 217461
* Allow empty statements in naked functions in addition to ASM statementsEhsan Akhgari2014-09-091-0/+9
| | | | | | | | | | | | Summary: This fixes PR20883. Test Plan: The patch includes an automated test. Reviewers: hansw Differential Revision: http://reviews.llvm.org/D5256 llvm-svn: 217413
* Fix PCHs that import more than one moduleBen Langmuir2014-09-082-0/+2
| | | | | | | We were passing < to std::unique, but it expects ==. Since the input is sorted, we were always trimming it to one entry. llvm-svn: 217402
* Implement nonnull-attribute sanitizerAlexey Samsonov2014-09-082-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements a new UBSan check, which verifies that function arguments declared to be nonnull with __attribute__((nonnull)) are actually nonnull in runtime. To implement this check, we pass FunctionDecl to CodeGenFunction::EmitCallArgs (where applicable) and if function declaration has nonnull attribute specified for a certain formal parameter, we compare the corresponding RValue to null as soon as it's calculated. Test Plan: regression test suite Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, rnk Differential Revision: http://reviews.llvm.org/D5082 llvm-svn: 217389
* clang/test/CodeGen/builtin-assume*.c: Fixup for -Asserts.NAKAMURA Takumi2014-09-082-21/+22
| | | | llvm-svn: 217352
* Don't test really-large alignments for nowHal Finkel2014-09-081-1/+3
| | | | | | | | Temporarily comment out the test for really-large powers of two. This seems to be host-sensitive for some reason... trying to fix the clang-i386-freebsd builder. llvm-svn: 217351
* Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.Hal Finkel2014-09-075-3/+137
| | | | | | | | | | | This makes use of the recently-added @llvm.assume intrinsic to implement a __builtin_assume(bool) intrinsic (to provide additional information to the optimizer). This hooks up __assume in MS-compatibility mode to mirror __builtin_assume (the semantics have been intentionally kept compatible), and implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM now contains special logic to deal with assumptions of this form. llvm-svn: 217349
* Adjust test/CodeGenCXX/pr12251.cppHal Finkel2014-09-071-3/+2
| | | | | | | | InstCombine just got a bit smarter about checking known bits of returned values, and because this test runs the optimizer, it requires an update. We should really rewrite this test to directly check the IR output from CodeGen. llvm-svn: 217347
* Avoid writing to the test directory as it may not be writable.David Blaikie2014-09-071-2/+2
| | | | llvm-svn: 217339
* Fix test to not write output to the test directory, as it may not be writable.David Blaikie2014-09-071-2/+2
| | | | llvm-svn: 217337
* Try to green test/Sema/format-strings.c on Win botsHans Wennborg2014-09-072-3/+7
| | | | llvm-svn: 217327
* MS format strings: parse the 'Z' printf conversion specifier (PR20808)Hans Wennborg2014-09-071-1/+11
| | | | llvm-svn: 217326
* Move x86-specific bits of warn-unused-local-typedef.cpp into their own file.Nico Weber2014-09-062-16/+17
| | | | | | | That way, most of the test can run everywhere. Also give the new file an x86 triple in addition to a REQUIRES line. llvm-svn: 217314
* Attempt to fix ARM bot. (The test references a typedef from x86 asm.)Nico Weber2014-09-061-0/+1
| | | | llvm-svn: 217313
* [x86] Clean up the x86 builtin specs to reflect r217310 in LLVM whichChandler Carruth2014-09-062-2/+2
| | | | | | | | | | | | | | | made the 8-bit masks actually 8-bit arguments to these intrinsics. These builtins are a mess. Many were missing the I qualifier which I added where obviously correct. Most aren't tested, but I've updated the relevant tests. I've tried to catch all the things that should become 'c' in this round. It's also frustrating because the set of these is really ad-hoc and doesn't really map that cleanly to the set supported by either GCC or LLVM. Oh well... llvm-svn: 217311
* Add error, recovery and fixit for "~A::A() {...}".Richard Smith2014-09-062-0/+21
| | | | llvm-svn: 217302
* Add -Wunused-local-typedef, a warning that finds unused local typedefs.Nico Weber2014-09-068-4/+260
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning warns on TypedefNameDecls -- typedefs and C++11 using aliases -- that are !isReferenced(). Since the isReferenced() bit on TypedefNameDecls wasn't used for anything before this warning it wasn't always set correctly, so this patch also adds a few missing MarkAnyDeclReferenced() calls in various places for TypedefNameDecls. This is made a bit complicated due to local typedefs possibly being used only after their local scope has closed. Consider: template <class T> void template_fun(T t) { typename T::Foo s3foo; // YYY (void)s3foo; } void template_fun_user() { struct Local { typedef int Foo; // XXX } p; template_fun(p); } Here the typedef in XXX is only used at end-of-translation unit, when YYY in template_fun() gets instantiated. To handle this, typedefs that are unused when their scope exits are added to a set of potentially unused typedefs, and that set gets checked at end-of-TU. Typedefs that are still unused at that point then get warned on. There's also serialization code for this set, so that the warning works with precompiled headers and modules. For modules, the warning is emitted when the module is built, for precompiled headers each time the header gets used. Finally, consider a function using C++14 auto return types to return a local type defined in a header: auto f() { struct S { typedef int a; }; return S(); } Here, the typedef escapes its local scope and could be used by only some translation units including the header. To not warn on this, add a RecursiveASTVisitor that marks all delcs on local types returned from auto functions as referenced. (Except if it's a function with internal linkage, or the decls are private and the local type has no friends -- in these cases, it _is_ safe to warn.) Several of the included testcases (most of the interesting ones) were provided by Richard Smith. (gcc's spelling -Wunused-local-typedefs is supported as an alias for this warning.) llvm-svn: 217298
* Reword switch/goto diagnostics "protected scope" diagnostics. Making up a termRichard Smith2014-09-0620-95/+95
| | | | | | | | "protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
* Fix r217275 to work without the need for standard headers being includedDavid Blaikie2014-09-052-4/+0
| | | | | | | | It seems (I guess) in ObjC that va_list is provided without the need for inclusions. I verified that with this change the test still crashes in the absence of the fix committed in r217275. llvm-svn: 217290
* Move the initialization of VAListTagName after InitializeSema()Ben Langmuir2014-09-054-0/+36
| | | | | | | | | | | | | | | | | | | | This innocuous statement to get the identifier info for __va_list_tag was causing an assertion failure: NextIsPrevious() && "decl became non-canonical unexpectedly" if the __va_list_tag identifier was found in a PCH in some circumstances, because it was looked up before the ASTReader had a Sema object to use to find existing decls to merge with. We could possibly move getting the identifier info even later, or make it lazy if we wanted to, but this seemed like the minimal change. Now why a PCH would have this identifier in the first place is a bit mysterious. This seems to be related to the global module index in some way, because when the test case is built without the global module index it will not emit an identifier for __va_list_tag into the PCH, but with the global module index it does. llvm-svn: 217275
* Require an x86 target for ms-inline-asm-return.cpp instead of XFAILReid Kleckner2014-09-051-1/+1
| | | | llvm-svn: 217272
* [analyzer] Don't crash if malloc() has an unexpected function prototype.Jordan Rose2014-09-051-0/+17
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 217258
* [ARMv8] Add support for 32-bit MIN/MAXNM and directed rounding.James Molloy2014-09-052-0/+102
| | | | | | | | This patch adds support for the 32bit numeric max/min and directed round-to-integral NEON intrinsics that were added as part of v8, along with unit tests. Patch by Graham Hunter! llvm-svn: 217242
* Mark ms-inline-asm as xfail on ARMRenato Golin2014-09-051-0/+1
| | | | llvm-svn: 217241
* clang/test/CXX/drs/dr5xx.cpp: Fix up assumption of thiscall. It affects not ↵NAKAMURA Takumi2014-09-051-2/+2
| | | | | | | | x64 but x86. Note, i686-cygwin doesn't use thiscall. llvm-svn: 217234
* Remove suppression of dr547 test and instead test that deduction succeeds if weRichard Smith2014-09-051-6/+14
| | | | | | | | use __thiscall. (This doesn't actually work for MSVC; they don't allow the __thiscall qualifier here, but it's sufficient to demonstrate that we do implement the intent of the DR.) llvm-svn: 217213
* clang/test/CXX/drs/dr5xx.cpp: Suppress dr547 also for MinGWHans Wennborg2014-09-041-1/+2
| | | | | | This is a follow-up to r216841. llvm-svn: 217204
* Stop double visiting some expressions during self reference checking.Richard Trieu2014-09-041-0/+6
| | | | | | | | Originally, self reference checking made a double pass over some expressions to handle reference type checking. Now, allow HandleValue to also check reference types, and fallback to Visit for unhandled expressions. llvm-svn: 217203
* Don't allow inline asm statements to reference parameters in naked functionsHans Wennborg2014-09-042-0/+16
| | | | | | Differential Revision: http://reviews.llvm.org/D5183 llvm-svn: 217200
* Don't allow non-ASM statements in naked functionsHans Wennborg2014-09-041-1/+9
| | | | | | | | | | Naked functions don't have prologues or epilogues, so doing codegen for anything other than inline assembly would be completely hit or miss. Differential Revision: http://reviews.llvm.org/D5183 llvm-svn: 217199
* Don't emit prologues or epilogues for naked functions (PR18791, PR20028)Hans Wennborg2014-09-041-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | For naked functions with parameters, Clang would still emit stores in the prologue that would clobber the stack, because LLVM doesn't set up a stack frame. (This shows up in -O0 compiles, because the stores are optimized away otherwise.) For example: __attribute__((naked)) int f(int x) { asm("movl $42, %eax"); asm("retl"); } Would result in: _Z1fi: movl 12(%esp), %eax movl %eax, (%esp) <--- Oops. movl $42, %eax retl Differential Revision: http://reviews.llvm.org/D5183 llvm-svn: 217198
* PR20844: If we fail to list-initialize a reference, map to the referenced typeRichard Smith2014-09-043-8/+15
| | | | | | | | | before retrying the initialization to produce diagnostics. Otherwise, we may fail to produce any diagnostics, and silently produce invalid AST in a -Asserts build. Also add a note to this codepath to make it more clear why we were trying to create a temporary. llvm-svn: 217197
* MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)Hans Wennborg2014-09-041-0/+12
| | | | llvm-svn: 217196
* MS format strings: support the 'w' length modifier (PR20808)Hans Wennborg2014-09-041-13/+54
| | | | llvm-svn: 217195
* Add triple to ms-inline-asm-return.cpp testReid Kleckner2014-09-041-1/+1
| | | | llvm-svn: 217192
* MS inline asm: Allow __asm blocks to set a return valueReid Kleckner2014-09-042-5/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | If control falls off the end of a function after an __asm block, MSVC assumes that the inline assembly filled the EAX and possibly EDX registers with an appropriate return value. This functionality is used in inline functions returning 64-bit integers in system headers, so we need some amount of compatibility. This is implemented in Clang by adding extra output constraints to every inline asm block, and storing the resulting output registers into the return value slot. If we see an asm block somewhere in the function body, we emit a normal epilogue instead of marking the end of the function with a return type unreachable. Normal returns in functions not using this functionality will overwrite the return value slot, and in most cases LLVM should be able to eliminate the dead stores. Fixes PR17201. Reviewed By: majnemer Differential Revision: http://reviews.llvm.org/D5177 llvm-svn: 217187
* MS inline asm: Add a test for xgetbv clobbersReid Kleckner2014-09-041-0/+6
| | | | llvm-svn: 217174
* [mips] Mark aggregates returned in registers with the 'inreg' attribute.Daniel Sanders2014-09-042-6/+6
| | | | | | | | | | | | | | | | | | Summary: This allows us to easily find them in the backend after the aggregates have been lowered to other types. This is important on big-endian targets using the N32/N64 ABI's since these ABI's must shift small structures into the upper bits of the register. Reviewers: atanasyan Reviewed By: atanasyan Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5005 llvm-svn: 217160
OpenPOWER on IntegriCloud