xref: /Universal-ctags/parsers/cxx/cxx_debug.h (revision 782707ae37e9c747dc15497ca30d1a6befa28861)
1 #ifndef ctags_cxx_debug_h_
2 #define ctags_cxx_debug_h_
3 /*
4 *   Copyright (c) 2016, Szymon Tomasz Stefanek
5 *
6 *   This source code is released for free distribution under the terms of the
7 *   GNU General Public License version 2 or (at your option) any later version.
8 *
9 *   This module contains functions for parsing and scanning C++ source files
10 */
11 
12 #include "general.h"
13 #include "debug.h"
14 #include "trace.h"
15 #include "cxx_token.h"
16 #include "cxx_scope.h"
17 
18 #if defined(DO_TRACING)
19 	#define CXX_DO_DEBUGGING
20 #endif
21 
22 #ifdef CXX_DO_DEBUGGING
23 
24 const char* cxxDebugTypeDecode(enum CXXTokenType);
25 void cxxDebugDumpToken (CXXToken *pToken);
26 void cxxDebugDumpChain (CXXTokenChain *pChain);
27 const char* cxxDebugScopeDecode(enum CXXScopeType);
28 
29 #define CXX_DEBUG_ENTER() TRACE_ENTER()
30 #define CXX_DEBUG_LEAVE() TRACE_LEAVE()
31 
32 #define CXX_DEBUG_ENTER_TEXT(_szFormat,...) \
33 	TRACE_ENTER_TEXT(_szFormat,## __VA_ARGS__)
34 
35 #define CXX_DEBUG_LEAVE_TEXT(_szFormat,...) \
36 	TRACE_LEAVE_TEXT(_szFormat,## __VA_ARGS__)
37 
38 #define CXX_DEBUG_PRINT(_szFormat,...) \
39 	TRACE_PRINT(_szFormat,## __VA_ARGS__)
40 
41 #define CXX_DEBUG_ASSERT(_condition,_szFormat,...) \
42 	TRACE_ASSERT(_condition,_szFormat,## __VA_ARGS__)
43 
44 #define CXX_DEBUG_TOKEN(T)  cxxDebugDumpToken(T)
45 #define CXX_DEBUG_CHAIN(C)  cxxDebugDumpChain(C)
46 #else //!CXX_DO_DEBUGGING
47 
48 #define CXX_DEBUG_ENTER() do { } while(0)
49 #define CXX_DEBUG_LEAVE() do { } while(0)
50 
51 #define CXX_DEBUG_ENTER_TEXT(_szFormat,...) do { } while(0)
52 #define CXX_DEBUG_LEAVE_TEXT(_szFormat,...) do { } while(0)
53 
54 #define CXX_DEBUG_PRINT(_szFormat,...) do { } while(0)
55 
56 #define CXX_DEBUG_ASSERT(_condition,_szFormat,...) do { } while(0)
57 
58 #define CXX_DEBUG_TOKEN(T) do { } while(0)
59 #define CXX_DEBUG_CHAIN(T) do { } while(0)
60 #endif //!CXX_DO_DEBUGGING
61 
62 
63 #endif //!ctags_cxx_debug_h_
64