Clang-0.09000755001750001750 012541314565 12033 5ustar00ghedoghedo000000000000TODO100644001750001750 15312541314565 12563 0ustar00ghedoghedo000000000000Clang-0.09* comment support (to be released) * token support * code completion support * other (see python's cindex) README100644001750001750 60712541314565 12757 0ustar00ghedoghedo000000000000Clang-0.09 This archive contains the distribution Clang, version 0.09: Perl bindings to the Clang compiler's indexing interface This software is copyright (c) 2012 by Alessandro Ghedini. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v5.020. typemap100644001750001750 125412541314565 13520 0ustar00ghedoghedo000000000000Clang-0.09Index T_CLANG_REF TUnit T_CLANG_REF Cursor T_CLANG_REF CursorKind T_CLANG_INT Type T_CLANG_REF TypeKind T_CLANG_INT Diagnostic T_CLANG_REF OUTPUT T_CLANG_REF sv_setref_pv($arg, \"Clang::${type}\", (void *) $var); T_CLANG_INT sv_setref_iv($arg, \"Clang::${type}\", $var); INPUT T_CLANG_REF if (sv_isobject($arg) && sv_derived_from($arg, \"Clang::${type}\")) $var = INT2PTR($type, SvIV((SV *) SvRV($arg))); else Perl_croak(aTHX_ \"$var is not of type Clang::${type}\"); T_CLANG_INT if (sv_isobject($arg) && sv_derived_from($arg, \"Clang::${type}\")) $var = SvIV((SV *) SvRV($arg)); else Perl_croak(aTHX_ \"$var is not of type Clang::${type}\"); Changes100644001750001750 305112541314565 13406 0ustar00ghedoghedo000000000000Clang-0.09Revision history for Clang 0.09 2015-06-20 18:48:51+02:00 Europe/Rome - Add methods to determine whether a cursor represents a virtual method or a pure virtual method (GH#5) (thanks, @ArthurJahn!) - Add method to get a cursor's number of arguments (GH#5) (thanks, @Ziul, @LucianoAlmeida!) 0.08 2015-05-26 14:00:26+02:00 Europe/Rome - Return cursor's final line and column from Cursor -> location() (GH#3) (thanks, @gutorc92!) - Add method to retrieve cursor's access specifier (GH#4) (thanks, @gutorc92 and @lucasmoura!) 0.07 2015-04-23 20:09:52+02:00 Europe/Rome - Build with libclang v3.5 (GH#2) (thanks, @ArthurJahn!) - Do not suggest perl version in the example - Various test fixes 0.06 2012-08-20 13:20:25 Europe/Rome - Assorted fixes 0.05 2012-07-23 20:09:25 Europe/Rome - Add Clang::Diagnostic class 0.04 2012-07-22 12:44:01 Europe/Rome - Improve documentation (no functional changes) - Remove debug output 0.03 2012-07-17 12:21:56 Europe/Rome - Rename Clang::Index::* modules to Clang::* (incompatible change) - Add methods to Clang::CursorKind: + is_declaration() + is_reference( ) + is_expression() + is_statement() + is_attribute() + is_invalid() + is_tunit() + is_preprocessing() + is_unexposed() - Add Clang -> type() method and Clang::Type class - Improve documentation (no functional changes) 0.02 2012-07-16 12:30:41 Europe/Rome - Improve documentation (no functional changes) 0.01 2012-07-16 12:04:55 Europe/Rome - Initial version LICENSE100644001750001750 4367712541314565 13162 0ustar00ghedoghedo000000000000Clang-0.09This software is copyright (c) 2012 by Alessandro Ghedini. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2012 by Alessandro Ghedini. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2012 by Alessandro Ghedini. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Clang.xs100644001750001750 144712541314565 13522 0ustar00ghedoghedo000000000000Clang-0.09#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include typedef CXIndex Index; typedef CXTranslationUnit TUnit; typedef CXCursor * Cursor; typedef enum CXCursorKind CursorKind; typedef CXType * Type; typedef enum CXTypeKind TypeKind; typedef CXDiagnostic Diagnostic; enum CXChildVisitResult visitor(CXCursor cursor, CXCursor parent, CXClientData data) { SV *child; AV *children = data; CXCursor *ref = malloc(sizeof(CXCursor)); *ref = cursor; child = sv_setref_pv(newSV(0), "Clang::Cursor", (void *) ref); av_push(children, child); return CXChildVisit_Continue; } MODULE = Clang PACKAGE = Clang INCLUDE: xs/Index.xs INCLUDE: xs/TUnit.xs INCLUDE: xs/Cursor.xs INCLUDE: xs/CursorKind.xs INCLUDE: xs/Type.xs INCLUDE: xs/TypeKind.xs INCLUDE: xs/Diagnostic.xs dist.ini100644001750001750 43012541314565 13535 0ustar00ghedoghedo000000000000Clang-0.09name = Clang author = Alessandro Ghedini license = Perl_5 copyright_holder = Alessandro Ghedini copyright_year = 2012 [@Author::ALEXBIO] repo = p5-Clang makemaker = 0 [Prereqs / ConfigureRequires] Devel::CheckLib = 0 [=inc::MakeMaker / MakeMaker] META.yml100644001750001750 1572612541314565 13420 0ustar00ghedoghedo000000000000Clang-0.09--- abstract: "Perl bindings to the Clang compiler's indexing interface" author: - 'Alessandro Ghedini ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Test::More: '0' perl: '5.006' configure_requires: Devel::CheckLib: '0' ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.140640' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Clang requires: XSLoader: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/ghedo/p5-Clang/issues homepage: http://metacpan.org/release/Clang/ repository: git://github.com/ghedo/p5-Clang.git version: '0.09' x_Dist_Zilla: perl: version: '5.020002' plugins: - class: Dist::Zilla::Plugin::GatherDir name: '@Author::ALEXBIO/GatherDir' version: '5.020' - class: Dist::Zilla::Plugin::PruneCruft name: '@Author::ALEXBIO/PruneCruft' version: '5.020' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Author::ALEXBIO/ManifestSkip' version: '5.020' - class: Dist::Zilla::Plugin::MetaYAML name: '@Author::ALEXBIO/MetaYAML' version: '5.020' - class: Dist::Zilla::Plugin::License name: '@Author::ALEXBIO/License' version: '5.020' - class: Dist::Zilla::Plugin::Readme name: '@Author::ALEXBIO/Readme' version: '5.020' - class: Dist::Zilla::Plugin::ExtraTests name: '@Author::ALEXBIO/ExtraTests' version: '5.020' - class: Dist::Zilla::Plugin::ExecDir name: '@Author::ALEXBIO/ExecDir' version: '5.020' - class: Dist::Zilla::Plugin::ShareDir name: '@Author::ALEXBIO/ShareDir' version: '5.020' - class: Dist::Zilla::Plugin::Manifest name: '@Author::ALEXBIO/Manifest' version: '5.020' - class: Dist::Zilla::Plugin::TestRelease name: '@Author::ALEXBIO/TestRelease' version: '5.020' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Author::ALEXBIO/ConfirmRelease' version: '5.020' - class: Dist::Zilla::Plugin::GitHub::Meta name: '@Author::ALEXBIO/@GitHub/GitHub::Meta' version: '0.40' - class: Dist::Zilla::Plugin::GitHub::Update name: '@Author::ALEXBIO/@GitHub/GitHub::Update' version: '0.40' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: 0.01 version_by_branch: '0' version_regexp: (?^:^v(.+)$) Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Author::ALEXBIO/Git::NextVersion' version: '2.034' - class: Dist::Zilla::Plugin::MetaConfig name: '@Author::ALEXBIO/MetaConfig' version: '5.020' - class: Dist::Zilla::Plugin::MetaJSON name: '@Author::ALEXBIO/MetaJSON' version: '5.020' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@Author::ALEXBIO/AutoPrereqs' version: '5.020' - class: Dist::Zilla::Plugin::PodVersion name: '@Author::ALEXBIO/PodVersion' version: '5.020' - class: Dist::Zilla::Plugin::PkgVersion name: '@Author::ALEXBIO/PkgVersion' version: '5.020' - class: Dist::Zilla::Plugin::NextRelease name: '@Author::ALEXBIO/NextRelease' version: '5.020' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: '0' filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: '0' phase: test script_finder: - ':ExecFiles' skips: [] name: '@Author::ALEXBIO/Test::Compile' version: '2.052' - class: Dist::Zilla::Plugin::Test::CheckManifest name: '@Author::ALEXBIO/Test::CheckManifest' version: '0.04' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Author::ALEXBIO/PodSyntaxTests' version: '5.020' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Author::ALEXBIO/PodCoverageTests' version: '5.020' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%v%n%n%c time_zone: local Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - dist.ini - Changes allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Author::ALEXBIO/Git::Commit' version: '2.034' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ signed: 0 tag: v0.09 tag_format: v%v tag_message: '%N %v' time_zone: local Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Author::ALEXBIO/Git::Tag' version: '2.034' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Author::ALEXBIO/Git::Push' version: '2.034' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Author::ALEXBIO/UploadToCPAN' version: '5.020' - class: Dist::Zilla::Plugin::InstallRelease name: '@Author::ALEXBIO/InstallRelease' version: '0.008' - class: Dist::Zilla::Plugin::Clean name: '@Author::ALEXBIO/Clean' version: '0.07' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: configure type: requires name: ConfigureRequires version: '5.020' - class: inc::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: MakeMaker version: ~ - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '5.020' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '5.020' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '5.020' MANIFEST100644001750001750 144512541314565 13251 0ustar00ghedoghedo000000000000Clang-0.09# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.020. Changes Clang.xs LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README README.pod TODO dist.ini inc/MakeMaker.pm lib/Clang.pm lib/Clang/Cursor.pm lib/Clang/CursorKind.pm lib/Clang/Diagnostic.pm lib/Clang/Index.pm lib/Clang/TUnit.pm lib/Clang/Type.pm lib/Clang/TypeKind.pm t/00-compile.t t/01-tunit.t t/02-cursor.t t/03-cursorkind.t t/05-typekind.t t/06-diagnostic.t t/fragments/animal.h t/fragments/cat.cc t/fragments/cat.h t/fragments/main.cpp t/fragments/mammal.h t/fragments/person.cpp t/fragments/person.h t/fragments/test.c t/release-check-manifest.t t/release-pod-coverage.t t/release-pod-syntax.t typemap xs/Cursor.xs xs/CursorKind.xs xs/Diagnostic.xs xs/Index.xs xs/TUnit.xs xs/Type.xs xs/TypeKind.xs META.json100644001750001750 2554112541314565 13564 0ustar00ghedoghedo000000000000Clang-0.09{ "abstract" : "Perl bindings to the Clang compiler's indexing interface", "author" : [ "Alessandro Ghedini " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.140640", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Clang", "prereqs" : { "configure" : { "requires" : { "Devel::CheckLib" : "0", "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "XSLoader" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::More" : "0", "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/ghedo/p5-Clang/issues" }, "homepage" : "http://metacpan.org/release/Clang/", "repository" : { "type" : "git", "url" : "git://github.com/ghedo/p5-Clang.git", "web" : "https://github.com/ghedo/p5-Clang" } }, "version" : "0.09", "x_Dist_Zilla" : { "perl" : { "version" : "5.020002" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::GatherDir", "name" : "@Author::ALEXBIO/GatherDir", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Author::ALEXBIO/PruneCruft", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Author::ALEXBIO/ManifestSkip", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Author::ALEXBIO/MetaYAML", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Author::ALEXBIO/License", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@Author::ALEXBIO/Readme", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::ExtraTests", "name" : "@Author::ALEXBIO/ExtraTests", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Author::ALEXBIO/ExecDir", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Author::ALEXBIO/ShareDir", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Author::ALEXBIO/Manifest", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Author::ALEXBIO/TestRelease", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Author::ALEXBIO/ConfirmRelease", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::GitHub::Meta", "name" : "@Author::ALEXBIO/@GitHub/GitHub::Meta", "version" : "0.40" }, { "class" : "Dist::Zilla::Plugin::GitHub::Update", "name" : "@Author::ALEXBIO/@GitHub/GitHub::Update", "version" : "0.40" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : 0.01, "version_by_branch" : "0", "version_regexp" : "(?^:^v(.+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Author::ALEXBIO/Git::NextVersion", "version" : "2.034" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Author::ALEXBIO/MetaConfig", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Author::ALEXBIO/MetaJSON", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@Author::ALEXBIO/AutoPrereqs", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::PodVersion", "name" : "@Author::ALEXBIO/PodVersion", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@Author::ALEXBIO/PkgVersion", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@Author::ALEXBIO/NextRelease", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : "0", "fail_on_warning" : "author", "fake_home" : "0", "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : "0", "phase" : "test", "script_finder" : [ ":ExecFiles" ], "skips" : [] } }, "name" : "@Author::ALEXBIO/Test::Compile", "version" : "2.052" }, { "class" : "Dist::Zilla::Plugin::Test::CheckManifest", "name" : "@Author::ALEXBIO/Test::CheckManifest", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Author::ALEXBIO/PodSyntaxTests", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Author::ALEXBIO/PodCoverageTests", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%v%n%n%c", "time_zone" : "local" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "dist.ini", "Changes" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Author::ALEXBIO/Git::Commit", "version" : "2.034" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "signed" : 0, "tag" : "v0.09", "tag_format" : "v%v", "tag_message" : "%N %v", "time_zone" : "local" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Author::ALEXBIO/Git::Tag", "version" : "2.034" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Author::ALEXBIO/Git::Push", "version" : "2.034" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Author::ALEXBIO/UploadToCPAN", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::InstallRelease", "name" : "@Author::ALEXBIO/InstallRelease", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::Clean", "name" : "@Author::ALEXBIO/Clean", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "configure", "type" : "requires" } }, "name" : "ConfigureRequires", "version" : "5.020" }, { "class" : "inc::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "MakeMaker", "version" : null }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "5.020" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "5.020" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.020" } } } README.pod100644001750001750 224712541314565 13562 0ustar00ghedoghedo000000000000Clang-0.09package Clang; use strict; use warnings; require XSLoader; XSLoader::load('Clang', $Clang::VERSION); =head1 NAME Clang - Perl bindings to the Clang compiler's indexing interface =head1 SYNOPSIS use Clang; my $index = Clang::Index -> new(1); my $tunit = $index -> parse('file.c'); my $nodes = $tunit -> cursor -> children; foreach my $node (@$nodes) { say $node -> spelling; say $node -> kind -> spelling; } =head1 DESCRIPTION Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages which uses LLVM as its back end. This module provides Perl bindings to the Clang indexing interface, used for extracting high-level symbol information from source files without exposing the full Clang C++ API. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang xs000755001750001750 012541314565 12406 5ustar00ghedoghedo000000000000Clang-0.09Type.xs100644001750001750 141412541314565 14043 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::Type Cursor declaration(self) Type self CODE: Cursor retval = malloc(sizeof(CXCursor)); CXCursor cursor = clang_getTypeDeclaration(*self); *retval = cursor; RETVAL = retval; OUTPUT: RETVAL TypeKind kind(self) Type self CODE: RETVAL = self -> kind; OUTPUT: RETVAL SV * is_const(self) Type self CODE: RETVAL = clang_isConstQualifiedType(*self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_volatile(self) Type self CODE: RETVAL = clang_isVolatileQualifiedType(*self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_restrict(self) Type self CODE: RETVAL = clang_isRestrictQualifiedType(*self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL void DESTROY(self) Type self CODE: free(self); TUnit.xs100644001750001750 153212541314565 14166 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::TUnit Cursor cursor(self) TUnit self CODE: Cursor retval = malloc(sizeof(CXCursor)); CXCursor cursor = clang_getTranslationUnitCursor(self); *retval = cursor; RETVAL = retval; OUTPUT: RETVAL SV * spelling(self) TUnit self CODE: CXString spelling = clang_getTranslationUnitSpelling(self); RETVAL = newSVpv(clang_getCString(spelling), 0); OUTPUT: RETVAL AV * diagnostics(self) TUnit self CODE: AV *diagnostics = newAV(); unsigned int i, count = clang_getNumDiagnostics(self); for (i = 0; i < count; i++) { Diagnostic d = clang_getDiagnostic(self, i); SV *elem = sv_setref_pv( newSV(0), "Clang::Diagnostic", (void *) d ); av_push(diagnostics, elem); } RETVAL = diagnostics; OUTPUT: RETVAL void DESTROY(self) TUnit self CODE: clang_disposeTranslationUnit(self); Index.xs100644001750001750 71612541314565 14155 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::Index Index new(class, exclude_decls) SV *class int exclude_decls CODE: RETVAL = clang_createIndex(exclude_decls, 0); OUTPUT: RETVAL void DESTROY(self) Index self CODE: clang_disposeIndex(self); TUnit parse(self, file, ...) Index self SV *file CODE: const char *path = SvPVbyte_nolen(file); TUnit tu = clang_parseTranslationUnit( self, path, NULL, 0, NULL, 0, 0 ); RETVAL = tu; OUTPUT: RETVAL Makefile.PL100644001750001750 307612541314565 14074 0ustar00ghedoghedo000000000000Clang-0.09use Devel::CheckLib; check_lib_or_exit(libpath => '/usr/lib/llvm-3.5/lib', lib => 'clang'); # This Makefile.PL for Clang was generated by # inc::MakeMaker # and Dist::Zilla::Plugin::MakeMaker::Awesome 0.34. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Perl bindings to the Clang compiler's indexing interface", "AUTHOR" => "Alessandro Ghedini ", "CONFIGURE_REQUIRES" => { "Devel::CheckLib" => 0, "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Clang", "INC" => "-I. -I/usr/lib/llvm-3.5/include", "LIBS" => "-L/usr/lib/llvm-3.5/lib -lclang", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "Clang", "OBJECT" => "\$(O_FILES)", "PREREQ_PM" => { "XSLoader" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0 }, "VERSION" => "0.09", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0, "XSLoader" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); t000755001750001750 012541314565 12217 5ustar00ghedoghedo000000000000Clang-0.0901-tunit.t100644001750001750 27512541314565 14111 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl -T use Test::More; use Clang; my $index = Clang::Index -> new(0); my $tunit = $index -> parse('t/fragments/test.c'); is($tunit -> spelling, 't/fragments/test.c'); done_testing; Cursor.xs100644001750001750 460612541314565 14405 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::Cursor CursorKind kind(self) Cursor self CODE: RETVAL = clang_getCursorKind(*self); OUTPUT: RETVAL Type type(self) Cursor self CODE: CXType *retval = malloc(sizeof(CXType)); CXType type = clang_getCursorType(*self); *retval = type; RETVAL = retval; OUTPUT: RETVAL SV * spelling(self) Cursor self CODE: CXString spelling = clang_getCursorSpelling(*self); RETVAL = newSVpv(clang_getCString(spelling), 0); OUTPUT: RETVAL int num_arguments(self) Cursor self CODE: int num_arguments = clang_Cursor_getNumArguments(*self); RETVAL = num_arguments; OUTPUT: RETVAL SV * displayname(self) Cursor self CODE: CXString dname = clang_getCursorDisplayName(*self); RETVAL = newSVpv(clang_getCString(dname), 0); OUTPUT: RETVAL AV * children(self) Cursor self CODE: AV *children = newAV(); clang_visitChildren(*self, visitor, children); RETVAL = children; OUTPUT: RETVAL SV * is_pure_virtual(self) Cursor self CODE: RETVAL = clang_CXXMethod_isPureVirtual(*self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_virtual(self) Cursor self CODE: RETVAL = clang_CXXMethod_isVirtual(*self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL void location(self) Cursor self INIT: CXFile file; const char *filename; unsigned int line, line_end, col, col_end, offset; PPCODE: CXSourceLocation loc = clang_getCursorLocation(*self); CXSourceRange range = clang_getCursorExtent(*self); CXSourceLocation end = clang_getRangeEnd(range); clang_getSpellingLocation(loc, &file, &line, &col, NULL); clang_getSpellingLocation(end, NULL, &line_end, &col_end, NULL); filename = clang_getCString(clang_getFileName(file)); if (filename != NULL) mXPUSHp(filename, strlen(filename)); else mXPUSHp("", 0); mXPUSHi(line); mXPUSHi(col); mXPUSHi(line_end); mXPUSHi(col_end); SV * access_specifier(self) Cursor self CODE: enum CX_CXXAccessSpecifier access = clang_getCXXAccessSpecifier(*self); const char *accessStr = 0; switch (access) { case CX_CXXInvalidAccessSpecifier: accessStr = "invalid"; break; case CX_CXXPublic: accessStr = "public"; break; case CX_CXXProtected: accessStr = "protected"; break; case CX_CXXPrivate: accessStr = "private"; break; } RETVAL = newSVpv(accessStr, 0); OUTPUT: RETVAL void DESTROY(self) Cursor self CODE: free(self); lib000755001750001750 012541314565 12522 5ustar00ghedoghedo000000000000Clang-0.09Clang.pm100644001750001750 233612541314565 14250 0ustar00ghedoghedo000000000000Clang-0.09/libpackage Clang; $Clang::VERSION = '0.09'; use strict; use warnings; require XSLoader; XSLoader::load('Clang', $Clang::VERSION); =head1 NAME Clang - Perl bindings to the Clang compiler's indexing interface =head1 VERSION version 0.09 =head1 SYNOPSIS use Clang; my $index = Clang::Index -> new(1); my $tunit = $index -> parse('file.c'); my $nodes = $tunit -> cursor -> children; foreach my $node (@$nodes) { say $node -> spelling; say $node -> kind -> spelling; } =head1 DESCRIPTION Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages which uses LLVM as its back end. This module provides Perl bindings to the Clang indexing interface, used for extracting high-level symbol information from source files without exposing the full Clang C++ API. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang MANIFEST.SKIP100644001750001750 3112541314565 13744 0ustar00ghedoghedo000000000000Clang-0.09Clang.bs Clang.c Clang.o 02-cursor.t100644001750001750 1044612541314565 14325 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl -T use Test::More; use Clang; my $index = Clang::Index -> new(0); my $tunit = $index -> parse('t/fragments/test.c'); my $cursr = $tunit -> cursor; is($cursr -> spelling, 't/fragments/test.c'); is($cursr -> displayname, 't/fragments/test.c'); my $cursors = $cursr -> children; my @spellings = map { $_ -> spelling } @$cursors; my @expected = qw( foo main ); is_deeply(\@spellings, \@expected); my ($file, $line, $column) = $cursr -> location; is($file, ''); is($line, 0); is($column, 0); my @locations = map { join ' ', $_ -> location } @$cursors; @expected = ( 't/fragments/test.c 1 6 5 2', 't/fragments/test.c 7 5 11 2' ); is_deeply(\@locations, \@expected); $index = Clang::Index -> new(0); $tunit = $index -> parse('t/fragments/main.cpp'); $cursr = $tunit -> cursor; #Testing of method spelling is($cursr -> spelling, 't/fragments/main.cpp'); #Testing of method num_arguments my $num_arguments = 0; _visit_node_arguments($cursr); sub _visit_node_arguments { my $node = shift; if($node->kind->spelling() eq "FunctionDecl"){ $num_arguments = $node->num_arguments; } my $children = $node->children; foreach my $child(@$children) { _visit_node_arguments($child); } } is($num_arguments, 2); #Testing of method displayname is($cursr -> displayname, 't/fragments/main.cpp'); $cursors = $cursr -> children; @spellings = map { $_ -> spelling } @$cursors; @expected = qw( Person main ); is_deeply(\@spellings, \@expected); ($file, $line, $column) = $cursr -> location; is($file, ''); is($line, 0); is($column, 0); @locations = map { join ' ', $_ -> location } @$cursors; @expected = ( 't/fragments/person.h 4 7 13 2', 't/fragments/main.cpp 3 5 5 2' ); is_deeply(\@locations, \@expected); $cursors = @$cursors[0] -> children; @access = map { join ' ', $_ -> access_specifier } @$cursors; @expected = ( 'public', 'public', 'public', 'public', 'private', 'private', 'private' ); is_deeply(\@access,\@expected); #Testing if a method is pure virtual or not $index = Clang::Index -> new(0); $tunit = $index -> parse('t/fragments/cat.cc'); $cursr = $tunit -> cursor; $kind = $cursr -> kind; $cursors = $cursr -> children; my $check_pure_virtual = 'false'; my $pure_virtual_name = 'undef'; _visit_node($cursr); sub _visit_node { my $node = shift; if($node->is_pure_virtual){ $pure_virtual_name = $node->spelling; $check_pure_virtual = 'true'; } my $children = $node->children; foreach my $child(@$children) { _visit_node($child); } } is($check_pure_virtual,'true'); is($pure_virtual_name,'name'); #Testing if a method is virtual or not $index = Clang::Index -> new(0); $tunit = $index -> parse('t/fragments/cat.cc'); $cursr = $tunit -> cursor; $kind = $cursr -> kind; $cursors = $cursr -> children; my $check_virtual = 'false'; my $virtual_name = 'undef'; _visit_node_virtual($cursr); sub _visit_node_virtual { my $node = shift; if($node->is_virtual){ $virtual_name = $node->spelling; $check_virtual = 'true'; } my $children = $node->children; foreach my $child(@$children) { _visit_node_virtual($child); } } is($check_virtual,'true'); is($virtual_name,'name'); $tunit = $index -> parse('t/fragments/main.cpp'); $cursr = $tunit -> cursor; my $method_num_arguments = -4; _visit_node_method_arguments($cursr); sub _visit_node_method_arguments { my $node = shift; if($node->kind->spelling() eq "CXXMethod"){ if ($node->spelling() eq "walk"){ $method_num_arguments = $node->num_arguments; is($method_num_arguments, 2); } else{ ## test methods getAge() and getId() $method_num_arguments = $node->num_arguments; is($method_num_arguments, 0); } } my $children = $node->children; foreach my $child(@$children) { _visit_node_method_arguments($child); } } $tunit = $index -> parse('t/fragments/test.c'); $cursr = $tunit -> cursor; my $function_num_arguments = -5; _visit_node_method_arguments($cursr); sub _visit_node_method_arguments { my $node = shift; if($node->kind->spelling() eq "FunctionDecl"){ if ($node->spelling() eq "foo"){ $method_num_arguments = $node->num_arguments; is($method_num_arguments, 1); } else{ ## test function main() $method_num_arguments = $node->num_arguments; is($method_num_arguments, 2); } } my $children = $node->children; foreach my $child(@$children) { _visit_node_method_arguments($child); } } done_testing; TypeKind.xs100644001750001750 32312541314565 14627 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::TypeKind SV * spelling(self) TypeKind self CODE: CXString spelling = clang_getTypeKindSpelling(self); RETVAL = newSVpv(clang_getCString(spelling), 0); OUTPUT: RETVAL 00-compile.t100644001750001750 236012541314565 14412 0ustar00ghedoghedo000000000000Clang-0.09/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.052 use Test::More; plan tests => 8 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Clang.pm', 'Clang/Cursor.pm', 'Clang/CursorKind.pm', 'Clang/Diagnostic.pm', 'Clang/Index.pm', 'Clang/TUnit.pm', 'Clang/Type.pm', 'Clang/TypeKind.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; 05-typekind.t100644001750001750 64012541314565 14575 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl -T use Test::More; use Clang; my $index = Clang::Index -> new(0); my $tunit = $index -> parse('t/fragments/test.c'); my $cursr = $tunit -> cursor; is($cursr -> type -> kind -> spelling, 'Invalid'); my $cursors = $cursr -> children; my @spellings = map { $_ -> type -> kind -> spelling } @$cursors; my @expected = qw( FunctionProto FunctionProto ); is_deeply(\@spellings, \@expected); done_testing; inc000755001750001750 012541314565 12525 5ustar00ghedoghedo000000000000Clang-0.09MakeMaker.pm100644001750001750 107312541314565 15061 0ustar00ghedoghedo000000000000Clang-0.09/incpackage inc::MakeMaker; use Moose; use Devel::CheckLib; extends 'Dist::Zilla::Plugin::MakeMaker::Awesome'; override _build_MakeFile_PL_template => sub { my ($self) = @_; my $template = "use Devel::CheckLib;\n"; $template .= "check_lib_or_exit(libpath => '/usr/lib/llvm-3.5/lib', lib => 'clang');\n"; return $template.super(); }; override _build_WriteMakefile_args => sub { return +{ %{ super() }, LIBS => '-L/usr/lib/llvm-3.5/lib -lclang', INC => '-I. -I/usr/lib/llvm-3.5/include', OBJECT => '$(O_FILES)', } }; __PACKAGE__ -> meta -> make_immutable; Diagnostic.xs100644001750001750 157012541314565 15211 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::Diagnostic SV * format(self, with_source) Diagnostic self bool with_source CODE: unsigned int opts = 0; if (with_source) { opts = CXDiagnostic_DisplaySourceLocation | CXDiagnostic_DisplayColumn; } CXString fmt = clang_formatDiagnostic(self, opts); RETVAL = newSVpv(clang_getCString(fmt), 0); OUTPUT: RETVAL void location(self) Diagnostic self INIT: CXFile file; const char *filename; unsigned int line, column, offset; PPCODE: CXSourceLocation loc = clang_getDiagnosticLocation(self); clang_getSpellingLocation(loc, &file, &line, &column, NULL); filename = clang_getCString(clang_getFileName(file)); if (filename != NULL) mXPUSHp(filename, strlen(filename)); else mXPUSHp("", 0); mXPUSHi(line); mXPUSHi(column); void DESTROY(self) Diagnostic self CODE: clang_disposeDiagnostic(self); CursorKind.xs100644001750001750 254512541314565 15213 0ustar00ghedoghedo000000000000Clang-0.09/xsMODULE = Clang PACKAGE = Clang::CursorKind SV * spelling(self) CursorKind self CODE: CXString spelling = clang_getCursorKindSpelling(self); RETVAL = newSVpv(clang_getCString(spelling), 0); OUTPUT: RETVAL SV * is_declaration(self) CursorKind self CODE: RETVAL = clang_isDeclaration(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_reference(self) CursorKind self CODE: RETVAL = clang_isReference(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_expression(self) CursorKind self CODE: RETVAL = clang_isExpression(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_statement(self) CursorKind self CODE: RETVAL = clang_isStatement(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_attribute(self) CursorKind self CODE: RETVAL = clang_isAttribute(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_invalid(self) CursorKind self CODE: RETVAL = clang_isInvalid(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_tunit(self) CursorKind self CODE: RETVAL = clang_isTranslationUnit(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_preprocessing(self) CursorKind self CODE: RETVAL = clang_isPreprocessing(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL SV * is_unexposed(self) CursorKind self CODE: RETVAL = clang_isUnexposed(self) ? &PL_sv_yes : &PL_sv_no; OUTPUT: RETVAL 06-diagnostic.t100644001750001750 106612541314565 15116 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl -T use Test::More; use Clang; my $index = Clang::Index -> new(0); my $tunit = $index -> parse('t/fragments/test.c'); my $cursr = $tunit -> cursor; my $diags = $tunit -> diagnostics; my @formats = map { $_ -> format(1) } @$diags; my @expected = ( "t/fragments/test.c:2:10: error: use of undeclared identifier 'argp'", "t/fragments/test.c:4:2: error: void function 'foo' should not return a value", "t/fragments/test.c:8:6: error: initializing 'int' with an expression of incompatible type 'void'" ); is_deeply(\@formats, \@expected); done_testing; 03-cursorkind.t100644001750001750 65012541314565 15130 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl -T use Test::More; use Clang; my $index = Clang::Index -> new(0); my $tunit = $index -> parse('t/fragments/test.c'); my $cursr = $tunit -> cursor; my $kind = $cursr -> kind; is($kind -> spelling, 'TranslationUnit'); my $cursors = $cursr -> children; my @spellings = map { $_ -> kind -> spelling } @$cursors; my @expected = qw( FunctionDecl FunctionDecl ); is_deeply(\@spellings, \@expected); done_testing; fragments000755001750001750 012541314565 14205 5ustar00ghedoghedo000000000000Clang-0.09/tcat.h100644001750001750 26312541314565 15246 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#ifndef _CAT_H_ #define _CAT_H_ #include "mammal.h" class Cat : public Mammal { private: char* _name; public: Cat(char*); virtual const char* name(); }; #endif Clang000755001750001750 012541314565 13546 5ustar00ghedoghedo000000000000Clang-0.09/libType.pm100644001750001750 210312541314565 15161 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::Type; $Clang::Type::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::Type - Clang type class =head1 VERSION version 0.09 =head1 DESCRIPTION A C represents the type of an element in the AST. =head1 METHODS =head2 declaration( ) Retrieve the L that points to the declaration of the given type. =head2 kind( ) Retrieve the L of the given type. =head2 is_const( ) Determine whether the given type has the "const" qualifier. =head2 is_volatile( ) Determine whether the given type has the "volatile" qualifier. =head2 is_restrict( ) Determine whether the given type has the "restrict" qualifier. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::Type test.c100644001750001750 17312541314565 15451 0ustar00ghedoghedo000000000000Clang-0.09/t/fragmentsvoid foo(int arg) { int a = argp + 5; return a; } int main(int argc, char *argv[]) { int a = foo(argc); return a; } cat.cc100644001750001750 16412541314565 15404 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#include "cat.h" Cat::Cat(char* name) { this->_name = name; } const char* Cat::name() { return this->_name; } TUnit.pm100644001750001750 171512541314565 15313 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::TUnit; $Clang::TUnit::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::TUnit - Clang translation unit class =head1 VERSION version 0.09 =head1 DESCRIPTION A C represents a single translation unit which resides in an index. =head1 METHODS =head2 cursor( ) Retrieve the L corresponding to the given translation unit. =head2 spelling( ) Retrieve the original translation unit source file name. =head2 diagnostics( ) Retrieve the Ls associated with the given C. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::TUnit Index.pm100644001750001750 162012541314565 15312 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::Index; $Clang::Index::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::Index - Clang index class =head1 VERSION version 0.09 =head1 DESCRIPTION A C represents a set of translation units that would typically be linked together into an executable or library. =head1 METHODS =head2 new( $exclude_declarations ) Create a new C object. =head2 parse( $filename ) Parse the file C<$filename> and retrieve the corresponding L. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::Index Cursor.pm100644001750001750 376112541314565 15530 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::Cursor; $Clang::Cursor::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::Cursor - Clang cursor class =head1 VERSION version 0.09 =head1 DESCRIPTION A C represents an element in the abstract syntax tree of a translation unit. =head1 METHODS =head2 kind( ) Retrieve the L of the given cursor. =head2 type( ) Retrieve the L of the entity referenced by the given cursor. =head2 spelling( ) Retrieve the name for the entity referenced by the given cursor. =head2 num_arguments( ) Retrieve the number of arguments referenced by the given cursor. =head2 displayname( ) Return the display name for the entity referenced by the given cursor. =head2 children( ) Retrieve a list of the children of the given cursor. The children are C objects too. =head2 is_pure_virtual( ) Determine whether the given cursor kind represents a pure virtual method. =head2 is_virtual( ) Determine whether the given cursor kind represents a virtual method. =head2 location( ) Retrieve the location of the given cursor. This function returns five values: a string containing the source file name, an integer containing the initial line number, an integer containing the initial column number, an integer containing the final line number, and another integer containing the final column number. =head2 access_specifier( ) Retrieve the access of the given cursor. This can return the following values: C, C, C or C. Note that this only works for C++ code, it will return C for C functions. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::Cursor person.h100644001750001750 22412541314565 16002 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#ifndef _PERSON_h #define _PERSON_H class Person { public: int getAge(); int getId(); Person(int, int); private: int age; int id; }; #endif main.cpp100644001750001750 12012541314565 15746 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#include "person.h" int main(int argc, char const *argv[]) { Person p(2,2); } animal.h100644001750001750 15712541314565 15742 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#ifndef _ANIMAL_H_ #define _ANIMAL_H_ class Animal { public: virtual const char* name() = 0; }; #endif mammal.h100644001750001750 14512541314565 15742 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#ifndef _MAMMAL_H_ #define _MAMMAL_H_ #include "animal.h" class Mammal: public Animal { }; #endif TypeKind.pm100644001750001750 136212541314565 15775 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::TypeKind; $Clang::TypeKind::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::TypeKind - Clang type kind class =head1 VERSION version 0.09 =head1 DESCRIPTION A C describes the kind of a given type. =head1 METHODS/SUBROUTINES =head2 spelling( ) Retrieve the name of the given type kind. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::TypeKind person.cpp100644001750001750 21212541314565 16332 0ustar00ghedoghedo000000000000Clang-0.09/t/fragments#include "person.h" Person::Person(int age, int id){ this->age = age; this->id = id; } void Person::walk(int distance, float angle){ }release-pod-syntax.t100644001750001750 45612541314565 16255 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Diagnostic.pm100644001750001750 213312541314565 16327 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::Diagnostic; $Clang::Diagnostic::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::Diagnostic - Clang diagnostic class =head1 VERSION version 0.09 =head1 DESCRIPTION A C represents a diagnostic reported by the compiler. =head1 METHODS =head2 format( $with_source ) Format the given C as string. If C<$with_source> is true, the stringified source location of the diagnostic will be included. =head2 location( ) Retrieve the location of the given diagnostic. This function returns three values: a string containing the source file name, an integer containing the line number and another integer containing the column number. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::Diagnostic CursorKind.pm100644001750001750 313012541314565 16324 0ustar00ghedoghedo000000000000Clang-0.09/lib/Clangpackage Clang::CursorKind; $Clang::CursorKind::VERSION = '0.09'; use strict; use warnings; =head1 NAME Clang::CursorKind - Clang cursor kind class =head1 VERSION version 0.09 =head1 DESCRIPTION A C describes the kind of entity that a cursor refers to. =head1 METHODS =head2 spelling( ) Retrieve the name of the given cursor kind. =head2 is_declaration( ) Determine whether the given cursor kind represents a declaration. =head2 is_reference( ) Determine whether the given cursor kind represents a reference. =head2 is_expression( ) Determine whether the given cursor kind represents an expression. =head2 is_statement( ) Determine whether the given cursor kind represents a statement. =head2 is_attribute( ) Determine whether the given cursor kind represents an attribute. =head2 is_invalid( ) Determine whether the given cursor kind represents an invalid cursor. =head2 is_tunit( ) Determine whether the given cursor kind represents a translation unit. =head2 is_preprocessing( ) Determine whether the given cursor kind represents a preprocessing element. =head2 is_unexposed( ) Determine whether the given cursor kind represents an unexposed piece of the AST. =head1 AUTHOR Alessandro Ghedini =head1 LICENSE AND COPYRIGHT Copyright 2012 Alessandro Ghedini. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; # End of Clang::CursorKind release-pod-coverage.t100644001750001750 57212541314565 16521 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); release-check-manifest.t100644001750001750 73712541314565 17032 0ustar00ghedoghedo000000000000Clang-0.09/t#!perl -T BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::CheckManifest 1.24"; plan skip_all => "Test::CheckManifest 1.24 required for testing MANIFEST" if $@; ok_manifest();