Skip to content

Commit a52155a

Browse files
committed
clang: update to clang v10
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent 4b31b8c commit a52155a

14 files changed

+170
-52
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- "main"
1010

1111
env:
12-
LLVM_VERSION: 9
12+
LLVM_VERSION: 10
1313

1414
jobs:
1515
test:

clang/clang-c/BuildSystem.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
#ifndef LLVM_CLANG_C_BUILDSYSTEM_H
1717
#define LLVM_CLANG_C_BUILDSYSTEM_H
1818

19-
#include "clang-c/Platform.h"
2019
#include "clang-c/CXErrorCode.h"
2120
#include "clang-c/CXString.h"
21+
#include "clang-c/ExternC.h"
22+
#include "clang-c/Platform.h"
2223

23-
#ifdef __cplusplus
24-
extern "C" {
25-
#endif
24+
LLVM_CLANG_C_EXTERN_C_BEGIN
2625

2726
/**
2827
* \defgroup BUILD_SYSTEM Build system utilities
@@ -150,9 +149,7 @@ CINDEX_LINKAGE void clang_ModuleMapDescriptor_dispose(CXModuleMapDescriptor);
150149
* @}
151150
*/
152151

153-
#ifdef __cplusplus
154-
}
155-
#endif
152+
LLVM_CLANG_C_EXTERN_C_END
156153

157154
#endif /* CLANG_C_BUILD_SYSTEM_H */
158155

clang/clang-c/CXCompilationDatabase.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
#ifndef LLVM_CLANG_C_CXCOMPILATIONDATABASE_H
1818
#define LLVM_CLANG_C_CXCOMPILATIONDATABASE_H
1919

20-
#include "clang-c/Platform.h"
2120
#include "clang-c/CXString.h"
21+
#include "clang-c/ExternC.h"
22+
#include "clang-c/Platform.h"
2223

23-
#ifdef __cplusplus
24-
extern "C" {
25-
#endif
24+
LLVM_CLANG_C_EXTERN_C_BEGIN
2625

2726
/** \defgroup COMPILATIONDB CompilationDatabase functions
2827
* \ingroup CINDEX
@@ -171,8 +170,7 @@ clang_CompileCommand_getMappedSourceContent(CXCompileCommand, unsigned I);
171170
* @}
172171
*/
173172

174-
#ifdef __cplusplus
175-
}
176-
#endif
173+
LLVM_CLANG_C_EXTERN_C_END
174+
177175
#endif
178176

clang/clang-c/CXErrorCode.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
#ifndef LLVM_CLANG_C_CXERRORCODE_H
1717
#define LLVM_CLANG_C_CXERRORCODE_H
1818

19+
#include "clang-c/ExternC.h"
1920
#include "clang-c/Platform.h"
2021

21-
#ifdef __cplusplus
22-
extern "C" {
23-
#endif
22+
LLVM_CLANG_C_EXTERN_C_BEGIN
2423

2524
/**
2625
* Error codes returned by libclang routines.
@@ -59,8 +58,7 @@ enum CXErrorCode {
5958
CXError_ASTReadError = 4
6059
};
6160

62-
#ifdef __cplusplus
63-
}
64-
#endif
61+
LLVM_CLANG_C_EXTERN_C_END
62+
6563
#endif
6664

clang/clang-c/CXString.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
#ifndef LLVM_CLANG_C_CXSTRING_H
1717
#define LLVM_CLANG_C_CXSTRING_H
1818

19+
#include "clang-c/ExternC.h"
1920
#include "clang-c/Platform.h"
2021

21-
#ifdef __cplusplus
22-
extern "C" {
23-
#endif
22+
LLVM_CLANG_C_EXTERN_C_BEGIN
2423

2524
/**
2625
* \defgroup CINDEX_STRING String manipulation routines
@@ -66,8 +65,7 @@ CINDEX_LINKAGE void clang_disposeStringSet(CXStringSet *set);
6665
* @}
6766
*/
6867

69-
#ifdef __cplusplus
70-
}
71-
#endif
68+
LLVM_CLANG_C_EXTERN_C_END
69+
7270
#endif
7371

