[PATCH] [analyzer] Factor common code from {SymSym, SymInt, IntSym}Expr to BinarySymExpr

Ryan Govostes rzg at apple.com
Wed Apr 10 18:19:29 PDT 2013


The attached patch introduces a BinarySymExpr base class for SymSymExpr, SymIntExpr, and IntSymExpr, and factors getType() and getOpcode() out of these subclasses and into the base class. I could not factor getLHS() and getRHS() into the base class because these return unrelated types between subclasses.

This permits the simplification of repetitive code such as:

    case SymExpr::SymIntKind:
      return cast<SymIntExpr>(SE)->getOpcode();
    case SymExpr::IntSymKind:
      return cast<IntSymExpr>(SE)->getOpcode();
    case SymExpr::SymSymKind:
      return cast<SymSymExpr>(SE)->getOpcode();

However I did not notice any existing parts of the static analyzer that would currently benefit from this refactoring.

Ryan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: BinarySymExpr-0001.diff
Type: application/octet-stream
Size: 4562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130410/3eaf27ce/attachment.obj>


More information about the cfe-commits mailing list