summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Allow register variables in naked functions.Nikola Smiljanic2016-09-131-0/+18
| | | | llvm-svn: 281298
* [ms] Add support for parsing uuid as a Microsoft attribute.Nico Weber2016-09-031-0/+2
| | | | | | | | | | | | | | | | | Some Windows SDK classes, for example Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling attributes: [uuid("....")] class IBufferByteAccess {}; To be able to use __uuidof() to grab the uuid off these types, clang needs to support uuid as a Microsoft attribute. There was already code to skip Microsoft attributes, extend that to look for uuid and parse it. Use the new "Microsoft" attribute type added in r280575 (and r280574, r280576) for this. Final part of https://reviews.llvm.org/D23895 llvm-svn: 280578
* [Sema] Relax overloading restrictions in C.George Burgess IV2016-09-022-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows us to perform incompatible pointer conversions when resolving overloads in C. So, the following code will no longer fail to compile (though it will still emit warnings, assuming the user hasn't opted out of them): ``` void foo(char *) __attribute__((overloadable)); void foo(int) __attribute__((overloadable)); void callFoo() { unsigned char bar[128]; foo(bar); // selects the char* overload. } ``` These conversions are ranked below all others, so: A. Any other viable conversion will win out B. If we had another incompatible pointer conversion in the example above (e.g. `void foo(int *)`), we would complain about an ambiguity. Differential Revision: https://reviews.llvm.org/D24113 llvm-svn: 280553
* Allow a C11 generic selection expression to select a function with the ↵Aaron Ballman2016-09-021-1/+9
| | | | | | overloadable attribute as the result expression without crashing. This fixes PR30201. llvm-svn: 280483
* [Sema][Comments] Add support for TypeAliasTemplateBruno Cardoso Lopes2016-08-251-0/+32
| | | | | | | | | | | | | | | | Emit proper diagnostics when -Wdocumentation is used with constructs such as: template<typename T> using fn = int(T aaa, int ccc); Previously clang wouldn't recognize the function and complain with 'comment that is not attached to a function declaration'. Differential Revision: https://reviews.llvm.org/D23860 rdar://problem/27300695 llvm-svn: 279754
* [Sema][Comments] Support @param with c++ 'using' keywordBruno Cardoso Lopes2016-08-241-0/+63
| | | | | | | | | | | | | Give appropriate warnings with -Wdocumentation for @param comments that refer to function aliases defined with 'using'. Very similar to typedef's behavior. This does not add support for TypeAliasTemplateDecl yet. Differential Revision: https://reviews.llvm.org/D23783 rdar://problem/27300695 llvm-svn: 279662
* [Sema] Don't crash on scanf on forward-declared enums.Benjamin Kramer2016-08-201-0/+16
| | | | | | | | This is valid in GNU C, which allows pointers to incomplete enums. GCC just pretends that the underlying type is 'int' in those cases, follow that behavior. llvm-svn: 279374
* [MS] Silence -Wextern-init on const selectany variablesReid Kleckner2016-08-181-0/+8
| | | | | | | | | | | | In C, 'extern' is typically used to avoid tentative definitions when declaring variables in headers, but adding an intializer makes it a defintion. This is somewhat confusing, so GCC and Clang both warn on it. In C++, 'extern' is often used to give implictly static 'const' variables external linkage, so don't warn in that case. If selectany is present, this might be header code intended for C and C++ inclusion, so apply the C++ rules. llvm-svn: 279116
* Add missing testsRoger Ferrer Ibanez2016-08-172-0/+189
| | | | | | | | Change r278483 was missing the tests Differential Revision: https://reviews.llvm.org/D20561 llvm-svn: 278908
* [ObjC] Warn on unguarded use of partial declarationErik Pilkington2016-08-161-1/+1
| | | | | | | | | | | | | | This commit adds a traversal of the AST after Sema of a function that diagnoses unguarded references to declarations that are partially available (based on availability attributes). This traversal is only done when we would otherwise emit -Wpartial-availability. This commit is part of a feature I proposed here: http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html Differential revision: https://reviews.llvm.org/D23003 llvm-svn: 278826
* Left shifts of negative values are defined if -fwrapv is setJames Molloy2016-08-161-0/+9
| | | | | | | This means we shouldn't emit ubsan detection code or warn. Fixes PR25552. llvm-svn: 278786
* Fix For pr28288 - Error message in shift of vector valuesAndrey Bokhanko2016-08-121-0/+11
| | | | | | | | | | This fixes an error in type checking of shift of vector values. Patch by Vladimir Yakovlev. Differential Revision: https://reviews.llvm.org/D21678 llvm-svn: 278501
* [Sema] Fix a crash on variadic enable_if functions.George Burgess IV2016-08-121-0/+21
| | | | | | | | | | | | | Currently, when trying to evaluate an enable_if condition, we try to evaluate all arguments a user passes to a function. Given that we can't use variadic arguments from said condition anyway, not converting them is a reasonable thing to do. So, this patch makes us ignore any varargs when attempting to check an enable_if condition. We'd crash because, in order to convert an argument, we need its ParmVarDecl. Variadic arguments don't have ParmVarDecls. llvm-svn: 278471
* Revert "[Attr] Add support for the `ms_hook_prologue` attribute."Charles Davis2016-08-082-28/+0
| | | | | | | This reverts commit r278050. It depends on r278048, which will be reverted. llvm-svn: 278052
* [Attr] Add support for the `ms_hook_prologue` attribute.Charles Davis2016-08-082-0/+28
| | | | | | | | | | | | | | | | | | | | | | | Summary: Based on a patch by Michael Mueller. This attribute specifies that a function can be hooked or patched. This mechanism was originally devised by Microsoft for hotpatching their binaries (which they're constantly updating to stay ahead of crackers, script kiddies, and other ne'er-do-wells on the Internet), but it's now commonly abused by Windows programs that want to hook API functions. It is for this reason that this attribute was added to GCC--hence the name, `ms_hook_prologue`. Depends on D19908. Reviewers: rnk, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D19909 llvm-svn: 278050
* 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
OpenPOWER on IntegriCloud