Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to LLVM v19 #140

Merged
merged 6 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" &&
sudo apt-get update &&
sudo apt-get install -y git make pkg-config clang-18 cmake ninja-build python3 rust-all \
sudo apt-get install -y git make pkg-config clang-19 cmake ninja-build python3 rust-all \
libpixman-1-dev libglib2.0-dev
- name: Check out QEMU
uses: actions/checkout@v4
Expand All @@ -30,7 +30,7 @@ jobs:
git clean -dffx subprojects
mkdir build-clang
(cd build-clang &&
../configure --cc=clang-18 --disable-werror --disable-install-blobs \
../configure --cc=clang-19 --disable-werror --disable-install-blobs \
--target-list=riscv32-softmmu,riscv64-softmmu)
- name: Build
run: |
Expand Down Expand Up @@ -73,9 +73,9 @@ jobs:
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" &&
sudo apt-get update &&
sudo apt-get install -y clang-format-18
sudo apt-get install -y clang-format-19
- name: Check out QEMU
uses: actions/checkout@v4
- name: Check C code format
Expand Down Expand Up @@ -106,9 +106,9 @@ jobs:
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" &&
sudo apt-get update &&
sudo apt-get install -y clang-tidy-18 libglib2.0-dev
sudo apt-get install -y clang-tidy-19 libglib2.0-dev
- name: Check out QEMU
uses: actions/checkout@v4
- name: Download QEMU source artifacts
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" &&
sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" &&
sudo apt-get update &&
sudo apt-get install -y git make pkg-config gcc cmake ninja-build python3 rust-all \
libpixman-1-dev libglib2.0-dev
Expand Down
1 change: 1 addition & 0 deletions hw/misc/pulp_rv_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ static void pulp_rv_dm_load_rom(PulpRVDMState *s)
memcpy(rom, DEBUG_ROM, sizeof(DEBUG_ROM));
}

/* NOLINTNEXTLINE */
static uint64_t pulp_rv_dm_regs_read(void *opaque, hwaddr addr, unsigned size)
{
(void)opaque;
Expand Down
2 changes: 1 addition & 1 deletion hw/opentitan/ot_sram_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ static MemTxResult ot_sram_ctrl_mem_init_read_with_attrs(
/*
* the whole RAM is not fully initialized, check if this cell has been
* initialized
*/
*/
unsigned slot = ot_sram_ctrl_get_u64_slot(cell);
unsigned offset = ot_sram_ctrl_get_u64_offset(cell);

Expand Down
6 changes: 3 additions & 3 deletions hw/riscv/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without (limitation) the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* in the Software without restriction, including without (limitation) the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
Expand Down
9 changes: 6 additions & 3 deletions include/hw/opentitan/ot_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ ot_multibitbool_and_lo(uint32_t a, uint32_t b, uint32_t size)
}

/*
* Computes the new multibit register value when writing to a W1S register field.
* Computes the new multibit register value when writing to a W1S register
* field.
*/
static inline uint32_t
ot_multibitbool_w1s_write(uint32_t old, uint32_t val, uint32_t size)
Expand All @@ -154,7 +155,8 @@ ot_multibitbool_w1s_write(uint32_t old, uint32_t val, uint32_t size)
}

/*
* Computes the new multibit register value when writing to a W1C register field.
* Computes the new multibit register value when writing to a W1C register
* field.
*/
static inline uint32_t
ot_multibitbool_w1c_write(uint32_t old, uint32_t val, uint32_t size)
Expand All @@ -163,7 +165,8 @@ ot_multibitbool_w1c_write(uint32_t old, uint32_t val, uint32_t size)
}

