Skip to content

Commit f065d6f

Browse files
authored
Merge branch 'main' into fix/147217
2 parents 7d827df + 0f34360 commit f065d6f

File tree

292 files changed

+1117
-655
lines changed

Some content is hidden

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

292 files changed

+1117
-655
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,6 @@ latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or the
3737
Potentially Breaking Changes
3838
============================
3939

40-
- Clang will now emit a warning if the auto-detected GCC installation
41-
directory (i.e. the one with the largest version number) does not
42-
contain libstdc++ include directories although a "complete" GCC
43-
installation directory containing the include directories is
44-
available. It is planned to change the auto-detection to prefer the
45-
"complete" directory in the future. The warning will disappear if
46-
the libstdc++ include directories are either installed or removed
47-
for all GCC installation directories considered by the
48-
auto-detection; see the output of ``clang -v`` for a list of those
49-
directories. If the GCC installations cannot be modified and
50-
maintaining the current choice of the auto-detection is desired, the
51-
GCC installation directory can be selected explicitly using the
52-
``--gcc-install-dir`` command line argument. This will silence the
53-
warning. It can also be disabled using the
54-
``-Wno-gcc-install-dir-libstdcxx`` command line flag.
55-
5640
C/C++ Language Potentially Breaking Changes
5741
-------------------------------------------
5842

