Clang: Clean up clang patches with regard to CINDEX_VERSION_MINOR

Ensure that CINDEX_VERSION_MINOR is never increased and that instead
specific macros indicate backported functionality. This minimizes
potential build problems with other API functions that might have been
backported or not in the meanwhile.

Change-Id: I44d868e82dd6a3ea5aa3e8b22e18bba5c4bf8d16
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-01-16 08:23:49 +01:00
parent d11a724047
commit c205b43af1
2 changed files with 33 additions and 18 deletions

View File

@@ -1,15 +1,16 @@
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 3b5ea9fa53..f2397d1b63 100644
--- a/tools/clang/include/clang-c/Index.h
+++ b/tools/clang/include/clang-c/Index.h
@@ -32,7 +32,7 @@
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
@@ -33,6 +33,7 @@
*/
#define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 43
+#define CINDEX_VERSION_MINOR 46
#define CINDEX_VERSION_MINOR 43
+#define CINDEX_VERSION_HAS_ISINVALIDECL_BACKPORTED
#define CINDEX_VERSION_ENCODE(major, minor) ( \
((major) * 10000) \
@@ -2641,6 +2641,16 @@ CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
@@ -2616,6 +2617,16 @@ CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
*/
CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
@@ -107,10 +108,10 @@ index 45de93f308..1ea5346273 100644
// CHECK64: VarDecl=v1:[[@LINE+2]]:7 (Definition) [type=void *] [typekind=Pointer] [sizeof=8] [alignof=8]
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 99f05669b6..c5e345ef6a 100644
index cf3581e259..759ed449a4 100644
--- a/tools/clang/tools/c-index-test/c-index-test.c
+++ b/tools/clang/tools/c-index-test/c-index-test.c
@@ -812,6 +812,8 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {
@@ -810,6 +810,8 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {
printf(" (variadic)");
if (clang_Cursor_isObjCOptional(Cursor))
printf(" (@optional)");
@@ -120,10 +121,10 @@ index 99f05669b6..c5e345ef6a 100644
switch (clang_getCursorExceptionSpecificationType(Cursor))
{
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 66b6edc8b1..429fca3474 100644
index 9ba4d5bf30..584de42e7c 100644
--- a/tools/clang/tools/libclang/CIndex.cpp
+++ b/tools/clang/tools/libclang/CIndex.cpp
@@ -5437,6 +5437,15 @@ unsigned clang_isDeclaration(enum CXCursorKind K) {
@@ -5346,6 +5346,15 @@ unsigned clang_isDeclaration(enum CXCursorKind K) {
(K >= CXCursor_FirstExtraDecl && K <= CXCursor_LastExtraDecl);
}
@@ -140,10 +141,10 @@ index 66b6edc8b1..429fca3474 100644
return K >= CXCursor_FirstRef && K <= CXCursor_LastRef;
}
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index bf95b97073..5d1b0224ef 100644
index e0d178a529..7192baab6a 100644
--- a/tools/clang/tools/libclang/libclang.exports
+++ b/tools/clang/tools/libclang/libclang.exports
@@ -291,6 +291,7 @@ clang_isAttribute
@@ -286,6 +286,7 @@ clang_isAttribute
clang_isConstQualifiedType
clang_isCursorDefinition
clang_isDeclaration

View File

@@ -1,9 +1,20 @@
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index f2397d1b63..0f4ade266c 100644
--- a/tools/clang/include/clang-c/Index.h
+++ a/tools/clang/include/clang-c/Index.h
@@ -404,6 +404,21 @@
+++ b/tools/clang/include/clang-c/Index.h
@@ -34,6 +34,7 @@
#define CINDEX_VERSION_MAJOR 0
#define CINDEX_VERSION_MINOR 43
#define CINDEX_VERSION_HAS_ISINVALIDECL_BACKPORTED
+#define CINDEX_VERSION_HAS_GETFILECONTENTS_BACKPORTED
#define CINDEX_VERSION_ENCODE(major, minor) ( \
((major) * 10000) \
@@ -394,6 +395,21 @@ clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
const char *file_name);
/**
+/**
+ * \brief Retrieve the buffer associated with the given file.
+ *
+ * \param tu the translation unit
@@ -18,13 +29,14 @@
+CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu,
+ CXFile file, size_t *size);
+
+/**
/**
* \brief Returns non-zero if the \c file1 and \c file2 point to the same file,
* or they are both NULL.
*/
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 13599e1910..7902e8a030 100644
--- a/tools/clang/tools/libclang/CIndex.cpp
+++ a/tools/clang/tools/libclang/CIndex.cpp
@@ -4162,6 +4162,27 @@
+++ b/tools/clang/tools/libclang/CIndex.cpp
@@ -4148,6 +4148,27 @@ CXFile clang_getFile(CXTranslationUnit TU, const char *file_name) {
return const_cast<FileEntry *>(FMgr.getFile(file_name));
}
@@ -52,6 +64,8 @@
unsigned clang_isFileMultipleIncludeGuarded(CXTranslationUnit TU,
CXFile file) {
if (isNotUsableTU(TU)) {
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index 7192baab6a..c788abb881 100644
--- a/tools/clang/tools/libclang/libclang.exports
+++ b/tools/clang/tools/libclang/libclang.exports
@@ -216,6 +216,7 @@ clang_getExceptionSpecificationType