Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/dom/debugger/./../../../dom/debugger/CallbackDebuggerNotification.h
Warning:line 68, column 21
Value stored to 'typeStr' 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_dom_debugger0.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/dom/debugger -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/dom/debugger -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_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/dom/debugger -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dom/debugger -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 -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_dom_debugger0.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#ifndef mozilla_dom_CallbackDebuggerNotification_h
6#define mozilla_dom_CallbackDebuggerNotification_h
7
8#include "DebuggerNotification.h"
9#include "DebuggerNotificationManager.h"
10#include "mozilla/CycleCollectedJSContext.h"
11
12namespace mozilla::dom {
13
14class CallbackDebuggerNotification : public DebuggerNotification {
15 public:
16 NS_DECL_ISUPPORTS_INHERITEDpublic: virtual nsresult QueryInterface(const nsIID& aIID
, void** aInstancePtr) override; virtual MozExternalRefCountType
AddRef(void) override; virtual MozExternalRefCountType Release
(void) override;
17 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CallbackDebuggerNotification,class cycleCollection : public DebuggerNotification::cycleCollection
{ public: constexpr explicit cycleCollection(Flags aFlags = 0
) : DebuggerNotification::cycleCollection(aFlags) {} private:
public: virtual nsresult TraverseNative(void* p, nsCycleCollectionTraversalCallback
& cb) override; virtual const char* ClassName() override {
return "CallbackDebuggerNotification"; }; static CallbackDebuggerNotification
* Downcast(nsISupports* s) { return static_cast<CallbackDebuggerNotification
*>(static_cast<DebuggerNotification*>( DebuggerNotification
::cycleCollection::Downcast(s))); } virtual void Unlink(void*
p) override; static constexpr nsXPCOMCycleCollectionParticipant
* GetParticipant() { return &CallbackDebuggerNotification
::_cycleCollectorGlobal; } }; clang diagnostic push clang diagnostic
ignored "-Wunnecessary-virtual-specifier" virtual void CheckForRightParticipant
() override clang diagnostic pop { nsXPCOMCycleCollectionParticipant
* p; CallQueryInterface(this, &p); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(p == &_cycleCollectorGlobal
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(p == &_cycleCollectorGlobal))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("p == &_cycleCollectorGlobal"
" (" "CallbackDebuggerNotification" " should QI to its own CC participant"
")", "./../../../dom/debugger/CallbackDebuggerNotification.h"
, 18); AnnotateMozCrashReason("MOZ_ASSERT" "(" "p == &_cycleCollectorGlobal"
") (" "CallbackDebuggerNotification" " should QI to its own CC participant"
")"); do { MOZ_CrashSequence(__null, 18); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); } static cycleCollection
_cycleCollectorGlobal;
18 DebuggerNotification)class cycleCollection : public DebuggerNotification::cycleCollection
{ public: constexpr explicit cycleCollection(Flags aFlags = 0
) : DebuggerNotification::cycleCollection(aFlags) {} private:
public: virtual nsresult TraverseNative(void* p, nsCycleCollectionTraversalCallback
& cb) override; virtual const char* ClassName() override {
return "CallbackDebuggerNotification"; }; static CallbackDebuggerNotification
* Downcast(nsISupports* s) { return static_cast<CallbackDebuggerNotification
*>(static_cast<DebuggerNotification*>( DebuggerNotification
::cycleCollection::Downcast(s))); } virtual void Unlink(void*
p) override; static constexpr nsXPCOMCycleCollectionParticipant
* GetParticipant() { return &CallbackDebuggerNotification
::_cycleCollectorGlobal; } }; clang diagnostic push clang diagnostic
ignored "-Wunnecessary-virtual-specifier" virtual void CheckForRightParticipant
() override clang diagnostic pop { nsXPCOMCycleCollectionParticipant
* p; CallQueryInterface(this, &p); do { static_assert( mozilla
::detail::AssertionConditionType<decltype(p == &_cycleCollectorGlobal
)>::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(p == &_cycleCollectorGlobal))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("p == &_cycleCollectorGlobal"
" (" "CallbackDebuggerNotification" " should QI to its own CC participant"
")", "./../../../dom/debugger/CallbackDebuggerNotification.h"
, 18); AnnotateMozCrashReason("MOZ_ASSERT" "(" "p == &_cycleCollectorGlobal"
") (" "CallbackDebuggerNotification" " should QI to its own CC participant"
")"); do { MOZ_CrashSequence(__null, 18); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false); } static cycleCollection
_cycleCollectorGlobal;
19
20 CallbackDebuggerNotification(nsIGlobalObject* aDebuggeeGlobal,
21 DebuggerNotificationType aType,
22 CallbackDebuggerNotificationPhase aPhase,
23 nsIGlobalObject* aRelevantGlobal = nullptr)
24 : DebuggerNotification(aDebuggeeGlobal, aType, aRelevantGlobal),
25 mPhase(aPhase) {}
26
27 // nsWrapperCache
28 virtual JSObject* WrapObject(JSContext* aCx,
29 JS::Handle<JSObject*> aGivenProto) override;
30
31 already_AddRefed<DebuggerNotification> CloneInto(
32 nsIGlobalObject* aNewOwner) const override;
33
34 CallbackDebuggerNotificationPhase Phase() const { return mPhase; }
35
36 protected:
37 ~CallbackDebuggerNotification() = default;
38
39 CallbackDebuggerNotificationPhase mPhase;
40};
41
42class MOZ_RAII CallbackDebuggerNotificationGuard final {
43 public:
44 MOZ_CAN_RUN_SCRIPT CallbackDebuggerNotificationGuard(
45 nsIGlobalObject* aDebuggeeGlobal, DebuggerNotificationType aType)
46 : mDebuggeeGlobal(aDebuggeeGlobal), mType(aType) {
47 Dispatch(CallbackDebuggerNotificationPhase::Pre);
48 }
49 CallbackDebuggerNotificationGuard(const CallbackDebuggerNotificationGuard&) =
50 delete;
51 CallbackDebuggerNotificationGuard(CallbackDebuggerNotificationGuard&&) =
52 delete;
53 CallbackDebuggerNotificationGuard& operator=(
54 const CallbackDebuggerNotificationGuard&) = delete;
55 CallbackDebuggerNotificationGuard& operator=(
56 CallbackDebuggerNotificationGuard&&) = delete;
57
58 MOZ_CAN_RUN_SCRIPT ~CallbackDebuggerNotificationGuard() {
59 Dispatch(CallbackDebuggerNotificationPhase::Post);
60 }
61
62 private:
63 MOZ_CAN_RUN_SCRIPT void Dispatch(CallbackDebuggerNotificationPhase aPhase) {
64#ifdef MOZ_EXECUTION_TRACING1
65 if (MOZ_UNLIKELY(profiler_is_active())(__builtin_expect(!!(profiler_is_active()), 0))) {
66 CycleCollectedJSContext* ccjcx = CycleCollectedJSContext::Get();
67 if (ccjcx) {
68 const char* typeStr = "";
Value stored to 'typeStr' during its initialization is never read
69 switch (mType) {
70 case DebuggerNotificationType::SetTimeout:
71 typeStr = "setTimeout";
72 break;
73 case DebuggerNotificationType::ClearTimeout:
74 typeStr = "clearTimeout";
75 break;
76 case DebuggerNotificationType::SetInterval:
77 typeStr = "setInterval";
78 break;
79 case DebuggerNotificationType::ClearInterval:
80 typeStr = "clearInterval";
81 break;
82 case DebuggerNotificationType::RequestAnimationFrame:
83 typeStr = "requestAnimationFrame";
84 break;
85 case DebuggerNotificationType::CancelAnimationFrame:
86 typeStr = "cancelAnimationFrame";
87 break;
88 case DebuggerNotificationType::SetTimeoutCallback:
89 typeStr = "setTimeout";
90 break;
91 case DebuggerNotificationType::SetIntervalCallback:
92 typeStr = "setInterval";
93 break;
94 case DebuggerNotificationType::RequestAnimationFrameCallback:
95 typeStr = "requestAnimationFrame";
96 break;
97 case DebuggerNotificationType::DomEvent:
98 MOZ_CRASH("Unreachable")do { do { } while (false); MOZ_ReportCrash("" "Unreachable", "./../../../dom/debugger/CallbackDebuggerNotification.h"
, 98); AnnotateMozCrashReason("MOZ_CRASH(" "Unreachable" ")")
; do { MOZ_CrashSequence(__null, 98); __attribute__((nomerge)
) ::abort(); } while (false); } while (false)
;
99 break;
100 }
101 if (aPhase == CallbackDebuggerNotificationPhase::Pre) {
102 JS_TracerEnterLabelLatin1(ccjcx->Context(), typeStr);
103 } else {
104 JS_TracerLeaveLabelLatin1(ccjcx->Context(), typeStr);
105 }
106 }
107 }
108#endif
109
110 auto manager = DebuggerNotificationManager::ForDispatch(mDebuggeeGlobal);
111 if (MOZ_UNLIKELY(manager)(__builtin_expect(!!(manager), 0))) {
112 manager->Dispatch<CallbackDebuggerNotification>(mType, aPhase);
113 }
114 }
115
116 nsIGlobalObject* mDebuggeeGlobal;
117 DebuggerNotificationType mType;
118};
119
120} // namespace mozilla::dom
121
122#endif // mozilla_dom_CallbackDebuggerNotification_h