]> granicus.if.org Git - clang/commitdiff
Make CompoundLiteralRegion a subclass of TypedRegiion.
authorZhongxing Xu <xuzhongxing@gmail.com>
Fri, 31 Oct 2008 06:30:35 +0000 (06:30 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Fri, 31 Oct 2008 06:30:35 +0000 (06:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58493 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/MemRegion.h

index c35cda36c64ff1163e2b1de49ad6363551467274..49d5782351843125a9c3b69a6a682552130360c2 100644 (file)
@@ -37,10 +37,9 @@ class MemRegionManager;
 class MemRegion : public llvm::FoldingSetNode {
 public:
   enum Kind { MemSpaceRegionKind, SymbolicRegionKind,
-              // Subregions.
-              CompoundLiteralRegionKind,
               // Typed regions.
               BEG_TYPED_REGIONS,
+               CompoundLiteralRegionKind,
                StringRegionKind, ElementRegionKind,
                // Decl Regions.
                  BEG_DECL_REGIONS,
@@ -221,18 +220,22 @@ class AnonHeapRegion : public AnonTypedRegion {
 /// CompoundLiteralRegion - A memory region representing a compound literal.
 ///   Compound literals are essentially temporaries that are stack allocated
 ///   or in the global constant pool.
-class CompoundLiteralRegion : public SubRegion {
+class CompoundLiteralRegion : public TypedRegion {
 private:
   friend class MemRegionManager;
   const CompoundLiteralExpr* CL;
 
   CompoundLiteralRegion(const CompoundLiteralExpr* cl, const MemRegion* sReg)
-    : SubRegion(sReg,CompoundLiteralRegionKind), CL(cl) {}
+    : TypedRegion(sReg, CompoundLiteralRegionKind), CL(cl) {}
   
   static void ProfileRegion(llvm::FoldingSetNodeID& ID,
                             const CompoundLiteralExpr* CL,
                             const MemRegion* superRegion);
 public:
+  QualType getType(ASTContext& C) const {
+    return C.getCanonicalType(CL->getType());
+  }
+
   void Profile(llvm::FoldingSetNodeID& ID) const;
   
   void print(llvm::raw_ostream& os) const;