diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-14 20:07:36 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-14 20:07:36 +0000 |
commit | 6b8fca1275ebad48439ecca7a599392cf09e9950 (patch) | |
tree | e204fe210ad1760b123745fffc8691014fd30279 /clang/tools | |
parent | de722193e5451bf34e66c71be64cd0b27c064042 (diff) | |
download | bcm5719-llvm-6b8fca1275ebad48439ecca7a599392cf09e9950.tar.gz bcm5719-llvm-6b8fca1275ebad48439ecca7a599392cf09e9950.zip |
libclang: remove reinterpret_casts by using SourceLocation::getFromPtrEncoding
directly instead of casting a pointer to an integer
llvm-svn: 175206
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index cd81e99aeec..16b9fc5df9c 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -503,8 +503,7 @@ std::pair<const ObjCInterfaceDecl *, SourceLocation> cxcursor::getCursorObjCSuperClassRef(CXCursor C) { assert(C.kind == CXCursor_ObjCSuperClassRef); return std::make_pair(static_cast<const ObjCInterfaceDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorObjCProtocolRef(const ObjCProtocolDecl *Proto, @@ -520,8 +519,7 @@ std::pair<const ObjCProtocolDecl *, SourceLocation> cxcursor::getCursorObjCProtocolRef(CXCursor C) { assert(C.kind == CXCursor_ObjCProtocolRef); return std::make_pair(static_cast<const ObjCProtocolDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorObjCClassRef(const ObjCInterfaceDecl *Class, @@ -540,8 +538,7 @@ std::pair<const ObjCInterfaceDecl *, SourceLocation> cxcursor::getCursorObjCClassRef(CXCursor C) { assert(C.kind == CXCursor_ObjCClassRef); return std::make_pair(static_cast<const ObjCInterfaceDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorTypeRef(const TypeDecl *Type, SourceLocation Loc, @@ -556,8 +553,7 @@ std::pair<const TypeDecl *, SourceLocation> cxcursor::getCursorTypeRef(CXCursor C) { assert(C.kind == CXCursor_TypeRef); return std::make_pair(static_cast<const TypeDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorTemplateRef(const TemplateDecl *Template, @@ -573,8 +569,7 @@ std::pair<const TemplateDecl *, SourceLocation> cxcursor::getCursorTemplateRef(CXCursor C) { assert(C.kind == CXCursor_TemplateRef); return std::make_pair(static_cast<const TemplateDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorNamespaceRef(const NamedDecl *NS, @@ -592,8 +587,7 @@ std::pair<const NamedDecl *, SourceLocation> cxcursor::getCursorNamespaceRef(CXCursor C) { assert(C.kind == CXCursor_NamespaceRef); return std::make_pair(static_cast<const NamedDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorVariableRef(const VarDecl *Var, SourceLocation Loc, @@ -609,8 +603,7 @@ std::pair<const VarDecl *, SourceLocation> cxcursor::getCursorVariableRef(CXCursor C) { assert(C.kind == CXCursor_VariableRef); return std::make_pair(static_cast<const VarDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorMemberRef(const FieldDecl *Field, SourceLocation Loc, @@ -626,8 +619,7 @@ std::pair<const FieldDecl *, SourceLocation> cxcursor::getCursorMemberRef(CXCursor C) { assert(C.kind == CXCursor_MemberRef); return std::make_pair(static_cast<const FieldDecl *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorCXXBaseSpecifier(const CXXBaseSpecifier *B, @@ -653,10 +645,8 @@ CXCursor cxcursor::MakePreprocessingDirectiveCursor(SourceRange Range, SourceRange cxcursor::getCursorPreprocessingDirective(CXCursor C) { assert(C.kind == CXCursor_PreprocessingDirective); - SourceRange Range = SourceRange(SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t> (C.data[0])), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t> (C.data[1]))); + SourceRange Range(SourceLocation::getFromPtrEncoding(C.data[0]), + SourceLocation::getFromPtrEncoding(C.data[1])); ASTUnit *TU = getCursorASTUnit(C); return TU->mapRangeFromPreamble(Range); } @@ -726,8 +716,7 @@ std::pair<const LabelStmt *, SourceLocation> cxcursor::getCursorLabelRef(CXCursor C) { assert(C.kind == CXCursor_LabelRef); return std::make_pair(static_cast<const LabelStmt *>(C.data[0]), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } CXCursor cxcursor::MakeCursorOverloadedDeclRef(const OverloadExpr *E, @@ -773,8 +762,7 @@ cxcursor::getCursorOverloadedDeclRef(CXCursor C) { assert(C.kind == CXCursor_OverloadedDeclRef); return std::make_pair(OverloadedDeclRefStorage::getFromOpaqueValue( const_cast<void *>(C.data[0])), - SourceLocation::getFromRawEncoding( - reinterpret_cast<uintptr_t>(C.data[1]))); + SourceLocation::getFromPtrEncoding(C.data[1])); } const Decl *cxcursor::getCursorDecl(CXCursor Cursor) { |