clang/clang-c/Documentation.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
#ifndef LLVM_CLANG_C_DOCUMENTATION_H
1818
#define LLVM_CLANG_C_DOCUMENTATION_H
1919

20+
#include "clang-c/ExternC.h"
2021
#include "clang-c/Index.h"
2122

22-
#ifdef __cplusplus
23-
extern "C" {
24-
#endif
23+
LLVM_CLANG_C_EXTERN_C_BEGIN
2524

2625
/**
2726
* \defgroup CINDEX_COMMENT Comment introspection
@@ -184,7 +183,12 @@ enum CXCommentInlineCommandRenderKind {
184183
* Command argument should be rendered emphasized (typically italic
185184
* font).
186185
*/
187-
CXCommentInlineCommandRenderKind_Emphasized
186+
CXCommentInlineCommandRenderKind_Emphasized,
187+
188+
/**
189+
* Command argument should not be rendered (since it only defines an anchor).
190+
*/
191+
CXCommentInlineCommandRenderKind_Anchor
188192
};
189193

190194
/**
@@ -547,10 +551,7 @@ CINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment);
547551
* @}
548552
*/
549553

550-
551-
#ifdef __cplusplus
552-
}
553-
#endif
554+
LLVM_CLANG_C_EXTERN_C_END
554555

555556
#endif /* CLANG_C_DOCUMENTATION_H */
556557

clang/clang-c/ExternC.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <stdint.h>
2+
3+
/*===- clang-c/ExternC.h - Wrapper for 'extern "C"' ---------------*- C -*-===*\
4+
|* *|
5+
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
6+
|* Exceptions. *|
7+
|* See https://llvm.org/LICENSE.txt for license information. *|
8+
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
9+
|* *|
10+
|*===----------------------------------------------------------------------===*|
11+
|* *|
12+
|* This file defines an 'extern "C"' wrapper. *|
13+
|* *|
14+
\*===----------------------------------------------------------------------===*/
15+
16+
#ifndef LLVM_CLANG_C_EXTERN_C_H
17+
#define LLVM_CLANG_C_EXTERN_C_H
18+
19+
#ifdef __clang__
20+
#define LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN \
21+
_Pragma("clang diagnostic push") \
22+
_Pragma("clang diagnostic error \"-Wstrict-prototypes\"")
23+
#define LLVM_CLANG_C_STRICT_PROTOTYPES_END _Pragma("clang diagnostic pop")
24+
#else
25+
#define LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
26+
#define LLVM_CLANG_C_STRICT_PROTOTYPES_END
27+
#endif
28+
29+
#ifdef __cplusplus
30+
#define LLVM_CLANG_C_EXTERN_C_BEGIN \
31+
extern "C" { \
32+
LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
33+
#define LLVM_CLANG_C_EXTERN_C_END \
34+
LLVM_CLANG_C_STRICT_PROTOTYPES_END \
35+
}
36+
#else
37+
#define LLVM_CLANG_C_EXTERN_C_BEGIN LLVM_CLANG_C_STRICT_PROTOTYPES_BEGIN
38+
#define LLVM_CLANG_C_EXTERN_C_END LLVM_CLANG_C_STRICT_PROTOTYPES_END
39+
#endif
40+
41+
#endif

clang/clang-c/FatalErrorHandler.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <stdint.h>
2+
3+
/*===-- clang-c/FatalErrorHandler.h - Fatal Error Handling --------*- C -*-===*\
4+
|* *|
5+
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
6+
|* Exceptions. *|
7+
|* See https://llvm.org/LICENSE.txt for license information. *|
8+
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
9+
|* *|
10+
\*===----------------------------------------------------------------------===*/
11+
12+
#ifndef LLVM_CLANG_C_FATAL_ERROR_HANDLER_H
13+
#define LLVM_CLANG_C_FATAL_ERROR_HANDLER_H
14+
15+
#include "clang-c/ExternC.h"
16+
17+
LLVM_CLANG_C_EXTERN_C_BEGIN
18+
19+
/**
20+
* Installs error handler that prints error message to stderr and calls abort().
21+
* Replaces currently installed error handler (if any).
22+
*/
23+
void clang_install_aborting_llvm_fatal_error_handler(void);
24+
25+
/**
26+
* Removes currently installed error handler (if any).
27+
* If no error handler is intalled, the default strategy is to print error
28+
* message to stderr and call exit(1).
29+
*/
30+
void clang_uninstall_llvm_fatal_error_handler(void);
31+
32+
LLVM_CLANG_C_EXTERN_C_END
33+
34+
#endif

