r329652 - [AST] Attempt to fix buildbot warnings + appease MSVC; NFCI
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 9 18:51:53 PDT 2018
Thanks!
> On Apr 9, 2018, at 6:11 PM, George Burgess IV via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> Author: gbiv
> Date: Mon Apr 9 18:11:26 2018
> New Revision: 329652
>
> URL: http://llvm.org/viewvc/llvm-project?rev=329652&view=rev
> Log:
> [AST] Attempt to fix buildbot warnings + appease MSVC; NFCI
>
> GCC 4.8.4 on a bot was warning about `ArgPassingKind` not fitting in
> `ArgPassingRestrictions`, which appears to be incorrect, since
> `ArgPassingKind` only has three potential values:
>
> "warning: 'clang::RecordDecl::ArgPassingRestrictions' is too small to
> hold all values of 'enum clang::RecordDecl::ArgPassingKind'"
>
> Additionally, I remember hearing (though my knowledge may be outdated)
> that MSVC won't merge adjacent bitfields if their types are different.
>
> Try to fix both issues by turning these into `uint8_t`s.
>
> Modified:
> cfe/trunk/include/clang/AST/Decl.h
>
> Modified: cfe/trunk/include/clang/AST/Decl.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=329652&r1=329651&r2=329652&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/Decl.h (original)
> +++ cfe/trunk/include/clang/AST/Decl.h Mon Apr 9 18:11:26 2018
> @@ -3599,10 +3599,13 @@ private:
> /// Indicates whether this struct is destroyed in the callee. This flag is
> /// meaningless when Microsoft ABI is used since parameters are always
> /// destroyed in the callee.
> - bool ParamDestroyedInCallee : 1;
> + ///
> + /// Please note that MSVC won't merge adjacent bitfields if they don't have
> + /// the same type.
> + uint8_t ParamDestroyedInCallee : 1;
>
> /// Represents the way this type is passed to a function.
> - ArgPassingKind ArgPassingRestrictions : 2;
> + uint8_t ArgPassingRestrictions : 2;
>
> protected:
> RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
> @@ -3691,15 +3694,15 @@ public:
> /// it must have at least one trivial, non-deleted copy or move constructor.
> /// FIXME: This should be set as part of completeDefinition.
> bool canPassInRegisters() const {
> - return ArgPassingRestrictions == APK_CanPassInRegs;
> + return getArgPassingRestrictions() == APK_CanPassInRegs;
> }
>
> ArgPassingKind getArgPassingRestrictions() const {
> - return ArgPassingRestrictions;
> + return static_cast<ArgPassingKind>(ArgPassingRestrictions);
> }
>
> void setArgPassingRestrictions(ArgPassingKind Kind) {
> - ArgPassingRestrictions = Kind;
> + ArgPassingRestrictions = static_cast<uint8_t>(Kind);
> }
>
> bool isParamDestroyedInCallee() const {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list