mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++: Rename 'PseudoDeclarationEntry' to 'IRDeclarationEntry'.
This commit is contained in:
@@ -13,8 +13,8 @@ private import TranslatedInitialization
|
||||
* Gets the `TranslatedDeclarationEntry` that represents the declaration
|
||||
* `entry`.
|
||||
*/
|
||||
TranslatedDeclarationEntry getTranslatedDeclarationEntry(PseudoDeclarationEntry entry) {
|
||||
result.getPseudoDeclarationEntry() = entry
|
||||
TranslatedDeclarationEntry getTranslatedDeclarationEntry(IRDeclarationEntry entry) {
|
||||
result.getIRDeclarationEntry() = entry
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ TranslatedDeclarationEntry getTranslatedDeclarationEntry(PseudoDeclarationEntry
|
||||
* functions do not have a `TranslatedDeclarationEntry`.
|
||||
*/
|
||||
abstract class TranslatedDeclarationEntry extends TranslatedElement, TTranslatedDeclarationEntry {
|
||||
PseudoDeclarationEntry entry;
|
||||
IRDeclarationEntry entry;
|
||||
|
||||
TranslatedDeclarationEntry() { this = TTranslatedDeclarationEntry(entry) }
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class TranslatedDeclarationEntry extends TranslatedElement, TTranslated
|
||||
)
|
||||
}
|
||||
|
||||
PseudoDeclarationEntry getPseudoDeclarationEntry() { result = entry }
|
||||
IRDeclarationEntry getIRDeclarationEntry() { result = entry }
|
||||
|
||||
final override string toString() { result = entry.toString() }
|
||||
|
||||
@@ -218,7 +218,7 @@ class TranslatedStaticLocalVariableDeclarationEntry extends TranslatedDeclaratio
|
||||
*/
|
||||
class TranslatedStaticLocalVariableInitialization extends TranslatedElement,
|
||||
TranslatedLocalVariableDeclaration, TTranslatedStaticLocalVariableInitialization {
|
||||
PseudoVariableDeclarationEntry entry;
|
||||
IRVariableDeclarationEntry entry;
|
||||
StaticLocalVariable var;
|
||||
|
||||
TranslatedStaticLocalVariableInitialization() {
|
||||
|
||||
@@ -443,7 +443,7 @@ predicate hasTranslatedSyntheticTemporaryObject(Expr expr) {
|
||||
* necessary for automatic local variables, or for static local variables with dynamic
|
||||
* initialization.
|
||||
*/
|
||||
private predicate translateDeclarationEntry(PseudoDeclarationEntry entry) {
|
||||
private predicate translateDeclarationEntry(IRDeclarationEntry entry) {
|
||||
exists(DeclStmt declStmt, LocalVariable var |
|
||||
translateStmt(declStmt) and
|
||||
declStmt = entry.getStmt() and
|
||||
@@ -458,8 +458,8 @@ private predicate translateDeclarationEntry(PseudoDeclarationEntry entry) {
|
||||
)
|
||||
}
|
||||
|
||||
private module PseudoDeclarationEntries {
|
||||
private newtype TPseudoDeclarationEntry =
|
||||
private module IRDeclarationEntries {
|
||||
private newtype TIRDeclarationEntry =
|
||||
TPresentDeclarationEntry(DeclarationEntry entry) or
|
||||
TMissingDeclarationEntry(DeclStmt stmt, Declaration d, int index) {
|
||||
not exists(stmt.getDeclarationEntry(index)) and
|
||||
@@ -472,31 +472,31 @@ private module PseudoDeclarationEntries {
|
||||
* This class exists to work around the fact that `DeclStmt`s in
|
||||
* template instantiations do not have `DeclarationEntry`s.
|
||||
*
|
||||
* So instead, the IR works with `PseudoDeclarationEntry`s that synthesize
|
||||
* missing `DeclarationEntry`s when there is no result for `DeclStmt::getDeclarationEntry`.
|
||||
* So instead, the IR works with `IRDeclarationEntry`s that synthesize missing
|
||||
* `DeclarationEntry`s when there is no result for `DeclStmt::getDeclarationEntry`.
|
||||
*/
|
||||
abstract class PseudoDeclarationEntry extends TPseudoDeclarationEntry {
|
||||
/** Gets a string representation of this `PseudoDeclarationEntry`. */
|
||||
abstract class IRDeclarationEntry extends TIRDeclarationEntry {
|
||||
/** Gets a string representation of this `IRDeclarationEntry`. */
|
||||
abstract string toString();
|
||||
|
||||
/** Gets the `DeclStmt` that this `PseudoDeclarationEntry` belongs to. */
|
||||
/** Gets the `DeclStmt` that this `IRDeclarationEntry` belongs to. */
|
||||
abstract DeclStmt getStmt();
|
||||
|
||||
/** Gets the `Declaration` declared by this `PseudoDeclarationEntry`. */
|
||||
/** Gets the `Declaration` declared by this `IRDeclarationEntry`. */
|
||||
abstract Declaration getDeclaration();
|
||||
|
||||
/** Gets the AST represented by this `PseudoDeclarationEntry`. */
|
||||
/** Gets the AST represented by this `IRDeclarationEntry`. */
|
||||
abstract Locatable getAst();
|
||||
|
||||
/**
|
||||
* Holds if this `PseudoDeclarationEntry` is the `index`'th entry
|
||||
* Holds if this `IRDeclarationEntry` is the `index`'th entry
|
||||
* declared by the enclosing `DeclStmt`.
|
||||
*/
|
||||
abstract predicate hasIndex(int index);
|
||||
}
|
||||
|
||||
/** A `PseudoDeclarationEntry` for an existing `DeclarationEntry`. */
|
||||
private class PresentDeclarationEntry extends PseudoDeclarationEntry, TPresentDeclarationEntry {
|
||||
/** A `IRDeclarationEntry` for an existing `DeclarationEntry`. */
|
||||
private class PresentDeclarationEntry extends IRDeclarationEntry, TPresentDeclarationEntry {
|
||||
DeclarationEntry entry;
|
||||
|
||||
PresentDeclarationEntry() { this = TPresentDeclarationEntry(entry) }
|
||||
@@ -516,7 +516,7 @@ private module PseudoDeclarationEntries {
|
||||
* A synthesized `DeclarationEntry` that is created when a `DeclStmt` is missing a
|
||||
* result for `DeclStmt::getDeclarationEntry`
|
||||
*/
|
||||
private class MissingDeclarationEntry extends PseudoDeclarationEntry, TMissingDeclarationEntry {
|
||||
private class MissingDeclarationEntry extends IRDeclarationEntry, TMissingDeclarationEntry {
|
||||
DeclStmt stmt;
|
||||
Declaration d;
|
||||
int index;
|
||||
@@ -534,11 +534,11 @@ private module PseudoDeclarationEntries {
|
||||
override predicate hasIndex(int idx) { idx = index }
|
||||
}
|
||||
|
||||
/** A `PseudoDeclarationEntry` that represents an entry for a `Variable`. */
|
||||
class PseudoVariableDeclarationEntry instanceof PseudoDeclarationEntry {
|
||||
/** A `IRDeclarationEntry` that represents an entry for a `Variable`. */
|
||||
class IRVariableDeclarationEntry instanceof IRDeclarationEntry {
|
||||
Variable v;
|
||||
|
||||
PseudoVariableDeclarationEntry() { super.getDeclaration() = v }
|
||||
IRVariableDeclarationEntry() { super.getDeclaration() = v }
|
||||
|
||||
Variable getDeclaration() { result = v }
|
||||
|
||||
@@ -550,7 +550,7 @@ private module PseudoDeclarationEntries {
|
||||
}
|
||||
}
|
||||
|
||||
import PseudoDeclarationEntries
|
||||
import IRDeclarationEntries
|
||||
|
||||
newtype TTranslatedElement =
|
||||
// An expression that is not being consumed as a condition
|
||||
@@ -707,10 +707,10 @@ newtype TTranslatedElement =
|
||||
)
|
||||
} or
|
||||
// A local declaration
|
||||
TTranslatedDeclarationEntry(PseudoDeclarationEntry entry) { translateDeclarationEntry(entry) } or
|
||||
TTranslatedDeclarationEntry(IRDeclarationEntry entry) { translateDeclarationEntry(entry) } or
|
||||
// The dynamic initialization of a static local variable. This is a separate object from the
|
||||
// declaration entry.
|
||||
TTranslatedStaticLocalVariableInitialization(PseudoDeclarationEntry entry) {
|
||||
TTranslatedStaticLocalVariableInitialization(IRDeclarationEntry entry) {
|
||||
translateDeclarationEntry(entry) and
|
||||
entry.getDeclaration() instanceof StaticLocalVariable
|
||||
} or
|
||||
|
||||
@@ -76,12 +76,12 @@ class TranslatedDeclStmt extends TranslatedStmt {
|
||||
|
||||
private int getChildCount() { result = count(getDeclarationEntry(_)) }
|
||||
|
||||
PseudoDeclarationEntry getPseudoDeclarationEntry(int index) {
|
||||
IRDeclarationEntry getIRDeclarationEntry(int index) {
|
||||
result.hasIndex(index) and
|
||||
result.getStmt() = stmt
|
||||
}
|
||||
|
||||
PseudoDeclarationEntry getAPseudoDeclarationEntry() { result = this.getPseudoDeclarationEntry(_) }
|
||||
IRDeclarationEntry getAnIRDeclarationEntry() { result = this.getIRDeclarationEntry(_) }
|
||||
|
||||
/**
|
||||
* Gets the `TranslatedDeclarationEntry` child at zero-based index `index`. Since not all
|
||||
@@ -92,7 +92,7 @@ class TranslatedDeclStmt extends TranslatedStmt {
|
||||
private TranslatedDeclarationEntry getDeclarationEntry(int index) {
|
||||
result =
|
||||
rank[index + 1](TranslatedDeclarationEntry entry, int originalIndex |
|
||||
entry = getTranslatedDeclarationEntry(this.getPseudoDeclarationEntry(originalIndex))
|
||||
entry = getTranslatedDeclarationEntry(this.getIRDeclarationEntry(originalIndex))
|
||||
|
|
||||
entry order by originalIndex
|
||||
)
|
||||
@@ -654,16 +654,16 @@ class TranslatedRangeBasedForStmt extends TranslatedStmt, ConditionContext {
|
||||
}
|
||||
|
||||
private TranslatedDeclStmt getRangeVariableDeclStmt() {
|
||||
exists(PseudoVariableDeclarationEntry entry |
|
||||
exists(IRVariableDeclarationEntry entry |
|
||||
entry.getDeclaration() = stmt.getRangeVariable() and
|
||||
result.getAPseudoDeclarationEntry() = entry
|
||||
result.getAnIRDeclarationEntry() = entry
|
||||
)
|
||||
}
|
||||
|
||||
private TranslatedDeclStmt getBeginEndVariableDeclStmt() {
|
||||
exists(PseudoVariableDeclarationEntry entry |
|
||||
exists(IRVariableDeclarationEntry entry |
|
||||
entry.getStmt() = stmt.getBeginEndDeclaration() and
|
||||
result.getAPseudoDeclarationEntry() = entry
|
||||
result.getAnIRDeclarationEntry() = entry
|
||||
)
|
||||
}
|
||||
|
||||
@@ -678,9 +678,9 @@ class TranslatedRangeBasedForStmt extends TranslatedStmt, ConditionContext {
|
||||
}
|
||||
|
||||
private TranslatedDeclStmt getVariableDeclStmt() {
|
||||
exists(PseudoVariableDeclarationEntry entry |
|
||||
exists(IRVariableDeclarationEntry entry |
|
||||
entry.getDeclaration() = stmt.getVariable() and
|
||||
result.getAPseudoDeclarationEntry() = entry
|
||||
result.getAnIRDeclarationEntry() = entry
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user