Parse macros in getNameFromDecl.

Fleshes out the table of contents more.

Change-Id: I8f8f0e43bdf7419f978b4fc66de80922ed1ae425
Reviewed-on: https://boringssl-review.googlesource.com/4785
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-05-16 12:00:51 -04:00 committed by Adam Langley
parent 4831c3328c
commit 6deacb3895

View File

@ -215,6 +215,18 @@ func getNameFromDecl(decl string) (string, bool) {
if strings.HasPrefix(decl, "struct ") {
return "", false
}
if strings.HasPrefix(decl, "#define ") {
// This is a preprocessor #define. The name is the next symbol.
decl = strings.TrimPrefix(decl, "#define ")
for len(decl) > 0 && decl[0] == ' ' {
decl = decl[1:]
}
i := strings.IndexAny(decl, "( ")
if i < 0 {
return "", false
}
return decl[:i], true
}
decl = skipPast(decl, "STACK_OF(")
decl = skipPast(decl, "LHASH_OF(")
i := strings.Index(decl, "(")