<br><br><div class="gmail_quote">On Thu, Mar 12, 2009 at 5:57 AM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Author: kremenek<br>
Date: Wed Mar 11 16:57:34 2009<br>
New Revision: 66712<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=66712&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=66712&view=rev</a><br>
Log:<br>
Add TypedViewRegion::isBoundable() to indicate whether or not the<br>
TypedViewRegion has a valid rvalue type. Also renamed instance variable 'T' to<br>
'LvalueType' to make it unambiguous of its purpose.<br>
<br>
This fixes some crashes I was seeing after:<br>
<br>
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090309/013771.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090309/013771.html</a><br>
<br>
This is because 'isBoundable()' is defined in TypedRegion (the parent class) in<br>
terms of the rvalue type (which could be null), </blockquote><div><br>Hi Ted, I am curious when the rvalue type could be null? Could you please provide a test case caused to crash by my previous patch?<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
while for TypedViewRegion it<br>
should be defined in terms of the lvalue type.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h<br>
cfe/trunk/lib/Analysis/MemRegion.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=66712&r1=66711&r2=66712&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=66712&r1=66711&r2=66712&view=diff</a><br>
<br>
==============================================================================<br>
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)<br>
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Wed Mar 11 16:57:34 2009<br>
@@ -239,10 +239,10 @@<br>
class TypedViewRegion : public TypedRegion {<br>
friend class MemRegionManager;<br>
<br>
- QualType T;<br>
+ QualType LValueType;<br>
<br>
- TypedViewRegion(QualType t, const MemRegion* sreg)<br>
- : TypedRegion(sreg, TypedViewRegionKind), T(t) {}<br>
+ TypedViewRegion(QualType lvalueType, const MemRegion* sreg)<br>
+ : TypedRegion(sreg, TypedViewRegionKind), LValueType(lvalueType) {}<br>
<br>
static void ProfileRegion(llvm::FoldingSetNodeID& ID, QualType T,<br>
const MemRegion* superRegion);<br>
@@ -252,13 +252,17 @@<br>
void print(llvm::raw_ostream& os) const;<br>
<br>
QualType getRValueType(ASTContext&) const {<br>
- const PointerType* PTy = T->getAsPointerType();<br>
+ const PointerType* PTy = LValueType->getAsPointerType();<br>
assert(PTy);<br>
return PTy->getPointeeType();<br>
}<br>
+<br>
+ bool isBoundable(ASTContext &C) const {<br>
+ return isa<PointerType>(LValueType);<br>
+ }<br>
<br>
void Profile(llvm::FoldingSetNodeID& ID) const {<br>
- ProfileRegion(ID, T, superRegion);<br>
+ ProfileRegion(ID, LValueType, superRegion);<br>
}<br>
<br>
static bool classof(const MemRegion* R) {<br>
@@ -561,7 +565,8 @@<br>
ObjCIvarRegion* getObjCIvarRegion(const ObjCIvarDecl* ivd,<br>
const MemRegion* superRegion);<br>
<br>
- TypedViewRegion* getTypedViewRegion(QualType t, const MemRegion* superRegion);<br>
+ TypedViewRegion* getTypedViewRegion(QualType LValueType,<br>
+ const MemRegion* superRegion);<br>
<br>
bool hasStackStorage(const MemRegion* R);<br>
<br>
<br>
Modified: cfe/trunk/lib/Analysis/MemRegion.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=66712&r1=66711&r2=66712&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=66712&r1=66711&r2=66712&view=diff</a><br>
<br>
==============================================================================<br>
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)<br>
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Wed Mar 11 16:57:34 2009<br>
@@ -172,7 +172,7 @@<br>
}<br>
<br>
void TypedViewRegion::print(llvm::raw_ostream& os) const {<br>
- os << "typed_view{" << T.getAsString() << ',';<br>
+ os << "typed_view{" << LValueType.getAsString() << ',';<br>
getSuperRegion()->print(os);<br>
os << '}';<br>
}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br>