Skip to content

Commit 454587a

Browse files
authored
Merge branch 'main' into add-noalias.addrspace-attribute-for-load-and-store
2 parents e895abd + b144258 commit 454587a

File tree

260 files changed

+14672
-2219
lines changed

Some content is hidden

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

260 files changed

+14672
-2219
lines changed

clang-tools-extra/clangd/unittests/InlayHintTests.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,19 +1577,21 @@ TEST(TypeHints, Aliased) {
15771577
}
15781578

15791579
TEST(TypeHints, CallingConvention) {
1580-
// Check that we don't crash for lambdas without a FunctionTypeLoc
1580+
// Check that we don't crash for lambdas with an annotation
15811581
// https://github.com/clangd/clangd/issues/2223
1582-
std::string Code = R"cpp(
1582+
Annotations Source(R"cpp(
15831583
void test() {
1584-
[]() __cdecl {};
1584+
[]($lambda[[)]]__cdecl {};
15851585
}
1586-
)cpp";
1587-
TestTU TU = TestTU::withCode(Code);
1586+
)cpp");
1587+
TestTU TU = TestTU::withCode(Source.code());
15881588
TU.ExtraArgs.push_back("--target=x86_64-w64-mingw32");
15891589
TU.PredefineMacros = true; // for the __cdecl
15901590
auto AST = TU.build();
15911591

1592-
EXPECT_THAT(hintsOfKind(AST, InlayHintKind::Type), IsEmpty());
1592+
EXPECT_THAT(
1593+
hintsOfKind(AST, InlayHintKind::Type),
1594+
ElementsAre(HintMatcher(ExpectedHint{"-> void", "lambda"}, Source)));
15931595
}
15941596

