@@ -20,21 +20,39 @@ private string getLocationFilePath(@location_default loc) {
2020 */
2121overlay [ local]
2222private string getSingleLocationFilePath ( @element e ) {
23- // @var_decl has a direct location in the var_decls relation
24- exists ( @location_default loc | var_decls ( e , _, _, _, loc ) | result = getLocationFilePath ( loc ) )
25- //TODO: add other kinds of elements with single locations
23+ exists ( @location_default loc |
24+ var_decls ( e , _, _, _, loc )
25+ or
26+ fun_decls ( e , _, _, _, loc )
27+ or
28+ type_decls ( e , _, loc )
29+ or
30+ namespace_decls ( e , _, loc , _)
31+ or
32+ macroinvocations ( e , _, loc , _)
33+ or
34+ preprocdirects ( e , _, loc )
35+ |
36+ result = getLocationFilePath ( loc )
37+ )
2638}
2739
2840/**
2941 * Gets the file path for an element with potentially multiple locations.
3042 */
3143overlay [ local]
3244private string getMultiLocationFilePath ( @element e ) {
33- // @variable gets its location(s) from its @var_decl(s)
34- exists ( @var_decl vd , @location_default loc | var_decls ( vd , e , _, _, loc ) |
45+ exists ( @location_default loc |
46+ exists ( @var_decl vd | var_decls ( vd , e , _, _, loc ) )
47+ or
48+ exists ( @fun_decl fd | fun_decls ( fd , e , _, _, loc ) )
49+ or
50+ exists ( @type_decl td | type_decls ( td , e , loc ) )
51+ or
52+ exists ( @namespace_decl nd | namespace_decls ( nd , e , loc , _) )
53+ |
3554 result = getLocationFilePath ( loc )
3655 )
37- //TODO: add other kinds of elements with multiple locations
3856}
3957
4058/**
0 commit comments