This is an archive of the discontinued LLVM Phabricator instance.

Revert 245d10b7a2c12ec25e7b5860a38c61991543a739
ClosedPublic

Authored by saugustine on Jul 14 2023, 1:21 PM.

Details

Summary

This fixes an issue with 245d10b7a2c12ec25e7b5860a38c61991543a739, where on slightly older versions of clang, we get the below error and several others similar.

In file included from .../clang/lib/AST/Interp/Source.h:17:
In file included from .../llvm/include/llvm/ADT/PointerUnion.h:19:
In file included from .../llvm/include/llvm/ADT/PointerIntPair.h:18:
.../llvm/include/llvm/Support/PointerLikeTypeTraits.h:61:28: error: invalid application of 'alignof' to an incomplete type 'clang::Decl'
   61 |       detail::ConstantLog2<alignof(T)>::value;
      |                            ^~~~~~~~~~
.../llvm/include/llvm/Support/PointerLikeTypeTraits.h:101:56: note: in instantiation of static data member 'llvm::PointerLikeTypeTraits<clang::Decl *>::NumLowBitsAvailable' requested here
  101 |   static constexpr int NumLowBitsAvailable = NonConst::NumLowBitsAvailable;
      |                                                        ^
.../llvm/include/llvm/ADT/PointerUnion.h:38:54: note: in instantiation of static data member 'llvm::PointerLikeTypeTraits<const clang::Decl *>::NumLowBitsAvailable' requested here
   38 |     return std::min<int>({PointerLikeTypeTraits<Ts>::NumLowBitsAvailable...});
      |                                                      ^
.../llvm/include/llvm/ADT/PointerUnion.h:52:48: note: in instantiation of function template specialization 'llvm::pointer_union_detail::lowBitsAvailable<const clang::Decl *, const clang::Stmt *>' requested here
   52 |     static constexpr int NumLowBitsAvailable = lowBitsAvailable<PTs...>();
      |                                                ^
.../llvm/include/llvm/ADT/PointerIntPair.h:169:28: note: in instantiation of static data member 'llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>::NumLowBitsAvailable' requested here
  169 |   static_assert(PtrTraits::NumLowBitsAvailable <
      |                            ^
.../llvm/include/llvm/ADT/PointerIntPair.h:111:13: note: in instantiation of template class 'llvm::PointerIntPairInfo<void *, 1, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>' requested here
  111 |     Value = Info::updateInt(Info::updatePointer(0, PtrVal),
      |             ^
.../llvm/include/llvm/ADT/PointerIntPair.h:89:5: note: in instantiation of member function 'llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>::setPointerAndInt' requested here
   89 |     setPointerAndInt(PtrVal, IntVal);
      |     ^
.../llvm/include/llvm/ADT/PointerUnion.h:77:16: note: in instantiation of member function 'llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>::PointerIntPair' requested here
   77 |         : Base(ValTy(const_cast<void *>(
      |                ^
.../clang/lib/AST/Interp/Source.h:76:31: note: in instantiation of member function 'llvm::pointer_union_detail::PointerUnionMembers<llvm::PointerUnion<const clang::Decl *, const clang::Stmt *>, llvm::PointerIntPair<void *, 1, int, llvm::pointer_union_detail::PointerUnionUIntTraits<const clang::Decl *, const clang::Stmt *>>, 1, const clang::Stmt *>::PointerUnionMembers' requested here
   76 |   SourceInfo(const Stmt *E) : Source(E) {}
      |                               ^
.../clang/lib/AST/Interp/Source.h:22:7: note: forward declaration of 'clang::Decl'
   22 | class Decl;
      |       ^

Diff Detail

Event Timeline

saugustine created this revision.Jul 14 2023, 1:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 1:21 PM
Herald added a subscriber: ChuanqiXu. · View Herald Transcript
saugustine requested review of this revision.Jul 14 2023, 1:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 1:21 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
saugustine retitled this revision from This fixes an issue with 245d10b7a2c12ec25e7b5860a38c61991543a739, where on slightly older versions of clang, we get the below error and several others similar. to Replace forward-declarations with proper headers for Decl and Stmt.Jul 14 2023, 1:24 PM
saugustine edited the summary of this revision. (Show Details)
saugustine added a reviewer: tbaeder.
saugustine edited the summary of this revision. (Show Details)Jul 14 2023, 1:27 PM

Switch to pure revert.

saugustine retitled this revision from Replace forward-declarations with proper headers for Decl and Stmt to Revert 245d10b7a2c12ec25e7b5860a38c61991543a739.Jul 14 2023, 1:36 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jul 14 2023, 1:41 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.