This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Rename kind-enumeration values of SVal, SymExpr, MemRegion classes, for consistency.
ClosedPublic

Authored by NoQ on Jan 11 2016, 5:39 AM.

Details

Summary

Based on discussion in D15448.

  • For every sub-class C, its kind in the relevant enumeration is CKind (or C##Kind in preprocessor-ish terms), eg:

    MemRegionKind -> MemRegionValKind

    RegionValueKind -> SymbolRegionValueKind

    CastSymbolKind -> SymbolCastKind

    SymIntKind -> SymIntExprKind
  • MemSpaceRegion is now an abstract base and no longer occupies GenericMemSpaceRegionKind. Instead, a new class, CodeSpaceRegion, is introduced for handling the unique use case for MemSpaceRegion as "the generic memory space" (when it represents a memory space that holds all executable code).
  • BEG_ prefixes in memory region kind ranges are renamed to BEGIN_ for consisitency with symbol kind ranges (pro: not about begging, con: two extra characters to type).

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ updated this revision to Diff 44470.Jan 11 2016, 5:39 AM
NoQ retitled this revision from to [analyzer] Rename kind-enumeration values of SVal, SymExpr, MemRegion classes, for consistency..
NoQ updated this object.
NoQ added reviewers: zaks.anna, dcoughlin.
NoQ updated this object.
NoQ added a subscriber: cfe-commits.
zaks.anna edited edge metadata.Jan 11 2016, 11:05 AM

MemSpaceRegion is now an abstract base

What prevents it from being instantiated?

dcoughlin edited edge metadata.Jan 11 2016, 1:00 PM

Looks good to me. Thanks for making this more consistent!

include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
102 ↗(On Diff #44470)

While we're at it, what do you think about renaming FunctionTextRegion and BlockTextRegion to FunctionCodeRegion and BlockCodeRegion, respectively? The term 'code' is less jargony than 'text' and we already refer to BlockTextRegion as a 'code region' in BlockDataRegion.

195 ↗(On Diff #44470)

Following up on Anna's question: does MemSpaceRegion need to be a friend of MemRegionManager now?

NoQ updated this revision to Diff 44628.Jan 12 2016, 5:55 AM
NoQ edited edge metadata.
NoQ marked 2 inline comments as done.

Good point! Removed the friend-class directive here, and also in NonStaticGlobalSpaceRegion, which is also abstract.

Agreed and renamed text regions to code regions.

dcoughlin accepted this revision.Jan 12 2016, 10:12 AM
dcoughlin edited edge metadata.

Looks good to me. Please commit!

This revision is now accepted and ready to land.Jan 12 2016, 10:12 AM
This revision was automatically updated to reflect the committed changes.