Merge pull request #740 from luoliwoshang/c/clang/nonref

c/clang:noref type
This commit is contained in:
xushiwei
2024-08-22 22:33:30 +08:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -45,6 +45,8 @@ void wrap_clang_getPointeeType(CXType *pointerTyp, CXType *pointeeTyp) {
*pointeeTyp = clang_getPointeeType(*pointerTyp);
}
void wrap_clang_getNonReferenceType(CXType *typ, CXType *nonRefTyp) { *nonRefTyp = clang_getNonReferenceType(*typ); }
void wrap_clang_getArrayElementType(CXType *arrayTyp, CXType *elemTyp) {
*elemTyp = clang_getArrayElementType(*arrayTyp);
}

View File

@@ -1942,6 +1942,23 @@ func (t Type) ArrayElementType() (ret Type) {
return
}
/**
* For reference types (e.g., "const int&"), returns the type that the
* reference refers to (e.g "const int").
*
* Otherwise, returns the type itself.
*
* A type that has kind \c CXType_LValueReference or
* \c CXType_RValueReference is a reference type.
*/
// llgo:link (*Type).wrapNonReferenceType C.wrap_clang_getNonReferenceType
func (t *Type) wrapNonReferenceType(ret *Type) { return }
func (t Type) NonReferenceType() (ret Type) {
t.wrapNonReferenceType(&ret)
return
}
/**
* Return the element type of an array, complex, or vector type.
*