Skip to content

Commit 18fa6f5

Browse files
authored
Merge pull request github#14202 from alexet/translated-element-location
CPP: Add a location to TranslatedElement to help with debugging IR creation
2 parents 79c305c + 0c10fa0 commit 18fa6f5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,9 @@ abstract class TranslatedElement extends TTranslatedElement {
824824
/** DEPRECATED: Alias for getAst */
825825
deprecated Locatable getAST() { result = this.getAst() }
826826

827+
/** Gets the location of this element. */
828+
Location getLocation() { result = this.getAst().getLocation() }
829+
827830
/**
828831
* Get the first instruction to be executed in the evaluation of this element.
829832
*/

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class TranslatedStaticStorageDurationVarInit extends TranslatedRootElement,
2222

2323
final override Declaration getFunction() { result = var }
2424

25-
final Location getLocation() { result = var.getLocation() }
26-
2725
override Instruction getFirstInstruction() { result = this.getInstruction(EnterFunctionTag()) }
2826

2927
override TranslatedElement getChild(int n) {

0 commit comments

Comments
 (0)