summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/static-init.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Output destructors and constructors in a more natural order.Rafael Espindola2013-12-091-6/+6
| | | | | | | | | | | | | | | | With this patch we output the in the order C2 C1 D2 D1 D0 Which means that a destructor or constructor that call another is output after the callee. This is a bit easier to read IHMO and a tiny bit more efficient as we don't put a decl in DeferredDeclsToEmit. llvm-svn: 196784
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-8/+8
| | | | | | tests fail. llvm-svn: 188447
* PR12226: don't generate wrong code if a braced string literal is used toRichard Smith2012-04-151-0/+2
| | | | | | | | | initialize an array of unsigned char. Outside C++11 mode, this bug was benign, and just resulted in us emitting a constant which was double the required length, padded with 0s. In C++11, it resulted in us generating an array whose first element was something like i8 ptrtoint ([n x i8]* @str to i8). llvm-svn: 154756
* Use atexit when __cxa_atexit isn't available instead of adding aJohn McCall2012-04-061-1/+1
| | | | | | | | | global destructor entry. For some reason this isn't enabled for apple-kexts; it'd be good to have documentation for that. Based on a patch by Nakamura Takumi! llvm-svn: 154191
* Make sure we unique static-local decls across multiple emissions ofJohn McCall2012-03-301-0/+71
| | | | | | | | 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-71/+0
| | | | | | | | | | | | | | | | 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-0/+21
| | | | | | 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/+50
| | | | | | | | | | | | | | | 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
* Make sure we update the static local decl address map when we are forced to ↵Eli Friedman2012-03-091-0/+16
| | | | | | rebuild a global because of the initializer. <rdar://problem/10957867>. llvm-svn: 152372
* Make sure constant emission handles initializer lists with strings ↵Eli Friedman2012-03-091-0/+4
| | | | | | correctly. Part of <rdar://problem/10957867>. llvm-svn: 152370
* Re-commit r139643.Eli Friedman2011-09-131-3/+1
| | | | | | Make clang use Acquire loads and Release stores where necessary. llvm-svn: 139650
* Revert r139643 while I look into it; it's breaking selfhost.Eli Friedman2011-09-131-1/+3
| | | | llvm-svn: 139648
* Make clang use Acquire loads and Release stores where necessary.Eli Friedman2011-09-131-3/+1
| | | | llvm-svn: 139643
* Perform an acquire memory barrier on the fast path of a thread-safeJohn McCall2011-06-171-0/+3
| | | | | | static initializer check, as required by the Itanium ABI. llvm-svn: 133250
* Fix a test case and teach ClearLinkageCache() to clear the linkage ofJohn McCall2011-03-221-2/+2
| | | | | | | a function template decl's pattern, which was suddenly exposed by my last patch. llvm-svn: 128073
* Implement ARM static local initialization guards, which are more compact thanJohn McCall2010-09-081-1/+1
| | | | | | Itanium guards and use a slightly different compiled-in API. llvm-svn: 113330
* Correctly align large arrays in x86-64. This fixes PR5599.Rafael Espindola2010-06-041-1/+1
| | | | llvm-svn: 105500
* If a function definition has any sort of weak linkage, its static localJohn McCall2010-05-251-2/+13
| | | | | | | | | | | | variables should have that linkage. Otherwise, its static local variables should have internal linkage. To avoid computing this excessively, set a function's linkage before we emit code for it. Previously we were assigning weak linkage to the static variables of static inline functions in C++, with predictably terrible results. This fixes that and also gives better linkage than 'weak' when merging is required. llvm-svn: 104581
* For thread-safe static initialization of local statics withDouglas Gregor2010-05-051-1/+3
| | | | | | | | destructors, place the __cxa_atexit call after the __cxa_guard_release call, mimicking GCC/LLVM-GCC behavior. Noticed while debugging something related. llvm-svn: 103088
* Just bail out immediately when emitting an unreachable function-local staticJohn McCall2010-05-031-0/+11
| | | | | | variable. Surprisingly, this does seem to be the right way to solve this. llvm-svn: 102961
* Use the right linkage for static variables inside C++ inline functions.Anders Carlsson2010-02-071-0/+12
| | | | llvm-svn: 95512
* Make sure to always mark a global variable as not being constant if it has a ↵Anders Carlsson2010-01-261-0/+7
| | | | | | C++ initializer. llvm-svn: 94504
* implement PR5654: add -fassume-sane-operator-new, which is enabled by ↵Nuno Lopes2009-12-161-1/+1
| | | | | | | | default, and adds the malloc attribute to the global function new() and to the overloaded new operators. feel free to chage the name to this lengthy argument llvm-svn: 91543
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Handle emitting static variables that have reference type.Anders Carlsson2009-12-101-4/+8
| | | | llvm-svn: 91027
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-2/+2
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Use the inbounds variant of getelementptr for common pointer arithmetic.Dan Gohman2009-08-121-1/+1
| | | | llvm-svn: 78756
* Refactor some code and implement support for global destructors for static ↵Anders Carlsson2009-08-081-0/+13
variables. llvm-svn: 78507
OpenPOWER on IntegriCloud