From 71b39dadc0d4ab61f942d169d0f7c92e4e1eb317 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Mon, 20 Feb 2017 10:38:13 +0330 Subject: added some more stuff for rule check disabling,enabling, added equivalency map for MisraC1998 --- mutator-lvl0.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/mutator-lvl0.cpp b/mutator-lvl0.cpp index 6d1d49d..dfb5aa0 100644 --- a/mutator-lvl0.cpp +++ b/mutator-lvl0.cpp @@ -22,12 +22,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.* /**********************************************************************************************************************/ /*included modules*/ /*project headers*/ +#include "mutator-lvl0.h" #include "mutator_aux.h" /*standard headers*/ #include #include #include #include +#include #include #include #include @@ -207,6 +209,40 @@ cl::opt MCD("MCD", cl::desc("MisraC switches to disable specific ru cl::opt MCEA("MCEA", cl::desc("MisraC switch to enable all rule checks"), cl::init(true), cl::cat(MutatorLVL0Cat), cl::Optional); cl::opt MCDA("MCDA", cl::desc("MisraC switches to disable all rule checks"), cl::init(false), cl::cat(MutatorLVL0Cat), cl::Optional); /**********************************************************************************************************************/ +class StringOptionsParser +{ +public: + StringOptionsParser() {} + + bool MC2Parser(void) + { + if (MCEA && MCDA) + { + std::cout << "You cannot set both MCEA and MCDA. That doesn't mean anything. Run with -h or visit the documentationi for help." << std::endl; + return false; + } + else if (MCEA) + { + MCOptsProto.AllisSet = true; + } + else if (MCDA) + { + MCOptsProto.AllisSet = false; + } + + return true; + } + +private: + struct MCOptsStructs + { + bool AllisSet; + std::vector Options; + }; + + MCOptsStructs MCOptsProto; +}; +/**********************************************************************************************************************/ class [[deprecated("replaced by a more efficient class"), maybe_unused]] MCForCmpless : public MatchFinder::MatchCallback { public: MCForCmpless (Rewriter &Rewrite) : Rewrite (Rewrite) {} @@ -7564,6 +7600,19 @@ int main(int argc, const char **argv) ClangTool Tool(op.getCompilations(), op.getSourcePathList()); + StringOptionsParser SOPProto; + +#if 1 + if (SOPProto.MC2Parser()) + { + typedef std::multimap::iterator Iter; + for (Iter iter = MC1EquivalencyMap.begin(); iter != MC1EquivalencyMap.end(); ++iter) + { + std::cout << "Key: " << iter->first << " " << "Value: " << iter->second << std::endl; + } + } +#endif + XMLDocOut.XMLCreateReport(); JSONDocOUT.JSONCreateReport(); -- cgit v1.2.3