Skip to content

Commit adee082

Browse files
committed
Merged main:75b3c3d267bf into amd-gfx:d648e114f351
Local branch amd-gfx d648e11 Revert "[AMDGPU] Try to fix the block prologs broken by RA inserted instructions (llvm#69924)" Remote branch main 75b3c3d [ARM] Disable UpperBound loop unrolling for MVE tail predicated loops. (llvm#69709) Change-Id: I5ed179024ddce969c97745bd3947ac42772629c0
2 parents d648e11 + 75b3c3d commit adee082

File tree

702 files changed

+69981
-16546
lines changed

Some content is hidden

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

702 files changed

+69981
-16546
lines changed

clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct UnqualNameVisitor : public RecursiveASTVisitor<UnqualNameVisitor> {
103103

104104
bool VisitDeclRefExpr(DeclRefExpr *S) {
105105
DeclarationName Name = S->getNameInfo().getName();
106-
return S->getQualifierLoc() || !Name.isIdentifier() ||
106+
return S->getQualifierLoc() || Name.isEmpty() || !Name.isIdentifier() ||
107107
!visitUnqualName(Name.getAsIdentifierInfo()->getName());
108108
}
109109

clang-tools-extra/pseudo/lib/Lex.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ TokenStream cook(const TokenStream &Code, const LangOptions &LangOpts) {
8787
llvm::SmallString<64> CleanBuffer;
8888
const char *Pos = Tok.text().begin();
8989
while (Pos < Tok.text().end()) {
90-
unsigned CharSize = 0;
91-
CleanBuffer.push_back(
92-
clang::Lexer::getCharAndSizeNoWarn(Pos, CharSize, LangOpts));
90+
auto [Char, CharSize] =
91+
clang::Lexer::getCharAndSizeNoWarn(Pos, LangOpts);
92+
CleanBuffer.push_back(Char);
9393
assert(CharSize != 0 && "no progress!");
9494
Pos += CharSize;
9595
}

clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type-cxx20.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,21 @@ struct TestDefaultOperatorB {
9898
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
9999
// CHECK-FIXES: {{^}} friend auto operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default;{{$}}
100100
};
101+
102+
namespace PR69863 {
103+
104+
template <unsigned Len>
105+
struct CustomCompileTimeString {
106+
constexpr CustomCompileTimeString(const char (&)[Len]) noexcept {}
107+
};
108+
109+
template <CustomCompileTimeString Str>
110+
constexpr decltype(Str) operator""__csz() noexcept {
111+
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
112+
// CHECK-FIXES: {{^}}constexpr auto operator""__csz() noexcept -> decltype(Str) {
113+
return Str;
114+
}
115+
116+
inline constexpr CustomCompileTimeString SomeString = "This line will cause a crash"__csz;
117+
118+
}
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
//===--- APINotesReader.h - API Notes Reader --------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines the \c APINotesReader class that reads source API notes
10+
// data providing additional information about source code as a separate input,
11+
// such as the non-nil/nilable annotations for method parameters.
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
#ifndef LLVM_CLANG_APINOTES_READER_H
16+
#define LLVM_CLANG_APINOTES_READER_H
17+
18+
#include "clang/APINotes/Types.h"
19+
#include "llvm/Support/MemoryBuffer.h"
20+
#include "llvm/Support/VersionTuple.h"
21+
#include <memory>
22+
23+
namespace clang {
24+
namespace api_notes {
25+
26+
/// A class that reads API notes data from a binary file that was written by
27+
/// the \c APINotesWriter.
28+
class APINotesReader {
29+
class Implementation;
30+
std::unique_ptr<Implementation> Implementation;
31+
32+
APINotesReader(llvm::MemoryBuffer *InputBuffer,
33+
llvm::VersionTuple SwiftVersion, bool &Failed);
34+
35+
public:
36+
/// Create a new API notes reader from the given member buffer, which
37+
/// contains the contents of a binary API notes file.
38+
///
39+
/// \returns the new API notes reader, or null if an error occurred.
40+
static std::unique_ptr<APINotesReader>
41+
Create(std::unique_ptr<llvm::MemoryBuffer> InputBuffer,
42+
llvm::VersionTuple SwiftVersion);
43+
44+
~APINotesReader();
45+
46+
APINotesReader(const APINotesReader &) = delete;
47+
APINotesReader &operator=(const APINotesReader &) = delete;
48+
49+
/// Captures the completed versioned information for a particular part of
50+
/// API notes, including both unversioned API notes and each versioned API
51+
/// note for that particular entity.
52+
template <typename T> class VersionedInfo {
53+
/// The complete set of results.
54+
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> Results;
55+
56+
/// The index of the result that is the "selected" set based on the desired
57+
/// Swift version, or null if nothing matched.
58+
std::optional<unsigned> Selected;
59+
60+
public:
61+
/// Form an empty set of versioned information.
62+
VersionedInfo(std::nullopt_t) : Selected(std::nullopt) {}
63+
64+
/// Form a versioned info set given the desired version and a set of
65+
/// results.
66+
VersionedInfo(
67+
llvm::VersionTuple Version,
68+
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> Results);
69+
70+
/// Retrieve the selected index in the result set.
71+
std::optional<unsigned> getSelected() const { return Selected; }
72+
73+
/// Return the number of versioned results we know about.
74+
unsigned size() const { return Results.size(); }
75+
76+
/// Access all versioned results.
77+
const std::pair<llvm::VersionTuple, T> *begin() const {
78+
assert(!Results.empty());
79+
return Results.begin();
80+
}
81+
const std::pair<llvm::VersionTuple, T> *end() const {
82+
return Results.end();
83+
}
84+
85+
/// Access a specific versioned result.
86+
const std::pair<llvm::VersionTuple, T> &operator[](unsigned index) const {
87+
assert(index < Results.size());
88+
return Results[index];
89+
}
90+
};
91+
92+
/// Look for the context ID of the given Objective-C class.
93+
///
94+
/// \param Name The name of the class we're looking for.
95+
///
96+
/// \returns The ID, if known.
97+
std::optional<ContextID> lookupObjCClassID(llvm::StringRef Name);
98+
99+
/// Look for information regarding the given Objective-C class.
100+
///
101+
/// \param Name The name of the class we're looking for.
102+
///
103+
/// \returns The information about the class, if known.
104+
VersionedInfo<ObjCContextInfo> lookupObjCClassInfo(llvm::StringRef Name);
105+
106+
/// Look for the context ID of the given Objective-C protocol.
107+
///
108+
/// \param Name The name of the protocol we're looking for.
109+
///
110+
/// \returns The ID of the protocol, if known.
111+
std::optional<ContextID> lookupObjCProtocolID(llvm::StringRef Name);
112+
113+
/// Look for information regarding the given Objective-C protocol.
114+
///
115+
/// \param Name The name of the protocol we're looking for.
116+
///
117+
/// \returns The information about the protocol, if known.
118+
VersionedInfo<ObjCContextInfo> lookupObjCProtocolInfo(llvm::StringRef Name);
119+
120+
/// Look for information regarding the given Objective-C property in
121+
/// the given context.
122+
///
123+
/// \param CtxID The ID that references the context we are looking for.
124+
/// \param Name The name of the property we're looking for.
125+
/// \param IsInstance Whether we are looking for an instance property (vs.
126+
/// a class property).
127+
///
128+
/// \returns Information about the property, if known.
129+
VersionedInfo<ObjCPropertyInfo>
130+
lookupObjCProperty(ContextID CtxID, llvm::StringRef Name, bool IsInstance);
131+
132+
/// Look for information regarding the given Objective-C method in
133+
/// the given context.
134+
///
135+
/// \param CtxID The ID that references the context we are looking for.
136+
/// \param Selector The selector naming the method we're looking for.
137+
/// \param IsInstanceMethod Whether we are looking for an instance method.
138+
///
139+
/// \returns Information about the method, if known.
140+
VersionedInfo<ObjCMethodInfo> lookupObjCMethod(ContextID CtxID,
141+
ObjCSelectorRef Selector,
142+
bool IsInstanceMethod);
143+
144+
/// Look for information regarding the given global variable.
145+
///
146+
/// \param Name The name of the global variable.
147+
///
148+
/// \returns information about the global variable, if known.
149+
VersionedInfo<GlobalVariableInfo>
150+
lookupGlobalVariable(llvm::StringRef Name,
151+
std::optional<Context> Ctx = std::nullopt);
152+
153+
/// Look for information regarding the given global function.
154+
///
155+
/// \param Name The name of the global function.
156+
///
157+
/// \returns information about the global function, if known.
158+
VersionedInfo<GlobalFunctionInfo>
159+
lookupGlobalFunction(llvm::StringRef Name,
160+
std::optional<Context> Ctx = std::nullopt);
161+
162+
/// Look for information regarding the given enumerator.
163+
///
164+
/// \param Name The name of the enumerator.
165+
///
166+
/// \returns information about the enumerator, if known.
167+
VersionedInfo<EnumConstantInfo> lookupEnumConstant(llvm::StringRef Name);
168+
169+
/// Look for information regarding the given tag
170+
/// (struct/union/enum/C++ class).
171+
///
172+
/// \param Name The name of the tag.
173+
///
174+
/// \returns information about the tag, if known.
175+
VersionedInfo<TagInfo> lookupTag(llvm::StringRef Name,
176+
std::optional<Context> Ctx = std::nullopt);
177+
178+
/// Look for information regarding the given typedef.
179+
///
180+
/// \param Name The name of the typedef.
181+
///
182+
/// \returns information about the typedef, if known.
183+
VersionedInfo<TypedefInfo>
184+
lookupTypedef(llvm::StringRef Name,
185+
std::optional<Context> Ctx = std::nullopt);
186+
187+
/// Look for the context ID of the given C++ namespace.
188+
///
189+
/// \param Name The name of the class we're looking for.
190+
///
191+
/// \returns The ID, if known.
192+
std::optional<ContextID>
193+
lookupNamespaceID(llvm::StringRef Name,
194+
std::optional<ContextID> ParentNamespaceID = std::nullopt);
195+
};
196+
197+
} // end namespace api_notes
198+
} // end namespace clang
199+
200+
#endif // LLVM_CLANG_APINOTES_READER_H

clang/include/clang/APINotes/Types.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,10 @@ class CommonTypeInfo : public CommonEntityInfo {
144144
return SwiftBridge;
145145
}
146146

147-
void setSwiftBridge(const std::optional<std::string> &SwiftType) {
147+
void setSwiftBridge(std::optional<std::string> SwiftType) {
148148
SwiftBridge = SwiftType;
149149
}
150150

151-
void setSwiftBridge(const std::optional<llvm::StringRef> &SwiftType) {
152-
SwiftBridge = SwiftType
153-
? std::optional<std::string>(std::string(*SwiftType))
154-
: std::nullopt;
155-
}
156-
157151
const std::optional<std::string> &getNSErrorDomain() const {
158152
return NSErrorDomain;
159153
}

clang/include/clang/Basic/BuiltinsLoongArch.def

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,14 @@
1515
# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
1616
#endif
1717

18-
// TODO: Support more builtins.
19-
TARGET_BUILTIN(__builtin_loongarch_cacop_d, "vWiUWiWi", "nc", "64bit")
20-
TARGET_BUILTIN(__builtin_loongarch_cacop_w, "viUii", "nc", "32bit")
21-
TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
22-
TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
23-
TARGET_BUILTIN(__builtin_loongarch_movfcsr2gr, "UiIUi", "nc", "f")
24-
TARGET_BUILTIN(__builtin_loongarch_movgr2fcsr, "vIUiUi", "nc", "f")
25-
TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
26-
TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
27-
TARGET_BUILTIN(__builtin_loongarch_cpucfg, "UiUi", "nc", "")
28-
TARGET_BUILTIN(__builtin_loongarch_asrtle_d, "vWiWi", "nc", "64bit")
29-
TARGET_BUILTIN(__builtin_loongarch_asrtgt_d, "vWiWi", "nc", "64bit")
18+
// Definition of LoongArch basic builtins.
19+
#include "clang/Basic/BuiltinsLoongArchBase.def"
3020

31-
TARGET_BUILTIN(__builtin_loongarch_crc_w_b_w, "iii", "nc", "64bit")
32-
TARGET_BUILTIN(__builtin_loongarch_crc_w_h_w, "iii", "nc", "64bit")
33-
TARGET_BUILTIN(__builtin_loongarch_crc_w_w_w, "iii", "nc", "64bit")
34-
TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iWii", "nc", "64bit")
35-
TARGET_BUILTIN(__builtin_loongarch_crcc_w_b_w, "iii", "nc", "64bit")
36-
TARGET_BUILTIN(__builtin_loongarch_crcc_w_h_w, "iii", "nc", "64bit")
37-
TARGET_BUILTIN(__builtin_loongarch_crcc_w_w_w, "iii", "nc", "64bit")
38-
TARGET_BUILTIN(__builtin_loongarch_crcc_w_d_w, "iWii", "nc", "64bit")
21+
// Definition of LSX builtins.
22+
#include "clang/Basic/BuiltinsLoongArchLSX.def"
3923

40-
TARGET_BUILTIN(__builtin_loongarch_csrrd_w, "UiIUi", "nc", "")
41-
TARGET_BUILTIN(__builtin_loongarch_csrrd_d, "UWiIUi", "nc", "64bit")
42-
TARGET_BUILTIN(__builtin_loongarch_csrwr_w, "UiUiIUi", "nc", "")
43-
TARGET_BUILTIN(__builtin_loongarch_csrwr_d, "UWiUWiIUi", "nc", "64bit")
44-
TARGET_BUILTIN(__builtin_loongarch_csrxchg_w, "UiUiUiIUi", "nc", "")
45-
TARGET_BUILTIN(__builtin_loongarch_csrxchg_d, "UWiUWiUWiIUi", "nc", "64bit")
46-
47-
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_b, "UiUi", "nc", "")
48-
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_h, "UiUi", "nc", "")
49-
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_w, "UiUi", "nc", "")
50-
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_d, "UWiUi", "nc", "64bit")
51-
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_b, "vUiUi", "nc", "")
52-
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_h, "vUiUi", "nc", "")
53-
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_w, "vUiUi", "nc", "")
54-
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_d, "vUWiUi", "nc", "64bit")
55-
56-
TARGET_BUILTIN(__builtin_loongarch_lddir_d, "WiWiIUWi", "nc", "64bit")
57-
TARGET_BUILTIN(__builtin_loongarch_ldpte_d, "vWiIUWi", "nc", "64bit")
24+
// Definition of LASX builtins.
25+
#include "clang/Basic/BuiltinsLoongArchLASX.def"
5826

