aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-30 20:17:27 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-30 20:17:27 +0000
commitc0c3f5dbc9e78aa53a86c7d5e3eeda23ddad93d6 (patch)
tree097bc258ddf308d6d5ae163c38da0ed666088c2c /lib
parent036dce063aab99fa606f102c872c5dcd138806b6 (diff)
Teach more of the static analyzer about ObjCQualifiedIdType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/BasicObjCFoundationChecks.cpp5
-rw-r--r--lib/Analysis/CFRefCount.cpp3
-rw-r--r--lib/Analysis/GRExprEngine.cpp4
-rw-r--r--lib/Analysis/GRSimpleVals.cpp12
4 files changed, 9 insertions, 15 deletions
diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index 98c7e28b74..d2a3d08b8e 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -40,10 +40,7 @@ static ObjCInterfaceType* GetReceiverType(ObjCMessageExpr* ME) {
QualType X = Receiver->getType();
Type* TP = X.getTypePtr();
- // FIXME: Why can this not be a pointer type?
- // assert (TP->isPointerType());
- if (!TP->isPointerType())
- return NULL;
+ assert (IsPointerType(X));
const PointerType* T = TP->getAsPointerType();
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 08bad5b155..9ed4f1db29 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -335,7 +335,8 @@ CFRefSummaryManager::getUnaryCFSummary(FunctionTypeProto* FT, CFUnaryFunc func)
if (strcmp("CFTypeRef", TDName) != 0)
return NULL;
- assert (ArgT->isPointerType() || ArgT->isObjCQualifiedIdType());
+ if (!ArgT->isPointerType())
+ return NULL;
QualType RetTy = FT->getResultType();
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 22205c06e0..80e9af3190 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -28,10 +28,6 @@ using llvm::dyn_cast;
using llvm::cast;
using llvm::APSInt;
-static inline bool IsPointerType(QualType T) {
- return T->isPointerType() || T->isObjCQualifiedIdType();
-}
-
//===----------------------------------------------------------------------===//
// Engine construction and deletion.
//===----------------------------------------------------------------------===//
diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp
index bb6ea5d560..b496f26443 100644
--- a/lib/Analysis/GRSimpleVals.cpp
+++ b/lib/Analysis/GRSimpleVals.cpp
@@ -20,6 +20,7 @@
#include "clang/Analysis/PathSensitive/ValueState.h"
#include "clang/Analysis/PathSensitive/BugReporter.h"
#include "clang/Analysis/LocalCheckers.h"
+#include "clang/Analysis/PathSensitive/GRExprEngine.h"
#include "llvm/Support/Compiler.h"
#include <sstream>
@@ -306,11 +307,10 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) {
BasicValueFactory& BasicVals = Eng.getBasicVals();
llvm::APSInt V = cast<nonlval::ConcreteInt>(X).getValue();
- V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType()
- || T->isObjCQualifiedIdType());
+ V.setIsUnsigned(T->isUnsignedIntegerType() || IsPointerType(T));
V.extOrTrunc(Eng.getContext().getTypeSize(T));
- if (T->isPointerType())
+ if (IsPointerType(T))
return lval::ConcreteInt(BasicVals.getValue(V));
else
return nonlval::ConcreteInt(BasicVals.getValue(V));
@@ -320,7 +320,7 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) {
RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, LVal X, QualType T) {
- if (T->isPointerLikeType() || T->isObjCQualifiedIdType())
+ if (IsPointerType(T))
return X;
assert (T->isIntegerType());
@@ -331,7 +331,7 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, LVal X, QualType T) {
BasicValueFactory& BasicVals = Eng.getBasicVals();
llvm::APSInt V = cast<lval::ConcreteInt>(X).getValue();
- V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType());
+ V.setIsUnsigned(T->isUnsignedIntegerType() || IsPointerType(T));
V.extOrTrunc(Eng.getContext().getTypeSize(T));
return nonlval::ConcreteInt(BasicVals.getValue(V));
@@ -594,7 +594,7 @@ void GRSimpleVals::EvalCall(ExplodedNodeSet<ValueState>& Dst,
unsigned Count = Builder.getCurrentBlockCount();
SymbolID Sym = Eng.getSymbolManager().getConjuredSymbol(CE, Count);
- RVal X = CE->getType()->isPointerType()
+ RVal X = IsPointerType(CE->getType())
? cast<RVal>(lval::SymbolVal(Sym))
: cast<RVal>(nonlval::SymbolVal(Sym));