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

Backport static assert warning #18

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
ce53e91
Reland "[LoongArch] Support -march=native and -mtune="
SixWeining Jul 26, 2023
7e68c9e
[OpenMP] [OMPT] [7/8] Invoke tool-supplied callbacks before and after…
mhalk Jul 25, 2023
6ce6dcf
[XCOFF] Enable available_externally linkage for functions.
EsmeYi Jul 26, 2023
397390a
[lldb] Treat ARM64X images as ARM64.
cjacek Jul 25, 2023
ab863b3
[libc++][mdspan] Implement std::mdspan class
crtrott Jul 25, 2023
9957225
[libc++][mdspan] Fix uglification, categorize asserts and move tests
crtrott Jul 25, 2023
bc849e5
Revert "[FuncSpec] Add Phi nodes to the InstCostVisitor."
labrinea Jul 26, 2023
52647ad
HIP: Fix broken version check for deprecated macro
arsenm Jul 25, 2023
cd2570a
[Support] Remove llvm::is_trivially_{copy/move}_constructible
MaskRay Jul 26, 2023
1993d2f
[AArch64] Add test showing incorrect register usage of FMLAL. NFC
davemgreen Jul 27, 2023
1de314f
[AArch64] Correct the regtype of indexed fmlal
davemgreen Jul 27, 2023
d4a6c50
[clangd] Revert the symbol collector behavior to old pre-include-clea…
VitaNuo Jul 27, 2023
02ccc2a
[lld][ELF][test] Fix excessive output file size in loongarch-add-sub.s
xen0n Jul 26, 2023
313de9d
For #64088: mark vtable as used if we might emit a reference to it.
zygoloid Jul 25, 2023
2d69280
AMDGPU: Always custom lower extract_subvector
arsenm Jul 27, 2023
b56a38f
[AMDGPU] Precommit tests for D156308
Pierre-vh Jul 26, 2023
6614571
[AMDGPU] Fix PromoteAlloca Subvector Stores for Single Elements
Pierre-vh Jul 26, 2023
88ce4e8
[Driver] Link shared asan runtime lib with -z now on Solaris/x86
rorth Jul 27, 2023
726f698
[Clang][RISCV] Bump rvv intrinsics version to v0.12
eopXD Jul 27, 2023
14dbd4b
[CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable the hardened mode in l…
var-const Jul 27, 2023
3fbec44
[libc++][Modules] Recreate the top level `std` clang module
ian-twilightcoder Jul 24, 2023
991cbe1
[hexagon] restore library path arguments
androm3da Jul 26, 2023
57381c3
AMDGPU: Add some release notes
arsenm Jul 25, 2023
a72cc97
Add release note for assumes now recognizing class-like FP tests
arsenm Jul 25, 2023
8ea504b
Add release node for exact dynamic_cast optimization.
zygoloid Jul 27, 2023
90321b4
[libunwind] Fix build with -Wunused-function
smeenai Jul 27, 2023
aff99b1
[OpenMP] Do not always emit unused extern variables
jhuber6 Jul 26, 2023
bafedb1
[Clang][RISCV] Remove RVV intrinsics `vread_csr`,`vwrite_csr`
eopXD Jul 26, 2023
cff7a77
[ThinLTO] Use module hash instead of module ID for cache key
nikic Jul 28, 2023
fa79d2b
[libc++][Modules] Fix a few module related warnings
ian-twilightcoder Jul 28, 2023
08f4f4c
[docs] Add release notes for a Windows specific change in LLD
mstorsjo Jul 29, 2023
6ee03f1
[NFC] Fix version number in release tree
tru Jul 31, 2023
1b7406b
[XCOFF] Do not put MergeableCStrings in their own section
Jul 26, 2023
fcf0d0b
[docs] Add release notes for the LLVM 17 RVV intrinsics support
eopXD Jul 31, 2023
e5f9e16
[libcxx] Add release notes for Windows wide stdio stream handling
mstorsjo Jul 30, 2023
658d9e5
[AArch64] Add some basic handling for bf16 constants.
davemgreen Jul 31, 2023
3ada195
[RISCV] Use correct LMUL!=1 types for __attribute__((riscv_rvv_vector…
wangpc-pp Aug 1, 2023
0b2d5b9
[clang] allow const structs/unions/arrays to be constant expressions …
nickdesaulniers Aug 2, 2023
c278f4c
clang driver throws error for -mabi=elfv2 or elfv2
Long5hot Jul 29, 2023
d921e45
Revert "[AArch64] Merge LDRSWpre-LD[U]RSW pair into LDPSWpre"
alexfh Jul 26, 2023
a622459
[RISCV] Fix the CFI offset for callee-saved registers stored by Zcmp …
tclin914 Aug 2, 2023
1f7ff62
[libc++] Fix `std::out_of_range` thrown from `basic_stringbuf::str() &&`
pfusik Aug 1, 2023
0af7e5e
[PowerPC][MC] Recognize tlbilx and its mnemonics
ecnelises Aug 2, 2023
51a4700
Multilib & mfloat-abi release notes
mplatings Aug 1, 2023
d1603c3
[X86] Workaround possible CPUID bug in Sandy Bridge.
topperc Aug 3, 2023
d6417ad
[TableGen] Improve error report of unspecified arguments
wangpc-pp Aug 3, 2023
5ddfea3
[docs] Bump minimum GCC version to 7.4
MaskRay Jul 31, 2023
e4ea24d
Remove stale info and fix superscript numbering
AaronBallman Aug 1, 2023
44ce1f8
Commit to a primary definition for a class when we load its first
zygoloid Jul 25, 2023
79d850a
[RISCV] Use max pushed register to get pushed register number.
Aug 3, 2023
219cef0
[libc++][mdspan] Fix layout_left::stride(r)
crtrott Aug 4, 2023
1d07708
[libc++][print] Make `<print>` tests require file system support.
var-const Aug 4, 2023
a6bc750
Retain all jump table range checks when using BTI.
statham-arm Jul 31, 2023
e96c444
[SymbolSize] Improve the performance of SymbolSize computation
cachemeifyoucan Jul 30, 2023
e67ec17
cmake: add missing dependencies on ClangDriverOptions tablegen
jroelofs Aug 4, 2023
34cf263
[sanitizer_common] Remove hacks for __builtin_return_address abuse on…
rorth Aug 3, 2023
8ff2643
Revert "[CodeGen]Allow targets to use target specific COPY instructio…
vitalybuka Jul 26, 2023
99ed472
Revert "Reapply: [MemCpyOpt] implement single BB stack-move optimizat…
vitalybuka Aug 2, 2023
2f40e7b
[clang][RISCV] Fix bug in ABI handling of empty structs with hard FP …
asb Aug 7, 2023
9a53f9c
[libc++][print] Mark some more `<print>` tests as requiring a file sy…
var-const Aug 4, 2023
bdf9215
MIPS: clear_cache, use _flush_cache instead of cacheflush
wzssyqa Aug 7, 2023
3fc4317
AMDGPU: Remove note about spill handling changes
arsenm Aug 7, 2023
af23bb5
Revert "[clang][X86] Add __cpuidex function to cpuid.h"
boomanaiden154 Aug 4, 2023
ed4284a
[Clang][LoongArch] Fix ABI handling of empty structs in C++ to match …
SixWeining Aug 7, 2023
992f540
[clang/cxx-interop] Teach clang to ignore availability errors that co…
zoecarver Aug 7, 2023
edc0ee3
[libc++][modules] Fixes exporting named declarations.
mordante Jul 28, 2023
f8468c3
Bump version to 17.0.0-rc2
tru Aug 8, 2023
51e2839
[Clang] Backport static_assert messages fixes
cor3ntin Jul 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
77 changes: 26 additions & 51 deletions clang-tools-extra/clangd/index/SymbolCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Token.h"
#include "clang/Tooling/Inclusions/HeaderAnalysis.h"
#include "clang/Tooling/Inclusions/StandardLibrary.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
Expand Down Expand Up @@ -836,14 +837,25 @@ void SymbolCollector::setIncludeLocation(const Symbol &S, SourceLocation DefLoc,
// Use the expansion location to get the #include header since this is
// where the symbol is exposed.
IncludeFiles[S.ID] = SM.getDecomposedExpansionLoc(DefLoc).first;
}

auto [It, Inserted] = SymbolProviders.try_emplace(S.ID);
if (Inserted) {
auto Headers =
include_cleaner::headersForSymbol(Sym, SM, Opts.PragmaIncludes);
if (!Headers.empty())
It->second = Headers.front();
}
llvm::StringRef getStdHeader(const Symbol *S, const LangOptions &LangOpts) {
tooling::stdlib::Lang Lang = tooling::stdlib::Lang::CXX;
if (LangOpts.C11)
Lang = tooling::stdlib::Lang::C;
else if(!LangOpts.CPlusPlus)
return "";

if (S->Scope == "std::" && S->Name == "move") {
if (!S->Signature.contains(','))
return "<utility>";
return "<algorithm>";
}

if (auto StdSym = tooling::stdlib::Symbol::named(S->Scope, S->Name, Lang))
if (auto Header = StdSym->header())
return Header->name();
return "";
}

void SymbolCollector::finish() {
Expand All @@ -869,16 +881,13 @@ void SymbolCollector::finish() {
}
}
llvm::DenseMap<FileID, bool> FileToContainsImportsOrObjC;
llvm::DenseMap<include_cleaner::Header, std::string> HeaderSpelling;
// Fill in IncludeHeaders.
// We delay this until end of TU so header guards are all resolved.
for (const auto &[SID, OptionalProvider] : SymbolProviders) {
for (const auto &[SID, FID] : IncludeFiles) {
const Symbol *S = Symbols.find(SID);
if (!S)
continue;
assert(IncludeFiles.find(SID) != IncludeFiles.end());

const auto FID = IncludeFiles.at(SID);
// Determine if the FID is #include'd or #import'ed.
Symbol::IncludeDirective Directives = Symbol::Invalid;
auto CollectDirectives = shouldCollectIncludePath(S->SymInfo.Kind);
Expand All @@ -898,54 +907,20 @@ void SymbolCollector::finish() {
if (Directives == Symbol::Invalid)
continue;

// Use the include location-based logic for Objective-C symbols.
if (Directives & Symbol::Import) {
if (auto IncludeHeader = HeaderFileURIs->getIncludeHeader(FID);
!IncludeHeader.empty()) {
auto NewSym = *S;
NewSym.IncludeHeaders.push_back({IncludeHeader, 1, Directives});
Symbols.insert(NewSym);
}
// FIXME: use providers from include-cleaner library once it's polished
// for Objective-C.
continue;
}

assert(Directives == Symbol::Include);
// For #include's, use the providers computed by the include-cleaner
// library.
if (!OptionalProvider)
continue;
const auto &H = *OptionalProvider;
const auto [SpellingIt, Inserted] = HeaderSpelling.try_emplace(H);
if (Inserted) {
auto &SM = ASTCtx->getSourceManager();
if (H.kind() == include_cleaner::Header::Kind::Physical) {
if (auto Canonical =
HeaderFileURIs->mapCanonical(H.physical()->getName());
!Canonical.empty())
SpellingIt->second = Canonical;
else if (tooling::isSelfContainedHeader(H.physical(), SM,
PP->getHeaderSearchInfo()))
SpellingIt->second =
HeaderFileURIs->toURI(H.physical()->getLastRef());
} else {
SpellingIt->second = include_cleaner::spellHeader(
{H, PP->getHeaderSearchInfo(),
SM.getFileEntryForID(SM.getMainFileID())});
}
}
// FIXME: Use the include-cleaner library instead.
llvm::StringRef IncludeHeader = getStdHeader(S, ASTCtx->getLangOpts());
if (IncludeHeader.empty())
IncludeHeader = HeaderFileURIs->getIncludeHeader(FID);

if (!SpellingIt->second.empty()) {
if (!IncludeHeader.empty()) {
auto NewSym = *S;
NewSym.IncludeHeaders.push_back({SpellingIt->second, 1, Directives});
NewSym.IncludeHeaders.push_back({IncludeHeader, 1, Directives});
Symbols.insert(NewSym);
}
}

ReferencedSymbols.clear();
IncludeFiles.clear();
SymbolProviders.clear();
FilesWithObjCConstructs.clear();
}

Expand Down
5 changes: 0 additions & 5 deletions clang-tools-extra/clangd/index/SymbolCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ class SymbolCollector : public index::IndexDataConsumer {
void setIncludeLocation(const Symbol &S, SourceLocation,
const include_cleaner::Symbol &Sym);

// Providers for Symbol.IncludeHeaders.
// The final spelling is calculated in finish().
llvm::DenseMap<SymbolID, std::optional<include_cleaner::Header>>
SymbolProviders;

// Files which contain ObjC symbols.
// This is finalized and used in finish().
llvm::DenseSet<FileID> FilesWithObjCConstructs;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/unittests/FileIndexTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ TEST(FileIndexTest, IncludeCollected) {
"<the/good/header.h>");
}

TEST(FileIndexTest, IWYUPragmaExport) {
TEST(FileIndexTest, DISABLED_IWYUPragmaExport) {
FileIndex M;

TestTU File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ TEST_F(SymbolCollectorTest, IWYUPragmaWithDoubleQuotes) {
includeHeader("\"the/good/header.h\""))));
}

TEST_F(SymbolCollectorTest, IWYUPragmaExport) {
TEST_F(SymbolCollectorTest, DISABLED_IWYUPragmaExport) {
CollectorOpts.CollectIncludePath = true;
const std::string Header = R"cpp(#pragma once
#include "exporter.h"
Expand Down
51 changes: 51 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ C++ Language Changes
- Implemented `CWG2518 <https://wg21.link/CWG2518>`_ which allows ``static_assert(false)``
to not be ill-formed when its condition is evaluated in the context of a template definition.
- Declaring namespace std to be an inline namespace is now prohibited, `[namespace.std]p7`.
- Improved code generation for ``dynamic_cast`` to a ``final`` type. Instead of
dispatching to the runtime library to compare the RTTI data, Clang now
generates a direct comparison of the vtable pointer in cases where the ABI
requires the vtable for a class to be unique. This optimization can be
disabled with ``-fno-assume-unique-vtables``. This optimization is not yet
implemented for the MS C++ ABI.

C++20 Feature Support
^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -180,6 +186,9 @@ C Language Changes
_Generic(i, int : 0, const int : 1); // Warns about unreachable code, the
// result is 0, not 1.
_Generic(typeof(i), int : 0, const int : 1); // Result is 1, not 0.
- ``structs``, ``unions``, and ``arrays`` that are const may now be used as
constant expressions. This change is more consistent with the behavior of
GCC.

C2x Feature Support
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -279,6 +288,12 @@ New Compiler Flags
and thread-local variables—to guarantee that they can be directly addressed.
Since this inhibits the merging of the affected variables, the number of
individual relocations in the program will generally increase.
- ``-f[no-]assume-unique-vtables`` controls whether Clang assumes that each
class has a unique vtable address, when that is required by the ABI.
- ``-print-multi-flags-experimental`` prints the flags used for multilib
selection. See `the multilib docs <https://clang.llvm.org/docs/Multilib.html>`_
for more details.


Deprecated Compiler Flags
-------------------------
Expand Down Expand Up @@ -462,6 +477,10 @@ Improvements to Clang's diagnostics

Bug Fixes in This Version
-------------------------
- Fixed an issue where a class template specialization whose declaration is
instantiated in one module and whose definition is instantiated in another
module may end up with members associated with the wrong declaration of the
class, which can result in miscompiles in some cases.

- Added a new diagnostic warning group
``-Wdeprecated-redundant-constexpr-static-def``, under the existing
Expand Down Expand Up @@ -872,6 +891,10 @@ Arm and AArch64 Support
``-mfloat-abi=hard`` or a triple ending in ``hf``) would silently
use the soft-float ABI instead.

- Clang now emits ``-Wunsupported-abi`` if the hard-float ABI is specified
and the selected processor lacks floating point registers.
(`#55755 <https://github.com/llvm/llvm-project/issues/55755>`_)

- Clang builtin ``__arithmetic_fence`` and the command line option ``-fprotect-parens``
are now enabled for AArch64.

Expand All @@ -887,6 +910,9 @@ Arm and AArch64 Support
- Fix a crash when ``preserve_all`` calling convention is used on AArch64.
`Issue 58145 <https://github.com/llvm/llvm-project/issues/58145>`_

- Clang now warns if invalid target triples ``--target=aarch64-*-eabi`` or
``--target=arm-*-elf`` are specified.

Windows Support
^^^^^^^^^^^^^^^

Expand All @@ -895,10 +921,14 @@ LoongArch Support

- Patchable function entry (``-fpatchable-function-entry``) is now supported
on LoongArch.
- An ABI mismatch between GCC and Clang related to the handling of empty structs
in C++ parameter passing under ``lp64d`` ABI was fixed.
- Unaligned memory accesses can be toggled by ``-m[no-]unaligned-access`` or the
aliases ``-m[no-]strict-align``.
- Non ``$``-prefixed GPR names (e.g. ``r4`` and ``a0``) are allowed in inlineasm
like GCC does.
- The ``-march=native`` ``-mtune=`` options and ``__loongarch_{arch,tune}``
macros are now supported.

RISC-V Support
^^^^^^^^^^^^^^
Expand All @@ -917,6 +947,21 @@ RISC-V Support
- The rules for ordering of extensions in ``-march`` strings were relaxed. A
canonical ordering is no longer enforced on ``z*``, ``s*``, and ``x*``
prefixed extensions.
- An ABI mismatch between GCC and Clang related to the handling of empty
structs in C++ parameter passing under the hard floating point calling
conventions was fixed.
- Support the RVV intrinsics v0.12. Please checkout `the RVV C intrinsics
specification
<https://github.com/riscv-non-isa/rvv-intrinsic-doc/releases/tag/v0.12.0>`_.
It is expected there won't be any incompatibility from this v0.12 to the
specifications planned for v1.0.

* Added vector intrinsics that models control to the rounding mode
(``frm`` and ``vxrm``) for the floating-point instruction intrinsics and the
fixed-point instruction intrinsics.
* Added intrinsics for reinterpret cast between vector boolean and vector
integer ``m1`` value
* Removed the ``vread_csr`` and ``vwrite_csr`` intrinsics

CUDA/HIP Language Changes
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1106,6 +1151,12 @@ The following methods have been added:
- ``clang_Location_isInSystemHeader`` exposed via the ``is_in_system_header``
property of the `Location` class.

Configurable Multilib
---------------------
The BareMetal toolchain for AArch64 & ARM now supports multilib, configurable
via ``multilib.yaml``. See `the multilib docs <https://clang.llvm.org/docs/Multilib.html>`_
for more details.

Additional Information
======================

Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/DiagnosticLexKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ def ext_ms_reserved_user_defined_literal : ExtWarn<
def err_unsupported_string_concat : Error<
"unsupported non-standard concatenation of string literals">;

def warn_unevaluated_string_prefix : Warning<
"encoding prefix '%0' on an unevaluated string literal has no effect"
"%select{| and is incompatible with c++2c}1">,
InGroup<DiagGroup<"invalid-unevaluated-string">>;
def err_unevaluated_string_prefix : Error<
"an unevaluated string literal cannot have an encoding prefix">;
def err_unevaluated_string_udl : Error<
Expand Down
50 changes: 0 additions & 50 deletions clang/include/clang/Basic/riscv_vector.td
Original file line number Diff line number Diff line change
Expand Up @@ -990,56 +990,6 @@ multiclass RVVPseudoVNCVTBuiltin<string IR, string MName, string type_range,
}
}

// Define vread_csr&vwrite_csr described in RVV intrinsics doc.
let HeaderCode =
[{
enum RVV_CSR {
RVV_VSTART = 0,
RVV_VXSAT,
RVV_VXRM,
RVV_VCSR,
};

static __inline__ __attribute__((__always_inline__, __nodebug__))
unsigned long __riscv_vread_csr(enum RVV_CSR __csr) {
unsigned long __rv = 0;
switch (__csr) {
case RVV_VSTART:
__asm__ __volatile__ ("csrr\t%0, vstart" : "=r"(__rv) : : "memory");
break;
case RVV_VXSAT:
__asm__ __volatile__ ("csrr\t%0, vxsat" : "=r"(__rv) : : "memory");
break;
case RVV_VXRM:
__asm__ __volatile__ ("csrr\t%0, vxrm" : "=r"(__rv) : : "memory");
break;
case RVV_VCSR:
__asm__ __volatile__ ("csrr\t%0, vcsr" : "=r"(__rv) : : "memory");
break;
}
return __rv;
}

static __inline__ __attribute__((__always_inline__, __nodebug__))
void __riscv_vwrite_csr(enum RVV_CSR __csr, unsigned long __value) {
switch (__csr) {
case RVV_VSTART:
__asm__ __volatile__ ("csrw\tvstart, %z0" : : "rJ"(__value) : "memory");
break;
case RVV_VXSAT:
__asm__ __volatile__ ("csrw\tvxsat, %z0" : : "rJ"(__value) : "memory");
break;
case RVV_VXRM:
__asm__ __volatile__ ("csrw\tvxrm, %z0" : : "rJ"(__value) : "memory");
break;
case RVV_VCSR:
__asm__ __volatile__ ("csrw\tvcsr, %z0" : : "rJ"(__value) : "memory");
break;
}
}
}] in
def vread_vwrite_csr: RVVHeader;

let HeaderCode =
[{
#define __riscv_vlenb() __builtin_rvv_vlenb()
Expand Down
1 change: 1 addition & 0 deletions clang/lib/ARCMigrate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ add_clang_library(clangARCMigrate

DEPENDS
omp_gen
ClangDriverOptions
)
14 changes: 0 additions & 14 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15218,14 +15218,6 @@ static bool FastEvaluateAsRValue(const Expr *Exp, Expr::EvalResult &Result,
return true;
}

// FIXME: Evaluating values of large array and record types can cause
// performance problems. Only do so in C++11 for now.
if (Exp->isPRValue() &&
(Exp->getType()->isArrayType() || Exp->getType()->isRecordType()) &&
!Ctx.getLangOpts().CPlusPlus11) {
IsConst = false;
return true;
}
return false;
}

Expand Down Expand Up @@ -15467,12 +15459,6 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
return Name;
});

// FIXME: Evaluating initializers for large array and record types can cause
// performance problems. Only do so in C++11 for now.
if (isPRValue() && (getType()->isArrayType() || getType()->isRecordType()) &&
!Ctx.getLangOpts().CPlusPlus11)
return false;

Expr::EvalStatus EStatus;
EStatus.Diag = &Notes;

Expand Down
Loading