[Lldb-commits] [lldb] r354423 - [lldb-instr] Group RECORD macros

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 19 17:49:10 PST 2019


Author: jdevlieghere
Date: Tue Feb 19 17:49:10 2019
New Revision: 354423

URL: http://llvm.org/viewvc/llvm-project?rev=354423&view=rev
Log:
[lldb-instr] Group RECORD macros

Group LLDB_RECORD macros per input file.

Modified:
    lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
    lldb/trunk/tools/lldb-instr/Instrument.cpp

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test?rev=354423&r1=354422&r2=354423&view=diff
==============================================================================
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test Tue Feb 19 17:49:10 2019
@@ -4,6 +4,7 @@
 
 # RUN: lldb-instr %t.dir/foo.cpp | FileCheck %s
 
+# CHECK: {
 # CHECK: LLDB_REGISTER_METHOD(void, Foo, A, ());
 # CHECK: LLDB_REGISTER_METHOD(void, Foo, B, (int));
 # CHECK: LLDB_REGISTER_METHOD(int, Foo, C, (int));
@@ -12,3 +13,4 @@
 # CHECK: LLDB_REGISTER_STATIC_METHOD(int, Foo, F, (int));
 # CHECK-NOT: LLDB_REGISTER_STATIC_METHOD(void, Foo, G
 # CHECK-NOT: LLDB_REGISTER_METHOD_CONST(void, Foo, I, ());
+# CHECK: }

Modified: lldb/trunk/tools/lldb-instr/Instrument.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/Instrument.cpp?rev=354423&r1=354422&r2=354423&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-instr/Instrument.cpp (original)
+++ lldb/trunk/tools/lldb-instr/Instrument.cpp Tue Feb 19 17:49:10 2019
@@ -104,8 +104,7 @@ static std::string GetRegisterConstructo
                                                StringRef Signature) {
   std::string Macro;
   llvm::raw_string_ostream OS(Macro);
-  OS << "LLDB_REGISTER_CONSTRUCTOR(" << Class << ", (" << Signature
-     << "));\n\n";
+  OS << "LLDB_REGISTER_CONSTRUCTOR(" << Class << ", (" << Signature << "));\n";
   return OS.str();
 }
 
@@ -305,10 +304,18 @@ class SBAction : public ASTFrontendActio
 public:
   SBAction() = default;
 
-  void EndSourceFileAction() override { MyRewriter.overwriteChangedFiles(); }
+  bool BeginSourceFileAction(CompilerInstance &CI) override {
+    llvm::outs() << "{\n";
+    return true;
+  }
+
+  void EndSourceFileAction() override {
+    llvm::outs() << "}\n";
+    MyRewriter.overwriteChangedFiles();
+  }
 
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
-                                                 StringRef file) override {
+                                                 StringRef File) override {
     MyRewriter.setSourceMgr(CI.getSourceManager(), CI.getLangOpts());
     return llvm::make_unique<SBConsumer>(MyRewriter, CI.getASTContext());
   }




More information about the lldb-commits mailing list