Skip to content

Fix a few compiler warnings. - #651

Merged
tannergooding merged 2 commits into
dotnet:mainfrom
rolfbjarne:fix-compiler-warnings
Nov 29, 2025
Merged

Fix a few compiler warnings.#651
tannergooding merged 2 commits into
dotnet:mainfrom
rolfbjarne:fix-compiler-warnings

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member
  • Use 'cast' instead of 'get'.

    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")]]
          |     ^
    
  • Use 'isa' instead of 'is'.

    Fixes:

    ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:165:28: warning: 'is' is deprecated: Use isa instead [-Wdeprecated-declarations]
      165 |                 if (object.is<BlockDecl*>()) {
          |                            ^
    ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:152:15: note: 'is' has been explicitly marked deprecated here
      152 |   inline bool is() const {
          |               ^
    ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:165:28: warning: 'is<clang::BlockDecl *>' is deprecated: Use isa instead [-Wdeprecated-declarations]
      165 |                 if (object.is<BlockDecl*>()) {
          |                            ^
    ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:151:5: note: 'is<clang::BlockDecl *>' has been explicitly marked deprecated here
      151 |   [[deprecated("Use isa instead")]]
          |     ^
    

Fixes:

```
ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:165:28: warning: 'is' is deprecated: Use isa instead [-Wdeprecated-declarations]
  165 |                 if (object.is<BlockDecl*>()) {
      |                            ^
ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:152:15: note: 'is' has been explicitly marked deprecated here
  152 |   inline bool is() const {
      |               ^
ClangSharp/ClangSharp/sources/libClangSharp/ClangSharp.cpp:165:28: warning: 'is<clang::BlockDecl *>' is deprecated: Use isa instead [-Wdeprecated-declarations]
  165 |                 if (object.is<BlockDecl*>()) {
      |                            ^
ClangSharp/artifacts/llvm/install/include/llvm/ADT/PointerUnion.h:151:5: note: 'is<clang::BlockDecl *>' has been explicitly marked deprecated here
  151 |   [[deprecated("Use isa instead")]]
      |     ^
```
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")]]
      |     ^
```
@tannergooding
tannergooding merged commit 30d6d6b into dotnet:main Nov 29, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants