Skip to content

Instantly share code, notes, and snippets.

@schtobia
Last active Dec 18, 2019
Embed
What would you like to do?
Generating a ctags file for libstdc++

Generating a ctags file for libstdc++

Ripped off Stackoverflow and adapted to be version independent.

  • call the following script regularly via crontab

  • add the following line to $HOME/.vimrc:

    set tags+=$HOME/.cache/cpp_tags
    
#! /bin/bash
CXX="${CXX:-g++}"
CXX_ABSPATH="`which $CXX`"
[ ! -x "$CXX_ABSPATH" ] && { echo "CXX \"$CXX\" is not executable." >&2; exit 1; }
ctags --quiet=yes -f $HOME/.cache/cpp_tags --c++-kinds=+UA --fields=+SaimKz --extras=+qf \
--langmap=c++:+.tcc. --languages=c++ -I "_GLIBCXX_NOEXCEPT _GLIBCXX_USE_NOEXCEPT \
_GLIBCXX_NOTHROW _GLIBCXX_USE_CONSTEXPR _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
_GLIBCXX_END_NAMESPACE_CONTAINER _GLIBCXX_CONSTEXPR _GLIBCXX_NAMESPACE_LDBL \
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_VISIBILITY+" \
-n --recurse=yes \
`$CXX_ABSPATH -xc++ -E -v /dev/null -o /dev/null 2>&1| sed -ne '/#include <...> search starts here:/,/End of search list./{//!p}'` 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment