srcML / srcSlice

Lightweight tool for slicing
34 stars 16 forks source link

Function level map overwriting instead of unioning #16

Closed cnewman closed 3 years ago

cnewman commented 7 years ago

The following clip of code, found in FunctionProfilePolicy.hpp assigns the value of the exprpolicy (referred to as var below) instead of unioning it. It should instead union with def and use for the local map (referred to as it->second).

           else if (ctx.IsOpen(ParserState::exprstmt) && ctx.IsClosed(ParserState::declstmt)){
                exprData = *policy->Data<ExprPolicy::ExprDataSet>();
                for(auto var : exprData.dataset){
                    auto it = profileset.dataset.find(var.first);
                    if(it != profileset.dataset.end()){
                        it->second.def = var.second.def;
                        it->second.use = var.second.use;
                    }else{
                        std::cerr<<"couldn't find identifier named: "<<var.first<<std::endl;
                    }
                }
                //data = exprData;
            }