[cfe-commits] r74486 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/Sema/SemaDeclCXX.cpp

Fariborz Jahanian fjahanian at apple.com
Mon Jun 29 17:17:27 PDT 2009


Author: fjahanian
Date: Mon Jun 29 19:17:27 2009
New Revision: 74486

URL: http://llvm.org/viewvc/llvm-project?rev=74486&view=rev
Log:
Take care of Chris's comments.


Modified:
    cfe/trunk/include/clang/AST/DeclCXX.h
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=74486&r1=74485&r2=74486&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Mon Jun 29 19:17:27 2009
@@ -616,7 +616,7 @@
 
   /// getBaseOrMember - get the generic 'member' representing either the field
   /// or a base class.
-  uintptr_t getBaseOrMember() const { return BaseOrMember; }
+  void* getBaseOrMember() const { return reinterpret_cast<void*>(BaseOrMember); }
   
   /// isBaseInitializer - Returns true when this initializer is
   /// initializing a base class.

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=74486&r1=74485&r2=74486&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Jun 29 19:17:27 2009
@@ -768,28 +768,29 @@
     Diag(ColonLoc, diag::err_only_constructors_take_base_inits);
     return;
   }
-  llvm::DenseMap<uintptr_t, CXXBaseOrMemberInitializer *>Members;
+  llvm::DenseMap<void*, CXXBaseOrMemberInitializer *>Members;
   
   for (unsigned i = 0; i < NumMemInits; i++) {
     CXXBaseOrMemberInitializer *Member = 
       static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
     CXXBaseOrMemberInitializer *&PrevMember = Members[Member->getBaseOrMember()];
-    if (!PrevMember)
+    if (!PrevMember) {
       PrevMember = Member;
+      continue;
+    }
+    if (FieldDecl *Field = Member->getMember())
+      Diag(Member->getSourceLocation(), 
+           diag::error_multiple_mem_initialization)
+      << Field->getNameAsString();
     else {
-      if (FieldDecl *Field = Member->getMember())
-        Diag(Member->getSourceLocation(), 
-             diag::error_multiple_mem_initialization)
-        << Field->getNameAsString();
-      else if (Type *BaseClass = Member->getBaseClass())
-        Diag(Member->getSourceLocation(), 
-             diag::error_multiple_base_initialization)
-          << BaseClass->getDesugaredType(true);
-      else
-        assert(false && "ActOnMemInitializers - neither field or base");
-      Diag(PrevMember->getSourceLocation(), diag::note_previous_initializer) 
-        << 0;
+      Type *BaseClass = Member->getBaseClass();
+      assert(BaseClass && "ActOnMemInitializers - neither field or base");
+      Diag(Member->getSourceLocation(),  
+           diag::error_multiple_base_initialization)
+        << BaseClass->getDesugaredType(true);
     }
+    Diag(PrevMember->getSourceLocation(), diag::note_previous_initializer)
+      << 0;
   }
 }
 





More information about the cfe-commits mailing list