[cfe-commits] r47443 - /cfe/trunk/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Thu Feb 21 10:15:29 PST 2008


Author: kremenek
Date: Thu Feb 21 12:15:29 2008
New Revision: 47443

URL: http://llvm.org/viewvc/llvm-project?rev=47443&view=rev
Log:
Added transfer function support for sizeof(void)

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47443&r1=47442&r2=47443&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Thu Feb 21 12:15:29 2008
@@ -528,18 +528,22 @@
   QualType T = Ex->getArgumentType();
   
   // FIXME: Implement alignof
-  // FIXME: Add support for sizeof(void)
-  // FIXME: Add support for VLAs.
 
+  // FIXME: Add support for VLAs.
   if (!T.getTypePtr()->isConstantSizeType())
     return;
   
-  SourceLocation Loc = Ex->getExprLoc();
-  uint64_t size = getContext().getTypeSize(T, Loc) / 8;
+  
+  uint64_t size = 1;  // Handle sizeof(void)
+  
+  if (T != getContext().VoidTy) {
+    SourceLocation Loc = Ex->getExprLoc();
+    size = getContext().getTypeSize(T, Loc) / 8;
+  }
   
   Nodify(Dst, Ex, Pred,
          SetRVal(Pred->getState(), Ex,
-                  NonLVal::MakeVal(ValMgr, size, Ex->getType(), Loc)));
+                  NonLVal::MakeVal(ValMgr, size, Ex->getType())));
   
 }
 





More information about the cfe-commits mailing list