Commit Graph

2319 Commits

Author SHA1 Message Date
Daniel Dunbar 07d0785dbb PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
are updated.

llvm-svn: 84447
2009-10-18 21:17:35 +00:00
Daniel Dunbar 349e6fbfce Twinify CGObjCMac, this simplifies the code and should reduce std::string
trashing.

llvm-svn: 84439
2009-10-18 20:48:59 +00:00
Anders Carlsson 9500ad13b0 Use CK_BitCast for member function pointer casts. Fixes PR5138.
llvm-svn: 84438
2009-10-18 20:31:03 +00:00
Daniel Dunbar 70e7eadd15 Move misc clients to IdentifierInfo StringRef API.
- strcmp -> ==
 - OS.write(II->getName() ...) -> OS << II->getNameStr()
 - Avoid std::string concatenation
 - Use getNameStr().str() when an std::string is really needed.

llvm-svn: 84437
2009-10-18 20:26:27 +00:00
Daniel Dunbar 2c422dc9ca Move clients to use IdentifierInfo::getNameStart() instead of getName()
llvm-svn: 84436
2009-10-18 20:26:12 +00:00
Nate Begeman 19351639fb Support IRgen of OpenCL vector initializers, ensuring the resulting IR is in a
form that LLVM code generators can turn into efficient code.  For example,
int4 a, b, c;
a = (int4)(b.yzw, a.x)

llvm-svn: 84434
2009-10-18 20:10:40 +00:00
Anders Carlsson 094c459525 Add some more cast kinds.
llvm-svn: 84423
2009-10-18 18:12:03 +00:00
Nuno Lopes ff3507b951 add support for codegening CXXZeroInitValueExprs
llvm-svn: 84418
2009-10-18 15:18:11 +00:00
Daniel Dunbar 1d4172c52b Suppress -Asserts warning.
llvm-svn: 84329
2009-10-17 09:39:30 +00:00
Chris Lattner 671fec8727 Fix PR5211: codegen shouldn't assume that the result of ||/&& is int
anymore.  In C++ it is bool.

llvm-svn: 84308
2009-10-17 04:24:20 +00:00
Fariborz Jahanian da21efb566 Implement derived-to-base AST/code gen. There is a
FIXME in CGCXX.cpp that I would like Anders to
take a look at.

llvm-svn: 84265
2009-10-16 19:20:59 +00:00
Nuno Lopes 8550cb250c ignore 'using' directive in CodeGenFunction::EmitDecl(). this fixes PR5085
llvm-svn: 84255
2009-10-16 14:40:52 +00:00
Anders Carlsson f847117ac8 Builtin types are subsitutable if they are qualified. Fixes PR5196.
llvm-svn: 84237
2009-10-16 02:06:06 +00:00
John McCall c5b8225285 Remove the ConstantArrayType subtypes. This information is preserved in the
TypeLoc records for declarations;  it should not be necessary to represent it
directly in the type system.

Please complain if you were using these classes and feel you can't replicate
previous functionality using the TypeLoc API.

llvm-svn: 84222
2009-10-16 00:14:28 +00:00
Mike Stump 8bccbfdafe Refine non-virtual part of the this adjustment for thunks. Refine
non-virtual part of the return result adjustments for covariant
thunks.  WIP.

llvm-svn: 84178
2009-10-15 09:30:16 +00:00
Mike Stump 37dbe96a06 Track the offset to the current virtual base in CurrentVBaseOffset.
Track path information completely to ensure we get all the overrides.  WIP.

llvm-svn: 84166
2009-10-15 02:04:03 +00:00
Anders Carlsson 66413c29d3 Handle
struct A { };
struct B : A { };

void f() {
  const A& a = B();
}

correctly. (This now does the offset conversion if necessary and calls the destructor when a goes out of scope).

llvm-svn: 84162
2009-10-15 00:51:46 +00:00
Douglas Gregor 819c3ddda8 Fix a thinko that John pointed out
llvm-svn: 84142
2009-10-14 21:36:34 +00:00
Douglas Gregor 3cc3cdeea9 Give explicit and implicit instantiations of static data members of
class templates the proper linkage. 

Daniel, please look over the CodeGenModule bits.

llvm-svn: 84140
2009-10-14 21:29:40 +00:00
Mike Stump b21c4eede4 Shift the vcall slots for non-virtual bases of a virtual base, up into
the virtual base so they can be reused properly.  Don't reuse vcall
slots across a virtual boundary.  WIP.  I have a testcase, but there
are still things that need to be fixed before the testcase can go in.

llvm-svn: 84120
2009-10-14 18:14:51 +00:00
Devang Patel f33cfaf760 Copy metadata associated with CI
llvm-svn: 84114
2009-10-14 17:03:29 +00:00
Duncan Sands cef56992b0 There is now only one version of eh.selector and eh.typeid.for.
Fix the clang build.

