Skip to content

Commit

Permalink
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Browse files Browse the repository at this point in the history
llvmorg-10.0.1-rc1-0-gf79cd71e145 (aka 10.0.1 rc1).

MFC after:	3 weeks
  • Loading branch information
DimitryAndric committed May 23, 2020
2 parents 2bbab0a + ec2b0f9 commit d65cd7a
Show file tree
Hide file tree
Showing 63 changed files with 1,227 additions and 579 deletions.
251 changes: 251 additions & 0 deletions ObsoleteFiles.inc

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions UPDATING
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)

20200523:
Clang, llvm, lld, lldb, compiler-rt, libc++, libunwind and openmp have
been upgraded to 10.0.1. Please see the 20141231 entry below for
information about prerequisites and upgrading, if you are not already
using clang 3.5.0 or higher.

20200424:
closefrom(2) has been moved under COMPAT12, and replaced in libc with a
stub that calls close_range(2). If using a custom kernel configuration,
Expand Down
2 changes: 2 additions & 0 deletions contrib/llvm-project/FREEBSD-Xlist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.clang-format
.clang-tidy
.git-blame-ignore-revs
.github/
.gitignore
CONTRIBUTING.md
README.md
Expand Down Expand Up @@ -264,6 +265,7 @@ lldb/.clang-format
lldb/.gitignore
lldb/CMakeLists.txt
lldb/CODE_OWNERS.txt
lldb/bindings/CMakeLists.txt
lldb/cmake/
lldb/docs/.htaccess
lldb/docs/CMakeLists.txt
Expand Down
9 changes: 5 additions & 4 deletions contrib/llvm-project/clang/include/clang/AST/DeclBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -856,14 +856,15 @@ class alignas(8) Decl {
return getParentFunctionOrMethod() == nullptr;
}

/// Returns true if this declaration lexically is inside a function.
/// It recognizes non-defining declarations as well as members of local
/// classes:
/// Returns true if this declaration is lexically inside a function or inside
/// a variable initializer. It recognizes non-defining declarations as well
/// as members of local classes:
/// \code
/// void foo() { void bar(); }
/// void foo2() { class ABC { void bar(); }; }
/// inline int x = [](){ return 0; };
/// \endcode
bool isLexicallyWithinFunctionOrMethod() const;
bool isInLocalScope() const;

