Skip to content

Commit

Permalink
Share span lookup across both cxx defn xref results
Browse files Browse the repository at this point in the history
Summary:
Slight optimization. We were computing the span twice, once for the decl -> def target, and against for the def -> decl target.

Just do it once outside the loop.

Reviewed By: nhawkes

Differential Revision: D39414932

fbshipit-source-id: ea5047ed9b09cedded3c1bd17e59fac0b98e694b
  • Loading branch information
donsbot authored and facebook-github-bot committed Sep 13, 2022
1 parent 4aa0dda commit 4ea90ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions glean/schema/py/symbolidcxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# To regenerate this file run fbcode//glean/schema/gen/sync
from typing import Optional, Tuple, Union, List, Dict, TypeVar
from thrift.py3 import Struct
from enum import Enum
import ast
from glean.schema.py.glean_schema_predicate import GleanSchemaPredicate, angle_for, R, Just, InnerGleanSchemaPredicate
from glean.schema.py.cxx1 import *
Expand Down
2 changes: 1 addition & 1 deletion glean/schema/source/codemarkup.cxx.angle
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ predicate CxxFileEntityTraceDeclToDefXRefLocations:
{ File, Trace, XRef, Entity } where
Trace = cxx1.Trace { File, cxx1.Declarations Decls, _ };
Decl = Decls[..];
cxx1.DeclarationNameSpan { Decl, _, Span };
# Get xrefs from decl to defn ,and defn back to decl family
({ Entity, Location } where
CxxDeclToDefXRefTargetLocation { Decl, Entity, Location } |
CxxDefToDeclFamilyXRefTargetLocation { Decl, Entity, Location }
);
cxx1.DeclarationNameSpan { Decl, _, Span };
{ Location, { span = Span }} = XRef;

# For a given Decl, it might have a base Defn, build an entity for that
Expand Down

0 comments on commit 4ea90ad

Please sign in to comment.