clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name SideEffects.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/build/source/build-llvm/tools/clang/stage2-bins -resource-dir /usr/lib/llvm-17/lib/clang/17 -D MLIR_CUDA_CONVERSIONS_ENABLED=1 -D MLIR_ROCM_CONVERSIONS_ENABLED=1 -D _DEBUG -D _GLIBCXX_ASSERTIONS -D _GNU_SOURCE -D _LIBCPP_ENABLE_ASSERTIONS -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I tools/mlir/lib/TableGen -I /build/source/mlir/lib/TableGen -I include -I /build/source/llvm/include -I /build/source/mlir/include -I tools/mlir/include -D _FORTIFY_SOURCE=2 -D NDEBUG -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/llvm-17/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fmacro-prefix-map=/build/source/= -fcoverage-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fcoverage-prefix-map=/build/source/= -source-date-epoch 1683717183 -O2 -Wno-unused-command-line-argument -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-comment -Wno-misleading-indentation -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/build/source/build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/source/= -ferror-limit 19 -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2023-05-10-133810-16478-1 -x c++ /build/source/mlir/lib/TableGen/SideEffects.cpp
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | #include "mlir/TableGen/SideEffects.h" |
10 | #include "llvm/ADT/Twine.h" |
11 | #include "llvm/TableGen/Record.h" |
12 | |
13 | using namespace mlir; |
14 | using namespace mlir::tblgen; |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | StringRef SideEffect::getName() const { |
21 | return def->getValueAsString("effect"); |
22 | } |
23 | |
24 | StringRef SideEffect::getBaseEffectName() const { |
25 | return def->getValueAsString("baseEffectName"); |
26 | } |
27 | |
28 | std::string SideEffect::getInterfaceTrait() const { |
29 | StringRef trait = def->getValueAsString("interfaceTrait"); |
30 | StringRef cppNamespace = def->getValueAsString("cppNamespace"); |
31 | return cppNamespace.empty() ? trait.str() |
32 | : (cppNamespace + "::" + trait).str(); |
33 | } |
34 | |
35 | StringRef SideEffect::getResource() const { |
36 | return def->getValueAsString("resource"); |
37 | } |
38 | |
39 | bool SideEffect::classof(const Operator::VariableDecorator *var) { |
40 | return var->getDef().isSubClassOf("SideEffect"); |
41 | } |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | Operator::var_decorator_range SideEffectTrait::getEffects() const { |
48 | auto *listInit = dyn_cast<llvm::ListInit>(def->getValueInit("effects")); |
| 1 | Assuming the object is not a 'CastReturnType' | |
|
| 2 | | 'listInit' initialized to a null pointer value | |
|
49 | return {listInit->begin(), listInit->end()}; |
| 3 | | Called C++ object pointer is null |
|
50 | } |
51 | |
52 | StringRef SideEffectTrait::getBaseEffectName() const { |
53 | return def->getValueAsString("baseEffectName"); |
54 | } |
55 | |
56 | bool SideEffectTrait::classof(const Trait *t) { |
57 | return t->getDef().isSubClassOf("SideEffectsTraitBase"); |
58 | } |