/// If this decl is defined inside a function/method/block it returns
/// the corresponding DeclContext, otherwise it returns null.
Expand Down
2 changes: 1 addition & 1 deletion contrib/llvm-project/clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def XRayLogArgs : InheritableAttr {

def PatchableFunctionEntry
: InheritableAttr,
TargetSpecificAttr<TargetArch<["aarch64", "x86", "x86_64"]>> {
TargetSpecificAttr<TargetArch<["aarch64", "aarch64_be", "x86", "x86_64"]>> {
let Spellings = [GCC<"patchable_function_entry">];
let Subjects = SubjectList<[Function, ObjCMethod]>;
let Args = [UnsignedArgument<"Count">, DefaultIntArgument<"Offset", 0>];
Expand Down
5 changes: 4 additions & 1 deletion contrib/llvm-project/clang/lib/AST/DeclBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,16 @@ void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
}
}

bool Decl::isLexicallyWithinFunctionOrMethod() const {
bool Decl::isInLocalScope() const {
const DeclContext *LDC = getLexicalDeclContext();
while (true) {
if (LDC->isFunctionOrMethod())
return true;
if (!isa<TagDecl>(LDC))
return false;
if (const auto *CRD = dyn_cast<CXXRecordDecl>(LDC))
if (CRD->isLambda())
return true;
LDC = LDC->getLexicalParent();
}
return false;
Expand Down
23 changes: 22 additions & 1 deletion contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8593,6 +8593,10 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
static bool EvaluateArrayNewInitList(EvalInfo &Info, LValue &This,
APValue &Result, const InitListExpr *ILE,
QualType AllocType);
static bool EvaluateArrayNewConstructExpr(EvalInfo &Info, LValue &This,
APValue &Result,
const CXXConstructExpr *CCE,
QualType AllocType);

bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
if (!Info.getLangOpts().CPlusPlus2a)
Expand Down Expand Up @@ -8642,6 +8646,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {

const Expr *Init = E->getInitializer();
const InitListExpr *ResizedArrayILE = nullptr;
const CXXConstructExpr *ResizedArrayCCE = nullptr;

QualType AllocType = E->getAllocatedType();
if (Optional<const Expr*> ArraySize = E->getArraySize()) {
Expand Down Expand Up @@ -8685,7 +8690,7 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
// -- the new-initializer is a braced-init-list and the number of
// array elements for which initializers are provided [...]
// exceeds the number of elements to initialize
if (Init) {
if (Init && !isa<CXXConstructExpr>(Init)) {
auto *CAT = Info.Ctx.getAsConstantArrayType(Init->getType());
assert(CAT && "unexpected type for array initializer");

Expand All @@ -8708,6 +8713,8 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
// special handling for this case when we initialize.
if (InitBound != AllocBound)
ResizedArrayILE = cast<InitListExpr>(Init);
} else if (Init) {
ResizedArrayCCE = cast<CXXConstructExpr>(Init);
}

AllocType = Info.Ctx.getConstantArrayType(AllocType, ArrayBound, nullptr,
Expand Down Expand Up @@ -8772,6 +8779,10 @@ bool PointerExprEvaluator::VisitCXXNewExpr(const CXXNewExpr *E) {
if (!EvaluateArrayNewInitList(Info, Result, *Val, ResizedArrayILE,
AllocType))
return false;
} else if (ResizedArrayCCE) {
if (!EvaluateArrayNewConstructExpr(Info, Result, *Val, ResizedArrayCCE,
AllocType))
return false;
} else if (Init) {
if (!EvaluateInPlace(*Val, Info, Result, Init))
return false;
Expand Down Expand Up @@ -9597,6 +9608,16 @@ static bool EvaluateArrayNewInitList(EvalInfo &Info, LValue &This,
.VisitInitListExpr(ILE, AllocType);
}

static bool EvaluateArrayNewConstructExpr(EvalInfo &Info, LValue &This,
APValue &Result,
const CXXConstructExpr *CCE,
QualType AllocType) {
assert(CCE->isRValue() && CCE->getType()->isArrayType() &&
"not an array rvalue");
return ArrayExprEvaluator(Info, This, Result)
.VisitCXXConstructExpr(CCE, This, &Result, AllocType);
}

// Return true iff the given array filler may depend on the element index.
static bool MaybeElementDependentArrayFiller(const Expr *FillerExpr) {
// For now, just whitelist non-class value-initialization and initialization
Expand Down
2 changes: 1 addition & 1 deletion contrib/llvm-project/clang/lib/AST/RawCommentList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ std::string RawComment::getFormattedText(const SourceManager &SourceMgr,
};

auto DropTrailingNewLines = [](std::string &Str) {
while (Str.back() == '\n')
while (!Str.empty() && Str.back() == '\n')
Str.pop_back();
};

Expand Down
11 changes: 9 additions & 2 deletions contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,9 +1847,16 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
else if (const auto *SA = FD->getAttr<SectionAttr>())
F->setSection(SA->getName());

// If we plan on emitting this inline builtin, we can't treat it as a builtin.
if (FD->isInlineBuiltinDeclaration()) {
F->addAttribute(llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoBuiltin);
const FunctionDecl *FDBody;
bool HasBody = FD->hasBody(FDBody);
(void)HasBody;
assert(HasBody && "Inline builtin declarations should always have an "
"available body!");
if (shouldEmitFunction(FDBody))
F->addAttribute(llvm::AttributeList::FunctionIndex,
llvm::Attribute::NoBuiltin);
}

if (FD->isReplaceableGlobalAllocationFunction()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,7 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
addExportedSymbol(CmdArgs, "___gcov_flush");
addExportedSymbol(CmdArgs, "_flush_fn_list");
addExportedSymbol(CmdArgs, "_writeout_fn_list");
addExportedSymbol(CmdArgs, "_reset_fn_list");
} else {
addExportedSymbol(CmdArgs, "___llvm_profile_filename");
addExportedSymbol(CmdArgs, "___llvm_profile_raw_version");
Expand Down
20 changes: 11 additions & 9 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,25 +309,24 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
}
}

static bool getPIE(const ArgList &Args, const toolchains::Linux &ToolChain) {
static bool getPIE(const ArgList &Args, const ToolChain &TC) {
if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_static) ||
Args.hasArg(options::OPT_r) || Args.hasArg(options::OPT_static_pie))
return false;

Arg *A = Args.getLastArg(options::OPT_pie, options::OPT_no_pie,
options::OPT_nopie);
if (!A)
return ToolChain.isPIEDefault();
return TC.isPIEDefault();
return A->getOption().matches(options::OPT_pie);
}

static bool getStaticPIE(const ArgList &Args,
const toolchains::Linux &ToolChain) {
static bool getStaticPIE(const ArgList &Args, const ToolChain &TC) {
bool HasStaticPIE = Args.hasArg(options::OPT_static_pie);
// -no-pie is an alias for -nopie. So, handling -nopie takes care of
// -no-pie as well.
if (HasStaticPIE && Args.hasArg(options::OPT_nopie)) {
const Driver &D = ToolChain.getDriver();
const Driver &D = TC.getDriver();
const llvm::opt::OptTable &Opts = D.getOpts();
const char *StaticPIEName = Opts.getOptionName(options::OPT_static_pie);
const char *NoPIEName = Opts.getOptionName(options::OPT_nopie);
Expand All @@ -346,8 +345,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
const toolchains::Linux &ToolChain =
static_cast<const toolchains::Linux &>(getToolChain());
// FIXME: The Linker class constructor takes a ToolChain and not a
// Generic_ELF, so the static_cast might return a reference to a invalid
// instance (see PR45061). Ideally, the Linker constructor needs to take a
// Generic_ELF instead.
const toolchains::Generic_ELF &ToolChain =
static_cast<const toolchains::Generic_ELF &>(getToolChain());
const Driver &D = ToolChain.getDriver();

const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
Expand Down Expand Up @@ -418,8 +421,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (isAndroid)
CmdArgs.push_back("--warn-shared-textrel");

for (const auto &Opt : ToolChain.ExtraOpts)
CmdArgs.push_back(Opt.c_str());
ToolChain.addExtraOpts(CmdArgs);

CmdArgs.push_back("--eh-frame-hdr");

Expand Down
6 changes: 6 additions & 0 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ class LLVM_LIBRARY_VISIBILITY Generic_ELF : public Generic_GCC {
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
Action::OffloadKind DeviceOffloadKind) const override;

virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const {
return {};
}

virtual void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const {}
};

} // end namespace toolchains
Expand Down
8 changes: 6 additions & 2 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Hurd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
return Triple.isArch32Bit() ? "lib" : "lib64";
}

Hurd::Hurd(const Driver &D, const llvm::Triple &Triple,
const ArgList &Args)
Hurd::Hurd(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
: Generic_ELF(D, Triple, Args) {
std::string SysRoot = computeSysRoot();
path_list &Paths = getFilePaths();
Expand Down Expand Up @@ -170,3 +169,8 @@ void Hurd::AddClangSystemIncludeArgs(const ArgList &DriverArgs,

addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
}

void Hurd::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const {
for (const auto &Opt : ExtraOpts)
CmdArgs.push_back(Opt.c_str());
}
6 changes: 4 additions & 2 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Hurd.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ class LLVM_LIBRARY_VISIBILITY Hurd : public Generic_ELF {
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;

virtual std::string computeSysRoot() const;
std::string computeSysRoot() const;

virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const;
std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override;

void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override;

std::vector<std::string> ExtraOpts;

Expand Down
5 changes: 5 additions & 0 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,3 +986,8 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args,
Twine("-u", llvm::getInstrProfRuntimeHookVarName())));
ToolChain::addProfileRTLibs(Args, CmdArgs);
}

void Linux::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const {
for (const auto &Opt : ExtraOpts)
CmdArgs.push_back(Opt.c_str());
}
4 changes: 3 additions & 1 deletion contrib/llvm-project/clang/lib/Driver/ToolChains/Linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class LLVM_LIBRARY_VISIBILITY Linux : public Generic_ELF {
llvm::opt::ArgStringList &CmdArgs) const override;
virtual std::string computeSysRoot() const;

virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const;
std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override;

void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override;

std::vector<std::string> ExtraOpts;

Expand Down
52 changes: 38 additions & 14 deletions contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2176,6 +2176,10 @@ static bool isFunctionDeclarationName(const FormatToken &Current,
Next = Next->Next;
continue;
}
if (Next->is(TT_TemplateOpener) && Next->MatchingParen) {
Next = Next->MatchingParen;
continue;
}

break;
}
Expand Down Expand Up @@ -2705,20 +2709,40 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
tok::l_square));
if (Right.is(tok::star) && Left.is(tok::l_paren))
return false;
if (Right.isOneOf(tok::star, tok::amp, tok::ampamp) &&
(Left.is(tok::identifier) || Left.isSimpleTypeSpecifier()) &&
// Space between the type and the * in:
// operator void*()
// operator char*()
// operator /*comment*/ const char*()
// operator volatile /*comment*/ char*()
// operator Foo*()
// dependent on PointerAlignment style.
Left.Previous &&
(Left.Previous->endsSequence(tok::kw_operator) ||
Left.Previous->endsSequence(tok::kw_const, tok::kw_operator) ||
Left.Previous->endsSequence(tok::kw_volatile, tok::kw_operator)))
return (Style.PointerAlignment != FormatStyle::PAS_Left);
if (Right.is(tok::star) && Left.is(tok::star))
return false;
if (Right.isOneOf(tok::star, tok::amp, tok::ampamp)) {
const FormatToken *Previous = &Left;
while (Previous && !Previous->is(tok::kw_operator)) {
if (Previous->is(tok::identifier) || Previous->isSimpleTypeSpecifier()) {
Previous = Previous->getPreviousNonComment();
continue;
}
if (Previous->is(TT_TemplateCloser) && Previous->MatchingParen) {
Previous = Previous->MatchingParen->getPreviousNonComment();
continue;
}
if (Previous->is(tok::coloncolon)) {
Previous = Previous->getPreviousNonComment();
continue;
}
break;
}
// Space between the type and the * in:
// operator void*()
// operator char*()
// operator /*comment*/ const char*()
// operator volatile /*comment*/ char*()
// operator Foo*()
// operator C<T>*()
// operator std::Foo*()
// operator C<T>::D<U>*()
// dependent on PointerAlignment style.
if (Previous && (Previous->endsSequence(tok::kw_operator) ||
Previous->endsSequence(tok::kw_const, tok::kw_operator) ||
Previous->endsSequence(tok::kw_volatile, tok::kw_operator)))
return (Style.PointerAlignment != FormatStyle::PAS_Left);
}
const auto SpaceRequiredForArrayInitializerLSquare =
[](const FormatToken &LSquareTok, const FormatStyle &Style) {
return Style.SpacesInContainerLiterals ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2343,7 +2343,7 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
UnparsedDefaultArgInstantiations[OldParm].push_back(NewParm);
} else if (Expr *Arg = OldParm->getDefaultArg()) {
FunctionDecl *OwningFunc = cast<FunctionDecl>(OldParm->getDeclContext());
if (OwningFunc->isLexicallyWithinFunctionOrMethod()) {
if (OwningFunc->isInLocalScope()) {
// Instantiate default arguments for methods of local classes (DR1484)
// and non-defining declarations.
Sema::ContextRAII SavedContext(*this, OwningFunc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4367,7 +4367,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New,
EPI.ExceptionSpec.Type != EST_None &&
EPI.ExceptionSpec.Type != EST_DynamicNone &&
EPI.ExceptionSpec.Type != EST_BasicNoexcept &&
!Tmpl->isLexicallyWithinFunctionOrMethod()) {
!Tmpl->isInLocalScope()) {
FunctionDecl *ExceptionSpecTemplate = Tmpl;
if (EPI.ExceptionSpec.Type == EST_Uninstantiated)
ExceptionSpecTemplate = EPI.ExceptionSpec.SourceTemplate;
Expand Down
Loading

0 comments on commit d65cd7a

Please sign in to comment.