[cfe-dev] clang-cc -ast-print-xml errors

Daniel Dunbar daniel at zuster.org
Fri Sep 18 01:56:05 PDT 2009

Hi Craig,

The driver doesn't have a built in way to deal with extra clang-cc
options we don't care to expose from the compiler.

The best way to deal with this is use a driver option which only runs
clang-cc, and use -Xclang to pass the extra option you want:
ddunbar at giles:tmp$ touch empty.c
ddunbar at giles:tmp$ clang -S -Xclang -ast-print-xml t.c -o -
<?xml version="1.0"?>
... turns out xml is verbose ...
ddunbar at giles:tmp$ clang -S -Xclang -ast-print-xml
~/llvm/tools/clang/INPUTS/Cocoa_h.m -o t.xml
Assertion failed: (NodeStack.size() > 1 && "too much backtracking"),
function toParent, file
line 51.

 - Daniel

On Wed, Sep 16, 2009 at 1:19 PM, Craig Mortensen <mortay at apple.com> wrote:
> Hi Mike,
> If I specify the -ast-print-xml, I'm assuming the output will be xml.
> I think you're right about the pch-thing.  At the beginning of the
> output file, I see 'CPCH'
> Removing the -emit-pch will cause an assertion during the creation of
> the output xml file:
> Assertion failed: (NodeStack.size() > 1 && "to much backtracking"),
> function toParent, file DocumentXML.cpp, line 51.
> ...the incomplete output file is in fact xml and I can read the
> contents. The file is simply incomplete because of the assertion.
> This is the command I'm using (with the -emit-pch)
> ./clang-cc -ast-print-xml -emit-pch --mcpu=yonah -v  -o /tmp/
> output.xml -x=objective-c /System/Library/Frameworks/
> Foundation.framework/Headers/Foundation.h
> I would attach the output file here, but it's a few Mbs...
> Craig
> On Sep 15, 2009, at 5:44 PM, Mike Stump wrote:
>> On Sep 15, 2009, at 5:33 PM, Craig Mortensen wrote:
>>> On Sep 15, 2009, at 4:58 PM, Eli Friedman wrote:
>>>> That indicates that clang is using the headers from an older version
>>> Yep. That was my problem.  I didn't update the headers in /Developer/
>>> user/lib/clang/1.0/include/
>>> Now that it completes successfully, the xml output file can't be read
>>> because the encoding is unknown.  I don't see where to specify the
>>> encoding.
>> Is the file written an xml file?  I think -emit-pch might be hosing
>> you.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list