[cfe-commits] r119943 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/Sema/SemaExpr.cpp tools/libclang/CIndex.cpp

Benjamin Kramer benny.kra at googlemail.com
Sun Nov 21 06:11:42 PST 2010


Author: d0k
Date: Sun Nov 21 08:11:41 2010
New Revision: 119943

URL: http://llvm.org/viewvc/llvm-project?rev=119943&view=rev
Log:
Fix a bunch of IndirectFieldDecl-related warnings.

- Negative ChainingSize doesn't make sense, make it unsigned.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=119943&r1=119942&r2=119943&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sun Nov 21 08:11:41 2010
@@ -1799,23 +1799,23 @@
 /// IndirectFieldDecl are always implicit.
 class IndirectFieldDecl : public ValueDecl {
   NamedDecl **Chaining;
-  int ChainingSize;
+  unsigned ChainingSize;
 
   IndirectFieldDecl(DeclContext *DC, SourceLocation L,
                     DeclarationName N, QualType T,
-                    NamedDecl **CH, int CHS)
+                    NamedDecl **CH, unsigned CHS)
     : ValueDecl(IndirectField, DC, L, N, T), Chaining(CH), ChainingSize(CHS) {}
 
 public:
   static IndirectFieldDecl *Create(ASTContext &C, DeclContext *DC,
                                    SourceLocation L, IdentifierInfo *Id,
-                                   QualType T, NamedDecl **CH, int CHS);
+                                   QualType T, NamedDecl **CH, unsigned CHS);
   
   typedef NamedDecl * const *chain_iterator;
   chain_iterator chain_begin() const { return Chaining; }
   chain_iterator chain_end() const  { return Chaining+ChainingSize; }
 
-  int getChainingSize() const { return ChainingSize; }
+  unsigned getChainingSize() const { return ChainingSize; }
 
   FieldDecl *getAnonField() const {
     assert(ChainingSize >= 2);

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=119943&r1=119942&r2=119943&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sun Nov 21 08:11:41 2010
@@ -2030,9 +2030,10 @@
   return new (C) EnumConstantDecl(CD, L, Id, T, E, V);
 }
 
-IndirectFieldDecl *IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC,
-                                          SourceLocation L, IdentifierInfo *Id,
-                                          QualType T, NamedDecl **CH, int CHS) {
+IndirectFieldDecl *
+IndirectFieldDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
+                          IdentifierInfo *Id, QualType T, NamedDecl **CH,
+                          unsigned CHS) {
   return new (C) IndirectFieldDecl(DC, L, Id, T, CH, CHS);
 }
 

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=119943&r1=119942&r2=119943&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Nov 21 08:11:41 2010
@@ -7913,7 +7913,7 @@
     FieldDecl *MemberDecl = R.getAsSingle<FieldDecl>();
     IndirectFieldDecl *IndirectMemberDecl = 0;
     if (!MemberDecl) {
-      if (IndirectMemberDecl = R.getAsSingle<IndirectFieldDecl>())
+      if ((IndirectMemberDecl = R.getAsSingle<IndirectFieldDecl>()))
         MemberDecl = IndirectMemberDecl->getAnonField();
     }
 

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=119943&r1=119942&r2=119943&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Sun Nov 21 08:11:41 2010
@@ -3555,6 +3555,7 @@
   case Decl::TemplateTypeParm:
   case Decl::EnumConstant:
   case Decl::Field:
+  case Decl::IndirectField:
   case Decl::ObjCIvar:
   case Decl::ObjCAtDefsField:
   case Decl::ImplicitParam:





More information about the cfe-commits mailing list