[libclang-perl] 01/03: Import original source of Clang 0.09
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Sat Jul 18 06:10:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to annotated tag debian/0.09-1
in repository libclang-perl.
commit e51db661dc4fe5d488b73d8c8e6c7837b402a8bf
Author: Lucas Kanashiro <kanashiro.duarte at gmail.com>
Date: Sat Jul 18 01:50:35 2015 -0300
Import original source of Clang 0.09
---
Changes | 58 +++++++
Clang.xs | 37 +++++
LICENSE | 379 +++++++++++++++++++++++++++++++++++++++++++++
MANIFEST | 47 ++++++
MANIFEST.SKIP | 3 +
META.json | 360 ++++++++++++++++++++++++++++++++++++++++++
META.yml | 259 +++++++++++++++++++++++++++++++
Makefile.PL | 64 ++++++++
README | 15 ++
README.pod | 52 +++++++
TODO | 4 +
dist.ini | 14 ++
inc/MakeMaker.pm | 25 +++
lib/Clang.pm | 56 +++++++
lib/Clang/Cursor.pm | 83 ++++++++++
lib/Clang/CursorKind.pm | 77 +++++++++
lib/Clang/Diagnostic.pm | 47 ++++++
lib/Clang/Index.pm | 45 ++++++
lib/Clang/TUnit.pm | 48 ++++++
lib/Clang/Type.pm | 56 +++++++
lib/Clang/TypeKind.pm | 40 +++++
t/00-compile.t | 58 +++++++
t/01-tunit.t | 12 ++
t/02-cursor.t | 195 +++++++++++++++++++++++
t/03-cursorkind.t | 23 +++
t/05-typekind.t | 23 +++
t/06-diagnostic.t | 23 +++
t/fragments/animal.h | 9 ++
t/fragments/cat.cc | 9 ++
t/fragments/cat.h | 14 ++
t/fragments/main.cpp | 5 +
t/fragments/mammal.h | 9 ++
t/fragments/person.cpp | 10 ++
t/fragments/person.h | 15 ++
t/fragments/test.c | 11 ++
t/release-check-manifest.t | 24 +++
t/release-pod-coverage.t | 15 ++
t/release-pod-syntax.t | 14 ++
typemap | 25 +++
xs/Cursor.xs | 153 ++++++++++++++++++
xs/CursorKind.xs | 92 +++++++++++
xs/Diagnostic.xs | 50 ++++++
xs/Index.xs | 33 ++++
xs/TUnit.xs | 51 ++++++
xs/Type.xs | 60 +++++++
xs/TypeKind.xs | 11 ++
46 files changed, 2713 insertions(+)
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..e21e43d
--- /dev/null
+++ b/Changes
@@ -0,0 +1,58 @@
+Revision 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
diff --git a/Clang.xs b/Clang.xs
new file mode 100644
index 0000000..b3c1087
--- /dev/null
+++ b/Clang.xs
@@ -0,0 +1,37 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <clang-c/Index.h>
+
+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
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..353ef2b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,379 @@
+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.
+
+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.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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.
+
+ <signature of Ty Coon>, 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
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..c8e8ecb
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,47 @@
+# 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
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644
index 0000000..6ff5958
--- /dev/null
+++ b/MANIFEST.SKIP
@@ -0,0 +1,3 @@
+Clang.bs
+Clang.c
+Clang.o
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..e05b2a7
--- /dev/null
+++ b/META.json
@@ -0,0 +1,360 @@
+{
+ "abstract" : "Perl bindings to the Clang compiler's indexing interface",
+ "author" : [
+ "Alessandro Ghedini <alexbio at cpan.org>"
+ ],
+ "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"
+ }
+ }
+}
+
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..b947cce
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,259 @@
+---
+abstract: "Perl bindings to the Clang compiler's indexing interface"
+author:
+ - 'Alessandro Ghedini <alexbio at cpan.org>'
+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'
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..e4c681d
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,64 @@
+use 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 <self>
+# 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 <alexbio\@cpan.org>",
+ "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);
diff --git a/README b/README
new file mode 100644
index 0000000..b487fa2
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+
+
+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.
+
diff --git a/README.pod b/README.pod
new file mode 100644
index 0000000..23a71fa
--- /dev/null
+++ b/README.pod
@@ -0,0 +1,52 @@
+package 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 <alexbio at cpan.org>
+
+=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
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..2c4598e
--- /dev/null
+++ b/TODO
@@ -0,0 +1,4 @@
+* comment support (to be released)
+* token support
+* code completion support
+* other (see python's cindex)
diff --git a/dist.ini b/dist.ini
new file mode 100644
index 0000000..a8407b0
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,14 @@
+name = Clang
+author = Alessandro Ghedini <alexbio at cpan.org>
+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]
diff --git a/inc/MakeMaker.pm b/inc/MakeMaker.pm
new file mode 100644
index 0000000..721d7c1
--- /dev/null
+++ b/inc/MakeMaker.pm
@@ -0,0 +1,25 @@
+package 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;
diff --git a/lib/Clang.pm b/lib/Clang.pm
new file mode 100644
index 0000000..7bc7331
--- /dev/null
+++ b/lib/Clang.pm
@@ -0,0 +1,56 @@
+package 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 <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/Cursor.pm b/lib/Clang/Cursor.pm
new file mode 100644
index 0000000..4690453
--- /dev/null
+++ b/lib/Clang/Cursor.pm
@@ -0,0 +1,83 @@
+package 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<Clang::Cursor> represents an element in the abstract syntax tree of a
+translation unit.
+
+=head1 METHODS
+
+=head2 kind( )
+
+Retrieve the L<Clang::CursorKind> of the given cursor.
+
+=head2 type( )
+
+Retrieve the L<Clang::Type> 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<Clang::Cursor> 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<invalid>, C<public>, C<protected> or C<private>. Note that this only works
+for C++ code, it will return C<invalid> for C functions.
+
+=head1 AUTHOR
+
+Alessandro Ghedini <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/CursorKind.pm b/lib/Clang/CursorKind.pm
new file mode 100644
index 0000000..bf33033
--- /dev/null
+++ b/lib/Clang/CursorKind.pm
@@ -0,0 +1,77 @@
+package 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<Clang::CursorKind> 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 <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/Diagnostic.pm b/lib/Clang/Diagnostic.pm
new file mode 100644
index 0000000..edbd76f
--- /dev/null
+++ b/lib/Clang/Diagnostic.pm
@@ -0,0 +1,47 @@
+package 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<Clang::Diagnostic> represents a diagnostic reported by the compiler.
+
+=head1 METHODS
+
+=head2 format( $with_source )
+
+Format the given C<Clang::Diagnostic> 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 <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/Index.pm b/lib/Clang/Index.pm
new file mode 100644
index 0000000..066d6dc
--- /dev/null
+++ b/lib/Clang/Index.pm
@@ -0,0 +1,45 @@
+package 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<Clang::Index> 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<Clang::Index> object.
+
+=head2 parse( $filename )
+
+Parse the file C<$filename> and retrieve the corresponding L<Clang::TUnit>.
+
+=head1 AUTHOR
+
+Alessandro Ghedini <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/TUnit.pm b/lib/Clang/TUnit.pm
new file mode 100644
index 0000000..f9760c9
--- /dev/null
+++ b/lib/Clang/TUnit.pm
@@ -0,0 +1,48 @@
+package 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<Clang::TUnit> represents a single translation unit which resides in an index.
+
+=head1 METHODS
+
+=head2 cursor( )
+
+Retrieve the L<Clang::Cursor> corresponding to the given translation unit.
+
+=head2 spelling( )
+
+Retrieve the original translation unit source file name.
+
+=head2 diagnostics( )
+
+Retrieve the L<Clang::Diagnostic>s associated with the given C<Clang::TUnit>.
+
+=head1 AUTHOR
+
+Alessandro Ghedini <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/Type.pm b/lib/Clang/Type.pm
new file mode 100644
index 0000000..a37eef9
--- /dev/null
+++ b/lib/Clang/Type.pm
@@ -0,0 +1,56 @@
+package 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<Clang::Type> represents the type of an element in the AST.
+
+=head1 METHODS
+
+=head2 declaration( )
+
+Retrieve the L<Clang::Cursor> that points to the declaration of the given type.
+
+=head2 kind( )
+
+Retrieve the L<Clang::TypeKind> 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 <alexbio at cpan.org>
+
+=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
diff --git a/lib/Clang/TypeKind.pm b/lib/Clang/TypeKind.pm
new file mode 100644
index 0000000..763a7e7
--- /dev/null
+++ b/lib/Clang/TypeKind.pm
@@ -0,0 +1,40 @@
+package 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<Clang::TypeKind> describes the kind of a given type.
+
+=head1 METHODS/SUBROUTINES
+
+=head2 spelling( )
+
+Retrieve the name of the given type kind.
+
+=head1 AUTHOR
+
+Alessandro Ghedini <alexbio at cpan.org>
+
+=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
diff --git a/t/00-compile.t b/t/00-compile.t
new file mode 100644
index 0000000..0de2a1c
--- /dev/null
+++ b/t/00-compile.t
@@ -0,0 +1,58 @@
+use 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<perlfaq8/How can I capture STDERR from an external command?>
+ 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};
+
+
diff --git a/t/01-tunit.t b/t/01-tunit.t
new file mode 100644
index 0000000..2021f2a
--- /dev/null
+++ b/t/01-tunit.t
@@ -0,0 +1,12 @@
+#!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;
diff --git a/t/02-cursor.t b/t/02-cursor.t
new file mode 100644
index 0000000..c5f8226
--- /dev/null
+++ b/t/02-cursor.t
@@ -0,0 +1,195 @@
+#!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;
+ at 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;
+
+ at spellings = map { $_ -> spelling } @$cursors;
+ at expected = qw(
+ Person
+ main
+);
+
+is_deeply(\@spellings, \@expected);
+
+($file, $line, $column) = $cursr -> location;
+is($file, ''); is($line, 0); is($column, 0);
+
+ at locations = map { join ' ', $_ -> location } @$cursors;
+ at 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;
+
+ at access = map { join ' ', $_ -> access_specifier } @$cursors;
+ at 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;
diff --git a/t/03-cursorkind.t b/t/03-cursorkind.t
new file mode 100644
index 0000000..d8df90f
--- /dev/null
+++ b/t/03-cursorkind.t
@@ -0,0 +1,23 @@
+#!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;
diff --git a/t/05-typekind.t b/t/05-typekind.t
new file mode 100644
index 0000000..81b7bce
--- /dev/null
+++ b/t/05-typekind.t
@@ -0,0 +1,23 @@
+#!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;
diff --git a/t/06-diagnostic.t b/t/06-diagnostic.t
new file mode 100644
index 0000000..611f801
--- /dev/null
+++ b/t/06-diagnostic.t
@@ -0,0 +1,23 @@
+#!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;
+
diff --git a/t/fragments/animal.h b/t/fragments/animal.h
new file mode 100644
index 0000000..b76b57c
--- /dev/null
+++ b/t/fragments/animal.h
@@ -0,0 +1,9 @@
+#ifndef _ANIMAL_H_
+#define _ANIMAL_H_
+
+class Animal {
+ public:
+ virtual const char* name() = 0;
+};
+
+#endif
diff --git a/t/fragments/cat.cc b/t/fragments/cat.cc
new file mode 100644
index 0000000..0c8bd75
--- /dev/null
+++ b/t/fragments/cat.cc
@@ -0,0 +1,9 @@
+#include "cat.h"
+
+Cat::Cat(char* name) {
+ this->_name = name;
+}
+
+const char* Cat::name() {
+ return this->_name;
+}
diff --git a/t/fragments/cat.h b/t/fragments/cat.h
new file mode 100644
index 0000000..838d8b3
--- /dev/null
+++ b/t/fragments/cat.h
@@ -0,0 +1,14 @@
+#ifndef _CAT_H_
+#define _CAT_H_
+
+#include "mammal.h"
+
+class Cat : public Mammal {
+ private:
+ char* _name;
+ public:
+ Cat(char*);
+ virtual const char* name();
+};
+
+#endif
diff --git a/t/fragments/main.cpp b/t/fragments/main.cpp
new file mode 100644
index 0000000..927a11f
--- /dev/null
+++ b/t/fragments/main.cpp
@@ -0,0 +1,5 @@
+#include "person.h"
+
+int main(int argc, char const *argv[]) {
+ Person p(2,2);
+}
diff --git a/t/fragments/mammal.h b/t/fragments/mammal.h
new file mode 100644
index 0000000..bc1fc5d
--- /dev/null
+++ b/t/fragments/mammal.h
@@ -0,0 +1,9 @@
+#ifndef _MAMMAL_H_
+#define _MAMMAL_H_
+
+#include "animal.h"
+
+class Mammal: public Animal {
+};
+
+#endif
diff --git a/t/fragments/person.cpp b/t/fragments/person.cpp
new file mode 100644
index 0000000..9c30f71
--- /dev/null
+++ b/t/fragments/person.cpp
@@ -0,0 +1,10 @@
+#include "person.h"
+
+Person::Person(int age, int id){
+ this->age = age;
+ this->id = id;
+}
+
+void
+Person::walk(int distance, float angle){
+}
\ No newline at end of file
diff --git a/t/fragments/person.h b/t/fragments/person.h
new file mode 100644
index 0000000..96af9f7
--- /dev/null
+++ b/t/fragments/person.h
@@ -0,0 +1,15 @@
+#ifndef _PERSON_h
+#define _PERSON_H
+
+class Person {
+public:
+ int getAge();
+ int getId();
+ Person(int, int);
+
+private:
+ int age;
+ int id;
+};
+
+#endif
diff --git a/t/fragments/test.c b/t/fragments/test.c
new file mode 100644
index 0000000..c2edab3
--- /dev/null
+++ b/t/fragments/test.c
@@ -0,0 +1,11 @@
+void foo(int arg) {
+ int a = argp + 5;
+
+ return a;
+}
+
+int main(int argc, char *argv[]) {
+ int a = foo(argc);
+
+ return a;
+}
diff --git a/t/release-check-manifest.t b/t/release-check-manifest.t
new file mode 100644
index 0000000..70a74d7
--- /dev/null
+++ b/t/release-check-manifest.t
@@ -0,0 +1,24 @@
+#!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();
diff --git a/t/release-pod-coverage.t b/t/release-pod-coverage.t
new file mode 100644
index 0000000..18a8274
--- /dev/null
+++ b/t/release-pod-coverage.t
@@ -0,0 +1,15 @@
+#!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' });
diff --git a/t/release-pod-syntax.t b/t/release-pod-syntax.t
new file mode 100644
index 0000000..cdd6a6c
--- /dev/null
+++ b/t/release-pod-syntax.t
@@ -0,0 +1,14 @@
+#!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();
diff --git a/typemap b/typemap
new file mode 100644
index 0000000..e38b692
--- /dev/null
+++ b/typemap
@@ -0,0 +1,25 @@
+Index 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}\");
diff --git a/xs/Cursor.xs b/xs/Cursor.xs
new file mode 100644
index 0000000..34bb7d9
--- /dev/null
+++ b/xs/Cursor.xs
@@ -0,0 +1,153 @@
+MODULE = 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);
diff --git a/xs/CursorKind.xs b/xs/CursorKind.xs
new file mode 100644
index 0000000..407441f
--- /dev/null
+++ b/xs/CursorKind.xs
@@ -0,0 +1,92 @@
+MODULE = 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
diff --git a/xs/Diagnostic.xs b/xs/Diagnostic.xs
new file mode 100644
index 0000000..85558fb
--- /dev/null
+++ b/xs/Diagnostic.xs
@@ -0,0 +1,50 @@
+MODULE = 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);
diff --git a/xs/Index.xs b/xs/Index.xs
new file mode 100644
index 0000000..2e6f1a4
--- /dev/null
+++ b/xs/Index.xs
@@ -0,0 +1,33 @@
+MODULE = 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
diff --git a/xs/TUnit.xs b/xs/TUnit.xs
new file mode 100644
index 0000000..b5f73ff
--- /dev/null
+++ b/xs/TUnit.xs
@@ -0,0 +1,51 @@
+MODULE = 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);
diff --git a/xs/Type.xs b/xs/Type.xs
new file mode 100644
index 0000000..d01d1ac
--- /dev/null
+++ b/xs/Type.xs
@@ -0,0 +1,60 @@
+MODULE = 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);
diff --git a/xs/TypeKind.xs b/xs/TypeKind.xs
new file mode 100644
index 0000000..21f7d58
--- /dev/null
+++ b/xs/TypeKind.xs
@@ -0,0 +1,11 @@
+MODULE = Clang PACKAGE = Clang::TypeKind
+
+SV *
+spelling(self)
+ TypeKind self
+
+ CODE:
+ CXString spelling = clang_getTypeKindSpelling(self);
+ RETVAL = newSVpv(clang_getCString(spelling), 0);
+
+ OUTPUT: RETVAL
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libclang-perl.git
More information about the Pkg-perl-cvs-commits
mailing list