aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-03-12[NFC][analyzer] Rename `CheckerBase::getCheckerName` to `getName` (#130953)Donát Nagy1-3/+2
The method name `getCheckerName` would imply "get the name of the checker associated with `this`", so it's suitable for e.g. `BugType::getCheckerName` -- but a method that just "gets the name of `this`" should be simply called `getName`. This change eliminates the redundant and ugly pattern `Checker->getCheckerName()` and helps to visually distinguish this method from `BugType::getCheckerName`. In the constructor of `BugType` the call of this method was completely removed (instead of just changing the name) because that call was dead code (when the data member `Checker` is non-null, the string stored in `CheckerName` is irrelevant) and was often querying the name of the checker before it was properly initialized. Moreover, in `ReturnValueChecker.cpp` the static helper function `getName` (which gets a function name from a `CallEvent`) was renamed to the more specific `getFunctionName` to avoid the name collision. This change is yet another cleanup commit before my planned changes that would add support for multi-part checkers to this method.
2025-03-11[NFC][analyzer] Remove CheckerNameRef::getName() (#130780)Donát Nagy1-1/+1
`CheckerNameRef` is a trivial wrapper around a `StringRef` which is guaranteed to be owned by the `CheckerRegistry` (the only `friend` of the class) because other code can't call the private constructor. This class had offered two ways to recover the plain `StringRef`: an an `operator StringRef()` for implicit conversion and a method `StringRef getName()` which could be called explicitly. However this method name was really confusing, because it implies "get the name of this object" instead of "get this name as a plain `StringRef`"; so I removed it from the codebase and used `static_cast<StringRef>` in the two locations where the cast wasn't performed implicitly. This commit "prepares the ground" for planned improvements in checker name handling.
2025-02-22[analyzer] Allow overriding Unknown memspaces using a ProgramState trait ↵Michael Flanders1-1/+1
(#123003) In general, if we see an allocation, we associate the immutable memory space with the constructed memory region. This works fine if we see the allocation. However, with symbolic regions it's not great because there we don't know anything about their memory spaces, thus put them into the Unknown space. The unfortunate consequence is that once we learn about some aliasing with this Symbolic Region, we can't change the memory space to the deduced one. In this patch, we open up the memory spaces as a trait, basically allowing associating a better memory space with a memregion that was created with the Unknown memory space. As a side effect, this means that now queriing the memory space of a region depends on the State, but many places in the analyzer, such as the Store, doesn't have (and cannot have) access to the State by design. This means that some uses must solely rely on the memspaces of the region, but any other users should use the getter taking a State. Co-authored-by: Balazs Benics <benicsbalazs@gmail.com>
2025-01-31[analyzer][NFC] Simplify and eliminate redundant map lookups (#125272)Balazs Benics1-3/+4
2024-12-19[analyzer][NFC] Migrate {SymInt,IntSym}Expr to use APSIntPtr (4/4) (#120438)Balazs Benics1-2/+2
2024-01-01[analyzer][NFC] Cleanup BugType lazy-init patterns (#76655)Balazs Benics1-6/+2
Cleanup most of the lazy-init `BugType` legacy. Some will be preserved, as those are slightly more complicated to refactor. Notice, that the default category for `BugType` is `LogicError`. I omitted setting this explicitly where I could. Please, actually have a look at the diff. I did this manually, and we rarely check the bug type descriptions and stuff in tests, so the testing might be shallow on this one.
2023-09-01[analyzer] Fix a few size-type inconsistency relating to DynamicExtentdingfei1-9/+9
Size-type inconsistency (signedness) causes confusion and even bugs. For example when signed compared to unsigned the result might not be expected. Summary of this commit: Related APIs changes: 1. getDynamicExtent() returns signed version of extent; 2. Add getDynamicElementCountWithOffset() for offset version of element count; 3. getElementExtent() could be 0, add defensive checking for getDynamicElementCount(), if element is of zero-length, try ConstantArrayType::getSize() as element count; Related checker changes: 1. ArrayBoundCheckerV2: add testcase for signed <-> unsigned comparison from type-inconsistency results by getDynamicExtent() 2. ExprInspection: use more general API to report more results Fixes https://github.com/llvm/llvm-project/issues/64920 Reviewed By: donat.nagy, steakhal Differential Revision: https://reviews.llvm.org/D158499
2023-07-05[analyzer][NFC] Move away from using raw-for loops inside StaticAnalyzerBalazs Benics1-2/+1
I'm involved with the Static Analyzer for the most part. I think we should embrace newer language standard features and gradually move forward. Differential Revision: https://reviews.llvm.org/D154325
2023-01-14[clang] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-24/+27
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-03[StaticAnalyzer] Use std::nullopt instead of None (NFC)Kazu Hirata1-7/+7
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-10-26[analyzer][StdLibraryFunctionsChecker] Add NoteTags for applied argGabor Marton1-3/+4
constraints In this patch I add a new NoteTag for each applied argument constraint. This way, any other checker that reports a bug - where the applied constraint is relevant - will display the corresponding note. With this change we provide more information for the users to understand some bug reports easier. Differential Revision: https://reviews.llvm.org/D101526 Reviewed By: NoQ
2022-09-13[analyzer] Prefer wrapping SymbolicRegions by ElementRegionsBalazs Benics1-2/+1
It turns out that in certain cases `SymbolRegions` are wrapped by `ElementRegions`; in others, it's not. This discrepancy can cause the analyzer not to recognize if the two regions are actually referring to the same entity, which then can lead to unreachable paths discovered. Consider this example: ```lang=C++ struct Node { int* ptr; }; void with_structs(Node* n1) { Node c = *n1; // copy Node* n2 = &c; clang_analyzer_dump(*n1); // lazy... clang_analyzer_dump(*n2); // lazy... clang_analyzer_dump(n1->ptr); // rval(n1->ptr): reg_$2<int * SymRegion{reg_$0<struct Node * n1>}.ptr> clang_analyzer_dump(n2->ptr); // rval(n2->ptr): reg_$1<int * Element{SymRegion{reg_$0<struct Node * n1>},0 S64b,struct Node}.ptr> clang_analyzer_eval(n1->ptr != n2->ptr); // UNKNOWN, bad! (void)(*n1); (void)(*n2); } ``` The copy of `n1` will insert a new binding to the store; but for doing that it actually must create a `TypedValueRegion` which it could pass to the `LazyCompoundVal`. Since the memregion in question is a `SymbolicRegion` - which is untyped, it needs to first wrap it into an `ElementRegion` basically implementing this untyped -> typed conversion for the sake of passing it to the `LazyCompoundVal`. So, this is why we have `Element{SymRegion{.}, 0,struct Node}` for `n1`. The problem appears if the analyzer evaluates a read from the expression `n1->ptr`. The same logic won't apply for `SymbolRegionValues`, since they accept raw `SubRegions`, hence the `SymbolicRegion` won't be wrapped into an `ElementRegion` in that case. Later when we arrive at the equality comparison, we cannot prove that they are equal. For more details check the corresponding thread on discourse: https://discourse.llvm.org/t/are-symbolicregions-really-untyped/64406 --- In this patch, I'm eagerly wrapping each `SymbolicRegion` by an `ElementRegion`; basically canonicalizing to this form. It seems reasonable to do so since any object can be thought of as a single array of that object; so this should not make much of a difference. The tests also underpin this assumption, as only a few were broken by this change; and actually fixed a FIXME along the way. About the second example, which does the same copy operation - but on the heap - it will be fixed by the next patch. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D132142
2022-07-15[analyzer] Add new function `clang_analyzer_value` to ExprInspectionCheckerDenys Petrov1-15/+45
Summary: Introduce a new function 'clang_analyzer_value'. It emits a report that in turn prints a RangeSet or APSInt associated with SVal. If there is no associated value, prints "n/a".
2022-05-26[analyzer] Add UnarySymExprGabor Marton1-0/+8
This patch adds a new descendant to the SymExpr hierarchy. This way, now we can assign constraints to symbolic unary expressions. Only the unary minus and bitwise negation are handled. Differential Revision: https://reviews.llvm.org/D125318
2022-05-13[analyzer] Introduce clang_analyzer_dumpSvalType introspection functionBalazs Benics1-0/+13
In some rare cases the type of an SVal might be interesting. This introspection function exposes this information in tests. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D125532
2022-04-19[analyzer] Expose Taint.h to pluginsTom Ritter1-1/+1
Reviewed By: NoQ, xazax.hun, steakhal Differential Revision: https://reviews.llvm.org/D123155
2021-04-05[analyzer] DynamicSize: Rename 'size' to 'extent'Charusso1-3/+3
2021-04-05[analyzer] DynamicSize: Debug facilityCharusso1-35/+97
This patch adds two debug functions to ExprInspectionChecker to dump out the dynamic extent and element count of symbolic values: dumpExtent(), dumpElementCount().
2020-11-17Revert "Revert "[analyzer] NFC: Move IssueHash to libAnalysis.""Artem Dergachev1-2/+2
This reverts commit 662ed9e67adace3d011f42478bc8bcb1773a2821.
2020-10-13Revert "[analyzer] NFC: Move IssueHash to libAnalysis."Artem Dergachev1-2/+2
This reverts commit b76dc111dd02672488df794570d82e3edbbfa5d8.
2020-10-13[analyzer] NFC: Move IssueHash to libAnalysis.Artem Dergachev1-2/+2
IssueHash is an attempt to introduce stable warning identifiers that won't change when code around them gets moved around. Path diagnostic consumers print issue hashes for the emitted diagnostics. This move will allow us to ultimately move path diagnostic consumers to libAnalysis. Differential Revision: https://reviews.llvm.org/D67421
2020-03-27[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* ↵Kirstóf Umann1-1/+1
functions Some checkers may not only depend on language options but also analyzer options. To make this possible this patch changes the parameter of the shouldRegister* function to CheckerManager to be able to query the analyzer options when deciding whether the checker should be registered. Differential Revision: https://reviews.llvm.org/D75271
2020-03-26[Analyzer] Only add container note tags to the operations of the affected ↵Adam Balogh1-8/+18
container If an error happens which is related to a container the Container Modeling checker adds note tags to all the container operations along the bug path. This may be disturbing if there are other containers beside the one which is affected by the bug. This patch restricts the note tags to only the affected container and adjust the debug checkers to be able to test this change. Differential Revision: https://reviews.llvm.org/D75514
2020-03-03[analyzer][taint] Add isTainted debug expression inspection checkBalazs Benics1-20/+41
Summary: This patch introduces the `clang_analyzer_isTainted` expression inspection check for checking taint. Using this we could query the analyzer whether the expression used as the argument is tainted or not. This would be useful in tests, where we don't want to issue warning for all tainted expressions in a given file (like the `debug.TaintTest` would do) but only for certain expressions. Example usage: ```lang=c++ int read_integer() { int n; clang_analyzer_isTainted(n); // expected-warning{{NO}} scanf("%d", &n); clang_analyzer_isTainted(n); // expected-warning{{YES}} clang_analyzer_isTainted(n + 2); // expected-warning{{YES}} clang_analyzer_isTainted(n > 0); // expected-warning{{YES}} int next_tainted_value = n; // no-warning return n; } ``` Reviewers: NoQ, Szelethus, baloghadamsoftware, xazax.hun, boga95 Reviewed By: Szelethus Subscribers: martong, rnkovacs, whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, Charusso, cfe-commits, boga95, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D74131
2020-01-30[analyzer] DynamicSize: Remove 'getExtent()' from regionsCharusso1-2/+4
Summary: This patch introduces a placeholder for representing the dynamic size of regions. It also moves the `getExtent()` method of `SubRegions` to the `MemRegionManager` as `getStaticSize()`. Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D69540
2019-09-12[analyzer][NFC] Fix inconsistent references to checkers as "checks"Kristof Umann1-1/+1
Traditionally, clang-tidy uses the term check, and the analyzer uses checker, but in the very early years, this wasn't the case, and code originating from the early 2010's still incorrectly refer to checkers as checks. This patch attempts to hunt down most of these, aiming to refer to checkers as checkers, but preserve references to callback functions (like checkPreCall) as checks. Differential Revision: https://reviews.llvm.org/D67140 llvm-svn: 371760
2019-09-09[analyzer] NFC: Introduce sub-classes for path-sensitive and basic reports.Artem Dergachev1-1/+1
Checkers are now required to specify whether they're creating a path-sensitive report or a path-insensitive report by constructing an object of the respective type. This makes BugReporter more independent from the rest of the Static Analyzer because all Analyzer-specific code is now in sub-classes. Differential Revision: https://reviews.llvm.org/D66572 llvm-svn: 371450
2019-08-14[Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere1-1/+1
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
2019-06-19[analyzer] NFC: Change evalCall() to provide a CallEvent.Artem Dergachev1-2/+7
This changes the checker callback signature to use the modern, easy to use interface. Additionally, this unblocks future work on allowing checkers to implement evalCall() for calls that don't correspond to any call-expression or require additional information that's only available as part of the CallEvent, such as C++ constructors and destructors. Differential Revision: https://reviews.llvm.org/D62440 llvm-svn: 363893
2019-01-26[analyzer] Supply all checkers with a shouldRegister functionKristof Umann1-0/+4
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
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
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
2018-12-22[analyzer] pr38668: Do not attempt to cast loaded integers to floats.Artem Dergachev1-9/+20
This patch is a different approach to landing the reverted r349701. It is expected to have the same object (memory region) treated as if it has different types in different program points. The correct behavior for RegionStore when an object is stored as an object of type T1 but loaded as an object of type T2 is to store the object as if it has type T1 but cast it to T2 during load. Note that the cast here is some sort of a "reinterpret_cast" (even in C). For instance, if you store an integer and load a float, you won't get your integer represented as a float; instead, you will get garbage. Admit that we cannot perform the cast and return an unknown value. Differential Revision: https://reviews.llvm.org/D55875 rdar://problem/45062567 llvm-svn: 349984
2018-12-15[analyzer][NFC] Move CheckerRegistry from the Core directory to FrontendKristof Umann1-1/+1
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
2018-10-13Move some helpers from the global namespace into anonymous ones.Benjamin Kramer1-0/+2
llvm-svn: 344468
2018-09-25[analyzer] Add a testing facility for testing relationships between symbols.Artem Dergachev1-0/+98
Tests introduced in r329780 was disabled in r342317 because these tests were accidentally testing dump infrastructure, when all they cared about was how symbols relate to each other. So when dump infrastructure changed, tests became annoying to maintain. Add a new feature to ExprInspection: clang_analyzer_denote() and clang_analyzer_explain(). The former adds a notation to a symbol, the latter expresses another symbol in terms of previously denoted symbols. It's currently a bit wonky - doesn't print parentheses and only supports denoting atomic symbols. But it's even more readable that way. Differential Revision: https://reviews.llvm.org/D52133 llvm-svn: 343048
2018-08-09Port getLocStart -> getBeginLocStephen Kelly1-1/+1
Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
2018-06-27[analyzer] [NFC] A convenient getter for getting a current stack frameGeorge Karpenkov1-2/+2
Differential Revision: https://reviews.llvm.org/D44756 llvm-svn: 335701
2017-10-30[analyzer] Make issue hash related tests more conciseGabor Horvath1-2/+16
Extend ExprInspection checker to make it possible to dump the issue hash of arbitrary expressions. This change makes it possible to make issue hash related tests more concise and also makes debugging issue hash related problems easier. Differential Revision: https://reviews.llvm.org/D38844 llvm-svn: 316899
2017-07-25[StaticAnalyzer] Completely unrolling specific loops with known bound optionPeter Szecsi1-0/+1
This feature allows the analyzer to consider loops to completely unroll. New requirements/rules (for unrolling) can be added easily via ASTMatchers. Right now it is hidden behind a flag, the aim is to find the correct heuristic and create a solution which results higher coverage % and more precise analysis, thus can be enabled by default. Right now the blocks which belong to an unrolled loop are marked by the LoopVisitor which adds them to the ProgramState. Then whenever we encounter a CFGBlock in the processCFGBlockEntrance which is marked then we skip its investigating. That means, it won't be considered to be visited more than the maximal bound for visiting since it won't be checked. llvm-svn: 309006
2017-07-20Revert "[StaticAnalyzer] Completely unrolling specific loops with known ↵Peter Szecsi1-1/+0
bound option" Revert r308561 and r308558. Clang-ppc64be-linux seems to crash while running the test cases. llvm-svn: 308592
2017-07-19This feature allows the analyzer to consider loops to completely unroll. NewPeter Szecsi1-0/+1
requirements/rules (for unrolling) can be added easily via ASTMatchers. The current implementation is hidden behind a flag. Right now the blocks which belong to an unrolled loop are marked by the LoopVisitor which adds them to the ProgramState. Then whenever we encounter a CFGBlock in the processCFGBlockEntrance which is marked then we skip its investigating. That means, it won't be considered to be visited more than the maximal bound for visiting since it won't be checked. Differential Revision: https://reviews.llvm.org/D34260 llvm-svn: 308558
2017-03-09[analyzer] Improve usability of ExprInspectionCheckerAnna Zaks1-2/+2
Some of the magic functions take arguments of arbitrary type. However, for semantic correctness, the compiler still requires a declaration of these functions with the correct type. Since C does not have argument-type-overloaded function, this made those functions hard to use in C code. Improve this situation by allowing arbitrary suffixes in the affected magic functions' names, thus allowing the user to create different declarations for different types. A patch by Keno Fischer! Differential Revision: https://reviews.llvm.org/D30589 llvm-svn: 297325
2017-01-16[StaticAnalyzer] Fix android buildPavel Labath1-1/+2
std::to_string is not available in the android NDK. Use llvm::to_string instead. Committing as obvious. llvm-svn: 292141
2016-11-30[analyzer] Minor fixes and improvements to debug.ExprInspectionArtem Dergachev1-14/+91
- Fix the bug with transition handling in ExprInspectionChecker's checkDeadSymbols implementation. - Test this bug by adding a new function clang_analyzer_numTimesReached() to catch number of passes through the code, which should be handy for testing against unintended state splits. - Add two more functions should help debugging issues quickly without running the debugger or dumping exploded graphs - clang_analyzer_dump() which dump()s an SVal argument to a warning message, and clang_analyzer_printState(), which dump()s the current program state to stderr. Differential Revision: https://reviews.llvm.org/D26835 llvm-svn: 288257
2016-01-15[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.Artem Dergachev1-34/+51
Provide separate visitor templates for the three hierarchies, and also the `FullSValVisitor' class, which is a union of all three visitors. Additionally, add a particular example visitor, `SValExplainer', in order to test the visitor templates. This visitor is capable of explaining the SVal, SymExpr, or MemRegion in a natural language. Compared to the reverted r257605, this fixes the test that used to fail on some triples, and fixes build failure under -fmodules. Differential Revision: http://reviews.llvm.org/D15448 llvm-svn: 257893
2016-01-13Revert "[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion."Artem Dergachev1-51/+34
This reverts commit r257605. The test fails on architectures that use unsigned int as size_t. SymbolManager.h fails with compile errors on some platforms. llvm-svn: 257608
2016-01-13[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion.Artem Dergachev1-34/+51
Provide separate visitor templates for the three hierarchies, and also the `FullSValVisitor' class, which is a union of all three visitors. Additionally, add a particular example visitor, `SValExplainer', in order to test the visitor templates. This visitor is capable of explaining the SVal, SymExpr, or MemRegion in a natural language. Differential Revision: http://reviews.llvm.org/D15448 llvm-svn: 257605
2015-12-10[analyzer] Fix symbolic element index lifetime.Artem Dergachev1-2/+44
SymbolReaper was destroying the symbol too early when it was referenced only from an index SVal of a live ElementRegion. In order to test certain aspects of this patch, extend the debug.ExprInspection checker to allow testing SymbolReaper in a direct manner. Differential Revision: http://reviews.llvm.org/D12726 llvm-svn: 255236
2015-09-16[analyzer] Add generateErrorNode() APIs to CheckerContext.Devin Coughlin1-5/+11
The analyzer trims unnecessary nodes from the exploded graph before reporting path diagnostics. However, in some cases it can trim all nodes (including the error node), leading to an assertion failure (see https://llvm.org/bugs/show_bug.cgi?id=24184). This commit addresses the issue by adding two new APIs to CheckerContext to explicitly create error nodes. Unless the client provides a custom tag, these APIs tag the node with the checker's tag -- preventing it from being trimmed. The generateErrorNode() method creates a sink error node, while generateNonFatalErrorNode() creates an error node for a path that should continue being explored. The intent is that one of these two methods should be used whenever a checker creates an error node. This commit updates the checkers to use these APIs. These APIs (unlike addTransition() and generateSink()) do not take an explicit Pred node. This is because there are not any error nodes in the checkers that were created with an explicit different than the default (the CheckerContext's Pred node). It also changes generateSink() to require state and pred nodes (previously these were optional) to reduce confusion. Additionally, there were several cases where checkers did check whether a generated node could be null; we now explicitly check for null in these places. This commit also includes a test case written by Ying Yi as part of http://reviews.llvm.org/D12163 (that patch originally addressed this issue but was reverted because it introduced false positive regressions). Differential Revision: http://reviews.llvm.org/D12780 llvm-svn: 247859