[PATCH] D53678: Include llvm-config.h from Demangle/Compiler.h

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 15:37:24 PDT 2018


andrew.w.kaylor created this revision.
andrew.w.kaylor added reviewers: zturner, dblaikie, labath.
Herald added a subscriber: erik.pilkington.

This fixes a problem that was exposed by the recently added ItaniumDemangleTest.cpp unittest.

The problem is that Demangle/Compiler.h checks LLVM_ENABLE_DUMP to see how it should define LLVM_DUMP_METHOD, but it doesn't include llvm-config.h so LLVM_ENABLE_DUMP is always undefined. If you have a build that defines LLVM_ENABLE_DUMP and NDEBUG, then Demangle/Compiler.h and Support/Compiler.h will define LLVM_DUMP_METHOD differently.

You can see this by configuring this way:

cmake -DLLVM_ENABLE_DUMP=true -DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_WERROR=true ../llvm

It isn't clear to me whether or not including llvm-config.h introduces a layering issue, hence the review for a one line change.


https://reviews.llvm.org/D53678

Files:
  include/llvm/Demangle/Compiler.h


Index: include/llvm/Demangle/Compiler.h
===================================================================
--- include/llvm/Demangle/Compiler.h
+++ include/llvm/Demangle/Compiler.h
@@ -14,6 +14,8 @@
 #ifndef LLVM_DEMANGLE_COMPILER_H
 #define LLVM_DEMANGLE_COMPILER_H
 
+#include "llvm/Config/llvm-config.h"
+
 #ifdef _MSC_VER
 // snprintf is implemented in VS 2015
 #if _MSC_VER < 1900


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53678.171005.patch
Type: text/x-patch
Size: 387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181024/d02a3e61/attachment.bin>


More information about the llvm-commits mailing list