summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [COFF, ARM64] Fix ABI implementation of struct returnsMandeep Singh Grang2019-05-031-1/+4
| | | | | | | | | | | | | | | | | | Summary: Related llvm patch: D60348. Patch co-authored by Sanjin Sijaric. Reviewers: rnk, efriedma, TomTan, ssijaric, ostannard Reviewed By: efriedma Subscribers: dmajor, richard.townsend.arm, ostannard, javed.absar, kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60349 llvm-svn: 359932
* [Sema][ObjC] Disable -Wunused-parameter for ObjC methodsAkira Hatanaka2019-05-031-2/+0
| | | | | | | | | | The warning isn't very useful when the function is an ObjC method. rdar://problem/41561853 Differential Revision: https://reviews.llvm.org/D61147 llvm-svn: 359864
* Revert "[Attribute/Diagnostics] Print macro if definition is an attribute ↵Leonard Chan2019-05-034-57/+10
| | | | | | | | declaration" This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d. llvm-svn: 359859
* Revert r359814 "[Sema] Emit warning for visibility attribute on ↵Nico Weber2019-05-031-8/+0
| | | | | | | | internal-linkage declaration" See cfe-commits thread for r359814. llvm-svn: 359858
* SemaOverload: Complete candidates before emitting the error, to ensure ↵David Blaikie2019-05-035-173/+269
| | | | | | | | | | | | | | | | | diagnostics emitted (or suppressed) during completion don't interfere with the overload notes Because diagnostics and their notes are not connected at the API level, if the error message for an overload is emitted, then the overload candidates are completed - if a diagnostic is emitted during that work, the notes related to overload candidates would be attached to the latter diagnostic, not the original error. Sort of worse, if the latter diagnostic was disabled, the notes are disabled. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D61357 llvm-svn: 359854
* [Attribute/Diagnostics] Print macro if definition is an attribute declarationLeonard Chan2019-05-024-10/+57
| | | | | | | | | | | | | If an address_space attribute is defined in a macro, print the macro instead when diagnosing a warning or error for incompatible pointers with different address_spaces. We allow this for all attributes (not just address_space), and for multiple attributes declared in the same macro. Differential Revision: https://reviews.llvm.org/D51329 llvm-svn: 359826
* [Sema] Emit warning for visibility attribute on internal-linkage declarationScott Linder2019-05-021-0/+8
| | | | | | | | GCC warns on these cases, but we currently just silently ignore the attribute. Differential Revision: https://reviews.llvm.org/D61097 llvm-svn: 359814
* Do not warn on switches over enums that do not use [[maybe_unused]] enumeratorsDavid Blaikie2019-05-021-0/+3
| | | | | | | | | | PR36231, [dcl.attr.unused]p3 Reviewers: aaron.ballman Differential Revision: https://reviews.llvm.org/D61444 llvm-svn: 359800
* [OpenCL] Fix initialisation of this via pointer.Anastasia Stulova2019-05-021-5/+5
| | | | | | | | | | | | | | | When the expression used to initialise 'this' has a pointer type, check the address space of the pointee type instead of the pointer type to decide whether an address space cast is required. It is the pointee type that carries the address space qualifier. Fixing PR41674. Patch by kpet (Kevin Petit)! Differential Revision: https://reviews.llvm.org/D61319 llvm-svn: 359798
* [OpenCL] Deduce static data members to __global addr space.Anastasia Stulova2019-05-021-2/+4
| | | | | | | | | Similarly to static variables in OpenCL, static class data members should be deduced to __global addr space. Differential Revision: https://reviews.llvm.org/D61304 llvm-svn: 359789
* Replace ad-hoc tracking of pattern for an instantiated class-scopeRichard Smith2019-05-023-48/+32
| | | | | | | | | | explicit function specialization with the MemberSpecializationInfo used everywhere else. Not NFC: the ad-hoc pattern tracking was not being serialized / deserialized properly. That's fixed here. llvm-svn: 359747
* Diagnose non-dependent qualified friend function template declarationsRichard Smith2019-05-022-2/+2
| | | | | | | that don't match any existing declaration. Don't get confused and treat such declarations as template *specializations*. llvm-svn: 359746
* [NFC] typoJF Bastien2019-04-301-2/+2
| | | | llvm-svn: 359524
* Simplify exclusion of nested classes from extern template instantiation, NFCReid Kleckner2019-04-291-8/+7
| | | | | | | | | | | | | | | | | | | | | Summary: This simplifies three checks for MS ABI, Win Itanium, or Win GNU to just "is Windows". The question remains, however, if this is really the correct thing to do. We could, for example, only not consider inner classes to be externally available if the outer class has a dllexport annotation. However, I will leave that as future work. Reviewers: hans, mstorsjo Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61278 llvm-svn: 359507
* [OPENMP]Fix PR41617: crash on template instantiation.Alexey Bataev2019-04-291-1/+1
| | | | | | | Fixed the crash on the template instantiation when trying to check the data locality in the current instantiation scope. llvm-svn: 359459
* Reinstate r359059, reverted in r359361, with a fix to properly preventRichard Smith2019-04-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | | us emitting the operand of __builtin_constant_p if it has side-effects. Original commit message: Fix interactions between __builtin_constant_p and constexpr to match current trunk GCC. GCC permits information from outside the operand of __builtin_constant_p (but in the same constant evaluation context) to be used within that operand; clang now does so too. A few other minor deviations from GCC's behavior showed up in my testing and are also fixed (matching GCC): * Clang now supports nullptr_t as the argument type for __builtin_constant_p * Clang now returns true from __builtin_constant_p if called with a null pointer * Clang now returns true from __builtin_constant_p if called with an integer cast to pointer type llvm-svn: 359367
* Revert Fix interactions between __builtin_constant_p and constexpr to match ↵Jorge Gorbe Moya2019-04-271-5/+1
| | | | | | | | current trunk GCC. This reverts r359059 (git commit 0b098754b73f3b96d00ecb1c7605760b11c90298) llvm-svn: 359361
* [AArch64] Add support for MTE intrinsicsJaved Absar2019-04-261-0/+164
| | | | | | | | | | | | This provides intrinsics support for Memory Tagging Extension (MTE), which was introduced with the Armv8.5-a architecture. These intrinsics are available when __ARM_FEATURE_MEMORY_TAGGING is defined. Each intrinsic is described in detail in the ACLE Q1 2019 documentation: https://developer.arm.com/docs/101028/latest Reviewed By: Tim Nortover, David Spickett Differential Revision: https://reviews.llvm.org/D60485 llvm-svn: 359348
* [MinGW] Do dllexport inline methods in template instantiationMartin Storsjo2019-04-261-2/+5
| | | | | | | | | | | | | | | | | | Normally, in MinGW mode, inline methods aren't dllexported. However, in the case of a dllimported template instantiation, the inline methods aren't instantiated locally, but referenced from the instantiation. Therefore, those methods also need to be dllexported, in the case of an instantiation. GCC suffers from the same issue, reported at [1], but the issue is still unresolved there. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89088 Differential Revision: https://reviews.llvm.org/D61176 llvm-svn: 359343
* [MinGW] Don't let template instantiation declarations cover nested classesMartin Storsjo2019-04-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An explicit template instantiation declaration used to let callers assume both outer and nested classes instantiations were defined in a different translation unit. If the instantiation is marked dllexport, only the outer class is exported, but the caller will try to reference the instantiation of both outer and inner classes. This makes MinGW mode match both MSVC and Windows Itanium, by having instantations only cover the outer class, and locally emitting definitions of the nested classes. Windows Itanium was changed to use this behavious in SVN r300804. This deviates from what GCC does, but should be safe (and only inflate the object file size a bit, but MSVC and Windows Itanium modes do the same), and fixes cases where inner classes aren't dllexported. This fixes missing references in combination with dllexported/imported template intantiations. GCC suffers from the same issue, reported at [1], but the issue is still unresolved there. The issue can probably be solved either by making dllexport cover all nested classes as well, or this way (matching MSVC). [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89087 Differential Revision: https://reviews.llvm.org/D61175 llvm-svn: 359342
* [OPENMP]Added check for non-random access types for the dependent loopAlexey Bataev2019-04-261-51/+78
| | | | | | | | | | | counters. According to the OpenMP 5.0, For any associated loop where the b or lb expression is not loop invariant with respect to the outermost loop, the var-outer that appears in the expression may not have a random access iterator type. llvm-svn: 359340
* [MinGW] Fix dllexport of explicit template instantiationMartin Storsjo2019-04-262-4/+29
| | | | | | | | | | | | | | | | | Contrary to MSVC, GCC/MinGW needs to have the dllexport attribute on the template instantiation declaration, not on the definition. Previously clang never marked explicit template instantiations as dllexport in MinGW mode, if the instantiation had a previous declaration, regardless of where the attribute was placed. This makes Clang behave like GCC in this regard, and allows using the same attribute form for both MinGW compilers. This fixes PR40256. Differential Revision: https://reviews.llvm.org/D61118 llvm-svn: 359285
* PR41607: Don't forget to substitute outer template arguments into aRichard Smith2019-04-261-5/+9
| | | | | | class-scope explicit specialization of a class template. llvm-svn: 359266
* Add missing diagnostic for explicit instantiation declarations namingRichard Smith2019-04-261-20/+46
| | | | | | | | | | | | | | | | | internal linkage entities. Such constructs are ill-formed by [temp.explicit]p13. We make a special exception to permit an invalid construct used by libc++ in some build modes: its <valarray> header declares some functions with the internal_linkage attribute and then (meaninglessly) provides explicit instantiation declarations for them. Luckily, Clang happens to effectively ignore the explicit instantiation declaration when generating code in this case, and this change codifies that behavior. This reinstates part of r359048, reverted in r359076. (The libc++ issue triggering the rollback has been addressed.) llvm-svn: 359259
* [OPENMP] Improved check for the linear dependency in the non-rectangularAlexey Bataev2019-04-251-5/+29
| | | | | | | | | loop nests. Added a checks that the initializer/condition expressions depend only only of the single previous loop iteration variable. llvm-svn: 359200
* [OPENMP]Initial support for non-rectangular loop nest.Alexey Bataev2019-04-241-13/+87
| | | | | | | Added basic semantic analysis for the non-rectangular loop nests for OpenMP 5.0 support. llvm-svn: 359132
* Use llvm::stable_sortFangrui Song2019-04-244-26/+20
| | | | llvm-svn: 359098
* Revert r359048: C++ DR2387: a variable template declared wthiIlya Biryukov2019-04-241-32/+20
| | | | | | | | | | | | | The change breaks libc++ with the follwing error: In file included from valarray:4: .../include/c++/v1/valarray:1062:60: error: explicit instantiation declaration of 'valarray<_Tp>' with internal linkage _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t)) ^ .../include/c++/v1/valarray:1063:60: error: explicit instantiation declaration of '~valarray<_Tp>' with internal linkage _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray()) llvm-svn: 359076
* Revert r350917 "[Sema] If CheckPlaceholderExpr rewrites the initializerRichard Smith2019-04-243-13/+14
| | | | | | | | | | | | | | of an auto" This commit changed the initializer expression passed into initialization (stripping off an enclosing pair of parentheses or braces) and subtly changing the meaning of programs, typically by inserting bogus calls to copy constructors. See the added testcase in test/SemaCXX/cxx1y-init-captures.cpp for an example of the breakage. llvm-svn: 359066
* Fix interactions between __builtin_constant_p and constexpr to matchRichard Smith2019-04-241-1/+5
| | | | | | | | | | | | | | | | | | current trunk GCC. GCC permits information from outside the operand of __builtin_constant_p (but in the same constant evaluation context) to be used within that operand; clang now does so too. A few other minor deviations from GCC's behavior showed up in my testing and are also fixed (matching GCC): * Clang now supports nullptr_t as the argument type for __builtin_constant_p * Clang now returns true from __builtin_constant_p if called with a null pointer * Clang now returns true from __builtin_constant_p if called with an integer cast to pointer type llvm-svn: 359059
* Add missing diagnostic for anonymous struct/union definitions that don'tRichard Smith2019-04-241-0/+12
| | | | | | introduce any names. llvm-svn: 359051
* Improve -Wuninitialized warning under ARC for block variables that areAkira Hatanaka2019-04-231-1/+2
| | | | | | | | | | | recursively captured. Under ARC, a block variable is zero-initialized when it is recursively captured by the block literal initializer. rdar://problem/11022762 llvm-svn: 359049
* C++ DR2387: a variable template declared wtih (or instantiated with) aRichard Smith2019-04-231-20/+32
| | | | | | | const-qualified type is not implicitly given internal linkage. But a variable template declared 'static' is. llvm-svn: 359048
* [c++2a] Implement semantic restrictions for 'export' declarations.Richard Smith2019-04-222-8/+162
| | | | llvm-svn: 358932
* [sema][objc] Minor refactor to OverrideSearch. NFCI.Matt Davis2019-04-221-26/+22
| | | | | | | | | | | | | | | | | | Summary: * Removed a member that was only used during construction. * Use range-based for iteration when accessing the result of the search. * Require an `ObjCMethodDecl` reference upon construction of an * Constify. Reviewers: rjmccall Reviewed By: rjmccall Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D60850 llvm-svn: 358898
* [Sema] ADL: Associated namespaces for class types and enumeration types (CWG ↵Bruno Ricci2019-04-221-27/+35
| | | | | | | | | | | | | | | | | | | 1691) CWG 1691 changed the definition of the namespaces associated with a class type or enumeration type. For a class type, the associated namespaces are the innermost enclosing namespaces of the associated classes. For an enumeration type, the associated namespace is the innermost enclosing namespace of its declaration. This also fixes CWG 1690 and CWG 1692. Differential Revision: https://reviews.llvm.org/D60573 Reviewed By: rjmccall, rsmith llvm-svn: 358882
* [Sema][MSVC] Fix bogus microsoft-pure-definition warning on member function ↵Bruno Ricci2019-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | of class template Clang emits a warning when using a pure specifier =0 in a function definition at class scope (a MS-specific construct), when using -fms-extensions. However, to detect this, it was using FD->isCanonicalDecl() on function declaration, which was also detecting out-of-class definition of member functions of class templates. Fix this by using !FD->isOutOfLine() instead. Fixes PR21334. Differential Revision: https://reviews.llvm.org/D29707 Reviewed By: riccibruno Reviewers: rnk, riccibruno Patch By: Rudy Pons llvm-svn: 358849
* Modules: Search for a visible definition of the decl context when computing ↵David Blaikie2019-04-191-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | visibility of a default template parameter The code is/was already correct for the case where a parameter is a parameter of its enclosing lexical DeclContext (functions and classes). But for other templates (alias and variable templates) they don't create their own scope to be members of - in those cases, they parameter should be considered visible if any definition of the lexical decl context is visible. [this should cleanup the failure on the libstdc++ modules buildbot] [this doesn't actually fix the variable template case for a secondary/compounding reason (its lexical decl context is incorrectly considered to be the translation unit)] Test covers all 4 kinds of templates with default args, including a regression test for the still broken variable template case. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D60892 llvm-svn: 358795
* [c++2a] Add semantic support for private module fragments.Richard Smith2019-04-183-61/+162
| | | | llvm-svn: 358713
* [OpenMP] Add checks for requires and target directives.Gheorghe-Teodor Bercea2019-04-181-0/+43
| | | | | | | | | | | | | | | | Summary: The requires directive containing target related clauses must appear before any target region in the compilation unit. Reviewers: ABataev, AlexEichenberger, caomhin Reviewed By: ABataev Subscribers: guansong, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60875 llvm-svn: 358709
* [Sema] Delete unused parameters/variablesFangrui Song2019-04-181-6/+2
| | | | llvm-svn: 358661
* Split out modules-specific declaration handling from SemaDecl.cpp into aRichard Smith2019-04-183-465/+486
| | | | | | new SemaModule.cpp. llvm-svn: 358633
* [c++2a] Improve diagnostic for use of declaration from another TU'sRichard Smith2019-04-181-21/+49
| | | | | | | | | | global module fragment. We know that the declaration in question should have been introduced by a '#include', so try to figure out which one and suggest it. Don't suggest importing the global module fragment itself! llvm-svn: 358631
* [Sema][ObjC] Don't warn about an implicitly retained self if theAkira Hatanaka2019-04-173-5/+35
| | | | | | | | | | | | | | | | | retaining block and all of the enclosing blocks are non-escaping. If the block implicitly retaining self doesn't escape, there is no risk of creating retain cycles, so clang shouldn't diagnose it and force users to add self-> to silence the diagnostic. Also, fix a bug where clang was failing to diagnose an implicitly retained self inside a c++ lambda nested inside a block. rdar://problem/25059955 Differential Revision: https://reviews.llvm.org/D60736 llvm-svn: 358624
* [NFC] Remove unused function (Sema::pushExternalDeclIntoScope)Leonard Chan2019-04-161-5/+0
| | | | llvm-svn: 358538
* [c++20] Parsing support for module-declarations, import-declarations,Richard Smith2019-04-142-37/+116
| | | | | | | | | and the global and private module fragment. For now, the private module fragment introducer is ignored, but use of the global module fragment introducer should be properly enforced. llvm-svn: 358353
* Add support for attributes on @implementations in Objective-CErik Pilkington2019-04-111-2/+10
| | | | | | | | | We want to make objc_nonlazy_class apply to implementations, but ran into this. There doesn't seem to be any reason that this isn't supported. Differential revision: https://reviews.llvm.org/D60542 llvm-svn: 358200
* Check i < FD->getNumParams() before queryingDmitri Gribenko2019-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: As was already stated in a previous comment, the parameter isn't necessarily referring to one of the DeclContext's parameter. We should check the index is within the range to avoid out-of-boundary access. Reviewers: gribozavr, rsmith, lebedev.ri Reviewed By: gribozavr, rsmith Subscribers: lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60055 Patch by Violet. llvm-svn: 358134
* [OPENMP]Allow allocate directive on parameters.Alexey Bataev2019-04-091-3/+0
| | | | | | Patch allows to use allocate directives on the function parameters. llvm-svn: 358016
* [X86] Add some fp to integer conversion intrinsics to ↵Craig Topper2019-04-081-0/+4
| | | | | | | | Sema::CheckX86BuiltinRoundingOrSAE so their rounding controls will be checked. If we don't check this in the frontend we'll get an isel error in the backend later. This is far less friendly to users. llvm-svn: 357924
OpenPOWER on IntegriCloud