C++: Add a few helper predicates.

This commit is contained in:
Mathias Vorreiter Pedersen
2026-01-09 19:23:19 +00:00
parent 6e3fd25b09
commit 67ab0fee83
3 changed files with 11 additions and 3 deletions

View File

@@ -192,6 +192,11 @@ class Element extends ElementBase {
*/
predicate isAffectedByMacro() { affectedByMacro(this) }
/** Holds if this element is affected by the expansion of `mi`. */
predicate isAffectedByMacro(MacroInvocation mi) {
affectedbymacroexpansion(underlyingElement(this), unresolveElement(mi))
}
private Element getEnclosingElementPref() {
enclosingfunction(underlyingElement(this), unresolveElement(result)) or
result.(Function) = stmtEnclosingElement(this) or