summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-08-29 17:50:47 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-08-29 17:50:47 +0000
commitfe208f5606bc4a82b573ac32db2897616d3abc24 (patch)
treeb24eb98bb9dcd177f8892ec5c1e09978c0977a7c /lib
parent5a4cb1eb0c4e2560397c009da45d57bb1ebb6135 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclObjC.cpp2
-rw-r--r--lib/AST/Expr.cpp24
-rw-r--r--lib/AST/ExprCXX.cpp18
-rw-r--r--lib/AST/MicrosoftMangle.cpp51
-rw-r--r--lib/AST/Stmt.cpp6
-rw-r--r--lib/AST/StmtObjC.cpp2
-rw-r--r--lib/Analysis/CloneDetection.cpp2
-rw-r--r--lib/Basic/Targets/X86.h8
-rw-r--r--lib/CodeGen/CGBuiltin.cpp21
-rw-r--r--lib/CodeGen/CGExpr.cpp3
-rw-r--r--lib/CodeGen/CodeGenModule.cpp20
-rw-r--r--lib/CodeGen/CoverageMappingGen.cpp3
-rw-r--r--lib/Headers/intrin.h14
-rw-r--r--lib/Sema/SemaChecking.cpp6
-rw-r--r--lib/Sema/SemaInit.cpp4
15 files changed, 120 insertions, 64 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 01fd10429fc1d..18ba3b13b3653 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -931,7 +931,7 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
return this;
}
-SourceLocation ObjCMethodDecl::getLocEnd() const {
+SourceLocation ObjCMethodDecl::getEndLoc() const {
if (Stmt *Body = getBody())
return Body->getLocEnd();
return DeclEndLoc;
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 7556c76c38bda..50cff156d248f 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -447,12 +447,12 @@ DeclRefExpr *DeclRefExpr::CreateEmpty(const ASTContext &Context,
return new (Mem) DeclRefExpr(EmptyShell());
}
-SourceLocation DeclRefExpr::getLocStart() const {
+SourceLocation DeclRefExpr::getBeginLoc() const {
if (hasQualifier())
return getQualifierLoc().getBeginLoc();
return getNameInfo().getLocStart();
}
-SourceLocation DeclRefExpr::getLocEnd() const {
+SourceLocation DeclRefExpr::getEndLoc() const {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return getNameInfo().getLocEnd();
@@ -1358,7 +1358,7 @@ QualType CallExpr::getCallReturnType(const ASTContext &Ctx) const {
return FnType->getReturnType();
}
-SourceLocation CallExpr::getLocStart() const {
+SourceLocation CallExpr::getBeginLoc() const {
if (isa<CXXOperatorCallExpr>(this))
return cast<CXXOperatorCallExpr>(this)->getLocStart();
@@ -1367,7 +1367,7 @@ SourceLocation CallExpr::getLocStart() const {
begin = getArg(0)->getLocStart();
return begin;
}
-SourceLocation CallExpr::getLocEnd() const {
+SourceLocation CallExpr::getEndLoc() const {
if (isa<CXXOperatorCallExpr>(this))
return cast<CXXOperatorCallExpr>(this)->getLocEnd();
@@ -1529,7 +1529,7 @@ MemberExpr *MemberExpr::Create(
return E;
}
-SourceLocation MemberExpr::getLocStart() const {
+SourceLocation MemberExpr::getBeginLoc() const {
if (isImplicitAccess()) {
if (hasQualifier())
return getQualifierLoc().getBeginLoc();
@@ -1543,7 +1543,7 @@ SourceLocation MemberExpr::getLocStart() const {
return BaseStartLoc;
return MemberLoc;
}
-SourceLocation MemberExpr::getLocEnd() const {
+SourceLocation MemberExpr::getEndLoc() const {
SourceLocation EndLoc = getMemberNameInfo().getEndLoc();
if (hasExplicitTemplateArgs())
EndLoc = getRAngleLoc();
@@ -2039,7 +2039,7 @@ bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions &LangOpts) const
return Lit && Lit->getValue() == 0;
}
-SourceLocation InitListExpr::getLocStart() const {
+SourceLocation InitListExpr::getBeginLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
return SyntacticForm->getLocStart();
SourceLocation Beg = LBraceLoc;
@@ -2057,7 +2057,7 @@ SourceLocation InitListExpr::getLocStart() const {
return Beg;
}
-SourceLocation InitListExpr::getLocEnd() const {
+SourceLocation InitListExpr::getEndLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
return SyntacticForm->getLocEnd();
SourceLocation End = RBraceLoc;
@@ -3870,7 +3870,7 @@ SourceRange DesignatedInitExpr::getDesignatorsSourceRange() const {
DIE->getDesignator(size()-1)->getLocEnd());
}
-SourceLocation DesignatedInitExpr::getLocStart() const {
+SourceLocation DesignatedInitExpr::getBeginLoc() const {
SourceLocation StartLoc;
auto *DIE = const_cast<DesignatedInitExpr *>(this);
Designator &First = *DIE->getDesignator(0);
@@ -3885,7 +3885,7 @@ SourceLocation DesignatedInitExpr::getLocStart() const {
return StartLoc;
}
-SourceLocation DesignatedInitExpr::getLocEnd() const {
+SourceLocation DesignatedInitExpr::getEndLoc() const {
return getInit()->getLocEnd();
}
@@ -3944,11 +3944,11 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
BaseAndUpdaterExprs[1] = ILE;
}
-SourceLocation DesignatedInitUpdateExpr::getLocStart() const {
+SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const {
return getBase()->getLocStart();
}
-SourceLocation DesignatedInitUpdateExpr::getLocEnd() const {
+SourceLocation DesignatedInitUpdateExpr::getEndLoc() const {
return getBase()->getLocEnd();
}
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 93d68ec8e0b28..cc4c631553be1 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -89,7 +89,7 @@ QualType CXXUuidofExpr::getTypeOperand(ASTContext &Context) const {
}
// CXXScalarValueInitExpr
-SourceLocation CXXScalarValueInitExpr::getLocStart() const {
+SourceLocation CXXScalarValueInitExpr::getBeginLoc() const {
return TypeInfo ? TypeInfo->getTypeLoc().getBeginLoc() : RParenLoc;
}
@@ -250,7 +250,7 @@ QualType CXXPseudoDestructorExpr::getDestroyedType() const {
return QualType();
}
-SourceLocation CXXPseudoDestructorExpr::getLocEnd() const {
+SourceLocation CXXPseudoDestructorExpr::getEndLoc() const {
SourceLocation End = DestroyedType.getLocation();
if (TypeSourceInfo *TInfo = DestroyedType.getTypeSourceInfo())
End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
@@ -450,13 +450,13 @@ DependentScopeDeclRefExpr::CreateEmpty(const ASTContext &C,
return E;
}
-SourceLocation CXXConstructExpr::getLocStart() const {
+SourceLocation CXXConstructExpr::getBeginLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
return cast<CXXTemporaryObjectExpr>(this)->getLocStart();
return Loc;
}
-SourceLocation CXXConstructExpr::getLocEnd() const {
+SourceLocation CXXConstructExpr::getEndLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
return cast<CXXTemporaryObjectExpr>(this)->getLocEnd();
@@ -707,11 +707,11 @@ CXXFunctionalCastExpr::CreateEmpty(const ASTContext &C, unsigned PathSize) {
return new (Buffer) CXXFunctionalCastExpr(EmptyShell(), PathSize);
}
-SourceLocation CXXFunctionalCastExpr::getLocStart() const {
+SourceLocation CXXFunctionalCastExpr::getBeginLoc() const {
return getTypeInfoAsWritten()->getTypeLoc().getLocStart();
}
-SourceLocation CXXFunctionalCastExpr::getLocEnd() const {
+SourceLocation CXXFunctionalCastExpr::getEndLoc() const {
return RParenLoc.isValid() ? RParenLoc : getSubExpr()->getLocEnd();
}
@@ -792,11 +792,11 @@ CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(const ASTContext &C,
CXXConstructExpr::CK_Complete, ParenOrBraceRange),
Type(TSI) {}
-SourceLocation CXXTemporaryObjectExpr::getLocStart() const {
+SourceLocation CXXTemporaryObjectExpr::getBeginLoc() const {
return Type->getTypeLoc().getBeginLoc();
}
-SourceLocation CXXTemporaryObjectExpr::getLocEnd() const {
+SourceLocation CXXTemporaryObjectExpr::getEndLoc() const {
SourceLocation Loc = getParenOrBraceRange().getEnd();
if (Loc.isInvalid() && getNumArgs())
Loc = getArg(getNumArgs()-1)->getLocEnd();
@@ -1120,7 +1120,7 @@ CXXUnresolvedConstructExpr::CreateEmpty(const ASTContext &C, unsigned NumArgs) {
return new (Mem) CXXUnresolvedConstructExpr(Empty, NumArgs);
}
-SourceLocation CXXUnresolvedConstructExpr::getLocStart() const {
+SourceLocation CXXUnresolvedConstructExpr::getBeginLoc() const {
return Type->getTypeLoc().getBeginLoc();
}
diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp
index 40281481f1d19..d5332ba7db549 100644
--- a/lib/AST/MicrosoftMangle.cpp
+++ b/lib/AST/MicrosoftMangle.cpp
@@ -29,6 +29,7 @@
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/JamCRC.h"
+#include "llvm/Support/xxhash.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
@@ -127,10 +128,10 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext {
llvm::DenseMap<const CXXRecordDecl *, unsigned> LambdaIds;
llvm::DenseMap<const NamedDecl *, unsigned> SEHFilterIds;
llvm::DenseMap<const NamedDecl *, unsigned> SEHFinallyIds;
+ SmallString<16> AnonymousNamespaceHash;
public:
- MicrosoftMangleContextImpl(ASTContext &Context, DiagnosticsEngine &Diags)
- : MicrosoftMangleContext(Context, Diags) {}
+ MicrosoftMangleContextImpl(ASTContext &Context, DiagnosticsEngine &Diags);
bool shouldMangleCXXName(const NamedDecl *D) override;
bool shouldMangleStringLiteral(const StringLiteral *SL) override;
void mangleCXXName(const NamedDecl *D, raw_ostream &Out) override;
@@ -238,6 +239,12 @@ public:
return Result.first->second;
}
+ /// Return a character sequence that is (somewhat) unique to the TU suitable
+ /// for mangling anonymous namespaces.
+ StringRef getAnonymousNamespaceHash() const {
+ return AnonymousNamespaceHash;
+ }
+
private:
void mangleInitFiniStub(const VarDecl *D, char CharCode, raw_ostream &Out);
};
@@ -371,6 +378,34 @@ private:
};
}
+MicrosoftMangleContextImpl::MicrosoftMangleContextImpl(ASTContext &Context,
+ DiagnosticsEngine &Diags)
+ : MicrosoftMangleContext(Context, Diags) {
+ // To mangle anonymous namespaces, hash the path to the main source file. The
+ // path should be whatever (probably relative) path was passed on the command
+ // line. The goal is for the compiler to produce the same output regardless of
+ // working directory, so use the uncanonicalized relative path.
+ //
+ // It's important to make the mangled names unique because, when CodeView
+ // debug info is in use, the debugger uses mangled type names to distinguish
+ // between otherwise identically named types in anonymous namespaces.
+ //
+ // These symbols are always internal, so there is no need for the hash to
+ // match what MSVC produces. For the same reason, clang is free to change the
+ // hash at any time without breaking compatibility with old versions of clang.
+ // The generated names are intended to look similar to what MSVC generates,
+ // which are something like "?A0x01234567@".
+ SourceManager &SM = Context.getSourceManager();
+ if (const FileEntry *FE = SM.getFileEntryForID(SM.getMainFileID())) {
+ // Truncate the hash so we get 8 characters of hexadecimal.
+ uint32_t TruncatedHash = uint32_t(xxHash64(FE->getName()));
+ AnonymousNamespaceHash = llvm::utohexstr(TruncatedHash);
+ } else {
+ // If we don't have a path to the main file, we'll just use 0.
+ AnonymousNamespaceHash = "0";
+ }
+}
+
bool MicrosoftMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) {
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
LanguageLinkage L = FD->getLanguageLinkage();
@@ -785,7 +820,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
if (const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) {
if (NS->isAnonymousNamespace()) {
- Out << "?A@";
+ Out << "?A0x" << Context.getAnonymousNamespaceHash() << '@';
break;
}
}
@@ -905,8 +940,14 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
- case DeclarationName::ObjCMultiArgSelector:
- llvm_unreachable("Can't mangle Objective-C selector names here!");
+ case DeclarationName::ObjCMultiArgSelector: {
+ // This is reachable only when constructing an outlined SEH finally
+ // block. Nothing depends on this mangling and it's used only with
+ // functinos with internal linkage.
+ llvm::SmallString<64> Name;
+ mangleSourceName(Name.str());
+ break;
+ }
case DeclarationName::CXXConstructorName:
if (isStructorDecl(ND)) {
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index a041006c905e4..64a7a196140ee 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -275,8 +275,8 @@ SourceRange Stmt::getSourceRange() const {
llvm_unreachable("unknown statement kind!");
}
-SourceLocation Stmt::getLocStart() const {
-// llvm::errs() << "getLocStart() for " << getStmtClassName() << "\n";
+SourceLocation Stmt::getBeginLoc() const {
+ // llvm::errs() << "getBeginLoc() for " << getStmtClassName() << "\n";
switch (getStmtClass()) {
case Stmt::NoStmtClass: llvm_unreachable("statement without class");
#define ABSTRACT_STMT(type)
@@ -288,7 +288,7 @@ SourceLocation Stmt::getLocStart() const {
llvm_unreachable("unknown statement kind");
}
-SourceLocation Stmt::getLocEnd() const {
+SourceLocation Stmt::getEndLoc() const {
switch (getStmtClass()) {
case Stmt::NoStmtClass: llvm_unreachable("statement without class");
#define ABSTRACT_STMT(type)
diff --git a/lib/AST/StmtObjC.cpp b/lib/AST/StmtObjC.cpp
index eea03f64c2fe5..cc4b2308a08bf 100644
--- a/lib/AST/StmtObjC.cpp
+++ b/lib/AST/StmtObjC.cpp
@@ -64,7 +64,7 @@ ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(const ASTContext &Context,
return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
}
-SourceLocation ObjCAtTryStmt::getLocEnd() const {
+SourceLocation ObjCAtTryStmt::getEndLoc() const {
if (HasFinally)
return getFinallyStmt()->getLocEnd();
if (NumCatchStmts)
diff --git a/lib/Analysis/CloneDetection.cpp b/lib/Analysis/CloneDetection.cpp
index 8912b3b767512..c0b9b5c0823aa 100644
--- a/lib/Analysis/CloneDetection.cpp
+++ b/lib/Analysis/CloneDetection.cpp
@@ -77,7 +77,7 @@ ASTContext &StmtSequence::getASTContext() const {
return D->getASTContext();
}
-SourceLocation StmtSequence::getStartLoc() const {
+SourceLocation StmtSequence::getBeginLoc() const {
return front()->getLocStart();
}
diff --git a/lib/Basic/Targets/X86.h b/lib/Basic/Targets/X86.h
index 019bc8d51a634..1d23b0ef69333 100644
--- a/lib/Basic/Targets/X86.h
+++ b/lib/Basic/Targets/X86.h
@@ -350,11 +350,9 @@ public:
(1 << TargetInfo::LongDouble));
// x86-32 has atomics up to 8 bytes
- CPUKind Kind = getCPUKind(Opts.CPU);
- if (Kind >= CK_i586 || Kind == CK_Generic)
- MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
- else if (Kind >= CK_i486)
- MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+ // FIXME: Check that we actually have cmpxchg8b before setting
+ // MaxAtomicInlineWidth. (cmpxchg8b is an i586 instruction.)
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
}
BuiltinVaListKind getBuiltinVaListKind() const override {
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index e99121c46d9b6..669a3be0e6e12 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -10361,6 +10361,27 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
llvm::SyncScope::System);
}
+ case X86::BI__shiftleft128:
+ case X86::BI__shiftright128: {
+ // FIXME: Once fshl/fshr no longer add an unneeded and and cmov, do this:
+ // llvm::Function *F = CGM.getIntrinsic(
+ // BuiltinID == X86::BI__shiftleft128 ? Intrinsic::fshl : Intrinsic::fshr,
+ // Int64Ty);
+ // Ops[2] = Builder.CreateZExt(Ops[2], Int64Ty);
+ // return Builder.CreateCall(F, Ops);
+ llvm::Type *Int128Ty = Builder.getInt128Ty();
+ Value *Val = Builder.CreateOr(
+ Builder.CreateShl(Builder.CreateZExt(Ops[1], Int128Ty), 64),
+ Builder.CreateZExt(Ops[0], Int128Ty));
+ Value *Amt = Builder.CreateAnd(Builder.CreateZExt(Ops[2], Int128Ty),
+ llvm::ConstantInt::get(Int128Ty, 0x3f));
+ Value *Res;
+ if (BuiltinID == X86::BI__shiftleft128)
+ Res = Builder.CreateLShr(Builder.CreateShl(Val, Amt), 64);
+ else
+ Res = Builder.CreateLShr(Val, Amt);
+ return Builder.CreateTrunc(Res, Int64Ty);
+ }
case X86::BI_ReadWriteBarrier:
case X86::BI_ReadBarrier:
case X86::BI_WriteBarrier: {
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index f168dd02ead1b..93a1859de7203 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -2408,6 +2408,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
// A DeclRefExpr for a reference initialized by a constant expression can
// appear without being odr-used. Directly emit the constant initializer.
const Expr *Init = VD->getAnyInitializer(VD);
+ const auto *BD = dyn_cast_or_null<BlockDecl>(CurCodeDecl);
if (Init && !isa<ParmVarDecl>(VD) && VD->getType()->isReferenceType() &&
VD->isUsableInConstantExpressions(getContext()) &&
VD->checkInitIsICE() &&
@@ -2417,7 +2418,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
(LocalDeclMap.count(VD->getCanonicalDecl()) ||
CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) ||
LambdaCaptureFields.lookup(VD->getCanonicalDecl()) ||
- isa<BlockDecl>(CurCodeDecl)))) {
+ (BD && BD->capturesVariable(VD))))) {
llvm::Constant *Val =
ConstantEmitter(*this).emitAbstract(E->getLocation(),
*VD->evaluateValue(),
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 8c5e0df0969b8..155ee6c6af12a 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -2539,15 +2539,17 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
if (getLangOpts().OpenMPIsDevice && OpenMPRuntime &&
!OpenMPRuntime->markAsGlobalTarget(GD) && FD->isDefined() &&
!DontDefer && !IsForDefinition) {
- const FunctionDecl *FDDef = FD->getDefinition();
- GlobalDecl GDDef;
- if (const auto *CD = dyn_cast<CXXConstructorDecl>(FDDef))
- GDDef = GlobalDecl(CD, GD.getCtorType());
- else if (const auto *DD = dyn_cast<CXXDestructorDecl>(FDDef))
- GDDef = GlobalDecl(DD, GD.getDtorType());
- else
- GDDef = GlobalDecl(FDDef);
- addDeferredDeclToEmit(GDDef);
+ if (const FunctionDecl *FDDef = FD->getDefinition())
+ if (getContext().DeclMustBeEmitted(FDDef)) {
+ GlobalDecl GDDef;
+ if (const auto *CD = dyn_cast<CXXConstructorDecl>(FDDef))
+ GDDef = GlobalDecl(CD, GD.getCtorType());
+ else if (const auto *DD = dyn_cast<CXXDestructorDecl>(FDDef))
+ GDDef = GlobalDecl(DD, GD.getDtorType());
+ else
+ GDDef = GlobalDecl(FDDef);
+ addDeferredDeclToEmit(GDDef);
+ }
}
if (FD->isMultiVersion()) {
diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp
index 2d84464635942..389d29e467b70 100644
--- a/lib/CodeGen/CoverageMappingGen.cpp
+++ b/lib/CodeGen/CoverageMappingGen.cpp
@@ -67,7 +67,8 @@ public:
void setStartLoc(SourceLocation Loc) { LocStart = Loc; }
- SourceLocation getStartLoc() const {
+ SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const {
assert(LocStart && "Region has no start location");
return *LocStart;
}
diff --git a/lib/Headers/intrin.h b/lib/Headers/intrin.h
index 91914214e2994..edb947eef6592 100644
--- a/lib/Headers/intrin.h
+++ b/lib/Headers/intrin.h
@@ -863,20 +863,6 @@ __nop(void) {
__asm__ volatile ("nop");
}
#endif
-#if defined(__x86_64__)
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
- unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
- unsigned __int128 __res = __val << (__d & 63);
- return (unsigned __int64)(__res >> 64);
-}
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
- unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
- unsigned __int128 __res = __val >> (__d & 63);
- return (unsigned __int64)__res;
-}
-#endif
/*----------------------------------------------------------------------------*\
|* Privileged intrinsics
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 93dbeab5b0344..718a5e1ccefa1 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -6121,11 +6121,13 @@ class FormatStringLiteral {
StartToken, StartTokenByteOffset);
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return FExpr->getLocStart().getLocWithOffset(Offset);
}
- SourceLocation getLocEnd() const LLVM_READONLY { return FExpr->getLocEnd(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return FExpr->getLocEnd(); }
};
} // namespace
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 01ef86c656bb5..5070996d50e08 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -6942,6 +6942,10 @@ void Sema::checkInitializerLifetime(const InitializedEntity &Entity,
} else if (isa<BlockExpr>(L)) {
Diag(DiagLoc, diag::err_ret_local_block) << DiagRange;
} else if (isa<AddrLabelExpr>(L)) {
+ // Don't warn when returning a label from a statement expression.
+ // Leaving the scope doesn't end its lifetime.
+ if (LK == LK_StmtExprResult)
+ return false;
Diag(DiagLoc, diag::warn_ret_addr_label) << DiagRange;
} else {
Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)