Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm-c/Remarks.h b/linux-x64/clang/include/llvm-c/Remarks.h
index 7fb1665..ffe647a 100644
--- a/linux-x64/clang/include/llvm-c/Remarks.h
+++ b/linux-x64/clang/include/llvm-c/Remarks.h
@@ -15,14 +15,16 @@
#ifndef LLVM_C_REMARKS_H
#define LLVM_C_REMARKS_H
+#include "llvm-c/ExternC.h"
#include "llvm-c/Types.h"
#ifdef __cplusplus
#include <cstddef>
-extern "C" {
#else
#include <stddef.h>
#endif /* !defined(__cplusplus) */
+LLVM_C_EXTERN_C_BEGIN
+
/**
* @defgroup LLVMCREMARKS Remarks
* @ingroup LLVMC
@@ -30,7 +32,8 @@
* @{
*/
-#define REMARKS_API_VERSION 0
+// 0 -> 1: Bitstream remarks support.
+#define REMARKS_API_VERSION 1
/**
* The type of the emitted remark.
@@ -137,6 +140,13 @@
typedef struct LLVMRemarkOpaqueEntry *LLVMRemarkEntryRef;
/**
+ * Free the resources used by the remark entry.
+ *
+ * \since REMARKS_API_VERSION=0
+ */
+extern void LLVMRemarkEntryDispose(LLVMRemarkEntryRef Remark);
+
+/**
* The type of the remark. For example, it can allow users to only keep the
* missed optimizations from the compiler.
*
@@ -161,7 +171,7 @@
LLVMRemarkEntryGetRemarkName(LLVMRemarkEntryRef Remark);
/**
- * Get the name of the function being processsed when the remark was emitted.
+ * Get the name of the function being processed when the remark was emitted.
*
* \since REMARKS_API_VERSION=0
*/
@@ -199,6 +209,8 @@
*
* If there are no arguments in \p Remark, the return value will be `NULL`.
*
+ * The lifetime of the returned value is bound to the lifetime of \p Remark.
+ *
* \since REMARKS_API_VERSION=0
*/
extern LLVMRemarkArgRef LLVMRemarkEntryGetFirstArg(LLVMRemarkEntryRef Remark);
@@ -208,6 +220,8 @@
*
* Returns `NULL` if there are no more arguments available.
*
+ * The lifetime of the returned value is bound to the lifetime of \p Remark.
+ *
* \since REMARKS_API_VERSION=0
*/
extern LLVMRemarkArgRef LLVMRemarkEntryGetNextArg(LLVMRemarkArgRef It,
@@ -230,10 +244,27 @@
uint64_t Size);
/**
+ * Creates a remark parser that can be used to parse the buffer located in \p
+ * Buf of size \p Size bytes.
+ *
+ * \p Buf cannot be `NULL`.
+ *
+ * This function should be paired with LLVMRemarkParserDispose() to avoid
+ * leaking resources.
+ *
+ * \since REMARKS_API_VERSION=1
+ */
+extern LLVMRemarkParserRef LLVMRemarkParserCreateBitstream(const void *Buf,
+ uint64_t Size);
+
+/**
* Returns the next remark in the file.
*
- * The value pointed to by the return value is invalidated by the next call to
- * LLVMRemarkParserGetNext().
+ * The value pointed to by the return value needs to be disposed using a call to
+ * LLVMRemarkEntryDispose().
+ *
+ * All the entries in the returned value that are of LLVMRemarkStringRef type
+ * will become invalidated once a call to LLVMRemarkParserDispose is made.
*
* If the parser reaches the end of the buffer, the return value will be `NULL`.
*
@@ -258,8 +289,9 @@
* ```
* LLVMRemarkParserRef Parser = LLVMRemarkParserCreateYAML(Buf, Size);
* LLVMRemarkEntryRef Remark = NULL;
- * while ((Remark == LLVMRemarkParserGetNext(Parser))) {
+ * while ((Remark = LLVMRemarkParserGetNext(Parser))) {
* // use Remark
+ * LLVMRemarkEntryDispose(Remark); // Release memory.
* }
* bool HasError = LLVMRemarkParserHasError(Parser);
* LLVMRemarkParserDispose(Parser);
@@ -307,8 +339,6 @@
* @} // endgoup LLVMCREMARKS
*/
-#ifdef __cplusplus
-}
-#endif /* !defined(__cplusplus) */
+LLVM_C_EXTERN_C_END
#endif /* LLVM_C_REMARKS_H */