]> granicus.if.org Git - clang/commitdiff
Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
authorJeffrey Yasskin <jyasskin@google.com>
Tue, 18 Jan 2011 02:00:16 +0000 (02:00 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Tue, 18 Jan 2011 02:00:16 +0000 (02:00 +0000)
-Wint-to-pointer-cast.

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

26 files changed:
include/clang/Basic/SourceLocation.h
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprComplex.cpp
lib/CodeGen/CGObjC.cpp
lib/CodeGen/ItaniumCXXABI.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseExpr.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseObjc.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/ParseTemplate.cpp
lib/Parse/ParseTentative.cpp
lib/Rewrite/RewriteObjC.cpp
lib/Sema/SemaCXXCast.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaTemplate.cpp
lib/Sema/SemaTemplateDeduction.cpp
lib/Sema/TreeTransform.h
lib/Serialization/ASTWriterDecl.cpp
lib/StaticAnalyzer/CXXExprEngine.cpp
lib/StaticAnalyzer/Checkers/ExprEngine.cpp
tools/libclang/CIndex.cpp
tools/libclang/CXCursor.cpp

index 74f762bd908db46a0941bee57dbadba8f27e54d6..605c4bbafc7486e0e61f75df88fa6c7d904920f9 100644 (file)
@@ -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<clang::SourceLocation> {
   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);
index 4c6d8419629036d022ffd416fd19a28c92f02ee9..e6af820d77a42cfdca4c4fb114fa05296dc9fdb0 100644 (file)
@@ -2081,7 +2081,6 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee,
 
   const FunctionType *FnType
     = cast<FunctionType>(cast<PointerType>(CalleeType)->getPointeeType());
-  QualType ResultType = FnType->getResultType();
 
   CallArgList Args;
   EmitCallArgs(Args, dyn_cast<FunctionProtoType>(FnType), ArgBeg, ArgEnd);
@@ -2108,4 +2107,3 @@ EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E) {
 
   return MakeAddrLValue(AddV, MPT->getPointeeType());
 }
-
index 5c4d0a560887c9d50fd9967ef9508e0a5a06c2cb..bdd245414be744b1de83f9b78e9441d633018c9f 100644 (file)
@@ -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;
 
index c7e0837b3dc2fed1f36f3745f52f6582e3b845ae..c7f834acb6f36e91cfde2ee63397a63edd730d45 100644 (file)
@@ -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<ObjCIvarDecl>(Field);
       LValue LV = EmitLValueForIvar(TypeOfSelfObject(), 
                                     LoadObjCSelf(), Ivar, 0);
@@ -860,5 +859,3 @@ void CodeGenFunction::EmitObjCAtSynchronizedStmt(
 }
 
 CGObjCRuntime::~CGObjCRuntime() {}
