Skip to content

Commit 554e3c6

Browse files
committed
Merge branch 'add_concepts_to_ast_02' of github.com:bob80905/llvm-project into add_concepts_to_ast_02
2 parents 8d173d3 + 1a9b9fd commit 554e3c6

File tree

76 files changed

+1324
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1324
-512
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,17 @@ Target Specific Changes
710710
AMDGPU Support
711711
^^^^^^^^^^^^^^
712712

713+
- Added headers ``gpuintrin.h`` and ``amdgpuintrin.h`` that contains common
714+
definitions for GPU builtin functions. This header can be included for OpenMP,
715+
CUDA, HIP, OpenCL, and C/C++.
716+
717+
NVPTX Support
718+
^^^^^^^^^^^^^^
719+
720+
- Added headers ``gpuintrin.h`` and ``nvptxintrin.h`` that contains common
721+
definitions for GPU builtin functions. This header can be included for OpenMP,
722+
CUDA, HIP, OpenCL, and C/C++.
723+
713724
X86 Support
714725
^^^^^^^^^^^
715726

clang/include/clang/AST/ASTNodeTraverser.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,13 @@ class ASTNodeTraverser
800800
Visit(A);
801801
}
802802

803+
void VisitLabelStmt(const LabelStmt *Node) {
804+
if (Node->getDecl()->hasAttrs()) {
805+
for (const auto *A : Node->getDecl()->getAttrs())
806+
Visit(A);
807+
}
808+
}
809+
803810
void VisitCXXCatchStmt(const CXXCatchStmt *Node) {
804811
Visit(Node->getExceptionDecl());
805812
}

