diff dmd/attrib.c @ 94:61615fa85940 trunk

[svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca"). Added support for array .sort and .reverse properties. Fixed some bugs with pointer arithmetic. Disabled some DMD AST optimizations that was messing things up, destroying valuable information. Added a KDevelop project file, this is what I use for coding LLVMDC now :) Other minor stuff.
author lindquist
date Mon, 12 Nov 2007 06:32:46 +0100
parents eb379601d445
children 5acec6b2eef8
line wrap: on
line diff
--- a/dmd/attrib.c	Thu Nov 08 19:21:05 2007 +0100
+++ b/dmd/attrib.c	Mon Nov 12 06:32:46 2007 +0100
@@ -879,6 +879,10 @@
                     llvm_internal = LLVMnotypeinfo;
                     assert(args->dim == 1);
                 }
+                else if (strcmp(str,"alloca")==0) {
+                    llvm_internal = LLVMalloca;
+                    assert(args->dim == 1);
+                }
                 else {
                     error("unknown pragma command: %s", str);
                 }
@@ -904,6 +908,7 @@
             case LLVMva_arg:
             case LLVMva_start:
             case LLVMnotypeinfo:
+            case LLVMalloca:
                 break;
 
             default:
@@ -960,6 +965,16 @@
                 s->llvmInternal = llvm_internal;
                 break;
 
+            case LLVMalloca:
+                if (FuncDeclaration* fd = s->isFuncDeclaration()) {
+                    fd->llvmInternal = llvm_internal;
+                }
+                else {
+                    error("may only be used on function declarations");
+                    assert(0);
+                }
+                break;
+
             default:
                 assert(0 && "invalid LLVM_internal pragma got through :/");
             }