зеркало из https://github.com/github/codeql.git
Merge pull request #3931 from aeisenberg/aeisenberg/cpp-print-ast
Add the printAst.ql contextual query for C++
This commit is contained in:
Коммит
2941f413f9
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @name Print AST
|
||||
* @description Outputs a representation of a file's Abstract Syntax Tree. This
|
||||
* query is used by the VS Code extension.
|
||||
* @id cpp/print-ast
|
||||
* @kind graph
|
||||
* @tags ide-contextual-queries/print-ast
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import semmle.code.cpp.PrintAST
|
||||
import definitions
|
||||
|
||||
/**
|
||||
* The source file to generate an AST from.
|
||||
*/
|
||||
external string selectedSourceFile();
|
||||
|
||||
class Cfg extends PrintASTConfiguration {
|
||||
/**
|
||||
* Holds if the AST for `func` should be printed.
|
||||
* Print All functions from the selected file.
|
||||
*/
|
||||
override predicate shouldPrintFunction(Function func) {
|
||||
func.getFile() = getEncodedFile(selectedSourceFile())
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче