Skip to content

Commit a52155a

Browse files
committed
clang: update to clang v10
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 4b31b8c commit a52155a

14 files changed

+170
-52
lines changed

.github/workflows/test.yml

+1-1
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

+4-7
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

+5-7
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

+4-6
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

+4-6
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

+9-8
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

+41
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

+34
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

+33-10
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

+5-6
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

clang/clang_gen.go

+11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package clang
22

33
// #include "./clang-c/BuildSystem.h"
4+
// #include "./clang-c/FatalErrorHandler.h"
45
// #include "./clang-c/Index.h"
56
// #include "go-clang.h"
67
import "C"
@@ -11,6 +12,16 @@ func GetBuildSessionTimestamp() uint64 {
1112
return uint64(C.clang_getBuildSessionTimestamp())
1213
}
1314

15+
// Installs error handler that prints error message to stderr and calls abort(). Replaces currently installed error handler (if any).
16+
func InstallAbortingFatalErrorHandler() {
17+
C.clang_install_aborting_llvm_fatal_error_handler()
18+
}
19+
20+
// Removes currently installed error handler (if any). If no error handler is intalled, the default strategy is to print error message to stderr and call exit(1).
21+
func UninstallFatalErrorHandler() {
22+
C.clang_uninstall_llvm_fatal_error_handler()
23+
}
24+
1425
/*
1526
Retrieve the set of display options most similar to the
1627
default behavior of the clang compiler.

clang/commentinlinecommandrenderkind_gen.go

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const (
1717
CommentInlineCommandRenderKind_Monospaced = C.CXCommentInlineCommandRenderKind_Monospaced
1818
// Command argument should be rendered emphasized (typically italic font).
1919
CommentInlineCommandRenderKind_Emphasized = C.CXCommentInlineCommandRenderKind_Emphasized
20+
// Command argument should not be rendered (since it only defines an anchor).
21+
CommentInlineCommandRenderKind_Anchor = C.CXCommentInlineCommandRenderKind_Anchor
2022
)
2123

2224
func (cicrk CommentInlineCommandRenderKind) Spelling() string {
@@ -29,6 +31,8 @@ func (cicrk CommentInlineCommandRenderKind) Spelling() string {
2931
return "CommentInlineCommandRenderKind=Monospaced"
3032
case CommentInlineCommandRenderKind_Emphasized:
3133
return "CommentInlineCommandRenderKind=Emphasized"
34+
case CommentInlineCommandRenderKind_Anchor:
35+
return "CommentInlineCommandRenderKind=Anchor"
3236
}
3337

3438
return fmt.Sprintf("CommentInlineCommandRenderKind unknown %d", int(cicrk))

clang/cursorkind_gen.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,17 @@ const (
577577
Cursor_OMPTargetTeamsDistributeSimdDirective = C.CXCursor_OMPTargetTeamsDistributeSimdDirective
578578
// C++2a std::bit_cast expression.
579579
Cursor_BuiltinBitCastExpr = C.CXCursor_BuiltinBitCastExpr
580-
// C++2a std::bit_cast expression.
580+
// OpenMP master taskloop directive.
581+
Cursor_OMPMasterTaskLoopDirective = C.CXCursor_OMPMasterTaskLoopDirective
582+
// OpenMP parallel master taskloop directive.
583+
Cursor_OMPParallelMasterTaskLoopDirective = C.CXCursor_OMPParallelMasterTaskLoopDirective
584+
// OpenMP master taskloop simd directive.
585+
Cursor_OMPMasterTaskLoopSimdDirective = C.CXCursor_OMPMasterTaskLoopSimdDirective
586+
// OpenMP parallel master taskloop simd directive.
587+
Cursor_OMPParallelMasterTaskLoopSimdDirective = C.CXCursor_OMPParallelMasterTaskLoopSimdDirective
588+
// OpenMP parallel master directive.
589+
Cursor_OMPParallelMasterDirective = C.CXCursor_OMPParallelMasterDirective
590+
// OpenMP parallel master directive.
581591
Cursor_LastStmt = C.CXCursor_LastStmt
582592
/*
583593
Cursor that represents the translation unit itself.

0 commit comments

Comments
 (0)