[Lldb-commits] [lldb] [llvm][tblgen] Add `Source Filename` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits
" + sys::path::filename(Record.getInputFilename()),"
In-Reply-To: 


https://github.com/sunshaoce closed 
https://github.com/llvm/llvm-project/pull/65744
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm][tblgen] Add `Source Filename` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits
" + sys::path::filename(Record.getInputFilename()),"
In-Reply-To: 


https://github.com/sunshaoce updated 
https://github.com/llvm/llvm-project/pull/65744

>From 8fd7007fa437a0eefb66015861f76f65095c31bc Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN 
Date: Sat, 23 Sep 2023 11:38:33 +0800
Subject: [PATCH 1/3] [llvm][tblgen] Add `SourcePath` for
 `emitSourceFileHeader`

---
 llvm/include/llvm/TableGen/TableGenBackend.h | 3 ++-
 llvm/lib/TableGen/TableGenBackend.cpp| 7 ++-
 llvm/utils/TableGen/VTEmitter.cpp| 3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/TableGen/TableGenBackend.h 
b/llvm/include/llvm/TableGen/TableGenBackend.h
index 39f1e14bc950841..7bbd163b0433aca 100644
--- a/llvm/include/llvm/TableGen/TableGenBackend.h
+++ b/llvm/include/llvm/TableGen/TableGenBackend.h
@@ -50,7 +50,8 @@ template  class OptClass : Opt {
 
 /// emitSourceFileHeader - Output an LLVM style file header to the specified
 /// raw_ostream.
-void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
+void emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+  StringRef SourcePath = "");
 
 } // End llvm namespace
 
diff --git a/llvm/lib/TableGen/TableGenBackend.cpp 
b/llvm/lib/TableGen/TableGenBackend.cpp
index 705c3a17a765750..164443a347dcc53 100644
--- a/llvm/lib/TableGen/TableGenBackend.cpp
+++ b/llvm/lib/TableGen/TableGenBackend.cpp
@@ -40,7 +40,8 @@ static void printLine(raw_ostream &OS, const Twine &Prefix, 
char Fill,
   OS << Suffix << '\n';
 }
 
-void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) {
+void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+StringRef SourcePath) {
   printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\");
   StringRef Prefix("|* ");
   StringRef Suffix(" *|");
@@ -59,4 +60,8 @@ void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream 
&OS) {
   printLine(OS, Prefix, ' ', Suffix);
   printLine(OS, "\\*===", '-', "===*/");
   OS << '\n';
+
+  // Print the path of source file
+  if (!SourcePath.empty())
+OS << "// Generated from: " << SourcePath << "\n\n";
 }
