Skip to content

Commit 9a25905

Browse files
committed
Pass the package name directly to the IR constructor
1 parent 16755cb commit 9a25905

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

bindgen/Main.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ int main(int argc, char *argv[]) {
4949

5050
locations.clear();
5151

52-
IR ir(libName);
53-
if (!Package.empty()) {
54-
ir.setPackageName(Package.getValue());
55-
}
56-
52+
IR ir(libName, Package.getValue());
5753
ScalaFrontendActionFactory actionFactory(ir);
5854

5955
int result = Tool.run(&actionFactory);

bindgen/ir/IR.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "IR.h"
22
#include "../Utils.h"
33

4-
IR::IR(std::string libName) : libName(std::move(libName)) {
4+
IR::IR(std::string libName, std::string packageName)
5+
: libName(std::move(libName)), packageName(packageName) {
56
if (this->libName == "native") {
67
/* there are at most 3 objects in the file.
78
* All of them will have distinct names. */
@@ -207,10 +208,6 @@ bool IR::typeIsUsedOnlyInTypeDefs(std::string type) {
207208
isTypeUsed(unions, type));
208209
}
209210

210-
void IR::setPackageName(std::string packageName) {
211-
this->packageName = std::move(packageName);
212-
}
213-
214211
void IR::setScalaNames() {
215212
/* Renaming according to Scala naming conventions
216213
* should happen here */

bindgen/ir/IR.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class IR {
1313
public:
14-
explicit IR(std::string libName);
14+
explicit IR(std::string libName, std::string packageName);
1515

1616
void addFunction(std::string name, std::vector<Parameter> parameters,
1717
std::string, bool isVariadic);
@@ -39,8 +39,6 @@ class IR {
3939

4040
void generate(const std::string &excludePrefix);
4141

42-
void setPackageName(std::string packageName);
43-
4442
private:
4543
/**
4644
* Generates type defs for enums, structs and unions

0 commit comments

Comments
 (0)