Skip to content

Commit 817da3e

Browse files
committed
merge main into amd-staging
2 parents 4ce9698 + d05634d commit 817da3e

File tree

185 files changed

+5753
-5508
lines changed

Some content is hidden

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

185 files changed

+5753
-5508
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ C Language Changes
222222
223223
char buf1[3] = "foo"; // -Wunterminated-string-initialization
224224
char buf2[3] = "flarp"; // -Wexcess-initializers
225-
char buf3[3] = "fo\0"; // This is fine, no warning.
226225
227226
This diagnostic can be suppressed by adding the new ``nonstring`` attribute
228227
to the field or variable being initialized. #GH137705

clang/docs/analyzer/developer-docs/DebugChecks.rst

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,10 @@ ExprInspection checks
317317
The value can be represented either as a range set or as a concrete integer.
318318
For the rest of the types function prints ``n/a`` (aka not available).
319319

320-
**Note:** This function will print nothing for clang built with Z3 constraint manager.
321-
This may cause crashes of your tests. To manage this use one of the test constraining
322-
techniques:
323-
324-
* llvm-lit commands ``REQUIRES no-z3`` or ``UNSUPPORTED z3`` `See for details. <https://llvm.org/docs/TestingGuide.html#constraining-test-execution>`_
325-
326-
* a preprocessor directive ``#ifndef ANALYZER_CM_Z3``
327-
328-
* a clang command argument ``-analyzer-constraints=range``
320+
**Note:** This function will print nothing when clang uses Z3 as the
321+
constraint manager (which is an unsupported and badly broken analysis mode
322+
that's distinct from the supported and stable "Z3 refutation" aka "Z3
323+
crosscheck" mode).
329324

330325
Example usage::
331326

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6409,12 +6409,7 @@ class SpirvOperand {
64096409
SpirvOperand(const SpirvOperand &Other) { *this = Other; }
64106410
~SpirvOperand() {}
64116411

6412-
SpirvOperand &operator=(const SpirvOperand &Other) {
6413-
this->Kind = Other.Kind;
6414-
this->ResultType = Other.ResultType;
6415-
this->Value = Other.Value;
6416-
return *this;
6417-
}
6412+
SpirvOperand &operator=(const SpirvOperand &Other) = default;
64186413

64196414
bool operator==(const SpirvOperand &Other) const {
64206415
return Kind == Other.Kind && ResultType == Other.ResultType &&

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,6 +3735,7 @@ def Visibility : InheritableAttr {
37353735
["default", "hidden", "internal", "protected"],
37363736
["Default", "Hidden", "Hidden", "Protected"]>];
37373737
let MeaningfulToClassTemplateDefinition = 1;
3738+
let PragmaAttributeSupport = 1;
37383739
let Documentation = [Undocumented];
37393740
}
37403741

clang/include/clang/Basic/SourceLocation.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class FileID {
7070
int getOpaqueValue() const { return ID; }
7171
};
7272

73+
using FileIDAndOffset = std::pair<FileID, unsigned>;
74+
7375
/// Encodes a location in the source. The SourceManager can decode this
7476
/// to get at the full include stack, line and column information.
7577
///
@@ -403,7 +405,7 @@ class FullSourceLoc : public SourceLocation {
403405
/// pair, after walking through all expansion records.
404406
///
405407
/// \see SourceManager::getDecomposedExpansionLoc
406-
std::pair<FileID, unsigned> getDecomposedExpansionLoc() const;
408+
FileIDAndOffset getDecomposedExpansionLoc() const;
407409

408410
unsigned getSpellingLineNumber(bool *Invalid = nullptr) const;
409411
unsigned getSpellingColumnNumber(bool *Invalid = nullptr) const;
@@ -424,7 +426,7 @@ class FullSourceLoc : public SourceLocation {
424426
///
425427
/// The first element is the FileID, the second is the offset from the
426428
/// start of the buffer of the location.
427-
std::pair<FileID, unsigned> getDecomposedLoc() const;
429+
FileIDAndOffset getDecomposedLoc() const;
428430

429431
bool isInSystemHeader() const;
430432

clang/include/clang/Basic/SourceManager.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
795795
///
796796
/// Used to cache results from and speed-up \c getDecomposedIncludedLoc
797797
/// function.
798-
mutable llvm::DenseMap<FileID, std::pair<FileID, unsigned>> IncludedLocMap;
798+
mutable llvm::DenseMap<FileID, FileIDAndOffset> IncludedLocMap;
799799

800800
/// The key value into the IsBeforeInTUCache table.
801801
using IsBeforeInTUCacheKey = std::pair<FileID, FileID>;
@@ -1269,7 +1269,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
12691269
///
12701270
/// The first element is the FileID, the second is the offset from the
12711271
/// start of the buffer of the location.
1272-
std::pair<FileID, unsigned> getDecomposedLoc(SourceLocation Loc) const {
1272+
FileIDAndOffset getDecomposedLoc(SourceLocation Loc) const {
12731273
FileID FID = getFileID(Loc);
12741274
auto *Entry = getSLocEntryOrNull(FID);
12751275
if (!Entry)
@@ -1281,8 +1281,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
12811281
///
12821282
/// If the location is an expansion record, walk through it until we find
12831283
/// the final location expanded.
1284-
std::pair<FileID, unsigned>
1285-
getDecomposedExpansionLoc(SourceLocation Loc) const {
1284+
FileIDAndOffset getDecomposedExpansionLoc(SourceLocation Loc) const {
12861285
FileID FID = getFileID(Loc);
12871286
auto *E = getSLocEntryOrNull(FID);
12881287
if (!E)
@@ -1299,8 +1298,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
12991298
///
13001299
/// If the location is an expansion record, walk through it until we find
13011300
/// its spelling record.
1302-
std::pair<FileID, unsigned>
1303-
getDecomposedSpellingLoc(SourceLocation Loc) const {
1301+
FileIDAndOffset getDecomposedSpellingLoc(SourceLocation Loc) const {
13041302
FileID FID = getFileID(Loc);
13051303
auto *E = getSLocEntryOrNull(FID);
13061304
if (!E)
@@ -1314,7 +1312,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
13141312

13151313
/// Returns the "included/expanded in" decomposed location of the given
13161314
/// FileID.
1317-
std::pair<FileID, unsigned> getDecomposedIncludedLoc(FileID FID) const;
1315+
FileIDAndOffset getDecomposedIncludedLoc(FileID FID) const;
13181316

13191317
/// Returns the offset from the start of the file that the
13201318
/// specified SourceLocation represents.
@@ -1682,18 +1680,17 @@ class SourceManager : public RefCountedBase<SourceManager> {
16821680
/// are in the same TU. The second bool is true if the first is true
16831681
/// and \p LOffs is before \p ROffs.
16841682
std::pair<bool, bool>
1685-
isInTheSameTranslationUnit(std::pair<FileID, unsigned> &LOffs,
1686-
std::pair<FileID, unsigned> &ROffs) const;
1683+
isInTheSameTranslationUnit(FileIDAndOffset &LOffs,
1684+
FileIDAndOffset &ROffs) const;
16871685

16881686
/// \param Loc a source location in a loaded AST (of a PCH/Module file).
16891687
/// \returns a FileID uniquely identifies the AST of a loaded
16901688
/// module/PCH where `Loc` is at.
16911689
FileID getUniqueLoadedASTFileID(SourceLocation Loc) const;
16921690

16931691
/// Determines whether the two decomposed source location is in the same TU.
1694-
bool isInTheSameTranslationUnitImpl(
1695-
const std::pair<FileID, unsigned> &LOffs,
1696-
const std::pair<FileID, unsigned> &ROffs) const;
1692+
bool isInTheSameTranslationUnitImpl(const FileIDAndOffset &LOffs,
1693+
const FileIDAndOffset &ROffs) const;
16971694

16981695
/// Determines the order of 2 source locations in the "source location
16991696
/// address space".
@@ -1979,11 +1976,10 @@ class SourceManager : public RefCountedBase<SourceManager> {
19791976
SourceLocation getSpellingLocSlowCase(SourceLocation Loc) const;
19801977
SourceLocation getFileLocSlowCase(SourceLocation Loc) const;
19811978

1982-
std::pair<FileID, unsigned>
1979+
FileIDAndOffset
19831980
getDecomposedExpansionLocSlowCase(const SrcMgr::SLocEntry *E) const;
1984-
std::pair<FileID, unsigned>
1985-
getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
1986-
unsigned Offset) const;
1981+
FileIDAndOffset getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
1982+
unsigned Offset) const;
19871983
void computeMacroArgsCache(MacroArgsMap &MacroArgsCache, FileID FID) const;
19881984
void associateFileChunkWithMacroArgExp(MacroArgsMap &MacroArgsCache,
19891985
FileID FID,

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ RawComment *ASTContext::getRawCommentForDeclNoCacheImpl(
248248

249249
// Decompose the location for the declaration and find the beginning of the
250250
// file buffer.
251-
const std::pair<FileID, unsigned> DeclLocDecomp =
251+
const FileIDAndOffset DeclLocDecomp =
252252
SourceMgr.getDecomposedLoc(RepresentativeLocForDecl);
253253

254254
// Slow path.

clang/lib/AST/ASTImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9989,7 +9989,7 @@ Expected<SourceLocation> ASTImporter::Import(SourceLocation FromLoc) {
99899989
SourceManager &FromSM = FromContext.getSourceManager();
99909990
bool IsBuiltin = FromSM.isWrittenInBuiltinFile(FromLoc);
99919991

9992-
std::pair<FileID, unsigned> Decomposed = FromSM.getDecomposedLoc(FromLoc);
9992+
FileIDAndOffset Decomposed = FromSM.getDecomposedLoc(FromLoc);
99939993
Expected<FileID> ToFileIDOrErr = Import(Decomposed.first, IsBuiltin);
99949994
if (!ToFileIDOrErr)
99959995
return ToFileIDOrErr.takeError();

clang/lib/AST/CommentLexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ void Lexer::lex(Token &T) {
904904
StringRef Lexer::getSpelling(const Token &Tok,
905905
const SourceManager &SourceMgr) const {
906906
SourceLocation Loc = Tok.getLocation();
907-
std::pair<FileID, unsigned> LocInfo = SourceMgr.getDecomposedLoc(Loc);
907+
FileIDAndOffset LocInfo = SourceMgr.getDecomposedLoc(Loc);
908908

909909
bool InvalidTemp = false;
910910
StringRef File = SourceMgr.getBufferData(LocInfo.first, &InvalidTemp);

clang/lib/AST/Expr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,7 @@ StringLiteral::getLocationOfByte(unsigned ByteNo, const SourceManager &SM,
13561356
SourceLocation StrTokSpellingLoc = SM.getSpellingLoc(StrTokLoc);
13571357

13581358
// Re-lex the token to get its length and original spelling.
1359-
std::pair<FileID, unsigned> LocInfo =
1360-
SM.getDecomposedLoc(StrTokSpellingLoc);
1359+
FileIDAndOffset LocInfo = SM.getDecomposedLoc(StrTokSpellingLoc);
13611360
bool Invalid = false;
13621361
StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid);
13631362
if (Invalid) {

0 commit comments

Comments
 (0)