[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 26 15:59:39 PDT 2024
================
@@ -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";
----------------
adrian-prantl wrote:
@JDevlieghere Can you take another look? Now we're even generating Doxygen comments!
https://github.com/llvm/llvm-project/pull/89981
More information about the lldb-commits
mailing list