Commit Graph

85 Commits

Author SHA1 Message Date
Peter Collingbourne e1d209911f CodeGen: rename CodeGenModule::Runtime to ObjCRuntime
llvm-svn: 136254
2011-07-27 20:29:46 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Jay Foad ed8db7d9df Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.

llvm-svn: 135673
2011-07-21 14:31:17 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
Chris Lattner e64d7ba153 Update to match mainline ConstantStruct::get API change. Also, use
ConvertType on InitListExprs as they are being converted.  This is
needed for a forthcoming patch, and improves the IR generated anyway
(see additional type names in testcases). 

This patch also converts a bunch of std::vector's in CGObjCMac to use
C arrays.  There are a ton more that should be converted as well.

llvm-svn: 133413
2011-06-20 04:01:35 +00:00
John McCall 0009fcc39e Make yet another placeholder type, this one marking that an expression is a bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function.  Diagnose this in the general case.  Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.

llvm-svn: 130239
2011-04-26 20:42:42 +00:00
Ken Dyck 499e93d7ee Eliminate a divide-by-8 in BuildVMIClassTypeInfo() by using CharUnits for
the base offset. No change in functionality intended.

llvm-svn: 129179
2011-04-09 01:09:56 +00:00
Ken Dyck bb4e977218 [Reapply r128776, modified so that it does not break debug info.]
Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.

llvm-svn: 129072
2011-04-07 12:37:09 +00:00
John McCall 319963434c Basic, untested implementation for an "unknown any" type requested by LLDB.
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-04-07 08:22:57 +00:00
Devang Patel 84852bbb42 Revert r128770, r128771, r128773 and r128776 for now. It breaks debug info.
llvm-svn: 128842
2011-04-04 20:36:06 +00:00
Ken Dyck 1473c9a7c4 Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.

llvm-svn: 128776
2011-04-02 17:52:22 +00:00
David Chisnall e1d2584d44 Fix Objective-C++ exceptions (GNU runtime).
llvm-svn: 127980
2011-03-20 21:35:39 +00:00
Richard Smith 30482bc786 Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.

llvm-svn: 126069
2011-02-20 03:19:35 +00:00
Rafael Espindola 3968cd0f7b For consistency, use llvm::raw_ostream in the rest of the mangle api.
llvm-svn: 125360
2011-02-11 02:52:17 +00:00
Anders Carlsson a03f3a85cb When building with optimizations, emit vtables where the key is not in the
current translation unit as available_externally. 

This helps devirtualize the second example in PR3100, comment 18:

struct S { S() {}; virtual void xyzzy(); };
inline void foo(S *s) { s->xyzzy(); }
void bar() { S s; foo(&s); }

This involved four major changes:

1. In DefineUsedVTables, always mark virtual member functions as referenced for
   non-template classes and class template specializations.
2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are
   enabled, even if the key function is not implemented in this translation 
   unit. We don't ever do this for code compiled with -fapple-kext, because we
   don't ever want to devirtualize virtual member function calls in that case.
3. Give the correct linkage for vtables where the key function is not defined.
4. Update the linkage for RTTI structures when necessary.

llvm-svn: 124565
2011-01-30 20:45:54 +00:00
Anders Carlsson 5b48bf70a8 Remove dead code.
llvm-svn: 124554
2011-01-29 22:15:18 +00:00
Anders Carlsson 49f17537ee When emitting RTTI for a non-class type, compute the visibility of the RTTI data based on the explicit visibility of the type.
llvm-svn: 124553
2011-01-29 22:10:32 +00:00
Anders Carlsson 678632fa42 Add RTTIBuilder::GetAddrOfTypeName which uses the newly added CreateOrReplaceCXXRuntimeVariable.
Set the visibility for typeinfo names.

llvm-svn: 124548
2011-01-29 20:36:11 +00:00
Anders Carlsson 265aa7c070 Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum instead of an "IsForRTTI" flag.
llvm-svn: 124546
2011-01-29 20:24:48 +00:00
Anders Carlsson 883fc72c3c Make emitting a VTT a two-step process, much like emitting a VTable. You first get the address of the VTT, and then pass it to EmitVTTDefinition.
llvm-svn: 124539
2011-01-29 19:16:51 +00:00
Anders Carlsson fd4834061c Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.
llvm-svn: 124529
2011-01-29 05:26:32 +00:00
Anders Carlsson 75286a7470 When building a type info struct for EH, we always want it to have linkonce_odr linkage.
llvm-svn: 124096
2011-01-24 02:12:11 +00:00
Anders Carlsson 68d3424b8c Change CodeGenModule::getVTableLinkage to be a non-static member function.
llvm-svn: 124095
2011-01-24 02:04:33 +00:00
Anders Carlsson 571e2ad042 Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.
This fixes PR6996.

llvm-svn: 124089
2011-01-24 00:46:19 +00:00
Rafael Espindola 25f4620c67 Set unnamed_addr in every type info.
llvm-svn: 123293
2011-01-11 23:55:05 +00:00
Rafael Espindola b1e879c80f Set unnamed_addr for type infos that we are confortable marking as hidden. I
think it is safe to mark all type infos with unnamed_addr, but I am not sure.

