summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Add -ftls-model command-line flag.Hans Wennborg2012-06-281-12/+6
| | | | | | This allows for setting the default TLS model. (PR9788) llvm-svn: 159336
* Support the tls_model attribute (PR9788)Hans Wennborg2012-06-231-4/+14
| | | | | | | | | | | | | | This adds support for the tls_model attribute. This allows the user to choose a TLS model that is better than what LLVM would select by default. For example, a variable might be declared as: __thread int x __attribute__((tls_model("initial-exec"))); if it will not be used in a shared library that is dlopen'ed. This depends on LLVM r159077. llvm-svn: 159078
* objc-arc: captured block variable accessed in its block literalFariborz Jahanian2012-06-191-0/+8
| | | | | | | | initializer need be null initialized before initializer takes hold, just like any other initialized retainable object pointer. // rdar://11016025 llvm-svn: 158738
* This patch adds a new Clang compiler flag "-gline-tables-only".Alexey Samsonov2012-05-041-10/+20
| | | | | | | | | | | | | | It reduces the amount of emitted debug information: 1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram, DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only. 2) .debug_str contains only function names. 3) No debug data for types/namespaces/variables is emitted. 4) The data in .debug_line is enough to produce valid stack traces with function names and line numbers. Reviewed by Eric Christopher. llvm-svn: 156160
* Don't enter cleanups for unreachable variables. It's impossible toJohn McCall2012-04-131-0/+4
| | | | | | | | jump into these scopes, and the cleanup-entering code sometimes wants to do some operations first (e.g. a GEP), which can leave us with unparented IR. llvm-svn: 154684
* Make sure we unique static-local decls across multiple emissions ofJohn McCall2012-03-301-17/+25
| | | | | | | | the function body, but do so in a way that doesn't make any assumptions about the static local actually having a proper, unique mangling, since apparently we don't do that correctly at all. llvm-svn: 153776
* Revert r153723, and its follow-ups r153728 and r153733.Chandler Carruth2012-03-301-96/+55
| | | | | | | | | | | | | | | | These patches cause us to miscompile and/or reject code with static function-local variables in an extern-C context. Previously, we were papering over this as long as the variables are within the same translation unit, and had not seen any failures in the wild. We still need a proper fix, which involves mangling static locals inside of an extern-C block (as GCC already does), but this patch causes pretty widespread regressions. Firefox, and many other applications no longer build. Lots of test cases have been posted to the list in response to this commit, so there should be no problem reproducing the issues. llvm-svn: 153768
* Do the static-locals thing properly in the face of unions andJohn McCall2012-03-301-61/+84
| | | | | | other things which might mess with the variable's type. llvm-svn: 153733
* When emitting a static local variable in C++, handleJohn McCall2012-03-301-0/+18
| | | | | | | | | | | | | | | the case that the variable already exists. Partly this is just protection against people making crazy declarations with custom asm labels or extern "C" names that intentionally collide with the manglings of such variables, but the main reason is that we can actually emit a static local variable twice with the requirement that it match up. There may be other cases with (e.g.) the various nested functions, but the main exemplar is with constructor variants, where we can be forced into double-emitting the function body under certain circumstances like (currently) the presence of virtual bases. llvm-svn: 153723
* Revert r153613 as it's causing large compile-time regressions on the nightly ↵Chad Rosier2012-03-291-3/+2
| | | | | | testers. llvm-svn: 153660
* When we can't prove that the target of an aggregate copy isJohn McCall2012-03-281-2/+3
| | | | | | | a complete object, the memcpy needs to use the data size of the structure instead of its sizeof() value. Fixes PR12204. llvm-svn: 153613
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-5/+5
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-4/+4
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Make sure we update the static local decl address map when we are forced to ↵Eli Friedman2012-03-091-1/+3
| | | | | | rebuild a global because of the initializer. <rdar://problem/10957867>. llvm-svn: 152372
* Make heap-allocation of std::initializer_list 'work'.Sebastian Redl2012-02-191-1/+1
| | | | llvm-svn: 150931
* Fix comment.Chad Rosier2012-02-181-1/+1
| | | | llvm-svn: 150859
* Basic code generation support for std::initializer_list.Sebastian Redl2012-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | We now generate temporary arrays to back std::initializer_list objects initialized with braces. The initializer_list is then made to point at the array. We support both ptr+size and start+end forms, although the latter is untested. Array lifetime is correct for temporary std::initializer_lists (e.g. call arguments) and local variables. It is untested for new expressions and member initializers. Things left to do: Massively increase the amount of testing. I need to write tests for start+end init lists, temporary objects created as a side effect of initializing init list objects, new expressions, member initialization, creation of temporary objects (e.g. std::vector) for initializer lists, and probably more. Get lifetime "right" for member initializers and new expressions. Not that either are very useful. Implement list-initialization of array new expressions. llvm-svn: 150803
* Bug fix: do not emit static const local variables with mutable membersRichard Smith2012-02-171-15/+10
| | | | | | | | | as constants. Refactor and simplify all the separate checks for whether a type can be emitted as a constant. llvm-svn: 150793
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
* Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith2012-02-131-1/+19
| | | | | | | | | | | constructor, and that constructor is used to initialize an object of static storage duration such that all members and bases are initialized by constant expressions, constant initialization is performed. In this case, the object can still have a non-trivial destructor, and if it does, we must emit a dynamic initializer which performs no initialization and instead simply registers that destructor. llvm-svn: 150419
* CWG issue 1405: mutable members are allowed in literal types, but can't undergoRichard Smith2012-02-091-5/+9
| | | | | | lvalue-to-rvalue conversions in constant expressions. llvm-svn: 150145
OpenPOWER on IntegriCloud