Skip to content

Commit 4f04550

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents 60dbdfe + cb8495c commit 4f04550

File tree

423 files changed

+123098
-64906
lines changed

Some content is hidden

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

423 files changed

+123098
-64906
lines changed

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ static bool isPublic(const clang::AccessSpecifier AS,
261261
const clang::Linkage Link) {
262262
if (AS == clang::AccessSpecifier::AS_private)
263263
return false;
264-
else if ((Link == clang::Linkage::Module) ||
265-
(Link == clang::Linkage::External))
264+
if ((Link == clang::Linkage::Module) || (Link == clang::Linkage::External))
266265
return true;
267266
return false; // otherwise, linkage is some form of internal linkage
268267
}

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,8 @@ clang-format
683683

684684
libclang
685685
--------
686+
- Fixed a bug in ``clang_File_isEqual`` that sometimes led to different
687+
in-memory files to be considered as equal.
686688
- Added ``clang_visitCXXMethods``, which allows visiting the methods
687689
of a class.
688690
- Added ``clang_getFullyQualifiedName``, which provides fully qualified type names as

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,14 @@ def err_drv_print_header_env_var : Error<
396396
"environment variable CC_PRINT_HEADERS_%select{FORMAT|FILTERING}0 has invalid value %1">;
397397
def err_drv_print_header_env_var_combination : Error<
398398
"unsupported combination: CC_PRINT_HEADERS_FORMAT=%0 and CC_PRINT_HEADERS_FILTERING=%1">;
399-
def err_drv_print_header_env_var_combination_cc1 : Error<
399+
def err_drv_print_header_env_var_invalid_format : Error<
400+
"environment variable CC_PRINT_HEADERS_FORMAT=%0 requires a compatible value for CC_PRINT_HEADERS_FILTERING">;
401+
def err_drv_print_header_cc1_invalid_combination : Error<
400402
"unsupported combination: -header-include-format=%0 and -header-include-filtering=%1">;
403+
def err_drv_print_header_cc1_invalid_filtering : Error<
404+
"-header-include-filtering=%0 requires a compatible value for -header-include-format">;
405+
def err_drv_print_header_cc1_invalid_format : Error<
406+
"-header-include-format=%0 requires a compatible value for -header-include-filtering">;
401407

402408
def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup<Deprecated>;
403409
def warn_drv_optimization_value : Warning<"optimization level '%0' is not supported; using '%1%2' instead">,

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,8 +1836,11 @@ def err_hlsl_virtual_function
18361836
def err_hlsl_virtual_inheritance
18371837
: Error<"virtual inheritance is unsupported in HLSL">;
18381838

1839-
// HLSL Root Siganture diagnostic messages
1839+
// HLSL Root Signature Parser Diagnostics
18401840
def err_hlsl_unexpected_end_of_params
18411841
: Error<"expected %0 to denote end of parameters, or, another valid parameter of %1">;
1842+
def err_hlsl_rootsig_repeat_param : Error<"specified the same parameter '%0' multiple times">;
1843+
def err_hlsl_rootsig_missing_param : Error<"did not specify mandatory parameter '%0'">;
1844+
def err_hlsl_number_literal_overflow : Error<"integer literal is too large to be represented as a 32-bit %select{signed |}0 integer type">;
18421845

18431846
} // end of Parser diagnostics

clang/include/clang/Basic/arm_sme.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,24 @@ let SMETargetGuard = "sme2,sme-mop4,sme-b16b16" in {
321321
defm SVBMOP4S_H : MOP4<"s", "_za16", "b", "aarch64_sme_mop4s", [ImmCheck<0, ImmCheck0_1>]>;
322322
}
323323

