GithubHelp home page GithubHelp logo

castxml's Introduction

CastXML

Introduction

CastXML is a C-family abstract syntax tree XML output tool.

This project is maintained by Kitware in support of ITK, the Insight Segmentation and Registration Toolkit.

Manual

See the castxml(1) manual page for instructions to run the tool.

License

CastXML is licensed under the Apache License, Version 2.0. See the LICENSE and NOTICE files for details.

Superbuild

If you are looking for pre-built binaries, or a compact way to build this project, please see CastXMLSuperbuild.

Build

To build CastXML from source, first obtain the prerequisites:

  • A C++ compiler supporting the c++11 standard language level.
  • CMake cross-platform build system generator.
  • LLVM/Clang compiler SDK install tree built using the C++ compiler. This version of CastXML has been tested with LLVM/Clang
    • Git main as of 2024-03-06 (f7d354af57)
    • Release 18.1
    • Release 17.0
    • Release 16.0
    • Release 15.0
    • Release 14.0
    • Release 13.0
    • Release 12.0
    • Release 11.0
    • Release 10.0
    • Release 9.0
    • Release 8.0
    • Release 7.0
    • Release 6.0
    • Release 5.0
    • Release 4.0
    • Release 3.9
    • Release 3.8
    • Release 3.7
    • Release 3.6
  • Optionally, the Sphinx documentation generator to build documentation.

Run CMake on the CastXML source tree to generate a build tree using a C++ compiler compatible with that used to build the LLVM/Clang SDK. CMake options include:

Clang_DIR
Location of the LLVM/Clang SDK. Set to <prefix>/lib/cmake/clang, where <prefix> is the top of the LLVM/Clang SDK install tree. Alternatively, LLVM_DIR may be set to <prefix>/lib/cmake/llvm.
SPHINX_EXECUTABLE
Location of the sphinx-build executable. Required only if building documentation.
SPHINX_HTML
Build documentation in html format.
SPHINX_MAN
Build documentation in man format.

Run the corresponding native build tool (e.g. make) in the CastXML build tree, and optionally build the install target. The castxml command-line tool may be used either from the build tree or the install tree. The install tree is relocatable.

castxml's People

Contributors

bradking avatar dankm avatar ellert avatar ericcousineau-tri avatar gerddie avatar glehmann avatar imichka avatar josephsnyder avatar jwollen avatar kwrobot avatar kylefromkitware avatar lucasgandel avatar markarussell avatar mbdevpl avatar nnemkin avatar plicease avatar smattr avatar teto avatar thewtex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

castxml's Issues

Can't build with llvm 3.8.0 on OS X with gcc-5.3.0

Hi,
I'm trying to build on OS X Darwin 15.2.0 with current:
gcc (Homebrew gcc 5.3.0) 5.3.0

Since llvm-3.6.2 leads to a lot of linker problems I tried at first bringing llvm up to date.

llvm --with-clang --with-asan --HEAD
/usr/local/Cellar/llvm/HEAD/bin/clang --version

clang version 3.8.0
Target: x86_64-apple-darwin15.2.0
Thread model: posix

Cmake was run with the following options:

cmake -DLLVM_DIR=/usr/local/Cellar/llvm/HEAD/share/llvm/cmake/

Compilation leads to the following error:

[ 52%] Building CXX object src/CMakeFiles/castxml.dir/castxml.cxx.o
/Users/carsten/src/gi/thirdParty/src/castXML/src/castxml.cxx: In function 'int main(int, const char*)':
/Users/carsten/src/gi/thirdParty/src/castXML/src/castxml.cxx:76:3: error: 'BumpPtrStringSaver' is not a member of 'llvm'
llvm::BumpPtrStringSaver argSaver(argSaverAlloc);
^
/Users/carsten/src/gi/thirdParty/src/castXML/src/castxml.cxx:81:5: error: 'argSaver' was not declared in this scope
argSaver, llvm::cl::TokenizeGNUCommandLine, argv);
^
make[2]: *
* [src/CMakeFiles/castxml.dir/castxml.cxx.o] Error 1
make[1]: *** [src/CMakeFiles/castxml.dir/all] Error 2
make: *** [all] Error 2

Maybe you have an idea how I can use castXML within OS X
Thanks

Invalid qualified enum name

Found a bug with enum qualification. Given this code

namespace fx{
    enum{ unnamed = 0 };
    void fix_unnamed( int x=unnamed );
}

latest CastXML is generating

  <Enumeration id="_1162" name="" ...>
    <EnumValue name="unnamed" init="0"/>
  </Enumeration>
  <Function id="_1163" name="fix_unnamed" ...>
    <Argument name="x" ... default="fx::::unnamed"/>
  </Function>

The default value is being generated as fx::::unnamed because the enum doesn't have a name.

Add support for templates

Hi

Some pygccxml tests are still failing. A bunch of them expect support for templates. For example
the following struct is not dumped to the xml file:
template <typename T> struct A {};

I've seen comments in castxml's code that templated code is not supported for the moment. Is this something we could set up or was is not done on purpose because something is missing ?

missing template information

I would like to know how I can get the template name for operators and methods with castxml ? For instance, if we have the following code:

class ClassA {
 public:
  template < class T > void foo( const T & ) {  }
  template < class T > ClassA & operator=( const T & ) { return * this; }
};

void test()
{
  ClassA a;
  a = 5;
  a.foo("hello");
}

The xml entry for the operator= and function foo are:

<Method id="_9" name="foo" returns="_15" context="_5" access="public" location="f1:3" file="f1" line="3" inline="1" attributes="__thiscall__">

and

<OperatorMethod id="_10" name="=" returns="_18" context="_5" access="public" location="f1:4" file="f1" line="4" inline="1" attributes="__thiscall__">

This doesn’t expose the template instantiation. Of course, in that particular example, the template is used as the first parameter so I could discover the type this way but it is not portable.

Gccxml was providing a demangled field with that information. For instance:

<Method id="_10" name="foo" returns="_12" context="_4" access="public" mangled="_ZN6ClassA3fooIA6_cEEvRKT_" demangled="void ClassA::foo&lt;char [6]&gt;(char const (&amp;) [6])" location="f0:3" file="f0" line="3" inline="1">

<OperatorMethod id="_11" name="=" returns="_13" context="_4" access="public" mangled="_ZN6ClassAaSIiEERS_RKT_" demangled="ClassA&amp; ClassA::operator=&lt;int&gt;(int const&amp;)" location="f0:4" file="f0" line="4" inline="1">

So how can I find the same information ?

Thank you

dependency problem

As per instruction on clang.llvm and since the revision number is reported to have been tested, I did:

svn co -r 267153 http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co -r 267153 http://llvm.org/svn/llvm-project/cfe/trunk clang (did I choose the right revision? )
cd ../..

and then ran cmake on it and then

cmake --build .
cmake --build --target install

and it installed fine.

Having checked out CastXML, I tried running cmake on it. I tried:

cmake -D LLVM_DIR=path\to\installed\llvm\ -D CLANG_RESOURCE_DIR=path\to\installed\llvm\lib\clang\3.9.0 ..\CastXML

I got the error about the find modules not being found. I then tried:

cmake -D CMAKE_PREFIX_PATH=path\to\downloaded\llvm\cmake\modules -D CLANG_RESOURCE_DIR=path\to\installed\llvm\lib\clang\3.9.0 ..\CastXML

and I get:

