aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Expression/ExpressionSourceCode.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-02-13 23:57:48 +0000
committerGreg Clayton <gclayton@apple.com>2013-02-13 23:57:48 +0000
commit399107a9365f40d82804be46a08820f72dbef6f5 (patch)
tree995ad5ec7e370468053d18d6e12ff8306d9131a5 /lldb/source/Expression/ExpressionSourceCode.cpp
parent090edf7e67226b32a478ea67e11d324f95090252 (diff)
downloadllvm-399107a9365f40d82804be46a08820f72dbef6f5.zip
llvm-399107a9365f40d82804be46a08820f72dbef6f5.tar.gz
llvm-399107a9365f40d82804be46a08820f72dbef6f5.tar.bz2
Centralized the expression prefixes that are used for both expressions and utility functions.
llvm-svn: 175108
Diffstat (limited to 'lldb/source/Expression/ExpressionSourceCode.cpp')
-rw-r--r--lldb/source/Expression/ExpressionSourceCode.cpp60
1 files changed, 31 insertions, 29 deletions
diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp
index 835d9d7..0c66831 100644
--- a/lldb/source/Expression/ExpressionSourceCode.cpp
+++ b/lldb/source/Expression/ExpressionSourceCode.cpp
@@ -13,31 +13,33 @@
using namespace lldb_private;
-static const char *global_defines =
-"#undef NULL \n"
-"#undef Nil \n"
-"#undef nil \n"
-"#undef YES \n"
-"#undef NO \n"
-"#define NULL (__null) \n"
-"#define Nil (__null) \n"
-"#define nil (__null) \n"
-"#define YES ((BOOL)1) \n"
-"#define NO ((BOOL)0) \n"
-"typedef signed char BOOL; \n"
-"typedef signed __INT8_TYPE__ int8_t;\n"
-"typedef unsigned __INT8_TYPE__ uint8_t;\n"
-"typedef signed __INT16_TYPE__ int16_t;\n"
-"typedef unsigned __INT16_TYPE__ uint16_t;\n"
-"typedef signed __INT32_TYPE__ int32_t;\n"
-"typedef unsigned __INT32_TYPE__ uint32_t;\n"
-"typedef signed __INT64_TYPE__ int64_t;\n"
-"typedef unsigned __INT64_TYPE__ uint64_t;\n"
-"typedef signed __INTPTR_TYPE__ intptr_t;\n"
-"typedef unsigned __INTPTR_TYPE__ uintptr_t;\n"
-"typedef __SIZE_TYPE__ size_t; \n"
-"typedef __PTRDIFF_TYPE__ ptrdiff_t;\n"
-"typedef unsigned short unichar;\n";
+const char *
+ExpressionSourceCode::g_expression_prefix = R"(
+#undef NULL
+#undef Nil
+#undef nil
+#undef YES
+#undef NO
+#define NULL (__null)
+#define Nil (__null)
+#define nil (__null)
+#define YES ((BOOL)1)
+#define NO ((BOOL)0)
+typedef signed char BOOL;
+typedef signed __INT8_TYPE__ int8_t;
+typedef unsigned __INT8_TYPE__ uint8_t;
+typedef signed __INT16_TYPE__ int16_t;
+typedef unsigned __INT16_TYPE__ uint16_t;
+typedef signed __INT32_TYPE__ int32_t;
+typedef unsigned __INT32_TYPE__ uint32_t;
+typedef signed __INT64_TYPE__ int64_t;
+typedef unsigned __INT64_TYPE__ uint64_t;
+typedef signed __INTPTR_TYPE__ intptr_t;
+typedef unsigned __INTPTR_TYPE__ uintptr_t;
+typedef __SIZE_TYPE__ size_t;
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef unsigned short unichar;
+)";
bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method) const
@@ -69,7 +71,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
" %s; \n"
"} \n",
m_prefix.c_str(),
- global_defines,
+ g_expression_prefix,
m_name.c_str(),
m_body.c_str());
break;
@@ -82,7 +84,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
" %s; \n"
"} \n",
m_prefix.c_str(),
- global_defines,
+ g_expression_prefix,
m_name.c_str(),
(const_object ? "const" : ""),
m_body.c_str());
@@ -102,7 +104,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
"} \n"
"@end \n",
m_prefix.c_str(),
- global_defines,
+ g_expression_prefix,
m_name.c_str(),
m_name.c_str(),
m_body.c_str());
@@ -121,7 +123,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
"} \n"
"@end \n",
m_prefix.c_str(),
- global_defines,
+ g_expression_prefix,
m_name.c_str(),
m_name.c_str(),
m_body.c_str());