summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Add #pragma clang attribute support to the availability attributeAlex Lorenz2017-04-201-1/+1
| | | | | | rdar://31707804 llvm-svn: 300826
* Add #pragma clang attribute support to the external_source_symbol attributeAlex Lorenz2017-04-191-3/+3
| | | | | | | | | | | | | | | | | | | Prior to this commit the external_source_symbol attribute wasn't supported by #pragma clang attribute for the following two reasons: - The Named attribute subject hasn't been supported by TableGen. - There was no way to specify a subject match rule for #pragma clang attribute that could operate on a set of attribute subjects (e.g. the ones that derive from NamedDecl). This commit fixes the two issues and thus adds external_source_symbol support to #pragma clang attribute. rdar://31169028 Differential Revision: https://reviews.llvm.org/D32176 llvm-svn: 300712
* mingw-w64: enable support for __declspec(selectany)Martell Malone2017-04-181-1/+2
| | | | | | | | | | Add selectany as a GCC spelling for mingw-w64 Reviewers: rnk Differential revision: https://reviews.llvm.org/D32083 llvm-svn: 300562
* Add #pragma clang attributeAlex Lorenz2017-04-182-0/+200
| | | | | | | | | | | | | | | | | This is a recommit of r300539 that was reverted in r300543 due to test failures. The original commit message is displayed below: The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 llvm-svn: 300556
* Revert r300539 - Add #pragma clang attributeAlex Lorenz2017-04-182-200/+0
| | | | | | | Some tests fail on the Windows buildbots. I will have to investigate more. This commit reverts r300539, r300540 and r300542. llvm-svn: 300543
* Add #pragma clang attributeAlex Lorenz2017-04-182-0/+200
| | | | | | | | | | | | | | The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 llvm-svn: 300539
* PR32280: Do not crash on nested initializers.Vassil Vassilev2017-04-141-0/+17
| | | | | | Patch by Yuka Takahashi (D31591)! llvm-svn: 300313
* Diagnose attempt to take address of bitfield members in anonymous structs.Richard Smith2017-04-131-1/+2
| | | | | | | | Patch by Jacob Young! Differential Revision: https://reviews.llvm.org/D27263 llvm-svn: 300264
* Moving a C++ test out of Sema and into SemaCXX; NFC.Aaron Ballman2017-04-121-21/+0
| | | | llvm-svn: 300071
* [OpenCL] Map default address space to alloca address spaceYaxun Liu2017-04-112-9/+1
| | | | | | | | | | | | | | For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier is always mapped to target address space 0. As now target private address space is specified by alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout. This change has no impact on targets whose alloca addr space is 0. With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung Differential Revision: https://reviews.llvm.org/D31404 llvm-svn: 299965
* Fix PR13910: Don't warn that __builtin_unreachable() is unreachableAlex Lorenz2017-04-111-0/+37
| | | | | | Differential Revision: https://reviews.llvm.org/D25321 llvm-svn: 299951
* Sema: prevent __declspec(naked) use on x64Saleem Abdulrasool2017-04-072-1/+12
| | | | | | | | | MSDN (https://msdn.microsoft.com/en-us/library/h5w10wxs.aspx) indicates that `__declspec(naked)` is only permitted on x86 and ARM targets. Testing with cl does confirm this behaviour. Provide a warning for use of `__declspec(naked)` on x64. llvm-svn: 299774
* [Sema] Retarget test to a specific platform for consistent datasizesSimon Dardis2017-04-061-1/+1
| | | | | | | | Attempt to satisfy llvm-clang-x86_64-expensive-checks-win by targeting x86_64-apple-darwin10 for Sema/vector-ops.c. The underlying failure is due to datatype differences between platforms. llvm-svn: 299643
* [Sema] Extend GetSignedVectorType to deal with non ExtVector typesSimon Dardis2017-04-061-3/+109
| | | | | | | | | | | | | This improves some error messages which would otherwise refer to ext_vector_type types in contexts where there are no such types. Factored out from D25866 at reviewer's request. Reviewers: bruno Differential Revision: https://reviews.llvm.org/D31667 llvm-svn: 299641
* -Wunreachable-code: 'true' and 'false' should not be treated as configurationAlex Lorenz2017-04-051-0/+10
| | | | | | | | | macros Clang should emit -Wunreachable-code warnings in C mode for code that's unreachable because of a 'false' or '!true' condition. llvm-svn: 299541
* [Sema][X86] Update immediate check for gather/scatter prefetch instructions ↵Craig Topper2017-03-311-1/+1
| | | | | | | | | | to match the _MM_HINT_T0/T1 constant definitions Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or Intel documentation. Interestingly gcc had this same bug on their implementation of the gather/scatter builtins at one point too. Fixes PR32411. llvm-svn: 299233
* Clang changes for alloc_align attribute Erich Keane2017-03-301-0/+19
| | | | | | | | GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to. Differential Revision: https://reviews.llvm.org/D29599 llvm-svn: 299117
* Correct class-template deprecation behavior-REDUXErich Keane2017-03-231-10/+13
| | | | | | | | | | | | | | | | | | Correct class-template deprecation behavior Based on the comment in the test, and my reading of the standard, a deprecated warning should be issued in the following case: template<typename T> [[deprecated]] class Foo{}; Foo<int> f; This was not the case, because the ClassTemplateSpecializationDecl creation did not also copy the deprecated attribute. Note: I did NOT audit the complete set of attributes to see WHICH ones should be copied, so instead I simply copy ONLY the deprecated attribute. Previous DiffRev: https://reviews.llvm.org/D27486, was reverted. This patch fixes the issues brought up here by the reverter: https://reviews.llvm.org/rL298410 Differential Revision: https://reviews.llvm.org/D31245 llvm-svn: 298634
* Revert "Correct class-template deprecation behavior"Martin Bohme2017-03-221-10/+10
| | | | | | | This reverts commit r298410 (which produces incorrect warnings, see comments on https://reviews.llvm.org/rL298410). llvm-svn: 298504
* Revert "iFix Test deprecation behavior in C89 mode as a result of r298410"Martin Bohme2017-03-221-4/+1
| | | | | | | This reverts commit r298433. (Required to revert r298410, see comments there.) llvm-svn: 298503
* Remove the -faltivec alias option and replace it with -maltivec everywhere.Eric Christopher2017-03-212-5/+5
| | | | | | | | | | | The alias was only ever used on darwin and had some issues there, and isn't used in practice much. Also fixes a problem with -mno-altivec not turning off -maltivec. Also add a diagnostic for faltivec/fno-altivec that directs users to use maltivec options and include the altivec.h file explicitly. llvm-svn: 298449
* iFix Test deprecation behavior in C89 mode as a result of r298410Erich Keane2017-03-211-1/+4
| | | | llvm-svn: 298433
* Correct class-template deprecation behaviorErich Keane2017-03-211-10/+10
| | | | | | | | | | | | | Based on the comment in the test, and my reading of the standard, a deprecated warning should be issued in the following case: template<typename T> [[deprecated]] class Foo{}; Foo<int> f; This was not the case, because the ClassTemplateSpecializationDecl creation did not also copy the deprecated attribute. Note: I did NOT audit the complete set of attributes to see WHICH ones should be copied, so instead I simply copy ONLY the deprecated attribute. Differential Revision: https://reviews.llvm.org/D27486 llvm-svn: 298410
* Add support for attribute enum_extensibility.Akira Hatanaka2017-03-211-0/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for a new attribute that will be used to distinguish between extensible and inextensible enums. There are three main purposes of this attribute: 1. Give better control over when enum-related warnings are issued. For example, in the code below, clang will not issue a -Wassign-enum warning if the enum is marked "open": enum __attribute__((enum_extensibility(closed))) EnumClosed { B0 = 1, B1 = 10 }; enum __attribute__((enum_extensibility(open))) EnumOpen { C0 = 1, C1 = 10 }; enum EnumClosed ec = 100; // warning issued enum EnumOpen eo = 100; // no warning 2. Enable code-completion and debugging tools to offer better suggestions. 3. Make it easier for swift's clang importer to determine which swift type an enum should be mapped to. For more details, see the discussion I started on cfe-dev: http://lists.llvm.org/pipermail/cfe-dev/2017-February/052748.html rdar://problem/12764379 rdar://problem/23145650 Differential Revision: https://reviews.llvm.org/D30766 llvm-svn: 298332
* Fix crash with interrupt attribute on ARM.Eli Friedman2017-03-141-0/+5
| | | | | | An indirect call has no associated function declaration. llvm-svn: 297694
* [X86] Add checking of the scale argument to scatter/gather builtinsCraig Topper2017-03-131-0/+14
| | | | | | | | The only valid values for scale immediate of scatter/gather builtins are 1, 2, 4, or 8. This patch enforces this in the frontend otherwise we generate invalid instruction encodings in the backend. Differential Revision: https://reviews.llvm.org/D30875 llvm-svn: 297642
* When diagnosing taking address of packed members skip __unaligned-qualified ↵Roger Ferrer Ibanez2017-03-131-0/+16
| | | | | | | | | | | | expressions Given that we have already explicitly stated in the qualifier that the expression is __unaligned, it makes little sense to diagnose that the address of the packed member may not be aligned. Differential Revision: https://reviews.llvm.org/D30884 llvm-svn: 297620
* Allow the nonnull attribute to be inherited as a parameter in the ↵Aaron Ballman2017-03-121-0/+7
| | | | | | | | redefinition of a function. Fixes PR30828. Patch by Matt Bettinson. llvm-svn: 297592
* [XRay] [clang] Allow logging the first argument of a function call.Dean Michael Berris2017-03-062-0/+18
| | | | | | | | | | | | | | | | Summary: Functions with the "xray_log_args" attribute will tell LLVM to emit a special XRay sled for compiler-rt to copy any call arguments to your logging handler. Reviewers: dberris Reviewed By: dberris Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29704 llvm-svn: 296999
* Introduce an 'external_source_symbol' attribute that describes the originAlex Lorenz2017-03-011-0/+19
| | | | | | | | | | | | | | | | and the nature of a declaration This commit adds an external_source_symbol attribute to Clang. This attribute specifies that a declaration originates from an external source and describes the nature of that source. This attribute will be used to improve IDE features like 'jump-to-definition' for mixed-language projects or project that use auto-generated code. rdar://30423368 Differential Revision: https://reviews.llvm.org/D29819 llvm-svn: 296649
* Allow attributes before union definitionErich Keane2017-02-281-0/+24
| | | | | | | | permits typedef union __attribute__((transparent_union)) {...} Differential Revision: https://reviews.llvm.org/D28266 llvm-svn: 296518
* Fix crash when an incorrect redeclaration only differs in __unaligned ↵Roger Ferrer Ibanez2017-02-241-0/+4
| | | | | | | | | | | type-qualifier Fix an assertion that is hit when a redeclaration with differing types only differs in the unaligned type-qualifier. Differential Revision: https://reviews.llvm.org/D29986 llvm-svn: 296099
* Revert r291477 "[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match ↵Hans Wennborg2017-02-241-0/+4
| | | | | | | | | builtin" It caused PR31864. There is a patch in progress to fix that, but let's revert in the meantime. llvm-svn: 296063
* Process attributes 'ifunc' and 'alias' when checking for redefinitionSerge Pavlov2017-02-182-2/+5
| | | | | | | | | | These attributes effectively turn a non-defining declaration into a definition, so the case when the declaration already has a body must be diagnosed properly. Differential Revision: https://reviews.llvm.org/D30032 llvm-svn: 295541
* [VLA] Fix the test failure on msvc by specifying the triple.Tim Shen2017-02-151-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D24333 llvm-svn: 295127
* [VLA] Handle VLA size expression in a full-expression context.Tim Shen2017-02-141-0/+15
| | | | | | | | | | | | | | | | Summary: Previously the cleanups (e.g. dtor calls) are inserted into the outer scope (e.g. function body scope), instead of it's own scope. After the fix, the cleanups are inserted right after getting the size value. This fixes pr30306. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24333 llvm-svn: 295123
* Revert r294910 and recommit r294861 and r294862 with a target triple to ↵Aaron Ballman2017-02-122-6/+17
| | | | | | hopefully appease the bots. llvm-svn: 294911
* Revert "Attributes on K&R C functions should not cause incompatible..."Renato Golin2017-02-122-11/+0
| | | | | | | | | | | | | | | | ...function type with a redeclaration having the same attribute. Fixing this introduced a secondary problem where we were assuming that K&R functions could not be attributed types when reporting old-style function definitions that are not preceded by a prototype." Also Revert "Hopefully fixes a compile error introduced by r294861." This reverts commit r294862, r294861, as they bork the ARM builds and haven't fix it back. Also, please, short commit titles, long commit decsriptions... llvm-svn: 294910
* Attributes on K&R C functions should not cause incompatible function type ↵Aaron Ballman2017-02-112-0/+11
| | | | | | | | with a redeclaration having the same attribute. Fixing this introduced a secondary problem where we were assuming that K&R functions could not be attributed types when reporting old-style function definitions that are not preceded by a prototype. This patch fixes PR31020. llvm-svn: 294861
* Don't let EvaluationModes dictate whether an invalid base is OKGeorge Burgess IV2017-02-101-0/+15
| | | | | | | | | | | | What we want to actually control this behavior is something more local than an EvalutationMode. Please see the linked revision for more discussion on why/etc. This fixes PR31843. Differential Revision: https://reviews.llvm.org/D29469 llvm-svn: 294800
* [c++1z] Diagnose attempts to use variables with deduced class templateRichard Smith2017-02-101-1/+1
| | | | | | specialization types from within their own initializers. llvm-svn: 294796
* [AVR] Add support for the 'interrupt' and 'naked' attributesDylan McKay2017-02-082-0/+16
| | | | | | | | | | | | | | | | Summary: This teaches clang how to parse and lower the 'interrupt' and 'naked' attributes. This allows interrupt signal handlers to be written. Reviewers: aaron.ballman Subscribers: malcolm.parsons, cfe-commits Differential Revision: https://reviews.llvm.org/D28451 llvm-svn: 294402
* Extend -Wcast-calling-convention to warn on declarations as well as definitionsReid Kleckner2017-01-311-0/+13
| | | | | | | | | My original warning was very conservative and I never revisited the heuristics that were used. This would have caught http://crbug.com/687251 at compile time. llvm-svn: 293677
* Improve fix for PR28739Richard Smith2017-01-311-11/+6
| | | | | | | | | | | | | | | Don't try to map an APSInt addend to an int64_t in pointer arithmetic before bounds-checking it. This gives more consistent behavior (outside C++11, we consistently use 2s complement semantics for both pointer and integer overflow in constant expressions) and fixes some cases where in C++11 we would fail to properly check for out-of-bounds pointer arithmetic (if the 2s complement 64-bit overflow landed us back in-bounds). In passing, also fix some cases where we'd perform possibly-overflowing arithmetic on CharUnits (which have a signed underlying type) during constant expression evaluation. llvm-svn: 293595
* PR28739: Check that integer values fit into 64 bits before extracting them ↵Richard Smith2017-01-301-2/+14
| | | | | | | | | | | | | as 64 bit values for pointer arithmetic. This fixes various ways to tickle an assertion in constant expression evaluation when using __int128. Longer term, we need to figure out what should happen here: either any kind of overflow in offset calculation should result in a non-constant value or we should truncate to 64 bits. In C++11 onwards, we're effectively already checking for overflow because we strictly enforce array bounds checks, but even there some forms of overflow can slip past undetected. llvm-svn: 293568
* Change how we handle diagnose_if attributes.George Burgess IV2017-01-281-3/+3
| | | | | | | | | | | | | This patch changes how we handle argument-dependent `diagnose_if` attributes. In particular, we now check them in the same place that we check for things like passing NULL to Nonnull args, etc. This is basically better in every way than how we were handling them before. :) This fixes PR31638, PR31639, and PR31640. Differential Revision: https://reviews.llvm.org/D28889 llvm-svn: 293360
* [AST Printer] Print attributes on enum constantsJordan Rose2017-01-201-0/+9
| | | | | | | The AST printer was dropping attributes on enumerators (enum constants). Now it's not. llvm-svn: 292571
* [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C modeAlex Lorenz2017-01-191-0/+13
| | | | | | | | rdar://28532840 Differential Revision: https://reviews.llvm.org/D25213 llvm-svn: 292497
* Warn when calling a non interrupt function from an interrupt on ARMJonathan Roelofs2017-01-181-0/+11
| | | | | | | | | | The idea for this originated from a really tricky bug: ISRs on ARM don't automatically save off the VFP regs, so if say, memcpy gets interrupted and the ISR itself calls memcpy, the regs are left clobbered when the ISR is done. https://reviews.llvm.org/D28820 llvm-svn: 292375
* Update the tests to match the typo fix done in r292015Sylvestre Ledru2017-01-141-2/+2
| | | | llvm-svn: 292016
OpenPOWER on IntegriCloud