Skip to content

Commit 543f39b

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:f99072bd8c6b into origin/amd-gfx:76d6615e816f
Local branch origin/amd-gfx 76d6615 Merged main:ad1ca5f4a2bc into origin/amd-gfx:b6266caaf444 Remote branch main f99072b [Clang][BPF] Add tests for btf_type_tag c2x-style attributes (llvm#133666)
2 parents 76d6615 + f99072b commit 543f39b

File tree

294 files changed

+9459
-3563
lines changed

Some content is hidden

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

294 files changed

+9459
-3563
lines changed

clang/bindings/python/tests/cindex/test_diagnostics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_diagnostic_category(self):
7979
self.assertEqual(d.location.line, 1)
8080
self.assertEqual(d.location.column, 11)
8181

82-
self.assertEqual(d.category_number, 2)
82+
self.assertEqual(d.category_number, 3)
8383
self.assertEqual(d.category_name, "Semantic Issue")
8484

8585
def test_diagnostic_option(self):
@@ -123,7 +123,7 @@ def test_diagnostic_string_format(self):
123123
self.assertEqual(str(d), "t.c:1:26: error: expected ';' after struct")
124124
self.assertEqual(
125125
d.format(0b111111),
126-
"t.c:1:26: error: expected ';' after struct [3, Parse Issue]",
126+
"t.c:1:26: error: expected ';' after struct [2, Parse Issue]",
127127
)
128128
with self.assertRaises(ValueError):
129129
d.format(0b1000000)

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ C23 Feature Support
159159
which clarified that a compound literal used within a function prototype is
160160
treated as if the compound literal were within the body rather than at file
161161
scope.
162+
- Fixed a bug where you could not cast a null pointer constant to type
163+
``nullptr_t``. Fixes #GH133644.
162164

163165
Non-comprehensive list of changes in this release
164166
-------------------------------------------------
@@ -311,6 +313,8 @@ Improvements to Clang's diagnostics
311313
312314
Fixes #GH61635
313315

316+
- Split diagnosing base class qualifiers from the ``-Wignored-Qualifiers`` diagnostic group into a new ``-Wignored-base-class-qualifiers`` diagnostic group (which is grouped under ``-Wignored-qualifiers``). Fixes #GH131935.
317+
314318
Improvements to Clang's time-trace
315319
----------------------------------
316320

@@ -337,6 +341,9 @@ Bug Fixes in This Version
337341
- Fixed a problematic case with recursive deserialization within ``FinishedDeserializing()`` where
338342
``PassInterestingDeclsToConsumer()`` was called before the declarations were safe to be passed. (#GH129982)
339343
- Fixed a modules crash where an explicit Constructor was deserialized. (#GH132794)
344+
- Defining an integer literal suffix (e.g., ``LL``) before including
345+
``<stdint.h>`` in a freestanding build no longer causes invalid token pasting
346+
when using the ``INTn_C`` macros. (#GH85995)
340347

341348
Bug Fixes to Compiler Builtins
342349
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/DeclCXX.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,7 @@ class CXXDestructorDecl : public CXXMethodDecl {
28522852
// FIXME: Don't allocate storage for these except in the first declaration
28532853
// of a virtual destructor.
28542854
FunctionDecl *OperatorDelete = nullptr;
2855+
FunctionDecl *OperatorArrayDelete = nullptr;
28552856
Expr *OperatorDeleteThisArg = nullptr;
28562857

28572858
CXXDestructorDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc,
@@ -2877,11 +2878,16 @@ class CXXDestructorDecl : public CXXMethodDecl {
28772878
static CXXDestructorDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
28782879

28792880
void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg);
2881+
void setOperatorArrayDelete(FunctionDecl *OD, Expr *ThisArg);
28802882

28812883
const FunctionDecl *getOperatorDelete() const {
28822884
return getCanonicalDecl()->OperatorDelete;
28832885
}
28842886

2887+
const FunctionDecl *getArrayOperatorDelete() const {
2888+
return getCanonicalDecl()->OperatorArrayDelete;
2889+
}
2890+
28852891
Expr *getOperatorDeleteThisArg() const {
28862892
return getCanonicalDecl()->OperatorDeleteThisArg;
28872893
}

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ macro(clang_diag_gen component)
88
-gen-clang-diags-enums -clang-component=${component}
99
SOURCE Diagnostic.td
1010
TARGET ClangDiagnostic${component}Enums)
11+
12+
clang_tablegen(Diagnostic${component}CompatIDs.inc
13+
-gen-clang-diags-compat-ids -clang-component=${component}
14+
SOURCE Diagnostic.td
15+
TARGET ClangDiagnostic${component}CompatIDs)
1116
endmacro(clang_diag_gen)
1217

1318
clang_diag_gen(Analysis)
@@ -31,6 +36,11 @@ clang_tablegen(DiagnosticIndexName.inc -gen-clang-diags-index-name
3136
SOURCE Diagnostic.td
3237
TARGET ClangDiagnosticIndexName)
3338

39+
clang_tablegen(DiagnosticAllCompatIDs.inc
40+
-gen-clang-diags-compat-ids
41+
SOURCE Diagnostic.td
42+
TARGET ClangDiagnosticAllCompatIDs)
43+
3444
clang_tablegen(AttrList.inc -gen-clang-attr-list
3545
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
3646
SOURCE Attr.td

clang/include/clang/Basic/Diagnostic.td

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ class DefaultWarnNoWerror {
155155
}
156156
class DefaultRemark { Severity DefaultSeverity = SEV_Remark; }
157157

158+
class CompatWarningId<string name, int std, string diag, string diag_pre> {
159+
string Component = ?;
160+
string Name = name;
161+
string Diag = diag;
162+
string DiagPre = diag_pre;
163+
int Std = std;
164+
165+
// This is unused, but Tablegen will complain if it's missing because we define
166+
// the compatibility ids in the same place as the other diagnostics (which means
167+
// that we'll be inside a 'let CategoryName = "" in { ... }' block).
168+
string CategoryName = ?;
169+
}
170+
158171
// C++ compatibility warnings.
159172
multiclass CXXCompat<
160173
string message,
@@ -178,6 +191,11 @@ multiclass CXXCompat<
178191
"CXX98Compat",
179192
"CXXPre"#std_ver#"Compat"))>,
180193
DefaultIgnore;
194+
195+
def : CompatWarningId<
196+
NAME, std_ver,
197+
"compat_cxx"#std_ver#"_"#NAME,
198+
"compat_pre_cxx"#std_ver#"_"#NAME>;
181199
}
182200

183201
// These generate pairs of C++ compatibility warnings of the form:

clang/include/clang/Basic/DiagnosticAST.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticASTCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICAST_H

clang/include/clang/Basic/DiagnosticAnalysis.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ enum {
3535
#undef DIAG_ENUM_ITEM
3636
#undef DIAG_ENUM
3737
} // end namespace diag
38+
39+
namespace diag_compat {
40+
#define DIAG_COMPAT_IDS_BEGIN() enum {
41+
#define DIAG_COMPAT_IDS_END() \
42+
} \
43+
;
44+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
45+
#include "clang/Basic/DiagnosticAnalysisCompatIDs.inc"
46+
#undef DIAG_COMPAT_ID
47+
#undef DIAG_COMPAT_IDS_BEGIN
48+
#undef DIAG_COMPAT_IDS_END
49+
} // end namespace diag_compat
3850
} // end namespace clang
3951

4052
#endif // LLVM_CLANG_BASIC_DIAGNOSTICANALYSIS_H

clang/include/clang/Basic/DiagnosticComment.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticCommentCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICCOMMENT_H

clang/include/clang/Basic/DiagnosticCrossTU.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticCrossTUCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICCROSSTU_H

clang/include/clang/Basic/DiagnosticDriver.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticDriverCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICDRIVER_H

clang/include/clang/Basic/DiagnosticFrontend.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticFrontendCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICFRONTEND_H

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;
496496
def IgnoredGCH : DiagGroup<"ignored-gch">;
497497
def IgnoredReferenceQualifiers : DiagGroup<"ignored-reference-qualifiers">;
498498
def IgnoredQualifiers : DiagGroup<"ignored-qualifiers", [IgnoredReferenceQualifiers]>;
499+
def IgnoredBaseClassQualifiers : DiagGroup<"ignored-base-class-qualifiers", [IgnoredQualifiers]>;
499500
def : DiagGroup<"import">;
500501
def GNUIncludeNext : DiagGroup<"gnu-include-next">;
501502
def IncompatibleMSStruct : DiagGroup<"incompatible-ms-struct">;

clang/include/clang/Basic/DiagnosticIDs.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
namespace clang {
2626
class DiagnosticsEngine;
2727
class DiagnosticBuilder;
28+
class LangOptions;
2829
class SourceLocation;
2930

3031
// Import the diagnostic enums themselves.
@@ -104,6 +105,18 @@ namespace clang {
104105
};
105106
}
106107

108+
namespace diag_compat {
109+
#define DIAG_COMPAT_IDS_BEGIN() enum {
110+
#define DIAG_COMPAT_IDS_END() \
111+
} \
112+
;
113+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
114+
#include "clang/Basic/DiagnosticCommonCompatIDs.inc"
115+
#undef DIAG_COMPAT_ID
116+
#undef DIAG_COMPAT_IDS_BEGIN
117+
#undef DIAG_COMPAT_IDS_END
118+
} // end namespace diag_compat
119+
107120
class DiagnosticMapping {
108121
LLVM_PREFERRED_TYPE(diag::Severity)
109122
unsigned Severity : 3;
@@ -464,6 +477,11 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
464477
/// given group name.
465478
static StringRef getNearestOption(diag::Flavor Flavor, StringRef Group);
466479

480+
/// Get the appropriate diagnostic Id to use for issuing a compatibility
481+
/// diagnostic. For use by the various DiagCompat() helpers.
482+
static unsigned getCXXCompatDiagId(const LangOptions &LangOpts,
483+
unsigned CompatDiagId);
484+
467485
private:
468486
/// Classify the specified diagnostic ID into a Level, consumable by
469487
/// the DiagnosticClient.

clang/include/clang/Basic/DiagnosticInstallAPI.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,17 @@ enum {
3535
#undef DIAG_ENUM_ITEM
3636
#undef DIAG_ENUM
3737
} // namespace diag
38+
39+
namespace diag_compat {
40+
#define DIAG_COMPAT_IDS_BEGIN() enum {
41+
#define DIAG_COMPAT_IDS_END() \
42+
} \
43+
;
44+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
45+
#include "clang/Basic/DiagnosticInstallAPICompatIDs.inc"
46+
#undef DIAG_COMPAT_ID
47+
#undef DIAG_COMPAT_IDS_BEGIN
48+
#undef DIAG_COMPAT_IDS_END
49+
} // end namespace diag_compat
3850
} // namespace clang
3951
#endif // LLVM_CLANG_BASIC_DIAGNOSTICINSTALLAPI_H

