summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Improve test coverage of -Wdouble-promotionRobert Lougher2016-04-291-1/+41
| | | | | | | | | | This patch adds coverage for additional cases where implicit conversion can occur (assignment and return). It also adds tests for some cases where a warning should occur but none is produced. These are marked as FIXME. Differential Revision: http://reviews.llvm.org/D16298 llvm-svn: 268075
* Add a Subjects line to NoDebugAttr [NFC].Paul Robinson2016-04-291-1/+1
| | | | | | | | | | | The 'nodebug' attribute had hand-coded constraints; replace those with a Subjects line in Attr.td. Also add a missing test to verify the attribute is okay on an Objective-C method. Differential Revision: http://reviews.llvm.org/D19689 llvm-svn: 268065
* [ARM] Guard the declarations of f16 to f32 vcvt intrinsics in arm_neon.h by ↵Silviu Baranga2016-04-291-0/+11
| | | | | | | | | | | | | | | | | | | testing __ARM_FP Summary: Conversions between float and half are only available when the taraget has the half-precision extension. Guard these intrinsics so that they don't cause crashes in the backend. Fixes PR27550. Reviewers: rengolin, t.p.northover Subscribers: cfe-commits, aemerson, t.p.northover, rengolin Differential Revision: http://reviews.llvm.org/D19665 llvm-svn: 268047
* PR27216: Only define __ARM_FEATURE_FMA when the target has VFPv4Silviu Baranga2016-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: According to the ACLE spec, "__ARM_FEATURE_FMA is defined to 1 if the hardware floating-point architecture supports fused floating-point multiply-accumulate". This changes clang's behaviour from emitting this macro for v7-A and v7-R cores to only emitting it when the target has VFPv4 (and therefore support for the floating point multiply-accumulate instruction). Fixes PR27216 Reviewers: t.p.northover, rengolin Subscribers: aemerson, rengolin, cfe-commits Differential Revision: http://reviews.llvm.org/D18963 llvm-svn: 267869
* Set the default C standard to C99 when targeting the PS4.Sunil Srivastava2016-04-272-1/+18
| | | | | | | | Patch by Douglas Yung! Differential Revision: http://reviews.llvm.org/D19003 llvm-svn: 267772
* Check 'r' and 'y specifiers of freebsd_kernel_printf format strings on PS4Sunil Srivastava2016-04-261-1/+8
| | | | | | This is an addendum to r229921. llvm-svn: 267625
* Improve diagnostic checking for va_start to also warn on other instances of ↵Aaron Ballman2016-04-243-14/+18
| | | | | | | | undefined behavior, such as a parameter declared with the register keyword in C, or a parameter of a type that undergoes default argument promotion. This helps cover some more of the CERT secure coding rule EXP58-CPP. Pass an object of the correct type to va_start (https://www.securecoding.cert.org/confluence/display/cplusplus/EXP58-CPP.+Pass+an+object+of+the+correct+type+to+va_start). llvm-svn: 267338
* Clarifying the wording of this diagnostic; it confused parameter and argument.Aaron Ballman2016-04-182-7/+7
| | | | llvm-svn: 266644
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-152-44/+8
| | | | | | | | | | Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). llvm-svn: 266460
* Revert r266415, it broke parsing SDK headers (PR27367).Nico Weber2016-04-153-11/+3
| | | | llvm-svn: 266431
* [MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifierAndrey Bokhanko2016-04-153-3/+11
| | | | | | | | | | | This patch implements __unaligned as a type qualifier; before that, it was modeled as an attribute. Proper mangling of __unaligned is implemented as well. Some OpenCL code/tests are tangenially affected, as they relied on existing number and sizes of type qualifiers. Differential Revision: http://reviews.llvm.org/D18596 llvm-svn: 266415
* In vector comparisons, handle scalar LHS just as we handle scalar RHSReid Kleckner2016-04-141-1/+6
| | | | | | | | | | | | Summary: Fixes PR27258 Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19123 llvm-svn: 266366
* AArch64: allow 64-bit access to sysregs.Tim Northover2016-04-131-2/+2
| | | | | | | | Although all the registers are actually 32-bits, I think we have to assume the high 32-bits could be RES0 (the ARM ARM is unclear). If so, reading as a 32-bit register can require extra zero extension operations. llvm-svn: 266212
* Reverting r266199; it causes build bot failures.Aaron Ballman2016-04-132-67/+2
| | | | | | | http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/3255 http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3517 llvm-svn: 266201
* Add functions declared in ctype.h to builtin function database. All ↵Aaron Ballman2016-04-132-2/+67
| | | | | | | | functions are annotated with nothrow and pure attribute, which enables better optimization. Patch by Taewook Oh. llvm-svn: 266199
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-132-8/+44
| | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. llvm-svn: 266186
* Adjust tests to have consistent integer sizes.Richard Trieu2016-04-111-2/+7
| | | | | | | Add a triple to the run lines so that integers will the same sizes across runs. Also add a compile time check to ensure the assumptions about sizes are met. llvm-svn: 265991
* Don't clutter the test directory with temporary IR files.Benjamin Kramer2016-04-111-2/+2
| | | | | | -emit-llvm emits a file, -emit-llvm-only doesn't. llvm-svn: 265926
* [GCC] Attribute ifunc support in clangDmitry Polukhin2016-04-112-1/+44
| | | | | | | | | | | This patch add support for GCC attribute((ifunc("resolver"))) for targets that use ELF as object file format. In general ifunc is a special kind of function alias with type @gnu_indirect_function. LLVM patch http://reviews.llvm.org/D15525 Differential Revision: http://reviews.llvm.org/D15524 llvm-svn: 265917
* [Sema] Fix PR27122: ICE with enable_if+ill-formed call.George Burgess IV2016-03-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | In some cases, when we encounter a direct function call with an incorrect number of arguments, we'll emit a diagnostic, and pretend that the call to the function was valid. For example, in C: int foo(); int a = foo(1); Prior to this patch, we'd get an ICE if foo had an enable_if attribute, because CheckEnableIf assumes that the number of arguments it gets passed is valid for the function it's passed. Now, we check that the number of args looks valid prior to checking enable_if conditions. This fix was not done inside of CheckEnableIf because the problem presently can only occur in one caller of CheckEnableIf (ActOnCallExpr). Additionally, checking inside of CheckEnableIf would make us emit multiple diagnostics for the same error (one "enable_if failed", one "you gave this function the wrong number of arguments"), which seems worse than just complaining about the latter. llvm-svn: 264975
* Fix deduction of __atomic_load's parameter types.Eric Fiselier2016-03-301-1/+4
| | | | | | | | | | | | | | Summary: __atomic_load's allows it's first argument to be a pointer to a const type. However the second argument is an output parameter and must be a pointer to non-const. This patch fixes the signature of __atomic_load generated by clang so that it respects the above requirements. Reviewers: rsmith, majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13420 llvm-svn: 264967
* [Sema] Attempt to fix tests for utf-8 invalid format string specifiersBruno Cardoso Lopes2016-03-292-16/+0
| | | | | | | | | | Followup from r264752. Attempt to appease buildbots: http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2882 http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2619 llvm-svn: 264765
* [Sema] Handle UTF-8 invalid format string specifiersBruno Cardoso Lopes2016-03-292-0/+16
| | | | | | | | | | | | | | | | | Improve invalid format string specifier handling by printing out invalid specifiers characters with \x, \u and \U. Previously clang would print gargabe whenever the character is unprintable. Example, before: NSLog(@"%\u25B9"); => warning: invalid conversion specifier ' [-Wformat-invalid-specifier] after: NSLog(@"%\u25B9"); => warning: invalid conversion specifier '\u25b9' [-Wformat-invalid-specifier] Differential Revision: http://reviews.llvm.org/D18296 rdar://problem/24672159 llvm-svn: 264752
* [Sema] Allow implicit conversions of &overloaded_fn in C.George Burgess IV2016-03-232-3/+26
| | | | | | | | | | | | | | | | | | | | | | | Also includes a minor ``enable_if`` docs update. Currently, our address-of overload machinery will only allow implicit conversions of overloaded functions to void* in C. For example: ``` void f(int) __attribute__((overloadable)); void f(double) __attribute__((overloadable, enable_if(0, ""))); void *fp = f; // OK. This is C and the target is void*. void (*fp2)(void) = f; // Error. This is C, but the target isn't void*. ``` This patch makes the assignment of `fp2` select the `f(int)` overload, rather than emitting an error (N.B. you'll still get a warning about the `fp2` assignment if you use -Wincompatible-pointer-types). Differential Revision: http://reviews.llvm.org/D13704 llvm-svn: 264132
* Fix printing of anonymous struct typedefs.Steven Watanabe2016-03-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | clang -cc1 -ast-print put the struct definition in the wrong place, like this: struct {} typedef S; The reason that this happens is that the printing code first prints the struct definition, and then tells the next declaration to leave out the type. This behavior is correct for simple variable declarations, but fails for typedefs (or extern, mutable, etc). The patch address this problem by skipping the struct declaration when we first see it, and then telling the first subsequent declaration that it needs to print out the full struct definition. Differential Revision: http://reviews.llvm.org/D17285 llvm-svn: 263836
* Add attributes for preserve_mostcc/preserve_allcc calling conventions to the ↵Roman Levenstein2016-03-161-0/+35
| | | | | | | | | | | | | | | C/C++ front-end Till now, preserve_mostcc/preserve_allcc calling convention attributes were only available at the LLVM IR level. This patch adds attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end. The code was mostly written by Juergen Ributzka. I just added support for the AArch64 target and tests. Differential Revision: http://reviews.llvm.org/D18025 llvm-svn: 263647
* Move the fixit for -Wformat-security to a note.Bob Wilson2016-03-152-6/+18
| | | | | | | | r263299 added a fixit for the -Wformat-security warning, but that runs into complications with our guideline that error recovery should be done as-if the fixit had been applied. Putting the fixit on a note avoids that. llvm-svn: 263584
* Add fix-it for format-security warnings.Bob Wilson2016-03-111-0/+6
| | | | llvm-svn: 263299
* Print strict in Availability attribute when it is on.Manman Ren2016-03-101-0/+3
| | | | llvm-svn: 263172
* Sema: Treat 'strict' availability flag like unavailableDuncan P. N. Exon Smith2016-03-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | This is a follow-up to r261512, which made the 'strict' availability attribute flag behave like 'unavailable'. However, that fix was insufficient. The following case would (erroneously) error when the deployment target was older than 10.9: struct __attribute__((availability(macosx,strict,introduced=10.9))) A; __attribute__((availability(macosx,strict,introduced=10.9))) void f(A*); The use of A* in the argument list for f is valid here, since f and A have the same availability. The fix is to return AR_Unavailable from DeclBase::getAvailability instead of AR_NotYetIntroduced. This also reverts the special handling added in r261163, instead relying on the well-tested logic for AR_Unavailable. rdar://problem/23791325 llvm-svn: 262915
* Implement support for [[nodiscard]] in C++1z that is based off existing ↵Aaron Ballman2016-03-071-4/+4
| | | | | | support for warn_unused_result, and treat it as an extension pre-C++1z. This also means extending the existing warn_unused_result attribute so that it can be placed on an enum as well as a class. llvm-svn: 262872
* Semantic analysis for the swiftcall calling convention.John McCall2016-03-031-0/+30
| | | | | | | I've tried to keep the infrastructure behind parameter ABI treatments fairly general. llvm-svn: 262587
* [Sema] PR26444 fix crash when alignment value is >= 2**16David Majnemer2016-03-021-0/+3
| | | | | | | | | | | Sema allows max values up to 2**28, use unsigned instead of unsiged short to hold values that large. Differential Revision: http://reviews.llvm.org/D17248 Patch by Don Hinton! llvm-svn: 262466
* Minor tweak to match the overall style.Sunil Srivastava2016-02-261-2/+2
| | | | llvm-svn: 262042
* Reduce false positives in printf/scanf format checkerAndy Gibbs2016-02-262-2/+31
| | | | | | | | | | | | | | | Summary: The printf/scanf format checker is a little over-zealous in handling the conditional operator. This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for example in the code fragment: printf(minimal ? "%i\n" : "%i: %s\n", code, msg); Reviewers: rtrieu Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15636 llvm-svn: 262025
* Amends r252104 to evaluate the controlling expression in an unevaluated ↵Aaron Ballman2016-02-231-0/+4
| | | | | | context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expression. llvm-svn: 261669
* Add has_feature attribute_availability_with_strict.Manman Ren2016-02-221-0/+4
| | | | | | rdar://23791325 llvm-svn: 261548
* Addressing review comments for r261163.Manman Ren2016-02-221-2/+2
| | | | | | | | | Use "strict" instead of "nopartial". Also make strictly not-introduced share the same diagnostics as Obsolete and Unavailable. rdar://23791325 llvm-svn: 261512
* pr26544: Bitfield layout with pragma pack and attributes "packed" andAlexey Bataev2016-02-191-0/+202
| | | | | | | | | | "aligned", by Vladimir Yakovlev Fix clang/gcc incompatibility of bitfields layout in the presence of pragma packed and attributes aligned and packed. Differential Revision: http://reviews.llvm.org/D17023 llvm-svn: 261321
* Sema: provide an extension warning for enable_ifSaleem Abdulrasool2016-02-181-0/+50
| | | | | | | Clang implements an enable_if attribute as an extension. Hook up `-Wpedantic` to issue an extension usage warning when __enable_if__ is used. llvm-svn: 261192
* Add 'nopartial' qualifier for availability attributes.Manman Ren2016-02-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | An optional nopartial can be placed after the platform name. int bar() __attribute__((availability(macosx,nopartial,introduced=10.12)) When deploying back to a platform version prior to when the declaration was introduced, with 'nopartial', Clang emits an error specifying that the function is not introduced yet; without 'nopartial', the behavior stays the same: the declaration is `weakly linked`. A member is added to the end of AttributeList to save the location of the 'nopartial' keyword. A bool member is added to AvailabilityAttr. The diagnostics for 'nopartial' not-yet-introduced is handled in the same way as we handle unavailable cases. Reviewed by Doug Gregor and Jordan Rose. rdar://23791325 llvm-svn: 261163
* Correct more typos in conditional expressionsDavid Majnemer2016-02-171-0/+2
| | | | | | | We didn't correctly handle some edge cases, causing us to bail out before correcting all the typos. llvm-svn: 261109
* PR26449: Tests for builtin_classify_type fixAndrey Bokhanko2016-02-151-0/+42
| | | | | | | | | In my previous commit (rL260881) I forget to svn add tests. This commit adds them. Differential Revision: http://reviews.llvm.org/D16846 llvm-svn: 260882
* Fix assertion "Chunk.Kind == DeclaratorChunk::Function" with attributed type.Denis Zobnin2016-02-101-0/+12
| | | | | | | | | | This patch is to upgrade FunctionTypeUnwrapper for correct processing of AttributedType. Fixes PR25786. Patch by Alexander Makarov. Differential Revision: http://reviews.llvm.org/D15373 llvm-svn: 260373
* [Sema] Issue a warning for integer overflow in nested struct initializerAkira Hatanaka2016-02-101-0/+20
| | | | | | | | | | | | | | | | | | | | | | | r257357 fixed clang to warn on integer overflow in struct initializers. However, it didn't warn when a struct had a nested initializer. This commit makes changes in Sema::CheckForIntOverflow to handle nested initializers. For example: struct s { struct t { unsigned x; } t; } s = { { .x = 4 * 1024 * 1024 * 1024 } }; rdar://problem/23526454 llvm-svn: 260360
* Exempt char array initializers from -Wconstant-converion.Richard Trieu2016-02-051-0/+2
| | | | | | | | Sometimes, char arrays are used as bit storage, with no difference made between signed and unsigned char. Thus, it is reasonable to use 0 to 255 instead of -128 to 127 and not trigger this warning. llvm-svn: 259947
* Do not honor explicit alignment attribute on fields for PS4.Sunil Srivastava2016-02-051-1/+37
| | | | | | | | This change reverts r257462 for PS4 triple. Differential Revision: http://reviews.llvm.org/D16788 llvm-svn: 259916
* -inline-asm][X86] Add ability to use AVX512 in MS inline asmMarina Yatsina2016-02-031-1/+1
| | | | | | | | | Defined the new AVX512 registers in clang inline asm. Fixed a bug in the MC subtarget info creation during the parsing of MS asm statement - now it receives the actual CPU and target features information. Differential Revision: http://reviews.llvm.org/D16757 llvm-svn: 259639
* ARM: allow both vfma and vfms intrinsics on v7.Tim Northover2016-02-021-0/+12
| | | | | | | | | | | | | | The main purpose here is that vfma/vfms should be symmetric, and they are supported on most v7 cores. The new ArchGuard is suggested by ACLE but prophylactic for us. Almost all CPUs with NEON *will* have vfma, and the few exceptions I know of (e.g. Cortex-A8) are incorrectly modelled by Clang so can't trigger a test. Fortunately, they're getting rarer. But if we ever do support them properly arm_neon.h should now do the right thing. llvm-svn: 259537
* Fix for PR8901: attribute "mode" rejected for enums and dependent types.Denis Zobnin2016-02-022-2/+53
| | | | | | | | | Allow "mode" attribute for enum types, except for vector modes, for compatibility with GCC. Support "mode" attribute with dependent types. Differential Revision: http://reviews.llvm.org/D16219 llvm-svn: 259497
OpenPOWER on IntegriCloud