interface/extract_interface.cc: take TargetOptions object from CompilerInstance
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 23 Nov 2012 20:25:11 +0000 (21:25 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 23 Nov 2012 20:25:15 +0000 (21:25 +0100)
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>
interface/extract_interface.cc

index 9154222..f39febc 100644 (file)
@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
                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);