changeset 351:f273f5c58a9a trunk

[svn r372] Fixed extern(C++) handling now same as DMD, which is to treat it like extern(C). Fixed a problem in resolving struct types where the size of elements might not yet be known. Switched to using DMD size() instead of LLVM ABI size (TargetData).
author lindquist
date Mon, 14 Jul 2008 03:23:43 +0200
parents b85cf5faccfc
children d920a244691b
files gen/structs.cpp gen/tollvm.cpp
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gen/structs.cpp	Mon Jul 14 01:03:53 2008 +0200
+++ b/gen/structs.cpp	Mon Jul 14 03:23:43 2008 +0200
@@ -188,12 +188,12 @@
                 assert(lastoffset == 0);
                 fieldtype = i->second.type;
                 fieldinit = i->second.var;
-                prevsize = getABITypeSize(fieldtype);
+                prevsize = fieldinit->type->size();
                 i->second.var->ir.irField->index = idx;
             }
             // colliding offset?
             else if (lastoffset == i->first) {
-                size_t s = getABITypeSize(i->second.type);
+                size_t s = i->second.var->type->size();
                 if (s > prevsize) {
                     fieldpad += s - prevsize;
                     prevsize = s;
@@ -203,7 +203,7 @@
             }
             // intersecting offset?
             else if (i->first < (lastoffset + prevsize)) {
-                size_t s = getABITypeSize(i->second.type);
+                size_t s = i->second.var->type->size();
                 assert((i->first + s) <= (lastoffset + prevsize)); // this holds because all types are aligned to their size
                 sd->ir.irStruct->hasUnions = true;
                 i->second.var->ir.irField->index = idx;
@@ -226,7 +226,7 @@
                 lastoffset = i->first;
                 fieldtype = i->second.type;
                 fieldinit = i->second.var;
-                prevsize = getABITypeSize(fieldtype);
+                prevsize = fieldinit->type->size();
                 i->second.var->ir.irField->index = idx;
                 fieldpad = 0;
             }
--- a/gen/tollvm.cpp	Mon Jul 14 01:03:53 2008 +0200
+++ b/gen/tollvm.cpp	Mon Jul 14 03:23:43 2008 +0200
@@ -281,7 +281,7 @@
 
 unsigned DtoCallingConv(LINK l)
 {
-    if (l == LINKc)
+    if (l == LINKc || l == LINKcpp)
         return llvm::CallingConv::C;
     else if (l == LINKd || l == LINKdefault)
         return llvm::CallingConv::Fast;