Skip to content

Commit a0a616b

Browse files
committed
Remove HeaderManager and locations
1 parent 919c4be commit a0a616b

File tree

7 files changed

+4
-91
lines changed

7 files changed

+4
-91
lines changed

bindgen/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ add_executable(bindgen
3636
defines/DefineFinderActionFactory.h
3737
TypeTranslator.h
3838
TypeTranslator.cpp
39-
HeaderManager.h
40-
HeaderManager.cpp
4139
CycleDetection.h
4240
Utils.h
4341
ir/IR.h

bindgen/HeaderManager.cpp

Lines changed: 0 additions & 32 deletions
This file was deleted.

bindgen/HeaderManager.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

bindgen/Main.cpp

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,7 @@ int main(int argc, const char *argv[]) {
1111

1212
llvm::cl::opt<std::string> LibName("name", llvm::cl::cat(Category),
1313
llvm::cl::desc("Library name"));
14-
llvm::cl::opt<std::string> StdHeaders(
15-
"std-headers", llvm::cl::cat(Category),
16-
llvm::cl::desc("Path to a file with the list of headers for which "
17-
"bindings\n"
18-
"will not be generated. "
19-
"The list contains header files names\n"
20-
"and package names that contain bindings for these "
21-
"headers.\nExample:\n"
22-
"math.h=scala.scalanative.native.math\n"
23-
"stdlib.h=scala.scalanative.native.stdlib"));
24-
llvm::cl::opt<bool> PrintHeadersLocation(
25-
"location", llvm::cl::cat(Category),
26-
llvm::cl::desc("Print list of parsed headers"));
14+
2715
llvm::cl::opt<std::string> ExcludePrefix(
2816
"exclude-prefix", llvm::cl::cat(Category),
2917
llvm::cl::desc("Functions and unused typedefs will be removed if their "
@@ -64,13 +52,6 @@ int main(int argc, const char *argv[]) {
6452
objectName = "nativeLib";
6553
}
6654

67-
auto stdhead = StdHeaders.getValue();
68-
if (!stdhead.empty()) {
69-
headerMan.LoadConfig(stdhead);
70-
}
71-
72-
locations.clear();
73-
7455
IR ir(libName, linkName, objectName, Package.getValue());
7556

7657
DefineFinderActionFactory defineFinderActionFactory(ir);
@@ -87,15 +68,8 @@ int main(int argc, const char *argv[]) {
8768
ScalaFrontendActionFactory actionFactory(ir, locationManager);
8869
result = Tool.run(&actionFactory);
8970

90-
auto printLoc = PrintHeadersLocation.getValue();
91-
if (printLoc) {
92-
for (const auto &location : locations) {
93-
llvm::outs() << location.c_str();
94-
}
95-
} else {
96-
ir.generate(ExcludePrefix.getValue());
97-
llvm::outs() << ir;
98-
}
71+
ir.generate(ExcludePrefix.getValue());
72+
llvm::outs() << ir;
9973
llvm::outs().flush();
10074
return result;
10175
}

bindgen/visitor/TreeConsumer.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ class TreeConsumer : public clang::ASTConsumer {
2020
// a DeclGroupRef may have multiple Decls, so we iterate through each
2121
// one
2222
for (auto D : DG) {
23-
std::string fpath = smanager.getFilename(D->getLocation()).str();
24-
25-
if (!headerMan.IsStandard(basename(fpath)) && !fpath.empty()) {
26-
locations.insert(basename(fpath) + "\n");
27-
visitor.TraverseDecl(D);
28-
}
23+
visitor.TraverseDecl(D);
2924
}
3025
return true;
3126
}

bindgen/visitor/TreeVisitor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "TreeVisitor.h"
22

3-
HeaderManager headerMan;
4-
53
std::set<std::string> locations;
64

75
bool TreeVisitor::VisitFunctionDecl(clang::FunctionDecl *func) {

bindgen/visitor/TreeVisitor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
#pragma once
22

33
#include "../CycleDetection.h"
4-
#include "../HeaderManager.h"
54
#include "../TypeTranslator.h"
65
#include "../ir/IR.h"
76
#include "../ir/location/LocationManager.h"
87
#include <clang/AST/RecursiveASTVisitor.h>
98
#include <clang/Frontend/CompilerInstance.h>
109

11-
extern HeaderManager headerMan;
12-
13-
extern std::set<std::string> locations;
14-
1510
class TreeVisitor : public clang::RecursiveASTVisitor<TreeVisitor> {
1611
private:
1712
clang::ASTContext *astContext;

0 commit comments

Comments
 (0)