summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-02-19 23:13:29 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-02-19 23:13:29 +0000
commitee04d4d840374028e8f791738c652ea353a39d45 (patch)
treebcc201e4e6c86e34a01a73316e71c6dcf5b92b69 /lldb
parent92756a80e7ae7b0ce682d84e8576e885e7e4ccb1 (diff)
downloadbcm5719-llvm-ee04d4d840374028e8f791738c652ea353a39d45.tar.gz
bcm5719-llvm-ee04d4d840374028e8f791738c652ea353a39d45.zip
[lldb-instr] Don't print REGISTER macro when RECORD is already present
Currently we'd always print the LLDB_REGISTER macro, even if the LLDB_RECORD macro was already present. This patches changes that to make it easier to incrementally update the macros. Note that it's still possible for the RECORD and REGISTER macros to get out of sync. llvm-svn: 354400
Diffstat (limited to 'lldb')
-rw-r--r--lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test1
-rw-r--r--lldb/tools/lldb-instr/Instrument.cpp17
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
OpenPOWER on IntegriCloud