[lldb-instr] Group RECORD macros

Group LLDB_RECORD macros per input file.

llvm-svn: 354423
This commit is contained in:
Jonas Devlieghere 2019-02-20 01:49:10 +00:00
parent 20332cc4ea
commit b7c22314c3
2 changed files with 13 additions and 4 deletions

View File

@ -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: }

View File

@ -104,8 +104,7 @@ static std::string GetRegisterConstructorMacro(StringRef Class,
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 ASTFrontendAction {
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());
}