Skip to content

Commit 3f025af

Browse files
committed
support %pltpcrel
Created using spr 1.3.5-bogner
2 parents 57958b3 + 0b2468d commit 3f025af

File tree

315 files changed

+14136
-1873
lines changed

Some content is hidden

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

315 files changed

+14136
-1873
lines changed

clang-tools-extra/clang-move/Move.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ getUsedDecls(const HelperDeclRefGraph *RG,
464464
for (const auto *D : Decls) {
465465
auto Result = RG->getReachableNodes(
466466
HelperDeclRGBuilder::getOutmostClassOrFunDecl(D));
467-
Nodes.insert(Result.begin(), Result.end());
467+
Nodes.insert_range(Result);
468468
}
469469
llvm::DenseSet<const Decl *> Results;
470470
for (const auto *Node : Nodes)

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
4343
IgnoredExceptionsVec;
4444
StringRef(RawFunctionsThatShouldNotThrow)
4545
.split(FunctionsThatShouldNotThrowVec, ",", -1, false);
46-
FunctionsThatShouldNotThrow.insert(FunctionsThatShouldNotThrowVec.begin(),
47-
FunctionsThatShouldNotThrowVec.end());
46+
FunctionsThatShouldNotThrow.insert_range(FunctionsThatShouldNotThrowVec);
4847

4948
llvm::StringSet<> IgnoredExceptions;
5049
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);
51-
IgnoredExceptions.insert(IgnoredExceptionsVec.begin(),
52-
IgnoredExceptionsVec.end());
50+
IgnoredExceptions.insert_range(IgnoredExceptionsVec);
5351
Tracer.ignoreExceptions(std::move(IgnoredExceptions));
5452
Tracer.ignoreBadAlloc(true);
5553
}

clang-tools-extra/clang-tidy/misc/NoRecursionCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ template <typename T, unsigned SmallSize> class ImmutableSmallSet {
5151
// We've decided that it isn't performant to keep using vector.
5252
// Let's migrate the data into Set.
5353
Set.reserve(Storage.size());
54-
Set.insert(Storage.begin(), Storage.end());
54+
Set.insert_range(Storage);
5555
}
5656

5757
/// count - Return 1 if the element is in the set, 0 otherwise.
@@ -97,7 +97,7 @@ template <typename T, unsigned SmallSize> class SmartSmallSetVector {
9797
const size_t NewMaxElts = 4 * Vector.size();
9898
Vector.reserve(NewMaxElts);
9999
Set.reserve(NewMaxElts);
100-
Set.insert(Vector.begin(), Vector.end());
100+
Set.insert_range(Vector);
101101
}
102102

103103
/// count - Return 1 if the element is in the set, 0 otherwise.

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
3030
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);
3131
llvm::transform(IgnoredExceptionsVec, IgnoredExceptionsVec.begin(),
3232
[](StringRef S) { return S.trim(); });
33-
IgnoredExceptions.insert(IgnoredExceptionsVec.begin(),
34-
IgnoredExceptionsVec.end());
33+
IgnoredExceptions.insert_range(IgnoredExceptionsVec);
3534
Tracer.ignoreExceptions(std::move(IgnoredExceptions));
3635
Tracer.ignoreBadAlloc(true);
3736
}

clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void ExceptionAnalyzer::ExceptionInfo::registerExceptions(
2222
if (Exceptions.empty())
2323
return;
2424
Behaviour = State::Throwing;
25-
ThrownExceptions.insert(Exceptions.begin(), Exceptions.end());
25+
ThrownExceptions.insert_range(Exceptions);
2626
}
2727

