From ab2a421db00fc81a8bd99f0beb04a7c39a8017e0 Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Wed, 26 Oct 2011 12:26:54 +0000
Subject: [PATCH] Initialize langopts more closely to what Tools.cpp
 (Clang::ConstructJob) is doing, to end up with a compatible LangOpt set in
 cling and PCHs.

git-svn-id: http://root.cern.ch/svn/root/trunk@41593 27541ba8-7e3a-0410-8455-c3a389f83636
---
 cint/cling/lib/Interpreter/CIFactory.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/cint/cling/lib/Interpreter/CIFactory.cpp b/cint/cling/lib/Interpreter/CIFactory.cpp
index bbc67e0fdb7..f74c74e4dee 100644
--- a/cint/cling/lib/Interpreter/CIFactory.cpp
+++ b/cint/cling/lib/Interpreter/CIFactory.cpp
@@ -168,6 +168,10 @@ namespace cling {
 
   void CIFactory::SetClingCustomLangOpts(LangOptions& Opts) {
     Opts.EmitAllDecls = 1;
+    Opts.ObjCNonFragileABI2 = 0;
+    Opts.Exceptions = 1;
+    Opts.CXXExceptions = 1;
+    Opts.Deprecated = 1;
   }
 
   void CIFactory::SetClingTargetLangOpts(LangOptions& Opts, 
@@ -177,6 +181,18 @@ namespace cling {
       Opts.MSCVersion = 1300;
       // Should fix http://llvm.org/bugs/show_bug.cgi?id=10528
       Opts.DelayedTemplateParsing = 1;
+    } else {
+      Opts.MicrosoftExt = 0;
+    }
+    if (Target.getTriple().getArch() == llvm::Triple::x86) {
+       Opts.ObjCNonFragileABI = 1;
+    } else {
+       Opts.ObjCNonFragileABI = 0;
+    }
+    if (Target.getTriple().isOSDarwin()) {
+       Opts.NeXTRuntime = 1;
+    } else {
+       Opts.NeXTRuntime = 0;
     }
   }
 } // end namespace
-- 
GitLab