summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Multiversioning- Ensure all MV functions are emitted.Erich Keane2018-11-011-0/+4
| | | | | | | | Multiverson function versions are always used (by the resolver), so ensure that they are always emitted. Change-Id: I5d2e0841fddf0d18918b3fb92ae76814add7ee96 llvm-svn: 345839
* Logging: put link against libclangAnalysis rather than libLLVMAnalysis for ↵Tim Northover2018-11-011-1/+1
| | | | | | os_log llvm-svn: 345835
* Logging: add CMake dependency so libAST can use OSLog analysis.Tim Northover2018-11-011-0/+1
| | | | | | | Should fix bots on platforms with slightly different symbol resolution semantics. llvm-svn: 345833
* Logging: make os_log buffer size an integer constant expression.Tim Northover2018-11-011-0/+7
| | | | | | | | | The size of an os_log buffer is known at any stage of compilation, so making it a constant expression means that the common idiom of declaring a buffer for it won't result in a VLA. That allows the compiler to skip saving and restoring the stack pointer around such buffers. llvm-svn: 345828
* Revert "[ASTImporter][Structural Eq] Check for isBeingDefined"Shafik Yaghmour2018-10-311-7/+1
| | | | | | | | This reverts commit r345760 because it caused an assertion in the lldb test suite. This is the log from the build bot: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12003/ llvm-svn: 345784
* [ASTImporter][Structural Eq] Check for isBeingDefinedGabor Marton2018-10-311-1/+7
| | | | | | | | | | | | | | Summary: If one definition is currently being defined, we do not compare for equality and we assume that the decls are equal. Reviewers: a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53697 llvm-svn: 345760
* Create ConstantExpr classBill Wendling2018-10-3110-13/+31
| | | | | | | | | | | | | | | | A ConstantExpr class represents a full expression that's in a context where a constant expression is required. This class reflects the path the evaluator took to reach the expression rather than the syntactic context in which the expression occurs. In the future, the class will be expanded to cache the result of the evaluated expression so that it's not needlessly re-evaluated Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D53475 llvm-svn: 345692
* Revert "[ASTImporter] Reorder fields after structure import is finished"Davide Italiano2018-10-301-43/+3
| | | | | | This reverts commit r345545 because it breaks some lldb tests. llvm-svn: 345643
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-302-6/+6
| | | | | | | | | | 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 llvm-svn: 345637
* [AST] Only store data for the NRVO candidate in ReturnStmt if neededBruno Ricci2018-10-302-6/+28
| | | | | | | | | | | | | Only store the NRVO candidate if needed in ReturnStmt. A good chuck of all of the ReturnStmt have no NRVO candidate (more than half when parsing all of Boost). For all of them this saves one pointer. This has no impact on children(). Differential Revision: https://reviews.llvm.org/D53716 Reviewed By: rsmith llvm-svn: 345605
* [AST] Only store the needed data in WhileStmtBruno Ricci2018-10-303-18/+52
| | | | | | | | | | | | Don't store the data for the condition variable if not needed. This cuts the size of WhileStmt by up to a pointer. The order of the children is kept the same. Differential Revision: https://reviews.llvm.org/D53715 Reviewed By: rjmccall llvm-svn: 345597
* PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of typeRichard Smith2018-10-301-0/+5
| | | | | | | | | nullptr_t does not access memory. We now reuse CK_NullToPointer to represent a conversion from a glvalue of type nullptr_t to a prvalue of nullptr_t where necessary. llvm-svn: 345562
* [ASTImporter] Reorder fields after structure import is finishedAleksei Sidorin2018-10-291-3/+43
| | | | | | | | | | | | There are multiple reasons why field structures can be imported in wrong order. The simplest is the ability of field initializers and method bodies to refer fields not in order they are listed in. Unfortunately, there is no clean solution for that currently so I'm leaving a FIXME. Differential Revision: https://reviews.llvm.org/D44100 llvm-svn: 345545
* [AST] Only store the needed data in SwitchStmtBruno Ricci2018-10-293-18/+63
| | | | | | | | | | | | | | | | Don't store the data for the init statement and condition variable if not needed. This cuts the size of SwitchStmt by up to 2 pointers. The order of the children is intentionally kept the same. Also use the newly available space in the bit-fields of Stmt to store the bit representing whether all enums have been covered instead of using a PointerIntPair. Differential Revision: https://reviews.llvm.org/D53714 Reviewed By: rjmccall llvm-svn: 345510
* [OpenMP][NVPTX] Use single loops when generating code for distribute ↵Gheorghe-Teodor Bercea2018-10-291-0/+12
| | | | | | | | | | | | | | | | parallel for Summary: This patch adds a new code generation path for bound sharing directives containing distribute parallel for. The new code generation scheme applies to chunked schedules on distribute and parallel for directives. The scheme simplifies the code that is being generated by eliminating the need for an outer for loop over chunks for both distribute and parallel for directives. In the case of distribute it applies to any sized chunk while in the parallel for case it only applies when chunk size is 1. Reviewers: ABataev, caomhin Reviewed By: ABataev Subscribers: jholewinski, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D53448 llvm-svn: 345509
* [ASTImporter] Import overrides before importing the rest of the chainGabor Marton2018-10-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: During method import we check for structural eq of two methods. In the structural eq check we check for their isVirtual() flag. That flag, however, may depend on the number of overrides. Before this change we imported the overrides *after* we had imported the rest of the redecl chain. So, during the import of another decl from the chain IsVirtual() gave false result. Writing tests for this is not really possible, because there is no way to remove an overridden method via the AST API. (We should access the private ASTContext::OverriddenMethods container.) Also, we should do the remove in the middle of the import process. Reviewers: a_sidorin, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53704 llvm-svn: 345496
* AST: extend MS decoration handling for extended vectorsSaleem Abdulrasool2018-10-281-12/+14
| | | | | | | | | | | | | | | | | We correctly handled extended vectors of non-floating point types. However, we have the Intel style builtins which MSVC also supports which do overlap in sizes with the floating point extended vectors. This would result in overloading of floating point extended vector types which matched sizes (e.g. <3 x float> would be backed by a <4 x float> and thus match sizes) to be mangled similarly. Extended vectors are a clang extension which live outside of the builtins, so mangle them all similarly. This change just extends the current scheme to treat floating point types similar to the way that we treat other types currently. This now allows the swift runtime to be built for Windows again. llvm-svn: 345479
* [AST] Don't store data for GNU range case statement if not neededBruno Ricci2018-10-283-8/+30
| | | | | | | | | | | | | | | | Don't store the data for case statements of the form LHS ... RHS if not needed. This cuts the size of CaseStmt by 1 pointer + 1 SourceLocation in the common case. Also use the newly available space in the bit-fields of Stmt to store the keyword location of SwitchCase and move the small accessor SwitchCase::getSubStmt to the header. Differential Revision: https://reviews.llvm.org/D53609 Reviewed By: rjmccall llvm-svn: 345472
* [AST] Only store the needed data in IfStmtBruno Ricci2018-10-273-23/+80
| | | | | | | | | | | | | | | | | | | | | | | | Only store the needed data in IfStmt. This cuts the size of IfStmt by up to 3 pointers + 1 SourceLocation. The order of the children is intentionally kept the same even though it would be more convenient to put the optional trailing objects last. Additionally use the newly available space in the bit-fields of Stmt to store the location of the "if". The result of this is that for the common case of an if statement of the form: if (some_cond) some_statement the size of IfStmt is brought down to 8 bytes + 2 pointers, instead of 8 bytes + 5 pointers + 2 SourceLocation. Differential Revision: https://reviews.llvm.org/D53607 Reviewed By: rjmccall llvm-svn: 345464
* [AST] Refactor PredefinedExprBruno Ricci2018-10-275-24/+49
| | | | | | | | | | | | | | | | | | Make the following changes to PredefinedExpr: 1. Move PredefinedExpr below StringLiteral so that it can use its definition. 2. Rename IdentType to IdentKind to be more in line with clang's conventions, and propagate the change to its users. 3. Move the location and the IdentKind into the newly available space of the bit-fields of Stmt. 4. Only store the function name when needed. When parsing all of Boost, of the 1357 PredefinedExpr 919 have no function name. Differential Revision: https://reviews.llvm.org/D53605 Reviewed By: rjmccall llvm-svn: 345460
* [AST] Widen the bit-fields of Stmt to 8 bytes.Bruno Ricci2018-10-271-3/+6
| | | | | | | | | | | | | | | | | | | | | | Although some classes are using the tail padding of Stmt, most of them are not. In particular the expression classes are not using it since there is Expr in between, and Expr contains a single pointer. This patch widen the bit-fields to Stmt to 8 bytes and move some data from NullStmt, CompoundStmt, LabelStmt, AttributedStmt, SwitchStmt, WhileStmt, DoStmt, ForStmt, GotoStmt, ContinueStmt, BreakStmt and ReturnStmt to the newly available space. In itself this patch do not achieve much but I plan to go through each of the classes in the statement/expression hierarchy and use this newly available space. A quick estimation gives me that this should shrink the size of the statement/expression hierarchy by >10% when parsing all of Boost. Differential Revision: https://reviews.llvm.org/D53604 Reviewed By: rjmccall llvm-svn: 345459
* AST: fix a typo in a comment (NFC)Saleem Abdulrasool2018-10-271-1/+1
| | | | | | Fix a typo spotted by Akira! NFC llvm-svn: 345449
* PR26547: alignof should return ABI alignment, not preferred alignmentRichard Smith2018-10-265-11/+35
| | | | | | | | | | | | Summary: - Add `UETT_PreferredAlignOf` to account for the difference between `__alignof` and `alignof` - `AlignOfType` now returns ABI alignment instead of preferred alignment iff clang-abi-compat > 7, and one uses _Alignof or alignof Patch by Nicole Mazzuca! Differential Revision: https://reviews.llvm.org/D53207 llvm-svn: 345419
* Revert r345330 "Add MS ABI mangling for operator<=>."Hans Wennborg2018-10-261-2/+9
| | | | | | | | | | The generated MS manglings differ between 32- and 64-bit, and the test only expects the latter. See also the commit email thread. > Thanks to Cameron DaCamara at Microsoft for letting us know what their > chosen mangling is here! llvm-svn: 345380
* Add MS ABI mangling for operator<=>.Richard Smith2018-10-251-9/+2
| | | | | | | Thanks to Cameron DaCamara at Microsoft for letting us know what their chosen mangling is here! llvm-svn: 345330
* Implement Function Multiversioning for Non-ELF Systems.Erich Keane2018-10-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Similar to how ICC handles CPU-Dispatch on Windows, this patch uses the resolver function directly to forward the call to the proper function. This is not nearly as efficient as IFuncs of course, but is still quite useful for large functions specifically developed for certain processors. This is unfortunately still limited to x86, since it depends on __builtin_cpu_supports and __builtin_cpu_is, which are x86 builtins. The naming for the resolver/forwarding function for cpu-dispatch was taken from ICC's implementation, which uses the unmodified name for this (no mangling additions). This is possible, since cpu-dispatch uses '.A' for the 'default' version. In 'target' multiversioning, this function keeps the '.resolver' extension in order to keep the default function keeping the default mangling. Change-Id: I4731555a39be26c7ad59a2d8fda6fa1a50f73284 Differential Revision: https://reviews.llvm.org/D53586 llvm-svn: 345298
* Driver,CodeGen: introduce support for Swift CFString layoutSaleem Abdulrasool2018-10-241-18/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new driver level flag `-fcf-runtime-abi=` that allows one to specify the runtime ABI for CoreFoundation. This controls the language interoperability. In particular, this is relevant for generating the CFConstantString classes (primarily through the `__builtin___CFStringMakeConstantString` builtin) which construct a reference to the "CFObject"'s `isa` field. This type differs between swift 4.1 and 4.2+. Valid values for the new option include: - objc [default behaviour] - enable ObjectiveC interoperability - swift-4.1 - enable interoperability with swift 4.1 - swift-4.2 - enable interoperability with swift 4.2 - swift-5.0 - enable interoperability with swift 5.0 - swift [alias] - target the latest swift ABI Furthermore, swift 4.2+ changed the layout for the CFString when building CoreFoundation *without* ObjectiveC interoperability. In such a case, a field was added to the CFObject base type changing it from: <{ const int*, int }> to <{ uintptr_t, uintptr_t, uint64_t }>. In swift 5.0, the CFString type will be further adjusted to change the length from a uint32_t on everything but BE LP64 targets to uint64_t. Note that the default behaviour for clang remains unchanged and the new layout must be explicitly opted into via `-fcf-runtime-abi=swift*`. llvm-svn: 345222
* AST: unindent CFConstantStringDecl by inverting condition (NFC)Saleem Abdulrasool2018-10-241-42/+40
| | | | | | | Unindent the body of the function by inverting check at the top. This is in preparation for supporting CFString's new ABI with swift. NFC. llvm-svn: 345159
* NFC: Remove MANGLE_CHECKER from ItaniumMangle.cppErik Pilkington2018-10-232-23/+0
| | | | | | | This hasn't even compiled since 2011. It would be useful to have some test to verify that ItaniumMangle and ItaniumDemangle agree, but this isn't it. llvm-svn: 345075
* Change getRedeclContext() to support enumerations as another kind of ↵Aaron Ballman2018-10-231-2/+12
| | | | | | | | transparent context in C. This change fixes PR15071 and ensures that enumerators redefined in a struct cannot conflict with enumerators defined outside of the struct. llvm-svn: 345073
* [Fixed Point Arithmetic] Fixed Point to Boolean CastLeonard Chan2018-10-232-0/+10
| | | | | | | | | | This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split the casting logic up into smaller patches. This contains the code for casting from fixed point types to boolean types. Differential Revision: https://reviews.llvm.org/D53308 llvm-svn: 345063
* [OpenCL][NFC] Unify ZeroToOCL* cast typesAndrew Savonichev2018-10-232-6/+3
| | | | | | | | | | | | Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, cfe-commits Differential Revision: https://reviews.llvm.org/D52654 llvm-svn: 345038
* [AST] Do not align virtual bases in `MicrosoftRecordLayoutBuilder` whenAleksandr Urakov2018-10-231-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an external layout is used Summary: The patch removes alignment of virtual bases when an external layout is used. We have two cases: - the external layout source has an information about virtual bases offsets, so we just use them; - the external source has no information about virtual bases offsets. In this case we can't predict where the base will be located. If we will align it but there will be something like `#pragma pack(push, 1)` really, then likely our layout will not fit into the real structure size, and then some asserts will hit. The asserts look reasonable, so I don't think that we need to remove them. May be it would be better instead don't align fields / bases etc. (so treat it always as `#pragma pack(push, 1)`) when an external layout source is used but no info about a field location is presented. This one is related to D49871 Reviewers: rnk, rsmith, zturner, mstorsjo, majnemer Reviewed By: rnk Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D53497 llvm-svn: 345012
* Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFCFangrui Song2018-10-201-8/+6
| | | | llvm-svn: 344859
* PR24164, PR39336: init-captures are not distinct full-expressions.Richard Smith2018-10-191-5/+2
| | | | | | | | | Rather, they are subexpressions of the enclosing lambda-expression, and any temporaries in them are destroyed at the end of that full-expression, or when the corresponding lambda-expression is destroyed if they are lifetime-extended. llvm-svn: 344801
* [ASTImporter] Removed uneeded default case label.Balazs Keri2018-10-191-2/+2
| | | | llvm-svn: 344784
* [ASTImporter] Added error handling for AST import.Balazs Keri2018-10-192-3305/+3962
| | | | | | | | | | | | | | | | | | | | | Summary: The goal of this change is to make the ASTImporter::Import functions return llvm::Expected instead of the imported type. As first part the ASTNodeImporter visit functions are updated to return with llvm::Expected. Various `import` functions are added to ASTNodeImporter to simplify the code and have a common place for interface towards ASTImporter (from ASTNodeImporter). There is some temporary code that is needed before ASTImporter is updated. Reviewers: a.sidorin, a_sidorin, xazax.hun Reviewed By: a_sidorin Subscribers: dkrupp, Szelethus, rnkovacs, martong, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D51633 llvm-svn: 344783
* [Diagnostics] Check for integer overflow in array size expressions David Bolvansky2018-10-181-0/+13
| | | | | | | | | | | | | | Summary: Fixes PR27439 Reviewers: rsmith, Rakete1111 Reviewed By: rsmith Subscribers: Rakete1111, cfe-commits Differential Revision: https://reviews.llvm.org/D52750 llvm-svn: 344759
* [OPENMP] Move OMPClausePrinter to OpenMPClause.h/OpenMPClause.cpp - NFC. ↵Patrick Lyster2018-10-182-451/+432
| | | | | | Differential Revision: https://reviews.llvm.org/D53102 llvm-svn: 344740
* [Fixed Point Arithmetic] FixedPointCastLeonard Chan2018-10-153-0/+4
| | | | | | | | | | | | | This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split them up. This contains the code for casting between fixed point types and other fixed point types. The method for converting between fixed point types is based off the convert() method in APFixedPoint. Differential Revision: https://reviews.llvm.org/D50616 llvm-svn: 344530
* Add support for 'dynamic_allocators' clause on 'requires' directive. ↵Patrick Lyster2018-10-113-0/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D53079 llvm-svn: 344249
* [AST] Use -fvisibility value when ignoring -fv-i-h* inline static localsReid Kleckner2018-10-101-7/+17
| | | | | | | | | | | | | | | | | | | | | | Summary: In r340386 we added code to give static locals in inline functions default visibility. Instead, we should use the "default" visibility passed on the command line, which could be hidden or protected, as GCC does. Some code bases use both -fvisibility=hidden and -fvisibility-inlines-hidden to hide inline functions of classes that are explicitly marked with default visibility. Fixes PR39236 Reviewers: hans, thakis Subscribers: eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D53052 llvm-svn: 344190
* [Sema] Fix a multiple definition bug with friends and templatesErik Pilkington2018-10-101-0/+36
| | | | | | | | | | | | | | The problem was that MergeFunctionDecl sometimes needs the injected template arguments of a FunctionTemplateDecl, but is called before adding the new template to the redecl chain. This leads to multiple common pointers in the same redecl chain, each with their own identical instantiation. Fix this by merging the the common state before inserting the new template into the redecl chain. rdar://44810129 Differential revision: https://reviews.llvm.org/D53046 llvm-svn: 344157
* ExprConstant: Make __builtin_object_size use EM_IgnoreSideEffects.James Y Knight2018-10-101-24/+7
| | | | | | | | | | | | | | | | | | | | | | | And, since EM_OffsetFold is now unused, remove it. While builtin_object_size intends to ignore the presence of side-effects in its argument, the EM_OffsetFold mode was NOT configured to ignore side-effects. Rather it was effectively identical to EM_ConstantFold -- its explanatory comment notwithstanding. However, currently, keepEvaluatingAfterSideEffect() is not always honored -- sometimes evaluation continues despite it returning false. Therefore, since the b_o_s code was only checking the return value from evaluation, and not additionally checking the HasSideEffects flag, side-effects _were_ in many cases actually being ignored. This change is a prerequisite cleanup towards fixing that issue. Differential Revision: https://reviews.llvm.org/D52924 llvm-svn: 344110
* Emit CK_NoOp casts in C mode, not just C++.James Y Knight2018-10-051-5/+1
| | | | | | | | | | | | Previously, it had been using CK_BitCast even for casts that only change const/restrict/volatile. Now it will use CK_Noop where appropriate. This is an alternate solution to r336746. Differential Revision: https://reviews.llvm.org/D52918 llvm-svn: 343892
* Emit diagnostic note when calling an invalid function declaration.James Y Knight2018-10-051-3/+6
| | | | | | | | | | | | | | The comment said it was intentionally not emitting any diagnostic because the declaration itself was already diagnosed. However, everywhere else that wants to not emit a diagnostic without an extra note emits note_invalid_subexpr_in_const_expr instead, which gets suppressed later. This was the only place which did not emit a diagnostic note. Differential Revision: https://reviews.llvm.org/D52919 llvm-svn: 343867
* [AST] Revert mangling changes from r339428Shoaib Meenai2018-10-041-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in https://reviews.llvm.org/D50144, we want Obj-C classes to have the same mangling as C++ structs, to support headers like the following: ``` @class I; struct I; void f(I *); ``` since the header can be used from both C++ and Obj-C++ TUs, and we want a consistent mangling across the two to prevent link errors. Itanium mangles both the same way, and so should the MS ABI. The main concern with having the same mangling for C++ structs and Obj-C classes was that we want to treat them differently for the purposes of exception handling, e.g. we don't want a C++ catch statement for a struct to be able to catch an Obj-C class with the same name as the struct. We can accomplish this by mangling Obj-C class names differently in their RTTI, which I'll do in a follow-up patch. Differential Revision: https://reviews.llvm.org/D52581 llvm-svn: 343808
* [NestedNameSpecifier] Add missing stream-specific dump methodsStephen Kelly2018-10-041-4/+11
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52870 llvm-svn: 343807
* [constexpr] Fix ICE when memcpy() is given a pointer to an incomplete arrayPetr Pavlu2018-10-041-0/+4
| | | | | | | | | | Fix code for constant evaluation of __builtin_memcpy() and __builtin_memmove() that would attempt to divide by zero when given two pointers to an incomplete array. Differential Revision: https://reviews.llvm.org/D51855 llvm-svn: 343761
* [OPENMP] Add reverse_offload clause to requires directivePatrick Lyster2018-10-033-0/+9
| | | | llvm-svn: 343711
OpenPOWER on IntegriCloud