[clang] 123f811 - Try to unbreak Win build after 973519826edb76

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 2 09:07:06 PDT 2021


Author: Nico Weber
Date: 2021-09-02T12:06:53-04:00
New Revision: 123f811fe5b0ba33f271c1c6172e6dff1463717a

URL: https://github.com/llvm/llvm-project/commit/123f811fe5b0ba33f271c1c6172e6dff1463717a
DIFF: https://github.com/llvm/llvm-project/commit/123f811fe5b0ba33f271c1c6172e6dff1463717a.diff

LOG: Try to unbreak Win build after 973519826edb76

Apparently some versions of the MS STL don't like constructing a
vector from a StringMapKeyIterator<>: http://45.33.8.238/win/44999/step_4.txt
It builds fine with the MS STL on my Windows box, so just sidestep the issue.

Full error for posterity:

    VC\Tools\MSVC\14.14.26428\include\xmemory(218,75):
      error: indirection requires pointer operand ('const llvm::StringMapKeyIterator<llvm::StringRef>' invalid)
          _Uses_default_construct_t<_Alloc, decltype(_Unfancy(_UDest)), decltype(*_UFirst)>())));
    VC\Tools\MSVC\14.14.26428\include\vector(1922,11):
      note: in instantiation of function template specialization 'std::_Uninitialized_copy<...>' requested here
                    return (_Uninitialized_copy(_First, _Last, _Dest, this->_Getal()));
    VC\Tools\MSVC\14.14.26428\include\vector(757,22):
      note: in instantiation of function template specialization
            'std::vector<llvm::StringRef>::_Ucopy<llvm::StringMapKeyIterator<llvm::StringRef>>' requested here
                            this->_Mylast() = _Ucopy(_First, _Last, this->_Myfirst());
    VC\Tools\MSVC\14.14.26428\include\vector(772,3):
      note: in instantiation of function template specialization
            'std::vector<llvm::StringRef>::_Range_construct_or_tidy<llvm::StringMapKeyIterator<llvm::StringRef>>' requested here
                    _Range_construct_or_tidy(_Unchecked(_First), _Unchecked(_Last), _Iter_cat_t<_Iter>{});
    ../../clang/lib/Driver/ToolChains/Arch/X86.cpp(62,30):
      note: in instantiation of function template specialization
            'std::vector<llvm::StringRef>::vector<llvm::StringMapKeyIterator<llvm::StringRef>, void>' requested here
          std::vector<StringRef> ValidArchs{ArchMap.keys().begin(),

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Arch/X86.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index bfa008f964e19..2e43c455b28fd 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,8 +59,9 @@ std::string x86::getX86TargetCPU(const Driver &D, const ArgList &Args,
     }
     StringRef CPU = ArchMap.lookup(A->getValue());
     if (CPU.empty()) {
-      std::vector<StringRef> ValidArchs{ArchMap.keys().begin(),
-                                        ArchMap.keys().end()};
+      std::vector<StringRef> ValidArchs;
+      for (StringRef Key : ArchMap.keys())
+        ValidArchs.push_back(Key);
       sort(ValidArchs);
       D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
           << A->getValue() << (Triple.getArch() == llvm::Triple::x86)


        


More information about the cfe-commits mailing list