Skip to content

Commit 01dc877

Browse files
authored
Merge branch 'main' into fix/111854
2 parents f19a1a1 + 11c8188 commit 01dc877

File tree

671 files changed

+20305
-13053
lines changed

Some content is hidden

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

671 files changed

+20305
-13053
lines changed

clang-tools-extra/clang-doc/Generators.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ std::string getTagType(TagTypeKind AS);
5555
} // namespace doc
5656
} // namespace clang
5757

58+
namespace llvm {
59+
extern template class Registry<clang::doc::Generator>;
60+
} // namespace llvm
61+
5862
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H

clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ using ClangTidyModuleRegistry = llvm::Registry<ClangTidyModule>;
1818

1919
} // namespace clang::tidy
2020

21+
namespace llvm {
22+
extern template class Registry<clang::tidy::ClangTidyModule>;
23+
} // namespace llvm
24+
2125
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYMODULEREGISTRY_H

clang-tools-extra/clangd/URI.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,8 @@ typedef llvm::Registry<URIScheme> URISchemeRegistry;
133133
} // namespace clangd
134134
} // namespace clang
135135

136+
namespace llvm {
137+
extern template class Registry<clang::clangd::URIScheme>;
138+
} // namespace llvm
139+
136140
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_URI_H

clang-tools-extra/clangd/refactor/Tweak.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,8 @@ prepareTweak(StringRef ID, const Tweak::Selection &S,
147147
} // namespace clangd
148148
} // namespace clang
149149

150+
namespace llvm {
151+
extern template class Registry<clang::clangd::Tweak>;
152+
} // namespace llvm
153+
150154
#endif

clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ using IncludeSpellingStrategy = llvm::Registry<IncludeSpeller>;
4646
std::string spellHeader(const IncludeSpeller::Input &Input);
4747
} // namespace clang::include_cleaner
4848