CMake Error at C:/Users/VR/llvm/cmake/modules/LLVM-Config.cmake:203 (message):
Library `option' not found in list of llvm libraries.

Have I got the wrong version of CLang source file?

CastXML doesn't like "override"

Hi,

now I get the following error:

Generating itkLevelSetFunction.xml
cd /home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/BUILD/Wrapping/Modules/ITKLevelSets && /usr/local/bin/castxml -o /home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/BUILD/Wrapping/Modules/ITKLevelSets/itkLevelSetFunction.xml --castxml-gccxml --castxml-start cable --castxml-cc-gnu /usr/bin/g++-6 -w -c @/home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/BUILD/Wrapping/Modules/ITKLevelSets/castxml.inc /home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/BUILD/Wrapping/Modules/ITKLevelSets/itkLevelSetFunction.cxx

In file included from /home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/BUILD/Wrapping/Modules/ITKLevelSets/itkLevelSetFunction.cxx:20:
  /home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h:181:21: error: 
        'ComputeUpdate' marked 'override' but does not override any member functions
        virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
                ^
    /home/gerddie/Debian/build-area/insighttoolkit4-4.8.2/BUILD/Wrapping/Modules/ITKLevelSets/itkLevelSetFunction.cxx:31:18: note: in
       instantiation of template class 'itk::LevelSetFunction<itk::Image<float, 2> >' requested here
typedef itk::LevelSetFunction< itk::Image< float,2 > >::Pointer itkLevelSetFunctionIF2_Pointer;

Obviously another C++11 issue, but I have no idea why this goes wrong, AFAIKS the override is perfectly valid.

Building LLVM/Clang wit CMake

I am trying to build LLVM/Clang via Cmake.

I have the LLVM-3.6.0 folder and when I ty to generate the project files wit CMake, he doesn't find any of the .h files like malloch, sognal.h, etc and at the end it fails with this error:

CMake Error at cmake/modules/HandleLLVMOptions.cmake:45 (message):
Host Visual Studio must be at least 2012 (MSVC 17.0)
Call Stack (most recent call first):
CMakeLists.txt:344 (include)

Coudl someone tell me how to fix this error ?

Best regards,

Alexandre

Failure parsing math headers when simulating `g++ -m32 -O`

As reported in Debian bug 813875:

$ cat complex.cxx
#include <complex>
$ castxml complex.cxx --castxml-cc-gnu "(" /usr/bin/g++ -m32 -O ")"
In file included from complex.cxx:1:
In file included from /usr/include/c++/5/complex:44:
In file included from /usr/include/c++/5/cmath:44:
In file included from /usr/include/math.h:427:
/usr/include/bits/mathinline.h:948:9: error: '(anonymous union at /usr/include/bits/mathinline.h:948:9)' cannot be defined in a type specifier
          (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
               ^
/usr/include/bits/mathinline.h:948:55: error: member reference base type 'void' is not a structure or union
          (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
2 errors generated.

Building castxml with clang3.8

Hello,
I'm trying to build castxml with clang3.8 but it doesn't work. I have the following error :
CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:178 (include):

include could not find load file:

/usr/share/llvm/cmake/LLVMExports.cmake

Call Stack (most recent call first):
CMakeLists.txt:64 (find_package)

CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:181 (include):
include could not find load file:

/usr/share/llvm/cmake/LLVM-Config.cmake

Call Stack (most recent call first):
CMakeLists.txt:64 (find_package)

CMake Error at src/CMakeLists.txt:46 (llvm_map_components_to_libnames):
Unknown CMake command "llvm_map_components_to_libnames".

-- Configuring incomplete, errors occurred!

Do you have an idea on what is happening if you have a little time to take a look on it.
Thank you for your help.

liblldConfig.a not found (cmake win7/msys)

Am attempting to build CastXML on Windows 7 using MINGW/MSYS2.

When running the command cmake -G 'Unix Makefiles' ../castXML from a build directory, the following error occurs:

CMake Error at C:/msys64/mingw64/share/llvm/cmake/LLVMExports.cmake:685 (message):
  The imported target "lldConfig" references the file
     "C:/msys64/mingw64/lib/liblldConfig.a"    
  but this file does not exist.  Possible reasons include:    
  * The file was deleted, renamed, or moved to another location.    
  * An install or uninstall procedure did not complete successfully.    
  * The installation package was faulty and contained    
     "C:/msys64/mingw64/share/llvm/cmake/LLVMExports.cmake"    
  but not all the files it references.
Call Stack (most recent call first):
  C:/msys64/mingw64/share/llvm/cmake/LLVMConfig.cmake:120 (include)
  CMakeLists.txt:64 (find_package)

There exists no liblldConfig.a in the MinGW installation of LLVM, and I can't find any info online. Prior to the error, CMake checks all come through OK:

-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/msys64/usr/bin/git.exe (found version "2.7.0")
-- Checking whether header cstdio is available
-- Checking whether header cstdio is available - yes
-- Checking for Large File Support
-- Checking for Large File Support - yes
-- Checking whether C compiler has ptrdiff_t in stddef.h
-- Checking whether C compiler has ptrdiff_t in stddef.h - yes
-- Checking whether C compiler has ssize_t in unistd.h
-- Checking whether C compiler has ssize_t in unistd.h - yes

Installation problem

Good morning,
I have issue building Castxlm, trying hard since 3 days...
Please find make &>castxlmoutpout.txt here:
https://transfert.u-psud.fr/xyjk2
I have done previously:
cmake LLVM_DIR=/usr/share/llvm-3.6/cmake ../

I'm stuck, could you have a look if you have time please ?

Thanks

Best

e

va_list arguments not printed correctly but as "?unknown?"

When printing declaration that contains a va_list as argument, pygccxml prints "?unknown?" instead.

For instance when parsing "int vasprintf(char **strp, const char *fmt, va_list ap);" will generate:
int dce_vasprintf ( char * *, char const *,?unknown? *);

--cast-gccxml does not work with c11

I can't make castxml to work at all on C header. I tried a simple castxml --cast-gccxml -o plop.xml /usr/include/libio.h but it always complain that it does not support c11

Debian packaging?

Hi,

will anyone of your team pursue the creation and maintenance of a Debian/Ubuntu package for castxml? See here for example.

missing type definition

Running the following test case:

template<class _Ty1, class _Ty2>
struct apair
{   
  typedef _Ty1 first_type;
  typedef _Ty2 second_type;

  apair(const _Ty1& _Val1, const _Ty2& _Val2)
    : first(_Val1), second(_Val2) {}

  first_type first;
  second_type second;
};

class start {
  apair<const aclass, double> p;
};

The constructor for apair got generated like this:

<Constructor id="_16" name="apair" context="_6" access="public" location="f1:20" file="f1" line="20" inline="1" attributes="__thiscall__">
  <Argument name="_Val1" type="_29" location="f1:20" file="f1" line="20"/>
  <Argument name="_Val2" type="_30" location="f1:20" file="f1" line="20"/>
</Constructor>

Searching for the first type of _Val1 (i.e. _29) give the following result:

<ReferenceType id="_29" type="_27c"/>
<CvQualifiedType id="_27c" type="_27" const="1"/>

But id _27 is not defined anywhere in the XML.

link error on ubuntu14.4

using gcc 4.8.4, clang 3.9

Linking CXX executable ../bin/castxml
CMakeFiles/castxml.dir/castxml.cxx.o: In function main': castxml.cxx:(.text+0x17f): undefined reference tollvm::cl::TokenizeGNUCommandLine(llvm::StringRef, llvm::cl::StringSaver&, llvm::SmallVectorImpl<char const*>&, bool)'
castxml.cxx:(.text+0x187): undefined reference to llvm::cl::ExpandResponseFiles(llvm::cl::StringSaver&, void (*)(llvm::StringRef, llvm::cl::StringSaver&, llvm::SmallVectorImpl<char const*>&, bool), llvm::SmallVectorImpl<char const*>&, bool)' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::cl::StringSaver::~StringSaver()':
castxml.cxx:(.text._ZN4llvm2cl11StringSaverD2Ev[_ZN4llvm2cl11StringSaverD5Ev]+0x13): undefined reference to vtable for llvm::cl::StringSaver' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::InitializeAllTargetInfos()':
castxml.cxx:(.text._ZN4llvm24InitializeAllTargetInfosEv[_ZN4llvm24InitializeAllTargetInfosEv]+0x5): undefined reference to LLVMInitializeR600TargetInfo' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::InitializeAllTargets()':
castxml.cxx:(.text._ZN4llvm20InitializeAllTargetsEv[_ZN4llvm20InitializeAllTargetsEv]+0xa): undefined reference to LLVMInitializeR600Target' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::InitializeAllTargetMCs()':
castxml.cxx:(.text._ZN4llvm22InitializeAllTargetMCsEv[_ZN4llvm22InitializeAllTargetMCsEv]+0x5): undefined reference to LLVMInitializeR600TargetMC' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::InitializeAllAsmPrinters()':
castxml.cxx:(.text._ZN4llvm24InitializeAllAsmPrintersEv[_ZN4llvm24InitializeAllAsmPrintersEv]+0x5): undefined reference to LLVMInitializeR600AsmPrinter' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::InitializeAllAsmParsers()':
castxml.cxx:(.text.ZN4llvm23InitializeAllAsmParsersEv[ZN4llvm23InitializeAllAsmParsersEv]+0x5): undefined reference to LLVMInitializeR600AsmParser' CMakeFiles/castxml.dir/castxml.cxx.o: In functionllvm::cl::StringSaver::StringSaver()':
castxml.cxx:(.text.ZN4llvm2cl11StringSaverC2Ev[ZN4llvm2cl11StringSaverC5Ev]+0xf): undefined reference to vtable for llvm::cl::StringSaver' CMakeFiles/castxml.dir/castxml.cxx.o:(.rodata._ZTV11StringSaver[_ZTV11StringSaver]+0x10): undefined reference tollvm::cl::StringSaver::anchor()'
CMakeFiles/castxml.dir/Output.cxx.o: In function clang::DeclContext::lookup(clang::DeclarationName) const': Output.cxx:(.text._ZNK5clang11DeclContext6lookupENS_15DeclarationNameE[_ZNK5clang11DeclContext6lookupENS_15DeclarationNameE]+0x1f): undefined reference toclang::DeclContext::lookup(clang::DeclarationName)'
CMakeFiles/castxml.dir/RunClang.cxx.o: In function runClangCreateDiagnostics(char const* const*, char const* const*)': RunClang.cxx:(.text+0x301): undefined reference tollvm::opt::OptTable::ParseArgs(char const* const
, char const
const
, unsigned int&, unsigned int&, unsigned int, unsigned int) const'
CMakeFiles/castxml.dir/RunClang.cxx.o: In function runClangImpl(char const_ const_, char const_ const_, Options const&)': RunClang.cxx:(.text+0x501): undefined reference to clang::driver::Driver::Driver(llvm::StringRef, llvm::StringRef, clang::DiagnosticsEngine&)'
RunClang.cxx:(.text+0x904): undefined reference to`clang::CompilerInstance::CompilerInstance(bool)'
collect2: error: ld returned 1 exit status
make[2]: *
* [bin/castxml] Error 1
make[1]: *** [src/CMakeFiles/castxml.dir/all] Error 2
make: *** [all] Error 2