llvm-svn: 84107
2009-10-14 16:13:30 +00:00
Sanjiv Gupta 84a0287497 Few targets like PIC16 mangle the names of global variables, so retrieve the name
from Var itself rather than the decl for DebugInfo metadata.

llvm-svn: 84102
2009-10-14 15:08:34 +00:00
Chris Lattner 4f8a2e22c0 fix some cfstring related issues:
1) -fwritable-string does affect the non-utf16 version of cfstrings
   just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
   is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.

This fixes rdar://7115750

llvm-svn: 84077
2009-10-14 05:55:45 +00:00
Chris Lattner 734351d214 unbreak test/CodeGen/builtins.c, reverting Devang's change.
llvm-svn: 84075
2009-10-14 05:49:21 +00:00
Devang Patel 3b3f0f6b65 Check void type before using replaceAllUsesWith().
llvm-svn: 84050
2009-10-13 22:59:11 +00:00
Mike Stump 284312176a Refine handling for non-virtual bases in return value adjustments for
covariant thunks.  WIP.

llvm-svn: 84046
2009-10-13 22:54:56 +00:00
Chris Lattner a2f9bd5339 fix test/CodeGen/statements.c on 32-bit hosts.
llvm-svn: 84039
2009-10-13 22:12:09 +00:00
Mike Stump 7373095ebf Ensure we sign extend.
llvm-svn: 84031
2009-10-13 21:31:09 +00:00
Anders Carlsson 6bfee8f3e3 Don't assume that the LHS and RHS of a member pointer expression is a DeclRefExpr. Fixes PR5177.
llvm-svn: 83986
2009-10-13 17:41:28 +00:00
Mike Stump ad47e7ea81 Remove FIXME. We construct VBIndex very early, before any calls to OverrideMethod.
llvm-svn: 83981
2009-10-13 17:23:44 +00:00
Devang Patel 9f73552852 Remove extra white space line.
llvm-svn: 83979
2009-10-13 17:02:38 +00:00
Devang Patel 7468489deb Do not check use_empty() before invoking replaceAllUsesWith().
Let replaceAllUsesWith() adjust VHs even though there are no uses.

llvm-svn: 83978
2009-10-13 17:02:04 +00:00
Mike Stump 87876a0053 Refine handling for return value conversions with respect to virtual
offsets for covariant thunks.

llvm-svn: 83965
2009-10-13 10:55:21 +00:00
Benjamin Kramer abd5b90e4c Simplify pointer creation with the new Type::getInt*Ptr methods.
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Chris Lattner 3eb172a02b Teach sema and codegen about the difference between address of labels,
which is a common idiom to improve PIC'ness of code using the addr of
label extension.  This implementation is a gross hack, but the only other
alternative would be to teach evalutate about this horrid combination.
While GCC allows things like "&&foo - &&bar + 1", people don't use this
in practice.  This implements PR5131.

llvm-svn: 83957
2009-10-13 07:14:16 +00:00
Chris Lattner 2bb5cb490c reimplement codegen for indirect goto with the following advantages:
1. CGF now has fewer bytes of state (one pointer instead of a vector).
2. The generated code is determinstic, instead of getting labels in
   'map order' based on pointer addresses.
3. Clang now emits one 'indirect goto switch' for each function, instead
   of one for each indirect goto.  This fixes an M*N = N^2 IR size issue
   when there are lots of address-taken labels and lots of indirect gotos.
4. This also makes the default cause do something useful, reducing the
   size of the jump table needed (by one).

llvm-svn: 83952
2009-10-13 06:55:33 +00:00
Chris Lattner 92ae16b0ae number address-taken labels from 1. This allows 0 to be used as a sentinel
for a null pointer.  In other words, "&&foo != NULL" will always work out to
true.

llvm-svn: 83948
2009-10-13 06:04:29 +00:00
Chris Lattner dd7eaad7d4 Use the new Type::getInt8PtrTy method. This should probably be used in a lot
more places in clang codegen now.

