aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
AgeCommit message (Collapse)AuthorFilesLines
2011-05-05Preserve the full name of the file, so that '-c -o foo.pic.o' producesNick Lewycky1-2/+2
foo.pic.gcno instead of foo.gcno. llvm-svn: 130899
2011-05-04Record where the GCOV data files should be placed.Nick Lewycky1-0/+4
llvm-svn: 130866
2011-04-12After some discussion with Doug, we decided that it made a lot more senseJohn McCall1-1/+0
for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. llvm-svn: 129331
2011-04-07Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall1-0/+2
The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
2011-03-31After much contemplation, I've decided that we probably shouldn't "unique"John McCall1-11/+29
__block object copy/dispose helpers for C++ objects with those for different variables with completely different semantics simply because they happen to both be no more aligned than a pointer. Found by inspection. Also, internalize most of the helper generation logic within CGBlocks.cpp, and refactor it to fit my peculiar aesthetic sense. llvm-svn: 128618
2011-03-27We were emitting construction v-tables with internal linkage all the time.John McCall1-0/+1
Emit them instead with the linkage of the VTT. I'm actually really ambivalent about this; it's what GCC does, but outside of improving code size (if the linkage is coalescing), I'm not sure it's at all relevant. Construction vtables are naturally referenced only by the VTT, which is itself only referenced by complete-object constructors and destructors; giving the construction vtables possibly-external linkage is important if you have an optimization that drills through the VTT to a reference to a particular construction vtable which it cannot just emit itself. llvm-svn: 128374
2011-03-23Update type cache when a type is completed.Devang Patel1-4/+2
Radar 9168773 llvm-svn: 128150
2011-03-18The Darwin kernel does not provide useful guard variable support.John McCall1-0/+3
Issue this as an IR-gen error; it's not really worthwhile doing this "right", i.e. in Sema, because IR gen knows a lot of tricks beyond what the constant evaluator knows. llvm-svn: 127854
2011-03-09Fix three of the four places where I left breadcrumbs to avoid unnecessaryJohn McCall1-4/+6
recomputation. llvm-svn: 127322
2011-03-09Use the "undergoes default argument promotion" bit on parameters toJohn McCall1-1/+2
simplify the logic of initializing function parameters so that we don't need both a variable declaration and a type in FunctionArgList. This also means that we need to propagate the CGFunctionInfo down in a lot of places rather than recalculating it from the FAL. There's more we can do to eliminate redundancy here, and I've left FIXMEs behind to do it. llvm-svn: 127314
2011-03-07DebugInfo can be enabled or disabled at function level (e.g. using an ↵Devang Patel1-8/+1
attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not. llvm-svn: 127165
2011-03-07Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user ↵Devang Patel1-1/+9
experience. 21 int main() { 22 A a; For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr. This fixes ostream-defined.exp regression from gdb testsuite. llvm-svn: 127164
2011-03-05StringRefify.Benjamin Kramer1-1/+1
llvm-svn: 127082
2011-02-26Pretty up the emission of field l-values and use volatile and TBAA whenJohn McCall1-0/+2
loading references as part of that. Use 'char' TBAA when accessing (immediate!) fields of a may_alias struct; fixes PR9307. llvm-svn: 126540
2011-02-22Emit the structure layout of the block literal parameter to a blockJohn McCall1-2/+2
invocation function into the debug info. Rather than faking up a class, which is tricky because of the custom layout we do, we just emit a struct directly from the layout information we've already got. Also, don't emit an unnecessarily parameter alloca for this "variable". llvm-svn: 126255
2011-02-22Reorganize the emission of local variables.John McCall1-1/+4
llvm-svn: 126189
2011-02-15Assorted cleanup:John McCall1-3/+30
- Have CGM precompute a number of commonly-used types - Have CGF copy that during initialization instead of recomputing them - Use TBAA info when initializing a parameter variable - Refactor the scalar ++/-- code llvm-svn: 125562
2011-02-08Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall1-2/+38
Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
2011-02-06Simplify thunks code.Anders Carlsson1-2/+1
llvm-svn: 124983
2011-02-05Pass a 'ForVTable' flag to GetAddrOfThunk and pass it along to ↵Anders Carlsson1-1/+2
GetOrCreateLLVMFunction so that we won't assert when building a thunk for an implicit virtual member function that is not marked used. llvm-svn: 124967
2011-02-05Re-land r124768, with a fix for PR9130.Anders Carlsson1-2/+4
We now emit everything except unused implicit virtual member functions when building the vtable. llvm-svn: 124935
2011-02-03More capturing of 'this': implicit member expressions. Getting thatJohn McCall1-0/+2
right for anonymous struct/union members led to me discovering some seemingly broken code in that area of Sema, which I fixed, partly by changing the representation of member pointer constants so that IndirectFieldDecls aren't expanded. This led to assorted cleanups with member pointers in CodeGen, and while I was doing that I saw some random other things to clean up. llvm-svn: 124785
2011-02-03Revert 124768.Rafael Espindola1-4/+2
This reopens PR99114, but that one at least can be avoided with an #include. PR9130 cannot. llvm-svn: 124780
2011-02-03Don't try to mark virtual members referenced for classes where the key functionAnders Carlsson1-2/+4
is not defined in the current translation unit. Doing so lead to compile errors such as PR9114. Instead, when CodeGen is building the vtable, don't try to emit a definition for functions that aren't marked used in the current translation unit. Fixes PR9114. llvm-svn: 124768
2011-01-29Move GetLLVMVisibility to CodeGenModule.Anders Carlsson1-0/+10
llvm-svn: 124550
2011-01-29Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum ↵Anders Carlsson1-1/+10
instead of an "IsForRTTI" flag. llvm-svn: 124546
2011-01-29Get rid of an unneeded parameter from setGlobalVisibility.Anders Carlsson1-2/+1
llvm-svn: 124541
2011-01-29Add a new function, to be used by CGRTTI, CGVTables and CGVTT (which each ↵Anders Carlsson1-0/+8
has their own copy of this code). llvm-svn: 124537
2011-01-29Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.Anders Carlsson1-1/+1
llvm-svn: 124529
2011-01-24Change CodeGenModule::getVTableLinkage to be a non-static member function.Anders Carlsson1-2/+1
llvm-svn: 124095
2011-01-18Add unnamed_addr in CreateRuntimeVariable.Rafael Espindola1-1/+2
llvm-svn: 123773
2011-01-13Move name mangling support from CodeGen to AST. In thePeter Collingbourne1-4/+5
process, perform a number of refactorings: - Move MiscNameMangler member functions to MangleContext - Remove GlobalDecl dependency from MangleContext - Make MangleContext abstract and move Itanium/Microsoft functionality to their own classes/files - Implement ASTContext::createMangleContext and have CodeGen use it No (intended) functionality change. llvm-svn: 123386
2010-12-30Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer1-11/+0
llvm-svn: 122634
2010-11-06Simplify the logic for emitting guard variables for template staticJohn McCall1-1/+2
data members by delaying the emission of the initializer until after linkage and visibility have been set on the global. Also, don't emit a guard unless the variable actually ends up with vague linkage, and don't use thread-safe statics in any case. llvm-svn: 118336
2010-10-30Better solution: calculate the visibility of functions and variablesJohn McCall1-2/+3
independently of whether they're definitions, then teach IR generation to ignore non-explicit visibility when emitting declarations. Use this to make sure that RTTI, vtables, and VTTs get the right visibility. More of rdar://problem/8613093 llvm-svn: 117781
2010-10-27Do the guarding of instantiated static data membersFariborz Jahanian1-2/+8
on if its linkage is weak. Currently this is the case but may change in the future. (part of radar 8562966). llvm-svn: 117452
2010-10-22Substantially revise how clang computes the visibility of a declaration toJohn McCall1-4/+1
more closely parallel the computation of linkage. This gets us to a state much closer to what gcc emits, modulo bugs, which will undoubtedly arise in abundance. llvm-svn: 117147
2010-10-19This patch implements Next's IRGen for -fconstant-string-class=class-name.Fariborz Jahanian1-5/+6
PR6056, //rdar: //8564463 llvm-svn: 116819
2010-10-14Experimental TBAA support.Dan Gohman1-0/+7
This enables metadata generation by default, however the TBAA pass in the optimizer is still disabled for now. llvm-svn: 116536
2010-09-16Opportunistically use the C++ personality function in ObjC++John McCall1-0/+4
translation units that don't catch ObjC types. rdar://problem/8434851 llvm-svn: 114070
2010-08-31Teach IR generation to return 'this' from constructors and destructorsJohn McCall1-4/+1
under the ARM ABI. llvm-svn: 112588
2010-08-23Abstract out everything having to do with member pointers into the ABIJohn McCall1-2/+0
class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. llvm-svn: 111789
2010-08-22Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall1-14/+4
Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. llvm-svn: 111786
2010-08-22Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall1-4/+0
duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. llvm-svn: 111772
2010-08-16Implement support for member pointers under the Microsoft C++ ABI in theCharles Davis1-2/+2
AST library. This also adds infrastructure for supporting multiple C++ ABIs in the AST. llvm-svn: 111117
2010-08-07Store inheritance paths after CastExprs instead of inside them.John McCall1-1/+2
This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
2010-08-04Emit standard-library RTTI with external linkage, not weak_odr.John McCall1-0/+5
Apply hidden visibility to most RTTI; libstdc++ does not rely on exact pointer equality for the type info (just the type info names). Apply the same optimization to RTTI that we do to vtables. Fixes PR5962. llvm-svn: 110192
2010-07-29Merge PCHWriterDecl.cpp's isRequiredDecl and ↵Argyrios Kyrtzidis1-9/+0
CodeGenModule::MayDeferGeneration into a new function, DeclIsRequiredFunctionOrFileScopedVar. This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes. Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext, thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen. This fixes current (and avoids future) codegen-from-PCH bugs. llvm-svn: 109784
2010-07-29cave in to reality and make ABIInfo depend on CodeGenTypes.Chris Lattner1-1/+1
This will simplify a bunch of code, coming up next. llvm-svn: 109722
2010-07-16IRgen: Support user defined attributes on block runtime functions.Daniel Dunbar1-0/+5
- This issue here is that /usr/include/Blocks.h wants to define some of the block runtime globals as weak, depending on the target. This doesn't work in Clang because we aren't using the AST decl for these globals. - The fix is a pretty gross hack which just watches all the decls for the specific blocks globals we need to know about; if we see one we use it, otherwise we use the hand coded type. In time, I would like to clean this up by changing IRgen to ask Sema/AST for the decl, which would then be lazily loaded from the builtin table if necessary. This could be used in a whole host of places in IRgen and would get rid of a lot of grotty hand coding of LLVM IR; however, we need some extra Sema support for this as well as support for builtin global variables. llvm-svn: 108482