30 changes: 6 additions & 24 deletions flang/lib/Lower/OpenMP/Clauses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ MAKE_EMPTY_CLASS(Full, Full);
MAKE_EMPTY_CLASS(Inbranch, Inbranch);
MAKE_EMPTY_CLASS(Mergeable, Mergeable);
MAKE_EMPTY_CLASS(Nogroup, Nogroup);
// MAKE_EMPTY_CLASS(NoOpenmp, ); // missing-in-parser
// MAKE_EMPTY_CLASS(NoOpenmpRoutines, ); // missing-in-parser
// MAKE_EMPTY_CLASS(NoParallelism, ); // missing-in-parser
MAKE_EMPTY_CLASS(NoOpenmp, NoOpenmp);
MAKE_EMPTY_CLASS(NoOpenmpRoutines, NoOpenmpRoutines);
MAKE_EMPTY_CLASS(NoParallelism, NoParallelism);
MAKE_EMPTY_CLASS(Notinbranch, Notinbranch);
MAKE_EMPTY_CLASS(Nowait, Nowait);
MAKE_EMPTY_CLASS(OmpxAttribute, OmpxAttribute);
Expand Down Expand Up @@ -321,7 +321,6 @@ ReductionOperator makeReductionOperator(const parser::OmpReductionOperator &inp,
// --------------------------------------------------------------------
// Actual clauses. Each T (where tomp::T exists in ClauseT) has its "make".

// Absent: missing-in-parser
Absent make(const parser::OmpClause::Absent &inp,
semantics::SemanticsContext &semaCtx) {
llvm_unreachable("Unimplemented: absent");
Expand Down Expand Up @@ -450,7 +449,6 @@ Collapse make(const parser::OmpClause::Collapse &inp,

// Compare: empty

// Contains: missing-in-parser
Contains make(const parser::OmpClause::Contains &inp,
semantics::SemanticsContext &semaCtx) {
llvm_unreachable("Unimplemented: contains");
Expand Down Expand Up @@ -714,7 +712,6 @@ Hint make(const parser::OmpClause::Hint &inp,
return Hint{/*HintExpr=*/makeExpr(inp.v, semaCtx)};
}

// Holds: missing-in-parser
Holds make(const parser::OmpClause::Holds &inp,
semantics::SemanticsContext &semaCtx) {
llvm_unreachable("Unimplemented: holds");
Expand Down Expand Up @@ -897,24 +894,9 @@ Nontemporal make(const parser::OmpClause::Nontemporal &inp,
return Nontemporal{/*List=*/makeList(inp.v, makeObjectFn(semaCtx))};
}

// NoOpenmp: missing-in-parser
NoOpenmp make(const parser::OmpClause::NoOpenmp &inp,
semantics::SemanticsContext &semaCtx) {
llvm_unreachable("Unimplemented: no_openmp");
}

// NoOpenmpRoutines: missing-in-parser
NoOpenmpRoutines make(const parser::OmpClause::NoOpenmpRoutines &inp,
semantics::SemanticsContext &semaCtx) {
llvm_unreachable("Unimplemented: no_openmp_routines");
}

// NoParallelism: missing-in-parser
NoParallelism make(const parser::OmpClause::NoParallelism &inp,
semantics::SemanticsContext &semaCtx) {
llvm_unreachable("Unimplemented: no_parallelism");
}

// NoOpenmp: empty
// NoOpenmpRoutines: empty
// NoParallelism: empty
// Notinbranch: empty

Novariants make(const parser::OmpClause::Novariants &inp,
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Lower/OpenMP/Clauses.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ using At = tomp::clause::AtT<TypeTy, IdTy, ExprTy>;
using Bind = tomp::clause::BindT<TypeTy, IdTy, ExprTy>;
using Capture = tomp::clause::CaptureT<TypeTy, IdTy, ExprTy>;
using Collapse = tomp::clause::CollapseT<TypeTy, IdTy, ExprTy>;
using Contains = tomp::clause::ContainsT<TypeTy, IdTy, ExprTy>;
using Compare = tomp::clause::CompareT<TypeTy, IdTy, ExprTy>;
using Contains = tomp::clause::ContainsT<TypeTy, IdTy, ExprTy>;
using Copyin = tomp::clause::CopyinT<TypeTy, IdTy, ExprTy>;
using Copyprivate = tomp::clause::CopyprivateT<TypeTy, IdTy, ExprTy>;
using Defaultmap = tomp::clause::DefaultmapT<TypeTy, IdTy, ExprTy>;
Expand Down
13 changes: 11 additions & 2 deletions flang/lib/Optimizer/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,9 @@ struct EmboxCommonConversion : public fir::FIROpConversion<OP> {
mlir::Location loc,
fir::RecordType recType) const {
std::string name =
fir::NameUniquer::getTypeDescriptorName(recType.getName());
this->options.typeDescriptorsRenamedForAssembly
? fir::NameUniquer::getTypeDescriptorAssemblyName(recType.getName())
: fir::NameUniquer::getTypeDescriptorName(recType.getName());
mlir::Type llvmPtrTy = ::getLlvmPtrType(mod.getContext());
if (auto global = mod.template lookupSymbol<fir::GlobalOp>(name)) {
return rewriter.create<mlir::LLVM::AddressOfOp>(loc, llvmPtrTy,
Expand Down Expand Up @@ -2704,7 +2706,10 @@ struct TypeDescOpConversion : public fir::FIROpConversion<fir::TypeDescOp> {
auto recordType = mlir::dyn_cast<fir::RecordType>(inTy);
auto module = typeDescOp.getOperation()->getParentOfType<mlir::ModuleOp>();
std::string typeDescName =
fir::NameUniquer::getTypeDescriptorName(recordType.getName());
this->options.typeDescriptorsRenamedForAssembly
? fir::NameUniquer::getTypeDescriptorAssemblyName(
recordType.getName())
: fir::NameUniquer::getTypeDescriptorName(recordType.getName());
auto llvmPtrTy = ::getLlvmPtrType(typeDescOp.getContext());
if (auto global = module.lookupSymbol<mlir::LLVM::GlobalOp>(typeDescName)) {
rewriter.replaceOpWithNewOp<mlir::LLVM::AddressOfOp>(
Expand Down Expand Up @@ -3653,6 +3658,10 @@ class FIRToLLVMLowering
if (!forcedTargetFeatures.empty())
fir::setTargetFeatures(mod, forcedTargetFeatures);

if (typeDescriptorsRenamedForAssembly)
options.typeDescriptorsRenamedForAssembly =
typeDescriptorsRenamedForAssembly;

// Run dynamic pass pipeline for converting Math dialect
// operations into other dialects (llvm, func, etc.).
// Some conversions of Math operations cannot be done
Expand Down
31 changes: 23 additions & 8 deletions flang/lib/Optimizer/Support/InternalNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "mlir/IR/Diagnostics.h"
#include "llvm/Support/CommandLine.h"
#include <optional>
#include <regex>

static llvm::cl::opt<std::string> mainEntryName(
"main-entry-name",
Expand Down Expand Up @@ -59,7 +60,11 @@ convertToStringRef(const std::optional<std::string> &from) {

static std::string readName(llvm::StringRef uniq, std::size_t &i,
std::size_t init, std::size_t end) {
for (i = init; i < end && (uniq[i] < 'A' || uniq[i] > 'Z'); ++i) {
// Allow 'X' to be part of the mangled name, which
// can happen after the special symbols are replaced
// in the mangled names by CompilerGeneratedNamesConversionPass.
for (i = init; i < end && (uniq[i] < 'A' || uniq[i] > 'Z' || uniq[i] == 'X');
++i) {
// do nothing
}
return uniq.substr(init, i - init).str();
Expand Down Expand Up @@ -348,7 +353,7 @@ mangleTypeDescriptorKinds(llvm::ArrayRef<std::int64_t> kinds) {
return "";
std::string result;
for (std::int64_t kind : kinds)
result += "." + std::to_string(kind);
result += (fir::kNameSeparator + std::to_string(kind)).str();
return result;
}

Expand All @@ -373,26 +378,36 @@ static std::string getDerivedTypeObjectName(llvm::StringRef mangledTypeName,

std::string
fir::NameUniquer::getTypeDescriptorName(llvm::StringRef mangledTypeName) {
return getDerivedTypeObjectName(mangledTypeName, typeDescriptorSeparator);
return getDerivedTypeObjectName(mangledTypeName,
fir::kTypeDescriptorSeparator);
}

std::string fir::NameUniquer::getTypeDescriptorAssemblyName(
llvm::StringRef mangledTypeName) {
return replaceSpecialSymbols(getTypeDescriptorName(mangledTypeName));
}

std::string fir::NameUniquer::getTypeDescriptorBindingTableName(
llvm::StringRef mangledTypeName) {
return getDerivedTypeObjectName(mangledTypeName, bindingTableSeparator);
return getDerivedTypeObjectName(mangledTypeName, fir::kBindingTableSeparator);
}

std::string
fir::NameUniquer::getComponentInitName(llvm::StringRef mangledTypeName,
llvm::StringRef componentName) {

std::string prefix =
getDerivedTypeObjectName(mangledTypeName, componentInitSeparator);
return prefix + "." + componentName.str();
getDerivedTypeObjectName(mangledTypeName, fir::kComponentInitSeparator);
return (prefix + fir::kNameSeparator + componentName).str();
}

llvm::StringRef
fir::NameUniquer::dropTypeConversionMarkers(llvm::StringRef mangledTypeName) {
if (mangledTypeName.ends_with(boxprocSuffix))
return mangledTypeName.drop_back(boxprocSuffix.size());
if (mangledTypeName.ends_with(fir::boxprocSuffix))
return mangledTypeName.drop_back(fir::boxprocSuffix.size());
return mangledTypeName;
}

std::string fir::NameUniquer::replaceSpecialSymbols(const std::string &name) {
return std::regex_replace(name, std::regex{"\\."}, "X");
}
1 change: 1 addition & 0 deletions flang/lib/Optimizer/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_flang_library(FIRTransforms
AnnotateConstant.cpp
AssumedRankOpConversion.cpp
CharacterConversion.cpp
CompilerGeneratedNames.cpp
ConstantArgumentGlobalisation.cpp
ControlFlowConverter.cpp
CufOpConversion.cpp
Expand Down
80 changes: 80 additions & 0 deletions flang/lib/Optimizer/Transforms/CompilerGeneratedNames.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//=== CompilerGeneratedNames.cpp - convert special symbols in global names ===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
#include "flang/Optimizer/Support/InternalNames.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/Pass.h"

namespace fir {
#define GEN_PASS_DEF_COMPILERGENERATEDNAMESCONVERSION
#include "flang/Optimizer/Transforms/Passes.h.inc"
} // namespace fir

using namespace mlir;

namespace {

class CompilerGeneratedNamesConversionPass
: public fir::impl::CompilerGeneratedNamesConversionBase<
CompilerGeneratedNamesConversionPass> {
public:
using CompilerGeneratedNamesConversionBase<
CompilerGeneratedNamesConversionPass>::
CompilerGeneratedNamesConversionBase;

mlir::ModuleOp getModule() { return getOperation(); }
void runOnOperation() override;
};
} // namespace

void CompilerGeneratedNamesConversionPass::runOnOperation() {
auto op = getOperation();
auto *context = &getContext();

llvm::DenseMap<mlir::StringAttr, mlir::FlatSymbolRefAttr> remappings;
for (auto &funcOrGlobal : op->getRegion(0).front()) {
if (llvm::isa<mlir::func::FuncOp>(funcOrGlobal) ||
llvm::isa<fir::GlobalOp>(funcOrGlobal)) {
auto symName = funcOrGlobal.getAttrOfType<mlir::StringAttr>(
mlir::SymbolTable::getSymbolAttrName());
auto deconstructedName = fir::NameUniquer::deconstruct(symName);
if (deconstructedName.first != fir::NameUniquer::NameKind::NOT_UNIQUED &&
!fir::NameUniquer::isExternalFacingUniquedName(deconstructedName)) {
std::string newName =
fir::NameUniquer::replaceSpecialSymbols(symName.getValue().str());
if (newName != symName) {
auto newAttr = mlir::StringAttr::get(context, newName);
mlir::SymbolTable::setSymbolName(&funcOrGlobal, newAttr);
auto newSymRef = mlir::FlatSymbolRefAttr::get(newAttr);
remappings.try_emplace(symName, newSymRef);
}
}
}
}

if (remappings.empty())
return;

// Update all uses of the functions and globals that have been renamed.
op.walk([&remappings](mlir::Operation *nestedOp) {
llvm::SmallVector<std::pair<mlir::StringAttr, mlir::SymbolRefAttr>> updates;
for (const mlir::NamedAttribute &attr : nestedOp->getAttrDictionary())
if (auto symRef = llvm::dyn_cast<mlir::SymbolRefAttr>(attr.getValue()))
if (auto remap = remappings.find(symRef.getRootReference());
remap != remappings.end())
updates.emplace_back(std::pair<mlir::StringAttr, mlir::SymbolRefAttr>{
attr.getName(), mlir::SymbolRefAttr(remap->second)});
for (auto update : updates)
nestedOp->setAttr(update.first, update.second);
});
}
69 changes: 44 additions & 25 deletions flang/lib/Semantics/runtime-type-info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "flang/Evaluate/fold.h"
#include "flang/Evaluate/tools.h"
#include "flang/Evaluate/type.h"
#include "flang/Optimizer/Support/InternalNames.h"
#include "flang/Semantics/scope.h"
#include "flang/Semantics/tools.h"
#include <functional>
Expand Down Expand Up @@ -377,9 +378,12 @@ static std::optional<std::string> GetSuffixIfTypeKindParameters(
if (pv->GetExplicit()) {
if (auto instantiatedValue{evaluate::ToInt64(*pv->GetExplicit())}) {
if (suffix.has_value()) {
*suffix += "."s + std::to_string(*instantiatedValue);
*suffix +=
(fir::kNameSeparator + llvm::Twine(*instantiatedValue))
.str();
} else {
suffix = "."s + std::to_string(*instantiatedValue);
suffix = (fir::kNameSeparator + llvm::Twine(*instantiatedValue))
.str();
}
}
}
Expand Down Expand Up @@ -448,7 +452,7 @@ const Symbol *RuntimeTableBuilder::DescribeType(Scope &dtScope) {
} else if (isPDTDefinitionWithKindParameters) {
return nullptr;
}
std::string dtDescName{".dt."s + distinctName};
std::string dtDescName{(fir::kTypeDescriptorSeparator + distinctName).str()};
Scope *dtSymbolScope{const_cast<Scope *>(dtSymbol->scope())};
Scope &scope{
GetContainingNonDerivedScope(dtSymbolScope ? *dtSymbolScope : dtScope)};
Expand Down Expand Up @@ -518,11 +522,13 @@ const Symbol *RuntimeTableBuilder::DescribeType(Scope &dtScope) {
}
}
AddValue(dtValues, derivedTypeSchema_, "kindparameter"s,
SaveNumericPointerTarget<Int8>(
scope, SaveObjectName(".kp."s + distinctName), std::move(kinds)));
SaveNumericPointerTarget<Int8>(scope,
SaveObjectName((fir::kKindParameterSeparator + distinctName).str()),
std::move(kinds)));
AddValue(dtValues, derivedTypeSchema_, "lenparameterkind"s,
SaveNumericPointerTarget<Int1>(
scope, SaveObjectName(".lpk."s + distinctName), std::move(lenKinds)));
SaveNumericPointerTarget<Int1>(scope,
SaveObjectName((fir::kLenKindSeparator + distinctName).str()),
std::move(lenKinds)));
// Traverse the components of the derived type
if (!isPDTDefinitionWithKindParameters) {
std::vector<const Symbol *> dataComponentSymbols;
Expand Down Expand Up @@ -570,13 +576,15 @@ const Symbol *RuntimeTableBuilder::DescribeType(Scope &dtScope) {
dtScope, distinctName, parameters));
}
AddValue(dtValues, derivedTypeSchema_, "component"s,
SaveDerivedPointerTarget(scope, SaveObjectName(".c."s + distinctName),
SaveDerivedPointerTarget(scope,
SaveObjectName((fir::kComponentSeparator + distinctName).str()),
std::move(dataComponents),
evaluate::ConstantSubscripts{
static_cast<evaluate::ConstantSubscript>(
dataComponents.size())}));
AddValue(dtValues, derivedTypeSchema_, "procptr"s,
SaveDerivedPointerTarget(scope, SaveObjectName(".p."s + distinctName),
SaveDerivedPointerTarget(scope,
SaveObjectName((fir::kProcPtrSeparator + distinctName).str()),
std::move(procPtrComponents),
evaluate::ConstantSubscripts{
static_cast<evaluate::ConstantSubscript>(
Expand All @@ -587,7 +595,9 @@ const Symbol *RuntimeTableBuilder::DescribeType(Scope &dtScope) {
std::vector<evaluate::StructureConstructor> bindings{
DescribeBindings(dtScope, scope)};
AddValue(dtValues, derivedTypeSchema_, bindingDescCompName,
SaveDerivedPointerTarget(scope, SaveObjectName(".v."s + distinctName),
SaveDerivedPointerTarget(scope,
SaveObjectName(
(fir::kBindingTableSeparator + distinctName).str()),
std::move(bindings),
evaluate::ConstantSubscripts{
static_cast<evaluate::ConstantSubscript>(bindings.size())}));
Expand Down Expand Up @@ -623,7 +633,9 @@ const Symbol *RuntimeTableBuilder::DescribeType(Scope &dtScope) {
sortedSpecials.emplace_back(std::move(pair.second));
}
AddValue(dtValues, derivedTypeSchema_, "special"s,
SaveDerivedPointerTarget(scope, SaveObjectName(".s."s + distinctName),
SaveDerivedPointerTarget(scope,
SaveObjectName(
(fir::kSpecialBindingSeparator + distinctName).str()),
std::move(sortedSpecials),
evaluate::ConstantSubscripts{
static_cast<evaluate::ConstantSubscript>(specials.size())}));
Expand Down Expand Up @@ -730,10 +742,12 @@ SomeExpr RuntimeTableBuilder::SaveNameAsPointerTarget(
using evaluate::Ascii;
using AsciiExpr = evaluate::Expr<Ascii>;
object.set_init(evaluate::AsGenericExpr(AsciiExpr{name}));
Symbol &symbol{*scope
.try_emplace(SaveObjectName(".n."s + name),
Attrs{Attr::TARGET, Attr::SAVE}, std::move(object))
.first->second};
Symbol &symbol{
*scope
.try_emplace(
SaveObjectName((fir::kNameStringSeparator + name).str()),
Attrs{Attr::TARGET, Attr::SAVE}, std::move(object))
.first->second};
SetReadOnlyCompilerCreatedFlags(symbol);
return evaluate::AsGenericExpr(
AsciiExpr{evaluate::Designator<Ascii>{symbol}});
Expand Down Expand Up @@ -821,8 +835,9 @@ evaluate::StructureConstructor RuntimeTableBuilder::DescribeComponent(
if (!lenParams.empty()) {
AddValue(values, componentSchema_, "lenvalue"s,
SaveDerivedPointerTarget(scope,
SaveObjectName(
".lv."s + distinctName + "."s + symbol.name().ToString()),
SaveObjectName((fir::kLenParameterSeparator + distinctName +
fir::kNameSeparator + symbol.name().ToString())
.str()),
std::move(lenParams),
evaluate::ConstantSubscripts{
static_cast<evaluate::ConstantSubscript>(lenParams.size())}));
Expand All @@ -845,8 +860,9 @@ evaluate::StructureConstructor RuntimeTableBuilder::DescribeComponent(
}
AddValue(values, componentSchema_, "bounds"s,
SaveDerivedPointerTarget(scope,
SaveObjectName(
".b."s + distinctName + "."s + symbol.name().ToString()),
SaveObjectName((fir::kBoundsSeparator + distinctName +
fir::kNameSeparator + symbol.name().ToString())
.str()),
std::move(bounds), evaluate::ConstantSubscripts{2, rank}));
} else {
AddValue(
Expand All @@ -868,8 +884,9 @@ evaluate::StructureConstructor RuntimeTableBuilder::DescribeComponent(
if (hasDataInit) {
AddValue(values, componentSchema_, "initialization"s,
SaveObjectInit(scope,
SaveObjectName(
".di."s + distinctName + "."s + symbol.name().ToString()),
SaveObjectName((fir::kComponentInitSeparator + distinctName +
fir::kNameSeparator + symbol.name().ToString())
.str()),
object));
}
}
Expand Down Expand Up @@ -918,8 +935,9 @@ bool RuntimeTableBuilder::InitializeDataPointer(
const ObjectEntityDetails &object, Scope &scope, Scope &dtScope,
const std::string &distinctName) {
if (object.init().has_value()) {
SourceName ptrDtName{SaveObjectName(
".dp."s + distinctName + "."s + symbol.name().ToString())};
SourceName ptrDtName{SaveObjectName((fir::kDataPtrInitSeparator +
distinctName + fir::kNameSeparator + symbol.name().ToString())
.str())};
Symbol &ptrDtSym{
*scope.try_emplace(ptrDtName, Attrs{}, UnknownDetails{}).first->second};
SetReadOnlyCompilerCreatedFlags(ptrDtSym);
Expand Down Expand Up @@ -952,8 +970,9 @@ bool RuntimeTableBuilder::InitializeDataPointer(
Structure(ptrDtDeclType, std::move(ptrInitValues))));
AddValue(values, componentSchema_, "initialization"s,
SaveObjectInit(scope,
SaveObjectName(
".di."s + distinctName + "."s + symbol.name().ToString()),
SaveObjectName((fir::kComponentInitSeparator + distinctName +
fir::kNameSeparator + symbol.name().ToString())
.str()),
ptrInitObj));
return true;
} else {
Expand Down
37 changes: 23 additions & 14 deletions flang/runtime/numeric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedIntKind(T x) {
return 4;
} else if (x <= 18) {
return 8;
#ifdef __SIZEOF_INT128__
#if defined __SIZEOF_INT128__ && !defined FLANG_RUNTIME_NO_INTEGER_16
} else if (x <= 38) {
return 16;
#endif
Expand Down Expand Up @@ -137,23 +137,35 @@ inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedRealKind(
return -5;
}

#ifndef FLANG_RUNTIME_NO_REAL_2
constexpr bool hasReal2{true};
#else
constexpr bool hasReal2{false};
#endif
#if defined LDBL_MANT_DIG == 64 && !defined FLANG_RUNTIME_NO_REAL_10
constexpr bool hasReal10{true};
#else
constexpr bool hasReal10{false};
#endif
#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && \
!defined FLANG_RUNTIME_NO_REAL_16
constexpr bool hasReal16{true};
#else
constexpr bool hasReal16{false};
#endif

int error{0};
int kind{0};
if (p <= 3) {
if (hasReal2 && p <= 3) {
kind = 2;
} else if (p <= 6) {
kind = 4;
} else if (p <= 15) {
kind = 8;
#if LDBL_MANT_DIG == 64
} else if (p <= 18) {
} else if (hasReal10 && p <= 18) {
kind = 10;
} else if (p <= 33) {
kind = 16;
#elif LDBL_MANT_DIG == 113
} else if (p <= 33) {
} else if (hasReal16 && p <= 33) {
kind = 16;
#endif
} else {
error -= 1;
}
Expand All @@ -164,13 +176,10 @@ inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedRealKind(
kind = kind < 3 ? (p == 3 ? 4 : 3) : kind;
} else if (r <= 307) {
kind = kind < 8 ? 8 : kind;
#if LDBL_MANT_DIG == 64
} else if (r <= 4931) {
} else if (hasReal10 && r <= 4931) {
kind = kind < 10 ? 10 : kind;
#elif LDBL_MANT_DIG == 113
} else if (r <= 4931) {
} else if (hasReal16 && r <= 4931) {
kind = kind < 16 ? 16 : kind;
#endif
} else {
error -= 2;
}
Expand Down
1 change: 1 addition & 0 deletions flang/test/Driver/mlir-debug-pass-pipeline.f90
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
! ALL-NEXT: CodeGenRewrite
! ALL-NEXT: (S) 0 num-dce'd - Number of operations eliminated
! ALL-NEXT: TargetRewrite
! ALL-NEXT: CompilerGeneratedNamesConversion
! ALL-NEXT: ExternalNameConversion
! DEBUG-NEXT: AddDebugInfo
! NO-DEBUG-NOT: AddDebugInfo
Expand Down
1 change: 1 addition & 0 deletions flang/test/Driver/mlir-pass-pipeline.f90
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
! ALL-NEXT: CodeGenRewrite
! ALL-NEXT: (S) 0 num-dce'd - Number of operations eliminated
! ALL-NEXT: TargetRewrite
! ALL-NEXT: CompilerGeneratedNamesConversion
! ALL-NEXT: ExternalNameConversion
! ALL-NEXT: FIRToLLVMLowering
! ALL-NOT: LLVMIRLoweringPass
1 change: 1 addition & 0 deletions flang/test/Fir/basic-program.fir
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func.func @_QQmain() {
// PASSES-NEXT: CodeGenRewrite
// PASSES-NEXT: (S) 0 num-dce'd - Number of operations eliminated
// PASSES-NEXT: TargetRewrite
// PASSES-NEXT: CompilerGeneratedNamesConversion
// PASSES-NEXT: FIRToLLVMLowering
// PASSES-NEXT: ReconcileUnrealizedCasts
// PASSES-NEXT: LLVMIRLoweringPass
2 changes: 1 addition & 1 deletion flang/test/Fir/convert-to-llvm.fir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=aarch64-unknown-linux-gnu" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=i386-unknown-linux-gnu" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=powerpc64le-unknown-linux-gn" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=powerpc64le-unknown-linux-gnu" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=x86_64-pc-win32" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=aarch64-apple-darwin" %s | FileCheck %s --check-prefixes=CHECK,CHECK-NO-COMDAT,GENERIC
// RUN: fir-opt --split-input-file --fir-to-llvm-ir="target=amdgcn-amd-amdhsa, datalayout=e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-P0" %s | FileCheck -check-prefixes=CHECK,AMDGPU %s
Expand Down
29 changes: 29 additions & 0 deletions flang/test/Fir/convert-type-desc-to-llvm.fir
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu type-descriptors-renamed-for-assembly=true" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=aarch64-unknown-linux-gnu type-descriptors-renamed-for-assembly=true" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=i386-unknown-linux-gnu type-descriptors-renamed-for-assembly=true" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=powerpc64le-unknown-linux-gnu type-descriptors-renamed-for-assembly=true" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=x86_64-pc-win32 type-descriptors-renamed-for-assembly=true" %s | FileCheck %s --check-prefixes=CHECK,CHECK-COMDAT
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=aarch64-apple-darwin type-descriptors-renamed-for-assembly=true" %s | FileCheck %s --check-prefixes=CHECK,CHECK-NO-COMDAT
// RUN: fir-opt --split-input-file --compiler-generated-names --fir-to-llvm-ir="target=amdgcn-amd-amdhsa type-descriptors-renamed-for-assembly=1 datalayout=e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-P0" %s | FileCheck -check-prefixes=CHECK %s

// Check descriptor for a derived type. Check that the f18Addendum flag is set
// to 1 meaning the addendum is present (true) and the addendum values are
// inserted.

fir.global linkonce @_QMtest_dinitE.dt.tseq constant : i8

func.func @embox1(%arg0: !fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) {
%0 = fir.embox %arg0() : (!fir.ref<!fir.type<_QMtest_dinitTtseq{i:i32}>>) -> !fir.box<!fir.type<_QMtest_dinitTtseq{i:i32}>>
return
}

// CHECK-COMDAT: llvm.mlir.global linkonce constant @_QMtest_dinitEXdtXtseq() comdat(@__llvm_comdat::@_QMtest_dinitEXdtXtseq) {addr_space = 0 : i32} : i8
// CHECK-NO-COMDAT: llvm.mlir.global linkonce constant @_QMtest_dinitEXdtXtseq() {addr_space = 0 : i32} : i8
// CHECK-LABEL: llvm.func @embox1
// CHECK: %[[TYPE_CODE:.*]] = llvm.mlir.constant(42 : i32) : i32
// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32
// CHECK: %{{.*}} = llvm.insertvalue %[[VERSION]], %{{.*}}[2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>
// CHECK: %[[TYPE_CODE_I8:.*]] = llvm.trunc %[[TYPE_CODE]] : i32 to i8
// CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_I8]], %{{.*}}[4] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>
// CHECK: %[[TDESC:.*]] = llvm.mlir.addressof @_QMtest_dinitEXdtXtseq : !llvm.ptr
// CHECK: %{{.*}} = llvm.insertvalue %[[TDESC]], %{{.*}}[7] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>
4 changes: 2 additions & 2 deletions flang/test/Fir/polymorphic.fir
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func.func @_QQmain() {
// CHECK-LABEL: define void @_QQmain(){{.*}}{
// CHECK: %[[CLASS_NONE:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
// CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, i64 1
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr @_QMmod1Ea, i64 ptrtoint (ptr getelementptr (%_QMmod1TtK2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 1, i8 1, ptr @_QMmod1E.dt.t.2, [1 x i64] zeroinitializer }, ptr %[[CLASS_NONE]], align 8
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr @_QMmod1Ea, i64 ptrtoint (ptr getelementptr (%_QMmod1TtK2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 1, i8 1, ptr @_QMmod1EXdtXtX2, [1 x i64] zeroinitializer }, ptr %[[CLASS_NONE]], align 8
// CHECK: %[[LOAD:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[CLASS_NONE]]
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOAD]], ptr %[[DESC]]
// CHECK: call void @_QMmod1Psub1(ptr %[[DESC]])
Expand Down Expand Up @@ -197,4 +197,4 @@ func.func @_QQembox_input_type(%arg0 : !fir.ref<!fir.type<_QMmod1Tp2{v:!fir.arra
}

// CHECK-LABEL: define void @_QQembox_input_type
// CHECK: %{{.*}} = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr undef, i64 ptrtoint (ptr getelementptr (%_QMmod1Tp2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 0, i8 1, ptr @_QMmod1E.dt.p2, [1 x i64] zeroinitializer }, ptr %{{.*}}, 0
// CHECK: %{{.*}} = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr undef, i64 ptrtoint (ptr getelementptr (%_QMmod1Tp2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 0, i8 1, ptr @_QMmod1EXdtXp2, [1 x i64] zeroinitializer }, ptr %{{.*}}, 0
4 changes: 2 additions & 2 deletions flang/test/Fir/type-descriptor.fir
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fir.global internal @_QFfooEx : !fir.box<!fir.heap<!sometype>> {
}
// CHECK: @_QFfooEx = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
// CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsometype, ptr null, i32 1) to i64),
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.sometype, [1 x i64] zeroinitializer }
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooEXdtXsometype, [1 x i64] zeroinitializer }

!some_pdt_type = !fir.type<_QFfooTsome_pdt_typeK42K43{num:i32,values:!fir.box<!fir.ptr<!fir.array<?x?xf32>>>}>
fir.global internal @_QFfooE.dt.some_pdt_type.42.43 constant : i8
Expand All @@ -26,4 +26,4 @@ fir.global internal @_QFfooEx2 : !fir.box<!fir.heap<!some_pdt_type>> {
}
// CHECK: @_QFfooEx2 = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }
// CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsome_pdt_typeK42K43, ptr null, i32 1) to i64),
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.some_pdt_type.42.43, [1 x i64] zeroinitializer }
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooEXdtXsome_pdt_typeX42X43, [1 x i64] zeroinitializer }
14 changes: 7 additions & 7 deletions flang/test/Lower/allocatable-polymorphic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -591,16 +591,16 @@ program test_alloc

! LLVM-LABEL: define void @_QMpolyPtest_allocatable()

! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyE.dt.p1, i32 0, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyEXdtXp1, i32 0, i32 0)
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableAllocate(ptr %{{.*}}, i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyE.dt.p1, i32 0, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyEXdtXp1, i32 0, i32 0)
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableAllocate(ptr %{{.*}}, i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyE.dt.p2, i32 0, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyEXdtXp2, i32 0, i32 0)
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableAllocate(ptr %{{.*}}, i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyE.dt.p1, i32 1, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyEXdtXp1, i32 1, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableSetBounds(ptr %{{.*}}, i32 0, i64 1, i64 10)
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableAllocate(ptr %{{.*}}, i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyE.dt.p2, i32 1, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %{{.*}}, ptr @_QMpolyEXdtXp2, i32 1, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableSetBounds(ptr %{{.*}}, i32 0, i64 1, i64 20)
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableAllocate(ptr %{{.*}}, i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
! LLVM-COUNT-2: call void %{{.*}}()
Expand Down Expand Up @@ -685,9 +685,9 @@ program test_alloc
! allocatable.

! LLVM-LABEL: define void @_QMpolyPtest_deallocate()
! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 ptrtoint (ptr getelementptr (%_QMpolyTp1, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QMpolyE.dt.p1, [1 x i64] zeroinitializer }, ptr %[[ALLOCA1:[0-9]*]]
! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 ptrtoint (ptr getelementptr (%_QMpolyTp1, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QMpolyEXdtXp1, [1 x i64] zeroinitializer }, ptr %[[ALLOCA1:[0-9]*]]
! LLVM: %[[LOAD:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[ALLOCA1]]
! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOAD]], ptr %[[ALLOCA2:[0-9]*]]
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %[[ALLOCA2]], ptr @_QMpolyE.dt.p1, i32 0, i32 0)
! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %[[ALLOCA2]], ptr @_QMpolyEXdtXp1, i32 0, i32 0)
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableAllocate(ptr %[[ALLOCA2]], i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
! LLVM: %{{.*}} = call i32 @_FortranAAllocatableDeallocatePolymorphic(ptr %[[ALLOCA2]], ptr {{.*}}, i1 false, ptr null, ptr @_QQclX{{.*}}, i32 {{.*}})
6 changes: 3 additions & 3 deletions flang/test/Lower/dense-array-any-rank.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ subroutine test()

! a1 array constructor
! CHECK-FIR: fir.global internal @_QQro.10xi4.{{.*}}(dense<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]> : tensor<10xi32>) constant : !fir.array<10xi32>
! CHECK-LLVMIR: @_QQro.10xi4.0 = internal constant [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
! CHECK-LLVMIR: @_QQroX10xi4X0 = internal constant [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]

! a2 array constructor
! CHECK-FIR: fir.global internal @_QQro.3x4xi4.{{.*}}(dense<{{\[\[11, 12, 13], \[21, 22, 23], \[31, 32, 33], \[41, 42, 43]]}}> : tensor<4x3xi32>) constant : !fir.array<3x4xi32>
! CHECK-LLVMIR: @_QQro.3x4xi4.1 = internal constant [4 x [3 x i32]] {{\[\[3 x i32] \[i32 11, i32 12, i32 13], \[3 x i32] \[i32 21, i32 22, i32 23], \[3 x i32] \[i32 31, i32 32, i32 33], \[3 x i32] \[i32 41, i32 42, i32 43]]}}
! CHECK-LLVMIR: @_QQroX3x4xi4X1 = internal constant [4 x [3 x i32]] {{\[\[3 x i32] \[i32 11, i32 12, i32 13], \[3 x i32] \[i32 21, i32 22, i32 23], \[3 x i32] \[i32 31, i32 32, i32 33], \[3 x i32] \[i32 41, i32 42, i32 43]]}}

! a3 array constructor
! CHECK-FIR: fir.global internal @_QQro.2x3x4xi4.{{.*}}(dense<{{\[\[\[111, 112], \[121, 122], \[131, 132]], \[\[211, 212], \[221, 222], \[231, 232]], \[\[311, 312], \[321, 322], \[331, 332]], \[\[411, 412], \[421, 422], \[431, 432]]]}}> : tensor<4x3x2xi32>) constant : !fir.array<2x3x4xi32>
! CHECK-LLVMIR: @_QQro.2x3x4xi4.2 = internal constant [4 x [3 x [2 x i32]]] {{\[\[3 x \[2 x i32]] \[\[2 x i32] \[i32 111, i32 112], \[2 x i32] \[i32 121, i32 122], \[2 x i32] \[i32 131, i32 132]], \[3 x \[2 x i32]] \[\[2 x i32] \[i32 211, i32 212], \[2 x i32] \[i32 221, i32 222], \[2 x i32] \[i32 231, i32 232]], \[3 x \[2 x i32]] \[\[2 x i32] \[i32 311, i32 312], \[2 x i32] \[i32 321, i32 322], \[2 x i32] \[i32 331, i32 332]], \[3 x \[2 x i32]] \[\[2 x i32] \[i32 411, i32 412], \[2 x i32] \[i32 421, i32 422], \[2 x i32] \[i32 431, i32 432]]]}}
! CHECK-LLVMIR: @_QQroX2x3x4xi4X2 = internal constant [4 x [3 x [2 x i32]]] {{\[\[3 x \[2 x i32]] \[\[2 x i32] \[i32 111, i32 112], \[2 x i32] \[i32 121, i32 122], \[2 x i32] \[i32 131, i32 132]], \[3 x \[2 x i32]] \[\[2 x i32] \[i32 211, i32 212], \[2 x i32] \[i32 221, i32 222], \[2 x i32] \[i32 231, i32 232]], \[3 x \[2 x i32]] \[\[2 x i32] \[i32 311, i32 312], \[2 x i32] \[i32 321, i32 322], \[2 x i32] \[i32 331, i32 332]], \[3 x \[2 x i32]] \[\[2 x i32] \[i32 411, i32 412], \[2 x i32] \[i32 421, i32 422], \[2 x i32] \[i32 431, i32 432]]]}}
2 changes: 2 additions & 0 deletions libc/config/gpu/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ set(TARGET_LIBC_ENTRYPOINTS
libc.src.stdio.vsprintf
libc.src.stdio.asprintf
libc.src.stdio.vasprintf
libc.src.stdio.scanf
libc.src.stdio.fscanf
libc.src.stdio.sscanf
libc.src.stdio.vsscanf
libc.src.stdio.feof
Expand Down
7 changes: 0 additions & 7 deletions libc/docs/build_and_test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ The libc can be built and tested in two different modes:
$> ninja libc-integration-tests
#. API verification test - See :ref:`api_test` for more information about
the API test. It can be run by the command:

.. code-block:: sh
$> ninja libc-api-test
Building with VSCode
====================

Expand Down
14 changes: 1 addition & 13 deletions libc/docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Contributing to the libc Project
================================

LLVM's libc is being developed as part of the LLVM project so contributions
LLVM-libc is being developed as part of the LLVM project so contributions
to the libc project should also follow the general LLVM
`contribution guidelines <https://llvm.org/docs/Contributing.html>`_. Below is
a list of open projects that one can start with:
Expand All @@ -31,24 +31,12 @@ a list of open projects that one can start with:
directory. So, a simple but mechanical project would be to move the parts
following the old styles to the new style.

#. **Integrating with the rest of the LLVM project** - There are two parts to
this project:

#. One is about adding CMake facilities to optionally link the libc's overlay
static archive (see :ref:`overlay_mode`) with other LLVM tools/executables.
#. The other is about putting plumbing in place to release the overlay static
archive (see :ref:`overlay_mode`) as part of the LLVM binary releases.

#. **Implement Linux syscall wrappers** - A large portion of the POSIX API can
be implemented as syscall wrappers on Linux. A good number have already been
implemented but many more are yet to be implemented. So, a project of medium
complexity would be to implement syscall wrappers which have not yet been
implemented.

#. **Add a better random number generator** - The current random number
generator has a very small range. This has to be improved or switched over
to a fast random number generator with a large range.

#. **Update the clang-tidy lint rules and use them in the build and/or CI** -
Currently, the :ref:`clang_tidy_checks` have gone stale and are mostly unused
by the developers and on the CI builders. This project is about updating
Expand Down
25 changes: 0 additions & 25 deletions libc/docs/dev/api_test.rst

This file was deleted.

11 changes: 0 additions & 11 deletions libc/docs/dev/ground_truth_specification.rst

This file was deleted.

2 changes: 2 additions & 0 deletions libc/docs/dev/header_generation.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _header_generation:

Generating Public and Internal headers
======================================

Expand Down
3 changes: 0 additions & 3 deletions libc/docs/dev/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ Navigate to the links below for information on the respective topics:
config_options
clang_tidy_checks
fuzzing
ground_truth_specification
header_generation
implementation_standard
undefined_behavior
printf_behavior
api_test
mechanics_of_public_api
29 changes: 0 additions & 29 deletions libc/docs/dev/mechanics_of_public_api.rst

This file was deleted.

24 changes: 17 additions & 7 deletions libc/docs/dev/source_tree_layout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ directories::
- docs
- examples
- fuzzing
- hdr
- include
- lib
- spec
- newhdrgen
- src
- startup
- test
Expand Down Expand Up @@ -62,6 +63,14 @@ The directory structure within this directory mirrors the directory structure
of the top-level ``libc`` directory itself. For more details, see
:doc:`fuzzing`.

The ``hdr`` directory
---------------------

This directory contains proxy headers which are included from the files in the
src directory. These proxy headers either include our internal type or macro
definitions, or the system's type or macro definitions, depending on if we are
in fullbuild or overlay mode.

The ``include`` directory
-------------------------

Expand All @@ -80,13 +89,14 @@ The ``lib`` directory
This directory contains a ``CMakeLists.txt`` file listing the targets for the
public libraries ``libc.a``, ``libm.a`` etc.

The ``spec`` directory
----------------------
The ``newhdrgen`` directory
---------------------------

This directory contains the specifications for the types, macros, and entrypoint
functions. These definitions come from the various standards and extensions
LLVM-libc supports, and they are used along with the ``*.h.def`` files and the
config files to generate the headers for fullbuild mode.
This directory contains the sources and specifications for the types, macros
and entrypoint functions. These definitions are organized in the ``yaml``
subdirectory and match the organization of the ``*.h.def`` files. This folder
also contains the python sources for new headergen, which is what generates the
headers.

The ``src`` directory
---------------------
Expand Down
115 changes: 15 additions & 100 deletions libc/docs/full_cross_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,33 @@ Full Cross Build
:depth: 1
:local:

.. note::
Fullbuild requires running headergen, which is a python program that depends on
pyyaml. The minimum versions are listed on the :ref:`header_generation`
page, as well as additional information.

In this document, we will present recipes to cross build the full libc. When we
say *cross build* a full libc, we mean that we will build the full libc for a
target system which is not the same as the system on which the libc is being
built. For example, you could be building for a bare metal aarch64 *target* on a
Linux x86_64 *host*.

There are three main recipes to cross build the full libc. Each one serves a
There are two main recipes to cross build the full libc. Each one serves a
different use case. Below is a short description of these recipes to help users
pick the recipe that best suites their needs and contexts.

* **Standalone cross build** - Using this recipe one can build the libc using a
compiler of their choice. One should use this recipe if their compiler can
build for the host as well as the target.
* **Runtimes cross build** - In this recipe, one will have to first build the
libc build tools for the host separately and then use those build tools to
build the libc. Users can use the compiler of their choice to build the
libc build tools as well as the libc. One should use this recipe if they
have to use a host compiler to build the build tools for the host and then
use a target compiler (which is different from the host compiler) to build
the libc.
* **Bootstrap cross build** - In this recipe, one will build the ``clang``
compiler and the libc build tools for the host first, and then use them to
build the libc for the target. Unlike with the runtimes build recipe, the
user does not have explicitly build ``clang`` and other libc build tools.
build the libc for the target. Unlike with the standalone build recipe, the
user does not have explicitly build ``clang`` and other build tools.
They get built automatically before building the libc. One should use this
recipe if they intend use the built ``clang`` and the libc as part of their
toolchain for the target.

The following sections present the three recipes in detail.
The following sections present the two recipes in detail.

Standalone cross build
======================
Expand All @@ -61,9 +59,9 @@ Below is the CMake command to configure the standalone crossbuild of the libc.
$> cd build
$> C_COMPILER=<C compiler> # For example "clang"
$> CXX_COMPILER=<C++ compiler> # For example "clang++"
$> cmake ../llvm \
$> cmake ../runtimes \
-G Ninja \
-DLLVM_ENABLE_PROJECTS=libc \
-DLLVM_ENABLE_RUNTIMES=libc \
-DCMAKE_C_COMPILER=$C_COMPILER \
-DCMAKE_CXX_COMPILER=$CXX_COMPILER \
-DLLVM_LIBC_FULL_BUILD=ON \
Expand All @@ -72,8 +70,8 @@ Below is the CMake command to configure the standalone crossbuild of the libc.
We will go over the special options passed to the ``cmake`` command above.

* **Enabled Projects** - Since we want to build the libc project, we list
``libc`` as the enabled project.
* **Enabled Runtimes** - Since we want to build LLVM-libc, we list
``libc`` as the enabled runtime.
* **The full build option** - Since we want to build the full libc, we pass
``-DLLVM_LIBC_FULL_BUILD=ON``.
* **The target triple** - This is the target triple of the target for which
Expand All @@ -94,88 +92,6 @@ The above ``ninja`` command will build the libc static archives ``libc.a`` and
``libm.a`` for the target specified with ``-DLIBC_TARGET_TRIPLE`` in the CMake
configure step.

.. _runtimes_cross_build:

Runtimes cross build
====================

The *runtimes cross build* is very similar to the standalone crossbuild but the
user will have to first build the libc build tools for the host separately. One
should use this recipe if they want to use a different host and target compiler.
Note that the libc build tools MUST be in sync with the libc. That is, the
libc build tools and the libc, both should be built from the same source
revision. At the time of this writing, there is only one libc build tool that
has to be built separately. It is done as follows:

.. code-block:: sh
$> cd llvm-project # The llvm-project checkout
$> mkdir build-libc-tools # A different build directory for the build tools
$> cd build-libc-tools
$> HOST_C_COMPILER=<C compiler for the host> # For example "clang"
$> HOST_CXX_COMPILER=<C++ compiler for the host> # For example "clang++"
$> cmake ../llvm \
-G Ninja \
-DLLVM_ENABLE_PROJECTS=libc \
-DCMAKE_C_COMPILER=$HOST_C_COMPILER \
-DCMAKE_CXX_COMPILER=$HOST_CXX_COMPILER \
-DLLVM_LIBC_FULL_BUILD=ON \
-DCMAKE_BUILD_TYPE=Debug # User can choose to use "Release" build type
$> ninja libc-hdrgen
The above commands should build a binary named ``libc-hdrgen``. Copy this binary
to a directory of your choice.

CMake configure step
--------------------

After copying the ``libc-hdrgen`` binary to say ``/path/to/libc-hdrgen``,
configure the libc build using the following command:

.. code-block:: sh
$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
$> TARGET_C_COMPILER=<C compiler for the target>
$> TARGET_CXX_COMPILER=<C++ compiler for the target>
$> HDRGEN=</path/to/libc-hdrgen>
$> TARGET_TRIPLE=<Your target triple>
$> cmake ../runtimes \
-G Ninja \
-DLLVM_ENABLE_RUNTIMES=libc \
-DCMAKE_C_COMPILER=$TARGET_C_COMPILER \
-DCMAKE_CXX_COMPILER=$TARGET_CXX_COMPILER \
-DLLVM_LIBC_FULL_BUILD=ON \
-DLIBC_HDRGEN_EXE=$HDRGEN \
-DLIBC_TARGET_TRIPLE=$TARGET_TRIPLE \
-DCMAKE_BUILD_TYPE=Debug # User can choose to use "Release" build type
Note the differences in the above cmake command versus the one used in the
CMake configure step of the standalone build recipe:

* Instead of listing ``libc`` in ``LLVM_ENABLED_PROJECTS``, we list it in
``LLVM_ENABLED_RUNTIMES``.
* Instead of using ``llvm-project/llvm`` as the root CMake source directory,
we use ``llvm-project/runtimes`` as the root CMake source directory.
* The path to the ``libc-hdrgen`` binary built earlier is specified with
``-DLIBC_HDRGEN_EXE=/path/to/libc-hdrgen``.

Build step
----------

The build step in the runtimes build recipe is exactly the same as that of
the standalone build recipe:

.. code-block:: sh
$> ninja libc libm
As with the standalone build recipe, the above ninja command will build the
libc static archives for the target specified with ``-DLIBC_TARGET_TRIPLE`` in
the CMake configure step.


Bootstrap cross build
=====================

Expand Down Expand Up @@ -203,8 +119,7 @@ CMake configure step
-DLLVM_RUNTIME_TARGETS=$TARGET_TRIPLE \
-DCMAKE_BUILD_TYPE=Debug
Note how the above cmake command differs from the one used in the other two
recipes:
Note how the above cmake command differs from the one used in the other recipe:

* ``clang`` is listed in ``-DLLVM_ENABLE_PROJECTS`` and ``libc`` is
listed in ``-DLLVM_ENABLE_RUNTIMES``.
Expand All @@ -214,7 +129,7 @@ recipes:
Build step
----------

The build step is similar to the other two recipes:
The build step is similar to the other recipe:

.. code-block:: sh
Expand Down
87 changes: 79 additions & 8 deletions libc/docs/full_host_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,97 @@ Full Host Build
:depth: 1
:local:

.. note::
Fullbuild requires running headergen, which is a python program that depends on
pyyaml. The minimum versions are listed on the :ref:`header_generation`
page, as well as additional information.

In this document, we will present a recipe to build the full libc for the host.
When we say *build the libc for the host*, the goal is to build the libc for
the same system on which the libc is being built. Also, we will take this
opportunity to demonstrate how one can set up a *sysroot* (see the documentation
the same system on which the libc is being built. First, we will explain how to
build for developing LLVM-libc, then we will explain how to build LLVM-libc as
part of a complete toolchain.

Configure the build for development
===================================


Below is the list of commands for a simple recipe to build LLVM-libc for
development. In this we've set the Ninja generator, set the build type to
"Debug", and enabled the Scudo allocator. This build also enables generating the
documentation and verbose cmake logging, which are useful development features.

.. note::
if your build fails with an error saying the compiler can't find
``<asm/unistd.h>`` or similar then you're probably missing the symlink from
``/usr/include/asm`` to ``/usr/include/<HOST TRIPLE>/asm``. Installing the
``gcc-multilib`` package creates this symlink, or you can do it manually with
this command:
``sudo ln -s /usr/include/<HOST TRIPLE>/asm /usr/include/asm``
(your host triple will probably be similar to ``x86_64-linux-gnu``)

.. code-block:: sh
$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
$> cmake ../runtimes \
-G Ninja \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_ENABLE_RUNTIMES="libc;compiler-rt" \
-DLLVM_LIBC_FULL_BUILD=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DLLVM_LIBC_INCLUDE_SCUDO=ON \
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DLLVM_ENABLE_SPHINX=ON -DLIBC_INCLUDE_DOCS=ON \
-DLIBC_CMAKE_VERBOSE_LOGGING=ON
Build and test
==============

After configuring the build with the above ``cmake`` command, one can build test
libc with the following command:

.. code-block:: sh
$> ninja libc libm check-libc
To build the docs run this command:


.. code-block:: sh
$> ninja docs-libc-html
To run a specific test, use the following:

.. code-block:: sh
$> ninja libc.test.src.<HEADER>.<FUNCTION>_test.__unit__
$> ninja libc.test.src.ctype.isalpha_test.__unit__ # EXAMPLE
Configure the complete toolchain build
======================================

For a complete toolchain we recommend creating a *sysroot* (see the documentation
of the ``--sysroot`` option here:
`<https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>`_) which includes
not only the components of LLVM's libc, but also a full LLVM only toolchain
consisting of the `clang <https://clang.llvm.org/>`_ compiler, the
`lld <https://lld.llvm.org/>`_ linker and the
`compiler-rt <https://compiler-rt.llvm.org/>`_ runtime libraries. LLVM's libc is
not yet complete enough to allow using and linking a C++ application against
`compiler-rt <https://compiler-rt.llvm.org/>`_ runtime libraries. LLVM-libc is
not quite complete enough to allow using and linking a C++ application against
a C++ standard library (like libc++). Hence, we do not include
`libc++ <https://libcxx.llvm.org/>`_ in the sysroot.

.. note:: When the libc is complete enough, we should be able to include
`libc++ <https://libcxx.llvm.org/>`_, libcxx-abi and libunwind in the
LLVM only toolchain and use them to build and link C++ applications.

Configure the full libc build
===============================

Below is the list of commands for a simple recipe to build and install the
libc components along with other components of an LLVM only toolchain. In this
we've set the Ninja generator, enabled a full compiler suite, set the build
Expand All @@ -43,6 +113,7 @@ to use the freshly built lld and compiler-rt.
this command:
``sudo ln -s /usr/include/<TARGET TRIPLE>/asm /usr/include/asm``

.. TODO: Move from projects to runtimes for libc, compiler-rt
.. code-block:: sh
$> cd llvm-project # The llvm-project checkout
Expand All @@ -51,7 +122,7 @@ to use the freshly built lld and compiler-rt.
$> SYSROOT=/path/to/sysroot # Remember to set this!
$> cmake ../llvm \
-G Ninja \
-DLLVM_ENABLE_PROJECTS="clang;libc;lld;compiler-rt" \
-DLLVM_ENABLE_PROJECTS="clang;lld;libc;compiler-rt" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
Expand Down
5 changes: 5 additions & 0 deletions libc/docs/fullbuild_mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Fullbuild Mode
==============

.. note::
Fullbuild requires running headergen, which is a python program that depends on
pyyaml. The minimum versions are listed on the :ref:`header_generation`
page, as well as additional information.

The *fullbuild* mode of LLVM's libc is the mode in which it is to be used as
the only libc (as opposed to the :ref:`overlay_mode` in which it is used along
with the system libc.) In order to use it as the only libc, one will have to
Expand Down
6 changes: 5 additions & 1 deletion libc/docs/gpu/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ targeting the default host environment as well.
Runtimes cross build
--------------------

.. note::
These instructions need to be updated for new headergen. They may be
inaccurate.

For users wanting more direct control over the build process, the build steps
can be done manually instead. This build closely follows the instructions in the
:ref:`main documentation<runtimes_cross_build>` but is specialized for the GPU
:ref:`main documentation<full_cross_build>` but is specialized for the GPU
build. We follow the same steps to first build the libc tools and a suitable
compiler. These tools must all be up-to-date with the libc source.

Expand Down
2 changes: 2 additions & 0 deletions libc/docs/gpu/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ snprintf |check|
vsprintf |check|
vsnprintf |check|
sscanf |check|
scanf |check|
fscanf |check|
putchar |check| |check|
fclose |check| |check|
fopen |check| |check|
Expand Down
17 changes: 10 additions & 7 deletions libc/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
The LLVM C Library
==================

.. warning::
The libc is not complete. If you need a fully functioning C library right
now, you should continue to use your standard system libraries.
.. note::
LLVM-libc is not fully complete right now. Some programs may fail to build due
to missing functions (especially C++ ones). If you would like to help us
finish LLVM-libc, check out "Contributing to the libc project" in the sidebar
or ask on discord.

Introduction
============

The libc aspires to a unique place in the software ecosystem. The goals are:
LLVM-libc aspires to a unique place in the software ecosystem. The goals are:

- Fully compliant with current C standards (C17 and upcoming C2x) and POSIX.
- Easily decomposed and embedded: Supplement or replace system C library
Expand All @@ -32,16 +34,17 @@ The libc aspires to a unique place in the software ecosystem. The goals are:
Platform Support
================

Most development is currently targeting x86_64 and aarch64 on Linux. Several
functions in the libc have been tested on Windows. The Fuchsia platform is
Most development is currently targeting Linux on x86_64, aarch64, arm, and
RISC-V. Embedded/baremetal targets are supported on arm and RISC-V, and Windows
and MacOS have limited support (may be broken). The Fuchsia platform is
slowly replacing functions from its bundled libc with functions from this
project.

ABI Compatibility
=================

The libc is written to be ABI independent. Interfaces are generated using
LLVM's tablegen, so supporting arbitrary ABIs is possible. In it's initial
headergen, so supporting arbitrary ABIs is possible. In it's initial
stages there is no ABI stability in any form.

.. toctree::
Expand Down
36 changes: 20 additions & 16 deletions libc/docs/overlay_mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ Also, if users choose to mix more than one libc with the system libc, then
the name ``libllvmlibc.a`` makes it absolutely clear that it is the static
archive of LLVM's libc.

Building the static archive with libc as a normal LLVM project
--------------------------------------------------------------
Building LLVM-libc as a standalone runtime
------------------------------------------

We can treat the ``libc`` project as any other normal LLVM project and perform
the CMake configure step as follows:
We can treat the ``libc`` project like any other normal LLVM runtime library by
building it with the following cmake command:

.. code-block:: sh
$> cd llvm-project # The llvm-project checkout
$> mkdir build
$> cd build
$> cmake ../llvm -G Ninja -DLLVM_ENABLE_RUNTIMES="libc" \
$> cmake ../runtimes -G Ninja -DLLVM_ENABLE_RUNTIMES="libc" \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
-DCMAKE_INSTALL_PREFIX=<Your prefix of choice> # Optional
Expand All @@ -50,24 +50,29 @@ Next, build the libc:
$> ninja libc
Then, run the tests:

.. code-block:: sh
$> ninja check-libc
The build step will build the static archive the in the directory
``build/projects/libc/lib``. Notice that the above CMake configure step also
specified an install prefix. This is optional, but if one uses it, then they
can follow up the build step with an install step:
specified an install prefix. This is optional, but it's used, then the following
command will install the static archive to the install path:

.. code-block:: sh
$> ninja install-llvmlibc
$> ninja install-libc
Building the static archive as part of the bootstrap build
----------------------------------------------------------

The bootstrap build is a build mode in which runtime components like libc++,
libcxx-abi, libc etc. are built using the ToT clang. The idea is that this build
produces an in-sync toolchain of compiler + runtime libraries. Such a synchrony
is not essential for the libc but can one still build the overlay static archive
as part of the bootstrap build if one wants to. The first step is to configure
appropriately:
produces an in-sync toolchain of compiler + runtime libraries. This ensures that
LLVM-libc has access to the latest clang features, which should provide the best
performance possible.

.. code-block:: sh
Expand All @@ -77,14 +82,13 @@ appropriately:
-DCMAKE_BUILD_TYPE=<Debug|Release> \ # Select build type
-DCMAKE_INSTALL_PREFIX=<Your prefix of choice> # Optional
The build and install steps are similar to the those used when configured
as a normal project. Note that the build step takes much longer this time
as ``clang`` will be built before building ``libllvmlibc.a``.
The build and install steps are the same as above, but the build step will take
much longer since ``clang`` will be built before building ``libllvmlibc.a``.

.. code-block:: sh
$> ninja libc
$> ninja install-llvmlibc
$> ninja check-libc
Using the overlay static archive
================================
Expand Down
15 changes: 0 additions & 15 deletions libc/docs/porting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@ have their own config directory.
config directory for Fuchsia as the bring up is being done in the Fuchsia
source tree.

The api.td file
---------------

If the :ref:`fullbuild_mode` is to be supported on the new operating system,
then a file named ``api.td`` should be added in its config directory. It is
written in the
`LLVM tablegen language <https://llvm.org/docs/TableGen/ProgRef.html>`_.
It lists all the relevant macros and type definitions we want in the
public libc header files. See the existing Linux
`api.td <https://github.com/llvm/llvm-project/blob/main/libc/config/linux/api.td>`_
file as an example to prepare the ``api.td`` file for the new operating system.

.. note:: In future, LLVM tablegen will be replaced with a different DSL to list
config information.

Architecture Subdirectory
=========================

Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ list(APPEND scanf_deps
libc.hdr.types.FILE
)

if(LLVM_LIBC_FULL_BUILD)
if(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_GPU)
list(APPEND scanf_deps
libc.src.__support.File.file
libc.src.__support.File.platform_file
Expand Down
44 changes: 27 additions & 17 deletions libc/src/stdio/scanf_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,31 @@ add_object_library(
libc.src.__support.str_to_float
)

if(NOT (TARGET libc.src.__support.File.file) AND LLVM_LIBC_FULL_BUILD)
# Not all platforms have a file implementation. If file is unvailable, and a
# full build is requested, then we must skip all file based printf sections.
return()
if(LIBC_TARGET_OS_IS_GPU)
add_header_library(
vfscanf_internal
HDRS
vfscanf_internal.h
DEPENDS
.reader
.scanf_main
libc.include.stdio
libc.src.__support.arg_list
libc.src.stdio.getc
libc.src.stdio.ungetc
libc.src.stdio.ferror
)
elseif(TARGET libc.src.__support.File.file OR (NOT LLVM_LIBC_FULL_BUILD))
add_header_library(
vfscanf_internal
HDRS
vfscanf_internal.h
DEPENDS
.reader
.scanf_main
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.arg_list
${use_system_file}
)
endif()

add_header_library(
vfscanf_internal
HDRS
vfscanf_internal.h
DEPENDS
.reader
.scanf_main
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.arg_list
${use_system_file}
)
28 changes: 27 additions & 1 deletion libc/src/stdio/scanf_core/vfscanf_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,43 @@
#include "src/__support/File/file.h"
#include "src/__support/arg_list.h"
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include "src/stdio/scanf_core/reader.h"
#include "src/stdio/scanf_core/scanf_main.h"

#if defined(LIBC_TARGET_ARCH_IS_GPU)
#include "src/stdio/ferror.h"
#include "src/stdio/getc.h"
#include "src/stdio/ungetc.h"
#endif

#include "hdr/types/FILE.h"
#include <stddef.h>

namespace LIBC_NAMESPACE_DECL {

namespace internal {

#ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE
#if defined(LIBC_TARGET_ARCH_IS_GPU)
// The GPU build provides FILE access through the host operating system's
// library. So here we simply use the public entrypoints like in the SYSTEM_FILE
// interface. Entrypoints should normally not call others, this is an exception.
// FIXME: We do not acquire any locks here, so this is not thread safe.
LIBC_INLINE void flockfile(::FILE *) { return; }

LIBC_INLINE void funlockfile(::FILE *) { return; }

LIBC_INLINE int getc(void *f) {
return LIBC_NAMESPACE::getc(reinterpret_cast<::FILE *>(f));
}

LIBC_INLINE void ungetc(int c, void *f) {
LIBC_NAMESPACE::ungetc(c, reinterpret_cast<::FILE *>(f));
}

LIBC_INLINE int ferror_unlocked(::FILE *f) { return LIBC_NAMESPACE::ferror(f); }

#elif !defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE)

LIBC_INLINE void flockfile(FILE *f) {
reinterpret_cast<LIBC_NAMESPACE::File *>(f)->lock();
Expand Down
36 changes: 36 additions & 0 deletions libcxx/cmake/caches/AMDGPU.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Configuration options for libcxx.
set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")

# Configuration options for libcxxabi.
set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")

# Necessary compile flags for AMDGPU.
set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
"-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
"-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
set(CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs" CACHE STRING "")
36 changes: 36 additions & 0 deletions libcxx/cmake/caches/NVPTX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Configuration options for libcxx.
set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
set(LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
set(LIBCXX_LIBC "llvm-libc" CACHE STRING "")
set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")

# Configuration options for libcxxabi.
set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")

# Necessary compile flags for NVPTX.
set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
"-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
set(LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
"-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
set(CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs -flto -c" CACHE STRING "")
7 changes: 6 additions & 1 deletion libcxx/docs/Status/Cxx17.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ Paper Status
.. [#note-P0607] P0607: The parts of P0607 that are not done are the ``<regex>`` bits.
.. [#note-P0154] P0154: The required macros are only implemented as of clang 19.
.. [#note-P0452] P0452: The changes to ``std::transform_inclusive_scan`` and ``std::transform_exclusive_scan`` have not yet been implemented.
.. [#note-P0156] P0156: This paper was reverted in Kona.
.. [#note-P0156] P0156: That paper was pulled out of the draft at the 2017-01 meeting in Kona.
.. [#note-P0181] P0181: That paper was pulled out of the draft at the 2017-01 meeting in Kona.
.. [#note-P0067] P0067: That paper was resolved by `P0067R5 <https://wg21.link/P0067R5>`__.
.. [#note-LWG2587] LWG2587: That LWG issue was resolved by `LWG2567 <https://wg21.link/LWG2567>`__.
.. [#note-LWG2588] LWG2588: That LWG issue was resolved by `LWG2568 <https://wg21.link/LWG2568>`__.
.. [#note-LWG2955] LWG2955: That LWG issue was resolved by `P0682R1 <https://wg21.link/P0682R1>`__.
.. _issues-status-cxx17:

Expand Down
8 changes: 4 additions & 4 deletions libcxx/docs/Status/Cxx17Issues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"`LWG2685 <https://wg21.link/LWG2685>`__","shared_ptr deleters must not throw on move construction","2016-06 (Oulu)","|Complete|","",""
"`LWG2687 <https://wg21.link/LWG2687>`__","{inclusive,exclusive}_scan misspecified","2016-06 (Oulu)","","",""
"`LWG2688 <https://wg21.link/LWG2688>`__","clamp misses preconditions and has extraneous condition on result","2016-06 (Oulu)","|Complete|","",""
"`LWG2689 <https://wg21.link/LWG2689>`__","Parallel versions of std::copy and std::move shouldn't be in order","2016-06 (Oulu)","|Nothing to do|","",""
"`LWG2689 <https://wg21.link/LWG2689>`__","Parallel versions of std::copy and std::move shouldn't be in order","2016-06 (Oulu)","|Nothing To Do|","",""
"`LWG2698 <https://wg21.link/LWG2698>`__","Effect of assign() on iterators/pointers/references","2016-06 (Oulu)","|Complete|","",""
"`LWG2704 <https://wg21.link/LWG2704>`__","recursive_directory_iterator's members should require '``*this`` is dereferenceable'","2016-06 (Oulu)","|Complete|","",""
"`LWG2706 <https://wg21.link/LWG2706>`__","Error reporting for recursive_directory_iterator::pop() is under-specified","2016-06 (Oulu)","|Complete|","",""
Expand Down Expand Up @@ -211,8 +211,8 @@
"`LWG2570 <https://wg21.link/LWG2570>`__","[fund.ts.v2] conjunction and disjunction requirements are too strict","2016-11 (Issaquah)","","",""
"`LWG2578 <https://wg21.link/LWG2578>`__","Iterator requirements should reference iterator traits","2016-11 (Issaquah)","|Complete|","",""
"`LWG2584 <https://wg21.link/LWG2584>`__","<regex> ECMAScript IdentityEscape is ambiguous","2016-11 (Issaquah)","","",""
"`LWG2587 <https://wg21.link/LWG2587>`__","""Convertible to bool"" requirement in conjunction and disjunction","2016-11 (Issaquah)","Resolved by `LWG2567 <https://wg21.link/LWG2567>`__","",""
"`LWG2588 <https://wg21.link/LWG2588>`__","[fund.ts.v2] ""Convertible to bool"" requirement in conjunction and disjunction","2016-11 (Issaquah)","Resolved by `LWG2568 <https://wg21.link/LWG2568>`__","",""
"`LWG2587 <https://wg21.link/LWG2587>`__","""Convertible to bool"" requirement in conjunction and disjunction","2016-11 (Issaquah)","|Nothing To Do| [#note-LWG2587]_","",""
"`LWG2588 <https://wg21.link/LWG2588>`__","[fund.ts.v2] ""Convertible to bool"" requirement in conjunction and disjunction","2016-11 (Issaquah)","|Nothing To Do| [#note-LWG2588]_","",""
"`LWG2589 <https://wg21.link/LWG2589>`__","match_results can't satisfy the requirements of a container","2016-11 (Issaquah)","|Complete|","",""
"`LWG2591 <https://wg21.link/LWG2591>`__","std::function's member template target() should not lead to undefined behaviour","2016-11 (Issaquah)","|Complete|","",""
"`LWG2598 <https://wg21.link/LWG2598>`__","addressof works on temporaries","2016-11 (Issaquah)","|Complete|","",""
Expand Down Expand Up @@ -310,5 +310,5 @@
"`LWG2934 <https://wg21.link/LWG2934>`__","optional<const T> doesn't compare with T","2017-02 (Kona)","|Complete|","",""
"","","","","",""
"`LWG2901 <https://wg21.link/LWG2901>`__","Variants cannot properly support allocators","2017-07 (Toronto)","|Complete|","",""
"`LWG2955 <https://wg21.link/LWG2955>`__","``to_chars / from_chars``\ depend on ``std::string``\ ","2017-07 (Toronto)","Resolved by `P0682R1 <https://wg21.link/P0682R1>`__","",""
"`LWG2955 <https://wg21.link/LWG2955>`__","``to_chars / from_chars``\ depend on ``std::string``\ ","2017-07 (Toronto)","|Nothing To Do| [#note-LWG2955]_","",""
"`LWG2956 <https://wg21.link/LWG2956>`__","``filesystem::canonical()``\ still defined in terms of ``absolute(p, base)``\ ","2017-07 (Toronto)","|Complete|","",""
14 changes: 7 additions & 7 deletions libcxx/docs/Status/Cxx17Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"`P0006R0 <https://wg21.link/P0006R0>`__","Adopt Type Traits Variable Templates for C++17.","2015-10 (Kona)","|Complete|","3.8",""
"`P0092R1 <https://wg21.link/P0092R1>`__","Polishing <chrono>","2015-10 (Kona)","|Complete|","3.8",""
"`P0007R1 <https://wg21.link/P0007R1>`__","Constant View: A proposal for a ``std::as_const``\ helper function template.","2015-10 (Kona)","|Complete|","3.8",""
"`P0156R0 <https://wg21.link/P0156R0>`__","Variadic lock_guard(rev 3).","2015-10 (Kona)","|Complete| [#note-P0156]_","3.9",""
"`P0156R0 <https://wg21.link/P0156R0>`__","Variadic lock_guard(rev 3).","2015-10 (Kona)","|Nothing To Do| [#note-P0156]_","",""
"`P0074R0 <https://wg21.link/P0074R0>`__","Making ``std::owner_less``\ more flexible","2015-10 (Kona)","|Complete|","3.8",""
"`P0013R1 <https://wg21.link/P0013R1>`__","Logical type traits rev 2","2015-10 (Kona)","|Complete|","3.8",""
"","","","","",""
Expand All @@ -44,7 +44,7 @@
"`P0032R3 <https://wg21.link/P0032R3>`__","Homogeneous interface for variant, any and optional","2016-06 (Oulu)","|Complete|","4.0",""
"`P0040R3 <https://wg21.link/P0040R3>`__","Extending memory management tools","2016-06 (Oulu)","|Complete|","4.0",""
"`P0063R3 <https://wg21.link/P0063R3>`__","C++17 should refer to C11 instead of C99","2016-06 (Oulu)","|Complete|","7.0",""
"`P0067R3 <https://wg21.link/P0067R3>`__","Elementary string conversions","2016-06 (Oulu)","Now `P0067R5 <https://wg21.link/P0067R5>`__","n/a",""
"`P0067R3 <https://wg21.link/P0067R3>`__","Elementary string conversions","2016-06 (Oulu)","|Nothing To Do| [#note-P0067]_","n/a",""
"`P0083R3 <https://wg21.link/P0083R3>`__","Splicing Maps and Sets","2016-06 (Oulu)","|Complete|","8.0",""
"`P0084R2 <https://wg21.link/P0084R2>`__","Emplace Return Type","2016-06 (Oulu)","|Complete|","4.0",""
"`P0088R3 <https://wg21.link/P0088R3>`__","Variant: a type-safe union for C++17","2016-06 (Oulu)","|Complete|","4.0",""
Expand All @@ -53,7 +53,7 @@
"`P0174R2 <https://wg21.link/P0174R2>`__","Deprecating Vestigial Library Parts in C++17","2016-06 (Oulu)","|Complete|","15.0",""
"`P0175R1 <https://wg21.link/P0175R1>`__","Synopses for the C library","2016-06 (Oulu)","","",""
"`P0180R2 <https://wg21.link/P0180R2>`__","Reserve a New Library Namespace for Future Standardization","2016-06 (Oulu)","|Nothing To Do|","n/a",""
"`P0181R1 <https://wg21.link/P0181R1>`__","Ordered by Default","2016-06 (Oulu)","*Removed in Kona*","n/a",""
"`P0181R1 <https://wg21.link/P0181R1>`__","Ordered by Default","2016-06 (Oulu)","|Nothing To Do| [#note-P0181]_","n/a",""
"`P0209R2 <https://wg21.link/P0209R2>`__","make_from_tuple: apply for construction","2016-06 (Oulu)","|Complete|","3.9",""
"`P0219R1 <https://wg21.link/P0219R1>`__","Relative Paths for Filesystem","2016-06 (Oulu)","|Complete|","7.0",""
"`P0254R2 <https://wg21.link/P0254R2>`__","Integrating std::string_view and std::string","2016-06 (Oulu)","|Complete|","4.0",""
Expand Down Expand Up @@ -98,16 +98,16 @@
"`P0452R1 <https://wg21.link/P0452R1>`__","Unifying <numeric> Parallel Algorithms","2017-02 (Kona)","|Partial| [#note-P0452]_","",""
"`P0467R2 <https://wg21.link/P0467R2>`__","Iterator Concerns for Parallel Algorithms","2017-02 (Kona)","|Partial|","",""
"`P0492R2 <https://wg21.link/P0492R2>`__","Proposed Resolution of C++17 National Body Comments for Filesystems","2017-02 (Kona)","|Complete|","7.0",""
"`P0518R1 <https://wg21.link/P0518R1>`__","Allowing copies as arguments to function objects given to parallel algorithms in response to CH11","2017-02 (Kona)","|Nothing to do|","",""
"`P0523R1 <https://wg21.link/P0523R1>`__","Wording for CH 10: Complexity of parallel algorithms","2017-02 (Kona)","|Nothing to do|","",""
"`P0518R1 <https://wg21.link/P0518R1>`__","Allowing copies as arguments to function objects given to parallel algorithms in response to CH11","2017-02 (Kona)","|Nothing To Do|","",""
"`P0523R1 <https://wg21.link/P0523R1>`__","Wording for CH 10: Complexity of parallel algorithms","2017-02 (Kona)","|Nothing To Do|","",""
"`P0548R1 <https://wg21.link/P0548R1>`__","common_type and duration","2017-02 (Kona)","|Complete|","5.0",""
"`P0558R1 <https://wg21.link/P0558R1>`__","Resolving atomic<T> named base class inconsistencies","2017-02 (Kona)","|Complete|","",""
"`P0574R1 <https://wg21.link/P0574R1>`__","Algorithm Complexity Constraints and Parallel Overloads","2017-02 (Kona)","|Nothing to do|","",""
"`P0574R1 <https://wg21.link/P0574R1>`__","Algorithm Complexity Constraints and Parallel Overloads","2017-02 (Kona)","|Nothing To Do|","",""
"`P0599R1 <https://wg21.link/P0599R1>`__","noexcept for hash functions","2017-02 (Kona)","|Complete|","5.0",""
"`P0604R0 <https://wg21.link/P0604R0>`__","Resolving GB 55, US 84, US 85, US 86","2017-02 (Kona)","|Complete|","",""
"`P0607R0 <https://wg21.link/P0607R0>`__","Inline Variables for the Standard Library","2017-02 (Kona)","|In Progress| [#note-P0607]_","6.0",""
"`P0618R0 <https://wg21.link/P0618R0>`__","Deprecating <codecvt>","2017-02 (Kona)","|Complete|","15.0",""
"`P0623R0 <https://wg21.link/P0623R0>`__","Final C++17 Parallel Algorithms Fixes","2017-02 (Kona)","|Nothing to do|","",""
"`P0623R0 <https://wg21.link/P0623R0>`__","Final C++17 Parallel Algorithms Fixes","2017-02 (Kona)","|Nothing To Do|","",""
"","","","","",""
"`P0682R1 <https://wg21.link/P0682R1>`__","Repairing elementary string conversions","2017-07 (Toronto)","","",""
"`P0739R0 <https://wg21.link/P0739R0>`__","Some improvements to class template argument deduction integration into the standard library","2017-07 (Toronto)","|Complete|","5.0",""
9 changes: 9 additions & 0 deletions libcxx/docs/Status/Cxx20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ Paper Status
.. [#note-P0883.2] P0883: ``ATOMIC_FLAG_INIT`` was marked deprecated in version 14.0, but was undeprecated with the implementation of LWG3659 in version 15.0.
.. [#note-P0660] P0660: The paper is implemented but the features are experimental and can be enabled via ``-fexperimental-library``.
.. [#note-P1614] P1614: ``std::strong_order(long double, long double)`` is partly implemented.
.. [#note-P0542] P0542: That paper was pulled out of the draft at the 2019-07 meeting in Cologne.
.. [#note-P0788] P0788: That paper was pulled out of the draft at the 2019-07 meeting in Cologne.
.. [#note-P0920] P0920: That paper was reverted by `P1661 <https://wg21.link/P1661>`__.
.. [#note-P1424] P1424: That paper was superseded by `P1902 <https://wg21.link/P1902>`__.
.. [#note-LWG2070] LWG2070: That LWG issue was resolved by `P0674R1 <https://wg21.link/P0674R1>`__.
.. [#note-LWG2499] LWG2499: That LWG issue was resolved by `P0487R1 <https://wg21.link/P0487R1>`__.
.. [#note-LWG2797] LWG2797: That LWG issue was resolved by `P1285R0 <https://wg21.link/P1285R0>`__.
.. [#note-LWG3022] LWG3022: That LWG issue was resolved by `P1285R0 <https://wg21.link/P1285R0>`__.
.. [#note-LWG3134] LWG3134: That LWG issue was resolved by `P1210R0 <https://wg21.link/P1210R0>`__.
.. [#note-P0355] P0355: The implementation status is:
* ``Calendars`` mostly done in Clang 7
Expand Down
14 changes: 7 additions & 7 deletions libcxx/docs/Status/Cxx20Issues.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"Issue #","Issue Name","Meeting","Status","First released version","Labels"
"`LWG2070 <https://wg21.link/LWG2070>`__","``allocate_shared``\ should use ``allocator_traits<A>::construct``\ ","2017-07 (Toronto)","Resolved by `P0674R1 <https://wg21.link/P0674R1>`__","",""
"`LWG2070 <https://wg21.link/LWG2070>`__","``allocate_shared``\ should use ``allocator_traits<A>::construct``\ ","2017-07 (Toronto)","|Nothing To Do| [#note-LWG2070]_","",""
"`LWG2444 <https://wg21.link/LWG2444>`__","Inconsistent complexity for ``std::sort_heap``\ ","2017-07 (Toronto)","|Nothing To Do|","",""
"`LWG2593 <https://wg21.link/LWG2593>`__","Moved-from state of Allocators","2017-07 (Toronto)","","",""
"`LWG2597 <https://wg21.link/LWG2597>`__","``std::log``\ misspecified for complex numbers","2017-07 (Toronto)","","",""
Expand Down Expand Up @@ -94,17 +94,17 @@
"`LWG2183 <https://wg21.link/LWG2183>`__","Muddled allocator requirements for ``match_results``\ constructors","2018-11 (San Diego)","|Complete|","",""
"`LWG2184 <https://wg21.link/LWG2184>`__","Muddled allocator requirements for ``match_results``\ assignments","2018-11 (San Diego)","|Complete|","",""
"`LWG2412 <https://wg21.link/LWG2412>`__","``promise::set_value()``\ and ``promise::get_future()``\ should not race","2018-11 (San Diego)","","",""
"`LWG2499 <https://wg21.link/LWG2499>`__","``operator>>(basic_istream&, CharT*)``\ makes it hard to avoid buffer overflows","2018-11 (San Diego)","Resolved by `P0487R1 <https://wg21.link/P0487R1>`__","",""
"`LWG2499 <https://wg21.link/LWG2499>`__","``operator>>(basic_istream&, CharT*)``\ makes it hard to avoid buffer overflows","2018-11 (San Diego)","|Nothing To Do| [#note-LWG2499]_","",""
"`LWG2682 <https://wg21.link/LWG2682>`__","``filesystem::copy()``\ won't create a symlink to a directory","2018-11 (San Diego)","|Nothing To Do|","",""
"`LWG2697 <https://wg21.link/LWG2697>`__","[concurr.ts] Behavior of ``future/shared_future``\ unwrapping constructor when given an invalid ``future``\ ","2018-11 (San Diego)","","",""
"`LWG2797 <https://wg21.link/LWG2797>`__","Trait precondition violations","2018-11 (San Diego)","Resolved by `P1285R0 <https://wg21.link/P1285R0>`__","",""
"`LWG2797 <https://wg21.link/LWG2797>`__","Trait precondition violations","2018-11 (San Diego)","|Nothing To Do| [#note-LWG2797]_","",""
"`LWG2936 <https://wg21.link/LWG2936>`__","Path comparison is defined in terms of the generic format","2018-11 (San Diego)","|Complete|","",""
"`LWG2943 <https://wg21.link/LWG2943>`__","Problematic specification of the wide version of ``basic_filebuf::open``\ ","2018-11 (San Diego)","|Nothing To Do|","",""
"`LWG2960 <https://wg21.link/LWG2960>`__","[fund.ts.v3] ``nonesuch``\ is insufficiently useless","2018-11 (San Diego)","|Complete|","",""
"`LWG2995 <https://wg21.link/LWG2995>`__","``basic_stringbuf``\ default constructor forbids it from using SSO capacity","2018-11 (San Diego)","|Complete|","20.0",""
"`LWG2996 <https://wg21.link/LWG2996>`__","Missing rvalue overloads for ``shared_ptr``\ operations","2018-11 (San Diego)","|Complete|","17.0",""
"`LWG3008 <https://wg21.link/LWG3008>`__","``make_shared``\ (sub)object destruction semantics are not specified","2018-11 (San Diego)","|Complete|","16.0",""
"`LWG3022 <https://wg21.link/LWG3022>`__","``is_convertible<derived*, base*>``\ may lead to ODR","2018-11 (San Diego)","Resolved by `P1285R0 <https://wg21.link/P1285R0>`__","",""
"`LWG3022 <https://wg21.link/LWG3022>`__","``is_convertible<derived*, base*>``\ may lead to ODR","2018-11 (San Diego)","|Nothing To Do| [#note-LWG3022]_","",""
"`LWG3025 <https://wg21.link/LWG3025>`__","Map-like container deduction guides should use ``pair<Key, T>``\ , not ``pair<const Key, T>``\ ","2018-11 (San Diego)","|Complete|","",""
"`LWG3031 <https://wg21.link/LWG3031>`__","Algorithms and predicates with non-const reference arguments","2018-11 (San Diego)","","",""
"`LWG3037 <https://wg21.link/LWG3037>`__","``polymorphic_allocator``\ and incomplete types","2018-11 (San Diego)","|Complete|","16.0",""
Expand All @@ -120,7 +120,7 @@
"`LWG3130 <https://wg21.link/LWG3130>`__","|sect|\ [input.output] needs many ``addressof``\ ","2018-11 (San Diego)","|Complete|","20.0",""
"`LWG3131 <https://wg21.link/LWG3131>`__","``addressof``\ all the things","2018-11 (San Diego)","","",""
"`LWG3132 <https://wg21.link/LWG3132>`__","Library needs to ban macros named ``expects``\ or ``ensures``\ ","2018-11 (San Diego)","|Nothing To Do|","",""
"`LWG3134 <https://wg21.link/LWG3134>`__","[fund.ts.v3] LFTSv3 contains extraneous [meta] variable templates that should have been deleted by P09961","2018-11 (San Diego)","Resolved by `P1210R0 <https://wg21.link/P1210R0>`__","",""
"`LWG3134 <https://wg21.link/LWG3134>`__","[fund.ts.v3] LFTSv3 contains extraneous [meta] variable templates that should have been deleted by P09961","2018-11 (San Diego)","|Nothing To Do| [#note-LWG3134]_","",""
"`LWG3137 <https://wg21.link/LWG3137>`__","Header for ``__cpp_lib_to_chars``\ ","2018-11 (San Diego)","|Complete|","",""
"`LWG3140 <https://wg21.link/LWG3140>`__","``COMMON_REF``\ is unimplementable as specified","2018-11 (San Diego)","|Nothing To Do|","",""
"`LWG3145 <https://wg21.link/LWG3145>`__","``file_clock``\ breaks ABI for C++17 implementations","2018-11 (San Diego)","|Complete|","",""
Expand Down Expand Up @@ -193,7 +193,7 @@
"`LWG2859 <https://wg21.link/LWG2859>`__","Definition of *reachable* in [ptr.launder] misses pointer arithmetic from pointer-interconvertible object","2020-02 (Prague)","","",""
"`LWG3018 <https://wg21.link/LWG3018>`__","``shared_ptr``\ of function type","2020-02 (Prague)","|Nothing To Do|","",""
"`LWG3050 <https://wg21.link/LWG3050>`__","Conversion specification problem in ``chrono::duration``\ constructor","2020-02 (Prague)","|Complete|","19.0","|chrono|"
"`LWG3141 <https://wg21.link/LWG3141>`__","``CopyConstructible``\ doesn't preserve source values","2020-02 (Prague)","|Nothing to do|","",""
"`LWG3141 <https://wg21.link/LWG3141>`__","``CopyConstructible``\ doesn't preserve source values","2020-02 (Prague)","|Nothing To Do|","",""
"`LWG3150 <https://wg21.link/LWG3150>`__","``UniformRandomBitGenerator``\ should validate ``min``\ and ``max``\ ","2020-02 (Prague)","|Complete|","13.0","|ranges|"
"`LWG3175 <https://wg21.link/LWG3175>`__","The ``CommonReference``\ requirement of concept ``SwappableWith``\ is not satisfied in the example","2020-02 (Prague)","|Complete|","13.0",""
"`LWG3194 <https://wg21.link/LWG3194>`__","``ConvertibleTo``\ prose does not match code","2020-02 (Prague)","|Complete|","13.0",""
Expand All @@ -218,7 +218,7 @@
"`LWG3269 <https://wg21.link/LWG3269>`__","Parse manipulators do not specify the result of the extraction from stream","2020-02 (Prague)","","","|chrono|"
"`LWG3270 <https://wg21.link/LWG3270>`__","Parsing and formatting ``%j``\ with ``duration``\ s","2020-02 (Prague)","|Partial|","","|chrono| |format|"
"`LWG3280 <https://wg21.link/LWG3280>`__","View converting constructors can cause constraint recursion and are unneeded","2020-02 (Prague)","|Complete|","15.0","|ranges|"
"`LWG3281 <https://wg21.link/LWG3281>`__","Conversion from ``*pair-like*``\ types to ``subrange``\ is a silent semantic promotion","2020-02 (Prague)","|Complete|","15.0","|ranges|"
"`LWG3281 <https://wg21.link/LWG3281>`__","Conversion from ``*pair-like*``\ types to ``subrange``\ is a silent semantic promotion","2020-02 (Prague)","|Complete|","13.0","|ranges|"
"`LWG3282 <https://wg21.link/LWG3282>`__","``subrange``\ converting constructor should disallow derived to base conversions","2020-02 (Prague)","|Complete|","15.0","|ranges|"
"`LWG3284 <https://wg21.link/LWG3284>`__","``random_access_iterator``\ semantic constraints accidentally promote difference type using unary negate","2020-02 (Prague)","|Nothing To Do|","","|ranges|"
"`LWG3285 <https://wg21.link/LWG3285>`__","The type of a customization point object shall satisfy ``semiregular``\ ","2020-02 (Prague)","|Nothing To Do|","","|ranges|"
Expand Down
8 changes: 4 additions & 4 deletions libcxx/docs/Status/Cxx20Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
"`P0475R1 <https://wg21.link/P0475R1>`__","LWG 2511: guaranteed copy elision for piecewise construction","2018-06 (Rapperswil)","|Complete|","",""
"`P0476R2 <https://wg21.link/P0476R2>`__","Bit-casting object representations","2018-06 (Rapperswil)","|Complete|","14.0",""
"`P0528R3 <https://wg21.link/P0528R3>`__","The Curious Case of Padding Bits, Featuring Atomic Compare-and-Exchange","2018-06 (Rapperswil)","","",""
"`P0542R5 <https://wg21.link/P0542R5>`__","Support for contract based programming in C++","2018-06 (Rapperswil)","*Removed in Cologne*","n/a",""
"`P0542R5 <https://wg21.link/P0542R5>`__","Support for contract based programming in C++","2018-06 (Rapperswil)","|Nothing To Do| [#note-P0542]_","n/a",""
"`P0556R3 <https://wg21.link/P0556R3>`__","Integral power-of-2 operations","2018-06 (Rapperswil)","|Complete|","9.0",""
"`P0619R4 <https://wg21.link/P0619R4>`__","Reviewing Deprecated Facilities of C++17 for C++20","2018-06 (Rapperswil)","|Partial| [#note-P0619]_","",""
"`P0646R1 <https://wg21.link/P0646R1>`__","Improving the Return Value of Erase-Like Algorithms","2018-06 (Rapperswil)","|Complete|","10.0",""
"`P0722R3 <https://wg21.link/P0722R3>`__","Efficient sized delete for variable sized classes","2018-06 (Rapperswil)","|Complete|","9.0",""
"`P0758R1 <https://wg21.link/P0758R1>`__","Implicit conversion traits and utility functions","2018-06 (Rapperswil)","|Complete|","",""
"`P0759R1 <https://wg21.link/P0759R1>`__","fpos Requirements","2018-06 (Rapperswil)","|Complete|","11.0",""
"`P0769R2 <https://wg21.link/P0769R2>`__","Add shift to <algorithm>","2018-06 (Rapperswil)","|Complete|","12.0",""
"`P0788R3 <https://wg21.link/P0788R3>`__","Standard Library Specification in a Concepts and Contracts World","2018-06 (Rapperswil)","*Removed in Cologne*","n/a",""
"`P0788R3 <https://wg21.link/P0788R3>`__","Standard Library Specification in a Concepts and Contracts World","2018-06 (Rapperswil)","|Nothing To Do| [#note-P0788]_","n/a",""
"`P0879R0 <https://wg21.link/P0879R0>`__","Constexpr for swap and swap related functions Also resolves LWG issue 2800.","2018-06 (Rapperswil)","|Complete|","13.0",""
"`P0887R1 <https://wg21.link/P0887R1>`__","The identity metafunction","2018-06 (Rapperswil)","|Complete|","8.0",""
"`P0892R2 <https://wg21.link/P0892R2>`__","explicit(bool)","2018-06 (Rapperswil)","","",""
Expand Down Expand Up @@ -85,7 +85,7 @@
"`P0340R3 <https://wg21.link/P0340R3>`__","Making std::underlying_type SFINAE-friendly","2019-02 (Kona)","|Complete|","9.0",""
"`P0738R2 <https://wg21.link/P0738R2>`__","I Stream, You Stream, We All Stream for istream_iterator","2019-02 (Kona)","","",""
"`P0811R3 <https://wg21.link/P0811R3>`__","Well-behaved interpolation for numbers and pointers","2019-02 (Kona)","|Complete|","9.0",""
"`P0920R2 <https://wg21.link/P0920R2>`__","Precalculated hash values in lookup","2019-02 (Kona)","Reverted by `P1661 <https://wg21.link/P1661>`__","",""
"`P0920R2 <https://wg21.link/P0920R2>`__","Precalculated hash values in lookup","2019-02 (Kona)","|Nothing To Do| [#note-P0920]_","",""
"`P1001R2 <https://wg21.link/P1001R2>`__","Target Vectorization Policies from Parallelism V2 TS to C++20","2019-02 (Kona)","|Complete|","17.0",""
"`P1024R3 <https://wg21.link/P1024R3>`__","Usability Enhancements for std::span","2019-02 (Kona)","|Complete|","9.0",""
"`P1164R1 <https://wg21.link/P1164R1>`__","Make create_directory() Intuitive","2019-02 (Kona)","|Complete|","12.0",""
Expand Down Expand Up @@ -117,7 +117,7 @@
"`P1355R2 <https://wg21.link/P1355R2>`__","Exposing a narrow contract for ceil2","2019-07 (Cologne)","|Complete|","9.0",""
"`P1361R2 <https://wg21.link/P1361R2>`__","Integration of chrono with text formatting","2019-07 (Cologne)","|Partial|","",""
"`P1423R3 <https://wg21.link/P1423R3>`__","char8_t backward compatibility remediation","2019-07 (Cologne)","|Complete|","15.0",""
"`P1424R1 <https://wg21.link/P1424R1>`__","'constexpr' feature macro concerns","2019-07 (Cologne)","Superseded by `P1902 <https://wg21.link/P1902>`__","",""
"`P1424R1 <https://wg21.link/P1424R1>`__","'constexpr' feature macro concerns","2019-07 (Cologne)","|Nothing To Do| [#note-P1424]_","",""
"`P1466R3 <https://wg21.link/P1466R3>`__","Miscellaneous minor fixes for chrono","2019-07 (Cologne)","","",""
"`P1474R1 <https://wg21.link/P1474R1>`__","Helpful pointers for ContiguousIterator","2019-07 (Cologne)","|Complete|","15.0","|ranges|"
"`P1502R1 <https://wg21.link/P1502R1>`__","Standard library header units for C++20","2019-07 (Cologne)","","",""
Expand Down
3 changes: 3 additions & 0 deletions libcxx/docs/Status/Cxx23.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Paper Status
.. [#note-P2520R0] P2520R0: Libc++ implemented this paper as a DR in C++20 as well.
.. [#note-P2711R1] P2711R1: ``join_with_view`` hasn't been done yet since this type isn't implemented yet.
.. [#note-P2770R0] P2770R0: ``join_with_view`` hasn't been done yet since this type isn't implemented yet.
.. [#note-LWG3494] LWG3494: That LWG issue was superseded by `P2017R1 <https://wg21.link/P2017R1>`__.
.. [#note-LWG3481] LWG3481: That LWG issue was superseded by `P2415R2 <https://wg21.link/P2415R2>`__.
.. [#note-LWG3265] LWG3265: That LWG issue was resolved by `LWG3435 <https://wg21.link/LWG3435>`__.
.. [#note-P2693R1] P2693R1: The formatter for ``std::thread::id`` is implemented.
The formatter for ``stacktrace`` is not implemented, since ``stacktrace`` is
not implemented yet.
Expand Down
Loading