Static Value-Flow Analysis
Loading...
Searching...
No Matches
CFLGramGraphChecker.h
Go to the documentation of this file.
1//===----- CFLGramGraphChecker.h -- CFL Checker for Grammar and graphBuilder alignment --------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23/*
24 * CFLGramGraphChecker.h
25 *
26 * Created on: May 23, 2022
27 * Author: Pei Xu
28 */
29#ifndef INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_
30#define INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_
31
32#include "CFL/CFGrammar.h"
33#include "Graphs/CFLGraph.h"
34namespace SVF
35{
36
38{
39public:
41 {
43 for(auto pairV : grammar->getTerminals())
44 {
45 if (graphBuilder->getLabelToKindMap().find(pairV.first) != graphBuilder->getLabelToKindMap().end())
46 {
47 assert(graphBuilder->getLabelToKindMap()[pairV.first] == pairV.second);
48 assert(graphBuilder->getKindToLabelMap()[pairV.second] == pairV.first);
49 }
50 }
51
52 for(auto pairV : grammar->getNonterminals())
53 {
54 if (graphBuilder->getLabelToKindMap().find(pairV.first) != graphBuilder->getLabelToKindMap().end())
55 {
56 assert(graphBuilder->getLabelToKindMap()[pairV.first] == pairV.second);
57 assert(graphBuilder->getKindToLabelMap()[pairV.second] == pairV.first);
58 }
59 else
60 {
61 graphBuilder->getLabelToKindMap().insert(std::make_pair (pairV.first,pairV.second));
62 graphBuilder->getKindToLabelMap().insert(std::make_pair (pairV.second, pairV.first));
63 }
64 }
65
67 grammar->setKindToAttrsMap(graphBuilder->getKindToAttrsMap());
68 graph->startKind = grammar->getStartKind();
69 }
70};
71
72}// SVF
73
74#endif /* INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_*/
void check(GrammarBase *grammar, CFLGraphBuilder *graphBuilder, CFLGraph *graph)
Map< std::string, Kind > & getNonterminals()
Definition CFGrammar.h:160
Map< std::string, Kind > & getTerminals()
Definition CFGrammar.h:170
Kind getStartKind()
Definition CFGrammar.h:205
void setKindToAttrsMap(const Map< Kind, Set< Attribute > > &kindToAttrsMap)
Definition CFGrammar.cpp:45
for isBitcode
Definition BasicTypes.h:68
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74