[cfe-dev] extern "C" parsing

Jay L. T. Cornwall jay at thefoundry.co.uk
Tue Feb 16 08:11:34 PST 2010


I am porting one of our internal tools built upon the ROSE 
source-to-source compiler to LLVM/Clang, to improve its scalability.

With the program:

extern "C" {
typedef struct {} MyStruct;

MyStruct a;

The clang driver from SVN successfully parses this. My library-based 
interface to clang, however, gives this error:

test.cpp:5:1: error: unknown type name 'MyStruct'

The presence of an extern "C" {} block appears to hide the type. It 
parses correctly without the block. I have set LangOptions::CPlusPlus 
but have been unable to locate an option which controls this behaviour.

Could you point me in the right direction?

Jay L. T. Cornwall, Software Engineer
The Foundry, 1 Wardour Street, London. W1D 6PA
Tel: +44 (0)20 7434 0449, Fax: +44 (0)20 7434 1550, Web: 

The Foundry Visionmongers Ltd • Registered in England and Wales No: 4642027

More information about the cfe-dev mailing list