1- struct CLModule
1+ struct CLModule
22 mod:: CXModule
33end
44
@@ -8,36 +8,65 @@ Base.unsafe_convert(::Type{CXModule}, x::CLModule) = x.mod
88
99Base. show (io:: IO , x:: CLModule ) = print (io, " CLModule ($(full_name (x)) )" )
1010
11-
11+ """
12+ get_module(tu::TranslationUnit, file::CLFile) -> CLModule
13+ Given a CLFile header file, return the module that contains it, if one exists.
14+ """
1215function get_module (tu:: TranslationUnit , file:: CLFile ):: CLModule
1316 return Clang. clang_getModuleForFile (tu, file)
1417end
1518
19+ """
20+ ast_file(mod::CLModule) -> CLFile
21+ Given a module, return the module file where the provided module object came from.
22+ """
1623function ast_file (mod:: CLModule ):: CLFile
1724 return Clang. clang_Module_getASTFile (mod)
1825end
1926
27+ """
28+ parent_module(mod::CLModule) -> CLModule
29+ Given a module, return the parent of a sub-module or NULL if the given module is top-level,
30+ e.g. for 'std.vector' it will return the 'std' module.
31+ """
2032function parent_module (mod:: CLModule ):: CLModule
2133 return Clang. clang_Module_getParent (mod)
2234end
2335
36+ """
37+ name(mod::CLModule)
38+ Given a module, return the name of the module,
39+ e.g. for the 'std.vector' sub-module it will return "vector".
40+ """
2441function name (mod:: CLModule )
2542 return Clang. clang_Module_getName (mod) |> _cxstring_to_string
2643end
2744
45+ """
46+ full_name(mod::CLModule)
47+ Given a module, return the full name of the module, e.g. "std.vector".
48+ """
2849function full_name (mod:: CLModule )
2950 return Clang. clang_Module_getFullName (mod) |> _cxstring_to_string
3051end
3152
53+ """
54+ is_system(mod::CLModule)
55+ Given a module, return whether it is a system one.
56+ """
3257function is_system (mod:: CLModule )
3358 return Bool (Clang. clang_Module_isSystem (mod))
3459end
3560
61+ """
62+ toplevel_headers(tu::TranslationUnit, mod::CLModule)
63+ Given a module, return all top level headers associated with the module.
64+ """
3665function toplevel_headers (tu:: TranslationUnit , mod:: CLModule )
3766 num = Clang. clang_Module_getNumTopLevelHeaders (tu, mod)
3867 headers = Vector {CLFile} (undef, num)
3968 for i= 1 : num
40- headers[i] = Clang. clang_Module_getTopLevelHeader (tu, mod, i- 1 )
69+ headers[i] = Clang. clang_Module_getTopLevelHeader (tu, mod, i- 1 )
4170 end
4271 return headers
4372end
0 commit comments