[cfe-dev] Builtins

Miguel Guedes miguel.a.guedes at gmail.com
Sat Apr 20 00:57:48 PDT 2013


Hello List,

Using the Clang 3.2 C++ API, I'm getting loads of errors on builtins only 
like the one below:

In file included from test.cpp:24:
In file included from ./pch.hxx:22:
In file included from ./../libomnis/libomnis.hxx:31:
In file included from /usr/include/stdio.h:75:
In file included from /usr/include/libio.h:53:
/usr/lib/gcc/x86_64-linux-gnu/4.7/include/stdarg.h:40:9: error: unknown 
type name '__builtin_va_list'; did you mean '__builtin_va_list'?
typedef __builtin_va_list __gnuc_va_list;
        ^~~~~~~~~~~~~~~~~
        __builtin_va_list
note: '__builtin_va_list' declared here

This is a major blocking issue and would very much appreciate any 
pointers. I've no idea how to fix this.

TargetInfo is created as follows:

    clang::TargetOptions targetOptions;
    targetOptions.Triple = llvm::sys::getDefaultTargetTriple();

    clang::TargetInfo *pTargetInfo = 
        clang::TargetInfo::CreateTargetInfo(
            *pDiagnosticsEngine,
            targetOptions);

I'm initializing the Preprocessor like so: 

    llvm::IntrusiveRefCntPtr<clang::PreprocessorOptions> pOpts(new 
clang::PreprocessorOptions());
    clang::Preprocessor preprocessor(
        pOpts,
        *pDiagnosticsEngine,
        languageOptions,
        pTargetInfo,
        sourceManager,
        headerSearch,
        compInst);

    clang::FrontendOptions frontendOptions;
    clang::InitializePreprocessor(
        preprocessor,
        *pOpts,
        *headerSearchOptions,
        frontendOptions);

And the Builtin::Context is initialised as given:

    clang::Builtin::Context builtinContext;
    builtinContext.InitializeTarget(*pTargetInfo);





More information about the cfe-dev mailing list