summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Allow -1 to assign max value to unsigned bitfields.Richard Trieu2016-08-052-1/+13
| | | | | | | | Silence the -Wbitfield-constant-conversion warning for when -1 or other negative values are assigned to unsigned bitfields, provided that the bitfield is wider than the minimum number of bits needed to encode the negative value. llvm-svn: 277796
* [Parser] Fix bug where delayed typo in conditional expression was corrected ↵Erik Pilkington2016-07-291-0/+15
| | | | | | | | | | twice Patch by David Tarditi! Differential revision: https://reviews.llvm.org/D22930 llvm-svn: 277095
* Add .rgba syntax extension to ext_vector_type typesPirama Arumuga Nainar2016-07-221-0/+27
| | | | | | | | | | | | | | | | | | Summary: This patch enables .rgba accessors to ext_vector_type types and adds tests for syntax validation and code generation. 'a' and 'b' can appear either in the point access mode or the numeric access mode (for indices 10 and 11). To disambiguate between the two usages, the accessor type is explicitly passed to relevant methods. Reviewers: rsmith Subscribers: Anastasia, bader, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D20602 llvm-svn: 276455
* [Sema] Handle errors during rewriteBuiltinFunctionDeclDavid Majnemer2016-07-211-1/+4
| | | | | | | | | | rewriteBuiltinFunctionDecl can encounter errors when performing DefaultFunctionArrayLvalueConversion. These errors were not handled which led to a null pointer dereference. This fixes PR28651. llvm-svn: 276352
* [Sema] Compute the nullability of a conditional expression based on theAkira Hatanaka2016-07-201-0/+67
| | | | | | | | | | | | | | nullabilities of its operands. This patch defines a function to compute the nullability of conditional expressions, which enables Sema to precisely detect implicit conversions of nullable conditional expressions to nonnull pointers. rdar://problem/25166556 Differential Revision: https://reviews.llvm.org/D22392 llvm-svn: 276076
* [Sema] Create a separate group for incompatible function pointer warningBruno Cardoso Lopes2016-07-183-2/+16
| | | | | | | | | | | | | Give incompatible function pointer warning its own diagnostic group but still leave it as a subgroup of incompatible-pointer-types. This is in preparation to promote -Wincompatible-function-pointer-types to error on darwin. Differential Revision: https://reviews.llvm.org/D22248 rdar://problem/12907612 llvm-svn: 275907
* Sema: support __declspec(dll*) on ObjC interfacesSaleem Abdulrasool2016-07-152-12/+24
| | | | | | | | | | | Extend the __declspec(dll*) attribute to cover ObjC interfaces. This was requested by Microsoft for their ObjC support. Cover both import and export. This only adds the semantic analysis portion of the support, code-generation still remains outstanding. Add some basic initial documentation on the attributes that were previously empty. Tweak the previous tests to use the relative expected-warnings to make the tests easier to read. llvm-svn: 275610
* C does not have inline variables.Paul Robinson2016-07-141-1/+1
| | | | | | | | Add a few missing tests for related C++ diagnostics. Differential Revision: http://reviews.llvm.org/D22113 llvm-svn: 275493
* Reverting 275417Roger Ferrer Ibanez2016-07-142-186/+0
| | | | | | This change has triggered unexpected failures. llvm-svn: 275462
* Diagnose taking address and reference binding of packed membersRoger Ferrer Ibanez2016-07-142-0/+186
| | | | | | | | | | | | | | | | | | | | | | | 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. Conversions (either implicit or via a valid casting) to pointer types with lower or equal alignment requirements (e.g. void* or char*) silence the warning. This change also adds a new error diagnostic when the user attempts to bind a reference to a packed member, regardless of the alignment. Differential Revision: https://reviews.llvm.org/D20561 llvm-svn: 275417
* Add XRay flags to Clang. We implement two flags to control the XRay behaviour:Aaron Ballman2016-07-132-0/+16
| | | | | | | | | | | -fxray-instrument: enables XRay annotation of IR -fxray-instruction-threshold: configures the threshold for function size (looking at IR instructions), and allow LLVM to decide whether to add the nop sleds later on in the process. Also implements the related xray_always_instrument and xray_never_instrument function attributes. Patch by Dean Michael Berris. llvm-svn: 275330
* AArch64: fix return type of vqmovun_high_*.Tim Northover2016-07-121-0/+7
| | | | | | These should be returning an unsigned quantity. llvm-svn: 275195
* [SemaExpr] Support assignments from vector to scalars with same sizeBruno Cardoso Lopes2016-07-061-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before r266366, clang used to support constructs like: typedef __attribute__((vector_size(8))) double float64x1_t; typedef __attribute__((vector_size(16))) double float64x2_t; float64x1_t vget_low_f64(float64x2_t __p0); double y = 3.0 + vget_low_f64(v); But it would reject: double y = vget_low_f64(v) + 3.0; It also always rejected assignments: double y = vget_low_f64(v); This patch: (a) revivies the behavior of `3.0 + vget_low_f64(v)` prior to r266366, (b) add support for `vget_low_f64(v) + 3.0` and (c) add support for assignments. These vector semantics have never really been tied up but it seems odd that we used to support some binop froms but do not support assignment. If we did support scalar for the purposes of arithmetic, we should probably be able to reinterpret as scalar for the purposes of assignment too. Differential Revision: http://reviews.llvm.org/D21700 rdar://problem/26093791 llvm-svn: 274646
* [Sema] A flexible array member must not be the only named memberDavid Majnemer2016-07-041-0/+6
| | | | | | | | | We didn't correctly detect situations where a flexible array member was the only named member in a record. This fixes PR28407. llvm-svn: 274477
* AvailabilityAttr: we accept "macos" as the platform name.Manman Ren2016-06-283-11/+11
| | | | | | | | | | | | | | We continue accepting "macosx" but canonicalize it to "macos", When emitting diagnostics, we use "macOS" instead of "OS X". The PlatformName in TargetInfo is changed from "macosx" to "macos" so we can directly compare the Platform in AvailabilityAttr with the PlatformName in TargetInfo. rdar://26795172 rdar://26800775 llvm-svn: 274064
* [ExprConstant] Fix PR28314 - crash while evluating objectsize.George Burgess IV2016-06-271-0/+24
| | | | | | | | | | | | | | | | | | | | | This fixes a crash in code like: ``` struct A { struct B b; char c[1]; } int foo(struct A* a) { return __builtin_object_size(a->c, 0); } ``` We wouldn't check whether the structs we were examining were invalid, and getting the layout of an invalid struct is (unsurprisingly) A Bad Thing. With this patch, we'll always return conservatively if we see an invalid struct, since I'm assuming the presence of an invalid struct means that our compilation failed (so having a conservative result isn't such a big deal). llvm-svn: 273911
* Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives aRichard Smith2016-06-251-1/+1
| | | | | | | variable weak discardable linkage and partially-ordered initialization, and is implied for constexpr static data members.) llvm-svn: 273754
* [ARM] Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics.Ranjeet Singh2016-06-171-7/+19
| | | | | | | | | | Reapplying patch in r272777 which was reverted because the llvm patch which added support for generating the mcrr/mcrr2 instructions from the intrinsic was causing an assertion failure. This has now been fixed in llvm. llvm-svn: 272983
* Keep invalid functions as part of the ASTOlivier Goffart2016-06-161-3/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D19764 llvm-svn: 272962
* Allow 'nodebug' on local variables.Paul Robinson2016-06-161-2/+2
| | | | | | | | | Parameters and non-static members of aggregates are still excluded, and probably should remain that way. Differential Revision: http://reviews.llvm.org/D19754 llvm-svn: 272859
* [Sparc] setjmp and longjmp intrinsic support update to add unit tests and ↵Chris Dewhurst2016-06-151-0/+1
| | | | | | | | remove accidentally checked-in code. Related to revision r272782 llvm-svn: 272798
* Reverting r272777 because one of the testsRanjeet Singh2016-06-151-19/+7
| | | | | | | added in the llvm patch is causing an assertion to fail. llvm-svn: 272790
* [ARM] Add mrrc/mrrc2 intrinsics and update existing mcrr/mcrr2 intrinsics.Ranjeet Singh2016-06-151-7/+19
| | | | | | | | | | | | | | Patch adds intrinsics for mrrc/mrrc2. The intrinsics for mrrc/mrrc2 return a single uint64_t to represent two 32 bit values. The mcrr/mcrr2 intrinsic was changed to accept a single uint64_t instead of two 32 bit values as the input for consistency. Differential Revision: http://reviews.llvm.org/D21179 llvm-svn: 272777
* Add a "declared 'nonnull' here" note to warnings where an expression is ↵Nick Lewycky2016-06-151-5/+5
| | | | | | checked against null. llvm-svn: 272755
* Reverting "Warn when taking address of a packed member"Roger Ferrer Ibanez2016-06-141-126/+0
| | | | | | | | This new diagnostic is causing some false positives that have to be addressed. This reverts commit 272552 llvm-svn: 272653
* [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
OpenPOWER on IntegriCloud