summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix handling of usual deallocation functions in various configuratios.Eric Fiselier2019-02-031-2/+7
| | | | | | | | | | | | | Clang allows users to enable or disable various types of allocation and deallocation regardless of the C++ dialect. When extended new/delete overloads are enabled in older dialects, we need to treat them as if they're usual. Also, disabling one usual deallocation form shouldn't disable any others. For example, disabling aligned allocation in C++2a should have no effect on destroying delete. llvm-svn: 352980
* [Sema][ObjC] Allow declaring ObjC pointer members with non-trivialAkira Hatanaka2019-02-021-0/+11
| | | | | | | | | | | | | | | ownership qualifications in C++ unions under ARC. An ObjC pointer member with non-trivial ownership qualifications causes all of the defaulted special functions of the enclosing union to be defined as deleted, except when the member has an in-class initializer, the default constructor isn't defined as deleted. rdar://problem/34213306 Differential Revision: https://reviews.llvm.org/D57438 llvm-svn: 352949
* Don't use ASTContext in DeclOpenMP.h because it's still incomplete.Eric Fiselier2019-02-011-0/+10
| | | | llvm-svn: 352919
* [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.Michael Kruse2019-02-017-3/+99
| | | | | | | | | | | | | | | | | This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D56326 llvm-svn: 352906
* [ASTDump] Inline traverse methods into classStephen Kelly2019-01-301-543/+388
| | | | | | | This API will be extracted into a new template class. This change will make the follow-up commit easier to review. llvm-svn: 352676
* Add a new builtin: __builtin_dynamic_object_sizeErik Pilkington2019-01-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This builtin has the same UI as __builtin_object_size, but has the potential to be evaluated dynamically. It is meant to be used as a drop-in replacement for libraries that use __builtin_object_size when a dynamic checking mode is enabled. For instance, __builtin_object_size fails to provide any extra checking in the following function: void f(size_t alloc) { char* p = malloc(alloc); strcpy(p, "foobar"); // expands to __builtin___strcpy_chk(p, "foobar", __builtin_object_size(p, 0)) } This is an overflow if alloc < 7, but because LLVM can't fold the object size intrinsic statically, it folds __builtin_object_size to -1. With __builtin_dynamic_object_size, alloc is passed through to __builtin___strcpy_chk. rdar://32212419 Differential revision: https://reviews.llvm.org/D56760 llvm-svn: 352665
* [ASTDump] Make method definition order matches declaration orderStephen Kelly2019-01-301-21/+22
| | | | | | This will make follow-up changes easier to review. llvm-svn: 352663
* [ASTDump] Re-arrange method declarations to group Visit togetherStephen Kelly2019-01-301-120/+112
| | | | | | This will make follow-up commits easier to review. llvm-svn: 352661
* [ASTDump] Rename methods which are conceptually VisitsStephen Kelly2019-01-301-129/+125
| | | | | | | This is consistent with the TextNodeDumper, and is the appropriate name for the traverser class which will be extracted. llvm-svn: 352657
* [ASTDump] NFC: Inline vestigial methodsStephen Kelly2019-01-301-23/+15
| | | | | | This was a porting aid. llvm-svn: 352656
* [ASTDump] Move Decl node dumping to TextNodeDumperStephen Kelly2019-01-302-625/+707
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D57419 llvm-svn: 352655
* [ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bitRoman Lebedev2019-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Was trying to understand how complicated it would be to write a clang-tidy `openmp-exception-escape`-ish check once D57100 lands. Just so it happens, all the data is already there, it is just conveniently omitted from AST dump. Reviewers: aaron.ballman, steveire, ABataev Reviewed By: ABataev Subscribers: ABataev, guansong, cfe-commits Tags: #openmp, #clang Differential Revision: https://reviews.llvm.org/D57452 llvm-svn: 352631
* NFC: Move GenericSelectionExpr dump to NodeDumperStephen Kelly2019-01-292-2/+5
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56961 llvm-svn: 352558
* NFC: Implement GenericSelectionExpr::Association dump with VisitorStephen Kelly2019-01-292-15/+24
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56960 llvm-svn: 352552
* OpenCL: Use length modifier for warning on vector printf argumentsMatt Arsenault2019-01-293-18/+59
| | | | | | | | | | | | Re-enable format string warnings on printf. The warnings are still incomplete. Apparently it is undefined to use a vector specifier without a length modifier, which is not currently warned on. Additionally, type warnings appear to not be working with the hh modifier, and aren't warning on all of the special restrictions from c99 printf. llvm-svn: 352540
* Re-commit "[AST] Introduce GenericSelectionExpr::Association"Bruno Ricci2019-01-293-11/+12
| | | | | | This time with a fix to make gcc 4.8 happy. llvm-svn: 352486
* Remove unused variable to silence compiler warningMikael Holmen2019-01-291-1/+1
| | | | llvm-svn: 352456
* [ASTImporter] Fix handling of overriden methods during ASTImportShafik Yaghmour2019-01-281-7/+37
| | | | | | | | | Summary: When importing classes we may add a CXXMethodDecl more than once to a CXXRecordDecl when handling overrides. This patch will fix the cases we currently know about and handle the case where we are only dealing with declarations. Differential Revision: https://reviews.llvm.org/D56936 llvm-svn: 352436
* Revert "[AST] Introduce GenericSelectionExpr::Association"Bruno Ricci2019-01-283-12/+11
| | | | | | This breaks GCC 4.8.4. Reported by email by Hans Wennborg. llvm-svn: 352403
* [clang][OpenMP] OMPFlushClause is synthetic, no such clause existsRoman Lebedev2019-01-282-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in https://reviews.llvm.org/D57112#inline-506781, 'flush' clause does not exist in the OpenMP spec, it can not be specified, and `OMPFlushClause` class is just a helper class. Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def` should not contain 'flush' "clause". I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)` from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE` and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every** place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def` is then included. So as-is, this patch is a NFC. Possibly, some of these `OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped, i don't really know. Test plan: `ninja check-clang` Reviewers: ABataev Reviewed By: ABataev Subscribers: guansong, arphaman, cfe-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D57280 llvm-svn: 352390
* [AST] Introduce GenericSelectionExpr::AssociationBruno Ricci2019-01-283-11/+12
| | | | | | | | | | | | | | | | | Introduce a new class GenericSelectionExpr::Association which bundle together an association expression and its TypeSourceInfo. An iterator GenericSelectionExpr::AssociationIterator is additionally added to make it possible to iterate over ranges of Associations. This iterator is a kind of proxy iterator which abstract over how exactly the expressions and the TypeSourceInfos are stored. Differential Revision: https://reviews.llvm.org/D57106 Reviewed By: aaron.ballman Reviewers: aaron.ballman, steveire, dblaikie, mclow.lists llvm-svn: 352369
* Rename getTypeQualifiers to getMethodQualifiers.Anastasia Stulova2019-01-287-10/+10
| | | | | | | | Use more descriptive name for the method qualifiers getter. Differential Revision: https://reviews.llvm.org/D56792 llvm-svn: 352349
* [AST] Pack GenericSelectionExprBruno Ricci2019-01-261-13/+53
| | | | | | | | | | | | | | | | Store the controlling expression, the association expressions and the corresponding TypeSourceInfos as trailing objects. Additionally use the bit-fields of Stmt to store one SourceLocation, saving one additional pointer. This saves 3 pointers in total per GenericSelectionExpr. Differential Revision: https://reviews.llvm.org/D57104 Reviewed By: aaron.ballman Reviewers: aaron.ballman, steveire llvm-svn: 352276
* [AST][NFC] Various cleanups to GenericSelectionExprBruno Ricci2019-01-261-47/+47
| | | | | | | | | | | | | | | | | | Various cleanups to GenericSelectionExpr factored out of D57104. In particular: 1. Move the friend declaration to the top. 2. Introduce a constant ResultDependentIndex instead of the magic "-1". 3. clang-format 4. Group the member function together so that they can be removed as one block by D57106. NFC. Differential Revision: https://reviews.llvm.org/D57238 Reviewed By: aaron.ballman llvm-svn: 352275
* Fix "control reaches end of non-void function" warning. NFCI.Simon Pilgrim2019-01-251-0/+1
| | | | llvm-svn: 352192
* [AST] Add a method to get a call type from an ObjCMessageExprGeorge Karpenkov2019-01-251-0/+25
| | | | | | | | | | | | Due to references, expression type does not always correspond to an expected method return type (e.g. for a method returning int & the expression type of the call would still be int). We have a helper method for getting the expected type on CallExpr, but not on ObjCMessageExpr. Differential Revision: https://reviews.llvm.org/D57204 llvm-svn: 352147
* [ASTImporter] Fix inequality of functions with different attributesGabor Marton2019-01-241-1/+28
| | | | | | | | | | | | | | | | Summary: FunctionType::ExtInfo holds such properties of a function which are needed mostly for code gen. We should not compare these bits when checking for structural equivalency. Checking ExtInfo caused false ODR errors during CTU analysis (of tmux). Reviewers: a_sidorin, a.sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53699 llvm-svn: 352050
* [Sema] Fix Modified Type in address_space AttributedTypeLeonard Chan2019-01-242-2/+12
| | | | | | | | | | | This is a fix for https://reviews.llvm.org/D51229 where we pass the address_space qualified type as the modified type of an AttributedType. This change now instead wraps the AttributedType with either the address_space qualifier or a DependentAddressSpaceType. Differential Revision: https://reviews.llvm.org/D55447 llvm-svn: 351997
* [ASTImporter] Fix importing OperatorDelete from CXXConstructorDeclRaphael Isemann2019-01-221-1/+17
| | | | | | | | | | | | | | | | | Summary: Shafik found out that importing a CXXConstructorDecl will create a translation unit that causes Clang's CodeGen to crash. The reason for that is that we don't copy the OperatorDelete from the CXXConstructorDecl when importing. This patch fixes it and adds a test case for that. Reviewers: shafik, martong, a_sidorin, a.sidorin Reviewed By: martong, a_sidorin Subscribers: rnkovacs, cfe-commits Differential Revision: https://reviews.llvm.org/D56651 llvm-svn: 351849
* Replace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>Serge Guelton2019-01-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization for isPodLike<std::pair<...>> did not match the expectation of std::is_trivially_copyable which makes the memcpy optimization invalid. This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable. Unfortunately std::is_trivially_copyable is not portable across compiler / STL versions. So a portable version is provided too. Note that the following specialization were invalid: std::pair<T0, T1> llvm::Optional<T> Tests have been added to assert that former specialization are respected by the standard usage of llvm::is_trivially_copyable, and that when a decent version of std::is_trivially_copyable is available, llvm::is_trivially_copyable is compared to std::is_trivially_copyable. As of this patch, llvm::Optional is no longer considered trivially copyable, even if T is. This is to be fixed in a later patch, as it has impact on a long-running bug (see r347004) Note that GCC warns about this UB, but this got silented by https://reviews.llvm.org/D50296. Differential Revision: https://reviews.llvm.org/D54472 llvm-svn: 351701
* [ASTDump] NFC: Convert iterative loops to cxx_range_forStephen Kelly2019-01-191-24/+14
| | | | | | | This is coming up a lot in reviews. Better just to change them all at once. llvm-svn: 351647
* [ASTDump] NFC: Use `const auto` in cxx_range_for loopsStephen Kelly2019-01-191-15/+15
| | | | | | This is coming up a lot in reviews. Better just to do them all at once. llvm-svn: 351646
* Move decl context dumping to TextNodeDumperStephen Kelly2019-01-192-7/+11
| | | | | | | | | | | | Summary: Only an obscure case is moved. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56829 llvm-svn: 351637
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1973-294/+219
| | | | | | | | | | | | | | | | | 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. llvm-svn: 351636
* Emit !callback metadata and introduce the callback attributeJohannes Doerfert2019-01-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | With commit r351627, LLVM gained the ability to apply (existing) IPO optimizations on indirections through callbacks, or transitive calls. The general idea is that we use an abstraction to hide the middle man and represent the callback call in the context of the initial caller. It is described in more detail in the commit message of the LLVM patch r351627, the llvm::AbstractCallSite class description, and the language reference section on callback-metadata. This commit enables clang to emit !callback metadata that is understood by LLVM. It does so in three different cases: 1) For known broker functions declarations that are directly generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel. 2) For known broker functions that are identified by their name and source location through the builtin detection, e.g., pthread_create from the POSIX thread API. 3) For user annotated functions that carry the "callback(callee, ...)" attribute. The attribute has to include the name, or index, of the callback callee and how the passed arguments can be identified (as many as the callback callee has). See the callback attribute documentation for detailed information. Differential Revision: https://reviews.llvm.org/D55483 llvm-svn: 351629
* [ASTDump] NFC: Move variable into if() statementStephen Kelly2019-01-181-2/+1
| | | | llvm-svn: 351605
* [ASTDump] NFC: Remove redundant conditionStephen Kelly2019-01-181-4/+1
| | | | | | | | | | | These conditions are duplicated from the dumpDeclContext function called within the if(). This is presumably an attempt to avoid calling the function in the case it will do nothing. That may have made sense in the past if the code was different, but it doesn't make sense now. llvm-svn: 351604
* [ASTDump] NFC: Remove non-needed bracesStephen Kelly2019-01-181-3/+2
| | | | llvm-svn: 351603
* [ASTDump] Mark null params with a tag rather than a child nodeStephen Kelly2019-01-181-4/+9
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56753 llvm-svn: 351601
* [ASTDump] Mark BlockDecls which capture this with a tagStephen Kelly2019-01-181-3/+3
| | | | | | | | | | | | | | Summary: Removal of the child node makes it easier to separate traversal from output generation. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56752 llvm-svn: 351600
* [ASTDump] Mark variadic declarations with a tag instead of child nodeStephen Kelly2019-01-182-8/+8
| | | | | | | | | | | | | | Summary: This makes it easier to separate traversal of the AST from output generation. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56751 llvm-svn: 351597
* [Fixed Point Arithmetic] Fixed Point Addition Constant Expression EvaluationLeonard Chan2019-01-181-49/+148
| | | | | | | | This patch includes logic for constant expression evaluation of fixed point additions. Differential Revision: https://reviews.llvm.org/D55868 llvm-svn: 351593
* [NFC] Fix wParentheses warning in ASTContext getFixedPointSemanticsErich Keane2019-01-181-3/+3
| | | | | Change-Id: I862f00a548236872fe24f7da8eb2bf7917e123ff llvm-svn: 351576
* [Fixed Point Arithmetic] Add APFixedPoint to APValueLeonard Chan2019-01-163-21/+22
| | | | | | | | This adds APFixedPoint to the union of values that can be represented with an APValue. Differential Revision: https://reviews.llvm.org/D56746 llvm-svn: 351368
* [Fixed Point Arithmetic] Fixed Point AdditionLeonard Chan2019-01-161-1/+42
| | | | | | | | | | | | | | | | | | This patch covers addition between fixed point types and other fixed point types or integers, using the conversion rules described in 4.1.4 of N1169. Usual arithmetic rules do not apply to binary operations when one of the operands is a fixed point type, and the result of the operation must be calculated with the full precision of the operands, so we should not perform any casting to a common type. This patch does not include constant expression evaluation for addition of fixed point types. That will be addressed in another patch since I think this one is already big enough. Differential Revision: https://reviews.llvm.org/D53738 llvm-svn: 351364
* Re-order type param children of ObjC nodesStephen Kelly2019-01-151-2/+2
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55394 llvm-svn: 351272
* NFC: Some cleanups that I missed in the previous commitStephen Kelly2019-01-151-9/+6
| | | | llvm-svn: 351271
* Re-order overrides in FunctionDecl dumpStephen Kelly2019-01-151-14/+16
| | | | | | | | | | | | | | Output all content which is local to the FunctionDecl before traversing to child AST nodes. This is necessary so that all of the part which is local to the FunctionDecl can be split into a different method. Reviewers: aaron.ballman Differential Revision: https://reviews.llvm.org/D55083 llvm-svn: 351269
* NFC: Replace iterator loop with cxx_range_forStephen Kelly2019-01-151-4/+2
| | | | llvm-svn: 351268
* Implement BlockDecl::Capture dump in terms of visitorsStephen Kelly2019-01-152-15/+23
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56709 llvm-svn: 351239
OpenPOWER on IntegriCloud