Hi all,<div><br></div><div>I'm trying to compile and run PrintFunctionNames example,</div><div>here is build file that I use:</div><div>-----------</div><div><div>#!/bin/bash</div><div><br></div><div>EXAMPLE=PrintFunctionNames</div>

<div><br></div><div>CLANG_MODULES=( AST Analysis Basic Checker CodeGen Driver Frontend FrontendTool Index Lex Parse Rewrite Sema Serialization )</div><div>for mod in ${CLANG_MODULES[@]}</div><div>do</div><div>  CLANG_LIBS="-lclang$mod $CLANG_LIBS"</div>

<div>done</div><div><br></div><div>g++ `llvm-config --cxxflags` -c $EXAMPLE.cpp \</div><div>&&</div><div>g++ `llvm-config --ldflags --libs` $CLANG_LIBS -shared -o lib$EXAMPLE.dylib $EXAMPLE.o</div><div><br></div>
<div>
rm $EXAMPLE.o</div><div><meta charset="utf-8"><div>-----------</div><div></div></div><div><br></div><div>But when I'm trying to execute clang with this plugin it crashes with assert:</div><div><meta charset="utf-8"><div>

<div>-----------</div><div></div></div><div>Assertion failed: (Inserted && "Pass registered multiple times!"), function registerPass, file PassRegistry.cpp, line 101.</div><div>0  clang                       0x00000001011ba593 PrintStackTrace(void*) + 38</div>

<div>1  clang                       0x00000001011bab4e SignalHandler(int) + 254</div><div>2  libSystem.B.dylib           0x00007fff86d2635a _sigtramp + 26</div><div>3  libSystem.B.dylib           0x00007fff5fc404a0 _sigtramp + 3639714144</div>

<div>4  clang                       0x0000000100027a71 raise + 29</div><div>5  clang                       0x0000000100027a81 abort + 14</div><div>6  clang                       0x0000000100027b0e __gnu_cxx::new_allocator<std::pair<void (*)(void*), void*> >::new_allocator() + 0</div>

<div>7  clang                       0x0000000100021c53 llvm::PassRegistry::registerPass(llvm::PassInfo const&) + 183</div><div>8  clang                       0x000000010001bcbd llvm::PassInfo::PassInfo(char const*, char const*, void const*, llvm::Pass* (*)(), bool, bool) + 169</div>

<div>9  clang                       0x000000010001ffdf llvm::RegisterPass<llvm::DominatorTree>::RegisterPass(char const*, char const*, bool, bool) + 83</div><div>10 libPrintFunctionNames.dylib 0x000000010580185b __static_initialization_and_destruction_0(int, int) + 157</div>

<div>11 libPrintFunctionNames.dylib 0x00000001058018c5 global constructors keyed to _ZN4llvm13DominatorTree2IDE + 19</div><div>12 libPrintFunctionNames.dylib 0x00007fff5fc0d500 global constructors keyed to _ZN4llvm13DominatorTree2IDE + 1514191950</div>

<div>13 libPrintFunctionNames.dylib 0x00007fff5fc0bcec global constructors keyed to _ZN4llvm13DominatorTree2IDE + 1514185786</div><div>14 libPrintFunctionNames.dylib 0x00007fff5fc0bda6 global constructors keyed to _ZN4llvm13DominatorTree2IDE + 1514185972</div>

<div>15 libPrintFunctionNames.dylib 0x00007fff5fc08fbb global constructors keyed to _ZN4llvm13DominatorTree2IDE + 1514174217</div><div>16 libSystem.B.dylib           0x00007fff86ccc2c0 dlopen + 61</div><div>17 clang                       0x00000001011b0457 llvm::sys::DynamicLibrary::LoadLibraryPermanently(char const*, std::string*) + 33</div>

<div>18 clang                       0x0000000100032c12 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 508</div><div>19 clang                       0x00000001000288a3 cc1_main(char const**, char const**, char const*, void*) + 879</div>

<div>20 clang                       0x000000010002fda6 main + 450</div><div>21 clang                       0x0000000100028138 start + 52</div><div>Stack dump:</div><div>0.<span class="Apple-tab-span" style="white-space:pre">      </span>Program arguments: clang -cc1 -load libPrintFunctionNames.dylib -plugin print-fns PrintFunctionNames.cpp </div>

<div>Illegal instruction</div></div><div><meta charset="utf-8"><div><div>-----------</div><div></div></div></div><div><br></div>clang is compiled from svn:</div><div><div>clang version 2.9 (trunk 115408)</div><div>Target: x86_64-apple-darwin10</div>

<div>Thread model: posix</div><div><br></div><div>This example is working when I compile it using provided Makefile, so the problem is in my build script.</div><div>But I don't want to use default Makefile because in this way plugin should be located inside clang source tree.</div>

<div><br></div><div>Please advice me how can I resolve this issue.</div><div><br></div><div>Thank you.</div><div><br></div>------ <br>With best wishes,<br>Sergey Martynov<br><br>
</div>