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
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
Benjamin Kramer
abd5b90e4c
Simplify pointer creation with the new Type::getInt*Ptr methods.
...
llvm-svn: 83964
2009-10-13 10:07:13 +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
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
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
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
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
Anders Carlsson
649a17e861
Handle namespace aliases.
...
llvm-svn: 82644
2009-09-23 19:19:16 +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
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
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
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
0ef3479cb7
Change CodeGenModule::ConstructTypeAttributes to return the calling convention
...
to use, and allow the ABI implementation to override the calling convention.
llvm-svn: 81593
2009-09-12 00:59:20 +00:00
Douglas Gregor
16618f2157
Remove unnecessary ASTContext parameters from isMain and isExternC
...
llvm-svn: 81589
2009-09-12 00:17:51 +00:00
Daniel Dunbar
bbaeca4fef
Set the calling convention based on the CGFunctionInfo.
...
llvm-svn: 81582
2009-09-11 22:25:00 +00:00
Anders Carlsson
ecf9bf0158
GlobalDecl doesn't have an explicit constructor anymore.
...
llvm-svn: 81481
2009-09-10 23:43:36 +00:00
Anders Carlsson
38988d7ee0
Add stricter GlobalDecl constructors.
...
llvm-svn: 81480
2009-09-10 23:38:47 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Douglas Gregor
34ec2ef159
Improve the AST representation and semantic analysis for extern
...
templates. We now distinguish between an explicit instantiation
declaration and an explicit instantiation definition, and know not to
instantiate explicit instantiation declarations. Unfortunately, there
is some remaining confusion w.r.t. instantiation of out-of-line member
function definitions that causes trouble here.
llvm-svn: 81053
2009-09-04 22:48:11 +00:00
Douglas Gregor
d94105a1c2
Don't generate any code for an explicit call to a trivial destructor.
...
Now that parsing, semantic analysis, and (I think) code generation of
pseudo-destructor expressions and explicit destructor calls works,
update the example-dynarray.cpp test to destroy the objects it
allocates and update the test to actually compile + link.
The code seems correct, but the Clang-compiled version dies with a
malloc error. Time to debug!
llvm-svn: 81025
2009-09-04 19:04:08 +00:00
Douglas Gregor
e5feb51624
Don't try to CodeGen using directives, from Anders Johnsen
...
llvm-svn: 80853
2009-09-02 23:49:23 +00:00
Mike Stump
3722f5896c
Regularize the case and sort.
...
llvm-svn: 80163
2009-08-26 22:31:08 +00:00
Anders Carlsson
6c0a6e490c
Emit conversion functions correctly.
...
llvm-svn: 79985
2009-08-25 13:14:46 +00:00
Fariborz Jahanian
d262eda6fc
Patch toward synthesizing non-trivial destructors. WIP
...
llvm-svn: 79199
2009-08-16 19:36:17 +00:00
Anders Carlsson
157c321b7c
No need to append extra padding now that we don't create packed structs for simple cases like the constant string.
...
llvm-svn: 79178
2009-08-16 05:55:31 +00:00
Fariborz Jahanian
92b3f47de2
Fixed a bug in ir-gen for copy assignment synthesis.
...
Fixed a bug when evaluating those copy-assignments
which need by lazily syntheized. A test case
for these.
llvm-svn: 78965
2009-08-14 00:01:54 +00:00
Owen Anderson
41a750271b
Update for LLVM API change.
...
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Fariborz Jahanian
4985b33fd7
Patch to force synthesis of copy assignment operator
...
function in the order according to c++03. ir-gen
for copy assignment in the trivial case and the first
test case.
llvm-svn: 78938
2009-08-13 21:09:41 +00:00
Fariborz Jahanian
de7d4c264a
Patch for synthesizing copy assignment operator.
...
WIP.
llvm-svn: 78841
2009-08-12 21:14:35 +00:00
Fariborz Jahanian
b2197042b8
ir-gen support for anonymous union data member
...
copying in copy constructors and used in
default constructor's initializer list.
llvm-svn: 78700
2009-08-11 18:49:54 +00:00
Fariborz Jahanian
296584b2a9
Support for anonymous union in ctor's initializer and
...
bunch of FIXMEs for their is-gen.
llvm-svn: 78623
2009-08-10 23:56:17 +00:00
Anders Carlsson
b8be93fc92
Add support for global initializers.
...
llvm-svn: 78515
2009-08-08 23:24:23 +00:00
Fariborz Jahanian
7c3d7f6c59
Remove use of uninitized variable.
...
llvm-svn: 78448
2009-08-08 00:59:58 +00:00
Fariborz Jahanian
40134e71be
More synthesis of copy constructors. Work in progress.
...
llvm-svn: 78402
2009-08-07 20:22:40 +00:00
Fariborz Jahanian
9301b24c0a
Patch toward synthesizing copy constructors.
...
Work in progress.
llvm-svn: 78355
2009-08-06 23:38:16 +00:00
Owen Anderson
758428f4e3
Update for LLVM API change.
...
llvm-svn: 78259
2009-08-05 23:18:46 +00:00
Chris Lattner
f49573d1ee
weak globals that are const should get weak_odr linkage.
...
add a fixme about C++ const.
llvm-svn: 78159
2009-08-05 05:20:29 +00:00
Chris Lattner
c0693bc2ea
rdar://7119244 - globals with an explicit section specified don't get
...
common linkage.
llvm-svn: 78158
2009-08-05 04:56:58 +00:00
Daniel Dunbar
4d93a4f9d4
Make sure UTF-16 strings end with a 16-bit null (as opposed to 8-bit).
...
llvm-svn: 78001
2009-08-03 21:47:08 +00:00
Anders Carlsson
59a9468b22
Whoops, meant to delete this.
...
llvm-svn: 77916
2009-08-02 21:34:52 +00:00
Anders Carlsson
f18318cf4e
use CodeGenModule::EmitNullConstant in a couple of places.
...
llvm-svn: 77915
2009-08-02 21:18:22 +00:00
Eli Friedman
e480ce3d29
Don't error on C++ linkage; if we don't support that, there are
...
serious issues :)
llvm-svn: 77800
2009-08-01 20:48:04 +00:00