diff --git a/llvm/utils/TableGen/VTEmitter.cpp 
b/llvm/utils/TableGen/VTEmitter.cpp
index d398a7e7b58f40a..03fa3d64b41fe6c 100644
--- a/llvm/utils/TableGen/VTEmitter.cpp
+++ b/llvm/utils/TableGen/VTEmitter.cpp
@@ -30,7 +30,8 @@ class VTEmitter {
 } // End anonymous namespace.
 
 void VTEmitter::run(raw_ostream &OS) {
-  emitSourceFileHeader("ValueTypes Source Fragment", OS);
+  emitSourceFileHeader("ValueTypes Source Fragment", OS,
+   Records.getInputFilename());
 
   std::array VTsByNumber = {};
   auto ValueTypes = Records.getAllDerivedDefinitions("ValueType");

>From 0d138680a7d663b8373834223cc6665dc9e3a6ba Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN 
Date: Sun, 24 Sep 2023 00:52:02 +0800
Subject: [PATCH 2/3] add more tests

---
 clang/utils/TableGen/ClangASTNodesEmitter.cpp |  4 +-
 .../TableGen/ClangASTPropertiesEmitter.cpp|  8 ++--
 clang/utils/TableGen/ClangAttrEmitter.cpp | 48 +++
 .../ClangCommentCommandInfoEmitter.cpp| 10 ++--
 ...mentHTMLNamedCharacterReferenceEmitter.cpp |  5 +-
 .../TableGen/ClangCommentHTMLTagsEmitter.cpp  |  4 +-
 .../TableGen/ClangOpenCLBuiltinEmitter.cpp|  6 +--
 clang/utils/TableGen/ClangSyntaxEmitter.cpp   |  4 +-
 .../utils/TableGen/ClangTypeNodesEmitter.cpp  |  2 +-
 lldb/utils/TableGen/LLDBOptionDefEmitter.cpp  |  2 +-
 .../utils/TableGen/LLDBPropertyDefEmitter.cpp |  4 +-
 llvm/include/llvm/TableGen/TableGenBackend.h  |  3 +-
 llvm/lib/TableGen/TableGenBackend.cpp |  6 +--
 llvm/utils/TableGen/AsmMatcherEmitter.cpp |  2 +-
 llvm/utils/TableGen/AsmWriterEmitter.cpp  |  2 +-
 llvm/utils/TableGen/VTEmitter.cpp |  3 +-
 mlir/tools/mlir-tblgen/DialectGen.cpp |  4 +-
 mlir/tools/mlir-tblgen/EnumsGen.cpp   |  4 +-
 mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp |  2 +-
 mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp   |  4 +-
 mlir/tools/mlir-tblgen/RewriterGen.cpp|  2 +-
 mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp  | 22 +
 22 files changed, 81 insertions(+), 70 deletions(-)

diff --git a/clang/utils/TableGen/ClangASTNodesEmitter.cpp 
b/clang/utils/TableGen/ClangASTNodesEmitter.cpp
index 2b8d7a9efdf10c9..16a1c74b9d91ad6 100644
--- a/clang/utils/TableGen/ClangASTNodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangASTNodesEmitter.cpp
@@ -169,7 +169,7 @@ void ClangASTNodesEmitter::deriveChildTree() {
 void ClangASTNodesEmitter::run(raw_ostream &OS) {
   deriveChildTree();
 
-  emitSourceFileHeader("List of AST nodes of a particular kind", OS);
+  emitSourceFileHeader("List of AST nodes of a particular kind", OS, Records);
 
   // Write the preamble
   OS << "#ifndef ABSTRACT_" << macroHierarchyName() << "\n";
@@ -205,7 +205,7 @@ void clang::EmitClangASTNodes(RecordKeeper &RK, raw_ostream 
&OS,
 void clang::EmitClangDeclContext(RecordKee

[Lldb-commits] [lldb] [llvm][tblgen] Add `Source Filename` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits
" + sys::path::filename(Record.getInputFilename()),"
In-Reply-To: 


https://github.com/sunshaoce edited 
https://github.com/llvm/llvm-project/pull/65744
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm][tblgen] Add `SourcePath` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits
" + sys::path::filename(Record.getInputFilename()),"
In-Reply-To: 


sunshaoce wrote:

Addressed. Thanks! Now it is
```
/*===- TableGen'erated file -*- C++ -*-===*\
|**|
|* ValueTypes Source Fragment *|
|**|
|* Automatically generated file, do not edit! *|
|* From: ValueTypes.td*|
|**|
\*===--===*/
```

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


[Lldb-commits] [lldb] [llvm][tblgen] Add `SourcePath` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits
" + sys::path::filename(Record.getInputFilename()),"
In-Reply-To: 


https://github.com/sunshaoce updated 
https://github.com/llvm/llvm-project/pull/65744

>From 23d0b738bf40ea44e159f4f8d7355d4d6bc0688d Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN 
Date: Sat, 23 Sep 2023 11:38:33 +0800
Subject: [PATCH 1/3] [llvm][tblgen] Add `SourcePath` for
 `emitSourceFileHeader`

---
 llvm/include/llvm/TableGen/TableGenBackend.h | 3 ++-
 llvm/lib/TableGen/TableGenBackend.cpp| 7 ++-
 llvm/utils/TableGen/VTEmitter.cpp| 3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/TableGen/TableGenBackend.h 
b/llvm/include/llvm/TableGen/TableGenBackend.h
index 39f1e14bc950841..7bbd163b0433aca 100644
--- a/llvm/include/llvm/TableGen/TableGenBackend.h
+++ b/llvm/include/llvm/TableGen/TableGenBackend.h
@@ -50,7 +50,8 @@ template  class OptClass : Opt {
 
 /// emitSourceFileHeader - Output an LLVM style file header to the specified
 /// raw_ostream.
-void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
+void emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+  StringRef SourcePath = "");
 
 } // End llvm namespace
 
diff --git a/llvm/lib/TableGen/TableGenBackend.cpp 
b/llvm/lib/TableGen/TableGenBackend.cpp
index 135ec643bc3a7df..a50df8dbdcfb220 100644
--- a/llvm/lib/TableGen/TableGenBackend.cpp
+++ b/llvm/lib/TableGen/TableGenBackend.cpp
@@ -40,7 +40,8 @@ static void printLine(raw_ostream &OS, const Twine &Prefix, 
char Fill,
   OS << Suffix << '\n';
 }
 
-void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) {
+void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+StringRef SourcePath) {
   printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\");
   StringRef Prefix("|* ");
   StringRef Suffix(" *|");
@@ -59,4 +60,8 @@ void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream 
&OS) {
   printLine(OS, Prefix, ' ', Suffix);
   printLine(OS, "\\*===", '-', "===*/");
   OS << '\n';
+
+  // Print the path of source file
+  if (!SourcePath.empty())
+OS << "// Generated from: " << SourcePath << "\n\n";
 }
diff --git a/llvm/utils/TableGen/VTEmitter.cpp 
b/llvm/utils/TableGen/VTEmitter.cpp
index d398a7e7b58f40a..03fa3d64b41fe6c 100644
--- a/llvm/utils/TableGen/VTEmitter.cpp
+++ b/llvm/utils/TableGen/VTEmitter.cpp
@@ -30,7 +30,8 @@ class VTEmitter {
 } // End anonymous namespace.
 
 void VTEmitter::run(raw_ostream &OS) {
-  emitSourceFileHeader("ValueTypes Source Fragment", OS);
+  emitSourceFileHeader("ValueTypes Source Fragment", OS,
+   Records.getInputFilename());
 
   std::array VTsByNumber = {};
   auto ValueTypes = Records.getAllDerivedDefinitions("ValueType");

>From d07486764071679c8cbcd5e7c4905eb41b4770b3 Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN 
Date: Sun, 24 Sep 2023 00:52:02 +0800
Subject: [PATCH 2/3] add more tests

---
 clang/utils/TableGen/ClangASTNodesEmitter.cpp |  4 +-
 .../TableGen/ClangASTPropertiesEmitter.cpp|  8 ++--
 clang/utils/TableGen/ClangAttrEmitter.cpp | 47 +++
 .../ClangCommentCommandInfoEmitter.cpp|  8 ++--
 ...mentHTMLNamedCharacterReferenceEmitter.cpp |  4 +-
 .../TableGen/ClangCommentHTMLTagsEmitter.cpp  |  5 +-
 .../TableGen/ClangOpenCLBuiltinEmitter.cpp|  6 +--
 clang/utils/TableGen/ClangSyntaxEmitter.cpp   |  4 +-
 .../utils/TableGen/ClangTypeNodesEmitter.cpp  |  2 +-
 lldb/utils/TableGen/LLDBOptionDefEmitter.cpp  |  2 +-
 .../utils/TableGen/LLDBPropertyDefEmitter.cpp |  4 +-
 llvm/include/llvm/TableGen/TableGenBackend.h  |  3 +-
 llvm/lib/TableGen/TableGenBackend.cpp |  6 +--
 llvm/utils/TableGen/AsmMatcherEmitter.cpp |  2 +-
 llvm/utils/TableGen/AsmWriterEmitter.cpp  |  2 +-
 llvm/utils/TableGen/VTEmitter.cpp |  3 +-
 mlir/tools/mlir-tblgen/DialectGen.cpp |  4 +-
 mlir/tools/mlir-tblgen/EnumsGen.cpp   |  4 +-
 mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp |  2 +-
 mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp   |  4 +-
 mlir/tools/mlir-tblgen/RewriterGen.cpp|  2 +-
 mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp  | 22 +
 22 files changed, 81 insertions(+), 67 deletions(-)

diff --git a/clang/utils/TableGen/ClangASTNodesEmitter.cpp 
b/clang/utils/TableGen/ClangASTNodesEmitter.cpp
index 2b8d7a9efdf10c9..16a1c74b9d91ad6 100644
--- a/clang/utils/TableGen/ClangASTNodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangASTNodesEmitter.cpp
@@ -169,7 +169,7 @@ void ClangASTNodesEmitter::deriveChildTree() {
 void ClangASTNodesEmitter::run(raw_ostream &OS) {
   deriveChildTree();
 
-  emitSourceFileHeader("List of AST nodes of a particular kind", OS);
+  emitSourceFileHeader("List of AST nodes of a particular kind", OS, Records);
 
   // Write the preamble
   OS << "#ifndef ABSTRACT_" << macroHierarchyName() << "\n";
@@ -205,7 +205,7 @@ void clang::EmitClangASTNodes(RecordKeeper &RK, raw_ostream 
&OS,
 void clang::EmitClangDeclContext(RecordKee

[Lldb-commits] [lldb] [llvm][tblgen] Add `SourcePath` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits

sunshaoce wrote:

I am not sure how to keep only the `llvm-project//Filename` path except by 
hard-coding. Or how to keep only the base file name? This could limit it to 
within 80 characters.

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


[Lldb-commits] [lldb] [llvm][tblgen] Add `SourcePath` for `emitSourceFileHeader` (PR #65744)

2023-09-25 Thread Shao-Ce SUN via lldb-commits

sunshaoce wrote:

> ⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️
> 
> You can test this locally with the following command:
> ```shell
> git-clang-format --diff b8b4ee6b450766796b162b4811a6b3f723d07268 
> d07486764071679c8cbcd5e7c4905eb41b4770b3 -- 
> clang/utils/TableGen/ClangASTNodesEmitter.cpp 
> clang/utils/TableGen/ClangASTPropertiesEmitter.cpp 
> clang/utils/TableGen/ClangAttrEmitter.cpp 
> clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp 
> clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp 
> clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp 
> clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp 
> clang/utils/TableGen/ClangSyntaxEmitter.cpp 
> clang/utils/TableGen/ClangTypeNodesEmitter.cpp 
> lldb/utils/TableGen/LLDBOptionDefEmitter.cpp 
> lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp 
> llvm/include/llvm/TableGen/TableGenBackend.h 
> llvm/lib/TableGen/TableGenBackend.cpp 
> llvm/utils/TableGen/AsmMatcherEmitter.cpp 
> llvm/utils/TableGen/AsmWriterEmitter.cpp llvm/utils/TableGen/VTEmitter.cpp 
> mlir/tools/mlir-tblgen/DialectGen.cpp mlir/tools/mlir-tblgen/EnumsGen.cpp 
> mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp 
> mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp 
> mlir/tools/mlir-tblgen/RewriterGen.cpp 
> mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp
> ```
> 
> View the diff from clang-format here.
> ```diff
> diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp 
> b/clang/utils/TableGen/ClangAttrEmitter.cpp
> index 6ba82a22df1e..dddc9b9896ef 100644
> --- a/clang/utils/TableGen/ClangAttrEmitter.cpp
> +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
> @@ -3170,27 +3170,27 @@ namespace clang {
>  
>  // Emits the enumeration list for attributes.
>  void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
> -  emitSourceFileHeader("List of all attributes that Clang recognizes", OS,
> -   Records);
> +emitSourceFileHeader("List of all attributes that Clang recognizes", OS,
> + Records);
>  
> -  AttrClassHierarchy Hierarchy(Records);
> +AttrClassHierarchy Hierarchy(Records);
>  
> -  // Add defaulting macro definitions.
> -  Hierarchy.emitDefaultDefines(OS);
> -  emitDefaultDefine(OS, "PRAGMA_SPELLING_ATTR", nullptr);
> +// Add defaulting macro definitions.
> +Hierarchy.emitDefaultDefines(OS);
> +emitDefaultDefine(OS, "PRAGMA_SPELLING_ATTR", nullptr);
>  
> -  std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
> -  std::vector PragmaAttrs;
> -  for (auto *Attr : Attrs) {
> -if (!Attr->getValueAsBit("ASTNode"))
> -  continue;
> +std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
> +std::vector PragmaAttrs;
> +for (auto *Attr : Attrs) {
> +  if (!Attr->getValueAsBit("ASTNode"))
> +continue;
>  
> -// Add the attribute to the ad-hoc groups.
> -if (AttrHasPragmaSpelling(Attr))
> -  PragmaAttrs.push_back(Attr);
> +  // Add the attribute to the ad-hoc groups.
> +  if (AttrHasPragmaSpelling(Attr))
> +PragmaAttrs.push_back(Attr);
>  
> -// Place it in the hierarchy.
> -Hierarchy.classifyAttr(Attr);
> +  // Place it in the hierarchy.
> +  Hierarchy.classifyAttr(Attr);
>}
>  
>// Emit the main attribute list.
> ```

Is this suggestion correct?

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


[Lldb-commits] [lldb] [llvm][tblgen] Add `SourcePath` for `emitSourceFileHeader` (PR #65744)

2023-09-23 Thread Shao-Ce SUN via lldb-commits

https://github.com/sunshaoce updated 
https://github.com/llvm/llvm-project/pull/65744

>From 23d0b738bf40ea44e159f4f8d7355d4d6bc0688d Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN 
Date: Sat, 23 Sep 2023 11:38:33 +0800
Subject: [PATCH 1/2] [llvm][tblgen] Add `SourcePath` for
 `emitSourceFileHeader`

---
 llvm/include/llvm/TableGen/TableGenBackend.h | 3 ++-
 llvm/lib/TableGen/TableGenBackend.cpp| 7 ++-
 llvm/utils/TableGen/VTEmitter.cpp| 3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/TableGen/TableGenBackend.h 
b/llvm/include/llvm/TableGen/TableGenBackend.h
index 39f1e14bc950841..7bbd163b0433aca 100644
--- a/llvm/include/llvm/TableGen/TableGenBackend.h
+++ b/llvm/include/llvm/TableGen/TableGenBackend.h
@@ -50,7 +50,8 @@ template  class OptClass : Opt {
 
 /// emitSourceFileHeader - Output an LLVM style file header to the specified
 /// raw_ostream.
-void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
+void emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+  StringRef SourcePath = "");
 
 } // End llvm namespace
 
diff --git a/llvm/lib/TableGen/TableGenBackend.cpp 
b/llvm/lib/TableGen/TableGenBackend.cpp
index 135ec643bc3a7df..a50df8dbdcfb220 100644
--- a/llvm/lib/TableGen/TableGenBackend.cpp
+++ b/llvm/lib/TableGen/TableGenBackend.cpp
@@ -40,7 +40,8 @@ static void printLine(raw_ostream &OS, const Twine &Prefix, 
char Fill,
   OS << Suffix << '\n';
 }
 
-void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS) {
+void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream &OS,
+StringRef SourcePath) {
   printLine(OS, "/*===- TableGen'erated file ", '-', "*- C++ -*-===*\\");
   StringRef Prefix("|* ");
   StringRef Suffix(" *|");
@@ -59,4 +60,8 @@ void llvm::emitSourceFileHeader(StringRef Desc, raw_ostream 
&OS) {
   printLine(OS, Prefix, ' ', Suffix);
   printLine(OS, "\\*===", '-', "===*/");
   OS << '\n';
+
+  // Print the path of source file
+  if (!SourcePath.empty())
+OS << "// Generated from: " << SourcePath << "\n\n";
 }
diff --git a/llvm/utils/TableGen/VTEmitter.cpp 
b/llvm/utils/TableGen/VTEmitter.cpp
index d398a7e7b58f40a..03fa3d64b41fe6c 100644
--- a/llvm/utils/TableGen/VTEmitter.cpp
+++ b/llvm/utils/TableGen/VTEmitter.cpp
@@ -30,7 +30,8 @@ class VTEmitter {
 } // End anonymous namespace.
 
 void VTEmitter::run(raw_ostream &OS) {
-  emitSourceFileHeader("ValueTypes Source Fragment", OS);
+  emitSourceFileHeader("ValueTypes Source Fragment", OS,
+   Records.getInputFilename());
 
   std::array VTsByNumber = {};
   auto ValueTypes = Records.getAllDerivedDefinitions("ValueType");

>From d07486764071679c8cbcd5e7c4905eb41b4770b3 Mon Sep 17 00:00:00 2001
From: Shao-Ce SUN 
Date: Sun, 24 Sep 2023 00:52:02 +0800
Subject: [PATCH 2/2] add more tests

---
 clang/utils/TableGen/ClangASTNodesEmitter.cpp |  4 +-
 .../TableGen/ClangASTPropertiesEmitter.cpp|  8 ++--
 clang/utils/TableGen/ClangAttrEmitter.cpp | 47 +++
 .../ClangCommentCommandInfoEmitter.cpp|  8 ++--
 ...mentHTMLNamedCharacterReferenceEmitter.cpp |  4 +-
 .../TableGen/ClangCommentHTMLTagsEmitter.cpp  |  5 +-
 .../TableGen/ClangOpenCLBuiltinEmitter.cpp|  6 +--
 clang/utils/TableGen/ClangSyntaxEmitter.cpp   |  4 +-
 .../utils/TableGen/ClangTypeNodesEmitter.cpp  |  2 +-
 lldb/utils/TableGen/LLDBOptionDefEmitter.cpp  |  2 +-
 .../utils/TableGen/LLDBPropertyDefEmitter.cpp |  4 +-
 llvm/include/llvm/TableGen/TableGenBackend.h  |  3 +-
 llvm/lib/TableGen/TableGenBackend.cpp |  6 +--
 llvm/utils/TableGen/AsmMatcherEmitter.cpp |  2 +-
 llvm/utils/TableGen/AsmWriterEmitter.cpp  |  2 +-
 llvm/utils/TableGen/VTEmitter.cpp |  3 +-
 mlir/tools/mlir-tblgen/DialectGen.cpp |  4 +-
 mlir/tools/mlir-tblgen/EnumsGen.cpp   |  4 +-
 mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp |  2 +-
 mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp   |  4 +-
 mlir/tools/mlir-tblgen/RewriterGen.cpp|  2 +-
 mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp  | 22 +
 22 files changed, 81 insertions(+), 67 deletions(-)

diff --git a/clang/utils/TableGen/ClangASTNodesEmitter.cpp 
b/clang/utils/TableGen/ClangASTNodesEmitter.cpp
index 2b8d7a9efdf10c9..16a1c74b9d91ad6 100644
--- a/clang/utils/TableGen/ClangASTNodesEmitter.cpp
+++ b/clang/utils/TableGen/ClangASTNodesEmitter.cpp
@@ -169,7 +169,7 @@ void ClangASTNodesEmitter::deriveChildTree() {
 void ClangASTNodesEmitter::run(raw_ostream &OS) {
   deriveChildTree();
 
-  emitSourceFileHeader("List of AST nodes of a particular kind", OS);
+  emitSourceFileHeader("List of AST nodes of a particular kind", OS, Records);
 
   // Write the preamble
   OS << "#ifndef ABSTRACT_" << macroHierarchyName() << "\n";
@@ -205,7 +205,7 @@ void clang::EmitClangASTNodes(RecordKeeper &RK, raw_ostream 
&OS,
 void clang::EmitClangDeclContext(RecordKeeper &Records, raw_ostream &OS) {
   // FIXME: Find a .td file format

[Lldb-commits] [lldb] 7c704c0 - [NFC] fix a typo

2021-10-14 Thread Shao-Ce SUN via lldb-commits

Author: Shao-Ce SUN
Date: 2021-10-15T14:51:49+08:00
New Revision: 7c704c0f53bd7f785ec99fc6bedd71569816a28c

URL: 
https://github.com/llvm/llvm-project/commit/7c704c0f53bd7f785ec99fc6bedd71569816a28c
DIFF: 
https://github.com/llvm/llvm-project/commit/7c704c0f53bd7f785ec99fc6bedd71569816a28c.diff

LOG: [NFC] fix a typo

Added: 


Modified: 
lldb/bindings/interface/SBSymbolContextList.i
lldb/test/API/python_api/target/TestTargetAPI.py
llvm/tools/llvm-mca/CodeRegionGenerator.cpp

Removed: 




diff  --git a/lldb/bindings/interface/SBSymbolContextList.i 
b/lldb/bindings/interface/SBSymbolContextList.i
index e9d4aa8d62db..14566b3e3720 100644
--- a/lldb/bindings/interface/SBSymbolContextList.i
+++ b/lldb/bindings/interface/SBSymbolContextList.i
@@ -14,7 +14,7 @@ namespace lldb {
 For example (from test/python_api/target/TestTargetAPI.py), ::
 
 def find_functions(self, exe_name):
-'''Exercise SBTaget.FindFunctions() API.'''
+'''Exercise SBTarget.FindFunctions() API.'''
 exe = os.path.join(os.getcwd(), exe_name)
 
 # Create a target by the debugger.

diff  --git a/lldb/test/API/python_api/target/TestTargetAPI.py 
b/lldb/test/API/python_api/target/TestTargetAPI.py
index 29e368224e81..0503aa8e4369 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -207,7 +207,7 @@ def find_data_section(self, target):
 return data_section
 
 def find_global_variables(self, exe_name):
-"""Exercise SBTaget.FindGlobalVariables() API."""
+"""Exercise SBTarget.FindGlobalVariables() API."""
 exe = self.getBuildArtifact(exe_name)
 
 # Create a target by the debugger.
@@ -272,7 +272,7 @@ def find_compile_units(self, exe):
 list[0].GetCompileUnit().GetFileSpec().GetFilename(), source_name)
 
 def find_functions(self, exe_name):
-"""Exercise SBTaget.FindFunctions() API."""
+"""Exercise SBTarget.FindFunctions() API."""
 exe = self.getBuildArtifact(exe_name)
 
 # Create a target by the debugger.
@@ -292,7 +292,7 @@ def find_functions(self, exe_name):
 self.assertEqual(sc.GetSymbol().GetName(), 'c')
 
 def get_description(self):
-"""Exercise SBTaget.GetDescription() API."""
+"""Exercise SBTarget.GetDescription() API."""
 exe = self.getBuildArtifact("a.out")
 
 # Create a target by the debugger.
@@ -321,7 +321,7 @@ def get_description(self):
 @skipIfRemote
 @no_debug_info_test
 def test_launch_new_process_and_redirect_stdout(self):
-"""Exercise SBTaget.Launch() API with redirected stdout."""
+"""Exercise SBTarget.Launch() API with redirected stdout."""
 self.build()
 exe = self.getBuildArtifact("a.out")
 
@@ -380,7 +380,7 @@ def test_launch_new_process_and_redirect_stdout(self):
 substrs=["a(1)", "b(2)", "a(3)"])
 
 def resolve_symbol_context_with_address(self):
-"""Exercise SBTaget.ResolveSymbolContextForAddress() API."""
+"""Exercise SBTarget.ResolveSymbolContextForAddress() API."""
 exe = self.getBuildArtifact("a.out")
 
 # Create a target by the debugger.

diff  --git a/llvm/tools/llvm-mca/CodeRegionGenerator.cpp 
b/llvm/tools/llvm-mca/CodeRegionGenerator.cpp
index 6ad2a65592b9..6cdd0ba797aa 100644
--- a/llvm/tools/llvm-mca/CodeRegionGenerator.cpp
+++ b/llvm/tools/llvm-mca/CodeRegionGenerator.cpp
@@ -114,7 +114,7 @@ Expected 
AsmCodeRegionGenerator::parseCodeRegions(
 
   // Need to initialize an MCTargetStreamer otherwise
   // certain asm directives will cause a segfault.
-  // Using nulls() so that anything emitted by the MCTagetStreamer
+  // Using nulls() so that anything emitted by the MCTargetStreamer
   // doesn't show up in the llvm-mca output.
   raw_ostream &OSRef = nulls();
   formatted_raw_ostream FOSRef(OSRef);



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits