summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Tighten up the rules for precise lifetime and documentJohn McCall2013-03-131-1/+1
| | | | | | | | the requirements on the ARC optimizer. rdar://13407451 llvm-svn: 176924
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-5/+12
| | | | | | | | | | | | | | | 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
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | calls and declarations. LLVM has a default CC determined by the target triple. This is not always the actual default CC for the ABI we've been asked to target, and so we sometimes find ourselves annotating all user functions with an explicit calling convention. Since these calling conventions usually agree for the simple set of argument types passed to most runtime functions, using the LLVM-default CC in principle has no effect. However, the LLVM optimizer goes into histrionics if it sees this kind of formal CC mismatch, since it has no concept of CC compatibility. Therefore, if this module happens to define the "runtime" function, or got LTO'ed with such a definition, we can miscompile; so it's quite important to get this right. Defining runtime functions locally is quite common in embedded applications. llvm-svn: 176286
* Abstract out emitting the vdtor calls and do it properly when using -cxx-abi ↵Timur Iskhodzhanov2013-02-151-12/+11
| | | | | | microsoft; also fix vdtor calls for the ARM ABI llvm-svn: 175271
* Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058Timur Iskhodzhanov2013-02-131-8/+10
| | | | llvm-svn: 175045
* CodeGen: Implement hint values for dynamic_cast as described in the Itanium ↵Benjamin Kramer2013-02-031-2/+59
| | | | | | | | | | | | | | | C++ ABI. This can yield dramatic speedups of dynamic_cast for simple inheritance trees, at least with libsupc++. Neither libcxxabi nor libcxxrt make use of this hint currently, it was never implemented because clang didn't support it. There was some concern about the number of class hierarchy walks this change introduces. If it turns out to be an issue we can add caching either at the cast pair level or even deeper, but we also do a lot of walks in Sema so this codepath is probably fairly optimized already. llvm-svn: 174293
* CodeGen: Mark the runtime function __dynamic_cast as readonly & nounwind.Benjamin Kramer2013-02-031-5/+10
| | | | | | This allows the optimizer to CSE dynamic_casts. llvm-svn: 174289
* When we're emitting a constructor or destructor call from a delegatingDouglas Gregor2013-01-311-3/+7
| | | | | | | 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-1/+1
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | 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-3/+3
| | | | llvm-svn: 167261
* Cleanup some clang code to use new type functions instead of using cast<>.Micah Villmow2012-10-251-2/+1
| | | | llvm-svn: 166684
* -fcatch-undefined-behavior checking for appropriate vptr value: Clang ↵Richard Smith2012-10-251-2/+3
| | | | | | CodeGen side. llvm-svn: 166661
* When we're devirtualizing a method call, make sure the method has the ↵Eli Friedman2012-10-251-7/+7
| | | | | | | | correct IR type. Reported in the thread "devirtualisation appears to crash clang on covariant functions on ARM" on cfe-dev. llvm-svn: 166651
* Switch CodeGenOptions over to a .def file, like we do with LangOptions.Douglas Gregor2012-10-231-2/+3
| | | | llvm-svn: 166497
* -fcatch-undefined-behavior: emit calls to the runtime library whenever one ↵Richard Smith2012-10-091-8/+11
| | | | | | of the checks fails. llvm-svn: 165536
* CodeGen: Copy tail padding when we're not dealing with a trivial copy assign ↵Benjamin Kramer2012-09-301-2/+2
| | | | | | | | | | or move assign operator. This fixes a regression from r162254, the optimizer has problems reasoning about the smaller memcpy as it's often not safe to widen a store but making it smaller is. llvm-svn: 164917
* When performing a ::delete of an object with a virtual destructor,John McCall2012-09-251-1/+7
| | | | | | | | | | | | | | be sure to delete the complete object pointer, not the original pointer. This is necessary if the base being deleted is at a non-zero offset in the complete object. This is only required for objects with virtual destructors because deleting an object via a base-class subobject when the base does not have a virtual destructor is undefined behavior. Noticed while reviewing the last four years of cxx-abi-dev activity. llvm-svn: 164597
* Remove redundant semicolons which are null statements.Dmitri Gribenko2012-09-101-1/+1
| | | | llvm-svn: 163546
* -fcatch-undefined-behavior: Factor emission of the creation of, and branch to,Richard Smith2012-09-081-2/+3
| | | | | | | | | the trap BB out of the individual checks and into a common function, to prepare for making this code call into a runtime library. Rename the existing EmitCheck to EmitTypeCheck to clarify it and to move it out of the way of the new EmitCheck. llvm-svn: 163451
* Fix a CodeGen bug where we would skip zero-initialization forEli Friedman2012-08-251-4/+1
| | | | | | array new with a non-trivial constructor. Pointed out in PR13380. llvm-svn: 162643
* New -fcatch-undefined-behavior features:Richard Smith2012-08-241-0/+7
| | | | | | | | * when checking that a pointer or reference refers to appropriate storage for a type, also check the alignment and perform a null check * check that references are bound to appropriate storage * check that 'this' has appropriate storage in member accesses and member function calls llvm-svn: 162523
* Devirtualize calls on glvalues produced by class member access expressions.Richard Smith2012-08-151-1/+8
| | | | | | Based on a patch by Yin Ma! llvm-svn: 161998
* Factor out computation of whether a typeid's expression is potentiallyRichard Smith2012-08-131-9/+3
| | | | | | evaluated into a CXXTypeid member function. No functionality change. llvm-svn: 161779
* The delete argument should not be converted to void*.Abramo Bagnara2012-07-091-11/+0
| | | | llvm-svn: 159961
* Distinguish more carefully between free functions and C++ instance methodsJohn McCall2012-07-071-10/+10
| | | | | | | | in the ABI arrangement, and leave a hook behind so that we can easily tweak CCs on platforms that use different CCs by default for C++ instance methods. llvm-svn: 159894
* Compare the canonical types and document why we give up on the covariant case.Rafael Espindola2012-06-281-2/+8
| | | | llvm-svn: 159360
* Disable devirtualization when we have covariant returns. I will open a bugRafael Espindola2012-06-281-0/+3
| | | | | | for tracking this. llvm-svn: 159351
* Don't devirtualize calls when we don't have the correct type of the this pointerRafael Espindola2012-06-281-19/+36
| | | | | | | | | handy. It can be done, but we would have to build a derived-to-base cast during codegen to compute the correct this pointer. I will handle covariant returns next. llvm-svn: 159350
* Fix another issue with devirtualizing calls to final methods by passing themRafael Espindola2012-06-281-9/+16
| | | | | | | | the correct this pointer. There is some potential for sharing a bit more code with canDevirtualizeMemberFunctionCalls, but that can be done in an independent patch. llvm-svn: 159326
* Implement John McCall's review of r159212 other than the this pointer notRafael Espindola2012-06-271-4/+2
| | | | | | being updated. Will fix that in a second. llvm-svn: 159280
* Fix a bug in my previous patch: If we are not doing a virtual call becauseRafael Espindola2012-06-261-0/+4
| | | | | | | the member expression is qualified, call the method specified in the code, not the most derived one we can find. llvm-svn: 159219
* During codegen of a virtual call we would extract any casts in the expressionRafael Espindola2012-06-261-33/+22
| | | | | | | | to see if we had an underlying final class or method, but we would then use the cast type to do the call, resulting in a direct call to the wrong method. llvm-svn: 159212
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-2/+2
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Zap a bogus assert for delegating constructors. PR12890, part 2.Eli Friedman2012-05-201-1/+0
| | | | | | I'm pretty sure we are in fact doing the right thing here, but someone who knows the standard better should double-check that we are in fact supposed to zero out the member in the given testcase. llvm-svn: 157138
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-2/+2
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Use enum to set debug info size generated by ClangAlexey Samsonov2012-04-271-1/+1
| | | | llvm-svn: 155697
* Propagate alignment on lvalues through EmitLValueForField. PR12395.Eli Friedman2012-04-161-1/+4
| | | | llvm-svn: 154789
* Revert r153613 as it's causing large compile-time regressions on the nightly ↵Chad Rosier2012-03-291-2/+1
| | | | | | testers. llvm-svn: 153660
* When we can't prove that the target of an aggregate copy isJohn McCall2012-03-281-1/+2
| | | | | | | 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
* Formatting.Eric Christopher2012-02-291-1/+1
| | | | llvm-svn: 151700
* Reapply r151172 - Unwind path cleanup for array new list initializers - with aChad Rosier2012-02-241-7/+32
| | | | | | test case that only runs on debug builds. llvm-svn: 151311
* Replace a use of hasTrivialDefaultConstructor() with the appropriateDouglas Gregor2012-02-231-1/+1
| | | | | | isTrivial() call. llvm-svn: 151259
* Revert r151172: Unwind path cleanup for array new list initializers.Chad Rosier2012-02-221-32/+7
| | | | llvm-svn: 151203
* Unwind path cleanup for array new list initializers.Sebastian Redl2012-02-221-7/+32
| | | | llvm-svn: 151172
* CodeGen for array new list initializers. Doesn't correctly clean up in the ↵Sebastian Redl2012-02-221-27/+69
| | | | | | face of exceptions yet. llvm-svn: 151171
* Make heap-allocation of std::initializer_list 'work'.Sebastian Redl2012-02-191-0/+2
| | | | llvm-svn: 150931
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-23/+23
| | | | | | | | | | | | | | | | | | | | | 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
* Elide copy construction in new expressions. PR11757.Eli Friedman2012-02-161-14/+0
| | | | llvm-svn: 150738
OpenPOWER on IntegriCloud