summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenCL] Allow function declaration with empty argument list.Alexey Bader2017-10-111-1/+2
| | | | | | | | | | | | | | | | Treat 'f()' as 'f(void)' rather than a function w/o a prototype. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia, yaxunl Subscribers: cfe-commits, echuraev, chapuni Differential Revision: https://reviews.llvm.org/D33681 Re-apply revision 306653. llvm-svn: 315453
* [modules] Fix visibility checking for using declarations via ADL.Richard Smith2017-10-111-6/+14
| | | | | | | We want to check whether the using (shadow) declaration itself is visible, not whether its target is visible. llvm-svn: 315408
* [modules] Only take visible using-directives into account during name lookup.Richard Smith2017-10-111-14/+16
| | | | llvm-svn: 315402
* [Modules TS] Diagnose missing/duplicate module-declaration.Richard Smith2017-10-112-5/+24
| | | | llvm-svn: 315397
* [Modules TS] Diagnose attempts to enter module implementation units without ↵Richard Smith2017-10-101-5/+7
| | | | | | the module interface being available. llvm-svn: 315381
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-108-55/+153
| | | | | | | | | | | | | | | | | When declaring an entity in the "purview" of a module, it's never a redeclaration of an entity in the purview of a default module or in no module ("in the global module"). Don't consider those other declarations as possible redeclaration targets if they're not visible, and reject any cases where we pick a prior visible declaration that violates this rule. This reinstates r315251 and r315256, reverted in r315309 and r315308 respectively, tweaked to avoid triggering a linkage calculation when declaring implicit special members (this exposed our pre-existing issue with typedef names for linkage changing the linkage of types whose linkage has already been computed and cached in more cases). A testcase for that regression has been added in r315366. llvm-svn: 315379
* For dllexport class templates, export specializations of member functions ↵Hans Wennborg2017-10-101-0/+16
| | | | | | | | | | (PR34849) (take 2) This is a re-commit of r315025, but making sure to only apply this to specializations of class template member functions; i.e. not when the function itself is a template. llvm-svn: 315330
* Revert "[Modules TS] Module ownership semantics for redeclarations."Eric Liu2017-10-108-154/+55
| | | | | | This reverts commit r315251. See the original commit thread for reason. llvm-svn: 315309
* [Sema][ObjC] Preserve syntactic sugar when removingAkira Hatanaka2017-10-101-8/+31
| | | | | | | | | | | | | | | | | ARCReclaimReturnedObject cast. This is a follow-up to r314370. Rather than throwing away the enclosing parentheses, this commit walks down the expression until an ARCReclaimReturnedObject cast is found and removes just the cast, preserving the syntactic sugar expressions (parens and casts) that were visited up to that point. rdar://problem/34705720 Differential Revision: https://reviews.llvm.org/D38659 llvm-svn: 315261
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-098-55/+154
| | | | | | | | | | When declaring an entity in the "purview" of a module, it's never a redeclaration of an entity in the purview of a default module or in no module ("in the global module"). Don't consider those other declarations as possible redeclaration targets if they're not visible, and reject any cases where we pick a prior visible declaration that violates this rule. llvm-svn: 315251
* Remove unused variables. No functionality change.Benjamin Kramer2017-10-084-4/+0
| | | | llvm-svn: 315196
* Revert "For dllexport class templates, export specializations of member ↵Reid Kleckner2017-10-061-15/+0
| | | | | | | | functions (PR34849)" This reverts r315025, it caused http://crbug.com/772461 llvm-svn: 315111
* [ObjC] Don't warn on readwrite properties with custom setters thatAlex Lorenz2017-10-061-1/+5
| | | | | | | | override readonly properties from protocols rdar://34192541 llvm-svn: 315093
* [OPENMP] Do not capture local static variables.Alexey Bataev2017-10-061-0/+4
| | | | | | | | Previously we may erroneously try to capture locally declared static variables, which will lead to crash for target-based constructs. Patch fixes this problem. llvm-svn: 315076
* [OPENMP] Capture references to global variables.Alexey Bataev2017-10-061-1/+2
| | | | | | | | In C++11 variable to global variables are considered as constant expressions and these variables are not captured in the outlined regions. Patch allows capturing of such variables in the OpenMP regions. llvm-svn: 315074
* For dllexport class templates, export specializations of member functions ↵Hans Wennborg2017-10-051-0/+15
| | | | | | (PR34849) llvm-svn: 315025
* Fix two-phase name lookup for non-dependent overloaded operators.Richard Smith2017-10-052-11/+19
| | | | | | | | If we resolve an overloaded operator call to a specific function during template definition, don't perform ADL during template instantiation. Doing so finds overloads that we're not supposed to find. llvm-svn: 315005
* [OPENMP] Fix mapping|privatization of implicitly captured variables.Alexey Bataev2017-10-051-14/+37
| | | | | | | | If the `defaultmap(tofrom:scalar)` clause is specified, the scalars must be mapped with 'tofrom' modifiers, otherwise they must be captured as firstprivates. llvm-svn: 314995
* Fix 'section' warning behavior with tentatively-defined valuesErich Keane2017-10-041-1/+1
| | | | | | | | | As reported on cfe-commits, r314262 resulted in tentatively-defined variables not being excluded for the warning. Patch By: Elizabeth Andrews llvm-svn: 314939
* [OpenMP] Initial implementation of teams distribute code generationCarlo Bertolli2017-10-041-2/+2
| | | | | | | | https://reviews.llvm.org/D38371 This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses. llvm-svn: 314905
* We allow implicit function declarations as an extension in all C dialects. ↵Richard Smith2017-10-041-5/+3
| | | | | | Remove OpenCL special case. llvm-svn: 314872
* PR34822: Fix a collection of related bugs with our handling of C89 implicit ↵Richard Smith2017-10-041-15/+29
| | | | | | | | | | | | | | | | | function declarations. We were injecting the function into the wrong semantic context, resulting in it failing to be registered as a global for redeclaration lookup. As a consequence, we accepted invalid code since r310616. Fixing that resulted in the "out-of-scope declaration" diagnostic firing a lot more often. It turned out that warning codepath was non-conforming, because it did not cause us to inject the implicitly-declared function into the enclosing block scope. We now only warn if the type of the out-of-scope declaration doesn't match the type of an implicitly-declared function; in all other cases, we produce the normal warning for an implicitly-declared function. llvm-svn: 314871
* Suppress -Wmissing-braces warning when aggregate-initializing a struct with ↵Richard Smith2017-10-031-1/+30
| | | | | | | | | | a single field that is itself an aggregate. In C++, such initialization of std::array<T, N> types is guaranteed to work by the standard, is completely idiomatic, and the "suggested" alternative from Clang was technically invalid. llvm-svn: 314838
* [OPENMP] Allow use of declare target directive inside structAlexey Bataev2017-10-031-1/+5
| | | | | | | | | | declaration. Patch allows using of the `#pragma omp declare target`| `#pragma omp end declare target` directives inside the structures if we need to mark as declare target only some static members. llvm-svn: 314833
* [OpenCL] Fix checking of vector type castingYaxun Liu2017-10-031-3/+3
| | | | | | | | | | | | | | | | | | Currently clang allows the following code int a; int b = (const int) a; However it does not the following code int4 a; int4 b = (const int4) a; This is because Clang compares the qualified types instead of unqualified types for vector type casting, which causes the inconsistency. This patch fixes that. Differential Revision: https://reviews.llvm.org/D38463 llvm-svn: 314802
* PR33839: Fix -Wunused handling for structured binding declarations.Richard Smith2017-10-023-6/+26
| | | | | | | We warn about a structured binding declaration being unused only if none of its bindings are used. llvm-svn: 314733
* Revert "[Sema] Warn on attribute nothrow conflicting with language specifiers"Reid Kleckner2017-10-021-20/+1
| | | | | | | | | | | This reverts r314461. It is warning on user code that uses END_COM_MAP(), which expands to declare QueryInterface with conflicting exception specifers. I've spent a while trying to understand why, but haven't been able to extract a reduced test case. Let's revert and I'll keep trying. llvm-svn: 314689
* [OPENMP] Capture argument of `device` clause for target-basedAlexey Bataev2017-10-021-1/+11
| | | | | | | | | | directives. The argument of the `device` clause in target-based executable directives must be captured to support codegen for the `target` directives with the `depend` clauses. llvm-svn: 314686
* Dependent Address Space SupportAndrew Gozillon2017-10-025-36/+251
| | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. llvm-svn: 314649
* Test Commit.Andrew Gozillon2017-10-011-1/+0
| | | | llvm-svn: 314623
* Add a "vexing parse" warning for ambiguity between a variable declaration and aRichard Smith2017-09-291-0/+96
| | | | | | | | | | | | | | function-style cast. This fires for cases such as T(x); ... where 'x' was previously declared and T is a type. This construct declares a variable named 'x' rather than the (probably expected) interpretation of a function-style cast of 'x' to T. llvm-svn: 314570
* [Sema] Suppress warnings for C's zero initializerDaniel Marjamaki2017-09-291-2/+5
| | | | | | | | Patch by S. Gilles! Differential Revision: https://reviews.llvm.org/D28148 llvm-svn: 314499
* [X86][MS-InlineAsm] Extended support for variables / identifiers on memory / ↵Coby Tayree2017-09-291-28/+20
| | | | | | | | | | | immediate expressions Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized. supersedes D33278, D35774 Differential Revision: https://reviews.llvm.org/D37413 llvm-svn: 314494
* [Sema] Put nullability fix-it after the end of the pointer.Volodymyr Sapsai2017-09-281-15/+22
| | | | | | | | | | | | | | | | | | Fixes nullability fix-it for `id<SomeProtocol>`. With this change nullability specifier is inserted after ">" instead of between "id" and "<". rdar://problem/34260995 Reviewers: jordan_rose, doug.gregor, ahatanak, arphaman Reviewed By: jordan_rose Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38327 llvm-svn: 314473
* [Sema] Correct nothrow inherited by noexceptErich Keane2017-09-281-0/+3
| | | | | | | | | | | | | | | As reported in https://bugs.llvm.org/show_bug.cgi?id=33235, a noexcept function was unable to inherit from a nothrow defaulted constructor. Attribute "nothrow" is supposed to be semantically identical to noexcept, and in fact, a number of other places in the code treat them identically. This patch simply checks the RecordDecl for the correct attribute in the case where no other exception specifier was set. Differential Revision: https://reviews.llvm.org/D38209 llvm-svn: 314462
* [Sema] Warn on attribute nothrow conflicting with language specifiersErich Keane2017-09-281-1/+20
| | | | | | | | | | | | | | I discovered it was possible to create a 'nothrow' noexcept(false) function, which is both non-sensical as well as seemingly breaking. This patch warns if attribute nothrow is used with anything besides "noexcept". "noexcept(true)" isn't possible, because the noexcept decl isn't parsed until later. Differential Revision: https://reviews.llvm.org/D38205 llvm-svn: 314461
* Consolidate std::move() detection code. No behavior change.Nico Weber2017-09-283-19/+7
| | | | llvm-svn: 314427
* Look through parentheses.Akira Hatanaka2017-09-281-1/+1
| | | | | | | | | This fixes a bug where clang would emit instructions to reclaim a value that's going to be __bridge-casted to CF. rdar://problem/34687542 llvm-svn: 314370
* Add support for remembering origins to ExternalASTMergerSean Callanan2017-09-271-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExternalASTMerger has hitherto relied on being able to look up any Decl through its named DeclContext chain. This works for many cases, but causes problems for function-local structs, which cannot be looked up in their containing FunctionDecl. An example case is void f() { { struct S { int a; }; } { struct S { bool b; }; } } It is not possible to lookup either of the two Ses individually (or even to provide enough information to disambiguate) after parsing is over; and there is typically no need to, since they are invisible to the outside world. However, ExternalASTMerger needs to be able to complete either S on demand. This led to an XFAIL on test/Import/local-struct, which this patch removes. The way the patch works is: It defines a new data structure, ExternalASTMerger::OriginMap, which clients are expected to maintain (default-constructing if the origin does not have an ExternalASTMerger servicing it) As DeclContexts are imported, if they cannot be looked up by name they are placed in the OriginMap. This allows ExternalASTMerger to complete them later if necessary. As DeclContexts are imported from an origin that already has its own OriginMap, the origins are forwarded – but only for those DeclContexts that are actually used. This keeps the amount of stored data minimal. The patch also applies several improvements from review: - Thoroughly documents the interface to ExternalASTMerger; - Adds optional logging to help track what's going on; and - Cleans up a bunch of braces and dangling elses. Differential Revision: https://reviews.llvm.org/D38208 llvm-svn: 314336
* Fix capitalization of a bunch of parameters in SemaDeclAttr [NFC]Erich Keane2017-09-271-44/+44
| | | | llvm-svn: 314267
* Emit section information for extern variables. Erich Keane2017-09-261-0/+10
| | | | | | | | | | | | | | | | | Currently, if _attribute_((section())) is used for extern variables, section information is not emitted in generated IR when the variables are used. This is expected since sections are not generated for external linkage objects. However NiosII requires this information as it uses special GP-relative accesses for any objects that use attribute section (.sdata). GCC keeps this attribute in middle-end. This change emits the section information for all targets. Patch By: Elizabeth Andrews Differential Revision:https://reviews.llvm.org/D36487 llvm-svn: 314262
* Fix uninitialized member found by msan build bot.Richard Smith2017-09-261-1/+1
| | | | llvm-svn: 314246
* Sema: rename SemaBuiltinVAStart to SemaBuiltinVAStartMicrosoftSaleem Abdulrasool2017-09-261-2/+2
| | | | | | | | | | | This function is used to perform semantic analysis on Microsoft style `__va_start`. Rename it to make this more explicit. `__va_start` is marked as `ALL_MS_LANGUAGES`, and requires Microsoft compatibility. Other GNU targets will use `__builtin_va_start` instead. NFC. Addresses post-commit review comments from David Majnemer. llvm-svn: 314241
* Resolve a defect in C++17 copy omission.Richard Smith2017-09-263-43/+133
| | | | | | | | | | | | When selecting constructors for initializing an object of type T from a single expression of class type U, also consider conversion functions of U that convert to T (rather than modeling such conversions as calling a conversion function and then calling a constructor). This approach is proposed as the resolution for the defect, and is also already implemented by GCC. llvm-svn: 314231
* [Sema] Corrected the warn-on-throw-from-noexcept behavior to include nothrowErich Keane2017-09-261-1/+1
| | | | | | | | | | Discovered that 'nothrow' (which is supposed to be an alias for noexcept) was not warning with a throw inside of it. This patch corrects the behavior previously created to add 'nothrow' to this list. Differential Revision: https://reviews.llvm.org/D38203 llvm-svn: 314229
* Sema: Windows/ARM __va_start is not const correctSaleem Abdulrasool2017-09-261-17/+27
| | | | | | | | | | The `__va_start` intrinsic for Windows ARM does not account for const correctness when performing a check. All local qualifiers are ignored when validating the invocation. This was exposed by building the swift stdlib against the Windows 10586 SDK for ARM. Simply expand out the check for the two parameters and ignore the qualifiers for the check. llvm-svn: 314226
* [OPENMP] Fix handling of implicit mapping of array sections.Alexey Bataev2017-09-261-2/+3
| | | | llvm-svn: 314220
* [OPENMP] Generate implicit map|firstprivate clauses for target-basedAlexey Bataev2017-09-261-32/+166
| | | | | | | | | | directives. If the variable is used in the target-based region but is not found in any private|mapping clause, then generate implicit firstprivate|map clauses for these implicitly mapped variables. llvm-svn: 314205
* [Sema] Null check in BuildDeclarationNameExprYi Kong2017-09-251-0/+2
| | | | | | | | | | Qualtype may point to null if we cannot infer its type yet. Fixes PR33843 Differential Revision: https://reviews.llvm.org/D38158 llvm-svn: 314124
* Don't warn about runtime behavior problems in variable initializers that weRichard Smith2017-09-231-3/+17
| | | | | | | | know are going to be constant-evaluated. Any relevant diagnostics should be produced by constant expression evaluation. llvm-svn: 314067
OpenPOWER on IntegriCloud