1 : //
2 : // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 : // Use of this source code is governed by a BSD-style license that can be
4 : // found in the LICENSE file.
5 : //
6 :
7 : // compilerdebug.cpp: Debugging utilities.
8 :
9 : #include "compiler/compilerdebug.h"
10 :
11 : #include <stdarg.h>
12 : #include <stdio.h>
13 :
14 : #include "compiler/ParseHelper.h"
15 :
16 : static const int kTraceBufferLen = 1024;
17 :
18 : #ifdef TRACE_ENABLED
19 : extern "C" {
20 0 : void Trace(const char *format, ...) {
21 0 : if (!format) return;
22 :
23 0 : TParseContext* parseContext = GetGlobalParseContext();
24 0 : if (parseContext) {
25 : char buf[kTraceBufferLen];
26 : va_list args;
27 0 : va_start(args, format);
28 0 : vsnprintf(buf, kTraceBufferLen, format, args);
29 0 : va_end(args);
30 :
31 0 : parseContext->infoSink.debug << buf;
32 : }
33 : }
34 : } // extern "C"
35 : #endif // TRACE_ENABLED
36 :
|