Added support for the fragile ivars provided by
Apple's Objective-C 2.0 runtime.  They are enabled
if the Objective-C runtime has the proper version.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123694 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionParser.cpp b/source/Expression/ClangExpressionParser.cpp
index 77fff8a..adc5a9e 100644
--- a/source/Expression/ClangExpressionParser.cpp
+++ b/source/Expression/ClangExpressionParser.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Expression/IRToDWARF.h"
 #include "lldb/Expression/RecordingMemoryManager.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 
@@ -177,6 +178,7 @@
 //===----------------------------------------------------------------------===//
 
 ClangExpressionParser::ClangExpressionParser(const char *target_triple,
+                                             Process *process,
                                              ClangExpression &expr) :
     m_expr(expr),
     m_target_triple (),
@@ -211,10 +213,18 @@
     // Setup objective C
     m_compiler->getLangOpts().ObjC1 = true;
     m_compiler->getLangOpts().ObjC2 = true;
-    // We need to enable the fragile ABI for things target triples that
-    // support it. 
-//    m_compiler->getLangOpts().ObjCNonFragileABI = true;     // NOT i386
-//    m_compiler->getLangOpts().ObjCNonFragileABI2 = true;    // NOT i386
+    
+    if (process)
+    {
+        if (process->GetObjCLanguageRuntime())
+        {
+            if (process->GetObjCLanguageRuntime()->GetRuntimeVersion() == lldb::eAppleObjC_V2)
+            {
+                m_compiler->getLangOpts().ObjCNonFragileABI = true;     // NOT i386
+                m_compiler->getLangOpts().ObjCNonFragileABI2 = true;    // NOT i386
+            }
+        }
+    }
 
     m_compiler->getLangOpts().ThreadsafeStatics = false;
     m_compiler->getLangOpts().AccessControl = false; // Debuggers get universal access