llvm-svn: 123275
2011-01-11 21:44:37 +00:00
Chris Lattner ad3467ee89 The -fshort-wchar option causes wchar_t to become unsigned, in addition to being
16-bits in size.  Implement this by splitting WChar into two enums, like we have
for char.  This fixes a miscompmilation of XULRunner, PR8856.

llvm-svn: 122558
2010-12-25 23:25:43 +00:00
John McCall 09982c0a49 Give hidden visibility to RTTI for derived types. This is kindof a hacky
way to do this, but it fixes rdar://problem/8778973

llvm-svn: 122033
2010-12-17 02:58:03 +00:00
Anders Carlsson ba37e1eb49 std::nullptr_t is a fundamental type for RTTI purposes.
llvm-svn: 118238
2010-11-04 05:28:09 +00:00
Anders Carlsson fd88a6160d Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.
llvm-svn: 117881
2010-10-31 23:22:37 +00:00
John McCall c273f24196 Better solution: calculate the visibility of functions and variables
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-30 11:50:40 +00:00
John McCall 457a04e3ce Substantially revise how clang computes the visibility of a declaration to
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-22 21:05:15 +00:00
Benjamin Kramer fb5e584151 More class anonymization.
llvm-svn: 117106
2010-10-22 16:48:22 +00:00
Argyrios Kyrtzidis 0c34b138df Make sure the VTables for template instantiations are emitted even if the key function doesn't have a body.
llvm-svn: 116186
2010-10-11 03:25:57 +00:00
Argyrios Kyrtzidis f0e31c8b9c Don't let typeinfo name symbols be 'internal hidden', it can lead to linker conflicts
with similarly named classes in anonymous namespaces.

llvm-svn: 116185
2010-10-11 03:25:53 +00:00
John McCall 2917bd0fb4 Petty optimization.
llvm-svn: 113049
2010-09-04 01:26:37 +00:00
John McCall 5d865c3292 Teach IR generation to return 'this' from constructors and destructors
under the ARM ABI.

llvm-svn: 112588
2010-08-31 07:33:07 +00:00
Eli Friedman 04831926ec Detabify.
llvm-svn: 111768
2010-08-22 01:00:03 +00:00
Eli Friedman 1bb53d9cd6 Explicitly handle every case in the switch in RTTIBuilder::BuildTypeInfo.
llvm-svn: 111085
2010-08-15 00:24:31 +00:00
John McCall b3732bb3b7 Just disable the hidden-visibility optimization for now by hiding it behind
a -cc1 option.  The Darwin linker complains about mixed visibility when linking
gcc-built objects with clang-built objects, and the optimization isn't really
that valuable.  Platforms with less ornery linkers can feel free to enable this.

llvm-svn: 110979
2010-08-12 23:36:15 +00:00
John McCall 398dc37d1f Implement RTTI generation for Objective C types. Fixes PR7864.
llvm-svn: 110900
2010-08-12 02:17:33 +00:00
Eli Friedman 961fc05418 Work in progress for PR7864. Someone more familiar with ObjC++ needs to fill
in the code after the "FIXME: Needs to be written".

llvm-svn: 110849
2010-08-11 20:41:51 +00:00
John McCall e16adc2b1e Emit standard-library RTTI with external linkage, not weak_odr.
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-08-04 08:34:44 +00:00
Argyrios Kyrtzidis 54fcbc7345 getBody() -> hasBody()
llvm-svn: 107773
2010-07-07 12:24:18 +00:00
Anders Carlsson a85c1469c7 When building RTTI descriptors for pointer types, we need to get the unqualified array type and the qualifiers from it.
llvm-svn: 105326
2010-06-02 15:44:35 +00:00
John McCall 48bf349471 Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI
when used by the exceptions routines.  Fixes PR 6974.

llvm-svn: 102684
2010-04-30 01:15:21 +00:00
Anders Carlsson 11e5140db9 Vtable -> VTable renames across the board.
llvm-svn: 101666
2010-04-17 20:15:18 +00:00
Douglas Gregor eadd3cace9 Eliminate excessive PCH deserialization caused by the search for
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.

With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.

Fixes <rdar://problem/7840011>.

llvm-svn: 100772
2010-04-08 15:52:03 +00:00
Douglas Gregor d7f18dd750 Drastically simplify the computation of linkage for typeinfo by using
the existing (and already well-tested) linkage computation for types,
with minor tweaks for dynamic classes and (pointers to) incomplete
types. Fixes PR6597.

llvm-svn: 99968
2010-03-31 00:15:35 +00:00
Rafael Espindola adcc1d18e2 When given the magic class __cxxabiv1::__fundamental_type_info, produce
the typeinfo for the fundamental types.

Fixes PR6685.

llvm-svn: 99701
2010-03-27 02:52:14 +00:00