llvm-svn: 83947
2009-10-13 06:02:42 +00:00
Devang Patel 5b294f4330 Enable "debug info attached to an instruction" mode.
llvm-svn: 83928
2009-10-12 23:31:25 +00:00
Devang Patel dac79decf3 There is no need to attach debug location info with alloca instruction.
llvm-svn: 83913
2009-10-12 22:29:02 +00:00
Devang Patel 551e112e99 Encode long double.
llvm-svn: 83912
2009-10-12 22:28:31 +00:00
Anders Carlsson 1d116976b4 Store the key function of a record decl inside CGRecordLayout.
llvm-svn: 83900
2009-10-12 21:16:22 +00:00
Anders Carlsson a1b54fdbe1 Even more devirtualization cleverness.
llvm-svn: 83886
2009-10-12 19:59:15 +00:00
Anders Carlsson 2a01709204 More devirtualization improvements.
llvm-svn: 83883
2009-10-12 19:51:33 +00:00
Anders Carlsson b61301f353 Devirtualize calls on temporaries. A().f() for example.
llvm-svn: 83882
2009-10-12 19:45:47 +00:00
Anders Carlsson d7432dfb0a Factor out devirtualization checking into a separate function and make it handle references correctly.
llvm-svn: 83880
2009-10-12 19:41:04 +00:00
Anders Carlsson b5296558f1 If the base type of a member call is a record type we don't need to emit a virtual call.
llvm-svn: 83816
2009-10-11 23:55:52 +00:00
Benjamin Kramer bb0a07bf92 Remove dead variable.
llvm-svn: 83808
2009-10-11 22:57:54 +00:00
Benjamin Kramer 2e8301dd62 Add CGVtable.cpp to CMakeLists.
llvm-svn: 83800
2009-10-11 22:22:38 +00:00
Anders Carlsson 2bb27f53e0 Move the vtable builder to CGVtable.cpp, general cleanup.
llvm-svn: 83798
2009-10-11 22:13:54 +00:00
Anders Carlsson 2295f31810 Change mangleCXXVtable and mangleCXXRtti to take CXXRecordDecls instead of QualTypes.
llvm-svn: 83793
2009-10-11 21:24:51 +00:00
Anders Carlsson 6ce51fdf43 Move our (non-existing) RTTI emission code into CGRtti.cpp. No functionality change.
llvm-svn: 83732
2009-10-10 20:49:04 +00:00
Fariborz Jahanian 07ca72725a Generate weak read barriers when reading a weak __block
variable inside the block.

llvm-svn: 83729
2009-10-10 20:07:56 +00:00
Devang Patel 3028a43f57 Revert 83567.
llvm-svn: 83676
2009-10-09 22:06:15 +00:00
Mike Stump fc8ff639cb Allow customization for the producer information in the debug output.
llvm-svn: 83659
2009-10-09 18:38:12 +00:00
Mike Stump 0d479e6653 Avoid warning.
llvm-svn: 83609
2009-10-09 01:25:47 +00:00
Douglas Gregor 01249503fe Installation of Clang libraries and headers, from Axel Naumann!
llvm-svn: 83582
2009-10-08 22:15:31 +00:00
Devang Patel abf71fa9fc Record location info before emiting alloca for arguments. This allows arguments to have proper location info.
llvm-svn: 83567
2009-10-08 18:53:37 +00:00
Anders Carlsson a18ed9b113 If a global initializer has a non-trivial constructor or destructor, we never want to defer generation of it, even if it is declared static.
With this change we're finally able to compile and run the (infamous)

#include <string>
#include <iostream>

int main(int argc, char **argv) {
  std::cout << "Hello, World" << std::endl;
}

$ clang hello.cpp -lstdc++ -o hello
$ ./hello 
Hello, World

llvm-svn: 83559
2009-10-08 17:28:59 +00:00
Anders Carlsson 3482b819db Mangle std::basic_ostream<char, std::char_traits<char>> as So.
llvm-svn: 83557
2009-10-08 17:20:26 +00:00
Anders Carlsson 1e39bd944b Mangle anonymous structs/unions correctly. Fixes PR5139.
llvm-svn: 83448
2009-10-07 01:45:02 +00:00
Anders Carlsson ff971e8bf4 Add a MangleContext and pass it to all mangle functions. It will be used for keeping state, such as identifiers assigned to anonymous structs as well as scope encoding.
llvm-svn: 83442
2009-10-07 01:06:45 +00:00
Anders Carlsson b703fd2216 Uncomment some commented out code.
llvm-svn: 83428
2009-10-06 23:02:00 +00:00
Anders Carlsson c6d171ec77 Change GetAddressCXXOfBaseClass to use CXXBasePaths for calculating base class offsets. Fix the code to handle virtual bases as well.
llvm-svn: 83426
2009-10-06 22:43:30 +00:00
Anders Carlsson 11d00cf972 When mangling names, always use the canonical decl. Fixes PR5144.
llvm-svn: 83420
2009-10-06 21:58:01 +00:00
Devang Patel 542ab5f551 InsertSubprogramStart if ATTACH_DEBUG_INFO_TO_AN_INSN is not defined.
llvm-svn: 83419
2009-10-06 21:53:41 +00:00
Devang Patel 5d90d62701 Add support to attach debug info to an instruction.
This is not yet enabled.

