Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/main/java/com/aparapi/internal/writer/BlockWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,6 @@ public void writeInstruction(Instruction _instruction) throws CodeGenException {
final AssignToLocalVariable assignToLocalVariable = inlineAssignInstruction.getAssignToLocalVariable();

final LocalVariableInfo localVariableInfo = assignToLocalVariable.getLocalVariableInfo();
if (assignToLocalVariable.isDeclaration()) {
// this is bad! we need a general way to hoist up a required declaration
throw new CodeGenException("/* we can't declare this " + convertType(localVariableInfo.getVariableDescriptor(), true, false)
+ " here */");
}
write(localVariableInfo.getVariableName());
write("=");
writeInstruction(inlineAssignInstruction.getRhs());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,37 @@
*/
package com.aparapi.codegen.test;

import com.aparapi.internal.exception.ClassParseException;
import com.aparapi.internal.exception.CodeGenException;
import org.junit.Ignore;
import org.junit.Test;

public class AssignAndPassAsParameterSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase {

private static final String[] expectedOpenCL = null;
private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = CodeGenException.class;
private static final String[] expectedOpenCL = {
"typedef struct This_s{\n"
+ "\n"
+ " int passid;\n"
+ " }This;\n"
+ " int get_pass_id(This *this){\n"
+ " return this->passid;\n"
+ " }\n"
+ "\n"
+ " void actuallyDoIt(This *this, int a){\n"
+ " return;\n"
+ " }\n"
+ " __kernel void run(\n"
+ " int passid\n"
+ " ){\n"
+ " This thisStruct;\n"
+ " This* this=&thisStruct;\n"
+ " this->passid = passid;\n"
+ " {\n"
+ " int z;\n"
+ " actuallyDoIt(this, z=1);\n"
+ " return;\n"
+ " }\n"
+ " }\n"
+ " "};
private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null;

@Test
public void AssignAndPassAsParameterSimpleTest() {
Expand Down