Can't resolve Sema::ActOnClassTemplate, clang-cc build fail

Hi,

Yes, I post again...

Today I was trying to build clang revision 69421 and fail with the
message like this:

2>clangSema.lib(ParseAST.obj) : error LNK2001: external symbol could
not be resolved(ah, my visual studio is not english version, and my
english is poor)
"public: virtual class clang::ActionBase::ActionResult<5,class
clang::OpaquePtr<0>,1> __thiscall
clang::Sema::ActOnClassTemplate(class clang::Scope *,unsigned int,enum
clang::Action::TagKind,class clang::SourceLocation,class
clang::CXXScopeSpec const &,class clang::IdentifierInfo *,class
clang::SourceLocation,class clang::AttributeList *,

class clang::ASTMultiPtr<&[thunk]: __thiscall
clang::ExternalASTSource::`vcall'{12,{flat}}' }'>,

ether zhhb wrote:

Hi,

Yes, I post again...

Today I was trying to build clang revision 69421 and fail with the
message like this:
  

I'll get to my Windows system tonight and try this out. Looks mysterious.

Sebastian

I try to comment

Sema S(PP, Ctx, *Consumer, CompleteTranslationUnit);

in ParseAST.cpp at line 40 and change

Parser P(PP, S);

in ParseAST.cpp at line 41 to

Parser P(PP, *((Sema *)0));

and then build it, it could be build without error message.

It seem that something wrong in the constructor of Sema? but I can't
see any reference to "ActOnClassTemplate" there.

The only thing that's wrong is the MS compiler. I've looked into it, and
I'm quite certain it's a miscompilation. I generated the assembly listing
for ParseAST.cpp, and it indeed contains an external reference to the
mystery function, but there's no motivation for it. A search of the entire
source base reveals that ASTMultiPtr and ExternalASTSource never get within
a mile of each other.

I wonder ... perhaps a string hash being used incorrectly in the compiler?

Anyway, this is too absurd for me. I've tried changing the name of
ExternalASTSource, but it didn't help. I suggest you contact Microsoft
support.

Sebastian

Thank you for reply.

Last night I try to dump the clangSema.lib and found the same thing,
at last I comment those functions, and I could compile it without
error. so I think the error occur due to the compiler doing some
magical things to the header file.

This morning I just move the statement of including Sema.h to the head
of the include list, and everything is OK :slight_smile:

ParseAST.patch (566 Bytes)

I'd prefer to keep the include of parseast.h first. Does this work though?
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090413/015845.html

-Chris

Yes, it's ok, too.