49+
namespace llvm {
50+
extern template class Registry<clang::include_cleaner::IncludeSpeller>;
51+
} // namespace llvm
52+
4953
#endif

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ Bug Fixes in This Version
439439
- Fixed a crash when trying to transform a dependent address space type. Fixes #GH101685.
440440
- Fixed a crash when diagnosing format strings and encountering an empty
441441
delimited escape sequence (e.g., ``"\o{}"``). #GH102218
442+
- Fixed a crash using ``__array_rank`` on 64-bit targets. (#GH113044).
442443
- The warning emitted for an unsupported register variable type now points to
443444
the unsupported type instead of the ``register`` keyword (#GH109776).
444445

@@ -507,7 +508,7 @@ Bug Fixes to C++ Support
507508
- Clang no longer tries to capture non-odr used default arguments of template parameters of generic lambdas (#GH107048)
508509
- Fixed a bug where defaulted comparison operators would remove ``const`` from base classes. (#GH102588)
509510
- Fix a crash when using ``source_location`` in the trailing return type of a lambda expression. (#GH67134)
510-
- A follow-up fix was added for (#GH61460), as the previous fix was not entirely correct. (#GH86361)
511+
- A follow-up fix was added for (#GH61460), as the previous fix was not entirely correct. (#GH86361), (#GH112352)
511512
- Fixed a crash in the typo correction of an invalid CTAD guide. (#GH107887)
512513
- Fixed a crash when clang tries to subtitute parameter pack while retaining the parameter
513514
pack. (#GH63819), (#GH107560)
@@ -539,6 +540,9 @@ Bug Fixes to C++ Support
539540
- Fix erroneous templated array size calculation leading to crashes in generated code. (#GH41441)
540541
- During the lookup for a base class name, non-type names are ignored. (#GH16855)
541542
- Fix a crash when recovering an invalid expression involving an explicit object member conversion operator. (#GH112559)
543+
- Clang incorrectly considered a class with an anonymous union member to not be
544+
const-default-constructible even if a union member has a default member initializer.
545+
(#GH95854).
542546
- Fixed assertion failure in range calculations for conditional throw expressions (#GH111854)
543547

544548
Bug Fixes to AST Handling

clang/include/clang/ASTMatchers/ASTMatchersMacros.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
#ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H
5050
#define LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H
5151

52+
#include "clang/Support/Compiler.h"
53+
5254
/// AST_MATCHER_FUNCTION(ReturnType, DefineMatcher) { ... }
5355
/// defines a zero parameter function named DefineMatcher() that returns a
5456
/// ReturnType object.
@@ -367,7 +369,7 @@
367369
static QualType (T::*value())() const { return &T::FunctionName; } \
368370
}; \
369371
} \
370-
extern const ::clang::ast_matchers::internal:: \
372+
CLANG_ABI extern const ::clang::ast_matchers::internal:: \
371373
TypeTraversePolymorphicMatcher< \
372374
QualType, \
373375
::clang::ast_matchers::internal::TypeMatcher##MatcherName##Getter, \
@@ -407,7 +409,7 @@
407409
static TypeLoc (T::*value())() const { return &T::FunctionName##Loc; } \
408410
}; \
409411
} \
410-
extern const ::clang::ast_matchers::internal:: \
412+
CLANG_ABI extern const ::clang::ast_matchers::internal:: \
411413
TypeTraversePolymorphicMatcher< \
412414
TypeLoc, \
413415
::clang::ast_matchers::internal:: \

clang/include/clang/Basic/AttrDocs.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ sign. For example:
26692669

26702670
.. code-block:: c++
26712671

2672-
__attribute__((target_clones("sha2+memtag2", "fcma+sve2-pmull128")))
2672+
__attribute__((target_clones("sha2+memtag", "fcma+sve2-pmull128")))
26732673
void foo() {}
26742674

26752675
For every multiversioned function a ``default`` (fallback) implementation

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ TARGET_BUILTIN(__builtin_amdgcn_frexp_exph, "sh", "nc", "16-bit-insts")
224224
TARGET_BUILTIN(__builtin_amdgcn_fracth, "hh", "nc", "16-bit-insts")
225225
TARGET_BUILTIN(__builtin_amdgcn_classh, "bhi", "nc", "16-bit-insts")
226226
TARGET_BUILTIN(__builtin_amdgcn_s_memrealtime, "WUi", "n", "s-memrealtime")
227-
TARGET_BUILTIN(__builtin_amdgcn_mov_dpp, "iiIiIiIiIb", "nc", "dpp")
228-
TARGET_BUILTIN(__builtin_amdgcn_update_dpp, "iiiIiIiIiIb", "nc", "dpp")
227+
TARGET_BUILTIN(__builtin_amdgcn_mov_dpp, "iiIiIiIiIb", "nct", "dpp")
228+
TARGET_BUILTIN(__builtin_amdgcn_update_dpp, "iiiIiIiIiIb", "nct", "dpp")
229229
TARGET_BUILTIN(__builtin_amdgcn_s_dcache_wb, "v", "n", "gfx8-insts")
230230
TARGET_BUILTIN(__builtin_amdgcn_perm, "UiUiUiUi", "nc", "gfx8-insts")
231231

clang/include/clang/Basic/FileManager.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ class FileManager : public RefCountedBase<FileManager> {
124124
std::unique_ptr<FileSystemStatCache> StatCache;
125125

126126
std::error_code getStatValue(StringRef Path, llvm::vfs::Status &Status,
127-
bool isFile,
128-
std::unique_ptr<llvm::vfs::File> *F);
127+
bool isFile, std::unique_ptr<llvm::vfs::File> *F,
128+
bool IsText = true);
129129

130130
/// Add all ancestors of the given path (pointing to either a file
131131
/// or a directory) as virtual directories.
@@ -230,7 +230,8 @@ class FileManager : public RefCountedBase<FileManager> {
230230
/// the failure to find this file.
231231
llvm::Expected<FileEntryRef> getFileRef(StringRef Filename,
232232
bool OpenFile = false,
233-
bool CacheFailure = true);
233+
bool CacheFailure = true,
234+
bool IsText = true);
234235

235236
/// Get the FileEntryRef for stdin, returning an error if stdin cannot be
236237
/// read.
@@ -290,23 +291,28 @@ class FileManager : public RefCountedBase<FileManager> {
290291

291292
/// Open the specified file as a MemoryBuffer, returning a new
292293
/// MemoryBuffer if successful, otherwise returning null.
294+
/// The IsText parameter controls whether the file should be opened as a text
295+
/// or binary file, and should be set to false if the file contents should be
296+
/// treated as binary.
293297
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
294298
getBufferForFile(FileEntryRef Entry, bool isVolatile = false,
295299
bool RequiresNullTerminator = true,
296-
std::optional<int64_t> MaybeLimit = std::nullopt);
300+
std::optional<int64_t> MaybeLimit = std::nullopt,
301+
bool IsText = true);
297302
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
298303
getBufferForFile(StringRef Filename, bool isVolatile = false,
299304
bool RequiresNullTerminator = true,
300-
std::optional<int64_t> MaybeLimit = std::nullopt) const {
305+
std::optional<int64_t> MaybeLimit = std::nullopt,
306+
bool IsText = true) const {
301307
return getBufferForFileImpl(Filename,
302308
/*FileSize=*/MaybeLimit.value_or(-1),
303-
isVolatile, RequiresNullTerminator);
309+
isVolatile, RequiresNullTerminator, IsText);
304310
}
305311

306312
private:
307313
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
308314
getBufferForFileImpl(StringRef Filename, int64_t FileSize, bool isVolatile,
309-
bool RequiresNullTerminator) const;
315+
bool RequiresNullTerminator, bool IsText) const;
310316

311317
DirectoryEntry *&getRealDirEntry(const llvm::vfs::Status &Status);
312318

clang/include/clang/Basic/FileSystemStatCache.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class FileSystemStatCache {
4848
/// success for directories (not files). On a successful file lookup, the
4949
/// implementation can optionally fill in \p F with a valid \p File object and
5050
/// the client guarantees that it will close it.
51-
static std::error_code
52-
get(StringRef Path, llvm::vfs::Status &Status, bool isFile,
53-
std::unique_ptr<llvm::vfs::File> *F,
54-
FileSystemStatCache *Cache, llvm::vfs::FileSystem &FS);
51+
static std::error_code get(StringRef Path, llvm::vfs::Status &Status,
52+
bool isFile, std::unique_ptr<llvm::vfs::File> *F,
53+
FileSystemStatCache *Cache,
54+
llvm::vfs::FileSystem &FS, bool IsText = true);
5555

5656
protected:
5757
// FIXME: The pointer here is a non-owning/optional reference to the

clang/include/clang/Basic/ParsedAttrInfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "clang/Basic/AttrSubjectMatchRules.h"
1919
#include "clang/Basic/AttributeCommonInfo.h"
20+
#include "clang/Support/Compiler.h"
2021
#include "llvm/ADT/ArrayRef.h"
2122
#include "llvm/Support/Registry.h"
2223
#include <climits>
@@ -175,4 +176,8 @@ const std::list<std::unique_ptr<ParsedAttrInfo>> &getAttributePluginInstances();
175176

176177
} // namespace clang
177178

179+
namespace llvm {
180+
extern template class CLANG_TEMPLATE_ABI Registry<clang::ParsedAttrInfo>;
181+
} // namespace llvm
182+
178183
#endif // LLVM_CLANG_BASIC_PARSEDATTRINFO_H

clang/include/clang/Basic/TargetInfo.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ enum class FloatModeKind {
8787
struct TransferrableTargetInfo {
8888
unsigned char PointerWidth, PointerAlign;
8989
unsigned char BoolWidth, BoolAlign;
90+
unsigned char ShortWidth, ShortAlign;
9091
unsigned char IntWidth, IntAlign;
9192
unsigned char HalfWidth, HalfAlign;
9293
unsigned char BFloat16Width, BFloat16Align;
@@ -497,13 +498,10 @@ class TargetInfo : public TransferrableTargetInfo,
497498
unsigned getCharWidth() const { return 8; } // FIXME
498499
unsigned getCharAlign() const { return 8; } // FIXME
499500

500-
/// Return the size of 'signed short' and 'unsigned short' for this
501-
/// target, in bits.
502-
unsigned getShortWidth() const { return 16; } // FIXME
503-
504-
/// Return the alignment of 'signed short' and 'unsigned short' for
505-
/// this target.
506-
unsigned getShortAlign() const { return 16; } // FIXME
501+
/// getShortWidth/Align - Return the size of 'signed short' and
502+
/// 'unsigned short' for this target, in bits.
503+
unsigned getShortWidth() const { return ShortWidth; }
504+
unsigned getShortAlign() const { return ShortAlign; }
507505

508506
/// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
509507
/// this target, in bits.

clang/include/clang/Frontend/FrontendPluginRegistry.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define LLVM_CLANG_FRONTEND_FRONTENDPLUGINREGISTRY_H
1515

1616
#include "clang/Frontend/FrontendAction.h"
17+
#include "clang/Support/Compiler.h"
1718
#include "llvm/Support/Registry.h"
1819

1920
namespace clang {
@@ -23,4 +24,8 @@ using FrontendPluginRegistry = llvm::Registry<PluginASTAction>;
2324

2425
} // namespace clang
2526

27+
namespace llvm {
28+
extern template class CLANG_TEMPLATE_ABI Registry<clang::PluginASTAction>;
29+
} // namespace llvm
30+
2631
#endif // LLVM_CLANG_FRONTEND_FRONTENDPLUGINREGISTRY_H

clang/include/clang/Lex/Preprocessor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "clang/Lex/PPEmbedParameters.h"
3333
#include "clang/Lex/Token.h"
3434
#include "clang/Lex/TokenLexer.h"
35+
#include "clang/Support/Compiler.h"
3536
#include "llvm/ADT/APSInt.h"
3637
#include "llvm/ADT/ArrayRef.h"
3738
#include "llvm/ADT/DenseMap.h"
@@ -3060,4 +3061,8 @@ using PragmaHandlerRegistry = llvm::Registry<PragmaHandler>;
30603061

30613062
} // namespace clang
30623063

3064+
namespace llvm {
3065+
extern template class CLANG_TEMPLATE_ABI Registry<clang::PragmaHandler>;
3066+
} // namespace llvm
3067+
30633068
#endif // LLVM_CLANG_LEX_PREPROCESSOR_H

clang/include/clang/Tooling/CompilationDatabasePluginRegistry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
1010
#define LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
1111

12+
#include "clang/Support/Compiler.h"
1213
#include "clang/Tooling/CompilationDatabase.h"
1314
#include "llvm/Support/Registry.h"
1415

@@ -42,4 +43,9 @@ using CompilationDatabasePluginRegistry =
4243
} // namespace tooling
4344
} // namespace clang
4445

46+
namespace llvm {
47+
extern template class CLANG_TEMPLATE_ABI
48+
Registry<clang::tooling::CompilationDatabasePlugin>;
49+
} // namespace llvm
50+
4551
#endif // LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H

clang/include/clang/Tooling/ToolExecutorPluginRegistry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_CLANG_TOOLING_TOOLEXECUTORPLUGINREGISTRY_H
1010
#define LLVM_CLANG_TOOLING_TOOLEXECUTORPLUGINREGISTRY_H
1111

12+
#include "clang/Support/Compiler.h"
1213
#include "clang/Tooling/Execution.h"
1314
#include "llvm/Support/Registry.h"
1415

@@ -20,4 +21,9 @@ using ToolExecutorPluginRegistry = llvm::Registry<ToolExecutorPlugin>;
2021
} // namespace tooling
2122
} // namespace clang
2223

24+
namespace llvm {
25+
extern template class CLANG_TEMPLATE_ABI
26+
Registry<clang::tooling::ToolExecutorPlugin>;
27+
} // namespace llvm
28+
2329
#endif // LLVM_CLANG_TOOLING_TOOLEXECUTORPLUGINREGISTRY_H

0 commit comments

Comments
 (0)