Merge remote-tracking branch 'origin/4.6'

Conflicts:
	src/libs/utils/settingsaccessor.cpp
	src/plugins/autotest/autotestplugin.cpp
	src/plugins/git/gitclient.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.h

Change-Id: I65f143cad18af509a2621d6c5925abbd038ea70f
This commit is contained in:
Eike Ziller
2018-04-13 10:54:42 +02:00
61 changed files with 1137 additions and 90 deletions

View File

@@ -0,0 +1,739 @@
diff --git a/tools/clang/include/clang/AST/ASTContext.h b/tools/clang/include/clang/AST/ASTContext.h
index 703f588c56..d7beffa25e 100644
--- a/tools/clang/include/clang/AST/ASTContext.h
+++ b/tools/clang/include/clang/AST/ASTContext.h
@@ -2072,6 +2072,10 @@ public:
void CollectInheritedProtocols(const Decl *CDecl,
llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols);
+ /// \brief Return true if the specified type has unique object representations
+ /// according to (C++17 [meta.unary.prop]p9)
+ bool hasUniqueObjectRepresentations(QualType Ty) const;
+
//===--------------------------------------------------------------------===//
// Type Operators
//===--------------------------------------------------------------------===//
diff --git a/tools/clang/include/clang/Basic/TokenKinds.def b/tools/clang/include/clang/Basic/TokenKinds.def
index be67663a10..90ac33b9ea 100644
--- a/tools/clang/include/clang/Basic/TokenKinds.def
+++ b/tools/clang/include/clang/Basic/TokenKinds.def
@@ -448,6 +448,8 @@ TYPE_TRAIT_1(__is_pod, IsPOD, KEYCXX)
TYPE_TRAIT_1(__is_polymorphic, IsPolymorphic, KEYCXX)
TYPE_TRAIT_1(__is_trivial, IsTrivial, KEYCXX)
TYPE_TRAIT_1(__is_union, IsUnion, KEYCXX)
+TYPE_TRAIT_1(__has_unique_object_representations,
+ HasUniqueObjectRepresentations, KEYCXX)
// Clang-only C++ Type Traits
TYPE_TRAIT_N(__is_trivially_constructible, IsTriviallyConstructible, KEYCXX)
diff --git a/tools/clang/include/clang/Basic/TypeTraits.h b/tools/clang/include/clang/Basic/TypeTraits.h
index 6aadf795d8..8ecd63f9c3 100644
--- a/tools/clang/include/clang/Basic/TypeTraits.h
+++ b/tools/clang/include/clang/Basic/TypeTraits.h
@@ -70,7 +70,8 @@ namespace clang {
UTT_IsUnsigned,
UTT_IsVoid,
UTT_IsVolatile,
- UTT_Last = UTT_IsVolatile,
+ UTT_HasUniqueObjectRepresentations,
+ UTT_Last = UTT_HasUniqueObjectRepresentations,
BTT_IsBaseOf,
BTT_IsConvertible,
BTT_IsConvertibleTo,
diff --git a/tools/clang/lib/AST/ASTContext.cpp b/tools/clang/lib/AST/ASTContext.cpp
index c60373c5a9..1ce7d51857 100644
--- a/tools/clang/lib/AST/ASTContext.cpp
+++ b/tools/clang/lib/AST/ASTContext.cpp
@@ -1823,7 +1823,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
}
case Type::MemberPointer: {
const MemberPointerType *MPT = cast<MemberPointerType>(T);
- std::tie(Width, Align) = ABI->getMemberPointerWidthAndAlign(MPT);
+ CXXABI::MemberPointerInfo MPI = ABI->getMemberPointerInfo(MPT);
+ Width = MPI.Width;
+ Align = MPI.Align;
break;
}
case Type::Complex: {
@@ -2107,6 +2109,171 @@ void ASTContext::CollectInheritedProtocols(const Decl *CDecl,
}
}
+static bool unionHasUniqueObjectRepresentations(const ASTContext &Context,
+ const RecordDecl *RD) {
+ assert(RD->isUnion() && "Must be union type");
+ CharUnits UnionSize = Context.getTypeSizeInChars(RD->getTypeForDecl());
+
+ for (const auto *Field : RD->fields()) {
+ if (!Context.hasUniqueObjectRepresentations(Field->getType()))
+ return false;
+ CharUnits FieldSize = Context.getTypeSizeInChars(Field->getType());
+ if (FieldSize != UnionSize)
+ return false;
+ }
+ return !RD->field_empty();
+}
+
+bool isStructEmpty(QualType Ty) {
+ const RecordDecl *RD = Ty->castAs<RecordType>()->getDecl();
+
+ if (!RD->field_empty())
+ return false;
+
+ if (const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
+ return ClassDecl->isEmpty();
+
+ return true;
+}
+
+static llvm::Optional<int64_t>
+structHasUniqueObjectRepresentations(const ASTContext &Context,
+ const RecordDecl *RD) {
+ assert(!RD->isUnion() && "Must be struct/class type");
+ const auto &Layout = Context.getASTRecordLayout(RD);
+
+ int64_t CurOffsetInBits = 0;
+ if (const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
+ if (ClassDecl->isDynamicClass())
+ return llvm::None;
+
+ SmallVector<std::pair<QualType, int64_t>, 4> Bases;
+ for (const auto Base : ClassDecl->bases()) {
+ // Empty types can be inherited from, and non-empty types can potentially
+ // have tail padding, so just make sure there isn't an error.
+ if (!isStructEmpty(Base.getType())) {
+ llvm::Optional<int64_t> Size = structHasUniqueObjectRepresentations(
+ Context, Base.getType()->getAs<RecordType>()->getDecl());
+ if (!Size)
+ return llvm::None;
+ Bases.emplace_back(Base.getType(), Size.getValue());
+ }
+ }
+
+ std::sort(
+ Bases.begin(), Bases.end(), [&](const std::pair<QualType, int64_t> &L,
+ const std::pair<QualType, int64_t> &R) {
+ return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
+ Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
+ });
+
+ for (const auto Base : Bases) {
+ int64_t BaseOffset = Context.toBits(
+ Layout.getBaseClassOffset(Base.first->getAsCXXRecordDecl()));
+ int64_t BaseSize = Base.second;
+ if (BaseOffset != CurOffsetInBits)
+ return llvm::None;
+ CurOffsetInBits = BaseOffset + BaseSize;
+ }
+ }
+
+ for (const auto *Field : RD->fields()) {
+ if (!Field->getType()->isReferenceType() &&
+ !Context.hasUniqueObjectRepresentations(Field->getType()))
+ return llvm::None;
+
+ int64_t FieldSizeInBits =
+ Context.toBits(Context.getTypeSizeInChars(Field->getType()));
+ if (Field->isBitField()) {
+ int64_t BitfieldSize = Field->getBitWidthValue(Context);
+
+ if (BitfieldSize > FieldSizeInBits)
+ return llvm::None;
+ FieldSizeInBits = BitfieldSize;
+ }
+
+ int64_t FieldOffsetInBits = Context.getFieldOffset(Field);
+
+ if (FieldOffsetInBits != CurOffsetInBits)
+ return llvm::None;
+
+ CurOffsetInBits = FieldSizeInBits + FieldOffsetInBits;
+ }
+
+ return CurOffsetInBits;
+}
+
+bool ASTContext::hasUniqueObjectRepresentations(QualType Ty) const {
+ // C++17 [meta.unary.prop]:
+ // The predicate condition for a template specialization
+ // has_unique_object_representations<T> shall be
+ // satisfied if and only if:
+ // (9.1) - T is trivially copyable, and
+ // (9.2) - any two objects of type T with the same value have the same
+ // object representation, where two objects
+ // of array or non-union class type are considered to have the same value
+ // if their respective sequences of
+ // direct subobjects have the same values, and two objects of union type
+ // are considered to have the same
+ // value if they have the same active member and the corresponding members
+ // have the same value.
+ // The set of scalar types for which this condition holds is
+ // implementation-defined. [ Note: If a type has padding
+ // bits, the condition does not hold; otherwise, the condition holds true
+ // for unsigned integral types. -- end note ]
+ assert(!Ty.isNull() && "Null QualType sent to unique object rep check");
+
+ // Arrays are unique only if their element type is unique.
+ if (Ty->isArrayType())
+ return hasUniqueObjectRepresentations(getBaseElementType(Ty));
+
+ // (9.1) - T is trivially copyable...
+ if (!Ty.isTriviallyCopyableType(*this))
+ return false;
+
+ // All integrals and enums are unique.
+ if (Ty->isIntegralOrEnumerationType())
+ return true;
+
+ // All other pointers are unique.
+ if (Ty->isPointerType())
+ return true;
+
+ if (Ty->isMemberPointerType()) {
+ const MemberPointerType *MPT = Ty->getAs<MemberPointerType>();
+ return !ABI->getMemberPointerInfo(MPT).HasPadding;
+ }
+
+ if (Ty->isRecordType()) {
+ const RecordDecl *Record = Ty->getAs<RecordType>()->getDecl();
+
+ if (Record->isInvalidDecl())
+ return false;
+
+ if (Record->isUnion())
+ return unionHasUniqueObjectRepresentations(*this, Record);
+
+ Optional<int64_t> StructSize =
+ structHasUniqueObjectRepresentations(*this, Record);
+
+ return StructSize &&
+ StructSize.getValue() == static_cast<int64_t>(getTypeSize(Ty));
+ }
+
+ // FIXME: More cases to handle here (list by rsmith):
+ // vectors (careful about, eg, vector of 3 foo)
+ // _Complex int and friends
+ // _Atomic T
+ // Obj-C block pointers
+ // Obj-C object pointers
+ // and perhaps OpenCL's various builtin types (pipe, sampler_t, event_t,
+ // clk_event_t, queue_t, reserve_id_t)
+ // There're also Obj-C class types and the Obj-C selector type, but I think it
+ // makes sense for those to return false here.
+
+ return false;
+}
+
unsigned ASTContext::CountNonClassIvars(const ObjCInterfaceDecl *OI) const {
unsigned count = 0;
// Count ivars declared in class extension.
diff --git a/tools/clang/lib/AST/CXXABI.h b/tools/clang/lib/AST/CXXABI.h
index 924ef00e81..06295b5817 100644
--- a/tools/clang/lib/AST/CXXABI.h
+++ b/tools/clang/lib/AST/CXXABI.h
@@ -31,9 +31,16 @@ class CXXABI {
public:
virtual ~CXXABI();
- /// Returns the width and alignment of a member pointer in bits.
- virtual std::pair<uint64_t, unsigned>
- getMemberPointerWidthAndAlign(const MemberPointerType *MPT) const = 0;
+ struct MemberPointerInfo {
+ uint64_t Width;
+ unsigned Align;
+ bool HasPadding;
+ };
+
+ /// Returns the width and alignment of a member pointer in bits, as well as
+ /// whether it has padding.
+ virtual MemberPointerInfo
+ getMemberPointerInfo(const MemberPointerType *MPT) const = 0;
/// Returns the default calling convention for C++ methods.
virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0;
diff --git a/tools/clang/lib/AST/ItaniumCXXABI.cpp b/tools/clang/lib/AST/ItaniumCXXABI.cpp
index 692a455eaf..d6bc16b635 100644
--- a/tools/clang/lib/AST/ItaniumCXXABI.cpp
+++ b/tools/clang/lib/AST/ItaniumCXXABI.cpp
@@ -101,15 +101,17 @@ protected:
public:
ItaniumCXXABI(ASTContext &Ctx) : Context(Ctx) { }
- std::pair<uint64_t, unsigned>
- getMemberPointerWidthAndAlign(const MemberPointerType *MPT) const override {
+ MemberPointerInfo
+ getMemberPointerInfo(const MemberPointerType *MPT) const override {
const TargetInfo &Target = Context.getTargetInfo();
TargetInfo::IntType PtrDiff = Target.getPtrDiffType(0);
- uint64_t Width = Target.getTypeWidth(PtrDiff);
- unsigned Align = Target.getTypeAlign(PtrDiff);
+ MemberPointerInfo MPI;
+ MPI.Width = Target.getTypeWidth(PtrDiff);
+ MPI.Align = Target.getTypeAlign(PtrDiff);
+ MPI.HasPadding = false;
if (MPT->isMemberFunctionPointer())
- Width = 2 * Width;
- return std::make_pair(Width, Align);
+ MPI.Width *= 2;
+ return MPI;
}
CallingConv getDefaultMethodCallConv(bool isVariadic) const override {
diff --git a/tools/clang/lib/AST/MicrosoftCXXABI.cpp b/tools/clang/lib/AST/MicrosoftCXXABI.cpp
index 73324e40f3..b19491f313 100644
--- a/tools/clang/lib/AST/MicrosoftCXXABI.cpp
+++ b/tools/clang/lib/AST/MicrosoftCXXABI.cpp
@@ -76,8 +76,8 @@ class MicrosoftCXXABI : public CXXABI {
public:
MicrosoftCXXABI(ASTContext &Ctx) : Context(Ctx) { }
- std::pair<uint64_t, unsigned>
- getMemberPointerWidthAndAlign(const MemberPointerType *MPT) const override;
+ MemberPointerInfo
+ getMemberPointerInfo(const MemberPointerType *MPT) const override;
CallingConv getDefaultMethodCallConv(bool isVariadic) const override {
if (!isVariadic &&
@@ -227,7 +227,7 @@ getMSMemberPointerSlots(const MemberPointerType *MPT) {
return std::make_pair(Ptrs, Ints);
}
-std::pair<uint64_t, unsigned> MicrosoftCXXABI::getMemberPointerWidthAndAlign(
+CXXABI::MemberPointerInfo MicrosoftCXXABI::getMemberPointerInfo(
const MemberPointerType *MPT) const {
// The nominal struct is laid out with pointers followed by ints and aligned
// to a pointer width if any are present and an int width otherwise.
@@ -237,22 +237,25 @@ std::pair<uint64_t, unsigned> MicrosoftCXXABI::getMemberPointerWidthAndAlign(
unsigned Ptrs, Ints;
std::tie(Ptrs, Ints) = getMSMemberPointerSlots(MPT);
- uint64_t Width = Ptrs * PtrSize + Ints * IntSize;
- unsigned Align;
+ MemberPointerInfo MPI;
+ MPI.HasPadding = false;
+ MPI.Width = Ptrs * PtrSize + Ints * IntSize;
// When MSVC does x86_32 record layout, it aligns aggregate member pointers to
// 8 bytes. However, __alignof usually returns 4 for data memptrs and 8 for
// function memptrs.
if (Ptrs + Ints > 1 && Target.getTriple().isArch32Bit())
- Align = 64;
+ MPI.Align = 64;
else if (Ptrs)
- Align = Target.getPointerAlign(0);
+ MPI.Align = Target.getPointerAlign(0);
else
- Align = Target.getIntAlign();
+ MPI.Align = Target.getIntAlign();
- if (Target.getTriple().isArch64Bit())
- Width = llvm::alignTo(Width, Align);
- return std::make_pair(Width, Align);
+ if (Target.getTriple().isArch64Bit()) {
+ MPI.Width = llvm::alignTo(MPI.Width, MPI.Align);
+ MPI.HasPadding = MPI.Width != (Ptrs * PtrSize + Ints * IntSize);
+ }
+ return MPI;
}
CXXABI *clang::CreateMicrosoftCXXABI(ASTContext &Ctx) {
diff --git a/tools/clang/lib/Parse/ParseExpr.cpp b/tools/clang/lib/Parse/ParseExpr.cpp
index 44b87af01a..73aac10c23 100644
--- a/tools/clang/lib/Parse/ParseExpr.cpp
+++ b/tools/clang/lib/Parse/ParseExpr.cpp
@@ -716,6 +716,7 @@ class CastExpressionIdValidator : public CorrectionCandidateCallback {
/// '__is_sealed' [MS]
/// '__is_trivial'
/// '__is_union'
+/// '__has_unique_object_representations'
///
/// [Clang] unary-type-trait:
/// '__is_aggregate'
diff --git a/tools/clang/lib/Sema/SemaExprCXX.cpp b/tools/clang/lib/Sema/SemaExprCXX.cpp
index a9cf3ec799..a7d75ad977 100644
--- a/tools/clang/lib/Sema/SemaExprCXX.cpp
+++ b/tools/clang/lib/Sema/SemaExprCXX.cpp
@@ -4141,6 +4141,7 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT,
case UTT_IsDestructible:
case UTT_IsNothrowDestructible:
case UTT_IsTriviallyDestructible:
+ case UTT_HasUniqueObjectRepresentations:
if (ArgTy->isIncompleteArrayType() || ArgTy->isVoidType())
return true;
@@ -4580,6 +4581,8 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
// Returns True if and only if T is a complete type at the point of the
// function call.
return !T->isIncompleteType();
+ case UTT_HasUniqueObjectRepresentations:
+ return C.hasUniqueObjectRepresentations(T);
}
}
diff --git a/tools/clang/test/SemaCXX/has_unique_object_reps_member_ptr.cpp b/tools/clang/test/SemaCXX/has_unique_object_reps_member_ptr.cpp
new file mode 100644
index 0000000000..b8e27f82ff
--- /dev/null
+++ b/tools/clang/test/SemaCXX/has_unique_object_reps_member_ptr.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -triple x86_64-linux-pc -DIS64 -fsyntax-only -verify -std=c++17 %s
+// RUN: %clang_cc1 -triple x86_64-windows-pc -DIS64 -fsyntax-only -verify -std=c++17 %s
+// RUN: %clang_cc1 -triple i386-linux-pc -fsyntax-only -verify -std=c++17 %s
+// RUN: %clang_cc1 -triple i386-windows-pc -DW32 -fsyntax-only -verify -std=c++17 %s
+// expected-no-diagnostics
+
+struct Base {};
+struct A : virtual Base {
+ virtual void n() {}
+};
+
+auto p = &A::n;
+static_assert(__has_unique_object_representations(decltype(p)));
+
+struct B {
+ decltype(p) x;
+ int b;
+#ifdef IS64
+ // required on 64 bit to fill out the tail padding.
+ int c;
+#endif
+};
+static_assert(__has_unique_object_representations(B));
+
+struct C { // has padding on Win32, but nothing else.
+ decltype(p) x;
+};
+#ifdef W32
+static_assert(!__has_unique_object_representations(C));
+#else
+static_assert(__has_unique_object_representations(C));
+#endif
diff --git a/tools/clang/test/SemaCXX/type-traits.cpp b/tools/clang/test/SemaCXX/type-traits.cpp
index 5879a77dd5..3c2f9c7f0f 100644
--- a/tools/clang/test/SemaCXX/type-traits.cpp
+++ b/tools/clang/test/SemaCXX/type-traits.cpp
@@ -2352,3 +2352,321 @@ void is_trivially_destructible_test() {
{ int arr[F(__is_trivially_destructible(void))]; }
{ int arr[F(__is_trivially_destructible(const volatile void))]; }
}
+
+// Instantiation of __has_unique_object_representations
+template <typename T>
+struct has_unique_object_representations {
+ static const bool value = __has_unique_object_representations(T);
+};
+
+static_assert(!has_unique_object_representations<void>::value, "void is never unique");
+static_assert(!has_unique_object_representations<const void>::value, "void is never unique");
+static_assert(!has_unique_object_representations<volatile void>::value, "void is never unique");
+static_assert(!has_unique_object_representations<const volatile void>::value, "void is never unique");
+
+static_assert(has_unique_object_representations<int>::value, "integrals are");
+static_assert(has_unique_object_representations<const int>::value, "integrals are");
+static_assert(has_unique_object_representations<volatile int>::value, "integrals are");
+static_assert(has_unique_object_representations<const volatile int>::value, "integrals are");
+
+static_assert(has_unique_object_representations<void *>::value, "as are pointers");
+static_assert(has_unique_object_representations<const void *>::value, "as are pointers");
+static_assert(has_unique_object_representations<volatile void *>::value, "are pointers");
+static_assert(has_unique_object_representations<const volatile void *>::value, "as are pointers");
+
+static_assert(has_unique_object_representations<int *>::value, "as are pointers");
+static_assert(has_unique_object_representations<const int *>::value, "as are pointers");
+static_assert(has_unique_object_representations<volatile int *>::value, "as are pointers");
+static_assert(has_unique_object_representations<const volatile int *>::value, "as are pointers");
+
+class C {};
+using FP = int (*)(int);
+using PMF = int (C::*)(int);
+using PMD = int C::*;
+
+static_assert(has_unique_object_representations<FP>::value, "even function pointers");
+static_assert(has_unique_object_representations<const FP>::value, "even function pointers");
+static_assert(has_unique_object_representations<volatile FP>::value, "even function pointers");
+static_assert(has_unique_object_representations<const volatile FP>::value, "even function pointers");
+
+static_assert(has_unique_object_representations<PMF>::value, "and pointer to members");
+static_assert(has_unique_object_representations<const PMF>::value, "and pointer to members");
+static_assert(has_unique_object_representations<volatile PMF>::value, "and pointer to members");
+static_assert(has_unique_object_representations<const volatile PMF>::value, "and pointer to members");
+
+static_assert(has_unique_object_representations<PMD>::value, "and pointer to members");
+static_assert(has_unique_object_representations<const PMD>::value, "and pointer to members");
+static_assert(has_unique_object_representations<volatile PMD>::value, "and pointer to members");
+static_assert(has_unique_object_representations<const volatile PMD>::value, "and pointer to members");
+
+static_assert(has_unique_object_representations<bool>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<char>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<signed char>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<unsigned char>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<short>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<unsigned short>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<int>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<unsigned int>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<long>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<unsigned long>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<long long>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<unsigned long long>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<wchar_t>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<char16_t>::value, "yes, all integral types");
+static_assert(has_unique_object_representations<char32_t>::value, "yes, all integral types");
+
+static_assert(!has_unique_object_representations<void>::value, "but not void!");
+static_assert(!has_unique_object_representations<decltype(nullptr)>::value, "or nullptr_t");
+static_assert(!has_unique_object_representations<float>::value, "definitely not Floating Point");
+static_assert(!has_unique_object_representations<double>::value, "definitely not Floating Point");
+static_assert(!has_unique_object_representations<long double>::value, "definitely not Floating Point");
+
+struct NoPadding {
+ int a;
+ int b;
+};
+
+static_assert(has_unique_object_representations<NoPadding>::value, "types without padding are");
+
+struct InheritsFromNoPadding : NoPadding {
+ int c;
+ int d;
+};
+
+static_assert(has_unique_object_representations<InheritsFromNoPadding>::value, "types without padding are");
+
+struct VirtuallyInheritsFromNoPadding : virtual NoPadding {
+ int c;
+ int d;
+};
+
+static_assert(!has_unique_object_representations<VirtuallyInheritsFromNoPadding>::value, "No virtual inheritence");
+
+struct Padding {
+ char a;
+ int b;
+};
+
+//static_assert(!has_unique_object_representations<Padding>::value, "but not with padding");
+
+struct InheritsFromPadding : Padding {
+ int c;
+ int d;
+};
+
+static_assert(!has_unique_object_representations<InheritsFromPadding>::value, "or its subclasses");
+
+struct TailPadding {
+ int a;
+ char b;
+};
+
+static_assert(!has_unique_object_representations<TailPadding>::value, "even at the end");
+
+struct TinyStruct {
+ char a;
+};
+
+static_assert(has_unique_object_representations<TinyStruct>::value, "Should be no padding");
+
+struct InheritsFromTinyStruct : TinyStruct {
+ int b;
+};
+
+static_assert(!has_unique_object_representations<InheritsFromTinyStruct>::value, "Inherit causes padding");
+
+union NoPaddingUnion {
+ int a;
+ unsigned int b;
+};
+
+static_assert(has_unique_object_representations<NoPaddingUnion>::value, "unions follow the same rules as structs");
+
+union PaddingUnion {
+ int a;
+ long long b;
+};
+
+static_assert(!has_unique_object_representations<PaddingUnion>::value, "unions follow the same rules as structs");
+
+struct NotTriviallyCopyable {
+ int x;
+ NotTriviallyCopyable(const NotTriviallyCopyable &) {}
+};
+
+static_assert(!has_unique_object_representations<NotTriviallyCopyable>::value, "must be trivially copyable");
+
+struct HasNonUniqueMember {
+ float x;
+};
+
+static_assert(!has_unique_object_representations<HasNonUniqueMember>::value, "all members must be unique");
+
+enum ExampleEnum { xExample,
+ yExample };
+enum LLEnum : long long { xLongExample,
+ yLongExample };
+
+static_assert(has_unique_object_representations<ExampleEnum>::value, "Enums are integrals, so unique!");
+static_assert(has_unique_object_representations<LLEnum>::value, "Enums are integrals, so unique!");
+
+enum class ExampleEnumClass { xExample,
+ yExample };
+enum class LLEnumClass : long long { xLongExample,
+ yLongExample };
+
+static_assert(has_unique_object_representations<ExampleEnumClass>::value, "Enums are integrals, so unique!");
+static_assert(has_unique_object_representations<LLEnumClass>::value, "Enums are integrals, so unique!");
+
+// because references aren't trivially copyable.
+static_assert(!has_unique_object_representations<int &>::value, "No references!");
+static_assert(!has_unique_object_representations<const int &>::value, "No references!");
+static_assert(!has_unique_object_representations<volatile int &>::value, "No references!");
+static_assert(!has_unique_object_representations<const volatile int &>::value, "No references!");
+static_assert(!has_unique_object_representations<Empty>::value, "No empty types!");
+static_assert(!has_unique_object_representations<EmptyUnion>::value, "No empty types!");
+
+class Compressed : Empty {
+ int x;
+};
+
+static_assert(has_unique_object_representations<Compressed>::value, "But inheriting from one is ok");
+
+class EmptyInheritor : Compressed {};
+
+static_assert(has_unique_object_representations<EmptyInheritor>::value, "As long as the base has items, empty is ok");
+
+class Dynamic {
+ virtual void A();
+ int i;
+};
+
+static_assert(!has_unique_object_representations<Dynamic>::value, "Dynamic types are not valid");
+
+class InheritsDynamic : Dynamic {
+ int j;
+};
+
+static_assert(!has_unique_object_representations<InheritsDynamic>::value, "Dynamic types are not valid");
+
+static_assert(has_unique_object_representations<int[42]>::value, "Arrays are fine, as long as their value type is");
+static_assert(has_unique_object_representations<int[]>::value, "Arrays are fine, as long as their value type is");
+static_assert(has_unique_object_representations<int[][42]>::value, "Arrays are fine, as long as their value type is");
+static_assert(!has_unique_object_representations<double[42]>::value, "So no array of doubles!");
+static_assert(!has_unique_object_representations<double[]>::value, "So no array of doubles!");
+static_assert(!has_unique_object_representations<double[][42]>::value, "So no array of doubles!");
+
+struct __attribute__((aligned(16))) WeirdAlignment {
+ int i;
+};
+union __attribute__((aligned(16))) WeirdAlignmentUnion {
+ int i;
+};
+static_assert(!has_unique_object_representations<WeirdAlignment>::value, "Alignment causes padding");
+static_assert(!has_unique_object_representations<WeirdAlignmentUnion>::value, "Alignment causes padding");
+static_assert(!has_unique_object_representations<WeirdAlignment[42]>::value, "Also no arrays that have padding");
+
+static_assert(!has_unique_object_representations<int(int)>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) const>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) volatile>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) const volatile>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) const &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) volatile &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) const volatile &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) &&>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) const &&>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) volatile &&>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int) const volatile &&>::value, "Functions are not unique");
+
+static_assert(!has_unique_object_representations<int(int, ...)>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) const>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) volatile>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) const volatile>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) const &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) volatile &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) const volatile &>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) &&>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) const &&>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) volatile &&>::value, "Functions are not unique");
+static_assert(!has_unique_object_representations<int(int, ...) const volatile &&>::value, "Functions are not unique");
+
+void foo(){
+ static auto lambda = []() {};
+ static_assert(!has_unique_object_representations<decltype(lambda)>::value, "Lambdas follow struct rules");
+ int i;
+ static auto lambda2 = [i]() {};
+ static_assert(has_unique_object_representations<decltype(lambda2)>::value, "Lambdas follow struct rules");
+}
+
+struct PaddedBitfield {
+ char c : 6;
+ char d : 1;
+};
+
+struct UnPaddedBitfield {
+ char c : 6;
+ char d : 2;
+};
+
+struct AlignedPaddedBitfield {
+ char c : 6;
+ __attribute__((aligned(1)))
+ char d : 2;
+};
+
+static_assert(!has_unique_object_representations<PaddedBitfield>::value, "Bitfield padding");
+static_assert(has_unique_object_representations<UnPaddedBitfield>::value, "Bitfield padding");
+static_assert(!has_unique_object_representations<AlignedPaddedBitfield>::value, "Bitfield padding");
+
+struct BoolBitfield {
+ bool b : 8;
+};
+
+static_assert(has_unique_object_representations<BoolBitfield>::value, "Bitfield bool");
+
+struct BoolBitfield2 {
+ bool b : 16;
+};
+
+static_assert(!has_unique_object_representations<BoolBitfield2>::value, "Bitfield bool");
+
+struct GreaterSizeBitfield {
+ //expected-warning@+1 {{width of bit-field 'n'}}
+ int n : 1024;
+};
+
+static_assert(sizeof(GreaterSizeBitfield) == 128, "Bitfield Size");
+static_assert(!has_unique_object_representations<GreaterSizeBitfield>::value, "Bitfield padding");
+
+struct StructWithRef {
+ int &I;
+};
+
+static_assert(has_unique_object_representations<StructWithRef>::value, "References are still unique");
+
+struct NotUniqueBecauseTailPadding {
+ int &r;
+ char a;
+};
+struct CanBeUniqueIfNoPadding : NotUniqueBecauseTailPadding {
+ char b[7];
+};
+
+static_assert(!has_unique_object_representations<NotUniqueBecauseTailPadding>::value,
+ "non trivial");
+// Can be unique on Itanium, since the is child class' data is 'folded' into the
+// parent's tail padding.
+static_assert(sizeof(CanBeUniqueIfNoPadding) != 16 ||
+ has_unique_object_representations<CanBeUniqueIfNoPadding>::value,
+ "inherit from std layout");
+
+namespace ErrorType {
+ struct S; //expected-note{{forward declaration of 'ErrorType::S'}}
+
+ struct T {
+ S t; //expected-error{{field has incomplete type 'ErrorType::S'}}
+ };
+ bool b = __has_unique_object_representations(T);
+};
--
2.14.1

