diff options
-rw-r--r-- | lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test | 1 | ||||
-rw-r--r-- | lldb/tools/lldb-instr/Instrument.cpp | 17 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test b/lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test index baf737be22b..47672213490 100644 --- a/lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test +++ b/lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test @@ -11,3 +11,4 @@ # CHECK: LLDB_REGISTER_STATIC_METHOD(void, Foo, E, ()); # 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, ()); diff --git a/lldb/tools/lldb-instr/Instrument.cpp b/lldb/tools/lldb-instr/Instrument.cpp index 06a34cee556..3a5df4bf91a 100644 --- a/lldb/tools/lldb-instr/Instrument.cpp +++ b/lldb/tools/lldb-instr/Instrument.cpp @@ -158,6 +158,15 @@ public: if (ShouldSkip(Decl)) return false; + // Skip CXXMethodDecls that already starts with a macro. This should make + // it easier to rerun the tool to find missing macros. + Stmt *Body = Decl->getBody(); + for (auto &C : Body->children()) { + if (C->getBeginLoc().isMacroID()) + return false; + break; + } + // Print 'bool' instead of '_Bool'. PrintingPolicy Policy(Context.getLangOpts()); Policy.Bool = true; @@ -209,14 +218,6 @@ public: Decl->isStatic(), Decl->isConst()); } - // If this CXXMethodDecl already starts with a macro we're done. - Stmt *Body = Decl->getBody(); - for (auto &C : Body->children()) { - if (C->getBeginLoc().isMacroID()) - return false; - break; - } - // Insert the macro at the beginning of the function. We don't attempt to // fix the formatting and instead rely on clang-format to fix it after the // tool has run. This is also the reason that the macros end with two |