summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* Substitute type arguments into uses of Objective-C interface members.Douglas Gregor2015-07-076-16/+475
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When messaging a method that was defined in an Objective-C class (or category or extension thereof) that has type parameters, substitute the type arguments for those type parameters. Similarly, substitute into property accesses, instance variables, and other references. This includes general infrastructure for substituting the type arguments associated with an ObjCObject(Pointer)Type into a type referenced within a particular context, handling all of the substitutions required to deal with (e.g.) inheritance involving parameterized classes. In cases where no type arguments are available (e.g., because we're messaging via some unspecialized type, id, etc.), we substitute in the type bounds for the type parameters instead. Example: @interface NSSet<T : id<NSCopying>> : NSObject <NSCopying> - (T)firstObject; @end void f(NSSet<NSString *> *stringSet, NSSet *anySet) { [stringSet firstObject]; // produces NSString* [anySet firstObject]; // produces id<NSCopying> (the bound) } When substituting for the type parameters given an unspecialized context (i.e., no specific type arguments were given), substituting the type bounds unconditionally produces type signatures that are too strong compared to the pre-generics signatures. Instead, use the following rule: - In covariant positions, such as method return types, replace type parameters with “id” or “Class” (the latter only when the type parameter bound is “Class” or qualified class, e.g, “Class<NSCopying>”) - In other positions (e.g., parameter types), replace type parameters with their type bounds. - When a specialized Objective-C object or object pointer type contains a type parameter in its type arguments (e.g., NSArray<T>*, but not NSArray<NSString *> *), replace the entire object/object pointer type with its unspecialized version (e.g., NSArray *). llvm-svn: 241543
* Handle Objective-C type arguments.Douglas Gregor2015-07-077-16/+215
| | | | | | | | | | | | | | | | | | | | | Objective-C type arguments can be provided in angle brackets following an Objective-C interface type. Syntactically, this is the same position as one would provide protocol qualifiers (e.g., id<NSCopying>), so parse both together and let Sema sort out the ambiguous cases. This applies both when parsing types and when parsing the superclass of an Objective-C class, which can now be a specialized type (e.g., NSMutableArray<T> inherits from NSArray<T>). Check Objective-C type arguments against the type parameters of the corresponding class. Verify the length of the type argument list and that each type argument satisfies the corresponding bound. Specializations of parameterized Objective-C classes are represented in the type system as distinct types. Both specialized types (e.g., NSArray<NSString *> *) and unspecialized types (NSArray *) are represented, separately. llvm-svn: 241542
* Parsing, semantic analysis, and AST for Objective-C type parameters.Douglas Gregor2015-07-074-1/+242
| | | | | | | | | | | | | | | | | | | | Produce type parameter declarations for Objective-C type parameters, and attach lists of type parameters to Objective-C classes, categories, forward declarations, and extensions as appropriate. Perform semantic analysis of type bounds for type parameters, both in isolation and across classes/categories/extensions to ensure consistency. Also handle (de-)serialization of Objective-C type parameter lists, along with sundry other things one must do to add a new declaration to Clang. Note that Objective-C type parameters are typedef name declarations, like typedefs and C++11 type aliases, in support of type erasure. Part of rdar://problem/6294649. llvm-svn: 241541
* Debug info: Emit distinct __block_literal_generic types for blocks withAdrian Prantl2015-07-071-5/+22
| | | | | | | | | | different function signatures. (Previously clang would emit all block pointer types with the type of the first block pointer in the compile unit.) rdar://problem/21602473 llvm-svn: 241534
* Revert "Revert 241171, 241187, 241199 (32-bit SEH)."Reid Kleckner2015-07-073-82/+129
| | | | | | | | | | | This reverts commit r241244, but restricts SEH support to Win64. This way, Chromium builds will still fall back on TUs with SEH, and Clang developers can work on this incrementally upstream while patching this small predicate locally. It'll also make it easier to review small fixes. llvm-svn: 241533
* [Driver] Use llvm::Triple methods to handle -EL and -EB.Benjamin Kramer2015-07-061-0/+9
| | | | | | Add a test for ppc64(le), which wasn't handled before. llvm-svn: 241528
* Handle arbitrary whitespace in the target attribute support.Eric Christopher2015-07-061-0/+3
| | | | | | | This allows us to deal a bit more gracefully with inclusions done by macros, token pasting, or just code layout/formatting. llvm-svn: 241525
* Debug info: Don't emit a bogus location for the global block pointer typeAdrian Prantl2015-07-061-1/+3
| | | | | | | | | | | (__block_literal_generic). The arbitrary nature of the location confuses lldb and prevents type uniquing. rdar://problem/21602473 llvm-svn: 241511
* [Sema] Warn when shifting a negative value.Davide Italiano2015-07-062-3/+4
| | | | | | | | | | | | | | | Example: % ./clang -Wshift-negative-value emit.c emit.c:3:14: warning: shifting a negative signed value is undefined [-Wshift-negative-value] int a = -1 << 3; ~~ ^ 1 warning generated. PR: 24026 Differential Revision: http://reviews.llvm.org/D10938 Reviewed by: rsmith llvm-svn: 241478
* Update testcase to reflect new behavior in DIBuilder.Adrian Prantl2015-07-061-2/+1
| | | | llvm-svn: 241471
* Resubmit "Pass down the -flto option to the -cc1 job" (r239481)Teresa Johnson2015-07-062-0/+42
| | | | | | | | | | | | | | | | | | The patch is the same except for the addition of a new test for the issue that required reverting the dependent llvm commit. --Original Commit Message-- Pass down the -flto option to the -cc1 job, and from there into the CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. llvm-svn: 241467
* [OPENMP 4.0] Codegen for 'omp cancel' directive.Alexey Bataev2015-07-061-0/+95
| | | | | | | | | | Add the next codegen for 'omp cancel' directive: if (__kmpc_cancel()) { __kmpc_cancel_barrier(); <exit construct>; } llvm-svn: 241429
* PR24030, PR24033: Consistently check whether a new declaration conflicts withRichard Smith2015-07-062-4/+67
| | | | | | | | | | an existing using shadow declaration if they define entities of the same kind in different namespaces. We'd previously check this consistently if the using-declaration came after the other declaration, but not if it came before. llvm-svn: 241428
* DR1909: Diagnose all invalid cases of a class member sharing its name with ↵Richard Smith2015-07-067-28/+62
| | | | | | the class. llvm-svn: 241425
* When we see something that looks like a constructor with a return type, only ↵Richard Smith2015-07-064-10/+6
| | | | | | issue one error, not two. llvm-svn: 241424
* Mark clang/test/Modules/signal.m as REQUIRES:crash-recovery.NAKAMURA Takumi2015-07-051-1/+1
| | | | llvm-svn: 241421
* clang/test/CodeGen/builtins-ppc-vsx.c: Fix for -Asserts.NAKAMURA Takumi2015-07-051-8/+8
| | | | llvm-svn: 241401
* Add missing builtins to altivec.h for ABI compliance (vol. 2)Nemanja Ivanovic2015-07-051-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D10875 The bulk of the second round of additions to altivec.h. The following interfaces were added: vector double vec_floor(vector double) vector double vec_madd(vector double, vector double, vector double) vector float vec_msub(vector float, vector float, vector float) vector double vec_msub(vector double, vector double, vector double) vector float vec_mul(vector float, vector float) vector double vec_mul(vector double, vector double) vector float vec_nmadd(vector float, vector float, vector float) vector double vec_nmadd(vector double, vector double, vector double) vector double vec_nmsub(vector double, vector double, vector double) vector double vec_nor(vector double, vector double) vector double vec_or(vector double, vector double) vector float vec_rint(vector float) vector double vec_rint(vector double) vector float vec_nearbyint(vector float) vector double vec_nearbyint(vector double) vector float vec_sqrt(vector float) vector double vec_sqrt(vector double) vector double vec_rsqrte(vector double) vector double vec_sel(vector double, vector double, vector unsigned long long) vector double vec_sel(vector double, vector double, vector unsigned long long) vector double vec_sub(vector double, vector double) vector double vec_trunc(vector double) vector double vec_xor(vector double, vector double) vector double vec_xor(vector double, vector bool long long) vector double vec_xor(vector bool long long, vector double) New VSX paths for the following interfaces: vector float vec_madd(vector float, vector float, vector float) vector float vec_nmsub(vector float, vector float, vector float) vector float vec_rsqrte(vector float) vector float vec_trunc(vector float) vector float vec_floor(vector float) llvm-svn: 241399
* [OPENMP 4.0] Fixed codegen for 'cancellation point' construct.Alexey Bataev2015-07-0313-59/+84
| | | | | | | | | | Generate the next code for 'cancellation point': if (__kmpc_cancellationpoint()) { __kmpc_cancel_barrier(); <exit construct>; } llvm-svn: 241336
* clang/test/CodeGenCXX/trap-fnattr.cpp: Tweak to match MS-mangled names.NAKAMURA Takumi2015-07-031-6/+6
| | | | llvm-svn: 241328
* Make corrections to r241314.Akira Hatanaka2015-07-031-4/+4
| | | | | | The return type of a function follows the signext attribute. llvm-svn: 241315
* Fix test case to appease buildbot.Akira Hatanaka2015-07-031-4/+4
| | | | | | | | | Test case trap-fnattr.cpp was failng on clang-ppc64-elf-linux2 because ppc64 sign-extends the i32 return value. This is a follow-up to r241306. llvm-svn: 241314
* Attach attribute "trap-func-name" to call sites of llvm.trap and llvm.debugtrap.Akira Hatanaka2015-07-021-0/+36
| | | | | | | | | | | This is needed to use clang's command line option "-ftrap-function" for LTO and enable changing the trap function name on a per-call-site basis. rdar://problem/21225723 Differential Revision: http://reviews.llvm.org/D10831 llvm-svn: 241306
* This patch adds support for the vector merge even word and vector merge odd wordKit Barton2015-07-021-0/+28
| | | | | | | | | | | | instructions introduced in POWER8. These are the Clang-related changes for http://reviews.llvm.org/D10704 All builtins are added in altivec.h and guarded with the POWER8_VECTOR macro. Phabricator review: http://reviews.llvm.org/D10736 llvm-svn: 241293
* [Modules] Be consistent about finding a module for framework headersBen Langmuir2015-07-028-0/+55
| | | | | | | | | | | | | | | | We use findModuleForHeader() in several places, but in header search we were not calling it when a framework module didn't show up with the expected name, which would then lead to unexpected non-modular includes. Now we will find the module unconditionally for frameworks. For regular frameworks, we use the spelling of the module name from the module map file, and for inferred ones we use the canonical directory name. In the future we might want to lock down framework modules sufficiently that these name mismatches cannot happen. rdar://problem/20465870 llvm-svn: 241258
* [OPENMP 4.0] Initial support for 'omp cancel' construct.Alexey Bataev2015-07-022-0/+130
| | | | | | Implemented parsing/sema analysis + (de)serialization. llvm-svn: 241253
* [MS ABI] nullptr data member ptrs are mangled differently for classes vs fnsDavid Majnemer2015-07-022-2/+17
| | | | | | | | | | | It turns out that nullptr pointers to data members act differently in function templates vs class templates. Class templates use a variable width representation proportional to the number of fields needed to materialize it. Function templates always use a single '0' template parameter. However, using '0' all the time is problematic if the class uses single or multiple inheritance. In those cases, use -1. llvm-svn: 241251
* Specify --target, hopefully fixing non-x86 bots.Peter Collingbourne2015-07-021-4/+4
| | | | llvm-svn: 241248
* Revert 241171, 241187, 241199 (32-bit SEH).Nico Weber2015-07-023-127/+82
| | | | | | | It still doesn't produce quite the right code, test binaries built with this enabled fail some tests. llvm-svn: 241244
* Parse 'technical term' format specifier.Ted Kremenek2015-07-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | Objective-C format strings now support modifier flags that can be attached to a '@' conversion. Currently the only one supported, as of iOS 9 and OS X 10.11, is the new "technical term", denoted by the flag "tt", for example: %[tt]@ instead of just: %@ The 'tt' stands for "technical term", which is used by the string-localization facilities on Darwin to add the appropriate spacing or quotation depending the language locale. Implements <rdar://problem/20374720>. llvm-svn: 241243
* [OPENMP 4.0] Fixed test for 'cancellation point' directive.Alexey Bataev2015-07-021-1/+1
| | | | | | Added explicit target to pch test llvm-svn: 241240
* [OPENMP 4.0] Codegen for 'cancellation point' directive.Alexey Bataev2015-07-021-0/+70
| | | | | | | | | | The next code is generated for this construct: ``` if (__kmpc_cancellationpoint(ident_t *loc, kmp_int32 global_tid, kmp_int32 cncl_kind) != 0) <exit from outer innermost construct>; ``` llvm-svn: 241239
* [OPENMP] Introduced type trait "__builtin_omp_required_simd_align" for ↵Alexey Bataev2015-07-022-0/+94
| | | | | | | | | default simd alignment. Adds type trait "__builtin_omp_required_simd_align" after discussions here http://reviews.llvm.org/D9894 Differential Revision: http://reviews.llvm.org/D10597 llvm-svn: 241237
* Specify -arch:IA32. Should fix hexagon bot.Peter Collingbourne2015-07-021-4/+4
| | | | llvm-svn: 241229
* Driver: add support for linking the UBSan runtime library on Windows.Peter Collingbourne2015-07-022-4/+13
| | | | | | | | | | | | | | On Windows the user may invoke the linker directly, so we might not have an opportunity to add runtime library flags to the linker command line. Instead, instruct the code generator to embed linker directive in the object file that cause the required runtime libraries to be linked. We might also want to do something similar for ASan, but it seems to have its own special complexities which may make this infeasible. Differential Revision: http://reviews.llvm.org/D10862 llvm-svn: 241225
* InstrProf: Pack the coverage mapping structs that we write outJustin Bogner2015-07-021-1/+1
| | | | | | | When we read this data we treat it as unaligned and packed, so we should really be explicit about that when we write it. llvm-svn: 241218
* [modules] Merging support for specializations of a function template. This veryRichard Smith2015-07-012-0/+10
| | | | | | | rarely matters, but can affect whether two dependent types are canonically equivalent. llvm-svn: 241207
* [SEH] Update EmitCapturedLocals to match r241187Reid Kleckner2015-07-011-13/+14
| | | | | | | It was still using frameaddress(1) to get the parent FP, even though it had the value it wanted as a parameter. llvm-svn: 241199
* [SEH] Delete the 32-bit IR lowering for __finally blocks and use x64Reid Kleckner2015-07-012-36/+18
| | | | | | | | | | | | | | | | 32-bit finally funclets are intended to be called both directly from the parent function and indirectly from the EH runtime. Because we aren't contorting LLVM's X86 prologue to match MSVC's, calling the finally block directly passes in a different value of EBP than the one that the runtime provides. We need an adapter thunk to adjust EBP to the expected value. However, WinEHPrepare already has to solve this problem when cleanups are not pre-outlined, so we can go ahead and rely on it rather than duplicating work. Now we only do the llvm.x86.seh.recoverfp dance for 32-bit SEH filter functions. llvm-svn: 241187
* [modules] Don't make out-of-line member specializations of an instantiatedRichard Smith2015-07-012-11/+20
| | | | | | | class template specialization visible just because the class template specialization's definition is visible. llvm-svn: 241182
* [modules] Skip trailing attributes when skipping a class definition during ↵Richard Smith2015-07-011-0/+4
| | | | | | parse-merging. llvm-svn: 241180
* Revert "[DebugInfo] Fix debug info generation for function static variables, ↵David Blaikie2015-07-014-71/+0
| | | | | | | | | | typedefs, and records" Caused PR24008. This reverts commit r241154. llvm-svn: 241177
* [SEH] Add 32-bit lowering for SEH __tryReid Kleckner2015-07-013-79/+141
| | | | | | | | | | | | | | | | | | | This re-lands r236052 and adds support for __exception_code(). In 32-bit SEH, the exception code is not available in eax. It is only available in the filter function, and now we arrange to load it and store it into an escaped variable in the parent frame. As a consequence, we have to disable the "catch i8* null" optimization on 32-bit and always generate a filter function. We can re-enable the optimization if we detect an __except block that doesn't use the exception code, but this probably isn't worth optimizing. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D10852 llvm-svn: 241171
* [DebugInfo] Fix debug info generation for function static variables, ↵Michael Kuperstein2015-07-014-0/+71
| | | | | | | | | | | | | | | typedefs, and records Function static variables, typedefs and records (class, struct or union) declared inside a lexical scope were associated with the function as their parent scope, rather than the lexical scope they are defined or declared in. This fixes PR19238 Patch by: amjad.aboud@intel.com Differential Revision: http://reviews.llvm.org/D9760 llvm-svn: 241154
* [modules] Don't require the 'inline' specifier when merging an inline function;Richard Smith2015-07-011-0/+6
| | | | | | any source of the inline nature is sufficient. llvm-svn: 241146
* [OPENMP 4.0] Initial support for 'omp cancellation point' construct.Alexey Bataev2015-07-012-0/+130
| | | | | | Add parsing and sema analysis for 'omp cancellation point' directive. llvm-svn: 241145
* [modules] Before checking whether the controlling macro of a header is defined,Richard Smith2015-07-015-0/+13
| | | | | | | | | | | update the identifier in case we've imported a definition of the macro (and thus the contents of the header) from a module. Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer makes sense to keep these separate now that the only user of the former also needs the latter. llvm-svn: 241137
* CodeGen: Do not give local-linkage functions externally available linkage, ↵Peter Collingbourne2015-07-011-0/+1
| | | | | | | | | | | | | | | | even temporarily. When an internal-linkage thunk is code gen'd, CodeGenVTables::emitThunk will first be called with ForVTable=true (which incorrectly set the thunk's linkage to available_externally under the Itanium ABI) and later with ForVTable=false (which reset it to internal). Because we will always see a call with ForVTable=false, this incorrect linkage never ended up in the final IR. However, the temporary presence of this linkage caused us to give such functions a comdat as a result of code introduced in r241102. To avoid this, check that the thunk is externally visible before giving it available_externally linkage. llvm-svn: 241136
* Use a stable sort to guarantee target feature ordering in the IREric Christopher2015-07-013-7/+7
| | | | | | | in order to make testing somewhat more feasible. Has the advantage of making it easier to find target features as well. llvm-svn: 241134
* [Sema] Don't crash when deduction fails for decltype(auto)David Majnemer2015-07-011-0/+4
| | | | | | | | | We didn't check the return result of BuildDecltypeType, resulting in us crashing when we tried to grab the canonical version of the type. This fixes PR23995. llvm-svn: 241131
OpenPOWER on IntegriCloud