[cfe-dev] Clang build issues FreeBSD + gcc 4.2

Justin Handville uniheliodem at gmail.com
Fri Sep 7 17:40:56 PDT 2007


Here's the error I'm getting during a build against trunk.  The
getTokenName function is defined in the tok namespace.  The build
results and the patch are below.  After applying the patch, the code
compiles.

$ gmake
gmake[1]: Entering directory `/llvm-trunk/tools/clang/Basic'
gmake[1]: Nothing to be done for `all'.
gmake[1]: Leaving directory `/llvm-trunk/tools/clang/Basic'
gmake[1]: Entering directory `/llvm-trunk/tools/clang/Lex'
llvm[1]: Compiling IdentifierTable.cpp for Debug build
In file included from
/llvm-trunk/tools/clang/Lex/../include/clang/Lex/MacroInfo.h:17,
                 from IdentifierTable.cpp:16:
/llvm-trunk/tools/clang/Lex/../include/clang/Lex/Token.h: In member
function 'const char* clang::Token::getName() const':
/llvm-trunk/tools/clang/Lex/../include/clang/Lex/Token.h:64: error:
'getTokenName' was not declared in this scope
gmake[1]: *** [/llvm-trunk/tools/clang/Lex/Debug/IdentifierTable.o] Error 1
gmake[1]: Leaving directory `/llvm-trunk/tools/clang/Lex'
gmake: *** [all] Error 1

$ gcc --version
gcc (GCC) 4.2.2 20070822 (prerelease)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
FreeBSD 6.2-STABLE FreeBSD 6.2-STABLE amd64

Here's the patch:

Index: include/clang/Lex/Token.h
===================================================================
--- include/clang/Lex/Token.h   (revision 41776)
+++ include/clang/Lex/Token.h   (working copy)
@@ -61,7 +61,7 @@
   void setLocation(SourceLocation L) { Loc = L; }
   void setLength(unsigned Len) { Length = Len; }

-  const char *getName() const { return getTokenName(Kind); }
+  const char *getName() const { return tok::getTokenName(Kind); }

   /// startToken - Reset all flags to cleared.
   ///



More information about the cfe-dev mailing list