diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-02-28 00:56:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-02-28 00:56:05 +0000 |
commit | 3bc5372fae18be64a7e482f0167f4b4a215dea44 (patch) | |
tree | 1dc39c5d8984463a7ae27e350298c610ee1ee345 /clang/lib/StaticAnalyzer/Core/Environment.cpp | |
parent | 8c4729fd4457e73d563f5306bac42f82353dcbd0 (diff) | |
download | bcm5719-llvm-3bc5372fae18be64a7e482f0167f4b4a215dea44.tar.gz bcm5719-llvm-3bc5372fae18be64a7e482f0167f4b4a215dea44.zip |
[analyzer] teach analyzer about ObjC literals, thus trimming out a false positive with the malloc() checker involving
comparing literal addresses to nil.
Fixes <rdar://problem/10579586>
llvm-svn: 151602
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/Environment.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/Environment.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp index a44476e850c..5207a506aec 100644 --- a/clang/lib/StaticAnalyzer/Core/Environment.cpp +++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp @@ -90,6 +90,11 @@ SVal Environment::getSVal(const EnvironmentEntry &Entry, continue; case Stmt::ObjCPropertyRefExprClass: return loc::ObjCPropRef(cast<ObjCPropertyRefExpr>(E)); + case Stmt::ObjCStringLiteralClass: { + MemRegionManager &MRMgr = svalBuilder.getRegionManager(); + const ObjCStringLiteral *SL = cast<ObjCStringLiteral>(E); + return svalBuilder.makeLoc(MRMgr.getObjCStringRegion(SL)); + } case Stmt::StringLiteralClass: { MemRegionManager &MRMgr = svalBuilder.getRegionManager(); const StringLiteral *SL = cast<StringLiteral>(E); |