summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* NFC: Implement OMPClause dump in terms of visitorsStephen Kelly2019-01-152-21/+29
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56708 llvm-svn: 351236
* Implement CXXCtorInitializer dump in terms of VisitorStephen Kelly2019-01-152-11/+15
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56707 llvm-svn: 351235
* NFC: Move Decl node handling to TextNodeDumperStephen Kelly2019-01-152-68/+77
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56643 llvm-svn: 351175
* [ASTDump] NFC: Move dump of type nodes to NodeDumperStephen Kelly2019-01-152-88/+162
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56642 llvm-svn: 351172
* [ASTDump] NFC: Move dumping of QualType node to TextNodeDumperStephen Kelly2019-01-142-5/+9
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56641 llvm-svn: 351116
* [ASTDump] NFC: Canonicalize handling of TypeLocInfoStephen Kelly2019-01-141-4/+3
| | | | | | | | | | | | Summary: No need to avoid the Visit method. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56640 llvm-svn: 351115
* [ASTDump] NFC: Move Type Visit implementation to TextNodeDumperStephen Kelly2019-01-142-32/+45
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56639 llvm-svn: 351114
* NFC: Fix nits I missed beforeStephen Kelly2019-01-142-3/+2
| | | | llvm-svn: 351112
* [OpenCL] Set generic addr space of 'this' in special class members.Anastasia Stulova2019-01-141-2/+2
| | | | | | | | | | | | | | | | | Set address spaces of 'this' param correctly for implicit special class members. This also changes initialization conversion sequence to separate address space conversion from other qualifiers in case of binding reference to a temporary. In this case address space conversion should happen after the binding (unlike for other quals). This is needed to materialize it correctly in the alloca address space. Initial patch by Mikael Nilssoni! Differential Revision: https://reviews.llvm.org/D56066 llvm-svn: 351053
* [ASTDump] NFC: Move dump of individual Stmts to TextNodeDumperStephen Kelly2019-01-122-489/+467
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55340 llvm-svn: 351014
* Implement TemplateArgument dumping in terms of VisitorStephen Kelly2019-01-122-44/+68
| | | | | | | | | | | | Summary: Split the output streaming from the traversal to other AST nodes. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55491 llvm-svn: 351012
* [ASTDump] Change parameter to StringRefStephen Kelly2019-01-121-2/+2
| | | | llvm-svn: 351011
* NFC: Port loop to cxx_range_forStephen Kelly2019-01-121-3/+2
| | | | llvm-svn: 350984
* Implement Attr dumping in terms of visitorsStephen Kelly2019-01-112-19/+31
| | | | | | | | | | | | | | Remove now-vestigial dumpType and dumpBareDeclRef methods. The old tablegen generated code used to expect them to be present, but the new generated code has no such requirement. Reviewers: aaron.ballman Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D55492 llvm-svn: 350958
* [ASTDump] Add utility for dumping a label with child nodesStephen Kelly2019-01-111-7/+7
| | | | | | | | | | | | | | | | | | | Summary: Use it to add optional label nodes to Stmt dumps. This preserves behavior of InitExprList dump: // CHECK-NEXT: `-InitListExpr {{.+}} <col:13, col:15> 'U [3]' // CHECK-NEXT: |-array_filler: InitListExpr {{.+}} <col:15> 'U' field Field {{.+}} 'i' 'int' // CHECK-NEXT: `-InitListExpr {{.+}} <col:14> 'U' field Field {{.+}} 'i' 'int' // CHECK-NEXT: `-IntegerLiteral {{.+}} <col:14> 'int' 1 Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55488 llvm-svn: 350957
* Fix a pair of Wfallthrough warnings in ScanfFormatString.Erich Keane2019-01-111-0/+2
| | | | | Change-Id: Ia73a34fdd93fc974224583505f9e6432493cb0da llvm-svn: 350941
* [AST] Remove ASTContext from getThisType (NFC)Brian Gesiak2019-01-112-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D54862 removed the usages of `ASTContext&` from within the `CXXMethodDecl::getThisType` method. Remove the parameter altogether, as well as all usages of it. This does not result in any functional change because the parameter was unused since https://reviews.llvm.org/D54862. Test Plan: check-clang Reviewers: akyrtzi, mikael Reviewed By: mikael Subscribers: mehdi_amini, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D56509 llvm-svn: 350914
* NFC: Change case of identifiersStephen Kelly2019-01-102-3/+3
| | | | llvm-svn: 350890
* [AST] Move back BasePathSize to the bit-fields of CastExprBruno Ricci2019-01-092-51/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The number of trailing CXXBaseSpecifiers in CastExpr was moved from CastExprBitfields to a trailing object in r338489 (D50050). At this time these bit-fields classes were only 32 bits wide. However later r345459 widened these bit-field classes to 64 bits. The reason for this change was that on 64 bit archs alignment requirements caused 4 bytes of padding after the Stmt sub-object in nearly all expression classes. Reusing this padding yielded an >10% reduction in the size used by all statement/expressions when parsing all of Boost (on a 64 bit arch). This increased the size of statement/expressions for 32 bits archs, but this can be mitigated by moving more data to the bit-fields of Stmt (and moreover most people now care about 64 bits archs as a host). Therefore move back the number of CXXBaseSpecifiers in CastExpr to the bit-fields of Stmt. This in effect mostly revert r338489 while keeping the added test. Differential Revision: https://reviews.llvm.org/D56358 Reviewed By: lebedev.ri Reviewers: lebedev.ri, rjmccall llvm-svn: 350741
* [AST] Store the results in OverloadExpr in a trailing arrayBruno Ricci2019-01-091-109/+125
| | | | | | | | | | | | | | | Use the newly available space in the bit-fields of Stmt to pack OverloadExpr, UnresolvedLookupExpr and UnresolvedMemberExpr. Additionally store the results in the overload set in a trailing array. This saves 1 pointer + 8 bytes per UnresolvedLookupExpr and UnresolvedMemberExpr. Differential Revision: https://reviews.llvm.org/D56368 Reviewed By: rjmccall llvm-svn: 350732
* [ASTDump] NFC: Move dumpDeclRef to NodeDumperStephen Kelly2019-01-082-42/+41
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55337 llvm-svn: 350677
* Implement the TreeStructure interface through the TextNodeDumperStephen Kelly2019-01-082-6/+4
| | | | | | | | | | | | | | | | | | | | Summary: This way, when the generic ASTTraverser is extracted from ASTDumper, there can't be any problem related to ordering of class members, a concern that was raised in https://reviews.llvm.org/D55337. This will also preserve the property that the generic traverser does not enforce any coupling between the NodeDumper and the TreeStructure. https://godbolt.org/z/PEtT1_ Reviewers: aaron.ballman, erichkeane Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56407 llvm-svn: 350665
* [AST][NFC] Pack CXXScalarValueInitExprBruno Ricci2019-01-081-1/+1
| | | | | | | Use the newly available space in the bit-fields of Stmt. This saves one pointer per CXXScalarValueInitExpr. NFC. llvm-svn: 350635
* [AST] Pack CXXDependentScopeMemberExprBruno Ricci2019-01-081-51/+51
| | | | | | | | | | | | | | | | | | | | Use the newly available space in the bit-fields of Stmt. Additionally store FirstQualifierFoundInScope as a trailing object since it is most of the time null (non-null for 2 of the 35446 CXXDependentScopeMemberExpr when parsing all of Boost). It would be possible to move the data for the nested-name-specifier to a trailing object too to save another 2 pointers, however doing so did actually regress the time taken to parse all of Boost slightly. This saves 8 bytes + 1 pointer per CXXDependentScopeMemberExpr in the vast majority of cases. Differential Revision: https://reviews.llvm.org/D56367 Reviewed By: rjmccall llvm-svn: 350625
* NFC: Replace asserts with if() in SourceLocation accessorsStephen Kelly2019-01-071-3/+3
| | | | | | | | | | | | | | | | | | | Summary: Nowhere else in the AST classes assert on these kinds of accessors. This way, we can call the accessors and check the validity of the result instead of externally duplicating the conditions. This generality will make it possible to introspect instances for source locations: http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/iiaWhw Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56354 llvm-svn: 350573
* [AST] Store some data of CXXNewExpr as trailing objectsBruno Ricci2019-01-072-51/+95
| | | | | | | | | | | | | | | | | Store the optional array size expression, optional initialization expression and optional placement new arguments in a trailing array. Additionally store the range for the parenthesized type-id in a trailing object if needed since in the vast majority of cases the type is not parenthesized (not a single new expression in the translation unit of SemaDecl.cpp has a parenthesized type-id). This saves 2 pointers per CXXNewExpr in all cases, and 2 pointers + 8 bytes per CXXNewExpr in the common case where the type is not parenthesized. Differential Revision: https://reviews.llvm.org/D56134 Reviewed By: rjmccall llvm-svn: 350527
* [AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExprBruno Ricci2019-01-071-58/+52
| | | | | | | | | | | Use the newly available space in the bit-fields of Stmt. This saves 1 pointer per DependentScopeDeclRefExpr/CXXUnresolvedConstructExpr. Additionally rename "TypeSourceInfo *Type;" to "TypeSourceInfo *TSI;" as was done in D56022 (r350003) (but this is an internal detail anyway), and clang-format both classes. NFC. llvm-svn: 350525
* DR674, PR38883, PR40238: Qualified friend lookup should look for aRichard Smith2019-01-071-0/+6
| | | | | | | | | | | | | | | | | | template specialization if there is no matching non-template function. This exposed a couple of related bugs: - we would sometimes substitute into a friend template instead of a suitable non-friend declaration; this would now crash because we'd decide the specialization of the friend is a redeclaration of itself - ADL failed to properly handle the case where an invisible local extern declaration redeclares an invisible friend Both are fixed herein: in particular, we now never make invisible friends or local extern declarations visible to name lookup unless they are the only declaration of the entity. (We already mostly did this for local extern declarations.) llvm-svn: 350505
* [Basic] Extend DiagnosticEngine to store and format Qualifiers.Anastasia Stulova2019-01-041-0/+14
| | | | | | | | | | | Qualifiers can now be streamed into the DiagnosticEngine using regular << operator. If Qualifiers are empty 'unqualified' will be printed in the diagnostic otherwise regular qual syntax is used. Differential Revision: https://reviews.llvm.org/D56198 llvm-svn: 350386
* Diagnose an unused result from a call through a function pointer whose ↵Aaron Ballman2019-01-032-19/+14
| | | | | | | | | | return type is marked [[nodiscard]]. When a function returns a type and that type was declared [[nodiscard]], we diagnose any unused results from that call as though the function were marked nodiscard. The same behavior should apply to calls through a function pointer. This addresses PR31526. llvm-svn: 350317
* Add vtable anchor to classes.Richard Trieu2018-12-292-0/+4
| | | | llvm-svn: 350143
* [MS] Mangle return adjusting thunks with the public access specifierReid Kleckner2018-12-261-6/+12
| | | | | | | | MSVC does this, so we should too. Fixes PR40138 llvm-svn: 350071
* Ignore ConstantExpr in IgnoreParensReid Kleckner2018-12-261-4/+4
| | | | | | | | | | | | | | | | | | Summary: This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more helpers ignore it. For most clients, this ensures that these helpers behave the same with and without C++17 enabled, which is what appears to introduce these new expression nodes. Fixes PR39881 Reviewers: void, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55853 llvm-svn: 350068
* [AST] Store the arguments of CXXConstructExpr in a trailing arrayBruno Ricci2018-12-222-74/+100
| | | | | | | | | | | | | | | Store the arguments of CXXConstructExpr in a trailing array. This is very similar to the CallExpr case in D55771, with the exception that there is only one derived class (CXXTemporaryObjectExpr) and that we compute the offset to the trailing array instead of storing it. This saves one pointer per CXXConstructExpr and CXXTemporaryObjectExpr. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D56022 llvm-svn: 350003
* [AST][NFC] Remove stale comment in CXXRecordDecl::is(Virtually)DerivedFrom.Bruno Ricci2018-12-211-2/+0
| | | | | | The "this" capture was removed in r291939. llvm-svn: 349948
* [AST][NFC] Fix Wsign-compare warning introduced in CXXOperatorCallExprBruno Ricci2018-12-211-2/+3
| | | | llvm-svn: 349934
* [AST][NFC] Pack CXXOperatorCallExprBruno Ricci2018-12-211-2/+7
| | | | | | | Use the space available in the bit-fields of Stmt. This saves 8 bytes per CXXOperatorCallExpr. NFC. llvm-svn: 349924
* [AST] Store the callee and argument expressions of CallExpr in a trailing array.Bruno Ricci2018-12-213-55/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since CallExpr::setNumArgs has been removed, it is now possible to store the callee expression and the argument expressions of CallExpr in a trailing array. This saves one pointer per CallExpr, CXXOperatorCallExpr, CXXMemberCallExpr, CUDAKernelCallExpr and UserDefinedLiteral. Given that CallExpr is used as a base of the above classes we cannot use llvm::TrailingObjects. Instead we store the offset in bytes from the this pointer to the start of the trailing objects and manually do the casts + arithmetic. Some notes: 1.) I did not try to fit the number of arguments in the bit-fields of Stmt. This leaves some space for future additions and avoid the discussion about whether x bits are sufficient to hold the number of arguments. 2.) It would be perfectly possible to recompute the offset to the trailing objects before accessing the trailing objects. However the trailing objects are frequently accessed and benchmarks show that it is slightly faster to just load the offset from the bit-fields. Additionally, because of 1), we have plenty of space in the bit-fields of Stmt. Differential Revision: https://reviews.llvm.org/D55771 Reviewed By: rjmccall llvm-svn: 349910
* [AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.Bruno Ricci2018-12-212-7/+22
| | | | | | | | | All of the other constructors already take a reference to the AST context. This avoids calling Decl::getASTContext in most cases. Additionally move the definition of the constructor from Expr.h to Expr.cpp since it is calling DeclRefExpr::computeDependence. NFC. llvm-svn: 349901
* [mingw] Don't mangle thiscall like fastcall etcReid Kleckner2018-12-211-2/+8
| | | | | | | | | | | | | | | GCC does not mangle it when it is not explicit in the source. The mangler as currently written cannot differentiate between explicit and implicit calling conventions, so we can't match GCC. Explicit thiscall conventions are rare, so mangle as if the convention was implicit to be as ABI compatible as possible. Also fixes some tests using %itanium_abi_triple in some configurations as a side effect. Fixes PR40107. llvm-svn: 349872
* [Sema] Better static assert diagnostics for expressions involving ↵Clement Courbet2018-12-201-5/+26
| | | | | | | | | | | | | | | | | | temporaries/casts/.... Summary: Handles expressions such as: - `std::is_const<T>()` - `std::is_const<T>()()`; - `std::is_same(decltype(U()), V>::value`; Reviewers: aaron.ballman, Quuxplusone Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D55552 llvm-svn: 349729
* [OPENMP] parsing and sema support for 'close' map-type-modifierKelvin Li2018-12-181-9/+13
| | | | | | | | | | | | A map clause with the close map-type-modifier is a hint to prefer that the variables are mapped using a copy into faster memory. Patch by Ahsan Saghir (saghir) Differential Revision: https://reviews.llvm.org/D55719 llvm-svn: 349551
* [ExprConstant] Handle compound assignment when LHS has integral type and RHS ↵Tan S. B.2018-12-181-7/+19
| | | | | | | | | | has floating point type Fixes PR39858 Differential Revision: https://reviews.llvm.org/D55413 llvm-svn: 349444
* Update Microsoft name mangling scheme for exception specifiers in the type ↵Reid Kleckner2018-12-171-11/+18
| | | | | | | | | | | | | | | | | | | | | system Summary: The msvc exception specifier for noexcept function types has changed from the prior default of "Z" to "_E" if the function cannot throw when compiling with /std:C++17. Patch by Zachary Henkel! Reviewers: zturner, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55685 llvm-svn: 349414
* [ASTImporter] Add importer specific lookupGabor Marton2018-12-173-85/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There are certain cases when normal C/C++ lookup (localUncachedLookup) does not find AST nodes. E.g.: Example 1: template <class T> struct X { friend void foo(); // this is never found in the DC of the TU. }; Example 2: // The fwd decl to Foo is not found in the lookupPtr of the DC of the // translation unit decl. struct A { struct Foo *p; }; In these cases we create a new node instead of returning with the old one. To fix it we create a new lookup table which holds every node and we are not interested in any C++ specific visibility considerations. Simply, we must know if there is an existing Decl in a given DC. Reviewers: a_sidorin, a.sidorin Subscribers: mgorny, rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53708 llvm-svn: 349351
* [ASTImporter] Fix redecl chain of classes and class templatesGabor Marton2018-12-172-173/+164
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The crux of the issue that is being fixed is that lookup could not find previous decls of a friend class. The solution involves making the friend declarations visible in their decl context (i.e. adding them to the lookup table). Also, we simplify `VisitRecordDecl` greatly. This fix involves two other repairs (without these the unittests fail): (1) We could not handle the addition of injected class types properly when a redecl chain was involved, now this is fixed. (2) DeclContext::removeDecl failed if the lookup table in Vector form did not contain the to be removed element. This caused troubles in ASTImporter::ImportDeclContext. This is also fixed. Reviewers: a_sidorin, balazske, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53655 llvm-svn: 349349
* Mangle calling conventions into function pointer types where GCC doesReid Kleckner2018-12-141-5/+10
| | | | | | | | | | | | | | | | | | | | Summary: GCC 5.1 began mangling these Windows calling conventions into function types, since they can be used for overloading. They've always been mangled in the MS ABI, but they are new to the Itanium mangler. Note that the calling convention doesn't appear as part of the main declaration, it only appears on function parameter types and other types. Fixes PR39860 Reviewers: rjmccall, efriedma Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55672 llvm-svn: 349212
* Add AddressSpace mangling to MS modeErich Keane2018-12-141-1/+71
| | | | | | | | | | | | All of the symbols demangle on llvm-undname and demangler.com. This address space qualifier is useful for when we want to use opencl C++ in Windows mode. Additionally, C++ address-space using functions will now be usable on windows. Differential Revision: https://reviews.llvm.org/D55715 Change-Id: Ife4506613c3cce778a783456d62117fbf7d83c26 llvm-svn: 349209
* [Clang] Add __builtin_launderEric Fiselier2018-12-141-1/+2
| | | | | | | | | | | | | | | | | Summary: This patch adds `__builtin_launder`, which is required to implement `std::launder`. Additionally GCC provides `__builtin_launder`, so thing brings Clang in-line with GCC. I'm not exactly sure what magic `__builtin_launder` requires, but based on previous discussions this patch applies a `@llvm.invariant.group.barrier`. As noted in previous discussions, this may not be enough to correctly handle vtables. Reviewers: rnk, majnemer, rsmith Reviewed By: rsmith Subscribers: kristina, Romain-Geissler-1A, erichkeane, amharc, jroelofs, cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D40218 llvm-svn: 349195
* Fix up diagnostics.Richard Trieu2018-12-143-3/+2
| | | | | | | | | | | Move some diagnostics around between Diagnostic*Kinds.td files. Diagnostics used in multiple places were moved to DiagnosticCommonKinds.td. Diagnostics listed in the wrong place (ie, Sema diagnostics listed in DiagnosticsParseKinds.td) were moved to the correct places. One diagnostic split into two so that the diagnostic string is in the .td file instead of in code. Cleaned up the diagnostic includes after all the changes. llvm-svn: 349125
OpenPOWER on IntegriCloud