@@ -1032,29 +1032,26 @@ CXType clangsharp_Cursor_getDefaultArgType(CXCursor C) {
10321032CXCursor clangsharp_Cursor_getDefinition (CXCursor C) {
10331033    if  (isDeclOrTU (C.kind )) {
10341034        const  Decl* D = getCursorDecl (C);
1035+         const  Decl* DD = nullptr ;
10351036
10361037        if  (const  FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) {
1037-             return  MakeCXCursor (FD->getDefinition (), getCursorTU (C));
1038-         }
1039- 
1040-         if  (const  ObjCInterfaceDecl* OCID = dyn_cast<ObjCInterfaceDecl>(D)) {
1041-             return  MakeCXCursor (OCID->getDefinition (), getCursorTU (C));
1042-         }
1043- 
1044-         if  (const  ObjCProtocolDecl* OCPD = dyn_cast<ObjCProtocolDecl>(D)) {
1045-             return  MakeCXCursor (OCPD->getDefinition (), getCursorTU (C));
1046-         }
1047- 
1048-         if  (const  TagDecl* TD = dyn_cast<TagDecl>(D)) {
1049-             return  MakeCXCursor (TD->getDefinition (), getCursorTU (C));
1050-         }
1051- 
1052-         if  (const  VarDecl* VD = dyn_cast<VarDecl>(D)) {
1053-             return  MakeCXCursor (VD->getDefinition (), getCursorTU (C));
1054-         }
1038+             DD = FD->getDefinition ();
1039+         } else  if  (const  ObjCInterfaceDecl* OCID = dyn_cast<ObjCInterfaceDecl>(D)) {
1040+             DD = OCID->getDefinition ();
1041+         } else  if  (const  ObjCProtocolDecl* OCPD = dyn_cast<ObjCProtocolDecl>(D)) {
1042+             DD = OCPD->getDefinition ();
1043+         } else  if  (const  TagDecl* TD = dyn_cast<TagDecl>(D)) {
1044+             DD = TD->getDefinition ();
1045+         } else  if  (const  VarDecl* VD = dyn_cast<VarDecl>(D)) {
1046+             DD = VD->getDefinition ();
1047+         } else  {
1048+             return  clang_getCursorDefinition (C);
1049+         }
1050+ 
1051+         return  DD ? MakeCXCursor (DD, getCursorTU (C)) : clang_getNullCursor ();
1052+     } else  {
1053+         return  clang_getCursorDefinition (C);
10551054    }
1056- 
1057-     return  clang_getCursorDefinition (C);
10581055}
10591056
10601057CXCursor clangsharp_Cursor_getDependentLambdaCallOperator (CXCursor C) {
0 commit comments