]> granicus.if.org Git - clang/commitdiff
Fix a bunch of IndirectFieldDecl-related warnings.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 21 Nov 2010 14:11:41 +0000 (14:11 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 21 Nov 2010 14:11:41 +0000 (14:11 +0000)
- Negative ChainingSize doesn't make sense, make it unsigned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119943 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/Decl.cpp
lib/Sema/SemaExpr.cpp
tools/libclang/CIndex.cpp

index a5e29c6146a34d0a344e2d9a6c84fc2400061f57..9540804e3ab24670a14327652a2cdc8569de6fe9 100644 (file)
@@ -1799,23 +1799,23 @@ public:
 /// 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);
index ef8f16861e24ecd60683665ed90adecda04226af..9664fe26849bd7e2a5b8a04a0a56f539d23ef8c5 100644 (file)
@@ -2030,9 +2030,10 @@ EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, EnumDecl *CD,
   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);
 }
 
index 37561028c26b719a4d46697adb0ba5beb4c78656..d8f3ccf8a4de5ae3332e53f93ba9f07db2b180c3 100644 (file)
@@ -7913,7 +7913,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
     FieldDecl *MemberDecl = R.getAsSingle<FieldDecl>();
     IndirectFieldDecl *IndirectMemberDecl = 0;
     if (!MemberDecl) {
-      if (IndirectMemberDecl = R.getAsSingle<IndirectFieldDecl>())
+      if ((IndirectMemberDecl = R.getAsSingle<IndirectFieldDecl>()))
         MemberDecl = IndirectMemberDecl->getAnonField();
     }
 
index 55331f6db41071ac36eb7c7f616e2971eeec7217..2bc362adfc523d7d2cfb04ac80471da38e92919c 100644 (file)
@@ -3555,6 +3555,7 @@ CXCursor clang_getCursorDefinition(CXCursor C) {
   case Decl::TemplateTypeParm:
   case Decl::EnumConstant:
   case Decl::Field:
+  case Decl::IndirectField:
   case Decl::ObjCIvar:
   case Decl::ObjCAtDefsField:
   case Decl::ImplicitParam: