summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP]Use cast instead dyn_cast, NFC.Alexey Bataev2019-12-021-1/+1
| | | | Here the expression is always a DeclRefExpr, no need to use dyn_cast.
* [OPENMP]Fix PR44133: Emit definitions of used constructors/functions.Alexey Bataev2019-12-021-76/+41
| | | | | Need to fully rebuild the initializer/combiner when instatiating the declare reduction constrcut to properly emit used functions.
* [OpenCL] Fix address space for implicit conversion (PR43145)Sven van Haastregt2019-12-021-3/+20
| | | | | | | | | | Clang was creating a DerivedToBase ImplicitCastExpr that was also casting between address spaces as part of the second step in the standard conversion sequence. Defer the address space conversion to the third step in the sequence instead, such that we get a separate ImplicitCastExpr for the address space conversion. Differential Revision: https://reviews.llvm.org/D70605
* Revert "[ARM] Allocatable Global Register Variables for ARM"Carey Williams2019-11-291-2/+0
| | | | This reverts commit 2d739f98d8a53e38bf9faa88cdb6b0c2a363fb77.
* [CIndex] Fix annotate-deep-statements test when using a Debug buildAlexandre Ganea2019-11-291-1/+2
| | | | Differential Revision: https://reviews.llvm.org/D70149
* [mips] Check that features required by built-ins are enabledSimon Atanasyan2019-11-291-2/+31
| | | | | | | | | | | | Now Clang does not check that features required by built-in functions are enabled. That causes errors in the backend reported in PR44018. This patch fixes this bug by checking that required features are enabled. This should fix PR44018. Differential Revision: https://reviews.llvm.org/D70808
* [LifetimeAnalysis] Fix PR44150Gabor Horvath2019-11-271-7/+26
| | | | | | | | References need somewhat special treatment. While copying a gsl::Pointer will propagate the points-to set, creating an object from a reference often behaves more like a dereference operation. Differential Revision: https://reviews.llvm.org/D70755
* [OPENMP50]Add if clause in parallel for simd directive.Alexey Bataev2019-11-271-1/+6
| | | | | According to OpenMP 5.0, if clause can be used in parallel for simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
* [OpenCL] Move addr space deduction to Sema.Anastasia Stulova2019-11-275-241/+160
| | | | | | | | | | | | | | | | In order to simplify implementation we are moving add space deduction into Sema while constructing variable declaration and on template instantiation. Pointee are deduced to generic addr space during creation of types. This commit also - fixed addr space dedution for auto type; - factors out in a separate helper function OpenCL specific logic from type diagnostics in var decl. Tags: #clang Differential Revision: https://reviews.llvm.org/D65744
* [OPENMP]Fix PR44133: crash on lambda reductions in templates.Alexey Bataev2019-11-261-32/+51
| | | | | | Need to perform the instantiation of the combiner/initializer even if the resulting type is not dependent, if the construct is defined in templates in some cases.
* Partially reland "[Diagnostics] Put "deprecated copy" warnings into ↵Dávid Bolvanský2019-11-261-5/+5
| | | | | | -Wdeprecated-copy"" But do not enable it under -Wextra until libcxx issue is solved.
* [OpenCL] Add work-group and miscellaneous vector builtin functionsSven van Haastregt2019-11-261-1/+56
| | | | | | | Add the work-group and miscellaneous vector builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt.
* Revert "[Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copy"Tom Stellard2019-11-251-4/+3
| | | | | | This reverts commit 9353c5dd0664ea444236e527bf93566e11dc34df. This commit introduced bot falures for multi-stage bots with -Werror.
* [Diagnostics] Warn for comparison with string literals expanded from macro ↵Dávid Bolvanský2019-11-241-40/+45
| | | | | | | | | | | | | | | | | | (PR44064) Summary: As noted in PR, we have a poor test coverage for this warning. I think macro support was just overlooked. GCC warns in these cases. Clang missed a real bug in the code I am working with, GCC caught it. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70624
* [Diagnostics] Make behaviour of Clang's -Wdeprecated-copy same as in GCCDávid Bolvanský2019-11-231-2/+3
| | | | Do not warn for functions that are explicitly marked delete or default, which follows the behavior of the GCC warning.
* Separate the MS inheritance model enum from the attribute, NFCReid Kleckner2019-11-223-20/+18
| | | | | | This avoids the need to include Attr.h in DeclCXX.h for a four-value enum. Removing the include will be done separately, since it is large and risky change.
* Move vtordisp mode from Attr class to LangOptions.h, NFCReid Kleckner2019-11-222-5/+5
| | | | | This removes one of the two uses of Attr.h in DeclCXX.h, reducing the need to include Attr.h as widely. LangOptions is already very popular.
* Revert "[Sema] Use the canonical type in function isVector"Akira Hatanaka2019-11-221-1/+1
| | | | | This reverts commit a6150b48cea00ab31e9335cc73770327acc4cb3a. The commit broke a few neon CodeGen tests.
* [Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copyDávid Bolvanský2019-11-221-3/+4
| | | | | | | | | | | | | | | | | Summary: GCC 9 added -Wdeprecated-copy (as part of -Wextra). This diagnostic is already implemented in Clang too, just hidden under -Wdeprecated (not on by default). This patch adds -Wdeprecated-copy and makes it compatible with GCC 9+. This diagnostic is heavily tested in deprecated.cpp, so I added simple tests just to check we warn when new flag/-Wextra is enabled. Reviewers: rsmith, dblaikie Reviewed By: dblaikie Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70342
* [Sema] Use the canonical type in function isVectorAkira Hatanaka2019-11-221-1/+1
| | | | | | | This fixes an assertion in Sema::CreateBuiltinBinOp that fails when one of the vector operand's element type is a typedef of __fp16. rdar://problem/55983556
* Don't report "main" as missing a prototype in freestanding modeBill Wendling2019-11-221-2/+4
| | | | | | | | | | | | | | | | | Summary: A user may want to use freestanding mode with the standard "main" entry point. It's not useful to warn about a missing prototype as it's not typical to have a prototype for "main". Reviewers: efriedma, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70588
* [OPENMP]Simplify processing of context selectors, NFC.Alexey Bataev2019-11-221-21/+11
|
* [coroutines] Remove assert on CoroutineParameterMoves in ↵Brian Gesiak2019-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Sema::buildCoroutineParameterMoves Summary: The assertion of CoroutineParameterMoves happens when build coroutine function with arguments multiple time while fails to build promise type. Fix: use return false instead. Test Plan: check-clang Reviewers: modocache, GorNishanov, rjmccall Reviewed By: modocache Subscribers: rjmccall, EricWF, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69022 Patch by junparser (JunMa)!
* [OPENMP]Fix behaviour of defaultmap for OpenMP 4.5.Alexey Bataev2019-11-221-6/+12
| | | | | | In OpenMP 4.5 pointers also must be considered as scalar types and defaultmap(tofrom:scalar) clause must affect mapping of the pointers too.
* [clangd] Show lambda signature for lambda autocompletionsKirill Bobyrev2019-11-221-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | The original bug report can be found [here](https://github.com/clangd/clangd/issues/85) Given the following code: ```c++ void function() { auto Lambda = [](int a, double &b) {return 1.f;}; La^ } ``` Triggering the completion at `^` would show `(lambda)` before this patch and would show signature `(int a, double &b) const`, build a snippet etc with this patch. Reviewers: sammccall Reviewed by: sammccall Differential revision: https://reviews.llvm.org/D70445
* [OPENMP50]Add device/kind context selector support.Alexey Bataev2019-11-212-3/+38
| | | | | | | | | | | | Summary: Added basic parsing/sema support for device/kind context selector. Reviewers: jdoerfert Subscribers: rampitec, aheejin, fedor.sergeev, simoncook, guansong, s.egerton, hfinkel, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70245
* [OPENMP]Fix datasharing checks for if clause in parallel taskloopAlexey Bataev2019-11-211-3/+7
| | | | | | | | directives. If the default datasharing is set to none, the datasharing attributes for variables in the condition of the if clause for the inner taskloop directive must be verified.
* [OPENMP50]Add if clause in for simd directive.Alexey Bataev2019-11-211-1/+3
| | | | | | According to OpenMP 5.0, if clause can be used in for simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
* [DeclCXX] Remove unknown external linkage specificationsEhud Katz2019-11-212-6/+0
| | | | | | | | | | | | | | | | Partial revert of r372681 "Support for DWARF-5 C++ language tags". The change introduced new external linkage languages ("C++11" and "C++14") which not supported in C++. It also changed the definition of the existing enum to use the DWARF constants. The problem is that "LinkageSpecDeclBits.Language" (the field that reserves this enum) is actually defined as 3 bits length (bitfield), which cannot contain the new DWARF constants. Defining the enum as integer literals is more appropriate for maintaining valid values. Differential Revision: https://reviews.llvm.org/D69935
* [OpenCL] Fix address space for base method call (PR43145)Sven van Haastregt2019-11-211-0/+14
| | | | | | | | Clang was creating an UncheckedDerivedToBase ImplicitCastExpr that was also casting between address spaces. Insert an ImplicitCastExpr node for doing the address space conversion. Differential Revision: https://reviews.llvm.org/D69810
* Atomics: support min/max orthogonallyTim Northover2019-11-211-17/+8
| | | | | | | | | | | | We seem to have been gradually growing support for atomic min/max operations (exposing longstanding IR atomicrmw instructions). But until now there have been gaps in the expected intrinsics. This adds support for the C11-style intrinsics (i.e. taking _Atomic, rather than individually blessed by C11 standard), and the variants that return the new value instead of the original one. That way, people won't be misled by trying one form and it not working, and the front-end is more friendly to people using _Atomic types, as we recommend.
* [Sema] Add a 'Semantic' parameter to Expr::isKnownToHaveBooleanValueErik Pilkington2019-11-201-1/+1
| | | | | | | | | Some clients of this function want to know about any expression that is known to produce a 0/1 value, and others care about expressions that are semantically boolean. This fixes a -Wswitch-bool regression I introduced in 8bfb353bb33c, pointed out by Chris Hamilton!
* [OPENMP50]Add if clause in simd directive.Alexey Bataev2019-11-191-1/+3
| | | | | | According to OpenMP 5.0, if clause can be used in simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
* [CGDebugInfo] Emit subprograms for decls when AT_tail_call is understood ↵Vedant Kumar2019-11-191-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (reland with fixes) Currently, clang emits subprograms for declared functions when the target debugger or DWARF standard is known to support entry values (DW_OP_entry_value & the GNU equivalent). Treat DW_AT_tail_call the same way to allow debuggers to follow cross-TU tail calls. Pre-patch debug session with a cross-TU tail call: ``` * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt] frame #1: 0x0000000100000f99 main`main at a.c:8:10 [opt] ``` Post-patch (note that the tail-calling frame, "helper", is visible): ``` * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt] frame #1: 0x0000000100000f80 main`helper [opt] [artificial] frame #2: 0x0000000100000f99 main`main at a.c:8:10 [opt] ``` This was reverted in 5b9a072c because it attached declaration subprograms to inlinable builtin calls, which interacted badly with the MergeICmps pass. The fix is to not attach declarations to builtins. rdar://46577651 Differential Revision: https://reviews.llvm.org/D69743
* Add a key method to Sema to optimize debug info sizeReid Kleckner2019-11-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that the debug info describing the Sema class is an appreciable percentage of the total object file size of objects in Sema. By adding a key function, clang is able to optimize the debug info size by emitting a forward declaration in TUs that do not define the key function. On Windows, with clang-cl, these are the total sizes of object files in Sema before and after this change, compiling with optimizations and debug info: before: 335,012 KB after: 278,116 KB delta: -56,896 KB percent: -17.0% The effect on link time was negligible, despite having ~56MB less input. On Linux, with clang, these are the same sizes using DWARF -g and optimizations: before: 603,756 KB after: 515,340 KB delta: -88,416 KB percent: -14.6% I didn't use type units, DWARF-5, fission, or any other special flags. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D70340
* [NFC] Refactor representation of materialized temporariesTyker2019-11-197-15/+14
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: thakis, sammccall, ilya-biryukov, rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))Pierre Habouzit2019-11-184-6/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __attribute__((objc_direct)) is an attribute on methods declaration, and __attribute__((objc_direct_members)) on implementation, categories or extensions. A `direct` property specifier is added (@property(direct) type name) These attributes / specifiers cause the method to have no associated Objective-C metadata (for the property or the method itself), and the calling convention to be a direct C function call. The symbol for the method has enforced hidden visibility and such direct calls are hence unreachable cross image. An explicit C function must be made if so desired to wrap them. The implicit `self` and `_cmd` arguments are preserved, however to maintain compatibility with the usual `objc_msgSend` semantics, 3 fundamental precautions are taken: 1) for instance methods, `self` is nil-checked. On arm64 backends this typically adds a single instruction (cbz x0, <closest-ret>) to the codegen, for the vast majority of the cases when the return type is a scalar. 2) for class methods, because the class may not be realized/initialized yet, a call to `[self self]` is emitted. When the proper deployment target is used, this is optimized to `objc_opt_self(self)`. However, long term we might want to emit something better that the optimizer can reason about. When inlining kicks in, these calls aren't optimized away as the optimizer has no idea that a single call is really necessary. 3) the calling convention for the `_cmd` argument is changed: the caller leaves the second argument to the call undefined, and the selector is loaded inside the body when it's referenced only. As far as error reporting goes, the compiler refuses: - making any overloads direct, - making an overload of a direct method, - implementations marked as direct when the declaration in the interface isn't (the other way around is allowed, as the direct attribute is inherited from the declaration), - marking methods required for protocol conformance as direct, - messaging an unqualified `id` with a direct method, - forming any @selector() expression with only direct selectors. As warnings: - any inconsistency of direct-related calling convention when @selector() or messaging is used, - forming any @selector() expression with a possibly direct selector. Lastly an `objc_direct_members` attribute is added that can decorate `@implementation` blocks and causes methods only declared there (and in no `@interface`) to be automatically direct. When decorating an `@interface` then all methods and properties declared in this block are marked direct. Radar-ID: rdar://problem/2684889 Differential Revision: https://reviews.llvm.org/D69991 Reviewed-By: John McCall
* [Attr] Fix `-ast-print` for `asm` attributeJoel E. Denny2019-11-181-5/+6
| | | | | | | | | | | | | | | | Without this fix, the tests introduced here produce the following assert fail: ``` clang: /home/jdenny/llvm/clang/include/clang/Basic/AttributeCommonInfo.h:163: unsigned int clang::AttributeCommonInfo::getAttributeSpellingListIndex() const: Assertion `(isAttributeSpellingListCalculated() || AttrName) && "Spelling cannot be found"' failed. ``` The bug was introduced by D67368, which caused `AsmLabelAttr`'s spelling index to be set to `SpellingNotCalculated`. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D70349
* Fix "not all control paths return a value" warning. NFCI.Simon Pilgrim2019-11-181-2/+3
|
* [ARM] Allocatable Global Register Variables for ARMAnna Welker2019-11-181-0/+2
| | | | | | | | | | | | Provides support for using r6-r11 as globally scoped register variables. This requires a -ffixed-rN flag in order to reserve rN against general allocation. If for a given GRV declaration the corresponding flag is not found, or the the register in question is the target's FP, we fail with a diagnostic. Differential Revision: https://reviews.llvm.org/D68862
* Revert "[NFC] Refactor representation of materialized temporaries"Nico Weber2019-11-177-14/+15
| | | | | | This reverts commit 08ea1ee2db5f9d6460fef1d79d0d1d1a5eb78982. It broke ./ClangdTests/FindExplicitReferencesTest.All on the bots, see comments on https://reviews.llvm.org/D69360
* [NFC] Refactor representation of materialized temporariesTyker2019-11-167-15/+14
| | | | | | | | | | | | | | | Summary: this patch refactor representation of materialized temporaries to prevent an issue raised by rsmith in https://reviews.llvm.org/D63640#inline-612718 Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: rnkovacs, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69360
* Avoid including Builtins.h in Preprocessor.hReid Kleckner2019-11-153-1/+4
| | | | | | Builtins are rarely if ever accessed via the Preprocessor. They are typically found on the ASTContext, so there should be no performance penalty to using a pointer indirection to store the builtin context.
* [OpenMP 5.0] - Extend defaultmap, by Chi Chun Chen.cchen2019-11-152-62/+265
| | | | | | | | | | | | | | | | | Summary: For the extended defaultmap, most of the work is inside sema. The only difference for codegen is to set different initial maptype for different implicit-behavior. Reviewers: jdoerfert, ABataev Reviewed By: ABataev Subscribers: dreachem, sandoval, cfe-commits Tags: #clang, #openmp Differential Revision: https://reviews.llvm.org/D69204
* Implement target(branch-protection) attribute for AArch64Momchil Velikov2019-11-151-0/+13
| | | | | | | | | This patch implements `__attribute__((target("branch-protection=...")))` in a manner, compatible with the analogous GCC feature: https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/AArch64-Function-Attributes.html#AArch64-Function-Attributes Differential Revision: https://reviews.llvm.org/D68711
* [CodeComplete] Constructor overload candidates report as vector(int) instead ↵Sam McCall2019-11-151-0/+4
| | | | | | | | | | | | | | | | | | | of vector<string>(int) Summary: This is shorter, shouldn't be confusing (is consistent with how they're declared), and avoids messy cases that are printed as myclass<type-param-0-0>(int) in the case of partial specialization. Fixes part of https://github.com/clangd/clangd/issues/76 Reviewers: hokein, lh123 Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70307
* [BPF] Add preserve_access_index attribute for record definitionYonghong Song2019-11-131-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a resubmission for the previous reverted commit 943436040121 with the same subject. This commit fixed the segfault issue and addressed additional review comments. This patch introduced a new bpf specific attribute which can be added to struct or union definition. For example, struct s { ... } __attribute__((preserve_access_index)); union u { ... } __attribute__((preserve_access_index)); The goal is to simplify user codes for cases where preserve access index happens for certain struct/union, so user does not need to use clang __builtin_preserve_access_index for every members. The attribute has no effect if -g is not specified. When the attribute is specified and -g is specified, any member access defined by that structure or union, including array subscript access and inner records, will be preserved through __builtin_preserve_{array,struct,union}_access_index() IR intrinsics, which will enable relocation generation in bpf backend. The following is an example to illustrate the usage: -bash-4.4$ cat t.c #define __reloc__ __attribute__((preserve_access_index)) struct s1 { int c; } __reloc__; struct s2 { union { struct s1 b[3]; }; } __reloc__; struct s3 { struct s2 a; } __reloc__; int test(struct s3 *arg) { return arg->a.b[2].c; } -bash-4.4$ clang -target bpf -g -S -O2 t.c A relocation with access string "0:0:0:0:2:0" will be generated representing access offset of arg->a.b[2].c. forward declaration with attribute is also handled properly such that the attribute is copied and populated in real record definition. Differential Revision: https://reviews.llvm.org/D69759
* [OpenCL] Add remaining vector data builtin functionsSven van Haastregt2019-11-131-1/+51
| | | | | | | Add the remaining half (fp16) vector data load and store builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt.
* [Sema] Add MacroQualified case for FunctionTypeUnwrapperLeonard Chan2019-11-121-1/+8
| | | | | | | | | | | | | | | | | | This is a fix for PR43315. An assertion error is hit for this minimal example: ``` //clang -cc1 -triple x86_64-- -S tstVMStructRC-min.cpp int (a b)(); // Assertion `Chunk.Kind == DeclaratorChunk::Function' failed. ``` This is because we do not cover the case in the FunctionTypeUnwrapper where it receives a MacroQualifiedType. We have not run into this earlier because this is a unique case where the __attribute__ contains both __cdecl__ and __regparm__ (in that order), and we are compiling for x86_64. Changing the architecture or the order of __cdecl__ and __regparm__ does not raise the assertion. Differential Revision: https://reviews.llvm.org/D67992
* [AST] Use an explicit copy in a range-based forMark de Wever2019-11-123-3/+3
| | | | | | | | | The AssociationIteratorTy type will be copied in a range-based for loop. Make the copy explicit to avoid the -Wrange-loop-analysis warning. This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D70045
OpenPOWER on IntegriCloud