Skip to content

Commit 06cfbcb

Browse files
authored
Merge branch 'main' into rt-unroll-early-continue-load
2 parents 2fab33a + e1833e3 commit 06cfbcb

File tree

88 files changed

+1064
-514
lines changed

Some content is hidden

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

88 files changed

+1064
-514
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,11 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
696696

697697
// What this is a specialization of.
698698
auto SpecOf = CTSD->getSpecializedTemplateOrPartial();
699-
if (SpecOf.is<ClassTemplateDecl *>()) {
700-
Specialization.SpecializationOf =
701-
getUSRForDecl(SpecOf.get<ClassTemplateDecl *>());
702-
} else if (SpecOf.is<ClassTemplatePartialSpecializationDecl *>()) {
703-
Specialization.SpecializationOf =
704-
getUSRForDecl(SpecOf.get<ClassTemplatePartialSpecializationDecl *>());
705-
}
699+
if (auto *CTD = dyn_cast<ClassTemplateDecl *>(SpecOf))
700+
Specialization.SpecializationOf = getUSRForDecl(CTD);
701+
else if (auto *CTPSD =
702+
dyn_cast<ClassTemplatePartialSpecializationDecl *>(SpecOf))
703+
Specialization.SpecializationOf = getUSRForDecl(CTPSD);
706704

707705
// Parameters to the specilization. For partial specializations, get the
708706
// parameters "as written" from the ClassTemplatePartialSpecializationDecl

clang/include/clang/Sema/SemaConcept.h

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -135,31 +135,20 @@ struct NormalizedConstraint {
135135
return *this;
136136
}
137137

138-
bool isAtomic() const { return Constraint.is<AtomicConstraint *>(); }
138+
bool isAtomic() const { return llvm::isa<AtomicConstraint *>(Constraint); }
139139
bool isFoldExpanded() const {
140-
return Constraint.is<FoldExpandedConstraint *>();
140+
return llvm::isa<FoldExpandedConstraint *>(Constraint);
141141
}
142-
bool isCompound() const { return Constraint.is<CompoundConstraint>(); }
142+
bool isCompound() const { return llvm::isa<CompoundConstraint>(Constraint); }
143143

144-
CompoundConstraintKind getCompoundKind() const {
145-
assert(isCompound() && "getCompoundKind on a non-compound constraint..");
146-
return Constraint.get<CompoundConstraint>().getInt();
147-
}
144+
CompoundConstraintKind getCompoundKind() const;
148145

149146
NormalizedConstraint &getLHS() const;
150147
NormalizedConstraint &getRHS() const;
151148

152-
AtomicConstraint *getAtomicConstraint() const {
153-
assert(isAtomic() &&
154-
"getAtomicConstraint called on non-atomic constraint.");
155-
return Constraint.get<AtomicConstraint *>();
156-
}
149+
AtomicConstraint *getAtomicConstraint() const;
157150

158-
FoldExpandedConstraint *getFoldExpandedConstraint() const {
159-
assert(isFoldExpanded() &&
160-
"getFoldExpandedConstraint called on non-fold-expanded constraint.");
161-
return Constraint.get<FoldExpandedConstraint *>();
162-
}
151+
FoldExpandedConstraint *getFoldExpandedConstraint() const;
163152

164153
private:
165154
static std::optional<NormalizedConstraint>

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4974,20 +4974,35 @@ template <class Emitter> bool Compiler<Emitter>::visitIfStmt(const IfStmt *IS) {
49744974
LabelTy LabelEnd = this->getLabel();
49754975
if (!this->jumpFalse(LabelElse))
49764976
return false;
4977-
if (!visitStmt(IS->getThen()))
4978-
return false;
4977+
{
4978+
LocalScope<Emitter> ThenScope(this);
4979+
if (!visitStmt(IS->getThen()))
4980+
return false;
4981+
if (!ThenScope.destroyLocals())
4982+
return false;
4983+
}
49794984
if (!this->jump(LabelEnd))
49804985
return false;
49814986
this->emitLabel(LabelElse);
4982-
if (!visitStmt(Else))
4983-
return false;
4987+
{
4988+
LocalScope<Emitter> ElseScope(this);
4989+
if (!visitStmt(Else))
4990+
return false;
4991+
if (!ElseScope.destroyLocals())
4992+
return false;
4993+
}
49844994
this->emitLabel(LabelEnd);
49854995
} else {
49864996
LabelTy LabelEnd = this->getLabel();
49874997
if (!this->jumpFalse(LabelEnd))
49884998
return false;
4989-
if (!visitStmt(IS->getThen()))
4990-
return false;
4999+
{
5000+
LocalScope<Emitter> ThenScope(this);
5001+
if (!visitStmt(IS->getThen()))
5002+
return false;
5003+
if (!ThenScope.destroyLocals())
5004+
return false;
5005+
}
49915006
this->emitLabel(LabelEnd);
49925007
}
49935008

