Skip to content

Commit 879aff1

Browse files
committed
Merge from 'main' to 'sycl-web' (#2)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/CodeGenModule.cpp
2 parents fa7ea91 + d3d4d98 commit 879aff1

File tree

628 files changed

+15863
-3535
lines changed

Some content is hidden

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

628 files changed

+15863
-3535
lines changed

clang-tools-extra/clangd/CompileCommands.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ const llvm::Optional<std::string> detectSysroot() {
127127
if (::getenv("SDKROOT"))
128128
return llvm::None;
129129
return queryXcrun({"xcrun", "--show-sdk-path"});
130-
return llvm::None;
131130
}
132131

133132
std::string detectStandardResourceDir() {

clang/docs/AddressSanitizer.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ Code generation control
282282
Instrumentation code outlining
283283
------------------------------
284284

285-
By default AddressSanitizer inlines the instumentation code to improve the
285+
By default AddressSanitizer inlines the instrumentation code to improve the
286286
run-time performance, which leads to increased binary size. Using the
287287
(clang flag ``-fsanitize-address-outline-instrumentation` default: ``false``)
288-
flag forces all code instumentation to be outlined, which reduces the size
289-
of the generated code, but also reduces the run-time performace.
288+
flag forces all code instrumentation to be outlined, which reduces the size
289+
of the generated code, but also reduces the run-time performance.
290290

291291
Limitations
292292
===========

clang/docs/ClangCommandLineReference.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ Enable support for int128\_t type
17051705

17061706
.. option:: -ffp-contract=<arg>
17071707

1708-
Form fused FP ops (e.g. FMAs): fast (fuses across statements disregarding pragmas) \| on (only fuses in the same statement unless dictated by pragmas) \| off (never fuses) \| fast-honor-pragmas (fuses across statements unless diectated by pragmas). Default is 'fast' for CUDA, 'fast-honor-pragmas' for HIP, and 'on' otherwise.
1708+
Form fused FP ops (e.g. FMAs): fast (fuses across statements disregarding pragmas) \| on (only fuses in the same statement unless dictated by pragmas) \| off (never fuses) \| fast-honor-pragmas (fuses across statements unless dictated by pragmas). Default is 'fast' for CUDA, 'fast-honor-pragmas' for HIP, and 'on' otherwise.
17091709

17101710
.. option:: -ffp-exception-behavior=<arg>
17111711

@@ -2543,7 +2543,7 @@ Give global types 'default' visibility and global functions and variables 'hidde
25432543

25442544
.. option:: -fvisibility-nodllstorageclass=<arg>
25452545

2546-
The visibility for defintiions without an explicit DLL export class \[-fvisibility-from-dllstorageclass\]
2546+
The visibility for definitions without an explicit DLL export class \[-fvisibility-from-dllstorageclass\]
25472547

25482548
.. option:: -fvisibility=<arg>
25492549

clang/docs/ClangFormatStyleOptions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3541,7 +3541,7 @@ the configuration (without a prefix: ``Auto``).
35413541
ForEach and If macros. This is useful in projects where ForEach/If
35423542
macros are treated as function calls instead of control statements.
35433543
``SBPO_ControlStatementsExceptForEachMacros`` remains an alias for
3544-
backward compatability.
3544+
backward compatibility.
35453545

35463546
.. code-block:: c++
35473547

clang/docs/DataFlowSanitizerDesign.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Origin tracking trace representation
139139
------------------------------------
140140

141141
An origin tracking trace is a list of chains. Each chain has a stack trace
142-
where the DFSan runtime records a label propapation, and a pointer to its
142+
where the DFSan runtime records a label propagation, and a pointer to its
143143
previous chain. The very first chain does not point to any chain.
144144

145145
Every four 4-bytes aligned application bytes share a 4-byte origin trace ID. A

clang/docs/IntroductionToTheClangAST.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ clang ParenExpr).
3232
Examining the AST
3333
=================
3434

35-
A good way to familarize yourself with the Clang AST is to actually look
35+
A good way to familiarize yourself with the Clang AST is to actually look
3636
at it on some simple example code. Clang has a builtin AST-dump mode,
3737
which can be enabled with the flag ``-ast-dump``.
3838

clang/docs/MemorySanitizer.rst

+9
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ particular function. MemorySanitizer may still instrument such functions to
8585
avoid false positives. This attribute may not be supported by other compilers,
8686
so we suggest to use it together with ``__has_feature(memory_sanitizer)``.
8787

88+
``__attribute__((disable_sanitizer_instrumentation))``
89+
--------------------------------------------------------
90+
91+
The ``disable_sanitizer_instrumentation`` attribute can be applied to functions
92+
to prevent all kinds of instrumentation. As a result, it may introduce false
93+
positives and therefore should be used with care, and only if absolutely
94+
required; for example for certain code that cannot tolerate any instrumentation
95+
and resulting side-effects. This attribute overrides ``no_sanitize("memory")``.
96+
8897
Ignorelist
8998
----------
9099

clang/docs/OpenMPSupport.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ implementation.
133133
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
134134
| loop extension | inclusive scan extension (matching C++17 PSTL) | :good:`done` | |
135135
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
136-
| memory mangagement | memory allocators | :good:`done` | r341687,r357929 |
136+
| memory management | memory allocators | :good:`done` | r341687,r357929 |
137137
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
138-
| memory mangagement | allocate directive and allocate clause | :good:`done` | r355614,r335952 |
138+
| memory management | allocate directive and allocate clause | :good:`done` | r355614,r335952 |
139139
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
140140
| OMPD | OMPD interfaces | :part:`not upstream` | https://github.com/OpenMPToolsInterface/LLVM-openmp/tree/ompd-tests |
141141
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ Windows Support
100100
C Language Changes in Clang
101101
---------------------------
102102

103-
- ...
103+
- Wide multi-characters literals such as ``L'ab'`` that would previously be interpreted as ``L'b'``
104+
are now ill-formed in all language modes. The motivation for this change is outlined in
105+
`P2362 <wg21.link/P2362>`_.
104106

105107
C++ Language Changes in Clang
106108
-----------------------------

clang/docs/ThreadSanitizer.rst

+10
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ instruments such functions to avoid false positives and provide meaningful stack
100100
traces. This attribute may not be supported by other compilers, so we suggest
101101
to use it together with ``__has_feature(thread_sanitizer)``.
102102

103+
``__attribute__((disable_sanitizer_instrumentation))``
104+
--------------------------------------------------------
105+
106+
The ``disable_sanitizer_instrumentation`` attribute can be applied to functions
107+
to prevent all kinds of instrumentation. As a result, it may introduce false
108+
positives and incorrect stack traces. Therefore, it should be used with care,
109+
and only if absolutely required; for example for certain code that cannot
110+
tolerate any instrumentation and resulting side-effects. This attribute
111+
overrides ``no_sanitize("thread")``.
112+
103113
Ignorelist
104114
----------
105115

clang/include/clang/AST/Decl.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
615615
if (!isInline())
616616
return false;
617617
auto X = lookup(Name);
618-
auto Y = getParent()->lookup(Name);
618+
// We should not perform a lookup within a transparent context, so find a
619+
// non-transparent parent context.
620+
auto Y = getParent()->getNonTransparentContext()->lookup(Name);
619621
return std::distance(X.begin(), X.end()) ==
620622
std::distance(Y.begin(), Y.end());
621623
}

clang/include/clang/AST/DeclBase.h

+6
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,12 @@ class DeclContext {
19971997
return const_cast<DeclContext*>(this)->getNonClosureAncestor();
19981998
}
19991999

2000+
// Retrieve the nearest context that is not a transparent context.
2001+
DeclContext *getNonTransparentContext();
2002+
const DeclContext *getNonTransparentContext() const {
2003+
return const_cast<DeclContext *>(this)->getNonTransparentContext();
2004+
}
2005+
20002006
/// getPrimaryContext - There may be many different
20012007
/// declarations of the same entity (including forward declarations
20022008
/// of classes, multiple definitions of namespaces, etc.), each with

clang/include/clang/AST/Type.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,12 @@ class Qualifiers {
495495
(A == LangAS::Default &&
496496
(B == LangAS::sycl_private || B == LangAS::sycl_local ||
497497
B == LangAS::sycl_global || B == LangAS::sycl_global_device ||
498-
B == LangAS::sycl_global_host));
498+
B == LangAS::sycl_global_host)) ||
499+
// In HIP device compilation, any cuda address space is allowed
500+
// to implicitly cast into the default address space.
501+
(A == LangAS::Default &&
502+
(B == LangAS::cuda_constant || B == LangAS::cuda_device ||
503+
B == LangAS::cuda_shared));
499504
}
500505

501506
/// Returns true if the address space in these qualifiers is equal to or

clang/include/clang/Basic/Attr.td

+7
Original file line numberDiff line numberDiff line change
@@ -3607,6 +3607,13 @@ def NoSanitizeSpecific : InheritableAttr {
36073607
let ASTNode = 0;
36083608
}
36093609

3610+
def DisableSanitizerInstrumentation : InheritableAttr {
3611+
let Spellings = [Clang<"disable_sanitizer_instrumentation">];
3612+
let Subjects = SubjectList<[Function, ObjCMethod, GlobalVar]>;
3613+
let Documentation = [DisableSanitizerInstrumentationDocs];
3614+
let SimpleHandler = 1;
3615+
}
3616+
36103617
def CFICanonicalJumpTable : InheritableAttr {
36113618
let Spellings = [Clang<"cfi_canonical_jump_table">];
36123619
let Subjects = SubjectList<[Function], ErrorDiag>;

clang/include/clang/Basic/AttrDocs.td

+12
Original file line numberDiff line numberDiff line change
@@ -3825,6 +3825,18 @@ full list of supported sanitizer flags.
38253825
}];
38263826
}
38273827

3828+
def DisableSanitizerInstrumentationDocs : Documentation {
3829+
let Category = DocCatFunction;
3830+
let Content = [{
3831+
Use the ``disable_sanitizer_instrumentation`` attribute on a function,
3832+
Objective-C method, or global variable, to specify that no sanitizer
3833+
instrumentation should be applied.
3834+
3835+
This is not the same as ``__attribute__((no_sanitize(...)))``, which depending
3836+
on the tool may still insert instrumentation to prevent false positive reports.
3837+
}];
3838+
}
3839+
38283840
def NoSanitizeAddressDocs : Documentation {
38293841
let Category = DocCatFunction;
38303842
// This function has multiple distinct spellings, and so it requires a custom

clang/include/clang/Basic/BuiltinsWebAssembly.def

+4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,12 @@ TARGET_BUILTIN(__builtin_wasm_abs_f64x2, "V2dV2d", "nc", "simd128")
129129

130130
TARGET_BUILTIN(__builtin_wasm_min_f32x4, "V4fV4fV4f", "nc", "simd128")
131131
TARGET_BUILTIN(__builtin_wasm_max_f32x4, "V4fV4fV4f", "nc", "simd128")
132+
TARGET_BUILTIN(__builtin_wasm_pmin_f32x4, "V4fV4fV4f", "nc", "simd128")
133+
TARGET_BUILTIN(__builtin_wasm_pmax_f32x4, "V4fV4fV4f", "nc", "simd128")
132134
TARGET_BUILTIN(__builtin_wasm_min_f64x2, "V2dV2dV2d", "nc", "simd128")
133135
TARGET_BUILTIN(__builtin_wasm_max_f64x2, "V2dV2dV2d", "nc", "simd128")
136+
TARGET_BUILTIN(__builtin_wasm_pmin_f64x2, "V2dV2dV2d", "nc", "simd128")
137+
TARGET_BUILTIN(__builtin_wasm_pmax_f64x2, "V2dV2dV2d", "nc", "simd128")
134138

135139
TARGET_BUILTIN(__builtin_wasm_ceil_f32x4, "V4fV4f", "nc", "simd128")
136140
TARGET_BUILTIN(__builtin_wasm_floor_f32x4, "V4fV4f", "nc", "simd128")

clang/include/clang/Basic/BuiltinsX86.def

+41
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,47 @@ TARGET_BUILTIN(__builtin_ia32_cmpsh_mask, "UcV8xV8xIiUcIi", "ncV:128:", "avx512f
18761876
TARGET_BUILTIN(__builtin_ia32_loadsh128_mask, "V8xV8x*V8xUc", "nV:128:", "avx512fp16")
18771877
TARGET_BUILTIN(__builtin_ia32_storesh128_mask, "vV8x*V8xUc", "nV:128:", "avx512fp16")
18781878

1879+
TARGET_BUILTIN(__builtin_ia32_rcpph128_mask, "V8xV8xV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1880+
TARGET_BUILTIN(__builtin_ia32_rcpph256_mask, "V16xV16xV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1881+
TARGET_BUILTIN(__builtin_ia32_rcpph512_mask, "V32xV32xV32xUi", "ncV:512:", "avx512fp16")
1882+
TARGET_BUILTIN(__builtin_ia32_rsqrtph128_mask, "V8xV8xV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1883+
TARGET_BUILTIN(__builtin_ia32_rsqrtph256_mask, "V16xV16xV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1884+
TARGET_BUILTIN(__builtin_ia32_rsqrtph512_mask, "V32xV32xV32xUi", "ncV:512:", "avx512fp16")
1885+
TARGET_BUILTIN(__builtin_ia32_getmantph128_mask, "V8xV8xIiV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1886+
TARGET_BUILTIN(__builtin_ia32_getmantph256_mask, "V16xV16xIiV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1887+
TARGET_BUILTIN(__builtin_ia32_getmantph512_mask, "V32xV32xIiV32xUiIi", "ncV:512:", "avx512fp16")
1888+
1889+
TARGET_BUILTIN(__builtin_ia32_getexpph128_mask, "V8xV8xV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1890+
TARGET_BUILTIN(__builtin_ia32_getexpph256_mask, "V16xV16xV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1891+
TARGET_BUILTIN(__builtin_ia32_getexpph512_mask, "V32xV32xV32xUiIi", "ncV:512:", "avx512fp16")
1892+
1893+
TARGET_BUILTIN(__builtin_ia32_scalefph128_mask, "V8xV8xV8xV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1894+
TARGET_BUILTIN(__builtin_ia32_scalefph256_mask, "V16xV16xV16xV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1895+
TARGET_BUILTIN(__builtin_ia32_scalefph512_mask, "V32xV32xV32xV32xUiIi", "ncV:512:", "avx512fp16")
1896+
1897+
TARGET_BUILTIN(__builtin_ia32_rndscaleph_128_mask, "V8xV8xIiV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1898+
TARGET_BUILTIN(__builtin_ia32_rndscaleph_256_mask, "V16xV16xIiV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1899+
TARGET_BUILTIN(__builtin_ia32_rndscaleph_mask, "V32xV32xIiV32xUiIi", "ncV:512:", "avx512fp16")
1900+
TARGET_BUILTIN(__builtin_ia32_reduceph128_mask, "V8xV8xIiV8xUc", "ncV:128:", "avx512fp16,avx512vl")
1901+
TARGET_BUILTIN(__builtin_ia32_reduceph256_mask, "V16xV16xIiV16xUs", "ncV:256:", "avx512fp16,avx512vl")
1902+
TARGET_BUILTIN(__builtin_ia32_reduceph512_mask, "V32xV32xIiV32xUiIi", "ncV:512:", "avx512fp16")
1903+
TARGET_BUILTIN(__builtin_ia32_rcpsh_mask, "V8xV8xV8xV8xUc", "ncV:128:", "avx512fp16")
1904+
TARGET_BUILTIN(__builtin_ia32_rsqrtsh_mask, "V8xV8xV8xV8xUc", "ncV:128:", "avx512fp16")
1905+
TARGET_BUILTIN(__builtin_ia32_getmantsh_round_mask, "V8xV8xV8xIiV8xUcIi", "ncV:128:", "avx512fp16")
1906+
TARGET_BUILTIN(__builtin_ia32_getexpsh128_round_mask, "V8xV8xV8xV8xUcIi", "ncV:128:", "avx512fp16")
1907+
TARGET_BUILTIN(__builtin_ia32_scalefsh_round_mask, "V8xV8xV8xV8xUcIi", "ncV:128:", "avx512fp16")
1908+
TARGET_BUILTIN(__builtin_ia32_rndscalesh_round_mask, "V8xV8xV8xV8xUcIiIi", "ncV:128:", "avx512fp16")
1909+
TARGET_BUILTIN(__builtin_ia32_reducesh_mask, "V8xV8xV8xV8xUcIiIi", "ncV:128:", "avx512fp16")
1910+
1911+
TARGET_BUILTIN(__builtin_ia32_sqrtph, "V8xV8x", "ncV:128:", "avx512fp16,avx512vl")
1912+
TARGET_BUILTIN(__builtin_ia32_sqrtph256, "V16xV16x", "ncV:256:", "avx512fp16,avx512vl")
1913+
TARGET_BUILTIN(__builtin_ia32_sqrtph512, "V32xV32xIi", "ncV:512:", "avx512fp16")
1914+
TARGET_BUILTIN(__builtin_ia32_sqrtsh_round_mask, "V8xV8xV8xV8xUcIi", "ncV:128:", "avx512fp16")
1915+
TARGET_BUILTIN(__builtin_ia32_fpclassph128_mask, "UcV8xIiUc", "ncV:128:", "avx512fp16,avx512vl")
1916+
TARGET_BUILTIN(__builtin_ia32_fpclassph256_mask, "UsV16xIiUs", "ncV:256:", "avx512fp16,avx512vl")
1917+
TARGET_BUILTIN(__builtin_ia32_fpclassph512_mask, "UiV32xIiUi", "ncV:512:", "avx512fp16")
1918+
TARGET_BUILTIN(__builtin_ia32_fpclasssh_mask, "UcV8xIiUc", "ncV:128:", "avx512fp16")
1919+
18791920
TARGET_BUILTIN(__builtin_ia32_vcvtpd2ph128_mask, "V8xV2dV8xUc", "ncV:128:", "avx512fp16,avx512vl")
18801921
TARGET_BUILTIN(__builtin_ia32_vcvtpd2ph256_mask, "V8xV4dV8xUc", "ncV:256:", "avx512fp16,avx512vl")
18811922
TARGET_BUILTIN(__builtin_ia32_vcvtpd2ph512_mask, "V8xV8dV8xUcIi", "ncV:512:", "avx512fp16")

clang/include/clang/Basic/DiagnosticLexKinds.td

+2-4
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,10 @@ def warn_c2x_compat_digit_separator : Warning<
183183
InGroup<CPre2xCompat>, DefaultIgnore;
184184
def err_digit_separator_not_between_digits : Error<
185185
"digit separator cannot appear at %select{start|end}0 of digit sequence">;
186-
def warn_extraneous_char_constant : Warning<
187-
"extraneous characters in character constant ignored">;
188186
def warn_char_constant_too_large : Warning<
189187
"character constant too long for its type">;
190-
def err_multichar_utf_character_literal : Error<
191-
"Unicode character literals may not contain multiple characters">;
188+
def err_multichar_character_literal : Error<
189+
"%select{wide|Unicode}0 character literals may not contain multiple characters">;
192190
def err_exponent_has_no_digits : Error<"exponent has no digits">;
193191
def err_hex_constant_requires : Error<
194192
"hexadecimal floating %select{constant|literal}0 requires "

clang/include/clang/Driver/Options.td

-1
Original file line numberDiff line numberDiff line change
@@ -4402,7 +4402,6 @@ def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
44024402
// These are legacy user-facing driver-level option spellings. They are always
44034403
// aliases for options that are spelled using the more common Unix / GNU flag
44044404
// style of double-dash and equals-joined flags.
4405-
def gcc_toolchain_legacy_spelling : Separate<["-"], "gcc-toolchain">, Alias<gcc_toolchain>;
44064405
def target_legacy_spelling : Separate<["-"], "target">, Alias<target>;
44074406

44084407
// Special internal option to handle -Xlinker --no-demangle.

clang/lib/AST/ASTContext.cpp

+19-20
Original file line numberDiff line numberDiff line change
@@ -172,29 +172,28 @@ static SourceLocation getDeclLocForCommentSearch(const Decl *D,
172172
// Allow association with Y across {} in `typedef struct X {} Y`.
173173
isa<TypedefDecl>(D))
174174
return D->getBeginLoc();
175-
else {
176-
const SourceLocation DeclLoc = D->getLocation();
177-
if (DeclLoc.isMacroID()) {
178-
if (isa<TypedefDecl>(D)) {
179-
// If location of the typedef name is in a macro, it is because being
180-
// declared via a macro. Try using declaration's starting location as
181-
// the "declaration location".
182-
return D->getBeginLoc();
183-
} else if (const auto *TD = dyn_cast<TagDecl>(D)) {
184-
// If location of the tag decl is inside a macro, but the spelling of
185-
// the tag name comes from a macro argument, it looks like a special
186-
// macro like NS_ENUM is being used to define the tag decl. In that
187-
// case, adjust the source location to the expansion loc so that we can
188-
// attach the comment to the tag decl.
189-
if (SourceMgr.isMacroArgExpansion(DeclLoc) &&
190-
TD->isCompleteDefinition())
191-
return SourceMgr.getExpansionLoc(DeclLoc);
192-
}
175+
176+
const SourceLocation DeclLoc = D->getLocation();
177+
if (DeclLoc.isMacroID()) {
178+
if (isa<TypedefDecl>(D)) {
179+
// If location of the typedef name is in a macro, it is because being
180+
// declared via a macro. Try using declaration's starting location as
181+
// the "declaration location".
182+
return D->getBeginLoc();
183+
}
184+
185+
if (const auto *TD = dyn_cast<TagDecl>(D)) {
186+
// If location of the tag decl is inside a macro, but the spelling of
187+
// the tag name comes from a macro argument, it looks like a special
188+
// macro like NS_ENUM is being used to define the tag decl. In that
189+
// case, adjust the source location to the expansion loc so that we can
190+
// attach the comment to the tag decl.
191+
if (SourceMgr.isMacroArgExpansion(DeclLoc) && TD->isCompleteDefinition())
192+
return SourceMgr.getExpansionLoc(DeclLoc);
193193
}
194-
return DeclLoc;
195194
}
196195

197-
return {};
196+
return DeclLoc;
198197
}
199198

200199
RawComment *ASTContext::getRawCommentForDeclNoCacheImpl(

clang/lib/AST/DeclBase.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,15 @@ bool DeclContext::Encloses(const DeclContext *DC) const {
12171217
return false;
12181218
}
12191219

1220+
DeclContext *DeclContext::getNonTransparentContext() {
1221+
DeclContext *DC = this;
1222+
while (DC->isTransparentContext()) {
1223+
DC = DC->getParent();
1224+
assert(DC && "All transparent contexts should have a parent!");
1225+
}
1226+
return DC;
1227+
}
1228+
12201229
DeclContext *DeclContext::getPrimaryContext() {
12211230
switch (getDeclKind()) {
12221231
case Decl::ExternCContext:

clang/lib/Basic/LangOptions.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ bool LangOptions::isNoBuiltinFunc(StringRef FuncName) const {
4747

4848
VersionTuple LangOptions::getOpenCLVersionTuple() const {
4949
const int Ver = OpenCLCPlusPlus ? OpenCLCPlusPlusVersion : OpenCLVersion;
50+
if (OpenCLCPlusPlus && Ver != 100)
51+
return VersionTuple(Ver / 100);
5052
return VersionTuple(Ver / 100, (Ver % 100) / 10);
5153
}
5254

clang/lib/Basic/Targets/AMDGPU.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,18 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
352352
}
353353

354354
LangAS getCUDABuiltinAddressSpace(unsigned AS) const override {
355-
return LangAS::Default;
355+
switch (AS) {
356+
case 0:
357+
return LangAS::Default;
358+
case 1:
359+
return LangAS::cuda_device;
360+
case 3:
361+
return LangAS::cuda_shared;
362+
case 4:
363+
return LangAS::cuda_constant;
364+
default:
365+
return getLangASFromTargetAS(AS);
366+
}
356367
}
357368

358369
llvm::Optional<LangAS> getConstantAddressSpace() const override {

0 commit comments

Comments
 (0)