clang/clang-c/Index.h

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020

2121
#include <time.h>
2222

23-
#include "clang-c/Platform.h"
23+
#include "clang-c/BuildSystem.h"
2424
#include "clang-c/CXErrorCode.h"
2525
#include "clang-c/CXString.h"
26-
#include "clang-c/BuildSystem.h"
26+
#include "clang-c/ExternC.h"
27+
#include "clang-c/Platform.h"
2728

2829
/**
2930
* The version constants for the libclang API.
@@ -53,9 +54,7 @@
5354
CINDEX_VERSION_MAJOR, \
5455
CINDEX_VERSION_MINOR)
5556

56-
#ifdef __cplusplus
57-
extern "C" {
58-
#endif
57+
LLVM_CLANG_C_EXTERN_C_BEGIN
5958

6059
/** \defgroup CINDEX libclang: C Interface to Clang
6160
*
@@ -1358,7 +1357,12 @@ enum CXTranslationUnit_Flags {
13581357
* the case where these warnings are not of interest, as for an IDE for
13591358
* example, which typically shows only the diagnostics in the main file.
13601359
*/
1361-
CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000
1360+
CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000,
1361+
1362+
/**
1363+
* Tells the preprocessor not to skip excluded conditional blocks.
1364+
*/
1365+
CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000
13621366
};
13631367

13641368
/**
@@ -2552,7 +2556,27 @@ enum CXCursorKind {
25522556
*/
25532557
CXCursor_BuiltinBitCastExpr = 280,
25542558

2555-
CXCursor_LastStmt = CXCursor_BuiltinBitCastExpr,
2559+
/** OpenMP master taskloop directive.
2560+
*/
2561+
CXCursor_OMPMasterTaskLoopDirective = 281,
2562+
2563+
/** OpenMP parallel master taskloop directive.
2564+
*/
2565+
CXCursor_OMPParallelMasterTaskLoopDirective = 282,
2566+
2567+
/** OpenMP master taskloop simd directive.
2568+
*/
2569+
CXCursor_OMPMasterTaskLoopSimdDirective = 283,
2570+
2571+
/** OpenMP parallel master taskloop simd directive.
2572+
*/
2573+
CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284,
2574+
2575+
/** OpenMP parallel master directive.
2576+
*/
2577+
CXCursor_OMPParallelMasterDirective = 285,
2578+
2579+
CXCursor_LastStmt = CXCursor_OMPParallelMasterDirective,
25562580

25572581
/**
25582582
* Cursor that represents the translation unit itself.
@@ -6755,7 +6779,6 @@ CINDEX_LINKAGE unsigned clang_Type_visitFields(CXType T,
67556779
* @}
67566780
*/
67576781

6758-
#ifdef __cplusplus
6759-
}
6760-
#endif
6782+
LLVM_CLANG_C_EXTERN_C_END
6783+
67616784
#endif

clang/clang-c/Platform.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
#ifndef LLVM_CLANG_C_PLATFORM_H
1717
#define LLVM_CLANG_C_PLATFORM_H
1818

19-
#ifdef __cplusplus
20-
extern "C" {
21-
#endif
19+
#include "clang-c/ExternC.h"
20+
21+
LLVM_CLANG_C_EXTERN_C_BEGIN
2222

2323
/* MSVC DLL import/export. */
2424
#ifdef _MSC_VER
@@ -41,7 +41,6 @@ extern "C" {
4141
#endif
4242
#endif
4343

44-
#ifdef __cplusplus
45-
}
46-
#endif
44+
LLVM_CLANG_C_EXTERN_C_END
45+
4746
#endif

0 commit comments

Comments
 (0)