summaryrefslogtreecommitdiff
path: root/src/jit/jit.h
diff options
context:
space:
mode:
authorMichelle McDaniel <adiaaida@gmail.com>2016-08-09 09:59:01 -0700
committerMichelle McDaniel <adiaaida@gmail.com>2016-08-11 09:53:34 -0700
commitab7d6a8df73d3d89210a778338feaa9fedf4146a (patch)
tree4da1d793e3c5102a82398c5e8d560cf032f164a4 /src/jit/jit.h
parent7a84ab0f876d25464d1493c2d02de45da6f9da7e (diff)
downloadcoreclr-ab7d6a8df73d3d89210a778338feaa9fedf4146a.tar.gz
coreclr-ab7d6a8df73d3d89210a778338feaa9fedf4146a.tar.bz2
coreclr-ab7d6a8df73d3d89210a778338feaa9fedf4146a.zip
Prepare jit source for clang-tidy
In templates, clang-tidy will replace 0 with nullptr, but this is illegal for primitive types. This change replaces 0 in two templated functions with ZERO, which is defined to be 0 to avoid this issue. Additioanlly, we need to conditionally define some macros for running under __clang__ so they are found by clang-tidy.
Diffstat (limited to 'src/jit/jit.h')
-rw-r--r--src/jit/jit.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jit/jit.h b/src/jit/jit.h
index cbff78f8a6..36cf690c9d 100644
--- a/src/jit/jit.h
+++ b/src/jit/jit.h
@@ -22,6 +22,10 @@
// ifdef. This macro allows us to anchor the comments to the regular flow of code.
#define CLANG_FORMAT_COMMENT_ANCHOR ;
+// Clang-tidy replaces 0 with nullptr in some templated functions, causing a build
+// break. Replacing those instances with ZERO avoids this change
+#define ZERO 0
+
#ifdef _MSC_VER
// These don't seem useful, so turning them off is no big deal
#pragma warning(disable:4510) // can't generate default constructor
@@ -861,13 +865,13 @@ public:
template<typename T>
T dspPtr(T p)
{
- return (p == 0) ? 0 : (JitTls::GetCompiler()->opts.dspDiffable ? T(0xD1FFAB1E) : p);
+ return (p == ZERO) ? ZERO : (JitTls::GetCompiler()->opts.dspDiffable ? T(0xD1FFAB1E) : p);
}
template<typename T>
T dspOffset(T o)
{
- return (o == 0) ? 0 : (JitTls::GetCompiler()->opts.dspDiffable ? T(0xD1FFAB1E) : o);
+ return (o == ZERO) ? ZERO : (JitTls::GetCompiler()->opts.dspDiffable ? T(0xD1FFAB1E) : o);
}
#else // !defined(DEBUG)