<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 20, 2010, at 1:02 AM, Simone Pellegrini wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div bgcolor="#ffffff" text="#000000">
On 04/20/2010 09:25 AM, Douglas Gregor wrote:
<blockquote cite="mid:B4B567CD-01E8-4443-85D3-CFACFDA17BB6@apple.com" type="cite">
  <pre wrap="">On Apr 20, 2010, at 12:03 AM, Simone Pellegrini wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi all,
I was wondering if C++ support will be enabled by default in this 
release or we would have to wait the next release (2.8).

and if not, is there any way to enable it?
    </pre>
  </blockquote>
  <pre wrap="">C++ support is enabled by default in 2.7. 
  </pre>
</blockquote>
What I am doing is using clang as a library so I cannot use the clang
driver directly. <br>
<br>
I manually instantiate a CompilerInstance and feed C++ code and get the
following error:<br>
<br>
error: unknown type name 'class'<br>
<br>
I also tried to feed the "-ccc-clang-cxx" flag as suggested in:

<a href="http://clang.llvm.org/docs/UsersManual.html#cxx">http://clang.llvm.org/docs/UsersManual.html#cxx</a><br>
but it didn't help. <br>
<br>
The actual code I use to instantiate a compiler is the following:<br>
<br>
CompilerInstance Clang;<br>
Clang.setLLVMContext(new llvm::LLVMContext);<br>
Clang.createDiagnostics(argc, argv);<br>
            <br>
Clang.setFileManager(&FileMgr);<br>
Clang.createSourceManager();<br>
<br>
Clang.InitializeSourceManager(File->getName());<br>
 <br>
// Add the default clang system headers<br>
Clang.getHeaderSearchOpts().AddPath(
"/software/llvm-2.7/lib/clang/1.1/include/", clang::frontend::System,
true, false );<br>
// add user headers<br>
for (size_t i = 0; i < Flags::I_dirs.size(); ++i)<br>
       Clang.getHeaderSearchOpts().AddPath( Flags::I_dirs[i],
clang::frontend::Angled, true, false);<br>
<br>
TargetOptions TO;<br>
TO.Triple = llvm::Triple("x86_64", "PC", "Linux").getTriple();<br>
Clang.setTarget( TargetInfo::CreateTargetInfo (Clang.getDiagnostics(),
TO) );<br>
<br>
// A compiler invocation object has to be created in order for the
diagnostics to work<br>
CompilerInvocation* CI = new CompilerInvocation; // CompilerInvocation
will be deleted by CompilerInstance<br>
<br>
const char* arg = "ccc-clang-cxx";<br>
CompilerInvocation::CreateFromArgs(*CI, &arg, &arg+1,
Clang.getDiagnostics());<br>
Clang.setInvocation(CI);<br>
<br>
Clang.createPreprocessor();<br>
Clang.createASTContext();<br>
 <br>
...<br>
<br>
what am I doing wrong? The code works perfectly for C programs!!<br></div></blockquote></div><br><div>I don't see where you're setting the LangOption bit that tells it to compile C++ code.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div></body></html>