Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/tools/profiler/./../../../tools/profiler/core/VTuneProfiler.cpp
Warning:line 20, column 15
Value stored to 'testEvent' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Unified_cpp_tools_profiler1.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 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/tools/profiler -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/tools/profiler -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D MOZ_REPLACE_MALLOC_PREFIX=profiler -D MOZJEMALLOC_PROFILING_CALLBACKS -D MOZ_VTUNE_INSTRUMENTATION -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/tools/profiler -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/tools/profiler -I /root/firefox-clang/caps -I /root/firefox-clang/docshell/base -I /root/firefox-clang/ipc/chromium/src -I /root/firefox-clang/mozglue/linker -I /root/firefox-clang/netwerk/base -I /root/firefox-clang/netwerk/protocol/http -I /root/firefox-clang/toolkit/components/jsoncpp/include -I /root/firefox-clang/toolkit/crashreporter/google-breakpad/src -I /root/firefox-clang/tools/profiler/core -I /root/firefox-clang/tools/profiler/gecko -I /root/firefox-clang/xpcom/base -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /root/firefox-clang/ipc/chromium/src -I /root/firefox-clang/third_party/abseil-cpp -I /root/firefox-clang/toolkit/components/telemetry -I /root/firefox-clang/xpcom/base -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -Wno-error=stack-protector -Wno-ignored-qualifiers -std=gnu++20 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-09-01-224014-2642839-1 -x c++ Unified_cpp_tools_profiler1.cpp
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#ifdef XP_WIN
6# undef UNICODE
7# undef _UNICODE
8#endif
9
10#include "VTuneProfiler.h"
11#include "mozilla/Bootstrap.h"
12
13VTuneProfiler* VTuneProfiler::mInstance = nullptr;
14
15void VTuneProfiler::Initialize() {
16 // This is just a 'dirty trick' to find out if the ittnotify DLL was found.
17 // If it wasn't this function always returns 0, otherwise it returns
18 // incrementing numbers, if the library was found this wastes 2 events but
19 // that should be okay.
20 __itt_event testEvent =
Value stored to 'testEvent' during its initialization is never read
21 __itt_event_create(!__itt_event_create_ptr__3_0) ? 0 : __itt_event_create_ptr__3_0("Test event", strlen("Test event"));
22 testEvent = __itt_event_create(!__itt_event_create_ptr__3_0) ? 0 : __itt_event_create_ptr__3_0("Test event 2", strlen("Test event 2"));
23
24 if (testEvent) {
25 mInstance = new VTuneProfiler();
26 }
27}
28
29void VTuneProfiler::Shutdown() {}
30
31void VTuneProfiler::TraceInternal(const char* aName, TracingKind aKind) {
32 std::string str(aName);
33
34 auto iter = mStrings.find(str);
35
36 __itt_event event;
37 if (iter != mStrings.end()) {
38 event = iter->second;
39 } else {
40 event = __itt_event_create(!__itt_event_create_ptr__3_0) ? 0 : __itt_event_create_ptr__3_0(aName, str.length());
41 mStrings.insert({str, event});
42 }
43
44 if (aKind == TRACING_INTERVAL_START || aKind == TRACING_EVENT) {
45 // VTune will consider starts not matched with an end to be single point in
46 // time events.
47 __itt_event_start(!__itt_event_start_ptr__3_0) ? 0 : __itt_event_start_ptr__3_0(event);
48 } else {
49 __itt_event_end(!__itt_event_end_ptr__3_0) ? 0 : __itt_event_end_ptr__3_0(event);
50 }
51}
52
53void VTuneProfiler::RegisterThreadInternal(const char* aName) {
54 std::string str(aName);
55
56 if (!str.compare("GeckoMain")) {
57 // Process main thread.
58 switch (XRE_GetProcessType()) {
59 case GeckoProcessType::GeckoProcessType_Default:
60 __itt_thread_set_name(!__itt_thread_set_name_ptr__3_0) ? (void)0 : __itt_thread_set_name_ptr__3_0("Main Process");
61 break;
62 case GeckoProcessType::GeckoProcessType_Content:
63 __itt_thread_set_name(!__itt_thread_set_name_ptr__3_0) ? (void)0 : __itt_thread_set_name_ptr__3_0("Content Process");
64 break;
65 case GeckoProcessType::GeckoProcessType_GMPlugin:
66 __itt_thread_set_name(!__itt_thread_set_name_ptr__3_0) ? (void)0 : __itt_thread_set_name_ptr__3_0("Plugin Process");
67 break;
68 case GeckoProcessType::GeckoProcessType_GPU:
69 __itt_thread_set_name(!__itt_thread_set_name_ptr__3_0) ? (void)0 : __itt_thread_set_name_ptr__3_0("GPU Process");
70 break;
71 default:
72 __itt_thread_set_name(!__itt_thread_set_name_ptr__3_0) ? (void)0 : __itt_thread_set_name_ptr__3_0("Unknown Process");
73 }
74 return;
75 }
76 __itt_thread_set_name(!__itt_thread_set_name_ptr__3_0) ? (void)0 : __itt_thread_set_name_ptr__3_0(aName);
77}