Commit 52710258 by Olli Etuaho

Remove separate compilerdebug.h in favor of debug.h

This unifies the behavior across the compiler and rest of ANGLE - for example, one can use #define ANGLE_TEST_CONFIG to disable UNIMPLEMENTED asserts in both the compiler and the rest of ANGLE. Compiler traces from asserts also go to the same TRACE_OUTPUT_FILE as other traces instead of being directed through ParseContext. The compiler build already includes the common sources, so no changes to build config are needed. TEST=angle_unittests, angle_end2end_tests, dEQP-GLES3.functional.shaders.* BUG=angleproject:983 Change-Id: Ifca4d16f667b1e5cf9c2e7cc4139940091917a1c Reviewed-on: https://chromium-review.googlesource.com/266993Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 2a7ffe16
......@@ -113,8 +113,6 @@
'compiler/translator/VersionGLSL.h',
'compiler/translator/blocklayout.cpp',
'compiler/translator/blocklayout.h',
'compiler/translator/compilerdebug.cpp',
'compiler/translator/compilerdebug.h',
'compiler/translator/depgraph/DependencyGraph.cpp',
'compiler/translator/depgraph/DependencyGraph.h',
'compiler/translator/depgraph/DependencyGraphBuilder.cpp',
......
......@@ -7,7 +7,7 @@
#ifndef COMPILER_TRANSLATOR_BASETYPES_H_
#define COMPILER_TRANSLATOR_BASETYPES_H_
#include "compiler/translator/compilerdebug.h"
#include "common/debug.h"
//
// Precision qualifiers
......
......@@ -14,9 +14,9 @@
#include <limits>
#include <stdio.h>
#include "compiler/translator/PoolAlloc.h"
#include "compiler/translator/compilerdebug.h"
#include "common/angleutils.h"
#include "common/debug.h"
#include "compiler/translator/PoolAlloc.h"
struct TSourceLoc {
int first_file;
......
......@@ -6,7 +6,7 @@
#include "compiler/translator/Diagnostics.h"
#include "compiler/translator/compilerdebug.h"
#include "common/debug.h"
#include "compiler/translator/InfoSink.h"
#include "compiler/preprocessor/SourceLocation.h"
......@@ -50,11 +50,6 @@ void TDiagnostics::writeInfo(Severity severity,
sink << "'" << token << "' : " << reason << " " << extra << "\n";
}
void TDiagnostics::writeDebug(const std::string& str)
{
mInfoSink.debug << str;
}
void TDiagnostics::print(ID id,
const pp::SourceLocation& loc,
const std::string& text)
......
......@@ -29,8 +29,6 @@ class TDiagnostics : public pp::Diagnostics, angle::NonCopyable
const std::string& token,
const std::string& extra);
void writeDebug(const std::string& str);
protected:
virtual void print(ID id,
const pp::SourceLocation& loc,
......
......@@ -8,7 +8,7 @@
#include <sstream>
#include "compiler/translator/compilerdebug.h"
#include "common/debug.h"
#include "compiler/translator/Diagnostics.h"
static TBehavior getBehavior(const std::string& str)
......
......@@ -5,7 +5,8 @@
//
#include "compiler/translator/InitializeVariables.h"
#include "compiler/translator/compilerdebug.h"
#include "common/debug.h"
namespace
{
......
......@@ -5,7 +5,8 @@
//
#include "compiler/translator/OutputGLSLBase.h"
#include "compiler/translator/compilerdebug.h"
#include "common/debug.h"
#include <cfloat>
......
......@@ -11,6 +11,7 @@
#include <stdio.h>
#include "common/angleutils.h"
#include "common/debug.h"
#include "common/utilities.h"
#include "compiler/translator/BuiltInFunctionEmulator.h"
#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h"
......@@ -26,7 +27,6 @@
#include "compiler/translator/UniformHLSL.h"
#include "compiler/translator/UtilsHLSL.h"
#include "compiler/translator/blocklayout.h"
#include "compiler/translator/compilerdebug.h"
#include "compiler/translator/util.h"
namespace sh
......
......@@ -198,11 +198,6 @@ void TParseContext::warning(const TSourceLoc& loc,
srcLoc, reason, token, extraInfo);
}
void TParseContext::trace(const char* str)
{
diagnostics.writeDebug(str);
}
//
// Same error message for all places assignments don't work.
//
......
......@@ -78,7 +78,6 @@ struct TParseContext {
const char* extraInfo="");
void warning(const TSourceLoc& loc, const char* reason, const char* token,
const char* extraInfo="");
void trace(const char* str);
void recover();
// This method is guaranteed to succeed, even if no variable with 'name' exists.
......
......@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
#include "common/debug.h"
#include "compiler/translator/RegenerateStructNames.h"
#include "compiler/translator/compilerdebug.h"
void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
{
......
......@@ -4,8 +4,8 @@
// found in the LICENSE file.
//
#include "common/debug.h"
#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h"
#include "compiler/translator/compilerdebug.h"
#include <algorithm>
......
......@@ -9,7 +9,7 @@
#include <GLSLANG/ShaderLang.h>
#include "compiler/translator/compilerdebug.h"
#include "common/debug.h"
namespace sh
{
......
......@@ -8,10 +8,10 @@
#define COMPILER_TRANSLATOR_TYPES_H_
#include "common/angleutils.h"
#include "common/debug.h"
#include "compiler/translator/BaseTypes.h"
#include "compiler/translator/Common.h"
#include "compiler/translator/compilerdebug.h"
struct TPublicType;
class TType;
......
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "compiler/translator/compilerdebug.h"
#include <stdarg.h>
#include <stdio.h>
#include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/ParseContext.h"
#ifdef TRACE_ENABLED
static const int kTraceBufferLen = 1024;
extern "C" {
void Trace(const char *format, ...) {
if (!format) return;
TParseContext* parseContext = GetGlobalParseContext();
if (parseContext) {
char buf[kTraceBufferLen];
va_list args;
va_start(args, format);
vsnprintf(buf, kTraceBufferLen, format, args);
va_end(args);
parseContext->trace(buf);
}
}
} // extern "C"
#endif // TRACE_ENABLED
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.h: Debugging utilities.
#ifndef COMPILER_TRANSLATOR_COMPILERDEBUG_H_
#define COMPILER_TRANSLATOR_COMPILERDEBUG_H_
#include <assert.h>
#ifdef _DEBUG
#define TRACE_ENABLED // define to enable debug message tracing
#endif // _DEBUG
// Outputs text to the debug log
#ifdef TRACE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
void Trace(const char* format, ...);
#ifdef __cplusplus
}
#endif // __cplusplus
#else // TRACE_ENABLED
#define Trace(...) ((void)0)
#endif // TRACE_ENABLED
// A macro asserting a condition and outputting failures to the debug log
#define ASSERT(expression) do { \
if(!(expression)) \
Trace("Assert failed: %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
assert(expression); \
} while(0)
#define UNIMPLEMENTED() do { \
Trace("Unimplemented invoked: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} while(0)
#define UNREACHABLE() do { \
Trace("Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} while(0)
#endif // COMPILER_TRANSLATOR_COMPILERDEBUG_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment