From 94a73d8785ae34f780c1fe03fd4c338ae2a0eaa4 Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Wed, 8 Feb 2017 12:42:32 +0330 Subject: added 19.8 --- mutator-lvl0.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/mutator-lvl0.cpp b/mutator-lvl0.cpp index bd06212..46ed8e7 100644 --- a/mutator-lvl0.cpp +++ b/mutator-lvl0.cpp @@ -48,6 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.* #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendActions.h" #include "clang/Lex/Lexer.h" +#include "clang/Lex/MacroArgs.h" #include "clang/Lex/Preprocessor.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Tooling/CommonOptionsParser.h" @@ -6162,7 +6163,6 @@ public: MacroInfo* MI = MD.getMacroInfo(); - /*underdev2*/ /*start of 19.4*/ ArrayRef TokenArrayRef = MI->tokens(); @@ -6333,6 +6333,32 @@ public: } /*end of 19.4*/ +#if 1 + if (Args != nullptr) + { + /*@DEVI-Macro args are passed twice. first they are expanded and then the whole macro, + including the args is checked again for expansion, so args are passed twice.*/ + if (MI->getNumArgs() != Args->getNumArguments() - MI->getNumArgs()) + { + if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, SM, MDSL)) + { + /*intentionally left blank*/ + } + else + { + if (Devi::IsTheMatchInMainFile(MainFileOnly, SM, MDSL)) + { + std::cout << "19.8:" << "Funciton-like macro invoked with wrong number of arguments:"; + std::cout << Range.getBegin().printToString(SM) << ":" << Args->getNumArguments() << " " << MI->getNumArgs() << ":" << std::endl; + + XMLDocOut.XMLAddNode(SM, SL, "19.8", "Funciton-like macro invoked with wrong number of arguments:"); + JSONDocOUT.JSONAddElement(SM, SL, "19.8", "Funciton-like macro invoked with wrong number of arguments:"); + } + } + } + } +#endif + if (MacroNameString == "offsetof") { if (Devi::IsTheMatchInSysHeader(CheckSystemHeader, SM, MDSL)) @@ -7354,6 +7380,11 @@ public: JSONDocOUT.JSONAddElement(SpellingLine, SpellingColumn, FileName, "14.2", "Expression result is unused:"); } + if (Info.getID() == 0U) + { + + } + } private: -- cgit v1.2.3