Segmentation fault (core dumped) when running clang libtooling -


i implemented simple refactoring tool can replace function name user-specific name.

when run tool on test code (without header files), works well.

however, if include header files in test code, e.g.

#include <stdio.h> 

... then, run again. there segmentation fault (core dumped):

$ ./transform -class=test -method=test -newname=run ./testcode.cpp  ./transform(_zn4llvm3sys15printstacktraceerns_11raw_ostreame+0x33)[0xc76123] ./transform[0xc761b6] ./transform(_zn4llvm3sys17runsignalhandlersev+0x99)[0xc74471] ./transform[0xc75998] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f5a0eec1390] ./transform[0xbd9537] ./transform[0xbd2d7b] ./transform[0x10a7215] ./transform(_zn5clang12ast_matchers8internal21boundnodestreebuilder12visitmatchesepns2_7visitore+0x10c)[0x11527fc] ./transform[0x10a665b] ./transform[0x10a67f9] ./transform[0x10aba99] ./transform[0x10a77c3] ./transform[0x1103b1e] ./transform[0x10c3d55] ./transform[0x10ac8b6] ./transform[0x10a77d6] ./transform[0x1103b1e] ./transform[0x10c94d7] ./transform[0x10ad4dd] ./transform[0x10a77d6] ./transform(_zn5clang12ast_matchers11matchfinder8matchasterns_10astcontexte+0x9b)[0x10a8377] ./transform[0x10a7a99] ./transform(_zn5clang8parseasterns_4semaebb+0x30d)[0x13b484d] ./transform(_zn5clang17astfrontendaction13executeactionev+0x143)[0x11e4ac1] ./transform(_zn5clang14frontendaction7executeev+0x96)[0x11e450e] ./transform(_zn5clang16compilerinstance13executeactionerns_14frontendactione+0x522)[0x123e956] ./transform(_zn5clang7tooling21frontendactionfactory13runinvocationest10shared_ptrins_18compilerinvocationeepns_11filemanageres2_ins_22pchcontaineroperationseepns_18diagnosticconsumere+0x19e)[0x13abb66] ./transform(_zn5clang7tooling14toolinvocation13runinvocationepkcpns_6driver11compilationest10shared_ptrins_18compilerinvocationees7_ins_22pchcontaineroperationsee+0x12c)[0x13ab98c] ./transform(_zn5clang7tooling14toolinvocation3runev+0x5d7)[0x13ab795] ./transform(_zn5clang7tooling9clangtool3runepns0_10toolactione+0xa32)[0x13accb6] ./transform(_zn5clang7tooling15refactoringtool10runandsaveepns0_21frontendactionfactorye+0x44)[0x13a7ae8] ./transform(main+0x71b)[0xbd3ca0] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f5a0e04c830] ./transform(_start+0x29)[0xbd1c59] segmentation fault (core dumped) 

i'm confused that, since add "#include <...>" please check faults info? in advance!


Comments