diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-16 14:35:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-17 08:18:00 +0200 |
commit | ff55ad1aceb10b900254c8ad3629775b7789d60a (patch) | |
tree | b40fa0a185f0110967b2ffcf2e5038a4341a7a00 | |
parent | 47a774fbef8c224e4853de3fdd0230b9442bb716 (diff) |
simplify sharedplugin PostTraverse calls
(*) nobody is using the bool parameter, so drop it
(*) nobody is using the "return false to permanently disable the
plugin", and that is a dangerous footgun, so drop it
Change-Id: I75c1fbd022ffb8aba7237568ce048031bbc31a5d
Reviewed-on: https://gerrit.libreoffice.org/75726
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | compilerplugins/clang/dbgunhandledexception.cxx | 8 | ||||
-rw-r--r-- | compilerplugins/clang/sharedvisitor/generator.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/sharedvisitor/sharedvisitor.cxx | 15 | ||||
-rw-r--r-- | compilerplugins/clang/unicodetochar.cxx | 15 | ||||
-rw-r--r-- | compilerplugins/clang/unreffun.cxx | 5 |
5 files changed, 17 insertions, 30 deletions
diff --git a/compilerplugins/clang/dbgunhandledexception.cxx b/compilerplugins/clang/dbgunhandledexception.cxx index 81d6126fb3af..0b0cb41edc2e 100644 --- a/compilerplugins/clang/dbgunhandledexception.cxx +++ b/compilerplugins/clang/dbgunhandledexception.cxx @@ -34,7 +34,7 @@ public: bool VisitCallExpr(CallExpr const* call); bool TraverseCXXCatchStmt(CXXCatchStmt*); bool PreTraverseCXXCatchStmt(CXXCatchStmt*); - bool PostTraverseCXXCatchStmt(CXXCatchStmt*, bool traverseOk); + void PostTraverseCXXCatchStmt(CXXCatchStmt*); private: std::stack<CXXCatchStmt const*> currCatchStmt; @@ -56,11 +56,10 @@ bool DbgUnhandledException::PreTraverseCXXCatchStmt(CXXCatchStmt* catchStmt) return true; } -bool DbgUnhandledException::PostTraverseCXXCatchStmt(CXXCatchStmt* catchStmt, bool) +void DbgUnhandledException::PostTraverseCXXCatchStmt(CXXCatchStmt* catchStmt) { assert(currCatchStmt.top() == catchStmt); currCatchStmt.pop(); - return true; } bool DbgUnhandledException::TraverseCXXCatchStmt(CXXCatchStmt* catchStmt) @@ -68,8 +67,7 @@ bool DbgUnhandledException::TraverseCXXCatchStmt(CXXCatchStmt* catchStmt) if (!PreTraverseCXXCatchStmt(catchStmt)) return false; bool ret = RecursiveASTVisitor::TraverseCXXCatchStmt(catchStmt); - if (!PostTraverseCXXCatchStmt(catchStmt, ret)) - return false; + PostTraverseCXXCatchStmt(catchStmt); return ret; } diff --git a/compilerplugins/clang/sharedvisitor/generator.cxx b/compilerplugins/clang/sharedvisitor/generator.cxx index b12939516d16..3eeb74b26c77 100644 --- a/compilerplugins/clang/sharedvisitor/generator.cxx +++ b/compilerplugins/clang/sharedvisitor/generator.cxx @@ -318,9 +318,7 @@ void generateVisitor( PluginType type ) output << " if( " << plugin.variableName << " != nullptr "; output << ")\n"; output << " {\n"; - output << " if( !" << plugin.variableName << "->Post" << traverse.name << "( arg, ret ))\n"; - // This will disable the plugin for the rest of the run. - output << " save" << plugin.className << " = nullptr;\n"; + output << " " << plugin.variableName << "->Post" << traverse.name << "( arg );\n"; output << " }\n"; } output << " " << plugin.variableName << " = save" << plugin.className << ";\n"; diff --git a/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx b/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx index f746fd9b070f..ed07569f5431 100644 --- a/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx +++ b/compilerplugins/clang/sharedvisitor/sharedvisitor.cxx @@ -1008,8 +1008,7 @@ public: bool ret = RecursiveASTVisitor::TraverseCStyleCastExpr( arg ); if( unicodeToChar != nullptr ) { - if( !unicodeToChar->PostTraverseCStyleCastExpr( arg, ret )) - saveUnicodeToChar = nullptr; + unicodeToChar->PostTraverseCStyleCastExpr( arg ); } unicodeToChar = saveUnicodeToChar; return ret; @@ -1037,8 +1036,7 @@ public: bool ret = RecursiveASTVisitor::TraverseCXXCatchStmt( arg ); if( dbgUnhandledException != nullptr ) { - if( !dbgUnhandledException->PostTraverseCXXCatchStmt( arg, ret )) - saveDbgUnhandledException = nullptr; + dbgUnhandledException->PostTraverseCXXCatchStmt( arg ); } dbgUnhandledException = saveDbgUnhandledException; return ret; @@ -1054,8 +1052,7 @@ public: bool ret = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr( arg ); if( unicodeToChar != nullptr ) { - if( !unicodeToChar->PostTraverseCXXFunctionalCastExpr( arg, ret )) - saveUnicodeToChar = nullptr; + unicodeToChar->PostTraverseCXXFunctionalCastExpr( arg ); } unicodeToChar = saveUnicodeToChar; return ret; @@ -1071,8 +1068,7 @@ public: bool ret = RecursiveASTVisitor::TraverseCXXStaticCastExpr( arg ); if( unicodeToChar != nullptr ) { - if( !unicodeToChar->PostTraverseCXXStaticCastExpr( arg, ret )) - saveUnicodeToChar = nullptr; + unicodeToChar->PostTraverseCXXStaticCastExpr( arg ); } unicodeToChar = saveUnicodeToChar; return ret; @@ -1088,8 +1084,7 @@ public: bool ret = RecursiveASTVisitor::TraverseFriendDecl( arg ); if( unrefFun != nullptr ) { - if( !unrefFun->PostTraverseFriendDecl( arg, ret )) - saveUnrefFun = nullptr; + unrefFun->PostTraverseFriendDecl( arg ); } unrefFun = saveUnrefFun; return ret; diff --git a/compilerplugins/clang/unicodetochar.cxx b/compilerplugins/clang/unicodetochar.cxx index 3599d3081a9f..17f4795495ad 100644 --- a/compilerplugins/clang/unicodetochar.cxx +++ b/compilerplugins/clang/unicodetochar.cxx @@ -30,14 +30,13 @@ public: subExprs_.push(expr->getSubExpr()); return true; } - bool PostTraverseCStyleCastExpr(CStyleCastExpr *, bool ) { + void PostTraverseCStyleCastExpr(CStyleCastExpr *) { subExprs_.pop(); - return true; } bool TraverseCStyleCastExpr(CStyleCastExpr * expr) { PreTraverseCStyleCastExpr(expr); bool ret = RecursiveASTVisitor::TraverseCStyleCastExpr(expr); - PostTraverseCStyleCastExpr(expr, ret); + PostTraverseCStyleCastExpr(expr); return ret; } @@ -45,14 +44,13 @@ public: subExprs_.push(expr->getSubExpr()); return true; } - bool PostTraverseCXXStaticCastExpr(CXXStaticCastExpr *, bool) { + void PostTraverseCXXStaticCastExpr(CXXStaticCastExpr *) { subExprs_.pop(); - return true; } bool TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr) { PreTraverseCXXStaticCastExpr(expr); bool ret = RecursiveASTVisitor::TraverseCXXStaticCastExpr(expr); - PostTraverseCXXStaticCastExpr(expr, ret); + PostTraverseCXXStaticCastExpr(expr); return ret; } @@ -60,14 +58,13 @@ public: subExprs_.push(expr->getSubExpr()); return true; } - bool PostTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr *, bool) { + void PostTraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr *) { subExprs_.pop(); - return true; } bool TraverseCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) { PreTraverseCXXFunctionalCastExpr(expr); bool ret = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr); - PostTraverseCXXFunctionalCastExpr(expr, ret); + PostTraverseCXXFunctionalCastExpr(expr); return ret; } diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx index e5ea7f34ee38..3321037c8580 100644 --- a/compilerplugins/clang/unreffun.cxx +++ b/compilerplugins/clang/unreffun.cxx @@ -78,14 +78,13 @@ public: friendFunction.push( dyn_cast_or_null<FunctionDecl>(decl->getFriendDecl())); return true; } - bool PostTraverseFriendDecl(FriendDecl *, bool ) { + void PostTraverseFriendDecl(FriendDecl *) { friendFunction.pop(); - return true; } bool TraverseFriendDecl(FriendDecl * decl) { PreTraverseFriendDecl(decl); auto const ret = RecursiveASTVisitor::TraverseFriendDecl(decl); - PostTraverseFriendDecl(decl, ret); + PostTraverseFriendDecl(decl); return ret; } |