mirror of
git://code.qt.io/qt/qt5.git
synced 2026-04-18 19:16:21 +08:00
Upload the Axivion config files to gerrit
To review and comment on the rules. Task-number: QTQAINFRA-6577 Change-Id: I3c4f85e307533346d393ed32adccb75c106d882e Reviewed-by: Simo Fält <simo.falt@qt.io>
This commit is contained in:
34
coin/provisioning/common/linux/axivion/post_processing.py
Normal file
34
coin/provisioning/common/linux/axivion/post_processing.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#Copyright (C) 2024 The Qt Company Ltd
|
||||
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
import re
|
||||
|
||||
import axivion.config
|
||||
from axivion.analysis.post_processing import FilterAction
|
||||
from bauhaus import ir
|
||||
|
||||
analysis = axivion.config.get_analysis()
|
||||
|
||||
qt_inline_pattern = re.compile(r"QT_.*_INLINE(_IMPL)?_SINCE\(\d+,\d+\)")
|
||||
def exclude_inlined_by_qt_inline_macro(sv, ir_graph):
|
||||
node = ir_graph.get_node(ir.Physical, sv.primary_sloc.pir_node_number)
|
||||
|
||||
# we have to check on the token stream as the macro might expand to nothing
|
||||
# -> only the invocation is in the IR, but not in the AST of the routine decl / def
|
||||
preceeding_string = ""
|
||||
|
||||
token = node.Token
|
||||
while True:
|
||||
try:
|
||||
token_value = re.sub('^#\\s+', '#', token.Value)
|
||||
if token_value in {';', '{', '}', '#define'}:
|
||||
break
|
||||
preceeding_string = token.Value + preceeding_string
|
||||
token = token.prev()
|
||||
except StopIteration:
|
||||
break
|
||||
if re.match(qt_inline_pattern, preceeding_string):
|
||||
return FilterAction.exclude
|
||||
return FilterAction.normal
|
||||
|
||||
analysis['Qt-Generic-NoFunctionDefinitionInHeader'].post_processing.add_filter(exclude_inlined_by_qt_inline_macro, inputs=[ir.Graph])
|
||||
Reference in New Issue
Block a user