Can't build with llvm 3.6.2 on OS X

Hi

I am trying to work on CastXML's packaging; so that we can provide binaries through homebrew on Mac.
I am on OS X 10.11.1 (El Capitan) and installed llvm through homebrew (brew install llvm --with-clang).
The install tree is in /usr/local/Cellar/llvm/.

I tested with the corresponding clang version and with the clang version provided by Apple. I get the following linker error:

Undefined symbols for architecture x86_64:
  "std::bad_cast::bad_cast()", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::seekoff(long long, std::__1::ios_base::seekdir, unsigned int) in Utils.cxx.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::sync() in Utils.cxx.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::underflow() in Utils.cxx.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::overflow(int) in Utils.cxx.o
  "std::bad_cast::~bad_cast()", referenced from:
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::seekoff(long long, std::__1::ios_base::seekdir, unsigned int) in Utils.cxx.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::sync() in Utils.cxx.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::underflow() in Utils.cxx.o
      std::__1::basic_filebuf<char, std::__1::char_traits<char> >::overflow(int) in Utils.cxx.o
  "std::terminate()", referenced from:
      ___clang_call_terminate in castxml.cxx.o
      ___clang_call_terminate in Detect.cxx.o
      ___clang_call_terminate in Output.cxx.o
      ___clang_call_terminate in RunClang.cxx.o
      ___clang_call_terminate in Utils.cxx.o
ld: symbol(s) not found for architecture x86_64

Cmake was run with the following options:

cmake DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/3.6.2/bin/clang++ -DLLVM_DIR=/usr/local/Cellar/llvm/3.6.2/share/llvm/cmake

Here is cmake's output:
https://gist.github.com/iMichka/9e256769e3bbd691b886

And here make:
https://gist.github.com/iMichka/32592928dc466be6ff86

Maybe you can help me out here. It would be great to have a reliable way to compile CastXML on OS X (and I would prefer not to keep multiple llvm versions around on my macbook, this is eating up a lot of space :)).

__builtin_va_arg_pack not supported by castxml

The problem is triggered by compiling ITK-4.9 using the host compiler g++-5.3.1. and is actually already reported for llvm upstream.

Specifically, I get

cd /home/gerddie/build-area/insighttoolkit4-4.9.0/BUILD/Wrapping/Modules/ITKImageFilterBase && /usr/bin/castxml -o /home/gerddie/build-area/insighttoolkit4-4.9.0/BUILD/Wrapping/itkRecursiveSeparableImageFilter.xml --castxml-gccxml --castxml-start _wrapping_ --castxml-cc-gnu "(" /usr/bin/c++ -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel ")" -w -c @/home/gerddie/build-area/insighttoolkit4-4.9.0/BUILD/Wrapping/ITKImageFilterBase.castxml.inc /home/gerddie/build-area/insighttoolkit4-4.9.0/BUILD/Wrapping/itkRecursiveSeparableImageFilter.cxx


In file included from /home/gerddie/build-area/insighttoolkit4-4.9.0/BUILD/Wrapping/itkRecursiveSeparableImageFilter.cxx:1:
In file included from /home/gerddie/build-area/insighttoolkit4-4.9.0/Modules/Core/Common/include/itkCommand.h:21:
In file included from /home/gerddie/build-area/insighttoolkit4-4.9.0/Modules/Core/Common/include/itkObject.h:31:
In file included from /home/gerddie/build-area/insighttoolkit4-4.9.0/Modules/Core/Common/include/itkLightObject.h:21:
In file included from /home/gerddie/build-area/insighttoolkit4-4.9.0/Modules/Core/Common/include/itkMacro.h:47:
In file included from /usr/include/c++/5/string:40:
In file included from /usr/include/c++/5/bits/char_traits.h:40:
In file included from /usr/include/c++/5/bits/postypes.h:40:
In file included from /usr/include/c++/5/cwchar:44:
In file included from /usr/include/wchar.h:884:
    /usr/include/x86_64-linux-gnu/bits/wchar2.h:291:14: error: use of undeclared identifier '__builtin_va_arg_pack'
                       __fmt, __va_arg_pack ());
                              ^
    /usr/include/x86_64-linux-gnu/sys/cdefs.h:349:26: note: expanded from macro '__va_arg_pack'
        # define __va_arg_pack() __builtin_va_arg_pack ()

