-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
80 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <fire-llvm/fire.hpp> | ||
|
||
#include <iostream> | ||
#include <optional> | ||
#include <string> | ||
#include <vector> | ||
|
||
struct S | ||
{ | ||
std::string hello(std::string const &msg) | ||
{ | ||
return msg; | ||
} | ||
|
||
int add(int a, int b) | ||
{ | ||
return a + b; | ||
} | ||
|
||
bool flag(bool f) | ||
{ | ||
return f; | ||
} | ||
|
||
int default_arg(int d = 0) | ||
{ | ||
return d; | ||
} | ||
|
||
void optional(std::optional<int> opt) | ||
{ | ||
if (opt) | ||
std::cout << "opt = " << opt.value() << std::endl; | ||
else | ||
std::cout << "opt = nothing" << std::endl; | ||
} | ||
|
||
void variadic(std::vector<int> const &variadic) | ||
{ | ||
std::cout << "variadic = {"; | ||
|
||
if (!variadic.empty()) { | ||
std::cout << variadic[0]; | ||
for (std::size_t i = 1; i < variadic.size(); ++i) | ||
std::cout << ", " << variadic[i]; | ||
} | ||
|
||
std::cout << "}"; | ||
} | ||
}; | ||
|
||
S s; | ||
|
||
int main() | ||
{ | ||
fire::fire_llvm(s); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
#include <fire-llvm/fire.hpp> | ||
|
||
#include <iostream> | ||
|
||
namespace { | ||
|
||
int fire_main_default(int def = 0) | ||
int default_arg(int d = 0) | ||
{ | ||
return def; | ||
return d; | ||
} | ||
|
||
} | ||
|
||
int main() | ||
{ | ||
fire::fire_llvm(fire_main_default); | ||
fire::fire_llvm(default_arg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
#include <fire-llvm/fire.hpp> | ||
|
||
#include <iostream> | ||
|
||
namespace { | ||
|
||
void fire_main_flag(bool flag_a, bool flag_b) | ||
bool flag(bool f) | ||
{ | ||
std::cout << "flag_a = " << flag_a << ", flag_b = " << flag_b << std::endl; | ||
return f; | ||
} | ||
|
||
} | ||
|
||
int main() | ||
{ | ||
fire::fire_llvm(fire_main_flag); | ||
fire::fire_llvm(flag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters