KKazu HirataRemove redundaunt virtual specifiers (NFC)
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[clang] Add a raw_ostream operator<< overload for QualType Under the hood this prints the same as QualType::getAsString() but cuts out the middle-man when that string is sent to another raw_ostream. Also cleaned up all the call sites where this occurs. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123926 | 4 年前 | |
[clang] Remove redundant virtual specifies (NFC) Identified with modernize-use-override. | 3 年前 | |
[clang] Remove unused forward declarations (NFC) | 4 年前 | |
[analyzer][NFC] Add partial specializations for ProgramStateTraits I'm also hoisting common code from the existing specializations into a common trait impl to reduce code duplication. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D126801 | 4 年前 | |
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 | 7 年前 | |
[analyzer] Enable constructor support in evalCall event. Pass EvalCallOptions via runCheckersForEvalCall into defaultEvalCall. Update the AnalysisOrderChecker to support evalCall for testing. Differential Revision: https://reviews.llvm.org/D82256 | 5 年前 | |
[analyzer][NFC] Refactor llvm::isa<> usages in the StaticAnalyzer It turns out llvm::isa<> is variadic, and we could have used this at a lot of places. The following patterns: x && isa<T1>(x) || isa<T2>(x) ... Will be replaced by: isa_and_non_null<T1, T2, ...>(x) Sometimes it caused further simplifications, when it would cause even more code smell. Aside from this, keep in mind that within assert() or any macro functions, we need to wrap the isa<> expression within a parenthesis, due to the parsing of the comma. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D111982 | 4 年前 | |
[analyzer] Replace adjacent assumeInBound calls to assumeInBoundDual This is to minimize superfluous assume calls. Depends on D124758 Differential Revision: https://reviews.llvm.org/D124761 | 4 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[clang] Use value instead of getValue (NFC) | 3 年前 | |
[analyzer][NFC] Switch to using CallDescription::matches() instead of isCalled() This patch replaces each use of the previous API with the new one. In variadic cases, it will use the ADL matchesAny(Call, CDs...) variadic function. Also simplifies some code involving such operations. Reviewed By: martong, xazax.hun Differential Revision: https://reviews.llvm.org/D113591 | 4 年前 | |
[analyzer] Add taint to the BoolAssignmentChecker BoolAssignment checker is now taint-aware and warns if a tainted value is assigned. Original author: steakhal Reviewed By: martong Differential Revision: https://reviews.llvm.org/D125360 | 4 年前 | |
[Clang] Add __builtin_function_start Control-Flow Integrity (CFI) replaces references to address-taken functions with pointers to the CFI jump table. This is a problem for low-level code, such as operating system kernels, which may need the address of an actual function body without the jump table indirection. This change adds the __builtin_function_start() builtin, which accepts an argument that can be constant-evaluated to a function, and returns the address of the function body. Link: https://github.com/ClangBuiltLinux/linux/issues/1353 Depends on D108478 Reviewed By: pcc, rjmccall Differential Revision: https://reviews.llvm.org/D108479 | 4 年前 | |
[clang][analyzer] Add checker for bad use of 'errno'. Extend checker 'ErrnoModeling' with a state of 'errno' to indicate the importance of the 'errno' value and how it should be used. Add a new checker 'ErrnoChecker' that observes use of 'errno' and finds possible wrong uses, based on the "errno state". The "errno state" should be set (together with value of 'errno') by other checkers (that perform modeling of the given function) in the future. Currently only a test function can set this value. The new checker has no user-observable effect yet. Reviewed By: martong, steakhal Differential Revision: https://reviews.llvm.org/D122150 | 3 年前 | |
[clang][analyzer] Added partial wide character support to CStringChecker Support for functions wmemcpy, wcslen, wcsnlen is added to the checker. Documentation and tests are updated and extended with the new functions. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D130091 | 3 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
[analyzer] DynamicSize: Rename 'size' to 'extent' | 5 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer] Fix null pointer deref in CastValueChecker A crash was seen in CastValueChecker due to a null pointer dereference. The fix uses QualType::getAsString to avoid the null dereference when a CXXRecordDecl cannot be obtained. A small reproducer is added, and cast value notes LITs are updated for the new debug messages. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D127105 | 4 年前 | |
[clang] Don't use Optional::getValue (NFC) | 3 年前 | |
[clang] Add a raw_ostream operator<< overload for QualType Under the hood this prints the same as QualType::getAsString() but cuts out the middle-man when that string is sent to another raw_ostream. Also cleaned up all the call sites where this occurs. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123926 | 4 年前 | |
[analyzer] DynamicSize: Rename 'size' to 'extent' | 5 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer] Fix a typo in docs llvm-svn: 352468 | 7 年前 | |
[analyzer][NFC] Switch to using CallDescription::matches() instead of isCalled() This patch replaces each use of the previous API with the new one. In variadic cases, it will use the ADL matchesAny(Call, CDs...) variadic function. Also simplifies some code involving such operations. Reviewed By: martong, xazax.hun Differential Revision: https://reviews.llvm.org/D113591 | 4 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
[analyzer][NFC] Use enum for CallDescription flags Yeah, let's prefer a slightly stronger type representing this. Reviewed By: martong, xazax.hun Differential Revision: https://reviews.llvm.org/D113595 | 4 年前 | |
[analyzer] Expand conversion check to check more expressions for overflow and underflow This expands checking for more expressions. This will check underflow and loss of precision when using call expressions like: void foo(unsigned); int i = -1; foo(i); This also includes other expressions as well, so it can catch negative indices to std::vector since it uses unsigned integers for [] and .at() function. Patch by: @pfultz2 Differential Revision: https://reviews.llvm.org/D46081 | 4 年前 | |
[analyzer][NFC] Merge similar conditional paths Reviewed By: aaron.ballman, steakhal Differential Revision: https://reviews.llvm.org/D121045 | 4 年前 | |
[clang] Use true/false instead of 1/0 (NFC) Identified with modernize-use-bool-literals. | 4 年前 | |
[analyzer][NFC] Use enum for CallDescription flags Yeah, let's prefer a slightly stronger type representing this. Reviewed By: martong, xazax.hun Differential Revision: https://reviews.llvm.org/D113595 | 4 年前 | |
[analyzer][NFC] Use enum for CallDescription flags Yeah, let's prefer a slightly stronger type representing this. Reviewed By: martong, xazax.hun Differential Revision: https://reviews.llvm.org/D113595 | 4 年前 | |
[analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker One of the pain points in simplifying MallocCheckers interface by gradually changing to CallEvent is that a variety of C++ allocation and deallocation functionalities are modeled through preStmt<...> where CallEvent is unavailable, and a single one of these callbacks can prevent a mass parameter change. This patch introduces a new CallEvent, CXXDeallocatorCall, which happens after preStmt<CXXDeleteExpr>, and can completely replace that callback as demonstrated. Differential Revision: https://reviews.llvm.org/D75430 | 6 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[Sema, StaticAnalyzer] Use StringRef::contains (NFC) | 4 年前 | |
[analyzer] Expose Taint.h to plugins Reviewed By: NoQ, xazax.hun, steakhal Differential Revision: https://reviews.llvm.org/D123155 | 4 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[clang][NFC] Inclusive terms: Replace uses of whitelist in clang/lib/StaticAnalyzer Replace variable and functions names, as well as comments that contain whitelist with more inclusive terms. Reviewed By: aaron.ballman, martong Differential Revision: https://reviews.llvm.org/D112642 | 4 年前 | |
[clang][analyzer] Add checker for bad use of 'errno'. Extend checker 'ErrnoModeling' with a state of 'errno' to indicate the importance of the 'errno' value and how it should be used. Add a new checker 'ErrnoChecker' that observes use of 'errno' and finds possible wrong uses, based on the "errno state". The "errno state" should be set (together with value of 'errno') by other checkers (that perform modeling of the given function) in the future. Currently only a test function can set this value. The new checker has no user-observable effect yet. Reviewed By: martong, steakhal Differential Revision: https://reviews.llvm.org/D122150 | 3 年前 | |
[clang][analyzer] Add checker for bad use of 'errno'. Extend checker 'ErrnoModeling' with a state of 'errno' to indicate the importance of the 'errno' value and how it should be used. Add a new checker 'ErrnoChecker' that observes use of 'errno' and finds possible wrong uses, based on the "errno state". The "errno state" should be set (together with value of 'errno') by other checkers (that perform modeling of the given function) in the future. Currently only a test function can set this value. The new checker has no user-observable effect yet. Reviewed By: martong, steakhal Differential Revision: https://reviews.llvm.org/D122150 | 3 年前 | |
[clang][analyzer] Add checker for bad use of 'errno'. Extend checker 'ErrnoModeling' with a state of 'errno' to indicate the importance of the 'errno' value and how it should be used. Add a new checker 'ErrnoChecker' that observes use of 'errno' and finds possible wrong uses, based on the "errno state". The "errno state" should be set (together with value of 'errno') by other checkers (that perform modeling of the given function) in the future. Currently only a test function can set this value. The new checker has no user-observable effect yet. Reviewed By: martong, steakhal Differential Revision: https://reviews.llvm.org/D122150 | 3 年前 | |
[clang][analyzer] Add checker for bad use of 'errno'. Extend checker 'ErrnoModeling' with a state of 'errno' to indicate the importance of the 'errno' value and how it should be used. Add a new checker 'ErrnoChecker' that observes use of 'errno' and finds possible wrong uses, based on the "errno state". The "errno state" should be set (together with value of 'errno') by other checkers (that perform modeling of the given function) in the future. Currently only a test function can set this value. The new checker has no user-observable effect yet. Reviewed By: martong, steakhal Differential Revision: https://reviews.llvm.org/D122150 | 3 年前 | |
[analyzer] Add new function clang_analyzer_value to ExprInspectionChecker 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". | 3 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[clang] Rename StringRef _lower() method calls to _insensitive() This is mostly a mechanical change, but a testcase that contains parts of the StringRef class (clang/test/Analysis/llvm-conventions.cpp) isn't touched. | 4 年前 | |
[clang] Don't use Optional::hasValue (NFC) This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only. | 3 年前 | |
[clang] Don't use Optional::getValue (NFC) | 3 年前 | |
[OPENMP50]Add initial support for OpenMP 5.0 iterator. Added basic parsing/semantic analysis/(de)serialization support for iterator expression introduced in OpenMP 5.0. | 6 年前 | |
Remove redundaunt virtual specifiers (NFC) Identified with tidy-modernize-use-override. | 3 年前 | |
[analyzer][MallocChecker][NFC] Communicate the allocation family to auxiliary functions with parameters The following series of refactoring patches aim to fix the horrible mess that MallocChecker.cpp is. I genuinely hate this file. It goes completely against how most of the checkers are implemented, its by far the biggest headache regarding checker dependencies, checker options, or anything you can imagine. On top of all that, its just bad code. Its seriously everything that you shouldn't do in C++, or any other language really. Bad variable/class names, in/out parameters... Apologies, rant over. So: there are a variety of memory manipulating function this checker models. One aspect of these functions is their AllocationFamily, which we use to distinguish between allocation kinds, like using free() on an object allocated by operator new. However, since we always know which function we're actually modeling, in fact we know it compile time, there is no need to use tricks to retrieve this information out of thin air n+1 function calls down the line. This patch changes many methods of MallocChecker to take a non-optional AllocationFamily template parameter (which also makes stack dumps a bit nicer!), and removes some no longer needed auxiliary functions. Differential Revision: https://reviews.llvm.org/D68162 | 6 年前 | |
[Analyzer] Handle pointer implemented as iterators in iterator checkers Iterators are an abstraction of pointers and in some data structures iterators may be implemented by pointers. This patch adds support for iterators implemented as pointers in all the iterator checkers (including iterator modeling). Differential Revision: https://reviews.llvm.org/D82185 | 5 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer][NFC] Separate CallDescription from CallEvent CallDescriptions deserve its own translation unit. This patch simply moves the corresponding parts. Also includes the CallDescription.h where it's necessary. Reviewed By: martong, xazax.hun, Szelethus Differential Revision: https://reviews.llvm.org/D113587 | 4 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
[clang] Add a raw_ostream operator<< overload for QualType Under the hood this prints the same as QualType::getAsString() but cuts out the middle-man when that string is sent to another raw_ostream. Also cleaned up all the call sites where this occurs. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123926 | 4 年前 | |
[clang] Don't use Optional::hasValue (NFC) | 3 年前 | |
[clang][NFC] Inclusive terms: replace some uses of sanity in clang Rewording of comments to avoid using sanity test, sanity check. Reviewed By: aaron.ballman, Quuxplusone Differential Revision: https://reviews.llvm.org/D114025 | 4 年前 | |
[analyzer][NFC] Refactor llvm::isa<> usages in the StaticAnalyzer It turns out llvm::isa<> is variadic, and we could have used this at a lot of places. The following patterns: x && isa<T1>(x) || isa<T2>(x) ... Will be replaced by: isa_and_non_null<T1, T2, ...>(x) Sometimes it caused further simplifications, when it would cause even more code smell. Aside from this, keep in mind that within assert() or any macro functions, we need to wrap the isa<> expression within a parenthesis, due to the parsing of the comma. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D111982 | 4 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
Remove redundaunt virtual specifiers (NFC) Identified with tidy-modernize-use-override. | 3 年前 | |
[analyzer][NFC] Refactor llvm::isa<> usages in the StaticAnalyzer It turns out llvm::isa<> is variadic, and we could have used this at a lot of places. The following patterns: x && isa<T1>(x) || isa<T2>(x) ... Will be replaced by: isa_and_non_null<T1, T2, ...>(x) Sometimes it caused further simplifications, when it would cause even more code smell. Aside from this, keep in mind that within assert() or any macro functions, we need to wrap the isa<> expression within a parenthesis, due to the parsing of the comma. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D111982 | 4 年前 | |
[clang] Add a raw_ostream operator<< overload for QualType Under the hood this prints the same as QualType::getAsString() but cuts out the middle-man when that string is sent to another raw_ostream. Also cleaned up all the call sites where this occurs. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123926 | 4 年前 | |
[Analyzer] Handle pointer implemented as iterators in iterator checkers Iterators are an abstraction of pointers and in some data structures iterators may be implemented by pointers. This patch adds support for iterators implemented as pointers in all the iterator checkers (including iterator modeling). Differential Revision: https://reviews.llvm.org/D82185 | 5 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer] PR41269: Add a bit of C++ smart pointer modeling. Implement cplusplus.SmartPtrModeling, a new checker that doesn't emit any warnings but models methods of smart pointers more precisely. For now the only thing it does is make (bool) P return false when P is a freshly moved pointer. This addresses a false positive in the use-after-move-checker. Differential Revision: https://reviews.llvm.org/D60796 llvm-svn: 358944 | 7 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[clang] Use value instead of getValue (NFC) | 3 年前 | |
Revert "[clang] Implement ElaboratedType sugaring for types written bare" This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed without addressing the issue or even agreement on how to address the issue. More details and discussion in https://reviews.llvm.org/D112374. | 3 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
Revert "[clang] Implement ElaboratedType sugaring for types written bare" This reverts commit 7c51f02effdbd0d5e12bfd26f9c3b2ab5687c93f because it stills breaks the LLDB tests. This was re-landed without addressing the issue or even agreement on how to address the issue. More details and discussion in https://reviews.llvm.org/D112374. | 3 年前 | |
[analyzer] Support allocClassWithName in OSObjectCStyleCast checker allocClassWithName allocates an object with the given type. The type is actually provided as a string argument (type's name). This creates a possibility for not particularly useful warnings from the analyzer. In order to combat with those, this patch checks for casts of the allocClassWithName results to types mentioned directly as its argument. All other uses of this method should be reasoned about as before. rdar://72165694 Differential Revision: https://reviews.llvm.org/D99500 | 5 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer] Fix return of llvm::StringRef to destroyed std::string This issue was discovered whilst testing with ASAN. Differential Revision: https://reviews.llvm.org/D124683 | 4 年前 | |
[clang] Add a raw_ostream operator<< overload for QualType Under the hood this prints the same as QualType::getAsString() but cuts out the middle-man when that string is sent to another raw_ostream. Also cleaned up all the call sites where this occurs. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D123926 | 4 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
Upgrade SmallSets of pointer-like types to SmallPtrSet This is slightly more efficient. NFC. | 5 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer] Track runtime types represented by Obj-C Class objects Summary: Objective-C Class objects can be used to do a dynamic dispatch on class methods. The analyzer had a few places where we tried to overcome the dynamic nature of it and still guess the actual function that is being called. That was done mostly using some simple heuristics covering the most widespread cases (e.g. [[self class] classmethod]). This solution introduces a way to track types represented by Class objects and work with that instead of direct AST matching. rdar://problem/50739539 Differential Revision: https://reviews.llvm.org/D78286 | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
Use any_of (NFC) | 3 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
Add some explicit use of TK_AsIs | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
[analyzer] Replace adjacent assumeInBound calls to assumeInBoundDual This is to minimize superfluous assume calls. Depends on D124758 Differential Revision: https://reviews.llvm.org/D124761 | 4 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
Remove redundant string initialization (NFC) Identified with readability-redundant-string-init. | 4 年前 | |
Correct Doxygen syntax for inline code There is no syntax like {@code ...} in Doxygen, @code is a block command that ends with @endcode, and generally these are not enclosed in braces. The correct syntax for inline code snippets is @c <code>. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D98665 | 5 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[StaticAnalyzer] Remove redundant declaration isStdSmartPtr (NFC) An identical declaration is present just a couple of lines above the line being removed in this patch. Identified with readability-redundant-declaration. | 4 年前 | |
[Analyzer] Support note tags for smart ptr checker Summary: Added support for note tags for null smart_ptr reporting Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun Reviewed By: NoQ, vsavchenko, xazax.hun Subscribers: martong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D84600 | 5 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[analyzer] Clean checker options from bool to DefaultBool (NFC) A recent review emphasized the preference to use DefaultBool instead of bool for checker options. This change is a NFC and cleans up some of the instances where bool was used, and could be changed to DefaultBool. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D123464 | 4 年前 | |
[clang] Remove redundant virtual specifies (NFC) Identified with modernize-use-override. | 3 年前 | |
[analyzer] Fix StreamErrorState hash bug The Profile function was incorrectly implemented. The StreamErrorState has an implicit bool conversion operator, which will result in a different hash than faithfully hashing the raw value of the enum. I don't have a test for it, since it seems difficult to find one. Even if we would have one, any change in the hashing algorithm would have a chance of breaking it, so I don't think it would justify the effort. Depends on D127836, which uncovered this issue by marking the related Profile function dead. Reviewed By: martong, balazske Differential Revision: https://reviews.llvm.org/D127839 | 3 年前 | |
[clang] Don't use Optional::hasValue (NFC) | 3 年前 | |
[Analyzer] Fix clang::ento::taint::dumpTaint definition Ensure the definition is in the "taint" namespace, like its declaration. Reviewed By: steakhal Differential Revision: https://reviews.llvm.org/D124462 | 4 年前 | |
[analyzer][NFC] Remove dead code and modernize surroundings Thanks @kazu for helping me clean these parts in D127799. I'm leaving the dump methods, along with the unused visitor handlers and the forwarding methods. The dead parts actually helped to uncover two bugs, to which I'm going to post separate patches. Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127836 | 3 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer] Add support for __attribute__((returns_nonnull)). Differential Revision: https://reviews.llvm.org/D118657 | 4 年前 | |
[analyzer][NFC] Don't bind values to ObjCForCollectionStmt, replace it with a GDM trait Based on the discussion in D82598#2171312. Thanks @NoQ! D82598 is titled "Get rid of statement liveness, because such a thing doesn't exist", and indeed, expressions express a value, non-expression statements don't. if (a && get() || []{ return true; }()) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ has a value ~ has a value ~~~~~~~~~~ has a value ~~~~~~~~~~~~~~~~~~~~ has a value ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ doesn't have a value That is simple enough, so it would only make sense if we only assigned symbolic values to expressions in the static analyzer. Yet the interface checkers can access presents, among other strange things, the following two methods: ProgramState::BindExpr(const Stmt *S, const LocationContext *LCtx, SVal V, bool Invalidate=true) ProgramState::getSVal(const Stmt *S, const LocationContext *LCtx) So, what gives? Turns out, we make an exception for ReturnStmt (which we'll leave for another time) and ObjCForCollectionStmt. For any other loops, in order to know whether we should analyze another iteration, among other things, we evaluate it's condition. Which is a problem for ObjCForCollectionStmt, because it simply doesn't have one (CXXForRangeStmt has an implicit one!). In its absence, we assigned the actual statement with a concrete 1 or 0 to indicate whether there are any more iterations left. However, this is wildly incorrect, its just simply not true that the for statement has a value of 1 or 0, we can't calculate its liveness because that doesn't make any sense either, so this patch turns it into a GDM trait. Fixing this allows us to reinstate the assert removed in https://reviews.llvm.org/rG032b78a0762bee129f33e4255ada6d374aa70c71. Differential Revision: https://reviews.llvm.org/D86736 | 5 年前 | |
[analyzer] Change FindLastStoreBRVisitor to use Tracker Additionally, this commit completely removes any uses of FindLastStoreBRVisitor from the analyzer except for the one in Tracker. The next step is actually removing this class altogether from the header file. Differential Revision: https://reviews.llvm.org/D103618 | 4 年前 | |
[analyzer] Replace adjacent assumeInBound calls to assumeInBoundDual This is to minimize superfluous assume calls. Depends on D124758 Differential Revision: https://reviews.llvm.org/D124761 | 4 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[analyzer][NFC] Change LangOptions to CheckerManager in the shouldRegister* 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 | 6 年前 | |
[clang] Use value instead of getValue (NFC) | 3 年前 | |
[analyzer] Introduce common bug category "Unused code". This category is generic enough to hold a variety of checkers. Currently it contains the Dead Stores checker and an alpha unreachable code checker. Differential Revision: https://reviews.llvm.org/D98741 | 5 年前 | |
[analyzer][NFC] Prefer using isa<> instead getAs<> in conditions Depends on D125709 Reviewed By: martong Differential Revision: https://reviews.llvm.org/D127742 | 3 年前 | |
[analyzer] Fix ValistChecker false-positive involving symbolic pointers In the following example: int va_list_get_int(va_list *va) { return va_arg(*va, int); // FP } The *va expression will be something like Element{SymRegion{va}, 0, va_list}. We use ElementRegions for representing the result of the dereference. In this case, the IsSymbolic was set to false in the getVAListAsRegion(). Hence, before checking if the memregion is a SymRegion, we should take the base of that region. Analogously to the previous example, one can craft other cases: struct MyVaList { va_list l; }; int va_list_get_int(struct MyVaList va) { return va_arg(va.l, int); // FP } But it would also work if the va_list would be in the base or derived part of a class. ObjCIvarRegions are likely also susceptible. I'm not explicitly demonstrating these cases. PS: Check the MemRegion::getBaseRegion() definition. Fixes #55009 Reviewed By: xazax.hun Differential Revision: https://reviews.llvm.org/D124239 | 4 年前 | |
[clang][NFC] Inclusive terms: Replace uses of whitelist in clang/lib/StaticAnalyzer Replace variable and functions names, as well as comments that contain whitelist with more inclusive terms. Reviewed By: aaron.ballman, martong Differential Revision: https://reviews.llvm.org/D112642 | 4 年前 | |
[clang][nearly-NFC] Remove some superfluous uses of NamedDecl::getNameAsString OS << ND->getDeclName(); is equivalent to OS << ND->getNameAsString(); without the extra temporary string. This is not quite a NFC since two uses of getNameAsString in a diagnostic are replaced, which results in the named entity being quoted with additional "'"s (ie: 'var' instead of var). | 5 年前 | |
[NFC] Fix endif comments to match with include guard | 4 年前 |