@@ -184,8 +168,6 @@ Improvements to Clang's diagnostics
184168
an override of a virtual method.
185169
- Fixed fix-it hint for fold expressions. Clang now correctly places the suggested right
186170
parenthesis when diagnosing malformed fold expressions. (#GH151787)
187-
- ``-Wstring-concatenation`` now diagnoses every missing comma in an initializer list,
188-
rather than stopping after the first. (#GH153745)
189171

190172
- Fixed an issue where emitted format-signedness diagnostics were not associated with an appropriate
191173
diagnostic id. Besides being incorrect from an API standpoint, this was user visible, e.g.:
@@ -247,7 +229,6 @@ Bug Fixes to C++ Support
247229
- Diagnose binding a reference to ``*nullptr`` during constant evaluation. (#GH48665)
248230
- Suppress ``-Wdeprecated-declarations`` in implicitly generated functions. (#GH147293)
249231
- Fix a crash when deleting a pointer to an incomplete array (#GH150359).
250-
- Fixed a mismatched lambda scope bug when propagating up ``consteval`` within nested lambdas. (#GH145776)
251232
- Fix an assertion failure when expression in assumption attribute
252233
(``[[assume(expr)]]``) creates temporary objects.
253234
- Fix the dynamic_cast to final class optimization to correctly handle

clang/include/clang/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3526,7 +3526,7 @@ class TypeDecl : public NamedDecl {
35263526
public:
35273527
// Low-level accessor. If you just want the type defined by this node,
35283528
// check out ASTContext::getTypeDeclType or one of
3529-
// ASTContext::getTypedefType, ASTContext::getRecordType, etc. if you
3529+
// ASTContext::getTypedefType, ASTContext::getTagType, etc. if you
35303530
// already know the specific kind of node this is.
35313531
const Type *getTypeForDecl() const {
35323532
assert(!isa<TagDecl>(this));

clang/include/clang/AST/Type.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6401,6 +6401,9 @@ class TagType : public TypeWithKeyword {
64016401
bool IsInjected, const Type *CanonicalType);
64026402

64036403
public:
6404+
// FIXME: Temporarily renamed from `getDecl` in order to facilitate
6405+
// rebasing, due to change in behaviour. This should be renamed back
6406+
// to `getDecl` once the change is settled.
64046407
TagDecl *getOriginalDecl() const { return decl; }
64056408

64066409
NestedNameSpecifier getQualifier() const;
@@ -6466,6 +6469,9 @@ class RecordType final : public TagType {
64666469
using TagType::TagType;
64676470

64686471
public:
6472+
// FIXME: Temporarily renamed from `getDecl` in order to facilitate
6473+
// rebasing, due to change in behaviour. This should be renamed back
6474+
// to `getDecl` once the change is settled.
64696475
RecordDecl *getOriginalDecl() const {
64706476
return reinterpret_cast<RecordDecl *>(TagType::getOriginalDecl());
64716477
}
@@ -6483,6 +6489,9 @@ class EnumType final : public TagType {
64836489
using TagType::TagType;
64846490

64856491
public:
6492+
// FIXME: Temporarily renamed from `getDecl` in order to facilitate
6493+
// rebasing, due to change in behaviour. This should be renamed back
6494+
// to `getDecl` once the change is settled.
64866495
EnumDecl *getOriginalDecl() const {
64876496
return reinterpret_cast<EnumDecl *>(TagType::getOriginalDecl());
64886497
}
@@ -6515,6 +6524,9 @@ class InjectedClassNameType final : public TagType {
65156524
bool IsInjected, const Type *CanonicalType);
65166525

65176526
public:
6527+
// FIXME: Temporarily renamed from `getDecl` in order to facilitate
6528+
// rebasing, due to change in behaviour. This should be renamed back
6529+
// to `getDecl` once the change is settled.
65186530
CXXRecordDecl *getOriginalDecl() const {
65196531
return reinterpret_cast<CXXRecordDecl *>(TagType::getOriginalDecl());
65206532
}

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,4 @@ def warn_drv_openacc_without_cir
885885
: Warning<"OpenACC directives will result in no runtime behavior; use "
886886
"-fclangir to enable runtime effect">,
887887
InGroup<SourceUsesOpenACC>;
888-
889-
def warn_drv_gcc_install_dir_libstdcxx : Warning<
890-
"future releases of the clang compiler will prefer GCC installations "
891-
"containing libstdc++ include directories; '%0' would be chosen over '%1'">,
892-
InGroup<DiagGroup<"gcc-install-dir-libstdcxx">>;
893888
}

clang/include/clang/Driver/ToolChain.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ class ToolChain {
224224
static void addSystemFrameworkInclude(const llvm::opt::ArgList &DriverArgs,
225225
llvm::opt::ArgStringList &CC1Args,
226226
const Twine &Path);
227+
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
228+
llvm::opt::ArgStringList &CC1Args,
229+
const Twine &Path);
227230
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
228231
llvm::opt::ArgStringList &CC1Args,
229232
const Twine &Path);
@@ -243,9 +246,6 @@ class ToolChain {
243246
///@}
244247

245248
public:
246-
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
247-
llvm::opt::ArgStringList &CC1Args,
248-
const Twine &Path);
249249
virtual ~ToolChain();
250250

251251
// Accessors

clang/include/clang/Sema/Sema.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4176,15 +4176,8 @@ class Sema final : public SemaBase {
41764176
/// return statement in the scope of a variable has the same NRVO candidate,
41774177
/// that candidate is an NRVO variable.
41784178
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope);
4179-
4180-
/// Performs semantic analysis at the end of a function body.
4181-
///
4182-
/// \param RetainFunctionScopeInfo If \c true, the client is responsible for
4183-
/// releasing the associated \p FunctionScopeInfo. This is useful when
4184-
/// building e.g. LambdaExprs.
4185-
Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body,
4186-
bool IsInstantiation = false,
4187-
bool RetainFunctionScopeInfo = false);
4179+
Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body);
4180+
Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
41884181
Decl *ActOnSkippedFunctionBody(Decl *Decl);
41894182
void ActOnFinishInlineFunctionDef(FunctionDecl *D);
41904183

@@ -6881,23 +6874,23 @@ class Sema final : public SemaBase {
68816874
assert(!ExprEvalContexts.empty() &&
68826875
"Must be in an expression evaluation context");
68836876
return ExprEvalContexts.back();
6884-
}
6877+
};
68856878

68866879
ExpressionEvaluationContextRecord &currentEvaluationContext() {
68876880
assert(!ExprEvalContexts.empty() &&
68886881
"Must be in an expression evaluation context");
68896882
return ExprEvalContexts.back();
6890-
}
6883+
};
68916884

68926885
ExpressionEvaluationContextRecord &parentEvaluationContext() {
68936886
assert(ExprEvalContexts.size() >= 2 &&
68946887
"Must be in an expression evaluation context");
68956888
return ExprEvalContexts[ExprEvalContexts.size() - 2];
6896-
}
6889+
};
68976890

68986891
const ExpressionEvaluationContextRecord &parentEvaluationContext() const {
68996892
return const_cast<Sema *>(this)->parentEvaluationContext();
6900-
}
6893+
};
69016894

69026895
bool isAttrContext() const {
69036896
return ExprEvalContexts.back().ExprContext ==
@@ -9147,7 +9140,8 @@ class Sema final : public SemaBase {
91479140

91489141
/// Complete a lambda-expression having processed and attached the
91499142
/// lambda body.
9150-
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc);
9143+
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,
9144+
sema::LambdaScopeInfo *LSI);
91519145

91529146
/// Get the return type to use for a lambda's conversion function(s) to
91539147
/// function pointer type, given the type of the call operator.

clang/lib/AST/Decl.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,17 +1604,20 @@ LinkageInfo LinkageComputer::getLVForDecl(const NamedDecl *D,
16041604
// We have just computed the linkage for this decl. By induction we know
16051605
// that all other computed linkages match, check that the one we just
16061606
// computed also does.
1607-
NamedDecl *Old = nullptr;
1608-
for (auto *I : D->redecls()) {
1609-
auto *T = cast<NamedDecl>(I);
1610-
if (T == D)
1607+
// We can't assume the redecl chain is well formed at this point,
1608+
// so keep track of already visited declarations.
1609+
for (llvm::SmallPtrSet<const Decl *, 4> AlreadyVisited{D}; /**/; /**/) {
1610+
D = cast<NamedDecl>(const_cast<NamedDecl *>(D)->getNextRedeclarationImpl());
1611+
if (!AlreadyVisited.insert(D).second)
1612+
break;
1613+
if (D->isInvalidDecl())
16111614
continue;
1612-
if (!T->isInvalidDecl() && T->hasCachedLinkage()) {
1613-
Old = T;
1615+
if (auto OldLinkage = D->getCachedLinkage();
1616+
OldLinkage != Linkage::Invalid) {
1617+
assert(LV.getLinkage() == OldLinkage);
16141618
break;
16151619
}
16161620
}
1617-
assert(!Old || Old->getCachedLinkage() == D->getCachedLinkage());
16181621
#endif
16191622

16201623
return LV;

clang/lib/Driver/ToolChain.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,13 @@ void ToolChain::addSystemFrameworkInclude(const llvm::opt::ArgList &DriverArgs,
14091409
CC1Args.push_back(DriverArgs.MakeArgString(Path));
14101410
}
14111411

1412+
/// Utility function to add a system include directory to CC1 arguments.
1413+
void ToolChain::addSystemInclude(const ArgList &DriverArgs,
1414+
ArgStringList &CC1Args, const Twine &Path) {
1415+
CC1Args.push_back("-internal-isystem");
1416+
CC1Args.push_back(DriverArgs.MakeArgString(Path));
1417+
}
1418+
14121419
/// Utility function to add a system include directory with extern "C"
14131420
/// semantics to CC1 arguments.
14141421
///
@@ -1431,14 +1438,6 @@ void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs,
14311438
addExternCSystemInclude(DriverArgs, CC1Args, Path);
14321439
}
14331440

1434-
/// Utility function to add a system include directory to CC1 arguments.
1435-
/*static*/ void ToolChain::addSystemInclude(const ArgList &DriverArgs,
1436-
ArgStringList &CC1Args,
1437-
const Twine &Path) {
1438-
CC1Args.push_back("-internal-isystem");
1439-
CC1Args.push_back(DriverArgs.MakeArgString(Path));
1440-
}
1441-
14421441
/// Utility function to add a list of system framework directories to CC1.
14431442
void ToolChain::addSystemFrameworkIncludes(const ArgList &DriverArgs,
14441443
ArgStringList &CC1Args,

0 commit comments

Comments
 (0)