]> granicus.if.org Git - clang/commit
Lex: make `clang::Preprocessor::macros` work on MSVC
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 11 Apr 2018 23:47:25 +0000 (23:47 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 11 Apr 2018 23:47:25 +0000 (23:47 +0000)
commitdba5be425449f20480c8053388d0deb7b99dac51
tree9b262d03ba6e2b24ed8f1fa4a27f27a25c6ddc4f
parent7c19d0f700520e6df68573fc867b878a922d6d55
Lex: make `clang::Preprocessor::macros` work on MSVC

The order of argument construction is reversed on MS ABI on Windows.
When `macros` was invoked, the `end` call is made prior to `begin`.  In
such a case, the DenseMap (`ModuleMap`) is populated after the `end`
iterator is constructed.  This reversal results in the invalidation of
the end iterator, resulting in a failure at runtime (assertion failure
in `DenseMap<T>::operator!=` that "handles are not in sync!").  Ensure
that the end iterator is constructed after the begin iterator.  This
fixes the use of `macros(bool)`, which symptomized as an assertion
failure in the swift compiler in the clang importer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329866 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Lex/Preprocessor.h