]> granicus.if.org Git - clang/commitdiff
Fix some dead stores which the static analyzer warned about. No functionality
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 14 Sep 2012 18:27:01 +0000 (18:27 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 14 Sep 2012 18:27:01 +0000 (18:27 +0000)
change (the problematic cases in ParseDecl.cpp are currently impossible).

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

lib/Parse/ParseDecl.cpp
lib/Sema/SemaObjCProperty.cpp

index bcc9106eb717d281fa180bdabb036e3ee2eadc14..f8a20c3b532285a073493bbd1560172a5694a7e6 100644 (file)
@@ -2277,6 +2277,8 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
           isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typename,
                                          Tok.getAnnotationEndLoc(),
                                          PrevSpec, DiagID, T);
+          if (isInvalid)
+            break;
         }
         else
           DS.SetTypeSpecError();
@@ -2482,12 +2484,12 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
     case tok::kw___forceinline: {
       isInvalid = DS.SetFunctionSpecInline(Loc, PrevSpec, DiagID);
       IdentifierInfo *AttrName = Tok.getIdentifierInfo();
-      SourceLocation AttrNameLoc = ConsumeToken();
+      SourceLocation AttrNameLoc = Tok.getLocation();
       // FIXME: This does not work correctly if it is set to be a declspec
       //        attribute, and a GNU attribute is simply incorrect.
       DS.getAttributes().addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
                                 SourceLocation(), 0, 0, AttributeList::AS_GNU);
-      continue;
+      break;
     }
 
     case tok::kw___ptr64:
index 28b4dfa0ccadb74436142283112d6af505376c84..4d2fb777e2164ea1ceaaf7e4295ee699fade0018 100644 (file)
@@ -948,10 +948,9 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
 
     // Check that type of property and its ivar are type compatible.
     if (!Context.hasSameType(PropertyIvarType, IvarType)) {
-      compat = false;
       if (isa<ObjCObjectPointerType>(PropertyIvarType) 
           && isa<ObjCObjectPointerType>(IvarType))
-        compat = 
+        compat =
           Context.canAssignObjCInterfaces(
                                   PropertyIvarType->getAs<ObjCObjectPointerType>(),
                                   IvarType->getAs<ObjCObjectPointerType>());