Skip to content

Commit fda0864

Browse files
authored
Merge branch 'main' into OpenXiangShan/reapply-flang-pgo
2 parents 22ff984 + 2e33734 commit fda0864

File tree

56 files changed

+3158
-1090
lines changed

Some content is hidden

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

56 files changed

+3158
-1090
lines changed

clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,11 @@ createSymbolIndexManager(StringRef FilePath) {
167167
// Parse input and fill the database with it.
168168
// <symbol>=<header><, header...>
169169
// Multiple symbols can be given, separated by semicolons.
170-
std::map<std::string, std::vector<std::string>> SymbolsMap;
171170
SmallVector<StringRef, 4> SemicolonSplits;
172171
StringRef(Input).split(SemicolonSplits, ";");
173172
std::vector<find_all_symbols::SymbolAndSignals> Symbols;
174173
for (StringRef Pair : SemicolonSplits) {
175174
auto Split = Pair.split('=');
176-
std::vector<std::string> Headers;
177175
SmallVector<StringRef, 4> CommaSplits;
178176
Split.second.split(CommaSplits, ",");
179177
for (size_t I = 0, E = CommaSplits.size(); I != E; ++I)

clang-tools-extra/clang-tidy/openmp/ExceptionEscapeCheck.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
2020
ClangTidyContext *Context)
2121
: ClangTidyCheck(Name, Context),
2222
RawIgnoredExceptions(Options.get("IgnoredExceptions", "")) {
23-
llvm::SmallVector<StringRef, 8> FunctionsThatShouldNotThrowVec,
24-
IgnoredExceptionsVec;
23+
llvm::SmallVector<StringRef, 8> IgnoredExceptionsVec;
2524

2625
llvm::StringSet<> IgnoredExceptions;
2726
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);

clang-tools-extra/clang-tidy/readability/MathMissingParenthesesCheck.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ static void addParantheses(const BinaryOperator *BinOp,
8888
void MathMissingParenthesesCheck::check(
8989
const MatchFinder::MatchResult &Result) {
9090
const auto *BinOp = Result.Nodes.getNodeAs<BinaryOperator>("binOp");
91-
std::vector<
92-
std::pair<clang::SourceRange, std::pair<const clang::BinaryOperator *,
93-
const clang::BinaryOperator *>>>
94-
Insertions;
9591
const SourceManager &SM = *Result.SourceManager;
9692
const clang::LangOptions &LO = Result.Context->getLangOpts();
9793
addParantheses(BinOp, nullptr, this, SM, LO);

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
913913
if (!ResourceDir.empty())
914914
Opts.ResourceDir = ResourceDir;
915915
Opts.BuildDynamicSymbolIndex = true;
916-
std::vector<std::unique_ptr<SymbolIndex>> IdxStack;
917916
#if CLANGD_ENABLE_REMOTE
918917
if (RemoteIndexAddress.empty() != ProjectRoot.empty()) {
919918
llvm::errs() << "remote-index-address and project-path have to be "

clang/bindings/python/clang/cindex.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ def is_in_system_header(self):
335335
return conf.lib.clang_Location_isInSystemHeader(self) # type: ignore [no-any-return]
336336

337337
def __eq__(self, other):
338-
if not isinstance(other, SourceLocation):
339-
return False
340-
return conf.lib.clang_equalLocations(self, other) # type: ignore [no-any-return]
338+
return isinstance(other, SourceLocation) and conf.lib.clang_equalLocations(
339+
self, other
340+
)
341341

342342
def __ne__(self, other):
343343
return not self.__eq__(other)
@@ -395,9 +395,9 @@ def end(self):
395395
return conf.lib.clang_getRangeEnd(self) # type: ignore [no-any-return]
396396

397397
def __eq__(self, other):
398-
if not isinstance(other, SourceRange):
399-
return False
400-
return conf.lib.clang_equalRanges(self, other) # type: ignore [no-any-return]
398+
return isinstance(other, SourceRange) and conf.lib.clang_equalRanges(
399+
self, other
400+
)
401401

402402
def __ne__(self, other):
403403
return not self.__eq__(other)
@@ -1599,9 +1599,7 @@ def from_location(tu: TranslationUnit, location: SourceLocation) -> Cursor | Non
15991599

16001600
# This function is not null-guarded because it is used in cursor_null_guard itself
16011601
def __eq__(self, other: object) -> bool:
1602-
if not isinstance(other, Cursor):
1603-
return False
1604-
return conf.lib.clang_equalCursors(self, other) # type: ignore [no-any-return]
1602+
return isinstance(other, Cursor) and conf.lib.clang_equalCursors(self, other)
16051603

16061604
# Not null-guarded for consistency with __eq__
16071605
def __ne__(self, other: object) -> bool:

clang/lib/AST/ByteCode/Context.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bool Context::isPotentialConstantExpr(State &Parent, const FunctionDecl *FD) {
4949
if (!Run(Parent, Func))
5050
return false;
5151

52-
return Func->isConstexpr();
52+
return Func->isValid();
5353
}
5454

5555
bool Context::evaluateAsRValue(State &Parent, const Expr *E, APValue &Result) {

clang/lib/AST/ByteCode/Function.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Function::Function(Program &P, FunctionDeclTy Source, unsigned ArgSize,
2727
if (const auto *F = dyn_cast<const FunctionDecl *>(Source)) {
2828
Variadic = F->isVariadic();
2929
Immediate = F->isImmediateFunction();
30+
Constexpr = F->isConstexpr() || F->hasAttr<MSConstexprAttr>();
3031
if (const auto *CD = dyn_cast<CXXConstructorDecl>(F)) {
3132
Virtual = CD->isVirtual();
3233
Kind = FunctionKind::Ctor;
@@ -48,6 +49,7 @@ Function::Function(Program &P, FunctionDeclTy Source, unsigned ArgSize,
4849
Variadic = false;
4950
Virtual = false;
5051
Immediate = false;
52+
Constexpr = false;
5153
}
5254
}
5355

clang/lib/AST/ByteCode/Function.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ class Function final {
150150
/// Returns the source information at a given PC.
151151
SourceInfo getSource(CodePtr PC) const;
152152

153-
/// Checks if the function is valid to call in constexpr.
154-
bool isConstexpr() const { return IsValid || isLambdaStaticInvoker(); }
153+
/// Checks if the function is valid to call.
154+
bool isValid() const { return IsValid || isLambdaStaticInvoker(); }
155155

156156
/// Checks if the function is virtual.
157157
bool isVirtual() const { return Virtual; };
158158
bool isImmediate() const { return Immediate; }
159+
bool isConstexpr() const { return Constexpr; }
159160

160161
/// Checks if the function is a constructor.
161162
bool isConstructor() const { return Kind == FunctionKind::Ctor; }
@@ -303,6 +304,8 @@ class Function final {
303304
unsigned Virtual : 1;
304305
LLVM_PREFERRED_TYPE(bool)
305306
unsigned Immediate : 1;
307+
LLVM_PREFERRED_TYPE(bool)
308+
unsigned Constexpr : 1;
306309

307310
public:
308311
/// Dumps the disassembled bytecode to \c llvm::errs().

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -857,23 +857,22 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
857857
return false;
858858
}
859859

860-
// Bail out if the function declaration itself is invalid. We will
861-
// have produced a relevant diagnostic while parsing it, so just
862-
// note the problematic sub-expression.
863-
if (F->getDecl()->isInvalidDecl())
864-
return Invalid(S, OpPC);
865-
866860
if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0)
867861
return false;
868862

869-
if (F->isConstexpr() && F->hasBody() &&
870-
(F->getDecl()->isConstexpr() || F->getDecl()->hasAttr<MSConstexprAttr>()))
863+
if (F->isValid() && F->hasBody() && F->isConstexpr())
871864
return true;
872865

873866
// Implicitly constexpr.
874867
if (F->isLambdaStaticInvoker())
875868
return true;
876869

870+
// Bail out if the function declaration itself is invalid. We will
871+
// have produced a relevant diagnostic while parsing it, so just
872+
// note the problematic sub-expression.
873+
if (F->getDecl()->isInvalidDecl())
874+
return Invalid(S, OpPC);
875+
877876
// Diagnose failed assertions specially.
878877
if (S.Current->getLocation(OpPC).isMacroID() &&
879878
F->getDecl()->getIdentifier()) {
@@ -923,7 +922,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
923922
// for a constant expression. It might be defined at the point we're
924923
// actually calling it.
925924
bool IsExtern = DiagDecl->getStorageClass() == SC_Extern;
926-
if (!DiagDecl->isDefined() && !IsExtern && DiagDecl->isConstexpr() &&
925+
bool IsDefined = F->isDefined();
926+
if (!IsDefined && !IsExtern && DiagDecl->isConstexpr() &&
927927
S.checkingPotentialConstantExpression())
928928
return false;
929929

0 commit comments

Comments
 (0)