Move `FunctionTemplateDeclImporter` to its own file.
PiperOrigin-RevId: 444185887
diff --git a/rs_bindings_from_cc/BUILD b/rs_bindings_from_cc/BUILD
index 3e709f0..40837d0 100644
--- a/rs_bindings_from_cc/BUILD
+++ b/rs_bindings_from_cc/BUILD
@@ -166,6 +166,7 @@
"//rs_bindings_from_cc/importers:class_template",
"//rs_bindings_from_cc/importers:cxx_record",
"//rs_bindings_from_cc/importers:enum",
+ "//rs_bindings_from_cc/importers:function_template",
"@absl//container:flat_hash_map",
"@absl//container:flat_hash_set",
"@absl//status",
diff --git a/rs_bindings_from_cc/importer.cc b/rs_bindings_from_cc/importer.cc
index 275a9e7..166e88a 100644
--- a/rs_bindings_from_cc/importer.cc
+++ b/rs_bindings_from_cc/importer.cc
@@ -444,12 +444,6 @@
};
}
-std::optional<IR::Item> FunctionTemplateDeclImporter::Import(
- clang::FunctionTemplateDecl* function_template_decl) {
- return ictx_.ImportUnsupportedItem(
- function_template_decl, "Function templates are not supported yet");
-}
-
std::optional<IR::Item> FunctionDeclImporter::Import(
clang::FunctionDecl* function_decl) {
if (!ictx_.IsFromCurrentTarget(function_decl)) return std::nullopt;
diff --git a/rs_bindings_from_cc/importer.h b/rs_bindings_from_cc/importer.h
index 37d89e8..9fba8d1 100644
--- a/rs_bindings_from_cc/importer.h
+++ b/rs_bindings_from_cc/importer.h
@@ -16,6 +16,7 @@
#include "rs_bindings_from_cc/importers/class_template.h"
#include "rs_bindings_from_cc/importers/cxx_record.h"
#include "rs_bindings_from_cc/importers/enum.h"
+#include "rs_bindings_from_cc/importers/function_template.h"
#include "rs_bindings_from_cc/ir.h"
#include "third_party/llvm/llvm-project/clang/include/clang/AST/DeclCXX.h"
#include "third_party/llvm/llvm-project/clang/include/clang/AST/Mangle.h"
@@ -24,15 +25,6 @@
// TODO(forster): Move those implementations into separate files.
-// A `DeclImporter` for `FunctionTemplateDecl`s.
-class FunctionTemplateDeclImporter
- : public DeclImporterBase<clang::FunctionTemplateDecl> {
- public:
- FunctionTemplateDeclImporter(ImportContext& context)
- : DeclImporterBase(context){};
- std::optional<IR::Item> Import(clang::FunctionTemplateDecl*);
-};
-
// A `DeclImporter` for `FunctionDecl`s.
class FunctionDeclImporter : public DeclImporterBase<clang::FunctionDecl> {
public:
diff --git a/rs_bindings_from_cc/importers/BUILD b/rs_bindings_from_cc/importers/BUILD
index 153299f..a9ec25e 100644
--- a/rs_bindings_from_cc/importers/BUILD
+++ b/rs_bindings_from_cc/importers/BUILD
@@ -33,3 +33,13 @@
"@llvm///clang:ast",
],
)
+
+cc_library(
+ name = "function_template",
+ srcs = ["function_template.cc"],
+ hdrs = ["function_template.h"],
+ deps = [
+ "//rs_bindings_from_cc:decl_importer",
+ "@llvm///clang:ast",
+ ],
+)
diff --git a/rs_bindings_from_cc/importers/function_template.cc b/rs_bindings_from_cc/importers/function_template.cc
new file mode 100644
index 0000000..bedff79
--- /dev/null
+++ b/rs_bindings_from_cc/importers/function_template.cc
@@ -0,0 +1,15 @@
+// Part of the Crubit project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#include "rs_bindings_from_cc/importers/function_template.h"
+
+namespace crubit {
+
+std::optional<IR::Item> FunctionTemplateDeclImporter::Import(
+ clang::FunctionTemplateDecl* function_template_decl) {
+ return ictx_.ImportUnsupportedItem(
+ function_template_decl, "Function templates are not supported yet");
+}
+
+} // namespace crubit
diff --git a/rs_bindings_from_cc/importers/function_template.h b/rs_bindings_from_cc/importers/function_template.h
new file mode 100644
index 0000000..84e1664
--- /dev/null
+++ b/rs_bindings_from_cc/importers/function_template.h
@@ -0,0 +1,23 @@
+// Part of the Crubit project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+#ifndef CRUBIT_RS_BINDINGS_FROM_CC_IMPORTERS_FUNCTION_TEMPLATE_H_
+#define CRUBIT_RS_BINDINGS_FROM_CC_IMPORTERS_FUNCTION_TEMPLATE_H_
+
+#include "rs_bindings_from_cc/decl_importer.h"
+#include "third_party/llvm/llvm-project/clang/include/clang/AST/DeclTemplate.h"
+
+namespace crubit {
+
+// A `DeclImporter` for `FunctionTemplateDecl`s.
+class FunctionTemplateDeclImporter
+ : public DeclImporterBase<clang::FunctionTemplateDecl> {
+ public:
+ FunctionTemplateDeclImporter(ImportContext& context)
+ : DeclImporterBase(context) {}
+ std::optional<IR::Item> Import(clang::FunctionTemplateDecl*);
+};
+
+} // namespace crubit
+#endif // CRUBIT_RS_BINDINGS_FROM_CC_IMPORTERS_FUNCTION_TEMPLATE_H_