llvm-svn: 83399
2009-10-06 18:36:08 +00:00
Anders Carlsson 6b7378bbe1 Emit the destructor epilogue in a cleanup block so a return from a destructor body still calls the epilogue.
llvm-svn: 83397
2009-10-06 18:09:57 +00:00
Anders Carlsson 80ef6f1a46 Pass the right type to GetAddrOfFunction when getting functions for the VTable. Fixes PR5021.
llvm-svn: 83395
2009-10-06 17:54:23 +00:00
Devang Patel faf7e9ad24 Set appropriate context for a global variable while emitting debug info.
llvm-svn: 83352
2009-10-06 00:35:31 +00:00
Mike Stump 916c006735 Fix thinko and simplify.
llvm-svn: 83342
2009-10-05 23:08:21 +00:00
Mike Stump 3472ae5bac Ensure we have atleast 2-byte alignment for member functions.
llvm-svn: 83337
2009-10-05 22:49:20 +00:00
Mike Stump c5e153c50e Respect alignments better.
llvm-svn: 83328
2009-10-05 21:58:44 +00:00
Benjamin Kramer dde0fee82e Use new predicates for some type equality tests.
llvm-svn: 83303
2009-10-05 13:47:21 +00:00
Anders Carlsson d5931cd2b7 Pass the canonical method decl to GetVtableIndex. Fixes PR5120.
llvm-svn: 83272
2009-10-03 19:56:56 +00:00
Anders Carlsson 2ee3c011d9 Implement code generation of member function pointer calls. Fixes PR5121.
llvm-svn: 83271
2009-10-03 19:43:08 +00:00
Anders Carlsson c46bf276e1 Teach AggExprEmitter about pointers to member functions.
llvm-svn: 83266
2009-10-03 15:43:24 +00:00
Anders Carlsson 3162e4945a Handle base-to-derived casts of member function pointers in CGExprConstant.cpp
llvm-svn: 83265
2009-10-03 15:13:22 +00:00
Anders Carlsson 128a5d5147 Handle members to function pointers in CGExprConstant.
llvm-svn: 83264
2009-10-03 15:02:02 +00:00
Anders Carlsson 32bfb1ce8f Move some functions from CodeGenFunctions to CodeGenModule so they can be used by CGExprConstant.
llvm-svn: 83263
2009-10-03 14:56:57 +00:00
Anders Carlsson 8a744ad8a6 Don't update the struct alignment when adding fields to a packed struct. Fixes PR5118.
llvm-svn: 83235
2009-10-02 04:52:12 +00:00
Mike Stump 581b9ad124 More magic pixie dust.
llvm-svn: 83232
2009-10-02 02:30:50 +00:00
Mike Stump 440af3d903 Fix up debug information for block pointers a bit more.
llvm-svn: 83231
2009-10-02 02:23:37 +00:00
Anders Carlsson 39e3eb12ae When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.
llvm-svn: 83230
2009-10-02 02:15:20 +00:00
Mike Stump 017460ab6c Implement a FIXME. This improves codegen just a tad.
llvm-svn: 83221
2009-10-01 22:29:41 +00:00
Douglas Gregor 369acf9304 CodeGen may see out-of-line declarations of the various special member
functions when they are explicitly declared, e.g., via a function
template specialization or explicit template instantiation
declaration. Don't try to synthesize bodies for the special member
functions in this case; rather, check whether we have an implicit
declaration and, if so, synthesize the appropriate function
body. Fixes PR5084.

llvm-svn: 83212
2009-10-01 20:44:19 +00:00
Douglas Gregor e364e7bc2b Fix a lame regression in IR gen for C++ delete expressions. PR5102
llvm-svn: 83195
2009-10-01 05:49:51 +00:00
Mike Stump 7d69911a1f A couple of refinements for laying out debug information for
BlockDeclRefDecls.

llvm-svn: 83185
2009-10-01 00:27:30 +00:00
John McCall 4fa5342758 Anonymous namespaces, sema + codegen. A lot of semantics are still broken,
apparently because using directives aren't quite working correctly.

llvm-svn: 83184
2009-10-01 00:25:31 +00:00
Fariborz Jahanian e01e434aef <rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.
llvm-svn: 83150
2009-09-30 17:10:29 +00:00
Mike Stump 2e722b915c Improve debugging information for BlockDeclRefExpr. WIP. Given this
scheme, we can switch the previous scheme over to using this code
path.  There's a bit of simplifications yet to do as well.

llvm-svn: 83138
2009-09-30 02:43:10 +00:00
Douglas Gregor bb3e12fc0b Handle C++ delete expressions when the overloaded delete operator is a
"usual deallocation function" with two arguments. CodeGen will have to
handle this case specifically, since the value for the second argument
(the size of the allocated object) may have to be computed at run
time.

Fixes the Sema part of PR4782.

