Skip to content

Commit 4787509

Browse files
committed
Use 'cast' instead of 'get' to fix a compiler warning.
Fixes: ``` ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:166:48: warning: 'get' is deprecated: Use cast instead [-Wdeprecated-declarations] 166 | return MakeCXCursor(object.get<BlockDecl*>(), getCursorTU(C)); | ^ ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:161:12: note: 'get' has been explicitly marked deprecated here 161 | inline T get() const { | ^ ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:166:48: warning: 'get<clang::BlockDecl *>' is deprecated: Use cast instead [-Wdeprecated-declarations] 166 | return MakeCXCursor(object.get<BlockDecl*>(), getCursorTU(C)); | ^ ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:160:5: note: 'get<clang::BlockDecl *>' has been explicitly marked deprecated here 160 | [[deprecated("Use cast instead")]] | ^ ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:169:48: warning: 'get' is deprecated: Use cast instead [-Wdeprecated-declarations] 169 | return MakeCXCursor(object.get<CompoundLiteralExpr*>(), getCursorDecl(C), getCursorTU(C)); | ^ ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:161:12: note: 'get' has been explicitly marked deprecated here 161 | inline T get() const { | ^ ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:169:48: warning: 'get<clang::CompoundLiteralExpr *>' is deprecated: Use cast instead [-Wdeprecated-declarations] 169 | return MakeCXCursor(object.get<CompoundLiteralExpr*>(), getCursorDecl(C), getCursorTU(C)); | ^ ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:160:5: note: 'get<clang::CompoundLiteralExpr *>' has been explicitly marked deprecated here 160 | [[deprecated("Use cast instead")]] | ^ ```
1 parent 74f659d commit 4787509

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sources/libClangSharp/ClangSharp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ CXCursor clangsharp_Cursor_getArgument(CXCursor C, unsigned i) {
162162
llvm::PointerUnion<BlockDecl*, CompoundLiteralExpr*> object = EWC->getObject(i);
163163

164164
if (isa<BlockDecl*>(object)) {
165-
return MakeCXCursor(object.get<BlockDecl*>(), getCursorTU(C));
165+
return MakeCXCursor(cast<BlockDecl*>(object), getCursorTU(C));
166166
}
167167
else {
168-
return MakeCXCursor(object.get<CompoundLiteralExpr*>(), getCursorDecl(C), getCursorTU(C));
168+
return MakeCXCursor(cast<CompoundLiteralExpr*>(object), getCursorDecl(C), getCursorTU(C));
169169
}
170170
}
171171
}

0 commit comments

Comments
 (0)