clang/include/clang/Basic/DiagnosticLex.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ enum {
3535
#undef DIAG_ENUM_ITEM
3636
#undef DIAG_ENUM
3737
} // end namespace diag
38+
39+
namespace diag_compat {
40+
#define DIAG_COMPAT_IDS_BEGIN() enum {
41+
#define DIAG_COMPAT_IDS_END() \
42+
} \
43+
;
44+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
45+
#include "clang/Basic/DiagnosticLexCompatIDs.inc"
46+
#undef DIAG_COMPAT_ID
47+
#undef DIAG_COMPAT_IDS_BEGIN
48+
#undef DIAG_COMPAT_IDS_END
49+
} // end namespace diag_compat
3850
} // end namespace clang
3951

4052
#endif // LLVM_CLANG_BASIC_DIAGNOSTICLEX_H

clang/include/clang/Basic/DiagnosticParse.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticParseCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICPARSE_H

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
let Component = "Parse" in {
14+
let CategoryName = "Parse Issue" in {
15+
// C++11 compatibility with C++98.
16+
defm enum_fixed_underlying_type : CXX11Compat<
17+
"enumeration types with a fixed underlying type are",
18+
/*ext_warn=*/false>;
19+
}
1420

1521
def err_asm_qualifier_ignored : Error<
1622
"expected 'volatile', 'inline', 'goto', or '('">, CatInlineAsm;
@@ -107,9 +113,6 @@ def err_enumerator_list_missing_comma : Error<
107113
"missing ',' between enumerators">;
108114
def err_enumerator_unnamed_no_def : Error<
109115
"unnamed enumeration must be a definition">;
110-
def ext_cxx11_enum_fixed_underlying_type : Extension<
111-
"enumeration types with a fixed underlying type are a C++11 extension">,
112-
InGroup<CXX11>;
113116
def ext_ms_c_enum_fixed_underlying_type : Extension<
114117
"enumeration types with a fixed underlying type are a Microsoft extension">,
115118
InGroup<MicrosoftFixedEnum>;
@@ -119,9 +122,6 @@ def ext_c23_enum_fixed_underlying_type : Extension<
119122
def warn_c17_compat_enum_fixed_underlying_type : Warning<
120123
"enumeration types with a fixed underlying type are incompatible with C standards before C23">,
121124
DefaultIgnore, InGroup<CPre23Compat>;
122-
def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
123-
"enumeration types with a fixed underlying type are incompatible with C++98">,
124-
InGroup<CXX98Compat>, DefaultIgnore;
125125
def ext_enum_base_in_type_specifier : ExtWarn<
126126
"non-defining declaration of enumeration with a fixed underlying type is "
127127
"only permitted as a standalone declaration"

clang/include/clang/Basic/DiagnosticRefactoring.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ enum {
3636
#undef DIAG_ENUM_ITEM
3737
#undef DIAG_ENUM
3838
} // end namespace diag
39+
40+
namespace diag_compat {
41+
#define DIAG_COMPAT_IDS_BEGIN() enum {
42+
#define DIAG_COMPAT_IDS_END() \
43+
} \
44+
;
45+
#define DIAG_COMPAT_ID(IDX, NAME, ...) NAME = IDX,
46+
#include "clang/Basic/DiagnosticRefactoringCompatIDs.inc"
47+
#undef DIAG_COMPAT_ID
48+
#undef DIAG_COMPAT_IDS_BEGIN
49+
#undef DIAG_COMPAT_IDS_END
50+
} // end namespace diag_compat
3951
} // end namespace clang
4052

4153
#endif // LLVM_CLANG_BASIC_DIAGNOSTICREFACTORING_H

0 commit comments

Comments
 (0)