324+
////////////////////////////////////////////////////////////////////////////////
325+
// SME2 - FP8 FMOP4A, FMOP4S
326+
327+
multiclass MOP4_FP8<string za, list<ImmCheck> checks> {
328+
def _1x1 : Inst<"svmop4a" # "[_1x1]" # za # "[_{d}_{d}]", "vidd>", "m", MergeNone, "aarch64_sme_fp8_fmop4a" # za # "_1x1", [IsInOutZA, IsStreaming], checks>;
329+
def _1x2 : Inst<"svmop4a" # "[_1x2]" # za # "[_{d}_{d}]", "vid2>", "m", MergeNone, "aarch64_sme_fp8_fmop4a" # za # "_1x2", [IsInOutZA, IsStreaming], checks>;
330+
def _2x1 : Inst<"svmop4a" # "[_2x1]" # za # "[_{d}_{d}]", "vi2d>", "m", MergeNone, "aarch64_sme_fp8_fmop4a" # za # "_2x1", [IsInOutZA, IsStreaming], checks>;
331+
def _2x2 : Inst<"svmop4a" # "[_2x2]" # za # "[_{d}_{d}]", "vi22>", "m", MergeNone, "aarch64_sme_fp8_fmop4a" # za # "_2x2", [IsInOutZA, IsStreaming], checks>;
332+
}
333+
334+
let SMETargetGuard = "sme2,sme-mop4,sme-f8f32" in {
335+
defm SVMOP4A_FP8_ZA32 : MOP4_FP8<"_za32", [ImmCheck<0, ImmCheck0_3>]>;
336+
}
337+
338+
let SMETargetGuard = "sme2,sme-mop4,sme-f8f16" in {
339+
defm SVMOP4A_FP8_ZA16 : MOP4_FP8<"_za16", [ImmCheck<0, ImmCheck0_1>]>;
340+
}
341+
324342
////////////////////////////////////////////////////////////////////////////////
325343
// SME2 - SMOP4A, SMOP4S, UMOP4A, UMOP4S
326344

clang/include/clang/CIR/Dialect/IR/CIRAttrs.td

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ class CIR_Attr<string name, string attrMnemonic, list<Trait> traits = []>
2727
let mnemonic = attrMnemonic;
2828
}
2929

30+
class CIR_TypedAttr<string name, string attrMnemonic, list<Trait> traits = []>
31+
: CIR_Attr<name, attrMnemonic, !listconcat(traits, [TypedAttrInterface])> {
32+
33+
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
34+
35+
let builders = [
36+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
37+
return $_get(type.getContext(), type);
38+
}]>
39+
];
40+
41+
let assemblyFormat = [{}];
42+
}
43+
3044
class CIRUnitAttr<string name, string attrMnemonic, list<Trait> traits = []>
3145
: CIR_Attr<name, attrMnemonic, traits> {
3246
let returnType = "bool";
@@ -64,43 +78,23 @@ def CIR_BoolAttr : CIR_Attr<"Bool", "bool", [TypedAttrInterface]> {
6478
// ZeroAttr
6579
//===----------------------------------------------------------------------===//
6680

67-
def ZeroAttr : CIR_Attr<"Zero", "zero", [TypedAttrInterface]> {
81+
def ZeroAttr : CIR_TypedAttr<"Zero", "zero"> {
6882
let summary = "Attribute to represent zero initialization";
6983
let description = [{
7084
The ZeroAttr is used to indicate zero initialization on structs.
7185
}];
72-
73-
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
74-
75-
let builders = [
76-
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
77-
return $_get(type.getContext(), type);
78-
}]>
79-
];
80-
81-
let assemblyFormat = [{}];
8286
}
8387

8488
//===----------------------------------------------------------------------===//
8589
// UndefAttr
8690
//===----------------------------------------------------------------------===//
8791

88-
def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
92+
def UndefAttr : CIR_TypedAttr<"Undef", "undef"> {
8993
let summary = "Represent an undef constant";
9094
let description = [{
9195
The UndefAttr represents an undef constant, corresponding to LLVM's notion
9296
of undef.
9397
}];
94-
95-
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
96-
97-
let builders = [
98-
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
99-
return $_get(type.getContext(), type);
100-
}]>
101-
];
102-
103-
let assemblyFormat = [{}];
10498
}
10599

