[PATCH] D23963: [analyzer] pr28449 - Move literal rvalue construction away from RegionStore.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 27 14:48:09 PDT 2016


NoQ created this revision.
NoQ added reviewers: zaks.anna, dcoughlin, xazax.hun, a.sidorin.
NoQ added a subscriber: cfe-commits.

When binding string literal regions to `char` arrays, `RegionStore`'s `bindArray()` method converts the string literals to their lazy compound values before binding. Bug https://llvm.org/bugs/show_bug.cgi?id=28449 shows that similar behavior is required for handling compound literals (brace initializers).

However, it seems illogical to me that `RegionStore` modifies the value it was asked to bind - it should be handled by the external code, and `RegionStore`'s `bind...()` interface should perhaps only bind the given value to the given location, without improvising.

This patch conducts the necessary refactoring to avoid the issue. Now all compound values should be correct to begin with. The patch accidentally fixes the bug.

Additionally, this patch enables loading values from compound-literal regions - it was explicitly disabled, but the problem due to which it was disabled seems already resolved; made the respective tests stronger to see that it's actually working correctly.

Additionally, this patch tweaks the dump method of compound literal regions, addressing a FIXME there and making things prettier.

Didn't notice significant changes on large codebase runs - no new crashes, no changes in positives.

https://reviews.llvm.org/D23963

Files:
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineC.cpp
  lib/StaticAnalyzer/Core/MemRegion.cpp
  lib/StaticAnalyzer/Core/RegionStore.cpp
  test/Analysis/compound-literals.c
  test/Analysis/region-store.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23963.69497.patch
Type: text/x-patch
Size: 7942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160827/aafd4c0f/attachment-0001.bin>


More information about the cfe-commits mailing list