svn commit: r323112 - in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/tools/clang/include/clang/AST contrib/llvm/tools/clang/...

Dimitry Andric dim at FreeBSD.org
Fri Sep 1 18:53:40 UTC 2017


Author: dim
Date: Fri Sep  1 18:53:36 2017
New Revision: 323112
URL: https://svnweb.freebsd.org/changeset/base/323112

Log:
  Upgrade our copies of clang, llvm, lldb and compiler-rt to r312293 from
  the upstream release_50 branch.  This corresponds to 5.0.0 rc4.
  
  As of this version, the cad/stepcode port should now compile in a more
  reasonable time on i386 (see bug 221836 for more information).
  
  PR:		221836
  MFC after:	2 months
  X-MFC-with:	r321369

Modified:
  head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
  head/contrib/llvm/lib/Analysis/PostDominators.cpp
  head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  head/contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h
  head/contrib/llvm/tools/clang/include/clang/Driver/Options.td
  head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def
  head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h
  head/contrib/llvm/tools/clang/lib/CodeGen/ABIInfo.h
  head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.h
  head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
  head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.cpp
  head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.h
  head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp
  head/contrib/llvm/tools/lldb/source/Host/common/TCPSocket.cpp
  head/lib/clang/include/clang/Basic/Version.inc
  head/lib/clang/include/lld/Config/Version.inc
  head/lib/clang/include/llvm/Support/VCSRevision.h
Directory Properties:
  head/contrib/compiler-rt/   (props changed)
  head/contrib/libc++/   (props changed)
  head/contrib/llvm/   (props changed)
  head/contrib/llvm/tools/clang/   (props changed)
  head/contrib/llvm/tools/lld/   (props changed)
  head/contrib/llvm/tools/lldb/   (props changed)

Modified: head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
==============================================================================
--- head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -801,7 +801,8 @@ class SDNode : public FoldingSetNode, public ilist_nod
   /// if DAG changes.
   static bool hasPredecessorHelper(const SDNode *N,
                                    SmallPtrSetImpl<const SDNode *> &Visited,
-                                   SmallVectorImpl<const SDNode *> &Worklist) {
+                                   SmallVectorImpl<const SDNode *> &Worklist,
+                                   unsigned int MaxSteps = 0) {
     if (Visited.count(N))
       return true;
     while (!Worklist.empty()) {
@@ -816,6 +817,8 @@ class SDNode : public FoldingSetNode, public ilist_nod
       }
       if (Found)
         return true;
+      if (MaxSteps != 0 && Visited.size() >= MaxSteps)
+        return false;
     }
     return false;
   }

Modified: head/contrib/llvm/lib/Analysis/PostDominators.cpp
==============================================================================
--- head/contrib/llvm/lib/Analysis/PostDominators.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/lib/Analysis/PostDominators.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -23,8 +23,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "postdomtree"
 
-template class llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
-
 //===----------------------------------------------------------------------===//
 //  PostDominatorTree Implementation
 //===----------------------------------------------------------------------===//

Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
==============================================================================
--- head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -1118,22 +1118,30 @@ SDValue DAGCombiner::PromoteIntBinOp(SDValue Op) {
     SDValue RV =
         DAG.getNode(ISD::TRUNCATE, DL, VT, DAG.getNode(Opc, DL, PVT, NN0, NN1));
 
-    // New replace instances of N0 and N1
-    if (Replace0 && N0 && N0.getOpcode() != ISD::DELETED_NODE && NN0 &&
-        NN0.getOpcode() != ISD::DELETED_NODE) {
+    // We are always replacing N0/N1's use in N and only need
+    // additional replacements if there are additional uses.
+    Replace0 &= !N0->hasOneUse();
+    Replace1 &= (N0 != N1) && !N1->hasOneUse();
+
+    // Combine Op here so it is presreved past replacements.
+    CombineTo(Op.getNode(), RV);
+
+    // If operands have a use ordering, make sur we deal with
+    // predecessor first.
+    if (Replace0 && Replace1 && N0.getNode()->isPredecessorOf(N1.getNode())) {
+      std::swap(N0, N1);
+      std::swap(NN0, NN1);
+    }
+
+    if (Replace0) {
       AddToWorklist(NN0.getNode());
       ReplaceLoadWithPromotedLoad(N0.getNode(), NN0.getNode());
     }
-
-    if (Replace1 && N1 && N1.getOpcode() != ISD::DELETED_NODE && NN1 &&
-        NN1.getOpcode() != ISD::DELETED_NODE) {
+    if (Replace1) {
       AddToWorklist(NN1.getNode());
       ReplaceLoadWithPromotedLoad(N1.getNode(), NN1.getNode());
     }
-
-    // Deal with Op being deleted.
-    if (Op && Op.getOpcode() != ISD::DELETED_NODE)
-      return RV;
+    return Op;
   }
   return SDValue();
 }
@@ -12599,25 +12607,37 @@ void DAGCombiner::getStoreMergeCandidates(
         }
 }
 
