Skip to content

Commit 0c10fa0

Browse files
committed
CPP: Add a location to TranslatedElement to help with debugging IR creation
1 parent 38892bb commit 0c10fa0

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)