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

Update to LLVM 18.1.0 rc 3 #167

Merged
merged 55 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
076953d
[mlir] Skip invalid test on big endian platform (s390x) (#80246)
Lewuathe Feb 2, 2024
50f8284
[SPARC] Support reserving arbitrary general purpose registers (#74927)
koachan Feb 11, 2024
58b2a6d
[LLD] [test] Avoid printing timestamps past INT32_MAX with llvm-reado…
mstorsjo Feb 12, 2024
831b9a5
[AArch64][GISel] Don't pointlessly lower G_TRUNC (#81479)
nikic Feb 13, 2024
8391421
[LLD] [docs] Add a release note for the SOURCE_DATE_EPOCH support (#8…
mstorsjo Feb 16, 2024
872fe20
[libc++][print] Moves is_terminal to the dylib. (#80464)
mordante Feb 10, 2024
ab57f6c
[clang-format] Don't remove parentheses in macro definitions (#81444)
owenca Feb 13, 2024
325d4a1
Revert "[RISCV] Recurse on first operand of two operand shuffles (#79…
preames Feb 16, 2024
8b7b3fb
[AArch64][SME] Implement inline-asm clobbers for za/zt0 (#79276)
MDevereau Feb 2, 2024
e3c6d5a
[PowerPC] Update V18.1.0 release notes (#81631)
maryammo Feb 16, 2024
9cf0c29
MipsAsmParser/O32: Don't add redundant $ to $-prefixed symbol in the …
wzssyqa Feb 14, 2024
c90f200
[analyzer][docs] Admit that the cleanup attribute is not supported (#…
steakhal Feb 16, 2024
023925b
[RISCV] Use APInt in useInversedSetcc to prevent crashes when mask is…
topperc Feb 15, 2024
38c5b35
[RISCV] Make sure ADDI replacement in optimizeCondBranch has a virtua…
topperc Feb 16, 2024
d7c6794
[OpenMP] [cmake] Don't use -fno-semantic-interposition on Windows (#8…
mstorsjo Feb 8, 2024
e098f6c
[AArch64] Only apply bool vector bitcast opt if result is scalar (#81…
nikic Feb 12, 2024
5750be5
[CFI][annotation] Leave alone function pointers in function annotatio…
yozhu Feb 16, 2024
28be6f6
[LLD] [MinGW] Implement the --lto-emit-asm and -plugin-opt=emit-llvm …
mstorsjo Feb 13, 2024
cf13026
[OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in tes…
xingxue-ibm Feb 7, 2024
34fdf52
[OpenMP][AIX]Define struct kmp_base_tas_lock with the order of two me…
xingxue-ibm Feb 13, 2024
0a44c37
[lld] Add target support for SystemZ (s390x) (#75643)
uweigand Feb 13, 2024
ddc2a5f
[18.x][Docs] Add release note about Clang-defined target OS macros (#…
zixu-w Feb 16, 2024
60a8ec3
[lld][ELF] Support relax R_LARCH_ALIGN (#78692)
MQ-mengqing Feb 6, 2024
d01a4ab
[LLD] [docs] Add more release notes for COFF and MinGW (#81977)
mstorsjo Feb 16, 2024
1a69056
Backport [DAGCombine] Fix multi-use miscompile in load combine (#8158…
nikic Feb 16, 2024
5226ae4
[SLP]Fix PR79229: Check that extractelement is used only in a single …
alexey-bataev Jan 24, 2024
b7a4ff8
[SLP]Fix PR79229: Do not erase extractelement, if it used in
alexey-bataev Jan 25, 2024
0756378
[libc++][modules] Re-add build dir CMakeLists.txt. (#81370)
mordante Feb 13, 2024
d71aae5
[lld] Fix test failures when running as root user (#81339)
tstellar Feb 10, 2024
347977c
[lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739)
uweigand Feb 14, 2024
8a3d8f0
[AArch64][GlobalISel] Fail legalization for unknown libcalls. (#81873)
davemgreen Feb 17, 2024
82e17c1
Use container on Linux to run llvm-project-tests workflow (#81349) (#…
tstellar Feb 18, 2024
b27f0b4
[AIX] Add a dummy variable in the __llvm_orderfile section (#81968)
w2yehia Feb 16, 2024
ae27600
[OpenMP][AIX] Set worker stack size to 2 x KMP_DEFAULT_STKSIZE if sys…
xingxue-ibm Feb 16, 2024
c5e1885
[Support/ELF] Add OpenBSD PT_OPENBSD_SYSCALLS constant.
fcambus Feb 17, 2024
b845f06
[ValueTracking] Fix computeKnownFPClass for fpext (#81972)
dtcxzyw Feb 17, 2024
c7b0a6e
[RISCV] Check type is legal before combining mgather to vlse intrinsi…
lukel97 Feb 8, 2024
c74afe6
[InstCombine] Add unsigned variants of gep exact div tests (NFC)
nikic Feb 20, 2024
ebc589e
[InstCombine] Fold gep of exact unsigned division (#82334)
nikic Feb 20, 2024
801a10d
[OpenMP][AIX]Add assembly file containing microtasking routines and u…
xingxue-ibm Feb 20, 2024
3af6881
[llvm-readobj] Add support for the PT_OPENBSD_SYSCALLS segment type. …
fcambus Feb 20, 2024
12114d2
[llvm-objdump] Add support for the PT_OPENBSD_SYSCALLS segment type. …
fcambus Feb 20, 2024
3b4b047
[PowerPC] Mask constant operands in ValueBit tracking (#67653)
ecnelises Feb 6, 2024
390dcd4
[compiler-rt][profile] Fix InstrProfilingFile possible resource leak.…
devnexen Feb 10, 2024
5ef297a
[llvm-objcopy] Add SystemZ support (#81841)
uweigand Feb 16, 2024
66351a5
[Serialization] Record whether the ODR is skipped (#82302)
ChuanqiXu9 Feb 20, 2024
688566b
[IndVars] Add tests for #79861 (NFC)
nikic Feb 1, 2024
4223b22
[SCEVExpander] Do not reuse disjoint or (#80281)
nikic Feb 2, 2024
dc0ed54
[SCEV] Move canReuseInstruction() helper into SCEV (NFC)
nikic Feb 2, 2024
94dcc1d
[IndVarSimplify] Fix poison-safety when reusing instructions (#80458)
nikic Feb 5, 2024
bba3944
[Release] Don't build during test-release.sh Phase 3 install (#82001)
rorth Feb 20, 2024
d84c1e9
[workflows] Fix permissions check for creating new releases (#81163)
tstellar Feb 21, 2024
235306b
[cmake] Add minor version to library SONAME (#79376)
tstellar Feb 20, 2024
6c90f8d
Fix llvm-x86_64-debian-dylib buildbot
tstellar Feb 21, 2024
3e722cc
Merge remote-tracking branch 'upstream/release/18.x' into rustc/18.0-…
nikic Feb 21, 2024
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
10 changes: 8 additions & 2 deletions .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
lit-tests:
name: Lit Tests
runs-on: ${{ matrix.os }}
container:
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
volumes:
- /mnt/:/mnt/
strategy:
fail-fast: false
matrix:
Expand All @@ -77,6 +81,7 @@ jobs:
with:
python-version: ${{ inputs.python_version }}
- name: Install Ninja
if: runner.os != 'Linux'
uses: llvm/actions/install-ninja@main
# actions/checkout deletes any existing files in the new git directory,
# so this needs to either run before ccache-action or it has to use
Expand Down Expand Up @@ -108,8 +113,8 @@ jobs:
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
builddir="/mnt/build/"
sudo mkdir -p $builddir
sudo chown `whoami`:`whoami` $builddir
mkdir -p $builddir
extra_cmake_args="-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
else
builddir="$(pwd)"/build
fi
Expand All @@ -123,6 +128,7 @@ jobs:
-DLLDB_INCLUDE_TESTS=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
$extra_cmake_args \
${{ inputs.extra_cmake_args }}
ninja -C "$builddir" '${{ inputs.build_target }}'

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
name: Create a New Release
runs-on: ubuntu-latest
needs: validate-tag

steps:
- name: Install Dependencies
run: |
Expand All @@ -40,8 +41,9 @@ jobs:
- name: Create Release
env:
GITHUB_TOKEN: ${{ github.token }}
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} create
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} --user ${{ github.actor }} --user-token "$USER_TOKEN" create
release-documentation:
name: Build and Upload Release Documentation
needs:
Expand Down
54 changes: 51 additions & 3 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ AST Dumping Potentially Breaking Changes
"qualType": "foo"
}

Clang Frontend Potentially Breaking Changes
-------------------------------------------
- Target OS macros extension
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
Darwin (Apple platform) targets. Clang now defines ``TARGET_OS_*`` macros for
these targets, which could break existing code bases with improper checks for
the ``TARGET_OS_`` macros. For example, existing checks might fail to include
the ``TargetConditionals.h`` header from Apple SDKs and therefore leaving the
macros undefined and guarded code unexercised.

Affected code should be checked to see if it's still intended for the specific
target and fixed accordingly.

The extension can be turned off by the option ``-fno-define-target-os-macros``
as a workaround.

What's New in Clang |release|?
==============================
Some of the major new features and improvements to Clang are listed
Expand Down Expand Up @@ -304,6 +320,10 @@ Non-comprehensive list of changes in this release

* The version of Unicode used by Clang (primarily to parse identifiers) has been updated to 15.1.

* Clang now defines macro ``__LLVM_INSTR_PROFILE_GENERATE`` when compiling with
PGO instrumentation profile generation, and ``__LLVM_INSTR_PROFILE_USE`` when
compiling with PGO profile use.

New Compiler Flags
------------------

Expand Down Expand Up @@ -344,6 +364,17 @@ New Compiler Flags
attribute the replaceable global new and delete operators behave normally
(like other functions) with respect to visibility attributes, pragmas and
options (e.g ``--fvisibility=``).
* Full register names can be used when printing assembly via ``-mregnames``.
This option now matches the one used by GCC.

.. _target_os_detail:

* ``-fdefine-target-os-macros`` and its complement
``-fno-define-target-os-macros``. Enables or disables the Clang extension to
provide built-in definitions of a list of ``TARGET_OS_*`` macros based on the
target triple.

The extension is enabled by default for Darwin (Apple platform) targets.

Deprecated Compiler Flags
-------------------------
Expand All @@ -363,6 +394,7 @@ Modified Compiler Flags
* ``-fvisibility-global-new-delete-hidden`` is now a deprecated spelling of
``-fvisibility-global-new-delete=force-hidden`` (``-fvisibility-global-new-delete=``
is new in this release).
* ``-fprofile-update`` is enabled for ``-fprofile-generate``.

Removed Compiler Flags
-------------------------
Expand Down Expand Up @@ -860,6 +892,9 @@ Bug Fixes in This Version
Fixes (`#78290 <https://github.com/llvm/llvm-project/issues/78290>`_)
- Fixed assertion failure with deleted overloaded unary operators.
Fixes (`#78314 <https://github.com/llvm/llvm-project/issues/78314>`_)
- The XCOFF object file format does not support aliases to symbols having common
linkage. Clang now diagnoses the use of an alias for a common symbol when
compiling for AIX.

- Clang now doesn't produce false-positive warning `-Wconstant-logical-operand`
for logical operators in C23.
Expand Down Expand Up @@ -1261,6 +1296,16 @@ CUDA Support
- Clang now supports CUDA SDK up to 12.3
- Added support for sm_90a

PowerPC Support
^^^^^^^^^^^^^^^

- Added ``nmmintrin.h`` to intrinsics headers.
- Added ``__builtin_ppc_fence`` as barrier of code motion, and
``__builtin_ppc_mffsl`` for corresponding instruction.
- Supported ``__attribute__((target("tune=cpu")))``.
- Emit ``float-abi`` module flag on 64-bit ELFv2 PowerPC targets if
``long double`` type is used in current module.

AIX Support
^^^^^^^^^^^

Expand All @@ -1269,6 +1314,10 @@ AIX Support
base is encoded as an immediate operand.
This access sequence is not used for TLS variables larger than 32KB, and is
currently only supported on 64-bit mode.
- Inline assembler supports VSR register in pure digits.
- Enabled ThinLTO support. Requires AIX 7.2 TL5 SP7 or newer, or AIX 7.3 TL2
or newer. Similar to the LTO support on AIX, ThinLTO is implemented with
the libLTO.so plugin.

WebAssembly Support
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1332,6 +1381,8 @@ libclang
- Exposed arguments of ``clang::annotate``.
- ``clang::getCursorKindForDecl`` now recognizes linkage specifications such as
``extern "C"`` and reports them as ``CXCursor_LinkageSpec``.
- Changed the libclang library on AIX to export only the necessary symbols to
prevent issues of resolving to the wrong duplicate symbol.

Static Analyzer
---------------
Expand All @@ -1343,9 +1394,6 @@ New features
of static analysis tools, such as the Clang Static Analyzer.
`Documentation <https://clang.llvm.org/docs/AttributeReference.html#suppress>`__.

- Added support for the ``cleanup`` attribute.
`Documentation <https://clang.llvm.org/docs/AttributeReference.html#cleanup>`__.

- Support "Deducing this" (P0847R7). (Worked out of the box)
(`af4751738db8 <https://github.com/llvm/llvm-project/commit/af4751738db89a142a8880c782d12d4201b222a8>`__)

Expand Down
12 changes: 12 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -5815,6 +5815,18 @@ def mvis3 : Flag<["-"], "mvis3">, Group<m_sparc_Features_Group>;
def mno_vis3 : Flag<["-"], "mno-vis3">, Group<m_sparc_Features_Group>;
def mhard_quad_float : Flag<["-"], "mhard-quad-float">, Group<m_sparc_Features_Group>;
def msoft_quad_float : Flag<["-"], "msoft-quad-float">, Group<m_sparc_Features_Group>;
foreach i = 1 ... 7 in
def ffixed_g#i : Flag<["-"], "ffixed-g"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the G"#i#" register (SPARC only)">;
foreach i = 0 ... 5 in
def ffixed_o#i : Flag<["-"], "ffixed-o"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the O"#i#" register (SPARC only)">;
foreach i = 0 ... 7 in
def ffixed_l#i : Flag<["-"], "ffixed-l"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the L"#i#" register (SPARC only)">;
foreach i = 0 ... 5 in
def ffixed_i#i : Flag<["-"], "ffixed-i"#i>, Group<m_sparc_Features_Group>,
HelpText<"Reserve the I"#i#" register (SPARC only)">;
} // let Flags = [TargetSpecific]

// M68k features flags
Expand Down
9 changes: 8 additions & 1 deletion clang/lib/Basic/Targets/AArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,8 @@ TargetInfo::BuiltinVaListKind AArch64TargetInfo::getBuiltinVaListKind() const {
}

const char *const AArch64TargetInfo::GCCRegNames[] = {
// clang-format off

// 32-bit Integer registers
"w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7", "w8", "w9", "w10", "w11",
"w12", "w13", "w14", "w15", "w16", "w17", "w18", "w19", "w20", "w21", "w22",
Expand Down Expand Up @@ -1223,7 +1225,12 @@ const char *const AArch64TargetInfo::GCCRegNames[] = {

// SVE predicate-as-counter registers
"pn0", "pn1", "pn2", "pn3", "pn4", "pn5", "pn6", "pn7", "pn8",
"pn9", "pn10", "pn11", "pn12", "pn13", "pn14", "pn15"
"pn9", "pn10", "pn11", "pn12", "pn13", "pn14", "pn15",

// SME registers
"za", "zt0",

// clang-format on
};

ArrayRef<const char *> AArch64TargetInfo::getGCCRegNames() const {
Expand Down
81 changes: 81 additions & 0 deletions clang/lib/Driver/ToolChains/Arch/Sparc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,85 @@ void sparc::getSparcTargetFeatures(const Driver &D, const ArgList &Args,
else
Features.push_back("-hard-quad-float");
}

if (Args.hasArg(options::OPT_ffixed_g1))
Features.push_back("+reserve-g1");

if (Args.hasArg(options::OPT_ffixed_g2))
Features.push_back("+reserve-g2");

if (Args.hasArg(options::OPT_ffixed_g3))
Features.push_back("+reserve-g3");

if (Args.hasArg(options::OPT_ffixed_g4))
Features.push_back("+reserve-g4");

if (Args.hasArg(options::OPT_ffixed_g5))
Features.push_back("+reserve-g5");

if (Args.hasArg(options::OPT_ffixed_g6))
Features.push_back("+reserve-g6");

if (Args.hasArg(options::OPT_ffixed_g7))
Features.push_back("+reserve-g7");

if (Args.hasArg(options::OPT_ffixed_o0))
Features.push_back("+reserve-o0");

if (Args.hasArg(options::OPT_ffixed_o1))
Features.push_back("+reserve-o1");

if (Args.hasArg(options::OPT_ffixed_o2))
Features.push_back("+reserve-o2");

if (Args.hasArg(options::OPT_ffixed_o3))
Features.push_back("+reserve-o3");

if (Args.hasArg(options::OPT_ffixed_o4))
Features.push_back("+reserve-o4");

if (Args.hasArg(options::OPT_ffixed_o5))
Features.push_back("+reserve-o5");

if (Args.hasArg(options::OPT_ffixed_l0))
Features.push_back("+reserve-l0");

if (Args.hasArg(options::OPT_ffixed_l1))
Features.push_back("+reserve-l1");

if (Args.hasArg(options::OPT_ffixed_l2))
Features.push_back("+reserve-l2");

if (Args.hasArg(options::OPT_ffixed_l3))
Features.push_back("+reserve-l3");

if (Args.hasArg(options::OPT_ffixed_l4))
Features.push_back("+reserve-l4");

if (Args.hasArg(options::OPT_ffixed_l5))
Features.push_back("+reserve-l5");

if (Args.hasArg(options::OPT_ffixed_l6))
Features.push_back("+reserve-l6");

if (Args.hasArg(options::OPT_ffixed_l7))
Features.push_back("+reserve-l7");

if (Args.hasArg(options::OPT_ffixed_i0))
Features.push_back("+reserve-i0");

if (Args.hasArg(options::OPT_ffixed_i1))
Features.push_back("+reserve-i1");

if (Args.hasArg(options::OPT_ffixed_i2))
Features.push_back("+reserve-i2");

if (Args.hasArg(options::OPT_ffixed_i3))
Features.push_back("+reserve-i3");

if (Args.hasArg(options::OPT_ffixed_i4))
Features.push_back("+reserve-i4");

if (Args.hasArg(options::OPT_ffixed_i5))
Features.push_back("+reserve-i5");
}
2 changes: 1 addition & 1 deletion clang/lib/Format/UnwrappedLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2515,7 +2515,7 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType) {
parseChildBlock();
break;
case tok::r_paren:
if (!MightBeStmtExpr &&
if (!MightBeStmtExpr && !Line->InMacroBody &&
Style.RemoveParentheses > FormatStyle::RPS_Leave) {
const auto *Prev = LeftParen->Previous;
const auto *Next = Tokens->peekNextToken();
Expand Down
10 changes: 7 additions & 3 deletions clang/lib/Serialization/ASTReaderDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,12 @@ void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
BitsUnpacker EnumDeclBits(Record.readInt());
ED->setNumPositiveBits(EnumDeclBits.getNextBits(/*Width=*/8));
ED->setNumNegativeBits(EnumDeclBits.getNextBits(/*Width=*/8));
bool ShouldSkipCheckingODR = EnumDeclBits.getNextBit();
ED->setScoped(EnumDeclBits.getNextBit());
ED->setScopedUsingClassTag(EnumDeclBits.getNextBit());
ED->setFixed(EnumDeclBits.getNextBit());

if (!shouldSkipCheckingODR(ED)) {
if (!ShouldSkipCheckingODR) {
ED->setHasODRHash(true);
ED->ODRHash = Record.readInt();
}
Expand Down Expand Up @@ -1073,6 +1074,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {

FD->setCachedLinkage((Linkage)FunctionDeclBits.getNextBits(/*Width=*/3));
FD->setStorageClass((StorageClass)FunctionDeclBits.getNextBits(/*Width=*/3));
bool ShouldSkipCheckingODR = FunctionDeclBits.getNextBit();
FD->setInlineSpecified(FunctionDeclBits.getNextBit());
FD->setImplicitlyInline(FunctionDeclBits.getNextBit());
FD->setHasSkippedBody(FunctionDeclBits.getNextBit());
Expand Down Expand Up @@ -1102,7 +1104,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
if (FD->isExplicitlyDefaulted())
FD->setDefaultLoc(readSourceLocation());

if (!shouldSkipCheckingODR(FD)) {
if (!ShouldSkipCheckingODR) {
FD->ODRHash = Record.readInt();
FD->setHasODRHash(true);
}
Expand Down Expand Up @@ -1973,6 +1975,8 @@ void ASTDeclReader::ReadCXXDefinitionData(

BitsUnpacker CXXRecordDeclBits = Record.readInt();

bool ShouldSkipCheckingODR = CXXRecordDeclBits.getNextBit();

#define FIELD(Name, Width, Merge) \
if (!CXXRecordDeclBits.canGetNextNBits(Width)) \
CXXRecordDeclBits.updateValue(Record.readInt()); \
Expand All @@ -1982,7 +1986,7 @@ void ASTDeclReader::ReadCXXDefinitionData(
#undef FIELD

// We only perform ODR checks for decls not in GMF.
if (!shouldSkipCheckingODR(D)) {
if (!ShouldSkipCheckingODR) {
// Note: the caller has deserialized the IsLambda bit already.
Data.ODRHash = Record.readInt();
Data.HasODRHash = true;
Expand Down
6 changes: 4 additions & 2 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6010,6 +6010,9 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {

BitsPacker DefinitionBits;

bool ShouldSkipCheckingODR = shouldSkipCheckingODR(D);
DefinitionBits.addBit(ShouldSkipCheckingODR);

#define FIELD(Name, Width, Merge) \
if (!DefinitionBits.canWriteNextNBits(Width)) { \
Record->push_back(DefinitionBits); \
Expand All @@ -6023,11 +6026,10 @@ void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
Record->push_back(DefinitionBits);

// We only perform ODR checks for decls not in GMF.
if (!shouldSkipCheckingODR(D)) {
if (!ShouldSkipCheckingODR)
// getODRHash will compute the ODRHash if it has not been previously
// computed.
Record->push_back(D->getODRHash());
}

bool ModulesDebugInfo =
Writer->Context->getLangOpts().ModulesDebugInfo && !D->isDependentType();
Expand Down
Loading