[LLVMdev] Problem using llvm::cl::bits class with gcc 4.7

Delcypher delcypher at gmail.com
Fri Sep 14 08:43:19 PDT 2012


Hi,

I'm currently working on the KLEE tool that uses LLVM (2.9 because that's
what KLEE currently uses) and in particular I'm having an unexpected
problem with the llvm::cl::bits class. I try something like this...

  enum testx
  {
  A,B
  };
  cl::bits<testx> queryLoggingOptions("option",cl::values(
       clEnumVal(A,"this is a"),
       clEnumVal(B,"this is b"),
       clEnumValEnd
    )

  );

And when I compile (gcc 4.7.1 20120721 (prerelease) ) I get an error like
this...

In file included from
/home/dan/documents/projects/project/klee/src/lib/Core/Executor.cpp:60:0:
/home/dan/documents/projects/project/llvm-2.9/src/include/llvm/Support/CommandLine.h:
In instantiation of ‘bool llvm::cl::bits<DataType, Storage,
ParserClass>::handleOccurrence(unsigned int, llvm::StringRef,
llvm::StringRef) [with DataType = {anonymous}::testx; Storage = bool;
ParserClass = llvm::cl::parser<{anonymous}::testx>]’:
/home/dan/documents/projects/project/klee/src/lib/Core/Executor.cpp:3448:1:
  required from here
/home/dan/documents/projects/project/llvm-2.9/src/include/llvm/Support/CommandLine.h:1220:5:
error: ‘addValue’ was not declared in this scope, and no declarations were
found by argument-dependent lookup at the point of instantiation
[-fpermissive]
/home/dan/documents/projects/project/llvm-2.9/src/include/llvm/Support/CommandLine.h:1220:5:
note: declarations in dependent base
‘llvm::cl::bits_storage<{anonymous}::testx, bool>’ are not found by
unqualified lookup
/home/dan/documents/projects/project/llvm-2.9/src/include/llvm/Support/CommandLine.h:1220:5:
note: use ‘this->addValue’ instead
/bin/rm: cannot remove
‘/home/dan/documents/projects/project/klee/bin-rel/lib/Core/Release+Asserts/Executor.d.tmp’:
No such file or directory

I think this is related to "Name Look up Change" in
http://gcc.gnu.org/gcc-4.7/porting_to.html . Indeed if I modify LLVM 2.9's
header file to use ``this->addValue()'' instead of ``addValue()'' I can
than successfully compile.

Is there anyway round this because I don't really want to have to patch
LLVM's header files specially for KLEE. I took a look at the latest LLVM
code (
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Support/CommandLine.h#1512
)
and the line that's causing me compile problems doesn't seem to have
changed. Does that mean that no one else has had the problem or am I doing
something very wrong?

Regards,
Dan Liew.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120914/05edd122/attachment.html>


More information about the llvm-dev mailing list