clang/lib/Headers/amdgpuintrin.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ __gpu_shuffle_idx_u64(uint64_t __lane_mask, uint32_t __idx, uint64_t __x) {
160160

161161
// Returns true if the flat pointer points to CUDA 'shared' memory.
162162
_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_local(void *ptr) {
163-
return __builtin_amdgcn_is_shared(
164-
(void __attribute__((address_space(0))) *)((void __gpu_generic *)ptr));
163+
return __builtin_amdgcn_is_shared((void __attribute__((address_space(0))) *)((
164+
void [[clang::opencl_generic]] *)ptr));
165165
}
166166

167167
// Returns true if the flat pointer points to CUDA 'local' memory.
168168
_DEFAULT_FN_ATTRS static __inline__ bool __gpu_is_ptr_private(void *ptr) {
169-
return __builtin_amdgcn_is_private(
170-
(void __attribute__((address_space(0))) *)((void __gpu_generic *)ptr));
169+
return __builtin_amdgcn_is_private((void __attribute__((
170+
address_space(0))) *)((void [[clang::opencl_generic]] *)ptr));
171171
}
172172

173173
// Terminates execution of the associated wavefront.

clang/lib/InstallAPI/DirectoryScanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ llvm::Error DirectoryScanner::scanForFrameworks(StringRef Directory) {
277277
// Expect a certain directory structure and naming convention to find
278278
// frameworks.
279279
static const char *SubDirectories[] = {"System/Library/Frameworks/",
280-
"System/Library/PrivateFrameworks/"};
280+
"System/Library/PrivateFrameworks/",
281+
"System/Library/SubFrameworks"};
281282

282283
// Check if the directory is already a framework.
283284
if (isFramework(Directory)) {

clang/lib/Lex/InitHeaderSearch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(
346346
AddPath("/System/DriverKit/System/Library/Frameworks", System, true);
347347
} else {
348348
AddPath("/System/Library/Frameworks", System, true);
349+
AddPath("/System/Library/SubFrameworks", System, true);
349350
AddPath("/Library/Frameworks", System, true);
350351
}
351352
}

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,7 @@ Decl *
990990
TemplateDeclInstantiator::VisitLabelDecl(LabelDecl *D) {
991991
LabelDecl *Inst = LabelDecl::Create(SemaRef.Context, Owner, D->getLocation(),
992992
D->getIdentifier());
993+
SemaRef.InstantiateAttrs(TemplateArgs, D, Inst, LateAttrs, StartingScope);
993994
Owner->addDecl(Inst);
994995
return Inst;
995996
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// UNSUPPORTED: system-windows
2+
// Windows is unsupported because we use the Unix path separator `\`.
3+
4+
// Add default directories before running clang to check default
5+
// search paths.
6+
// RUN: rm -rf %t && mkdir -p %t
7+
// RUN: cp -R %S/Inputs/MacOSX15.1.sdk %t/
8+
// RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/Frameworks
9+
// RUN: mkdir -p %t/MacOSX15.1.sdk/System/Library/SubFrameworks
10+
// RUN: mkdir -p %t/MacOSX15.1.sdk/usr/include
11+
12+
// RUN: %clang %s -target arm64-apple-darwin13.0 -isysroot %t/MacOSX15.1.sdk -E -v 2>&1 | FileCheck %s
13+
14+
// CHECK: -isysroot [[PATH:[^ ]*/MacOSX15.1.sdk]]
15+
// CHECK: #include <...> search starts here:
16+
// CHECK: [[PATH]]/usr/include
17+
// CHECK: [[PATH]]/System/Library/Frameworks (framework directory)
18+
// CHECK: [[PATH]]/System/Library/SubFrameworks (framework directory)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// RUN: %clang_cc1 -std=gnu++20 -fsyntax-only -ast-dump %s | FileCheck %s
2+
3+
void f() {
4+
[[clang::annotate("decl", 1)]] int i = 0;
5+
[[clang::annotate("stmt", 2)]] i += 1;
6+
[[clang::annotate("label", 3)]] label1:
7+
i += 2;
8+
}
9+
10+
// CHECK: -FunctionDecl {{.*}} f 'void ()'
11+
// CHECK: -VarDecl {{.*}} used i 'int'
12+
// CHECK: -AnnotateAttr {{.*}} "decl"
13+
// CHECK: -IntegerLiteral {{.*}} 'int' 1
14+
// CHECK: -AttributedStmt
15+
// CHECK: -AnnotateAttr {{.*}} "stmt"
16+
// CHECK: -IntegerLiteral {{.*}} 'int' 2
17+
// CHECK: -LabelStmt {{.*}} 'label1'
18+
// CHECK: -AnnotateAttr {{.*}} "label"
19+
// CHECK: -IntegerLiteral {{.*}} 'int' 3
20+
// CHECK: -CompoundAssignOperator
21+
22+
template <typename T> void g() {
23+
[[clang::annotate("tmpl_decl", 4)]] T j = 0;
24+
[[clang::annotate("tmpl_stmt", 5)]] j += 1;
25+
[[clang::annotate("tmpl_label", 6)]] label2:
26+
j += 2;
27+
}
28+
29+
// CHECK: -FunctionTemplateDecl {{.*}} g
30+
// CHECK: -VarDecl {{.*}} referenced j 'T'
31+
// CHECK: -AnnotateAttr {{.*}} "tmpl_decl"
32+
// CHECK: -IntegerLiteral {{.*}} 'int' 4
33+
// CHECK: -AttributedStmt
34+
// CHECK: -AnnotateAttr {{.*}} "tmpl_stmt"
35+
// CHECK: -IntegerLiteral {{.*}} 'int' 5
36+
// CHECK: -LabelStmt {{.*}} 'label2'
37+
// CHECK: -AnnotateAttr {{.*}} "tmpl_label"
38+
// CHECK: -IntegerLiteral {{.*}} 'int' 6
39+
// CHECK: -CompoundAssignOperator
40+
41+
void h() {
42+
g<int>();
43+
}
44+
45+
// CHECK: -FunctionDecl {{.*}} used g 'void ()' implicit_instantiation
46+
// CHECK: -VarDecl {{.*}} used j 'int'
47+
// CHECK: -AnnotateAttr {{.*}} "tmpl_decl"
48+
// CHECK: -IntegerLiteral {{.*}} 'int' 4
49+
// CHECK: -AttributedStmt
50+
// CHECK: -AnnotateAttr {{.*}} Implicit "tmpl_stmt"
51+
// CHECK: -IntegerLiteral {{.*}} 'int' 5
52+
// CHECK: -LabelStmt {{.*}} 'label2'
53+
// CHECK: -AnnotateAttr {{.*}} "tmpl_label"
54+
// CHECK: -IntegerLiteral {{.*}} 'int' 6
55+
// CHECK: -CompoundAssignOperator

clang/www/c_status.html

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ <h2 id="c2x">C23 implementation status</h2>
289289
<td class="full" align="center">Clang 9</td>
290290
</tr>
291291
<tr id="TS18661">
292-
<td rowspan="8">TS 18661 Integration</td>
292+
<td rowspan="9">TS 18661 Integration</td>
293293
</tr>
294294
<tr> <!-- Pre-Oct 2019 -->
295295
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2314.pdf">N2314</a></td>
@@ -319,6 +319,10 @@ <h2 id="c2x">C23 implementation status</h2>
319319
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2931.pdf">N2931</a></td>
320320
<td class="none" align="center">No</td>
321321
</tr>
322+
<tr>
323+
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2754.htm">N2754</a></td>
324+
<td class="none" align="center">No</td>
325+
</tr>
322326
<tr>
323327
<td>Preprocessor line numbers unspecified</td>
324328
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2322.htm">N2322</a></td>
@@ -626,11 +630,6 @@ <h2 id="c2x">C23 implementation status</h2>
626630
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2701.htm">N2701</a></td>
627631
<td class="full" align="center">Yes</td>
628632
</tr>
629-
<tr>
630-
<td>Quantum exponent of NaN (version 2)</td>
631-
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2754.htm">N2754</a></td>
632-
<td class="unknown" align="center">Unknown</td>
633-
</tr>
634633
<tr>
635634
<td>The noreturn attribute</td>
636635
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2764.pdf">N2764</a></td>

flang/include/flang/Semantics/openmp-directive-sets.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ static const OmpDirectiveSet workShareSet{
290290
} | allDoSet,
291291
};
292292

293+
//===----------------------------------------------------------------------===//
294+
// Directive sets for parent directives that do allow/not allow a construct
295+
//===----------------------------------------------------------------------===//
296+
297+
static const OmpDirectiveSet scanParentAllowedSet{allDoSet | allSimdSet};
298+
293299
//===----------------------------------------------------------------------===//
294300
// Directive sets for allowed/not allowed nested directives
295301
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)