diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-01-26 21:29:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-01-26 21:29:00 +0000 |
commit | 49b1e38e4bee0f0c6f8b49e1a62d5284084e09e7 (patch) | |
tree | 26e7a601a36b15a97f523c0e51083521e817d29c /clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp | |
parent | 6efba4fc97f4509ab1b48076e030e8fdc5434d33 (diff) | |
download | bcm5719-llvm-49b1e38e4bee0f0c6f8b49e1a62d5284084e09e7.tar.gz bcm5719-llvm-49b1e38e4bee0f0c6f8b49e1a62d5284084e09e7.zip |
Change references to 'const ProgramState *' to typedef 'ProgramStateRef'.
At this point this is largely cosmetic, but it opens the door to replace
ProgramStateRef with a smart pointer that more eagerly acts in the role
of reclaiming unused ProgramState objects.
llvm-svn: 149081
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp index ffe23f14b1c..74dd26ba3d1 100644 --- a/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp @@ -46,7 +46,7 @@ public: const CallExpr *) const; private: bool ReportZeroByteAllocation(CheckerContext &C, - const ProgramState *falseState, + ProgramStateRef falseState, const Expr *arg, const char *fn_name) const; void BasicAllocationCheck(CheckerContext &C, @@ -88,7 +88,7 @@ void UnixAPIChecker::CheckOpen(CheckerContext &C, const CallExpr *CE) const { } // Look at the 'oflags' argument for the O_CREAT flag. - const ProgramState *state = C.getState(); + ProgramStateRef state = C.getState(); if (CE->getNumArgs() < 2) { // The frontend should issue a warning for this case, so this is a sanity @@ -116,7 +116,7 @@ void UnixAPIChecker::CheckOpen(CheckerContext &C, const CallExpr *CE) const { DefinedSVal maskedFlags = cast<DefinedSVal>(maskedFlagsUC); // Check if maskedFlags is non-zero. - const ProgramState *trueState, *falseState; + ProgramStateRef trueState, falseState; llvm::tie(trueState, falseState) = state->assume(maskedFlags); // Only emit an error if the value of 'maskedFlags' is properly @@ -155,7 +155,7 @@ void UnixAPIChecker::CheckPthreadOnce(CheckerContext &C, // Check if the first argument is stack allocated. If so, issue a warning // because that's likely to be bad news. - const ProgramState *state = C.getState(); + ProgramStateRef state = C.getState(); const MemRegion *R = state->getSVal(CE->getArg(0), C.getLocationContext()).getAsRegion(); if (!R || !isa<StackSpaceRegion>(R->getMemorySpace())) @@ -192,10 +192,10 @@ void UnixAPIChecker::CheckPthreadOnce(CheckerContext &C, // Returns true if we try to do a zero byte allocation, false otherwise. // Fills in trueState and falseState. -static bool IsZeroByteAllocation(const ProgramState *state, +static bool IsZeroByteAllocation(ProgramStateRef state, const SVal argVal, - const ProgramState **trueState, - const ProgramState **falseState) { + ProgramStateRef *trueState, + ProgramStateRef *falseState) { llvm::tie(*trueState, *falseState) = state->assume(cast<DefinedSVal>(argVal)); @@ -206,7 +206,7 @@ static bool IsZeroByteAllocation(const ProgramState *state, // will perform a zero byte allocation. // Returns false if an error occured, true otherwise. bool UnixAPIChecker::ReportZeroByteAllocation(CheckerContext &C, - const ProgramState *falseState, + ProgramStateRef falseState, const Expr *arg, const char *fn_name) const { ExplodedNode *N = C.generateSink(falseState); @@ -240,8 +240,8 @@ void UnixAPIChecker::BasicAllocationCheck(CheckerContext &C, return; // Check if the allocation size is 0. - const ProgramState *state = C.getState(); - const ProgramState *trueState = NULL, *falseState = NULL; + ProgramStateRef state = C.getState(); + ProgramStateRef trueState = NULL, falseState = NULL; const Expr *arg = CE->getArg(sizeArg); SVal argVal = state->getSVal(arg, C.getLocationContext()); @@ -265,8 +265,8 @@ void UnixAPIChecker::CheckCallocZero(CheckerContext &C, if (nArgs != 2) return; - const ProgramState *state = C.getState(); - const ProgramState *trueState = NULL, *falseState = NULL; + ProgramStateRef state = C.getState(); + ProgramStateRef trueState = NULL, falseState = NULL; unsigned int i; for (i = 0; i < nArgs; i++) { |