[cfe-commits] r45546 - in /cfe/trunk: AST/ASTContext.cpp Sema/SemaExpr.cpp

Fariborz Jahanian fjahanian at apple.com
Thu Jan 3 12:01:38 PST 2008


Author: fjahanian
Date: Thu Jan  3 14:01:35 2008
New Revision: 45546

URL: http://llvm.org/viewvc/llvm-project?rev=45546&view=rev
Log:
Remove cause of misc. "variable might be used uninitialized in this function" warnings.


Modified:
    cfe/trunk/AST/ASTContext.cpp
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=45546&r1=45545&r2=45546&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Thu Jan  3 14:01:35 2008
@@ -1384,7 +1384,7 @@
     if (!rhsQI && !rhsQID && !rhsID)
       return false;
     
-    unsigned numRhsProtocols;
+    unsigned numRhsProtocols = 0;
     ObjcProtocolDecl **rhsProtoList;
     if (rhsQI) {
       numRhsProtocols = rhsQI->getNumProtocols();
@@ -1435,7 +1435,7 @@
     if (!lhsQI && !lhsQID && !lhsID)
       return false;
     
-    unsigned numLhsProtocols;
+    unsigned numLhsProtocols = 0;
     ObjcProtocolDecl **lhsProtoList;
     if (lhsQI) {
       numLhsProtocols = lhsQI->getNumProtocols();

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=45546&r1=45545&r2=45546&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Thu Jan  3 14:01:35 2008
@@ -2308,7 +2308,7 @@
   Expr *RExpr = static_cast<Expr *>(receiver);
   QualType receiverType = RExpr->getType();
   QualType returnType;
-  ObjcMethodDecl *Method;
+  ObjcMethodDecl *Method = 0;
   
   if (receiverType == Context.getObjcIdType() ||
       receiverType == Context.getObjcClassType()) {
@@ -2336,7 +2336,7 @@
           static_cast<PointerType*>(receiverType.getTypePtr());
         receiverType = pointerType->getPointeeType();
       }
-    ObjcInterfaceDecl* ClassDecl;
+    ObjcInterfaceDecl* ClassDecl = 0;
     if (ObjcQualifiedInterfaceType *QIT = 
         dyn_cast<ObjcQualifiedInterfaceType>(receiverType)) {
       ClassDecl = QIT->getDecl();
@@ -2379,9 +2379,10 @@
     }
     if (!Method) {
       // If we have an implementation in scope, check "private" methods.
-      if (ObjcImplementationDecl *ImpDecl = 
+      if (ClassDecl)
+        if (ObjcImplementationDecl *ImpDecl = 
             ObjcImplementations[ClassDecl->getIdentifier()])
-        Method = ImpDecl->getInstanceMethod(Sel);
+          Method = ImpDecl->getInstanceMethod(Sel);
 	  // If we still haven't found a method, look in the global pool. This
 	  // behavior isn't very desirable, however we need it for GCC compatibility.
 	  if (!Method)





More information about the cfe-commits mailing list