-// We need to check that merging these stores does not cause a loop
-// in the DAG. Any store candidate may depend on another candidate
+// We need to check that merging these stores does not cause a loop in
+// the DAG. Any store candidate may depend on another candidate
 // indirectly through its operand (we already consider dependencies
 // through the chain). Check in parallel by searching up from
 // non-chain operands of candidates.
+
 bool DAGCombiner::checkMergeStoreCandidatesForDependencies(
     SmallVectorImpl<MemOpLink> &StoreNodes, unsigned NumStores) {
+
+  // FIXME: We should be able to truncate a full search of
+  // predecessors by doing a BFS and keeping tabs the originating
+  // stores from which worklist nodes come from in a similar way to
+  // TokenFactor simplfication.
+
   SmallPtrSet<const SDNode *, 16> Visited;
   SmallVector<const SDNode *, 8> Worklist;
-  // search ops of store candidates
+  unsigned int Max = 8192;
+  // Search Ops of store candidates.
   for (unsigned i = 0; i < NumStores; ++i) {
     SDNode *n = StoreNodes[i].MemNode;
     // Potential loops may happen only through non-chain operands
     for (unsigned j = 1; j < n->getNumOperands(); ++j)
       Worklist.push_back(n->getOperand(j).getNode());
   }
-  // search through DAG. We can stop early if we find a storenode
+  // Search through DAG. We can stop early if we find a store node.
   for (unsigned i = 0; i < NumStores; ++i) {
-    if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist))
+    if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist,
+                                     Max))
+      return false;
+    // Check if we ended early, failing conservatively if so.
+    if (Visited.size() >= Max)
       return false;
   }
   return true;