-
-
index 554d2403c013d8266a01f6632690938cb7498c6b..edc03b1bd1eb8488497115b49e8911db8164b586 100644 (file)
@@ -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);
index 8e334c3069742e3cf89092ac79229ae1a4fb01bc..355ba022f6ca15041cd2e8ae6ed3649c2d4f07e5 100644 (file)
@@ -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
index fcd629fe70926e72858794cf3dac81a6ff41ac9e..20e2b8b0be2677757c965f57577fba076dfca3d6 100644 (file)
@@ -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";
index 7133b610225618a05cb9323c3d5ec5782dba2a32..f48b7a5faa49f089128286a40ecc91ccb1b6c0c0 100644 (file)
@@ -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);
index aa638bb0776adb085658153ac28856fb0f32ab1a..8b12650a47cb3112fcc6c93741a6b9a523923e08 100644 (file)
@@ -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());
index 2d293c5aebafd90ee84a64d1180f8b8b7d79cd50..af53d7d592d5cf0b1c2dcae412f74da999265f94 100644 (file)
@@ -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);
index 113b2661b0f997ffe29540ba73c9122f6250d379..3a6f80da2d997620439e15bdecb4808dfed8d46d 100644 (file)
@@ -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;
index 93f5c9ba43d7a94defb6cce50ac343804e3cd70c..05cdd5c87f02f4dee29151a1db5ea7ce1e9faaf8 100644 (file)
@@ -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.
index c6e6784f6c20200fe3d76f76b72e85aa9d330437..bec201ce23f6adae9f98b324db699156ce17555b 100644 (file)
@@ -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.
index 7d060389e780c65d64014b07c640b6f90b0e3ad2..985a6a29f59cd587cf89a299e7603684260ed343 100644 (file)
@@ -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<ObjCObjectPointerType>()) {
         // Should be a pointer to a class.
index ba1c3b0f407c3dea01c290b597bad761c3d57baf..200f975d74b9ee94c6219f7a595c925f5b8e39fb 100644 (file)
@@ -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
index e7bd7d5e87071bbc3f18a303519be41f8dff0e1e..c736d47d43de4538ae600e341fa68bcf27a8f1dd 100644 (file)
@@ -4995,10 +4995,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
     // Form the assignment:
     //   static_cast<Base*>(this)->Base::operator=(static_cast<Base&>(other));
     QualType BaseType = Base->getType().getUnqualifiedType();
-    CXXRecordDecl *BaseClassDecl = 0;
-    if (const RecordType *BaseRecordT = BaseType->getAs<RecordType>())
-      BaseClassDecl = cast<CXXRecordDecl>(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,
index 902afac0a7a80c324b08058578b5ee9563c093d1..26fdb2e059cde3156ef917c2e005c8b6f411d175 100644 (file)
@@ -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);
 }
 
index d08d26ffb695d04149b567b96b66b703d1159c6e..61fe55b4a798e4ea5602757316f76f46f191fa0b 100644 (file)
@@ -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),
index 3c9d386f81afd4ae0989800456e2b4b12b65b6d3..d4953c32f6f02ee80dea0ee89e87437648831e94 100644 (file)
@@ -6128,4 +6128,3 @@ Sema::getTemplateArgumentBindingsText(const TemplateParameterList *Params,
   Out << ']';
   return Out.str();
 }
-
index a608bea34c8a3701c9fac8ea62534abb49391087..0d074e03333b4f8f069305e0abc2d16a2bc63995 100644 (file)
@@ -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();
     }
index be4d82c39a68baa8fdc01c89922e8fcae7d714bc..2020260d4f66e84d17aa00caf06ffa899433b95a 100644 (file)
@@ -7126,7 +7126,6 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
     ParmVarDecl *OldParm = (*P);
     ParmVarDecl *NewParm = getDerived().TransformFunctionTypeParam(OldParm,
                                                    llvm::Optional<unsigned>());
-    QualType NewType = NewParm->getType();
     Params.push_back(NewParm);
     ParamTypes.push_back(NewParm->getType());
   }
index 7223362165f44c7ee38d15baed7c2fc6d1510ec4..c329711ecff84649de9f409672b7db40edd4f2ab 100644 (file)
@@ -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);
index 47b3a0bd06905f01f6c94b201cd24f4b7e9ee7cb..149d4bd9abe82d9dbc4648605ef4f894591f94d8 100644 (file)
@@ -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);
index f45041b73e9c00844ecb098d099b4c75c83fa094..a022562a1292b3dc7b6fc698cad0367a205af2f1 100644 (file)
@@ -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);
index 910f44989431d67631c003c55ad1f9667fbc78ab..7f00f9982c8c65e2224eed041826ad0b650524bb 100644 (file)
@@ -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<LabelStmt*>(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;
   }
index 7bcd1597baf2dd555dd0f268fc5e29fd0acc4f4f..7ae9f7dbbddbc0519b14a3adbb495c469bf0f813 100644 (file)
@@ -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"
-