summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* [ms-cxxabi] Construct and destroy call arguments in the correct orderReid Kleckner2013-12-041-1/+1
| | | | | | | | | | | | | | | | | | | Summary: MSVC destroys arguments in the callee from left to right. Because C++ objects have to be destroyed in the reverse order of construction, Clang has to construct arguments from right to left and destroy arguments from left to right. This patch fixes the ordering by reversing the order of evaluation of all call arguments under the MS C++ ABI. Fixes PR18035. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2275 llvm-svn: 196402
* Add CodeGenABITypes.h for use in LLDB.Mark Lacey2013-10-301-0/+1
| | | | | | | | | | | | | | | | | | CodeGenABITypes is a wrapper built on top of CodeGenModule that exposes some of the functionality of CodeGenTypes (held by CodeGenModule), specifically methods that determine the LLVM types appropriate for function argument and return values. I addition to CodeGenABITypes.h, CGFunctionInfo.h is introduced, and the definitions of ABIArgInfo, RequiredArgs, and CGFunctionInfo are moved into this new header from the private headers ABIInfo.h and CGCall.h. Exposing this functionality is one part of making it possible for LLDB to determine the actual ABI locations of function arguments and return values, making it possible for it to determine this for any supported target without hard-coding ABI knowledge in the LLDB code. llvm-svn: 193717
* Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occursNick Lewycky2013-10-021-3/+4
| | | | | | when scalars are loaded / undergo lvalue-to-rvalue conversion. llvm-svn: 191808
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-0/+3
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Simplify linkage code for static local vars.Eli Friedman2013-07-011-49/+3
| | | | | | | | | The key insight here is that weak linkage for a static local variable should always mean linkonce_odr, because every file that needs it will generate a definition. We don't actually care about the precise linkage of the parent context. I feel a bit silly that I didn't realize this before. llvm-svn: 185381
* Fix mangling for block literals.Eli Friedman2013-07-011-8/+39
| | | | | | | | | | | | | | | Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. llvm-svn: 185372
* [ms-cxxabi] Destroy temporary record arguments in the calleeReid Kleckner2013-06-211-2/+10
| | | | | | | | | | | | | | | | | | Itanium destroys them in the caller at the end of the full expression, but MSVC destroys them in the callee. This is further complicated by the need to emit EH-only destructor cleanups in the caller. This should help clang compile MSVC's debug iterators more correctly. There is still an outstanding issue in PR5064 of a memcpy emitted by the LLVM backend, which is not correct for C++ records. Fixes PR16226. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D929 llvm-svn: 184543
* Compute the visibility of static local variables consistently. Fixes PR16208.Eli Friedman2013-06-171-2/+1
| | | | llvm-svn: 184137
* 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
OpenPOWER on IntegriCloud