From 61d34b94632969af682094939aa39c43b3fd0fbb Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Mon, 22 Apr 2019 22:49:35 -0700 Subject: [PATCH 1/2] Adding various extensions to expose APIs in a object oriented manner. --- ClangSharp/ClangSharp.csproj | 2 +- ClangSharp/Extensions.cs | 36 ------ ClangSharp/Extensions/CXCursor.cs | 70 +++++++++++ ClangSharp/Extensions/CXCursorSet.cs | 19 +++ ClangSharp/Extensions/CXDiagnostic.cs | 56 +++++++++ ClangSharp/Extensions/CXDiagnosticSet.cs | 34 ++++++ ClangSharp/Extensions/CXFile.cs | 37 ++++++ ClangSharp/Extensions/CXIndex.cs | 19 +++ ClangSharp/Extensions/CXSourceLocation.cs | 37 ++++++ ClangSharp/Extensions/CXSourceRange.cs | 25 ++++ ClangSharp/Extensions/CXString.cs | 16 +++ ClangSharp/Extensions/CXTranslationUnit.cs | 67 +++++++++++ ClangSharp/Extensions/CXType.cs | 133 +++++++++++++++++++++ 13 files changed, 514 insertions(+), 37 deletions(-) delete mode 100644 ClangSharp/Extensions.cs create mode 100644 ClangSharp/Extensions/CXCursor.cs create mode 100644 ClangSharp/Extensions/CXCursorSet.cs create mode 100644 ClangSharp/Extensions/CXDiagnostic.cs create mode 100644 ClangSharp/Extensions/CXDiagnosticSet.cs create mode 100644 ClangSharp/Extensions/CXFile.cs create mode 100644 ClangSharp/Extensions/CXIndex.cs create mode 100644 ClangSharp/Extensions/CXSourceLocation.cs create mode 100644 ClangSharp/Extensions/CXSourceRange.cs create mode 100644 ClangSharp/Extensions/CXString.cs create mode 100644 ClangSharp/Extensions/CXTranslationUnit.cs create mode 100644 ClangSharp/Extensions/CXType.cs diff --git a/ClangSharp/ClangSharp.csproj b/ClangSharp/ClangSharp.csproj index 72764a66..939a2ed9 100644 --- a/ClangSharp/ClangSharp.csproj +++ b/ClangSharp/ClangSharp.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/ClangSharp/Extensions.cs b/ClangSharp/Extensions.cs deleted file mode 100644 index 5b2baf63..00000000 --- a/ClangSharp/Extensions.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace ClangSharp -{ - public partial struct CXString - { - public override string ToString() - { - string retval = clang.getCString(this); - clang.disposeString(this); - return retval; - } - } - - public partial struct CXType - { - public override string ToString() - { - return clang.getTypeSpelling(this).ToString(); - } - } - - public partial struct CXCursor - { - public override string ToString() - { - return clang.getCursorSpelling(this).ToString(); - } - } - - public partial struct CXDiagnostic - { - public override string ToString() - { - return clang.getDiagnosticSpelling(this).ToString(); - } - } -} \ No newline at end of file diff --git a/ClangSharp/Extensions/CXCursor.cs b/ClangSharp/Extensions/CXCursor.cs new file mode 100644 index 00000000..3ad4a162 --- /dev/null +++ b/ClangSharp/Extensions/CXCursor.cs @@ -0,0 +1,70 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXCursor : IEquatable + { + public static CXCursor Null + => clang.getNullCursor(); + + public CXSourceRange CommentRange + => clang.Cursor_getCommentRange(this); + + public CXType EnumDeclIntegerType + => clang.getEnumDeclIntegerType(this); + + public CXSourceRange Extent + => clang.getCursorExtent(this); + + public CXType IBOutletCollectionType + => clang.getIBOutletCollectionType(this); + + public bool IsNull + => clang.Cursor_isNull(this) != 0; + + public CXCursorKind Kind + => clang.getCursorKind(this); + + public CXSourceLocation Location + => clang.getCursorLocation(this); + + public CXType TypedefDeclUnderlyingType + => clang.getTypedefDeclUnderlyingType(this); + + public CXType RecieverType + => clang.Cursor_getReceiverType(this); + + public CXType ResultType + => clang.getCursorResultType(this); + + public CXString Spelling + => clang.getCursorSpelling(this); + + public CXTranslationUnit TranslationUnit + => clang.Cursor_getTranslationUnit(this); + + public CXType Type + => clang.getCursorType(this); + + public override bool Equals(object obj) + => (obj is CXCursor other) && Equals(other); + + public bool Equals(CXCursor other) + => clang.equalCursors(this, other) != 0; + + public override int GetHashCode() + => (int)clang.hashCursor(this); + + public CXSourceRange GetReferenceNameRange(CXNameRefFlags nameFlags, uint pieceIndex) + => clang.getCursorReferenceNameRange(this, (uint)nameFlags, pieceIndex); + + public CXType GetTemplateArgumentType(uint i) + => clang.Cursor_getTemplateArgumentType(this, i); + + public CXSourceRange GetSpellingNameRange(uint pieceIndex, uint options) + => clang.Cursor_getSpellingNameRange(this, pieceIndex, options); + + public override string ToString() + => Spelling.ToString(); + } +} diff --git a/ClangSharp/Extensions/CXCursorSet.cs b/ClangSharp/Extensions/CXCursorSet.cs new file mode 100644 index 00000000..a8b339a4 --- /dev/null +++ b/ClangSharp/Extensions/CXCursorSet.cs @@ -0,0 +1,19 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXCursorSet : IDisposable + { + public static CXCursorSet Create() + => clang.createCXCursorSet(); + + public bool Contains(CXCursor cursor) + => clang.CXCursorSet_contains(this, cursor) != 0; + + public void Dispose() + => clang.disposeCXCursorSet(this); + + public bool Insert(CXCursor cursor) + => clang.CXCursorSet_insert(this, cursor) != 0; + } +} diff --git a/ClangSharp/Extensions/CXDiagnostic.cs b/ClangSharp/Extensions/CXDiagnostic.cs new file mode 100644 index 00000000..f9f521e2 --- /dev/null +++ b/ClangSharp/Extensions/CXDiagnostic.cs @@ -0,0 +1,56 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXDiagnostic : IDisposable + { + public static CXDiagnosticDisplayOptions DefaultDisplayOptions + => (CXDiagnosticDisplayOptions)clang.defaultDiagnosticDisplayOptions(); + + public uint Category + => clang.getDiagnosticCategory(this); + + public CXString CategoryText + => clang.getDiagnosticCategoryText(this); + + public CXDiagnosticSet ChildDiagnostics + => clang.getChildDiagnostics(this); + + public CXSourceLocation Location + => clang.getDiagnosticLocation(this); + + public uint NumFixIts + => clang.getDiagnosticNumFixIts(this); + + public uint NumRanges + => clang.getDiagnosticNumRanges(this); + + public CXDiagnosticSeverity Severity + => clang.getDiagnosticSeverity(this); + + public CXString Spelling + => clang.getDiagnosticSpelling(this); + + public void Dispose() + => clang.disposeDiagnostic(this); + + public CXString Format(CXDiagnosticDisplayOptions options) + => clang.formatDiagnostic(this, (uint)options); + + [Obsolete("Use " + nameof(CategoryText) + " instead.")] + public static CXString GetCategoryName(uint category) + => clang.getDiagnosticCategoryName(category); + + public CXString GetFixIt(uint fixIt, out CXSourceRange replacementRange) + => clang.getDiagnosticFixIt(this, fixIt, out replacementRange); + + public CXString GetOption(out CXString disable) + => clang.getDiagnosticOption(this, out disable); + + public CXSourceRange GetRange(uint range) + => clang.getDiagnosticRange(this, range); + + public override string ToString() + => Spelling.ToString(); + } +} diff --git a/ClangSharp/Extensions/CXDiagnosticSet.cs b/ClangSharp/Extensions/CXDiagnosticSet.cs new file mode 100644 index 00000000..51d81b25 --- /dev/null +++ b/ClangSharp/Extensions/CXDiagnosticSet.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace ClangSharp +{ + public partial struct CXDiagnosticSet : IDisposable, IReadOnlyCollection + { + public CXDiagnostic this[uint index] + => GetDiagnostic(index); + + public int Count + => (int)clang.getNumDiagnosticsInSet(this); + + public void Dispose() + => clang.disposeDiagnosticSet(this); + + public CXDiagnostic GetDiagnostic(uint index) + => clang.getDiagnosticInSet(this, index); + + public IEnumerator GetEnumerator() + { + var count = (uint)Count; + + for (var index = 0u; index < count; index++) + { + yield return GetDiagnostic(index); + } + } + + IEnumerator IEnumerable.GetEnumerator() + => GetEnumerator(); + } +} diff --git a/ClangSharp/Extensions/CXFile.cs b/ClangSharp/Extensions/CXFile.cs new file mode 100644 index 00000000..af098dc4 --- /dev/null +++ b/ClangSharp/Extensions/CXFile.cs @@ -0,0 +1,37 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXFile : IEquatable + { + public CXString Name + => clang.getFileName(this); + + public long Time + => clang.getFileTime(this); + + public override bool Equals(object obj) + => (obj is CXFile other) && Equals(other); + + public bool Equals(CXFile other) + => clang.File_isEqual(this, other) != 0; + + public string GetContents(CXTranslationUnit translationUnit, out ulong size) + => clang.getFileContents(translationUnit, this, out size); + + public CXSourceLocation GetLocation(CXTranslationUnit translationUnit, uint line, uint column) + => clang.getLocation(translationUnit, this, line, column); + + public CXSourceLocation GetLocationForOffset(CXTranslationUnit translationUnit, uint offset) + => clang.getLocationForOffset(translationUnit, this, offset); + + public bool IsMultipleIncludeGuarded(CXTranslationUnit translationUnit) + => clang.isFileMultipleIncludeGuarded(translationUnit, this) != 0; + + public override string ToString() + => Name.ToString(); + + public CXString TryGetRealPathName() + => clang.File_tryGetRealPathName(this); + } +} diff --git a/ClangSharp/Extensions/CXIndex.cs b/ClangSharp/Extensions/CXIndex.cs new file mode 100644 index 00000000..3b4f9cf1 --- /dev/null +++ b/ClangSharp/Extensions/CXIndex.cs @@ -0,0 +1,19 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXIndex : IDisposable + { + public CXIndex Create(bool excludeDeclarationsFromPch = false, bool displayDiagnostics = false) + => clang.createIndex(excludeDeclarationsFromPch ? 1 : 0, displayDiagnostics ? 1 : 0); + + public CXGlobalOptFlags GlobalOptions + { + get => (CXGlobalOptFlags)clang.CXIndex_getGlobalOptions(this); + set => clang.CXIndex_setGlobalOptions(this, (uint)value); + } + + public void Dispose() + => clang.disposeIndex(this); + } +} diff --git a/ClangSharp/Extensions/CXSourceLocation.cs b/ClangSharp/Extensions/CXSourceLocation.cs new file mode 100644 index 00000000..a63b7010 --- /dev/null +++ b/ClangSharp/Extensions/CXSourceLocation.cs @@ -0,0 +1,37 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXSourceLocation : IEquatable + { + public static CXSourceLocation Null + => clang.getNullLocation(); + + public bool IsFromMainFile + => clang.Location_isFromMainFile(this) != 0; + + public bool IsInSystemHeader + => clang.Location_isInSystemHeader(this) != 0; + + public override bool Equals(object obj) + => (obj is CXSourceLocation other) && Equals(other); + + public bool Equals(CXSourceLocation other) + => clang.equalLocations(this, other) != 0; + + public void GetExpansionLocation(out CXFile file, out uint line, out uint column, out uint offset) + => clang.getExpansionLocation(this, out file, out line, out column, out offset); + + public void GetFileLocation(out CXFile file, out uint line, out uint column, out uint offset) + => clang.getFileLocation(this, out file, out line, out column, out offset); + + public void GetInstantiationLocation(out CXFile file, out uint line, out uint column, out uint offset) + => clang.getInstantiationLocation(this, out file, out line, out column, out offset); + + public void GetPresumedLocation(out CXString fileName, out uint line, out uint column) + => clang.getPresumedLocation(this, out fileName, out line, out column); + + public void GetSpellingLocation(out CXFile file, out uint line, out uint column, out uint offset) + => clang.getSpellingLocation(this, out file, out line, out column, out offset); + } +} diff --git a/ClangSharp/Extensions/CXSourceRange.cs b/ClangSharp/Extensions/CXSourceRange.cs new file mode 100644 index 00000000..0b1c5b53 --- /dev/null +++ b/ClangSharp/Extensions/CXSourceRange.cs @@ -0,0 +1,25 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXSourceRange : IEquatable + { + public CXSourceRange Create(CXSourceLocation begin, CXSourceLocation end) + => clang.getRange(begin, end); + + public static CXSourceRange Null + => clang.getNullRange(); + + public CXSourceLocation End + => clang.getRangeEnd(this); + + public CXSourceLocation Start + => clang.getRangeStart(this); + + public override bool Equals(object obj) + => (obj is CXSourceRange other) && Equals(other); + + public bool Equals(CXSourceRange other) + => clang.equalRanges(this, other) != 0; + } +} diff --git a/ClangSharp/Extensions/CXString.cs b/ClangSharp/Extensions/CXString.cs new file mode 100644 index 00000000..bc92eedc --- /dev/null +++ b/ClangSharp/Extensions/CXString.cs @@ -0,0 +1,16 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXString : IDisposable + { + public string CString + => clang.getCString(this); + + public void Dispose() + => clang.disposeString(this); + + public override string ToString() + => CString; + } +} diff --git a/ClangSharp/Extensions/CXTranslationUnit.cs b/ClangSharp/Extensions/CXTranslationUnit.cs new file mode 100644 index 00000000..4036b671 --- /dev/null +++ b/ClangSharp/Extensions/CXTranslationUnit.cs @@ -0,0 +1,67 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXTranslationUnit : IDisposable + { + public static CXTranslationUnit Create(CXIndex index, string astFileName) + => clang.createTranslationUnit(index, astFileName); + + public static CXErrorCode Create(CXIndex index, string astFileName, out CXTranslationUnit translationUnit) + => clang.createTranslationUnit2(index, astFileName, out translationUnit); + + public static CXTranslationUnit CreateFromSourceFile(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles) + => clang.createTranslationUnitFromSourceFile(index, sourceFileName, commandLineArgs.Length, commandLineArgs, (uint)unsavedFiles.Length, unsavedFiles); + + public static CXTranslationUnit Parse(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options) + => clang.parseTranslationUnit(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options); + + public static CXErrorCode Parse(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options, out CXTranslationUnit translationUnit) + => clang.parseTranslationUnit2(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options, out translationUnit); + + public static CXErrorCode ParseFullArgv(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options, out CXTranslationUnit translationUnit) + => clang.parseTranslationUnit2FullArgv(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options, out translationUnit); + + public CXCursor Cursor + => clang.getTranslationUnitCursor(this); + + public CXReparse_Flags DefaultReparseOptions + => (CXReparse_Flags)clang.defaultReparseOptions(this); + + public CXSaveTranslationUnit_Flags DefaultSaveOptions + => (CXSaveTranslationUnit_Flags)clang.defaultSaveOptions(this); + + public CXDiagnosticSet DiagnosticSet + => clang.getDiagnosticSetFromTU(this); + + public uint NumDiagnostics + => clang.getNumDiagnostics(this); + + public CXString Spelling + => clang.getTranslationUnitSpelling(this); + + public void Dispose() + => clang.disposeTranslationUnit(this); + + public CXCursor GetCursor(CXSourceLocation location) + => clang.getCursor(this, location); + + public CXDiagnostic GetDiagnostic(uint index) + => clang.getDiagnostic(this, index); + + public CXFile GetFile(string fileName) + => clang.getFile(this, fileName); + + public CXErrorCode Reparse(CXUnsavedFile[] unsavedFiles, CXReparse_Flags options) + => (CXErrorCode)clang.reparseTranslationUnit(this, (uint)unsavedFiles.Length, unsavedFiles, (uint)options); + + public CXSaveError Save(string fileName, CXSaveTranslationUnit_Flags options) + => (CXSaveError)clang.saveTranslationUnit(this, fileName, (uint)options); + + public bool Suspend() + => clang.suspendTranslationUnit(this) != 0; + + public override string ToString() + => Spelling.ToString(); + } +} diff --git a/ClangSharp/Extensions/CXType.cs b/ClangSharp/Extensions/CXType.cs new file mode 100644 index 00000000..e60f1ae8 --- /dev/null +++ b/ClangSharp/Extensions/CXType.cs @@ -0,0 +1,133 @@ +using System; + +namespace ClangSharp +{ + public partial struct CXType : IEquatable + { + public uint AddressSpace + => clang.getAddressSpace(this); + + public long AlignOf + => clang.Type_getAlignOf(this); + + public CXType ArrayElementType + => clang.getArrayElementType(this); + + public long ArraySize + => clang.getArraySize(this); + + public CXType CanonicalType + => clang.getCanonicalType(this); + + public CXType ClassType + => clang.Type_getClassType(this); + + public CXRefQualifierKind CXXRefQualifier + => clang.Type_getCXXRefQualifier(this); + + public CXCursor Declaration + => clang.getTypeDeclaration(this); + + public CXType ElementType + => clang.getElementType(this); + + public CXCursor_ExceptionSpecificationKind ExceptionSpecificationType + => (CXCursor_ExceptionSpecificationKind)clang.getExceptionSpecificationType(this); + + public CXCallingConv FunctionTypeCallingConv + => clang.getFunctionTypeCallingConv(this); + + public bool IsConstQualified + => clang.isConstQualifiedType(this) != 0; + + public bool IsFunctionTypeVariadic + => clang.isFunctionTypeVariadic(this) != 0; + + public bool IsPODType + => clang.isPODType(this) != 0; + + public bool IsRestrictQualified + => clang.isRestrictQualifiedType(this) != 0; + + public bool IsTransparentTagTypedef + => clang.Type_isTransparentTagTypedef(this) != 0; + + public bool IsVolatileQualified + => clang.isVolatileQualifiedType(this) != 0; + + public CXString KindSpelling + => clang.getTypeKindSpelling(kind); + + public CXType ModifierType + => clang.Type_getModifiedType(this); + + public CXType NamedType + => clang.Type_getNamedType(this); + + public CXTypeNullabilityKind Nullability + => clang.Type_getNullability(this); + + public int NumArgTypes + => clang.getNumArgTypes(this); + + public long NumElements + => clang.getNumElements(this); + + public uint NumObjCProtocolRefs + => clang.Type_getNumObjCProtocolRefs(this); + + public uint NumObjCTypeArgs + => clang.Type_getNumObjCTypeArgs(this); + + public int NumTemplateArguments + => clang.Type_getNumTemplateArguments(this); + + public CXType ObjCObjectBaseType + => clang.Type_getObjCObjectBaseType(this); + + public CXString ObjCEncoding + => clang.Type_getObjCEncoding(this); + + public CXType PointeeType + => clang.getPointeeType(this); + + public CXType ResultType + => clang.getResultType(this); + + public long SizeOf + => clang.Type_getSizeOf(this); + + public CXString TypedefName + => clang.getTypedefName(this); + + public override bool Equals(object obj) + => (obj is CXType other) && Equals(other); + + public bool Equals(CXType other) + => clang.equalTypes(this, other) != 0; + + public CXType GetArgType(uint i) + => clang.getArgType(this, i); + + public CXCursor GetObjCProtocolDecl(uint i) + => clang.Type_getObjCProtocolDecl(this, i); + + public CXType GetObjCTypeArg(uint i) + => clang.Type_getObjCTypeArg(this, i); + + public long GetOffsetOf(string s) + => clang.Type_getOffsetOf(this, s); + + public CXType GetTemplateArgumentAsType(uint i) + => clang.Type_getTemplateArgumentAsType(this, i); + + public CXString Spelling + => clang.getTypeSpelling(this); + + public override string ToString() + => Spelling.ToString(); + + public uint VisitFields(CXFieldVisitor visitor, CXClientData clientData) + => clang.Type_visitFields(this, visitor, clientData); + } +} From e91988e2c621e40393ea0e86dfafee0539ea315c Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Tue, 23 Apr 2019 13:42:59 -0700 Subject: [PATCH 2/2] Fixing the lambda expressions in the extension types to be single line --- ClangSharp/Extensions/CXCursor.cs | 63 ++++------- ClangSharp/Extensions/CXCursorSet.cs | 12 +- ClangSharp/Extensions/CXDiagnostic.cs | 48 +++----- ClangSharp/Extensions/CXDiagnosticSet.cs | 15 +-- ClangSharp/Extensions/CXFile.cs | 30 ++--- ClangSharp/Extensions/CXIndex.cs | 6 +- ClangSharp/Extensions/CXSourceLocation.cs | 30 ++--- ClangSharp/Extensions/CXSourceRange.cs | 18 +-- ClangSharp/Extensions/CXString.cs | 9 +- ClangSharp/Extensions/CXTranslationUnit.cs | 60 ++++------ ClangSharp/Extensions/CXType.cs | 126 +++++++-------------- 11 files changed, 139 insertions(+), 278 deletions(-) diff --git a/ClangSharp/Extensions/CXCursor.cs b/ClangSharp/Extensions/CXCursor.cs index 3ad4a162..c059e4b2 100644 --- a/ClangSharp/Extensions/CXCursor.cs +++ b/ClangSharp/Extensions/CXCursor.cs @@ -4,67 +4,46 @@ namespace ClangSharp { public partial struct CXCursor : IEquatable { - public static CXCursor Null - => clang.getNullCursor(); + public static CXCursor Null => clang.getNullCursor(); - public CXSourceRange CommentRange - => clang.Cursor_getCommentRange(this); + public CXSourceRange CommentRange => clang.Cursor_getCommentRange(this); - public CXType EnumDeclIntegerType - => clang.getEnumDeclIntegerType(this); + public CXType EnumDeclIntegerType => clang.getEnumDeclIntegerType(this); - public CXSourceRange Extent - => clang.getCursorExtent(this); + public CXSourceRange Extent => clang.getCursorExtent(this); - public CXType IBOutletCollectionType - => clang.getIBOutletCollectionType(this); + public CXType IBOutletCollectionType => clang.getIBOutletCollectionType(this); - public bool IsNull - => clang.Cursor_isNull(this) != 0; + public bool IsNull => clang.Cursor_isNull(this) != 0; - public CXCursorKind Kind - => clang.getCursorKind(this); + public CXCursorKind Kind => clang.getCursorKind(this); - public CXSourceLocation Location - => clang.getCursorLocation(this); + public CXSourceLocation Location => clang.getCursorLocation(this); - public CXType TypedefDeclUnderlyingType - => clang.getTypedefDeclUnderlyingType(this); + public CXType TypedefDeclUnderlyingType => clang.getTypedefDeclUnderlyingType(this); - public CXType RecieverType - => clang.Cursor_getReceiverType(this); + public CXType RecieverType => clang.Cursor_getReceiverType(this); - public CXType ResultType - => clang.getCursorResultType(this); + public CXType ResultType => clang.getCursorResultType(this); - public CXString Spelling - => clang.getCursorSpelling(this); + public CXString Spelling => clang.getCursorSpelling(this); - public CXTranslationUnit TranslationUnit - => clang.Cursor_getTranslationUnit(this); + public CXTranslationUnit TranslationUnit => clang.Cursor_getTranslationUnit(this); - public CXType Type - => clang.getCursorType(this); + public CXType Type => clang.getCursorType(this); - public override bool Equals(object obj) - => (obj is CXCursor other) && Equals(other); + public override bool Equals(object obj) => (obj is CXCursor other) && Equals(other); - public bool Equals(CXCursor other) - => clang.equalCursors(this, other) != 0; + public bool Equals(CXCursor other) => clang.equalCursors(this, other) != 0; - public override int GetHashCode() - => (int)clang.hashCursor(this); + public override int GetHashCode() => (int)clang.hashCursor(this); - public CXSourceRange GetReferenceNameRange(CXNameRefFlags nameFlags, uint pieceIndex) - => clang.getCursorReferenceNameRange(this, (uint)nameFlags, pieceIndex); + public CXSourceRange GetReferenceNameRange(CXNameRefFlags nameFlags, uint pieceIndex) => clang.getCursorReferenceNameRange(this, (uint)nameFlags, pieceIndex); - public CXType GetTemplateArgumentType(uint i) - => clang.Cursor_getTemplateArgumentType(this, i); + public CXType GetTemplateArgumentType(uint i) => clang.Cursor_getTemplateArgumentType(this, i); - public CXSourceRange GetSpellingNameRange(uint pieceIndex, uint options) - => clang.Cursor_getSpellingNameRange(this, pieceIndex, options); + public CXSourceRange GetSpellingNameRange(uint pieceIndex, uint options) => clang.Cursor_getSpellingNameRange(this, pieceIndex, options); - public override string ToString() - => Spelling.ToString(); + public override string ToString() => Spelling.ToString(); } } diff --git a/ClangSharp/Extensions/CXCursorSet.cs b/ClangSharp/Extensions/CXCursorSet.cs index a8b339a4..59e2158c 100644 --- a/ClangSharp/Extensions/CXCursorSet.cs +++ b/ClangSharp/Extensions/CXCursorSet.cs @@ -4,16 +4,12 @@ namespace ClangSharp { public partial struct CXCursorSet : IDisposable { - public static CXCursorSet Create() - => clang.createCXCursorSet(); + public static CXCursorSet Create() => clang.createCXCursorSet(); - public bool Contains(CXCursor cursor) - => clang.CXCursorSet_contains(this, cursor) != 0; + public bool Contains(CXCursor cursor) => clang.CXCursorSet_contains(this, cursor) != 0; - public void Dispose() - => clang.disposeCXCursorSet(this); + public void Dispose() => clang.disposeCXCursorSet(this); - public bool Insert(CXCursor cursor) - => clang.CXCursorSet_insert(this, cursor) != 0; + public bool Insert(CXCursor cursor) => clang.CXCursorSet_insert(this, cursor) != 0; } } diff --git a/ClangSharp/Extensions/CXDiagnostic.cs b/ClangSharp/Extensions/CXDiagnostic.cs index f9f521e2..1a7c2d31 100644 --- a/ClangSharp/Extensions/CXDiagnostic.cs +++ b/ClangSharp/Extensions/CXDiagnostic.cs @@ -4,53 +4,37 @@ namespace ClangSharp { public partial struct CXDiagnostic : IDisposable { - public static CXDiagnosticDisplayOptions DefaultDisplayOptions - => (CXDiagnosticDisplayOptions)clang.defaultDiagnosticDisplayOptions(); + public static CXDiagnosticDisplayOptions DefaultDisplayOptions => (CXDiagnosticDisplayOptions)clang.defaultDiagnosticDisplayOptions(); - public uint Category - => clang.getDiagnosticCategory(this); + public uint Category => clang.getDiagnosticCategory(this); - public CXString CategoryText - => clang.getDiagnosticCategoryText(this); + public CXString CategoryText => clang.getDiagnosticCategoryText(this); - public CXDiagnosticSet ChildDiagnostics - => clang.getChildDiagnostics(this); + public CXDiagnosticSet ChildDiagnostics => clang.getChildDiagnostics(this); - public CXSourceLocation Location - => clang.getDiagnosticLocation(this); + public CXSourceLocation Location => clang.getDiagnosticLocation(this); - public uint NumFixIts - => clang.getDiagnosticNumFixIts(this); + public uint NumFixIts => clang.getDiagnosticNumFixIts(this); - public uint NumRanges - => clang.getDiagnosticNumRanges(this); + public uint NumRanges => clang.getDiagnosticNumRanges(this); - public CXDiagnosticSeverity Severity - => clang.getDiagnosticSeverity(this); + public CXDiagnosticSeverity Severity => clang.getDiagnosticSeverity(this); - public CXString Spelling - => clang.getDiagnosticSpelling(this); + public CXString Spelling => clang.getDiagnosticSpelling(this); - public void Dispose() - => clang.disposeDiagnostic(this); + public void Dispose() => clang.disposeDiagnostic(this); - public CXString Format(CXDiagnosticDisplayOptions options) - => clang.formatDiagnostic(this, (uint)options); + public CXString Format(CXDiagnosticDisplayOptions options) => clang.formatDiagnostic(this, (uint)options); [Obsolete("Use " + nameof(CategoryText) + " instead.")] - public static CXString GetCategoryName(uint category) - => clang.getDiagnosticCategoryName(category); + public static CXString GetCategoryName(uint category) => clang.getDiagnosticCategoryName(category); - public CXString GetFixIt(uint fixIt, out CXSourceRange replacementRange) - => clang.getDiagnosticFixIt(this, fixIt, out replacementRange); + public CXString GetFixIt(uint fixIt, out CXSourceRange replacementRange) => clang.getDiagnosticFixIt(this, fixIt, out replacementRange); - public CXString GetOption(out CXString disable) - => clang.getDiagnosticOption(this, out disable); + public CXString GetOption(out CXString disable) => clang.getDiagnosticOption(this, out disable); - public CXSourceRange GetRange(uint range) - => clang.getDiagnosticRange(this, range); + public CXSourceRange GetRange(uint range) => clang.getDiagnosticRange(this, range); - public override string ToString() - => Spelling.ToString(); + public override string ToString() => Spelling.ToString(); } } diff --git a/ClangSharp/Extensions/CXDiagnosticSet.cs b/ClangSharp/Extensions/CXDiagnosticSet.cs index 51d81b25..481686b0 100644 --- a/ClangSharp/Extensions/CXDiagnosticSet.cs +++ b/ClangSharp/Extensions/CXDiagnosticSet.cs @@ -6,17 +6,13 @@ namespace ClangSharp { public partial struct CXDiagnosticSet : IDisposable, IReadOnlyCollection { - public CXDiagnostic this[uint index] - => GetDiagnostic(index); + public CXDiagnostic this[uint index] => GetDiagnostic(index); - public int Count - => (int)clang.getNumDiagnosticsInSet(this); + public int Count => (int)clang.getNumDiagnosticsInSet(this); - public void Dispose() - => clang.disposeDiagnosticSet(this); + public void Dispose() => clang.disposeDiagnosticSet(this); - public CXDiagnostic GetDiagnostic(uint index) - => clang.getDiagnosticInSet(this, index); + public CXDiagnostic GetDiagnostic(uint index) => clang.getDiagnosticInSet(this, index); public IEnumerator GetEnumerator() { @@ -28,7 +24,6 @@ public IEnumerator GetEnumerator() } } - IEnumerator IEnumerable.GetEnumerator() - => GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } } diff --git a/ClangSharp/Extensions/CXFile.cs b/ClangSharp/Extensions/CXFile.cs index af098dc4..0d3394ba 100644 --- a/ClangSharp/Extensions/CXFile.cs +++ b/ClangSharp/Extensions/CXFile.cs @@ -4,34 +4,24 @@ namespace ClangSharp { public partial struct CXFile : IEquatable { - public CXString Name - => clang.getFileName(this); + public CXString Name => clang.getFileName(this); - public long Time - => clang.getFileTime(this); + public long Time => clang.getFileTime(this); - public override bool Equals(object obj) - => (obj is CXFile other) && Equals(other); + public override bool Equals(object obj) => (obj is CXFile other) && Equals(other); - public bool Equals(CXFile other) - => clang.File_isEqual(this, other) != 0; + public bool Equals(CXFile other) => clang.File_isEqual(this, other) != 0; - public string GetContents(CXTranslationUnit translationUnit, out ulong size) - => clang.getFileContents(translationUnit, this, out size); + public string GetContents(CXTranslationUnit translationUnit, out ulong size) => clang.getFileContents(translationUnit, this, out size); - public CXSourceLocation GetLocation(CXTranslationUnit translationUnit, uint line, uint column) - => clang.getLocation(translationUnit, this, line, column); + public CXSourceLocation GetLocation(CXTranslationUnit translationUnit, uint line, uint column) => clang.getLocation(translationUnit, this, line, column); - public CXSourceLocation GetLocationForOffset(CXTranslationUnit translationUnit, uint offset) - => clang.getLocationForOffset(translationUnit, this, offset); + public CXSourceLocation GetLocationForOffset(CXTranslationUnit translationUnit, uint offset) => clang.getLocationForOffset(translationUnit, this, offset); - public bool IsMultipleIncludeGuarded(CXTranslationUnit translationUnit) - => clang.isFileMultipleIncludeGuarded(translationUnit, this) != 0; + public bool IsMultipleIncludeGuarded(CXTranslationUnit translationUnit) => clang.isFileMultipleIncludeGuarded(translationUnit, this) != 0; - public override string ToString() - => Name.ToString(); + public override string ToString() => Name.ToString(); - public CXString TryGetRealPathName() - => clang.File_tryGetRealPathName(this); + public CXString TryGetRealPathName() => clang.File_tryGetRealPathName(this); } } diff --git a/ClangSharp/Extensions/CXIndex.cs b/ClangSharp/Extensions/CXIndex.cs index 3b4f9cf1..87c5a32a 100644 --- a/ClangSharp/Extensions/CXIndex.cs +++ b/ClangSharp/Extensions/CXIndex.cs @@ -4,8 +4,7 @@ namespace ClangSharp { public partial struct CXIndex : IDisposable { - public CXIndex Create(bool excludeDeclarationsFromPch = false, bool displayDiagnostics = false) - => clang.createIndex(excludeDeclarationsFromPch ? 1 : 0, displayDiagnostics ? 1 : 0); + public CXIndex Create(bool excludeDeclarationsFromPch = false, bool displayDiagnostics = false) => clang.createIndex(excludeDeclarationsFromPch ? 1 : 0, displayDiagnostics ? 1 : 0); public CXGlobalOptFlags GlobalOptions { @@ -13,7 +12,6 @@ public CXGlobalOptFlags GlobalOptions set => clang.CXIndex_setGlobalOptions(this, (uint)value); } - public void Dispose() - => clang.disposeIndex(this); + public void Dispose() => clang.disposeIndex(this); } } diff --git a/ClangSharp/Extensions/CXSourceLocation.cs b/ClangSharp/Extensions/CXSourceLocation.cs index a63b7010..d2994daf 100644 --- a/ClangSharp/Extensions/CXSourceLocation.cs +++ b/ClangSharp/Extensions/CXSourceLocation.cs @@ -4,34 +4,24 @@ namespace ClangSharp { public partial struct CXSourceLocation : IEquatable { - public static CXSourceLocation Null - => clang.getNullLocation(); + public static CXSourceLocation Null => clang.getNullLocation(); - public bool IsFromMainFile - => clang.Location_isFromMainFile(this) != 0; + public bool IsFromMainFile => clang.Location_isFromMainFile(this) != 0; - public bool IsInSystemHeader - => clang.Location_isInSystemHeader(this) != 0; + public bool IsInSystemHeader => clang.Location_isInSystemHeader(this) != 0; - public override bool Equals(object obj) - => (obj is CXSourceLocation other) && Equals(other); + public override bool Equals(object obj) => (obj is CXSourceLocation other) && Equals(other); - public bool Equals(CXSourceLocation other) - => clang.equalLocations(this, other) != 0; + public bool Equals(CXSourceLocation other) => clang.equalLocations(this, other) != 0; - public void GetExpansionLocation(out CXFile file, out uint line, out uint column, out uint offset) - => clang.getExpansionLocation(this, out file, out line, out column, out offset); + public void GetExpansionLocation(out CXFile file, out uint line, out uint column, out uint offset) => clang.getExpansionLocation(this, out file, out line, out column, out offset); - public void GetFileLocation(out CXFile file, out uint line, out uint column, out uint offset) - => clang.getFileLocation(this, out file, out line, out column, out offset); + public void GetFileLocation(out CXFile file, out uint line, out uint column, out uint offset) => clang.getFileLocation(this, out file, out line, out column, out offset); - public void GetInstantiationLocation(out CXFile file, out uint line, out uint column, out uint offset) - => clang.getInstantiationLocation(this, out file, out line, out column, out offset); + public void GetInstantiationLocation(out CXFile file, out uint line, out uint column, out uint offset) => clang.getInstantiationLocation(this, out file, out line, out column, out offset); - public void GetPresumedLocation(out CXString fileName, out uint line, out uint column) - => clang.getPresumedLocation(this, out fileName, out line, out column); + public void GetPresumedLocation(out CXString fileName, out uint line, out uint column) => clang.getPresumedLocation(this, out fileName, out line, out column); - public void GetSpellingLocation(out CXFile file, out uint line, out uint column, out uint offset) - => clang.getSpellingLocation(this, out file, out line, out column, out offset); + public void GetSpellingLocation(out CXFile file, out uint line, out uint column, out uint offset) => clang.getSpellingLocation(this, out file, out line, out column, out offset); } } diff --git a/ClangSharp/Extensions/CXSourceRange.cs b/ClangSharp/Extensions/CXSourceRange.cs index 0b1c5b53..86e0cfe4 100644 --- a/ClangSharp/Extensions/CXSourceRange.cs +++ b/ClangSharp/Extensions/CXSourceRange.cs @@ -4,22 +4,16 @@ namespace ClangSharp { public partial struct CXSourceRange : IEquatable { - public CXSourceRange Create(CXSourceLocation begin, CXSourceLocation end) - => clang.getRange(begin, end); + public CXSourceRange Create(CXSourceLocation begin, CXSourceLocation end) => clang.getRange(begin, end); - public static CXSourceRange Null - => clang.getNullRange(); + public static CXSourceRange Null => clang.getNullRange(); - public CXSourceLocation End - => clang.getRangeEnd(this); + public CXSourceLocation End => clang.getRangeEnd(this); - public CXSourceLocation Start - => clang.getRangeStart(this); + public CXSourceLocation Start => clang.getRangeStart(this); - public override bool Equals(object obj) - => (obj is CXSourceRange other) && Equals(other); + public override bool Equals(object obj) => (obj is CXSourceRange other) && Equals(other); - public bool Equals(CXSourceRange other) - => clang.equalRanges(this, other) != 0; + public bool Equals(CXSourceRange other) => clang.equalRanges(this, other) != 0; } } diff --git a/ClangSharp/Extensions/CXString.cs b/ClangSharp/Extensions/CXString.cs index bc92eedc..9a68f2a1 100644 --- a/ClangSharp/Extensions/CXString.cs +++ b/ClangSharp/Extensions/CXString.cs @@ -4,13 +4,10 @@ namespace ClangSharp { public partial struct CXString : IDisposable { - public string CString - => clang.getCString(this); + public string CString => clang.getCString(this); - public void Dispose() - => clang.disposeString(this); + public void Dispose() => clang.disposeString(this); - public override string ToString() - => CString; + public override string ToString() => CString; } } diff --git a/ClangSharp/Extensions/CXTranslationUnit.cs b/ClangSharp/Extensions/CXTranslationUnit.cs index 4036b671..b928a4e8 100644 --- a/ClangSharp/Extensions/CXTranslationUnit.cs +++ b/ClangSharp/Extensions/CXTranslationUnit.cs @@ -4,64 +4,44 @@ namespace ClangSharp { public partial struct CXTranslationUnit : IDisposable { - public static CXTranslationUnit Create(CXIndex index, string astFileName) - => clang.createTranslationUnit(index, astFileName); + public static CXTranslationUnit Create(CXIndex index, string astFileName) => clang.createTranslationUnit(index, astFileName); - public static CXErrorCode Create(CXIndex index, string astFileName, out CXTranslationUnit translationUnit) - => clang.createTranslationUnit2(index, astFileName, out translationUnit); + public static CXErrorCode Create(CXIndex index, string astFileName, out CXTranslationUnit translationUnit) => clang.createTranslationUnit2(index, astFileName, out translationUnit); - public static CXTranslationUnit CreateFromSourceFile(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles) - => clang.createTranslationUnitFromSourceFile(index, sourceFileName, commandLineArgs.Length, commandLineArgs, (uint)unsavedFiles.Length, unsavedFiles); + public static CXTranslationUnit CreateFromSourceFile(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles) => clang.createTranslationUnitFromSourceFile(index, sourceFileName, commandLineArgs.Length, commandLineArgs, (uint)unsavedFiles.Length, unsavedFiles); - public static CXTranslationUnit Parse(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options) - => clang.parseTranslationUnit(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options); + public static CXTranslationUnit Parse(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options) => clang.parseTranslationUnit(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options); - public static CXErrorCode Parse(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options, out CXTranslationUnit translationUnit) - => clang.parseTranslationUnit2(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options, out translationUnit); + public static CXErrorCode Parse(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options, out CXTranslationUnit translationUnit) => clang.parseTranslationUnit2(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options, out translationUnit); - public static CXErrorCode ParseFullArgv(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options, out CXTranslationUnit translationUnit) - => clang.parseTranslationUnit2FullArgv(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options, out translationUnit); + public static CXErrorCode ParseFullArgv(CXIndex index, string sourceFileName, string[] commandLineArgs, CXUnsavedFile[] unsavedFiles, CXTranslationUnit_Flags options, out CXTranslationUnit translationUnit) => clang.parseTranslationUnit2FullArgv(index, sourceFileName, commandLineArgs, commandLineArgs.Length, unsavedFiles, (uint)unsavedFiles.Length, (uint)options, out translationUnit); - public CXCursor Cursor - => clang.getTranslationUnitCursor(this); + public CXCursor Cursor => clang.getTranslationUnitCursor(this); - public CXReparse_Flags DefaultReparseOptions - => (CXReparse_Flags)clang.defaultReparseOptions(this); + public CXReparse_Flags DefaultReparseOptions => (CXReparse_Flags)clang.defaultReparseOptions(this); - public CXSaveTranslationUnit_Flags DefaultSaveOptions - => (CXSaveTranslationUnit_Flags)clang.defaultSaveOptions(this); + public CXSaveTranslationUnit_Flags DefaultSaveOptions => (CXSaveTranslationUnit_Flags)clang.defaultSaveOptions(this); - public CXDiagnosticSet DiagnosticSet - => clang.getDiagnosticSetFromTU(this); + public CXDiagnosticSet DiagnosticSet => clang.getDiagnosticSetFromTU(this); - public uint NumDiagnostics - => clang.getNumDiagnostics(this); + public uint NumDiagnostics => clang.getNumDiagnostics(this); - public CXString Spelling - => clang.getTranslationUnitSpelling(this); + public CXString Spelling => clang.getTranslationUnitSpelling(this); - public void Dispose() - => clang.disposeTranslationUnit(this); + public void Dispose() => clang.disposeTranslationUnit(this); - public CXCursor GetCursor(CXSourceLocation location) - => clang.getCursor(this, location); + public CXCursor GetCursor(CXSourceLocation location) => clang.getCursor(this, location); - public CXDiagnostic GetDiagnostic(uint index) - => clang.getDiagnostic(this, index); + public CXDiagnostic GetDiagnostic(uint index) => clang.getDiagnostic(this, index); - public CXFile GetFile(string fileName) - => clang.getFile(this, fileName); + public CXFile GetFile(string fileName) => clang.getFile(this, fileName); - public CXErrorCode Reparse(CXUnsavedFile[] unsavedFiles, CXReparse_Flags options) - => (CXErrorCode)clang.reparseTranslationUnit(this, (uint)unsavedFiles.Length, unsavedFiles, (uint)options); + public CXErrorCode Reparse(CXUnsavedFile[] unsavedFiles, CXReparse_Flags options) => (CXErrorCode)clang.reparseTranslationUnit(this, (uint)unsavedFiles.Length, unsavedFiles, (uint)options); - public CXSaveError Save(string fileName, CXSaveTranslationUnit_Flags options) - => (CXSaveError)clang.saveTranslationUnit(this, fileName, (uint)options); + public CXSaveError Save(string fileName, CXSaveTranslationUnit_Flags options) => (CXSaveError)clang.saveTranslationUnit(this, fileName, (uint)options); - public bool Suspend() - => clang.suspendTranslationUnit(this) != 0; + public bool Suspend() => clang.suspendTranslationUnit(this) != 0; - public override string ToString() - => Spelling.ToString(); + public override string ToString() => Spelling.ToString(); } } diff --git a/ClangSharp/Extensions/CXType.cs b/ClangSharp/Extensions/CXType.cs index e60f1ae8..3b756315 100644 --- a/ClangSharp/Extensions/CXType.cs +++ b/ClangSharp/Extensions/CXType.cs @@ -4,130 +4,88 @@ namespace ClangSharp { public partial struct CXType : IEquatable { - public uint AddressSpace - => clang.getAddressSpace(this); + public uint AddressSpace => clang.getAddressSpace(this); - public long AlignOf - => clang.Type_getAlignOf(this); + public long AlignOf => clang.Type_getAlignOf(this); - public CXType ArrayElementType - => clang.getArrayElementType(this); + public CXType ArrayElementType => clang.getArrayElementType(this); - public long ArraySize - => clang.getArraySize(this); + public long ArraySize => clang.getArraySize(this); - public CXType CanonicalType - => clang.getCanonicalType(this); + public CXType CanonicalType => clang.getCanonicalType(this); - public CXType ClassType - => clang.Type_getClassType(this); + public CXType ClassType => clang.Type_getClassType(this); - public CXRefQualifierKind CXXRefQualifier - => clang.Type_getCXXRefQualifier(this); + public CXRefQualifierKind CXXRefQualifier => clang.Type_getCXXRefQualifier(this); - public CXCursor Declaration - => clang.getTypeDeclaration(this); + public CXCursor Declaration => clang.getTypeDeclaration(this); - public CXType ElementType - => clang.getElementType(this); + public CXType ElementType => clang.getElementType(this); - public CXCursor_ExceptionSpecificationKind ExceptionSpecificationType - => (CXCursor_ExceptionSpecificationKind)clang.getExceptionSpecificationType(this); + public CXCursor_ExceptionSpecificationKind ExceptionSpecificationType => (CXCursor_ExceptionSpecificationKind)clang.getExceptionSpecificationType(this); - public CXCallingConv FunctionTypeCallingConv - => clang.getFunctionTypeCallingConv(this); + public CXCallingConv FunctionTypeCallingConv => clang.getFunctionTypeCallingConv(this); - public bool IsConstQualified - => clang.isConstQualifiedType(this) != 0; + public bool IsConstQualified => clang.isConstQualifiedType(this) != 0; - public bool IsFunctionTypeVariadic - => clang.isFunctionTypeVariadic(this) != 0; + public bool IsFunctionTypeVariadic => clang.isFunctionTypeVariadic(this) != 0; - public bool IsPODType - => clang.isPODType(this) != 0; + public bool IsPODType => clang.isPODType(this) != 0; - public bool IsRestrictQualified - => clang.isRestrictQualifiedType(this) != 0; + public bool IsRestrictQualified => clang.isRestrictQualifiedType(this) != 0; - public bool IsTransparentTagTypedef - => clang.Type_isTransparentTagTypedef(this) != 0; + public bool IsTransparentTagTypedef => clang.Type_isTransparentTagTypedef(this) != 0; - public bool IsVolatileQualified - => clang.isVolatileQualifiedType(this) != 0; + public bool IsVolatileQualified => clang.isVolatileQualifiedType(this) != 0; - public CXString KindSpelling - => clang.getTypeKindSpelling(kind); + public CXString KindSpelling => clang.getTypeKindSpelling(kind); - public CXType ModifierType - => clang.Type_getModifiedType(this); + public CXType ModifierType => clang.Type_getModifiedType(this); - public CXType NamedType - => clang.Type_getNamedType(this); + public CXType NamedType => clang.Type_getNamedType(this); - public CXTypeNullabilityKind Nullability - => clang.Type_getNullability(this); + public CXTypeNullabilityKind Nullability => clang.Type_getNullability(this); - public int NumArgTypes - => clang.getNumArgTypes(this); + public int NumArgTypes => clang.getNumArgTypes(this); - public long NumElements - => clang.getNumElements(this); + public long NumElements => clang.getNumElements(this); - public uint NumObjCProtocolRefs - => clang.Type_getNumObjCProtocolRefs(this); + public uint NumObjCProtocolRefs => clang.Type_getNumObjCProtocolRefs(this); - public uint NumObjCTypeArgs - => clang.Type_getNumObjCTypeArgs(this); + public uint NumObjCTypeArgs => clang.Type_getNumObjCTypeArgs(this); - public int NumTemplateArguments - => clang.Type_getNumTemplateArguments(this); + public int NumTemplateArguments => clang.Type_getNumTemplateArguments(this); - public CXType ObjCObjectBaseType - => clang.Type_getObjCObjectBaseType(this); + public CXType ObjCObjectBaseType => clang.Type_getObjCObjectBaseType(this); - public CXString ObjCEncoding - => clang.Type_getObjCEncoding(this); + public CXString ObjCEncoding => clang.Type_getObjCEncoding(this); - public CXType PointeeType - => clang.getPointeeType(this); + public CXType PointeeType => clang.getPointeeType(this); - public CXType ResultType - => clang.getResultType(this); + public CXType ResultType => clang.getResultType(this); - public long SizeOf - => clang.Type_getSizeOf(this); + public long SizeOf => clang.Type_getSizeOf(this); - public CXString TypedefName - => clang.getTypedefName(this); + public CXString TypedefName => clang.getTypedefName(this); - public override bool Equals(object obj) - => (obj is CXType other) && Equals(other); + public override bool Equals(object obj) => (obj is CXType other) && Equals(other); - public bool Equals(CXType other) - => clang.equalTypes(this, other) != 0; + public bool Equals(CXType other) => clang.equalTypes(this, other) != 0; - public CXType GetArgType(uint i) - => clang.getArgType(this, i); + public CXType GetArgType(uint i) => clang.getArgType(this, i); - public CXCursor GetObjCProtocolDecl(uint i) - => clang.Type_getObjCProtocolDecl(this, i); + public CXCursor GetObjCProtocolDecl(uint i) => clang.Type_getObjCProtocolDecl(this, i); - public CXType GetObjCTypeArg(uint i) - => clang.Type_getObjCTypeArg(this, i); + public CXType GetObjCTypeArg(uint i) => clang.Type_getObjCTypeArg(this, i); - public long GetOffsetOf(string s) - => clang.Type_getOffsetOf(this, s); + public long GetOffsetOf(string s) => clang.Type_getOffsetOf(this, s); - public CXType GetTemplateArgumentAsType(uint i) - => clang.Type_getTemplateArgumentAsType(this, i); + public CXType GetTemplateArgumentAsType(uint i) => clang.Type_getTemplateArgumentAsType(this, i); - public CXString Spelling - => clang.getTypeSpelling(this); + public CXString Spelling => clang.getTypeSpelling(this); - public override string ToString() - => Spelling.ToString(); + public override string ToString() => Spelling.ToString(); - public uint VisitFields(CXFieldVisitor visitor, CXClientData clientData) - => clang.Type_visitFields(this, visitor, clientData); + public uint VisitFields(CXFieldVisitor visitor, CXClientData clientData) => clang.Type_visitFields(this, visitor, clientData); } }