15951597
TEST(TypeHints, Decltype) {

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ related warnings within the method body.
301301
particularly relevant for AMDGPU targets, where they map to corresponding IR
302302
metadata.
303303

304+
- Clang now disallows the use of attributes applied before an
305+
``extern template`` declaration (#GH79893).
306+
304307
Improvements to Clang's diagnostics
305308
-----------------------------------
306309

@@ -395,14 +398,16 @@ Improvements to Clang's diagnostics
395398
constructors to initialize their non-modifiable members. The diagnostic is
396399
not new; being controlled via a warning group is what's new. Fixes #GH41104
397400

401+
402+
- Improved Clang's error recovery for invalid function calls.
403+
398404
- Improved bit-field diagnostics to consider the type specified by the
399405
``preferred_type`` attribute. These diagnostics are controlled by the flags
400406
``-Wpreferred-type-bitfield-enum-conversion`` and
401407
``-Wpreferred-type-bitfield-width``. These warnings are on by default as they
402408
they're only triggered if the authors are already making the choice to use
403409
``preferred_type`` attribute.
404410

405-
406411
Improvements to Clang's time-trace
407412
----------------------------------
408413

clang/include/clang/Basic/BuiltinHeaders.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
HEADER(NO_HEADER, nullptr)
15+
HEADER(ARMACLE_H, "arm_acle.h")
1516
HEADER(BLOCKS_H, "Blocks.h")
1617
HEADER(COMPLEX_H, "complex.h")
1718
HEADER(CTYPE_H, "ctype.h")

clang/include/clang/Basic/BuiltinsAArch64.def

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ BUILTIN(__builtin_arm_wfi, "v", "")
5050
BUILTIN(__builtin_arm_sev, "v", "")
5151
BUILTIN(__builtin_arm_sevl, "v", "")
5252
BUILTIN(__builtin_arm_chkfeat, "WUiWUi", "")
53+
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
54+
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
55+
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
56+
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
57+
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
5358

5459
// Like __builtin_trap but provide an 16-bit immediate reason code (which goes into `brk #N`).
5560
BUILTIN(__builtin_arm_trap, "vUIs", "nr")
@@ -82,6 +87,9 @@ TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")
8287
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
8388
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
8489
BUILTIN(__builtin_arm_isb, "vUi", "nc")
90+
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
91+
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
92+
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
8593

8694
TARGET_BUILTIN(__builtin_arm_jcvt, "Zid", "nc", "v8.3a")
8795

@@ -98,16 +106,6 @@ BUILTIN(__builtin_arm_wsr64, "vcC*WUi", "nc")
98106
TARGET_BUILTIN(__builtin_arm_wsr128, "vcC*LLLUi", "nc", "d128")
99107
BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc")
100108

101-
// MSVC
102-
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
103-
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
104-
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
105-
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
106-
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
107-
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
108-
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
109-
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
110-
111109
// Misc
112110
BUILTIN(__builtin_sponentry, "v*", "c")
113111

clang/include/clang/Basic/BuiltinsARM.def

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,19 @@ BUILTIN(__builtin_arm_wfi, "v", "")
186186
BUILTIN(__builtin_arm_sev, "v", "")
187187
BUILTIN(__builtin_arm_sevl, "v", "")
188188
BUILTIN(__builtin_arm_dbg, "vUi", "")
189+
TARGET_HEADER_BUILTIN(__yield, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
190+
TARGET_HEADER_BUILTIN(__wfe, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
191+
TARGET_HEADER_BUILTIN(__wfi, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
192+
TARGET_HEADER_BUILTIN(__sev, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
193+
TARGET_HEADER_BUILTIN(__sevl, "v", "h", ARMACLE_H, ALL_LANGUAGES, "")
189194

190195
// Data barrier
191196
BUILTIN(__builtin_arm_dmb, "vUi", "nc")
192197
BUILTIN(__builtin_arm_dsb, "vUi", "nc")
193198
BUILTIN(__builtin_arm_isb, "vUi", "nc")
199+
TARGET_HEADER_BUILTIN(__dmb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
200+
TARGET_HEADER_BUILTIN(__dsb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
201+
TARGET_HEADER_BUILTIN(__isb, "vUi", "nch", ARMACLE_H, ALL_LANGUAGES, "")
194202

195203
// Prefetch
196204
BUILTIN(__builtin_arm_prefetch, "vvC*UiUi", "nc")
@@ -209,15 +217,6 @@ BUILTIN(__builtin_sponentry, "v*", "c")
209217
// MSVC
210218
LANGBUILTIN(__emit, "vIUiC", "", ALL_MS_LANGUAGES)
211219

212-
LANGBUILTIN(__yield, "v", "", ALL_MS_LANGUAGES)
213-
LANGBUILTIN(__wfe, "v", "", ALL_MS_LANGUAGES)
214-
LANGBUILTIN(__wfi, "v", "", ALL_MS_LANGUAGES)
215-
LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES)
216-
LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES)
217-
218-
LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
219-
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
220-
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
221220
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
222221
LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
223222
LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)

clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct RecordTypeStorage : public mlir::TypeStorage {
5454
RecordType::RecordKind kind)
5555
: members(members), name(name), incomplete(incomplete), packed(packed),
5656
padded(padded), kind(kind) {
57-
assert(name || !incomplete && "Incomplete records must have a name");
57+
assert((name || !incomplete) && "Incomplete records must have a name");
5858
}
5959

6060
KeyTy getAsKey() const {

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4702,15 +4702,17 @@ def EB : Flag<["-"], "EB">, Alias<mbig_endian>;
47024702
def m16 : Flag<["-"], "m16">, Group<m_Group>, Flags<[NoXarchOption]>,
47034703
Visibility<[ClangOption, CLOption, DXCOption]>;
47044704
def m32 : Flag<["-"], "m32">, Group<m_Group>, Flags<[NoXarchOption]>,
4705-
Visibility<[ClangOption, CLOption, DXCOption]>;
4706-
def maix32 : Flag<["-"], "maix32">, Group<m_Group>, Flags<[NoXarchOption]>;
4705+
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>;
4706+
def maix32 : Flag<["-"], "maix32">, Group<m_Group>, Flags<[NoXarchOption]>,
4707+
Visibility<[FlangOption]>;
47074708
def mqdsp6_compat : Flag<["-"], "mqdsp6-compat">, Group<m_Group>,
47084709
Flags<[NoXarchOption]>, Visibility<[ClangOption, CC1Option]>,
47094710
HelpText<"Enable hexagon-qdsp6 backward compatibility">,
47104711
MarshallingInfoFlag<LangOpts<"HexagonQdsp6Compat">>;
47114712
def m64 : Flag<["-"], "m64">, Group<m_Group>, Flags<[NoXarchOption]>,
47124713
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>;
4713-
def maix64 : Flag<["-"], "maix64">, Group<m_Group>, Flags<[NoXarchOption]>;
4714+
def maix64 : Flag<["-"], "maix64">, Group<m_Group>, Flags<[NoXarchOption]>,
4715+
Visibility<[FlangOption]>;
47144716
def mx32 : Flag<["-"], "mx32">, Group<m_Group>, Flags<[NoXarchOption]>,
47154717
Visibility<[ClangOption, CLOption, DXCOption]>;
47164718
def miamcu : Flag<["-"], "miamcu">, Group<m_Group>, Flags<[NoXarchOption]>,

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,18 +845,25 @@ class CompilerInstance : public ModuleLoader {
845845
/// Creates a \c CompilerInstance for compiling a module.
846846
///
847847
/// This expects a properly initialized \c FrontendInputFile.
848+
///
849+
/// Explicitly-specified \c VFS takes precedence over the VFS of this instance
850+
/// when creating the clone and also prevents \c FileManager sharing.
848851
std::unique_ptr<CompilerInstance> cloneForModuleCompileImpl(
849852
SourceLocation ImportLoc, StringRef ModuleName, FrontendInputFile Input,
850-
StringRef OriginalModuleMapFile, StringRef ModuleFileName);
853+
StringRef OriginalModuleMapFile, StringRef ModuleFileName,
854+
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
851855

852856
public:
853857
/// Creates a new \c CompilerInstance for compiling a module.
854858
///
855859
/// This takes care of creating appropriate \c FrontendInputFile for
856860
/// public/private frameworks, inferred modules and such.
857-
std::unique_ptr<CompilerInstance>
858-
cloneForModuleCompile(SourceLocation ImportLoc, Module *Module,
859-
StringRef ModuleFileName);
861+
///
862+
/// Explicitly-specified \c VFS takes precedence over the VFS of this instance
863+
/// when creating the clone and also prevents \c FileManager sharing.
864+
std::unique_ptr<CompilerInstance> cloneForModuleCompile(
865+
SourceLocation ImportLoc, Module *Module, StringRef ModuleFileName,
866+
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
860867

861868
/// Compile a module file for the given module, using the options
862869
/// provided by the importing compiler instance. Returns true if the module

clang/include/clang/Parse/Parser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,8 +1942,7 @@ class Parser : public CodeCompletionHandler {
19421942
llvm::function_ref<void()> ExpressionStarts =
19431943
llvm::function_ref<void()>(),
19441944
bool FailImmediatelyOnInvalidExpr = false,
1945-
bool EarlyTypoCorrection = false,
1946-
bool *HasTrailingComma = nullptr);
1945+
bool EarlyTypoCorrection = false);
19471946

19481947
/// ParseSimpleExpressionList - A simple comma-separated list of expressions,
19491948
/// used for misc language extensions.

clang/lib/AST/Decl.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3910,8 +3910,25 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
39103910

39113911
FunctionTypeLoc FunctionDecl::getFunctionTypeLoc() const {
39123912
const TypeSourceInfo *TSI = getTypeSourceInfo();
3913-
return TSI ? TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>()
3914-
: FunctionTypeLoc();
3913+
3914+
if (!TSI)
3915+
return FunctionTypeLoc();
3916+
3917+
TypeLoc TL = TSI->getTypeLoc();
3918+
FunctionTypeLoc FTL;
3919+
3920+
while (!(FTL = TL.getAs<FunctionTypeLoc>())) {
3921+
if (const auto PTL = TL.getAs<ParenTypeLoc>())
3922+
TL = PTL.getInnerLoc();
3923+
else if (const auto ATL = TL.getAs<AttributedTypeLoc>())
3924+
TL = ATL.getEquivalentTypeLoc();
3925+
else if (const auto MQTL = TL.getAs<MacroQualifiedTypeLoc>())
3926+
TL = MQTL.getInnerLoc();
3927+
else
3928+
break;
3929+
}
3930+
3931+
return FTL;
39153932
}
39163933

39173934
SourceRange FunctionDecl::getReturnTypeSourceRange() const {

0 commit comments

Comments
 (0)