Skip to content

Commit

Permalink
Cleanup warnings and tests (#666)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter authored Jun 21, 2024
1 parent 5754074 commit f673dd8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/tcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2870,7 +2870,6 @@ struct FunctionEmitter {
Value *v = emitAddressOf(&obj);
Obj entryType;
Value *result = emitStructSelect(&typ, v, offset, &entryType);
Type *ttype = getType(&typ)->type;
if (!exp->boolean("lvalue"))
result = B->CreateLoad(getType(&entryType)->type, result);
return result;
Expand Down Expand Up @@ -3011,7 +3010,6 @@ struct FunctionEmitter {
Value *a_result = B->CreateExtractValue(a, ArrayRef<unsigned>(0));
Value *a_success = B->CreateExtractValue(a, ArrayRef<unsigned>(1));
Value *a_success_i8 = B->CreateZExt(a_success, B->getInt8Ty());
Type *elt_types[2] = {a_result->getType(), B->getInt8Ty()};
Type *result_type = typeOfValue(exp)->type;
Value *result = UndefValue::get(result_type);
result = B->CreateInsertValue(result, a_result, ArrayRef<unsigned>(0));
Expand Down
3 changes: 0 additions & 3 deletions src/tcwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,9 +802,6 @@ void InitHeaderSearchFlagsAndArgs(std::string const &TripleStr, HeaderSearchOpti
}

clang::driver::ToolChain const &TC = C->getDefaultToolChain();
std::string path = TC.GetLinkerPath();
const char *link = path.c_str();
for (auto &i : TC.getProgramPaths()) link = i.c_str();

llvm::opt::ArgStringList IncludeArgs;
TC.AddClangSystemIncludeArgs(C->getArgs(), IncludeArgs);
Expand Down
3 changes: 1 addition & 2 deletions tests/class.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IO = terralib.includec("stdio.h")
local Class = require("lib/javalike")
local IO = Class.C

struct A(Class()) {
a : int
Expand Down Expand Up @@ -104,7 +104,6 @@ end
assert(12 == foobar2())


local IO = terralib.includec("stdio.h")
struct Animal(Class()) {
data : int
}
Expand Down
7 changes: 2 additions & 5 deletions tests/class3.t
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

C = terralib.includec("stdio.h")

local Class = require("lib/javalike")

local C = Class.C

local Prints = Class.Interface("Prints",{ print = {} -> {} })

Expand Down Expand Up @@ -32,4 +29,4 @@ terra test()
p:print()
end

test()
test()
2 changes: 1 addition & 1 deletion tests/class4.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ terra bar()
a:draw()
end

bar()
bar()
3 changes: 1 addition & 2 deletions tests/class5.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

IO = terralib.includec("stdio.h")
local Class = require("lib/javalike")
local IO = Class.C

struct A(Class()) {
a : int;
Expand Down
12 changes: 8 additions & 4 deletions tests/lib/javalike.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
local List = terralib.newlist
local malloc = terralib.externfunction("malloc", uint64 -> &opaque)
local free = terralib.externfunction("free", &opaque -> {})
local printf = terralib.externfunction("printf", terralib.types.funcpointer({rawstring},int,true))
local C = terralib.includecstring [[
#include "stdio.h"
#include "stdlib.h"
]]
local malloc = C.malloc
local free = C.free
local printf = C.printf
local function createvtable(T)
return
end
Expand Down Expand Up @@ -157,4 +161,4 @@ local function Interface(name,methodlist_)
return iface
end

return setmetatable({ Interface = Interface }, { __call = Class })
return setmetatable({ Interface = Interface, C = C }, { __call = Class })

0 comments on commit f673dd8

Please sign in to comment.