cmTagFile.h/c : cmTagFile now recognizes function definition, and structure and union tags.

This commit is contained in:
kevin 2014-01-06 16:11:18 -05:00
parent 83314506d7
commit babb016383
2 changed files with 34 additions and 14 deletions

View File

@ -33,12 +33,15 @@ const cmChar_t* _cmTfFlagsToLabel( unsigned flags )
{
switch(flags)
{
case kFuncTfFl: return "p";
case kEnumTfFl: return "e";
case kMacroTfFl: return "m";
case kTypedefTfFl: return "t";
case kFieldTfFl: return "f";
case kExternTfFl: return "x";
case kFuncProtoTfFl: return "p";
case kFuncDefnTfFl: return "d";
case kEnumTfFl: return "e";
case kMacroTfFl: return "m";
case kTypedefTfFl: return "t";
case kFieldTfFl: return "f";
case kExternTfFl: return "x";
case kStructTagTfFl:return "s";
case kUnionTagTfFl: return "u";
default:
{ assert(0); }
}
@ -125,7 +128,11 @@ cmTfRC_t _cmTfParseLine( cmTf_t* p, const cmChar_t* fn, unsigned line, cmChar_t*
break;
case 'p': // function prototype
r.flags |= kFuncTfFl;
r.flags |= kFuncProtoTfFl;
break;
case 'f': // function defn
r.flags |= kFuncDefnTfFl;
break;
case 't': // typedef
@ -140,6 +147,14 @@ cmTfRC_t _cmTfParseLine( cmTf_t* p, const cmChar_t* fn, unsigned line, cmChar_t*
r.flags |= kExternTfFl;
break;
case 's': // struct tag
r.flags |= kStructTagTfFl;
break;
case 'u': // union tag
r.flags |= kUnionTagTfFl;
break;
default: // unrecognized type
return rc;
}

View File

@ -9,7 +9,9 @@ extern "C" {
//
// ctags --c-kinds=+p --fields=+n file.h
//
// --c-kinds=+p turns on function prototype reporting.
// --c-kinds=+px
// p - turns on function prototype reporting.
// x - turns on external and forward decl
// --field=+n turns on line number reporting
enum
{
@ -27,12 +29,15 @@ extern "C" {
enum
{
kFuncTfFl = 0x01,
kEnumTfFl = 0x02,
kMacroTfFl = 0x04,
kTypedefTfFl = 0x08,
kFieldTfFl = 0x10,
kExternTfFl = 0x20 // extern var's and forward declarations
kFuncProtoTfFl = 0x001,
kFuncDefnTfFl = 0x002,
kEnumTfFl = 0x004,
kMacroTfFl = 0x008,
kTypedefTfFl = 0x010,
kFieldTfFl = 0x020,
kExternTfFl = 0x040, // extern var's and forward declarations
kStructTagTfFl = 0x080,
kUnionTagTfFl = 0x100
// be sure to add new flags to _cmTfFlagsToLabel()
};