[PATCH] D50266: Remove uses of push_macro/pop_macro in APInt::KnuthDiv

Raphael Isemann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 3 11:09:29 PDT 2018


teemperor created this revision.
teemperor added a reviewer: craig.topper.

The APInt::KnuthDiv uses push_macro/pop_macro to temporarily redefine the LLVM_DEBUG macro.

It turns out that when building with LLVM_ENABLE_MODULES, clang doesn't correctly
handle the push_macro/pop_macro pragmas, which causes that LLVM_DEBUG is actually undefined
after KnuthDiv calls `pop_macro`. This hasn't been a problem so far as we never used LLVM_DEBUG
after the KnuthDiv implementation.

However, https://reviews.llvm.org/rL338758 added new uses of the LLVM_DEBUG macro after the KnuthDiv implementation,
which now fail to compile with LLVM_ENABLE_MODULES as clang can't find the definition of
LLVM_DEBUG.

To fix the LLVM builds with enabled modules, we either move the KnuthDiv implementation to the end
of the file, or we just replace the use of push_macro/pop_macro pragmas. This patch uses the latter
option because it's less intrusive to the change log.


Repository:
  rL LLVM

https://reviews.llvm.org/D50266

Files:
  lib/Support/APInt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50266.159052.patch
Type: text/x-patch
Size: 6022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/d26ee639/attachment.bin>


More information about the llvm-commits mailing list