|
clang 24.0.0git
|
#include "InterCheckerAPI.h"#include "clang/AST/OperationKinds.h"#include "clang/Basic/CharInfo.h"#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"#include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"#include "clang/StaticAnalyzer/Core/Checker.h"#include "clang/StaticAnalyzer/Core/CheckerManager.h"#include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h"#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicExtent.h"#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"#include "llvm/ADT/APSInt.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/STLForwardCompat.h"#include "llvm/ADT/StringExtras.h"#include "llvm/Support/raw_ostream.h"#include <functional>#include <optional>Go to the source code of this file.
Macros | |
| #define | REGISTER_CHECKER(NAME) |
Typedefs | |
| using | SearchFn |
| Resolve the haystack and delegate to a function-specific search lambda. | |
Functions | |
| static std::optional< NonLoc > | getIndex (ProgramStateRef State, const ElementRegion *ER, CharKind CK) |
| static void | printIdxWithOrdinalSuffix (llvm::raw_ostream &Os, unsigned Idx) |
| static std::optional< StringRef > | getHaystack (CheckerContext &C, const CallEvent &Call) |
| Compute the constant search offset for strchr/strrchr/strchrnul. | |
| static StringRef | getCStr (StringRef Haystack) |
| Get the null-terminated C string view of the haystack. | |
| static std::optional< char > | getSearchChar (CheckerContext &C, const CallEvent &Call) |
| Try to extract the constant character from the second argument. | |
| static std::optional< size_t > | computeStringOffset (CheckerContext &C, const CallEvent &Call, SearchFn Search) |
| static std::optional< size_t > | searchChar (CheckerContext &C, const CallEvent &Call, StringRef Haystack, bool Reverse, bool NulOnMiss) |
| Search for a character in the null-terminated C string view. | |
| #define REGISTER_CHECKER | ( | NAME | ) |
Definition at line 3253 of file CStringChecker.cpp.
| using SearchFn |
Resolve the haystack and delegate to a function-specific search lambda.
Definition at line 2701 of file CStringChecker.cpp.
|
static |
Definition at line 2705 of file CStringChecker.cpp.
References clang::C, clang::Call, and getHaystack().
|
static |
Get the null-terminated C string view of the haystack.
Definition at line 2684 of file CStringChecker.cpp.
Referenced by searchChar().
|
static |
Compute the constant search offset for strchr/strrchr/strchrnul.
Try to resolve the source (first) argument to its string literal content.
Definition at line 2675 of file CStringChecker.cpp.
References clang::C, clang::Call, and clang::ento::SVal::getAsRegion().
Referenced by computeStringOffset().
|
static |
Definition at line 423 of file CStringChecker.cpp.
References clang::ento::SVal::castAs(), clang::ASTContext::CharTy, clang::ento::SValBuilder::evalBinOpNN(), clang::ento::SValBuilder::getContext(), clang::ento::ElementRegion::getIndex(), clang::CharUnits::getQuantity(), clang::ASTContext::getSizeType(), clang::ento::SValBuilder::getStateManager(), clang::ento::ProgramStateManager::getSValBuilder(), clang::ASTContext::getTypeSizeInChars(), clang::ento::ElementRegion::getValueType(), clang::ento::SValBuilder::makeIntVal(), and clang::ASTContext::WideCharTy.
|
static |
Try to extract the constant character from the second argument.
Definition at line 2690 of file CStringChecker.cpp.
References clang::C, clang::Call, and clang::ento::SValBuilder::getKnownValue().
Referenced by searchChar().
|
static |
Definition at line 450 of file CStringChecker.cpp.
|
static |
Search for a character in the null-terminated C string view.
Definition at line 2714 of file CStringChecker.cpp.
References clang::C, clang::Call, getCStr(), and getSearchChar().