g++ --version: g++ (Debian 5.3.1-7) 5.3.1 20160121

Surprisingly, this didn't show up with g++-6.

Link error when building castxml: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>

ScaledNumber.cpp:(.text._ZN4llvm16ScaledNumberBase8toStringB5cxx11Emsij+0x602): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)'
ScaledNumber.cpp:(.text._ZN4llvm16ScaledNumberBase8toStringB5cxx11Emsij+0x72d): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long)'
ScaledNumber.cpp:(.text._ZN4llvm16ScaledNumberBase8toStringB5cxx11Emsij+0x878): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)'

Should not exit with status 0 on error

CastXML appears to always exit with status 0 even if, e.g. the input file doesn't exist:

steve@riemann{trunk}castxml a b
error: no such file or directory: 'a'
error: no such file or directory: 'b'
error: no input files
steve@riemann{trunk}echo $?
0

The analogous situation with gccxml did exit non-zero:

steve@riemann{trunk}gccxml a b
gccxml_cc1plus: error: a: No such file or directory
steve@riemann{trunk}echo $?
1

Missing namespace for template template parameter

Hi.
Following code generates an incomplete output:

namespace test {
class A { };
class B { };

template <class A, class B, template<class D, class E> class C>
class template_test { };

template <class D, class E> class
innerTemplate { };

class child : public template_test<A, B, innerTemplate> { };
}

The corresponding xml entry to template_test has the attribute
name="template_test&lt;test::A, test::B, innerTemplate&gt;"
The namespace for innerTemplate is missing.

"Unable to locate resources for <...>\castxml.exe"

I built CastXML using Visual Studio 2013. But I encoutered a problem launching the output executable.
The error message is "Unable to locate resources for <...>\castxml.exe".
It seems that the cause is the folder named "share/castxml/clang" is missing.

Default constructor created for non-default constructible type

Given this type

struct const_item
{
  const int values[10];
};

CastXML generates the following XML output

  <Struct id="_6" name="const_item" context="_1" location="f1:578" file="f1" line="578" members="_11 _12 _13 _14" size="320" align="32"/>
  <Constructor id="_12" name="const_item" context="_6" access="public" location="f1:578" file="f1" line="578" inline="1" artificial="1"/>
  <Constructor id="_13" name="const_item" context="_6" access="public" location="f1:578" file="f1" line="578" inline="1" artificial="1" throw="">
    <Argument type="_20" location="f1:578" file="f1" line="578"/>
  </Constructor>

The first Constructor element seems invalid because const_item's default constructor is implicitly declared as deleted. Otherwise, the implicit definition would be ill-formed because it would attempt to default initialize the const data member. This is specified in the last sentence under [dcl.init]/7

If a program calls for the default initialization of an object of a const-qualified type T, T shall be a class type with a user-provided default constructor.

Both gcc and clang fail to compile this example.

The first Constructor element should either be absent, or it should have an extra attribute, say deleted="1". If the extra attribute is added, it might be a good idea to also include another attribute defaulted="1" which would be set for C++11 code that explicitly =defaults member functions.

linking problem with mingw-w64-i686-clang-3.6.2

I experience the following linker problem while building castXML under the current mingw64 and mingw32 environment with respective mingw-w64-*-clang-3.6.2

Scanning dependencies of target cxsys
[ 6%] Building C object src/kwsys/CMakeFiles/cxsys.dir/ProcessWin32.c.obj
[ 13%] Building C object src/kwsys/CMakeFiles/cxsys.dir/EncodingC.c.obj
[ 20%] Building C object src/kwsys/CMakeFiles/cxsys.dir/System.c.obj
[ 26%] Building CXX object src/kwsys/CMakeFiles/cxsys.dir/Directory.cxx.obj
[ 33%] Building CXX object src/kwsys/CMakeFiles/cxsys.dir/EncodingCXX.cxx.obj
[ 40%] Building CXX object src/kwsys/CMakeFiles/cxsys.dir/RegularExpression.cxx.obj
[ 46%] Building CXX object src/kwsys/CMakeFiles/cxsys.dir/SystemTools.cxx.obj
[ 53%] Building CXX object src/kwsys/CMakeFiles/cxsys.dir/FStream.cxx.obj
Linking CXX static library ../../lib/libcxsys.a
[ 53%] Built target cxsys
Scanning dependencies of target castxml
[ 60%] Building CXX object src/CMakeFiles/castxml.dir/castxml.cxx.obj
[ 66%] Building CXX object src/CMakeFiles/castxml.dir/Detect.cxx.obj
[ 73%] Building CXX object src/CMakeFiles/castxml.dir/Output.cxx.obj
[ 80%] Building CXX object src/CMakeFiles/castxml.dir/RunClang.cxx.obj
[ 86%] Building CXX object src/CMakeFiles/castxml.dir/Utils.cxx.obj
Linking CXX executable ../bin/castxml.exe
C:\msys32\mingw32\bin/../lib/libclangFrontend.a(CompilerInstance.o):(.text$_ZN5clang11ASTConsumer22GetASTMutationListenerEv[__ZN5clang11ASTConsumer22GetASTMutationListenerEv]+0x0): multiple definition of clang::ASTConsumer::GetASTMutationListener()' CMakeFiles/castxml.dir/objects.a(RunClang.cxx.obj):(.text[__ZN5clang11ASTConsumer22GetASTMutationListenerEv]+0x0): first defined here C:\msys32\mingw32\bin/../lib/libclangFrontend.a(CompilerInstance.o):(.text$_ZN5clang11ASTConsumer29GetASTDeserializationListenerEv[__ZN5clang11ASTConsumer29GetASTDeserializationListenerEv]+0x0): multiple definition ofclang::ASTConsumer::GetASTDeserializationListener()'
CMakeFiles/castxml.dir/objects.a(RunClang.cxx.obj):(.text[__ZN5clang11ASTConsumer29GetASTDeserializationListenerEv]+0x0): first defined here
C:\msys32\mingw32\bin/../lib/libclangFrontend.a(CompilerInstance.o):(.text$_ZNK5clang14FrontendAction20isModelParsingActionEv[__ZNK5clang14FrontendAction20isModelParsingActionEv]+0x0): multiple definition of clang::FrontendAction::isModelParsingAction() const' CMakeFiles/castxml.dir/objects.a(RunClang.cxx.obj):(.text[__ZNK5clang14FrontendAction20isModelParsingActionEv]+0x0): first defined here C:\msys32\mingw32\bin/../lib/libclangFrontend.a(CompilerInstance.o):(.text$_ZN5clang15IdentifierTable3getEN4llvm9StringRefE[__ZN5clang15IdentifierTable3getEN4llvm9StringRefE]+0x0): multiple definition ofclang::IdentifierTable::get(llvm::StringRef)'
CMakeFiles/castxml.dir/objects.a(Output.cxx.obj):(.text[__ZN5clang15IdentifierTable3getEN4llvm9StringRefE]+0x0): first defined here
C:\msys32\mingw32\bin/../lib/libclangFrontend.a(CompilerInstance.o):(.text$_ZN4llvm15SmallVectorImplIN5clang9FixItHintEE5clearEv[__ZN4llvm15SmallVectorImplIN5clang9FixItHintEE5clearEv]+0x0): multiple definition of llvm::SmallVectorImpl<clang::FixItHint>::clear()' CMakeFiles/castxml.dir/objects.a(RunClang.cxx.obj):(.text[__ZN4llvm15SmallVectorImplIN5clang9FixItHintEE5clearEv]+0x0): first defined here C:\msys32\mingw32\bin/../lib/libclangFrontend.a(CompilerInstance.o):(.text$_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St9_IdentityIS5_ESt4lessIS5_ESaIS5_EE8_M_eraseEPSt13_Rb_tree_nodeIS5_E[__ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St9_IdentityIS5_ESt4lessIS5_ESaIS5_EE8_M_eraseEPSt13_Rb_tree_nodeIS5_E]+0x0): multiple definition ofstd::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::_Identity<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::less<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >::_M_erase(std::_Rb_tree_node<std::__cxx11::basic_string<char, std::char_traits, std::allocator > >*)'
CMakeFiles/castxml.dir/objects.a(castxml.cxx.obj):(.text[__ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St9_IdentityIS5_ESt4lessIS5_ESaIS5_EE8_M_eraseEPSt13_Rb_tree_nodeIS5_E]+0x0): first defined here
..........................
now following a lot of 'multiple definition of ' errors
..........................

