Skip to content

Commit 0d3cf58

Browse files
committed
test(irdec): add functional tests for decompiling glu code
1 parent 46f8680 commit 0d3cf58

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

lib/IRDec/DITypeLifter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ DITypeLifter::handleComposedTypes(llvm::DICompositeType const *diCompositeType)
6161
fieldDecls.push_back(astArena.create<ast::FieldDecl>(
6262
SourceLocation::invalid,
6363
copyString(fieldName.str(), astArena.getAllocator()),
64-
fieldType
64+
fieldType, nullptr, nullptr, ast::Visibility::Public
6565
));
6666
}
6767
}
@@ -71,7 +71,7 @@ DITypeLifter::handleComposedTypes(llvm::DICompositeType const *diCompositeType)
7171
copyString(
7272
diCompositeType->getName().str(), astArena.getAllocator()
7373
),
74-
fieldDecls
74+
fieldDecls, ast::Visibility::Public
7575
);
7676
_declBindings[diCompositeType] = structDecl;
7777
return typesArena.create<StructTy>(structDecl);
File renamed without changes.

test/functional/IRDec/simple.glu

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// RUN: gluc -emit-llvm-bc %s -o %t.bc
3+
// RUN: gluc %t.bc -print-interface | FileCheck -v %s
4+
//
5+
6+
// CHECK: public func getName() -> *Char;
7+
public func getName() -> *Char {
8+
return "Emil";
9+
}
10+
11+
// CHECK: public func getSchool() -> *Char;
12+
public func getSchool() -> *Char {
13+
return "Epitech";
14+
}

test/functional/IRDec/struct.glu

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// RUN: gluc -emit-llvm-bc %s -o %t.bc
3+
// RUN: gluc %t.bc -print-interface | FileCheck -v %s
4+
//
5+
6+
// CHECK: public func getName() -> Person;
7+
public func getName() -> Person {
8+
return { "Emil", 22 };
9+
}
10+
11+
// CHECK: public struct Person {
12+
// CHECK-NEXT: public name: *Char,
13+
// CHECK-NEXT: public age: UInt32,
14+
// CHECK-NEXT:}
15+
public struct Person {
16+
public name: *Char,
17+
public age: UInt32,
18+
}

0 commit comments

Comments
 (0)