Modified: head/contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -2028,7 +2028,10 @@ class CXXMethodDecl : public FunctionDecl { (public)
 
   /// \brief Returns the type of the \c this pointer.
   ///
-  /// Should only be called for instance (i.e., non-static) methods.
+  /// Should only be called for instance (i.e., non-static) methods. Note
+  /// that for the call operator of a lambda closure type, this returns the
+  /// desugared 'this' type (a pointer to the closure type), not the captured
+  /// 'this' type.
   QualType getThisType(ASTContext &C) const;
 
   unsigned getTypeQualifiers() const {

Modified: head/contrib/llvm/tools/clang/include/clang/Driver/Options.td
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/Driver/Options.td	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/include/clang/Driver/Options.td	Fri Sep  1 18:53:36 2017	(r323112)
@@ -694,6 +694,9 @@ def fbuiltin : Flag<["-"], "fbuiltin">, Group<f_Group>
 def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group<f_Group>,
   Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
 def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group<f_Group>;
+def fclang_abi_compat_EQ : Joined<["-"], "fclang-abi-compat=">, Group<f_clang_Group>,
+  Flags<[CC1Option]>, MetaVarName<"<version>">, Values<"<major>.<minor>,latest">,
+  HelpText<"Attempt to match the ABI of Clang <version>">;
 def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group<f_Group>;
 def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group<f_Group>,
   Flags<[CoreOption, CC1Option]>, HelpText<"Use colors in diagnostics">;

Modified: head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.def	Fri Sep  1 18:53:36 2017	(r323112)
@@ -120,6 +120,10 @@ CODEGENOPT(NoZeroInitializedInBSS , 1, 0) ///< -fno-ze
 ENUM_CODEGENOPT(ObjCDispatchMethod, ObjCDispatchMethodKind, 2, Legacy)
 CODEGENOPT(OmitLeafFramePointer , 1, 0) ///< Set when -momit-leaf-frame-pointer is
                                         ///< enabled.
+
+/// A version of Clang that we should attempt to be ABI-compatible with.
+ENUM_CODEGENOPT(ClangABICompat, ClangABI, 4, ClangABI::Latest)
+
 VALUE_CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
 VALUE_CODEGENOPT(OptimizeSize, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.
 

Modified: head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -69,6 +69,23 @@ class CodeGenOptions : public CodeGenOptionsBase { (pu
     LocalExecTLSModel
   };
 
+  /// Clang versions with different platform ABI conformance.
+  enum class ClangABI {
+    /// Attempt to be ABI-compatible with code generated by Clang 3.8.x
+    /// (SVN r257626). This causes <1 x long long> to be passed in an
+    /// integer register instead of an SSE register on x64_64.
+    Ver3_8,
+
+    /// Attempt to be ABI-compatible with code generated by Clang 4.0.x
+    /// (SVN r291814). This causes move operations to be ignored when
+    /// determining whether a class type can be passed or returned directly.
+    Ver4,
+
+    /// Conform to the underlying platform's C and C++ ABIs as closely
+    /// as we can.
+    Latest
+  };
+
   enum StructReturnConventionKind {
     SRCK_Default,  // No special option was passed.
     SRCK_OnStack,  // Small structs on the stack (-fpcc-struct-return).

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/ABIInfo.h
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/ABIInfo.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/ABIInfo.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -24,6 +24,7 @@ namespace llvm {
 
 namespace clang {
   class ASTContext;
+  class CodeGenOptions;
   class TargetInfo;
 
 namespace CodeGen {
@@ -68,6 +69,7 @@ namespace swiftcall {
     llvm::LLVMContext &getVMContext() const;
     const llvm::DataLayout &getDataLayout() const;
     const TargetInfo &getTarget() const;
+    const CodeGenOptions &getCodeGenOpts() const;
 
     /// Return the calling convention to use for system runtime
     /// functions.

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -3260,7 +3260,7 @@ void CGDebugInfo::EmitInlineFunctionStart(CGBuilderTy 
   llvm::DISubprogram *SP = nullptr;
   if (FI != SPCache.end())
     SP = dyn_cast_or_null<llvm::DISubprogram>(FI->second);
-  if (!SP)
+  if (!SP || !SP->isDefinition())
     SP = getFunctionStub(GD);
   FnBeginRegionCount.push_back(LexicalBlockStack.size());
   LexicalBlockStack.emplace_back(SP);

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -22,6 +22,7 @@
 #include "CodeGenPGO.h"
 #include "TargetInfo.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTLambda.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/StmtCXX.h"
@@ -983,11 +984,22 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
     }
 
     // Check the 'this' pointer once per function, if it's available.
-    if (CXXThisValue) {
+    if (CXXABIThisValue) {
       SanitizerSet SkippedChecks;
       SkippedChecks.set(SanitizerKind::ObjectSize, true);
       QualType ThisTy = MD->getThisType(getContext());
-      EmitTypeCheck(TCK_Load, Loc, CXXThisValue, ThisTy,
+
+      // If this is the call operator of a lambda with no capture-default, it
+      // may have a static invoker function, which may call this operator with
+      // a null 'this' pointer.
+      if (isLambdaCallOperator(MD) &&
+          cast<CXXRecordDecl>(MD->getParent())->getLambdaCaptureDefault() ==
+              LCD_None)
+        SkippedChecks.set(SanitizerKind::Null, true);
+
+      EmitTypeCheck(isa<CXXConstructorDecl>(MD) ? TCK_ConstructorCall
+                                                : TCK_MemberCall,
+                    Loc, CXXABIThisValue, ThisTy,
                     getContext().getTypeAlignInChars(ThisTy->getPointeeType()),
                     SkippedChecks);
     }

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -44,6 +44,10 @@ CodeGenTypes::~CodeGenTypes() {
     delete &*I++;
 }
 
+const CodeGenOptions &CodeGenTypes::getCodeGenOpts() const {
+  return CGM.getCodeGenOpts();
+}
+
 void CodeGenTypes::addRecordTypeName(const RecordDecl *RD,
                                      llvm::StructType *Ty,
                                      StringRef suffix) {

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.h
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTypes.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -178,6 +178,7 @@ class CodeGenTypes { (public)
   const TargetInfo &getTarget() const { return Target; }
   CGCXXABI &getCXXABI() const { return TheCXXABI; }
   llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
+  const CodeGenOptions &getCodeGenOpts() const;
 
   /// ConvertType - Convert type T into a llvm::Type.
   llvm::Type *ConvertType(QualType T);

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/ItaniumCXXABI.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -62,9 +62,20 @@ class ItaniumCXXABI : public CodeGen::CGCXXABI { (publ
 
   bool classifyReturnType(CGFunctionInfo &FI) const override;
 
+  bool passClassIndirect(const CXXRecordDecl *RD) const {
+    // Clang <= 4 used the pre-C++11 rule, which ignores move operations.
+    // The PS4 platform ABI follows the behavior of Clang 3.2.
+    if (CGM.getCodeGenOpts().getClangABICompat() <=
+            CodeGenOptions::ClangABI::Ver4 ||
+        CGM.getTriple().getOS() == llvm::Triple::PS4)
+      return RD->hasNonTrivialDestructor() ||
+             RD->hasNonTrivialCopyConstructor();
+    return !canCopyArgument(RD);
+  }
+
   RecordArgABI getRecordArgABI(const CXXRecordDecl *RD) const override {
     // If C++ prohibits us from making a copy, pass by address.
-    if (!canCopyArgument(RD))
+    if (passClassIndirect(RD))
       return RAA_Indirect;
     return RAA_Default;
   }
@@ -996,7 +1007,7 @@ bool ItaniumCXXABI::classifyReturnType(CGFunctionInfo 
     return false;
 
   // If C++ prohibits us from making a copy, return by address.
-  if (!canCopyArgument(RD)) {
+  if (passClassIndirect(RD)) {
     auto Align = CGM.getContext().getTypeAlignInChars(FI.getReturnType());
     FI.getReturnInfo() = ABIArgInfo::getIndirect(Align, /*ByVal=*/false);
     return true;

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -183,8 +183,12 @@ const TargetInfo &ABIInfo::getTarget() const {
   return CGT.getTarget();
 }
 
-bool ABIInfo:: isAndroid() const { return getTarget().getTriple().isAndroid(); }
+const CodeGenOptions &ABIInfo::getCodeGenOpts() const {
+  return CGT.getCodeGenOpts();
+}
 
+bool ABIInfo::isAndroid() const { return getTarget().getTriple().isAndroid(); }
+
 bool ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const {
   return false;
 }
@@ -2095,9 +2099,14 @@ class X86_64ABIInfo : public SwiftABIInfo {
     return !getTarget().getTriple().isOSDarwin();
   }
 
-  /// GCC classifies <1 x long long> as SSE but compatibility with older clang
-  // compilers require us to classify it as INTEGER.
+  /// GCC classifies <1 x long long> as SSE but some platform ABIs choose to
+  /// classify it as INTEGER (for compatibility with older clang compilers).
   bool classifyIntegerMMXAsSSE() const {
+    // Clang <= 3.8 did not do this.
+    if (getCodeGenOpts().getClangABICompat() <=
+        CodeGenOptions::ClangABI::Ver3_8)
+      return false;
+
     const llvm::Triple &Triple = getTarget().getTriple();
     if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::PS4)
       return false;

Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -2855,6 +2855,9 @@ void Clang::ConstructJob(Compilation &C, const JobActi
 
   addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs);
 
+  if (auto *ABICompatArg = Args.getLastArg(options::OPT_fclang_abi_compat_EQ))
+    ABICompatArg->render(Args, CmdArgs);
+
   // Add runtime flag for PS4 when PGO or Coverage are enabled.
   if (getToolChain().getTriple().isPS4CPU())
     PS4cpu::addProfileRTArgs(getToolChain(), Args, CmdArgs);

Modified: head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -246,12 +246,12 @@ AlignTokenSequence(unsigned Start, unsigned End, unsig
 
   for (unsigned i = Start; i != End; ++i) {
     if (ScopeStack.size() != 0 &&
-        Changes[i].nestingAndIndentLevel() <
-            Changes[ScopeStack.back()].nestingAndIndentLevel())
+        Changes[i].indentAndNestingLevel() <
+            Changes[ScopeStack.back()].indentAndNestingLevel())
       ScopeStack.pop_back();
 
-    if (i != Start && Changes[i].nestingAndIndentLevel() >
-                          Changes[i - 1].nestingAndIndentLevel())
+    if (i != Start && Changes[i].indentAndNestingLevel() >
+                          Changes[i - 1].indentAndNestingLevel())
       ScopeStack.push_back(i);
 
     bool InsideNestedScope = ScopeStack.size() != 0;
@@ -327,8 +327,8 @@ static unsigned AlignTokens(const FormatStyle &Style, 
 
   // Measure the scope level (i.e. depth of (), [], {}) of the first token, and
   // abort when we hit any token in a higher scope than the starting one.
-  auto NestingAndIndentLevel = StartAt < Changes.size()
-                                   ? Changes[StartAt].nestingAndIndentLevel()
+  auto IndentAndNestingLevel = StartAt < Changes.size()
+                                   ? Changes[StartAt].indentAndNestingLevel()
                                    : std::pair<unsigned, unsigned>(0, 0);
 
   // Keep track of the number of commas before the matching tokens, we will only
@@ -359,7 +359,7 @@ static unsigned AlignTokens(const FormatStyle &Style, 
 
   unsigned i = StartAt;
   for (unsigned e = Changes.size(); i != e; ++i) {
-    if (Changes[i].nestingAndIndentLevel() < NestingAndIndentLevel)
+    if (Changes[i].indentAndNestingLevel() < IndentAndNestingLevel)
       break;
 
     if (Changes[i].NewlinesBefore != 0) {
@@ -375,7 +375,7 @@ static unsigned AlignTokens(const FormatStyle &Style, 
 
     if (Changes[i].Tok->is(tok::comma)) {
       ++CommasBeforeMatch;
-    } else if (Changes[i].nestingAndIndentLevel() > NestingAndIndentLevel) {
+    } else if (Changes[i].indentAndNestingLevel() > IndentAndNestingLevel) {
       // Call AlignTokens recursively, skipping over this scope block.
       unsigned StoppedAt = AlignTokens(Style, Matches, Changes, i);
       i = StoppedAt - 1;

Modified: head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.h
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/Format/WhitespaceManager.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -154,12 +154,11 @@ class WhitespaceManager { (public)
     const Change *StartOfBlockComment;
     int IndentationOffset;
 
-    // A combination of nesting level and indent level, which are used in
+    // A combination of indent level and nesting level, which are used in
     // tandem to compute lexical scope, for the purposes of deciding
     // when to stop consecutive alignment runs.
-    std::pair<unsigned, unsigned>
-    nestingAndIndentLevel() const {
-      return std::make_pair(Tok->NestingLevel, Tok->IndentLevel);
+    std::pair<unsigned, unsigned> indentAndNestingLevel() const {
+      return std::make_pair(Tok->IndentLevel, Tok->NestingLevel);
     }
   };
 

Modified: head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -573,6 +573,33 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, Arg
   if (!Opts.ProfileInstrumentUsePath.empty())
     setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath);
 
+  if (Arg *A = Args.getLastArg(OPT_fclang_abi_compat_EQ)) {
+    Opts.setClangABICompat(CodeGenOptions::ClangABI::Latest);
+
+    StringRef Ver = A->getValue();
+    std::pair<StringRef, StringRef> VerParts = Ver.split('.');
+    unsigned Major, Minor = 0;
+
+    // Check the version number is valid: either 3.x (0 <= x <= 9) or
+    // y or y.0 (4 <= y <= current version).
+    if (!VerParts.first.startswith("0") &&
+        !VerParts.first.getAsInteger(10, Major) &&
+        3 <= Major && Major <= CLANG_VERSION_MAJOR &&
+        (Major == 3 ? VerParts.second.size() == 1 &&
+                      !VerParts.second.getAsInteger(10, Minor)
+                    : VerParts.first.size() == Ver.size() ||
+                      VerParts.second == "0")) {
+      // Got a valid version number.
+      if (Major == 3 && Minor <= 8)
+        Opts.setClangABICompat(CodeGenOptions::ClangABI::Ver3_8);
+      else if (Major <= 4)
+        Opts.setClangABICompat(CodeGenOptions::ClangABI::Ver4);
+    } else if (Ver != "latest") {
+      Diags.Report(diag::err_drv_invalid_value)
+          << A->getAsString(Args) << A->getValue();
+    }
+  }
+
   Opts.CoverageMapping =
       Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);
   Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);

Modified: head/contrib/llvm/tools/lldb/source/Host/common/TCPSocket.cpp
==============================================================================
--- head/contrib/llvm/tools/lldb/source/Host/common/TCPSocket.cpp	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/contrib/llvm/tools/lldb/source/Host/common/TCPSocket.cpp	Fri Sep  1 18:53:36 2017	(r323112)
@@ -198,9 +198,14 @@ Status TCPSocket::Listen(llvm::StringRef name, int bac
     ::setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, option_value_p,
                  sizeof(option_value));
 
-    address.SetPort(port);
+    SocketAddress listen_address = address;
+    if(!listen_address.IsLocalhost())
+      listen_address.SetToAnyAddress(address.GetFamily(), port);
+    else
+      listen_address.SetPort(port);
 
-    int err = ::bind(fd, &address.sockaddr(), address.GetLength());
+    int err =
+        ::bind(fd, &listen_address.sockaddr(), listen_address.GetLength());
     if (-1 != err)
       err = ::listen(fd, backlog);
 

Modified: head/lib/clang/include/clang/Basic/Version.inc
==============================================================================
--- head/lib/clang/include/clang/Basic/Version.inc	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/lib/clang/include/clang/Basic/Version.inc	Fri Sep  1 18:53:36 2017	(r323112)
@@ -8,4 +8,4 @@
 
 #define	CLANG_VENDOR			"FreeBSD "
 
-#define	SVN_REVISION			"311606"
+#define	SVN_REVISION			"312293"

Modified: head/lib/clang/include/lld/Config/Version.inc
==============================================================================
--- head/lib/clang/include/lld/Config/Version.inc	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/lib/clang/include/lld/Config/Version.inc	Fri Sep  1 18:53:36 2017	(r323112)
@@ -4,5 +4,5 @@
 #define LLD_VERSION_STRING "5.0.0"
 #define LLD_VERSION_MAJOR 5
 #define LLD_VERSION_MINOR 0
-#define LLD_REVISION_STRING "311606"
+#define LLD_REVISION_STRING "312293"
 #define LLD_REPOSITORY_STRING "FreeBSD"

Modified: head/lib/clang/include/llvm/Support/VCSRevision.h
==============================================================================
--- head/lib/clang/include/llvm/Support/VCSRevision.h	Fri Sep  1 18:02:53 2017	(r323111)
+++ head/lib/clang/include/llvm/Support/VCSRevision.h	Fri Sep  1 18:53:36 2017	(r323112)
@@ -1,2 +1,2 @@
 /* $FreeBSD$ */
-#define LLVM_REVISION "svn-r311606"
+#define LLVM_REVISION "svn-r312293"


More information about the svn-src-all mailing list