summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix interaction of max_align_t and modules.Richard Smith2014-10-036-2/+34
| | | | | | | | | When building with modules enabled, we were defining max_align_t as a typedef for a different anonymous struct type each time it was included, resulting in an error if <stddef.h> is not covered by a module map and is included more than once in the same modules-enabled compilation of C11 or C++11 code. llvm-svn: 218931
* Patch to warn if 'override' is missingFariborz Jahanian2014-10-0211-20/+77
| | | | | | | | | | | | for an overriding method if class has at least one 'override' specified on one of its methods. Reviewed by Doug Gregor. rdar://18295240 (I have already checked in all llvm files with missing 'override' methods and Bob Wilson has fixed a TableGen of FastISel so no warnings are expected from build of llvm after this patch. I have already verified this). llvm-svn: 218925
* Revert "DI: LLVM schema change: fold constants into string"Duncan P. N. Exon Smith2014-10-0259-215/+210
| | | | | | This reverts commit r218913 while I investigate some bots. llvm-svn: 218917
* DI: LLVM schema change: fold constants into stringDuncan P. N. Exon Smith2014-10-0259-210/+215
| | | | | | | | | Update debug info testcases for an LLVM metadata schema change to fold metadata constant operands into a single `MDString`. Part of PR17891. llvm-svn: 218913
* Initial support for the align_value attributeHal Finkel2014-10-023-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for the align_value attribute. This attribute is supported by Intel's compiler (versions 14.0+), and several of my HPC users have requested support in Clang. It specifies an alignment assumption on the values to which a pointer points, and is used by numerical libraries to encourage efficient generation of vector code. Of course, we already have an aligned attribute that can specify enhanced alignment for a type, so why is this additional attribute important? The problem is that if you want to specify that an input array of T is, say, 64-byte aligned, you could try this: typedef double aligned_double attribute((aligned(64))); void foo(aligned_double *P) { double x = P[0]; // This is fine. double y = P[1]; // What alignment did those doubles have again? } the access here to P[1] causes problems. P was specified as a pointer to type aligned_double, and any object of type aligned_double must be 64-byte aligned. But if P[0] is 64-byte aligned, then P[1] cannot be, and this access causes undefined behavior. Getting round this problem requires a lot of awkward casting and hand-unrolling of loops, all of which is bad. With the align_value attribute, we can accomplish what we'd like in a well defined way: typedef double *aligned_double_ptr attribute((align_value(64))); void foo(aligned_double_ptr P) { double x = P[0]; // This is fine. double y = P[1]; // This is fine too. } This attribute does not create a new type (and so it not part of the type system), and so will only "propagate" through templates, auto, etc. by optimizer deduction after inlining. This seems consistent with Intel's implementation (thanks to Alexey for confirming the various Intel-compiler behaviors). As a final note, I would have chosen to call this aligned_value, not align_value, for better naming consistency with the aligned attribute, but I think it would be more useful to users to adopt Intel's name. llvm-svn: 218910
* Add __sync_fetch_and_nand (again)Hal Finkel2014-10-023-2/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to GCC 4.4, __sync_fetch_and_nand was implemented as: { tmp = *ptr; *ptr = ~tmp & value; return tmp; } but this was changed in GCC 4.4 to be: { tmp = *ptr; *ptr = ~(tmp & value); return tmp; } in response to this change, support for sync_fetch_and_nand (and sync_nand_and_fetch) was removed in r99522 in order to avoid miscompiling code depending on the old semantics. However, at this point: 1. Many years have passed, and the amount of code relying on the old semantics is likely smaller. 2. Through the work of many contributors, all LLVM backends have been updated such that "atomicrmw nand" provides the newer GCC 4.4+ semantics (this process was complete July of 2014 (added to the release notes in r212635). 3. The lack of this intrinsic is now a needless impediment to porting codes from GCC to Clang (I've now seen several examples of this). It is true, however, that we still set GNUC_MINOR to 2 (corresponding to GCC 4.2). To compensate for this, and to address the original concern regarding code relying on the old semantics, I've added a warning that specifically details the fact that the semantics have changed and that we provide the newer semantics. Fixes PR8842. llvm-svn: 218905
* Diagnose mixed use of '_' and '.' as versionFariborz Jahanian2014-10-021-0/+5
| | | | | | separators in my previous patch. llvm-svn: 218895
* [x32/NaCl] Check if method pointers straddle an eightbyte to classify HiJan Wen Voung2014-10-022-0/+59
| | | | | | | | | | | | | | | | | | | | Summary: Currently, with struct my_struct { int x; method_ptr y; }; a call to foo(my_struct s) may end up dropping the last 4 bytes of the method pointer for x86_64 NaCl and x32. When checking Has64BitPointers, also check if the method pointer straddles an eightbyte boundary and classify Hi as well as Lo if needed. Test Plan: test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp Reviewers: dschuff, pavel.v.chupin Subscribers: jfb Differential Revision: http://reviews.llvm.org/D5555 llvm-svn: 218889
* Patch to accept '_' in addition to '.' as versionFariborz Jahanian2014-10-021-0/+92
| | | | | | | number separator in "availability" attribute. rdar://18490958 llvm-svn: 218884
* Emit lifetime.start / lifetime.end markers for unnamed temporary objects.Arnaud A. de Grandmaison2014-10-021-0/+290
| | | | | | | This will give more information to the optimizers so that they can reuse stack slots and reduce stack usage. llvm-svn: 218865
* Fix a broken test case.Asiri Rathnayake2014-10-021-2/+2
| | | | | | | | | | Summary: Commit r218863 broke this test case. This patch fixes it by updating the expected output line. Should've been updated with the original patch but for some reason it didn't fail during my local make check. Change-Id: I89ed28b37f67c34d1a5d28a3e47ae33d9a82a98f llvm-svn: 218864
* [ARM] Handle conflicts between -mfpu and -mfloat-abi options.Asiri Rathnayake2014-10-021-2/+113
| | | | | | | | | Summary: This patch implements warnings/downgradable errors for invalid -mfpu, -mfloat-abi option combinations (e.g. -mfpu=none -mfloat-abi=hard). Change-Id: I94fa664e1bc0b5855ad835abd7a50a3e0395632d llvm-svn: 218863
* Reduce the PR20399 test case.David Blaikie2014-10-014-79/+30
| | | | | | | | | I couldn't get something /really/ obvious, and I imagine Richard Smith might be able to provide some text explaining the sequence of steps that's demonstrated by these files - but at least it's a bit simpler now. llvm-svn: 218840
* Test case for my r218780 patch.Fariborz Jahanian2014-10-011-0/+5
| | | | | | | Suggested by Richard Smith. rdar://18508589. llvm-svn: 218830
* Objective-C Modernizer. Patch to remove dangling spaceFariborz Jahanian2014-10-012-11/+48
| | | | | | | before the semicolon wahen modernizing to use NS_ENUM/NS_OPTIONS macros. rdar://18498539 llvm-svn: 218809
* Update CGDebugInfo to the updated API in LLVM.Adrian Prantl2014-10-016-13/+13
| | | | | | | | | | Complex address expressions are no longer part of DIVariable, but rather an extra argument to the debug intrinsics. http://reviews.llvm.org/D4919 rdar://problem/17994491 llvm-svn: 218788
* Reverting r218777 while investigating buildbot breakage.Adrian Prantl2014-10-016-13/+13
| | | | | | "Update CGDebugInfo to the updated API in LLVM." llvm-svn: 218781
* Update CGDebugInfo to the updated API in LLVM.Adrian Prantl2014-10-016-13/+13
| | | | | | | | | | Complex address expressions are no longer part of DIVariable, but rather an extra argument to the debug intrinsics. http://reviews.llvm.org/D4919 rdar://problem/17994491 llvm-svn: 218777
* [ARM] Add support for Cortex-M7, FPv5-SP and FPv5-DPOliver Stannard2014-10-013-0/+27
| | | | | | | | | The Cortex-M7 has 3 options for its FPU: none, FPv5-SP-D16 and FPv5-DP-D16. FPv5 has the same instructions as FP-ARMv8, so it can be modeled using the same target feature, and all double-precision operations are already disabled by the fp-only-sp target features. llvm-svn: 218748
* [OPENMP] Loop collapsing and codegen for 'omp simd' directive.Alexander Musman2014-10-016-1/+501
| | | | | | | | | | | | | This patch implements collapsing of the loops (in particular, in presense of clause 'collapse'). It calculates number of iterations N and expressions nesessary to calculate the nested loops counters values based on new iteration variable (that goes from 0 to N-1) in Sema. It also adds Codegen for 'omp simd', which uses (and tests) this feature. Differential Revision: http://reviews.llvm.org/D5184 llvm-svn: 218743
* Improve -Wuninitialized warnings for fields that are record types.Richard Trieu2014-10-011-0/+93
| | | | | | | Get the record handling code from SelfReferenceChecker into UninitializedFieldVisitor as well as copying the testcases. llvm-svn: 218740
* InstrProf: Avoid repeated linear searches in a hot pathJustin Bogner2014-10-014-39/+43
| | | | | | | | | | | | | | | | | | | | | | When generating coverage regions, we were doing a linear search through the existing regions in order to try to merge related ones. Most of the time this would find what it was looking for in a small number of steps and it wasn't a big deal, but in cases with many regions and few mergeable ones this leads to an absurd compile time regression. This changes the coverage mapping logic to do a single sort and then merge as we go, which is a bit simpler and about 100 times faster. I've also added FIXMEs on a couple of behaviours that seem a little suspect, while keeping them behaving as they were - I'll look into these soon. The test changes here are mostly tedious reorganization, because the ordering of regions we output has become slightly (but not completely) more consistent from the almost completely arbitrary ordering we got before. llvm-svn: 218738
* Update uninitialized tests to ensure that field initialization has theRichard Trieu2014-09-301-29/+40
| | | | | | same coverage as the global checker. llvm-svn: 218720
* Enable both C and C++ modules with -fmodules, by switching -fcxx-modules toRichard Smith2014-09-301-2/+4
| | | | | | | | | | | | | | | | | being on by default. -fno-cxx-modules can still be used to enable C modules but not C++ modules, but C++ modules is not significantly less stable than C modules any more. Also remove some of the scare words from the modules documentation. We're certainly not going to remove modules support (though we might change the interface), and it works well enough to bootstrap and build lots of non-trivial code. Note that this does not represent a commitment to the current interface nor implementation, and we still intend to follow whatever direction the C and C++ committees take regarding modules support. llvm-svn: 218717
* Update -Wuninitialized to be stricter on CK_NoOp casts.Richard Trieu2014-09-301-0/+16
| | | | llvm-svn: 218715
* Avoid a crash after loading an #undef'd macro in code completionBen Langmuir2014-09-303-0/+12
| | | | | | | | | | | In code-completion, don't assume there is a MacroInfo for everything, since we aren't serializing the def corresponding to a later #undef in the same module. Also setup the HadMacro bit correctly for undefs to avoid an assertion failure. rdar://18416901 llvm-svn: 218694
* CUDA: mark the target of implicit intrinsics properlyEli Bendersky2014-09-301-0/+10
| | | | | | | | | | | | | r218624 implemented target inference for implicit special members. However, other entities can be implicit - for example intrinsics. These can not have inference running on them, so they should be marked host device as before. This is the safest and most flexible setting, since by construction these functions don't invoke anything, and we'd like them to be invokable from both host and device code. LLVM's intrinsics definitions (where these intrinsics come from in the case of CUDA/NVPTX) have no notion of target, so both host and device intrinsics can be supported this way. llvm-svn: 218688
* Make sure aggregates are properly alligned on MSP430.Job Noorman2014-09-301-1/+1
| | | | llvm-svn: 218666
* MS ABI: Correct layout for empty recordsDavid Majnemer2014-09-302-0/+66
| | | | | | | | Empty records do not always have size equivalent to their alignment. They only do so when their alignment is at least as large as the minimum empty struct size: 1 byte in C++ and 4 bytes in C. llvm-svn: 218661
* [OPENMP] Codegen of the ‘aligned’ clause for the ‘omp simd’ directive.Alexander Musman2014-09-304-6/+21
| | | | | | Differential Revision: http://reviews.llvm.org/D5499 llvm-svn: 218660
* PR20399: Do not assert when adding an implicit member coming from a module atRichard Smith2014-09-306-0/+126
| | | | | | | | writing time. Patch by Vassil Vassilev! llvm-svn: 218651
* clang/test/CodeGenCXX/vararg-non-pod-ms-compat.cpp: Appease -Asserts to skip ↵NAKAMURA Takumi2014-09-291-0/+2
| | | | | | 1st alloca. llvm-svn: 218647
* Try to fix non-asserts CodeGenCXX/vararg-non-pod-ms-compat.cppHans Wennborg2014-09-291-2/+2
| | | | | | | There are two GEP's in the function, and it seems the X64 CHECK was matching the wrong one. llvm-svn: 218645
* Don't trap when passing non-POD arguments to variadic functions in ↵Hans Wennborg2014-09-292-0/+29
| | | | | | | | | | | | | | | | | | MS-compatibility mode Clang warns (treated as error by default, but still ignored in system headers) when passing non-POD arguments to variadic functions, and generates a trap instruction to crash the program if that code is ever run. Unfortunately, MSVC happily generates code for such calls without a warning, and there is code in system headers that use it. This makes Clang not insert the trap instruction when in -fms-compatibility mode, while still generating the warning/error message. Differential Revision: http://reviews.llvm.org/D5492 llvm-svn: 218640
* CUDA: Fix incorrect target inference for implicit members.Eli Bendersky2014-09-293-0/+352
| | | | | | | | | | | | As PR20495 demonstrates, Clang currenlty infers the CUDA target (host/device, etc) for implicit members (constructors, etc.) incorrectly. This causes errors and even assertions in Clang when compiling code (assertions in C++11 mode where implicit move constructors are added into the mix). Fix the problem by inferring the target from the methods the implicit member should call (depending on its base classes and fields). llvm-svn: 218624
* Objective-C [qoi] - provide group name forFariborz Jahanian2014-09-291-2/+1
| | | | | | warn_property_types_are_incompatible. rdar://18487506 llvm-svn: 218621
* Fix bug 20116 - http://llvm.org/bugs/show_bug.cgi?id=20116Alexey Bataev2014-09-291-3/+6
| | | | | | | | Fixes incorrect codegen when devirtualization is aborted due to covariant return types. Differential Revision: http://reviews.llvm.org/D5321 llvm-svn: 218602
* Tests for DR600-640.Richard Smith2014-09-291-0/+347
| | | | llvm-svn: 218591
* Fix "unsupported friend" diagnostic to also appear for friend functions with ↵Richard Smith2014-09-291-4/+4
| | | | | | dependent scopes. llvm-svn: 218590
* Add the tests for __super that I forgot to commit in as part of r218484.Nikola Smiljanic2014-09-291-0/+147
| | | | llvm-svn: 218587
* Run DR tests in C++17 mode too.Richard Smith2014-09-2812-12/+24
| | | | llvm-svn: 218580
* CodeGen: Don't crash when initializing pointer-to-member fields in basesDavid Majnemer2014-09-283-3/+16
| | | | | | | | | | | | | | | | | Clang uses two types to talk about a C++ class, the NonVirtualBaseLLVMType and the LLVMType. Previously, we would allow one of these to be packed and the other not. This is problematic. If both don't agree on a common subset of fields, then routines like getLLVMFieldNo will point to the wrong field. Solve this by copying the 'packed'-ness of the complete type to the non-virtual subobject. For this to work, we need to take into account the non-virtual subobject's size and alignment when we are computing the layout of the complete object. This fixes PR21089. llvm-svn: 218577
* Add back checking for condition of conditional operator for -WuninitializedRichard Trieu2014-09-261-1/+11
| | | | llvm-svn: 218556
* Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.Alexey Samsonov2014-09-261-0/+7
| | | | | | | | | | | It makes no sense to link in sanitizer runtimes in this case: the user probably doesn't want to see any system/toolchain libs in his link if he provides these flags, and the link will most likely fail anyway - as sanitizer runtimes depend on libpthread, libdl, libc etc. Also, see discussion in https://code.google.com/p/address-sanitizer/issues/detail?id=344 llvm-svn: 218541
* Fix an assertion failure trying to emit a trivial destructor in ObjC++Ben Langmuir2014-09-261-0/+50
| | | | | | | | | | | | | | | | | | If a base class declares a destructor, we will add the implicit destructor for the subclass in ActOnFields -> AddImplicitlyDeclaredMembersToClass But in Objective C++, we did not compute whether we have a trivial destructor until after that in CXXRecordDecl::completeDefinition() This was leading to a mismatch between the class, which thought it had no trivial destructor, and the CXXDestructorDecl, which considered itself trivial. It turns out the reason we delayed setting this until completeDefinition() was for a warning that has since been removed as part of -Warc-abi, so we just do it eagerly now. llvm-svn: 218520
* clang/test/CodeGen/builtin-assume-aligned.c: Fix for -Asserts.NAKAMURA Takumi2014-09-261-9/+9
| | | | llvm-svn: 218507
* Small fix for bug 18635.Alexander Musman2014-09-261-0/+22
| | | | | | | | (clang crashed in CodeGen in llvm::Module::getNamedValue on thread_local std::unique_ptr<int>). Differential Revision: http://reviews.llvm.org/D5353 llvm-svn: 218503
* Support the assume_aligned function attributeHal Finkel2014-09-263-0/+103
| | | | | | | | | In addition to __builtin_assume_aligned, GCC also supports an assume_aligned attribute which specifies the alignment (and optional offset) of a function's return value. Here we implement support for the assume_aligned attribute by making use of the @llvm.assume intrinsic. llvm-svn: 218500
* CGBuiltin: Use frem instruction rather than libcall to implement fmodJan Vesely2014-09-261-0/+16
| | | | | | | | AFAICT the semantics of frem match libm's fmod. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Tom Stellard <tom@stellard.net> llvm-svn: 218488
* Fix PR20886 - enforce CUDA target match in method callsEli Bendersky2014-09-251-0/+71
| | | | | | http://reviews.llvm.org/D5298 llvm-svn: 218482
OpenPOWER on IntegriCloud