Bug Summary

File:out/../deps/icu-small/source/common/unifilt.cpp
Warning:line 53, column 18
Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name unifilt.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 -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/maurizio/node-v18.6.0/out -resource-dir /usr/local/lib/clang/16.0.0 -D V8_DEPRECATION_WARNINGS -D V8_IMMINENT_DEPRECATION_WARNINGS -D _GLIBCXX_USE_CXX11_ABI=1 -D NODE_OPENSSL_CONF_NAME=nodejs_conf -D NODE_OPENSSL_HAS_QUIC -D __STDC_FORMAT_MACROS -D OPENSSL_NO_PINSHARED -D OPENSSL_THREADS -D U_COMMON_IMPLEMENTATION=1 -D U_ATTRIBUTE_DEPRECATED= -D _CRT_SECURE_NO_DEPRECATE= -D U_STATIC_IMPLEMENTATION=1 -D UCONFIG_NO_SERVICE=1 -D U_ENABLE_DYLOAD=0 -D U_HAVE_STD_STRING=1 -D UCONFIG_NO_BREAK_ITERATION=0 -I ../deps/icu-small/source/common -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward -internal-isystem /usr/local/lib/clang/16.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wno-deprecated-declarations -Wno-strict-aliasing -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/maurizio/node-v18.6.0/out -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-08-22-142216-507842-1 -x c++ ../deps/icu-small/source/common/unifilt.cpp
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/*
4**********************************************************************
5* Copyright (c) 2001-2012, International Business Machines
6* Corporation and others. All Rights Reserved.
7**********************************************************************
8* Date Name Description
9* 07/18/01 aliu Creation.
10**********************************************************************
11*/
12
13#include "unicode/unifilt.h"
14#include "unicode/rep.h"
15#include "unicode/utf16.h"
16
17U_NAMESPACE_BEGINnamespace icu_71 {
18UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(UnicodeFilter)UClassID UnicodeFilter::getStaticClassID() { static char classID
= 0; return (UClassID)&classID; }
19
20
21/* Define this here due to the lack of another file.
22 It can't be defined in the header */
23UnicodeMatcher::~UnicodeMatcher() {}
24
25UnicodeFilter::~UnicodeFilter() {}
26
27/**
28 * UnicodeFunctor API.
29 * Note that UnicodeMatcher is a base class of UnicodeFilter.
30 */
31UnicodeMatcher* UnicodeFilter::toMatcher() const {
32 return const_cast<UnicodeFilter *>(this);
33}
34
35void UnicodeFilter::setData(const TransliterationRuleData*) {}
36
37/**
38 * Default implementation of UnicodeMatcher::matches() for Unicode
39 * filters. Matches a single code point at offset (either one or
40 * two 16-bit code units).
41 */
42UMatchDegree UnicodeFilter::matches(const Replaceable& text,
43 int32_t& offset,
44 int32_t limit,
45 UBool incremental) {
46 UChar32 c;
47 if (offset < limit &&
48 contains(c = text.char32At(offset))) {
49 offset += U16_LENGTH(c)((uint32_t)(c)<=0xffff ? 1 : 2);
50 return U_MATCH;
51 }
52 if (offset > limit &&
53 contains(c = text.char32At(offset))) {
Although the value stored to 'c' is used in the enclosing expression, the value is never actually read from 'c'
54 // Backup offset by 1, unless the preceding character is a
55 // surrogate pair -- then backup by 2 (keep offset pointing at
56 // the lead surrogate).
57 --offset;
58 if (offset >= 0) {
59 offset -= U16_LENGTH(text.char32At(offset))((uint32_t)(text.char32At(offset))<=0xffff ? 1 : 2) - 1;
60 }
61 return U_MATCH;
62 }
63 if (incremental && offset == limit) {
64 return U_PARTIAL_MATCH;
65 }
66 return U_MISMATCH;
67}
68
69U_NAMESPACE_END}
70
71//eof