5927
#undef BUILTIN
6028
#undef TARGET_BUILTIN
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//============------------ BuiltinsLoongArchBase.def -------------*- C++ -*-==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines the LoongArch-specific basic builtin function database.
10+
// Users of this file must define the BUILTIN macro to make use of this
11+
// information.
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
TARGET_BUILTIN(__builtin_loongarch_cacop_d, "vWiUWiWi", "nc", "64bit")
16+
TARGET_BUILTIN(__builtin_loongarch_cacop_w, "viUii", "nc", "32bit")
17+
TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
18+
TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
19+
TARGET_BUILTIN(__builtin_loongarch_movfcsr2gr, "UiIUi", "nc", "f")
20+
TARGET_BUILTIN(__builtin_loongarch_movgr2fcsr, "vIUiUi", "nc", "f")
21+
TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
22+
TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
23+
TARGET_BUILTIN(__builtin_loongarch_cpucfg, "UiUi", "nc", "")
24+
TARGET_BUILTIN(__builtin_loongarch_asrtle_d, "vWiWi", "nc", "64bit")
25+
TARGET_BUILTIN(__builtin_loongarch_asrtgt_d, "vWiWi", "nc", "64bit")
26+
27+
TARGET_BUILTIN(__builtin_loongarch_crc_w_b_w, "iii", "nc", "64bit")
28+
TARGET_BUILTIN(__builtin_loongarch_crc_w_h_w, "iii", "nc", "64bit")
29+
TARGET_BUILTIN(__builtin_loongarch_crc_w_w_w, "iii", "nc", "64bit")
30+
TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iWii", "nc", "64bit")
31+
TARGET_BUILTIN(__builtin_loongarch_crcc_w_b_w, "iii", "nc", "64bit")
32+
TARGET_BUILTIN(__builtin_loongarch_crcc_w_h_w, "iii", "nc", "64bit")
33+
TARGET_BUILTIN(__builtin_loongarch_crcc_w_w_w, "iii", "nc", "64bit")
34+
TARGET_BUILTIN(__builtin_loongarch_crcc_w_d_w, "iWii", "nc", "64bit")
35+
36+
TARGET_BUILTIN(__builtin_loongarch_csrrd_w, "UiIUi", "nc", "")
37+
TARGET_BUILTIN(__builtin_loongarch_csrrd_d, "UWiIUi", "nc", "64bit")
38+
TARGET_BUILTIN(__builtin_loongarch_csrwr_w, "UiUiIUi", "nc", "")
39+
TARGET_BUILTIN(__builtin_loongarch_csrwr_d, "UWiUWiIUi", "nc", "64bit")
40+
TARGET_BUILTIN(__builtin_loongarch_csrxchg_w, "UiUiUiIUi", "nc", "")
41+
TARGET_BUILTIN(__builtin_loongarch_csrxchg_d, "UWiUWiUWiIUi", "nc", "64bit")
42+
43+
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_b, "UiUi", "nc", "")
44+
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_h, "UiUi", "nc", "")
45+
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_w, "UiUi", "nc", "")
46+
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_d, "UWiUi", "nc", "64bit")
47+
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_b, "vUiUi", "nc", "")
48+
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_h, "vUiUi", "nc", "")
49+
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_w, "vUiUi", "nc", "")
50+
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_d, "vUWiUi", "nc", "64bit")
51+
52+
TARGET_BUILTIN(__builtin_loongarch_lddir_d, "WiWiIUWi", "nc", "64bit")
53+
TARGET_BUILTIN(__builtin_loongarch_ldpte_d, "vWiIUWi", "nc", "64bit")

0 commit comments

Comments
 (0)