/*
* Computes the new multibit register value when writing to a W0C register field.
* Computes the new multibit register value when writing to a W0C register
* field.
*/
static inline uint32_t
ot_multibitbool_w0c_write(uint32_t old, uint32_t val, uint32_t size)
Expand Down
2 changes: 1 addition & 1 deletion include/hw/riscv/ibex_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ typedef struct {
{ \
__VA_ARGS__, \
{ \
.out = {.num = -1 } \
.out = { .num = -1 } \
} \
}

Expand Down
70 changes: 59 additions & 11 deletions scripts/opentitan/clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# compatible with clang-format-16
# compatible with clang-format-19
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
Expand All @@ -9,24 +9,55 @@ AlignConsecutiveAssignments:
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: true
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveShortCaseStatements:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCaseArrows: false
AlignCaseColons: false
AlignConsecutiveTableGenBreakingDAGArgColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenCondOperatorColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenDefinitionColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignEscapedNewlines: DontAlign
AlignOperands: Align
Expand All @@ -35,17 +66,18 @@ AlignTrailingComments:
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
BinPackArguments: true
BinPackParameters: true
Expand All @@ -71,6 +103,7 @@ BraceWrapping:
SplitEmptyRecord: false
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: None
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
Expand All @@ -80,8 +113,10 @@ BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakConstructorInitializersBeforeComma: false
BreakFunctionDefinitionParameters: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
BreakTemplateDeclarations: MultiLine
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
Expand Down Expand Up @@ -167,11 +202,15 @@ IntegerLiteralSeparator:
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
KeepEmptyLines:
AtEndOfFile: true
AtStartOfBlock: false
AtStartOfFile: false
LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MainIncludeChar: Quote
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
Expand All @@ -185,6 +224,7 @@ PenaltyBreakBeforeFirstCallParameter: 500
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakScopeResolution: 500
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
Expand All @@ -194,24 +234,28 @@ PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: false
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SkipMacroDefinitionBody: false
SortIncludes: CaseInsensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceBeforeParensOptions:
AfterControlStatements: true
Expand All @@ -220,29 +264,33 @@ SpaceBeforeParensOptions:
AfterFunctionDefinitionName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterPlacementOperator: true
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpaceBeforeSquareBrackets: false
SpacesInParentheses: false
SpacesInParens: Never
SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false
InConditionalStatements: false
InEmptyParentheses: false
Other: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
StatementMacros:
TabWidth: 4
UseTab: Never
VerilogBreakBetweenInstancePorts: true
WhitespaceSensitiveMacros:
...

9 changes: 8 additions & 1 deletion scripts/opentitan/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Checks: '*,
-altera-*,
-android-cloexec-fopen,
-bugprone-assignment-in-if-condition,
-bugprone-branch-clone,
-bugprone-casting-through-void,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
Expand All @@ -15,6 +16,7 @@ Checks: '*,
-clang-diagnostic-error,
-clang-diagnostic-unknown-warning-option,
-cert-dcl37-c,-cert-dcl51-cpp,
-cert-int09-c,
-concurrency-mt-unsafe,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-interfaces-global-init,
Expand All @@ -30,8 +32,13 @@ Checks: '*,
-readability-avoid-nested-conditional-operator,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-enum-initial-value,
-readability-isolate-declaration,
-readability-redundant-casting'
-readability-math-missing-parentheses,
-readability-redundant-casting,
-readability-redundant-declaration'

UseColor: true
SystemHeaders: false
WarningsAsErrors: '*'
...
6 changes: 3 additions & 3 deletions scripts/opentitan/ot-format.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh

# Copyright (c) 2024 Rivos, Inc.
# Copyright (c) 2024-2025 Rivos, Inc.
# SPDX-License-Identifier: Apache2

EXPECTED_VERSION="18"
EXPECTED_VERSION="19"

# find clang-format executable: either 'clang-format-17' or 'clang-format'
# find clang-format executable: either 'clang-format-19' or 'clang-format'
for ver_suffix in "-${EXPECTED_VERSION}" ""; do
clangformat="$(which clang-format${ver_suffix} 2>/dev/null)"
if [ -n "${clangformat}" ]; then
Expand Down
Loading
Loading