CMakeFiles/castxml.dir/objects.a(Detect.cxx.obj):(.text+0x15fd): undefined reference to llvm::sys::getDefaultTargetTriple()' CMakeFiles/castxml.dir/objects.a(RunClang.cxx.obj):(.text+0x5f8): undefined reference tollvm::sys::getDefaultTargetTriple()'
CMakeFiles/castxml.dir/objects.a(Utils.cxx.obj):(.text+0x734): undefined reference to `llvm::sys::fs::getMainExecutable(char const_, void_)'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
src/CMakeFiles/castxml.dir/build.make:305: die Regel für Ziel „bin/castxml.exe“ scheiterte
make[2]: *** [bin/castxml.exe] Fehler 1
CMakeFiles/Makefile2:993: die Regel für Ziel „src/CMakeFiles/castxml.dir/all“ scheiterte
make[1]: *** [src/CMakeFiles/castxml.dir/all] Fehler 2
Makefile:126: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

Hopefully you have an idea on how to make castXML running wihin current mingw.
Cheers

No such path for LLVM_DIR

Hello!

Hopefully you can give me a hint to the build instructions. I have downloaded llvm and clang (3.7) and have done a build. Because llvm does not allow me to do an in-source-tree build I have done an out-of-source-tree-build. This worked like a charm. Now I would like to build CastXML on top of this. The build instructions say to set LLVM_DIR to /share/llvm/cmake.

Now my problem is the following: A subdirectory structure share/llvm/cmake exists only in the build directory. If I set LLVM_DIR to this path, cmake complains that I must set it to a LLVM/clang SDK source tree, not a build tree. But in the source tree there is no such directory structure. If I set the LLVM_DIR variable to /share/llvm/cmake even if it does not exist, cmake complains about a missing FindLLVM.cmake. So what path should I use for LLVM_DIR?

Regards
Dietmar

(ppc)Asm macro syntax not recognized

Our mcu is mpc5634, and use windriver's diab compiler.
When using CastXML in my code to extract the definition of all variables, I encountered the following error:
Does CastXML support the powerpc embedding assembly code, or I misused some args?
My command line:

castxml --castxml-gccxml -std=c89 -I D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT D:\Code\Rtrt_test\10024832_MT62.1\CORE\EMS_Core\ENGN\engncald.c -imacros C:\castxml\bin\define.txt

The souce code is follows:

__asm void STORE_SPR_VALUE(const uint32_t spr_register, const uint32_t spr_value)
{
% con spr_register; con spr_value
! "r3"
   isync
   addis   r3,r0,spr_value@h
   addi    r3,r3,spr_value@l
   mtspr   spr_register,r3
   isync
}

errors:

D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:57:7: error: expected '(' after 'asm'
__asm void STORE_SPR_VALUE(const uint32_t spr_register, const uint32_t spr_value)
      ^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:57:6: error: expected ';' after top-level asm block
__asm void STORE_SPR_VALUE(const uint32_t spr_register, const uint32_t spr_value)
     ^
     ;
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:59:1: error: expected expression
% con spr_register; con spr_value
^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:59:3: error: use of undeclared identifier 'con'
% con spr_register; con spr_value
  ^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:59:21: error: use of undeclared identifier 'con'
% con spr_register; con spr_value
                    ^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:99:7: error: expected '(' after 'asm'
__asm void STORE_SPR_VALUE_VAR(const uint32_t spr_register, uint32_t spr_value)
      ^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:99:6: error: expected ';' after top-level asm block
__asm void STORE_SPR_VALUE_VAR(const uint32_t spr_register, uint32_t spr_value)
     ^
     ;
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:101:1: error: expected expression
% con spr_register; reg spr_value
^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:101:3: error: use of undeclared identifier 'con'
% con spr_register; reg spr_value
  ^
D:\Code\Rtrt_test\10024832_MT62.1\INCL_RT/dd_e200z6_diab.h:101:21: error: use of undeclared identifier 'reg'
% con spr_register; reg spr_value
                    ^

How to Build on Sun 10

Hi,

I am trying to build CastXML on a Sun machine, I am doing the following:
cd src
mkdir build
cd build
cmake ..

and I get the following errors:

-- The C compiler identification is SunPro 5.12.0
-- The CXX compiler identification is SunPro 5.12.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error: Could not open file for write in copy operation /CMakeFiles/castxmlSourceDir.txt.tmp
CMake Error: : System Error: No such file or directory
CMake Error at CMakeLists.txt:18 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /CMakeFiles/castxmlClangResourceDir.txt.tmp
CMake Error: : System Error: No such file or directory
CMake Error at CMakeLists.txt:23 (configure_file):
  configure_file Problem configuring file


CMake Error: Could not open file for write in copy operation /src/Version.h.tmp
CMake Error: : System Error: No such file or directory
CMake Error at CMakeLists.txt:28 (configure_file):
  configure_file Problem configuring file


CMake Error at CMakeLists.txt:46 (llvm_map_components_to_libnames):
  Unknown CMake command "llvm_map_components_to_libnames".


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.1)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/home/____/mbig/CastXML-master/src/build/CMakeFiles/CMakeOutput.log".

Is there any documentation on how to build this project? If not, can somebody help me create such a doc/page?

CastXML chokes on C++11 constructs in g++-6 headers

Hello,

currently Debian is preparing for the gcc-6 release, and when compiling the python bindings in ITK, castxml fails with errors in the g++6 header files that are related to C++11 constructs.

For instance:
...c++/6/bits/c++config.h error: unknown type name decltype

To reproduce the error you can install the g++-6 snapshot from Debian/experimental, and then force the compiler when configuring ITK.

Best,
Gert

debian mipsel build issues

Dear developers,

it seems there is something bad for castxml in debian mipsel [0].

There are some tests that are failing.

Some errors are of this kind:

236/236 Test #236: gccxml.c++11.GNU-float128-nostart .......................***Failed    0.37 sec
CMake Error at /«BUILDDIR»/castxml-0.1+git20150630/test/run.cmake:97 (message):
  result does not match that expected.

  stderr does not match that expected.

  xml does not match that expected.

  Command was:

   command> "/«BUILDDIR»/castxml-0.1+git20150630/obj-mipsel-linux-gnu/bin/castxml" "--castxml-gccxml" "-std=c++11" "/«BUILDDIR»/castxml-0.1+git20150630/test/input/GNU-float128.cxx" "-o" "gccxml.c++11.GNU-float128-nostart.xml" "--castxml-cc-gnu" "/usr/bin/g++"

  Expected result to match:

   expect-result> 0

  Expected stderr to match:

   expect-stderr> ^$

  Expected xml to match:

   expect-xml> ^<\?xml version="1.0"\?>
   expect-xml> <GCC_XML[^>]*>
   expect-xml> .*<FundamentalType id="_[0-9]+" name="__float128" size="128" align="128"/>.*
   expect-xml>   <File id="f1" name=".*/test/input/GNU-float128.cxx"/>
   expect-xml> </GCC_XML>$

  Actual result:

   actual-result> 1

  Actual stdout:

   actual-stdout> 

  Actual stderr:

   actual-stderr> /«BUILDDIR»/castxml-0.1+git20150630/test/input/GNU-float128.cxx:1:1: error: unknown type name '__float128'
   actual-stderr> __float128 start(__float128);
   actual-stderr> ^
   actual-stderr> /«BUILDDIR»/castxml-0.1+git20150630/test/input/GNU-float128.cxx:1:18: error: unknown type name '__float128'
   actual-stderr> __float128 start(__float128);
   actual-stderr>                  ^
   actual-stderr> 2 errors generated.

  Actual xml:

   actual-xml> (missing)

At the end, the tests result is like this:

97% tests passed, 6 tests failed out of 236

I have a mipsel machine, if you provide me a patch I can do some local tests. Please, let me know if you need additional info.

best regards.

[0] https://buildd.debian.org/status/fetch.php?pkg=castxml&arch=mipsel&ver=0.1%2Bgit20150630-1&stamp=1437262967

__float128 struct dumped to xml file

Hi

when using castxml with gcc (GCC 4.8.2, 5.1.0, --castxml-cc-gnu /usr/bin/c++), the xml file contains the unnamed struct for __float128, defined here:

// Provide __float128 if simulating the actual GNU compiler.

This causes two problems:

  • the struct's name is empty (which is OK I guess)
  • the struct has no file="" definition
  • the content of the struct is dumped to the xml file (for example the x field)

Is it required to dump this definition to the xml file ? We could maybe just not write this part of the tree ? If not, I'll need to adapt pygccxml for this case.

Support for `__attribute__((gccxml(#x)))`?

Hi there!
I'm a fan of gccxml and I have been using it extensively in the project SharpDX to generate .NET wrapper from C++ DirectX headers.

One of my major requirement is the support for declspec attributes, that allows to parse SAL annotations in Windows headers...
When using gccxml, I remmember I was able to use such a macro like this:

#define __declspec(x) __attribute__((gccxml(#x)))

Does CastXML support this scenario? I'm not sure if clang have some support for attached metadata attributes...
Thanks!

__NSConstantString and __NSConstantString_tag

Hi

I got a report from a user that there were some problems with the latest llvm (3.9).
CastXML/pygccxml#32

I just compiled llvm from trunk, and even for an empty c++ file, I get new fields in the xml file that were not there before:

<Typedef id="_4" name="__NSConstantString" type="_10" context="_1" location="f0:0" file="f0" line="0"/>
<Struct id="_10" name="__NSConstantString_tag" context="_1" location="f0:0" file="f0" line="0" members="_14 _15 _16 _17" size="256" align="64"/>

And with this comes a bunch of fields that have no name (I think this is allowed in c++ for structs and unions) and no file (not sure about this one):

<Field id="_14" name="" type="_21" context="_10" access="public" offset="0"/>
<Field id="_15" name="" type="_20" context="_10" access="public" offset="64"/>
<Field id="_16" name="" type="_22" context="_10" access="public" offset="128"/>
<Field id="_17" name="" type="_23" context="_10" access="public" offset="192"/>

I presume that this patch a few days ago introduced these fields:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148942.html

I can rebuild with a version before the patch to double check.

I am not sure on the right behaviour to expect here.

  • Maybe these fields are "leaking" in the output (clang -Xclang -ast-dump does display them). If they should stay hidden, we should report this upstream.
  • If these fields are valid, we either need to make sure they get a file (maybe file="f0", like other cases we treated before), or I need to teach pygccxml to expect fields without name nor fields (which is getting messy)

I thought you may want to have a look before I ask my question on the llvm mailing list :)

Qualified names in default arguments

CastXML currently populates the default attribute for a function default argument with the same text as what was in the header it parsed. This causes code generated by pyplusplus to not compile because the names are not correctly qualified when creating the Boost.Python binding. For example, parsing the following

namespace ns
{

enum fruit{ apple, orange };
void fun1( fruit arg1 = apple );

struct st1
{
   static const int DEFAULT = 0;
   void fun2( int arg2 = DEFAULT );
};

typedef unsigned long long ull;
void fun3( ull arg3 = (ull)-1 );

}

with the command

castxml  -I. -c -x c++ --castxml-cc-gnu  g++ --castxml-gccxml -o default_args.cpp.xml default_args.hpp

produces the following output for default arguments

<Argument name="arg1" type="_11" location="f1:30" file="f1" line="30" default="apple"/>
<Argument name="arg2" type="_29" location="f1:35" file="f1" line="35" default="DEFAULT"/>
<Argument name="arg3" type="_14" location="f1:39" file="f1" line="39" default="(ull)-1"/>

Parsing the same header using gccxml produces

<Argument name="arg1" type="_161" location="f1:30" file="f1" line="30" default="apple"/>
<Argument name="arg2" type="_146" location="f1:35" file="f1" line="35" default="ns::st1::DEFAULT"/>
<Argument name="arg3" type="_163" location="f1:39" file="f1" line="39" default="-1u"/>

arg1 can be patched rather easily to have a fully qualified name, and pygccxml has the machinery to do that, but the other two are trickier.

Would it be possible to have CastXML put fully qualified names in default arguments? The ideal default values for the code above would be

default="ns::apple"
default="ns::st1::DEFAULT"
default="-1ull"

If the enum is a C++11 scoped enum, then the first one would have to be default="ns::fruit::apple" (but as I said earlier, the enum is less important, I can patch that pretty reliably in pygccxml). If literals cannot be transformed to the final type as GCCXML (incorrectly) does, then the last one could be default=(ns::ull)-1".

CMake can't find libLLVMSupport.a

I'm having difficulty building CastXML on my Fedora 24 installation. I have Cmake version 3.8.0
This is as far as I got:

CMake Error at /usr/share/llvm/cmake/LLVMExports.cmake:829 (message):
The imported target "LLVMSupport" references the file`

"/usr/lib64/libLLVMSupport.a"

` but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and contained

    "/usr/share/llvm/cmake/LLVMExports.cmake"

    but not all the files it references.

Call Stack (most recent call first):
/usr/share/llvm/cmake/LLVMConfig.cmake:152 (include)
CMakeLists.txt:64 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/matthew/Downloads/CastXML/CMakeFiles/CMakeOutput.log".
CMakeOutput.log.txt

Needs LLVMSupport

On windows when building needs to link against LLVMSupport so the following should appear on src/CMakeLists.txt

llvm_map_components_to_libnames(llvm_libs
native
option
bitreader
support
${LLVM_TARGETS_TO_BUILD}
)

Unable to generate xml with Boost on Windows and MSVC

Hi, everyone!

I'm trying to generate Python wrappings via WrapITK for my C++ project. The project also uses Boost libraries. I'm getting the following errors while generating xml for sources that include Boost headers:

In file included from C:/Boost/boost/filesystem.hpp:16:
In file included from C:/Boost/boost/filesystem/path.hpp:25:
In file included from C:/Boost/boost/filesystem/path_traits.hpp:22:
In file included from C:/Boost/boost/type_traits/decay.hpp:18:
In file included from C:/Boost/boost/mpl/eval_if.hpp:17:
C:/Boost/boost/mpl/if.hpp:131:1: error: pasting formed 'BOOST_PP_TUPLE_ELEM_O_3(', an invalid preprocessing token [-Winvalid-token-paste]
BOOST_MPL_AUX_NA_SPEC(3, if_)
^
C:/Boost/boost/mpl/aux_/na_spec.hpp:161:40: note: expanded from macro 'BOOST_MPL_AUX_NA_SPEC'
#define BOOST_MPL_AUX_NA_SPEC(i, name) \
                                       ^
C:/Boost/boost/mpl/aux_/na_spec.hpp:154:47: note: expanded from macro '\
BOOST_MPL_AUX_NA_SPEC_NO_ETI'
#define BOOST_MPL_AUX_NA_SPEC_NO_ETI(i, name) \
                                              ^
C:/Boost/boost/mpl/aux_/na_spec.hpp:65:9: note: expanded from macro '\
BOOST_MPL_AUX_NA_SPEC_MAIN'
        BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, typename T, na) \
        ^
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
C:/Boost/boost/preprocessor/tuple/elem.hpp:26:42: note: expanded from macro 'BOOST_PP_TUPLE_ELEM'
#        define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__))
                                         ^
C:/Boost/boost/preprocessor/tuple/elem.hpp:27:48: note: expanded from macro 'BOOST_PP_TUPLE_ELEM_I'
#        define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args)
                                               ^
C:/Boost/boost/preprocessor/tuple/elem.hpp:28:64: note: expanded from macro 'BOOST_PP_TUPLE_ELEM_II'
#        define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,)
                                                               ^

I use Windows 7/8.1 x64 and MS VisualStudio 2013. Boost 1.56

CastXML Version:

castxml version 0.1-g2e55b35

CastXML project maintained and supported by Kitware (kitware.com).

clang version 3.7.0 (tags/RELEASE_370/rc1)
Target: x86_64-pc-windows-msvc
Thread model: posix

(Prebuilt windows binary from here)

CastXML has a problem with __float128 on GCC-6.1

Using CastXML-41581db, pygccxml-1.7.4 and the most recent pyplusplus from the ompl bitbucket repo. Seems to be related to issue #45. I also tried -std=c++14 and got past this problem, but had other problems with empty declaration names (in bits/hashtable.h via unordered_map).

$ g++ --version
g++ (GCC) 6.1.0

castxml -I/path/to/boost-1_60 -c -x c++ --castxml-cc-gnu /path/to/g++ -std=gnu++14 --castxml-gccxml -o /tmp/tmpCYMyX0.xml boost-1_60/boost/type_traits/type_with_alignment.hpp
boost-1_60/boost/type_traits/type_with_alignment.hpp:48:21: error:
support for type '__float128' is not yet implemented
__float128 f128;
^
1 error generated.

castxml crash

I just tried castxml as a possible replacement for gccxml. It crashes, but I have no idea how to track down the problem. This with llvm/clang 3.6 at r225216 installed via MacPorts.

> lldb /usr/local/bin/castxml
(lldb) target create "/usr/local/bin/castxml"
Current executable set to '/usr/local/bin/castxml' (x86_64).
(lldb) r -v -x c++  --castxml-gccxml  -iwithprefix /opt/local/libexec/llvm-3.6/lib/c++/v1  -I"." -I"/Users/mmoll/omplapp/ompl/src" -I"/Users/mmoll/omplapp/src" -I"/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m" -I"/opt/local/include" -I"/opt/local/include"   "bindings/util.h" -o=foo.xml
Process 4223 launched: '/usr/local/bin/castxml' (x86_64)
clang version 3.6.0 (trunk 225216)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
clang -cc1 version 3.6.0 based upon LLVM 3.6.0svn default target x86_64-apple-darwin14.0.0
ignoring nonexistent directory "/usr/local/include/c++/v1"
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring duplicate directory "/opt/local/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /Users/mmoll/omplapp/ompl/src
 /Users/mmoll/omplapp/src
 /opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m
 /opt/local/include
 /usr/local/include
 /usr/local/share/castxml/clang/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
 /opt/local/libexec/llvm-3.6/lib/c++/v1
End of search list.
Process 4223 stopped
* thread #1: tid = 0x337c7, 0x000000010001b82c castxml`clang::FunctionType::getReturnType(this=0x0000000000000000) const + 12 at Type.h:2823, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
    frame #0: 0x000000010001b82c castxml`clang::FunctionType::getReturnType(this=0x0000000000000000) const + 12 at Type.h:2823
   2820   unsigned getTypeQuals() const { return FunctionTypeBits.TypeQuals; }
   2821 
   2822 public:
-> 2823   QualType getReturnType() const { return ResultType; }
   2824 
   2825   bool getHasRegParm() const { return getExtInfo().getHasRegParm(); }
   2826   unsigned getRegParmType() const { return getExtInfo().getRegParm(); }
(lldb) bt
* thread #1: tid = 0x337c7, 0x000000010001b82c castxml`clang::FunctionType::getReturnType(this=0x0000000000000000) const + 12 at Type.h:2823, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
  * frame #0: 0x000000010001b82c castxml`clang::FunctionType::getReturnType(this=0x0000000000000000) const + 12 at Type.h:2823
    frame #1: 0x00000001000129db castxml`ASTVisitor::AddDumpNode(this=0x00007fff5fbfd1b0, d=0x0000000105175eb0, complete=true) + 427 at Output.cxx:448
    frame #2: 0x0000000100013794 castxml`ASTVisitor::AddDeclContextMembers(this=0x00007fff5fbfd1b0, dc=0x0000000105175e80, emitted=0x00007fff5fbfcbb8) + 756 at Output.cxx:669
    frame #3: 0x0000000100013768 castxml`ASTVisitor::AddDeclContextMembers(this=0x00007fff5fbfd1b0, dc=0x000000010302f4e0, emitted=0x00007fff5fbfcbb8) + 712 at Output.cxx:654
    frame #4: 0x000000010001952b castxml`ASTVisitor::PrintMembersAttribute(this=0x00007fff5fbfd1b0, dc=0x000000010302f4e0) + 139 at Output.cxx:983
    frame #5: 0x0000000100017c39 castxml`ASTVisitor::OutputTranslationUnitDecl(this=0x00007fff5fbfd1b0, d=0x000000010302f4c0, dn=0x0000000105988ae8) + 313 at Output.cxx:1223
    frame #6: 0x0000000100014fbe castxml`ASTVisitor::OutputDecl(this=0x00007fff5fbfd1b0, d=0x000000010302f4c0, dn=0x0000000105988ae8) + 1710 at DeclNodes.inc:473
    frame #7: 0x00000001000148b4 castxml`ASTVisitor::ProcessQueue(this=0x00007fff5fbfd1b0) + 660 at Output.cxx:729
    frame #8: 0x000000010001b34c castxml`ASTVisitor::HandleTranslationUnit(this=0x00007fff5fbfd1b0, tu=0x000000010302f4c0) + 620 at Output.cxx:1681
    frame #9: 0x000000010001b41d castxml`outputXML(ci=0x0000000102e07530, ctx=0x0000000103028000, os=0x0000000102e0a0f0, opts=0x00007fff5fbfedc8) + 125 at Output.cxx:1706
    frame #10: 0x000000010003b5e0 castxml`ASTConsumer::HandleTranslationUnit(this=0x0000000102e0f310, ctx=0x0000000103028000) + 336 at RunClang.cxx:122
    frame #11: 0x0000000100220b3c castxml`clang::ParseAST(S=0x000000010304a200, PrintStats=false, SkipFunctionBodies=<unavailable>) + 391 at ParseAST.cpp:151
    frame #12: 0x00000001000e4ab5 castxml`clang::FrontendAction::Execute(this=<unavailable>) + 67 at FrontendAction.cpp:428
    frame #13: 0x00000001000c119b castxml`clang::CompilerInstance::ExecuteAction(this=0x0000000102e07530, Act=0x0000000102e08600) + 547 at CompilerInstance.cpp:811
    frame #14: 0x0000000100038a8e castxml`runClangCI(CI=0x0000000102e07530, opts=0x00007fff5fbfedc8) + 862 at RunClang.cxx:253
    frame #15: 0x0000000100037626 castxml`runClangImpl(argBeg=0x00007fff5fbfe8f8, argEnd=0x00007fff5fbfe960, opts=0x00007fff5fbfedc8) + 4486 at RunClang.cxx:338
    frame #16: 0x0000000100036428 castxml`runClang(argBeg=0x00007fff5fbff128, argEnd=0x00007fff5fbff190, opts=0x00007fff5fbfedc8) + 3112 at RunClang.cxx:409
    frame #17: 0x00000001000045d4 castxml`main(argc_in=15, argv_in=0x00007fff5fbff478) + 6052 at castxml.cxx:262
    frame #18: 0x00007fff8766c5c9 libdyld.dylib`start + 1
    frame #19: 0x00007fff8766c5c9 libdyld.dylib`start + 1
(lldb) 

Wrong access for class templates inside another class.

If you run castxml on this code:

class TestClass
{
protected:
  template <class T> class TemplateSubclass
  {
  public:
    T mData;
  };

  TemplateSubclass<double> mInstance;
};

then the class TemplateSubclass has access="public" instead of "protected" like other non template classes.

std::vector<bool> causes castxml.exe to hang

Hi, Thanks for your work. Here's my problem. I'm on windows 7 and tried with a few versions of Visual Studio / clang / LLVM:

Class MyClass()
{
...
  std::vector<bool> mBoolVector;
};

When castxml is run on this class (-x c++ --castxml-gccxml --castxml-cc-msvc cl) , it hangs with the memory used by the process increasing rapidly. Have you seen this before ?

Usage information is a bit vague on --castxml-cc-<id>

This goes for both the man page and for the --help:

  --castxml-cc-<id> <cc>
  --castxml-cc-<id> "(" <cc> <cc-opt>... ")"
    Simulate given <id>-like compiler command, where <id> is
    one of: gnu, msvc

In particular, what are <cc> and <cc-opt> meant to represent here? The man page says "the given compiler command" but as a naive user it's not entirely clear what that means. In the case of --cast-xml-gnu I'm assuming this means, notionally, "anything that you'd put on the command line after g++ except the file name". Is that accurate?

A practical example would go a long way for us n00bs here.

Thanks!

Assertion "Name.isIdentifier() && "Name is not a simple identifier"" failed

Parsing <string>, castxml shows:

assertion "Name.isIdentifier() && "Name is not a simple identifier"" failed: file "/usr/include/clang/AST/Decl.h", line 169, function: llvm::StringRef clang::NamedDecl::getName() const
Aborted

Steps to reproduce:

  1. Using clang 3.7.1 on cygwin Windows 7 (Target: i686-pc-windows-cygnus) installed from latest cygwin
  2. Downloaded latest CastXML (9a83414)
  3. cmake . && make install

using a simple file test.C

#include <string>

$ castxml.exe -x c++ --castxml-gccxml test.C
assertion "Name.isIdentifier() && "Name is not a simple identifier"" failed: file "/usr/include/clang/AST/Decl.h", line 169, function: llvm::StringRef clang::NamedDecl::getName() const
Aborted

This problem has apparently been discussed at https://www.mail-archive.com/[email protected]/msg01885.html

Looking at the change reported there as culprit (917c646), the answer to the following question (http://comments.gmane.org/gmane.comp.compilers.clang.devel/48763) seems to suggest a solution.

Problem with castxml

I'm trying to install pygimli. All things seems to be ok except the building o castxml .
I have the following message :
/home/arfang/gimli/thirdParty/src/castXML/src/Output.cxx:21:34: fatal error: clang/AST/ASTContext.h: Aucun fichier ou dossier de ce type
#include "clang/AST/ASTContext.h"
^
compilation terminated.
/home/arfang/gimli/thirdParty/src/castXML/src/RunClang.cxx:24:35: fatal error: clang/AST/ASTConsumer.h: Aucun fichier ou dossier de ce type
#include "clang/AST/ASTConsumer.h"
^
compilation terminated.
make[2]: *** [src/CMakeFiles/castxml.dir/Output.cxx.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
make[2]: *** [src/CMakeFiles/castxml.dir/RunClang.cxx.o] Erreur 1
make[1]: *** [src/CMakeFiles/castxml.dir/all] Erreur 2
make: *** [all] Erreur 2
~/gimli/thirdParty
-- NOT Found castxml executable: cannot build pygimli.
I don't know what to do with this issue.
I try to built castxml with gcc or with clang but i got the same error.
Thank you for your help cause i don't know how to deal with this issue.

Consider tagging a version in sync with ITK releases

Hello,

while I'm well aware of this post I still think that it would make life of everybody easier if you would tag some release. Everybody knows that a 0.X release is unstable and may even be buggy but it makes referencing the code a lot easier then pointing to some hash value, also consider the RERO principle.

In light that one of the prominent uses of castxml is creating language bindings for ITK you could for instance tag the version that was used when you released the latest ITK version.

thanks for your consideration,
Gert

compilation issues

Hello,

tried to compile with x86_64-pc-linux-gnu-clang-3.5.0 (and same with gcc-4.9.3)

CC=clang CXX=clang++ cmake ../CastXML/

and get:
[ 40%] Building CXX object src/CMakeFiles/castxml.dir/Output.cxx.o
x86_64-pc-linux-gnu-clang-3.5.0: warning: argument unused during compilation: '-I /home/carsten/src/gimli/thirdParty/src/castXML/build/src'
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:311:34: error: no type named 'TypeInfo' in namespace 'clang'
void PrintABIAttributes(clang::TypeInfo const& t);
~~~~~~~^
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:311:43: error: expected ')'
void PrintABIAttributes(clang::TypeInfo const& t);
^
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:311:26: note: to match this '('
void PrintABIAttributes(clang::TypeInfo const& t);
^
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:1081:32: error: no viable conversion from 'std::pair<uint64_t, unsigned int>' to 'const clang::TypeDecl *'
this->PrintABIAttributes(this->CTX.getTypeInfo(ty));
^~~~~~~~~~~~~~~~~~~~~~~~~
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:1076:60: note: passing argument to parameter 'd' here
void ASTVisitor::PrintABIAttributes(clang::TypeDecl const* d)
^
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:1087:18: error: variable has incomplete type 'void'
void ASTVisitor::PrintABIAttributes(clang::TypeInfo const& t)
^
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:1087:44: error: no member named 'TypeInfo' in namespace 'clang'
void ASTVisitor::PrintABIAttributes(clang::TypeInfo const& t)
~~~~~~~^
/home/carsten/src/gimli/thirdParty/src/castXML/CastXML/src/Output.cxx:1087:62: error: expected ';' after top level declarator
void ASTVisitor::PrintABIAttributes(clang::TypeInfo const& t)
^
;
6 errors generated.
src/CMakeFiles/castxml.dir/build.make:100: recipe for target 'src/CMakeFiles/castxml.dir/Output.cxx.o' failed

Bests,
Carsten

problem with function returning reference

In compatibility mode (gccxml), castxml differ in behavior for function returning a typedef reference. The following test case https://gist.github.com/heneault/558f3f18a07e0ddf608e#file-test_ref_return shows the issue. The output from the original gccxml is there https://gist.github.com/heneault/1bdb190a85c9f26f65c2#file-test_ref_gccxml-xml . The return type for the method fcn is a reference type, which itself link to the fundamental type.
The output from castxml is there:
https://gist.github.com/heneault/07a4cdd57a4b3b3e1bb5#file-test_ref_castxml-xml
In that case, the return of the fcn is a typedef that link to the reference type. This extra redirection break the compatibility of tools like genreflex.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.