106100
//===----------------------------------------------------------------------===//

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "clang/Frontend/CompilerInvocation.h"
1717
#include "clang/Frontend/PCHContainerOperations.h"
1818
#include "clang/Frontend/Utils.h"
19+
#include "clang/Lex/DependencyDirectivesScanner.h"
1920
#include "clang/Lex/HeaderSearchOptions.h"
2021
#include "clang/Lex/ModuleLoader.h"
2122
#include "llvm/ADT/ArrayRef.h"
@@ -99,6 +100,9 @@ class CompilerInstance : public ModuleLoader {
99100
/// The cache of PCM files.
100101
IntrusiveRefCntPtr<ModuleCache> ModCache;
101102

103+
/// Functor for getting the dependency preprocessor directives of a file.
104+
std::unique_ptr<DependencyDirectivesGetter> GetDependencyDirectives;
105+
102106
/// The preprocessor.
103107
std::shared_ptr<Preprocessor> PP;
104108

@@ -697,6 +701,11 @@ class CompilerInstance : public ModuleLoader {
697701
/// and replace any existing one with it.
698702
void createPreprocessor(TranslationUnitKind TUKind);
699703

704+
void setDependencyDirectivesGetter(
705+
std::unique_ptr<DependencyDirectivesGetter> Getter) {
706+
GetDependencyDirectives = std::move(Getter);
707+
}
708+
700709
std::string getSpecificModuleCachePath(StringRef ModuleHash);
701710
std::string getSpecificModuleCachePath() {
702711
return getSpecificModuleCachePath(getInvocation().getModuleHash());

clang/include/clang/Lex/DependencyDirectivesScanner.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/ADT/ArrayRef.h"
2222

2323
namespace clang {
24+
class FileManager;
2425

2526
namespace tok {
2627
enum TokenKind : unsigned short;
@@ -135,6 +136,19 @@ void printDependencyDirectivesAsSource(
135136
ArrayRef<dependency_directives_scan::Directive> Directives,
136137
llvm::raw_ostream &OS);
137138

139+
/// Functor that returns the dependency directives for a given file.
140+
class DependencyDirectivesGetter {
141+
public:
142+
/// Clone the getter for a new \c FileManager instance.
143+
virtual std::unique_ptr<DependencyDirectivesGetter>
144+
cloneFor(FileManager &FileMgr) = 0;
145+
146+
/// Get the dependency directives for the given file.
147+
virtual std::optional<ArrayRef<dependency_directives_scan::Directive>>
148+
operator()(FileEntryRef File) = 0;
149+
150+
virtual ~DependencyDirectivesGetter() = default;
151+
};
138152
} // end namespace clang
139153

140154
#endif // LLVM_CLANG_LEX_DEPENDENCYDIRECTIVESSCANNER_H

clang/include/clang/Lex/Preprocessor.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ class Preprocessor {
140140
friend class VariadicMacroScopeGuard;
141141

142142
llvm::unique_function<void(const clang::Token &)> OnToken;
143+
/// Functor for getting the dependency preprocessor directives of a file.
144+
///
145+
/// These are directives derived from a special form of lexing where the
146+
/// source input is scanned for the preprocessor directives that might have an
147+
/// effect on the dependencies for a compilation unit.
148+
DependencyDirectivesGetter *GetDependencyDirectives = nullptr;
143149
const PreprocessorOptions &PPOpts;
144150
DiagnosticsEngine *Diags;
145151
const LangOptions &LangOpts;
@@ -1326,6 +1332,10 @@ class Preprocessor {
13261332
OnToken = std::move(F);
13271333
}
13281334

1335+
void setDependencyDirectivesGetter(DependencyDirectivesGetter &Get) {
1336+
GetDependencyDirectives = &Get;
1337+
}
1338+
13291339
void setPreprocessToken(bool Preprocess) { PreprocessToken = Preprocess; }
13301340

13311341
bool isMacroDefined(StringRef Id) {

clang/include/clang/Lex/PreprocessorOptions.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,6 @@ class PreprocessorOptions {
189189
/// with support for lifetime-qualified pointers.
190190
ObjCXXARCStandardLibraryKind ObjCXXARCStandardLibrary = ARCXX_nolib;
191191

192-
/// Function for getting the dependency preprocessor directives of a file.
193-
///
194-
/// These are directives derived from a special form of lexing where the
195-
/// source input is scanned for the preprocessor directives that might have an
196-
/// effect on the dependencies for a compilation unit.
197-
///
198-
/// Enables a client to cache the directives for a file and provide them
199-
/// across multiple compiler invocations.
200-
/// FIXME: Allow returning an error.
201-
std::function<std::optional<ArrayRef<dependency_directives_scan::Directive>>(
202-
FileEntryRef)>
203-
DependencyDirectivesForFile;
204-
205192
/// Set up preprocessor for RunAnalysis action.
206193
bool SetUpStaticAnalyzer = false;
207194

0 commit comments

Comments
 (0)