Search code examples
c++cllvmcscope

How to use cscope for a project which has .c , .cpp and .h files?


I am working on a project which requires the understanding of llvm compiler source-code. To browse source code of llvm, I tried to use cscope with following command in the root directory of the source:

cscope -R *

But it doesn't work. As there are mainly .cpp and .h files but some .c files are also there. So now I don't have a clue how to make cscope work? Can someone please help?


Solution

  • You can use following commands to do the required task from the root directory of llvm source tree:

    touch tags.lst
    find | grep "\.c$" >> tags.lst
    find | grep "\.cpp$" >> tags.lst
    find | grep "\.h$" >> tags.lst
    cscope -i tags.lst
    

    It would create cscope.out file which is used with cscope to browse the code. Hope it helps!