summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor functions PrintTemplateArgumentListSerge Pavlov2017-11-281-4/+4
| | | | | | | | | | | These functions were defined as static members of TemplateSpecializationType. Now they are moved to namespace level. Previously there were different implementations for lists containing TemplateArgument and TemplateArgumentLoc, now these implementations share the same code. This change is a result of refactoring patch D40508. NFC. llvm-svn: 319178
* [OPENMP] Codegen for `distribute parallel for simd` directive.Alexey Bataev2017-11-271-2/+13
| | | | | | Added proper codegen for `distribute parallel for simd` directive. llvm-svn: 319078
* Do not perform the analysis based warning if the warnings are ignoredOlivier Goffart2017-11-231-4/+4
| | | | | | | | | | | | | This saves some cycles when compiling with "-w". (Also fix a potential crash on invalid code for tools that tries to recover from some errors, because analysis might compute the CFG which crashes if the code contains invalid declaration. This does not happen normally with because we also don't perform these analysis if there was an error.) Differential Revision: https://reviews.llvm.org/D40242 llvm-svn: 318900
* [OPENMP] Add support for cancel constructs in `target teams distributeAlexey Bataev2017-11-221-2/+4
| | | | | | | | | parallel for`. Add support for cancel/cancellation point directives inside `target teams distribute parallel for` directives. llvm-svn: 318881
* [OPENMP] Add support for cancel constructs in [teams] distributeAlexey Bataev2017-11-221-3/+7
| | | | | | | | | parallel for directives. Added codegen/sema support for cancel constructs in [teams] distribute parallel for directives. llvm-svn: 318872
* [OPENMP] Added missed checks for for [simd] based directives.Alexey Bataev2017-11-221-0/+52
| | | | | | | Added missed checks/analysis for safelen/simdlen clauses + linear clause in for [simd] based directives. llvm-svn: 318860
* [OPENMP] General improvement of code, NFC.Alexey Bataev2017-11-221-3/+16
| | | | llvm-svn: 318849
* [OPENMP] Codegen for `target teams` directive.Alexey Bataev2017-11-221-0/+10
| | | | | | Added codegen of the clauses for `target teams` directive. llvm-svn: 318834
* The offsetof macro is intended to work with subobjects rather than simple ↵Aaron Ballman2017-11-211-9/+1
| | | | | | identifiers designating a member, making the -Wextended-offsetof diagnostic obsolete as this construct is not an extension. Implements WG14 DR496. llvm-svn: 318796
* [OPENMP] Initial support for asynchronous data update, NFC.Alexey Bataev2017-11-211-16/+103
| | | | | | | | | OpenMP 5.0 introduces asynchronous data update/dependecies clauses on target data directives. Patch adds initial support for outer task regions to use task-based codegen for future async target data directives. llvm-svn: 318781
* [Modules TS] Added module re-export support.Hamza Sood2017-11-211-4/+9
| | | | | | | This implements [dcl.modules.export] from the C++ Modules TS, which lets a module re-export another module with the "export import" syntax. Differential Revision: https://reviews.llvm.org/D40270 llvm-svn: 318744
* [OpenMP] Initial implementation of code generation for pragma 'teams ↵Carlo Bertolli2017-11-201-5/+111
| | | | | | | | | | distribute parallel for' on host https://reviews.llvm.org/D40187 This patch implements code gen for 'teams distribute parallel for' on the host, including all its clauses and related regression tests. llvm-svn: 318692
* Revert r318456 "Issue -Wempty-body warnings for else blocks"Hans Wennborg2017-11-201-3/+1
| | | | | | | | | | | | | | This caused warnings also when the if or else comes from macros. There was an attempt to fix this in r318556, but that introduced new problems and was reverted. Reverting this too until the whole issue is sorted. > This looks like it was just an oversight. > > Fixes http://llvm.org/pr35319 > > git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318456 91177308-0d34-0410-b5e6-96231b3b80d8 llvm-svn: 318667
* Revert r318556 "Loosen -Wempty-body warning"Hans Wennborg2017-11-202-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems this somehow made -Wempty-body fire in some macro cases where it didn't before, e.g. ../../third_party/ffmpeg/libavcodec/bitstream.c(169,5): error: if statement has empty body [-Werror,-Wempty-body] ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); ^ ../../third_party/ffmpeg\libavutil/internal.h(276,80): note: expanded from macro 'ff_dlog' # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) ^ ../../third_party/ffmpeg/libavcodec/bitstream.c(169,5): note: put the semicolon on a separate line to silence this warning Reverting until this can be figured out. > Do not show it when `if` or `else` come from macros. > E.g., > > #define USED(A) if (A); else > #define SOME_IF(A) if (A) > > void test() { > // No warnings are shown in those cases now. > USED(0); > SOME_IF(0); > } > > Patch by Ilya Biryukov! > > Differential Revision: https://reviews.llvm.org/D40185 llvm-svn: 318665
* [OpenMP] Show error if VLAs are not supportedJonas Hahnfeld2017-11-182-12/+25
| | | | | | | | | | | | | | Some target devices (e.g. Nvidia GPUs) don't support dynamic stack allocation and hence no VLAs. Print errors with description instead of failing in the backend or generating code that doesn't work. This patch handles explicit uses of VLAs (local variable in target or declare target region) or implicitly generated (private) VLAs for reductions on VLAs or on array sections with non-constant size. Differential Revision: https://reviews.llvm.org/D39505 llvm-svn: 318601
* Loosen -Wempty-body warningReid Kleckner2017-11-172-3/+2
| | | | | | | | | | | | | | | | | | | | Do not show it when `if` or `else` come from macros. E.g., #define USED(A) if (A); else #define SOME_IF(A) if (A) void test() { // No warnings are shown in those cases now. USED(0); SOME_IF(0); } Patch by Ilya Biryukov! Differential Revision: https://reviews.llvm.org/D40185 llvm-svn: 318556
* [ObjC][ARC] Honor noescape attribute for -Warc-retain-cyclesAlex Lorenz2017-11-171-2/+8
| | | | | | | | rdar://35409566 Differential Revision: https://reviews.llvm.org/D40141 llvm-svn: 318552
* [OPENMP] Codegen for `target simd` construct.Alexey Bataev2017-11-171-1/+12
| | | | | | Added codegen support for `target simd` directive. llvm-svn: 318536
* Issue -Wempty-body warnings for else blocksReid Kleckner2017-11-161-1/+3
| | | | | | | | This looks like it was just an oversight. Fixes http://llvm.org/pr35319 llvm-svn: 318456
* [AST, Sema] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2017-11-151-174/+275
| | | | | | other minor fixes (NFC). llvm-svn: 318341
* BuiltinOperatorOverloadBuilder: Don't consider types that are unavailable on ↵Hans Wennborg2017-11-151-71/+70
| | | | | | | | | | | | | the target (PR35174) In the PR, Clang ended up in a situation where it tried to mangle the __float128 type, which isn't supported when targetingt MSVC, because Clang instantiated a variable template with that type when searching for a conversion to use in an arithmetic expression. Differential revision: https://reviews.llvm.org/D39579 llvm-svn: 318309
* [clang] Expose orderedString from CodeCompletionResult. NFCSam McCall2017-11-151-16/+12
| | | | llvm-svn: 318286
* [OPENMP] Fix DSA analysis for threadprivates after deserialization.Alexey Bataev2017-11-141-0/+6
| | | | | | | If threadprivate vaible is deserialized, it is not marked as threadprivate in DSAStack. llvm-svn: 318194
* [completion] complete ObjC interface names in an expressionAlex Lorenz2017-11-141-2/+9
| | | | | | | | Objective-C interfaces can be used in a class property expression. rdar://26982192 llvm-svn: 318129
* [Sema] Stable sort OverloadCandidates to remove non-deterministic orderingMandeep Singh Grang2017-11-141-1/+1
| | | | | | | | | | | | | | | | Summary: This fixes failure in Misc/diag-template-diffing.cpp uncovered by D39245. Reviewers: rjmccall, rsmith Reviewed By: rjmccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D39944 llvm-svn: 318121
* [CodeGen] fix const-ness of cbrt and fmaSanjay Patel2017-11-131-7/+25
| | | | | | | | | | | cbrt() is always constant because it can't overflow or underflow. Therefore, it can't set errno. fma() is not always constant because it can overflow or underflow. Therefore, it can set errno. But we know that it never sets errno on GNU / MSVC, so make it constant in those environments. Differential Revision: https://reviews.llvm.org/D39641 llvm-svn: 318093
* [OpenMP] diagnose assign to firstprivate const, patch by Joel E. DennyAlexey Bataev2017-11-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: [OpenMP] diagnose assign to firstprivate const Clang does not diagnose assignments to const variables declared firstprivate. Furthermore, codegen is broken such that, at run time, such assignments simply have no effect. For example, the following prints 0 not 1: int main() { const int i = 0; #pragma omp parallel firstprivate(i) { i=1; printf("%d\n", i); } return 0; } This commit makes these assignments a compile error, which is consistent with other OpenMP compilers I've tried (pgcc 17.4-0, gcc 6.3.0). Reviewers: ABataev Reviewed By: ABataev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39859 llvm-svn: 317891
* [OPENMP] Codegen for `#pragma omp target parallel for simd`.Alexey Bataev2017-11-091-6/+16
| | | | | | Added codegen for `#pragma omp target parallel for simd` and clauses. llvm-svn: 317813
* [ObjC] Fix function signature handling for blocks literals with attributesAlex Lorenz2017-11-081-2/+2
| | | | | | | | | | | | | | Block literals can have a type with attributes in its signature, e.g. ns_returns_retained. The code that inspected the type loc of the block when declaring its parameters didn't account for this fact, and only looked through paren type loc. This commit ensures that getAsAdjusted is used instead of IgnoreParens to find the block's FunctionProtoTypeLoc. This ensures that block parameters are declared correctly in the block and avoids the 'undeclared identifier' error. rdar://35416160 llvm-svn: 317736
* [ObjC] Boxed strings should use the nullability from stringWithUTF8String's ↵Alex Lorenz2017-11-081-0/+7
| | | | | | | | | | | | | | | | | | return type Objective-C NSString has a class method stringWithUTF8String that creates a new NSString from a C string. Objective-C box expression @(...) can be used to create an NSString instead of invoking the stringWithUTF8String method directly (The compiler lowers it down to the invocation though). This commit ensures that the type of @(string-value) gets the same nullability attributes as the return type of stringWithUTF8String to ensure that the diagnostics are consistent between the two. rdar://33847186 Differential Revision: https://reviews.llvm.org/D39762 llvm-svn: 317727
* [OPENMP] Codegen for `#pragma omp target parallel for`.Alexey Bataev2017-11-081-5/+77
| | | | llvm-svn: 317719
* Avoid printing some redundant name qualifiers in completionIlya Biryukov2017-11-081-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adjusted PrintingPolicy inside code completion to avoid printing some redundant name qualifiers. Before this change, typedefs that were written unqualified in source code were printed with qualifiers in completion. For example, in the following code struct foo { typedef int type; type method(); }; completion item for `method` had return type of `foo::type`, even though the original code used `type` without qualifiers. After this change, the completion item has return type `type`, as originally written in the source code. Note that this change does not suppress qualifiers written by the user. For example, in the following code typedef int type; struct foo { typedef int type; ::type method(foo::type); }; completion item for `method` has return type of `::type` and parameter type of `foo::type`, as originally written in the source code. Reviewers: arphaman, bkramer, klimek Reviewed By: arphaman Subscribers: mgorny, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D38538 llvm-svn: 317677
* [X86] Add masked vcvtps2ph builtins to CheckX86BuiltinFunctionCall.Craig Topper2017-11-081-0/+3
| | | | | | This ensures that only immediates that fit in 8-bits are used. This matches what we do for the unmasked versions. llvm-svn: 317664
* [ObjC++] Don't warn about pessimizing move for __block variablesAlex Lorenz2017-11-071-0/+4
| | | | | | rdar://33316951 llvm-svn: 317620
* Replace a use of std::for_each() with llvm::for_each(); NFC.Aaron Ballman2017-11-031-2/+1
| | | | llvm-svn: 317359
* Add default calling convention support for regcall.Erich Keane2017-11-021-0/+7
| | | | | | | | | | | Added support for regcall as default calling convention. Also added code to exclude main when applying default calling conventions. Patch-By: eandrews Differential Revision: https://reviews.llvm.org/D39210 llvm-svn: 317268
* [OpenMP] Extend "Avoid VLAs for reduction" optimization to VLAs as baseJonas Hahnfeld2017-11-021-1/+1
| | | | | | | | | We can generate constant sized arrays whenever the array section has constant length, even if the base expression itself is a VLA. Differential Revision: https://reviews.llvm.org/D39504 llvm-svn: 317207
* Fix missing -Wregister warning when 'register' is applied to a function ↵Richard Smith2017-11-011-0/+8
| | | | | | parameter. llvm-svn: 317140
* Fix -Wunused-private-field to fire regardless of which implicit special ↵Richard Smith2017-11-012-2/+5
| | | | | | members have been implicitly declared. llvm-svn: 317076
* Change assertion to quick exit from checking function.Richard Trieu2017-11-011-3/+2
| | | | | | | Remove the assertion that could be triggered by invalid code. Replace it with an early exit from the checking function. llvm-svn: 317073
* [c++17] Refine resolution of constructor / conversion function disambiguation.Richard Smith2017-11-011-14/+12
| | | | | | | | | | | | Given a choice between a constructor call and a conversion function in C++17, we prefer the constructor for direct-initialization and the conversion function for copy-initialization, matching the behavior in C++14 and before. The guaranteed copy elision rules were not intended to change the meaning of such code (other than by removing unnecessary copy constructor calls). This tweak will be raised with CWG. llvm-svn: 317066
* [modules] Retain multiple using-directives in the same scope even if they ↵Richard Smith2017-10-301-3/+3
| | | | | | | | | | | | name the same namespace. They might have different visibility, and thus discarding all but one of them can result in rejecting valid code. Also fix name lookup to cope with multiple using-directives being found that denote the same namespace, where some are not visible -- don't cache an "already visited" state for a using-directive that we didn't visit because it was hidden. llvm-svn: 316965
* PR35039: Materialize temporary objects before wrapping them in anRichard Smith2017-10-281-0/+10
| | | | | | | | | OpaqueValueExpr in a GNU binary conditional expression. It's not meaningful for a non-materialized temporary object to be used as a common subexpression of multiple expressions. llvm-svn: 316836
* Never try to instantiate a deduction guide's "definition". Fixes bogus ↵Richard Smith2017-10-281-1/+2
| | | | | | warning when there inevitably isn't one. llvm-svn: 316820
* [MS] Allow access to ambiguous, inaccessible direct basesReid Kleckner2017-10-271-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang typically warns that in the following class hierarchy, 'A' is inaccessible because there is no series of casts that the user can write to access it unambiguously: struct A { }; struct B : A { }; struct C : A, B { }; MSVC allows the user to convert from C* to A*, though, and we've encountered this issue in the latest Windows SDK headers. This patch allows this conversion when -fms-compatibility is set and adds a warning for it under -Wmicrosoft-inaccessible-base. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39389 llvm-svn: 316807
* [Sema] Fix an assert-on-invalid by avoiding function template specialisationAlex Lorenz2017-10-271-4/+4
| | | | | | | | | | | | | deduction for invalid functions The fabricated template parameters cause an assertion because their depth is invalid. rdar://34109988 Differential Revision: https://reviews.llvm.org/D37341 llvm-svn: 316778
* Test commitIvan Donchevskii2017-10-271-1/+1
| | | | llvm-svn: 316758
* [Sema] -Wzero-as-null-pointer-constant: don't warn for system macros other ↵Roman Lebedev2017-10-261-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than NULL. Summary: The warning was initially introduced in D32914 by @thakis, and the concerns were raised there, and later in rL302247 and PR33771. I do believe that it makes sense to relax the diagnostic e.g. in this case, when the expression originates from the system header, which can not be modified. This prevents adoption for the diagnostic for codebases which use pthreads (`PTHREAD_MUTEX_INITIALIZER`), gtest, etc. As @malcolm.parsons suggests, it *may* make sense to also not warn for the template types, but it is not obvious to me how to do that in here. Though, it still makes sense to complain about `NULL` macro. While there, add more tests. Reviewers: dblaikie, thakis, rsmith, rjmccall, aaron.ballman Reviewed By: thakis Subscribers: Rakete1111, hans, cfe-commits, thakis, malcolm.parsons Tags: #clang Differential Revision: https://reviews.llvm.org/D38954 llvm-svn: 316662
* Fix overloaded static functions in SemaCodeCompleteBenjamin Kramer2017-10-262-9/+23
| | | | | | | | | | | | | | | | | | | | | https://bugs.llvm.org/show_bug.cgi?id=33904 Happens when static function is accessed via the class variable. That leads to incorrect overloads number because the variable is considered as the first argument. struct Bar { static void foo(); static void foo(int); }; int main() { Bar b; b.foo(/*complete here*/); // did not work before Bar::foo(/*complete here*/); // worked fine } Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D36390 llvm-svn: 316646
* Ignore implicity casts for zero-as-null-pointer-constant warningErich Keane2017-10-251-1/+1
| | | | | | | | | | The repro in https://bugs.llvm.org/show_bug.cgi?id=34362 caused the left nullptr to be cast to a int* implicitly, which resulted diagnosing this falsely. Differential Revision: https://reviews.llvm.org/D39301 llvm-svn: 316605
OpenPOWER on IntegriCloud