From dec0984fce504a39a7f085774fb67cfd9957be58 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Tue, 18 Jan 2011 02:00:16 +0000 Subject: [PATCH] Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and -Wint-to-pointer-cast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123719 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/SourceLocation.h | 18 +++++++++++++++++- lib/CodeGen/CGExpr.cpp | 2 -- lib/CodeGen/CGExprComplex.cpp | 2 +- lib/CodeGen/CGObjC.cpp | 3 --- lib/CodeGen/ItaniumCXXABI.cpp | 7 +++---- lib/Parse/ParseDecl.cpp | 1 - lib/Parse/ParseDeclCXX.cpp | 3 +-- lib/Parse/ParseExpr.cpp | 3 +-- lib/Parse/ParseExprCXX.cpp | 2 +- lib/Parse/ParseObjc.cpp | 10 ++++++---- lib/Parse/ParseStmt.cpp | 5 +---- lib/Parse/ParseTemplate.cpp | 4 +--- lib/Parse/ParseTentative.cpp | 3 --- lib/Rewrite/RewriteObjC.cpp | 2 -- lib/Sema/SemaCXXCast.cpp | 2 -- lib/Sema/SemaDeclCXX.cpp | 7 +------ lib/Sema/SemaExpr.cpp | 2 +- lib/Sema/SemaExprCXX.cpp | 1 - lib/Sema/SemaTemplate.cpp | 1 - lib/Sema/SemaTemplateDeduction.cpp | 3 --- lib/Sema/TreeTransform.h | 1 - lib/Serialization/ASTWriterDecl.cpp | 1 - lib/StaticAnalyzer/CXXExprEngine.cpp | 6 ------ lib/StaticAnalyzer/Checkers/ExprEngine.cpp | 3 --- tools/libclang/CIndex.cpp | 10 +++++----- tools/libclang/CXCursor.cpp | 3 +-- 26 files changed, 40 insertions(+), 65 deletions(-) diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h index 74f762bd90..605c4bbafc 100644 --- a/include/clang/Basic/SourceLocation.h +++ b/include/clang/Basic/SourceLocation.h @@ -130,6 +130,22 @@ public: return X; } + /// getPtrEncoding - When a SourceLocation itself cannot be used, this returns + /// an (opaque) pointer encoding for it. This should only be passed + /// to SourceLocation::getFromPtrEncoding, it should not be inspected + /// directly. + void* getPtrEncoding() const { + // Double cast to avoid a warning "cast to pointer from integer of different + // size". + return (void*)(uintptr_t)getRawEncoding(); + } + + /// getFromPtrEncoding - Turn a pointer encoding of a SourceLocation object + /// into a real SourceLocation. + static SourceLocation getFromPtrEncoding(void *Encoding) { + return getFromRawEncoding((unsigned)(uintptr_t)Encoding); + } + void print(llvm::raw_ostream &OS, const SourceManager &SM) const; void dump(const SourceManager &SM) const; }; @@ -369,7 +385,7 @@ namespace llvm { class PointerLikeTypeTraits { public: static inline void *getAsVoidPointer(clang::SourceLocation L) { - return (void*)L.getRawEncoding(); + return L.getPtrEncoding(); } static inline clang::SourceLocation getFromVoidPointer(void *P) { return clang::SourceLocation::getFromRawEncoding((unsigned)(uintptr_t)P); diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 4c6d841962..e6af820d77 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2081,7 +2081,6 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee, const FunctionType *FnType = cast(cast(CalleeType)->getPointeeType()); - QualType ResultType = FnType->getResultType(); CallArgList Args; EmitCallArgs(Args, dyn_cast(FnType), ArgBeg, ArgEnd); @@ -2108,4 +2107,3 @@ EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E) { return MakeAddrLValue(AddV, MPT->getPointeeType()); } - diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index 5c4d0a5608..bdd245414b 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -538,7 +538,7 @@ EmitCompoundAssignLValue(const CompoundAssignOperator *E, ComplexPairTy &Val) { TestAndClearIgnoreReal(); TestAndClearIgnoreImag(); - QualType LHSTy = E->getLHS()->getType(), RHSTy = E->getRHS()->getType(); + QualType LHSTy = E->getLHS()->getType(); BinOpInfo OpInfo; diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index c7e0837b3d..c7f834acb6 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -434,7 +434,6 @@ void CodeGenFunction::GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, for (unsigned I = 0, E = IvarInitializers.size(); I != E; ++I) { CXXCtorInitializer *IvarInit = IvarInitializers[I]; FieldDecl *Field = IvarInit->getAnyMember(); - QualType FieldType = Field->getType(); ObjCIvarDecl *Ivar = cast(Field); LValue LV = EmitLValueForIvar(TypeOfSelfObject(), LoadObjCSelf(), Ivar, 0); @@ -860,5 +859,3 @@ void CodeGenFunction::EmitObjCAtSynchronizedStmt( } CGObjCRuntime::~CGObjCRuntime() {} - - diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 554d2403c0..edc03b1bd1 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -349,11 +349,11 @@ ItaniumCXXABI::EmitMemberPointerConversion(CodeGenFunction &CGF, bool DerivedToBase = E->getCastKind() == CK_DerivedToBaseMemberPointer; - const CXXRecordDecl *BaseDecl, *DerivedDecl; + const CXXRecordDecl *DerivedDecl; if (DerivedToBase) - DerivedDecl = SrcDecl, BaseDecl = DestDecl; + DerivedDecl = SrcDecl; else - BaseDecl = SrcDecl, DerivedDecl = DestDecl; + DerivedDecl = DestDecl; llvm::Constant *Adj = CGF.CGM.GetNonVirtualBaseClassOffset(DerivedDecl, @@ -1000,7 +1000,6 @@ void ARMCXXABI::ReadArrayCookie(CodeGenFunction &CGF, // The cookie size is always 2 * sizeof(size_t). CookieSize = 2 * SizeSize; - CharUnits NumElementsOffset = CookieSize - SizeSize; // The allocated pointer is the input ptr, minus that amount. AllocPtr = CGF.Builder.CreateBitCast(Ptr, CharPtrTy); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 8e334c3069..355ba022f6 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -1724,7 +1724,6 @@ ParseStructDeclaration(DeclSpec &DS, FieldCallback &Fields) { } // Parse the common specifier-qualifiers-list piece. - SourceLocation DSStart = Tok.getLocation(); ParseSpecifierQualifierList(DS); // If there are no declarators, this is a free-standing declaration diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index fcd629fe70..20e2b8b0be 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1443,7 +1443,6 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, return; } - SourceLocation DSStart = Tok.getLocation(); // decl-specifier-seq: // Parse the common declaration-specifiers piece. ParsingDeclSpec DS(*this, TemplateDiags); @@ -1931,7 +1930,7 @@ bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc, bool &hasAnyExceptionSpec) { assert(Tok.is(tok::kw_throw) && "expected throw"); - SourceLocation ThrowLoc = ConsumeToken(); + ConsumeToken(); if (!Tok.is(tok::l_paren)) { return Diag(Tok, diag::err_expected_lparen_after) << "throw"; diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 7133b61022..f48b7a5faa 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -566,7 +566,6 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, ParenParseOption ParenExprType = (isUnaryExpression && !getLang().CPlusPlus)? CompoundLiteral : CastExpr; ParsedType CastTy; - SourceLocation LParenLoc = Tok.getLocation(); SourceLocation RParenLoc; { @@ -641,7 +640,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, (Actions.getTypeName(II, ILoc, getCurScope()) || // Allow the base to be 'super' if in an objc-method. (&II == Ident_super && getCurScope()->isInObjcMethodScope()))) { - SourceLocation DotLoc = ConsumeToken(); + ConsumeToken(); if (Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_property_name); diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index aa638bb077..8b12650a47 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -824,7 +824,7 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut, // '=' assignment-expression if (isTokenEqualOrMistypedEqualEqual( diag::err_invalid_equalequal_after_declarator)) { - SourceLocation EqualLoc = ConsumeToken(); + ConsumeToken(); ExprResult AssignExpr(ParseAssignmentExpression()); if (!AssignExpr.isInvalid()) Actions.AddInitializerToDecl(DeclOut, AssignExpr.take()); diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 2d293c5aeb..af53d7d592 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -150,7 +150,9 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation atLoc, SourceLocation nameLoc = ConsumeToken(); if (Tok.is(tok::l_paren) && !isKnownToBeTypeSpecifier(GetLookAheadToken(1))) { // we have a category. - SourceLocation lparenLoc = ConsumeParen(); + // TODO(dgregor): Use the return value from the next line to provide better + // recovery. + ConsumeParen(); SourceLocation categoryLoc, rparenLoc; IdentifierInfo *categoryId = 0; if (Tok.is(tok::code_completion)) { @@ -1298,7 +1300,7 @@ Decl *Parser::ParseObjCAtImplementationDeclaration( if (Tok.is(tok::l_paren)) { // we have a category implementation. - SourceLocation lparenLoc = ConsumeParen(); + ConsumeParen(); SourceLocation categoryLoc, rparenLoc; IdentifierInfo *categoryId = 0; @@ -1418,7 +1420,7 @@ Decl *Parser::ParseObjCAtAliasDeclaration(SourceLocation atLoc) { Decl *Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) { assert(Tok.isObjCAtKeyword(tok::objc_synthesize) && "ParseObjCPropertyDynamic(): Expected '@synthesize'"); - SourceLocation loc = ConsumeToken(); // consume synthesize + ConsumeToken(); // consume synthesize while (true) { if (Tok.is(tok::code_completion)) { @@ -1473,7 +1475,7 @@ Decl *Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) { Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) { assert(Tok.isObjCAtKeyword(tok::objc_dynamic) && "ParseObjCPropertyDynamic(): Expected '@dynamic'"); - SourceLocation loc = ConsumeToken(); // consume dynamic + ConsumeToken(); // consume dynamic while (true) { if (Tok.is(tok::code_completion)) { Actions.CodeCompleteObjCPropertyDefinition(getCurScope(), ObjCImpDecl); diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 113b2661b0..3a6f80da2d 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -545,12 +545,9 @@ bool Parser::ParseParenExprOrCondition(ExprResult &ExprResult, Decl *&DeclResult, SourceLocation Loc, bool ConvertToBoolean) { - bool ParseError = false; - SourceLocation LParenLoc = ConsumeParen(); if (getLang().CPlusPlus) - ParseError = ParseCXXCondition(ExprResult, DeclResult, Loc, - ConvertToBoolean); + ParseCXXCondition(ExprResult, DeclResult, Loc, ConvertToBoolean); else { ExprResult = ParseExpression(); DeclResult = 0; diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 93f5c9ba43..05cdd5c87f 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -531,7 +531,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { << PP.getSpelling(Tok); return 0; } - SourceLocation ClassLoc = ConsumeToken(); + ConsumeToken(); // Parse the ellipsis, if given. SourceLocation EllipsisLoc; @@ -595,8 +595,6 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { /// parameter-declaration Decl * Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) { - SourceLocation StartLoc = Tok.getLocation(); - // Parse the declaration-specifiers (i.e., the type). // FIXME: The type should probably be restricted in some way... Not all // declarators (parts of declarators?) are accepted for parameters. diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index c6e6784f6c..bec201ce23 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -111,10 +111,7 @@ bool Parser::isCXXSimpleDeclaration() { // We need tentative parsing... TentativeParsingAction PA(*this); - TPR = TryParseSimpleDeclaration(); - SourceLocation TentativeParseLoc = Tok.getLocation(); - PA.Revert(); // In case of an error, let the declaration parsing code handle it. diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 7d060389e7..985a6a29f5 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -1952,7 +1952,6 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) { buf += "}"; ReplaceText(lastCurlyLoc, 1, buf); } - bool sawIdTypedCatch = false; Stmt *lastCatchBody = 0; for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) { ObjCAtCatchStmt *Catch = S->getCatchStmt(I); @@ -1985,7 +1984,6 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) { if (t == Context->getObjCIdType()) { buf += "1) { "; ReplaceText(startLoc, lParenLoc-startBuf+1, buf); - sawIdTypedCatch = true; } else if (const ObjCObjectPointerType *Ptr = t->getAs()) { // Should be a pointer to a class. diff --git a/lib/Sema/SemaCXXCast.cpp b/lib/Sema/SemaCXXCast.cpp index ba1c3b0f40..200f975d74 100644 --- a/lib/Sema/SemaCXXCast.cpp +++ b/lib/Sema/SemaCXXCast.cpp @@ -601,8 +601,6 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr, // In the CStyle case, the earlier attempt to const_cast should have taken // care of reverse qualification conversions. - QualType OrigSrcType = SrcExpr->getType(); - QualType SrcType = Self.Context.getCanonicalType(SrcExpr->getType()); // C++0x 5.2.9p9: A value of a scoped enumeration type can be explicitly diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index e7bd7d5e87..c736d47d43 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -4995,10 +4995,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, // Form the assignment: // static_cast(this)->Base::operator=(static_cast(other)); QualType BaseType = Base->getType().getUnqualifiedType(); - CXXRecordDecl *BaseClassDecl = 0; - if (const RecordType *BaseRecordT = BaseType->getAs()) - BaseClassDecl = cast(BaseRecordT->getDecl()); - else { + if (!BaseType->isRecordType()) { Invalid = true; continue; } @@ -6220,8 +6217,6 @@ Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { Invalid = true; } - QualType ExDeclType = TInfo->getType(); - IdentifierInfo *II = D.getIdentifier(); if (NamedDecl *PrevDecl = LookupSingleName(S, II, D.getIdentifierLoc(), LookupOrdinaryName, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 902afac0a7..26fdb2e059 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -8531,7 +8531,7 @@ ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, Expr *expr, ParsedType type, SourceLocation RPLoc) { TypeSourceInfo *TInfo; - QualType T = GetTypeFromParser(type, &TInfo); + GetTypeFromParser(type, &TInfo); return BuildVAArgExpr(BuiltinLoc, expr, TInfo, RPLoc); } diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index d08d26ffb6..61fe55b4a7 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -718,7 +718,6 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, if (!TInfo) TInfo = Context.getTrivialTypeSourceInfo(AllocType); - SourceRange R = TInfo->getTypeLoc().getSourceRange(); return BuildCXXNew(StartLoc, UseGlobal, PlacementLParen, move(PlacementArgs), diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 3c9d386f81..d4953c32f6 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -6128,4 +6128,3 @@ Sema::getTemplateArgumentBindingsText(const TemplateParameterList *Params, Out << ']'; return Out.str(); } - diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index a608bea34c..0d074e0333 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -2019,11 +2019,9 @@ Sema::SubstituteExplicitTemplateArguments( // note that the template argument pack is partially substituted and record // the explicit template arguments. They'll be used as part of deduction // for this template parameter pack. - bool HasPartiallySubstitutedPack = false; for (unsigned I = 0, N = Builder.size(); I != N; ++I) { const TemplateArgument &Arg = Builder[I]; if (Arg.getKind() == TemplateArgument::Pack) { - HasPartiallySubstitutedPack = true; CurrentInstantiationScope->SetPartiallySubstitutedPack( TemplateParams->getParam(I), Arg.pack_begin(), @@ -2438,7 +2436,6 @@ static bool AdjustFunctionParmAndArgTypesForDeduction(Sema &S, else { // - If A is a cv-qualified type, the top level cv-qualifiers of A’s // type are ignored for type deduction. - QualType CanonArgType = S.Context.getCanonicalType(ArgType); if (ArgType.getCVRQualifiers()) ArgType = ArgType.getUnqualifiedType(); } diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index be4d82c39a..2020260d4f 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -7126,7 +7126,6 @@ TreeTransform::TransformBlockExpr(BlockExpr *E) { ParmVarDecl *OldParm = (*P); ParmVarDecl *NewParm = getDerived().TransformFunctionTypeParam(OldParm, llvm::Optional()); - QualType NewType = NewParm->getType(); Params.push_back(NewParm); ParamTypes.push_back(NewParm->getType()); } diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 7223362165..c329711ecf 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -661,7 +661,6 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { if (Map) { for (StoredDeclsMap::iterator D = Map->begin(), DEnd = Map->end(); D != DEnd; ++D) { - DeclarationName Name = D->first; DeclContext::lookup_result Result = D->second.getLookupResult(); while (Result.first != Result.second) { Writer.GetDeclRef(*Result.first); diff --git a/lib/StaticAnalyzer/CXXExprEngine.cpp b/lib/StaticAnalyzer/CXXExprEngine.cpp index 47b3a0bd06..149d4bd9ab 100644 --- a/lib/StaticAnalyzer/CXXExprEngine.cpp +++ b/lib/StaticAnalyzer/CXXExprEngine.cpp @@ -50,14 +50,8 @@ void ExprEngine::evalArguments(ConstExprIterator AI, ConstExprIterator AE, // Evaluate the argument. ExplodedNodeSet Tmp; - bool VisitAsLvalue = FstArgAsLValue; if (FstArgAsLValue) { FstArgAsLValue = false; - } else { - const unsigned ParamIdx = Item.I - AI; - VisitAsLvalue = FnType && ParamIdx < FnType->getNumArgs() - ? FnType->getArgType(ParamIdx)->isReferenceType() - : false; } Visit(*Item.I, Item.N, Tmp); diff --git a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp index f45041b73e..a022562a12 100644 --- a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp @@ -3168,8 +3168,6 @@ void ExprEngine::VisitBinaryOperator(const BinaryOperator* B, if (Op == BO_Assign) { // EXPERIMENTAL: "Conjured" symbols. // FIXME: Handle structs. - QualType T = RHS->getType(); - if (RightV.isUnknown() ||!getConstraintManager().canReasonAbout(RightV)) { unsigned Count = Builder->getCurrentBlockCount(); @@ -3238,7 +3236,6 @@ void ExprEngine::VisitBinaryOperator(const BinaryOperator* B, CLHSTy = getContext().getCanonicalType(CLHSTy); QualType LTy = getContext().getCanonicalType(LHS->getType()); - QualType RTy = getContext().getCanonicalType(RHS->getType()); // Promote LHS. V = svalBuilder.evalCast(V, CLHSTy, LTy); diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 910f449894..7f00f9982c 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1530,22 +1530,22 @@ class LabelRefVisit : public VisitorJob { public: LabelRefVisit(LabelStmt *LS, SourceLocation labelLoc, CXCursor parent) : VisitorJob(parent, VisitorJob::LabelRefVisitKind, LS, - (void*) labelLoc.getRawEncoding()) {} + labelLoc.getPtrEncoding()) {} static bool classof(const VisitorJob *VJ) { return VJ->getKind() == VisitorJob::LabelRefVisitKind; } LabelStmt *get() const { return static_cast(data[0]); } SourceLocation getLoc() const { - return SourceLocation::getFromRawEncoding((unsigned)(uintptr_t) data[1]); } + return SourceLocation::getFromPtrEncoding(data[1]); } }; class NestedNameSpecifierVisit : public VisitorJob { public: NestedNameSpecifierVisit(NestedNameSpecifier *NS, SourceRange R, CXCursor parent) : VisitorJob(parent, VisitorJob::NestedNameSpecifierVisitKind, - NS, (void*) R.getBegin().getRawEncoding(), - (void*) R.getEnd().getRawEncoding()) {} + NS, R.getBegin().getPtrEncoding(), + R.getEnd().getPtrEncoding()) {} static bool classof(const VisitorJob *VJ) { return VJ->getKind() == VisitorJob::NestedNameSpecifierVisitKind; } @@ -1583,7 +1583,7 @@ class MemberRefVisit : public VisitorJob { public: MemberRefVisit(FieldDecl *D, SourceLocation L, CXCursor parent) : VisitorJob(parent, VisitorJob::MemberRefVisitKind, D, - (void*) L.getRawEncoding()) {} + L.getPtrEncoding()) {} static bool classof(const VisitorJob *VJ) { return VJ->getKind() == VisitorJob::MemberRefVisitKind; } diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index 7bcd1597ba..7ae9f7dbbd 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -57,7 +57,7 @@ CXCursor cxcursor::MakeCXCursor(Decl *D, CXTranslationUnit TU, bool FirstInDeclGroup) { assert(D && TU && "Invalid arguments!"); CXCursor C = { getCursorKindForDecl(D), - { D, (void*) (FirstInDeclGroup ? 1 : 0), TU } + { D, (void*)(intptr_t) (FirstInDeclGroup ? 1 : 0), TU } }; return C; } @@ -560,4 +560,3 @@ unsigned clang_CXCursorSet_insert(CXCursorSet set, CXCursor cursor) { return flag; } } // end: extern "C" - -- 2.40.0