[cfe-dev] libclang C API coding standards

James Mitchell via cfe-dev cfe-dev at lists.llvm.org
Sat Dec 2 04:10:48 PST 2017


I'm working on adding some matchers support to libclang however I'm quiet
confused with the preferred naming conventions

Current function naming:
 * clang_<c_type>_<method> (e.g. clang_CXCursorSet_insert)
 * clang_<c++type>_<method> (e.g. upper: clang_Cursor_getArgument lower:
clang_index_getClientEntity )
 * clang_get<type><attr> (e.g. clang_getDiagnosticInSet)

Dispose and create seems a little more consistent with prefix of
clang_create/clang_dispose however there are some which use dispose/create
suffix (e.g. clang_IndexAction_*, clang_remap_*)

Even variable names for functions are consistent:
 * No names at all (clang_remap_dispose(CXRemapping))
 * Underscore names (e.g. unsigned index_options)
 * Camel case upper (e.g. unsigned NumTokens)
 * Camel case lower (e.g. unsigned *isGenerated)

With all of these different alternatives what should be used for new code?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171202/45f5884a/attachment.html>


More information about the cfe-dev mailing list