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 WasmDump.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -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/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/build-llvm -resource-dir /usr/lib/llvm-14/lib/clang/14.0.0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I tools/llvm-objdump -I /build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/llvm/tools/llvm-objdump -I include -I /build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/llvm/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-14/lib/clang/14.0.0/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/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/build-llvm=build-llvm -fmacro-prefix-map=/build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/= -fcoverage-prefix-map=/build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/build-llvm=build-llvm -fcoverage-prefix-map=/build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/= -O3 -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 -std=c++14 -fdeprecated-macro -fdebug-compilation-dir=/build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/build-llvm -fdebug-prefix-map=/build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/build-llvm=build-llvm -fdebug-prefix-map=/build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/= -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-2022-01-19-134126-35450-1 -x c++ /build/llvm-toolchain-snapshot-14~++20220119111520+da61cb019eb2/llvm/tools/llvm-objdump/WasmDump.cpp
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | #include "WasmDump.h" |
15 | |
16 | #include "llvm-objdump.h" |
17 | #include "llvm/Object/Wasm.h" |
18 | |
19 | using namespace llvm; |
20 | using namespace llvm::object; |
21 | |
22 | void objdump::printWasmFileHeader(const object::ObjectFile *Obj) { |
23 | const auto *File = dyn_cast<const WasmObjectFile>(Obj); |
| 1 | Assuming 'Obj' is not a 'WasmObjectFile' | |
|
| 2 | | 'File' initialized to a null pointer value | |
|
24 | |
25 | outs() << "Program Header:\n"; |
26 | outs() << "Version: 0x"; |
27 | outs().write_hex(File->getHeader().Version); |
| 3 | | Called C++ object pointer is null |
|
28 | outs() << "\n"; |
29 | } |
30 | |
31 | Error objdump::getWasmRelocationValueString(const WasmObjectFile *Obj, |
32 | const RelocationRef &RelRef, |
33 | SmallVectorImpl<char> &Result) { |
34 | const wasm::WasmRelocation &Rel = Obj->getWasmRelocation(RelRef); |
35 | symbol_iterator SI = RelRef.getSymbol(); |
36 | std::string FmtBuf; |
37 | raw_string_ostream Fmt(FmtBuf); |
38 | if (SI == Obj->symbol_end()) { |
39 | |
40 | |
41 | Fmt << Rel.Index; |
42 | } else { |
43 | Expected<StringRef> SymNameOrErr = SI->getName(); |
44 | if (!SymNameOrErr) |
45 | return SymNameOrErr.takeError(); |
46 | StringRef SymName = *SymNameOrErr; |
47 | Result.append(SymName.begin(), SymName.end()); |
48 | } |
49 | Fmt << (Rel.Addend < 0 ? "" : "+") << Rel.Addend; |
50 | Fmt.flush(); |
51 | Result.append(FmtBuf.begin(), FmtBuf.end()); |
52 | return Error::success(); |
53 | } |