Поиск характерных шаблонов кода, приводящих к ошибкам функционирования в программах промышленного размера (1162573), страница 5
Текст из файла (страница 5)
d e s t r o y S D G ( ) ;}else{"Option: '-pdg-dump-path ' or '-template-pdg-path ' should be given tollvm .\n" ;e r r s ( )<<}returnChanged ;}Ëèñòèíã 3: Ñêðèïòû ñáîðêè è ãåíåðàöèè Makele äëÿ øàáëîíîâ#! / b i n / b a s h'\033[0;32 m''\033[0;31 m'YELLOW='\033[0;33 m'GREEN=RED="$(readlink -f ${ BASH_SOURCE [0]})""$(dirname $_script)"_ s c r i p t=_base=source$_base / b u i l d _ c c d _ d e p s . s hecho-e"${GREEN}Checking required packages ..."tputsgr0installPkgg++installPkgpythoninstallPkgpython - tkinstallPkgdoxygena r r=$ ( e c h o$@|tr" " "\n" )p a r s e d =0t m p l=0''i n s t a l l _ p r="$_base/ templatesDump "for x i n $ a r rdoif [ [ $ x == * - - p r e f i x =* ] ]t e m p l a t e _ p a t h=thenp a r s e d =1"${x/'--prefix ='/''}"" $install_pr " ]i n s t a l l _ p r=if[-zthen"${RED}Error : --prefix must be initialized "echo-etputsgr0exit0fifiif[[$ x ==* - - template - p a t h=*]]thent m p l=1"${x/'--template -path ='/''}"" template_path " ]t e m p l a t e _ p a t h=if[-zthenecho-e"${YELLOW}Warning : using default templates dump path"27tputsgr0exit0fifidoneif[[$ t m p l == 0||templatesDump "$template_path==""||$template_path=="$_base/]]thenecho-e"${YELLOW}Warning : using default templates dump path"rm- rf$_base / templatesDumpmkdir$_base / templatesDump"$_base/ templatesDump "t e m p l a t e _ p a t h=tputsgr0fiif[[!-d$template_path]]thenechotput"${RED}Error : Templates dump directory must exist"-esgr0exit0fipythonif[[c o n f i g .
py$parsed$_base== 0$install_pr$template_path]]then"${RED}Error : --prefix must be initialized "echo-etputsgr0exit0fi"${GREEN} Configure LLVM+Clang ..."echo-etputsgr0export"-std=c++11"CXXFLAGS=$_base / c o n f i g u r e$@||exit0"${GREEN}Building LLVM+Clang ..."echo-etputsgr0make- j ` nproc `makeinstall||||exitexit00"${GREEN}Creating documentation for ccd ..."echo-etputsgr0$ _ b a s e / CCDTools / CCDDOCGenerator .
py-etputsgr0- rfmkdirmake$ i n s t a l l _ p r / ccd_docs"${GREEN}Making temlates"echorm-p$_base / t e m p l a t e s D o t s$_base / t e m p l a t e s D o t s-C$_base / t e m p l a t e s /- - no - p r i n t - d i r e c t o r y28- r$_base||exit0"${GREEN}Finished "echo-etputsgr0#! / u s r / b i n / p y t h o nimportfileinputimportsysimportreifl e n ( sys . argv )basepat=rep=if=1:'"template-pdg-path", cl:: Hidden , cl:: init \(".*"\) ''"template-pdg-path", cl:: Hidden , cl:: init ("'l e n ( sys . argv )>3:rep+=sys . argv [3]+rep+='")'else :for>sys . argv [ 1 ]linein'")'"/lib/CCD/PDG.cpp" ,f i l e i n p u t .
i n p u t ( b a s e+p r i n t ( r e . sub ( pat ,rep ,i n p l a c e=T r u e ) :line )) ,""e x p o r t s t r=ifl e n ( sys . argv )>3:"CC=" + s y s . a r g v [ 2 ] + """/bin/clang\\-make-pdg\\-mllvm -pdg-dump-path=""" + s y s . a r g v [ 3 ] + """\\-mllvm -dot-graph-path=""" + b a s e + """/ templatesDots-mllvm -with-ctrl-dep=FULL -ggdbs y s . a r g v [ 2 ] + """/bin/clang ++\\-make-pdg\\-mllvm -pdg-dump-path=""" + s y s . a r g v [ 3 ] + """\\-mllvm -dot-graph-path=""" + b a s e + """/ templatesDots-mllvm -with-ctrl-dep=FULL -ggdb\n\n"""e x p o r t s t r=CXX="""+\\\\r e s t ="""TDIRS :=$(shell ls -d */)TOTAL=.PHONY: $(TDIRS)all: $(TDIRS) clean@echo "TOTAL:" $(words $(TOTAL)) "TEMPLATES"$(TDIRS):$(eval SRCS=$(wildcard $@*.c))$(eval DIRS=$(shell find $@include -type d 2>/dev/null))$(eval FLAGS=$(foreach d, $(DIRS), -I$d))$(eval TOTAL +=$(SRCS))@echo $(words $(SRCS)) $(shell echo $(shell basename $@) | tr a-z A-Z) "TEMPLATES"@$(CC) -c $(FLAGS) $(SRCS)clean:with@rm -f *.o*"""open ( b a s e+"/ templates / Makefile" , 'w' )f .
write ( exportstr )f . write ( rest )29asf :.