Skip to content

Commit e1f1672

Browse files
authored
merge main into amd-staging (llvm#1502)
2 parents 117347d + dc007d2 commit e1f1672

File tree

77 files changed

+665
-436
lines changed

Some content is hidden

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

77 files changed

+665
-436
lines changed

.ci/monolithic-linux.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ targets="${2}"
5353
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5454

5555
echo "--- cmake"
56-
pip install --break-system-packages -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
57-
pip install --break-system-packages -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
58-
pip install --break-system-packages -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
56+
export PIP_BREAK_SYSTEM_PACKAGES=1
57+
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
58+
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
59+
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
5960
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6061
-D LLVM_ENABLE_PROJECTS="${projects}" \
6162
-G Ninja \

clang/lib/Format/Format.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4010,7 +4010,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) {
40104010

40114011
switch (Style.Language) {
40124012
case FormatStyle::LK_C:
4013-
LangOpts.C17 = 1;
4013+
LangOpts.C11 = 1;
40144014
break;
40154015
case FormatStyle::LK_Cpp:
40164016
case FormatStyle::LK_ObjC:

clang/lib/Format/FormatToken.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static SmallVector<StringRef> CppNonKeywordTypes = {
4444
bool FormatToken::isTypeName(const LangOptions &LangOpts) const {
4545
if (is(TT_TypeName) || Tok.isSimpleTypeSpecifier(LangOpts))
4646
return true;
47-
return (LangOpts.CXXOperatorNames || LangOpts.C17) && is(tok::identifier) &&
47+
return (LangOpts.CXXOperatorNames || LangOpts.C11) && is(tok::identifier) &&
4848
std::binary_search(CppNonKeywordTypes.begin(),
4949
CppNonKeywordTypes.end(), TokenText);
5050
}

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ class AnnotatingParser {
129129
: Style(Style), Line(Line), CurrentToken(Line.First), AutoFound(false),
130130
IsCpp(Style.isCpp()), LangOpts(getFormattingLangOpts(Style)),
131131
Keywords(Keywords), Scopes(Scopes), TemplateDeclarationDepth(0) {
132-
assert(IsCpp == (LangOpts.CXXOperatorNames || LangOpts.C17));
133132
Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false));
134133
resetTokenMetadata();
135134
}
@@ -3847,7 +3846,7 @@ static bool isFunctionDeclarationName(const LangOptions &LangOpts,
38473846
};
38483847

38493848
const auto *Next = Current.Next;
3850-
const bool IsCpp = LangOpts.CXXOperatorNames || LangOpts.C17;
3849+
const bool IsCpp = LangOpts.CXXOperatorNames || LangOpts.C11;
38513850

38523851
// Find parentheses of parameter list.
38533852
if (Current.is(tok::kw_operator)) {

clang/lib/Format/TokenAnnotator.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ class TokenAnnotator {
224224
public:
225225
TokenAnnotator(const FormatStyle &Style, const AdditionalKeywords &Keywords)
226226
: Style(Style), IsCpp(Style.isCpp()),
227-
LangOpts(getFormattingLangOpts(Style)), Keywords(Keywords) {
228-
assert(IsCpp == (LangOpts.CXXOperatorNames || LangOpts.C17));
229-
}
227+
LangOpts(getFormattingLangOpts(Style)), Keywords(Keywords) {}
230228

231229
/// Adapts the indent levels of comment lines to the indent of the
232230
/// subsequent line.

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,13 @@ class LineJoiner {
316316
const AnnotatedLine *Line = nullptr;
317317
for (auto J = I - 1; J >= AnnotatedLines.begin(); --J) {
318318
assert(*J);
319-
if (!(*J)->InPPDirective && !(*J)->isComment() &&
320-
(*J)->Level < TheLine->Level) {
319+
if ((*J)->InPPDirective || (*J)->isComment() ||
320+
(*J)->Level > TheLine->Level) {
321+
continue;
322+
}
323+
if ((*J)->Level < TheLine->Level ||
324+
(Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths &&
325+
(*J)->First->is(tok::l_brace))) {
321326
Line = *J;
322327
break;
323328
}

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ UnwrappedLineParser::UnwrappedLineParser(
167167
? IG_Rejected
168168
: IG_Inited),
169169
IncludeGuardToken(nullptr), FirstStartColumn(FirstStartColumn),
170-
Macros(Style.Macros, SourceMgr, Style, Allocator, IdentTable) {
171-
assert(IsCpp == (LangOpts.CXXOperatorNames || LangOpts.C17));
172-
}
170+
Macros(Style.Macros, SourceMgr, Style, Allocator, IdentTable) {}
173171

174172
void UnwrappedLineParser::reset() {
175173
PPBranchLevel = -1;

clang/unittests/Format/FormatTest.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15142,6 +15142,13 @@ TEST_F(FormatTest, PullInlineOnlyFunctionDefinitionsIntoSingleLine) {
1514215142
"}",
1514315143
MergeInlineOnly);
1514415144

15145+
MergeInlineOnly.BreakBeforeBraces = FormatStyle::BS_Whitesmiths;
15146+
verifyFormat("class Foo\n"
15147+
" {\n"
15148+
" void f() { foo(); }\n"
15149+
" };",
15150+
MergeInlineOnly);
15151+
1514515152
// Also verify behavior when BraceWrapping.AfterFunction = true
1514615153
MergeInlineOnly.BreakBeforeBraces = FormatStyle::BS_Custom;
1514715154
MergeInlineOnly.BraceWrapping.AfterFunction = true;

clang/unittests/Format/TokenAnnotatorTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3935,6 +3935,12 @@ TEST_F(TokenAnnotatorTest, UserDefinedConversionFunction) {
39353935
EXPECT_TOKEN(Tokens[5], tok::l_paren, TT_FunctionDeclarationLParen);
39363936
}
39373937

3938+
TEST_F(TokenAnnotatorTest, UTF8StringLiteral) {
3939+
auto Tokens = annotate("return u8\"foo\";", getLLVMStyle(FormatStyle::LK_C));
3940+
ASSERT_EQ(Tokens.size(), 4u) << Tokens;
3941+
EXPECT_TOKEN(Tokens[1], tok::utf8_string_literal, TT_Unknown);
3942+
}
3943+
39383944
} // namespace
39393945
} // namespace format
39403946
} // namespace clang

llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ module MetadataKind = struct
153153
| DIArgListMetadataKind
154154
| DIAssignIDMetadataKind
155155
| DISubrangeTypeMetadataKind
156+
| DIFixedPointTypeMetadataKind
156157
end
157158

158159
(** The amount of debug information to emit. *)

0 commit comments

Comments
 (0)