llvm-svn: 83080
2009-09-29 18:16:17 +00:00
Anders Carlsson 8f4fd60c47 Handle CXXMemberCallExprs that point to a static method. Fixes PR5093.
llvm-svn: 83045
2009-09-29 03:54:11 +00:00
Anders Carlsson 9150a2a8c0 Handle CK_BaseToDerivedMemberPointer for member function pointers. Fixes PR5091.
llvm-svn: 83041
2009-09-29 03:13:20 +00:00
Anders Carlsson b05a3e551b Improve support for member function pointers.
llvm-svn: 83039
2009-09-29 02:09:01 +00:00
Anders Carlsson 1fb7ae9e3c Use a switch statement in VisitCastExpr.
llvm-svn: 83038
2009-09-29 01:23:39 +00:00
Anders Carlsson d30d820dc4 Make hasAggregateLLVMType use positive checks.
llvm-svn: 83037
2009-09-29 01:15:29 +00:00
Mike Stump e7a2b48572 Fix http://llvm.org/PR5090.
llvm-svn: 83035
2009-09-29 00:50:50 +00:00
Anders Carlsson 02bca738b4 Mangle dependent name expressions. Fixes PR5063.
llvm-svn: 82915
2009-09-27 20:11:34 +00:00
Anders Carlsson d122de5f32 Use mangleTemplatePrefix when we know that we're mangling a nested template name.
llvm-svn: 82912
2009-09-27 19:53:49 +00:00
Anders Carlsson 52d78a518a CodeGen for try statements. (We just emit the body for now).
llvm-svn: 82910
2009-09-27 18:58:34 +00:00
Anders Carlsson 9bf787ad1f Look for substitutions when mangling TypenameTypes.
llvm-svn: 82885
2009-09-27 01:06:07 +00:00
Anders Carlsson e00745b285 Better template parameter type mangling.
llvm-svn: 82883
2009-09-27 00:38:53 +00:00
Anders Carlsson 2e5935241a Mangle std::basic_string<char, std::char_traits<char>, std::allocator<char> > as Ss.
llvm-svn: 82882
2009-09-27 00:12:57 +00:00
Anders Carlsson 853bb50382 Mangle ::std::basic_string as Sb.
llvm-svn: 82881
2009-09-26 23:14:39 +00:00
Anders Carlsson 872ce0dc31 Mangle ::std::allocator as Sa.
llvm-svn: 82880
2009-09-26 23:10:05 +00:00
Anders Carlsson 3e83c30c4c Handle substitutions in mangleTemplatePrefix.
llvm-svn: 82879
2009-09-26 22:18:22 +00:00
Anders Carlsson aa9e3c8793 Substitute "::std::" as "St".
llvm-svn: 82874
2009-09-26 20:53:44 +00:00
Anders Carlsson 49232b9f42 Don't crash when trying to mangle function templates.
llvm-svn: 82872
2009-09-26 20:13:56 +00:00
Anders Carlsson 26e67afd1e mangleTemplatePrefix and mangleUnscopedTemplateName should take a TemplateDecl.
llvm-svn: 82871
2009-09-26 19:45:45 +00:00
Anders Carlsson 677475206c Use the qualified name for tag types.
llvm-svn: 82870
2009-09-26 19:03:24 +00:00
Anders Carlsson e33eed5c1e Set alignment on static function level decls and VLAs. Fixes PR5060.
llvm-svn: 82868
2009-09-26 18:16:06 +00:00
Anders Carlsson 0374742326 Use ABIArgInfo::getDirect() for all types that have a pointer representation.
llvm-svn: 82845
2009-09-26 03:56:53 +00:00
Anders Carlsson 296f8dc52f Mangle record types as decls.
llvm-svn: 82843
2009-09-26 03:55:37 +00:00
Anders Carlsson 9f8e3d1929 Change isTemplate to return the actual template declaration.
llvm-svn: 82839
2009-09-26 03:24:57 +00:00
Anders Carlsson bdaaab4671 Improve mangling of typename types.
llvm-svn: 82833
2009-09-26 02:26:02 +00:00
Mike Stump 1dbb8f78a3 Fix 80-col violation.
llvm-svn: 82782
2009-09-25 18:11:00 +00:00
John McCall 0cf155174e Fix an infinite loop arising when trying to generate debug information
for a ObjC class with an ivar of weak self type.

