Граф коммитов

2240 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 3eea635041 Don't assume that the LHS and RHS of a member pointer expression is a DeclRefExpr. Fixes PR5177.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:41:28 +00:00
Mike Stump e647d93be5 Remove FIXME. We construct VBIndex very early, before any calls to OverrideMethod.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:23:44 +00:00
Devang Patel 70cf5306f0 Remove extra white space line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:02:38 +00:00
Devang Patel 3b122bc5f1 Do not check use_empty() before invoking replaceAllUsesWith().
Let replaceAllUsesWith() adjust VHs even though there are no uses.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 17:02:04 +00:00
Mike Stump d9878a181f Refine handling for return value conversions with respect to virtual
offsets for covariant thunks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83965 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 10:55:21 +00:00
Benjamin Kramer 3c0ef8cc0d Simplify pointer creation with the new Type::getInt*Ptr methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 10:07:13 +00:00
Chris Lattner 3ae9f48ae0 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 07:14:16 +00:00
Chris Lattner 3d00fdc82f 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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 06:55:33 +00:00
Chris Lattner 9329a5c292 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 06:04:29 +00:00
Chris Lattner 36afd38fb7 Use the new Type::getInt8PtrTy method. This should probably be used in a lot
more places in clang codegen now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 06:02:42 +00:00
Devang Patel 55df71abf0 Enable "debug info attached to an instruction" mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 23:31:25 +00:00
Devang Patel d35e2e0c35 There is no need to attach debug location info with alloca instruction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 22:29:02 +00:00
Devang Patel 7c173cbcd7 Encode long double.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 22:28:31 +00:00
Anders Carlsson 5017a157c6 Store the key function of a record decl inside CGRecordLayout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 21:16:22 +00:00
Anders Carlsson 4a0d832ecd Even more devirtualization cleverness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 19:59:15 +00:00
Anders Carlsson cf5deecd78 More devirtualization improvements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 19:51:33 +00:00
Anders Carlsson 7636648769 Devirtualize calls on temporaries. A().f() for example.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 19:45:47 +00:00
Anders Carlsson 8e7670de19 Factor out devirtualization checking into a separate function and make it handle references correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 19:41:04 +00:00
Anders Carlsson 3b89f3fa61 If the base type of a member call is a record type we don't need to emit a virtual call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 23:55:52 +00:00
Benjamin Kramer 7a9474e025 Remove dead variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 22:57:54 +00:00
Benjamin Kramer 091c1c2757 Add CGVtable.cpp to CMakeLists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83800 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 22:22:38 +00:00
Anders Carlsson dbd920c775 Move the vtable builder to CGVtable.cpp, general cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 22:13:54 +00:00
Anders Carlsson fc3bf4d4d2 Change mangleCXXVtable and mangleCXXRtti to take CXXRecordDecls instead of QualTypes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83793 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-11 21:24:51 +00:00
Anders Carlsson 656e4c10dc Move our (non-existing) RTTI emission code into CGRtti.cpp. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 20:49:04 +00:00
Fariborz Jahanian f7bcc7e6c8 Generate weak read barriers when reading a weak __block
variable inside the block.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-10 20:07:56 +00:00
Devang Patel fee53aa127 Revert 83567.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 22:06:15 +00:00
Mike Stump d8945d6ae0 Allow customization for the producer information in the debug output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 18:38:12 +00:00
Mike Stump 25bc275c3f Avoid warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83609 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-09 01:25:47 +00:00
Douglas Gregor 14ea569641 Installation of Clang libraries and headers, from Axel Naumann!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 22:15:31 +00:00
Devang Patel e23429269f Record location info before emiting alloca for arguments. This allows arguments to have proper location info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 18:53:37 +00:00
Anders Carlsson 74d644abe5 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 17:28:59 +00:00
Anders Carlsson 8f8fd8ea7e Mangle std::basic_ostream<char, std::char_traits<char>> as So.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-08 17:20:26 +00:00
Anders Carlsson c4355b6883 Mangle anonymous structs/unions correctly. Fixes PR5139.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83448 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 01:45:02 +00:00
Anders Carlsson b540491851 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-07 01:06:45 +00:00
Anders Carlsson edee783ed3 Uncomment some commented out code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 23:02:00 +00:00
Anders Carlsson 2f1986b557 Change GetAddressCXXOfBaseClass to use CXXBasePaths for calculating base class offsets. Fix the code to handle virtual bases as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 22:43:30 +00:00
Anders Carlsson b217c1b9d2 When mangling names, always use the canonical decl. Fixes PR5144.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 21:58:01 +00:00
Devang Patel 6e461bf753 InsertSubprogramStart if ATTACH_DEBUG_INFO_TO_AN_INSN is not defined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 21:53:41 +00:00
Devang Patel bbd9fa4b4a Add support to attach debug info to an instruction.
This is not yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 18:36:08 +00:00
Anders Carlsson c33e4ba203 Emit the destructor epilogue in a cleanup block so a return from a destructor body still calls the epilogue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83397 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 18:09:57 +00:00
Anders Carlsson b299d3516d Pass the right type to GetAddrOfFunction when getting functions for the VTable. Fixes PR5021.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 17:54:23 +00:00
Devang Patel 979ec2e5ee Set appropriate context for a global variable while emitting debug info.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-06 00:35:31 +00:00
Mike Stump bd6dbd1978 Fix thinko and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 23:08:21 +00:00
Mike Stump fb51ddfafc Ensure we have atleast 2-byte alignment for member functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 22:49:20 +00:00
Mike Stump f55314dce9 Respect alignments better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 21:58:44 +00:00
Benjamin Kramer ffbb15e54a Use new predicates for some type equality tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83303 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 13:47:21 +00:00
Anders Carlsson 719aa44de4 Pass the canonical method decl to GetVtableIndex. Fixes PR5120.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 19:56:56 +00:00
Anders Carlsson 375c31c467 Implement code generation of member function pointer calls. Fixes PR5121.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 19:43:08 +00:00
Anders Carlsson a024d17048 Teach AggExprEmitter about pointers to member functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 15:43:24 +00:00
Anders Carlsson 2c51f092e4 Handle base-to-derived casts of member function pointers in CGExprConstant.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 15:13:22 +00:00
Anders Carlsson f57b4e44d0 Handle members to function pointers in CGExprConstant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 15:02:02 +00:00
Anders Carlsson 2b3583573b Move some functions from CodeGenFunctions to CodeGenModule so they can be used by CGExprConstant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-03 14:56:57 +00:00
Anders Carlsson 2df96e7019 Don't update the struct alignment when adding fields to a packed struct. Fixes PR5118.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-02 04:52:12 +00:00
Mike Stump 3d363c596d More magic pixie dust.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-02 02:30:50 +00:00
Mike Stump 944e705766 Fix up debug information for block pointers a bit more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-02 02:23:37 +00:00
Anders Carlsson 31f2f9ced8 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-02 02:15:20 +00:00
Mike Stump b289b3f324 Implement a FIXME. This improves codegen just a tad.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83221 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 22:29:41 +00:00
Douglas Gregor 4513272f44 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 20:44:19 +00:00
Douglas Gregor d69dd78086 Fix a lame regression in IR gen for C++ delete expressions. PR5102
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83195 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 05:49:51 +00:00
Mike Stump de8c5c77e2 A couple of refinements for laying out debug information for
BlockDeclRefDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83185 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 00:27:30 +00:00
John McCall 9aeed32282 Anonymous namespaces, sema + codegen. A lot of semantics are still broken,
apparently because using directives aren't quite working correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 00:25:31 +00:00
Fariborz Jahanian 75b08f169f <rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 17:10:29 +00:00
Mike Stump b1a6e68796 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-30 02:43:10 +00:00
Douglas Gregor 9091656e42 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 18:16:17 +00:00
Anders Carlsson 2472bf0a17 Handle CXXMemberCallExprs that point to a static method. Fixes PR5093.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83045 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 03:54:11 +00:00
Anders Carlsson 84080ec16e Handle CK_BaseToDerivedMemberPointer for member function pointers. Fixes PR5091.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 03:13:20 +00:00
Anders Carlsson e9d34dc7af Improve support for member function pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 02:09:01 +00:00
Anders Carlsson 3016842613 Use a switch statement in VisitCastExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 01:23:39 +00:00
Anders Carlsson e322f30486 Make hasAggregateLLVMType use positive checks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 01:15:29 +00:00
Mike Stump 740256bafb Fix http://llvm.org/PR5090.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 00:50:50 +00:00
Anders Carlsson 50755b0dcc Mangle dependent name expressions. Fixes PR5063.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 20:11:34 +00:00
Anders Carlsson e45117b945 Use mangleTemplatePrefix when we know that we're mangling a nested template name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 19:53:49 +00:00
Anders Carlsson 6815e94199 CodeGen for try statements. (We just emit the body for now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 18:58:34 +00:00
Anders Carlsson 88599176d1 Look for substitutions when mangling TypenameTypes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 01:06:07 +00:00
Anders Carlsson 0ccdf8d62c Better template parameter type mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 00:38:53 +00:00
Anders Carlsson f514b544b2 Mangle std::basic_string<char, std::char_traits<char>, std::allocator<char> > as Ss.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-27 00:12:57 +00:00
Anders Carlsson 189d59cfc7 Mangle ::std::basic_string as Sb.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82881 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 23:14:39 +00:00
Anders Carlsson 8c0315563f Mangle ::std::allocator as Sa.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 23:10:05 +00:00
Anders Carlsson aeb85374e9 Handle substitutions in mangleTemplatePrefix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82879 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 22:18:22 +00:00
Anders Carlsson e7c8cb6b27 Substitute "::std::" as "St".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 20:53:44 +00:00
Anders Carlsson 1668f2062b Don't crash when trying to mangle function templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 20:13:56 +00:00
Anders Carlsson 0fa6df4400 mangleTemplatePrefix and mangleUnscopedTemplateName should take a TemplateDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 19:45:45 +00:00
Anders Carlsson 6b7fc1344d Use the qualified name for tag types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 19:03:24 +00:00
Anders Carlsson 41f8a13ac7 Set alignment on static function level decls and VLAs. Fixes PR5060.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 18:16:06 +00:00
Anders Carlsson 5b3a2fcd80 Use ABIArgInfo::getDirect() for all types that have a pointer representation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 03:56:53 +00:00
Anders Carlsson d99edc4430 Mangle record types as decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 03:55:37 +00:00
Anders Carlsson bb36ba488b Change isTemplate to return the actual template declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82839 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 03:24:57 +00:00
Anders Carlsson ae35248661 Improve mangling of typename types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 02:26:02 +00:00
Mike Stump bcdc0f0aff Fix 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:00 +00:00
John McCall a180529e3d Fix an infinite loop arising when trying to generate debug information
for a ObjC class with an ivar of weak self type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 01:40:47 +00:00
Fariborz Jahanian 76368e843c Fixed another code gen bug in objc's new write-barrier API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 00:00:20 +00:00
Mike Stump bb30419d81 Fix 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 22:31:14 +00:00
Fariborz Jahanian 6c7a1f3647 Patch fixes a code gen. bug in generation of objc_assign_ivar
(objc GC's API).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 22:25:38 +00:00
John McCall 0953e767ff 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 19:53:00 +00:00
Daniel Dunbar 55e59e139d 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82681 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 05:12:36 +00:00
Anders Carlsson 018837b081 Handle namespace aliases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 19:19:16 +00:00
Anders Carlsson 6ac5fc49ee Emit new[] cookie when needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 18:59:48 +00:00
Anders Carlsson a4d4c019bf Basic support for new[].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 16:07:23 +00:00
Anders Carlsson 569c1f4a6c Add a new variant of EmitCXXAggrConstructorCall that takes a Value that holds the number of elements to construct, to be used when implementing new[].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 02:45:36 +00:00
Anders Carlsson 16d81b8db3 Move codegen of new and delete to CGCXXExpr.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:53:17 +00:00
Mike Stump 45504e568c Remove now fixed FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:31:44 +00:00
Anders Carlsson 592a2bbc19 No need to null check implicit lvalue cast exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:00:46 +00:00
Anders Carlsson dfd0330267 When doing a derived-to-base class and the class offset is 0 we can just do a simple bitcast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:58:22 +00:00
Anders Carlsson add28829c7 CXXMethodDecls should always be mangled, even if they are inside an extern "C" block. Fixes PR5017.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 20:33:31 +00:00
Anders Carlsson 5cc58c6cfe Don't assert that linkage decls are always C++, it's not true. Fixes PR5019.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 17:23:30 +00:00
Daniel Dunbar f015b03415 Revert "Switch a few clients over to StringLiteral::getString.", this is breaking some projects, but I don't have a test case yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 10:03:52 +00:00
Daniel Dunbar df4eee9b03 Switch a few clients over to StringLiteral::getString.
- Switching all of them out-of-my-current-scope-of-interest, sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:27:52 +00:00
Mike Stump fd47b31be0 Fix some typos. WIP. Large alignments don't work yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82512 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:44:17 +00:00
Mike Stump 39605b4eab Improve debug info generation for __block variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:12:52 +00:00
John McCall 183700f494 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:43:11 +00:00
Fariborz Jahanian b924259cc5 Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:03:37 +00:00
Fariborz Jahanian fd02ed702e Miscellanous fixes in generatation of objc gc's write-barriers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 18:54:29 +00:00
Chris Lattner 21190d5463 Implement __builtin_unreachable(), a GCC 4.5 extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:09:59 +00:00
Anders Carlsson d553f8c57f Start mangling expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 01:21:10 +00:00
Daniel Dunbar 65f13c3381 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:17:48 +00:00
Nick Lewycky 0d36dd28bb 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:00:52 +00:00
Daniel Dunbar 23e81bae8c Switch CGDebugInfo type cache to using an AssertingVH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:27:24 +00:00
Daniel Dunbar 03faac3b8c Factor out CGDebugInfo::CreateTypeNode method.
- No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:27:14 +00:00
Anders Carlsson 2ee3fca27a More mangling work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 20:11:09 +00:00
Anders Carlsson eafc6dcf67 Make the mangler conform even better to the grammar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:44:50 +00:00
Mike Stump 97f4d46e2f Generate more of the vbase virtual offset for covariant thunks. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:06:35 +00:00
Anders Carlsson 2744a063f1 More mangler mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:00:18 +00:00
Anders Carlsson aa73ab1bd0 Call mangleTemplatePrefix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:47:07 +00:00
Anders Carlsson 9263e91e2e Change manglePrefix to return early if the DC is the translation unit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:39:58 +00:00
Anders Carlsson 7482e24716 More mangling goodness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 04:29:09 +00:00
Anders Carlsson 7624f21938 Handle mangling of TemplateSpecializationType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 02:42:01 +00:00
Fariborz Jahanian 1c1afc4ed3 Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 00:04:00 +00:00
Anders Carlsson d58d6f778d Ignore extern "C++" { } when mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82146 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 16:12:20 +00:00
Anders Carlsson 068f347772 Revert r82123 for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 05:31:47 +00:00
Anders Carlsson 657094b1ad Treat an unqualified RecordType as a RecordDecl when substituting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82123 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:38:23 +00:00
Anders Carlsson 6862fc720b Substitution for prefixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:16:28 +00:00
Anders Carlsson 03c9d530db Substitute unscoped template names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:02:31 +00:00
Daniel Dunbar 6793966aa2 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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:01:40 +00:00
Daniel Dunbar d6c93d7035 IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:01:22 +00:00
Anders Carlsson d3a932a298 Add mangleSubstitution/addSubstitution variants that take a NamedDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:53:28 +00:00
Anders Carlsson 9234b7ff2b 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:46:43 +00:00
Anders Carlsson 201ce7485c Add new functions to the mangler for the <unscoped-name> and <unscoped-template-name> productions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:17:01 +00:00
Anders Carlsson 7696737d41 Add basic substitution to the C++ mangler. It currently only looks at types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:43:46 +00:00
Fariborz Jahanian dbf3cfd39d patch for generating objc'2 objc_assign_ivar. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 23:11:23 +00:00
Fariborz Jahanian b123ea395e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 21:37:16 +00:00
Fariborz Jahanian 8e674aea31 Removed a superfluous check before setting
a flag (objc GC).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 16:49:08 +00:00
Anders Carlsson 0a8f847e97 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 15:53:40 +00:00
Mike Stump 5a8621732d Be sure to use the correct version instead of inventing the wrong one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 21:48:34 +00:00
Anders Carlsson 6fcec8b58d Code generation of Conditional operators that are lvalues (but that aren't bitfields).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 16:35:24 +00:00
Anders Carlsson 7f9e646b7e Handle reinterpret_cast between integral types and pointer types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81837 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 04:48:33 +00:00
Anders Carlsson c1eb14a66f Codegen support for nullptr from C++0x.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 04:39:46 +00:00
Daniel Dunbar 4202557106 ARM/[A]APCS: Ignore empty records passed as arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 21:54:03 +00:00
David Chisnall a7c5b0832c Small fix to stop CGObjCGNU emitting symbols that break some versions of gas.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81778 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 19:04:10 +00:00
Anders Carlsson de1d26b9c1 Remove an unnecessary FunctionDecl parameter to the synthesizing functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 05:32:02 +00:00
Daniel Dunbar 34771b594c 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. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 04:33:21 +00:00