================
@@ -0,0 +1,45 @@
+//===- LLDBPropertyDefEmitter.cpp 
-----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Produce the list of source languages header file fragment for the SBAPI. 
+//
+//===----------------------------------------------------------------------===//
+
+#include <fstream>
+#include <llvm/ADT/StringRef.h>
+namespace lldb_private {
+int EmitSBAPIDWARFEnum(int argc, char **argv) {
+  std::string InputFilename;
+  std::string OutputFilename;
+  std::string DepFilename;
+  // This command line option parser is as robust as the worst shell script.
+  for (int i = 0; i < argc; ++i) {
+    if (llvm::StringRef(argv[i]).ends_with("Dwarf.def"))
+      InputFilename = std::string(argv[i]);
+    if (llvm::StringRef(argv[i]) == "-o" && i + 1 < argc)
+      OutputFilename = std::string(argv[i + 1]);
+    if (llvm::StringRef(argv[i]) == "-d" && i + 1 < argc)
+      DepFilename = std::string(argv[i + 1]);
+  }
+  std::ifstream input(InputFilename);
+  std::ofstream output(OutputFilename);
+  output << "// Do not include this file directly.\n";
+  output << "#ifndef HANDLE_DW_LNAME\n";
+  output << "#error \"Missing macro definition\"\n";
+  output << "#endif\n";
+  std::string line;
+  while (std::getline(input, line)) {
+    if (llvm::StringRef(line).starts_with("HANDLE_DW_LNAME"))
+      output << line << '\n';
+  }
+  output << "#undef HANDLE_DW_LNAME\n";
----------------
JDevlieghere wrote:

Why not generate `SBSourceLanguageName` directly? It seems tedious that you 
would have to run the preprocessor on the LLDB headers. Does that even work for 
SWIG?

https://github.com/llvm/llvm-project/pull/89981
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to