summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* P0217R3: code generation support for decomposition declarations.Richard Smith2016-08-151-3/+7
| | | | llvm-svn: 278642
* P0217R3: Parsing support and framework for AST representation of C++1zRichard Smith2016-07-221-1/+4
| | | | | | | | | | | decomposition declarations. There are a couple of things in the wording that seem strange here: decomposition declarations are permitted at namespace scope (which we partially support here) and they are permitted as the declaration in a template (which we reject). llvm-svn: 276492
* [Temporary, Lifetime] Add lifetime marks for temporariesTim Shen2016-07-011-18/+2
| | | | | | | | | With all MaterializeTemporaryExprs coming with a ExprWithCleanups, it's easy to add correct lifetime.end marks into the right RunCleanupsScope. Differential Revision: http://reviews.llvm.org/D20499 llvm-svn: 274385
* P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:Richard Smith2016-06-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
* Update clang for D20348Peter Collingbourne2016-06-141-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D20339 llvm-svn: 272710
* [asan] Added -fsanitize-address-use-after-scope flagVitaly Buka2016-06-021-13/+24
| | | | | | | | | | | | | | | | Summary: Also emit lifetime markers for -fsanitize-address-use-after-scope. Asan uses life-time markers for use-after-scope check. PR27453 Reviewers: kcc, eugenis, aizatsky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20759 llvm-svn: 271451
* [CUDA] Restrict init of local __shared__ variables to empty constructors only.Artem Belevich2016-05-091-2/+8
| | | | | | | | | | Allow only empty constructors for local __shared__ variables in a way identical to restrictions imposed on dynamic initializers for global variables on device. Differential Revision: http://reviews.llvm.org/D20039 llvm-svn: 268982
* Reverting 268055 as it caused PR27579.Amjad Aboud2016-04-301-14/+7
| | | | llvm-svn: 268151
* Recommitted r264281 "Supporting all entities declared in lexical scope in ↵Amjad Aboud2016-04-291-7/+14
| | | | | | | | LLVM debug info." After fixing PR26942 in r267004. llvm-svn: 268055
* revert SVN r265702, r265640Saleem Abdulrasool2016-04-081-1/+1
| | | | | | | | | | | Revert the two changes to thread CodeGenOptions into the TargetInfo allocation and to fix the layering violation by moving CodeGenOptions into Basic. Code Generation is arguably not particularly "basic". This addresses Richard's post-commit review comments. This change purely does the mechanical revert and will be followed up with an alternate approach to thread the desired information into TargetInfo. llvm-svn: 265806
* Basic: move CodeGenOptions from FrontendSaleem Abdulrasool2016-04-071-1/+1
| | | | | | | | This is a mechanical move of CodeGenOptions from libFrontend to libBasic. This fixes the layering violation introduced earlier by threading CodeGenOptions into TargetInfo. It should also fix the modules based self-hosting builds. NFC. llvm-svn: 265702
* [CodeGen] Emit lifetime.end intrinsic after objects are destructed inAkira Hatanaka2016-04-011-1/+1
| | | | | | | | | | | | | | | | landing pads. Previously, lifetime.end intrinsics were inserted only on normal control flows. This prevented StackColoring from merging stack slots for objects that were destroyed on the exception handling control flow since it couldn't tell their lifetime ranges were disjoint. This patch fixes code-gen to emit the intrinsic on both control flows. rdar://problem/22181976 Differential Revision: http://reviews.llvm.org/D18196 llvm-svn: 265197
* Revert "Recommitted r263425 "Supporting all entities declared in lexical ↵Reid Kleckner2016-03-241-14/+7
| | | | | | | | | | | scope in LLVM debug info." After fixing PR26942 (the fix is included in this commit)." This reverts commit r264281. This change breaks building Chromium for iOS. We'll upload a reproducer to the PR soon. llvm-svn: 264333
* Recommitted r263425 "Supporting all entities declared in lexical scope in ↵Amjad Aboud2016-03-241-7/+14
| | | | | | | | | | LLVM debug info." After fixing PR26942 (the fix is included in this commit). Differential Revision: http://reviews.llvm.org/D18350 llvm-svn: 264281
* Revert "Recommitted r261634 "Supporting all entities declared in lexical ↵Benjamin Kramer2016-03-141-14/+7
| | | | | | | | scope in LLVM debug info." After fixing PR26715 at r263379." This reverts commit r263425. Breaks self-host. llvm-svn: 263436
* Recommitted r261634 "Supporting all entities declared in lexical scope in ↵Amjad Aboud2016-03-141-7/+14
| | | | | | | | LLVM debug info." After fixing PR26715 at r263379. llvm-svn: 263425
* [OPENMP 4.0] Codegen for 'declare reduction' construct.Alexey Bataev2016-03-041-3/+8
| | | | | | | Emit function for 'combiner' part of 'declare reduction' construct and 'initialilzer' part, if any. llvm-svn: 262699
* [OPENMP 4.0] Initial support for 'omp declare reduction' construct.Alexey Bataev2016-03-031-0/+8
| | | | | | | | | | | | | | | | | Add parsing, sema analysis and serialization/deserialization for 'declare reduction' construct. User-defined reductions are defined as #pragma omp declare reduction( reduction-identifier : typename-list : combiner ) [initializer ( initializer-expr )] These custom reductions may be used in 'reduction' clauses of OpenMP constructs. The combiner specifies how partial results can be combined into a single value. The combiner can use the special variable identifiers omp_in and omp_out that are of the type of the variables being reduced with this reduction-identifier. Each of them will denote one of the values to be combined before executing the combiner. It is assumed that the special omp_out identifier will refer to the storage that holds the resulting combined value after executing the combiner. As the initializer-expr value of a user-defined reduction is not known a priori the initializer-clause can be used to specify one. Then the contents of the initializer-clause will be used as the initializer for private copies of reduction list items where the omp_priv identifier will refer to the storage to be initialized. The special identifier omp_orig can also appear in the initializer-clause and it will refer to the storage of the original variable to be reduced. Differential Revision: http://reviews.llvm.org/D11182 llvm-svn: 262582
* Serialize `#pragma detect_mismatch`.Nico Weber2016-03-021-0/+1
| | | | | | | This is like r262493, but for pragma detect_mismatch instead of pragma comment. The two pragmas have similar behavior, so use the same approach for both. llvm-svn: 262506
* Serialize `#pragma comment`.Nico Weber2016-03-021-0/+1
| | | | | | | | | | | | | | `#pragma comment` was handled by Sema calling a function on ASTConsumer, and CodeGen then implementing this function and writing things to its output. Instead, introduce a PragmaCommentDecl AST node and hang one off the TranslationUnitDecl for every `#pragma comment` line, and then use the regular serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's eagerly deserialized.) http://reviews.llvm.org/D17799 llvm-svn: 262493
* Revert r261634 "Supporting all entities declared in lexical scope in LLVM ↵Hans Wennborg2016-02-231-14/+7
| | | | | | | | debug info." and r261657 r261634 and r261633 seems to have caused PR26715. r261657 depends on the former two. llvm-svn: 261670
* Supporting all entities declared in lexical scope in LLVM debug info.Amjad Aboud2016-02-231-7/+14
| | | | | | Differential Revision: http://reviews.llvm.org/D15977 llvm-svn: 261634
* [OPENMP] Rename OMPCapturedFieldDecl to OMPCapturedExprDecl, NFC.Alexey Bataev2016-02-111-1/+1
| | | | | | | | OMPCapturedExprDecl allows caopturing not only of fielddecls, but also other expressions. It also allows to simplify codegen for several clauses. llvm-svn: 260492
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-101-6/+5
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* [OPENMP 4.5] Ccapture/codegen of private non-static data members.Alexey Bataev2016-02-081-0/+1
| | | | | | | OpenMP 4.5 introduces privatization of non-static data members of current class in non-static member functions. To correctly handle such kind of privatization a new (pseudo)declaration VarDecl-based node is added. It allows to reuse an existing code for capturing variables in Lambdas/Block/Captured blocks of code for correct privatization and codegen. llvm-svn: 260077
* Move DebugInfoKind into its own header to cut the cyclic dependency edge ↵Benjamin Kramer2016-02-021-5/+5
| | | | | | from Driver to Frontend. llvm-svn: 259489
* Emit calls to objc_unsafeClaimAutoreleasedReturnValue whenJohn McCall2016-01-271-2/+1
| | | | | | | | | | | | | | | | | reclaiming a call result in order to ignore it or assign it to an __unsafe_unretained variable. This avoids adding an unwanted retain/release pair when the return value is not actually returned autoreleased (e.g. when it is returned from a nonatomic getter or a typical collection accessor). This runtime function is only available on the latest Apple OS releases; the backwards-compatibility story is that you don't get the optimization unless your deployment target is recent enough. Sorry. rdar://20530049 llvm-svn: 258962
* Correctly handle type mismatches in the __weak copy/move-initializationJohn McCall2015-11-161-2/+12
| | | | | | | | peephole I added in r250916. rdar://23559789 llvm-svn: 253255
* [Sema] Implement __make_integer_seqDavid Majnemer2015-11-041-0/+1
| | | | | | | | | | | | | | | | | | This new builtin template allows for incredibly fast instantiations of templates like std::integer_sequence. Performance numbers follow: My work station has 64 GB of ram + 20 Xeon Cores at 2.8 GHz. __make_integer_seq<std::integer_sequence, int, 90000> takes 0.25 seconds. std::make_integer_sequence<int, 90000> takes unbound time, it is still running. Clang is consuming gigabytes of memory. Differential Revision: http://reviews.llvm.org/D13786 llvm-svn: 252036
* In ARC, peephole the initialization of a __weak variable withJohn McCall2015-10-211-0/+47
| | | | | | | a value loaded from a __weak variable into a call to objc_copyWeak or objc_moveWeak. llvm-svn: 250916
* [WinEH] Don't use lifetime markers for MS catch parametersReid Kleckner2015-10-071-1/+7
| | | | | | | | | We don't have a good place to put them. Our previous spot was causing us to optimize loads from the exception object to undef, because it was after the catchpad instruction that models the write to the catch object. llvm-svn: 249616
* [OpenCL 2.0] Enable program scope variables, Section 6.5.1.Anastasia Stulova2015-09-301-1/+1
| | | | | | | | | | | | | | | | | | - Remove virtual SC_OpenCLWorkGroupLocal storage type specifier as it conflicts with static local variables now and prevents diagnosing static local address space variables correctly. - Allow static local and global variables (OpenCL2.0 s6.8 and s6.5.1). - Improve diagnostics of allowed ASes for variables in different scopes: (i) Global or static local variables have to be in global or constant ASes (OpenCL1.2 s6.5, OpenCL2.0 s6.5.1); (ii) Non-kernel function variables can't be declared in local or constant ASes (OpenCL1.1 s6.5.2 and s6.5.3). http://reviews.llvm.org/D13105 llvm-svn: 248906
* Fix a nasty bug with the partial destruction of nested arrays;John McCall2015-09-141-2/+2
| | | | | | | | | it escaped notice because it's only used for heterogeneous initialization. rdar://21397946 llvm-svn: 247597
* clangCodeGen: Fix comments. [-Wdocumentation]NAKAMURA Takumi2015-09-081-1/+1
| | | | llvm-svn: 246995
* When building the alloca for a local variable, set its nameJohn McCall2015-09-081-1/+5
| | | | | | | | | | separately from building the instruction so that it's preserved even in -Asserts builds. Employ C++'s mystical "comment" feature to discourage breaking this in the future. llvm-svn: 246991
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-081-144/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. llvm-svn: 246985
* Devirtualize EHScopeStack::Cleanup's dtor because it's never destroyed ↵David Blaikie2015-08-181-9/+9
| | | | | | polymorphically llvm-svn: 245378
* Fix a case where we forgot to make a static local variable comdatReid Kleckner2015-07-201-0/+1
| | | | | | | | | | | | | Sometimes we can provide an initializer for static locals, in which case we sometimes might need to change the type. Changing the type requires making a new LLVM GlobalVariable, and in this codepath we were forgetting to transfer the comdat. Fixes PR23838. Patch by Ivan Garramona. llvm-svn: 242704
* Rely on default zero-arg value for IRBuilder::CreateCall calls to zero-arg ↵David Blaikie2015-07-141-1/+1
| | | | | | | | functions Patch by servuswiegehtz at yahoo.de llvm-svn: 242168
* Parsing, semantic analysis, and AST for Objective-C type parameters.Douglas Gregor2015-07-071-0/+1
| | | | | | | | | | | | | | | | | | | | Produce type parameter declarations for Objective-C type parameters, and attach lists of type parameters to Objective-C classes, categories, forward declarations, and extensions as appropriate. Perform semantic analysis of type bounds for type parameters, both in isolation and across classes/categories/extensions to ensure consistency. Also handle (de-)serialization of Objective-C type parameter lists, along with sundry other things one must do to add a new declaration to Clang. Note that Objective-C type parameters are typedef name declarations, like typedefs and C++11 type aliases, in support of type erasure. Part of rdar://problem/6294649. llvm-svn: 241541
* Switch users of the 'for (StmtRange range = stmt->children(); range; ↵Benjamin Kramer2015-07-021-5/+5
| | | | | | | | | ++range)‘ pattern to range for loops. The pattern was born out of the lack of range-based for loops in C++98 and is somewhat obscure. No functionality change intended. llvm-svn: 241300
* Revert "[DebugInfo] Fix debug info generation for function static variables, ↵David Blaikie2015-07-011-9/+2
| | | | | | | | | | typedefs, and records" Caused PR24008. This reverts commit r241154. llvm-svn: 241177
* [DebugInfo] Fix debug info generation for function static variables, ↵Michael Kuperstein2015-07-011-2/+9
| | | | | | | | | | | | | | | typedefs, and records Function static variables, typedefs and records (class, struct or union) declared inside a lexical scope were associated with the function as their parent scope, rather than the lexical scope they are defined or declared in. This fixes PR19238 Patch by: amjad.aboud@intel.com Differential Revision: http://reviews.llvm.org/D9760 llvm-svn: 241154
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-3/+3
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-3/+3
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* [CodeGen] Use IRBuilder to create llvm.lifetime intrinsics.Alexey Samsonov2015-06-121-9/+6
| | | | | | | | | | | | | | | | | | | | Summary: In addition to easier syntax, IRBuilder makes sure to set correct debug locations for newly added instructions (bitcast and llvm.lifetime itself). This restores the original behavior, which was modified by r234581 (reapplied as r235553). Extend one of the tests to check for debug locations. Test Plan: regression test suite Reviewers: aadg, dblaikie Subscribers: cfe-commits, majnemer Differential Revision: http://reviews.llvm.org/D10418 llvm-svn: 239643
* API update for streamlining of IRBuilder::CreateCall to just use ↵David Blaikie2015-05-181-1/+1
| | | | | | ArrayRef/initializer_list+braced init llvm-svn: 237625
* Revert r236879, "Do not emit thunks with available_externally linkage in ↵NAKAMURA Takumi2015-05-091-1/+2
| | | | | | | | comdats" It broke pecoff, at least i686-cygwin. llvm-svn: 236937
* Do not emit thunks with available_externally linkage in comdatsDerek Schuff2015-05-081-2/+1
| | | | | | | | | | | | | | Functions with available_externally linkage will not be emitted to object files (they will just be undefined symbols), so it does not make sense to put them in comdats. Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject instead of the Decl, and uses that in several places that had the faulty logic. Differential Revision: http://reviews.llvm.org/D9580 llvm-svn: 236879
* Fix for http://llvm.org/PR23392: magick/feature.c from ImageMagick-6.9.1-2 ICEs.Alexey Bataev2015-05-071-0/+2
| | | | | | | Fix for codegen of static variables declared inside of captured statements. Captured statements are actually a transparent DeclContexts, so we have to skip them when trying to get a mangled name for statics. Differential Revision: http://reviews.llvm.org/D9522 llvm-svn: 236701
OpenPOWER on IntegriCloud