Skip to content

Commit 1a265dc

Browse files
authored
Merge branch 'main' into assume-filename-with-clang-format-ignore
2 parents 506a4a4 + 173907b commit 1a265dc

File tree

27 files changed

+159
-61
lines changed

27 files changed

+159
-61
lines changed

clang/include/clang/AST/ExprCXX.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,13 +876,13 @@ class CXXTypeidExpr : public Expr {
876876

877877
/// Best-effort check if the expression operand refers to a most derived
878878
/// object. This is not a strong guarantee.
879-
bool isMostDerived(ASTContext &Context) const;
879+
bool isMostDerived(const ASTContext &Context) const;
880880

881881
bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); }
882882

883883
/// Retrieves the type operand of this typeid() expression after
884884
/// various required adjustments (removing reference types, cv-qualifiers).
885-
QualType getTypeOperand(ASTContext &Context) const;
885+
QualType getTypeOperand(const ASTContext &Context) const;
886886

887887
/// Retrieve source information for the type operand.
888888
TypeSourceInfo *getTypeOperandSourceInfo() const {

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,10 @@ static bool interp__builtin_ia32_pdep(InterpState &S, CodePtr OpPC,
13311331
const InterpFrame *Frame,
13321332
const Function *Func,
13331333
const CallExpr *Call) {
1334+
if (!Call->getArg(0)->getType()->isIntegerType() ||
1335+
!Call->getArg(1)->getType()->isIntegerType())
1336+
return false;
1337+
13341338
PrimType ValT = *S.Ctx.classify(Call->getArg(0));
13351339
PrimType MaskT = *S.Ctx.classify(Call->getArg(1));
13361340

@@ -1352,6 +1356,10 @@ static bool interp__builtin_ia32_pext(InterpState &S, CodePtr OpPC,
13521356
const InterpFrame *Frame,
13531357
const Function *Func,
13541358
const CallExpr *Call) {
1359+
if (!Call->getArg(0)->getType()->isIntegerType() ||
1360+
!Call->getArg(1)->getType()->isIntegerType())
1361+
return false;
1362+
13551363
PrimType ValT = *S.Ctx.classify(Call->getArg(0));
13561364
PrimType MaskT = *S.Ctx.classify(Call->getArg(1));
13571365

clang/lib/AST/ExprCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool CXXTypeidExpr::isPotentiallyEvaluated() const {
147147
return false;
148148
}
149149

150-
bool CXXTypeidExpr::isMostDerived(ASTContext &Context) const {
150+
bool CXXTypeidExpr::isMostDerived(const ASTContext &Context) const {
151151
assert(!isTypeOperand() && "Cannot call isMostDerived for typeid(type)");
152152
const Expr *E = getExprOperand()->IgnoreParenNoopCasts(Context);
153153
if (const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
@@ -159,7 +159,7 @@ bool CXXTypeidExpr::isMostDerived(ASTContext &Context) const {
159159
return false;
160160
}
161161

162-
QualType CXXTypeidExpr::getTypeOperand(ASTContext &Context) const {
162+
QualType CXXTypeidExpr::getTypeOperand(const ASTContext &Context) const {
163163
assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)");
164164
Qualifiers Quals;
165165
return Context.getUnqualifiedArrayType(

clang/lib/Tooling/Inclusions/HeaderIncludes.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,9 @@ HeaderIncludes::HeaderIncludes(StringRef FileName, StringRef Code,
335335
// \p Offset: the start of the line following this include directive.
336336
void HeaderIncludes::addExistingInclude(Include IncludeToAdd,
337337
unsigned NextLineOffset) {
338-
auto Iter =
339-
ExistingIncludes.try_emplace(trimInclude(IncludeToAdd.Name)).first;
340-
Iter->second.push_back(std::move(IncludeToAdd));
341-
auto &CurInclude = Iter->second.back();
338+
auto &Incs = ExistingIncludes[trimInclude(IncludeToAdd.Name)];
339+
Incs.push_back(std::move(IncludeToAdd));
340+
auto &CurInclude = Incs.back();
342341
// The header name with quotes or angle brackets.
343342
// Only record the offset of current #include if we can insert after it.
344343
if (CurInclude.R.getOffset() <= MaxInsertOffset) {

compiler-rt/test/asan/TestCases/Windows/delay_dbghelp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// static build, there won't be any clang_rt DLLs.
1010
// RUN: not grep cl""ang_rt %t || \
1111
// RUN: grep cl""ang_rt %t | xargs which | \
12-
// RUN: xargs llvm-readobj --coff-imports | not grep dbghelp.dll %t
12+
// RUN: xargs llvm-readobj --coff-imports | not grep dbghelp.dll
1313

1414
extern "C" int puts(const char *);
1515

libc/src/string/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ add_entrypoint_object(
138138
DEPENDS
139139
.strcpy
140140
.string_utils
141+
libc.include.llvm-libc-types.size_t
141142
)
142143

143144
add_entrypoint_object(
@@ -240,6 +241,7 @@ add_entrypoint_object(
240241
.string_utils
241242
libc.include.stdlib
242243
libc.src.errno.errno
244+
libc.include.llvm-libc-types.size_t
243245
)
244246

245247
add_entrypoint_object(
@@ -270,7 +272,7 @@ add_entrypoint_object(
270272
strlcat.h
271273
DEPENDS
272274
.string_utils
273-
libc.include.string
275+
libc.include.llvm-libc-types.size_t
274276
)
275277

276278
add_entrypoint_object(
@@ -281,7 +283,7 @@ add_entrypoint_object(
281283
strlcpy.h
282284
DEPENDS
283285
.string_utils
284-
libc.include.string
286+
libc.include.llvm-libc-types.size_t
285287
)
286288

287289
add_entrypoint_object(
@@ -292,7 +294,7 @@ add_entrypoint_object(
292294
strlen.h
293295
DEPENDS
294296
.string_utils
295-
libc.include.string
297+
libc.include.llvm-libc-types.size_t
296298
)
297299

298300
add_entrypoint_object(
@@ -304,6 +306,7 @@ add_entrypoint_object(
304306
DEPENDS
305307
.strncpy
306308
.string_utils
309+
libc.include.llvm-libc-types.size_t
307310
)
308311

309312
add_entrypoint_object(
@@ -346,6 +349,7 @@ add_entrypoint_object(
346349
.string_utils
347350
libc.include.stdlib
348351
libc.src.__support.CPP.new
352+
libc.include.llvm-libc-types.size_t
349353
)
350354

351355
add_entrypoint_object(

libc/src/string/strcat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRCAT_H
1010
#define LLVM_LIBC_SRC_STRING_STRCAT_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strcpy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRCPY_H
1010
#define LLVM_LIBC_SRC_STRING_STRCPY_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strdup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRDUP_H
1010
#define LLVM_LIBC_SRC_STRING_STRDUP_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strlcat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRLCAT_H
1010
#define LLVM_LIBC_SRC_STRING_STRLCAT_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strlcpy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRLCPY_H
1010
#define LLVM_LIBC_SRC_STRING_STRLCPY_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strlen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRLEN_H
1010
#define LLVM_LIBC_SRC_STRING_STRLEN_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strncat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRNCAT_H
1010
#define LLVM_LIBC_SRC_STRING_STRNCAT_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

libc/src/string/strndup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#ifndef LLVM_LIBC_SRC_STRING_STRNDUP_H
1010
#define LLVM_LIBC_SRC_STRING_STRNDUP_H
1111

12+
#include "include/llvm-libc-types/size_t.h"
1213
#include "src/__support/macros/config.h"
13-
#include <string.h>
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

lldb/source/Interpreter/Options.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,9 @@ Option *Options::GetLongOptions() {
251251
m_getopt_table[i].flag = nullptr;
252252
m_getopt_table[i].val = short_opt;
253253

254-
if (option_seen.find(short_opt) == option_seen.end()) {
255-
option_seen[short_opt] = i;
256-
} else if (short_opt) {
254+
auto [pos, inserted] = option_seen.try_emplace(short_opt, i);
255+
if (!inserted && short_opt) {
257256
m_getopt_table[i].val = 0;
258-
std::map<int, uint32_t>::const_iterator pos =
259-
option_seen.find(short_opt);
260257
StreamString strm;
261258
if (defs[i].HasShortOption())
262259
Debugger::ReportError(

llvm/include/llvm/Analysis/TargetLibraryInfo.def

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,6 +2162,36 @@ TLI_DEFINE_ENUM_INTERNAL(roundl)
21622162
TLI_DEFINE_STRING_INTERNAL("roundl")
21632163
TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl)
21642164

2165+
/// double scalbln(double arg, long exp);
2166+
TLI_DEFINE_ENUM_INTERNAL(scalbln)
2167+
TLI_DEFINE_STRING_INTERNAL("scalbln")
2168+
TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Long)
2169+
2170+
/// float scalblnf(float arg, long exp);
2171+
TLI_DEFINE_ENUM_INTERNAL(scalblnf)
2172+
TLI_DEFINE_STRING_INTERNAL("scalblnf")
2173+
TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Long)
2174+
2175+
/// long double scalblnl(long double arg, long exp);
2176+
TLI_DEFINE_ENUM_INTERNAL(scalblnl)
2177+
TLI_DEFINE_STRING_INTERNAL("scalblnl")
2178+
TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Long)
2179+
2180+
/// double scalbn(double arg, int exp);
2181+
TLI_DEFINE_ENUM_INTERNAL(scalbn)
2182+
TLI_DEFINE_STRING_INTERNAL("scalbn")
2183+
TLI_DEFINE_SIG_INTERNAL(Dbl, Dbl, Int)
2184+
2185+
/// float scalbnf(float arg, int exp);
2186+
TLI_DEFINE_ENUM_INTERNAL(scalbnf)
2187+
TLI_DEFINE_STRING_INTERNAL("scalbnf")
2188+
TLI_DEFINE_SIG_INTERNAL(Flt, Flt, Int)
2189+
2190+
/// long double scalbnl(long double arg, int exp);
2191+
TLI_DEFINE_ENUM_INTERNAL(scalbnl)
2192+
TLI_DEFINE_STRING_INTERNAL("scalbnl")
2193+
TLI_DEFINE_SIG_INTERNAL(LDbl, LDbl, Int)
2194+
21652195
/// int scanf(const char *restrict format, ... );
21662196
TLI_DEFINE_ENUM_INTERNAL(scanf)
21672197
TLI_DEFINE_STRING_INTERNAL("scanf")

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,12 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
382382
TLI.setUnavailable(LibFunc_rintf);
383383
TLI.setUnavailable(LibFunc_round);
384384
TLI.setUnavailable(LibFunc_roundf);
385+
TLI.setUnavailable(LibFunc_scalbln);
386+
TLI.setUnavailable(LibFunc_scalblnf);
387+
TLI.setUnavailable(LibFunc_scalblnl);
388+
TLI.setUnavailable(LibFunc_scalbn);
389+
TLI.setUnavailable(LibFunc_scalbnf);
390+
TLI.setUnavailable(LibFunc_scalbnl);
385391
TLI.setUnavailable(LibFunc_trunc);
386392
TLI.setUnavailable(LibFunc_truncf);
387393
}
@@ -404,6 +410,8 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
404410
TLI.setUnavailable(LibFunc_nearbyintl);
405411
TLI.setUnavailable(LibFunc_rintl);
406412
TLI.setUnavailable(LibFunc_roundl);
413+
TLI.setUnavailable(LibFunc_scalblnl);
414+
TLI.setUnavailable(LibFunc_scalbnl);
407415
TLI.setUnavailable(LibFunc_truncl);
408416

409417
// Win32 does not support these functions, but

llvm/lib/Support/VirtualFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ class InMemoryFileAdaptor : public File {
750750

751751
class InMemoryDirectory : public InMemoryNode {
752752
Status Stat;
753-
std::map<std::string, std::unique_ptr<InMemoryNode>> Entries;
753+
std::map<std::string, std::unique_ptr<InMemoryNode>, std::less<>> Entries;
754754

755755
public:
756756
InMemoryDirectory(Status Stat)
@@ -766,7 +766,7 @@ class InMemoryDirectory : public InMemoryNode {
766766
UniqueID getUniqueID() const { return Stat.getUniqueID(); }
767767

768768
InMemoryNode *getChild(StringRef Name) const {
769-
auto I = Entries.find(Name.str());
769+
auto I = Entries.find(Name);
770770
if (I != Entries.end())
771771
return I->second.get();
772772
return nullptr;

llvm/lib/Transforms/Scalar/GVNSink.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -535,14 +535,10 @@ class ValueTable {
535535
uint32_t e = ExpressionNumbering[exp];
536536
if (!e) {
537537
hash_code H = exp->getHashValue([=](Value *V) { return lookupOrAdd(V); });
538-
auto I = HashNumbering.find(H);
539-
if (I != HashNumbering.end()) {
540-
e = I->second;
541-
} else {
542-
e = nextValueNumber++;
543-
HashNumbering[H] = e;
544-
ExpressionNumbering[exp] = e;
545-
}
538+
auto [I, Inserted] = HashNumbering.try_emplace(H, nextValueNumber);
539+
e = I->second;
540+
if (Inserted)
541+
ExpressionNumbering[exp] = nextValueNumber++;
546542
}
547543
ValueNumbering[V] = e;
548544
return e;

llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,12 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F,
12491249
case LibFunc_round:
12501250
case LibFunc_roundf:
12511251
case LibFunc_roundl:
1252+
case LibFunc_scalbln:
1253+
case LibFunc_scalblnf:
1254+
case LibFunc_scalblnl:
1255+
case LibFunc_scalbn:
1256+
case LibFunc_scalbnf:
1257+
case LibFunc_scalbnl:
12521258
case LibFunc_sin:
12531259
case LibFunc_sincospif_stret:
12541260
case LibFunc_sinf:

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,11 +3840,11 @@ static const std::optional<BitPart> &
38403840
collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals,
38413841
std::map<Value *, std::optional<BitPart>> &BPS, int Depth,
38423842
bool &FoundRoot) {
3843-
auto I = BPS.find(V);
3844-
if (I != BPS.end())
3843+
auto [I, Inserted] = BPS.try_emplace(V);
3844+
if (!Inserted)
38453845
return I->second;
38463846

3847-
auto &Result = BPS[V] = std::nullopt;
3847+
auto &Result = I->second;
38483848
auto BitWidth = V->getType()->getScalarSizeInBits();
38493849

38503850
// Can't do integer/elements > 128 bits.

0 commit comments

Comments
 (0)