@@ -91,7 +91,7 @@ FileModelItem Binder::run(AST *node)
9191 return result;
9292}
9393
94- ScopeModelItem Binder::currentScope ()
94+ ScopeModelItem Binder::currentScope () const
9595{
9696 if (_M_current_class)
9797 return model_static_cast<ScopeModelItem>(_M_current_class);
@@ -175,6 +175,7 @@ CodeModel::ClassType Binder::decode_class_type(std::size_t index) const
175175 case Token_union:
176176 return CodeModel::Union;
177177 default :
178+ warnHere ();
178179 std::cerr << " ** WARNING unrecognized class type" << std::endl;
179180 }
180181 return CodeModel::Class;
@@ -254,6 +255,7 @@ void Binder::declare_symbol(SimpleDeclarationAST *node, InitDeclaratorAST *init_
254255 NameAST *id = declarator->id ;
255256 if (! declarator->id )
256257 {
258+ warnHere ();
257259 std::cerr << " ** WARNING expected a declarator id" << std::endl;
258260 return ;
259261 }
@@ -263,6 +265,7 @@ void Binder::declare_symbol(SimpleDeclarationAST *node, InitDeclaratorAST *init_
263265 if (! symbolScope)
264266 {
265267 name_cc.run (id);
268+ warnHere ();
266269 std::cerr << " ** WARNING scope not found for symbol:"
267270 << qPrintable (name_cc.name ()) << std::endl;
268271 return ;
@@ -371,7 +374,8 @@ void Binder::visitFunctionDefinition(FunctionDefinitionAST *node)
371374 declarator = declarator->sub_declarator ;
372375 // Q_ASSERT(declarator->id);
373376 if (!declarator->id ) {
374- std::cerr << " ** SHIT" << qPrintable (name_cc.name ()) << std::endl
377+ warnHere ();
378+ std::cerr << " ** SHIT " << qPrintable (name_cc.name ()) << std::endl
375379 << " \t definition *ignored*"
376380 << std::endl;
377381 return ;
@@ -381,8 +385,9 @@ void Binder::visitFunctionDefinition(FunctionDefinitionAST *node)
381385 ScopeModelItem functionScope = finder.resolveScope (declarator->id , scope);
382386 if (! functionScope)
383387 {
388+ warnHere ();
384389 name_cc.run (declarator->id );
385- std::cerr << " ** WARNING scope not found for function definition:"
390+ std::cerr << " ** WARNING scope not found for function definition: "
386391 << qPrintable (name_cc.name ()) << std::endl
387392 << " \t definition *ignored*"
388393 << std::endl;
@@ -392,6 +397,7 @@ void Binder::visitFunctionDefinition(FunctionDefinitionAST *node)
392397 decl_cc.run (declarator);
393398 foreach (DeclaratorCompiler::Parameter p, decl_cc.parameters ()) {
394399 if (p.type .isRvalueReference ()) {
400+ // warnHere();
395401 // std::cerr << "** Skipping function with rvalue reference parameter: "
396402 // << qPrintable(name_cc.name()) << std::endl;
397403 return ;
@@ -565,6 +571,7 @@ void Binder::visitTypedef(TypedefAST *node)
565571
566572 if (alias_name.isEmpty ())
567573 {
574+ warnHere ();
568575 std::cerr << " ** WARNING anonymous typedef not supported! ``" ;
569576 Token const &tk = _M_token_stream->token ((int ) node->start_token );
570577 Token const &end_tk = _M_token_stream->token ((int ) node->end_token );
@@ -830,6 +837,16 @@ void Binder::visitQProperty(QPropertyAST *node)
830837 _M_current_class->addPropertyDeclaration (property);
831838}
832839
840+ void Binder::warnHere () const
841+ {
842+ ScopeModelItem scope = currentScope ();
843+ QString fileName = scope ? scope->fileName () : QString (" <unknown>" );
844+ if (fileName != _M_lastWarnedFile) {
845+ _M_lastWarnedFile = fileName;
846+ std::cerr << " In file " << fileName.toLatin1 ().constData () << " :" << std::endl;
847+ }
848+ }
849+
833850void Binder::applyStorageSpecifiers (const ListNode<std::size_t > *it, MemberModelItem item)
834851{
835852 if (it == 0 )
0 commit comments