Refactor the clang invocations to make them more uniform and robust:
* make sure that we correctly retain the exit code from clang and fail tests on
errors
* unify the clang invocations into one, so that we can share the command line
configuration
* fix the command line to correctly use the clang binary name as the first
entry and replace the faulty `--syntax-only` with `-fsyntax-only`
PiperOrigin-RevId: 402220726
diff --git a/rs_bindings_from_cc/ir_from_cc.h b/rs_bindings_from_cc/ir_from_cc.h
index 5e6c8c7..19834c6 100644
--- a/rs_bindings_from_cc/ir_from_cc.h
+++ b/rs_bindings_from_cc/ir_from_cc.h
@@ -8,13 +8,24 @@
#include <vector>
#include "rs_bindings_from_cc/ir.h"
+#include "third_party/absl/status/statusor.h"
#include "third_party/absl/strings/string_view.h"
#include "third_party/absl/types/span.h"
namespace rs_bindings_from_cc {
-IR IrFromCc(absl::Span<const absl::string_view> header_files_contents,
- const std::vector<absl::string_view>& args);
+/// Parses C++ source code into IR.
+///
+/// Parameters:
+/// * `header_file_contents`: textual C++ source code to be parsed directly
+/// * `header_names`: names of headers to include from the file system before
+/// the textual source
+/// * `args`: additional command line arguments for Clang
+///
+absl::StatusOr<IR> IrFromCc(
+ absl::Span<const absl::string_view> header_files_contents,
+ absl::Span<const absl::string_view> header_names = {},
+ absl::Span<const absl::string_view> args = {});
} // namespace rs_bindings_from_cc