summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Typo.Eric Christopher2012-04-161-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154880 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable debug info for objective c implementations that may not haveEric Christopher2012-04-111-0/+5
| | | | | | | | an explicit instance variable. rdar://10590352 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154481 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r153723, and its follow-ups r153728 and r153733.Chandler Carruth2012-03-301-3/+2
| | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153768 91177308-0d34-0410-b5e6-96231b3b80d8
* Do the static-locals thing properly in the face of unions andJohn McCall2012-03-301-2/+3
| | | | | | other things which might mess with the variable's type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153733 91177308-0d34-0410-b5e6-96231b3b80d8
* The UTF16 string referenced by a CFString should go into the __TEXT,__ustringBill Wendling2012-03-301-26/+24
| | | | | | | | | | | | | | section. A 'normal' string will go into the __TEXT,__const section, but this isn't good for UTF16 strings. The __ustring section allows for coalescing, among other niceties (such as allowing the linker to easily split up strings). Instead of outputting the UTF16 string as a series of bytes, output it as a series of shorts. The back-end will then nicely place the UTF16 string into the correct section, because it's a mensch. <rdar://problem/10655949> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153710 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix whitespace.Bill Wendling2012-03-291-6/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153698 91177308-0d34-0410-b5e6-96231b3b80d8
* add tbaa metadata to vtable pointer loads/storesKostya Serebryany2012-03-261-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153447 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify some users of DenseMap::erase.Benjamin Kramer2012-03-241-4/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153389 91177308-0d34-0410-b5e6-96231b3b80d8
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-40/+40
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace MarkVarRequired with a more genericRafael Espindola2012-03-081-2/+6
| | | | | | HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152320 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola2012-03-051-0/+3
| | | | | | | | | | | | In the included testcase, soma thinks that we already have a definition after we see the out of line decl. Codegen puts it in a deferred list, to be output if a use is seen. This would break when we saw an explicit template instantiation definition, since codegen would not be notified. This patch adds a method to the consumer interface so that soma can notify codegen that this decl is now required. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152024 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate r151879, r151880, reverted in r151922, along with a bugfix forRichard Smith2012-03-021-1/+2
| | | | | | | | | | scalar emission of DeclRefExprs to const bools: emit scalar bools as i1, not as i8. In addition to the extra unit testing, this has successfully bootstrapped. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151955 91177308-0d34-0410-b5e6-96231b3b80d8
* Hack in a loud error for PR12086. Better than a silent miscompile.Sebastian Redl2012-02-271-1/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151586 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen support for global variables of type std::initializer_list<X>.Sebastian Redl2012-02-251-2/+117
| | | | | | | | | | | | | This emits a backing array with internal linkage and fills it with data, then has the initializer_list point at the array. Dynamic initialization and global destructors are correctly supported. What doesn't work is nested initializer_lists. I have no idea how to get them to work, either. However, these should be very rare, and so I'll just call it a known bug and declare generalized initializers DONE! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151457 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove UpdateCompletedType from the debug info emission. We nowEric Christopher2012-02-181-2/+0
| | | | | | | emit less than complete types on purpose on occasion and so our caches aren't useful for this kind of lazy emitting. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150856 91177308-0d34-0410-b5e6-96231b3b80d8
* Bug fix: do not emit static const local variables with mutable membersRichard Smith2012-02-171-15/+18
| | | | | | | | | | as constants. Refactor and simplify all the separate checks for whether a type can be emitted as a constant. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150793 91177308-0d34-0410-b5e6-96231b3b80d8
* When performing IRGen on a global, emit it as a constant if:Richard Smith2012-02-171-1/+0
| | | | | | | | | | | | 1) It has a const-qualified type, and 2) It has no mutable members, and 3) It has no dynamic initialization, and 4) It has trivial destruction. Remove the unnecessary requirement that the type be POD. This allows us to mark all constexpr objects with no mutable members as 'constant'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150792 91177308-0d34-0410-b5e6-96231b3b80d8
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-7/+4
| | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150788 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach clang to add metadata tags to calls and invokes in ObjC withDan Gohman2012-02-161-1/+2
| | | | | | | | | | -fno-objc-arc-exceptions. This will allow the optimizer to perform optimizations which are only safe under that flag. This is a part of rdar://10803830. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150644 91177308-0d34-0410-b5e6-96231b3b80d8
* Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith2012-02-131-7/+11
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150419 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-18/+20
| | | | | | CodeGenModule. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149943 91177308-0d34-0410-b5e6-96231b3b80d8
* build wide strings with ConstantDataArray, just because we can.Chris Lattner2012-02-061-12/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149928 91177308-0d34-0410-b5e6-96231b3b80d8
* improve the code that handles IR generation of byte-sized string literals to ↵Chris Lattner2012-02-061-35/+19
| | | | | | | | | avoid allocating an std::string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149924 91177308-0d34-0410-b5e6-96231b3b80d8
* use cheaper llvm APIs for various bits of IR generation.Chris Lattner2012-02-061-17/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149916 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply the patches reverted in r149477, which enable ConstantDataArray.Chris Lattner2012-02-051-25/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149801 91177308-0d34-0410-b5e6-96231b3b80d8
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-2/+2
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149799 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the code that sets the AddressSafetyAlexander Potapenko2012-02-021-8/+7
| | | | | | | | | | | | attribute into CodeGenModule::SetLLVMFunctionAttributesForDefinition(). Previously it resided in CodeGenModule::GetOrCreateLLVMFunction, which for some reason wasn't called for ObjC class methods, see http://code.google.com/p/address-sanitizer/issues/detail?id=33 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149605 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r149363 which was part a series of commits that were reverted in llvmArgyrios Kyrtzidis2012-02-011-26/+25
| | | | | | | | | | | | | | | | | commit 149470. This fixes test/CodeGen/PR3589-freestanding-libcalls.c. Original log: ConstantArray::get() (for strings) is going away, use ConstantDataArray::getString instead. Many instances of ConstantArray::get() could be moved to use more efficient ConstantDataArray methods that avoid a ton of intermediate Constant*'s for each element (e.g. GetConstantArrayFromStringLiteral). I don't plan on doing this in the short-term though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149477 91177308-0d34-0410-b5e6-96231b3b80d8
* Support @compatibility_alias at run time (GNUstep Runtime)David Chisnall2012-01-311-1/+1
| | | | | | | | Patch by Niels Grewe! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149401 91177308-0d34-0410-b5e6-96231b3b80d8
* ConstantArray::get() (for strings) is going away, useChris Lattner2012-01-311-25/+26
| | | | | | | | | | | | | | ConstantDataArray::getString instead. Many instances of ConstantArray::get() could be moved to use more efficient ConstantDataArray methods that avoid a ton of intermediate Constant*'s for each element (e.g. GetConstantArrayFromStringLiteral). I don't plan on doing this in the short-term though. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149363 91177308-0d34-0410-b5e6-96231b3b80d8
* The following patch adds __attribute__((no_address_safety_analysis)) which ↵Kostya Serebryany2012-01-241-0/+8
| | | | | | | | | | | | | | | | will allow to disable address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function. When building with AddressSanitizer, add AddressSafety function attribute to every generated function except for those that have __attribute__((no_address_safety_analysis)). With this patch we will be able to 1. disable AddressSanitizer for a particular function 2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148842 91177308-0d34-0410-b5e6-96231b3b80d8
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-4/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
* test svn commit accessSeth Cantrell2012-01-181-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148388 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a string over-run detected by ASAN.Nick Lewycky2012-01-181-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148375 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix special king of typo.Nick Lewycky2012-01-181-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148368 91177308-0d34-0410-b5e6-96231b3b80d8
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-1/+1
| | | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148187 91177308-0d34-0410-b5e6-96231b3b80d8
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-141-3/+4
| | | | | | | | | | | | | | | | | | | | | APValue::Array and APValue::MemberPointer. All APValue values can now be emitted as constants. Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other entrypoints dealing with constant member pointers are no longer necessary and will be removed in a later change. Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to VarDecl::evaluateValue. This performs caching and deals with the nasty cases in C++11 where a non-const object's initializer can refer indirectly to previously-initialized fields within the same object. Building the intermediate APValue object incurs a measurable performance hit on pathological testcases with huge initializer lists, so we continue to build IR directly from the Expr nodes for array and record types outside of C++11. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148178 91177308-0d34-0410-b5e6-96231b3b80d8
* The `-fwritable-strings' flag doesn't make the backing store strings of allBill Wendling2012-01-101-10/+6
| | | | | | | | | | | | CFStrings writable. The strings (both Unicode and ASCII) should reside in a read-only section. E.g., __TEXT,__cstring instead of __DATA,__data. This is done by making the global variable created for the strings constant despite the value of that flag. <rdar://problem/10657500> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147845 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-4/+6
| | | | | | | ObjCProtocolDecl modules forward declarations properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147415 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-271-1/+0
| | | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147299 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend the fix for PR9614 to handle inline asm in the outer decl andRafael Espindola2011-12-191-15/+32
| | | | | | | the inner decl being a builtin. This is needed to support the glibc headers in fedora 16 (2.14). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146867 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a module import declaration, so that we properly represent, e.g.,Douglas Gregor2011-12-021-0/+1
| | | | | | | | | | __import_module__ std.vector; in the AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145725 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman2011-11-011-24/+51
| | | | | | | | | | | | native representation of integers for the elements. This fixes a bunch of nastiness involving treating wide strings as a series of bytes. Patch by Seth Cantrell. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143417 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9614 for functions with the always_inline attribute. Try to keepRafael Espindola2011-10-281-6/+3
| | | | | | the common case (-O0, no always_inline) fast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143222 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix pr9614 by not emitting an available_externally function when it callsRafael Espindola2011-10-261-4/+58
| | | | | | | | | itself via an asm label. available_externally functions are supposed to correspond to an external function, and that is not the case in the examples in pr9614. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143049 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace vectors with arrays.Benjamin Kramer2011-10-151-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142072 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit:Eric Christopher2011-10-131-3/+1
| | | | | | | | | | | | | | | Start handling debug line and scope information better: Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 after fixing a few bugs that were exposed in gdb testsuite testing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141893 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert file/scope handling patches. gdb testing revealed a couple of bugs.Eric Christopher2011-10-121-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141796 91177308-0d34-0410-b5e6-96231b3b80d8
* Start handling debug line and scope information better:Eric Christopher2011-10-111-3/+1
| | | | | | | | | | | Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141732 91177308-0d34-0410-b5e6-96231b3b80d8
* Free 'TheTargetCodeGenInfo' in the class CodeGenModule. This looks like an ↵Ted Kremenek2011-10-081-0/+1
| | | | | | obvious memory leak that was reported from LLDB devs. The comment indicates the leak is deliberate, but I have no idea why this needs to be so. Please comment/revert if you know otherwise. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141479 91177308-0d34-0410-b5e6-96231b3b80d8