File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
cpp/ql/lib/semmle/code/cpp Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,11 @@ class Element extends ElementBase {
192192 */
193193 predicate isAffectedByMacro ( ) { affectedByMacro ( this ) }
194194
195+ /** Holds if this element is affected by the expansion of `mi`. */
196+ predicate isAffectedByMacro ( MacroInvocation mi ) {
197+ affectedbymacroexpansion ( underlyingElement ( this ) , unresolveElement ( mi ) )
198+ }
199+
195200 private Element getEnclosingElementPref ( ) {
196201 enclosingfunction ( underlyingElement ( this ) , unresolveElement ( result ) ) or
197202 result .( Function ) = stmtEnclosingElement ( this ) or
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class Expr extends StmtParent, @expr {
2323 predicate hasChild ( Expr e , int n ) { e = this .getChild ( n ) }
2424
2525 /** Gets the enclosing function of this expression, if any. */
26- Function getEnclosingFunction ( ) { result = exprEnclosingElement ( this ) }
26+ override Function getEnclosingFunction ( ) { result = exprEnclosingElement ( this ) }
2727
2828 /** Gets the nearest enclosing set of curly braces around this expression in the source, if any. */
2929 BlockStmt getEnclosingBlock ( ) { result = this .getEnclosingStmt ( ) .getEnclosingBlock ( ) }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class Stmt extends StmtParent, @stmt {
2020 predicate hasChild ( Element e , int n ) { this .getChild ( n ) = e }
2121
2222 /** Gets the enclosing function of this statement, if any. */
23- Function getEnclosingFunction ( ) { result = stmtEnclosingElement ( this ) }
23+ override Function getEnclosingFunction ( ) { result = stmtEnclosingElement ( this ) }
2424
2525 /**
2626 * Gets the nearest enclosing block of this statement in the source, if any.
@@ -159,7 +159,10 @@ private class TStmtParent = @stmt or @expr;
159159 *
160160 * This is normally a statement, but may be a `StmtExpr`.
161161 */
162- class StmtParent extends ControlFlowNode , TStmtParent { }
162+ class StmtParent extends ControlFlowNode , TStmtParent {
163+ /** Gets the enclosing function of this element, if any. */
164+ Function getEnclosingFunction ( ) { none ( ) }
165+ }
163166
164167/**
165168 * A C/C++ 'expression' statement.
You can’t perform that action at this time.
0 commit comments