diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index e897b9946e72..7c0f2f96ab26 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3745,7 +3745,13 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const { FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const { const TypeSourceInfo *TSI = getTypeSourceInfo(); - + // CHERIOT: The following code diverges from upstream. The previous + // code returned a null FunctionTypeLoc when the function was + // annotated (impacting getReturnTypeSourceRange too). It is + // necessary to provide hints to replace the return type of a + // compartment entry point which returns void instead of int. + // + // https://github.com/llvm/llvm-project/pull/118420 if (!TSI) return FunctionTypeLoc();