[cfe-dev] Problems in clang/AST/ASTConsumer.h

Simone Pellegrini spellegrini at dps.uibk.ac.at
Wed Dec 10 04:09:09 PST 2008



Paolo Bolzoni wrote:
> did you use -fno-rtti?
>
>   
No, using the -fno-rtti flags fixes the problem!
Thanks
> On Wed, 10 Dec 2008 12:07:56 +0100
> Simone Pellegrini <spellegrini at dps.uibk.ac.at> wrote:
>   
>> Hi,
>> I'm extending the ASTConsumer class to make some custom analysis on the 
>> Syntax tree created by clang in the following way:
>>
>> class MyASTConsumer: public ASTConsumer {
>>     ...
>> }
>>
>> when I try to compile my program using the g++ compiler (I've used both 
>> the gcc 3.4.6 and gcc 4.3.2). I get the following error:
>>
>> build/main.o(.gnu.linkonce.r._ZTI13MyASTConsumer+0x10): undefined 
>> reference to `typeinfo for clang::ASTConsumer'
>> collect2: ld returned 1 exit status
>>
>> Apparently the error is caused by the empty virtual definition of 
>> ASTConsumer methods:
>>  virtual ~ASTConsumer();
>>  virtual void InitializeTU(TranslationUnit& TU) ;
>>
>> changing this declaration (in the ASTConsumer.h file) into:
>>  virtual ~ASTConsumer() {}
>>  virtual void InitializeTU(TranslationUnit& TU) {}
>> or:
>>  virtual ~ASTConsumer() = 0;
>>  virtual void InitializeTU(TranslationUnit& TU) = 0;
>>
>> fixes the problem for me! Of course in the second problem I have to 
>> provide an implementation for both the methods in my class.
>>
>> I hope it helps,
>> greetings Simone
>>     
> _______________________________________________
> 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