summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [Parser] Only correct delayed typos when neededErik Pilkington2016-06-131-0/+8
| | | | | | | | | ActOnBinOp corrects delayed typos when in C mode; don't correct them in that case. Fixes PR26700. Differential Revision: http://reviews.llvm.org/D20490 llvm-svn: 272587
* Warn when taking address of a packed memberRoger Ferrer Ibanez2016-06-131-0/+126
| | | | | | | | | | | | | | | | | This patch implements PR#22821. Taking the address of a packed member is dangerous since the reduced alignment of the pointee is lost. This can lead to memory alignment faults in some architectures if the pointer value is dereferenced. This change adds a new warning to clang emitted when taking the address of a packed member. A packed member is either a field/data member declared as attribute((packed)) or belonging to a struct/class declared as such. The associated flag is -Waddress-of-packed-member Differential Revision: http://reviews.llvm.org/D20561 llvm-svn: 272552
* Revise RenderScript attribute declarationPirama Arumuga Nainar2016-06-101-3/+7
| | | | | | | | | | | | | | | | Summary: Address post-patch comments to r272342. - Rename the 'kernel' attribute's name - Idiomatically restrict the attribute to the 'RenderScript' LangOpt. Reviewers: aaron.ballman, rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21240 llvm-svn: 272438
* RenderScript support in the FrontendPirama Arumuga Nainar2016-06-091-0/+20
| | | | | | | | | | | | | | | | | | | | | Summary: Create a new Frontend LangOpt to specify the renderscript language. It is enabled by the "-x renderscript" option from the driver. Add a "kernel" function attribute only for RenderScript (an "ignored attribute" warning is generated otherwise). Make the NativeHalfType and NativeHalfArgsAndReturns LangOpts be implied by the RenderScript LangOpt. Reviewers: rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21198 llvm-svn: 272342
* [ARM] Add load/store co-processor intrinsics.Ranjeet Singh2016-05-311-0/+32
| | | | | | Differential Revision: http://reviews.llvm.org/D20563 llvm-svn: 271275
* [MSVC] Support for __unaligned qualifier in functionsAndrey Bokhanko2016-05-261-0/+2
| | | | | | | | | | | | | | | This implements support for MS-specific __unaligned qualifier in functions and makes the following test case both compile and mangle correctly: struct S { void f() __unaligned; }; void S::f() __unaligned { } Differential Revision: http://reviews.llvm.org/D20437 llvm-svn: 270834
* [ms][dll] #26935 Defining a dllimport function should cause it to be exportedDenis Zobnin2016-05-251-14/+52
| | | | | | | | | | | | | | | | | | | If we have some function with dllimport attribute and then we have the function definition in the same module but without dllimport attribute we should add dllexport attribute to this function definition. The same should be done for variables. Example: struct __declspec(dllimport) C3 { ~C3(); }; C3::~C3() {;} // we should export this definition. Patch by Andrew V. Tischenko Differential revision: http://reviews.llvm.org/D18953 llvm-svn: 270686
* [ARM] Fix cdp intrinsicRanjeet Singh2016-05-191-0/+12
| | | | | | | | | | | - Fixed cdp intrinsic to only accept compile time constant values previously you could pass in a variable to the builtin which would result in illegal llvm assembly output Differential Revision: http://reviews.llvm.org/D20394 llvm-svn: 270058
* Fix line numbers in calling convention testReid Kleckner2016-05-171-9/+9
| | | | llvm-svn: 269787
* Fix calling convention testReid Kleckner2016-05-171-3/+0
| | | | llvm-svn: 269781
* [PS4] Change the names of some "environmental" things to what ourPaul Robinson2016-05-162-9/+9
| | | | | | | | licensees actually see in the toolchain we deliver to them. This will reduce the set of local patches we have to maintain. The triple is not changing. (The term ORBIS is an internal code name for PS4.) llvm-svn: 269671
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-113-3/+11
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367 and PR27666. Differential Revision: http://reviews.llvm.org/D20103 llvm-svn: 269220
* Relax -Wcalling-convention-cast when casting to the default convention (cdecl)Reid Kleckner2016-05-111-0/+9
| | | | llvm-svn: 269214
* Disable -Wcast-calling-convention by default (follow-up to r269116)Hans Wennborg2016-05-111-8/+11
| | | | llvm-svn: 269148
* Wildcard away paths in fixit CHECKs in my last testcaseReid Kleckner2016-05-101-9/+9
| | | | | | Oops. :( llvm-svn: 269118
* Add -Wcast-calling-convention to warn when casting away calling conventionsReid Kleckner2016-05-101-0/+54
| | | | | | | | | | | | | | | | | | | | | | Summary: This only warns on casts of the address of a function defined in the current TU. In this case, the fix is likely to be local and the warning useful. Here are some things we could experiment with in the future: - Fire on declarations as well as definitions - Limit the warning to non-void function prototypes - Limit the warning to mismatches of caller and callee cleanup CCs This warning is currently off by default while we study its usefulness. Reviewers: thakis, rtrieu Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17348 llvm-svn: 269116
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-093-9/+56
| | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. llvm-svn: 268898
* Availability: set location when creating attribute for tvos, watchos.Manman Ren2016-05-061-0/+6
| | | | | | | | | | | | When inferring availability attributes for tvos, watchos from ios, we use the same source location and set the implicit bit to true. So when emitting diagnostics on inferred attributes, we have a source location. rdar://25893544 llvm-svn: 268793
* Availability: attach the note to the declaration with the attributes.Manman Ren2016-05-061-0/+11
| | | | | | | | | | | | | Sometimes, the declaration we found has inherited availability attributes, attaching the note to it does not tell us where the availability attributes are in the source. Go through the redecl chain to find the declaration with actual availability attributes. rdar://25221771 llvm-svn: 268786
* Revert r268727, it caused PR27666.Nico Weber2016-05-063-11/+3
| | | | llvm-svn: 268736
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-063-3/+11
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367. Differential Revision: http://reviews.llvm.org/D19654 llvm-svn: 268727
* Add the Pure attribute to C99 builtin functions from ctype.h. This is a ↵Aaron Ballman2016-05-043-2/+132
| | | | | | | | corrected version of r266199 with test case fixes. Patch by Taewook Oh. llvm-svn: 268553
* 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
OpenPOWER on IntegriCloud