summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix behavior of __builtin_bit_cast when the From and To types are theRichard Smith2019-10-071-5/+0
| | | | | | | | | | same. We were missing the lvalue-to-rvalue conversion entirely in this case, and in fact still need the full CK_LValueToRValueBitCast conversion to perform a load with no TBAA. llvm-svn: 373874
* Implements CWG 1601 in [over.ics.rank/4.2]Richard Smith2019-10-061-0/+42
| | | | | | | | | | | | | | | | | | | Summary: The overload resolution for enums with a fixed underlying type has changed in the C++14 standard. This patch implements the new rule. Patch by Mark de Wever! Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65695 llvm-svn: 373866
* [Sema] Avoids an assertion failure when an invalid conversion declaration is ↵Richard Smith2019-10-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | used Summary: When using a user-defined conversion function template with a deduced return type the compiler gives a set of warnings: ``` bug.cc:252:44: error: cannot specify any part of a return type in the declaration of a conversion function; use an alias template to declare a conversion to 'auto (Ts &&...) const' template <typename... Ts> operator auto()(Ts &&... xs) const; ^~~~~~~~~~~~~~~~~~~ bug.cc:252:29: error: conversion function cannot convert to a function type template <typename... Ts> operator auto()(Ts &&... xs) const; ^ error: pointer to function type cannot have 'const' qualifier ``` after which it triggers an assertion failure. It seems the last error is incorrect and doesn't have any location information. This patch stops the compilation after the second warning. Fixes bug 31422. Patch by Mark de Wever! Reviewers: rsmith Reviewed By: rsmith Subscribers: bbannier, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64820 llvm-svn: 373862
* [Diagnostics] Highlight expr's source range for -Wbool-operationDavid Bolvansky2019-10-051-0/+1
| | | | | | Warning message looks better; and GCC adds it too. llvm-svn: 373828
* SemaTemplate - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-4/+4
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373827
* TreeTransform - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-4/+4
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373826
* Remove redundant !HasDependentValue check. NFCI.Simon Pilgrim2019-10-051-1/+1
| | | | | | Fixes cppcheck warning. llvm-svn: 373825
* SemaStmt - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-051-5/+5
| | | | | | The static analyzer is warning about potential null dereferences, but we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373824
* [Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise ↵David Bolvansky2019-10-051-1/+1
| | | | | | | | negation of bool in languages without a bool type Thanks for this advice, Richard Trieu! llvm-svn: 373817
* [clang] fix a typo from r372531Yuanfang Chen2019-10-041-1/+1
| | | | | | | | | | | | Reviewers: xbolva00 Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68482 llvm-svn: 373792
* [Sema] Split out -Wformat-type-confusion from -Wformat-pedanticErik Pilkington2019-10-041-15/+33
| | | | | | | | | The warnings now in -Wformat-type-confusion don't align with how we interpret 'pedantic' in clang, and don't belong in -pedantic. Differential revision: https://reviews.llvm.org/D67775 llvm-svn: 373774
* SemaDeclAttr - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-041-4/+4
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373753
* [CodeComplete] Ensure object is the same in compareOverloads()Ilya Biryukov2019-10-041-0/+3
| | | | | | | | | | | | | | | | | | Summary: This fixes a regression that led to size() not being available in clangd when completing 'deque().^' and using libc++. Reviewers: sammccall Reviewed By: sammccall Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68335 llvm-svn: 373710
* Properly handle instantiation-dependent array bounds.Richard Smith2019-10-049-33/+46
| | | | | | | | | We previously failed to treat an array with an instantiation-dependent but not value-dependent bound as being an instantiation-dependent type. We now track the array bound expression as part of a constant array type if it's an instantiation-dependent expression. llvm-svn: 373685
* Check for qualified function types after substituting into the operandRichard Smith2019-10-032-1/+16
| | | | | | | | | | of 'typeid'. This is a rare place where it's valid for a function type to be substituted but not valid for a qualified function type to be substituted, so needs a special check. llvm-svn: 373648
* PR43547: substitute into the type of a non-type template parameter ifRichard Smith2019-10-031-3/+1
| | | | | | | | it's instantiation-dependent, even if it's not dependent. There might be a SFINAE check in the parameter type. llvm-svn: 373643
* [Diagnostics] Bitwise negation of a boolean expr always evaluates to true; ↵David Bolvansky2019-10-031-1/+3
| | | | | | | | | warn with -Wbool-operation Requested here: http://lists.llvm.org/pipermail/cfe-dev/2019-October/063452.html llvm-svn: 373614
* Silence static analyzer getAs<RecordType> null dereference warnings. NFCI.Simon Pilgrim2019-10-039-16/+17
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<RecordType> directly and if not assert will fire for us. llvm-svn: 373584
* [OPENMP50]Add parsing/sema analysis for declare variant score.Alexey Bataev2019-10-022-3/+23
| | | | | | | | Context selectors may include optional score clause in format `score(<expr>):`, where `<expr>` must be a constant integer expression. Added parsing/sema analysis only. llvm-svn: 373502
* Silence static analyzer getAs<VectorType> null dereference warnings. NFCI.Simon Pilgrim2019-10-021-5/+5
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<VectorType> directly and if not assert will fire for us. llvm-svn: 373478
* SemaOverload - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-021-25/+25
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373475
* SemaInit - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-10-021-16/+16
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373474
* Rename TypeNodes.def to TypeNodes.inc for consistency across allJohn McCall2019-10-024-5/+5
| | | | | | | | our autogenerated files. NFC. As requested by Nico Weber. llvm-svn: 373425
* Revert r368237 - Update fix-it hints for std::move warnings.Richard Trieu2019-10-021-27/+24
| | | | | | | | r368237 attempted to improve fix-its for move warnings, but introduced some regressions to -Wpessimizing-move. Revert that change and add the missing test cases to the pessimizing move test to prevent future regressions. llvm-svn: 373421
* [OPENMP]Fix PR43516: Compiler crash with collapse(2) on non-rectangularAlexey Bataev2019-10-011-5/+13
| | | | | | | | | loop. Missed check if the condition is also dependent when building final expressions for the collapsed loop directives. llvm-svn: 373348
* [clang] Make handling of unnamed template params similar to function paramsKadir Cetinkaya2019-10-011-9/+4
| | | | | | | | | | | | | | | | | | | | | Summary: Clang uses the location identifier should be inserted for declarator decls when a decl is unnamed. But for type template and template template paramaters it uses the location of "typename/class" keyword, which makes it hard for tooling to insert/change parameter names. This change tries to unify these two cases by making template parameter parsing and sourcerange operations similar to function params/declarator decls. Reviewers: ilya-biryukov Subscribers: arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68143 llvm-svn: 373340
* [Diagnostics] Warn if enumeration type mismatch in conditional expressionDavid Bolvansky2019-09-301-0/+28
| | | | | | | | | | | | | | | | | | Summary: - Useful warning - GCC compatibility (GCC warns in C++ mode) Reviewers: rsmith, aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67919 llvm-svn: 373252
* [OPENMP50]Do not emit warning for the function with the currentlyAlexey Bataev2019-09-301-2/+3
| | | | | | | | | defined body. If the function is currently defined, we should not emit a warning that it might be emitted already because it was not really emitted. llvm-svn: 373243
* [OPENMP] Fix comment, NFC.Alexey Bataev2019-09-301-1/+1
| | | | llvm-svn: 373210
* Don't crash if a variable with a constexpr destructor has aRichard Smith2019-09-291-1/+2
| | | | | | value-dependent initializer. llvm-svn: 373173
* For P0784R7: compute whether a variable has constant destruction if itRichard Smith2019-09-291-0/+13
| | | | | | | | | | has a constexpr destructor. For constexpr variables, reject if the variable does not have constant destruction. In all cases, do not emit runtime calls to the destructor for variables with constant destruction. llvm-svn: 373159
* SemaExpr - silence static analyzer getAs<> null dereference warnings. NFCI.Simon Pilgrim2019-09-281-30/+30
| | | | | | The static analyzer is warning about potential null dereferences, but in these cases we should be able to use castAs<> directly and if not assert will fire for us. llvm-svn: 373150
* [clang] [AST] Treat "inline gnu_inline" the same way as "extern inline ↵Martin Storsjo2019-09-271-0/+3
| | | | | | | | | | | | | | | | | gnu_inline" in C++ mode This matches how GCC handles it, see e.g. https://gcc.godbolt.org/z/HPplnl. GCC documents the gnu_inline attribute with "In C++, this attribute does not depend on extern in any way, but it still requires the inline keyword to enable its special behavior." The previous behaviour of gnu_inline in C++, without the extern keyword, can be traced back to the original commit that added support for gnu_inline, SVN r69045. Differential Revision: https://reviews.llvm.org/D67414 llvm-svn: 373078
* For P0784R7: Add support for dynamic allocation with new / delete duringRichard Smith2019-09-271-0/+6
| | | | | | constant evaluation. llvm-svn: 373036
* [OpenMP 5.0] Fix user-defined mapper lookup in semaMichael Kruse2019-09-261-3/+11
| | | | | | | | | | | | This patches fixes the case when a user-defined mapper is attached to the elements of an array, and to report error when a mapper is used for types other than struct, class, and union. Patch by Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D67978 llvm-svn: 373023
* Always rebuild a DeclRefExpr if its FoundDecl would change.Richard Smith2019-09-261-0/+1
| | | | | | Fixes a regression introduced by r369999. llvm-svn: 373022
* [OPENMP50]Emit warnings if the functions was defined/used before markedAlexey Bataev2019-09-261-4/+8
| | | | | | | | | declare variant. We can use the original function if it was used/emitted already. So, just use warnings for these cases, not errors. llvm-svn: 373010
* [OPENMP50]Parsing/sema support for 'implementation/vendor' contextAlexey Bataev2019-09-252-6/+11
| | | | | | | | | selector. Added basic parsing/semantic support for 'implementation={vendor(<vendor>)}' context selector. llvm-svn: 372917
* [Mangle] Add flag to asm labels to disable '\01' prefixingVedant Kumar2019-09-251-7/+8
| | | | | | | | | | | | | | LLDB synthesizes decls using asm labels. These decls cannot have a mangle different than the one specified in the label name. I.e., the '\01' prefix should not be added. Fixes an expression evaluation failure in lldb's TestVirtual.py on iOS. rdar://45827323 Differential Revision: https://reviews.llvm.org/D67774 llvm-svn: 372903
* [CUDA][HIP] Enable kernel function return type deduction.Michael Liao2019-09-254-2/+21
| | | | | | | | | | | | | | | | | Summary: - Even though only `void` is still accepted as the deduced return type, enabling deduction/instantiation on the return type allows more consistent coding. Reviewers: tra, jlebar Subscribers: cfe-commits, yaxunl Tags: #clang Differential Revision: https://reviews.llvm.org/D68031 llvm-svn: 372898
* [OpenCL] Add image query builtin functionsSven van Haastregt2019-09-251-0/+25
| | | | | | | | | | Add the image query builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D67713 llvm-svn: 372833
* [NFC] Strenghten preconditions for warningDavid Bolvansky2019-09-241-1/+2
| | | | llvm-svn: 372775
* [HIP] Support new kernel launching APIYaxun Liu2019-09-241-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D67947 llvm-svn: 372773
* [Diagnostics] Handle tautological left shifts in boolean context David Bolvansky2019-09-241-5/+14
| | | | llvm-svn: 372749
* [Diagnostics] Do not diagnose unsigned shifts in boolean context ↵David Bolvansky2019-09-241-26/+21
| | | | | | | | (-Wint-in-bool-context) I was looking at old GCC's patch. Current "trunk" version avoids warning for unsigned case, GCC warns only for signed shifts. llvm-svn: 372708
* Support for DWARF-5 C++ language tags.Adrian Prantl2019-09-242-0/+6
| | | | | | | | | | | | This patch provides support for DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend. Patch by Sourabh Singh Tomar! Differential Revision: https://reviews.llvm.org/D67613 Reapplies r372663 after adapting a failing test in the LLDB testsuite. llvm-svn: 372681
* Revert "Support for DWARF-5 C++ language tags."Jonas Devlieghere2019-09-232-6/+0
| | | | | | This reverts commit bf9c8ffb54943c6d77398adbedddf05ef9724007. llvm-svn: 372672
* [Diagnostics] Warn for enum constants in bool context ↵David Bolvansky2019-09-231-1/+13
| | | | | | | | (-Wint-in-bool-context; GCC compatibility) Extracted from D63082. llvm-svn: 372664
* Support for DWARF-5 C++ language tags.Adrian Prantl2019-09-232-0/+6
| | | | | | | | | | This patch provides support for DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 tags in the Clang C++ frontend. Patch by Sourabh Singh Tomar! Differential Revision: https://reviews.llvm.org/D67613 llvm-svn: 372663
* [Sema] Fix the atomic expr rebuilding order.Michael Liao2019-09-232-28/+68
| | | | | | | | | | | | | | | | Summary: - Rearrange the atomic expr order to the API order when rebuilding atomic expr during template instantiation. Reviewers: erichkeane Subscribers: jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67924 llvm-svn: 372640
OpenPOWER on IntegriCloud