summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP][CUDA]Do not emit warnings for variables in late-reported asmAlexey Bataev2019-02-261-42/+60
| | | | | | | | | | | | statements. If the assembler instruction is not generated and the delayed diagnostic is emitted, we may end up with extra warning message for variables used in the asm statement. Since the asm statement is not built, the variables may be left non-referenced and it may produce a warning about a use of the non-initialized variables. llvm-svn: 354928
* [OPENMP]Delay emission for unsupported va_arg expression.Alexey Bataev2019-02-261-0/+5
| | | | | | | If the OpenMP device is NVPTX and va_arg is used, delay emission of the error for va_arg unless it is used in the device code. llvm-svn: 354925
* [AMDGPU] Allow using integral non-type template parametersMichael Liao2019-02-262-34/+149
| | | | | | | | | | | | | | | | | | | Summary: - Allow using integral non-type template parameters in the following attributes __attribute__((amdgpu_flat_work_group_size(<min>, <max>))) __attribute__((amdgpu_waves_per_eu(<min>[, <max>]))) Reviewers: kzhuravl, yaxunl Subscribers: jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58623 llvm-svn: 354909
* revert r354873 as this breaks lldb builds.Pierre Gousseau2019-02-261-2/+1
| | | | llvm-svn: 354875
* [Driver] Allow enum SanitizerOrdinal to represent more than 64 different ↵Pierre Gousseau2019-02-261-1/+2
| | | | | | | | | | | | | sanitizer checks, NFC. enum SanitizerOrdinal has reached maximum capacity, this change extends the capacity to 128 sanitizer checks. This can eventually allow us to add gcc 8's options "-fsanitize=pointer-substract" and "-fsanitize=pointer-compare". Fixes: https://llvm.org/PR39425 Differential Revision: https://reviews.llvm.org/D57914 llvm-svn: 354873
* [CodeComplete] Propagate preferred type for function arguments in more casesIlya Biryukov2019-02-261-2/+22
| | | | | | | | | | | | | | | | | | | | | Summary: See the added test for some new cases. This change also removes special code completion calls inside the ParseExpressionList function now that we properly propagate expected type to the function responsible for parsing elements of the expression list (ParseAssignmentExpression). Reviewers: kadircet Reviewed By: kadircet Subscribers: xbolva00, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58541 llvm-svn: 354864
* Reapply "Make static counters in ASTContext non-static." with fixes.Alexander Kornienko2019-02-251-12/+12
| | | | | | This reverts commit e50038e4dc53caee1acc811362ac0b15e00ef5eb. llvm-svn: 354827
* [OpenMP 5.0] Parsing/sema support for from clause with mapper modifier.Michael Kruse2019-02-252-44/+45
| | | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for the OpenMP 'from'-clause with potential user-defined mappers attached. User-defined mappers are a new feature in OpenMP 5.0. A 'from'-clause can have an explicit or implicit associated mapper, which instructs the compiler to generate and use customized mapping functions. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target update from(mapper(id): ss) // use the mapper with name 'id' to map ss from device Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58638 llvm-svn: 354817
* Revert "Make static counters in ASTContext non-static."Vlad Tsyrklevich2019-02-251-12/+12
| | | | | | | This reverts commit r354795, I suspect it is causing test failures on MSan sanitizer bots. llvm-svn: 354812
* Make static counters in ASTContext non-static.Alexander Kornienko2019-02-251-12/+12
| | | | | | | | | | | | | | | | | | Summary: Fixes a data race and makes it possible to run clang-based tools in multithreaded environment with TSan. Reviewers: ilya-biryukov, riccibruno Reviewed By: riccibruno Subscribers: riccibruno, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58612 llvm-svn: 354795
* Enable coroutines under -std=c++2a.Richard Smith2019-02-231-1/+1
| | | | llvm-svn: 354736
* [OpenMP 5.0] Parsing/sema support for to clause with mapper modifier.Michael Kruse2019-02-222-61/+87
| | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for OpenMP to clause with potential user-defined mappers attached. User defined mapper is a new feature in OpenMP 5.0. A to/from clause can have an explicit or implicit associated mapper, which instructs the compiler to generate and use customized mapping functions. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target update to(mapper(id): ss) // use the mapper with name 'id' to map ss to device Contributed-by: <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58523 llvm-svn: 354698
* [OPENMP] Delayed diagnostics for VLA support.Alexey Bataev2019-02-222-9/+17
| | | | | | Generalized processing of the deferred diagnostics for OpenMP/CUDA code. llvm-svn: 354690
* Revert "[OPENMP] Delayed diagnostics for VLA support."Alexey Bataev2019-02-221-7/+9
| | | | | | | This reverts commit r354679 to fix the problem with the Windows buildbots llvm-svn: 354680
* [OPENMP] Delayed diagnostics for VLA support.Alexey Bataev2019-02-221-9/+7
| | | | | | Generalized processing of the deferred diagnostics for OpenMP/CUDA code. llvm-svn: 354679
* [CUDA]Delayed diagnostics for the asm instructions.Alexey Bataev2019-02-224-17/+12
| | | | | | | | | Adapted targetDiag for the CUDA and used for the delayed diagnostics in asm constructs. Works for both host and device compilation sides. Differential Revision: https://reviews.llvm.org/D58463 llvm-svn: 354671
* Revert "[CUDA]Delayed diagnostics for the asm instructions."Alexey Bataev2019-02-214-6/+13
| | | | | | | This reverts commit r354593 to fix the problem with the crash on windows. llvm-svn: 354596
* [CUDA]Delayed diagnostics for the asm instructions.Alexey Bataev2019-02-214-13/+6
| | | | | | | | | | | | | | | | Summary: Adapted targetDiag for the CUDA and used for the delayed diagnostics in asm constructs. Works for both host and device compilation sides. Reviewers: tra, jlebar Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58463 llvm-svn: 354593
* [CodeComplete] Collect visited contexts when scope specifier is invalid.Eric Liu2019-02-211-1/+14
| | | | | | | | | | | | | | | | | Summary: This will allow completion consumers to guess the specified scope by putting together scopes in the context with the specified scope (e.g. when the specified namespace is not imported yet). Reviewers: ilya-biryukov Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58446 llvm-svn: 354570
* [attributes] Add an attribute for server routines in Mach kernel and extensions.Artem Dergachev2019-02-211-0/+26
| | | | | | | | | | | | The new __attribute__ ((mig_server_routine)) is going to be used for annotating Mach Interface Generator (MIG) callback functions as such, so that additional static analysis could be applied to their implementations. It can also be applied to regular functions behavior of which is supposed to be identical to that of a MIG server routine. Differential Revision: https://reviews.llvm.org/D58365 llvm-svn: 354530
* [OPENMP] Use targetDiag for diagnostics of unsupported exceptions, NFC.Alexey Bataev2019-02-202-8/+2
| | | | llvm-svn: 354509
* [OPENMP] Delay emission of the asm target-specific error messages.Alexey Bataev2019-02-202-44/+53
| | | | | | | | | | | | | | | | | Summary: Added the ability to emit target-specific builtin assembler error messages only in case if the function is really is going to be emitted for the device. Reviewers: rjmccall Subscribers: guansong, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58243 llvm-svn: 354486
* [OpenMP 5.0] Parsing/sema support for map clause with mapper modifier.Michael Kruse2019-02-193-127/+326
| | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for OpenMP map clauses with potential user-defined mapper attached. User defined mapper is a new feature in OpenMP 5.0. A map clause can have an explicit or implicit associated mapper, which instructs the compiler to generate extra data mapping. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target map(mapper(id) tofrom: ss) // use the mapper with name 'id' to map ss Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58074 llvm-svn: 354347
* [Sema] Diagnose floating point conversions based on target semanticsErik Pilkington2019-02-161-11/+14
| | | | | | | | | | ...instead of just comparing rank. Also, fix a bad warning about _Float16, since its declared out of order in BuiltinTypes.def, meaning comparing rank using BuiltinType::getKind() is incorrect. Differential revision: https://reviews.llvm.org/D58254 llvm-svn: 354190
* Fix implementation of [temp.local]p4.Richard Smith2019-02-154-71/+112
| | | | | | | | | | | | | | | | | | | | | | | | When a template-name is looked up, we need to give injected-class-name declarations of class templates special treatment, as they denote a template rather than a type. Previously we achieved this by applying a filter to the lookup results after completing name lookup, but that is incorrect in various ways, not least of which is that it lost all information about access and how members were named, and the filtering caused us to generally lose all ambiguity errors between templates and non-templates. We now preserve the lookup results exactly, and the few places that need to map from a declaration found by name lookup into a declaration of a template do so explicitly. Deduplication of repeated lookup results of the same injected-class-name declaration is done by name lookup instead of after the fact. This reinstates r354091, which was previously reverted in r354097 because it exposed bugs in lldb and compiler-rt. Those bugs were fixed in r354173 and r354174 respectively. llvm-svn: 354176
* [OpenCL][PR40707] Allow OpenCL C types in C++ mode.Anastasia Stulova2019-02-151-1/+3
| | | | | | Allow all OpenCL types to be parsed in C++ mode. llvm-svn: 354121
* Revert "Fix implementation of [temp.local]p4."Francis Visoiu Mistrih2019-02-154-112/+71
| | | | | | | | | This reverts commit 40bd10b770813bd1471d46f514545437516aa4ba. This seems to now emit an error when building the sanitizer tests: http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/53965/consoleFull. llvm-svn: 354097
* Fix implementation of [temp.local]p4.Richard Smith2019-02-154-71/+112
| | | | | | | | | | | | | | | | | | | | When a template-name is looked up, we need to give injected-class-name declarations of class templates special treatment, as they denote a template rather than a type. Previously we achieved this by applying a filter to the lookup results after completing name lookup, but that is incorrect in various ways, not least of which is that it lost all information about access and how members were named, and the filtering caused us to generally lose all ambiguity errors between templates and non-templates. We now preserve the lookup results exactly, and the few places that need to map from a declaration found by name lookup into a declaration of a template do so explicitly. Deduplication of repeated lookup results of the same injected-class-name declaration is done by name lookup instead of after the fact. llvm-svn: 354091
* PR40642: Fix determination of whether the final statement of a statementRichard Smith2019-02-153-93/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expression is a discarded-value expression. Summary: We used to get this wrong in three ways: 1) During parsing, an expression-statement followed by the }) ending a statement expression was always treated as producing the value of the statement expression. That's wrong for ({ if (1) expr; }) 2) During template instantiation, various kinds of statement (most statements not appearing directly in a compound-statement) were not treated as discarded-value expressions, resulting in missing volatile loads (etc). 3) In all contexts, an expression-statement with attributes was not treated as producing the value of the statement expression, eg ({ [[attr]] expr; }). Also fix incorrect enforcement of OpenMP rule that directives can "only be placed in the program at a position where ignoring or deleting the directive would result in a program with correct syntax". In particular, a label (be it goto, case, or default) should not affect whether directives are permitted. Reviewers: aaron.ballman, rjmccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57984 llvm-svn: 354090
* [Sema] Fix-up a -Wfloat-conversion diagnosticErik Pilkington2019-02-141-10/+10
| | | | | | | | | | | | We were warning on valid ObjC property reference exprs, and passing in the wrong arguments to DiagnoseFloatingImpCast (leading to a badly worded diagnostic). rdar://47644670 Differential revision: https://reviews.llvm.org/D58145 llvm-svn: 354074
* [Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"Bruno Ricci2019-02-141-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | D54902 removed CallExpr::setNumArgs in preparation of tail-allocating the arguments of CallExpr. It did this by allocating storage for max(number of arguments, number of parameters in the prototype). The temporarily nulled arguments however causes issues in BuildResolvedCallExpr when typo correction is done just after the creation of the call expression. This was unfortunately missed by the tests /: To fix this, delay setting the number of arguments to max(number of arguments, number of parameters in the prototype) until we are ready for it. It would be nice to have this encapsulated in CallExpr but this is the best I can come up with under the constraint that we cannot add anything the CallExpr. Fixes PR40286. Differential Revision: https://reviews.llvm.org/D57948 Reviewed By: aaron.ballman llvm-svn: 354035
* [Builtins] Treat `bcmp` as a builtin.Clement Courbet2019-02-141-8/+8
| | | | | | | | | | | | | | | | | Summary: This makes it consistent with `memcmp` and `__builtin_bcmp`. Also see the discussion in https://reviews.llvm.org/D56593. Reviewers: jyknight Subscribers: kristina, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58120 llvm-svn: 354023
* Restore Check for Unreachable Exit Block in -Winfinite-recursionRobert Widmann2019-02-131-0/+4
| | | | | | | | | | | | | | | | | | | Summary: When this was rewritten in D43737, the logic changed to better explore infinite loops. The check for a reachable exit block was deleted which accidentally introduced false positives in case the exit node was unreachable. We were testing for cases like this, but @steven_wu provided an additional test case that I've included in the regression tests for this patch. Reviewers: steven_wu, rtrieu Reviewed By: steven_wu, rtrieu Subscribers: cfe-commits, steven_wu Tags: #clang Differential Revision: https://reviews.llvm.org/D58122 llvm-svn: 353984
* [Sema] Delay checking whether objc_designated_initializer is being applied ↵Erik Pilkington2019-02-131-2/+24
| | | | | | | | | | | | | | | | to an init method This fixes a regression that was caused by r335084, which reversed the order that attributes are applied. objc_method_family can change whether a method is an init method, so the order that these attributes are applied matters. The commit fixes this by delaying the init check until after all attributes have been applied. rdar://47829358 Differential revision: https://reviews.llvm.org/D58152 llvm-svn: 353976
* [Sema] Fix a crash in access checking for deduction guidesIlya Biryukov2019-02-121-1/+5
| | | | | | | | | | | | | | | | Summary: See the added test for a repro. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58111 llvm-svn: 353840
* Renaming yet another diagnostic to not conflict; NFC.Aaron Ballman2019-02-121-1/+2
| | | | llvm-svn: 353839
* Renaming this diagnostic to not conflict with another; NFC.Aaron Ballman2019-02-121-1/+1
| | | | | | Amends r353837 which renamed the diagnostics to conflict. llvm-svn: 353838
* Fixing a typo; NFC.Aaron Ballman2019-02-121-3/+3
| | | | llvm-svn: 353837
* Add a new attribute, fortify_stdlibErik Pilkington2019-02-111-0/+29
| | | | | | | | | | | | | | | | | | | | | | This attribute applies to declarations of C stdlib functions (sprintf, memcpy...) that have known fortified variants (__sprintf_chk, __memcpy_chk, ...). When applied, clang will emit calls to the fortified variant functions instead of calls to the defaults. In GCC, this is done by adding gnu_inline-style wrapper functions, but that doesn't work for us for variadic functions because we don't support __builtin_va_arg_pack (and have no intention to). This attribute takes two arguments, the first is 'type' argument passed through to __builtin_object_size, and the second is a flag argument that gets passed through to the variadic checking variants. rdar://47905754 Differential revision: https://reviews.llvm.org/D57918 llvm-svn: 353765
* [Sema] Mark GNU compound literal array init as an rvalue.Eli Friedman2019-02-111-7/+33
| | | | | | | | | | | | | | | | | | | | | | Basically the same issue as string init, except it didn't really have any visible consequences before I removed the implicit lvalue-to-rvalue conversion from CodeGen. While I'm here, a couple minor drive-by cleanups: IgnoreParens never returns a ConstantExpr, and there was a potential crash with string init involving a ChooseExpr. The analyzer test change maybe indicates we could simplify the analyzer code a little with this fix? Apparently a hack was added to support lvalues in initializers in r315750, but I'm not really familiar with the relevant code. Fixes regression reported in the kernel build at https://bugs.llvm.org/show_bug.cgi?id=40430#c6 . Differential Revision: https://reviews.llvm.org/D58069 llvm-svn: 353762
* Make some helper functions static. NFC.Benjamin Kramer2019-02-111-2/+2
| | | | llvm-svn: 353705
* [Sema] Make string literal init an rvalue.Eli Friedman2019-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This allows substantially simplifying the expression evaluation code, because we don't have to special-case lvalues which are actually string literal initialization. This currently throws away an optimization where we would avoid creating an array APValue for string literal initialization. If we really want to optimize this case, we should fix APValue so it can store simple arrays more efficiently, like llvm::ConstantDataArray. This shouldn't affect the memory usage for other string literals. (Not sure if this is a blocker; I don't think string literal init is common enough for this to be a serious issue, but I could be wrong.) The change to test/CodeGenObjC/encode-test.m is a weird side-effect of these changes: we currently don't constant-evaluate arrays in C, so the strlen call shouldn't be folded, but lvalue string init managed to get around that check. I this this is fine. Fixes https://bugs.llvm.org/show_bug.cgi?id=40430 . llvm-svn: 353569
* [OPENMP]Delay emission of the error messages for the exceptions.Alexey Bataev2019-02-084-12/+67
| | | | | | | | | | Fixed diagnostic emission for the exceptions support in case of the compilation of OpenMP code for the devices. From now on, it uses delayed diagnostics mechanism, previously used for CUDA only. It allow to diagnose not allowed used of exceptions only in functions that are going to be codegen'ed. llvm-svn: 353542
* Revert "[OPENMP]Initial support for the delayed diagnostics."Alexey Bataev2019-02-084-67/+12
| | | | | | | This reverts commit r353540. Erroneously committed, need to fix the message and description. llvm-svn: 353541
* [OPENMP]Initial support for the delayed diagnostics.Alexey Bataev2019-02-084-12/+67
| | | | | | | | | It is important to delay the emission of the diagnostic messages for the functions unless it is proved that the function is going to be used on the device side. It is required to support compilation with some of the target-specific system headers. llvm-svn: 353540
* [Sema][ObjC] Disallow non-trivial C struct fields in unions.Akira Hatanaka2019-02-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug where clang doesn’t reject union fields of non-trivial C struct types. For example: ``` // This struct is non-trivial under ARC. struct S0 { id x; }; union U0 { struct S0 s0; // clang should reject this. struct S0 s1; // clang should reject this. }; void test(union U0 a) { // Previously, both 'a.s0.x' and 'a.s1.x' were released in this // function. } ``` rdar://problem/46677858 Differential Revision: https://reviews.llvm.org/D55659 llvm-svn: 353459
* [SEMA]Generalize deferred diagnostic interface, NFC.Alexey Bataev2019-02-072-194/+197
| | | | | | | | | | | | | | | | | Summary: Deferred diagnostic interface is going to be used for OpenMP device compilation. Generalized previously existed deferred diagnostic interface for CUDA to be used with OpenMP and, possibly, other models. Reviewers: rjmccall, tra Subscribers: caomhin, cfe-commits, kkwli0 Tags: #clang Differential Revision: https://reviews.llvm.org/D57908 llvm-svn: 353456
* [OpenCL][PR40603] In C++ preserve compatibility with OpenCL C v2.0Anastasia Stulova2019-02-071-3/+4
| | | | | | | | | | Valid OpenCL C code should still compile in C++ mode. This change enables extensions and OpenCL types. Differential Revision: https://reviews.llvm.org/D57824 llvm-svn: 353431
* Test commit. NFCPatrick Lyster2019-02-061-1/+1
| | | | llvm-svn: 353320
* [OPENMP] issue error messages for multiple teams contructs in a target constructKelvin Li2019-02-051-1/+3
| | | | | | | | | | | | | | | | The fix is to issue error messages if there are more than one teams construct inside a target constructs. #pragma omp target { #pragma omp teams { ... } #pragma omp teams { ... } } llvm-svn: 353186
OpenPOWER on IntegriCloud