2828
ExceptionAnalyzer::ExceptionInfo &ExceptionAnalyzer::ExceptionInfo::merge(
@@ -39,8 +39,7 @@ ExceptionAnalyzer::ExceptionInfo &ExceptionAnalyzer::ExceptionInfo::merge(
3939
Behaviour = State::Unknown;
4040

4141
ContainsUnknown = ContainsUnknown || Other.ContainsUnknown;
42-
ThrownExceptions.insert(Other.ThrownExceptions.begin(),
43-
Other.ThrownExceptions.end());
42+
ThrownExceptions.insert_range(Other.ThrownExceptions);
4443
return *this;
4544
}
4645

clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class Lookup : public Command {
202202
}
203203

204204
LookupRequest Request;
205-
Request.IDs.insert(IDs.begin(), IDs.end());
205+
Request.IDs.insert_range(IDs);
206206
bool FoundSymbol = false;
207207
Index->lookup(Request, [&](const Symbol &Sym) {
208208
FoundSymbol = true;
@@ -255,7 +255,7 @@ class Refs : public Command {
255255
}
256256
}
257257
RefsRequest RefRequest;
258-
RefRequest.IDs.insert(IDs.begin(), IDs.end());
258+
RefRequest.IDs.insert_range(IDs);
259259
llvm::Regex RegexFilter(Filter);
260260
Index->refs(RefRequest, [&RegexFilter](const Ref &R) {
261261
auto U = URI::parse(R.Location.FileURI);

clang-tools-extra/clangd/unittests/TestIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ std::vector<std::string> match(const SymbolIndex &I,
151151
std::vector<std::string> lookup(const SymbolIndex &I,
152152
llvm::ArrayRef<SymbolID> IDs) {
153153
LookupRequest Req;
154-
Req.IDs.insert(IDs.begin(), IDs.end());
154+
Req.IDs.insert_range(IDs);
155155
std::vector<std::string> Results;
156156
I.lookup(Req, [&](const Symbol &Sym) {
157157
Results.push_back(getQualifiedName(Sym));

clang/include/clang/Basic/ObjCRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class ObjCRuntime {
473473
case GCC: return false;
474474
case GNUstep:
475475
return (getVersion() >= VersionTuple(2, 2));
476-
case ObjFW: return false;
476+
case ObjFW: return true;
477477
}
478478
llvm_unreachable("bad kind");
479479
}

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,6 +2224,96 @@ class CGObjCObjFW: public CGObjCGNU {
22242224
return ClassSymbol;
22252225
}
22262226

2227+
void GenerateDirectMethodPrologue(
2228+
CodeGenFunction &CGF, llvm::Function *Fn, const ObjCMethodDecl *OMD,
2229+
const ObjCContainerDecl *CD) override {
2230+
auto &Builder = CGF.Builder;
2231+
bool ReceiverCanBeNull = true;
2232+
auto selfAddr = CGF.GetAddrOfLocalVar(OMD->getSelfDecl());
2233+
auto selfValue = Builder.CreateLoad(selfAddr);
2234+
2235+
// Generate:
2236+
//
2237+
// /* for class methods only to force class lazy initialization */
2238+
// self = [self self];
2239+
//
2240+
// /* unless the receiver is never NULL */
2241+
// if (self == nil) {
2242+
// return (ReturnType){ };
2243+
// }
2244+
//
2245+
// _cmd = @selector(...)
2246+
// ...
2247+
2248+
if (OMD->isClassMethod()) {
2249+
const ObjCInterfaceDecl *OID = cast<ObjCInterfaceDecl>(CD);
2250+
assert(
2251+
OID &&
2252+
"GenerateDirectMethod() should be called with the Class Interface");
2253+
Selector SelfSel = GetNullarySelector("self", CGM.getContext());
2254+
auto ResultType = CGF.getContext().getObjCIdType();
2255+
RValue result;
2256+
CallArgList Args;
2257+
2258+
// TODO: If this method is inlined, the caller might know that `self` is
2259+
// already initialized; for example, it might be an ordinary Objective-C
2260+
// method which always receives an initialized `self`, or it might have
2261+
// just forced initialization on its own.
2262+
//
2263+
// We should find a way to eliminate this unnecessary initialization in
2264+
// such cases in LLVM.
2265+
result = GeneratePossiblySpecializedMessageSend(
2266+
CGF, ReturnValueSlot(), ResultType, SelfSel, selfValue, Args, OID,
2267+
nullptr, true);
2268+
Builder.CreateStore(result.getScalarVal(), selfAddr);
2269+
2270+
// Nullable `Class` expressions cannot be messaged with a direct method
2271+
// so the only reason why the receive can be null would be because
2272+
// of weak linking.
2273+
ReceiverCanBeNull = isWeakLinkedClass(OID);
2274+
}
2275+
2276+
if (ReceiverCanBeNull) {
2277+
llvm::BasicBlock *SelfIsNilBlock =
2278+
CGF.createBasicBlock("objc_direct_method.self_is_nil");
2279+
llvm::BasicBlock *ContBlock =
2280+
CGF.createBasicBlock("objc_direct_method.cont");
2281+
2282+
// if (self == nil) {
2283+
auto selfTy = cast<llvm::PointerType>(selfValue->getType());
2284+
auto Zero = llvm::ConstantPointerNull::get(selfTy);
2285+
2286+
llvm::MDBuilder MDHelper(CGM.getLLVMContext());
2287+
Builder.CreateCondBr(Builder.CreateICmpEQ(selfValue, Zero),
2288+
SelfIsNilBlock, ContBlock,
2289+
MDHelper.createUnlikelyBranchWeights());
2290+
2291+
CGF.EmitBlock(SelfIsNilBlock);
2292+
2293+
// return (ReturnType){ };
2294+
auto retTy = OMD->getReturnType();
2295+
Builder.SetInsertPoint(SelfIsNilBlock);
2296+
if (!retTy->isVoidType()) {
2297+
CGF.EmitNullInitialization(CGF.ReturnValue, retTy);
2298+
}
2299+
CGF.EmitBranchThroughCleanup(CGF.ReturnBlock);
2300+
// }
2301+
2302+
// rest of the body
2303+
CGF.EmitBlock(ContBlock);
2304+
Builder.SetInsertPoint(ContBlock);
2305+
}
2306+
2307+
// only synthesize _cmd if it's referenced
2308+
if (OMD->getCmdDecl()->isUsed()) {
2309+
// `_cmd` is not a parameter to direct methods, so storage must be
2310+
// explicitly declared for it.
2311+
CGF.EmitVarDecl(*OMD->getCmdDecl());
2312+
Builder.CreateStore(GetSelector(CGF, OMD),
2313+
CGF.GetAddrOfLocalVar(OMD->getCmdDecl()));
2314+
}
2315+
}
2316+
22272317
public:
22282318
CGObjCObjFW(CodeGenModule &Mod): CGObjCGNU(Mod, 9, 3) {
22292319
// IMP objc_msg_lookup(id, SEL);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,17 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
28752875
CmdArgs.push_back("-target-feature");
28762876
CmdArgs.push_back(MipsTargetFeature);
28772877
}
2878+
2879+
// Those OSes default to enabling VIS on 64-bit SPARC.
2880+
// See also the corresponding code for external assemblers in
2881+
// sparc::getSparcAsmModeForCPU().
2882+
bool IsSparcV9ATarget =
2883+
(C.getDefaultToolChain().getArch() == llvm::Triple::sparcv9) &&
2884+
(Triple.isOSLinux() || Triple.isOSFreeBSD() || Triple.isOSOpenBSD());
2885+
if (IsSparcV9ATarget && SparcTargetFeatures.empty()) {
2886+
CmdArgs.push_back("-target-feature");
2887+
CmdArgs.push_back("+vis");
2888+
}
28782889
for (const char *Feature : SparcTargetFeatures) {
28792890
CmdArgs.push_back("-target-feature");
28802891
CmdArgs.push_back(Feature);

0 commit comments

Comments
 (0)