mirror of
https://github.com/hohn/codeql-sample-polkit.git
synced 2025-12-16 13:53:04 +01:00
30 lines
948 B
Plaintext
30 lines
948 B
Plaintext
/**
|
|
* @name Print Aliased SSA IR
|
|
* @description Outputs a representation of the Aliased SSA IR graph
|
|
* @id cpp/example/polkit-ir
|
|
* @kind graph
|
|
*/
|
|
|
|
// From PrintIR.qll:
|
|
// ... For most uses, however, it is better to write a query
|
|
// that imports `PrintIR.qll`,
|
|
// extends `PrintIRConfiguration`,
|
|
// and overrides `shouldPrintFunction()` to select a subset of functions to dump.
|
|
|
|
import semmle.code.cpp.ir.PrintIR
|
|
import semmle.code.cpp.ir.internal.IRCppLanguage as Language
|
|
|
|
class PkexecMainConfig extends PrintIRConfiguration {
|
|
/** Gets a textual representation of this configuration. */
|
|
override string toString() { result = "PkexecMainConfig" }
|
|
|
|
/**
|
|
* Holds if the IR for `func` should be printed. By default, holds for all
|
|
* functions.
|
|
*/
|
|
override predicate shouldPrintFunction(Language::Function func) {
|
|
func.getName() = "main" and
|
|
func.getLocation().getFile().getBaseName() = "pkexec.c"
|
|
}
|
|
}
|