History log of /llvm-project/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp (Results 26 – 50 of 53)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4
# 088b1c9c 04-Mar-2019 Kristof Umann <dkszelethus@gmail.com>

[analyzer] Enable subcheckers to possess checker options

Under the term "subchecker", I mean checkers that do not have a checker class on
their own, like unix.MallocChecker to unix.DynamicMemoryMode

[analyzer] Enable subcheckers to possess checker options

Under the term "subchecker", I mean checkers that do not have a checker class on
their own, like unix.MallocChecker to unix.DynamicMemoryModeling.

Since a checker object was required in order to retrieve checker options,
subcheckers couldn't possess options on their own.

This patch is also an excuse to change the argument order of getChecker*Option,
it always bothered me, now it resembles the actual command line argument
(checkername:option=value).

Differential Revision: https://reviews.llvm.org/D57579

llvm-svn: 355297

show more ...


Revision tags: llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2
# 058a7a45 26-Jan-2019 Kristof Umann <dkszelethus@gmail.com>

[analyzer] Supply all checkers with a shouldRegister function

Introduce the boolean ento::shouldRegister##CHECKERNAME(const LangOptions &LO)
function very similarly to ento::register##CHECKERNAME. T

[analyzer] Supply all checkers with a shouldRegister function

Introduce the boolean ento::shouldRegister##CHECKERNAME(const LangOptions &LO)
function very similarly to ento::register##CHECKERNAME. This will force every
checker to implement this function, but maybe it isn't that bad: I saw a lot of
ObjC or C++ specific checkers that should probably not register themselves based
on some LangOptions (mine too), but they do anyways.

A big benefit of this is that all registry functions now register their checker,
once it is called, registration is guaranteed.

This patch is a part of a greater effort to reinvent checker registration, more
info here: D54438#1315953

Differential Revision: https://reviews.llvm.org/D55424

llvm-svn: 352277

show more ...


Revision tags: llvmorg-8.0.0-rc1
# 2946cd70 19-Jan-2019 Chandler Carruth <chandlerc@gmail.com>

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the ne

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636

show more ...


# 76a21502 15-Dec-2018 Kristof Umann <dkszelethus@gmail.com>

[analyzer][NFC] Move CheckerRegistry from the Core directory to Frontend

ClangCheckerRegistry is a very non-obvious, poorly documented, weird concept.
It derives from CheckerRegistry, and is placed

[analyzer][NFC] Move CheckerRegistry from the Core directory to Frontend

ClangCheckerRegistry is a very non-obvious, poorly documented, weird concept.
It derives from CheckerRegistry, and is placed in lib/StaticAnalyzer/Frontend,
whereas it's base is located in lib/StaticAnalyzer/Core. It was, from what I can
imagine, used to circumvent the problem that the registry functions of the
checkers are located in the clangStaticAnalyzerCheckers library, but that
library depends on clangStaticAnalyzerCore. However, clangStaticAnalyzerFrontend
depends on both of those libraries.

One can make the observation however, that CheckerRegistry has no place in Core,
it isn't used there at all! The only place where it is used is Frontend, which
is where it ultimately belongs.

This move implies that since
include/clang/StaticAnalyzer/Checkers/ClangCheckers.h only contained a single function:

class CheckerRegistry;

void registerBuiltinCheckers(CheckerRegistry &registry);

it had to re purposed, as CheckerRegistry is no longer available to
clangStaticAnalyzerCheckers. It was renamed to BuiltinCheckerRegistration.h,
which actually describes it a lot better -- it does not contain the registration
functions for checkers, but only those generated by the tblgen files.

Differential Revision: https://reviews.llvm.org/D54436

llvm-svn: 349275

show more ...


Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3
# 0a1f91c8 05-Nov-2018 Kristof Umann <dkszelethus@gmail.com>

[analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered

One of the reasons why AnalyzerOptions is so chaotic is that options can be
retrieved from the comman

[analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered

One of the reasons why AnalyzerOptions is so chaotic is that options can be
retrieved from the command line whenever and wherever. This allowed for some
options to be forgotten for a looooooong time. Have you ever heard of
"region-store-small-struct-limit"? In order to prevent this in the future, I'm
proposing to restrict AnalyzerOptions' interface so that only checker options
can be retrieved without special getters. I would like to make every option be
accessible only through a getter, but checkers from plugins are a thing, so I'll
have to figure something out for that.

This also forces developers who'd like to add a new option to register it
properly in the .def file.

This is done by

* making the third checker pointer parameter non-optional, and checked by an
assert to be non-null.
* I added new, but private non-checkers option initializers, meant only for
internal use,
* Renamed these methods accordingly (mind the consistent name for once with
getBooleanOption!):
- getOptionAsString -> getCheckerStringOption,
- getOptionAsInteger -> getCheckerIntegerOption
* The 3 functions meant for initializing data members (with the not very
descriptive getBooleanOption, getOptionAsString and getOptionAsUInt names)
were renamed to be overloads of the getAndInitOption function name.
* All options were in some way retrieved via getCheckerOption. I removed it, and
moved the logic to getStringOption and getCheckerStringOption. This did cause
some code duplication, but that's the only way I could do it, now that checker
and non-checker options are separated. Note that the non-checker version
inserts the new option to the ConfigTable with the default value, but the
checker version only attempts to find already existing entries. This is how
it always worked, but this is clunky and I might end reworking that too, so we
can eventually get a ConfigTable that contains the entire configuration of the
analyzer.

Differential Revision: https://reviews.llvm.org/D53483

llvm-svn: 346113

show more ...


Revision tags: llvmorg-7.0.1-rc2
# c83b0dda 02-Nov-2018 Kristof Umann <dkszelethus@gmail.com>

[analyzer][NFC] Fix some incorrect uses of -analyzer-config options

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-con

[analyzer][NFC] Fix some incorrect uses of -analyzer-config options

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from
the command line, and be able to list them all.

In this patch, I found some flags that should've been used as checker options,
or have absolutely no mention of in AnalyzerOptions, or are nonexistent.

- NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker
option
- lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path"
option through a getter in AnalyzerOptions
- -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it,
- lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and
lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually
only contain an option getter. I deleted them, and fixed RetainCountChecker
to get it's "leak-diagnostics-reference-allocation" option as a checker option,
- "region-store-small-struct-limit" has a proper getter now.

Differential Revision: https://reviews.llvm.org/D53276

llvm-svn: 345985

show more ...


Revision tags: llvmorg-7.0.1-rc1
# c82d457d 28-Sep-2018 George Karpenkov <ekarpenkov@apple.com>

[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter

Differential Revision: https://reviews.llvm.org/D52640

llvm-svn: 343353


Revision tags: llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1
# 70ec1dd1 26-Jun-2018 George Karpenkov <ekarpenkov@apple.com>

[analyzer] Do not run visitors until the fixpoint, run only once.

In the current implementation, we run visitors until the fixed point is
reached.
That is, if a visitor adds another visitor, the cur

[analyzer] Do not run visitors until the fixpoint, run only once.

In the current implementation, we run visitors until the fixed point is
reached.
That is, if a visitor adds another visitor, the currently processed path
is destroyed, all diagnostics is discarded, and it is regenerated again,
until it's no longer modified.
This pattern has a few negative implications:

- This loop does not even guarantee to terminate.
E.g. just imagine two visitors bouncing a diagnostics around.
- Performance-wise, e.g. for sqlite3 all visitors are being re-run at
least 10 times for some bugs.
We have already seen a few reports where it leads to timeouts.
- If we want to add more computationally intense visitors, this will
become worse.
- From architectural standpoint, the current layout requires copying
visitors, which is conceptually wrong, and can be annoying (e.g. no
unique_ptr on visitors allowed).

The proposed change is a much simpler architecture: the outer loop
processes nodes upwards, and whenever the visitor is added it only
processes current nodes and above, thus guaranteeing termination.

Differential Revision: https://reviews.llvm.org/D47856

llvm-svn: 335666

show more ...


Revision tags: llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1
# 2a8c18d9 06-Apr-2018 Alexander Kornienko <alexfh@google.com>

Fix typos in clang

Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

archtype
cas
classs
checkk
compres
definit
frome
iff
inteval
ith
lod
metho

Fix typos in clang

Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

archtype
cas
classs
checkk
compres
definit
frome
iff
inteval
ith
lod
methode
nd
optin
ot
pres
statics
te
thru

Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few
files that have dubious fixes reverted.)

Differential revision: https://reviews.llvm.org/D44188

llvm-svn: 329399

show more ...


Revision tags: llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2
# d703ec94 17-Jan-2018 George Karpenkov <ekarpenkov@apple.com>

[analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the helper is used consistently

In most cases using
`N->getState()->getSVal(E, N->getLocationContext())`
is ugly, verbose, and

[analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the helper is used consistently

In most cases using
`N->getState()->getSVal(E, N->getLocationContext())`
is ugly, verbose, and also opens up more surface area for bugs if an
inconsistent location context is used.

This patch introduces a helper on an exploded node, and ensures
consistent usage of either `ExplodedNode::getSVal` or
`CheckContext::getSVal` across the codebase.
As a result, a large number of redundant lines is removed.

Differential Revision: https://reviews.llvm.org/D42155

llvm-svn: 322753

show more ...


Revision tags: llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1
# 49db0306 14-Jul-2017 Erik Verbruggen <erikjv@me.com>

[analyzer] Add annotation for functions taking user-facing strings

There was already a returns_localized_nsstring annotation to indicate
that the return value could be passed to UIKit methods that w

[analyzer] Add annotation for functions taking user-facing strings

There was already a returns_localized_nsstring annotation to indicate
that the return value could be passed to UIKit methods that would
display them. However, those UIKit methods were hard-coded, and it was
not possible to indicate that other classes/methods in a code-base would
do the same.

The takes_localized_nsstring annotation can be put on function
parameters and selector parameters to indicate that those will also show
the string to the user.

Differential Revision: https://reviews.llvm.org/D35186

llvm-svn: 308012

show more ...


# 928d72fa 21-Jun-2017 Artem Dergachev <artem.dergachev@gmail.com>

[analyzer] LocalizationChecker: Support new localizable APIs.

Add support for new methods that were added in macOS High Sierra & iOS 11
and require a localized string.

Patch by Kulpreet Chilana!

r

[analyzer] LocalizationChecker: Support new localizable APIs.

Add support for new methods that were added in macOS High Sierra & iOS 11
and require a localized string.

Patch by Kulpreet Chilana!

rdar://problem/32795210
Differential Revision: https://reviews.llvm.org/D34266

llvm-svn: 305896

show more ...


Revision tags: llvmorg-4.0.1, llvmorg-4.0.1-rc3, llvmorg-4.0.1-rc2, llvmorg-4.0.1-rc1, llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3, llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1
# 0a0c275f 05-Jan-2017 David Blaikie <dblaikie@gmail.com>

Migrate PathDiagnosticPiece to std::shared_ptr

Simplifies and makes explicit the memory ownership model rather than
implicitly passing/acquiring ownership.

llvm-svn: 291143


Revision tags: llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1
# 184996bb 30-Aug-2016 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker

Fix a crash when relexing the underlying memory buffer to find incorrect
arguments to NSLocalizedString(). With precompiled he

[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker

Fix a crash when relexing the underlying memory buffer to find incorrect
arguments to NSLocalizedString(). With precompiled headers, the raw
buffer may be NULL. Instead, use the source manager to get the buffer,
which will lazily create the buffer for precompiled headers.

rdar://problem/27429091

llvm-svn: 280174

show more ...


Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2
# 1502511c 30-Jul-2016 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Update APIs taking user-facing strings.

Add new APIs that require localized strings and remove two APIs that were
incorrectly marked as requiring a user-facing string.

A patch by Kulpree

[analyzer] Update APIs taking user-facing strings.

Add new APIs that require localized strings and remove two APIs that were
incorrectly marked as requiring a user-facing string.

A patch by Kulpreet Chilana!

Differential Revision: https://reviews.llvm.org/D22926

llvm-svn: 277273

show more ...


Revision tags: llvmorg-3.9.0-rc1
# 9670f847 18-Jul-2016 Mehdi Amini <mehdi.amini@apple.com>

[NFC] Header cleanup

Summary: Removed unused headers, replaced some headers with forward class declarations

Patch by: Eugene <claprix@yandex.ru>

Differential Revision: https://reviews.llvm.org/D20

[NFC] Header cleanup

Summary: Removed unused headers, replaced some headers with forward class declarations

Patch by: Eugene <claprix@yandex.ru>

Differential Revision: https://reviews.llvm.org/D20100

llvm-svn: 275882

show more ...


Revision tags: llvmorg-3.8.1, llvmorg-3.8.1-rc1
# 97dc0c8c 28-Apr-2016 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Add path note for localizability checker.

Add a path note indicating the location of the non-localized string
literal in NonLocalizedStringChecker.

rdar://problem/25981525

llvm-svn: 267

[analyzer] Add path note for localizability checker.

Add a path note indicating the location of the non-localized string
literal in NonLocalizedStringChecker.

rdar://problem/25981525

llvm-svn: 267924

show more ...


Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3
# 409506ea 16-Feb-2016 Vedant Kumar <vsk@apple.com>

Simplify users of StringRef::{l,r}trim (clang) (NFC)

r260925 introduced a version of the *trim methods which is preferable
when trimming a single kind of character. Update all users in clang.

llvm-

Simplify users of StringRef::{l,r}trim (clang) (NFC)

r260925 introduced a version of the *trim methods which is preferable
when trimming a single kind of character. Update all users in clang.

llvm-svn: 260927

show more ...


# 084e3635 05-Feb-2016 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Suppress localization diagnostics in debug classes and methods.

If the class or method name case-insensitively contains the term "debug",
suppress warnings about string constants flowing

[analyzer] Suppress localization diagnostics in debug classes and methods.

If the class or method name case-insensitively contains the term "debug",
suppress warnings about string constants flowing to user-facing UI APIs.

llvm-svn: 259875

show more ...


Revision tags: llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1
# 0500c70b 04-Nov-2015 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Add 'optin' checker package and move localizability checkers into it.

This commit creates a new 'optin' top-level checker package and moves several of
the localizability checkers into it.

[analyzer] Add 'optin' checker package and move localizability checkers into it.

This commit creates a new 'optin' top-level checker package and moves several of
the localizability checkers into it.

This package is for checkers that are not alpha and that would normally be on by
default but where the driver does not have enough information to determine when
they are applicable. The localizability checkers fit this criterion because the
driver cannot determine whether a project is localized or not -- this is best
determined at the IDE or build-system level.

This new package is *not* intended for checkers that are too noisy to be on by
default.

The hierarchy under 'optin' mirrors that in 'alpha': checkers under 'optin'
should be organized in the hierarchy they would have had if they were truly top
level (e.g., optin.osx.cocoa.MyOptInChecker).

Differential Revision: http://reviews.llvm.org/D14303

llvm-svn: 252080

show more ...


# 9f21f68b 23-Sep-2015 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Improve localizability checks for iOS / OS X.

Various improvements to the localization checker:
* Adjusted copy to be consistent with diagnostic text in other Apple
API checkers.
* Adde

[analyzer] Improve localizability checks for iOS / OS X.

Various improvements to the localization checker:
* Adjusted copy to be consistent with diagnostic text in other Apple
API checkers.
* Added in ~150 UIKit / AppKit methods that require localized strings in
UnlocalizedStringsChecker.
* UnlocalizedStringChecker now checks for UI methods up the class hierarchy and
UI methods that conform for a certain Objective-C protocol.
* Added in alpha version of PluralMisuseChecker and some regression tests. False
positives are still not ideal.

(This is the second attempt, with the memory issues on Linux resolved.)

A patch by Kulpreet Chilana!

Differential Revision: http://reviews.llvm.org/D12417

llvm-svn: 248432

show more ...


# 749de235 23-Sep-2015 Devin Coughlin <dcoughlin@apple.com>

Revert "[analyzer] Improve localizability checks for iOS / OS X."

This reverts commit r248350. The pluralization checks are failing on some bots.

llvm-svn: 248351


# ab583143 22-Sep-2015 Devin Coughlin <dcoughlin@apple.com>

[analyzer] Improve localizability checks for iOS / OS X.

Various improvements to the localization checker:
* Adjusted copy to be consistent with diagnostic text in other Apple
API checkers.
* Adde

[analyzer] Improve localizability checks for iOS / OS X.

Various improvements to the localization checker:
* Adjusted copy to be consistent with diagnostic text in other Apple
API checkers.
* Added in ~150 UIKit / AppKit methods that require localized strings in
UnlocalizedStringsChecker.
* UnlocalizedStringChecker now checks for UI methods up the class hierarchy and
UI methods that conform for a certain Objective-C protocol.
* Added in alpha version of PluralMisuseChecker and some regression tests. False
positives are still not ideal.

A patch by Kulpreet Chilana!

Differential Revision: http://reviews.llvm.org/D12417

llvm-svn: 248350

show more ...


Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4
# 9589caf0 26-Aug-2015 Ted Kremenek <kremenek@apple.com>

Add missing newline.

llvm-svn: 246003


Revision tags: llvmorg-3.7.0-rc3
# e5d74caf 14-Aug-2015 Anna Zaks <ganna@apple.com>

[analyzer] Add checkers for OS X / iOS localizability issues

Add checkers that detect code-level localizability issues for OS X / iOS:
- A path sensitive checker that warns about uses of non-local

[analyzer] Add checkers for OS X / iOS localizability issues

Add checkers that detect code-level localizability issues for OS X / iOS:
- A path sensitive checker that warns about uses of non-localized
NSStrings passed to UI methods expecting localized strings.
- A syntax checker that warns against not including a comment in
NSLocalizedString macros.

A patch by Kulpreet Chilana!

(This is the second attempt with the compilation issue on Windows and
the random test failures resolved.)

llvm-svn: 245093

show more ...


123