Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af6a4f3

Browse files
author
Robert Marsh
committed
C++: TranslatedInstructionContainer to RootElement
1 parent 5811d0b commit af6a4f3

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,11 @@ abstract class TranslatedElement extends TTranslatedElement {
953953
final TranslatedElement getParent() { result.getAChild() = this }
954954
}
955955

956-
abstract class TranslatedInstructionContainer extends TranslatedElement {
957-
TranslatedInstructionContainer() {
956+
/**
957+
* Represents the IR translation of a root element, either a function or a global variable.
958+
*/
959+
abstract class TranslatedRootElement extends TranslatedElement {
960+
TranslatedRootElement() {
958961
this instanceof TTranslatedFunction
959962
or
960963
this instanceof TTranslatedGlobalOrNamespaceVarInit

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ abstract class TranslatedExpr extends TranslatedElement {
9393
/**
9494
* Gets the `TranslatedFunction` containing this expression.
9595
*/
96-
final TranslatedInstructionContainer getEnclosingFunction() {
96+
final TranslatedRootElement getEnclosingFunction() {
9797
result = getTranslatedFunction(expr.getEnclosingFunction())
9898
or
9999
result = getTranslatedVarInit(expr.getEnclosingVariable())

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ predicate hasReturnValue(Function func) { not func.getUnspecifiedType() instance
5858
* Represents the IR translation of a function. This is the root elements for
5959
* all other elements associated with this function.
6060
*/
61-
class TranslatedFunction extends TranslatedInstructionContainer, TTranslatedFunction {
61+
class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction {
6262
Function func;
6363

6464
TranslatedFunction() { this = TTranslatedFunction(func) }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ private import semmle.code.cpp.ir.internal.CppType
77
private import TranslatedInitialization
88
private import InstructionTag
99

10-
class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer,
10+
class TranslatedGlobalOrNamespaceVarInit extends TranslatedRootElement,
1111
TTranslatedGlobalOrNamespaceVarInit, InitializationContext {
1212
GlobalOrNamespaceVariable var;
1313

0 commit comments

Comments
 (0)