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

View File

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