summaryrefslogtreecommitdiff
path: root/clang-plugin/debug.h
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2013-12-10 12:56:04 +0000
committerPhilip Withnall <philip.withnall@collabora.co.uk>2013-12-10 12:56:04 +0000
commit8f8d2944fae776d08681e036fa0de55e28708089 (patch)
tree35cfc9eab752ab28ce29e5c222d0426b8b967a57 /clang-plugin/debug.h
parentd440167b3f93e96bf16c6a1c5f185ddd83221150 (diff)
clang-plugin: Factor out diagnostic reporting functions
Diffstat (limited to 'clang-plugin/debug.h')
-rw-r--r--clang-plugin/debug.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang-plugin/debug.h b/clang-plugin/debug.h
index 8c352c9..3f9b080 100644
--- a/clang-plugin/debug.h
+++ b/clang-plugin/debug.h
@@ -23,6 +23,12 @@
#ifndef GNOME_CLANG_DEBUG_H
#define GNOME_CLANG_DEBUG_H
+#include <clang/Basic/Diagnostic.h>
+#include <clang/Frontend/CompilerInstance.h>
+
+using namespace clang;
+
+namespace Debug {
#ifdef ENABLE_DEBUG
#define DEBUG(M) llvm::errs () << M << "\n"
#define DEBUG_EXPR(M, E) llvm::errs () << M; \
@@ -33,6 +39,20 @@
#define DEBUG_EXPR(M, E)
#endif
+/* For use with internal errors, such as unexpected precondition failures or
+ * states reached in the plugin internals. Not for user code warnings. */
#define WARN(M) llvm::errs () << "Warning: " << M << "\n"
+ DiagnosticBuilder emit_report (DiagnosticsEngine::Level level,
+ const std::string& message,
+ CompilerInstance& compiler,
+ SourceLocation location);
+ DiagnosticBuilder emit_error (const std::string& message,
+ CompilerInstance& compiler,
+ SourceLocation location);
+ DiagnosticBuilder emit_warning (const std::string& message,
+ CompilerInstance& compiler,
+ SourceLocation location);
+}
+
#endif /* !GNOME_CLANG_DEBUG_H */