clang/lib/Basic/Targets/X86.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,11 +832,6 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo
832832
"i64:64-i128:128-f80:128-n8:16:32:64-S128");
833833
}
834834

835-
void getTargetDefines(const LangOptions &Opts,
836-
MacroBuilder &Builder) const override {
837-
getOSDefines(Opts, X86TargetInfo::getTriple(), Builder);
838-
}
839-
840835
BuiltinVaListKind getBuiltinVaListKind() const override {
841836
return TargetInfo::CharPtrBuiltinVaList;
842837
}

clang/lib/Driver/ToolChains/UEFI.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ UEFI::UEFI(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
3535

3636
Tool *UEFI::buildLinker() const { return new tools::uefi::Linker(*this); }
3737

38+
void UEFI::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
39+
ArgStringList &CC1Args) const {
40+
if (DriverArgs.hasArg(options::OPT_nostdinc))
41+
return;
42+
43+
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
44+
SmallString<128> Dir(getDriver().ResourceDir);
45+
llvm::sys::path::append(Dir, "include");
46+
addSystemInclude(DriverArgs, CC1Args, Dir.str());
47+
}
48+
49+
if (DriverArgs.hasArg(options::OPT_nostdlibinc))
50+
return;
51+
52+
if (std::optional<std::string> Path = getStdlibIncludePath())
53+
addSystemInclude(DriverArgs, CC1Args, *Path);
54+
}
55+
3856
void tools::uefi::Linker::ConstructJob(Compilation &C, const JobAction &JA,
3957
const InputInfo &Output,
4058
const InputInfoList &Inputs,

clang/lib/Driver/ToolChains/UEFI.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class LLVM_LIBRARY_VISIBILITY UEFI : public ToolChain {
5151
return false;
5252
}
5353
bool isPICDefaultForced() const override { return true; }
54+
55+
void
56+
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
57+
llvm::opt::ArgStringList &CC1Args) const override;
5458
};
5559

5660
} // namespace toolchains

clang/lib/Format/MacroExpander.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ MacroExpander::expand(FormatToken *ID,
233233
if (Result.size() > 1) {
234234
++Result[0]->MacroCtx->StartOfExpansion;
235235
++Result[Result.size() - 2]->MacroCtx->EndOfExpansion;
236+
} else {
237+
// If the macro expansion is empty, mark the start and end.
238+
Result[0]->MacroCtx->StartOfExpansion = 1;
239+
Result[0]->MacroCtx->EndOfExpansion = 1;
236240
}
237241
return Result;
238242
}

clang/lib/Format/QualifierAlignmentFixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeRight(
348348
}
349349
}
350350

351-
if (Next->is(tok::kw_auto))
351+
if (Next && Next->is(tok::kw_auto))
352352
TypeToken = Next;
353353

354354
// Place the Qualifier at the end of the list of qualifiers.

clang/lib/Lex/InitHeaderSearch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ bool InitHeaderSearch::ShouldAddDefaultIncludePaths(
301301
case llvm::Triple::PS5:
302302
case llvm::Triple::RTEMS:
303303
case llvm::Triple::Solaris:
304+
case llvm::Triple::UEFI:
304305
case llvm::Triple::WASI:
305306
case llvm::Triple::ZOS:
306307
return false;

clang/lib/Sema/SemaConcept.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,3 +1958,21 @@ concepts::TypeRequirement::TypeRequirement(TypeSourceInfo *T) :
19581958
Value(T),
19591959
Status(T->getType()->isInstantiationDependentType() ? SS_Dependent
19601960
: SS_Satisfied) {}
1961+
1962+
NormalizedConstraint::CompoundConstraintKind
1963+
NormalizedConstraint::getCompoundKind() const {
1964+
assert(isCompound() && "getCompoundKind on a non-compound constraint..");
1965+
return cast<CompoundConstraint>(Constraint).getInt();
1966+
}
1967+
1968+
AtomicConstraint *NormalizedConstraint::getAtomicConstraint() const {
1969+
assert(isAtomic() && "getAtomicConstraint called on non-atomic constraint.");
1970+
return cast<AtomicConstraint *>(Constraint);
1971+
}
1972+
1973+
FoldExpandedConstraint *
1974+
NormalizedConstraint::getFoldExpandedConstraint() const {
1975+
assert(isFoldExpanded() &&
1976+
"getFoldExpandedConstraint called on non-fold-expanded constraint.");
1977+
return cast<FoldExpandedConstraint *>(Constraint);
1978+
}

0 commit comments

Comments
 (0)