Skip to content

Commit 7c7966d

Browse files
authored
Merge branch 'main' into remove_no_op_bitcast_DXIL_reland
2 parents b2a389a + 82f1967 commit 7c7966d

File tree

540 files changed

+14630
-8480
lines changed

Some content is hidden

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

540 files changed

+14630
-8480
lines changed

clang-tools-extra/clangd/refactor/Rename.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ getMappedRanges(ArrayRef<Range> Indexed, ArrayRef<SymbolRange> Lexed) {
13081308
return std::nullopt;
13091309
}
13101310
// Fast check for the special subset case.
1311-
if (std::includes(Indexed.begin(), Indexed.end(), Lexed.begin(), Lexed.end()))
1311+
if (llvm::includes(Indexed, Lexed))
13121312
return Lexed.vec();
13131313

13141314
std::vector<size_t> Best;

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ Bug Fixes in This Version
694694
- Constant evaluation now correctly runs the destructor of a variable declared in
695695
the second clause of a C-style ``for`` loop. (#GH139818)
696696
- Fixed a bug with constexpr evaluation for structs containing unions in case of C++ modules. (#GH143168)
697+
- Fixed incorrect token location when emitting diagnostics for tokens expanded from macros. (#GH143216)
697698

698699
Bug Fixes to Compiler Builtins
699700
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
488488
/// if possible.
489489
///
490490
/// Not serialized intentionally.
491-
llvm::StringMap<const Module *> PrimaryModuleNameMap;
492-
llvm::DenseMap<const Module *, const Module *> SameModuleLookupSet;
491+
mutable llvm::StringMap<const Module *> PrimaryModuleNameMap;
492+
mutable llvm::DenseMap<const Module *, const Module *> SameModuleLookupSet;
493493

494494
static constexpr unsigned ConstantArrayTypesLog2InitSize = 8;
495495
static constexpr unsigned GeneralTypesLog2InitSize = 9;
@@ -1151,7 +1151,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
11511151
///
11521152
/// FIXME: The signature may be confusing since `clang::Module` means to
11531153
/// a module fragment or a module unit but not a C++20 module.
1154-
bool isInSameModule(const Module *M1, const Module *M2);
1154+
bool isInSameModule(const Module *M1, const Module *M2) const;
11551155

11561156
TranslationUnitDecl *getTranslationUnitDecl() const {
11571157
return TUDecl->getMostRecentDecl();

clang/include/clang/AST/DeclBase.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ class alignas(8) Decl {
646646
return getModuleOwnershipKind() == ModuleOwnershipKind::ModulePrivate;
647647
}
648648

649+
/// Whether this declaration was a local declaration to a C++20
650+
/// named module.
651+
bool isModuleLocal() const;
652+
649653
/// Whether this declaration was exported in a lexical context.
650654
/// e.g.:
651655
///

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4630,6 +4630,7 @@ def OMPDeclareVariant : InheritableAttr {
46304630
OMPTraitInfoArgument<"TraitInfos">,
46314631
VariadicExprArgument<"AdjustArgsNothing">,
46324632
VariadicExprArgument<"AdjustArgsNeedDevicePtr">,
4633+
VariadicExprArgument<"AdjustArgsNeedDeviceAddr">,
46334634
VariadicOMPInteropInfoArgument<"AppendArgs">,
46344635
];
46354636
let AdditionalMembers = [{

clang/include/clang/Basic/Diagnostic.h

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "clang/Basic/DiagnosticOptions.h"
1919
#include "clang/Basic/SourceLocation.h"
2020
#include "clang/Basic/Specifiers.h"
21+
#include "clang/Basic/UnsignedOrNone.h"
2122
#include "llvm/ADT/ArrayRef.h"
2223
#include "llvm/ADT/DenseMap.h"
2324
#include "llvm/ADT/FunctionExtras.h"
@@ -49,6 +50,7 @@ class FileSystem;
4950
namespace clang {
5051

5152
class DeclContext;
53+
class Diagnostic;
5254
class DiagnosticBuilder;
5355
class DiagnosticConsumer;
5456
class IdentifierInfo;
@@ -228,6 +230,8 @@ class DiagStorageAllocator {
228230
class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
229231
public:
230232
/// The level of the diagnostic, after it has been through mapping.
233+
// FIXME: Make this an alias for DiagnosticIDs::Level as soon as
234+
// we can use 'using enum'.
231235
enum Level {
232236
Ignored = DiagnosticIDs::Ignored,
233237
Note = DiagnosticIDs::Note,
@@ -420,10 +424,13 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
420424
bool empty() const { return Files.empty(); }
421425

422426
/// Clear out this map.
423-
void clear() {
427+
void clear(bool Soft) {
428+
// Just clear the cache when in soft mode.
424429
Files.clear();
425-
FirstDiagState = CurDiagState = nullptr;
426-
CurDiagStateLoc = SourceLocation();
430+
if (!Soft) {
431+
FirstDiagState = CurDiagState = nullptr;
432+
CurDiagStateLoc = SourceLocation();
433+
}
427434
}
428435

429436
/// Produce a debugging dump of the diagnostic state.
@@ -532,7 +539,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
532539
///
533540
/// This is used to emit continuation diagnostics with the same level as the
534541
/// diagnostic that they follow.
535-
DiagnosticIDs::Level LastDiagLevel;
542+
Level LastDiagLevel;
536543

537544
/// Number of warnings reported
538545
unsigned NumWarnings;
@@ -777,18 +784,16 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
777784
/// the middle of another diagnostic.
778785
///
779786
/// This can be used by clients who suppress diagnostics themselves.
780-
void setLastDiagnosticIgnored(bool Ignored) {
781-
if (LastDiagLevel == DiagnosticIDs::Fatal)
787+
void setLastDiagnosticIgnored(bool IsIgnored) {
788+
if (LastDiagLevel == Fatal)
782789
FatalErrorOccurred = true;
783-
LastDiagLevel = Ignored ? DiagnosticIDs::Ignored : DiagnosticIDs::Warning;
790+
LastDiagLevel = IsIgnored ? Ignored : Warning;
784791
}
785792

786793
/// Determine whether the previous diagnostic was ignored. This can
787794
/// be used by clients that want to determine whether notes attached to a
788795
/// diagnostic will be suppressed.
789-
bool isLastDiagnosticIgnored() const {
790-
return LastDiagLevel == DiagnosticIDs::Ignored;
791-
}
796+
bool isLastDiagnosticIgnored() const { return LastDiagLevel == Ignored; }
792797

793798
/// Controls whether otherwise-unmapped extension diagnostics are
794799
/// mapped onto ignore/warning/error.
@@ -918,6 +923,10 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
918923
/// Reset the state of the diagnostic object to its initial configuration.
919924
/// \param[in] soft - if true, doesn't reset the diagnostic mappings and state
920925
void Reset(bool soft = false);
926+
/// We keep a cache of FileIDs for diagnostics mapped by pragmas. These might
927+
/// get invalidated when diagnostics engine is shared across different
928+
/// compilations. Provide users with a way to reset that.
929+
void ResetPragmas();
921930

922931
//===--------------------------------------------------------------------===//
923932
// DiagnosticsEngine classification and reporting interfaces.
@@ -1024,9 +1033,10 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
10241033
/// Used to report a diagnostic that is finally fully formed.
10251034
///
10261035
/// \returns true if the diagnostic was emitted, false if it was suppressed.
1027-
bool ProcessDiag(const DiagnosticBuilder &DiagBuilder) {
1028-
return Diags->ProcessDiag(*this, DiagBuilder);
1029-
}
1036+
bool ProcessDiag(const DiagnosticBuilder &DiagBuilder);
1037+
1038+
/// Forward a diagnostic to the DiagnosticConsumer.
1039+
void Report(Level DiagLevel, const Diagnostic &Info);
10301040

10311041
/// @name Diagnostic Emission
10321042
/// @{

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def err_drv_cannot_open_randomize_layout_seed_file : Error<
206206
"cannot read randomize layout seed file '%0'">;
207207
def err_drv_invalid_version_number : Error<
208208
"invalid version number in '%0'">;
209+
def err_drv_invalid_version_number_inferred
210+
: Error<"invalid version number '%0' inferred from '%1'">;
209211
def err_drv_missing_version_number : Error<"missing version number in '%0'">;
210212
def err_drv_kcfi_arity_unsupported_target : Error<
211213
"target '%0' is unsupported by -fsanitize-kcfi-arity">;

clang/include/clang/Basic/DiagnosticIDs.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,6 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
483483

484484
Class getDiagClass(unsigned DiagID) const;
485485

486-
/// Used to report a diagnostic that is finally fully formed.
487-
///
488-
/// \returns \c true if the diagnostic was emitted, \c false if it was
489-
/// suppressed.
490-
bool ProcessDiag(DiagnosticsEngine &Diag,
491-
const DiagnosticBuilder &DiagBuilder) const;
492-
493-
/// Used to emit a diagnostic that is finally fully formed,
494-
/// ignoring suppression.
495-
void EmitDiag(DiagnosticsEngine &Diag, const DiagnosticBuilder &DiagBuilder,
496-
Level DiagLevel) const;
497-
498486
/// Whether the diagnostic may leave the AST in a state where some
499487
/// invariants can break.
500488
bool isUnrecoverable(unsigned DiagID) const;

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,8 +1581,10 @@ def err_omp_unexpected_append_op : Error<
15811581
"unexpected operation specified in 'append_args' clause, expected 'interop'">;
15821582
def err_omp_unexpected_execution_modifier : Error<
15831583
"unexpected 'execution' modifier in non-executable context">;
1584-
def err_omp_unknown_adjust_args_op : Error<
1585-
"incorrect adjust_args type, expected 'need_device_ptr' or 'nothing'">;
1584+
def err_omp_unknown_adjust_args_op
1585+
: Error<
1586+
"incorrect 'adjust_args' type, expected 'need_device_ptr'%select{|, "
1587+
"'need_device_addr',}0 or 'nothing'">;
15861588
def err_omp_declare_variant_wrong_clause : Error<
15871589
"expected %select{'match'|'match', 'adjust_args', or 'append_args'}0 clause "
15881590
"on 'omp declare variant' directive">;

clang/include/clang/Basic/OpenMPKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ OPENMP_ORIGINAL_SHARING_MODIFIER(default)
214214
// Adjust-op kinds for the 'adjust_args' clause.
215215
OPENMP_ADJUST_ARGS_KIND(nothing)
216216
OPENMP_ADJUST_ARGS_KIND(need_device_ptr)
217+
OPENMP_ADJUST_ARGS_KIND(need_device_addr)
217218

218219
// Binding kinds for the 'bind' clause.
219220
OPENMP_BIND_KIND(teams)

0 commit comments

Comments
 (0)