Discussion:
[GCC-XML] Parsing LLVM
Paolo Redaelli
2013-05-23 14:13:53 UTC
Permalink
I'm trying to parse recent LLVM headers but I'm not able to solve this
issue:

gccxml -fexceptions `llvm-config --cppflags --cflags --cxxflags `
plugin/c/llvm-liberty.h -fxml=llvm.gcc-xml
In file included from /usr/include/c++/4.6/bits/ios_base.h:43,
from /usr/include/c++/4.6/ios:43,
from /usr/include/c++/4.6/ostream:40,
from /usr/include/c++/4.6/iterator:64,
from /usr/lib/llvm-3.1/include/llvm/Use.h:30,
from /usr/lib/llvm-3.1/include/llvm/Value.h:17,
from /usr/lib/llvm-3.1/include/llvm/User.h:23,
from /usr/lib/llvm-3.1/include/llvm/Constant.h:17,
from /usr/lib/llvm-3.1/include/llvm/GlobalValue.h:21,
from /usr/lib/llvm-3.1/include/llvm/Function.h:21,
from /usr/lib/llvm-3.1/include/llvm/Module.h:18,
from /usr/lib/llvm-3.1/include/llvm-c/Core.h:24,
from /usr/lib/llvm-3.1/include/llvm-c/Analysis.h:22,
from plugin/c/llvm-liberty.h:18:
/usr/include/c++/4.6/bits/locale_classes.h: In member function 'void
std::locale::facet::_M_remove_reference() const':
/usr/include/c++/4.6/bits/locale_classes.h:414: error: exception handling
disabled, use -fexceptions to enable
make: *** [llvm.gcc-xml] Errore 1

I'm running
gccxml 0.9.0+cvs20120420-4ubuntu1
llvm-dev 1:3.1-15~exp1
gcc 4:4.6.3-1ubuntu5

Gccxml parsed previous versions of llvm without problems.
Has anyone tried to parse recent LLVM headers?
What else may I try? Building gccxml from the git repository?
Thanks in advance for you attention
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gccxml.org/pipermail/gccxml/attachments/20130523/e517d381/attachment.htm>
Brad King
2013-05-23 17:43:18 UTC
Permalink
gccxml -fexceptions `llvm-config --cppflags --cflags --cxxflags ` plugin/c/llvm-liberty.h -fxml=llvm.gcc-xml
What is the output of llvm-config with those flags?

-Brad
Paolo Redaelli
2013-05-24 06:19:58 UTC
Permalink
2013/5/23 Brad King <brad.king at kitware.com>
Post by Paolo Redaelli
Post by Paolo Redaelli
I'm trying to parse recent LLVM headers but I'm not able to solve this
gccxml -fexceptions `llvm-config --cppflags --cflags --cxxflags `
plugin/c/llvm-liberty.h -fxml=llvm.gcc-xml
What is the output of llvm-config with those flags?
First of all thanks in advance for any hints and suggestion.

Here's all the missing informations required to reproduce the issue
paolo at qualita:/media/Liberty/tybor-liberty/src/wrappers/llvm/library/externals$
llvm-config --cppflags --cflags --cxxflags
-I/usr/lib/llvm-3.1/include -DNDEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-I/usr/lib/llvm-3.1/include -DNDEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g
-O2 -fomit-frame-pointer -fPIC
-I/usr/lib/llvm-3.1/include -DNDEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g
-O2 -fomit-frame-pointer -fvisibility-inlines-hidden -fno-exceptions -fPIC
-Woverloaded-virtual -Wcast-qual



paolo at qualita:/media/Liberty/tybor-liberty/src/wrappers/llvm/library/externals$
cat plugin/c/llvm-liberty.h
#ifdef DEBUG // Let's be verbose during compile
# warning "LLVM-liberty starting include"
#endif

#ifndef __builtin_bswap32 // previously __llvm__
extern unsigned int __builtin_bswap32(unsigned int _data);
#endif

#ifndef __builtin_bswap64
extern unsigned long __builtin_bswap64(unsigned long _data);
#endif

#ifndef __builtin_unreachable
# include <stdlib.h>
# define __builtin_unreachable abort
#endif

#include <llvm-c/Analysis.h>
#include <llvm-c/BitReader.h>
#include <llvm-c/BitWriter.h>
#include <llvm-c/Core.h>
#include <llvm-c/ExecutionEngine.h>
// #include <llvm-c/LinkTimeOptimizer.h>
// #include <llvm-c/Target.h>
// #include <llvm-c/lto.h>
// #include <llvm-c/Transforms/IPO.h>
// #include <llvm-c/Transforms/Scalar.h>
#ifdef DEBUG // Let's be verbose during compile
# warning "LLVM-liberty ending include"
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gccxml.org/pipermail/gccxml/attachments/20130524/3c387b85/attachment.htm>
Brad King
2013-05-24 12:23:12 UTC
Permalink
$ llvm-config --cppflags --cflags --cxxflags
... -fno-exceptions ...
The `llvm-config --cxxflags` is passing -fno-exceptions to gccxml.
You should extract only the preprocessing flags (--cppflags) to
pass to gccxml.

-Brad
Paolo Redaelli
2013-06-02 17:21:20 UTC
Permalink
Post by Brad King
$ llvm-config --cppflags --cflags --cxxflags
... -fno-exceptions ...
The `llvm-config --cxxflags` is passing -fno-exceptions to gccxml.
You should extract only the preprocessing flags (--cppflags) to
pass to gccxml.
Oh my! It was *that* simple! It works fine with all the llvm versions I
tried!
Thank you

Loading...