[cfe-dev] Getting type of ParmVarDecl of type defined in a header

Ilya Mirsky ilya.mirsky at gmail.com
Wed Nov 3 03:14:51 PDT 2010


Hi to all,

Given the following code:
*
typedef struct {
    int x;
    int y;
} MyStruct;

....

int foo(MyStruct s) ...*


I want to get the type of the parameter s.
In case the typedef appears in the main file, I have no problem and
paramVarDecl->getType().getAsString() return "MyStruct".
But when I put the typedef in a header and include it in the main file,
paramVarDecl->getType().getAsString() returns "int" for some reason.

This is how I initialize the Header Search related objects:

 *   // Apply header search
    _hsOpts->UseStandardIncludes = true;
    _hsOpts->UseBuiltinIncludes = true;
    _hsOpts->UseStandardCXXIncludes = true;

    // TODO Add user header search directories (I_dirs) ???

    llvm::Triple triple(_tarOpts.Triple);
    ApplyHeaderSearchOptions(*_hs, *_hsOpts, _langOpts, triple);

    // For searching and including Headers into the source files we are
analyzing
    InitializePreprocessor(*_pp, *_ppOpts, *_hsOpts, *_fendOpts);
*

Am I missing something here?


Thanks in advance,
Ilya

-- 
Best Regards,
Ilya Mirsky
www.cs.bgu.ac.il/~mirskyil <http://www.cs.bgu.ac.il/%7Emirskyil>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101103/baacb4c2/attachment.html>


More information about the cfe-dev mailing list