The memory management of TargetOptions has changed in recent clangs.
Taking TargetOptions from the CompilerInstance seems to work in both
older and newer versions of clang.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Clang->setInvocation(invocation);
Clang->createFileManager();
Clang->createSourceManager(Clang->getFileManager());
- TargetOptions TO;
+ TargetOptions &TO = Clang->getTargetOpts();
TO.Triple = llvm::sys::getDefaultTargetTriple();
TargetInfo *target = TargetInfo::CreateTargetInfo(Diags, TO);
Clang->setTarget(target);