summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-11-14 20:05:54 +0000
committerTed Kremenek <kremenek@apple.com>2011-11-14 20:05:54 +0000
commit731607fab2a573197ea7d02d3b296fec792b4079 (patch)
treed91b57b66308bf966b9422a426852770a88411c4 /clang/lib/StaticAnalyzer/Core/RegionStore.cpp
parentc8b47586bb293c5717036434890193e9a5ed51e4 (diff)
downloadbcm5719-llvm-731607fab2a573197ea7d02d3b296fec792b4079.tar.gz
bcm5719-llvm-731607fab2a573197ea7d02d3b296fec792b4079.zip
[analyzer;Regionstore] handle loads from StringLiteral elements for StringLiterals representing wide strings. Fixes PR 11294.
llvm-svn: 144563
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/RegionStore.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index 4b76cf1a3de..a207729be05 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -1046,12 +1046,12 @@ SVal RegionStoreManager::RetrieveElement(Store store,
// clients of RetrieveElement().
if (i < 0)
return UndefinedVal();
- int64_t byteLength = Str->getByteLength();
- // Technically, only i == byteLength is guaranteed to be null.
+ int64_t length = Str->getLength();
+ // Technically, only i == length is guaranteed to be null.
// However, such overflows should be caught before reaching this point;
// the only time such an access would be made is if a string literal was
// used to initialize a larger array.
- char c = (i >= byteLength) ? '\0' : Str->getString()[i];
+ char c = (i >= length) ? '\0' : Str->getCodeUnit(i);
return svalBuilder.makeIntVal(c, T);
}
}
OpenPOWER on IntegriCloud