1 //===-- ExpressionSourceCode.cpp --------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Expression/ExpressionSourceCode.h"
12 #include "lldb/Core/StreamString.h"
14 using namespace lldb_private;
17 ExpressionSourceCode::g_expression_prefix = R"(
28 typedef signed char BOOL;
29 typedef signed __INT8_TYPE__ int8_t;
30 typedef unsigned __INT8_TYPE__ uint8_t;
31 typedef signed __INT16_TYPE__ int16_t;
32 typedef unsigned __INT16_TYPE__ uint16_t;
33 typedef signed __INT32_TYPE__ int32_t;
34 typedef unsigned __INT32_TYPE__ uint32_t;
35 typedef signed __INT64_TYPE__ int64_t;
36 typedef unsigned __INT64_TYPE__ uint64_t;
37 typedef signed __INTPTR_TYPE__ intptr_t;
38 typedef unsigned __INTPTR_TYPE__ uintptr_t;
39 typedef __SIZE_TYPE__ size_t;
40 typedef __PTRDIFF_TYPE__ ptrdiff_t;
41 typedef unsigned short unichar;
45 bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method) const
49 switch (wrapping_language)
53 case lldb::eLanguageTypeC:
54 case lldb::eLanguageTypeC_plus_plus:
55 case lldb::eLanguageTypeObjC:
59 StreamString wrap_stream;
61 switch (wrapping_language)
65 case lldb::eLanguageTypeC:
66 wrap_stream.Printf("%s \n"
69 "%s(void *$__lldb_arg) \n"
78 case lldb::eLanguageTypeC_plus_plus:
79 wrap_stream.Printf("%s \n"
82 "$__lldb_class::%s(void *$__lldb_arg) %s\n"
89 (const_object ? "const" : ""),
92 case lldb::eLanguageTypeObjC:
95 wrap_stream.Printf("%s \n"
97 "@interface $__lldb_objc_class ($__lldb_category) \n"
98 "+(void)%s:(void *)$__lldb_arg; \n"
100 "@implementation $__lldb_objc_class ($__lldb_category) \n"
101 "+(void)%s:(void *)$__lldb_arg \n"
114 wrap_stream.Printf("%s \n"
116 "@interface $__lldb_objc_class ($__lldb_category) \n"
117 "-(void)%s:(void *)$__lldb_arg; \n"
119 "@implementation $__lldb_objc_class ($__lldb_category) \n"
120 "-(void)%s:(void *)$__lldb_arg \n"
134 text = wrap_stream.GetString();