summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprMember.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-1/+1
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368942 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Actually map a variable template specialization from pattern to ↵Erik Pilkington2019-07-301-8/+8
| | | | | | | | | | | | | instantiation We were previously just using a specialization in the class template instead of creating a new specialization in the class instantiation. Fixes llvm.org/PR42779. Differential revision: https://reviews.llvm.org/D65359 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367367 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-161-7/+7
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366177 91177308-0d34-0410-b5e6-96231b3b80d8
* For DR712: store on a MemberExpr whether it constitutes an odr-use.Richard Smith2019-06-111-3/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363087 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out duplicated code building a MemberExpr and marking itRichard Smith2019-06-061-28/+43
| | | | | | | | referenced. This reinstates r362563, reverted in r362597. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362757 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Factor out duplicated code building a MemberExpr and marking it" and ↵Benjamin Kramer2019-06-051-43/+28
| | | | | | | | "Convert MemberExpr creation and serialization to work the same way as" This reverts commits r362551 and r362563. Crashes during modules selfhost. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362597 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out duplicated code building a MemberExpr and marking itRichard Smith2019-06-051-28/+43
| | | | | | referenced. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362563 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out repeated code to build 'this' expressions and mark themRichard Smith2019-05-241-4/+2
| | | | | | referenced. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361588 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema][NFCI] Don't allocate storage for the various ↵Bruno Ricci2019-03-251-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CorrectionCandidateCallback unless we are going to do some typo correction The various CorrectionCandidateCallbacks are currently heap-allocated unconditionally. This was needed because of delayed typo correction. However these allocations represent currently 15.4% of all allocations (number of allocations) when parsing all of Boost (!), mostly because of ParseCastExpression, ParseStatementOrDeclarationAfterAttrtibutes and isCXXDeclarationSpecifier. Note that all of these callback objects are small. Let's not do this. Instead initially allocate the callback on the stack, and only do a heap allocation if we are going to do some typo correction. Do this by: 1. Adding a clone function to each callback, which will do a polymorphic clone of the callback. This clone function is required to be implemented by every callback (of which there is a fair amount). Make sure this is the case by making it pure virtual. 2. Use this clone function when we are going to try to correct a typo. This additionally cut the time of -fsyntax-only on all of Boost by 0.5% (not that much, but still something). No functional changes intended. Differential Revision: https://reviews.llvm.org/D58827 Reviewed By: rnk git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356925 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema/Attribute] Check for noderef attributeLeonard Chan2018-12-061-3/+25
| | | | | | | | | | This patch adds the noderef attribute in clang and checks for dereferences of types that have this attribute. This attribute is currently used by sparse and would like to be ported to clang. Differential Revision: https://reviews.llvm.org/D49511 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348442 91177308-0d34-0410-b5e6-96231b3b80d8
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-301-1/+1
| | | | | | | | | | We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345637 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing spaceFangrui Song2018-07-301-18/+18
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338291 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExprSteven Wu2018-05-241-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Remove the call to DiagnoseUseOfDecl in LookupMemberExpr because: 1. LookupMemberExpr eagerly lookup both getter and setter, reguardless if they are used or not. It causes wrong diagnostics if you are only using getter. 2. LookupMemberExpr only diagnoses getter, but not setter. 3. ObjCPropertyOpBuilder already DiagnoseUseOfDecl when building getter and setter. Doing it again in LookupMemberExpr causes duplicated diagnostics. rdar://problem/38479756 Reviewers: erik.pilkington, arphaman, doug.gregor Reviewed By: arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47280 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333148 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostics and error recovery for template name lookup.Richard Smith2018-05-111-16/+19
| | | | | | | | | | | | | | For 'x::template y', consistently give a "no member named 'y' in 'x'" diagnostic if there is no such member, and give a 'template keyword not followed by a template' name error if there is such a member but it's not a template. In the latter case, add a note pointing at the non-template. Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent if the lookup of X::Y was actually not a dependent lookup and found only non-templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332076 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-2/+2
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* Parse A::template B as an identifier rather than as a template-id with noRichard Smith2018-04-271-7/+7
| | | | | | | | | | | template arguments. This fixes some cases where we'd incorrectly accept "A::template B" when B is a kind of template that requires template arguments (in particular, a variable template or a concept). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331013 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out common code for diagnosing missing template arguments.Richard Smith2018-04-261-7/+3
| | | | | | | In passing, add 'concept' to the list of template kinds in diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330890 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Code cleanup and code improvements.Alexey Bataev2018-04-181-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330270 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with ↵Eric Fiselier2018-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multiple bases. Summary: Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths even though a qualified name is used. For example: ``` class B { protected: int i; union { int j; }; }; class X : public B { }; class Y : public B { }; class Z : public X, public Y { int a() { return X::i; } // works int b() { return X::j; } // fails }; ``` Reviewers: rsmith, aaron.ballman, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45411 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329521 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with ↵Eric Fiselier2018-04-081-1/+1
| | | | | | | | multiple bases." This reverts commit r329519. There are some unaddressed test failures. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329520 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with ↵Eric Fiselier2018-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multiple bases. Summary: Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths even though a qualified name is used. For example: ``` class B { protected: int i; union { int j; }; }; class X : public B { }; class Y : public B { }; class Z : public X, public Y { int a() { return X::i; } // works int b() { return X::j; } // fails }; ``` Reviewers: rsmith, aaron.ballman, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45411 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329519 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCIEric Fiselier2018-04-081-54/+20
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch cleans up a bunch of dead or unused code in BuildAnonymousStructUnionMemberReference. The dead code was a branch that built a new CXXThisExpr when we weren't given a base object expression or base variable. However, BuildAnonymousFoo has only two callers. One of which always builds a base object expression first, the second only calls when the IndirectFieldDecl is not a C++ class member. Even within C this branch seems entirely unused. I tried diligently to write a test which hit it with no success. This patch removes the branch and replaces it with an assertion that we were given either a base object expression or a base variable. Reviewers: rsmith, aaron.ballman, majnemer, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45410 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329518 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Avoid crash for category implementation without interfaceShoaib Meenai2018-03-271-0/+3
| | | | | | | | | | | When we have a category implementation without a corresponding interface (which is an error by itself), semantic checks for property accesses will attempt to access a null interface declaration and then segfault. Error out in such cases instead. Differential Revision: https://reviews.llvm.org/D44916 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328654 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid including ScopeInfo.h from Sema.hReid Kleckner2018-03-071-2/+3
| | | | | | | | | | | | | | | | | Summary: This provides no measurable build speedup, but it reinstates an optimization from r112038 that was lost in r179618. It requires moving CapturedScopeInfo::Capture out to clang::sema, which might be too general since we have plenty of other Capture records in BlockDecl and other AST nodes. Reviewers: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44221 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326957 91177308-0d34-0410-b5e6-96231b3b80d8
* Fif for an issue when Clang permits assignment to vector/extvector elements ↵Andrew V. Tischenko2018-02-091-0/+4
| | | | | | in a const method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324721 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum ↵Faisal Vali2017-12-301-1/+1
| | | | | | UnqualifiedIdKind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321574 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence a bunch of implicit fallthrough warningsAdrian Prantl2017-12-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321115 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -Wunused-private-field to fire regardless of which implicit special ↵Richard Smith2017-11-011-1/+3
| | | | | | members have been implicitly declared. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317076 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Restrict swizzle length check to OpenCL modeBruno Cardoso Lopes2017-10-171-1/+3
| | | | | | | | | | | Changes behavior introduced in r298369 to only error out on vector component invalid length access on OpenCL mode. Differential Revision: https://reviews.llvm.org/D38868 rdar://problem/33568748 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316016 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-101-2/+1
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315379 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Modules TS] Module ownership semantics for redeclarations."Eric Liu2017-10-101-1/+2
| | | | | | This reverts commit r315251. See the original commit thread for reason. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315309 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-091-2/+1
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315251 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the second half of PR34266: Don't implicitly capture '*this' if the ↵Faisal Vali2017-09-171-47/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | members are found in a class unrelated to the enclosing class. https://bugs.llvm.org/show_bug.cgi?id=34266 For e.g. struct A { void f(int); static void f(char); }; struct B { auto foo() { return [&] (auto a) { A::f(a); // this should not cause a capture of '*this' }; } }; The patch does the following: 1) It moves the check to attempt an implicit capture of '*this' by reference into the more logical location of when the call is actually built within ActOnCallExpr (as opposed to when the unresolved-member-lookup node is created). - Reminder: A capture of '*this' by value has to always be an explicit capture. 2) It additionally checks whether the naming class of the UnresolvedMemberExpr ('A' in the example above) is related to the enclosing class ('B' above). P.S. If you have access to ISO-C++'s CWG reflector, see this thread for some potentially related discussion: http://lists.isocpp.org/core/2017/08/2851.php git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313487 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r311839 (ongoing cwg discussion)Faisal Vali2017-08-291-1/+1
| | | | | | apologies. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311975 91177308-0d34-0410-b5e6-96231b3b80d8
* revert changes from r311851.Faisal Vali2017-08-271-7/+7
| | | | | | | | | The right answers here (and how clang needs to be tweaked) require further analysis (ongoing cwg thread). sorry. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311855 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't see through 'using member-declarations' when determining the relation ↵Faisal Vali2017-08-271-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | of any potential implicit object expression to the parent class of the member function containing the function call. Prior to this patch clang would not error here: template <class T> struct B; template <class T> struct A { void foo(); void foo2(); void test1() { B<T>::foo(); // OK, foo is declared in A<int> - matches type of 'this'. B<T>::foo2(); // This should be an error! // foo2 is found in B<int>, 'base unrelated' to 'this'. } }; template <class T> struct B : A<T> { using A<T>::foo2; }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311851 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass the correct object argument when a member call to an 'unrelated' class ↵Faisal Vali2017-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is made. Prior to this patch, clang would do the wrong thing here (see inline comments for pre-patch behavior): struct A { void bar(int) { } static void bar(double) { } void g(int*); static void g(char *); }; struct B { void f() { A::bar(3); // selects (double) ??!! A::g((int*)0); // Instead of no object argument, states conversion error?!! } }; The fix is as follows: When we detect that what appears to be an implicit member function call (A::bar) is actually a call to a member of a class (A) unrelated to the type (B) that contains the member function (B::f) from which the call is being made, don't treat it (A::bar) as an Implicit Member Call Expression. P.S. I wonder if there is an existing bug report related to this? (Surprisingly, a cursory search did not find one). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311839 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Fix DSA processing for member declaration.Alexey Bataev2017-07-201-2/+4
| | | | | | | | If the member declaration is captured in the OMPCapturedExprDecl, we may loose data-sharing attribute info for this declaration. Patch fixes this bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308629 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Skip BuildMemberExpr() in BuildFieldReferenceExpr(), NFC, by Kai NodaAlexey Bataev2017-07-111-5/+4
| | | | | | | | | In the OpenMP mode, we don't need to call BuildMemberExpr() only to discard its return value. BuildDeclRefExpr() is called instead. Differential revision: https://reviews.llvm.org/D35201 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307697 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped EnumFaisal Vali2017-04-011-7/+7
| | | | | | | | | - also replace direct equality checks against the ConstantEvaluated enumerator with isConstantEvaluted(), in anticipation of adding finer granularity to the various ConstantEvaluated contexts and reinstating certain restrictions on where lambda expressions can occur in C++17. - update the clang tablegen backend that uses these Enumerators, and add the relevant scope where needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299316 91177308-0d34-0410-b5e6-96231b3b80d8
* [Objective-C] Fix "repeated use of weak" warning with -fobjc-weakBrian Kelley2017-03-291-6/+4
| | | | | | | | | | | | | | Summary: -Warc-repeated-use-of-weak should produce the same warnings with -fobjc-weak as it does with -objc-arc. Also check for ObjCWeak along with ObjCAutoRefCount when recording the use of an evaluated weak variable. Add a -fobjc-weak run to the existing arc-repeated-weak test case and adapt it slightly to work in both modes. Reviewers: rsmith, doug.gregor, jordan_rose, rjmccall Reviewed By: rjmccall Subscribers: arphaman, rjmccall, cfe-commits Differential Revision: https://reviews.llvm.org/D31005 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299011 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Added diagnostic for checking length of vectorEgor Churaev2017-03-211-0/+21
| | | | | | | | | | | | Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D30937 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298369 91177308-0d34-0410-b5e6-96231b3b80d8
* [coroutines] Build and pass coroutine_handle to await_suspendGor Nishanov2017-03-091-1/+1
| | | | | | | | | | | | | | | | Summary: This patch adds passing a coroutine_handle object to await_suspend calls. It builds the coroutine_handle using coroutine_handle<PromiseType>::from_address(__builtin_coro_frame()). (a revision of https://reviews.llvm.org/D26316 that for some reason refuses to apply via arc patch) Reviewers: GorNishanov Subscribers: mehdi_amini, cfe-commits, EricWF Differential Revision: https://reviews.llvm.org/D30769 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297356 91177308-0d34-0410-b5e6-96231b3b80d8
* PR23135: Don't instantiate constexpr functions referenced in unevaluated ↵Richard Smith2017-01-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | operands where possible. This implements something like the current direction of DR1581: we use a narrow syntactic check to determine the set of places where a constant expression could be evaluated, and only instantiate a constexpr function or variable if it's referenced in one of those contexts, or is odr-used. It's not yet clear whether this is the right set of syntactic locations; we currently consider all contexts within templates that would result in odr-uses after instantiation, and contexts within list-initialization (narrowing conversions take another victim...), as requiring instantiation. We could in principle restrict the former cases more (only const integral / reference variable initializers, and contexts in which a constant expression is required, perhaps). However, this is sufficient to allow us to accept libstdc++ code, which relies on GCC's behavior (which appears to be somewhat similar to this approach). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291318 91177308-0d34-0410-b5e6-96231b3b80d8
* DR616, and part of P0135R1: member access (or pointer-to-member access) on aRichard Smith2016-12-031-0/+9
| | | | | | | | temporary produces an xvalue, not a prvalue. Support this by materializing the temporary prior to performing the member access. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288563 91177308-0d34-0410-b5e6-96231b3b80d8
* Mass-rename the handful of error_* diagnostics to err_*.Richard Smith2016-12-021-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288545 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: correct typo correction for ivars in @implementationSaleem Abdulrasool2016-11-171-3/+10
| | | | | | | | | | | | The previous typo correction handling assumed that ivars are only declared in the interface declaration rather than as a private ivar in the implementation. Adjust the handling to permit both interfaces. Assert earlier that the interface has been acquired to ensure that we can identify when both possible casts have failed. Addresses PR31040! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287238 91177308-0d34-0410-b5e6-96231b3b80d8
* P0217R3: Perform semantic checks and initialization for the bindings in aRichard Smith2016-08-111-30/+23
| | | | | | | | decomposition declaration for arrays, aggregate-like structs, tuple-like types, and (as an extension) for complex and vector types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278435 91177308-0d34-0410-b5e6-96231b3b80d8
* Add .rgba syntax extension to ext_vector_type typesPirama Arumuga Nainar2016-07-221-1/+29
| | | | | | | | | | | | | | | | | | Summary: This patch enables .rgba accessors to ext_vector_type types and adds tests for syntax validation and code generation. 'a' and 'b' can appear either in the point access mode or the numeric access mode (for indices 10 and 11). To disambiguate between the two usages, the accessor type is explicitly passed to relevant methods. Reviewers: rsmith Subscribers: Anastasia, bader, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D20602 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276455 91177308-0d34-0410-b5e6-96231b3b80d8