llvm-svn: 82745
2009-09-25 01:40:47 +00:00
Fariborz Jahanian 1f9ed58277 Fixed another code gen bug in objc's new write-barrier API.
llvm-svn: 82735
2009-09-25 00:00:20 +00:00
Mike Stump d2a3e61798 Fix 80-col violation.
llvm-svn: 82725
2009-09-24 22:31:14 +00:00
Fariborz Jahanian 7a95d72b10 Patch fixes a code gen. bug in generation of objc_assign_ivar
(objc GC's API).

llvm-svn: 82724
2009-09-24 22:25:38 +00:00
John McCall 8ccfcb51ee Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.

llvm-svn: 82705
2009-09-24 19:53:00 +00:00
Daniel Dunbar b3b1e53d33 Darwin/x86-32: Enumerated types and block pointer types in structures were not
handled correctly.
 - <rdar://problem/7247671> Function arguments incorrect when function returns a
   struct on i386 w/ llvm-g++ and clang

llvm-svn: 82681
2009-09-24 05:12:36 +00:00
Anders Carlsson 649a17e861 Handle namespace aliases.
llvm-svn: 82644
2009-09-23 19:19:16 +00:00
Anders Carlsson f771681e63 Emit new[] cookie when needed.
llvm-svn: 82642
2009-09-23 18:59:48 +00:00
Anders Carlsson b4bd0666d2 Basic support for new[].
llvm-svn: 82628
2009-09-23 16:07:23 +00:00
Anders Carlsson d49844b715 Add a new variant of EmitCXXAggrConstructorCall that takes a Value that holds the number of elements to construct, to be used when implementing new[].
llvm-svn: 82602
2009-09-23 02:45:36 +00:00
Anders Carlsson cc52f65500 Move codegen of new and delete to CGCXXExpr.cpp
llvm-svn: 82585
2009-09-22 22:53:17 +00:00
Mike Stump 17abe2a620 Remove now fixed FIXME.
llvm-svn: 82584
2009-09-22 22:31:44 +00:00
Anders Carlsson 8c978b4fc2 No need to null check implicit lvalue cast exprs.
llvm-svn: 82580
2009-09-22 22:00:46 +00:00
Anders Carlsson 8fef09cd80 When doing a derived-to-base class and the class offset is 0 we can just do a simple bitcast.
llvm-svn: 82579
2009-09-22 21:58:22 +00:00
Anders Carlsson 1d3b6f62df CXXMethodDecls should always be mangled, even if they are inside an extern "C" block. Fixes PR5017.
llvm-svn: 82567
2009-09-22 20:33:31 +00:00
Anders Carlsson fc51cc968b Don't assert that linkage decls are always C++, it's not true. Fixes PR5019.
llvm-svn: 82557
2009-09-22 17:23:30 +00:00
Daniel Dunbar b879c3c125 Revert "Switch a few clients over to StringLiteral::getString.", this is breaking some projects, but I don't have a test case yet.
llvm-svn: 82539
2009-09-22 10:03:52 +00:00
Daniel Dunbar 5de27daf93 Switch a few clients over to StringLiteral::getString.
- Switching all of them out-of-my-current-scope-of-interest, sorry.

llvm-svn: 82515
2009-09-22 03:27:52 +00:00
Mike Stump 207c680ff3 Fix some typos. WIP. Large alignments don't work yet.
llvm-svn: 82512
2009-09-22 02:44:17 +00:00
Mike Stump 2114d7c299 Improve debug info generation for __block variables.
llvm-svn: 82508
2009-09-22 02:12:52 +00:00
John McCall 9dd450bb78 Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely.  Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.

llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Fariborz Jahanian 71848a3ff1 Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.

llvm-svn: 82493
2009-09-21 23:03:37 +00:00
Fariborz Jahanian 38c3ae9bc4 Miscellanous fixes in generatation of objc gc's write-barriers.
llvm-svn: 82472
2009-09-21 18:54:29 +00:00
Chris Lattner bf20638966 Implement __builtin_unreachable(), a GCC 4.5 extension.
llvm-svn: 82433
2009-09-21 03:09:59 +00:00
Anders Carlsson a18322cea5 Start mangling expressions.
llvm-svn: 82423
2009-09-21 01:21:10 +00:00
Daniel Dunbar 9996138a80 Ok, an AssertingVH definitely doesn't work for now because we free our cache after the optimizer may have hacked on the module. Use a WeakVH instead.
llvm-svn: 82324
2009-09-19 20:17:48 +00:00
Nick Lewycky 41eaf0ac57 Make clang stop relying on ConstantStruct::get's default value for isPacked
which will be going away (ie. it's becoming a required parameter) later today.

llvm-svn: 82323
2009-09-19 20:00:52 +00:00
Daniel Dunbar 1cbaae56cf Switch CGDebugInfo type cache to using an AssertingVH.
llvm-svn: 82321
2009-09-19 19:27:24 +00:00
Daniel Dunbar de870bdcf2 Factor out CGDebugInfo::CreateTypeNode method.
- No functionality change.

llvm-svn: 82320
2009-09-19 19:27:14 +00:00
Anders Carlsson 82b688e423 More mangling work.
llvm-svn: 82265
2009-09-18 20:11:09 +00:00
Anders Carlsson c3773bd669 Make the mangler conform even better to the grammar.
llvm-svn: 82262
2009-09-18 19:44:50 +00:00
Mike Stump f9c95be2f6 Generate more of the vbase virtual offset for covariant thunks. WIP.
llvm-svn: 82253
2009-09-18 19:06:35 +00:00
Anders Carlsson 559d9741a8 More mangler mangling.
llvm-svn: 82250
2009-09-18 19:00:18 +00:00
Anders Carlsson caf4a646f8 Call mangleTemplatePrefix.
llvm-svn: 82247
2009-09-18 18:47:07 +00:00
Anders Carlsson c1370cb49b Change manglePrefix to return early if the DC is the translation unit.
llvm-svn: 82246
2009-09-18 18:39:58 +00:00
Anders Carlsson 2b5e1dda69 More mangling goodness.
llvm-svn: 82193
2009-09-18 04:29:09 +00:00
Anders Carlsson 7a8a74f704 Handle mangling of TemplateSpecializationType.
llvm-svn: 82189
2009-09-18 02:42:01 +00:00
Fariborz Jahanian 2e32ddc7ba Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.

llvm-svn: 82183
2009-09-18 00:04:00 +00:00
Anders Carlsson ca51ef156b Ignore extern "C++" { } when mangling.
llvm-svn: 82146
2009-09-17 16:12:20 +00:00
Anders Carlsson f96da57adb Revert r82123 for now.
llvm-svn: 82125
2009-09-17 05:31:47 +00:00
Anders Carlsson 49fe8b4f97 Treat an unqualified RecordType as a RecordDecl when substituting.
llvm-svn: 82123
2009-09-17 04:38:23 +00:00
Anders Carlsson 4245bf9e13 Substitution for prefixes.
llvm-svn: 82122
2009-09-17 04:16:28 +00:00
Anders Carlsson a2fb9bcd19 Substitute unscoped template names.
llvm-svn: 82119
2009-09-17 04:02:31 +00:00
Daniel Dunbar df0e62d0a1 IRgen/ObjC: Correctly construct the function info for variadic message sends.
This fixes some bad -O0 codegen and the unnecessary clearing of al on entry to objc_msgSend for most message sends.

<rdar://problem/7102824> [irgen] unnecessary xorb on calls to objc_msgSend on x86_64

llvm-svn: 82118
2009-09-17 04:01:40 +00:00
Daniel Dunbar aff9fcaa02 IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
llvm-svn: 82117
2009-09-17 04:01:22 +00:00
Anders Carlsson a96f56fba8 Add mangleSubstitution/addSubstitution variants that take a NamedDecl.
llvm-svn: 82116
2009-09-17 03:53:28 +00:00
Anders Carlsson df644fb773 When mangling function template specialization, mangle the type encoding of the original function template. Also, port mangle.cpp and function-template-specialization.cpp over to using FileCheck.
llvm-svn: 82114
2009-09-17 03:46:43 +00:00
Anders Carlsson 98e00bb162 Add new functions to the mangler for the <unscoped-name> and <unscoped-template-name> productions.
llvm-svn: 82113
2009-09-17 03:17:01 +00:00
Anders Carlsson feb60501a8 Add basic substitution to the C++ mangler. It currently only looks at types.
llvm-svn: 82102
2009-09-17 00:43:46 +00:00
Fariborz Jahanian de1d324dce patch for generating objc'2 objc_assign_ivar. WIP.
llvm-svn: 82090
2009-09-16 23:11:23 +00:00
Fariborz Jahanian a7fa6beb2e Starting patch to generate more specific API for objc's
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.

llvm-svn: 82082
2009-09-16 21:37:16 +00:00
Fariborz Jahanian 4141deb68e Removed a superfluous check before setting
a flag (objc GC).

llvm-svn: 82052
2009-09-16 16:49:08 +00:00
Anders Carlsson 20759ad54c x86-64 ABI: If a type is a C++ record with either a non-trivial destructor or a non-trivial copy constructor, it should be passed in a pointer. Daniel, plz review.
llvm-svn: 82050
2009-09-16 15:53:40 +00:00
Mike Stump c3844bea75 Be sure to use the correct version instead of inventing the wrong one.
llvm-svn: 81924
2009-09-15 21:48:34 +00:00
Anders Carlsson 1450adbbf9 Code generation of Conditional operators that are lvalues (but that aren't bitfields).
llvm-svn: 81867
2009-09-15 16:35:24 +00:00
Anders Carlsson 7cd39e0721 Handle reinterpret_cast between integral types and pointer types.
llvm-svn: 81837
2009-09-15 04:48:33 +00:00
Anders Carlsson 04c3bf4fab Codegen support for nullptr from C++0x.
llvm-svn: 81835
2009-09-15 04:39:46 +00:00
Daniel Dunbar 09d3362bf5 ARM/[A]APCS: Ignore empty records passed as arguments.
llvm-svn: 81798
2009-09-14 21:54:03 +00:00
David Chisnall 2997982ab4 Small fix to stop CGObjCGNU emitting symbols that break some versions of gas.
llvm-svn: 81778
2009-09-14 19:04:10 +00:00
Anders Carlsson ddf57d3df9 Remove an unnecessary FunctionDecl parameter to the synthesizing functions.
llvm-svn: 81759
2009-09-14 05:32:02 +00:00
Daniel Dunbar ff0553ec61 Fix subtle bug in generating LLVM function declarations for builtin functions.
The decl wasn't being passed down, which meant that function attributes were not
being set correctly. This is particularly important for ARM, since it wants to
override the calling convention. Instead we would emit the builtin with the
wrong calling convention, and instcombine would come along and merrily shred all
the calls to it. :)

llvm-svn: 81756
2009-09-14 04:33:21 +00:00
Daniel Dunbar d53bac7fa4 ARM/APCS: Don't treat structs w/ floating point types as "integer like".
llvm-svn: 81748
2009-09-14 02:20:34 +00:00
Anders Carlsson aedb46fe21 If a function call returns a reference, don't bind it to a temporary.
llvm-svn: 81743
2009-09-14 01:30:44 +00:00
Anders Carlsson 96bad9a5cd Implement CodeGenFunction::EmitCXXExprWithTemporariesLValue.
llvm-svn: 81738
2009-09-14 01:10:45 +00:00
Daniel Dunbar 1ce7251a0a Some minor clang/ARM/AAPCS tweaks.
llvm-svn: 81737
2009-09-14 00:56:55 +00:00
Daniel Dunbar b4091a9c6a Add TargetInfo::getABI(), and base ARM APCS vs AAPCS choice on that.
llvm-svn: 81735
2009-09-14 00:35:03 +00:00
Anders Carlsson 8783737029 Handle delete where the class has a virtual destructor.
llvm-svn: 81733
2009-09-14 00:16:25 +00:00
Anders Carlsson ccbabc9645 Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.
llvm-svn: 81681
2009-09-13 17:55:13 +00:00
Daniel Dunbar 626f1d8c3a ARM/APCS: Only "integer like" aggregates should be returned in r0 (following
gcc's interpretation of APCS' somewhat loose specification).

llvm-svn: 81671
2009-09-13 08:03:58 +00:00
Douglas Gregor 299d76e901 Rework the way we determine whether an externally visible symbol is
generated for an inline function definition, taking into account C99
and GNU inline/extern inline semantics. This solution is simpler,
cleaner, and fixes PR4536.

llvm-svn: 81670
2009-09-13 07:46:26 +00:00
Daniel Dunbar 0482cfd790 Don't use the PredefinedExpr string as the global variable name, these don't
make very nice symbols, just use the function name.

llvm-svn: 81653
2009-09-12 23:06:21 +00:00
Chris Lattner ee7bd3b204 whitespace fix
llvm-svn: 81644
2009-09-12 22:45:21 +00:00
Benjamin Kramer 2864584b14 Update CMake files.
llvm-svn: 81631
2009-09-12 21:18:26 +00:00
Mike Stump 6768683933 Add FIXME for alignments that won't be honored.
llvm-svn: 81620
2009-09-12 18:58:28 +00:00
Mike Stump d76611fac0 We can't have ctors in the vtable (right Doug?) :-)
llvm-svn: 81619
2009-09-12 18:57:58 +00:00
Anders Carlsson d95f9608ab Handle CK_DerivedToBase when emitting lvalue casts.
llvm-svn: 81614
2009-09-12 16:16:49 +00:00
Anders Carlsson 360e7d0a8f When necessary, null check the base value in GetAddressCXXOfBaseClass.
llvm-svn: 81611
2009-09-12 06:04:24 +00:00
Anders Carlsson 12f5a25f15 Handle derived-to-base conversion in CGExprScalar::EmitCast, if the cast kind is CK_DerivedToBase.
llvm-svn: 81610
2009-09-12 04:57:16 +00:00
Anders Carlsson 9a57c5ac6f Whoops, add CGCXXClass.cpp
llvm-svn: 81607
2009-09-12 04:27:24 +00:00
Anders Carlsson 864d525533 Rename AddressCXXOfBaseClass to GetAddressCXXOfBaseClass. Add a NullCheckValue argument (currently unused).
llvm-svn: 81606
2009-09-12 04:26:35 +00:00
Anders Carlsson 307408d2af Add CGCXXClass.cpp. and move CodeGenFunction::AddressCXXOfBaseClass there.
llvm-svn: 81604
2009-09-12 03:29:09 +00:00
Anders Carlsson f8e94f2008 Add support for __block variables with alignment greater than __alignof(void *).
llvm-svn: 81602
2009-09-12 02:44:18 +00:00