View File

@@ -0,0 +1,122 @@
diff --git a/tools/clang/include/clang/Basic/TokenKinds.def b/tools/clang/include/clang/Basic/TokenKinds.def
index 90ac33b9ea..67fea10788 100644
--- a/tools/clang/include/clang/Basic/TokenKinds.def
+++ b/tools/clang/include/clang/Basic/TokenKinds.def
@@ -390,6 +390,7 @@ TYPE_TRAIT_2(__builtin_types_compatible_p, TypeCompatible, KEYNOCXX)
KEYWORD(__builtin_va_arg , KEYALL)
KEYWORD(__extension__ , KEYALL)
KEYWORD(__float128 , KEYALL)
+ALIAS("_Float128", __float128 , KEYNOCXX)
KEYWORD(__imag , KEYALL)
KEYWORD(__int128 , KEYALL)
KEYWORD(__label__ , KEYALL)
diff --git a/tools/clang/lib/Frontend/InitPreprocessor.cpp b/tools/clang/lib/Frontend/InitPreprocessor.cpp
index 92d61369b4..8edc06fe93 100644
--- a/tools/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/tools/clang/lib/Frontend/InitPreprocessor.cpp
@@ -790,6 +790,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
DefineFloatMacros(Builder, "FLT", &TI.getFloatFormat(), "F");
DefineFloatMacros(Builder, "DBL", &TI.getDoubleFormat(), "");
DefineFloatMacros(Builder, "LDBL", &TI.getLongDoubleFormat(), "L");
+ if (TI.hasFloat128Type())
+ // FIXME: Switch away from the non-standard "Q" when we can
+ DefineFloatMacros(Builder, "FLT128", &TI.getFloat128Format(), "Q");
+
// Define a __POINTER_WIDTH__ macro for stdint.h.
Builder.defineMacro("__POINTER_WIDTH__",
diff --git a/tools/clang/test/Preprocessor/cuda-types.cu b/tools/clang/test/Preprocessor/cuda-types.cu
index 5f7b91655c..9e96f6a15e 100644
--- a/tools/clang/test/Preprocessor/cuda-types.cu
+++ b/tools/clang/test/Preprocessor/cuda-types.cu
@@ -5,42 +5,44 @@
// FIXME: We really should make __GCC_HAVE_SYNC_COMPARE_AND_SWAP identical on
// host and device, but architecturally this is difficult at the moment.
+// RUN: mkdir -p %t
+
// RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-host-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-device-defines-filtered
-// RUN: diff %T/i386-host-defines-filtered %T/i386-device-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered
+// RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-host-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-device-defines-filtered
-// RUN: diff %T/x86_64-host-defines-filtered %T/x86_64-device-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
+// RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/powerpc64-host-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/powerpc64-device-defines-filtered
-// RUN: diff %T/powerpc64-host-defines-filtered %T/powerpc64-device-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/powerpc64-device-defines-filtered
+// RUN: diff %t/powerpc64-host-defines-filtered %t/powerpc64-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-msvc-host-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-msvc-device-defines-filtered
-// RUN: diff %T/i386-msvc-host-defines-filtered %T/i386-msvc-device-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-device-defines-filtered
+// RUN: diff %t/i386-msvc-host-defines-filtered %t/i386-msvc-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-msvc-host-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
-// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-msvc-device-defines-filtered
-// RUN: diff %T/x86_64-msvc-host-defines-filtered %T/x86_64-msvc-device-defines-filtered
+// RUN: | grep -v '__FLT128\|__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-device-defines-filtered
+// RUN: diff %t/x86_64-msvc-host-defines-filtered %t/x86_64-msvc-device-defines-filtered
diff --git a/tools/clang/test/Sema/_Float128.c b/tools/clang/test/Sema/_Float128.c
new file mode 100644
index 0000000000..f0c3c6d555
--- /dev/null
+++ b/tools/clang/test/Sema/_Float128.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -verify %s
+// RUN: %clang_cc1 -triple powerpc64-linux -verify %s
+// RUN: %clang_cc1 -triple i686-windows-gnu -verify %s
+// RUN: %clang_cc1 -triple x86_64-windows-gnu -verify %s
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -verify %s
+
+#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
+_Float128 f;
+_Float128 tiny = __FLT128_EPSILON__;
+int g(int x, _Float128 *y) {
+ return x + *y;
+}
+
+// expected-no-diagnostics
+#else
+_Float128 f; // expected-error {{__float128 is not supported on this target}}
+float tiny = __FLT128_EPSILON__; // expected-error{{use of undeclared identifier}}
+int g(int x, _Float128 *y) { // expected-error {{__float128 is not supported on this target}}
+ return x + *y;
+}
+
+#endif // defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
--
2.14.1

View File

@@ -94,6 +94,24 @@ Some classes have totally broken highlighting (like classes inside texteditor.cp
Improves pretty printing for tooltips.
##### 220_Support-std-has_unique_object_represesentations.patch
* https://reviews.llvm.org/D39064 mplement __has_unique_object_representations
* https://reviews.llvm.org/D39347 Fix __has_unique_object_representations implementation
* (without review, git sha1 133cba2f9263f63f44b6b086a500f374bff13eee) Fix ICE when __has_unqiue_object_representations called with invalid decl
* (without review, git cb61fc53dc997bca3bee98d898d3406d0acb221c) Revert unintended hunk from ICE-Change
* https://reviews.llvm.org/D42863 Make __has_unique_object_representations reject empty union types.
Backport patches implementing std::has_unique_object_representations for
parsing type_traits header of stdlibc++ 7.
##### 230_D40673_Add-Float128-as-alias-to-__float128.patch
* https://reviews.llvm.org/D40673
Fixes parsing stdlib.h with -DGNU_SOURCE for GCC 7.2 (and maybe others).
Additional changes
------------------

View File

@@ -3,4 +3,5 @@ import qbs
QtcPlugin {
Depends { name: "LicenseChecker"; required: false }
cpp.defines: base.concat(LicenseChecker.present ? ["LICENSECHECKER"] : [])
pluginjson.useVcsData: true
}

View File

@@ -17,6 +17,7 @@ QtcProduct {
Depends { name: "ExtensionSystem" }
Depends { name: "pluginjson" }
pluginjson.useVcsData: false
Depends {
condition: qtc.testsEnabled
name: "Qt.testlib"

View File

@@ -10,9 +10,10 @@ Module {
// TODO: Wrap the VCS specific stuff in a dedicated module
property bool hasVcs: Utilities.versionCompare(qbs.version, "1.10") >= 0
Depends { name: "vcs"; condition: hasVcs }
property bool useVcsData: hasVcs
Depends { name: "vcs"; condition: useVcsData }
Properties {
condition: hasVcs
condition: useVcsData
vcs.headerFileName: undefined
vcs.repoDir: {
// TODO: Could something like this be incorporated into the vcs module?

View File

@@ -2245,6 +2245,11 @@ class DumperBase:
p += 1
def extractPointer(self, value):
try:
if value.type.code == TypeCodeArray:
return value.address()
except:
pass
code = 'I' if self.ptrSize() == 4 else 'Q'
return self.extractSomething(value, code, 8 * self.ptrSize())

View File

@@ -193,14 +193,14 @@ void QuickItemNodeInstance::doComponentComplete()
{
ObjectNodeInstance::doComponentComplete();
QQmlProperty contentItemProperty(quickItem(), "contentItem", engine());
if (contentItemProperty.isValid())
m_contentItem = contentItemProperty.read().value<QQuickItem*>();
QmlPrivateGate::disableTextCursor(quickItem());
DesignerSupport::emitComponentCompleteSignalForAttachedProperty(quickItem());
QQmlProperty contentItemProperty(quickItem(), "contentItem", engine());
if (contentItemProperty.isValid())
m_contentItem = contentItemProperty.read().value<QQuickItem*>();
quickItem()->update();
}

View File

@@ -80,9 +80,18 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 2,
"items":
[
{
"trKey": "Qt 5.11",
"value":
"{
'QtQuickVersion': '2.11',
'QtQuickWindowVersion': '2.11',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3'
}"
},
{
"trKey": "Qt 5.10",
"value":

View File

@@ -80,9 +80,18 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 2,
"items":
[
{
"trKey": "Qt 5.11",
"value":
"{
'QtQuickVersion': '2.11',
'QtQuickWindowVersion': '2.11',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3'
}"
},
{
"trKey": "Qt 5.10",
"value":

View File

@@ -83,9 +83,18 @@
"visible": false,
"data":
{
"index": 1,
"index": 2,
"items":
[
{
"trKey": "Qt 5.11",
"value":
"{
'QtQuickVersion': '2.11',
'QtQuickControlsVersion': '2.4',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3'
}"
},
{
"trKey": "Qt 5.10",
"value":

View File

@@ -82,9 +82,18 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 2,
"items":
[
{
"trKey": "Qt 5.11",
"value":
"{
'QtQuickVersion': '2.11',
'QtQuickControlsVersion': '2.4',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3'
}"
},
{
"trKey": "Qt 5.10",
"value":

View File

@@ -82,9 +82,18 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 2,
"items":
[
{
"trKey": "Qt 5.11",
"value":
"{
'QtQuickVersion': '2.11',
'QtQuickControlsVersion': '2.4',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3'
}"
},
{
"trKey": "Qt 5.10",
"value":

View File

@@ -40,9 +40,18 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 2,
"items":
[
{
"trKey": "Qt 5.11",
"value":
"{
'QtQuickVersion': '2.11',
'QtQuickWindowVersion': '2.11',
'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3'
}"
},
{
"trKey": "Qt 5.10",
"value":

View File

@@ -454,7 +454,7 @@ bool UpgradingSettingsAccessor::isValidVersionAndId(const int version, const QBy
{
return (version >= 0
&& version >= firstSupportedVersion() && version <= currentVersion())
&& (id == m_id || m_id.isEmpty());
&& (id.isEmpty() || id == m_id || m_id.isEmpty());
}
SettingsAccessor::RestoreData UpgradingSettingsAccessor::readData(const FileName &path,

View File

@@ -156,8 +156,8 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
m_filesToPull["/system/bin/app_process32"] = buildDir + "app_process";
}
} else {
m_appProcessBinaries << QLatin1String("/system/bin/app_process32")
<< QLatin1String("/system/bin/app_process");
m_filesToPull["/system/bin/app_process32"] = buildDir + "app_process";
m_filesToPull["/system/bin/app_process"] = buildDir + "app_process";
}
m_filesToPull["/system/bin/" + linkerName] = buildDir + linkerName;

View File

@@ -116,7 +116,6 @@ private:
QString m_avdName;
QString m_apkPath;
QMap<QString, QString> m_filesToPull;
QStringList m_appProcessBinaries;
QString m_targetArch;
bool m_uninstallPreviousPackage = false;

View File

@@ -150,7 +150,8 @@ QString AndroidToolChain::typeDisplayName() const
bool AndroidToolChain::isValid() const
{
return GccToolChain::isValid() && targetAbi().isValid() && !m_ndkToolChainVersion.isEmpty()
&& compilerCommand().isChildOf(AndroidConfigurations::currentConfig().ndkLocation());
&& compilerCommand().isChildOf(AndroidConfigurations::currentConfig().ndkLocation())
&& !originalTargetTriple().isEmpty();
}
void AndroidToolChain::addToEnvironment(Environment &env) const
@@ -417,6 +418,9 @@ bool AndroidToolChainFactory::versionCompareLess(const QList<int> &a, const QLis
bool AndroidToolChainFactory::versionCompareLess(QList<AndroidToolChain *> atc,
QList<AndroidToolChain *> btc)
{
if (atc.isEmpty() || btc.isEmpty())
return false;
const QList<int> a = versionNumberFromString(atc.at(0)->ndkToolChainVersion());
const QList<int> b = versionNumberFromString(btc.at(0)->ndkToolChainVersion());
@@ -463,7 +467,7 @@ AndroidToolChainFactory::autodetectToolChainsForNdk(const FileName &ndkPath,
FileName compilerPath = AndroidConfigurations::currentConfig().gccPath(abi, lang, version);
AndroidToolChain *tc = findToolChain(compilerPath, lang, alreadyKnown);
if (!tc) {
if (!tc || tc->originalTargetTriple().isEmpty()) {
tc = new AndroidToolChain(abi, version, lang,
ToolChain::AutoDetection);
tc->resetToolChain(compilerPath);
@@ -473,6 +477,8 @@ AndroidToolChainFactory::autodetectToolChainsForNdk(const FileName &ndkPath,
toolChainBundle.append(tc);
}
QTC_ASSERT(!toolChainBundle.isEmpty(), continue);
auto it = newestToolChainForArch.constFind(abi);
if (it == newestToolChainForArch.constEnd())
newestToolChainForArch.insert(abi, toolChainBundle);

View File

@@ -53,6 +53,8 @@
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorericons.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <texteditor/texteditor.h>
#include <utils/textutils.h>
#include <utils/utilsicons.h>
@@ -248,12 +250,16 @@ void AutotestPlugin::onRunUnderCursorTriggered(TestRunMode mode)
void AutotestPlugin::updateMenuItemsEnabledState()
{
const ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
const ProjectExplorer::Target *target = project ? project->activeTarget() : nullptr;
const bool canScan = !TestRunner::instance()->isTestRunning()
&& TestTreeModel::instance()->parser()->state() == TestCodeParser::Idle;
const bool hasTests = TestTreeModel::instance()->hasTests();
// avoid expensive call to PE::canRunStartupProject() - limit to minimum necessary checks
const bool canRun = hasTests && canScan
&& ProjectExplorer::ProjectExplorerPlugin::canRunStartupProject(
ProjectExplorer::Constants::NORMAL_RUN_MODE);
&& project && !project->needsConfiguration()
&& target && target->activeRunConfiguration()
&& !ProjectExplorer::BuildManager::isBuilding();
ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action()->setEnabled(canRun);
ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action()->setEnabled(canRun);

View File

@@ -172,7 +172,9 @@ void QtTestOutputReader::processXMLOutput(const QByteArray &outputLine)
if (m_className.isEmpty() && outputLine.trimmed().isEmpty())
return;
m_xmlReader.addData(outputLine);
// avoid encoding problems for Quick tests
m_xmlReader.addData(m_testType == TestType::QuickTest ? QString::fromLatin1(outputLine)
: QString::fromLocal8Bit(outputLine));
while (!m_xmlReader.atEnd()) {
if (m_futureInterface.isCanceled())
return;

View File

@@ -65,9 +65,6 @@ MakeStepFactory::MakeStepFactory()
registerStep<MakeStep>(MAKE_STEP_ID);
setDisplayName(tr("Make", "Display name for AutotoolsProjectManager::MakeStep id."));
setSupportedProjectType(AUTOTOOLS_PROJECT_ID);
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
}
// MakeStep

View File

@@ -165,7 +165,9 @@ private:
QString text;
if (m_displayHints.showCategoryAndEnableOption)
// Diagnostics from clazy/tidy do not have any category or option set, so
// avoid to add an empty line.
if (m_displayHints.showCategoryAndEnableOption && !diagnostic.category.isEmpty())
text.append(diagnosticCategoryAndEnableOptionRow(diagnostic));
text.append(diagnosticRow(diagnostic, IndentMode::DoNotIndent));
text.append(diagnosticRowsForChildren(diagnostic));

View File

@@ -448,6 +448,7 @@ public:
, m_projectPart(projectPart)
{
addLanguageOptions();
addGlobalDiagnosticOptions(); // Before addDiagnosticOptions() so users still can overwrite.
addDiagnosticOptions();
addGlobalOptions();
addPrecompiledHeaderOptions();
@@ -546,6 +547,15 @@ private:
addXclangArg("-plugin-arg-clang-lazy", "ignore-included-files");
}
void addGlobalDiagnosticOptions()
{
m_options.append({
// Avoid undesired warnings from e.g. Q_OBJECT
QStringLiteral("-Wno-unknown-pragmas"),
QStringLiteral("-Wno-unknown-warning-option")
});
}
void addGlobalOptions()
{
if (!m_projectPart.project)

View File

@@ -138,13 +138,14 @@ QIcon Core::IOptionsPage::categoryIcon() const
static QList<Core::IOptionsPage *> g_optionsPages;
/*!
Constructs an options page with the given \a parent.
Constructs an options page with the given \a parent and registers it
at the global options page pool if \a registerGlobally is true.
*/
Core::IOptionsPage::IOptionsPage(QObject *parent)
: QObject(parent),
m_keywordsInitialized(false)
Core::IOptionsPage::IOptionsPage(QObject *parent, bool registerGlobally)
: QObject(parent)
{
g_optionsPages.append(this);
if (registerGlobally)
g_optionsPages.append(this);
}
/*!

View File

@@ -44,7 +44,7 @@ class CORE_EXPORT IOptionsPage : public QObject
Q_OBJECT
public:
IOptionsPage(QObject *parent = 0);
IOptionsPage(QObject *parent = nullptr, bool registerGlobally = true);
virtual ~IOptionsPage();
static const QList<IOptionsPage *> allOptionsPages();
@@ -73,7 +73,7 @@ protected:
QString m_displayCategory;
Utils::Icon m_categoryIcon;
mutable bool m_keywordsInitialized;
mutable bool m_keywordsInitialized = false;
mutable QStringList m_keywords;
};

View File

@@ -33,11 +33,6 @@
namespace CppTools {
static QStringList commonWarnings()
{
return { QStringLiteral("-Wno-unknown-pragmas") };
}
static void addConfigForQuestionableConstructs(ClangDiagnosticConfigsModel &model)
{
ClangDiagnosticConfig config;
@@ -48,7 +43,7 @@ static void addConfigForQuestionableConstructs(ClangDiagnosticConfigsModel &mode
config.setClangOptions(QStringList{
QStringLiteral("-Wall"),
QStringLiteral("-Wextra"),
} + commonWarnings());
});
model.appendOrUpdate(config);
}
@@ -60,7 +55,7 @@ static void addConfigForPedanticWarnings(ClangDiagnosticConfigsModel &model)
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
"Pedantic Warnings"));
config.setIsReadOnly(true);
config.setClangOptions(QStringList{QStringLiteral("-Wpedantic")} + commonWarnings());
config.setClangOptions(QStringList{QStringLiteral("-Wpedantic")});
model.appendOrUpdate(config);
}
@@ -86,7 +81,7 @@ static void addConfigForAlmostEveryWarning(ClangDiagnosticConfigsModel &model)
QStringLiteral("-Wno-switch-enum"),
QStringLiteral("-Wno-missing-prototypes"), // Not optimal for C projects.
QStringLiteral("-Wno-used-but-marked-unused"), // e.g. QTest::qWait
} + commonWarnings());
});
model.appendOrUpdate(config);
}

View File

@@ -210,6 +210,7 @@ void appendDebugOutput(QtMsgType type, const QString &message, const QDebugConte
{
ConsoleItem::ItemType itemType;
switch (type) {
case QtInfoMsg:
case QtDebugMsg:
itemType = ConsoleItem::DebugType;
break;
@@ -220,11 +221,10 @@ void appendDebugOutput(QtMsgType type, const QString &message, const QDebugConte
case QtFatalMsg:
itemType = ConsoleItem::ErrorType;
break;
default:
//This case is not possible
return;
}
QTC_ASSERT(itemType != ConsoleItem::DefaultType, return);
debuggerConsole()->printItem(new ConsoleItem(itemType, message, info.file, info.line));
}

View File

@@ -36,6 +36,7 @@
using namespace Designer::Internal;
SettingsPage::SettingsPage(QDesignerOptionsPageInterface *designerPage) :
Core::IOptionsPage(nullptr, false),
m_designerPage(designerPage)
{
setId(Core::Id::fromString(m_designerPage->name()));

View File

@@ -44,7 +44,7 @@ DescriptionWidgetWatcher::DescriptionWidgetWatcher(DiffEditorController *control
m_widgets.append(widget);
}
connect(EditorManager::instance(), &EditorManager::editorOpened,
connect(EditorManager::instance(), &EditorManager::editorOpened, this,
[this](IEditor *editor) {
if (TextEditor::TextEditorWidget *widget = descriptionWidget(editor)) {
m_widgets.append(widget);
@@ -52,7 +52,7 @@ DescriptionWidgetWatcher::DescriptionWidgetWatcher(DiffEditorController *control
}
});
connect(EditorManager::instance(), &EditorManager::editorAboutToClose,
connect(EditorManager::instance(), &EditorManager::editorAboutToClose, this,
[this](IEditor *editor) {
if (TextEditor::TextEditorWidget *widget = descriptionWidget(editor)) {
emit descriptionWidgetRemoved(widget);

View File

@@ -227,7 +227,7 @@ void DiffEditorWidgetController::addCodePasterAction(QMenu *menu, int fileIndex,
if (ExtensionSystem::PluginManager::getObject<CodePaster::Service>()) {
// optional code pasting service
QAction *sendChunkToCodePasterAction = menu->addAction(tr("Send Chunk to CodePaster..."));
connect(sendChunkToCodePasterAction, &QAction::triggered, [this, fileIndex, chunkIndex]() {
connect(sendChunkToCodePasterAction, &QAction::triggered, this, [this, fileIndex, chunkIndex]() {
sendChunkToCodePaster(fileIndex, chunkIndex);
});
}
@@ -253,7 +253,7 @@ bool DiffEditorWidgetController::fileNamesAreDifferent(int fileIndex) const
void DiffEditorWidgetController::addApplyAction(QMenu *menu, int fileIndex, int chunkIndex)
{
QAction *applyAction = menu->addAction(tr("Apply Chunk..."));
connect(applyAction, &QAction::triggered, [this, fileIndex, chunkIndex]() {
connect(applyAction, &QAction::triggered, this, [this, fileIndex, chunkIndex]() {
patch(false, fileIndex, chunkIndex);
});
applyAction->setEnabled(chunkExists(fileIndex, chunkIndex) && fileNamesAreDifferent(fileIndex));
@@ -262,7 +262,7 @@ void DiffEditorWidgetController::addApplyAction(QMenu *menu, int fileIndex, int
void DiffEditorWidgetController::addRevertAction(QMenu *menu, int fileIndex, int chunkIndex)
{
QAction *revertAction = menu->addAction(tr("Revert Chunk..."));
connect(revertAction, &QAction::triggered, [this, fileIndex, chunkIndex]() {
connect(revertAction, &QAction::triggered, this, [this, fileIndex, chunkIndex]() {
patch(true, fileIndex, chunkIndex);
});
revertAction->setEnabled(chunkExists(fileIndex, chunkIndex));

View File

@@ -166,7 +166,7 @@ SideDiffEditorWidget::SideDiffEditorWidget(QWidget *parent)
settings.m_highlightBlocks = false;
SelectableTextEditorWidget::setDisplaySettings(settings);
connect(this, &TextEditorWidget::tooltipRequested, [this](const QPoint &point, int position) {
connect(this, &TextEditorWidget::tooltipRequested, this, [this](const QPoint &point, int position) {
const int block = document()->findBlock(position).blockNumber();
const auto it = m_fileInfo.constFind(block);
if (it != m_fileInfo.constEnd())
@@ -648,10 +648,10 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
};
setupHighlightController();
connect(m_leftEditor, &SideDiffEditorWidget::gotDisplaySettings, setupHighlightController);
connect(m_leftEditor, &SideDiffEditorWidget::gotDisplaySettings, this, setupHighlightController);
m_rightEditor->verticalScrollBar()->setFocusProxy(m_leftEditor);
connect(m_leftEditor, &SideDiffEditorWidget::gotFocus, [this]() {
connect(m_leftEditor, &SideDiffEditorWidget::gotFocus, this, [this]() {
if (m_rightEditor->verticalScrollBar()->focusProxy() == m_leftEditor)
return; // We already did it before.
@@ -672,7 +672,7 @@ SideBySideDiffEditorWidget::SideBySideDiffEditorWidget(QWidget *parent)
// too. We bring back the original policy to keep tab focus working.
m_leftEditor->setFocusPolicy(Qt::StrongFocus);
});
connect(m_rightEditor, &SideDiffEditorWidget::gotFocus, [this]() {
connect(m_rightEditor, &SideDiffEditorWidget::gotFocus, this, [this]() {
// Unhack #1.
m_rightEditor->verticalScrollBar()->setFocusProxy(nullptr);
// Unhack #2.

View File

@@ -318,7 +318,8 @@ GenericMakeAllStepFactory::GenericMakeAllStepFactory()
setDisplayName(QCoreApplication::translate(
"GenericProjectManager::Internal::GenericMakeStep", GENERIC_MS_DISPLAY_NAME));
setSupportedProjectType(Constants::GENERICPROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
}
//

View File

@@ -303,7 +303,7 @@ void GitDiffEditorController::updateBranchList()
VcsCommand *command = GitPlugin::client()->vcsExec(
workingDirectory, {"branch", noColorOption, "-a", "--contains", revision}, nullptr,
false, 0, workingDirectory);
connect(command, &VcsCommand::stdOutText, [this](const QString &text) {
connect(command, &VcsCommand::stdOutText, this, [this](const QString &text) {
const QString remotePrefix = "remotes/";
const QString localPrefix = "<Local>";
const int prefixLength = remotePrefix.length();
@@ -829,12 +829,12 @@ void GitClient::chunkActionsRequested(QMenu *menu, int fileIndex, int chunkIndex
menu->addSeparator();
QAction *stageChunkAction = menu->addAction(tr("Stage Chunk"));
connect(stageChunkAction, &QAction::triggered,
connect(stageChunkAction, &QAction::triggered, this,
[stageChunk, diffController, fileIndex, chunkIndex]() {
stageChunk(diffController, fileIndex, chunkIndex, false);
});
QAction *unstageChunkAction = menu->addAction(tr("Unstage Chunk"));
connect(unstageChunkAction, &QAction::triggered,
connect(unstageChunkAction, &QAction::triggered, this,
[stageChunk, diffController, fileIndex, chunkIndex]() {
stageChunk(diffController, fileIndex, chunkIndex, true);
});
@@ -1000,7 +1000,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
if (!argWidget) {
argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
argWidget->setBaseArguments(args);
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
editor->setEditorConfig(argWidget);
}
@@ -1086,7 +1086,7 @@ VcsBaseEditorWidget *GitClient::annotate(
if (!argWidget) {
argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
argWidget->setBaseArguments(extraOptions);
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
[=] {
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
annotate(workingDir, file, revision, line, extraOptions);

View File

@@ -328,9 +328,6 @@ void IosDsymBuildStepConfigWidget::resetDefaults()
IosDsymBuildStepFactory::IosDsymBuildStepFactory()
{
registerStep<IosDsymBuildStep>(Constants::IOS_DSYM_BUILD_STEP_ID);
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
ProjectExplorer::Constants::BUILDSTEPS_BUILD,
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE,
Constants::IOS_SIMULATOR_TYPE});
setDisplayName("dsymutil");

View File

@@ -904,12 +904,15 @@ void ListField::initializeData(MacroExpander *expander)
{
QTC_ASSERT(widget(), return);
if (m_index >= int(m_itemList.size())) {
qWarning().noquote() << QString("%1 (\"%2\") has an index of %3 which does not exist.").arg(type(), name(), QString::number(m_index));
m_index = -1;
}
QStandardItem *currentItem = m_index >= 0 ? m_itemList[uint(m_index)].get() : nullptr;
QList<QStandardItem*> expandedValuesItems;
expandedValuesItems.reserve(int(m_itemList.size()));
QSize maxIconSize;
for (const std::unique_ptr<QStandardItem> &item : m_itemList) {
bool condition = JsonWizard::boolFromVariant(item->data(ConditionRole), expander);
if (!condition)

View File

@@ -148,9 +148,6 @@ ProcessStepFactory::ProcessStepFactory()
{
registerStep<ProcessStep>(PROCESS_STEP_ID);
setDisplayName(ProcessStep::tr("Custom Process Step", "item in combobox"));
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
ProjectExplorer::Constants::BUILDSTEPS_DEPLOY});
}
//*******

View File

@@ -88,7 +88,7 @@ namespace ProjectExplorer {
static bool isListedFileNode(const Node *node)
{
return node->asContainerNode() || (node->nodeType() == NodeType::File && node->listInProject());
return node->asContainerNode() || node->listInProject();
}
static bool nodeLessThan(const Node *n1, const Node *n2)

View File

@@ -460,6 +460,7 @@ void QbsProject::updateAfterParse()
updateCppCodeModel();
updateQmlJsCodeModel();
emit fileListChanged();
emit dataChanged();
}
void QbsProject::delayedUpdateAfterParse()
@@ -617,6 +618,7 @@ void QbsProject::updateAfterBuild()
m_extraCompilersPending = false;
updateCppCodeModel();
}
emit dataChanged();
}
void QbsProject::registerQbsProjectParser(QbsProjectParser *p)

View File

@@ -105,6 +105,9 @@ public:
void delayParsing();
signals:
void dataChanged();
private:
void handleQbsParsingDone(bool success);

View File

@@ -112,8 +112,8 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target)
connect(target, &Target::kitChanged,
this, &QbsRunConfiguration::updateTargetInformation);
connect(target->project(), &Project::parsingFinished,
this, &QbsRunConfiguration::updateTargetInformation);
QbsProject *qbsProject = static_cast<QbsProject *>(project());
connect(qbsProject, &QbsProject::dataChanged, this, [this] { m_envCache.clear(); });
}
QVariantMap QbsRunConfiguration::toMap() const
@@ -164,9 +164,16 @@ void QbsRunConfiguration::setUsingLibraryPaths(bool useLibPaths)
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
{
const auto key = qMakePair(env.toStringList(), m_usingLibraryPaths);
const auto it = m_envCache.constFind(key);
if (it != m_envCache.constEnd()) {
env = it.value();
return;
}
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
if (bti.runEnvModifier)
bti.runEnvModifier(env, m_usingLibraryPaths);
m_envCache.insert(key, env);
}
Utils::OutputFormatter *QbsRunConfiguration::createOutputFormatter() const

View File

@@ -28,7 +28,9 @@
#include <projectexplorer/runnables.h>
#include <QCheckBox>
#include <QHash>
#include <QLabel>
#include <QPair>
#include <QStringList>
#include <QWidget>
@@ -62,6 +64,8 @@ private:
void updateTargetInformation();
using EnvCache = QHash<QPair<QStringList, bool>, Utils::Environment>;
mutable EnvCache m_envCache;
bool m_usingLibraryPaths = true;
};

View File

@@ -461,6 +461,4 @@ MakeStepFactory::MakeStepFactory()
registerStep<MakeStep>(MAKESTEP_BS_ID);
setSupportedProjectType(Constants::QMAKEPROJECT_ID);
setDisplayName(tr("Make"));
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_BUILD,
ProjectExplorer::Constants::BUILDSTEPS_CLEAN});
}

View File

@@ -633,7 +633,7 @@ static inline Kit *getActiveKit(DesignDocument *designDocument)
if (!target)
return 0;
if (!target->kit()->isValid())
if (!target->kit() || !target->kit()->isValid())
return 0;
QObject::connect(target, &Target::kitChanged,
designDocument, &DesignDocument::updateActiveQtVersion, Qt::UniqueConnection);

View File

@@ -24,6 +24,8 @@
****************************************************************************/
#include "designdocumentview.h"
#include <exception.h>
#include <rewriterview.h>
#include <basetexteditmodifier.h>
#include <modelmerger.h>
@@ -156,7 +158,11 @@ void DesignDocumentView::fromText(QString text)
if (rewriterView->errors().isEmpty() && rewriterView->rootModelNode().isValid()) {
ModelMerger merger(this);
merger.replaceModel(rewriterView->rootModelNode());
try {
merger.replaceModel(rewriterView->rootModelNode());
} catch(Exception &e) {
e.showException();
}
}
}

View File

@@ -90,6 +90,33 @@ void CustomFileSystemModel::setFilter(QDir::Filters)
}
QString filterMetaIcons(const QString fileName)
{
QFileInfo info(fileName);
if (info.dir().path().split("/").contains("designer")) {
QDir currentDir = info.dir();
int i = 0;
while (!currentDir.isRoot() && i < 3) {
if (currentDir.dirName() == "designer") {
if (!currentDir.entryList({"*.metainfo"}).isEmpty())
return {};
}
currentDir.cdUp();
++i;
}
if (info.dir().dirName() == "designer")
return {};
}
return fileName;
}
QModelIndex CustomFileSystemModel::setRootPath(const QString &newPath)
{
beginResetModel();
@@ -116,7 +143,7 @@ QModelIndex CustomFileSystemModel::setRootPath(const QString &newPath)
QDirIterator fileIterator(newPath, nameFilterList, QDir::Files, QDirIterator::Subdirectories);
while (fileIterator.hasNext())
m_files.append(fileIterator.next());
m_files.append(filterMetaIcons(fileIterator.next()));
QDirIterator dirIterator(newPath, {}, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
while (dirIterator.hasNext())

View File

@@ -225,6 +225,8 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV
NodeInstanceServerProxy::~NodeInstanceServerProxy()
{
m_destructing = true;
disconnect(this, SLOT(processFinished(int,QProcess::ExitStatus)));
writeCommand(QVariant::fromValue(EndPuppetCommand()));
@@ -273,6 +275,9 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command, PuppetStr
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
static const int puppetAliveCommandType = QMetaType::type("PuppetAliveCommand");
if (m_destructing)
return;
qCInfo(instanceViewBenchmark) << "dispatching command" << command.userType() << command.typeName();
if (command.userType() == informationChangedCommandType) {
nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>());

View File

@@ -128,6 +128,7 @@ private:
RunModus m_runModus;
int m_synchronizeId = -1;
QTime m_benchmarkTimer;
bool m_destructing = false;
};
} // namespace QmlDesigner

View File

@@ -76,7 +76,7 @@ static inline bool isSupportedAttachedProperties(const QString &propertyName)
static inline QStringList supportedVersionsList()
{
static const QStringList list = {
"2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10"
"2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11"
};
return list;
}
@@ -96,7 +96,7 @@ static inline QStringList globalQtEnums()
static inline QStringList knownEnumScopes()
{
static const QStringList list = {
"TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath"
"TextInput", "TextEdit", "Material", "Universal", "Font", "Shape", "ShapePath", "AbstractButton"
};
return list;
}

View File

@@ -499,6 +499,10 @@ QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
{
m_semanticInfoUpdater->abort();
m_semanticInfoUpdater->wait();
// clean up all marks, otherwise a callback could try to access deleted members.
// see QTCREATORBUG-20199
cleanDiagnosticMarks();
cleanSemanticMarks();
}
void QmlJSEditorDocumentPrivate::invalidateFormatterCache()

View File

@@ -413,6 +413,12 @@ QSet<Id> BaseQtVersion::availableFeatures() const
if (qtVersion().matches(5, 10))
return features;
features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 2, 11));
features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_2_PREFIX, 2, 4));
if (qtVersion().matches(5, 11))
return features;
return features;
}

View File

@@ -70,6 +70,14 @@
<description><![CDATA[Using Qt Quick Designer to develop Qt Quick applications.]]></description>
<tags>qt creator,qt quick,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: QML - Introduction" isVideo="true" videoUrl="https://www.youtube.com/watch?v=GkzncJ71mm0" videoLength="9:42">
<description><![CDATA[Using signals, slots, and property bindings Qt Quick applications.]]></description>
<tags>qt creator,qt quick,qml,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/videotutorialicon.png" difficulty="" projectPath="" name="Online: Qt Quick Designer - Qt Quick Controls" isVideo="true" videoUrl="https://www.youtube.com/watch?v=uuhmSZxK1mk" videoLength="7:09">
<description><![CDATA[Using Qt Quick Controls to develop Qt Quick applications.]]></description>
<tags>qt creator,qt quick,controls,video</tags>
</tutorial>
<tutorial imageUrl=":qtsupport/images/icons/qteventicon.png" difficulty="" projectPath="" name="Talk: Qt Creator - Getting Started" isVideo="true" videoUrl="https://www.youtube.com/watch?v=nGFmjOiT22Y" videoLength="50:36">
<description><![CDATA[Getting started with using Qt Creator for cross-platform development.]]></description>

View File

@@ -247,6 +247,14 @@ bool RegExprRule::doMatchSucceed(const QString &text,
return false;
}
RegExprRule *RegExprRule::doClone() const
{
auto clone = new RegExprRule(*this);
if (m_progress)
m_progress->trackRule(clone);
return clone;
}
// Keyword
KeywordRule::KeywordRule(const QSharedPointer<HighlightDefinition> &definition) :
m_overrideGlobal(false),

View File

@@ -124,7 +124,7 @@ private:
virtual bool doMatchSucceed(const QString &text,
const int length,
ProgressData *progress);
virtual RegExprRule *doClone() const { return new RegExprRule(*this); }
virtual RegExprRule *doClone() const;
virtual void doReplaceExpressions(const QStringList &captures);
virtual void doProgressFinished();

View File

@@ -19,7 +19,7 @@ SOURCES += clangbackendmain.cpp
HEADERS += ../qtcreatorcrashhandler/crashhandlersetup.h
SOURCES += ../qtcreatorcrashhandler/crashhandlersetup.cpp
unix {
unix:!disable_external_rpath:!contains(QMAKE_DEFAULT_LIBDIRS, $${LLVM_LIBDIR}) {
!osx: QMAKE_LFLAGS += -Wl,-z,origin
!contains(QMAKE_DEFAULT_LIBDIRS, $${LLVM_LIBDIR}):!disable_external_rpath: QMAKE_LFLAGS += -Wl,-rpath,$$shell_quote($${LLVM_LIBDIR})
QMAKE_LFLAGS += -Wl,-rpath,$$shell_quote($${LLVM_LIBDIR})
}

View File

@@ -237,6 +237,17 @@ static bool isHeaderErrorDiagnostic(const Utf8String &mainFilePath, const Diagno
return isCritical && diagnostic.location().filePath() != mainFilePath;
}
static bool isIgnoredHeaderErrorDiagnostic(const Diagnostic &diagnostic)
{
// FIXME: This diagnostic can appear if e.g. a main file includes a -isystem header and then the
// header is opened in the editor - the provided unsaved file for the newly opened editor
// overrides the file from the preamble. In this case, clang uses the version from the preamble
// and changes in the header are not reflected in the main file. Typically that's not a problem
// because only non-project headers are opened as -isystem headers.
return diagnostic.text().endsWith(
Utf8StringLiteral("from the precompiled header has been overridden"));
}
void TranslationUnit::extractDiagnostics(DiagnosticContainer &firstHeaderErrorDiagnostic,
QVector<DiagnosticContainer> &mainFileDiagnostics) const
{
@@ -246,7 +257,9 @@ void TranslationUnit::extractDiagnostics(DiagnosticContainer &firstHeaderErrorDi
bool hasFirstHeaderErrorDiagnostic = false;
for (const Diagnostic &diagnostic : diagnostics()) {
if (!hasFirstHeaderErrorDiagnostic && isHeaderErrorDiagnostic(m_filePath, diagnostic)) {
if (!hasFirstHeaderErrorDiagnostic
&& isHeaderErrorDiagnostic(m_filePath, diagnostic)
&& !isIgnoredHeaderErrorDiagnostic(diagnostic)) {
hasFirstHeaderErrorDiagnostic = true;
firstHeaderErrorDiagnostic = diagnostic.toDiagnosticContainer();
}

View File

@@ -28,9 +28,9 @@ SOURCES += \
../clangrefactoringbackend/source/refactoringcompilationdatabase.cpp
unix {
unix:!disable_external_rpath:!contains(QMAKE_DEFAULT_LIBDIRS, $${LLVM_LIBDIR}) {
!macx: QMAKE_LFLAGS += -Wl,-z,origin
!disable_external_rpath: QMAKE_LFLAGS += -Wl,-rpath,$$shell_quote($${LLVM_LIBDIR})
QMAKE_LFLAGS += -Wl,-rpath,$$shell_quote($${LLVM_LIBDIR})
}
DEFINES += CLANG_COMPILER_PATH=\"R\\\"xxx($${LLVM_BINDIR}/clang)xxx\\\"\"

View File

@@ -23,7 +23,7 @@ QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS
SOURCES += \
clangrefactoringbackendmain.cpp
unix {
unix:!disable_external_rpath:!contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR) {
!osx: QMAKE_LFLAGS += -Wl,-z,origin
!disable_external_rpath: QMAKE_LFLAGS += -Wl,-rpath,$$shell_quote($${LLVM_LIBDIR})
QMAKE_LFLAGS += -Wl,-rpath,$$shell_quote($${LLVM_LIBDIR})
}

View File

@@ -362,6 +362,7 @@ def invokeFindUsage(editor, line, typeOperation, n=1):
return False
for i in range(n):
type(editor, typeOperation)
snooze(1)
invokeContextMenuItem(editor, "Find Usages")
return True

View File

@@ -82,10 +82,6 @@ def main():
if counter < len(qtVersionsForQuick) - 1:
displayedPlatforms = __createProject__(category, template)
continue
elif template.startswith("Plain C"):
handleBuildSystemVerifyKits(category, template, kits, displayedPlatforms)
continue
handleBuildSystemVerifyKits(category, template, kits, displayedPlatforms)
invokeMenuItem("File", "Exit")

View File

@@ -17,7 +17,7 @@ include(../../../src/shared/clang/clang_installation.pri)
}
LIBS += $$LIBTOOLING_LIBS $$LIBCLANG_LIBS
QMAKE_RPATHDIR += $$LLVM_LIBDIR
!contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): QMAKE_RPATHDIR += $$LLVM_LIBDIR
LLVM_CXXFLAGS ~= s,-g\d?,
QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS