summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Cleanup linkage computation for static locals.Rafael Espindola2013-06-171-5/+3
| | | | | | | With this patch we assign VisibleNoLinkage to static locals in inline functions. This lets us simplify CodeGen a bit. llvm-svn: 184114
* Fix the linkage of static locals inside a CapturedStmt. (Found in theEli Friedman2013-06-131-3/+21
| | | | | | process of trying to fix the related issue for block literals.) llvm-svn: 183951
* Simplify: we don't need any special-case lifetime extension when initializingRichard Smith2013-06-121-1/+1
| | | | | | | declarations of reference type; they're handled by the general case handling of MaterializeTemporaryExpr. llvm-svn: 183875
* PR12086, PR15117Richard Smith2013-06-121-1/+0
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* Reapply r183721, reverted in r183776, with a fix for a bug in the former (weRichard Smith2013-06-121-0/+20
| | | | | | | | | | | | | | | | | | | | | | | were lacking ExprWithCleanups nodes in some cases where the new approach to lifetime extension needed them). Original commit message: Rework IR emission for lifetime-extended temporaries. Instead of trying to walk into the expression and dig out a single lifetime-extended entity and manually pull its cleanup outside the expression, instead keep a list of the cleanups which we'll need to emit when we get to the end of the full-expression. Also emit those cleanups early, as EH-only cleanups, to cover the case that the full-expression does not terminate normally. This allows IR generation to properly model temporary lifetime when multiple temporaries are extended by the same declaration. We have a pre-existing bug where an exception thrown from a temporary's destructor does not clean up lifetime-extended temporaries created in the same expression and extended to automatic storage duration; that is not fixed by this patch. llvm-svn: 183859
* Revert r183721. It caused cleanups to be delayed too long in some cases.Richard Smith2013-06-111-20/+0
| | | | | | Testcase to follow. llvm-svn: 183776
* Rework IR emission for lifetime-extended temporaries. Instead of trying to walkRichard Smith2013-06-111-0/+20
| | | | | | | | | | | | | | | | | into the expression and dig out a single lifetime-extended entity and manually pull its cleanup outside the expression, instead keep a list of the cleanups which we'll need to emit when we get to the end of the full-expression. Also emit those cleanups early, as EH-only cleanups, to cover the case that the full-expression does not terminate normally. This allows IR generation to properly model temporary lifetime when multiple temporaries are extended by the same declaration. We have a pre-existing bug where an exception thrown from a temporary's destructor does not clean up lifetime-extended temporaries created in the same expression and extended to automatic storage duration; that is not fixed by this patch. llvm-svn: 183721
* PR12848: When emitting a local variable declared 'constexpr', always ↵Richard Smith2013-06-021-8/+15
| | | | | | initialize it with a store or a memcpy, not by emitting the initializer expression. This is not required for correctness, but more closely aligns with people's expectations, and is cheap (since we've already evaluated the initializer). llvm-svn: 183082
* PR14606: Debug Info for namespace aliases/DW_TAG_imported_moduleDavid Blaikie2013-05-201-1/+4
| | | | | | | | | This resolves the last of the PR14606 failures in the GDB 7.5 test suite. (but there are still unresolved issues in the imported_decl case - we need to implement optional/lazy decls for functions & variables like we already do for types) llvm-svn: 182329
* Revert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration ↵David Blaikie2013-05-201-2/+5
| | | | | | | | | | | | | | | | | | | | | of variables, types, and functions."" This reverts commit r181947 (git d2990ce56a16050cac0d7937ec9919ff54c6df62 ) This addresses one of the two issues identified in r181947, ensuring that types imported via using declarations only result in a declaration being emitted for the type, not a definition. The second issue (emitting using declarations that are unused) is hopefully an acceptable increase as the real fix for this would be a bit difficult (probably at best we could record which using directives were involved in lookups - but may not have been the result of the lookup). This also ensures that DW_TAG_imported_declarations (& directives) are not emitted in line-tables-only mode as well as ensuring that typedefs only require/emit declarations (rather than definitions) for referenced types. llvm-svn: 182231
* Let CodeGenFunction::EmitVarDecl query the semantic storage class info.Enea Zaffanella2013-05-161-11/+7
| | | | | | Added testcase corresponding to PR15991. llvm-svn: 181998
* Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of ↵David Blaikie2013-05-151-5/+2
| | | | | | | | | | | | | variables, types, and functions." This reverts commit r181393 (git 3923d6a87fe7b2c91cc4a7dbd90c4ec7e2316bcd). This seems to be emitting too much extra debug info for two (known) reasons: * full class definitions are emitted when only declarations are expected * unused using declarations still produce DW_TAG_imported_declarations llvm-svn: 181947
* Debug Info: Using declarations/DW_TAG_imported_declaration of variables, ↵David Blaikie2013-05-081-2/+5
| | | | | | | | | | | | types, and functions. Basic support is implemented here - it still doesn't account for declared-but-not-defined variables or functions. It cannot handle out of order (declared, 'using', then defined) cases for variables, but can handle that for functions (& can handle declared, 'using'd, and not defined at all cases for types). llvm-svn: 181393
* Revert "Revert "PR14606: Debug info for using ↵David Blaikie2013-04-221-1/+4
| | | | | | | | directives/DW_TAG_imported_module"" This reverts commit 179839 now that the corresponding LLVM patch has been fixed. llvm-svn: 179997
* Revert "PR14606: Debug info for using directives/DW_TAG_imported_module"Eric Christopher2013-04-191-4/+1
| | | | | | This reverts commit r179837 as it seems to be causing test failures. llvm-svn: 179839
* PR14606: Debug info for using directives/DW_TAG_imported_moduleDavid Blaikie2013-04-191-1/+4
| | | | | | More changes later for using declarations/DW_TAG_imported_declaration. llvm-svn: 179837
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-1/+1
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* Sema for Captured StatementsTareq A. Siraj2013-04-161-0/+1
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+1
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Annotate flavor of TLS variable (statically or dynamically initialized) onto ↵Richard Smith2013-04-131-1/+1
| | | | | | the AST. llvm-svn: 179447
* Add 178663 back.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-1/+1
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* [ASan] Emit lifetime markers for local variables in ↵Alexey Samsonov2013-04-021-0/+3
| | | | | | -fsanitize=use-after-scope mode llvm-svn: 178538
* Bugfix/Followup for r177086.Adrian Prantl2013-03-291-1/+1
| | | | | | | | | * Store the .block_descriptor (instead of self) in the alloca so we can guarantee that all captured variables are available at -O0. * Add the missing OpDeref for the alloca. rdar://problem/12767564 llvm-svn: 178361
* Remove useGlobalsForAutomaticVariables.Rafael Espindola2013-03-261-92/+80
| | | | | | It is unused since pic support went away. llvm-svn: 178055
* Make clang to mark static stack allocations with lifetime markers to enable ↵Nadav Rotem2013-03-231-1/+68
| | | | | | | | | a more aggressive stack coloring. Patch by John McCall with help by Shuxin Yang. rdar://13115369 llvm-svn: 177819
* OpenMP threadprivate directive parsing and semantic analysisAlexey Bataev2013-03-221-0/+1
| | | | llvm-svn: 177705
* Allocate stack storage for .block_descriptor and captured self at -O0.Adrian Prantl2013-03-141-3/+13
| | | | | | | | | This way the register allocator will not optimize away the debug info for captured variables. Fixes rdar://problem/12767564 llvm-svn: 177086
* Tighten up the rules for precise lifetime and documentJohn McCall2013-03-131-5/+12
| | | | | | | | the requirements on the ARC optimizer. rdar://13407451 llvm-svn: 176924
* Promote atomic type sizes up to a power of two, capped byJohn McCall2013-03-071-2/+6
| | | | | | | | MaxAtomicPromoteWidth. Fix a ton of terrible bugs with _Atomic types and (non-intrinsic-mediated) loads and stores thereto. llvm-svn: 176658
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-5/+13
| | | | | | | | | | | | | | | aggregate types in a profoundly wrong way that has to be worked around in every call site, to getEvaluationKind, which classifies and distinguishes between all of these cases. Also, normalize the API for loading and storing complexes. I'm working on a larger patch and wanted to pull these changes out, but it would have be annoying to detangle them from each other. llvm-svn: 176656
* [Sema] Semantic analysis for empty-declaration and attribute-declaration.Michael Han2013-02-221-0/+1
| | | | | | | | Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these attributes can be sema checked just as attributes attached to "normal" declarations. llvm-svn: 175900
* objective-C arc IR-gen. Retaining of strongFariborz Jahanian2013-02-211-8/+17
| | | | | | | | | | arguments in function prologue is done with objc_StoreStrong to pair it with similar objc_StoreStrong for release in function epilogue. This is done with -O0 only. // rdar://13145317 llvm-svn: 175698
* Revert r174246, accidentally committed.David Blaikie2013-02-021-6/+2
| | | | | | This reverts commit 1513eb9284c23acfd19cf742b95996fbb11ca741. llvm-svn: 174249
* BasicsDavid Blaikie2013-02-021-2/+6
| | | | llvm-svn: 174246
* Destroy arrays and ARC fields when throwing out of ctors.John McCall2013-02-011-1/+12
| | | | | | | | Previously we were only handling non-array fields of class type. Testcases derived from a patch by WenHan Gu. llvm-svn: 174146
* When we're emitting a constructor or destructor call from a delegatingDouglas Gregor2013-01-311-1/+3
| | | | | | | constructor, retrieve our VTT parameter directly. Fixes PR14588 / <rdar://problem/12867962>. llvm-svn: 174042
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-4/+4
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* CGDecl.cpp: Prune three descriptions in two methods, ↵NAKAMURA Takumi2012-12-241-8/+0
| | | | | | | | | | CodeGenFunction::pushIrregularPartialArrayCleanup() and CodeGenFunction::pushRegularPartialArrayCleanup(). [-Wdocumentation] /// \param array - a value of type elementType* /// \param destructionKind - the kind of destruction required /// \param initializedElementCount - a value of type size_t* holding the number of successfully-constructed elements llvm-svn: 171013
* Don't eagerly emit a global static merged with a local extern.Rafael Espindola2012-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we are visiting the extern declaration of 'i' in static int i = 99; int foo() { extern int i; return i; } We should not try to handle it as if it was an function static. That is, we must consider the written storage class. Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the if leading to its call are not completely accurate. They were passing before because the second decl was marked as having external storage. I changed them to check the linkage, which I find easier to understand. Last but not least, there is something strange going on with cuda and opencl. My guess is that the linkage computation for these languages needs to be audited, but I didn't want to change that in this patch so I just updated the storage classes to keep the current behavior. Thanks to Reed Kotler for reporting this. llvm-svn: 170827
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Simplify: replace getContext().getLangOpts() with just getLangOpts().Richard Smith2012-11-011-4/+4
| | | | llvm-svn: 167261
* Switch CodeGenOptions over to a .def file, like we do with LangOptions.Douglas Gregor2012-10-231-5/+7
| | | | llvm-svn: 166497
* Move TargetData to DataLayout.Micah Villmow2012-10-081-2/+2
| | | | llvm-svn: 165395
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-271-1/+1
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 llvm-svn: 164769
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-271-1/+1
| | | | llvm-svn: 164766
* CUDA: give correct address space to globals declared in functionsPeter Collingbourne2012-08-281-1/+3
| | | | llvm-svn: 162787
* CodeGen: Hoist check from recursive function to its only callsite.Benjamin Kramer2012-08-271-4/+4
| | | | | | Suggested by Roman Divacky. llvm-svn: 162702
* CodeGen: When emitting stores for an initializer, only emit a GEP if we ↵Benjamin Kramer2012-08-271-7/+10
| | | | | | | | really need the store. This avoids emitting many dead GEPs for large zero-initialized arrays. llvm-svn: 162701
OpenPOWER on IntegriCloud