aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
AgeCommit message (Collapse)AuthorFilesLines
2012-02-16Teach clang to add metadata tags to calls and invokes in ObjC withDan Gohman1-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. llvm-svn: 150644
2012-02-13Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith1-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. llvm-svn: 150419
2012-02-07simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner1-18/+20
CodeGenModule. llvm-svn: 149943
2012-02-06build wide strings with ConstantDataArray, just because we can.Chris Lattner1-12/+18
llvm-svn: 149928
2012-02-06improve the code that handles IR generation of byte-sized string literals to ↵Chris Lattner1-35/+19
avoid allocating an std::string. llvm-svn: 149924
2012-02-06use cheaper llvm APIs for various bits of IR generation.Chris Lattner1-17/+14
llvm-svn: 149916
2012-02-05reapply the patches reverted in r149477, which enable ConstantDataArray.Chris Lattner1-25/+26
llvm-svn: 149801
2012-02-05Basic: import SmallString<> into clang namespaceDylan Noblesmith1-2/+2
(I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
2012-02-02Move the code that sets the AddressSafetyAlexander Potapenko1-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 llvm-svn: 149605
2012-02-01Revert r149363 which was part a series of commits that were reverted in llvmArgyrios Kyrtzidis1-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. llvm-svn: 149477
2012-01-31Support @compatibility_alias at run time (GNUstep Runtime)David Chisnall1-1/+1
Patch by Niels Grewe! llvm-svn: 149401
2012-01-31ConstantArray::get() (for strings) is going away, useChris Lattner1-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. llvm-svn: 149363
2012-01-24The following patch adds __attribute__((no_address_safety_analysis)) which ↵Kostya Serebryany1-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. llvm-svn: 148842
2012-01-20More dead code removal (using -Wunreachable-code)David Blaikie1-4/+2
llvm-svn: 148577
2012-01-18test svn commit accessSeth Cantrell1-0/+1
llvm-svn: 148388
2012-01-18Fix a string over-run detected by ASAN.Nick Lewycky1-2/+3
llvm-svn: 148375
2012-01-18Fix special king of typo.Nick Lewycky1-1/+1
llvm-svn: 148368
2012-01-14De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor1-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. llvm-svn: 148187
2012-01-14constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith1-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. llvm-svn: 148178
2012-01-10The `-fwritable-strings' flag doesn't make the backing store strings of allBill Wendling1-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> llvm-svn: 147845
2012-01-01Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor1-4/+6
ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
2011-12-27Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor1-1/+0
covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
2011-12-19Extend the fix for PR9614 to handle inline asm in the outer decl andRafael Espindola1-15/+32
the inner decl being a builtin. This is needed to support the glibc headers in fedora 16 (2.14). llvm-svn: 146867
2011-12-02Introduce a module import declaration, so that we properly represent, e.g.,Douglas Gregor1-0/+1
__import_module__ std.vector; in the AST. llvm-svn: 145725
2011-11-01Fix the representation of wide strings in the AST and IR so that it uses the ↵Eli Friedman1-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. llvm-svn: 143417
2011-10-28Fix PR9614 for functions with the always_inline attribute. Try to keepRafael Espindola1-6/+3
the common case (-O0, no always_inline) fast. llvm-svn: 143222
2011-10-26Fix pr9614 by not emitting an available_externally function when it callsRafael Espindola1-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. llvm-svn: 143049
2011-10-15Replace vectors with arrays.Benjamin Kramer1-2/+2
llvm-svn: 142072
2011-10-13Recommit:Eric Christopher1-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. llvm-svn: 141893
2011-10-12Revert file/scope handling patches. gdb testing revealed a couple of bugs.Eric Christopher1-1/+3
llvm-svn: 141796
2011-10-11Start handling debug line and scope information better:Eric Christopher1-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 llvm-svn: 141732
2011-10-08Free 'TheTargetCodeGenInfo' in the class CodeGenModule. This looks like an ↵Ted Kremenek1-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. llvm-svn: 141479
2011-10-06CUDA: add -fcuda-is-device flagPeter Collingbourne1-0/+17
This frontend-only flag is used by the IR generator to determine whether to filter CUDA declarations for the host or for the device. llvm-svn: 141301
2011-10-06CUDA: IR generation support for kernel call expressionsPeter Collingbourne1-3/+11
llvm-svn: 141300
2011-10-03Allow getting all source locations of selector identifiers in a ObjCMethodDecl.Argyrios Kyrtzidis1-2/+0
Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
2011-10-03Pass from the parser the locations of selector identifiers when creatingArgyrios Kyrtzidis1-1/+4
objc method decls. They are not stored in the AST yet. llvm-svn: 140984
2011-10-02Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall1-1/+21
increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
2011-09-25Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie1-4/+4
llvm-svn: 140478
2011-09-23Switch assert(0/false) llvm_unreachable.David Blaikie1-1/+1
llvm-svn: 140367
2011-09-19OpenCL: introduce support for function scope __local variablesPeter Collingbourne1-3/+11
llvm-svn: 140068
2011-09-19In apple-kext mode, use external linkage for explicit template instantiationsJohn McCall1-2/+7
instead of internal linkage. llvm-svn: 140030
2011-09-13Correctly generate IR for casted "builtin" functions, whereJohn McCall1-30/+0
the builtin is really just a predefined declaration. These are totally valid to cast. llvm-svn: 139657
2011-09-13Switch LangOptions over to a .def file that describes header of theDouglas Gregor1-2/+2
language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
2011-09-09Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: canJulien Lerouge1-61/+70
annotate global, local variables, struct fields, or arbitrary statements (using the __builtin_annotation), rdar://8037476. llvm-svn: 139423
2011-09-09Treat the weak export of block runtime symbols as a deployment-targetJohn McCall1-90/+0
feature akin to the ARC runtime checks. Removes a terrible hack where IR gen needed to find the declarations of those symbols in the translation unit. llvm-svn: 139404
2011-09-09Do a lookup for the blocks runtime globals to see if they were declared,Argyrios Kyrtzidis1-45/+36
instead of codegen waiting to consume such a declaration, which won't happen if that decls are coming from a PCH. Fixes rdar://10028656. llvm-svn: 139359
2011-09-02Extend the ASTContext constructor to delay the initialization ofDouglas Gregor1-11/+11
builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
2011-08-22Make sure we don't inline functions marked with __attribute__((naked)). ↵Eli Friedman1-4/+9
<rdar://problem/9973228> llvm-svn: 138310
2011-08-17Mark objc methods that are implicitly declared for properties (not ↵Argyrios Kyrtzidis1-3/+9
user-declared) as implicit. This results in libclang ignoring such methods. llvm-svn: 137852
2011-08-16Finalize debug info after all deferred globals are emitted.Devang Patel1-2/+3
llvm-svn: 137750