@@ -289,8 +289,10 @@ void CppServiceHandler::getProperties(
289
289
return_[" Type" ] = variable.qualifiedType ;
290
290
}
291
291
else
292
- LOG (warning) << " Database query result was not expected to be empty. "
293
- << __FILE__ << " , line #" << __LINE__;
292
+ LOG (warning)
293
+ << " Unexpected empty result when querying properties "
294
+ " of C++ variable: "
295
+ << toShortDiagnosticString (node);
294
296
295
297
break ;
296
298
}
@@ -310,8 +312,10 @@ void CppServiceHandler::getProperties(
310
312
return_[" Signature" ] = function.name ;
311
313
}
312
314
else
313
- LOG (warning) << " Database query result was not expected to be empty. "
314
- << __FILE__ << " , line #" << __LINE__;
315
+ LOG (warning)
316
+ << " Unexpected empty result when querying properties "
317
+ " of C++ function: "
318
+ << toShortDiagnosticString (node);
315
319
316
320
break ;
317
321
}
@@ -334,8 +338,10 @@ void CppServiceHandler::getProperties(
334
338
return_[" Qualified name" ] = type.qualifiedName ;
335
339
}
336
340
else
337
- LOG (warning) << " Database query result was not expected to be empty. "
338
- << __FILE__ << " , line #" << __LINE__;
341
+ LOG (warning)
342
+ << " Unexpected empty result when querying properties "
343
+ " of C++ type: "
344
+ << toShortDiagnosticString (node);
339
345
340
346
break ;
341
347
}
@@ -353,8 +359,10 @@ void CppServiceHandler::getProperties(
353
359
return_[" Qualified name" ] = type.qualifiedName ;
354
360
}
355
361
else
356
- LOG (warning) << " Database query result was not expected to be empty. "
357
- << __FILE__ << " , line #" << __LINE__;
362
+ LOG (warning)
363
+ << " Unexpected empty result when querying properties "
364
+ " of C++ typedef: "
365
+ << toShortDiagnosticString (node);
358
366
359
367
break ;
360
368
}
@@ -373,8 +381,10 @@ void CppServiceHandler::getProperties(
373
381
return_[" Value" ] = std::to_string (enumConst.value );
374
382
}
375
383
else
376
- LOG (warning) << " Database query result was not expected to be empty. "
377
- << __FILE__ << " , line #" << __LINE__;
384
+ LOG (warning)
385
+ << " Unexpected empty result when querying properties "
386
+ " of C++ enum constant: "
387
+ << toShortDiagnosticString (node);
378
388
}
379
389
}
380
390
});
@@ -492,8 +502,10 @@ std::int32_t CppServiceHandler::getReferenceCount(
492
502
TypeQuery::entityHash == function.typeHash ).count ;
493
503
}
494
504
else
495
- LOG (warning) << " Database query result was not expected to be empty. "
496
- << __FILE__ << " , line #" << __LINE__;
505
+ LOG (warning)
506
+ << " Unexpected empty result when counting return types "
507
+ " of C++ function: "
508
+ << toShortDiagnosticString (node);
497
509
498
510
return 0 ;
499
511
}
@@ -526,8 +538,10 @@ std::int32_t CppServiceHandler::getReferenceCount(
526
538
TypeQuery::entityHash == variable.typeHash ).count ;
527
539
}
528
540
else
529
- LOG (warning) << " Database query result was not expected to be empty. "
530
- << __FILE__ << " , line #" << __LINE__;
541
+ LOG (warning)
542
+ << " Unexpected empty result when counting types "
543
+ " of C++ variable: "
544
+ << toShortDiagnosticString (node);
531
545
532
546
return 0 ;
533
547
}
@@ -774,8 +788,10 @@ void CppServiceHandler::getReferences(
774
788
std::to_string (var.load ()->astNodeId )));
775
789
}
776
790
else
777
- LOG (warning) << " Database query result was not expected to be empty. "
778
- << __FILE__ << " , line #" << __LINE__;
791
+ LOG (warning)
792
+ << " Unexpected empty result when querying parameters "
793
+ " of C++ function: "
794
+ << toShortDiagnosticString (node);
779
795
780
796
break ;
781
797
}
@@ -795,8 +811,10 @@ void CppServiceHandler::getReferences(
795
811
std::to_string (var.load ()->astNodeId )));
796
812
}
797
813
else
798
- LOG (warning) << " Database query result was not expected to be empty. "
799
- << __FILE__ << " , line #" << __LINE__;
814
+ LOG (warning)
815
+ << " Unexpected empty result when querying local variables "
816
+ " of C++ function: "
817
+ << toShortDiagnosticString (node);
800
818
801
819
break ;
802
820
}
@@ -822,8 +840,10 @@ void CppServiceHandler::getReferences(
822
840
}
823
841
}
824
842
else
825
- LOG (warning) << " Database query result was not expected to be empty. "
826
- << __FILE__ << " , line #" << __LINE__;
843
+ LOG (warning)
844
+ << " Unexpected empty result when querying return type "
845
+ " of C++ function: "
846
+ << toShortDiagnosticString (node);
827
847
828
848
break ;
829
849
}
@@ -884,8 +904,10 @@ void CppServiceHandler::getReferences(
884
904
}
885
905
}
886
906
else
887
- LOG (warning) << " Database query result was not expected to be empty. "
888
- << __FILE__ << " , line #" << __LINE__;
907
+ LOG (warning)
908
+ << " Unexpected empty result when querying type "
909
+ " of C++ variable: "
910
+ << toShortDiagnosticString (node);
889
911
890
912
break ;
891
913
}
@@ -983,8 +1005,10 @@ void CppServiceHandler::getReferences(
983
1005
nodes = std::vector<model::CppAstNode>(result.begin (), result.end ());
984
1006
}
985
1007
else
986
- LOG (warning) << " Database query result was not expected to be empty. "
987
- << __FILE__ << " , line #" << __LINE__;
1008
+ LOG (warning)
1009
+ << " Unexpected empty result when querying underlying type "
1010
+ " of C++ typedef: "
1011
+ << toShortDiagnosticString (node);
988
1012
989
1013
break ;
990
1014
}
@@ -1009,8 +1033,10 @@ void CppServiceHandler::getReferences(
1009
1033
});
1010
1034
}
1011
1035
else
1012
- LOG (warning) << " Database query result was not expected to be empty. "
1013
- << __FILE__ << " , line #" << __LINE__;
1036
+ LOG (warning)
1037
+ << " Unexpected empty result when querying enum constants "
1038
+ " of C++ enum: "
1039
+ << toShortDiagnosticString (node);
1014
1040
1015
1041
break ;
1016
1042
}
@@ -1611,14 +1637,22 @@ CppServiceHandler::getTags(const std::vector<model::CppAstNode>& nodes_)
1611
1637
tags[node.id ].push_back (visibility);
1612
1638
}
1613
1639
1614
- // --- Virtual Tag ---//
1640
+ // --- Other Tags ---//
1615
1641
1616
1642
FuncResult funcNodes = _db->query <cc::model::CppFunction>(
1617
1643
FuncQuery::entityHash == defNode.entityHash );
1618
- const model::CppFunction& funcNode = *funcNodes.begin ();
1644
+ if (!funcNodes.empty ())
1645
+ {
1646
+ const model::CppFunction& funcNode = *funcNodes.begin ();
1619
1647
1620
- for (const model::Tag& tag : funcNode.tags )
1621
- tags[node.id ].push_back (model::tagToString (tag));
1648
+ for (const model::Tag& tag : funcNode.tags )
1649
+ tags[node.id ].push_back (model::tagToString (tag));
1650
+ }
1651
+ else
1652
+ LOG (warning)
1653
+ << " Unexpected empty result when querying tags "
1654
+ " of C++ function: "
1655
+ << toShortDiagnosticString (node);
1622
1656
1623
1657
break ;
1624
1658
}
@@ -1650,8 +1684,10 @@ CppServiceHandler::getTags(const std::vector<model::CppAstNode>& nodes_)
1650
1684
tags[node.id ].push_back (model::tagToString (tag));
1651
1685
}
1652
1686
else
1653
- LOG (warning) << " Database query result was not expected to be empty. "
1654
- << __FILE__ << " , line #" << __LINE__;
1687
+ LOG (warning)
1688
+ << " Unexpected empty result when querying tags "
1689
+ " of C++ variable: "
1690
+ << toShortDiagnosticString (node);
1655
1691
1656
1692
break ;
1657
1693
}
@@ -1698,6 +1734,23 @@ std::size_t CppServiceHandler::queryCallsCount(
1698
1734
return _db->query_value <model::CppAstCount>(astCallsQuery (node)).count ;
1699
1735
}
1700
1736
1737
+ inline std::string
1738
+ CppServiceHandler::toShortDiagnosticString (const model::CppAstNode& node) const
1739
+ {
1740
+ return std::string (node.astValue )
1741
+ .append (" \n AST node #" ).append (std::to_string (node.id ))
1742
+ .append (" \n in file " ).append (node.location .file .load ()->path )
1743
+ .append (" (" )
1744
+ .append (std::to_string (
1745
+ static_cast <signed >(node.location .range .start .line ))).append (" :" )
1746
+ .append (std::to_string (
1747
+ static_cast <signed >(node.location .range .start .column ))).append (" - " )
1748
+ .append (std::to_string (
1749
+ static_cast <signed >(node.location .range .end .line ))).append (" :" )
1750
+ .append (std::to_string (
1751
+ static_cast <signed >(node.location .range .end .column ))).append (" )" );
1752
+ }
1753
+
1701
1754
} // language
1702
1755
} // service
1703
1756
} // cc
0 commit comments