r315194 - Make SourceLocation, QualType and friends have constexpr constructors.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 9 11:22:01 PDT 2017
Looks like a bug in the compiler, the warning doesn't make any sense.
Does creating a FileID() variable and passing that instead work?
On Mon, Oct 9, 2017 at 8:02 PM, Galina Kistanova <gkistanova at gmail.com> wrote:
> Hello Benjamin,
>
> I look s like this commit broke build on one of our builders:
>
> http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/5327
>
> . . .
> FAILED:
> tools/clang/lib/Serialization/CMakeFiles/clangSerialization.dir/ASTReader.cpp.obj
> C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe /nologo /TP -DEXPENSIVE_CHECKS
> -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE
> -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
> -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_DEBUG -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0
> -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> -Itools\clang\lib\Serialization
> -IC:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\tools\clang\lib\Serialization
> -IC:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\tools\clang\include
> -Itools\clang\include -Iinclude
> -IC:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\include
> /DWIN32 /D_WINDOWS /WX /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4
> -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351
> -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800
> -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706
> -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091
> -wd4592 -wd4319 -wd4324 -w14062 -we4238 /MDd /Zi /Ob0 /Od /RTC1 /EHs-c-
> /GR- /showIncludes
> /Fotools\clang\lib\Serialization\CMakeFiles\clangSerialization.dir\ASTReader.cpp.obj
> /Fdtools\clang\lib\Serialization\CMakeFiles\clangSerialization.dir\clangSerialization.pdb
> /FS -c
> C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\tools\clang\lib\Serialization\ASTReader.cpp
> C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\tools\clang\lib\Serialization\ASTReader.cpp(5731):
> error C2220: warning treated as error - no 'object' file generated
> C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\tools\clang\lib\Serialization\ASTReader.cpp(5731):
> warning C4709: comma operator within array index expression
>
> Please have a look?
>
> Thanks
>
> Galina
>
> On Sun, Oct 8, 2017 at 1:53 PM, Benjamin Kramer via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>>
>> Author: d0k
>> Date: Sun Oct 8 13:53:36 2017
>> New Revision: 315194
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=315194&view=rev
>> Log:
>> Make SourceLocation, QualType and friends have constexpr constructors.
>>
>> No functionality change intended.
>>
>> Modified:
>> cfe/trunk/include/clang/AST/CharUnits.h
>> cfe/trunk/include/clang/AST/Type.h
>> cfe/trunk/include/clang/Basic/SourceLocation.h
>>
>> Modified: cfe/trunk/include/clang/AST/CharUnits.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CharUnits.h?rev=315194&r1=315193&r2=315194&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/CharUnits.h (original)
>> +++ cfe/trunk/include/clang/AST/CharUnits.h Sun Oct 8 13:53:36 2017
>> @@ -40,14 +40,14 @@ namespace clang {
>> typedef int64_t QuantityType;
>>
>> private:
>> - QuantityType Quantity;
>> + QuantityType Quantity = 0;
>>
>> explicit CharUnits(QuantityType C) : Quantity(C) {}
>>
>> public:
>>
>> /// CharUnits - A default constructor.
>> - CharUnits() : Quantity(0) {}
>> + CharUnits() = default;
>>
>> /// Zero - Construct a CharUnits quantity of zero.
>> static CharUnits Zero() {
>>
>> Modified: cfe/trunk/include/clang/AST/Type.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=315194&r1=315193&r2=315194&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/Type.h (original)
>> +++ cfe/trunk/include/clang/AST/Type.h Sun Oct 8 13:53:36 2017
>> @@ -162,8 +162,6 @@ public:
>> FastMask = (1 << FastWidth) - 1
>> };
>>
>> - Qualifiers() : Mask(0) {}
>> -
>> /// Returns the common set of qualifiers while removing them from
>> /// the given sets.
>> static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
>> {
>> @@ -539,7 +537,7 @@ private:
>>
>> // bits: |0 1 2|3|4 .. 5|6 .. 8|9 ... 31|
>> // |C R V|U|GCAttr|Lifetime|AddressSpace|
>> - uint32_t Mask;
>> + uint32_t Mask = 0;
>>
>> static const uint32_t UMask = 0x8;
>> static const uint32_t UShift = 3;
>> @@ -634,7 +632,7 @@ class QualType {
>>
>> friend class QualifierCollector;
>> public:
>> - QualType() {}
>> + QualType() = default;
>>
>> QualType(const Type *Ptr, unsigned Quals)
>> : Value(Ptr, Quals) {}
>>
>> Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=315194&r1=315193&r2=315194&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
>> +++ cfe/trunk/include/clang/Basic/SourceLocation.h Sun Oct 8 13:53:36
>> 2017
>> @@ -39,10 +39,9 @@ class SourceManager;
>> class FileID {
>> /// \brief A mostly-opaque identifier, where 0 is "invalid", >0 is
>> /// this module, and <-1 is something loaded from another module.
>> - int ID;
>> -public:
>> - FileID() : ID(0) {}
>> + int ID = 0;
>>
>> +public:
>> bool isValid() const { return ID != 0; }
>> bool isInvalid() const { return ID == 0; }
>>
>> @@ -86,17 +85,15 @@ private:
>> ///
>> /// It is important that this type remains small. It is currently 32 bits
>> wide.
>> class SourceLocation {
>> - unsigned ID;
>> + unsigned ID = 0;
>> friend class SourceManager;
>> friend class ASTReader;
>> friend class ASTWriter;
>> enum : unsigned {
>> MacroIDBit = 1U << 31
>> };
>> -public:
>> -
>> - SourceLocation() : ID(0) {}
>>
>> +public:
>> bool isFileID() const { return (ID & MacroIDBit) == 0; }
>> bool isMacroID() const { return (ID & MacroIDBit) != 0; }
>>
>> @@ -198,8 +195,9 @@ inline bool operator<(const SourceLocati
>> class SourceRange {
>> SourceLocation B;
>> SourceLocation E;
>> +
>> public:
>> - SourceRange(): B(SourceLocation()), E(SourceLocation()) {}
>> + SourceRange() = default;
>> SourceRange(SourceLocation loc) : B(loc), E(loc) {}
>> SourceRange(SourceLocation begin, SourceLocation end) : B(begin),
>> E(end) {}
>>
>> @@ -230,9 +228,10 @@ public:
>> /// range.
>> class CharSourceRange {
>> SourceRange Range;
>> - bool IsTokenRange;
>> + bool IsTokenRange = false;
>> +
>> public:
>> - CharSourceRange() : IsTokenRange(false) {}
>> + CharSourceRange() = default;
>> CharSourceRange(SourceRange R, bool ITR) : Range(R), IsTokenRange(ITR)
>> {}
>>
>> static CharSourceRange getTokenRange(SourceRange R) {
>> @@ -330,10 +329,11 @@ class FileEntry;
>> ///
>> /// This is useful for argument passing to functions that expect both
>> objects.
>> class FullSourceLoc : public SourceLocation {
>> - const SourceManager *SrcMgr;
>> + const SourceManager *SrcMgr = nullptr;
>> +
>> public:
>> /// \brief Creates a FullSourceLoc where isValid() returns \c false.
>> - explicit FullSourceLoc() : SrcMgr(nullptr) {}
>> + FullSourceLoc() = default;
>>
>> explicit FullSourceLoc(SourceLocation Loc, const SourceManager &SM)
>> : SourceLocation(Loc), SrcMgr(&SM) {}
>>
>>
>> _______________________________________________
>> 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