[LLVMdev] Build failure for 3.4.2 in lib/Suppot/StringPool.cpp and StringMap.h, compiler can't resolve overload

John Reagan johnrreagan at earthlink.net
Wed May 13 08:50:45 PDT 2015


Hi all,

I'm attempting to build LLVM 3.4.2 on OpenVMS I64 for an eventual port of
OpenVMS to x86.  I'm using 3.4.2 since the C++ compiler I have (Intel-based)
is only C++98 with no chance of C++11 (we'll bootstrap something newer down
the road on a native system using the compiler I'm trying to build now).
I've been able to get many of the files to compile but I'm stuck on
StringPool.cpp (I've noticed that this area has undergone changes in 3.5 and
3.6).  The compiler is complaining that it can't determine which "create" to
use when compiling it.

I'm sure the compiler is confused (buggy) and I'm looking for some source
changes I can make locally to get it to compile.  I'm confused on the
templates and need some expert assistance please.  I looked at lifting later
changes but I wasn't sure which ones to grab without opening a can of worms.

Thanks much for helping me out.

John



Here's the error the compiler gives me when compiling StringPool.cpp.  One
of those is surely the right create, but how can I tell that to the
compiler?

    return Create(KeyStart, KeyEnd, ValueTy());
...........^
%CXX-E-AMBOVLFUN, more than one instance of overloaded function
          "llvm::StringMapEntry<ValueTy>::Create [with
          ValueTy=llvm::StringPool::PooledString]" matches the argument
list:
            function template "llvm::StringMapEntry<ValueTy>::Create(const
                      char *, const char *, AllocatorTy &) [with
                      ValueTy=llvm::StringPool::PooledString]"
            function template "llvm::StringMapEntry<ValueTy>::Create(const
                      char *, const char *, InitType) [with
                      ValueTy=llvm::StringPool::PooledString]"
            argument types are: (const char *, const char *,
                      llvm::StringPool::PooledString)
          detected during instantiation of "llvm::StringMapEntry<ValueTy>
                    *llvm::StringMapEntry<ValueTy>::Create(const char *,
const
                    char *) [with ValueTy=llvm::StringPool::PooledString]"
at
                    line 30 of
                    "/home/reagan/llvm-342/lib/Support/StringPool.cpp"
at line number 191 in file
/home/reagan/llvm-342/include/llvm/ADT/StringMap.h

The snipet of source from StringPool.cpp (line 30) is:

PooledStringPtr StringPool::intern(StringRef Key) {
  table_t::iterator I = InternTable.find(Key);
  if (I != InternTable.end())
    return PooledStringPtr(&*I);

  entry_t *S = entry_t::Create(Key.begin(), Key.end()); // Line 30
  S->getValue().Pool = this;
  InternTable.insert(S);

  return PooledStringPtr(S);
}

And the snipet of source from StringMap.h is (line 191) is:

  template<typename AllocatorTy>
  static StringMapEntry *Create(const char *KeyStart, const char *KeyEnd,
                                AllocatorTy &Allocator) {
    return Create(KeyStart, KeyEnd, Allocator, 0);
  }

  /// Create - Create a StringMapEntry with normal malloc/free.
  template<typename InitType>
  static StringMapEntry *Create(const char *KeyStart, const char *KeyEnd,
                                InitType InitVal) {
    MallocAllocator A;
    return Create(KeyStart, KeyEnd, A, InitVal);
  }

  static StringMapEntry *Create(const char *KeyStart, const char *KeyEnd) {
    return Create(KeyStart, KeyEnd, ValueTy());  // Line 191
  }






More information about the llvm-dev mailing list