summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionParser.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-11-07 23:35:40 +0000
committerSean Callanan <scallanan@apple.com>2011-11-07 23:35:40 +0000
commitc7b650670e4c0c8ac87cad2afc8566859f71645c (patch)
tree6a0f7df9084a1cffc51726f40e0d39bcead5d0e4 /lldb/source/Expression/ClangExpressionParser.cpp
parent82695d6259f5767406ce9dd52b920e38a875729e (diff)
downloadbcm5719-llvm-c7b650670e4c0c8ac87cad2afc8566859f71645c.tar.gz
bcm5719-llvm-c7b650670e4c0c8ac87cad2afc8566859f71645c.zip
Added a language parameter to the expression parser,
which will in the future allow expressions to be compiled as C, C++, and Objective-C instead of the current default Objective-C++. This feature requires some additional support from Clang -- specifically, it requires reference types in the parser regardless of language -- so it is not yet exposed to the user. llvm-svn: 144042
Diffstat (limited to 'lldb/source/Expression/ClangExpressionParser.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionParser.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp
index d040cd84891..ae55cadc392 100644
--- a/lldb/source/Expression/ClangExpressionParser.cpp
+++ b/lldb/source/Expression/ClangExpressionParser.cpp
@@ -204,19 +204,32 @@ ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
// 2. Set options.
- // Parse expressions as Objective C++ regardless of context.
- // Our hook into Clang's lookup mechanism only works in C++.
- m_compiler->getLangOpts().CPlusPlus = true;
+ lldb::LanguageType language = expr.Language();
- // Setup objective C
- m_compiler->getLangOpts().ObjC1 = true;
- m_compiler->getLangOpts().ObjC2 = true;
+ switch (language)
+ {
+ case lldb::eLanguageTypeC:
+ break;
+ case lldb::eLanguageTypeObjC:
+ m_compiler->getLangOpts().ObjC1 = true;
+ m_compiler->getLangOpts().ObjC2 = true;
+ break;
+ case lldb::eLanguageTypeC_plus_plus:
+ m_compiler->getLangOpts().CPlusPlus = true;
+ break;
+ case lldb::eLanguageTypeObjC_plus_plus:
+ default:
+ m_compiler->getLangOpts().ObjC1 = true;
+ m_compiler->getLangOpts().ObjC2 = true;
+ m_compiler->getLangOpts().CPlusPlus = true;
+ break;
+ }
Process *process = NULL;
if (exe_scope)
process = exe_scope->CalculateProcess();
- if (process)
+ if (process && m_compiler->getLangOpts().ObjC1)
{
if (process->GetObjCLanguageRuntime())
{
OpenPOWER on IntegriCloud