diff options
author | bloodstalker <thabogre@gmail.com> | 2017-05-20 06:56:40 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2017-05-20 06:56:40 +0000 |
commit | d276e242a142060911276164ad9bc6ffc7be43fe (patch) | |
tree | 77c7adb9a4ec385747ae108fb5ddc4b862e6bd2b /mutator-lvl0.h | |
parent | added a test for mutagen extractAncestry to make usre it works (diff) | |
download | mutator-d276e242a142060911276164ad9bc6ffc7be43fe.tar.gz mutator-d276e242a142060911276164ad9bc6ffc7be43fe.zip |
fleshed out extractmutagen somewhat
Diffstat (limited to '')
-rw-r--r-- | mutator-lvl0.h | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/mutator-lvl0.h b/mutator-lvl0.h index 44a82fc..14dbcc3 100644 --- a/mutator-lvl0.h +++ b/mutator-lvl0.h @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.* /*included modules*/ /*project headers*/ /*standard library headers*/ +#include <iostream> #include <map> #include <string> #include <vector> @@ -355,27 +356,51 @@ class MutagenExtraction public: MutagenExtraction() {} + ~MutagenExtraction() {} + void ExtractAncestry(clang::ast_type_traits::DynTypedNode __dtn, clang::ASTContext &__astx) { clang::ASTContext::DynTypedNodeList DNL = __astx.getParents(__dtn); - std::vector<std::string> temp; - - /*FIXME-a temp. obviously well end up losing some parents in cpp if we're just picking up the + /*FIXME-a LastStrain. obviously well end up losing some parents in cpp if we're just picking up the * first parent from the list.*/ - temp.push_back(DNL[0].getNodeKind().asStringRef().str()); + LastStrain.push_back(DNL[0].getNodeKind().asStringRef().str()); + clang::ast_type_traits::DynTypedNode DTN = DNL[0]; /*FIXME-what does getparents return when there are no more parents to return?*/ - while (__astx.getParents(__dtn)[0].getNodeKind().asStringRef().str() != "FunctionDecl") + while (DTN.getNodeKind().asStringRef().str() != "FunctionDecl") { - DNL = __astx.getParents(__dtn); - temp.push_back(DNL[0].getNodeKind().asStringRef().str()); + DNL = __astx.getParents(DTN); + DTN = DNL[0]; + LastStrain.push_back(DTN.getNodeKind().asStringRef().str()); } - MutantStrainsAncestry.push_back(temp); + MutantStrainsAncestry.push_back(LastStrain); + } + + void DumpLast(void) + { + for (auto &iter : LastStrain) + { + std::cout << "DoomedStrain : " << iter << "\n"; + } + } + + void DumpAll(void) + { + for (auto &iter : MutantStrainsAncestry) + { + for (auto &iterer : iter) + { + std::cout << "DoomedStrainAll : " << iterer << "\n"; + } + + std::cout << "\n"; + } } private: + std::vector<std::string> LastStrain; std::vector<std::vector<std::string>> MutantStrainsAncestry; }; /**********************************************************************************************************************/ |