r338291 - Remove trailing space
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 30 12:24:50 PDT 2018
Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Mon Jul 30 12:24:48 2018
@@ -35,14 +35,14 @@ namespace {
struct BaseOffset {
/// DerivedClass - The derived class.
const CXXRecordDecl *DerivedClass;
-
+
/// VirtualBase - If the path from the derived class to the base class
/// involves virtual base classes, this holds the declaration of the last
/// virtual base in this path (i.e. closest to the base class).
const CXXRecordDecl *VirtualBase;
/// NonVirtualOffset - The offset from the derived class to the base class.
- /// (Or the offset from the virtual base class to the base class, if the
+ /// (Or the offset from the virtual base class to the base class, if the
/// path from the derived class to the base class involves a virtual base
/// class.
CharUnits NonVirtualOffset;
@@ -51,7 +51,7 @@ struct BaseOffset {
NonVirtualOffset(CharUnits::Zero()) { }
BaseOffset(const CXXRecordDecl *DerivedClass,
const CXXRecordDecl *VirtualBase, CharUnits NonVirtualOffset)
- : DerivedClass(DerivedClass), VirtualBase(VirtualBase),
+ : DerivedClass(DerivedClass), VirtualBase(VirtualBase),
NonVirtualOffset(NonVirtualOffset) { }
bool isEmpty() const { return NonVirtualOffset.isZero() && !VirtualBase; }
@@ -81,19 +81,19 @@ private:
/// MostDerivedClass - The most derived class for which the final overriders
/// are stored.
const CXXRecordDecl *MostDerivedClass;
-
- /// MostDerivedClassOffset - If we're building final overriders for a
+
+ /// MostDerivedClassOffset - If we're building final overriders for a
/// construction vtable, this holds the offset from the layout class to the
/// most derived class.
const CharUnits MostDerivedClassOffset;
- /// LayoutClass - The class we're using for layout information. Will be
+ /// LayoutClass - The class we're using for layout information. Will be
/// different than the most derived class if the final overriders are for a
- /// construction vtable.
- const CXXRecordDecl *LayoutClass;
+ /// construction vtable.
+ const CXXRecordDecl *LayoutClass;
ASTContext &Context;
-
+
/// MostDerivedClassLayout - the AST record layout of the most derived class.
const ASTRecordLayout &MostDerivedClassLayout;
@@ -103,19 +103,19 @@ private:
typedef llvm::DenseMap<MethodBaseOffsetPairTy,
OverriderInfo> OverridersMapTy;
-
- /// OverridersMap - The final overriders for all virtual member functions of
+
+ /// OverridersMap - The final overriders for all virtual member functions of
/// all the base subobjects of the most derived class.
OverridersMapTy OverridersMap;
-
+
/// SubobjectsToOffsetsMapTy - A mapping from a base subobject (represented
/// as a record decl and a subobject number) and its offsets in the most
/// derived class as well as the layout class.
- typedef llvm::DenseMap<std::pair<const CXXRecordDecl *, unsigned>,
+ typedef llvm::DenseMap<std::pair<const CXXRecordDecl *, unsigned>,
CharUnits> SubobjectOffsetMapTy;
typedef llvm::DenseMap<const CXXRecordDecl *, unsigned> SubobjectCountMapTy;
-
+
/// ComputeBaseOffsets - Compute the offsets for all base subobjects of the
/// given base.
void ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
@@ -125,40 +125,40 @@ private:
SubobjectCountMapTy &SubobjectCounts);
typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy;
-
+
/// dump - dump the final overriders for a base subobject, and all its direct
/// and indirect base subobjects.
void dump(raw_ostream &Out, BaseSubobject Base,
VisitedVirtualBasesSetTy& VisitedVirtualBases);
-
+
public:
FinalOverriders(const CXXRecordDecl *MostDerivedClass,
CharUnits MostDerivedClassOffset,
const CXXRecordDecl *LayoutClass);
/// getOverrider - Get the final overrider for the given method declaration in
- /// the subobject with the given base offset.
- OverriderInfo getOverrider(const CXXMethodDecl *MD,
+ /// the subobject with the given base offset.
+ OverriderInfo getOverrider(const CXXMethodDecl *MD,
CharUnits BaseOffset) const {
- assert(OverridersMap.count(std::make_pair(MD, BaseOffset)) &&
+ assert(OverridersMap.count(std::make_pair(MD, BaseOffset)) &&
"Did not find overrider!");
-
+
return OverridersMap.lookup(std::make_pair(MD, BaseOffset));
}
-
+
/// dump - dump the final overriders.
void dump() {
VisitedVirtualBasesSetTy VisitedVirtualBases;
- dump(llvm::errs(), BaseSubobject(MostDerivedClass, CharUnits::Zero()),
+ dump(llvm::errs(), BaseSubobject(MostDerivedClass, CharUnits::Zero()),
VisitedVirtualBases);
}
-
+
};
FinalOverriders::FinalOverriders(const CXXRecordDecl *MostDerivedClass,
CharUnits MostDerivedClassOffset,
const CXXRecordDecl *LayoutClass)
- : MostDerivedClass(MostDerivedClass),
+ : MostDerivedClass(MostDerivedClass),
MostDerivedClassOffset(MostDerivedClassOffset), LayoutClass(LayoutClass),
Context(MostDerivedClass->getASTContext()),
MostDerivedClassLayout(Context.getASTRecordLayout(MostDerivedClass)) {
@@ -167,10 +167,10 @@ FinalOverriders::FinalOverriders(const C
SubobjectOffsetMapTy SubobjectOffsets;
SubobjectOffsetMapTy SubobjectLayoutClassOffsets;
SubobjectCountMapTy SubobjectCounts;
- ComputeBaseOffsets(BaseSubobject(MostDerivedClass, CharUnits::Zero()),
+ ComputeBaseOffsets(BaseSubobject(MostDerivedClass, CharUnits::Zero()),
/*IsVirtual=*/false,
- MostDerivedClassOffset,
- SubobjectOffsets, SubobjectLayoutClassOffsets,
+ MostDerivedClassOffset,
+ SubobjectOffsets, SubobjectLayoutClassOffsets,
SubobjectCounts);
// Get the final overriders.
@@ -183,10 +183,10 @@ FinalOverriders::FinalOverriders(const C
for (const auto &M : Methods) {
unsigned SubobjectNumber = M.first;
- assert(SubobjectOffsets.count(std::make_pair(MD->getParent(),
+ assert(SubobjectOffsets.count(std::make_pair(MD->getParent(),
SubobjectNumber)) &&
"Did not find subobject offset!");
-
+
CharUnits BaseOffset = SubobjectOffsets[std::make_pair(MD->getParent(),
SubobjectNumber)];
@@ -198,12 +198,12 @@ FinalOverriders::FinalOverriders(const C
std::make_pair(OverriderRD, Method.Subobject))
&& "Did not find subobject offset!");
CharUnits OverriderOffset =
- SubobjectLayoutClassOffsets[std::make_pair(OverriderRD,
+ SubobjectLayoutClassOffsets[std::make_pair(OverriderRD,
Method.Subobject)];
OverriderInfo& Overrider = OverridersMap[std::make_pair(MD, BaseOffset)];
assert(!Overrider.Method && "Overrider should not exist yet!");
-
+
Overrider.Offset = OverriderOffset;
Overrider.Method = Method.Method;
Overrider.VirtualBase = Method.InVirtualSubobject;
@@ -235,11 +235,11 @@ static BaseOffset ComputeBaseOffset(cons
break;
}
}
-
+
// Now compute the non-virtual offset.
for (unsigned I = NonVirtualStart, E = Path.size(); I != E; ++I) {
const CXXBasePathElement &Element = Path[I];
-
+
// Check the base class offset.
const ASTRecordLayout &Layout = Context.getASTRecordLayout(Element.Class);
@@ -247,12 +247,12 @@ static BaseOffset ComputeBaseOffset(cons
NonVirtualOffset += Layout.getBaseClassOffset(Base);
}
-
+
// FIXME: This should probably use CharUnits or something. Maybe we should
- // even change the base offsets in ASTRecordLayout to be specified in
+ // even change the base offsets in ASTRecordLayout to be specified in
// CharUnits.
return BaseOffset(DerivedRD, VirtualBase, NonVirtualOffset);
-
+
}
static BaseOffset ComputeBaseOffset(const ASTContext &Context,
@@ -268,67 +268,67 @@ static BaseOffset ComputeBaseOffset(cons
}
static BaseOffset
-ComputeReturnAdjustmentBaseOffset(ASTContext &Context,
+ComputeReturnAdjustmentBaseOffset(ASTContext &Context,
const CXXMethodDecl *DerivedMD,
const CXXMethodDecl *BaseMD) {
const FunctionType *BaseFT = BaseMD->getType()->getAs<FunctionType>();
const FunctionType *DerivedFT = DerivedMD->getType()->getAs<FunctionType>();
-
+
// Canonicalize the return types.
CanQualType CanDerivedReturnType =
Context.getCanonicalType(DerivedFT->getReturnType());
CanQualType CanBaseReturnType =
Context.getCanonicalType(BaseFT->getReturnType());
- assert(CanDerivedReturnType->getTypeClass() ==
- CanBaseReturnType->getTypeClass() &&
+ assert(CanDerivedReturnType->getTypeClass() ==
+ CanBaseReturnType->getTypeClass() &&
"Types must have same type class!");
-
+
if (CanDerivedReturnType == CanBaseReturnType) {
// No adjustment needed.
return BaseOffset();
}
-
+
if (isa<ReferenceType>(CanDerivedReturnType)) {
- CanDerivedReturnType =
+ CanDerivedReturnType =
CanDerivedReturnType->getAs<ReferenceType>()->getPointeeType();
- CanBaseReturnType =
+ CanBaseReturnType =
CanBaseReturnType->getAs<ReferenceType>()->getPointeeType();
} else if (isa<PointerType>(CanDerivedReturnType)) {
- CanDerivedReturnType =
+ CanDerivedReturnType =
CanDerivedReturnType->getAs<PointerType>()->getPointeeType();
- CanBaseReturnType =
+ CanBaseReturnType =
CanBaseReturnType->getAs<PointerType>()->getPointeeType();
} else {
llvm_unreachable("Unexpected return type!");
}
-
+
// We need to compare unqualified types here; consider
// const T *Base::foo();
// T *Derived::foo();
- if (CanDerivedReturnType.getUnqualifiedType() ==
+ if (CanDerivedReturnType.getUnqualifiedType() ==
CanBaseReturnType.getUnqualifiedType()) {
// No adjustment needed.
return BaseOffset();
}
-
- const CXXRecordDecl *DerivedRD =
+
+ const CXXRecordDecl *DerivedRD =
cast<CXXRecordDecl>(cast<RecordType>(CanDerivedReturnType)->getDecl());
-
- const CXXRecordDecl *BaseRD =
+
+ const CXXRecordDecl *BaseRD =
cast<CXXRecordDecl>(cast<RecordType>(CanBaseReturnType)->getDecl());
return ComputeBaseOffset(Context, BaseRD, DerivedRD);
}
-void
+void
FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
CharUnits OffsetInLayoutClass,
SubobjectOffsetMapTy &SubobjectOffsets,
SubobjectOffsetMapTy &SubobjectLayoutClassOffsets,
SubobjectCountMapTy &SubobjectCounts) {
const CXXRecordDecl *RD = Base.getBase();
-
+
unsigned SubobjectNumber = 0;
if (!IsVirtual)
SubobjectNumber = ++SubobjectCounts[RD];
@@ -336,13 +336,13 @@ FinalOverriders::ComputeBaseOffsets(Base
// Set up the subobject to offset mapping.
assert(!SubobjectOffsets.count(std::make_pair(RD, SubobjectNumber))
&& "Subobject offset already exists!");
- assert(!SubobjectLayoutClassOffsets.count(std::make_pair(RD, SubobjectNumber))
+ assert(!SubobjectLayoutClassOffsets.count(std::make_pair(RD, SubobjectNumber))
&& "Subobject offset already exists!");
SubobjectOffsets[std::make_pair(RD, SubobjectNumber)] = Base.getBaseOffset();
SubobjectLayoutClassOffsets[std::make_pair(RD, SubobjectNumber)] =
OffsetInLayoutClass;
-
+
// Traverse our bases.
for (const auto &B : RD->bases()) {
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
@@ -358,19 +358,19 @@ FinalOverriders::ComputeBaseOffsets(Base
Context.getASTRecordLayout(LayoutClass);
BaseOffset = MostDerivedClassLayout.getVBaseClassOffset(BaseDecl);
- BaseOffsetInLayoutClass =
+ BaseOffsetInLayoutClass =
LayoutClassLayout.getVBaseClassOffset(BaseDecl);
} else {
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
CharUnits Offset = Layout.getBaseClassOffset(BaseDecl);
-
+
BaseOffset = Base.getBaseOffset() + Offset;
BaseOffsetInLayoutClass = OffsetInLayoutClass + Offset;
}
- ComputeBaseOffsets(BaseSubobject(BaseDecl, BaseOffset),
- B.isVirtual(), BaseOffsetInLayoutClass,
- SubobjectOffsets, SubobjectLayoutClassOffsets,
+ ComputeBaseOffsets(BaseSubobject(BaseDecl, BaseOffset),
+ B.isVirtual(), BaseOffsetInLayoutClass,
+ SubobjectOffsets, SubobjectLayoutClassOffsets,
SubobjectCounts);
}
}
@@ -382,7 +382,7 @@ void FinalOverriders::dump(raw_ostream &
for (const auto &B : RD->bases()) {
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
-
+
// Ignore bases that don't have any virtual member functions.
if (!BaseDecl->isPolymorphic())
continue;
@@ -393,7 +393,7 @@ void FinalOverriders::dump(raw_ostream &
// We've visited this base before.
continue;
}
-
+
BaseOffset = MostDerivedClassLayout.getVBaseClassOffset(BaseDecl);
} else {
BaseOffset = Layout.getBaseClassOffset(BaseDecl) + Base.getBaseOffset();
@@ -431,19 +431,19 @@ void FinalOverriders::dump(raw_ostream &
Offset.VirtualBase->printQualifiedName(Out);
Out << " vbase, ";
}
-
+
Out << Offset.NonVirtualOffset.getQuantity() << " nv]";
}
-
+
Out << "\n";
- }
+ }
}
/// VCallOffsetMap - Keeps track of vcall offsets when building a vtable.
struct VCallOffsetMap {
-
+
typedef std::pair<const CXXMethodDecl *, CharUnits> MethodAndOffsetPairTy;
-
+
/// Offsets - Keeps track of methods and their offsets.
// FIXME: This should be a real map and not a vector.
SmallVector<MethodAndOffsetPairTy, 16> Offsets;
@@ -458,11 +458,11 @@ public:
/// add was successful, or false if there was already a member function with
/// the same signature in the map.
bool AddVCallOffset(const CXXMethodDecl *MD, CharUnits OffsetOffset);
-
+
/// getVCallOffsetOffset - Returns the vcall offset offset (relative to the
/// vtable address point) for the given virtual member function.
CharUnits getVCallOffsetOffset(const CXXMethodDecl *MD);
-
+
// empty - Return whether the offset map is empty or not.
bool empty() const { return Offsets.empty(); }
};
@@ -489,13 +489,13 @@ bool VCallOffsetMap::MethodsCanShareVCal
const CXXMethodDecl *RHS) {
assert(LHS->isVirtual() && "LHS must be virtual!");
assert(RHS->isVirtual() && "LHS must be virtual!");
-
+
// A destructor can share a vcall offset with another destructor.
if (isa<CXXDestructorDecl>(LHS))
return isa<CXXDestructorDecl>(RHS);
// FIXME: We need to check more things here.
-
+
// The methods must have the same name.
DeclarationName LHSName = LHS->getDeclName();
DeclarationName RHSName = RHS->getDeclName();
@@ -506,14 +506,14 @@ bool VCallOffsetMap::MethodsCanShareVCal
return HasSameVirtualSignature(LHS, RHS);
}
-bool VCallOffsetMap::AddVCallOffset(const CXXMethodDecl *MD,
+bool VCallOffsetMap::AddVCallOffset(const CXXMethodDecl *MD,
CharUnits OffsetOffset) {
// Check if we can reuse an offset.
for (const auto &OffsetPair : Offsets) {
if (MethodsCanShareVCallOffset(OffsetPair.first, MD))
return false;
}
-
+
// Add the offset.
Offsets.push_back(MethodAndOffsetPairTy(MD, OffsetOffset));
return true;
@@ -525,36 +525,36 @@ CharUnits VCallOffsetMap::getVCallOffset
if (MethodsCanShareVCallOffset(OffsetPair.first, MD))
return OffsetPair.second;
}
-
+
llvm_unreachable("Should always find a vcall offset offset!");
}
/// VCallAndVBaseOffsetBuilder - Class for building vcall and vbase offsets.
class VCallAndVBaseOffsetBuilder {
public:
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
+ typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
VBaseOffsetOffsetsMapTy;
private:
/// MostDerivedClass - The most derived class for which we're building vcall
/// and vbase offsets.
const CXXRecordDecl *MostDerivedClass;
-
- /// LayoutClass - The class we're using for layout information. Will be
+
+ /// LayoutClass - The class we're using for layout information. Will be
/// different than the most derived class if we're building a construction
/// vtable.
const CXXRecordDecl *LayoutClass;
-
+
/// Context - The ASTContext which we will use for layout information.
ASTContext &Context;
/// Components - vcall and vbase offset components
typedef SmallVector<VTableComponent, 64> VTableComponentVectorTy;
VTableComponentVectorTy Components;
-
+
/// VisitedVirtualBases - Visited virtual bases.
llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedVirtualBases;
-
+
/// VCallOffsets - Keeps track of vcall offsets.
VCallOffsetMap VCallOffsets;
@@ -562,7 +562,7 @@ private:
/// VBaseOffsetOffsets - Contains the offsets of the virtual base offsets,
/// relative to the address point.
VBaseOffsetOffsetsMapTy VBaseOffsetOffsets;
-
+
/// FinalOverriders - The final overriders of the most derived class.
/// (Can be null when we're not building a vtable of the most derived class).
const FinalOverriders *Overriders;
@@ -571,48 +571,48 @@ private:
/// given base subobject.
void AddVCallAndVBaseOffsets(BaseSubobject Base, bool BaseIsVirtual,
CharUnits RealBaseOffset);
-
+
/// AddVCallOffsets - Add vcall offsets for the given base subobject.
void AddVCallOffsets(BaseSubobject Base, CharUnits VBaseOffset);
-
+
/// AddVBaseOffsets - Add vbase offsets for the given class.
- void AddVBaseOffsets(const CXXRecordDecl *Base,
+ void AddVBaseOffsets(const CXXRecordDecl *Base,
CharUnits OffsetInLayoutClass);
-
+
/// getCurrentOffsetOffset - Get the current vcall or vbase offset offset in
/// chars, relative to the vtable address point.
CharUnits getCurrentOffsetOffset() const;
-
+
public:
VCallAndVBaseOffsetBuilder(const CXXRecordDecl *MostDerivedClass,
const CXXRecordDecl *LayoutClass,
const FinalOverriders *Overriders,
BaseSubobject Base, bool BaseIsVirtual,
CharUnits OffsetInLayoutClass)
- : MostDerivedClass(MostDerivedClass), LayoutClass(LayoutClass),
+ : MostDerivedClass(MostDerivedClass), LayoutClass(LayoutClass),
Context(MostDerivedClass->getASTContext()), Overriders(Overriders) {
-
+
// Add vcall and vbase offsets.
AddVCallAndVBaseOffsets(Base, BaseIsVirtual, OffsetInLayoutClass);
}
-
+
/// Methods for iterating over the components.
typedef VTableComponentVectorTy::const_reverse_iterator const_iterator;
const_iterator components_begin() const { return Components.rbegin(); }
const_iterator components_end() const { return Components.rend(); }
-
+
const VCallOffsetMap &getVCallOffsets() const { return VCallOffsets; }
const VBaseOffsetOffsetsMapTy &getVBaseOffsetOffsets() const {
return VBaseOffsetOffsets;
}
};
-
-void
+
+void
VCallAndVBaseOffsetBuilder::AddVCallAndVBaseOffsets(BaseSubobject Base,
bool BaseIsVirtual,
CharUnits RealBaseOffset) {
const ASTRecordLayout &Layout = Context.getASTRecordLayout(Base.getBase());
-
+
// Itanium C++ ABI 2.5.2:
// ..in classes sharing a virtual table with a primary base class, the vcall
// and vbase offsets added by the derived class all come before the vcall
@@ -626,16 +626,16 @@ VCallAndVBaseOffsetBuilder::AddVCallAndV
bool PrimaryBaseIsVirtual = Layout.isPrimaryBaseVirtual();
CharUnits PrimaryBaseOffset;
-
+
// Get the base offset of the primary base.
if (PrimaryBaseIsVirtual) {
assert(Layout.getVBaseClassOffset(PrimaryBase).isZero() &&
"Primary vbase should have a zero offset!");
-
+
const ASTRecordLayout &MostDerivedClassLayout =
Context.getASTRecordLayout(MostDerivedClass);
-
- PrimaryBaseOffset =
+
+ PrimaryBaseOffset =
MostDerivedClassLayout.getVBaseClassOffset(PrimaryBase);
} else {
assert(Layout.getBaseClassOffset(PrimaryBase).isZero() &&
@@ -657,19 +657,19 @@ VCallAndVBaseOffsetBuilder::AddVCallAndV
}
CharUnits VCallAndVBaseOffsetBuilder::getCurrentOffsetOffset() const {
- // OffsetIndex is the index of this vcall or vbase offset, relative to the
+ // OffsetIndex is the index of this vcall or vbase offset, relative to the
// vtable address point. (We subtract 3 to account for the information just
// above the address point, the RTTI info, the offset to top, and the
// vcall offset itself).
int64_t OffsetIndex = -(int64_t)(3 + Components.size());
-
- CharUnits PointerWidth =
+
+ CharUnits PointerWidth =
Context.toCharUnitsFromBits(Context.getTargetInfo().getPointerWidth(0));
CharUnits OffsetOffset = PointerWidth * OffsetIndex;
return OffsetOffset;
}
-void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base,
+void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base,
CharUnits VBaseOffset) {
const CXXRecordDecl *RD = Base.getBase();
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
@@ -687,7 +687,7 @@ void VCallAndVBaseOffsetBuilder::AddVCal
AddVCallOffsets(BaseSubobject(PrimaryBase, Base.getBaseOffset()),
VBaseOffset);
}
-
+
// Add the vcall offsets.
for (const auto *MD : RD->methods()) {
if (!MD->isVirtual())
@@ -695,7 +695,7 @@ void VCallAndVBaseOffsetBuilder::AddVCal
MD = MD->getCanonicalDecl();
CharUnits OffsetOffset = getCurrentOffsetOffset();
-
+
// Don't add a vcall offset if we already have one for this member function
// signature.
if (!VCallOffsets.AddVCallOffset(MD, OffsetOffset))
@@ -705,20 +705,20 @@ void VCallAndVBaseOffsetBuilder::AddVCal
if (Overriders) {
// Get the final overrider.
- FinalOverriders::OverriderInfo Overrider =
+ FinalOverriders::OverriderInfo Overrider =
Overriders->getOverrider(MD, Base.getBaseOffset());
-
- /// The vcall offset is the offset from the virtual base to the object
+
+ /// The vcall offset is the offset from the virtual base to the object
/// where the function was overridden.
Offset = Overrider.Offset - VBaseOffset;
}
-
+
Components.push_back(
VTableComponent::MakeVCallOffset(Offset));
}
// And iterate over all non-virtual bases (ignoring the primary base).
- for (const auto &B : RD->bases()) {
+ for (const auto &B : RD->bases()) {
if (B.isVirtual())
continue;
@@ -727,18 +727,18 @@ void VCallAndVBaseOffsetBuilder::AddVCal
continue;
// Get the base offset of this base.
- CharUnits BaseOffset = Base.getBaseOffset() +
+ CharUnits BaseOffset = Base.getBaseOffset() +
Layout.getBaseClassOffset(BaseDecl);
-
- AddVCallOffsets(BaseSubobject(BaseDecl, BaseOffset),
+
+ AddVCallOffsets(BaseSubobject(BaseDecl, BaseOffset),
VBaseOffset);
}
}
-void
+void
VCallAndVBaseOffsetBuilder::AddVBaseOffsets(const CXXRecordDecl *RD,
CharUnits OffsetInLayoutClass) {
- const ASTRecordLayout &LayoutClassLayout =
+ const ASTRecordLayout &LayoutClassLayout =
Context.getASTRecordLayout(LayoutClass);
// Add vbase offsets.
@@ -747,7 +747,7 @@ VCallAndVBaseOffsetBuilder::AddVBaseOffs
// Check if this is a virtual base that we haven't visited before.
if (B.isVirtual() && VisitedVirtualBases.insert(BaseDecl).second) {
- CharUnits Offset =
+ CharUnits Offset =
LayoutClassLayout.getVBaseClassOffset(BaseDecl) - OffsetInLayoutClass;
// Add the vbase offset offset.
@@ -770,12 +770,12 @@ VCallAndVBaseOffsetBuilder::AddVBaseOffs
/// ItaniumVTableBuilder - Class for building vtable layout information.
class ItaniumVTableBuilder {
public:
- /// PrimaryBasesSetVectorTy - A set vector of direct and indirect
+ /// PrimaryBasesSetVectorTy - A set vector of direct and indirect
/// primary bases.
- typedef llvm::SmallSetVector<const CXXRecordDecl *, 8>
+ typedef llvm::SmallSetVector<const CXXRecordDecl *, 8>
PrimaryBasesSetVectorTy;
-
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
+
+ typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
VBaseOffsetOffsetsMapTy;
typedef VTableLayout::AddressPointsMapTy AddressPointsMapTy;
@@ -785,7 +785,7 @@ public:
private:
/// VTables - Global vtable information.
ItaniumVTableContext &VTables;
-
+
/// MostDerivedClass - The most derived class for which we're building this
/// vtable.
const CXXRecordDecl *MostDerivedClass;
@@ -793,19 +793,19 @@ private:
/// MostDerivedClassOffset - If we're building a construction vtable, this
/// holds the offset from the layout class to the most derived class.
const CharUnits MostDerivedClassOffset;
-
- /// MostDerivedClassIsVirtual - Whether the most derived class is a virtual
+
+ /// MostDerivedClassIsVirtual - Whether the most derived class is a virtual
/// base. (This only makes sense when building a construction vtable).
bool MostDerivedClassIsVirtual;
-
- /// LayoutClass - The class we're using for layout information. Will be
+
+ /// LayoutClass - The class we're using for layout information. Will be
/// different than the most derived class if we're building a construction
/// vtable.
const CXXRecordDecl *LayoutClass;
-
+
/// Context - The ASTContext which we will use for layout information.
ASTContext &Context;
-
+
/// FinalOverriders - The final overriders of the most derived class.
const FinalOverriders Overriders;
@@ -828,29 +828,29 @@ private:
struct MethodInfo {
/// BaseOffset - The base offset of this method.
const CharUnits BaseOffset;
-
+
/// BaseOffsetInLayoutClass - The base offset in the layout class of this
/// method.
const CharUnits BaseOffsetInLayoutClass;
-
+
/// VTableIndex - The index in the vtable that this method has.
/// (For destructors, this is the index of the complete destructor).
const uint64_t VTableIndex;
-
- MethodInfo(CharUnits BaseOffset, CharUnits BaseOffsetInLayoutClass,
+
+ MethodInfo(CharUnits BaseOffset, CharUnits BaseOffsetInLayoutClass,
uint64_t VTableIndex)
- : BaseOffset(BaseOffset),
+ : BaseOffset(BaseOffset),
BaseOffsetInLayoutClass(BaseOffsetInLayoutClass),
VTableIndex(VTableIndex) { }
-
- MethodInfo()
- : BaseOffset(CharUnits::Zero()),
- BaseOffsetInLayoutClass(CharUnits::Zero()),
+
+ MethodInfo()
+ : BaseOffset(CharUnits::Zero()),
+ BaseOffsetInLayoutClass(CharUnits::Zero()),
VTableIndex(0) { }
};
-
+
typedef llvm::DenseMap<const CXXMethodDecl *, MethodInfo> MethodInfoMapTy;
-
+
/// MethodInfoMap - The information for all methods in the vtable we're
/// currently building.
MethodInfoMapTy MethodInfoMap;
@@ -860,25 +860,25 @@ private:
MethodVTableIndicesTy MethodVTableIndices;
typedef llvm::DenseMap<uint64_t, ThunkInfo> VTableThunksMapTy;
-
- /// VTableThunks - The thunks by vtable index in the vtable currently being
+
+ /// VTableThunks - The thunks by vtable index in the vtable currently being
/// built.
VTableThunksMapTy VTableThunks;
typedef SmallVector<ThunkInfo, 1> ThunkInfoVectorTy;
typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy;
-
+
/// Thunks - A map that contains all the thunks needed for all methods in the
/// most derived class for which the vtable is currently being built.
ThunksMapTy Thunks;
-
+
/// AddThunk - Add a thunk for the given method.
void AddThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk);
-
+
/// ComputeThisAdjustments - Compute the 'this' pointer adjustments for the
/// part of the vtable we're currently building.
void ComputeThisAdjustments();
-
+
typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy;
/// PrimaryVirtualBases - All known virtual bases who are a primary base of
@@ -888,7 +888,7 @@ private:
/// ComputeReturnAdjustment - Compute the return adjustment given a return
/// adjustment base offset.
ReturnAdjustment ComputeReturnAdjustment(BaseOffset Offset);
-
+
/// ComputeThisAdjustmentBaseOffset - Compute the base offset for adjusting
/// the 'this' pointer from the base subobject to the derived subobject.
BaseOffset ComputeThisAdjustmentBaseOffset(BaseSubobject Base,
@@ -897,8 +897,8 @@ private:
/// ComputeThisAdjustment - Compute the 'this' pointer adjustment for the
/// given virtual member function, its offset in the layout class and its
/// final overrider.
- ThisAdjustment
- ComputeThisAdjustment(const CXXMethodDecl *MD,
+ ThisAdjustment
+ ComputeThisAdjustment(const CXXMethodDecl *MD,
CharUnits BaseOffsetInLayoutClass,
FinalOverriders::OverriderInfo Overrider);
@@ -907,7 +907,7 @@ private:
void AddMethod(const CXXMethodDecl *MD, ReturnAdjustment ReturnAdjustment);
/// IsOverriderUsed - Returns whether the overrider will ever be used in this
- /// part of the vtable.
+ /// part of the vtable.
///
/// Itanium C++ ABI 2.5.2:
///
@@ -921,16 +921,16 @@ private:
/// adjustment is required and no thunk is generated. However, inside D
/// objects, A is no longer a primary base of C, so if we allowed calls to
/// C::f() to use the copy of A's vtable in the C subobject, we would need
- /// to adjust this from C* to B::A*, which would require a third-party
- /// thunk. Since we require that a call to C::f() first convert to A*,
- /// C-in-D's copy of A's vtable is never referenced, so this is not
+ /// to adjust this from C* to B::A*, which would require a third-party
+ /// thunk. Since we require that a call to C::f() first convert to A*,
+ /// C-in-D's copy of A's vtable is never referenced, so this is not
/// necessary.
bool IsOverriderUsed(const CXXMethodDecl *Overrider,
CharUnits BaseOffsetInLayoutClass,
const CXXRecordDecl *FirstBaseInPrimaryBaseChain,
CharUnits FirstBaseOffsetInLayoutClass) const;
-
+
/// AddMethods - Add the methods of this base subobject and all its
/// primary bases to the vtable components vector.
void AddMethods(BaseSubobject Base, CharUnits BaseOffsetInLayoutClass,
@@ -949,12 +949,12 @@ private:
/// or a direct or indirect base of a virtual base.
///
/// \param BaseIsVirtualInLayoutClass - Whether the base subobject is virtual
- /// in the layout class.
+ /// in the layout class.
void LayoutPrimaryAndSecondaryVTables(BaseSubobject Base,
bool BaseIsMorallyVirtual,
bool BaseIsVirtualInLayoutClass,
CharUnits OffsetInLayoutClass);
-
+
/// LayoutSecondaryVTables - Layout the secondary vtables for the given base
/// subobject.
///
@@ -965,18 +965,18 @@ private:
/// DeterminePrimaryVirtualBases - Determine the primary virtual bases in this
/// class hierarchy.
- void DeterminePrimaryVirtualBases(const CXXRecordDecl *RD,
+ void DeterminePrimaryVirtualBases(const CXXRecordDecl *RD,
CharUnits OffsetInLayoutClass,
VisitedVirtualBasesSetTy &VBases);
/// LayoutVTablesForVirtualBases - Layout vtables for all virtual bases of the
/// given base (excluding any primary bases).
- void LayoutVTablesForVirtualBases(const CXXRecordDecl *RD,
+ void LayoutVTablesForVirtualBases(const CXXRecordDecl *RD,
VisitedVirtualBasesSetTy &VBases);
/// isBuildingConstructionVTable - Return whether this vtable builder is
/// building a construction vtable.
- bool isBuildingConstructorVTable() const {
+ bool isBuildingConstructorVTable() const {
return MostDerivedClass != LayoutClass;
}
@@ -1055,16 +1055,16 @@ public:
void ItaniumVTableBuilder::AddThunk(const CXXMethodDecl *MD,
const ThunkInfo &Thunk) {
- assert(!isBuildingConstructorVTable() &&
+ assert(!isBuildingConstructorVTable() &&
"Can't add thunks for construction vtable");
SmallVectorImpl<ThunkInfo> &ThunksVector = Thunks[MD];
// Check if we have this thunk already.
- if (std::find(ThunksVector.begin(), ThunksVector.end(), Thunk) !=
+ if (std::find(ThunksVector.begin(), ThunksVector.end(), Thunk) !=
ThunksVector.end())
return;
-
+
ThunksVector.push_back(Thunk);
}
@@ -1107,18 +1107,18 @@ void ItaniumVTableBuilder::ComputeThisAd
// Ignore adjustments for unused function pointers.
uint64_t VTableIndex = MethodInfo.VTableIndex;
- if (Components[VTableIndex].getKind() ==
+ if (Components[VTableIndex].getKind() ==
VTableComponent::CK_UnusedFunctionPointer)
continue;
-
+
// Get the final overrider for this method.
FinalOverriders::OverriderInfo Overrider =
Overriders.getOverrider(MD, MethodInfo.BaseOffset);
-
+
// Check if we need an adjustment at all.
if (MethodInfo.BaseOffsetInLayoutClass == Overrider.Offset) {
// When a return thunk is needed by a derived class that overrides a
- // virtual base, gcc uses a virtual 'this' adjustment as well.
+ // virtual base, gcc uses a virtual 'this' adjustment as well.
// While the thunk itself might be needed by vtables in subclasses or
// in construction vtables, there doesn't seem to be a reason for using
// the thunk in this vtable. Still, we do so to match gcc.
@@ -1143,7 +1143,7 @@ void ItaniumVTableBuilder::ComputeThisAd
/// Clear the method info map.
MethodInfoMap.clear();
-
+
if (isBuildingConstructorVTable()) {
// We don't need to store thunk information for construction vtables.
return;
@@ -1153,7 +1153,7 @@ void ItaniumVTableBuilder::ComputeThisAd
const VTableComponent &Component = Components[TI.first];
const ThunkInfo &Thunk = TI.second;
const CXXMethodDecl *MD;
-
+
switch (Component.getKind()) {
default:
llvm_unreachable("Unexpected vtable component kind!");
@@ -1176,7 +1176,7 @@ void ItaniumVTableBuilder::ComputeThisAd
ReturnAdjustment
ItaniumVTableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
ReturnAdjustment Adjustment;
-
+
if (!Offset.isEmpty()) {
if (Offset.VirtualBase) {
// Get the virtual base offset offset.
@@ -1193,7 +1193,7 @@ ItaniumVTableBuilder::ComputeReturnAdjus
Adjustment.NonVirtual = Offset.NonVirtualOffset.getQuantity();
}
-
+
return Adjustment;
}
@@ -1201,7 +1201,7 @@ BaseOffset ItaniumVTableBuilder::Compute
BaseSubobject Base, BaseSubobject Derived) const {
const CXXRecordDecl *BaseRD = Base.getBase();
const CXXRecordDecl *DerivedRD = Derived.getBase();
-
+
CXXBasePaths Paths(/*FindAmbiguities=*/true,
/*RecordPaths=*/true, /*DetectVirtual=*/true);
@@ -1214,32 +1214,32 @@ BaseOffset ItaniumVTableBuilder::Compute
BaseOffset Offset = ComputeBaseOffset(Context, DerivedRD, Path);
CharUnits OffsetToBaseSubobject = Offset.NonVirtualOffset;
-
+
if (Offset.VirtualBase) {
// If we have a virtual base class, the non-virtual offset is relative
// to the virtual base class offset.
const ASTRecordLayout &LayoutClassLayout =
Context.getASTRecordLayout(LayoutClass);
-
- /// Get the virtual base offset, relative to the most derived class
+
+ /// Get the virtual base offset, relative to the most derived class
/// layout.
- OffsetToBaseSubobject +=
+ OffsetToBaseSubobject +=
LayoutClassLayout.getVBaseClassOffset(Offset.VirtualBase);
} else {
- // Otherwise, the non-virtual offset is relative to the derived class
+ // Otherwise, the non-virtual offset is relative to the derived class
// offset.
OffsetToBaseSubobject += Derived.getBaseOffset();
}
-
+
// Check if this path gives us the right base subobject.
if (OffsetToBaseSubobject == Base.getBaseOffset()) {
// Since we're going from the base class _to_ the derived class, we'll
// invert the non-virtual offset here.
Offset.NonVirtualOffset = -Offset.NonVirtualOffset;
return Offset;
- }
+ }
}
-
+
return BaseOffset();
}
@@ -1249,13 +1249,13 @@ ThisAdjustment ItaniumVTableBuilder::Com
// Ignore adjustments for pure virtual member functions.
if (Overrider.Method->isPure())
return ThisAdjustment();
-
- BaseSubobject OverriddenBaseSubobject(MD->getParent(),
+
+ BaseSubobject OverriddenBaseSubobject(MD->getParent(),
BaseOffsetInLayoutClass);
-
+
BaseSubobject OverriderBaseSubobject(Overrider.Method->getParent(),
Overrider.Offset);
-
+
// Compute the adjustment offset.
BaseOffset Offset = ComputeThisAdjustmentBaseOffset(OverriddenBaseSubobject,
OverriderBaseSubobject);
@@ -1263,7 +1263,7 @@ ThisAdjustment ItaniumVTableBuilder::Com
return ThisAdjustment();
ThisAdjustment Adjustment;
-
+
if (Offset.VirtualBase) {
// Get the vcall offset map for this virtual base.
VCallOffsetMap &VCallOffsets = VCallOffsetsForVBases[Offset.VirtualBase];
@@ -1278,24 +1278,24 @@ ThisAdjustment ItaniumVTableBuilder::Com
/*BaseIsVirtual=*/true,
/*OffsetInLayoutClass=*/
CharUnits::Zero());
-
+
VCallOffsets = Builder.getVCallOffsets();
}
-
+
Adjustment.Virtual.Itanium.VCallOffsetOffset =
VCallOffsets.getVCallOffsetOffset(MD).getQuantity();
}
// Set the non-virtual part of the adjustment.
Adjustment.NonVirtual = Offset.NonVirtualOffset.getQuantity();
-
+
return Adjustment;
}
void ItaniumVTableBuilder::AddMethod(const CXXMethodDecl *MD,
ReturnAdjustment ReturnAdjustment) {
if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD)) {
- assert(ReturnAdjustment.isEmpty() &&
+ assert(ReturnAdjustment.isEmpty() &&
"Destructor can't have return adjustment!");
// Add both the complete destructor and the deleting destructor.
@@ -1312,7 +1312,7 @@ void ItaniumVTableBuilder::AddMethod(con
}
/// OverridesIndirectMethodInBase - Return whether the given member function
-/// overrides any methods in the set of given bases.
+/// overrides any methods in the set of given bases.
/// Unlike OverridesMethodInBase, this checks "overriders of overriders".
/// For example, if we have:
///
@@ -1320,7 +1320,7 @@ void ItaniumVTableBuilder::AddMethod(con
/// struct B : A { virtual void f(); }
/// struct C : B { virtual void f(); }
///
-/// OverridesIndirectMethodInBase will return true if given C::f as the method
+/// OverridesIndirectMethodInBase will return true if given C::f as the method
/// and { A } as the set of bases.
static bool OverridesIndirectMethodInBases(
const CXXMethodDecl *MD,
@@ -1333,7 +1333,7 @@ static bool OverridesIndirectMethodInBas
if (OverridesIndirectMethodInBases(OverriddenMD, Bases))
return true;
}
-
+
return false;
}
@@ -1347,9 +1347,9 @@ bool ItaniumVTableBuilder::IsOverriderUs
return true;
// We know now that Base (or a direct or indirect base of it) is a primary
- // base in part of the class hierarchy, but not a primary base in the most
+ // base in part of the class hierarchy, but not a primary base in the most
// derived class.
-
+
// If the overrider is the first base in the primary base chain, we know
// that the overrider will be used.
if (Overrider->getParent() == FirstBaseInPrimaryBaseChain)
@@ -1365,10 +1365,10 @@ bool ItaniumVTableBuilder::IsOverriderUs
while (true) {
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
-
+
if (!PrimaryBase)
break;
-
+
if (Layout.isPrimaryBaseVirtual()) {
assert(Layout.getVBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should always be at offset 0!");
@@ -1387,13 +1387,13 @@ bool ItaniumVTableBuilder::IsOverriderUs
assert(Layout.getBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should always be at offset 0!");
}
-
+
if (!PrimaryBases.insert(PrimaryBase))
llvm_unreachable("Found a duplicate primary base!");
RD = PrimaryBase;
}
-
+
// If the final overrider is an override of one of the primary bases,
// then we know that it will be used.
return OverridesIndirectMethodInBases(Overrider, PrimaryBases);
@@ -1446,13 +1446,13 @@ void ItaniumVTableBuilder::AddMethods(
if (Layout.isPrimaryBaseVirtual()) {
assert(Layout.getVBaseClassOffset(PrimaryBase).isZero() &&
"Primary vbase should have a zero offset!");
-
+
const ASTRecordLayout &MostDerivedClassLayout =
Context.getASTRecordLayout(MostDerivedClass);
-
- PrimaryBaseOffset =
+
+ PrimaryBaseOffset =
MostDerivedClassLayout.getVBaseClassOffset(PrimaryBase);
-
+
const ASTRecordLayout &LayoutClassLayout =
Context.getASTRecordLayout(LayoutClass);
@@ -1467,9 +1467,9 @@ void ItaniumVTableBuilder::AddMethods(
}
AddMethods(BaseSubobject(PrimaryBase, PrimaryBaseOffset),
- PrimaryBaseOffsetInLayoutClass, FirstBaseInPrimaryBaseChain,
+ PrimaryBaseOffsetInLayoutClass, FirstBaseInPrimaryBaseChain,
FirstBaseOffsetInLayoutClass, PrimaryBases);
-
+
if (!PrimaryBases.insert(PrimaryBase))
llvm_unreachable("Found a duplicate primary base!");
}
@@ -1486,31 +1486,31 @@ void ItaniumVTableBuilder::AddMethods(
MD = MD->getCanonicalDecl();
// Get the final overrider.
- FinalOverriders::OverriderInfo Overrider =
+ FinalOverriders::OverriderInfo Overrider =
Overriders.getOverrider(MD, Base.getBaseOffset());
// Check if this virtual member function overrides a method in a primary
// base. If this is the case, and the return type doesn't require adjustment
// then we can just use the member function from the primary base.
- if (const CXXMethodDecl *OverriddenMD =
+ if (const CXXMethodDecl *OverriddenMD =
FindNearestOverriddenMethod(MD, PrimaryBases)) {
- if (ComputeReturnAdjustmentBaseOffset(Context, MD,
+ if (ComputeReturnAdjustmentBaseOffset(Context, MD,
OverriddenMD).isEmpty()) {
// Replace the method info of the overridden method with our own
// method.
- assert(MethodInfoMap.count(OverriddenMD) &&
+ assert(MethodInfoMap.count(OverriddenMD) &&
"Did not find the overridden method!");
MethodInfo &OverriddenMethodInfo = MethodInfoMap[OverriddenMD];
-
+
MethodInfo MethodInfo(Base.getBaseOffset(), BaseOffsetInLayoutClass,
OverriddenMethodInfo.VTableIndex);
assert(!MethodInfoMap.count(MD) &&
"Should not have method info for this method yet!");
-
+
MethodInfoMap.insert(std::make_pair(MD, MethodInfo));
MethodInfoMap.erase(OverriddenMD);
-
+
// If the overridden method exists in a virtual base class or a direct
// or indirect base class of a virtual base class, we need to emit a
// thunk if we ever have a class hierarchy where the base class is not
@@ -1529,11 +1529,11 @@ void ItaniumVTableBuilder::AddMethods(
// the final overrider.
BaseOffset ReturnAdjustmentOffset =
ComputeReturnAdjustmentBaseOffset(Context, Overrider.Method, MD);
- ReturnAdjustment ReturnAdjustment =
+ ReturnAdjustment ReturnAdjustment =
ComputeReturnAdjustment(ReturnAdjustmentOffset);
// This is a virtual thunk for the most derived class, add it.
- AddThunk(Overrider.Method,
+ AddThunk(Overrider.Method,
ThunkInfo(ThisAdjustment, ReturnAdjustment));
}
}
@@ -1577,7 +1577,7 @@ void ItaniumVTableBuilder::AddMethods(
// Check if this overrider is going to be used.
const CXXMethodDecl *OverriderMD = Overrider.Method;
if (!IsOverriderUsed(OverriderMD, BaseOffsetInLayoutClass,
- FirstBaseInPrimaryBaseChain,
+ FirstBaseInPrimaryBaseChain,
FirstBaseOffsetInLayoutClass)) {
Components.push_back(VTableComponent::MakeUnusedFunction(OverriderMD));
continue;
@@ -1587,13 +1587,13 @@ void ItaniumVTableBuilder::AddMethods(
// We don't want to do this for pure virtual member functions.
BaseOffset ReturnAdjustmentOffset;
if (!OverriderMD->isPure()) {
- ReturnAdjustmentOffset =
+ ReturnAdjustmentOffset =
ComputeReturnAdjustmentBaseOffset(Context, OverriderMD, MD);
}
- ReturnAdjustment ReturnAdjustment =
+ ReturnAdjustment ReturnAdjustment =
ComputeReturnAdjustment(ReturnAdjustmentOffset);
-
+
AddMethod(Overrider.Method, ReturnAdjustment);
}
}
@@ -1604,14 +1604,14 @@ void ItaniumVTableBuilder::LayoutVTable(
/*BaseIsMorallyVirtual=*/false,
MostDerivedClassIsVirtual,
MostDerivedClassOffset);
-
+
VisitedVirtualBasesSetTy VBases;
-
+
// Determine the primary virtual bases.
- DeterminePrimaryVirtualBases(MostDerivedClass, MostDerivedClassOffset,
+ DeterminePrimaryVirtualBases(MostDerivedClass, MostDerivedClassOffset,
VBases);
VBases.clear();
-
+
LayoutVTablesForVirtualBases(MostDerivedClass, VBases);
// -fapple-kext adds an extra entry at end of vtbl.
@@ -1630,14 +1630,14 @@ void ItaniumVTableBuilder::LayoutPrimary
// Add vcall and vbase offsets for this vtable.
VCallAndVBaseOffsetBuilder Builder(MostDerivedClass, LayoutClass, &Overriders,
- Base, BaseIsVirtualInLayoutClass,
+ Base, BaseIsVirtualInLayoutClass,
OffsetInLayoutClass);
Components.append(Builder.components_begin(), Builder.components_end());
-
+
// Check if we need to add these vcall offsets.
if (BaseIsVirtualInLayoutClass && !Builder.getVCallOffsets().empty()) {
VCallOffsetMap &VCallOffsets = VCallOffsetsForVBases[Base.getBase()];
-
+
if (VCallOffsets.empty())
VCallOffsets = Builder.getVCallOffsets();
}
@@ -1659,7 +1659,7 @@ void ItaniumVTableBuilder::LayoutPrimary
// Now go through all virtual member functions and add them.
PrimaryBasesSetVectorTy PrimaryBases;
AddMethods(Base, OffsetInLayoutClass,
- Base.getBase(), OffsetInLayoutClass,
+ Base.getBase(), OffsetInLayoutClass,
PrimaryBases);
const CXXRecordDecl *RD = Base.getBase();
@@ -1692,10 +1692,10 @@ void ItaniumVTableBuilder::LayoutPrimary
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
-
+
if (!PrimaryBase)
break;
-
+
if (Layout.isPrimaryBaseVirtual()) {
// Check if this virtual primary base is a primary base in the layout
// class. If it's not, we don't want to add it.
@@ -1721,19 +1721,19 @@ ItaniumVTableBuilder::LayoutSecondaryVTa
bool BaseIsMorallyVirtual,
CharUnits OffsetInLayoutClass) {
// Itanium C++ ABI 2.5.2:
- // Following the primary virtual table of a derived class are secondary
+ // Following the primary virtual table of a derived class are secondary
// virtual tables for each of its proper base classes, except any primary
// base(s) with which it shares its primary virtual table.
const CXXRecordDecl *RD = Base.getBase();
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
-
+
for (const auto &B : RD->bases()) {
// Ignore virtual bases, we'll emit them later.
if (B.isVirtual())
continue;
-
+
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
// Ignore bases that don't have a vtable.
@@ -1753,11 +1753,11 @@ ItaniumVTableBuilder::LayoutSecondaryVTa
// Get the base offset of this base.
CharUnits RelativeBaseOffset = Layout.getBaseClassOffset(BaseDecl);
CharUnits BaseOffset = Base.getBaseOffset() + RelativeBaseOffset;
-
- CharUnits BaseOffsetInLayoutClass =
+
+ CharUnits BaseOffsetInLayoutClass =
OffsetInLayoutClass + RelativeBaseOffset;
-
- // Don't emit a secondary vtable for a primary base. We might however want
+
+ // Don't emit a secondary vtable for a primary base. We might however want
// to emit secondary vtables for other bases of this base.
if (BaseDecl == PrimaryBase) {
LayoutSecondaryVTables(BaseSubobject(BaseDecl, BaseOffset),
@@ -1778,7 +1778,7 @@ void ItaniumVTableBuilder::DeterminePrim
const CXXRecordDecl *RD, CharUnits OffsetInLayoutClass,
VisitedVirtualBasesSetTy &VBases) {
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
-
+
// Check if this base has a primary base.
if (const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase()) {
@@ -1794,13 +1794,13 @@ void ItaniumVTableBuilder::DeterminePrim
CharUnits PrimaryBaseOffsetInLayoutClass =
LayoutClassLayout.getVBaseClassOffset(PrimaryBase);
-
- // We know that the base is not a primary base in the layout class if
+
+ // We know that the base is not a primary base in the layout class if
// the base offsets are different.
if (PrimaryBaseOffsetInLayoutClass != OffsetInLayoutClass)
IsPrimaryVirtualBase = false;
}
-
+
if (IsPrimaryVirtualBase)
PrimaryVirtualBases.insert(PrimaryBase);
}
@@ -1811,18 +1811,18 @@ void ItaniumVTableBuilder::DeterminePrim
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
CharUnits BaseOffsetInLayoutClass;
-
+
if (B.isVirtual()) {
if (!VBases.insert(BaseDecl).second)
continue;
-
+
const ASTRecordLayout &LayoutClassLayout =
Context.getASTRecordLayout(LayoutClass);
- BaseOffsetInLayoutClass =
+ BaseOffsetInLayoutClass =
LayoutClassLayout.getVBaseClassOffset(BaseDecl);
} else {
- BaseOffsetInLayoutClass =
+ BaseOffsetInLayoutClass =
OffsetInLayoutClass + Layout.getBaseClassOffset(BaseDecl);
}
@@ -1846,12 +1846,12 @@ void ItaniumVTableBuilder::LayoutVTables
VBases.insert(BaseDecl).second) {
const ASTRecordLayout &MostDerivedClassLayout =
Context.getASTRecordLayout(MostDerivedClass);
- CharUnits BaseOffset =
+ CharUnits BaseOffset =
MostDerivedClassLayout.getVBaseClassOffset(BaseDecl);
-
+
const ASTRecordLayout &LayoutClassLayout =
Context.getASTRecordLayout(LayoutClass);
- CharUnits BaseOffsetInLayoutClass =
+ CharUnits BaseOffsetInLayoutClass =
LayoutClassLayout.getVBaseClassOffset(BaseDecl);
LayoutPrimaryAndSecondaryVTables(
@@ -1860,7 +1860,7 @@ void ItaniumVTableBuilder::LayoutVTables
/*BaseIsVirtualInLayoutClass=*/true,
BaseOffsetInLayoutClass);
}
-
+
// We only need to check the base for virtual base vtables if it actually
// has virtual bases.
if (BaseDecl->getNumVBases())
@@ -1897,7 +1897,7 @@ void ItaniumVTableBuilder::dumpLayout(ra
AddressPointsByIndex.insert(std::make_pair(Index, Base));
}
-
+
for (unsigned I = 0, E = Components.size(); I != E; ++I) {
uint64_t Index = I;
@@ -1910,7 +1910,7 @@ void ItaniumVTableBuilder::dumpLayout(ra
case VTableComponent::CK_VCallOffset:
Out << "vcall_offset ("
- << Component.getVCallOffset().getQuantity()
+ << Component.getVCallOffset().getQuantity()
<< ")";
break;
@@ -1925,17 +1925,17 @@ void ItaniumVTableBuilder::dumpLayout(ra
<< Component.getOffsetToTop().getQuantity()
<< ")";
break;
-
+
case VTableComponent::CK_RTTI:
Component.getRTTIDecl()->printQualifiedName(Out);
Out << " RTTI";
break;
-
+
case VTableComponent::CK_FunctionPointer: {
const CXXMethodDecl *MD = Component.getFunctionDecl();
- std::string Str =
- PredefinedExpr::ComputeName(PredefinedExpr::PrettyFunctionNoVirtual,
+ std::string Str =
+ PredefinedExpr::ComputeName(PredefinedExpr::PrettyFunctionNoVirtual,
MD);
Out << Str;
if (MD->isPure())
@@ -1950,7 +1950,7 @@ void ItaniumVTableBuilder::dumpLayout(ra
if (!Thunk.Return.isEmpty()) {
Out << "\n [return adjustment: ";
Out << Thunk.Return.NonVirtual << " non-virtual";
-
+
if (Thunk.Return.Virtual.Itanium.VBaseOffsetOffset) {
Out << ", " << Thunk.Return.Virtual.Itanium.VBaseOffsetOffset;
Out << " vbase offset offset";
@@ -1963,26 +1963,26 @@ void ItaniumVTableBuilder::dumpLayout(ra
if (!Thunk.This.isEmpty()) {
Out << "\n [this adjustment: ";
Out << Thunk.This.NonVirtual << " non-virtual";
-
+
if (Thunk.This.Virtual.Itanium.VCallOffsetOffset) {
Out << ", " << Thunk.This.Virtual.Itanium.VCallOffsetOffset;
Out << " vcall offset offset";
}
Out << ']';
- }
+ }
}
break;
}
- case VTableComponent::CK_CompleteDtorPointer:
+ case VTableComponent::CK_CompleteDtorPointer:
case VTableComponent::CK_DeletingDtorPointer: {
- bool IsComplete =
+ bool IsComplete =
Component.getKind() == VTableComponent::CK_CompleteDtorPointer;
-
+
const CXXDestructorDecl *DD = Component.getDestructorDecl();
-
+
DD->printQualifiedName(Out);
if (IsComplete)
Out << "() [complete]";
@@ -1998,15 +1998,15 @@ void ItaniumVTableBuilder::dumpLayout(ra
if (!Thunk.This.isEmpty()) {
Out << "\n [this adjustment: ";
Out << Thunk.This.NonVirtual << " non-virtual";
-
+
if (Thunk.This.Virtual.Itanium.VCallOffsetOffset) {
Out << ", " << Thunk.This.Virtual.Itanium.VCallOffsetOffset;
Out << " vcall offset offset";
}
-
+
Out << ']';
- }
- }
+ }
+ }
break;
}
@@ -2014,8 +2014,8 @@ void ItaniumVTableBuilder::dumpLayout(ra
case VTableComponent::CK_UnusedFunctionPointer: {
const CXXMethodDecl *MD = Component.getUnusedFunctionDecl();
- std::string Str =
- PredefinedExpr::ComputeName(PredefinedExpr::PrettyFunctionNoVirtual,
+ std::string Str =
+ PredefinedExpr::ComputeName(PredefinedExpr::PrettyFunctionNoVirtual,
MD);
Out << "[unused] " << Str;
if (MD->isPure())
@@ -2025,14 +2025,14 @@ void ItaniumVTableBuilder::dumpLayout(ra
}
Out << '\n';
-
+
// Dump the next address point.
uint64_t NextIndex = Index + 1;
if (AddressPointsByIndex.count(NextIndex)) {
if (AddressPointsByIndex.count(NextIndex) == 1) {
- const BaseSubobject &Base =
+ const BaseSubobject &Base =
AddressPointsByIndex.find(NextIndex)->second;
-
+
Out << " -- (";
Base.getBase()->printQualifiedName(Out);
Out << ", " << Base.getBaseOffset().getQuantity();
@@ -2040,7 +2040,7 @@ void ItaniumVTableBuilder::dumpLayout(ra
} else {
CharUnits BaseOffset =
AddressPointsByIndex.lower_bound(NextIndex)->second.getBaseOffset();
-
+
// We store the class names in a set to get a stable order.
std::set<std::string> ClassNames;
for (const auto &I :
@@ -2060,10 +2060,10 @@ void ItaniumVTableBuilder::dumpLayout(ra
}
Out << '\n';
-
+
if (isBuildingConstructorVTable())
return;
-
+
if (MostDerivedClass->getNumVBases()) {
// We store the virtual base class names and their offsets in a map to get
// a stable order.
@@ -2074,7 +2074,7 @@ void ItaniumVTableBuilder::dumpLayout(ra
CharUnits OffsetOffset = I.second;
ClassNamesAndOffsets.insert(std::make_pair(ClassName, OffsetOffset));
}
-
+
Out << "Virtual base offset offsets for '";
MostDerivedClass->printQualifiedName(Out);
Out << "' (";
@@ -2086,17 +2086,17 @@ void ItaniumVTableBuilder::dumpLayout(ra
Out << "\n";
}
-
+
if (!Thunks.empty()) {
// We store the method names in a map to get a stable order.
std::map<std::string, const CXXMethodDecl *> MethodNamesAndDecls;
for (const auto &I : Thunks) {
const CXXMethodDecl *MD = I.first;
- std::string MethodName =
+ std::string MethodName =
PredefinedExpr::ComputeName(PredefinedExpr::PrettyFunctionNoVirtual,
MD);
-
+
MethodNamesAndDecls.insert(std::make_pair(MethodName, MD));
}
@@ -2113,12 +2113,12 @@ void ItaniumVTableBuilder::dumpLayout(ra
Out << "Thunks for '" << MethodName << "' (" << ThunksVector.size();
Out << (ThunksVector.size() == 1 ? " entry" : " entries") << ").\n";
-
+
for (unsigned I = 0, E = ThunksVector.size(); I != E; ++I) {
const ThunkInfo &Thunk = ThunksVector[I];
Out << llvm::format("%4d | ", I);
-
+
// If this function pointer has a return pointer adjustment, dump it.
if (!Thunk.Return.isEmpty()) {
Out << "return adjustment: " << Thunk.Return.NonVirtual;
@@ -2136,16 +2136,16 @@ void ItaniumVTableBuilder::dumpLayout(ra
if (!Thunk.This.isEmpty()) {
Out << "this adjustment: ";
Out << Thunk.This.NonVirtual << " non-virtual";
-
+
if (Thunk.This.Virtual.Itanium.VCallOffsetOffset) {
Out << ", " << Thunk.This.Virtual.Itanium.VCallOffsetOffset;
Out << " vcall offset offset";
}
}
-
+
Out << '\n';
}
-
+
Out << '\n';
}
}
@@ -2227,7 +2227,7 @@ uint64_t ItaniumVTableContext::getMethod
MethodVTableIndicesTy::iterator I = MethodVTableIndices.find(GD);
if (I != MethodVTableIndices.end())
return I->second;
-
+
const CXXRecordDecl *RD = cast<CXXMethodDecl>(GD.getDecl())->getParent();
computeVTableRelatedInformation(RD);
@@ -2241,8 +2241,8 @@ CharUnits
ItaniumVTableContext::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
const CXXRecordDecl *VBase) {
ClassPairTy ClassPair(RD, VBase);
-
- VirtualBaseClassOffsetOffsetsMapTy::iterator I =
+
+ VirtualBaseClassOffsetOffsetsMapTy::iterator I =
VirtualBaseClassOffsetOffsets.find(ClassPair);
if (I != VirtualBaseClassOffsetOffsets.end())
return I->second;
@@ -2258,10 +2258,10 @@ ItaniumVTableContext::getVirtualBaseOffs
VirtualBaseClassOffsetOffsets.insert(std::make_pair(ClassPair, I.second));
}
-
+
I = VirtualBaseClassOffsetOffsets.find(ClassPair);
assert(I != VirtualBaseClassOffsetOffsets.end() && "Did not find index!");
-
+
return I->second;
}
@@ -2298,10 +2298,10 @@ ItaniumVTableContext::computeVTableRelat
// the rest of the vtable related information.
if (!RD->getNumVBases())
return;
-
+
const CXXRecordDecl *VBase =
RD->vbases_begin()->getType()->getAsCXXRecordDecl();
-
+
if (VirtualBaseClassOffsetOffsets.count(std::make_pair(RD, VBase)))
return;
Modified: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp Mon Jul 30 12:24:48 2018
@@ -56,13 +56,13 @@ using ManagedAnalysisMap = llvm::DenseMa
AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
const Decl *d,
const CFG::BuildOptions &buildOptions)
- : Manager(Mgr), D(d), cfgBuildOptions(buildOptions) {
+ : Manager(Mgr), D(d), cfgBuildOptions(buildOptions) {
cfgBuildOptions.forcedBlkExprs = &forcedBlkExprs;
}
AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
const Decl *d)
- : Manager(Mgr), D(d) {
+ : Manager(Mgr), D(d) {
cfgBuildOptions.forcedBlkExprs = &forcedBlkExprs;
}
@@ -154,7 +154,7 @@ const ImplicitParamDecl *AnalysisDeclCon
const VarDecl *VD = I.getVariable();
if (isSelfDecl(VD))
return dyn_cast<ImplicitParamDecl>(VD);
- }
+ }
}
auto *CXXMethod = dyn_cast<CXXMethodDecl>(D);
@@ -191,7 +191,7 @@ AnalysisDeclContext::getBlockForRegister
assert(forcedBlkExprs);
if (const auto *e = dyn_cast<Expr>(stmt))
stmt = e->IgnoreParens();
- CFG::BuildOptions::ForcedBlkExprs::const_iterator itr =
+ CFG::BuildOptions::ForcedBlkExprs::const_iterator itr =
forcedBlkExprs->find(stmt);
assert(itr != forcedBlkExprs->end());
return itr->second;
@@ -251,7 +251,7 @@ CFG *AnalysisDeclContext::getUnoptimized
CFGStmtMap *AnalysisDeclContext::getCFGStmtMap() {
if (cfgStmtMap)
return cfgStmtMap.get();
-
+
if (CFG *c = getCFG()) {
cfgStmtMap.reset(CFGStmtMap::Build(c, &getParentMap()));
return cfgStmtMap.get();
@@ -263,7 +263,7 @@ CFGStmtMap *AnalysisDeclContext::getCFGS
CFGReverseBlockReachabilityAnalysis *AnalysisDeclContext::getCFGReachablityAnalysis() {
if (CFA)
return CFA.get();
-
+
if (CFG *c = getCFG()) {
CFA.reset(new CFGReverseBlockReachabilityAnalysis(*c));
return CFA.get();
@@ -346,7 +346,7 @@ bool AnalysisDeclContext::isInStdNamespa
LocationContextManager &AnalysisDeclContext::getLocationContextManager() {
assert(Manager &&
"Cannot create LocationContexts without an AnalysisDeclContextManager!");
- return Manager->getLocationContextManager();
+ return Manager->getLocationContextManager();
}
//===----------------------------------------------------------------------===//
@@ -562,9 +562,9 @@ public:
IgnoredContexts.insert(BR->getBlockDecl());
Visit(BR->getBlockDecl()->getBody());
}
-
+
void VisitPseudoObjectExpr(PseudoObjectExpr *PE) {
- for (PseudoObjectExpr::semantics_iterator it = PE->semantics_begin(),
+ for (PseudoObjectExpr::semantics_iterator it = PE->semantics_begin(),
et = PE->semantics_end(); it != et; ++it) {
Expr *Semantic = *it;
if (auto *OVE = dyn_cast<OpaqueValueExpr>(Semantic))
Modified: cfe/trunk/lib/Analysis/BodyFarm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BodyFarm.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BodyFarm.cpp (original)
+++ cfe/trunk/lib/Analysis/BodyFarm.cpp Mon Jul 30 12:24:48 2018
@@ -50,33 +50,33 @@ namespace {
class ASTMaker {
public:
ASTMaker(ASTContext &C) : C(C) {}
-
+
/// Create a new BinaryOperator representing a simple assignment.
BinaryOperator *makeAssignment(const Expr *LHS, const Expr *RHS, QualType Ty);
-
+
/// Create a new BinaryOperator representing a comparison.
BinaryOperator *makeComparison(const Expr *LHS, const Expr *RHS,
BinaryOperator::Opcode Op);
-
+
/// Create a new compound stmt using the provided statements.
CompoundStmt *makeCompound(ArrayRef<Stmt*>);
-
+
/// Create a new DeclRefExpr for the referenced variable.
DeclRefExpr *makeDeclRefExpr(const VarDecl *D,
bool RefersToEnclosingVariableOrCapture = false);
-
+
/// Create a new UnaryOperator representing a dereference.
UnaryOperator *makeDereference(const Expr *Arg, QualType Ty);
-
+
/// Create an implicit cast for an integer conversion.
Expr *makeIntegralCast(const Expr *Arg, QualType Ty);
-
+
/// Create an implicit cast to a builtin boolean type.
ImplicitCastExpr *makeIntegralCastToBoolean(const Expr *Arg);
-
+
/// Create an implicit cast for lvalue-to-rvaluate conversions.
ImplicitCastExpr *makeLvalueToRvalue(const Expr *Arg, QualType Ty);
-
+
/// Make RValue out of variable declaration, creating a temporary
/// DeclRefExpr in the process.
ImplicitCastExpr *
@@ -92,10 +92,10 @@ public:
/// Create an Objective-C ivar reference.
ObjCIvarRefExpr *makeObjCIvarRef(const Expr *Base, const ObjCIvarDecl *IVar);
-
+
/// Create a Return statement.
ReturnStmt *makeReturn(const Expr *RetVal);
-
+
/// Create an integer literal expression of the given type.
IntegerLiteral *makeIntegerLiteral(uint64_t Value, QualType Ty);
@@ -506,9 +506,9 @@ static Stmt *create_dispatch_once(ASTCon
// block();
// }
// }
-
+
ASTMaker M(C);
-
+
// (1) Create the call.
CallExpr *CE = new (C) CallExpr(
/*ASTContext=*/C,
@@ -532,11 +532,11 @@ static Stmt *create_dispatch_once(ASTCon
PredicateTy),
M.makeIntegralCast(DoneValue, PredicateTy),
PredicateTy);
-
+
// (3) Create the compound statement.
Stmt *Stmts[] = { B, CE };
CompoundStmt *CS = M.makeCompound(Stmts);
-
+
// (4) Create the 'if' condition.
ImplicitCastExpr *LValToRval =
M.makeLvalueToRvalue(
@@ -576,7 +576,7 @@ static Stmt *create_dispatch_sync(ASTCon
// void dispatch_sync(dispatch_queue_t queue, void (^block)(void)) {
// block();
// }
- //
+ //
ASTMaker M(C);
DeclRefExpr *DR = M.makeDeclRefExpr(PV);
ImplicitCastExpr *ICE = M.makeLvalueToRvalue(DR, Ty);
@@ -612,16 +612,16 @@ static Stmt *create_OSAtomicCompareAndSw
const ParmVarDecl *NewValue = D->getParamDecl(1);
QualType NewValueTy = NewValue->getType();
-
+
assert(OldValueTy == NewValueTy);
-
+
const ParmVarDecl *TheValue = D->getParamDecl(2);
QualType TheValueTy = TheValue->getType();
const PointerType *PT = TheValueTy->getAs<PointerType>();
if (!PT)
return nullptr;
QualType PointeeTy = PT->getPointeeType();
-
+
ASTMaker M(C);
// Construct the comparison.
Expr *Comparison =
@@ -643,29 +643,29 @@ static Stmt *create_OSAtomicCompareAndSw
PointeeTy),
M.makeLvalueToRvalue(M.makeDeclRefExpr(NewValue), NewValueTy),
NewValueTy);
-
+
Expr *BoolVal = M.makeObjCBool(true);
Expr *RetVal = isBoolean ? M.makeIntegralCastToBoolean(BoolVal)
: M.makeIntegralCast(BoolVal, ResultTy);
Stmts[1] = M.makeReturn(RetVal);
CompoundStmt *Body = M.makeCompound(Stmts);
-
+
// Construct the else clause.
BoolVal = M.makeObjCBool(false);
RetVal = isBoolean ? M.makeIntegralCastToBoolean(BoolVal)
: M.makeIntegralCast(BoolVal, ResultTy);
Stmt *Else = M.makeReturn(RetVal);
-
+
/// Construct the If.
Stmt *If = new (C) IfStmt(C, SourceLocation(), false, nullptr, nullptr,
Comparison, Body, SourceLocation(), Else);
- return If;
+ return If;
}
Stmt *BodyFarm::getBody(const FunctionDecl *D) {
D = D->getCanonicalDecl();
-
+
Optional<Stmt *> &Val = Bodies[D];
if (Val.hasValue())
return Val.getValue();
@@ -692,7 +692,7 @@ Stmt *BodyFarm::getBody(const FunctionDe
.Case("dispatch_once", create_dispatch_once)
.Default(nullptr);
}
-
+
if (FF) { Val = FF(C, D); }
else if (Injector) { Val = Injector->getBody(D); }
return Val.getValue();
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Mon Jul 30 12:24:48 2018
@@ -145,7 +145,7 @@ static bool areExprTypesCompatible(const
namespace {
class CFGBuilder;
-
+
/// The CFG builder uses a recursive algorithm to build the CFG. When
/// we process an expression, sometimes we know that we must add the
/// subexpressions as block-level expressions. For example:
@@ -279,7 +279,7 @@ public:
private:
BumpVectorContext ctx;
-
+
/// Automatic variables in order of declaration.
AutomaticVarsTy Vars;
@@ -366,7 +366,7 @@ class TryResult {
public:
TryResult() = default;
TryResult(bool b) : X(b ? 1 : 0) {}
-
+
bool isTrue() const { return X == 1; }
bool isFalse() const { return X == 0; }
bool isKnown() const { return X >= 0; }
@@ -492,11 +492,11 @@ class CFGBuilder {
bool badCFG = false;
const CFG::BuildOptions &BuildOpts;
-
+
// State to track for building switch statements.
bool switchExclusivelyCovered = false;
Expr::EvalResult *switchCond = nullptr;
-
+
CFG::BuildOptions::ForcedBlkExprs::value_type *cachedEntry = nullptr;
const Stmt *lastLookup = nullptr;
@@ -516,7 +516,7 @@ public:
std::unique_ptr<CFG> buildCFG(const Decl *D, Stmt *Statement);
bool alwaysAdd(const Stmt *stmt);
-
+
private:
// Visitors to walk an AST and construct the CFG.
CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, AddStmtChoice asc);
@@ -1067,7 +1067,7 @@ private:
bool tryEvaluate(Expr *S, Expr::EvalResult &outResult) {
if (!BuildOpts.PruneTriviallyFalseEdges)
return false;
- return !S->isTypeDependent() &&
+ return !S->isTypeDependent() &&
!S->isValueDependent() &&
S->EvaluateAsRValue(outResult, *Context);
}
@@ -1183,18 +1183,18 @@ inline bool AddStmtChoice::alwaysAdd(CFG
bool CFGBuilder::alwaysAdd(const Stmt *stmt) {
bool shouldAdd = BuildOpts.alwaysAdd(stmt);
-
+
if (!BuildOpts.forcedBlkExprs)
return shouldAdd;
- if (lastLookup == stmt) {
+ if (lastLookup == stmt) {
if (cachedEntry) {
assert(cachedEntry->first == stmt);
return true;
}
return shouldAdd;
}
-
+
lastLookup = stmt;
// Perform the lookup!
@@ -1215,7 +1215,7 @@ bool CFGBuilder::alwaysAdd(const Stmt *s
cachedEntry = &*itr;
return true;
}
-
+
// FIXME: Add support for dependent-sized array types in C++?
// Does it even make sense to build a CFG for an uninstantiated template?
static const VariableArrayType *FindVA(const Type *t) {
@@ -1427,7 +1427,7 @@ std::unique_ptr<CFG> CFGBuilder::buildCF
// If there is no target block that contains label, then we are looking
// at an incomplete AST. Handle this by not registering a successor.
if (LI == LabelMap.end()) continue;
-
+
addSuccessor(B, LI->second.block);
}
@@ -1513,7 +1513,7 @@ CFGBlock *CFGBuilder::addInitializer(CXX
return Block;
}
-/// Retrieve the type of the temporary object whose lifetime was
+/// Retrieve the type of the temporary object whose lifetime was
/// extended by a local reference with the given initializer.
static QualType getReferenceInitTemporaryType(const Expr *Init,
bool *FoundMTE = nullptr) {
@@ -1766,7 +1766,7 @@ LocalScope* CFGBuilder::createOrReuseLoc
}
/// addLocalScopeForStmt - Add LocalScope to local scopes tree for statement
-/// that should create implicit scope (e.g. if/else substatements).
+/// that should create implicit scope (e.g. if/else substatements).
void CFGBuilder::addLocalScopeForStmt(Stmt *S) {
if (!BuildOpts.AddImplicitDtors && !BuildOpts.AddLifetime &&
!BuildOpts.AddScopes)
@@ -2574,7 +2574,7 @@ CFGBlock *CFGBuilder::VisitConditionalOp
// At least one of this or the above will be run.
return addStmt(BCO->getCommon());
}
-
+
return addStmt(condExpr);
}
@@ -2583,7 +2583,7 @@ CFGBlock *CFGBuilder::VisitDeclStmt(Decl
// CFG entirely.
if (isa<LabelDecl>(*DS->decl_begin()))
return Block;
-
+
// This case also handles static_asserts.
if (DS->isSingleDecl())
return VisitDeclSubExpr(DS);
@@ -3032,7 +3032,7 @@ CFGBlock *CFGBuilder::VisitLambdaExpr(La
}
return LastBlock;
}
-
+
CFGBlock *CFGBuilder::VisitGotoStmt(GotoStmt *G) {
// Goto is a control-flow statement. Thus we stop processing the current
// block and create a new one.
@@ -3146,7 +3146,7 @@ CFGBlock *CFGBuilder::VisitForStmt(ForSt
else if (badCFG)
return nullptr;
}
-
+
// Because of short-circuit evaluation, the condition of the loop can span
// multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that
// evaluate the condition.
@@ -3214,7 +3214,7 @@ CFGBlock *CFGBuilder::VisitForStmt(ForSt
// Link up the loop-back block to the entry condition block.
addSuccessor(TransitionBlock, EntryConditionBlock);
-
+
// The condition block is the implicit successor for any code above the loop.
Succ = EntryConditionBlock;
@@ -3334,7 +3334,7 @@ CFGBlock *CFGBuilder::VisitObjCForCollec
CFGBlock *LoopBackBlock = nullptr;
Succ = LoopBackBlock = createBlock();
LoopBackBlock->setLoopTarget(S);
-
+
BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos);
ContinueJumpTarget = JumpTarget(Succ, ScopePos);
@@ -3401,7 +3401,7 @@ CFGBlock *CFGBuilder::VisitPseudoObjectE
// Add the PseudoObject as the last thing.
appendStmt(Block, E);
- CFGBlock *lastBlock = Block;
+ CFGBlock *lastBlock = Block;
// Before that, evaluate all of the semantics in order. In
// CFG-land, that means appending them in reverse order.
@@ -3734,7 +3734,7 @@ CFGBlock *CFGBuilder::VisitUnaryExprOrTy
// VLA types have expressions that must be evaluated.
CFGBlock *lastBlock = Block;
-
+
if (E->isArgumentType()) {
for (const VariableArrayType *VA =FindVA(E->getArgumentType().getTypePtr());
VA != nullptr; VA = FindVA(VA->getElementType().getTypePtr()))
@@ -3863,7 +3863,7 @@ CFGBlock *CFGBuilder::VisitSwitchStmt(Sw
return LastBlock;
}
-
+
static bool shouldAddCase(bool &switchExclusivelyCovered,
const Expr::EvalResult *switchCond,
const CaseStmt *CS,
@@ -3878,7 +3878,7 @@ static bool shouldAddCase(bool &switchEx
// Evaluate the LHS of the case value.
const llvm::APSInt &lhsInt = CS->getLHS()->EvaluateKnownConstInt(Ctx);
const llvm::APSInt &condInt = switchCond->Val.getInt();
-
+
if (condInt == lhsInt) {
addCase = true;
switchExclusivelyCovered = true;
@@ -3897,7 +3897,7 @@ static bool shouldAddCase(bool &switchEx
else
addCase = true;
}
- return addCase;
+ return addCase;
}
CFGBlock *CFGBuilder::VisitCaseStmt(CaseStmt *CS) {
@@ -4069,7 +4069,7 @@ CFGBlock *CFGBuilder::VisitCXXCatchStmt(
CFGBlock *CatchBlock = Block;
if (!CatchBlock)
CatchBlock = createBlock();
-
+
// CXXCatchStmt is more than just a label. They have semantic meaning
// as well, as they implicitly "initialize" the catch variable. Add
// it to the CFG as a CFGElement so that the control-flow of these
@@ -4624,7 +4624,7 @@ CFGImplicitDtor::getDestructorDecl(ASTCo
const RecordType *recordType = ty->getAs<RecordType>();
const CXXRecordDecl *classDecl =
cast<CXXRecordDecl>(recordType->getDecl());
- return classDecl->getDestructor();
+ return classDecl->getDestructor();
}
case CFGElement::DeleteDtor: {
const CXXDeleteExpr *DE = castAs<CFGDeleteDtor>().getDeleteExpr();
@@ -4722,7 +4722,7 @@ public:
for (CFG::const_iterator I = cfg->begin(), E = cfg->end(); I != E; ++I ) {
unsigned j = 1;
for (CFGBlock::const_iterator BI = (*I)->begin(), BEnd = (*I)->end() ;
- BI != BEnd; ++BI, ++j ) {
+ BI != BEnd; ++BI, ++j ) {
if (Optional<CFGStmt> SE = BI->getAs<CFGStmt>()) {
const Stmt *stmt= SE->getStmt();
std::pair<unsigned, unsigned> P((*I)->getBlockID(), j);
@@ -5151,7 +5151,7 @@ static void print_block(raw_ostream &OS,
// Print the header.
if (ShowColors)
OS.changeColor(raw_ostream::YELLOW, true);
-
+
OS << "\n [B" << B.getBlockID();
if (&B == &cfg->getEntry())
@@ -5164,7 +5164,7 @@ static void print_block(raw_ostream &OS,
OS << " (NORETURN)]\n";
else
OS << "]\n";
-
+
if (ShowColors)
OS.resetColor();
@@ -5235,7 +5235,7 @@ static void print_block(raw_ostream &OS,
CFGBlockTerminatorPrint TPrinter(OS, &Helper, PP);
TPrinter.print(B.getTerminator());
OS << '\n';
-
+
if (ShowColors)
OS.resetColor();
}
@@ -5254,7 +5254,7 @@ static void print_block(raw_ostream &OS,
if (ShowColors)
OS.changeColor(Color);
-
+
for (CFGBlock::const_pred_iterator I = B.pred_begin(), E = B.pred_end();
I != E; ++I, ++i) {
if (i % 10 == 8)
@@ -5271,7 +5271,7 @@ static void print_block(raw_ostream &OS,
if (!Reachable)
OS << "(Unreachable)";
}
-
+
if (ShowColors)
OS.resetColor();
Modified: cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp (original)
+++ cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp Mon Jul 30 12:24:48 2018
@@ -68,7 +68,7 @@ void CFGReverseBlockReachabilityAnalysis
firstRun = false;
// Add the predecessors to the worklist.
- for (CFGBlock::const_pred_iterator i = block->pred_begin(),
+ for (CFGBlock::const_pred_iterator i = block->pred_begin(),
e = block->pred_end(); i != e; ++i) {
if (*i)
worklist.push_back(*i);
Modified: cfe/trunk/lib/Analysis/CFGStmtMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFGStmtMap.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFGStmtMap.cpp (original)
+++ cfe/trunk/lib/Analysis/CFGStmtMap.cpp Mon Jul 30 12:24:48 2018
@@ -24,7 +24,7 @@ static SMap *AsMap(void *m) { return (SM
CFGStmtMap::~CFGStmtMap() { delete AsMap(M); }
-CFGBlock *CFGStmtMap::getBlock(Stmt *S) {
+CFGBlock *CFGStmtMap::getBlock(Stmt *S) {
SMap *SM = AsMap(M);
Stmt *X = S;
@@ -53,17 +53,17 @@ static void Accumulate(SMap &SM, CFGBloc
Optional<CFGStmt> CS = CE.getAs<CFGStmt>();
if (!CS)
continue;
-
+
CFGBlock *&Entry = SM[CS->getStmt()];
// If 'Entry' is already initialized (e.g., a terminator was already),
// skip.
if (Entry)
continue;
-
+
Entry = B;
-
+
}
-
+
// Look at the label of the block.
if (Stmt *Label = B->getLabel())
SM[Label] = B;
@@ -82,7 +82,7 @@ CFGStmtMap *CFGStmtMap::Build(CFG *C, Pa
SMap *SM = new SMap();
// Walk all blocks, accumulating the block-level expressions, labels,
- // and terminators.
+ // and terminators.
for (CFG::iterator I = C->begin(), E = C->end(); I != E; ++I)
Accumulate(*SM, *I);
Modified: cfe/trunk/lib/Analysis/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CallGraph.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CallGraph.cpp (original)
+++ cfe/trunk/lib/Analysis/CallGraph.cpp Mon Jul 30 12:24:48 2018
@@ -84,7 +84,7 @@ public:
void VisitObjCMessageExpr(ObjCMessageExpr *ME) {
if (ObjCInterfaceDecl *IDecl = ME->getReceiverInterface()) {
Selector Sel = ME->getSelector();
-
+
// Find the callee definition within the same translation unit.
Decl *D = nullptr;
if (ME->isInstanceMessage())
Modified: cfe/trunk/lib/Analysis/CocoaConventions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CocoaConventions.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CocoaConventions.cpp (original)
+++ cfe/trunk/lib/Analysis/CocoaConventions.cpp Mon Jul 30 12:24:48 2018
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements cocoa naming convention analysis.
+// This file implements cocoa naming convention analysis.
//
//===----------------------------------------------------------------------===//
@@ -34,15 +34,15 @@ bool cocoa::isRefType(QualType RetTy, St
return false;
RetTy = TD->getDecl()->getUnderlyingType();
}
-
+
if (Name.empty())
return false;
-
+
// Is the type void*?
const PointerType* PT = RetTy->getAs<PointerType>();
if (!(PT->getPointeeType().getUnqualifiedType()->isVoidType()))
return false;
-
+
// Does the name start with the prefix?
return Name.startswith(Prefix);
}
@@ -66,32 +66,32 @@ bool coreFoundation::isCFObjectRef(QualT
bool cocoa::isCocoaObjectRef(QualType Ty) {
if (!Ty->isObjCObjectPointerType())
return false;
-
+
const ObjCObjectPointerType *PT = Ty->getAs<ObjCObjectPointerType>();
-
+
// Can be true for objects with the 'NSObject' attribute.
if (!PT)
return true;
-
+
// We assume that id<..>, id, Class, and Class<..> all represent tracked
// objects.
if (PT->isObjCIdType() || PT->isObjCQualifiedIdType() ||
PT->isObjCClassType() || PT->isObjCQualifiedClassType())
return true;
-
+
// Does the interface subclass NSObject?
// FIXME: We can memoize here if this gets too expensive.
const ObjCInterfaceDecl *ID = PT->getInterfaceDecl();
-
+
// Assume that anything declared with a forward declaration and no
// @interface subclasses NSObject.
if (!ID->hasDefinition())
return true;
-
+
for ( ; ID ; ID = ID->getSuperClass())
if (ID->getIdentifier()->getName() == "NSObject")
return true;
-
+
return false;
}
@@ -101,11 +101,11 @@ bool coreFoundation::followsCreateRule(c
const IdentifierInfo *ident = fn->getIdentifier();
if (!ident) return false;
StringRef functionName = ident->getName();
-
+
StringRef::iterator it = functionName.begin();
StringRef::iterator start = it;
StringRef::iterator endI = functionName.end();
-
+
while (true) {
// Scan for the start of 'create' or 'copy'.
for ( ; it != endI ; ++it) {
@@ -124,7 +124,7 @@ bool coreFoundation::followsCreateRule(c
// Did we hit the end of the string? If so, we didn't find a match.
if (it == endI)
return false;
-
+
// Scan for *lowercase* 'reate' or 'opy', followed by no lowercase
// character.
StringRef suffix = functionName.substr(it - start);
@@ -137,10 +137,10 @@ bool coreFoundation::followsCreateRule(c
// Keep scanning.
continue;
}
-
+
if (it == endI || !isLowercase(*it))
return true;
-
+
// If we matched a lowercase character, it isn't the end of the
// word. Keep scanning.
}
Modified: cfe/trunk/lib/Analysis/Consumed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/Consumed.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/Consumed.cpp (original)
+++ cfe/trunk/lib/Analysis/Consumed.cpp Mon Jul 30 12:24:48 2018
@@ -40,7 +40,7 @@
// TODO: Adjust states of args to constructors in the same way that arguments to
// function calls are handled.
// TODO: Use information from tests in for- and while-loop conditional.
-// TODO: Add notes about the actual and expected state for
+// TODO: Add notes about the actual and expected state for
// TODO: Correctly identify unreachable blocks when chaining boolean operators.
// TODO: Adjust the parser and AttributesList class to support lists of
// identifiers.
@@ -124,30 +124,30 @@ static bool isCallableInState(const Call
case CallableWhenAttr::Unknown:
MappedAttrState = CS_Unknown;
break;
-
+
case CallableWhenAttr::Unconsumed:
MappedAttrState = CS_Unconsumed;
break;
-
+
case CallableWhenAttr::Consumed:
MappedAttrState = CS_Consumed;
break;
}
-
+
if (MappedAttrState == State)
return true;
}
-
+
return false;
}
static bool isConsumableType(const QualType &QT) {
if (QT->isPointerType() || QT->isReferenceType())
return false;
-
+
if (const CXXRecordDecl *RD = QT->getAsCXXRecordDecl())
return RD->hasAttr<ConsumableAttr>();
-
+
return false;
}
@@ -250,13 +250,13 @@ static StringRef stateToString(ConsumedS
switch (State) {
case consumed::CS_None:
return "none";
-
+
case consumed::CS_Unknown:
return "unknown";
-
+
case consumed::CS_Unconsumed:
return "unconsumed";
-
+
case consumed::CS_Consumed:
return "consumed";
}
@@ -307,7 +307,7 @@ class PropagationInfo {
VarTestResult LTest;
VarTestResult RTest;
};
-
+
union {
ConsumedState State;
VarTestResult VarTest;
@@ -315,7 +315,7 @@ class PropagationInfo {
const CXXBindTemporaryExpr *Tmp;
BinTestTy BinTest;
};
-
+
public:
PropagationInfo() = default;
PropagationInfo(const VarTestResult &VarTest)
@@ -326,7 +326,7 @@ public:
VarTest.Var = Var;
VarTest.TestsFor = TestsFor;
}
-
+
PropagationInfo(const BinaryOperator *Source, EffectiveOp EOp,
const VarTestResult <est, const VarTestResult &RTest)
: InfoType(IT_BinTest) {
@@ -335,7 +335,7 @@ public:
BinTest.LTest = LTest;
BinTest.RTest = RTest;
}
-
+
PropagationInfo(const BinaryOperator *Source, EffectiveOp EOp,
const VarDecl *LVar, ConsumedState LTestsFor,
const VarDecl *RVar, ConsumedState RTestsFor)
@@ -347,46 +347,46 @@ public:
BinTest.RTest.Var = RVar;
BinTest.RTest.TestsFor = RTestsFor;
}
-
+
PropagationInfo(ConsumedState State)
: InfoType(IT_State), State(State) {}
PropagationInfo(const VarDecl *Var) : InfoType(IT_Var), Var(Var) {}
PropagationInfo(const CXXBindTemporaryExpr *Tmp)
: InfoType(IT_Tmp), Tmp(Tmp) {}
-
+
const ConsumedState &getState() const {
assert(InfoType == IT_State);
return State;
}
-
+
const VarTestResult &getVarTest() const {
assert(InfoType == IT_VarTest);
return VarTest;
}
-
+
const VarTestResult &getLTest() const {
assert(InfoType == IT_BinTest);
return BinTest.LTest;
}
-
+
const VarTestResult &getRTest() const {
assert(InfoType == IT_BinTest);
return BinTest.RTest;
}
-
+
const VarDecl *getVar() const {
assert(InfoType == IT_Var);
return Var;
}
-
+
const CXXBindTemporaryExpr *getTmp() const {
assert(InfoType == IT_Tmp);
return Tmp;
}
-
+
ConsumedState getAsState(const ConsumedStateMap *StateMap) const {
assert(isVar() || isTmp() || isState());
-
+
if (isVar())
return StateMap->getState(Var);
else if (isTmp())
@@ -396,39 +396,39 @@ public:
else
return CS_None;
}
-
+
EffectiveOp testEffectiveOp() const {
assert(InfoType == IT_BinTest);
return BinTest.EOp;
}
-
+
const BinaryOperator * testSourceNode() const {
assert(InfoType == IT_BinTest);
return BinTest.Source;
}
-
+
bool isValid() const { return InfoType != IT_None; }
bool isState() const { return InfoType == IT_State; }
bool isVarTest() const { return InfoType == IT_VarTest; }
bool isBinTest() const { return InfoType == IT_BinTest; }
bool isVar() const { return InfoType == IT_Var; }
bool isTmp() const { return InfoType == IT_Tmp; }
-
+
bool isTest() const {
return InfoType == IT_VarTest || InfoType == IT_BinTest;
}
-
+
bool isPointerToValue() const {
return InfoType == IT_Var || InfoType == IT_Tmp;
}
-
+
PropagationInfo invertTest() const {
assert(InfoType == IT_VarTest || InfoType == IT_BinTest);
-
+
if (InfoType == IT_VarTest) {
return PropagationInfo(VarTest.Var,
invertConsumedUnconsumed(VarTest.TestsFor));
-
+
} else if (InfoType == IT_BinTest) {
return PropagationInfo(BinTest.Source,
BinTest.EOp == EO_And ? EO_Or : EO_And,
@@ -447,7 +447,7 @@ static void
setStateForVarOrTmp(ConsumedStateMap *StateMap, const PropagationInfo &PInfo,
ConsumedState State) {
assert(PInfo.isVar() || PInfo.isTmp());
-
+
if (PInfo.isVar())
StateMap->setState(PInfo.getVar(), State);
else
@@ -462,7 +462,7 @@ class ConsumedStmtVisitor : public Const
using PairType= std::pair<const Stmt *, PropagationInfo>;
using InfoEntry = MapType::iterator;
using ConstInfoEntry = MapType::const_iterator;
-
+
AnalysisDeclContext &AC;
ConsumedAnalyzer &Analyzer;
ConsumedStateMap *StateMap;
@@ -498,7 +498,7 @@ public:
SourceLocation BlameLoc);
bool handleCall(const CallExpr *Call, const Expr *ObjArg,
const FunctionDecl *FunD);
-
+
void VisitBinaryOperator(const BinaryOperator *BinOp);
void VisitCallExpr(const CallExpr *Call);
void VisitCastExpr(const CastExpr *Cast);
@@ -518,16 +518,16 @@ public:
ConsumedStmtVisitor(AnalysisDeclContext &AC, ConsumedAnalyzer &Analyzer,
ConsumedStateMap *StateMap)
: AC(AC), Analyzer(Analyzer), StateMap(StateMap) {}
-
+
PropagationInfo getInfo(const Expr *StmtNode) const {
ConstInfoEntry Entry = findInfo(StmtNode);
-
+
if (Entry != PropagationMap.end())
return Entry->second;
else
return {};
}
-
+
void reset(ConsumedStateMap *NewStateMap) {
StateMap = NewStateMap;
}
@@ -696,7 +696,7 @@ void ConsumedStmtVisitor::propagateRetur
ReturnState = mapReturnTypestateAttrState(RTA);
else
ReturnState = mapConsumableAttrState(RetType);
-
+
PropagationMap.insert(PairType(Call, PropagationInfo(ReturnState)));
}
}
@@ -707,16 +707,16 @@ void ConsumedStmtVisitor::VisitBinaryOpe
case BO_LOr : {
InfoEntry LEntry = findInfo(BinOp->getLHS()),
REntry = findInfo(BinOp->getRHS());
-
+
VarTestResult LTest, RTest;
-
+
if (LEntry != PropagationMap.end() && LEntry->second.isVarTest()) {
LTest = LEntry->second.getVarTest();
} else {
LTest.Var = nullptr;
LTest.TestsFor = CS_None;
}
-
+
if (REntry != PropagationMap.end() && REntry->second.isVarTest()) {
RTest = REntry->second.getVarTest();
} else {
@@ -729,12 +729,12 @@ void ConsumedStmtVisitor::VisitBinaryOpe
static_cast<EffectiveOp>(BinOp->getOpcode() == BO_LOr), LTest, RTest)));
break;
}
-
+
case BO_PtrMemD:
case BO_PtrMemI:
forwardInfo(BinOp->getLHS(), BinOp);
break;
-
+
default:
break;
}
@@ -762,9 +762,9 @@ void ConsumedStmtVisitor::VisitCastExpr(
void ConsumedStmtVisitor::VisitCXXBindTemporaryExpr(
const CXXBindTemporaryExpr *Temp) {
-
+
InfoEntry Entry = findInfo(Temp->getSubExpr());
-
+
if (Entry != PropagationMap.end() && !Entry->second.isTest()) {
StateMap->setState(Temp, Entry->second.getAsState(StateMap));
PropagationMap.insert(PairType(Temp, PropagationInfo(Temp)));
@@ -776,13 +776,13 @@ void ConsumedStmtVisitor::VisitCXXConstr
ASTContext &CurrContext = AC.getASTContext();
QualType ThisType = Constructor->getThisType(CurrContext)->getPointeeType();
-
+
if (!isConsumableType(ThisType))
return;
-
+
// FIXME: What should happen if someone annotates the move constructor?
if (ReturnTypestateAttr *RTA = Constructor->getAttr<ReturnTypestateAttr>()) {
- // TODO: Adjust state of args appropriately.
+ // TODO: Adjust state of args appropriately.
ConsumedState RetState = mapReturnTypestateAttrState(RTA);
PropagationMap.insert(PairType(Call, PropagationInfo(RetState)));
} else if (Constructor->isDefaultConstructor()) {
@@ -840,10 +840,10 @@ void ConsumedStmtVisitor::VisitDeclRefEx
}
void ConsumedStmtVisitor::VisitDeclStmt(const DeclStmt *DeclS) {
- for (const auto *DI : DeclS->decls())
+ for (const auto *DI : DeclS->decls())
if (isa<VarDecl>(DI))
VisitVarDecl(cast<VarDecl>(DI));
-
+
if (DeclS->isSingleDecl())
if (const auto *Var = dyn_cast_or_null<VarDecl>(DeclS->getSingleDecl()))
PropagationMap.insert(PairType(DeclS, PropagationInfo(Var)));
@@ -861,38 +861,38 @@ void ConsumedStmtVisitor::VisitMemberExp
void ConsumedStmtVisitor::VisitParmVarDecl(const ParmVarDecl *Param) {
QualType ParamType = Param->getType();
ConsumedState ParamState = consumed::CS_None;
-
+
if (const ParamTypestateAttr *PTA = Param->getAttr<ParamTypestateAttr>())
- ParamState = mapParamTypestateAttrState(PTA);
+ ParamState = mapParamTypestateAttrState(PTA);
else if (isConsumableType(ParamType))
- ParamState = mapConsumableAttrState(ParamType);
+ ParamState = mapConsumableAttrState(ParamType);
else if (isRValueRef(ParamType) &&
isConsumableType(ParamType->getPointeeType()))
- ParamState = mapConsumableAttrState(ParamType->getPointeeType());
+ ParamState = mapConsumableAttrState(ParamType->getPointeeType());
else if (ParamType->isReferenceType() &&
isConsumableType(ParamType->getPointeeType()))
ParamState = consumed::CS_Unknown;
-
+
if (ParamState != CS_None)
StateMap->setState(Param, ParamState);
}
void ConsumedStmtVisitor::VisitReturnStmt(const ReturnStmt *Ret) {
ConsumedState ExpectedState = Analyzer.getExpectedReturnState();
-
+
if (ExpectedState != CS_None) {
InfoEntry Entry = findInfo(Ret->getRetValue());
-
+
if (Entry != PropagationMap.end()) {
ConsumedState RetState = Entry->second.getAsState(StateMap);
-
+
if (RetState != ExpectedState)
Analyzer.WarningsHandler.warnReturnTypestateMismatch(
Ret->getReturnLoc(), stateToString(ExpectedState),
stateToString(RetState));
}
}
-
+
StateMap->checkParamsForReturnTypestate(Ret->getLocStart(),
Analyzer.WarningsHandler);
}
@@ -900,17 +900,17 @@ void ConsumedStmtVisitor::VisitReturnStm
void ConsumedStmtVisitor::VisitUnaryOperator(const UnaryOperator *UOp) {
InfoEntry Entry = findInfo(UOp->getSubExpr());
if (Entry == PropagationMap.end()) return;
-
+
switch (UOp->getOpcode()) {
case UO_AddrOf:
PropagationMap.insert(PairType(UOp, Entry->second));
break;
-
+
case UO_LNot:
if (Entry->second.isTest())
PropagationMap.insert(PairType(UOp, Entry->second.invertTest()));
break;
-
+
default:
break;
}
@@ -924,7 +924,7 @@ void ConsumedStmtVisitor::VisitVarDecl(c
if (VIT != PropagationMap.end()) {
PropagationInfo PInfo = VIT->second;
ConsumedState St = PInfo.getAsState(StateMap);
-
+
if (St != consumed::CS_None) {
StateMap->setState(Var, St);
return;
@@ -940,7 +940,7 @@ static void splitVarStateForIf(const IfS
ConsumedStateMap *ThenStates,
ConsumedStateMap *ElseStates) {
ConsumedState VarState = ThenStates->getState(Test.Var);
-
+
if (VarState == CS_Unknown) {
ThenStates->setState(Test.Var, Test.TestsFor);
ElseStates->setState(Test.Var, invertConsumedUnconsumed(Test.TestsFor));
@@ -956,10 +956,10 @@ static void splitVarStateForIfBinOp(cons
ConsumedStateMap *ElseStates) {
const VarTestResult <est = PInfo.getLTest(),
&RTest = PInfo.getRTest();
-
+
ConsumedState LState = LTest.Var ? ThenStates->getState(LTest.Var) : CS_None,
RState = RTest.Var ? ThenStates->getState(RTest.Var) : CS_None;
-
+
if (LTest.Var) {
if (PInfo.testEffectiveOp() == EO_And) {
if (LState == CS_Unknown) {
@@ -987,7 +987,7 @@ static void splitVarStateForIfBinOp(cons
}
}
}
-
+
if (RTest.Var) {
if (PInfo.testEffectiveOp() == EO_And) {
if (RState == CS_Unknown)
@@ -1008,7 +1008,7 @@ bool ConsumedBlockInfo::allBackEdgesVisi
const CFGBlock *TargetBlock) {
assert(CurrBlock && "Block pointer must not be NULL");
assert(TargetBlock && "TargetBlock pointer must not be NULL");
-
+
unsigned int CurrBlockOrder = VisitOrder[CurrBlock->getBlockID()];
for (CFGBlock::const_pred_iterator PI = TargetBlock->pred_begin(),
PE = TargetBlock->pred_end(); PI != PE; ++PI) {
@@ -1069,7 +1069,7 @@ ConsumedBlockInfo::getInfo(const CFGBloc
bool ConsumedBlockInfo::isBackEdge(const CFGBlock *From, const CFGBlock *To) {
assert(From && "From block must not be NULL");
assert(To && "From block must not be NULL");
-
+
return VisitOrder[From->getBlockID()] > VisitOrder[To->getBlockID()];
}
@@ -1080,7 +1080,7 @@ bool ConsumedBlockInfo::isBackEdgeTarget
// edge.
if (Block->pred_size() < 2)
return false;
-
+
unsigned int BlockVisitOrder = VisitOrder[Block->getBlockID()];
for (CFGBlock::const_pred_iterator PI = Block->pred_begin(),
PE = Block->pred_end(); PI != PE; ++PI) {
@@ -1092,16 +1092,16 @@ bool ConsumedBlockInfo::isBackEdgeTarget
void ConsumedStateMap::checkParamsForReturnTypestate(SourceLocation BlameLoc,
ConsumedWarningsHandlerBase &WarningsHandler) const {
-
+
for (const auto &DM : VarMap) {
if (isa<ParmVarDecl>(DM.first)) {
const auto *Param = cast<ParmVarDecl>(DM.first);
const ReturnTypestateAttr *RTA = Param->getAttr<ReturnTypestateAttr>();
-
+
if (!RTA)
continue;
-
- ConsumedState ExpectedState = mapReturnTypestateAttrState(RTA);
+
+ ConsumedState ExpectedState = mapReturnTypestateAttrState(RTA);
if (DM.second != ExpectedState)
WarningsHandler.warnParamReturnTypestateMismatch(BlameLoc,
Param->getNameAsString(), stateToString(ExpectedState),
@@ -1116,20 +1116,20 @@ void ConsumedStateMap::clearTemporaries(
ConsumedState ConsumedStateMap::getState(const VarDecl *Var) const {
VarMapType::const_iterator Entry = VarMap.find(Var);
-
+
if (Entry != VarMap.end())
return Entry->second;
-
+
return CS_None;
}
ConsumedState
ConsumedStateMap::getState(const CXXBindTemporaryExpr *Tmp) const {
TmpMapType::const_iterator Entry = TmpMap.find(Tmp);
-
+
if (Entry != TmpMap.end())
return Entry->second;
-
+
return CS_None;
}
@@ -1143,10 +1143,10 @@ void ConsumedStateMap::intersect(const C
for (const auto &DM : Other.VarMap) {
LocalState = this->getState(DM.first);
-
+
if (LocalState == CS_None)
continue;
-
+
if (LocalState != DM.second)
VarMap[DM.first] = CS_Unknown;
}
@@ -1155,16 +1155,16 @@ void ConsumedStateMap::intersect(const C
void ConsumedStateMap::intersectAtLoopHead(const CFGBlock *LoopHead,
const CFGBlock *LoopBack, const ConsumedStateMap *LoopBackStates,
ConsumedWarningsHandlerBase &WarningsHandler) {
-
+
ConsumedState LocalState;
SourceLocation BlameLoc = getLastStmtLoc(LoopBack);
-
- for (const auto &DM : LoopBackStates->VarMap) {
+
+ for (const auto &DM : LoopBackStates->VarMap) {
LocalState = this->getState(DM.first);
-
+
if (LocalState == CS_None)
continue;
-
+
if (LocalState != DM.second) {
VarMap[DM.first] = CS_Unknown;
WarningsHandler.warnLoopStateMismatch(BlameLoc,
@@ -1195,7 +1195,7 @@ void ConsumedStateMap::remove(const CXXB
bool ConsumedStateMap::operator!=(const ConsumedStateMap *Other) const {
for (const auto &DM : Other->VarMap)
if (this->getState(DM.first) != DM.second)
- return true;
+ return true;
return false;
}
@@ -1235,15 +1235,15 @@ bool ConsumedAnalyzer::splitState(const
std::unique_ptr<ConsumedStateMap> FalseStates(
new ConsumedStateMap(*CurrStates));
PropagationInfo PInfo;
-
+
if (const auto *IfNode =
dyn_cast_or_null<IfStmt>(CurrBlock->getTerminator().getStmt())) {
const Expr *Cond = IfNode->getCond();
-
+
PInfo = Visitor.getInfo(Cond);
if (!PInfo.isValid() && isa<BinaryOperator>(Cond))
PInfo = Visitor.getInfo(cast<BinaryOperator>(Cond)->getRHS());
-
+
if (PInfo.isVarTest()) {
CurrStates->setSource(Cond);
FalseStates->setSource(Cond);
@@ -1262,26 +1262,26 @@ bool ConsumedAnalyzer::splitState(const
if (!PInfo.isVarTest()) {
if ((BinOp = dyn_cast_or_null<BinaryOperator>(BinOp->getLHS()))) {
PInfo = Visitor.getInfo(BinOp->getRHS());
-
+
if (!PInfo.isVarTest())
return false;
} else {
return false;
}
}
-
+
CurrStates->setSource(BinOp);
FalseStates->setSource(BinOp);
-
+
const VarTestResult &Test = PInfo.getVarTest();
ConsumedState VarState = CurrStates->getState(Test.Var);
-
+
if (BinOp->getOpcode() == BO_LAnd) {
if (VarState == CS_Unknown)
CurrStates->setState(Test.Var, Test.TestsFor);
else if (VarState == invertConsumedUnconsumed(Test.TestsFor))
CurrStates->markUnreachable();
-
+
} else if (BinOp->getOpcode() == BO_LOr) {
if (VarState == CS_Unknown)
FalseStates->setState(Test.Var,
@@ -1292,9 +1292,9 @@ bool ConsumedAnalyzer::splitState(const
} else {
return false;
}
-
+
CFGBlock::const_succ_iterator SI = CurrBlock->succ_begin();
-
+
if (*SI)
BlockInfo.addInfo(*SI, std::move(CurrStates));
else
@@ -1310,7 +1310,7 @@ void ConsumedAnalyzer::run(AnalysisDeclC
const auto *D = dyn_cast_or_null<FunctionDecl>(AC.getDecl());
if (!D)
return;
-
+
CFG *CFGraph = AC.getCFG();
if (!CFGraph)
return;
@@ -1319,7 +1319,7 @@ void ConsumedAnalyzer::run(AnalysisDeclC
PostOrderCFGView *SortedGraph = AC.getAnalysis<PostOrderCFGView>();
// AC.getCFG()->viewCFG(LangOptions());
-
+
BlockInfo = ConsumedBlockInfo(CFGraph->getNumBlockIDs(), SortedGraph);
CurrStates = llvm::make_unique<ConsumedStateMap>();
@@ -1328,12 +1328,12 @@ void ConsumedAnalyzer::run(AnalysisDeclC
// Add all trackable parameters to the state map.
for (const auto *PI : D->parameters())
Visitor.VisitParmVarDecl(PI);
-
+
// Visit all of the function's basic blocks.
for (const auto *CurrBlock : *SortedGraph) {
if (!CurrStates)
CurrStates = BlockInfo.getInfo(CurrBlock);
-
+
if (!CurrStates) {
continue;
} else if (!CurrStates->isReachable()) {
@@ -1349,34 +1349,34 @@ void ConsumedAnalyzer::run(AnalysisDeclC
case CFGElement::Statement:
Visitor.Visit(B.castAs<CFGStmt>().getStmt());
break;
-
+
case CFGElement::TemporaryDtor: {
const CFGTemporaryDtor &DTor = B.castAs<CFGTemporaryDtor>();
const CXXBindTemporaryExpr *BTE = DTor.getBindTemporaryExpr();
-
+
Visitor.checkCallability(PropagationInfo(BTE),
DTor.getDestructorDecl(AC.getASTContext()),
BTE->getExprLoc());
CurrStates->remove(BTE);
break;
}
-
+
case CFGElement::AutomaticObjectDtor: {
const CFGAutomaticObjDtor &DTor = B.castAs<CFGAutomaticObjDtor>();
SourceLocation Loc = DTor.getTriggerStmt()->getLocEnd();
const VarDecl *Var = DTor.getVarDecl();
-
+
Visitor.checkCallability(PropagationInfo(Var),
DTor.getDestructorDecl(AC.getASTContext()),
Loc);
break;
}
-
+
default:
break;
}
}
-
+
// TODO: Handle other forms of branching with precision, including while-
// and for-loops. (Deferred)
if (!splitState(CurrBlock, Visitor)) {
@@ -1406,13 +1406,13 @@ void ConsumedAnalyzer::run(AnalysisDeclC
CurrStates = nullptr;
}
}
-
+
if (CurrBlock == &AC.getCFG()->getExit() &&
D->getCallResultType()->isVoidType())
CurrStates->checkParamsForReturnTypestate(D->getLocation(),
WarningsHandler);
} // End of block iterator.
-
+
// Delete the last existing state map.
CurrStates = nullptr;
Modified: cfe/trunk/lib/Analysis/FormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatString.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/FormatString.cpp Mon Jul 30 12:24:48 2018
@@ -407,7 +407,7 @@ ArgType::matchesType(ASTContext &C, Qual
case WIntTy: {
- QualType PromoArg =
+ QualType PromoArg =
argTy->isPromotableIntegerType()
? C.getPromotedIntegerType(argTy) : argTy;
@@ -623,7 +623,7 @@ const char *ConversionSpecifier::toStrin
Optional<ConversionSpecifier>
ConversionSpecifier::getStandardSpecifier() const {
ConversionSpecifier::Kind NewKind;
-
+
switch (getKind()) {
default:
return None;
@@ -672,7 +672,7 @@ bool FormatSpecifier::hasValidLengthModi
switch (LM.getKind()) {
case LengthModifier::None:
return true;
-
+
// Handle most integer flags
case LengthModifier::AsShort:
if (Target.getTriple().isOSMSVCRT()) {
@@ -712,7 +712,7 @@ bool FormatSpecifier::hasValidLengthModi
default:
return false;
}
-
+
// Handle 'l' flag
case LengthModifier::AsLong: // or AsWideChar
switch (CS.getKind()) {
@@ -745,7 +745,7 @@ bool FormatSpecifier::hasValidLengthModi
default:
return false;
}
-
+
case LengthModifier::AsLongDouble:
switch (CS.getKind()) {
case ConversionSpecifier::aArg:
Modified: cfe/trunk/lib/Analysis/FormatStringParsing.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/FormatStringParsing.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/FormatStringParsing.h (original)
+++ cfe/trunk/lib/Analysis/FormatStringParsing.h Mon Jul 30 12:24:48 2018
@@ -23,7 +23,7 @@ public:
};
namespace analyze_format_string {
-
+
OptionalAmount ParseAmount(const char *&Beg, const char *E);
OptionalAmount ParseNonPositionAmount(const char *&Beg, const char *E,
unsigned &argIndex);
@@ -31,12 +31,12 @@ OptionalAmount ParseNonPositionAmount(co
OptionalAmount ParsePositionAmount(FormatStringHandler &H,
const char *Start, const char *&Beg,
const char *E, PositionContext p);
-
+
bool ParseFieldWidth(FormatStringHandler &H,
FormatSpecifier &CS,
const char *Start, const char *&Beg, const char *E,
unsigned *argIndex);
-
+
bool ParseArgPosition(FormatStringHandler &H,
FormatSpecifier &CS, const char *Start,
const char *&Beg, const char *E);
@@ -62,7 +62,7 @@ public:
SpecifierResult(const char *start,
const T &fs)
: FS(fs), Start(start), Stop(false) {}
-
+
const char *getStart() const { return Start; }
bool shouldStop() const { return Stop; }
bool hasValue() const { return Start != nullptr; }
@@ -72,7 +72,7 @@ public:
}
const T &getValue() { return FS; }
};
-
+
} // end analyze_format_string namespace
} // end clang namespace
Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Mon Jul 30 12:24:48 2018
@@ -39,7 +39,7 @@ public:
: enqueuedBlocks(cfg.getNumBlockIDs()),
POV(Ctx.getAnalysis<PostOrderCFGView>()),
worklist(POV->getComparator()) {}
-
+
void enqueueBlock(const CFGBlock *block);
void enqueuePredecessors(const CFGBlock *block);
@@ -73,7 +73,7 @@ const CFGBlock *DataflowWorklist::dequeu
namespace {
class LiveVariablesImpl {
-public:
+public:
AnalysisDeclContext &analysisContext;
llvm::ImmutableSet<const Stmt *>::Factory SSetFact;
llvm::ImmutableSet<const VarDecl *>::Factory DSetFact;
@@ -83,7 +83,7 @@ public:
llvm::DenseMap<const Stmt *, LiveVariables::LivenessValues> stmtsToLiveness;
llvm::DenseMap<const DeclRefExpr *, unsigned> inAssignment;
const bool killAtAssign;
-
+
LiveVariables::LivenessValues
merge(LiveVariables::LivenessValues valsA,
LiveVariables::LivenessValues valsB);
@@ -130,7 +130,7 @@ namespace {
SET mergeSets(SET A, SET B) {
if (A.isEmpty())
return B;
-
+
for (typename SET::iterator it = B.begin(), ei = B.end(); it != ei; ++it) {
A = A.add(*it);
}
@@ -142,17 +142,17 @@ void LiveVariables::Observer::anchor() {
LiveVariables::LivenessValues
LiveVariablesImpl::merge(LiveVariables::LivenessValues valsA,
- LiveVariables::LivenessValues valsB) {
-
+ LiveVariables::LivenessValues valsB) {
+
llvm::ImmutableSetRef<const Stmt *>
SSetRefA(valsA.liveStmts.getRootWithoutRetain(), SSetFact.getTreeFactory()),
SSetRefB(valsB.liveStmts.getRootWithoutRetain(), SSetFact.getTreeFactory());
-
-
+
+
llvm::ImmutableSetRef<const VarDecl *>
DSetRefA(valsA.liveDecls.getRootWithoutRetain(), DSetFact.getTreeFactory()),
DSetRefB(valsB.liveDecls.getRootWithoutRetain(), DSetFact.getTreeFactory());
-
+
llvm::ImmutableSetRef<const BindingDecl *>
BSetRefA(valsA.liveBindings.getRootWithoutRetain(), BSetFact.getTreeFactory()),
BSetRefB(valsB.liveBindings.getRootWithoutRetain(), BSetFact.getTreeFactory());
@@ -160,12 +160,12 @@ LiveVariablesImpl::merge(LiveVariables::
SSetRefA = mergeSets(SSetRefA, SSetRefB);
DSetRefA = mergeSets(DSetRefA, DSetRefB);
BSetRefA = mergeSets(BSetRefA, BSetRefB);
-
+
// asImmutableSet() canonicalizes the tree, allowing us to do an easy
// comparison afterwards.
return LiveVariables::LivenessValues(SSetRefA.asImmutableSet(),
DSetRefA.asImmutableSet(),
- BSetRefA.asImmutableSet());
+ BSetRefA.asImmutableSet());
}
bool LiveVariables::LivenessValues::equals(const LivenessValues &V) const {
@@ -211,7 +211,7 @@ public:
void VisitBinaryOperator(BinaryOperator *BO);
void VisitBlockExpr(BlockExpr *BE);
- void VisitDeclRefExpr(DeclRefExpr *DR);
+ void VisitDeclRefExpr(DeclRefExpr *DR);
void VisitDeclStmt(DeclStmt *DS);
void VisitObjCForCollectionStmt(ObjCForCollectionStmt *OS);
void VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *UE);
@@ -226,7 +226,7 @@ static const VariableArrayType *FindVA(Q
if (const VariableArrayType *VAT = dyn_cast<VariableArrayType>(VT))
if (VAT->getSizeExpr())
return VAT;
-
+
ty = VT->getElementType().getTypePtr();
}
@@ -236,7 +236,7 @@ static const VariableArrayType *FindVA(Q
static const Stmt *LookThroughStmt(const Stmt *S) {
while (S) {
if (const Expr *Ex = dyn_cast<Expr>(S))
- S = Ex->IgnoreParens();
+ S = Ex->IgnoreParens();
if (const ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(S)) {
S = EWC->getSubExpr();
continue;
@@ -259,15 +259,15 @@ static void AddLiveStmt(llvm::ImmutableS
void TransferFunctions::Visit(Stmt *S) {
if (observer)
observer->observeStmt(S, currentBlock, val);
-
+
StmtVisitor<TransferFunctions>::Visit(S);
-
+
if (isa<Expr>(S)) {
val.liveStmts = LV.SSetFact.remove(val.liveStmts, S);
}
// Mark all children expressions live.
-
+
switch (S->getStmtClass()) {
default:
break;
@@ -344,7 +344,7 @@ void TransferFunctions::VisitBinaryOpera
if (B->isAssignmentOp()) {
if (!LV.killAtAssign)
return;
-
+
// Assigning to a variable?
Expr *LHS = B->getLHS()->IgnoreParens();
@@ -414,7 +414,7 @@ void TransferFunctions::VisitObjCForColl
else if ((DR = dyn_cast<DeclRefExpr>(cast<Expr>(element)->IgnoreParens()))) {
VD = cast<VarDecl>(DR->getDecl());
}
-
+
if (VD) {
val.liveDecls = LV.DSetFact.remove(val.liveDecls, VD);
if (observer && DR)
@@ -444,12 +444,12 @@ void TransferFunctions::VisitUnaryOperat
// since a ++/-- acts as both a kill and a "use".
if (!observer)
return;
-
+
switch (UO->getOpcode()) {
default:
return;
case UO_PostInc:
- case UO_PostDec:
+ case UO_PostDec:
case UO_PreInc:
case UO_PreDec:
break;
@@ -470,11 +470,11 @@ LiveVariablesImpl::runOnBlock(const CFGB
LiveVariables::Observer *obs) {
TransferFunctions TF(*this, val, obs, block);
-
+
// Visit the terminator (if any).
if (const Stmt *term = block->getTerminator())
TF.Visit(const_cast<Stmt*>(term));
-
+
// Apply the transfer function for all Stmts in the block.
for (CFGBlock::const_reverse_iterator it = block->rbegin(),
ei = block->rend(); it != ei; ++it) {
@@ -488,7 +488,7 @@ LiveVariablesImpl::runOnBlock(const CFGB
if (!elem.getAs<CFGStmt>())
continue;
-
+
const Stmt *S = elem.castAs<CFGStmt>().getStmt();
TF.Visit(const_cast<Stmt*>(S));
stmtsToLiveness[S] = val;
@@ -499,10 +499,10 @@ LiveVariablesImpl::runOnBlock(const CFGB
void LiveVariables::runOnAllBlocks(LiveVariables::Observer &obs) {
const CFG *cfg = getImpl(impl).analysisContext.getCFG();
for (CFG::const_iterator it = cfg->begin(), ei = cfg->end(); it != ei; ++it)
- getImpl(impl).runOnBlock(*it, getImpl(impl).blocksEndToLiveness[*it], &obs);
+ getImpl(impl).runOnBlock(*it, getImpl(impl).blocksEndToLiveness[*it], &obs);
}
-LiveVariables::LiveVariables(void *im) : impl(im) {}
+LiveVariables::LiveVariables(void *im) : impl(im) {}
LiveVariables::~LiveVariables() {
delete (LiveVariablesImpl*) impl;
@@ -533,7 +533,7 @@ LiveVariables::computeLiveness(AnalysisD
for (CFG::const_iterator it = cfg->begin(), ei = cfg->end(); it != ei; ++it) {
const CFGBlock *block = *it;
worklist.enqueueBlock(block);
-
+
// FIXME: Scan for DeclRefExprs using in the LHS of an assignment.
// We need to do this because we lack context in the reverse analysis
// to determine if a DeclRefExpr appears in such a context, and thus
@@ -554,35 +554,35 @@ LiveVariables::computeLiveness(AnalysisD
}
}
}
-
+
while (const CFGBlock *block = worklist.dequeue()) {
// Determine if the block's end value has changed. If not, we
// have nothing left to do for this block.
LivenessValues &prevVal = LV->blocksEndToLiveness[block];
-
+
// Merge the values of all successor blocks.
LivenessValues val;
for (CFGBlock::const_succ_iterator it = block->succ_begin(),
ei = block->succ_end(); it != ei; ++it) {
- if (const CFGBlock *succ = *it) {
+ if (const CFGBlock *succ = *it) {
val = LV->merge(val, LV->blocksBeginToLiveness[succ]);
}
}
-
+
if (!everAnalyzedBlock[block->getBlockID()])
everAnalyzedBlock[block->getBlockID()] = true;
else if (prevVal.equals(val))
continue;
prevVal = val;
-
+
// Update the dataflow value for the start of this block.
LV->blocksBeginToLiveness[block] = LV->runOnBlock(block, val);
-
+
// Enqueue the value to the predecessors.
worklist.enqueuePredecessors(block);
}
-
+
return new LiveVariables(LV);
}
@@ -595,7 +595,7 @@ void LiveVariablesImpl::dumpBlockLivenes
for (llvm::DenseMap<const CFGBlock *, LiveVariables::LivenessValues>::iterator
it = blocksEndToLiveness.begin(), ei = blocksEndToLiveness.end();
it != ei; ++it) {
- vec.push_back(it->first);
+ vec.push_back(it->first);
}
llvm::sort(vec.begin(), vec.end(), [](const CFGBlock *A, const CFGBlock *B) {
return A->getBlockID() < B->getBlockID();
@@ -607,14 +607,14 @@ void LiveVariablesImpl::dumpBlockLivenes
it = vec.begin(), ei = vec.end(); it != ei; ++it) {
llvm::errs() << "\n[ B" << (*it)->getBlockID()
<< " (live variables at block exit) ]\n";
-
+
LiveVariables::LivenessValues vals = blocksEndToLiveness[*it];
declVec.clear();
-
+
for (llvm::ImmutableSet<const VarDecl *>::iterator si =
vals.liveDecls.begin(),
se = vals.liveDecls.end(); si != se; ++si) {
- declVec.push_back(*si);
+ declVec.push_back(*si);
}
llvm::sort(declVec.begin(), declVec.end(),
@@ -630,7 +630,7 @@ void LiveVariablesImpl::dumpBlockLivenes
llvm::errs() << ">\n";
}
}
- llvm::errs() << "\n";
+ llvm::errs() << "\n";
}
const void *LiveVariables::getTag() { static int x; return &x; }
Modified: cfe/trunk/lib/Analysis/ObjCNoReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ObjCNoReturn.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ObjCNoReturn.cpp (original)
+++ cfe/trunk/lib/Analysis/ObjCNoReturn.cpp Mon Jul 30 12:24:48 2018
@@ -32,13 +32,13 @@ ObjCNoReturn::ObjCNoReturn(ASTContext &C
{
// Generate selectors.
SmallVector<IdentifierInfo*, 3> II;
-
+
// raise:format:
II.push_back(&C.Idents.get("raise"));
II.push_back(&C.Idents.get("format"));
NSExceptionInstanceRaiseSelectors[0] =
C.Selectors.getSelector(II.size(), &II[0]);
-
+
// raise:format:arguments:
II.push_back(&C.Idents.get("arguments"));
NSExceptionInstanceRaiseSelectors[1] =
@@ -48,7 +48,7 @@ ObjCNoReturn::ObjCNoReturn(ASTContext &C
bool ObjCNoReturn::isImplicitNoReturn(const ObjCMessageExpr *ME) {
Selector S = ME->getSelector();
-
+
if (ME->isInstanceMessage()) {
// Check for the "raise" message.
return S == RaiseSel;
@@ -62,6 +62,6 @@ bool ObjCNoReturn::isImplicitNoReturn(co
}
}
}
-
+
return false;
}
Modified: cfe/trunk/lib/Analysis/PostOrderCFGView.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PostOrderCFGView.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PostOrderCFGView.cpp (original)
+++ cfe/trunk/lib/Analysis/PostOrderCFGView.cpp Mon Jul 30 12:24:48 2018
@@ -22,11 +22,11 @@ void PostOrderCFGView::anchor() {}
PostOrderCFGView::PostOrderCFGView(const CFG *cfg) {
Blocks.reserve(cfg->getNumBlockIDs());
CFGBlockSet BSet(cfg);
-
+
for (po_iterator I = po_iterator::begin(cfg, BSet),
E = po_iterator::end(cfg, BSet); I != E; ++I) {
BlockOrder[*I] = Blocks.size() + 1;
- Blocks.push_back(*I);
+ Blocks.push_back(*I);
}
}
@@ -43,7 +43,7 @@ bool PostOrderCFGView::BlockOrderCompare
const CFGBlock *b2) const {
PostOrderCFGView::BlockOrderTy::const_iterator b1It = POV.BlockOrder.find(b1);
PostOrderCFGView::BlockOrderTy::const_iterator b2It = POV.BlockOrder.find(b2);
-
+
unsigned b1V = (b1It == POV.BlockOrder.end()) ? 0 : b1It->second;
unsigned b2V = (b2It == POV.BlockOrder.end()) ? 0 : b2It->second;
return b1V > b2V;
Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Mon Jul 30 12:24:48 2018
@@ -348,7 +348,7 @@ static PrintfSpecifierResult ParsePrintf
if (Target.getTriple().isOSMSVCRT())
k = ConversionSpecifier::ZArg;
}
-
+
// Check to see if we used the Objective-C modifier flags with
// a conversion specifier other than '@'.
if (k != ConversionSpecifier::ObjCObjArg &&
@@ -416,9 +416,9 @@ bool clang::analyze_format_string::Parse
const char *E,
const LangOptions &LO,
const TargetInfo &Target) {
-
+
unsigned argIndex = 0;
-
+
// Keep looking for a %s format specifier until we have exhausted the string.
FormatStringHandler H;
while (I != E) {
Modified: cfe/trunk/lib/Analysis/ProgramPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ProgramPoint.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ProgramPoint.cpp (original)
+++ cfe/trunk/lib/Analysis/ProgramPoint.cpp Mon Jul 30 12:24:48 2018
@@ -43,7 +43,7 @@ ProgramPoint ProgramPoint::getProgramPoi
}
}
-SimpleProgramPointTag::SimpleProgramPointTag(StringRef MsgProvider,
+SimpleProgramPointTag::SimpleProgramPointTag(StringRef MsgProvider,
StringRef Msg)
: Desc((MsgProvider + " : " + Msg).str()) {}
Modified: cfe/trunk/lib/Analysis/ReachableCode.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ReachableCode.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ReachableCode.cpp (original)
+++ cfe/trunk/lib/Analysis/ReachableCode.cpp Mon Jul 30 12:24:48 2018
@@ -201,7 +201,7 @@ static bool isConfigurationValue(const S
// Special case looking for the sigil '()' around an integer literal.
if (const ParenExpr *PE = dyn_cast<ParenExpr>(S))
if (!PE->getLocStart().isMacroID())
- return isConfigurationValue(PE->getSubExpr(), PP, SilenceableCondVal,
+ return isConfigurationValue(PE->getSubExpr(), PP, SilenceableCondVal,
IncludeIntegers, true);
if (const Expr *Ex = dyn_cast<Expr>(S))
@@ -310,19 +310,19 @@ static unsigned scanFromBlock(const CFGB
Preprocessor *PP,
bool IncludeSometimesUnreachableEdges) {
unsigned count = 0;
-
+
// Prep work queue
SmallVector<const CFGBlock*, 32> WL;
-
+
// The entry block may have already been marked reachable
// by the caller.
if (!Reachable[Start->getBlockID()]) {
++count;
Reachable[Start->getBlockID()] = true;
}
-
+
WL.push_back(Start);
-
+
// Find the reachable blocks from 'Start'.
while (!WL.empty()) {
const CFGBlock *item = WL.pop_back_val();
@@ -337,7 +337,7 @@ static unsigned scanFromBlock(const CFGB
if (!IncludeSometimesUnreachableEdges)
TreatAllSuccessorsAsReachable = false;
- for (CFGBlock::const_succ_iterator I = item->succ_begin(),
+ for (CFGBlock::const_succ_iterator I = item->succ_begin(),
E = item->succ_end(); I != E; ++I) {
const CFGBlock *B = *I;
if (!B) do {
@@ -644,7 +644,7 @@ void DeadCodeScan::reportDeadCode(const
Loc, SourceRange(), SourceRange(Loc, Loc), R2);
return;
}
-
+
// Check if the dead block has a predecessor whose branch has
// a configuration value that *could* be modified to
// silence the warning.
@@ -690,7 +690,7 @@ void FindUnreachableCode(AnalysisDeclCon
scanMaybeReachableFromBlock(&cfg->getEntry(), PP, reachable);
if (numReachable == cfg->getNumBlockIDs())
return;
-
+
// If there aren't explicit EH edges, we should include the 'try' dispatch
// blocks as roots.
if (!AC.getCFGBuildOptions().AddEHEdges) {
@@ -703,16 +703,16 @@ void FindUnreachableCode(AnalysisDeclCon
}
// There are some unreachable blocks. We need to find the root blocks that
- // contain code that should be considered unreachable.
+ // contain code that should be considered unreachable.
for (CFG::iterator I = cfg->begin(), E = cfg->end(); I != E; ++I) {
const CFGBlock *block = *I;
// A block may have been marked reachable during this loop.
if (reachable[block->getBlockID()])
continue;
-
+
DeadCodeScan DS(reachable, PP, AC.getASTContext());
numReachable += DS.scanBackwards(block, CB);
-
+
if (numReachable == cfg->getNumBlockIDs())
return;
}
Modified: cfe/trunk/lib/Analysis/ScanfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ScanfFormatString.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ScanfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/ScanfFormatString.cpp Mon Jul 30 12:24:48 2018
@@ -41,7 +41,7 @@ static bool ParseScanList(FormatStringHa
H.HandleIncompleteScanList(start, I);
return true;
}
-
+
// Special case: ']' is the first character.
if (*I == ']') {
if (++I == E) {
@@ -65,7 +65,7 @@ static bool ParseScanList(FormatStringHa
H.HandleIncompleteScanList(start, I - 1);
return true;
}
- }
+ }
CS.setEndScanList(I);
return false;
@@ -98,17 +98,17 @@ static ScanfSpecifierResult ParseScanfSp
break;
}
}
-
+
// No format specifier found?
if (!Start)
return false;
-
+
if (I == E) {
// No more characters left?
H.HandleIncompleteSpecifier(Start, E - Start);
return true;
}
-
+
ScanfSpecifier FS;
if (ParseArgPosition(H, FS, Start, I, E))
return true;
@@ -118,7 +118,7 @@ static ScanfSpecifierResult ParseScanfSp
H.HandleIncompleteSpecifier(Start, E - Start);
return true;
}
-
+
// Look for '*' flag if it is present.
if (*I == '*') {
FS.setSuppressAssignment(I);
@@ -127,7 +127,7 @@ static ScanfSpecifierResult ParseScanfSp
return true;
}
}
-
+
// Look for the field width (if any). Unlike printf, this is either
// a fixed integer or isn't present.
const OptionalAmount &Amt = clang::analyze_format_string::ParseAmount(I, E);
@@ -141,20 +141,20 @@ static ScanfSpecifierResult ParseScanfSp
return true;
}
}
-
+
// Look for the length modifier.
if (ParseLengthModifier(FS, I, E, LO, /*scanf=*/true) && I == E) {
// No more characters left?
H.HandleIncompleteSpecifier(Start, E - Start);
return true;
}
-
+
// Detect spurious null characters, which are likely errors.
if (*I == '\0') {
H.HandleNullChar(I);
return true;
}
-
+
// Finally, look for the conversion specifier.
const char *conversionPosition = I++;
ScanfConversionSpecifier::Kind k = ScanfConversionSpecifier::InvalidSpecifier;
@@ -207,7 +207,7 @@ static ScanfSpecifierResult ParseScanfSp
if (CS.consumesDataArgument() && !FS.getSuppressAssignment()
&& !FS.usesPositionalArg())
FS.setArgIndex(argIndex++);
-
+
// FIXME: '%' and '*' doesn't make sense. Issue a warning.
// FIXME: 'ConsumedSoFar' and '*' doesn't make sense.
@@ -537,9 +537,9 @@ bool clang::analyze_format_string::Parse
const char *E,
const LangOptions &LO,
const TargetInfo &Target) {
-
+
unsigned argIndex = 0;
-
+
// Keep looking for a format specifier until we have exhausted the string.
while (I != E) {
const ScanfSpecifierResult &FSR = ParseScanfSpecifier(H, I, E, argIndex,
Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Mon Jul 30 12:24:48 2018
@@ -62,13 +62,13 @@ class DeclToIndex {
public:
DeclToIndex() = default;
-
+
/// Compute the actual mapping from declarations to bits.
void computeMap(const DeclContext &dc);
-
+
/// Return the number of declarations in the map.
unsigned size() const { return map.size(); }
-
+
/// Returns the bit vector index for a given declaration.
Optional<unsigned> getValueIndex(const VarDecl *d) const;
};
@@ -126,8 +126,8 @@ public:
CFGBlockValues(const CFG &cfg);
unsigned getNumEntries() const { return declToIndex.size(); }
-
- void computeSetOfDeclarations(const DeclContext &dc);
+
+ void computeSetOfDeclarations(const DeclContext &dc);
ValueVector &getValueVector(const CFGBlock *block) {
return vals[block->getBlockID()];
@@ -136,13 +136,13 @@ public:
void setAllScratchValues(Value V);
void mergeIntoScratch(ValueVector const &source, bool isFirst);
bool updateValueVectorWithScratch(const CFGBlock *block);
-
+
bool hasNoDeclarations() const {
return declToIndex.size() == 0;
}
void resetScratch();
-
+
ValueVector::reference operator[](const VarDecl *vd);
Value getValue(const CFGBlock *block, const CFGBlock *dstBlock,
@@ -151,7 +151,7 @@ public:
assert(idx.hasValue());
return getValueVector(block)[idx.getValue()];
}
-};
+};
} // namespace
@@ -235,7 +235,7 @@ public:
++PO_I;
}
}
-
+
void enqueueSuccessors(const CFGBlock *block);
const CFGBlock *dequeue();
};
@@ -614,7 +614,7 @@ public:
const CFGBlock *Pred = *I;
if (!Pred)
continue;
-
+
Value AtPredExit = vals.getValue(Pred, B, vd);
if (AtPredExit == Initialized)
// This block initializes the variable.
@@ -923,7 +923,7 @@ void clang::runUninitializedVariablesAna
classification, wasAnalyzed, PBH);
++stats.NumBlockVisits;
if (changed || !previouslyVisited[block->getBlockID()])
- worklist.enqueueSuccessors(block);
+ worklist.enqueueSuccessors(block);
previouslyVisited[block->getBlockID()] = true;
}
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Mon Jul 30 12:24:48 2018
@@ -116,12 +116,12 @@ void DiagnosticsEngine::Reset() {
UncompilableErrorOccurred = false;
FatalErrorOccurred = false;
UnrecoverableErrorOccurred = false;
-
+
NumWarnings = 0;
NumErrors = 0;
TrapNumErrorsOccurred = 0;
TrapNumUnrecoverableErrorsOccurred = 0;
-
+
CurDiagID = std::numeric_limits<unsigned>::max();
LastDiagLevel = DiagnosticIDs::Ignored;
DelayedDiagID = 0;
@@ -759,7 +759,7 @@ FormatDiagnostic(SmallVectorImpl<char> &
return;
}
- StringRef Diag =
+ StringRef Diag =
getDiags()->getDiagnosticIDs()->getDescription(getID());
FormatDiagnostic(Diag.begin(), Diag.end(), OutStr);
@@ -880,7 +880,7 @@ FormatDiagnostic(const char *DiagStr, co
continue;
}
}
-
+
switch (Kind) {
// ---- STRINGS ----
case DiagnosticsEngine::ak_std_string: {
@@ -1056,7 +1056,7 @@ FormatDiagnostic(const char *DiagStr, co
break;
}
}
-
+
// Remember this argument info for subsequent formatting operations. Turn
// std::strings into a null terminated string to make it be the same case as
// all the other ones.
@@ -1077,7 +1077,7 @@ StoredDiagnostic::StoredDiagnostic(Diagn
StringRef Message)
: ID(ID), Level(Level), Message(Message) {}
-StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level,
+StoredDiagnostic::StoredDiagnostic(DiagnosticsEngine::Level Level,
const Diagnostic &Info)
: ID(Info.getID()), Level(Level) {
assert((Info.getLocation().isInvalid() || Info.hasSourceManager()) &&
Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Mon Jul 30 12:24:48 2018
@@ -685,7 +685,7 @@ bool DiagnosticIDs::ProcessDiag(Diagnost
++Diag.NumErrors;
}
- // If we've emitted a lot of errors, emit a fatal error instead of it to
+ // If we've emitted a lot of errors, emit a fatal error instead of it to
// stop a flood of bogus errors.
if (Diag.ErrorLimit && Diag.NumErrors > Diag.ErrorLimit &&
DiagLevel == DiagnosticIDs::Error) {
Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Mon Jul 30 12:24:48 2018
@@ -71,7 +71,7 @@ void FileManager::addStatCache(std::uniq
StatCache = std::move(statCache);
return;
}
-
+
FileSystemStatCache *LastCache = StatCache.get();
while (LastCache->getNextStatCache())
LastCache = LastCache->getNextStatCache();
@@ -82,18 +82,18 @@ void FileManager::addStatCache(std::uniq
void FileManager::removeStatCache(FileSystemStatCache *statCache) {
if (!statCache)
return;
-
+
if (StatCache.get() == statCache) {
// This is the first stat cache.
StatCache = StatCache->takeNextStatCache();
return;
}
-
+
// Find the stat cache in the list.
FileSystemStatCache *PrevCache = StatCache.get();
while (PrevCache && PrevCache->getNextStatCache() != statCache)
PrevCache = PrevCache->getNextStatCache();
-
+
assert(PrevCache && "Stat cache not found for removal");
PrevCache->setNextStatCache(statCache->takeNextStatCache());
}
@@ -247,7 +247,7 @@ const FileEntry *FileManager::getFile(St
return nullptr;
}
-
+
// FIXME: Use the directory info to prune this, before doing the stat syscall.
// FIXME: This will reduce the # syscalls.
@@ -394,7 +394,7 @@ FileManager::getVirtualFile(StringRef Fi
bool FileManager::FixupRelativePath(SmallVectorImpl<char> &path) const {
StringRef pathRef(path.data(), path.size());
- if (FileSystemOpts.WorkingDir.empty()
+ if (FileSystemOpts.WorkingDir.empty()
|| llvm::sys::path::is_absolute(pathRef))
return false;
@@ -505,14 +505,14 @@ void FileManager::GetUniqueIDMapping(
SmallVectorImpl<const FileEntry *> &UIDToFiles) const {
UIDToFiles.clear();
UIDToFiles.resize(NextFileUID);
-
+
// Map file entries
for (llvm::StringMap<FileEntry*, llvm::BumpPtrAllocator>::const_iterator
FE = SeenFileEntries.begin(), FEEnd = SeenFileEntries.end();
FE != FEEnd; ++FE)
if (FE->getValue() && FE->getValue() != NON_EXISTENT_FILE)
UIDToFiles[FE->getValue()->getUID()] = FE->getValue();
-
+
// Map virtual file entries
for (const auto &VFE : VirtualFileEntries)
if (VFE && VFE.get() != NON_EXISTENT_FILE)
Modified: cfe/trunk/lib/Basic/FileSystemStatCache.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileSystemStatCache.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileSystemStatCache.cpp (original)
+++ cfe/trunk/lib/Basic/FileSystemStatCache.cpp Mon Jul 30 12:24:48 2018
@@ -95,17 +95,17 @@ bool FileSystemStatCache::get(StringRef
// If the path doesn't exist, return failure.
if (R == CacheMissing) return true;
-
+
// If the path exists, make sure that its "directoryness" matches the clients
// demands.
if (Data.IsDirectory != isForDir) {
// If not, close the file if opened.
if (F)
*F = nullptr;
-
+
return true;
}
-
+
return false;
}
@@ -120,7 +120,7 @@ MemorizeStatCalls::getStat(StringRef Pat
// entries).
if (Result == CacheMissing)
return Result;
-
+
// Cache file 'stat' results and directories with absolutely paths.
if (!Data.IsDirectory || llvm::sys::path::is_absolute(Path))
StatCalls[Path] = Data;
Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Mon Jul 30 12:24:48 2018
@@ -319,7 +319,7 @@ tok::PPKeywordKind IdentifierInfo::getPP
CASE( 6, 'i', 'n', ifndef);
CASE( 6, 'i', 'p', import);
CASE( 6, 'p', 'a', pragma);
-
+
CASE( 7, 'd', 'f', defined);
CASE( 7, 'i', 'c', include);
CASE( 7, 'w', 'r', warning);
@@ -328,7 +328,7 @@ tok::PPKeywordKind IdentifierInfo::getPP
CASE(12, 'i', 'c', include_next);
CASE(14, '_', 'p', __public_macro);
-
+
CASE(15, '_', 'p', __private_macro);
CASE(16, '_', 'i', __include_macros);
@@ -566,9 +566,9 @@ ObjCMethodFamily Selector::getMethodFami
ObjCInstanceTypeFamily Selector::getInstTypeMethodFamily(Selector sel) {
IdentifierInfo *first = sel.getIdentifierInfoForSlot(0);
if (!first) return OIT_None;
-
+
StringRef name = first->getName();
-
+
if (name.empty()) return OIT_None;
switch (name.front()) {
case 'a':
@@ -593,22 +593,22 @@ ObjCInstanceTypeFamily Selector::getInst
ObjCStringFormatFamily Selector::getStringFormatFamilyImpl(Selector sel) {
IdentifierInfo *first = sel.getIdentifierInfoForSlot(0);
if (!first) return SFF_None;
-
+
StringRef name = first->getName();
-
+
switch (name.front()) {
case 'a':
if (name == "appendFormat") return SFF_NSString;
break;
-
+
case 'i':
if (name == "initWithFormat") return SFF_NSString;
break;
-
+
case 'l':
if (name == "localizedStringWithFormat") return SFF_NSString;
break;
-
+
case 's':
if (name == "stringByAppendingFormat" ||
name == "stringWithFormat") return SFF_NSString;
Modified: cfe/trunk/lib/Basic/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Module.cpp (original)
+++ cfe/trunk/lib/Basic/Module.cpp Mon Jul 30 12:24:48 2018
@@ -58,7 +58,7 @@ Module::Module(StringRef Name, SourceLoc
if (Parent->ModuleMapIsPrivate)
ModuleMapIsPrivate = true;
IsMissingRequirement = Parent->IsMissingRequirement;
-
+
Parent->SubModuleIndex[Name] = Parent->SubModules.size();
Parent->SubModules.push_back(this);
}
@@ -134,10 +134,10 @@ bool Module::isSubModuleOf(const Module
do {
if (This == Other)
return true;
-
+
This = This->Parent;
} while (This);
-
+
return false;
}
@@ -145,7 +145,7 @@ const Module *Module::getTopLevelModule(
const Module *Result = this;
while (Result->Parent)
Result = Result->Parent;
-
+
return Result;
}
@@ -181,16 +181,16 @@ static void printModuleId(raw_ostream &O
std::string Module::getFullModuleName(bool AllowStringLiterals) const {
SmallVector<StringRef, 2> Names;
-
+
// Build up the set of module names (from innermost to outermost).
for (const Module *M = this; M; M = M->Parent)
Names.push_back(M->Name);
-
+
std::string Result;
llvm::raw_string_ostream Out(Result);
printModuleId(Out, Names.rbegin(), Names.rend(), AllowStringLiterals);
- Out.flush();
+ Out.flush();
return Result;
}
@@ -207,7 +207,7 @@ bool Module::fullModuleNameIs(ArrayRef<S
Module::DirectoryName Module::getUmbrellaDir() const {
if (Header U = getUmbrellaHeader())
return {"", U.Entry->getDir()};
-
+
return {UmbrellaAsWritten, Umbrella.dyn_cast<const DirectoryEntry *>()};
}
@@ -388,7 +388,7 @@ void Module::print(raw_ostream &OS, unsi
}
OS << " {\n";
-
+
if (!Requirements.empty()) {
OS.indent(Indent + 2);
OS << "requires ";
@@ -401,7 +401,7 @@ void Module::print(raw_ostream &OS, unsi
}
OS << "\n";
}
-
+
if (Header H = getUmbrellaHeader()) {
OS.indent(Indent + 2);
OS << "umbrella header \"";
@@ -411,7 +411,7 @@ void Module::print(raw_ostream &OS, unsi
OS.indent(Indent + 2);
OS << "umbrella \"";
OS.write_escaped(D.NameAsWritten);
- OS << "\"\n";
+ OS << "\"\n";
}
if (!ConfigMacros.empty() || ConfigMacrosExhaustive) {
@@ -468,7 +468,7 @@ void Module::print(raw_ostream &OS, unsi
OS.indent(Indent + 2);
OS << "export_as" << ExportAsModule << "\n";
}
-
+
for (submodule_const_iterator MI = submodule_begin(), MIEnd = submodule_end();
MI != MIEnd; ++MI)
// Print inferred subframework modules so that we don't need to re-infer
@@ -477,7 +477,7 @@ void Module::print(raw_ostream &OS, unsi
// those header files anyway.
if (!(*MI)->IsInferred || (*MI)->IsFramework)
(*MI)->print(OS, Indent + 2);
-
+
for (unsigned I = 0, N = Exports.size(); I != N; ++I) {
OS.indent(Indent + 2);
OS << "export ";
@@ -554,7 +554,7 @@ void Module::print(raw_ostream &OS, unsi
OS.indent(Indent + 2);
OS << "}\n";
}
-
+
OS.indent(Indent);
OS << "}\n";
}
Modified: cfe/trunk/lib/Basic/ObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/ObjCRuntime.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/ObjCRuntime.cpp (original)
+++ cfe/trunk/lib/Basic/ObjCRuntime.cpp Mon Jul 30 12:24:48 2018
@@ -27,7 +27,7 @@ std::string ObjCRuntime::getAsString() c
llvm::raw_string_ostream Out(Result);
Out << *this;
}
- return Result;
+ return Result;
}
raw_ostream &clang::operator<<(raw_ostream &out, const ObjCRuntime &value) {
Modified: cfe/trunk/lib/Basic/SourceLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceLocation.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceLocation.cpp (original)
+++ cfe/trunk/lib/Basic/SourceLocation.cpp Mon Jul 30 12:24:48 2018
@@ -49,7 +49,7 @@ void SourceLocation::print(raw_ostream &
if (isFileID()) {
PresumedLoc PLoc = SM.getPresumedLoc(*this);
-
+
if (PLoc.isInvalid()) {
OS << "<invalid>";
return;
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Jul 30 12:24:48 2018
@@ -105,9 +105,9 @@ llvm::MemoryBuffer *ContentCache::getBuf
if (Buffer.getPointer() || !ContentsEntry) {
if (Invalid)
*Invalid = isBufferInvalid();
-
+
return Buffer.getPointer();
- }
+ }
bool isVolatile = SM.userFilesAreVolatile() && !IsSystemFile;
auto BufferOrError =
@@ -141,7 +141,7 @@ llvm::MemoryBuffer *ContentCache::getBuf
<< ContentsEntry->getName() << BufferOrError.getError().message();
Buffer.setInt(Buffer.getInt() | InvalidFlag);
-
+
if (Invalid) *Invalid = true;
return Buffer.getPointer();
}
@@ -187,10 +187,10 @@ llvm::MemoryBuffer *ContentCache::getBuf
<< InvalidBOM << ContentsEntry->getName();
Buffer.setInt(Buffer.getInt() | InvalidFlag);
}
-
+
if (Invalid)
*Invalid = isBufferInvalid();
-
+
return Buffer.getPointer();
}
@@ -672,7 +672,7 @@ StringRef SourceManager::getBufferData(F
bool MyInvalid = false;
const SLocEntry &SLoc = getSLocEntry(FID, &MyInvalid);
if (!SLoc.isFile() || MyInvalid) {
- if (Invalid)
+ if (Invalid)
*Invalid = true;
return "<<<<<INVALID SOURCE LOCATION>>>>>";
}
@@ -684,7 +684,7 @@ StringRef SourceManager::getBufferData(F
if (MyInvalid)
return "<<<<<INVALID SOURCE LOCATION>>>>>";
-
+
return Buf->getBuffer();
}
@@ -770,7 +770,7 @@ FileID SourceManager::getFileIDLocal(uns
unsigned MidOffset = getLocalSLocEntry(MiddleIndex, &Invalid).getOffset();
if (Invalid)
return FileID::get(0);
-
+
++NumProbes;
// If the offset of the midpoint is too large, chop the high side of the
@@ -1104,7 +1104,7 @@ const char *SourceManager::getCharacterD
if (CharDataInvalid || !Entry.isFile()) {
if (Invalid)
*Invalid = true;
-
+
return "<<<<INVALID BUFFER>>>>";
}
llvm::MemoryBuffer *Buffer = Entry.getFile().getContentCache()->getBuffer(
@@ -1289,7 +1289,7 @@ FoundSpecialChar:
/// for the position indicated. This requires building and caching a table of
/// line offsets for the MemoryBuffer, so this is not cheap: use only when
/// about to emit a diagnostic.
-unsigned SourceManager::getLineNumber(FileID FID, unsigned FilePos,
+unsigned SourceManager::getLineNumber(FileID FID, unsigned FilePos,
bool *Invalid) const {
if (FID.isInvalid()) {
if (Invalid)
@@ -1308,10 +1308,10 @@ unsigned SourceManager::getLineNumber(Fi
*Invalid = true;
return 1;
}
-
+
Content = const_cast<ContentCache*>(Entry.getFile().getContentCache());
}
-
+
// If this is the first use of line information for this buffer, compute the
/// SourceLineCache for it on demand.
if (!Content->SourceLineCache) {
@@ -1383,7 +1383,7 @@ unsigned SourceManager::getLineNumber(Fi
return LineNo;
}
-unsigned SourceManager::getSpellingLineNumber(SourceLocation Loc,
+unsigned SourceManager::getSpellingLineNumber(SourceLocation Loc,
bool *Invalid) const {
if (isInvalid(Loc, Invalid)) return 0;
std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc);
@@ -1418,7 +1418,7 @@ SourceManager::getFileCharacteristic(Sou
const SLocEntry &SEntry = getSLocEntry(LocInfo.first, &Invalid);
if (Invalid || !SEntry.isFile())
return C_User;
-
+
const SrcMgr::FileInfo &FI = SEntry.getFile();
// If there are no #line directives in this file, just return the whole-file
@@ -1466,7 +1466,7 @@ PresumedLoc SourceManager::getPresumedLo
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
if (Invalid || !Entry.isFile())
return PresumedLoc();
-
+
const SrcMgr::FileInfo &FI = Entry.getFile();
const SrcMgr::ContentCache *C = FI.getContentCache();
@@ -1485,7 +1485,7 @@ PresumedLoc SourceManager::getPresumedLo
unsigned ColNo = getColumnNumber(LocInfo.first, LocInfo.second, &Invalid);
if (Invalid)
return PresumedLoc();
-
+
SourceLocation IncludeLoc = FI.getIncludeLoc();
// If we have #line directives in this file, update and overwrite the physical
@@ -1621,7 +1621,7 @@ FileID SourceManager::translateFile(cons
const SLocEntry &MainSLoc = getSLocEntry(MainFileID, &Invalid);
if (Invalid)
return FileID();
-
+
if (MainSLoc.isFile()) {
const ContentCache *MainContentCache
= MainSLoc.getFile().getContentCache();
@@ -1658,8 +1658,8 @@ FileID SourceManager::translateFile(cons
const SLocEntry &SLoc = getLocalSLocEntry(I, &Invalid);
if (Invalid)
return FileID();
-
- if (SLoc.isFile() &&
+
+ if (SLoc.isFile() &&
SLoc.getFile().getContentCache() &&
SLoc.getFile().getContentCache()->OrigEntry == SourceFile) {
FirstFID = FileID::get(I);
@@ -1670,7 +1670,7 @@ FileID SourceManager::translateFile(cons
if (FirstFID.isInvalid()) {
for (unsigned I = 0, N = loaded_sloc_entry_size(); I != N; ++I) {
const SLocEntry &SLoc = getLoadedSLocEntry(I);
- if (SLoc.isFile() &&
+ if (SLoc.isFile() &&
SLoc.getFile().getContentCache() &&
SLoc.getFile().getContentCache()->OrigEntry == SourceFile) {
FirstFID = FileID::get(-int(I) - 2);
@@ -1681,7 +1681,7 @@ FileID SourceManager::translateFile(cons
}
// If we haven't found what we want yet, try again, but this time stat()
- // each of the files in case the files have changed since we originally
+ // each of the files in case the files have changed since we originally
// parsed the file.
if (FirstFID.isInvalid() &&
(SourceFileName ||
@@ -1694,13 +1694,13 @@ FileID SourceManager::translateFile(cons
const SLocEntry &SLoc = getSLocEntry(IFileID, &Invalid);
if (Invalid)
return FileID();
-
- if (SLoc.isFile()) {
- const ContentCache *FileContentCache
+
+ if (SLoc.isFile()) {
+ const ContentCache *FileContentCache
= SLoc.getFile().getContentCache();
const FileEntry *Entry = FileContentCache ? FileContentCache->OrigEntry
: nullptr;
- if (Entry &&
+ if (Entry &&
*SourceFileName == llvm::sys::path::filename(Entry->getName())) {
if (Optional<llvm::sys::fs::UniqueID> EntryUID =
getActualFileUID(Entry)) {
@@ -1712,9 +1712,9 @@ FileID SourceManager::translateFile(cons
}
}
}
- }
+ }
}
-
+
(void) SourceFile;
return FirstFID;
}
@@ -1948,7 +1948,7 @@ SourceManager::getMacroArgExpandedLocati
assert(!MacroArgsCache->empty());
MacroArgsMap::iterator I = MacroArgsCache->upper_bound(Offset);
--I;
-
+
unsigned MacroArgBeginOffs = I->first;
SourceLocation MacroArgExpandedLoc = I->second;
if (MacroArgExpandedLoc.isValid())
@@ -2151,7 +2151,7 @@ void SourceManager::PrintStats() const {
<< " loaded SLocEntries allocated, "
<< MaxLoadedOffset - CurrentLoadedOffset
<< "B of Sloc address space used.\n";
-
+
unsigned NumLineNumsComputed = 0;
unsigned NumFileBytesMapped = 0;
for (fileinfo_iterator I = fileinfo_begin(), E = fileinfo_end(); I != E; ++I){
@@ -2231,7 +2231,7 @@ ExternalSLocEntrySource::~ExternalSLocEn
SourceManager::MemoryBufferSizes SourceManager::getMemoryBufferSizes() const {
size_t malloc_bytes = 0;
size_t mmap_bytes = 0;
-
+
for (unsigned i = 0, e = MemBufferInfos.size(); i != e; ++i)
if (size_t sized_mapped = MemBufferInfos[i]->getSizeBytesMapped())
switch (MemBufferInfos[i]->getMemoryBufferKind()) {
@@ -2242,7 +2242,7 @@ SourceManager::MemoryBufferSizes SourceM
malloc_bytes += sized_mapped;
break;
}
-
+
return MemoryBufferSizes(malloc_bytes, mmap_bytes);
}
@@ -2252,7 +2252,7 @@ size_t SourceManager::getDataStructureSi
+ llvm::capacity_in_bytes(LoadedSLocEntryTable)
+ llvm::capacity_in_bytes(SLocEntryLoaded)
+ llvm::capacity_in_bytes(FileInfos);
-
+
if (OverriddenFilesInfo)
size += llvm::capacity_in_bytes(OverriddenFilesInfo->OverriddenFiles);
Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Mon Jul 30 12:24:48 2018
@@ -1757,7 +1757,7 @@ void X86TargetInfo::fillValidCPUList(Sma
#define PROC(ENUM, STRING, IS64BIT) \
if (IS64BIT || getTriple().getArch() == llvm::Triple::x86) \
Values.emplace_back(STRING);
- // Go through CPUKind checking to ensure that the alias is de-aliased and
+ // Go through CPUKind checking to ensure that the alias is de-aliased and
// 64 bit-ness is checked.
#define PROC_ALIAS(ENUM, ALIAS) \
if (checkCPUKind(getCPUKind(ALIAS))) \
Modified: cfe/trunk/lib/Basic/Targets/X86.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/X86.h (original)
+++ cfe/trunk/lib/Basic/Targets/X86.h Mon Jul 30 12:24:48 2018
@@ -132,7 +132,7 @@ public:
: TargetInfo(Triple) {
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended();
}
-
+
unsigned getFloatEvalMethod() const override {
// X87 evaluates with 80 bits "long double" precision.
return SSELevel == NoSSE ? 2 : 0;
@@ -238,7 +238,7 @@ public:
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override;
-
+
static void setSSELevel(llvm::StringMap<bool> &Features, X86SSEEnum Level,
bool Enabled);
@@ -577,7 +577,7 @@ public:
IntPtrType = SignedLong;
PtrDiffType = SignedLong;
}
-
+
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override {
X86_32TargetInfo::getTargetDefines(Opts, Builder);
@@ -664,7 +664,7 @@ public:
bool hasInt128Type() const override { return true; }
unsigned getUnwindWordWidth() const override { return 64; }
-
+
unsigned getRegisterWidth() const override { return 64; }
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize,
Modified: cfe/trunk/lib/Basic/Warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Warnings.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Warnings.cpp (original)
+++ cfe/trunk/lib/Basic/Warnings.cpp Mon Jul 30 12:24:48 2018
@@ -51,7 +51,7 @@ void clang::ProcessWarningOptions(Diagno
Diags.setElideType(Opts.ElideType);
Diags.setPrintTemplateTree(Opts.ShowTemplateTree);
Diags.setShowColors(Opts.ShowColors);
-
+
// Handle -ferror-limit
if (Opts.ErrorLimit)
Diags.setErrorLimit(Opts.ErrorLimit);
@@ -75,7 +75,7 @@ void clang::ProcessWarningOptions(Diagno
Diags.getDiagnosticIDs();
// We parse the warning options twice. The first pass sets diagnostic state,
// while the second pass reports warnings/errors. This has the effect that
- // we follow the more canonical "last option wins" paradigm when there are
+ // we follow the more canonical "last option wins" paradigm when there are
// conflicting options.
for (unsigned Report = 0, ReportEnd = 2; Report != ReportEnd; ++Report) {
bool SetDiagnostic = (Report == 0);
@@ -114,7 +114,7 @@ void clang::ProcessWarningOptions(Diagno
Diags.setSuppressSystemWarnings(!isPositive);
continue;
}
-
+
// -Weverything is a special case as well. It implicitly enables all
// warnings, including ones not explicitly in a warning group.
if (Opt == "everything") {
@@ -128,8 +128,8 @@ void clang::ProcessWarningOptions(Diagno
}
continue;
}
-
- // -Werror/-Wno-error is a special case, not controlled by the option
+
+ // -Werror/-Wno-error is a special case, not controlled by the option
// table. It also has the "specifier" form of -Werror=foo and -Werror-foo.
if (Opt.startswith("error")) {
StringRef Specifier;
@@ -142,13 +142,13 @@ void clang::ProcessWarningOptions(Diagno
}
Specifier = Opt.substr(6);
}
-
+
if (Specifier.empty()) {
if (SetDiagnostic)
Diags.setWarningsAsErrors(isPositive);
continue;
}
-
+
if (SetDiagnostic) {
// Set the warning as error flag for this specifier.
Diags.setDiagnosticGroupWarningAsError(Specifier, isPositive);
@@ -157,7 +157,7 @@ void clang::ProcessWarningOptions(Diagno
}
continue;
}
-
+
// -Wfatal-errors is yet another special case.
if (Opt.startswith("fatal-errors")) {
StringRef Specifier;
@@ -176,7 +176,7 @@ void clang::ProcessWarningOptions(Diagno
Diags.setErrorsAsFatal(isPositive);
continue;
}
-
+
if (SetDiagnostic) {
// Set the error as fatal flag for this specifier.
Diags.setDiagnosticGroupErrorAsFatal(Specifier, isPositive);
@@ -185,7 +185,7 @@ void clang::ProcessWarningOptions(Diagno
}
continue;
}
-
+
if (Report) {
if (DiagIDs->getDiagnosticsInGroup(Flavor, Opt, _Diags))
EmitUnknownDiagWarning(Diags, Flavor, isPositive ? "-W" : "-Wno-",
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon Jul 30 12:24:48 2018
@@ -85,7 +85,7 @@ static llvm::Constant *buildBlockDescrip
cast<llvm::IntegerType>(CGM.getTypes().ConvertType(C.UnsignedLongTy));
llvm::PointerType *i8p = nullptr;
if (CGM.getLangOpts().OpenCL)
- i8p =
+ i8p =
llvm::Type::getInt8PtrTy(
CGM.getLLVMContext(), C.getTargetAddressSpace(LangAS::opencl_constant));
else
@@ -117,7 +117,7 @@ static llvm::Constant *buildBlockDescrip
CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr());
elements.add(llvm::ConstantExpr::getBitCast(
CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer(), i8p));
-
+
// GC layout.
if (C.getLangOpts().ObjC1) {
if (CGM.getLangOpts().getGC() != LangOptions::NonGC)
@@ -381,7 +381,7 @@ static void computeBlockInfo(CodeGenModu
else if (C.getLangOpts().ObjC1 &&
CGM.getLangOpts().getGC() == LangOptions::NonGC)
info.HasCapturedVariableLayout = true;
-
+
// Collect the layout chunks.
SmallVector<BlockLayoutChunk, 16> layout;
layout.reserve(block->capturesCXXThis() +
@@ -487,12 +487,12 @@ static void computeBlockInfo(CodeGenModu
QualType VT = getCaptureFieldType(*CGF, CI);
CharUnits size = C.getTypeSizeInChars(VT);
CharUnits align = C.getDeclAlign(variable);
-
+
maxFieldAlign = std::max(maxFieldAlign, align);
llvm::Type *llvmType =
CGM.getTypes().ConvertTypeForMem(VT);
-
+
layout.push_back(
BlockLayoutChunk(align, size, lifetime, &CI, llvmType, VT));
}
@@ -509,11 +509,11 @@ static void computeBlockInfo(CodeGenModu
// to get reproducible results. There should probably be an
// llvm::array_pod_stable_sort.
std::stable_sort(layout.begin(), layout.end());
-
+
// Needed for blocks layout info.
info.BlockHeaderForcedGapOffset = info.BlockSize;
info.BlockHeaderForcedGapSize = CharUnits::Zero();
-
+
CharUnits &blockSize = info.BlockSize;
info.BlockAlign = std::max(maxFieldAlign, info.BlockAlign);
@@ -564,7 +564,7 @@ static void computeBlockInfo(CodeGenModu
}
assert(endAlign == getLowBit(blockSize));
-
+
// At this point, we just have to add padding if the end align still
// isn't aligned right.
if (endAlign < maxFieldAlign) {
@@ -685,7 +685,7 @@ static void enterBlockScope(CodeGenFunct
CleanupKind cleanupKind = InactiveNormalCleanup;
bool useArrayEHCleanup = CGF.needsEHCleanup(dtorKind);
- if (useArrayEHCleanup)
+ if (useArrayEHCleanup)
cleanupKind = InactiveNormalAndEHCleanup;
CGF.pushDestroy(cleanupKind, addr, VT,
@@ -1315,7 +1315,7 @@ CodeGenFunction::GenerateBlockFunction(G
CurGD = GD;
CurEHLocation = blockInfo.getBlockExpr()->getLocEnd();
-
+
BlockInfo = &blockInfo;
// Arrange for local static and local extern declarations to appear
@@ -1977,7 +1977,7 @@ public:
// variable.
llvm::Value *value = CGF.Builder.CreateLoad(srcField);
-
+
llvm::Value *null =
llvm::ConstantPointerNull::get(cast<llvm::PointerType>(value->getType()));
@@ -2149,7 +2149,7 @@ generateByrefCopyHelper(CodeGenFunction
"src-object");
generator.emitCopy(CGF, destField, srcField);
- }
+ }
CGF.FinishFunction();
@@ -2321,7 +2321,7 @@ CodeGenFunction::buildByrefHelpers(llvm:
BlockFieldFlags flags;
if (type->isBlockPointerType()) {
flags |= BLOCK_FIELD_IS_BLOCK;
- } else if (CGM.getContext().isObjCNSObjectType(type) ||
+ } else if (CGM.getContext().isObjCNSObjectType(type) ||
type->isObjCObjectPointerType()) {
flags |= BLOCK_FIELD_IS_OBJECT;
} else {
@@ -2380,24 +2380,24 @@ const BlockByrefInfo &CodeGenFunction::g
llvm::StructType *byrefType =
llvm::StructType::create(getLLVMContext(),
"struct.__block_byref_" + D->getNameAsString());
-
+
QualType Ty = D->getType();
CharUnits size;
SmallVector<llvm::Type *, 8> types;
-
+
// void *__isa;
types.push_back(Int8PtrTy);
size += getPointerSize();
-
+
// void *__forwarding;
types.push_back(llvm::PointerType::getUnqual(byrefType));
size += getPointerSize();
-
+
// int32_t __flags;
types.push_back(Int32Ty);
size += CharUnits::fromQuantity(4);
-
+
// int32_t __size;
types.push_back(Int32Ty);
size += CharUnits::fromQuantity(4);
@@ -2408,7 +2408,7 @@ const BlockByrefInfo &CodeGenFunction::g
/// void *__copy_helper;
types.push_back(Int8PtrTy);
size += getPointerSize();
-
+
/// void *__destroy_helper;
types.push_back(Int8PtrTy);
size += getPointerSize();
Modified: cfe/trunk/lib/CodeGen/CGBlocks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.h (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.h Mon Jul 30 12:24:48 2018
@@ -70,7 +70,7 @@ public:
BlockFlags() : flags(0) {}
BlockFlags(BlockLiteralFlags flag) : flags(flag) {}
BlockFlags(BlockByrefFlags flag) : flags(flag) {}
-
+
uint32_t getBitMask() const { return flags; }
bool empty() const { return flags == 0; }
@@ -208,7 +208,7 @@ public:
Capture v;
v.Data = reinterpret_cast<uintptr_t>(value);
return v;
- }
+ }
};
/// CanBeGlobal - True if the block can be global, i.e. it has
@@ -226,13 +226,13 @@ public:
/// UsesStret : True if the block uses an stret return. Mutable
/// because it gets set later in the block-creation process.
mutable bool UsesStret : 1;
-
+
/// HasCapturedVariableLayout : True if block has captured variables
/// and their layout meta-data has been generated.
bool HasCapturedVariableLayout : 1;
/// The mapping of allocated indexes within the block.
- llvm::DenseMap<const VarDecl*, Capture> Captures;
+ llvm::DenseMap<const VarDecl*, Capture> Captures;
Address LocalAddress;
llvm::StructType *StructureType;
@@ -241,7 +241,7 @@ public:
CharUnits BlockSize;
CharUnits BlockAlign;
CharUnits CXXThisOffset;
-
+
// Offset of the gap caused by block header having a smaller
// alignment than the alignment of the block descriptor. This
// is the gap offset before the first capturued field.
Modified: cfe/trunk/lib/CodeGen/CGBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuilder.h (original)
+++ cfe/trunk/lib/CodeGen/CGBuilder.h Mon Jul 30 12:24:48 2018
@@ -116,7 +116,7 @@ public:
CharUnits Align, bool IsVolatile = false) {
return CreateAlignedStore(Val, Addr, Align.getQuantity(), IsVolatile);
}
-
+
// FIXME: these "default-aligned" APIs should be removed,
// but I don't feel like fixing all the builtin code right now.
llvm::StoreInst *CreateDefaultAlignedStore(llvm::Value *Val,
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jul 30 12:24:48 2018
@@ -8848,7 +8848,7 @@ static Value *EmitX86Ternlog(CodeGenFunc
return EmitX86Select(CGF, Ops[4], Ternlog, PassThru);
}
-static Value *EmitX86SExtMask(CodeGenFunction &CGF, Value *Op,
+static Value *EmitX86SExtMask(CodeGenFunction &CGF, Value *Op,
llvm::Type *DstTy) {
unsigned NumberOfElements = DstTy->getVectorNumElements();
Value *Mask = getMaskVecValue(CGF, Op, NumberOfElements);
@@ -9970,7 +9970,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
Value *A = Builder.CreateExtractElement(Ops[0], (uint64_t)0);
Function *F = CGM.getIntrinsic(Intrinsic::sqrt, A->getType());
A = Builder.CreateCall(F, {A});
- return Builder.CreateInsertElement(Ops[0], A, (uint64_t)0);
+ return Builder.CreateInsertElement(Ops[0], A, (uint64_t)0);
}
case X86::BI__builtin_ia32_sqrtsd_round_mask:
case X86::BI__builtin_ia32_sqrtss_round_mask: {
@@ -10282,7 +10282,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
return EmitX86MaskedCompareResult(*this, Cmp, NumElts, Ops[3]);
}
default:
- return getVectorFCmpIR(Pred);
+ return getVectorFCmpIR(Pred);
}
}
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon Jul 30 12:24:48 2018
@@ -284,12 +284,12 @@ static CGCallee BuildAppleKextVirtualCal
/// indirect call to virtual functions. It makes the call through indexing
/// into the vtable.
CGCallee
-CodeGenFunction::BuildAppleKextVirtualCall(const CXXMethodDecl *MD,
+CodeGenFunction::BuildAppleKextVirtualCall(const CXXMethodDecl *MD,
NestedNameSpecifier *Qual,
llvm::Type *Ty) {
assert((Qual->getKind() == NestedNameSpecifier::TypeSpec) &&
"BuildAppleKextVirtualCall - bad Qual kind");
-
+
const Type *QTy = Qual->getAsType();
QualType T = QualType(QTy, 0);
const RecordType *RT = T->getAs<RecordType>();
Modified: cfe/trunk/lib/CodeGen/CGCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXXABI.cpp Mon Jul 30 12:24:48 2018
@@ -51,9 +51,9 @@ CGCallee CGCXXABI::EmitLoadOfMemberFunct
ErrorUnsupportedABI(CGF, "calls through member pointers");
ThisPtrForCall = This.getPointer();
- const FunctionProtoType *FPT =
+ const FunctionProtoType *FPT =
MPT->getPointeeType()->getAs<FunctionProtoType>();
- const CXXRecordDecl *RD =
+ const CXXRecordDecl *RD =
cast<CXXRecordDecl>(MPT->getClass()->getAs<RecordType>()->getDecl());
llvm::FunctionType *FTy = CGM.getTypes().GetFunctionType(
CGM.getTypes().arrangeCXXMethodType(RD, FPT, /*FD=*/nullptr));
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Jul 30 12:24:48 2018
@@ -789,7 +789,7 @@ CodeGenTypes::arrangeLLVMFunctionInfo(Ca
bool erased = FunctionsBeingProcessed.erase(FI); (void)erased;
assert(erased && "Not in set?");
-
+
return *FI;
}
@@ -1344,7 +1344,7 @@ static void CreateCoercedStore(llvm::Val
}
static Address emitAddressAtOffset(CodeGenFunction &CGF, Address addr,
- const ABIArgInfo &info) {
+ const ABIArgInfo &info) {
if (unsigned offset = info.getDirectOffset()) {
addr = CGF.Builder.CreateElementBitCast(addr, CGF.Int8Ty);
addr = CGF.Builder.CreateConstInBoundsByteGEP(addr,
@@ -1675,7 +1675,7 @@ llvm::Type *CodeGenTypes::GetFunctionTyp
if (!isFuncTypeConvertible(FPT))
return llvm::StructType::get(getLLVMContext());
-
+
const CGFunctionInfo *Info;
if (isa<CXXDestructorDecl>(MD))
Info =
@@ -2683,7 +2683,7 @@ static llvm::Value *tryRemoveRetainOfSel
llvm::Value *retainedValue = retainCall->getArgOperand(0);
llvm::LoadInst *load =
dyn_cast<llvm::LoadInst>(retainedValue->stripPointerCasts());
- if (!load || load->isAtomic() || load->isVolatile() ||
+ if (!load || load->isAtomic() || load->isVolatile() ||
load->getPointerOperand() != CGF.GetAddrOfLocalVar(self).getPointer())
return nullptr;
@@ -3139,7 +3139,7 @@ static void emitWriteback(CodeGenFunctio
// Cast it back, in case we're writing an id to a Foo* or something.
value = CGF.Builder.CreateBitCast(value, srcAddr.getElementType(),
"icr.writeback-cast");
-
+
// Perform the writeback.
// If we have a "to use" value, it's something we need to emit a use
@@ -3245,7 +3245,7 @@ static void emitWritebackArg(CodeGenFunc
// isn't null, so we need to register a dominating point so that the cleanups
// system will make valid IR.
CodeGenFunction::ConditionalEvaluation condEval(CGF);
-
+
// Zero-initialize it if we're not doing a copy-initialization.
bool shouldCopy = CRE->shouldCopy();
if (!shouldCopy) {
@@ -3269,7 +3269,7 @@ static void emitWritebackArg(CodeGenFunc
llvm::Value *isNull =
CGF.Builder.CreateIsNull(srcAddr.getPointer(), "icr.isnull");
- finalArgument = CGF.Builder.CreateSelect(isNull,
+ finalArgument = CGF.Builder.CreateSelect(isNull,
llvm::ConstantPointerNull::get(destType),
temp.getPointer(), "icr.argument");
@@ -3309,7 +3309,7 @@ static void emitWritebackArg(CodeGenFunc
valueToUse = src;
}
}
-
+
// Finish the control flow if we needed it.
if (shouldCopy && !provablyNonNull) {
llvm::BasicBlock *copyBB = CGF.Builder.GetInsertBlock();
@@ -3360,7 +3360,7 @@ void CodeGenFunction::EmitNonNullArgChec
auto PVD = ParmNum < AC.getNumParams() ? AC.getParamDecl(ParmNum) : nullptr;
unsigned ArgNo = PVD ? PVD->getFunctionScopeIndex() : ParmNum;
- // Prefer the nonnull attribute if it's present.
+ // Prefer the nonnull attribute if it's present.
const NonNullAttr *NNAttr = nullptr;
if (SanOpts.has(SanitizerKind::NonnullAttribute))
NNAttr = getNonNullAttr(AC.getDecl(), PVD, ArgType, ArgNo);
@@ -3713,7 +3713,7 @@ void CodeGenFunction::EmitNoreturnRuntim
getBundlesForFunclet(callee);
if (getInvokeDest()) {
- llvm::InvokeInst *invoke =
+ llvm::InvokeInst *invoke =
Builder.CreateInvoke(callee,
getUnreachableBlock(),
getInvokeDest(),
Modified: cfe/trunk/lib/CodeGen/CGCall.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Mon Jul 30 12:24:48 2018
@@ -356,7 +356,7 @@ public:
class FunctionArgList : public SmallVector<const VarDecl*, 16> {
};
- /// ReturnValueSlot - Contains the address where the return value of a
+ /// ReturnValueSlot - Contains the address where the return value of a
/// function can be stored, and whether the address is volatile or not.
class ReturnValueSlot {
llvm::PointerIntPair<llvm::Value *, 2, unsigned int> Value;
@@ -381,7 +381,7 @@ public:
Address getValue() const { return Address(Value.getPointer(), Alignment); }
bool isUnused() const { return Value.getInt() & IS_UNUSED; }
};
-
+
} // end namespace CodeGen
} // end namespace clang
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Jul 30 12:24:48 2018
@@ -655,7 +655,7 @@ static void EmitMemberInitializer(CodeGe
// the constructor.
QualType::DestructionKind dtorKind = FieldType.isDestructedType();
if (CGF.needsEHCleanup(dtorKind))
- CGF.pushEHDestroy(dtorKind, LHS.getAddress(), FieldType);
+ CGF.pushEHDestroy(dtorKind, LHS.getAddress(), FieldType);
return;
}
}
@@ -890,7 +890,7 @@ namespace {
SanitizerSet OldSanOpts;
};
} // end anonymous namespace
-
+
namespace {
class FieldMemcpyizer {
public:
@@ -1937,7 +1937,7 @@ void CodeGenFunction::EmitCXXAggrConstru
// The alignment of the base, adjusted by the size of a single element,
// provides a conservative estimate of the alignment of every element.
// (This assumes we never start tracking offsetted alignments.)
- //
+ //
// Note that these are complete objects and so we don't need to
// use the non-virtual size or alignment.
QualType type = getContext().getTypeDeclType(ctor->getParent());
Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Mon Jul 30 12:24:48 2018
@@ -319,7 +319,7 @@ static llvm::LoadInst *createLoadInstBef
auto load = new llvm::LoadInst(addr.getPointer(), name, beforeInst);
load->setAlignment(addr.getAlignment().getQuantity());
return load;
-}
+}
/// All the branch fixups on the EH stack have propagated out past the
/// outermost normal cleanup; resolve them all by adding cases to the
@@ -621,7 +621,7 @@ static void destroyOptimisticNormalEntry
++i;
use.set(unreachableBB);
-
+
// The only uses should be fixup switches.
llvm::SwitchInst *si = cast<llvm::SwitchInst>(use.getUser());
if (si->getNumCases() == 1 && si->getDefaultDest() == unreachableBB) {
@@ -640,7 +640,7 @@ static void destroyOptimisticNormalEntry
condition->eraseFromParent();
}
}
-
+
assert(entry->use_empty());
delete entry;
}
@@ -659,7 +659,7 @@ void CodeGenFunction::PopCleanupBlock(bo
Address NormalActiveFlag =
Scope.shouldTestFlagInNormalCleanup() ? Scope.getActiveFlag()
: Address::invalid();
- Address EHActiveFlag =
+ Address EHActiveFlag =
Scope.shouldTestFlagInEHCleanup() ? Scope.getActiveFlag()
: Address::invalid();
@@ -708,7 +708,7 @@ void CodeGenFunction::PopCleanupBlock(bo
// cleanup, rewrite it so that it leads to the appropriate place.
if (Scope.isNormalCleanup() && HasPrebranchedFallthrough && !IsActive) {
llvm::BasicBlock *prebranchDest;
-
+
// If the prebranch is semantically branching through the next
// cleanup, just forward it to the next block, leaving the
// insertion point in the prebranched block.
@@ -922,7 +922,7 @@ void CodeGenFunction::PopCleanupBlock(bo
}
// V. Set up the fallthrough edge out.
-
+
// Case 1: a fallthrough source exists but doesn't branch to the
// cleanup because the cleanup is inactive.
if (!HasFallthrough && FallthroughSource) {
@@ -1025,11 +1025,11 @@ void CodeGenFunction::PopCleanupBlock(bo
bool CodeGenFunction::isObviouslyBranchWithoutCleanups(JumpDest Dest) const {
assert(Dest.getScopeDepth().encloses(EHStack.stable_begin())
&& "stale jump destination");
-
+
// Calculate the innermost active normal cleanup.
EHScopeStack::stable_iterator TopCleanup =
EHStack.getInnermostActiveNormalCleanup();
-
+
// If we're not in an active normal cleanup scope, or if the
// destination scope is within the innermost active normal cleanup
// scope, we don't need to worry about fixups.
@@ -1119,7 +1119,7 @@ void CodeGenFunction::EmitBranchThroughC
break;
}
}
-
+
Builder.ClearInsertionPoint();
}
Modified: cfe/trunk/lib/CodeGen/CGCleanup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCleanup.h (original)
+++ cfe/trunk/lib/CodeGen/CGCleanup.h Mon Jul 30 12:24:48 2018
@@ -509,7 +509,7 @@ class EHScopeStack::iterator {
public:
iterator() : Ptr(nullptr) {}
- EHScope *get() const {
+ EHScope *get() const {
return reinterpret_cast<EHScope*>(Ptr);
}
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Mon Jul 30 12:24:48 2018
@@ -27,9 +27,9 @@ using namespace CodeGen;
static void EmitDeclInit(CodeGenFunction &CGF, const VarDecl &D,
ConstantAddress DeclPtr) {
assert(D.hasGlobalStorage() && "VarDecl must have global storage!");
- assert(!D.getType()->isReferenceType() &&
+ assert(!D.getType()->isReferenceType() &&
"Should not call EmitDeclInit on a reference!");
-
+
QualType type = D.getType();
LValue lv = CGF.MakeAddrLValue(DeclPtr, type);
@@ -67,7 +67,7 @@ static void EmitDeclDestroy(CodeGenFunct
CodeGenModule &CGM = CGF.CGM;
// FIXME: __attribute__((cleanup)) ?
-
+
QualType type = D.getType();
QualType::DestructionKind dtorKind = type.isDestructedType();
@@ -219,7 +219,7 @@ llvm::Constant *CodeGenFunction::createA
CGF.StartFunction(&VD, CGM.getContext().VoidTy, fn, FI, FunctionArgList());
llvm::CallInst *call = CGF.Builder.CreateCall(dtor, addr);
-
+
// Make sure the call and the callee agree on calling convention.
if (llvm::Function *dtorFn =
dyn_cast<llvm::Function>(dtor->stripPointerCasts()))
@@ -488,7 +488,7 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
// Create our global initialization function.
if (!PrioritizedCXXGlobalInits.empty()) {
SmallVector<llvm::Function *, 8> LocalCXXGlobalInits;
- llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
+ llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
PrioritizedCXXGlobalInits.end());
// Iterate over "chunks" of ctors with same priority and emit each chunk
// into separate function. Note - everything is sorted first by priority,
@@ -684,8 +684,8 @@ llvm::Function *CodeGenFunction::generat
StartFunction(VD, getContext().VoidTy, fn, FI, args);
emitDestroy(addr, type, destroyer, useEHCleanupForArray);
-
+
FinishFunction();
-
+
return fn;
}
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Mon Jul 30 12:24:48 2018
@@ -335,7 +335,7 @@ void CodeGenModule::SimplifyPersonality(
// Nothing to do if it's unused.
if (!Fn || Fn->use_empty()) return;
-
+
// Can't do the optimization if it has non-C++ uses.
if (!PersonalityHasOnlyCXXUses(Fn)) return;
@@ -443,7 +443,7 @@ void CodeGenFunction::EmitCXXThrowExpr(c
void CodeGenFunction::EmitStartEHSpec(const Decl *D) {
if (!CGM.getLangOpts().CXXExceptions)
return;
-
+
const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D);
if (!FD) {
// Check if CapturedDecl is nothrow and create terminate scope for it.
@@ -520,7 +520,7 @@ static void emitFilterDispatchBlock(Code
void CodeGenFunction::EmitEndEHSpec(const Decl *D) {
if (!CGM.getLangOpts().CXXExceptions)
return;
-
+
const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D);
if (!FD) {
// Check if CapturedDecl is nothrow and pop terminate scope for it.
@@ -1345,7 +1345,7 @@ namespace {
CGF.PopCleanupBlock();
CGF.Builder.restoreIP(SavedIP);
}
-
+
// Now make sure we actually have an insertion point or the
// cleanup gods will hate us.
CGF.EnsureInsertPoint();
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Jul 30 12:24:48 2018
@@ -1820,14 +1820,14 @@ Address CodeGenFunction::EmitExtVectorEl
const VectorType *ExprVT = LV.getType()->getAs<VectorType>();
QualType EQT = ExprVT->getElementType();
llvm::Type *VectorElementTy = CGM.getTypes().ConvertType(EQT);
-
+
Address CastToPointerElement =
Builder.CreateElementBitCast(VectorAddress, VectorElementTy,
"conv.ptr.element");
-
+
const llvm::Constant *Elts = LV.getExtVectorElts();
unsigned ix = getAccessedFieldNo(0, Elts);
-
+
Address VectorBasePtrPlusIx =
Builder.CreateConstInBoundsGEP(CastToPointerElement, ix,
getContext().getTypeSizeInChars(EQT),
@@ -3282,7 +3282,7 @@ static Address emitArraySubscriptGEP(Cod
for (auto idx : indices.drop_back())
assert(isa<llvm::ConstantInt>(idx) &&
cast<llvm::ConstantInt>(idx)->isZero());
-#endif
+#endif
// Determine the element size of the statically-sized base. This is
// the thing that the indices are expressed in terms of.
@@ -3764,7 +3764,7 @@ LValue CodeGenFunction::EmitLValueForLam
static Address emitAddrOfFieldStorage(CodeGenFunction &CGF, Address base,
const FieldDecl *field) {
const RecordDecl *rec = field->getParent();
-
+
unsigned idx =
CGF.CGM.getTypes().getCGRecordLayout(rec).getLLVMFieldNo(field);
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon Jul 30 12:24:48 2018
@@ -650,7 +650,7 @@ AggExprEmitter::VisitCompoundLiteralExpr
EmitAggLoadOfLValue(E);
return;
}
-
+
AggValueSlot Slot = EnsureSlot(E->getType());
CGF.EmitAggExpr(E->getInitializer(), Slot);
}
@@ -766,7 +766,7 @@ void AggExprEmitter::VisitCastExpr(CastE
AggValueSlot::DoesNotOverlap,
AggValueSlot::IsZeroed);
}
-
+
CGF.EmitAggExpr(E->getSubExpr(), valueDest);
return;
}
@@ -801,7 +801,7 @@ void AggExprEmitter::VisitCastExpr(CastE
"Implicit cast types must be compatible");
Visit(E->getSubExpr());
break;
-
+
case CK_LValueBitCast:
llvm_unreachable("should not be emitting lvalue bitcast as rvalue");
@@ -1140,7 +1140,7 @@ void AggExprEmitter::VisitBinAssign(cons
Dest);
return;
}
-
+
LValue LHS = CGF.EmitLValue(E->getLHS());
// If we have an atomic type, evaluate into the destination and then
@@ -1155,7 +1155,7 @@ void AggExprEmitter::VisitBinAssign(cons
// Codegen the RHS so that it stores directly into the LHS.
AggValueSlot LHSSlot =
- AggValueSlot::forLValue(LHS, AggValueSlot::IsDestructed,
+ AggValueSlot::forLValue(LHS, AggValueSlot::IsDestructed,
needsGC(E->getLHS()->getType()),
AggValueSlot::IsAliased,
AggValueSlot::MayOverlap);
@@ -1163,7 +1163,7 @@ void AggExprEmitter::VisitBinAssign(cons
if (!LHSSlot.isVolatile() &&
CGF.hasVolatileMember(E->getLHS()->getType()))
LHSSlot.setVolatile(true);
-
+
CGF.EmitAggExpr(E->getRHS(), LHSSlot);
// Copy into the destination if the assignment isn't ignored.
@@ -1303,13 +1303,13 @@ static bool isSimpleZero(const Expr *E,
// '\0'
if (const CharacterLiteral *CL = dyn_cast<CharacterLiteral>(E))
return CL->getValue() == 0;
-
+
// Otherwise, hard case: conservatively return false.
return false;
}
-void
+void
AggExprEmitter::EmitInitializationToLValue(Expr *E, LValue LV) {
QualType type = LV.getType();
// FIXME: Ignore result?
@@ -1326,7 +1326,7 @@ AggExprEmitter::EmitInitializationToLVal
RValue RV = CGF.EmitReferenceBindingToExpr(E);
return CGF.EmitStoreThroughLValue(RV, LV);
}
-
+
switch (CGF.getEvaluationKind(type)) {
case TEK_Complex:
CGF.EmitComplexExprIntoLValue(E, LV, /*isInit*/ true);
@@ -1357,7 +1357,7 @@ void AggExprEmitter::EmitNullInitializat
// copied into it, we don't have to emit any zeros here.
if (Dest.isZeroed() && CGF.getTypes().isZeroInitializable(type))
return;
-
+
if (CGF.hasScalarEvaluationKind(type)) {
// For non-aggregates, we can store the appropriate null constant.
llvm::Value *null = CGF.CGM.EmitNullConstant(type);
@@ -1501,12 +1501,12 @@ void AggExprEmitter::VisitInitListExpr(I
if (curInitIndex == NumInitElements && Dest.isZeroed() &&
CGF.getTypes().isZeroInitializable(E->getType()))
break;
-
+
LValue LV = CGF.EmitLValueForFieldInitialization(DestLV, field);
// We never generate write-barries for initialized fields.
LV.setNonGC(true);
-
+
if (curInitIndex < NumInitElements) {
// Store the initializer into the field.
EmitInitializationToLValue(E->getInit(curInitIndex++), LV);
@@ -1535,10 +1535,10 @@ void AggExprEmitter::VisitInitListExpr(I
pushedCleanup = true;
}
}
-
+
// If the GEP didn't get used because of a dead zero init or something
// else, clean it up for -O0 builds and general tidiness.
- if (!pushedCleanup && LV.isSimple())
+ if (!pushedCleanup && LV.isSimple())
if (llvm::GetElementPtrInst *GEP =
dyn_cast<llvm::GetElementPtrInst>(LV.getPointer()))
if (GEP->use_empty())
@@ -1677,7 +1677,7 @@ static CharUnits GetNumNonZeroBytesInIni
ILE = dyn_cast<InitListExpr>(ILE->getInit(0));
if (!ILE || !CGF.getTypes().isZeroInitializable(ILE->getType()))
return CGF.getContext().getTypeSizeInChars(E->getType());
-
+
// InitListExprs for structs have to be handled carefully. If there are
// reference members, we need to consider the size of the reference, not the
// referencee. InitListExprs for unions and arrays can't have references.
@@ -1685,7 +1685,7 @@ static CharUnits GetNumNonZeroBytesInIni
if (!RT->isUnionType()) {
RecordDecl *SD = E->getType()->getAs<RecordType>()->getDecl();
CharUnits NumNonZeroBytes = CharUnits::Zero();
-
+
unsigned ILEElement = 0;
if (auto *CXXRD = dyn_cast<CXXRecordDecl>(SD))
while (ILEElement != CXXRD->getNumBases())
@@ -1701,7 +1701,7 @@ static CharUnits GetNumNonZeroBytesInIni
continue;
const Expr *E = ILE->getInit(ILEElement++);
-
+
// Reference values are always non-null and have the width of a pointer.
if (Field->getType()->isReferenceType())
NumNonZeroBytes += CGF.getContext().toCharUnitsFromBits(
@@ -1709,12 +1709,12 @@ static CharUnits GetNumNonZeroBytesInIni
else
NumNonZeroBytes += GetNumNonZeroBytesInInit(E, CGF);
}
-
+
return NumNonZeroBytes;
}
}
-
-
+
+
CharUnits NumNonZeroBytes = CharUnits::Zero();
for (unsigned i = 0, e = ILE->getNumInits(); i != e; ++i)
NumNonZeroBytes += GetNumNonZeroBytesInInit(ILE->getInit(i), CGF);
@@ -1750,14 +1750,14 @@ static void CheckAggExprForMemSetUse(Agg
CharUnits NumNonZeroBytes = GetNumNonZeroBytesInInit(E, CGF);
if (NumNonZeroBytes*4 > Size)
return;
-
+
// Okay, it seems like a good idea to use an initial memset, emit the call.
llvm::Constant *SizeVal = CGF.Builder.getInt64(Size.getQuantity());
- Address Loc = Slot.getAddress();
+ Address Loc = Slot.getAddress();
Loc = CGF.Builder.CreateElementBitCast(Loc, CGF.Int8Ty);
CGF.Builder.CreateMemSet(Loc, CGF.Builder.getInt8(0), SizeVal, false);
-
+
// Tell the AggExprEmitter that the slot is known zero.
Slot.setZeroed();
}
@@ -1777,7 +1777,7 @@ void CodeGenFunction::EmitAggExpr(const
// Optimize the slot if possible.
CheckAggExprForMemSetUse(Slot, E, *this);
-
+
AggExprEmitter(*this, Slot, Slot.isIgnored()).Visit(const_cast<Expr*>(E));
}
@@ -1826,7 +1826,7 @@ void CodeGenFunction::EmitAggregateCopy(
if (getLangOpts().CPlusPlus) {
if (const RecordType *RT = Ty->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(RT->getDecl());
- assert((Record->hasTrivialCopyConstructor() ||
+ assert((Record->hasTrivialCopyConstructor() ||
Record->hasTrivialCopyAssignment() ||
Record->hasTrivialMoveConstructor() ||
Record->hasTrivialMoveAssignment() ||
@@ -1899,7 +1899,7 @@ void CodeGenFunction::EmitAggregateCopy(
} else if (const RecordType *RecordTy = Ty->getAs<RecordType>()) {
RecordDecl *Record = RecordTy->getDecl();
if (Record->hasObjectMember()) {
- CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr,
+ CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr,
SizeVal);
return;
}
@@ -1907,7 +1907,7 @@ void CodeGenFunction::EmitAggregateCopy(
QualType BaseType = getContext().getBaseElementType(Ty);
if (const RecordType *RecordTy = BaseType->getAs<RecordType>()) {
if (RecordTy->getDecl()->hasObjectMember()) {
- CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr,
+ CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr,
SizeVal);
return;
}
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Mon Jul 30 12:24:48 2018
@@ -255,7 +255,7 @@ RValue CodeGenFunction::EmitCXXMemberOrO
if (MD->isTrivial() || (MD->isDefaulted() && MD->getParent()->isUnion())) {
if (isa<CXXDestructorDecl>(MD)) return RValue::get(nullptr);
- if (isa<CXXConstructorDecl>(MD) &&
+ if (isa<CXXConstructorDecl>(MD) &&
cast<CXXConstructorDecl>(MD)->isDefaultConstructor())
return RValue::get(nullptr);
@@ -337,7 +337,7 @@ RValue CodeGenFunction::EmitCXXMemberOrO
// We also don't emit a virtual call if the base expression has a record type
// because then we know what the type is.
bool UseVirtualCall = CanUseVirtualCall && !DevirtualizedMethod;
-
+
if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(MD)) {
assert(CE->arg_begin() == CE->arg_end() &&
"Destructor shouldn't have explicit parameters");
@@ -367,7 +367,7 @@ RValue CodeGenFunction::EmitCXXMemberOrO
}
return RValue::get(nullptr);
}
-
+
CGCallee Callee;
if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(MD)) {
Callee = CGCallee::forDirect(
@@ -416,20 +416,20 @@ CodeGenFunction::EmitCXXMemberPointerCal
cast<BinaryOperator>(E->getCallee()->IgnoreParens());
const Expr *BaseExpr = BO->getLHS();
const Expr *MemFnExpr = BO->getRHS();
-
- const MemberPointerType *MPT =
+
+ const MemberPointerType *MPT =
MemFnExpr->getType()->castAs<MemberPointerType>();
- const FunctionProtoType *FPT =
+ const FunctionProtoType *FPT =
MPT->getPointeeType()->castAs<FunctionProtoType>();
- const CXXRecordDecl *RD =
+ const CXXRecordDecl *RD =
cast<CXXRecordDecl>(MPT->getClass()->getAs<RecordType>()->getDecl());
// Emit the 'this' pointer.
Address This = Address::invalid();
if (BO->getOpcode() == BO_PtrMemI)
This = EmitPointerWithAlignment(BaseExpr);
- else
+ else
This = EmitLValue(BaseExpr).getAddress();
EmitTypeCheck(TCK_MemberCall, E->getExprLoc(), This.getPointer(),
@@ -443,10 +443,10 @@ CodeGenFunction::EmitCXXMemberPointerCal
CGCallee Callee =
CGM.getCXXABI().EmitLoadOfMemberFunctionPointer(*this, BO, This,
ThisPtrForCall, MemFnPtr, MPT);
-
+
CallArgList Args;
- QualType ThisType =
+ QualType ThisType =
getContext().getPointerType(getContext().getTagDeclType(RD));
// Push the this ptr.
@@ -570,7 +570,7 @@ CodeGenFunction::EmitCXXConstructExpr(co
AggValueSlot Dest) {
assert(!Dest.isIgnored() && "Must have a destination!");
const CXXConstructorDecl *CD = E->getConstructor();
-
+
// If we require zero initialization before (or instead of) calling the
// constructor, as can be the case with a non-user-provided default
// constructor, emit the zero initialization now, unless destination is
@@ -588,11 +588,11 @@ CodeGenFunction::EmitCXXConstructExpr(co
break;
}
}
-
+
// If this is a call to a trivial default constructor, do nothing.
if (CD->isTrivial() && CD->isDefaultConstructor())
return;
-
+
// Elide the constructor if we're constructing from a temporary.
// The temporary check is required because Sema sets this on NRVO
// returns.
@@ -604,7 +604,7 @@ CodeGenFunction::EmitCXXConstructExpr(co
return;
}
}
-
+
if (const ArrayType *arrayType
= getContext().getAsArrayType(E->getType())) {
EmitCXXAggrConstructorCall(CD, arrayType, Dest.getAddress(), E,
@@ -613,7 +613,7 @@ CodeGenFunction::EmitCXXConstructExpr(co
CXXCtorType Type = Ctor_Complete;
bool ForVirtualBase = false;
bool Delegating = false;
-
+
switch (E->getConstructionKind()) {
case CXXConstructExpr::CK_Delegating:
// We should be emitting a constructor; GlobalDecl will assert this
@@ -632,7 +632,7 @@ CodeGenFunction::EmitCXXConstructExpr(co
case CXXConstructExpr::CK_NonVirtualBase:
Type = Ctor_Base;
}
-
+
// Call the constructor.
EmitCXXConstructorCall(CD, Type, ForVirtualBase, Delegating,
Dest.getAddress(), E, Dest.mayOverlap(),
@@ -644,19 +644,19 @@ void CodeGenFunction::EmitSynthesizedCXX
const Expr *Exp) {
if (const ExprWithCleanups *E = dyn_cast<ExprWithCleanups>(Exp))
Exp = E->getSubExpr();
- assert(isa<CXXConstructExpr>(Exp) &&
+ assert(isa<CXXConstructExpr>(Exp) &&
"EmitSynthesizedCXXCopyCtor - unknown copy ctor expr");
const CXXConstructExpr* E = cast<CXXConstructExpr>(Exp);
const CXXConstructorDecl *CD = E->getConstructor();
RunCleanupsScope Scope(*this);
-
+
// If we require zero initialization before (or instead of) calling the
// constructor, as can be the case with a non-user-provided default
// constructor, emit the zero initialization now.
// FIXME. Do I still need this for a copy ctor synthesis?
if (E->requiresZeroInitialization())
EmitNullInitialization(Dest, E->getType());
-
+
assert(!getContext().getAsConstantArrayType(E->getType())
&& "EmitSynthesizedCXXCopyCtor - Copied-in Array");
EmitSynthesizedCXXCopyCtorCall(CD, Dest, Src, E);
@@ -711,7 +711,7 @@ static llvm::Value *EmitCXXNewAllocSize(
// size_t. That's just a gloss, though, and it's wrong in one
// important way: if the count is negative, it's an error even if
// the cookie size would bring the total size >= 0.
- bool isSigned
+ bool isSigned
= e->getArraySize()->getType()->isSignedIntegerOrEnumerationType();
llvm::IntegerType *numElementsType
= cast<llvm::IntegerType>(numElements->getType());
@@ -731,7 +731,7 @@ static llvm::Value *EmitCXXNewAllocSize(
// This will be a size_t.
llvm::Value *size;
-
+
// If someone is doing 'new int[42]' there is no need to do a dynamic check.
// Don't bloat the -O0 code.
if (llvm::ConstantInt *numElementsC =
@@ -822,7 +822,7 @@ static llvm::Value *EmitCXXNewAllocSize(
} else if (isSigned) {
if (numElementsWidth < sizeWidth)
numElements = CGF.Builder.CreateSExt(numElements, CGF.SizeTy);
-
+
// If there's a non-1 type size multiplier, then we can do the
// signedness check at the same time as we do the multiply
// because a negative number times anything will cause an
@@ -899,7 +899,7 @@ static llvm::Value *EmitCXXNewAllocSize(
// numElements doesn't need to be scaled.
assert(arraySizeMultiplier == 1);
}
-
+
// Add in the cookie size if necessary.
if (cookieSize != 0) {
sizeWithoutCookie = size;
@@ -1236,7 +1236,7 @@ void CodeGenFunction::EmitNewArrayInitia
CurPtr = Address(CurPtrPhi, ElementAlign);
// Store the new Cleanup position for irregular Cleanups.
- if (EndOfInit.isValid())
+ if (EndOfInit.isValid())
Builder.CreateStore(CurPtr.getPointer(), EndOfInit);
// Enter a partial-destruction Cleanup if necessary.
@@ -1749,7 +1749,7 @@ llvm::Value *CodeGenFunction::EmitCXXNew
resultPtr = PHI;
}
-
+
return resultPtr;
}
@@ -1913,13 +1913,13 @@ static void EmitObjectDelete(CodeGenFunc
case Qualifiers::OCL_Strong:
CGF.EmitARCDestroyStrong(Ptr, ARCPreciseLifetime);
break;
-
+
case Qualifiers::OCL_Weak:
CGF.EmitARCDestroyWeak(Ptr);
break;
}
}
-
+
CGF.PopCleanupBlock();
}
@@ -2122,9 +2122,9 @@ static llvm::Value *EmitTypeidFromVTable
}
llvm::Value *CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
- llvm::Type *StdTypeInfoPtrTy =
+ llvm::Type *StdTypeInfoPtrTy =
ConvertType(E->getType())->getPointerTo();
-
+
if (E->isTypeOperand()) {
llvm::Constant *TypeInfo =
CGM.GetAddrOfRTTIDescriptor(E->getTypeOperand(getContext()));
@@ -2137,7 +2137,7 @@ llvm::Value *CodeGenFunction::EmitCXXTyp
// representing the type of the most derived object (that is, the dynamic
// type) to which the glvalue refers.
if (E->isPotentiallyEvaluated())
- return EmitTypeidFromVTable(*this, E->getExprOperand(),
+ return EmitTypeidFromVTable(*this, E->getExprOperand(),
StdTypeInfoPtrTy);
QualType OperandTy = E->getExprOperand()->getType();
@@ -2199,7 +2199,7 @@ llvm::Value *CodeGenFunction::EmitDynami
assert(SrcRecordTy->isRecordType() && "source type must be a record type!");
- // C++ [expr.dynamic.cast]p4:
+ // C++ [expr.dynamic.cast]p4:
// If the value of v is a null pointer value in the pointer case, the result
// is the null pointer value of type T.
bool ShouldNullCheckSrcValue =
@@ -2209,7 +2209,7 @@ llvm::Value *CodeGenFunction::EmitDynami
llvm::BasicBlock *CastNull = nullptr;
llvm::BasicBlock *CastNotNull = nullptr;
llvm::BasicBlock *CastEnd = createBasicBlock("dynamic_cast.end");
-
+
if (ShouldNullCheckSrcValue) {
CastNull = createBasicBlock("dynamic_cast.null");
CastNotNull = createBasicBlock("dynamic_cast.notnull");
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Mon Jul 30 12:24:48 2018
@@ -57,7 +57,7 @@ public:
private:
ConstStructBuilder(ConstantEmitter &emitter)
- : CGM(emitter.CGM), Emitter(emitter), Packed(false),
+ : CGM(emitter.CGM), Emitter(emitter), Packed(false),
NextFieldOffsetInChars(CharUnits::Zero()),
LLVMStructAlignment(CharUnits::One()) { }
@@ -244,11 +244,11 @@ void ConstStructBuilder::AppendBitField(
assert(AT->getElementType()->isIntegerTy(CharWidth) &&
AT->getNumElements() != 0 &&
"Expected non-empty array padding of undefs");
-
+
// Remove the padding array.
NextFieldOffsetInChars -= CharUnits::fromQuantity(AT->getNumElements());
Elements.pop_back();
-
+
// Add the padding back in two chunks.
AppendPadding(CharUnits::fromQuantity(AT->getNumElements()-1));
AppendPadding(CharUnits::One());
@@ -269,7 +269,7 @@ void ConstStructBuilder::AppendBitField(
if (CGM.getDataLayout().isBigEndian()) {
// We want the high bits.
- Tmp =
+ Tmp =
FieldValue.lshr(FieldValue.getBitWidth() - CharWidth).trunc(CharWidth);
} else {
// We want the low bits.
@@ -314,14 +314,14 @@ void ConstStructBuilder::AppendPadding(C
llvm::Constant *C = llvm::UndefValue::get(Ty);
Elements.push_back(C);
- assert(getAlignment(C) == CharUnits::One() &&
+ assert(getAlignment(C) == CharUnits::One() &&
"Padding must have 1 byte alignment!");
NextFieldOffsetInChars += getSizeInChars(C);
}
void ConstStructBuilder::AppendTailPadding(CharUnits RecordSize) {
- assert(NextFieldOffsetInChars <= RecordSize &&
+ assert(NextFieldOffsetInChars <= RecordSize &&
"Size mismatch!");
AppendPadding(RecordSize - NextFieldOffsetInChars);
@@ -364,7 +364,7 @@ void ConstStructBuilder::ConvertStructTo
LLVMStructAlignment = CharUnits::One();
Packed = true;
}
-
+
bool ConstStructBuilder::Build(InitListExpr *ILE) {
RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl();
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
@@ -972,7 +972,7 @@ public:
unsigned NumInitElements = Updater->getNumInits();
unsigned NumElements = AType->getNumElements();
-
+
std::vector<llvm::Constant *> Elts;
Elts.reserve(NumElements);
@@ -1006,7 +1006,7 @@ public:
Elts[i] = EmitDesignatedInitUpdater(Elts[i], ChildILE, destElemType);
else
Elts[i] = Emitter.tryEmitPrivateForMemory(Init, destElemType);
-
+
if (!Elts[i])
return nullptr;
RewriteType |= (Elts[i]->getType() != ElemType);
@@ -1037,17 +1037,17 @@ public:
auto C = Visit(E->getBase(), destType);
if (!C) return nullptr;
return EmitDesignatedInitUpdater(C, E->getUpdater(), destType);
- }
+ }
llvm::Constant *VisitCXXConstructExpr(CXXConstructExpr *E, QualType Ty) {
if (!E->getConstructor()->isTrivial())
return nullptr;
// FIXME: We should not have to call getBaseElementType here.
- const RecordType *RT =
+ const RecordType *RT =
CGM.getContext().getBaseElementType(Ty)->getAs<RecordType>();
const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
-
+
// If the class doesn't have a trivial destructor, we can't emit it as a
// constant expr.
if (!RD->hasTrivialDestructor())
@@ -1482,7 +1482,7 @@ llvm::Constant *
ConstantEmitter::tryEmitAbstractForMemory(const Expr *E, QualType destType) {
auto nonMemoryDestType = getNonMemoryType(CGM, destType);
auto C = tryEmitAbstract(E, nonMemoryDestType);
- return (C ? emitForMemory(C, destType) : nullptr);
+ return (C ? emitForMemory(C, destType) : nullptr);
}
llvm::Constant *
@@ -1490,7 +1490,7 @@ ConstantEmitter::tryEmitAbstractForMemor
QualType destType) {
auto nonMemoryDestType = getNonMemoryType(CGM, destType);
auto C = tryEmitAbstract(value, nonMemoryDestType);
- return (C ? emitForMemory(C, destType) : nullptr);
+ return (C ? emitForMemory(C, destType) : nullptr);
}
llvm::Constant *ConstantEmitter::tryEmitPrivateForMemory(const Expr *E,
@@ -2073,7 +2073,7 @@ static llvm::Constant *EmitNullConstant(
// Fill in the virtual bases, if we're working with the complete object.
if (CXXR && asCompleteObject) {
for (const auto &I : CXXR->vbases()) {
- const CXXRecordDecl *base =
+ const CXXRecordDecl *base =
cast<CXXRecordDecl>(I.getType()->castAs<RecordType>()->getDecl());
// Ignore empty bases.
@@ -2095,7 +2095,7 @@ static llvm::Constant *EmitNullConstant(
if (!elements[i])
elements[i] = llvm::Constant::getNullValue(structure->getElementType(i));
}
-
+
return llvm::ConstantStruct::get(structure, elements);
}
@@ -2125,7 +2125,7 @@ llvm::Constant *CodeGenModule::EmitNullC
if (getTypes().isZeroInitializable(T))
return llvm::Constant::getNullValue(getTypes().ConvertTypeForMem(T));
-
+
if (const ConstantArrayType *CAT = Context.getAsConstantArrayType(T)) {
llvm::ArrayType *ATy =
cast<llvm::ArrayType>(getTypes().ConvertTypeForMem(T));
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Mon Jul 30 12:24:48 2018
@@ -2839,7 +2839,7 @@ static Value *emitPointerArithmetic(Code
//
if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(),
op.Opcode,
- expr->getLHS(),
+ expr->getLHS(),
expr->getRHS()))
return CGF.Builder.CreateIntToPtr(index, pointer->getType());
Modified: cfe/trunk/lib/CodeGen/CGLoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGLoopInfo.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGLoopInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGLoopInfo.cpp Mon Jul 30 12:24:48 2018
@@ -155,7 +155,7 @@ void LoopInfoStack::push(BasicBlock *Hea
unsigned ValueInt = 1;
// Translate opencl_unroll_hint attribute argument to
// equivalent LoopHintAttr enums.
- // OpenCL v2.0 s6.11.5:
+ // OpenCL v2.0 s6.11.5:
// 0 - full unroll (no argument).
// 1 - disable unroll.
// other positive integer n - unroll by n.
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Mon Jul 30 12:24:48 2018
@@ -45,7 +45,7 @@ static llvm::Constant *getNullForVariabl
/// Emits an instance of NSConstantString representing the object.
llvm::Value *CodeGenFunction::EmitObjCStringLiteral(const ObjCStringLiteral *E)
{
- llvm::Constant *C =
+ llvm::Constant *C =
CGM.getObjCRuntime().GenerateConstantString(E->getString()).getPointer();
// FIXME: This bitcast should just be made an invariant on the Runtime.
return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
@@ -65,7 +65,7 @@ CodeGenFunction::EmitObjCBoxedExpr(const
assert(BoxingMethod && "BoxingMethod is null");
assert(BoxingMethod->isClassMethod() && "BoxingMethod must be a class method");
Selector Sel = BoxingMethod->getSelector();
-
+
// Generate a reference to the class pointer, which will be the receiver.
// Assumes that the method was introduced in the class that should be
// messaged (avoids pulling it out of the result type).
@@ -76,8 +76,8 @@ CodeGenFunction::EmitObjCBoxedExpr(const
CallArgList Args;
const ParmVarDecl *ArgDecl = *BoxingMethod->param_begin();
QualType ArgQT = ArgDecl->getType().getUnqualifiedType();
-
- // ObjCBoxedExpr supports boxing of structs and unions
+
+ // ObjCBoxedExpr supports boxing of structs and unions
// via [NSValue valueWithBytes:objCType:]
const QualType ValueType(SubExpr->getType().getCanonicalType());
if (ValueType->isObjCBoxableRecordType()) {
@@ -92,7 +92,7 @@ CodeGenFunction::EmitObjCBoxedExpr(const
std::string Str;
getContext().getObjCEncodingForType(ValueType, Str);
llvm::Constant *GV = CGM.GetAddrOfConstantCString(Str).getPointer();
-
+
// Cast type encoding to correct type
const ParmVarDecl *EncodingDecl = BoxingMethod->parameters()[1];
QualType EncodingQT = EncodingDecl->getType().getUnqualifiedType();
@@ -106,7 +106,7 @@ CodeGenFunction::EmitObjCBoxedExpr(const
RValue result = Runtime.GenerateMessageSend(
*this, ReturnValueSlot(), BoxingMethod->getReturnType(), Sel, Receiver,
Args, ClassDecl, BoxingMethod);
- return Builder.CreateBitCast(result.getScalarVal(),
+ return Builder.CreateBitCast(result.getScalarVal(),
ConvertType(E->getType()));
}
@@ -119,7 +119,7 @@ llvm::Value *CodeGenFunction::EmitObjCCo
DLE = cast<ObjCDictionaryLiteral>(E);
// Optimize empty collections by referencing constants, when available.
- uint64_t NumElements =
+ uint64_t NumElements =
ALE ? ALE->getNumElements() : DLE->getNumElements();
if (NumElements == 0 && CGM.getLangOpts().ObjCRuntime.hasEmptyCollections()) {
StringRef ConstantName = ALE ? "__NSArray0__" : "__NSDictionary0__";
@@ -138,8 +138,8 @@ llvm::Value *CodeGenFunction::EmitObjCCo
llvm::APInt APNumElements(Context.getTypeSize(Context.getSizeType()),
NumElements);
QualType ElementType = Context.getObjCIdType().withConst();
- QualType ElementArrayType
- = Context.getConstantArrayType(ElementType, APNumElements,
+ QualType ElementArrayType
+ = Context.getConstantArrayType(ElementType, APNumElements,
ArrayType::Normal, /*IndexTypeQuals=*/0);
// Allocate the temporary array(s).
@@ -147,7 +147,7 @@ llvm::Value *CodeGenFunction::EmitObjCCo
Address Keys = Address::invalid();
if (DLE)
Keys = CreateMemTemp(ElementArrayType, "keys");
-
+
// In ARC, we may need to do extra work to keep all the keys and
// values alive until after the call.
SmallVector<llvm::Value *, 16> NeededObjects;
@@ -169,7 +169,7 @@ llvm::Value *CodeGenFunction::EmitObjCCo
if (TrackNeededObjects) {
NeededObjects.push_back(value);
}
- } else {
+ } else {
// Emit the key and store it to the appropriate array slot.
const Expr *Key = DLE->getKeyValueElement(i).Key;
LValue KeyLV = MakeAddrLValue(
@@ -191,9 +191,9 @@ llvm::Value *CodeGenFunction::EmitObjCCo
}
}
}
-
+
// Generate the argument list.
- CallArgList Args;
+ CallArgList Args;
ObjCMethodDecl::param_const_iterator PI = MethodWithObjects->param_begin();
const ParmVarDecl *argDecl = *PI++;
QualType ArgQT = argDecl->getType().getUnqualifiedType();
@@ -205,7 +205,7 @@ llvm::Value *CodeGenFunction::EmitObjCCo
}
argDecl = *PI;
ArgQT = argDecl->getType().getUnqualifiedType();
- llvm::Value *Count =
+ llvm::Value *Count =
llvm::ConstantInt::get(CGM.getTypes().ConvertType(ArgQT), NumElements);
Args.add(RValue::get(Count), ArgQT);
@@ -214,7 +214,7 @@ llvm::Value *CodeGenFunction::EmitObjCCo
QualType ResultType = E->getType();
const ObjCObjectPointerType *InterfacePointerType
= ResultType->getAsObjCInterfacePointerType();
- ObjCInterfaceDecl *Class
+ ObjCInterfaceDecl *Class
= InterfacePointerType->getObjectType()->getInterface();
CGObjCRuntime &Runtime = CGM.getObjCRuntime();
llvm::Value *Receiver = Runtime.GetClass(*this, Class);
@@ -232,7 +232,7 @@ llvm::Value *CodeGenFunction::EmitObjCCo
EmitARCIntrinsicUse(NeededObjects);
}
- return Builder.CreateBitCast(result.getScalarVal(),
+ return Builder.CreateBitCast(result.getScalarVal(),
ConvertType(E->getType()));
}
@@ -557,7 +557,7 @@ void CodeGenFunction::StartObjCMethod(co
if (CGM.getLangOpts().ObjCAutoRefCount &&
OMD->isInstanceMethod() &&
OMD->getSelector().isUnarySelector()) {
- const IdentifierInfo *ident =
+ const IdentifierInfo *ident =
OMD->getSelector().getIdentifierInfoForSlot(0);
if (ident->isStr("dealloc"))
EHStack.pushCleanup<FinishARCDealloc>(getARCCleanupKind());
@@ -580,7 +580,7 @@ void CodeGenFunction::GenerateObjCMethod
/// emitStructGetterCall - Call the runtime function to load a property
/// into the return value slot.
-static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar,
+static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar,
bool isAtomic, bool hasStrong) {
ASTContext &Context = CGF.getContext();
@@ -588,7 +588,7 @@ static void emitStructGetterCall(CodeGen
CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(), CGF.LoadObjCSelf(), ivar, 0)
.getAddress();
- // objc_copyStruct (ReturnValue, &structIvar,
+ // objc_copyStruct (ReturnValue, &structIvar,
// sizeof (Type of Ivar), isAtomic, false);
CallArgList args;
@@ -844,30 +844,30 @@ static bool hasTrivialGetExpr(const ObjC
return false;
}
-/// emitCPPObjectAtomicGetterCall - Call the runtime function to
+/// emitCPPObjectAtomicGetterCall - Call the runtime function to
/// copy the ivar into the resturn slot.
-static void emitCPPObjectAtomicGetterCall(CodeGenFunction &CGF,
+static void emitCPPObjectAtomicGetterCall(CodeGenFunction &CGF,
llvm::Value *returnAddr,
ObjCIvarDecl *ivar,
llvm::Constant *AtomicHelperFn) {
// objc_copyCppObjectAtomic (&returnSlot, &CppObjectIvar,
// AtomicHelperFn);
CallArgList args;
-
+
// The 1st argument is the return Slot.
args.add(RValue::get(returnAddr), CGF.getContext().VoidPtrTy);
-
+
// The 2nd argument is the address of the ivar.
- llvm::Value *ivarAddr =
- CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
+ llvm::Value *ivarAddr =
+ CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
CGF.LoadObjCSelf(), ivar, 0).getPointer();
ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
-
+
// Third argument is the helper function.
args.add(RValue::get(AtomicHelperFn), CGF.getContext().VoidPtrTy);
-
- llvm::Constant *copyCppAtomicObjectFn =
+
+ llvm::Constant *copyCppAtomicObjectFn =
CGF.CGM.getObjCRuntime().GetCppAtomicObjectGetFunction();
CGCallee callee = CGCallee::forDirect(copyCppAtomicObjectFn);
CGF.EmitCall(
@@ -889,7 +889,7 @@ CodeGenFunction::generateObjCGetterBody(
}
else {
ObjCIvarDecl *ivar = propImpl->getPropertyIvarDecl();
- emitCPPObjectAtomicGetterCall(*this, ReturnValue.getPointer(),
+ emitCPPObjectAtomicGetterCall(*this, ReturnValue.getPointer(),
ivar, AtomicHelperFn);
}
return;
@@ -899,7 +899,7 @@ CodeGenFunction::generateObjCGetterBody(
QualType propType = prop->getType();
ObjCMethodDecl *getterMethod = prop->getGetterMethodDecl();
- ObjCIvarDecl *ivar = propImpl->getPropertyIvarDecl();
+ ObjCIvarDecl *ivar = propImpl->getPropertyIvarDecl();
// Pick an implementation strategy.
PropertyImplStrategy strategy(CGM, propImpl);
@@ -1039,7 +1039,7 @@ CodeGenFunction::generateObjCGetterBody(
value = Builder.CreateBitCast(
value, ConvertType(GetterMethodDecl->getReturnType()));
}
-
+
EmitReturnOfRValue(RValue::get(value), propType);
return;
}
@@ -1055,7 +1055,7 @@ CodeGenFunction::generateObjCGetterBody(
/// from the first formal parameter into the given ivar.
static void emitStructSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD,
ObjCIvarDecl *ivar) {
- // objc_copyStruct (&structIvar, &Arg,
+ // objc_copyStruct (&structIvar, &Arg,
// sizeof (struct something), true, false);
CallArgList args;
@@ -1068,7 +1068,7 @@ static void emitStructSetterCall(CodeGen
// The second argument is the address of the parameter variable.
ParmVarDecl *argVar = *OMD->param_begin();
- DeclRefExpr argRef(argVar, false, argVar->getType().getNonReferenceType(),
+ DeclRefExpr argRef(argVar, false, argVar->getType().getNonReferenceType(),
VK_LValue, SourceLocation());
llvm::Value *argAddr = CGF.EmitLValue(&argRef).getPointer();
argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy);
@@ -1093,36 +1093,36 @@ static void emitStructSetterCall(CodeGen
callee, ReturnValueSlot(), args);
}
-/// emitCPPObjectAtomicSetterCall - Call the runtime function to store
-/// the value from the first formal parameter into the given ivar, using
+/// emitCPPObjectAtomicSetterCall - Call the runtime function to store
+/// the value from the first formal parameter into the given ivar, using
/// the Cpp API for atomic Cpp objects with non-trivial copy assignment.
-static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF,
+static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF,
ObjCMethodDecl *OMD,
ObjCIvarDecl *ivar,
llvm::Constant *AtomicHelperFn) {
- // objc_copyCppObjectAtomic (&CppObjectIvar, &Arg,
+ // objc_copyCppObjectAtomic (&CppObjectIvar, &Arg,
// AtomicHelperFn);
CallArgList args;
-
+
// The first argument is the address of the ivar.
- llvm::Value *ivarAddr =
- CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
+ llvm::Value *ivarAddr =
+ CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(),
CGF.LoadObjCSelf(), ivar, 0).getPointer();
ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
-
+
// The second argument is the address of the parameter variable.
ParmVarDecl *argVar = *OMD->param_begin();
- DeclRefExpr argRef(argVar, false, argVar->getType().getNonReferenceType(),
+ DeclRefExpr argRef(argVar, false, argVar->getType().getNonReferenceType(),
VK_LValue, SourceLocation());
llvm::Value *argAddr = CGF.EmitLValue(&argRef).getPointer();
argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy);
args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy);
-
+
// Third argument is the helper function.
args.add(RValue::get(AtomicHelperFn), CGF.getContext().VoidPtrTy);
-
- llvm::Constant *fn =
+
+ llvm::Constant *fn =
CGF.CGM.getObjCRuntime().GetCppAtomicObjectSetFunction();
CGCallee callee = CGCallee::forDirect(fn);
CGF.EmitCall(
@@ -1168,7 +1168,7 @@ CodeGenFunction::generateObjCSetterBody(
const ObjCPropertyDecl *prop = propImpl->getPropertyDecl();
ObjCIvarDecl *ivar = propImpl->getPropertyIvarDecl();
ObjCMethodDecl *setterMethod = prop->getSetterMethodDecl();
-
+
// Just use the setter expression if Sema gave us one and it's
// non-trivial.
if (!hasTrivialSetExpr(propImpl)) {
@@ -1221,7 +1221,7 @@ CodeGenFunction::generateObjCSetterBody(
llvm::Constant *setPropertyFn = nullptr;
if (UseOptimizedSetter(CGM)) {
// 10.8 and iOS 6.0 code and GC is off
- setOptimizedPropertyFn =
+ setOptimizedPropertyFn =
CGM.getObjCRuntime()
.GetOptimizedPropertySetFunction(strategy.isAtomic(),
strategy.isCopy());
@@ -1237,7 +1237,7 @@ CodeGenFunction::generateObjCSetterBody(
return;
}
}
-
+
// Emit objc_setProperty((id) self, _cmd, offset, arg,
// <is-atomic>, <is-copy>).
llvm::Value *cmd =
@@ -1272,7 +1272,7 @@ CodeGenFunction::generateObjCSetterBody(
EmitCall(getTypes().arrangeBuiltinFunctionCall(getContext().VoidTy, args),
callee, ReturnValueSlot(), args);
}
-
+
return;
}
@@ -1301,7 +1301,7 @@ CodeGenFunction::generateObjCSetterBody(
ImplicitCastExpr argLoad(ImplicitCastExpr::OnStack,
argType.getUnqualifiedType(), CK_LValueToRValue,
&arg, VK_RValue);
-
+
// The property type can differ from the ivar type in some situations with
// Objective-C pointer types, we can always bit cast the RHS in these cases.
// The following absurdity is just to ensure well-formed IR.
@@ -1435,7 +1435,7 @@ void CodeGenFunction::GenerateObjCCtorDt
for (const auto *IvarInit : IMP->inits()) {
FieldDecl *Field = IvarInit->getAnyMember();
ObjCIvarDecl *Ivar = cast<ObjCIvarDecl>(Field);
- LValue LV = EmitLValueForIvar(TypeOfSelfObject(),
+ LValue LV = EmitLValueForIvar(TypeOfSelfObject(),
LoadObjCSelf(), Ivar, 0);
EmitAggExpr(IvarInit->getInit(),
AggValueSlot::forLValue(LV, AggValueSlot::IsDestructed,
@@ -2015,7 +2015,7 @@ static void emitAutoreleasedReturnValueM
} else if (CGF.CGM.getCodeGenOpts().OptimizationLevel == 0) {
llvm::FunctionType *type =
llvm::FunctionType::get(CGF.VoidTy, /*variadic*/false);
-
+
marker = llvm::InlineAsm::get(type, assembly, "", /*sideeffects*/ true);
// If we're at -O1 and above, we don't want to litter the code
@@ -2368,10 +2368,10 @@ llvm::Value *CodeGenFunction::EmitObjCMR
IdentifierInfo *II = &CGM.getContext().Idents.get("alloc");
Selector AllocSel = getContext().Selectors.getSelector(0, &II);
CallArgList Args;
- RValue AllocRV =
- Runtime.GenerateMessageSend(*this, ReturnValueSlot(),
+ RValue AllocRV =
+ Runtime.GenerateMessageSend(*this, ReturnValueSlot(),
getContext().getObjCIdType(),
- AllocSel, Receiver, Args);
+ AllocSel, Receiver, Args);
// [Receiver init]
Receiver = AllocRV.getScalarVal();
@@ -2380,7 +2380,7 @@ llvm::Value *CodeGenFunction::EmitObjCMR
RValue InitRV =
Runtime.GenerateMessageSend(*this, ReturnValueSlot(),
getContext().getObjCIdType(),
- InitSel, Receiver, Args);
+ InitSel, Receiver, Args);
return InitRV.getScalarVal();
}
@@ -2391,7 +2391,7 @@ void CodeGenFunction::EmitObjCMRRAutorel
Selector DrainSel = getContext().Selectors.getSelector(0, &II);
CallArgList Args;
CGM.getObjCRuntime().GenerateMessageSend(*this, ReturnValueSlot(),
- getContext().VoidTy, DrainSel, Arg, Args);
+ getContext().VoidTy, DrainSel, Arg, Args);
}
void CodeGenFunction::destroyARCStrongPrecise(CodeGenFunction &CGF,
@@ -2471,7 +2471,7 @@ static TryEmitResult tryEmitARCRetainLoa
e = e->IgnoreParens();
QualType type = e->getType();
- // If we're loading retained from a __strong xvalue, we can avoid
+ // If we're loading retained from a __strong xvalue, we can avoid
// an extra retain/release pair by zeroing out the source of this
// "move" operation.
if (e->isXValue() &&
@@ -2479,14 +2479,14 @@ static TryEmitResult tryEmitARCRetainLoa
type.getObjCLifetime() == Qualifiers::OCL_Strong) {
// Emit the lvalue.
LValue lv = CGF.EmitLValue(e);
-
+
// Load the object pointer.
llvm::Value *result = CGF.EmitLoadOfLValue(lv,
SourceLocation()).getScalarVal();
-
+
// Set the source pointer to NULL.
CGF.EmitStoreOfScalar(getNullForVariable(lv.getAddress()), lv);
-
+
return TryEmitResult(result, true);
}
@@ -3225,7 +3225,7 @@ CodeGenFunction::GenerateObjCAtomicSette
assert(PID->getSetterCXXAssignment() && "SetterCXXAssignment - null");
if ((HelperFn = CGM.getAtomicSetterHelperFnMap(Ty)))
return HelperFn;
-
+
ASTContext &C = getContext();
IdentifierInfo *II
= &CGM.getContext().Idents.get("__assign_helper_atomic_property_");
@@ -3241,7 +3241,7 @@ CodeGenFunction::GenerateObjCAtomicSette
QualType SrcTy = Ty;
SrcTy.addConst();
SrcTy = C.getPointerType(SrcTy);
-
+
FunctionArgList args;
ImplicitParamDecl DstDecl(getContext(), FD, SourceLocation(), /*Id=*/nullptr,
DestTy, ImplicitParamDecl::Other);
@@ -3254,7 +3254,7 @@ CodeGenFunction::GenerateObjCAtomicSette
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI);
-
+
llvm::Function *Fn =
llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
"__assign_helper_atomic_property_",
@@ -3263,23 +3263,23 @@ CodeGenFunction::GenerateObjCAtomicSette
CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);
StartFunction(FD, C.VoidTy, Fn, FI, args);
-
+
DeclRefExpr DstExpr(&DstDecl, false, DestTy,
VK_RValue, SourceLocation());
UnaryOperator DST(&DstExpr, UO_Deref, DestTy->getPointeeType(),
VK_LValue, OK_Ordinary, SourceLocation(), false);
-
+
DeclRefExpr SrcExpr(&SrcDecl, false, SrcTy,
VK_RValue, SourceLocation());
UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(),
VK_LValue, OK_Ordinary, SourceLocation(), false);
-
+
Expr *Args[2] = { &DST, &SRC };
CallExpr *CalleeExp = cast<CallExpr>(PID->getSetterCXXAssignment());
CXXOperatorCallExpr TheCall(C, OO_Equal, CalleeExp->getCallee(),
Args, DestTy->getPointeeType(),
VK_LValue, SourceLocation(), FPOptions());
-
+
EmitStmt(&TheCall);
FinishFunction();
@@ -3307,8 +3307,8 @@ CodeGenFunction::GenerateObjCAtomicGette
assert(PID->getGetterCXXConstructor() && "getGetterCXXConstructor - null");
if ((HelperFn = CGM.getAtomicGetterHelperFnMap(Ty)))
return HelperFn;
-
-
+
+
ASTContext &C = getContext();
IdentifierInfo *II
= &CGM.getContext().Idents.get("__copy_helper_atomic_property_");
@@ -3324,7 +3324,7 @@ CodeGenFunction::GenerateObjCAtomicGette
QualType SrcTy = Ty;
SrcTy.addConst();
SrcTy = C.getPointerType(SrcTy);
-
+
FunctionArgList args;
ImplicitParamDecl DstDecl(getContext(), FD, SourceLocation(), /*Id=*/nullptr,
DestTy, ImplicitParamDecl::Other);
@@ -3337,7 +3337,7 @@ CodeGenFunction::GenerateObjCAtomicGette
CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, args);
llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI);
-
+
llvm::Function *Fn =
llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
"__copy_helper_atomic_property_", &CGM.getModule());
@@ -3345,16 +3345,16 @@ CodeGenFunction::GenerateObjCAtomicGette
CGM.SetInternalFunctionAttributes(GlobalDecl(), Fn, FI);
StartFunction(FD, C.VoidTy, Fn, FI, args);
-
+
DeclRefExpr SrcExpr(&SrcDecl, false, SrcTy,
VK_RValue, SourceLocation());
-
+
UnaryOperator SRC(&SrcExpr, UO_Deref, SrcTy->getPointeeType(),
VK_LValue, OK_Ordinary, SourceLocation(), false);
-
- CXXConstructExpr *CXXConstExpr =
+
+ CXXConstructExpr *CXXConstExpr =
cast<CXXConstructExpr>(PID->getGetterCXXConstructor());
-
+
SmallVector<Expr*, 4> ConstructorArgs;
ConstructorArgs.push_back(&SRC);
ConstructorArgs.append(std::next(CXXConstExpr->arg_begin()),
@@ -3371,21 +3371,21 @@ CodeGenFunction::GenerateObjCAtomicGette
CXXConstExpr->requiresZeroInitialization(),
CXXConstExpr->getConstructionKind(),
SourceRange());
-
+
DeclRefExpr DstExpr(&DstDecl, false, DestTy,
VK_RValue, SourceLocation());
-
+
RValue DV = EmitAnyExpr(&DstExpr);
CharUnits Alignment
= getContext().getTypeAlignInChars(TheCXXConstructExpr->getType());
- EmitAggExpr(TheCXXConstructExpr,
+ EmitAggExpr(TheCXXConstructExpr,
AggValueSlot::forAddr(Address(DV.getScalarVal(), Alignment),
Qualifiers(),
AggValueSlot::IsDestructed,
AggValueSlot::DoesNotNeedGCBarriers,
AggValueSlot::IsNotAliased,
AggValueSlot::DoesNotOverlap));
-
+
FinishFunction();
HelperFn = llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
CGM.setAtomicGetterHelperFnMap(Ty, HelperFn);
Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon Jul 30 12:24:48 2018
@@ -114,7 +114,7 @@ protected:
/// contains the receiver (object) and the expected class.
llvm::StructType *ObjCSuperTy;
/// struct objc_super*. The type of the argument to the superclass message
- /// lookup functions.
+ /// lookup functions.
llvm::PointerType *PtrToObjCSuperTy;
/// LLVM type for selectors. Opaque pointer (i8*) unless a header declaring
/// SEL is included in a header somewhere, in which case it will be whatever
@@ -159,7 +159,7 @@ protected:
llvm::IntegerType *LongTy;
/// LLVM type for C size_t. Used in various runtime data structures.
llvm::IntegerType *SizeTy;
- /// LLVM type for C intptr_t.
+ /// LLVM type for C intptr_t.
llvm::IntegerType *IntPtrTy;
/// LLVM type for C ptrdiff_t. Mainly used in property accessor functions.
llvm::IntegerType *PtrDiffTy;
@@ -197,7 +197,7 @@ protected:
/// Helper function that generates a constant string and returns a pointer to
/// the start of the string. The result of this function can be used anywhere
- /// where the C code specifies const char*.
+ /// where the C code specifies const char*.
llvm::Constant *MakeConstantString(StringRef Str, const char *Name = "") {
ConstantAddress Array = CGM.GetAddrOfConstantCString(Str, Name);
return llvm::ConstantExpr::getGetElementPtr(Array.getElementType(),
@@ -243,7 +243,7 @@ protected:
return MakeConstantString(PD->getNameAsString());
}
- /// Push the property attributes into two structure fields.
+ /// Push the property attributes into two structure fields.
void PushPropertyAttributes(ConstantStructBuilder &Fields,
const ObjCPropertyDecl *property, bool isSynthesized=true, bool
isDynamic=true) {
@@ -377,7 +377,7 @@ protected:
/// Runtime functions used for memory management in GC mode. Note that clang
/// supports code generation for calling these functions, but neither GNU
/// runtime actually supports this API properly yet.
- LazyRuntimeFunction IvarAssignFn, StrongCastAssignFn, MemMoveFn, WeakReadFn,
+ LazyRuntimeFunction IvarAssignFn, StrongCastAssignFn, MemMoveFn, WeakReadFn,
WeakAssignFn, GlobalAssignFn;
typedef std::pair<std::string, std::string> ClassAliasPair;
@@ -554,7 +554,7 @@ protected:
/// stored in a 64-bit value with the low bit set to 1 and the remaining 63
/// bits set to their values, LSB first, while larger ones are stored in a
/// structure of this / form:
- ///
+ ///
/// struct { int32_t length; int32_t values[length]; };
///
/// The values in the array are stored in host-endian format, with the least
@@ -810,7 +810,7 @@ class CGObjCGNUstep : public CGObjCGNU {
// Slot_t objc_slot_lookup_super(struct objc_super*, SEL);
SlotLookupSuperFn.init(&CGM, "objc_slot_lookup_super", SlotTy,
PtrToObjCSuperTy, SelectorTy);
- // If we're in ObjC++ mode, then we want to make
+ // If we're in ObjC++ mode, then we want to make
if (CGM.getLangOpts().CPlusPlus) {
llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
// void *__cxa_begin_catch(void *e)
@@ -892,7 +892,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
static constexpr const char *const SelSection = "__objc_selectors";
/// The section for classes.
static constexpr const char *const ClsSection = "__objc_classes";
- /// The section for references to classes.
+ /// The section for references to classes.
static constexpr const char *const ClsRefSection = "__objc_class_refs";
/// The section for categories.
static constexpr const char *const CatSection = "__objc_cats";
@@ -956,8 +956,8 @@ class CGObjCGNUstep2 : public CGObjCGNUs
bool isNonASCII = SL->containsNonAscii();
- auto LiteralLength = SL->getLength();
-
+ auto LiteralLength = SL->getLength();
+
if ((CGM.getTarget().getPointerWidth(0) == 64) &&
(LiteralLength < 9) && !isNonASCII) {
// Tiny strings are only used on 64-bit platforms. They store 8 7-bit
@@ -1224,7 +1224,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
std::string Name = SymbolForProtocol(ProtocolName);
auto *GV = TheModule.getGlobalVariable(Name);
if (!GV) {
- // Emit a placeholder symbol.
+ // Emit a placeholder symbol.
GV = new llvm::GlobalVariable(TheModule, ProtocolTy, false,
llvm::GlobalValue::ExternalLinkage, nullptr, Name);
GV->setAlignment(CGM.getPointerAlign().getQuantity());
@@ -1281,7 +1281,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
return Protocol;
EmittedProtocol = true;
-
+
// Use the protocol definition, if there is one.
if (const ObjCProtocolDecl *Def = PD->getDefinition())
PD = Def;
@@ -1680,7 +1680,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
OffsetVar = new llvm::GlobalVariable(TheModule, IntTy,
false, llvm::GlobalValue::ExternalLinkage,
OffsetValue, OffsetName);
- auto ivarVisibility =
+ auto ivarVisibility =
(IVD->getAccessControl() == ObjCIvarDecl::Private ||
IVD->getAccessControl() == ObjCIvarDecl::Package ||
classDecl->getVisibility() == HiddenVisibility) ?
@@ -1700,14 +1700,14 @@ class CGObjCGNUstep2 : public CGObjCGNUs
// Bits 0-1 are ownership.
// Bit 2 indicates an extended type encoding
// Bits 3-8 contain log2(aligment)
- ivarBuilder.addInt(Int32Ty,
+ ivarBuilder.addInt(Int32Ty,
(align << 3) | (1<<2) |
FlagsForOwnership(ivarTy.getQualifiers().getObjCLifetime()));
ivarBuilder.finishAndAddTo(ivarArrayBuilder);
}
ivarArrayBuilder.finishAndAddTo(ivarListBuilder);
auto ivarList = ivarListBuilder.finishAndCreateGlobal(".objc_ivar_list",
- CGM.getPointerAlign(), /*constant*/ false,
+ CGM.getPointerAlign(), /*constant*/ false,
llvm::GlobalValue::PrivateLinkage);
classFields.add(ivarList);
}
@@ -2448,7 +2448,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFu
// returns. With GCC, this generates a random return value (whatever happens
// to be on the stack / in those registers at the time) on most platforms,
// and generates an illegal instruction trap on SPARC. With LLVM it corrupts
- // the stack.
+ // the stack.
bool isPointerSizedReturn = (ResultType->isAnyPointerType() ||
ResultType->isIntegralOrEnumerationType() || ResultType->isVoidType());
@@ -2461,7 +2461,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFu
messageBB = CGF.createBasicBlock("msgSend");
continueBB = CGF.createBasicBlock("continue");
- llvm::Value *isNil = Builder.CreateICmpEQ(Receiver,
+ llvm::Value *isNil = Builder.CreateICmpEQ(Receiver,
llvm::Constant::getNullValue(Receiver->getType()));
Builder.CreateCondBr(isNil, continueBB, messageBB);
CGF.EmitBlock(messageBB);
@@ -2495,7 +2495,7 @@ CGObjCGNU::GenerateMessageSend(CodeGenFu
// If we have non-legacy dispatch specified, we try using the objc_msgSend()
// functions. These are not supported on all platforms (or all runtimes on a
- // given platform), so we
+ // given platform), so we
switch (CGM.getCodeGenOpts().getObjCDispatchMethod()) {
case CodeGenOptions::Legacy:
imp = LookupIMP(CGF, Receiver, cmd, node, MSI);
@@ -2720,7 +2720,7 @@ llvm::Constant *CGObjCGNU::GenerateClass
// Fill in the structure
- // isa
+ // isa
Elements.addBitCast(MetaClass, PtrToInt8Ty);
// super_class
Elements.add(SuperClass);
@@ -2869,7 +2869,7 @@ CGObjCGNU::GenerateEmptyProtocol(StringR
void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
std::string ProtocolName = PD->getNameAsString();
-
+
// Use the protocol definition, if there is one.
if (const ObjCProtocolDecl *Def = PD->getDefinition())
PD = Def;
@@ -2977,7 +2977,7 @@ void CGObjCGNU::GenerateProtocolHolderCa
/// stored in a 64-bit value with the low bit set to 1 and the remaining 63
/// bits set to their values, LSB first, while larger ones are stored in a
/// structure of this / form:
-///
+///
/// struct { int32_t length; int32_t values[length]; };
///
/// The values in the array are stored in host-endian format, with the least
@@ -3200,7 +3200,7 @@ void CGObjCGNU::GenerateClass(const ObjC
}
// Get the size of instances.
- int instanceSize =
+ int instanceSize =
Context.getASTObjCImplementationLayout(OID).getSize().getQuantity();
// Collect information about instance variables.
@@ -3291,7 +3291,7 @@ void CGObjCGNU::GenerateClass(const ObjC
// Collect the same information about synthesized properties, which don't
// show up in the instance method lists.
for (auto *propertyImpl : OID->property_impls())
- if (propertyImpl->getPropertyImplementation() ==
+ if (propertyImpl->getPropertyImplementation() ==
ObjCPropertyImplDecl::Synthesize) {
ObjCPropertyDecl *property = propertyImpl->getPropertyDecl();
auto addPropertyMethod = [&](const ObjCMethodDecl *accessor) {
@@ -3718,7 +3718,7 @@ void CGObjCGNU::EmitTryStmt(CodeGenFunct
// interoperate very well with foreign exceptions.
//
// In Objective-C++ mode, we actually emit something equivalent to the C++
- // exception handler.
+ // exception handler.
EmitTryCatchStmt(CGF, S, EnterCatchFn, ExitCatchFn, ExceptionReThrowFn);
}
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Jul 30 12:24:48 2018
@@ -57,7 +57,7 @@ private:
// should always bitcast before calling them.
/// id objc_msgSend (id, SEL, ...)
- ///
+ ///
/// The default messenger, used for sends whose ABI is unchanged from
/// the all-integer/pointer case.
llvm::Constant *getMessageSendFn() const {
@@ -184,12 +184,12 @@ public:
/// SelectorPtrTy - LLVM type for selector handles (typeof(SEL))
llvm::PointerType *SelectorPtrTy;
-
+
private:
/// ProtocolPtrTy - LLVM type for external protocol handles
/// (typeof(Protocol))
llvm::Type *ExternalProtocolPtrTy;
-
+
public:
llvm::Type *getExternalProtocolPtrTy() {
if (!ExternalProtocolPtrTy) {
@@ -200,10 +200,10 @@ public:
llvm::Type *T = Types.ConvertType(Ctx.getObjCProtoType());
ExternalProtocolPtrTy = llvm::PointerType::getUnqual(T);
}
-
+
return ExternalProtocolPtrTy;
}
-
+
// SuperCTy - clang type for struct objc_super.
QualType SuperCTy;
// SuperPtrCTy - clang type for struct objc_super *.
@@ -231,7 +231,7 @@ public:
llvm::Type *CacheTy;
/// CachePtrTy - LLVM type for struct objc_cache *.
llvm::PointerType *CachePtrTy;
-
+
llvm::Constant *getGetPropertyFn() {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
ASTContext &Ctx = CGM.getContext();
@@ -269,15 +269,15 @@ public:
llvm::Constant *getOptimizedSetPropertyFn(bool atomic, bool copy) {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
ASTContext &Ctx = CGM.getContext();
- // void objc_setProperty_atomic(id self, SEL _cmd,
+ // void objc_setProperty_atomic(id self, SEL _cmd,
// id newValue, ptrdiff_t offset);
- // void objc_setProperty_nonatomic(id self, SEL _cmd,
+ // void objc_setProperty_nonatomic(id self, SEL _cmd,
// id newValue, ptrdiff_t offset);
- // void objc_setProperty_atomic_copy(id self, SEL _cmd,
+ // void objc_setProperty_atomic_copy(id self, SEL _cmd,
// id newValue, ptrdiff_t offset);
- // void objc_setProperty_nonatomic_copy(id self, SEL _cmd,
+ // void objc_setProperty_nonatomic_copy(id self, SEL _cmd,
// id newValue, ptrdiff_t offset);
-
+
SmallVector<CanQualType,4> Params;
CanQualType IdType = Ctx.getCanonicalParamType(Ctx.getObjCIdType());
CanQualType SelType = Ctx.getCanonicalParamType(Ctx.getObjCSelType());
@@ -297,10 +297,10 @@ public:
name = "objc_setProperty_nonatomic_copy";
else
name = "objc_setProperty_nonatomic";
-
+
return CGM.CreateRuntimeFunction(FTy, name);
}
-
+
llvm::Constant *getCopyStructFn() {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
ASTContext &Ctx = CGM.getContext();
@@ -316,10 +316,10 @@ public:
Types.arrangeBuiltinFunctionDeclaration(Ctx.VoidTy, Params));
return CGM.CreateRuntimeFunction(FTy, "objc_copyStruct");
}
-
+
/// This routine declares and returns address of:
/// void objc_copyCppObjectAtomic(
- /// void *dest, const void *src,
+ /// void *dest, const void *src,
/// void (*copyHelper) (void *dest, const void *source));
llvm::Constant *getCppAtomicObjectFunction() {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
@@ -334,7 +334,7 @@ public:
Types.arrangeBuiltinFunctionDeclaration(Ctx.VoidTy, Params));
return CGM.CreateRuntimeFunction(FTy, "objc_copyCppObjectAtomic");
}
-
+
llvm::Constant *getEnumerationMutationFn() {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
ASTContext &Ctx = CGM.getContext();
@@ -396,7 +396,7 @@ public:
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_assign_threadlocal");
}
-
+
/// GcAssignIvarFn -- LLVM objc_assign_ivar function.
llvm::Constant *getGcAssignIvarFn() {
// id objc_assign_ivar(id, id *, ptrdiff_t)
@@ -439,7 +439,7 @@ public:
llvm::FunctionType *FTy = llvm::FunctionType::get(CGM.VoidTy, false);
return CGM.CreateRuntimeFunction(FTy, "objc_exception_rethrow");
}
-
+
/// SyncEnterFn - LLVM object_sync_enter function.
llvm::Constant *getSyncEnterFn() {
// int objc_sync_enter (id)
@@ -550,7 +550,7 @@ public:
/// ExceptionDataTy - LLVM type for struct _objc_exception_data.
llvm::StructType *ExceptionDataTy;
-
+
/// ExceptionTryEnterFn - LLVM objc_exception_try_enter function.
llvm::Constant *getExceptionTryEnterFn() {
llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
@@ -727,7 +727,7 @@ public:
llvm::StructType *EHTypeTy;
llvm::Type *EHTypePtrTy;
-
+
ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm);
};
@@ -760,33 +760,33 @@ public:
/// to '\0'.
/// I != 0: Currently unused.
BLOCK_LAYOUT_OPERATOR = 0,
-
+
/// The next I+1 bytes do not contain a value of object pointer type.
/// Note that this can leave the stream unaligned, meaning that
/// subsequent word-size instructions do not begin at a multiple of
/// the pointer size.
BLOCK_LAYOUT_NON_OBJECT_BYTES = 1,
-
+
/// The next I+1 words do not contain a value of object pointer type.
/// This is simply an optimized version of BLOCK_LAYOUT_BYTES for
/// when the required skip quantity is a multiple of the pointer size.
BLOCK_LAYOUT_NON_OBJECT_WORDS = 2,
-
+
/// The next I+1 words are __strong pointers to Objective-C
/// objects or blocks.
BLOCK_LAYOUT_STRONG = 3,
-
+
/// The next I+1 words are pointers to __block variables.
BLOCK_LAYOUT_BYREF = 4,
-
+
/// The next I+1 words are __weak pointers to Objective-C
/// objects or blocks.
BLOCK_LAYOUT_WEAK = 5,
-
+
/// The next I+1 words are __unsafe_unretained pointers to
/// Objective-C objects or blocks.
BLOCK_LAYOUT_UNRETAINED = 6
-
+
/// The next I+1 words are block or object pointers with some
/// as-yet-unspecified ownership semantics. If we add more
/// flavors of ownership semantics, values will be taken from
@@ -795,11 +795,11 @@ public:
/// This is included so that older tools can at least continue
/// processing the layout past such things.
//BLOCK_LAYOUT_OWNERSHIP_UNKNOWN = 7..10,
-
+
/// All other opcodes are reserved. Halt interpretation and
/// treat everything else as opaque.
};
-
+
class RUN_SKIP {
public:
enum BLOCK_LAYOUT_OPCODE opcode;
@@ -809,13 +809,13 @@ public:
CharUnits BytePos = CharUnits::Zero(),
CharUnits Size = CharUnits::Zero())
: opcode(Opcode), block_var_bytepos(BytePos), block_var_size(Size) {}
-
+
// Allow sorting based on byte pos.
bool operator<(const RUN_SKIP &b) const {
return block_var_bytepos < b.block_var_bytepos;
}
};
-
+
protected:
llvm::LLVMContext &VMContext;
// FIXME! May not be needing this after all.
@@ -871,7 +871,7 @@ protected:
/// DefinedClasses - List of defined classes.
SmallVector<llvm::GlobalValue*, 16> DefinedClasses;
-
+
/// ImplementedClasses - List of @implemented classes.
SmallVector<const ObjCInterfaceDecl*, 16> ImplementedClasses;
@@ -952,28 +952,28 @@ protected:
bool hasMRCWeakIvars) {
return BuildIvarLayout(OI, beginOffset, endOffset, false, hasMRCWeakIvars);
}
-
+
Qualifiers::ObjCLifetime getBlockCaptureLifetime(QualType QT, bool ByrefLayout);
-
+
void UpdateRunSkipBlockVars(bool IsByref,
Qualifiers::ObjCLifetime LifeTime,
CharUnits FieldOffset,
CharUnits FieldSize);
-
+
void BuildRCBlockVarRecordLayout(const RecordType *RT,
CharUnits BytePos, bool &HasUnion,
bool ByrefLayout=false);
-
+
void BuildRCRecordLayout(const llvm::StructLayout *RecLayout,
const RecordDecl *RD,
ArrayRef<const FieldDecl*> RecFields,
CharUnits BytePos, bool &HasUnion,
bool ByrefLayout);
-
+
uint64_t InlineLayoutInstruction(SmallVectorImpl<unsigned char> &Layout);
-
+
llvm::Constant *getBitmapBlockLayout(bool ComputeByrefLayout);
-
+
/// GetIvarLayoutName - Returns a unique constant for the given
/// ivar layout bitmap.
llvm::Constant *GetIvarLayoutName(IdentifierInfo *Ident,
@@ -987,9 +987,9 @@ protected:
const ObjCCommonTypesHelper &ObjCTypes,
bool IsClassProperty);
- /// EmitProtocolMethodTypes - Generate the array of extended method type
+ /// EmitProtocolMethodTypes - Generate the array of extended method type
/// strings. The return value has type Int8PtrPtrTy.
- llvm::Constant *EmitProtocolMethodTypes(Twine Name,
+ llvm::Constant *EmitProtocolMethodTypes(Twine Name,
ArrayRef<llvm::Constant*> MethodTypes,
const ObjCCommonTypesHelper &ObjCTypes);
@@ -1205,7 +1205,7 @@ private:
/// for the given class.
llvm::Value *EmitClassRef(CodeGenFunction &CGF,
const ObjCInterfaceDecl *ID);
-
+
llvm::Value *EmitClassRefFromId(CodeGenFunction &CGF,
IdentifierInfo *II);
@@ -1382,7 +1382,7 @@ private:
/// DefinedMetaClasses - List of defined meta-classes.
std::vector<llvm::GlobalValue*> DefinedMetaClasses;
-
+
/// isVTableDispatchedSelector - Returns true if SEL is a
/// vtable-based selector.
bool isVTableDispatchedSelector(Selector Sel);
@@ -1453,7 +1453,7 @@ private:
bool IsSuper,
const CallArgList &CallArgs,
const ObjCMethodDecl *Method);
-
+
/// GetClassGlobal - Return the global variable for the Objective-C
/// class of the given name.
llvm::Constant *GetClassGlobal(StringRef Name,
@@ -1467,7 +1467,7 @@ private:
/// for the given class reference.
llvm::Value *EmitClassRef(CodeGenFunction &CGF,
const ObjCInterfaceDecl *ID);
-
+
llvm::Value *EmitClassRefFromId(CodeGenFunction &CGF,
IdentifierInfo *II,
const ObjCInterfaceDecl *ID);
@@ -1700,7 +1700,7 @@ struct NullReturnState {
// Okay, start emitting the null-receiver block.
CGF.EmitBlock(NullBB);
-
+
// Release any consumed arguments we've got.
if (Method) {
CallArgList::const_iterator I = CallArgs.begin();
@@ -1709,7 +1709,7 @@ struct NullReturnState {
const ParmVarDecl *ParamDecl = (*i);
if (ParamDecl->hasAttr<NSConsumedAttr>()) {
RValue RV = I->getRValue(CGF);
- assert(RV.isScalar() &&
+ assert(RV.isScalar() &&
"NullReturnState::complete - arg not on object");
CGF.EmitARCRelease(RV.getScalarVal(), ARCImpreciseLifetime);
}
@@ -1839,7 +1839,7 @@ llvm::Constant *CGObjCMac::GetEHType(Qua
}
if (T->isObjCObjectPointerType())
return CGM.GetAddrOfRTTIDescriptor(T, /*ForEH=*/true);
-
+
llvm_unreachable("asking for catch type for ObjC type in fragile runtime");
}
@@ -1898,8 +1898,8 @@ llvm::Constant *CGObjCNonFragileABIMac::
return cast<llvm::Constant>(V);
auto &StringClass = CGM.getLangOpts().ObjCConstantStringClass;
- std::string str =
- StringClass.empty() ? "OBJC_CLASS_$_NSConstantString"
+ std::string str =
+ StringClass.empty() ? "OBJC_CLASS_$_NSConstantString"
: "OBJC_CLASS_$_" + StringClass;
auto GV = GetClassGlobal(str, NotForDefinition);
@@ -2162,7 +2162,7 @@ CGObjCCommonMac::EmitMessageSend(CodeGen
if (RequiresNullCheck) {
nullReturn.init(CGF, Arg0);
}
-
+
llvm::Instruction *CallSite;
Fn = llvm::ConstantExpr::getBitCast(Fn, MSI.MessengerType);
CGCallee Callee = CGCallee::forDirect(Fn);
@@ -2202,17 +2202,17 @@ static Qualifiers::GC GetGCAttrTypeForTy
}
llvm_unreachable("bad objc ownership");
}
-
+
// Treat unqualified retainable pointers as strong.
if (FQT->isObjCObjectPointerType() || FQT->isBlockPointerType())
return Qualifiers::Strong;
-
+
// Walk into C pointer types, but only in GC.
if (Ctx.getLangOpts().getGC() != LangOptions::NonGC) {
if (const PointerType *PT = FQT->getAs<PointerType>())
return GetGCAttrTypeForType(Ctx, PT->getPointeeType(), /*pointee*/ true);
}
-
+
return Qualifiers::GCNone;
}
@@ -2258,7 +2258,7 @@ namespace {
void visitRecord(const RecordType *RT, CharUnits offset);
template <class Iterator, class GetOffsetFn>
- void visitAggregate(Iterator begin, Iterator end,
+ void visitAggregate(Iterator begin, Iterator end,
CharUnits aggrOffset,
const GetOffsetFn &getOffset);
@@ -2287,7 +2287,7 @@ namespace {
llvm::Constant *CGObjCCommonMac::BuildGCBlockLayout(CodeGenModule &CGM,
const CGBlockInfo &blockInfo) {
-
+
llvm::Constant *nullPtr = llvm::Constant::getNullValue(CGM.Int8PtrTy);
if (CGM.getLangOpts().getGC() == LangOptions::NonGC)
return nullPtr;
@@ -2306,7 +2306,7 @@ llvm::Constant *CGObjCCommonMac::BuildGC
printf("\n block variable layout for block: ");
builder.dump(buffer);
}
-
+
return C;
}
@@ -2351,7 +2351,7 @@ void IvarLayoutBuilder::visitBlock(const
visitRecord(record, fieldOffset);
continue;
}
-
+
Qualifiers::GC GCAttr = GetGCAttrTypeForType(CGM.getContext(), type);
if (GCAttr == Qualifiers::Strong) {
@@ -2374,11 +2374,11 @@ Qualifiers::ObjCLifetime CGObjCCommonMac
// If it doesn't, and this is ARC, it has no ownership.
if (CGM.getLangOpts().ObjCAutoRefCount)
return Qualifiers::OCL_None;
-
+
// In MRC, retainable pointers are owned by non-__block variables.
if (FQT->isObjCObjectPointerType() || FQT->isBlockPointerType())
return ByrefLayout ? Qualifiers::OCL_ExplicitNone : Qualifiers::OCL_Strong;
-
+
return Qualifiers::OCL_None;
}
@@ -2416,11 +2416,11 @@ void CGObjCCommonMac::BuildRCRecordLayou
const FieldDecl *LastFieldBitfieldOrUnnamed = nullptr;
CharUnits MaxFieldOffset = CharUnits::Zero();
CharUnits LastBitfieldOrUnnamedOffset = CharUnits::Zero();
-
+
if (RecFields.empty())
return;
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
-
+
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
const FieldDecl *Field = RecFields[i];
// Note that 'i' here is actually the field index inside RD of Field,
@@ -2428,7 +2428,7 @@ void CGObjCCommonMac::BuildRCRecordLayou
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
CharUnits FieldOffset =
CGM.getContext().toCharUnitsFromBits(RL.getFieldOffset(i));
-
+
// Skip over unnamed or bitfields
if (!Field->getIdentifier() || Field->isBitField()) {
LastFieldBitfieldOrUnnamed = Field;
@@ -2441,12 +2441,12 @@ void CGObjCCommonMac::BuildRCRecordLayou
if (FQT->isRecordType() || FQT->isUnionType()) {
if (FQT->isUnionType())
HasUnion = true;
-
+
BuildRCBlockVarRecordLayout(FQT->getAs<RecordType>(),
BytePos + FieldOffset, HasUnion);
continue;
}
-
+
if (const ArrayType *Array = CGM.getContext().getAsArrayType(FQT)) {
const ConstantArrayType *CArray =
dyn_cast_or_null<ConstantArrayType>(Array);
@@ -2464,7 +2464,7 @@ void CGObjCCommonMac::BuildRCRecordLayou
const RecordType *RT = FQT->getAs<RecordType>();
BuildRCBlockVarRecordLayout(RT, BytePos + FieldOffset,
HasUnion);
-
+
// Replicate layout information for each array element. Note that
// one element is already done.
uint64_t ElIx = 1;
@@ -2494,7 +2494,7 @@ void CGObjCCommonMac::BuildRCRecordLayou
FieldSize);
}
}
-
+
if (LastFieldBitfieldOrUnnamed) {
if (LastFieldBitfieldOrUnnamed->isBitField()) {
// Last field was a bitfield. Must update the info.
@@ -2521,7 +2521,7 @@ void CGObjCCommonMac::BuildRCRecordLayou
FieldSize);
}
}
-
+
if (MaxField)
UpdateRunSkipBlockVars(false,
getBlockCaptureLifetime(MaxField->getType(), ByrefLayout),
@@ -2538,7 +2538,7 @@ void CGObjCCommonMac::BuildRCBlockVarRec
llvm::Type *Ty = CGM.getTypes().ConvertType(QualType(RT, 0));
const llvm::StructLayout *RecLayout =
CGM.getDataLayout().getStructLayout(cast<llvm::StructType>(Ty));
-
+
BuildRCRecordLayout(RecLayout, RD, Fields, BytePos, HasUnion, ByrefLayout);
}
@@ -2580,7 +2580,7 @@ uint64_t CGObjCCommonMac::InlineLayoutIn
else
return 0;
break;
-
+
case 2:
inst = Layout[0];
opcode = (enum BLOCK_LAYOUT_OPCODE) (inst >> 4);
@@ -2607,7 +2607,7 @@ uint64_t CGObjCCommonMac::InlineLayoutIn
else
return 0;
break;
-
+
case 1:
inst = Layout[0];
opcode = (enum BLOCK_LAYOUT_OPCODE) (inst >> 4);
@@ -2620,20 +2620,20 @@ uint64_t CGObjCCommonMac::InlineLayoutIn
else
return 0;
break;
-
+
default:
return 0;
}
-
+
// Cannot inline when any of the word counts is 15. Because this is one less
// than the actual work count (so 15 means 16 actual word counts),
// and we can only display 0 thru 15 word counts.
if (strong_word_count == 16 || byref_word_count == 16 || weak_word_count == 16)
return 0;
-
+
unsigned count =
(strong_word_count != 0) + (byref_word_count != 0) + (weak_word_count != 0);
-
+
if (size == count) {
if (strong_word_count)
Result = strong_word_count;
@@ -2655,12 +2655,12 @@ llvm::Constant *CGObjCCommonMac::getBitm
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits;
-
+
// Sort on byte position; captures might not be allocated in order,
// and unions can do funny things.
llvm::array_pod_sort(RunSkipBlockVars.begin(), RunSkipBlockVars.end());
SmallVector<unsigned char, 16> Layout;
-
+
unsigned size = RunSkipBlockVars.size();
for (unsigned i = 0; i < size; i++) {
enum BLOCK_LAYOUT_OPCODE opcode = RunSkipBlockVars[i].opcode;
@@ -2689,7 +2689,7 @@ llvm::Constant *CGObjCCommonMac::getBitm
size_in_bytes -= residue_in_bytes;
opcode = BLOCK_LAYOUT_NON_OBJECT_WORDS;
}
-
+
unsigned size_in_words = size_in_bytes.getQuantity() / WordSizeInBytes;
while (size_in_words >= 16) {
// Note that value in imm. is one less that the actual
@@ -2710,7 +2710,7 @@ llvm::Constant *CGObjCCommonMac::getBitm
Layout.push_back(inst);
}
}
-
+
while (!Layout.empty()) {
unsigned char inst = Layout.back();
enum BLOCK_LAYOUT_OPCODE opcode = (enum BLOCK_LAYOUT_OPCODE) (inst >> 4);
@@ -2719,7 +2719,7 @@ llvm::Constant *CGObjCCommonMac::getBitm
else
break;
}
-
+
uint64_t Result = InlineLayoutInstruction(Layout);
if (Result != 0) {
// Block variable layout instruction has been inlined.
@@ -2739,13 +2739,13 @@ llvm::Constant *CGObjCCommonMac::getBitm
}
return llvm::ConstantInt::get(CGM.IntPtrTy, Result);
}
-
+
unsigned char inst = (BLOCK_LAYOUT_OPERATOR << 4) | 0;
Layout.push_back(inst);
std::string BitMap;
for (unsigned i = 0, e = Layout.size(); i != e; i++)
BitMap += Layout[i];
-
+
if (CGM.getLangOpts().ObjCGCBitmapPrint) {
if (ComputeByrefLayout)
printf("\n Byref variable layout: ");
@@ -2798,20 +2798,20 @@ llvm::Constant *CGObjCCommonMac::getBitm
llvm::Constant *CGObjCCommonMac::BuildRCBlockLayout(CodeGenModule &CGM,
const CGBlockInfo &blockInfo) {
assert(CGM.getLangOpts().getGC() == LangOptions::NonGC);
-
+
RunSkipBlockVars.clear();
bool hasUnion = false;
-
+
unsigned WordSizeInBits = CGM.getTarget().getPointerWidth(0);
unsigned ByteSizeInBits = CGM.getTarget().getCharWidth();
unsigned WordSizeInBytes = WordSizeInBits/ByteSizeInBits;
-
+
const BlockDecl *blockDecl = blockInfo.getBlockDecl();
-
+
// Calculate the basic layout of the block structure.
const llvm::StructLayout *layout =
CGM.getDataLayout().getStructLayout(blockInfo.StructureType);
-
+
// Ignore the optional 'this' capture: C++ objects are not assumed
// to be GC'ed.
if (blockInfo.BlockHeaderForcedGapSize != CharUnits::Zero())
@@ -2822,15 +2822,15 @@ llvm::Constant *CGObjCCommonMac::BuildRC
for (const auto &CI : blockDecl->captures()) {
const VarDecl *variable = CI.getVariable();
QualType type = variable->getType();
-
+
const CGBlockInfo::Capture &capture = blockInfo.getCapture(variable);
-
+
// Ignore constant captures.
if (capture.isConstant()) continue;
-
+
CharUnits fieldOffset =
CharUnits::fromQuantity(layout->getElementOffset(capture.getIndex()));
-
+
assert(!type->isArrayType() && "array variable should not be caught");
if (!CI.isByRef())
if (const RecordType *record = type->getAs<RecordType>()) {
@@ -2891,7 +2891,7 @@ void CGObjCCommonMac::GenerateProtocol(c
llvm::Constant *CGObjCCommonMac::GetProtocolRef(const ObjCProtocolDecl *PD) {
if (DefinedProtocols.count(PD->getIdentifier()))
return GetOrEmitProtocol(PD);
-
+
return GetOrEmitProtocolRef(PD);
}
@@ -3094,12 +3094,12 @@ CGObjCMac::EmitProtocolList(Twine name,
return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListPtrTy);
}
-static void
+static void
PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*,16> &PropertySet,
SmallVectorImpl<const ObjCPropertyDecl *> &Properties,
const ObjCProtocolDecl *Proto,
bool IsClassProperty) {
- for (const auto *P : Proto->protocols())
+ for (const auto *P : Proto->protocols())
PushProtocolProperties(PropertySet, Properties, P, IsClassProperty);
for (const auto *PD : Proto->properties()) {
@@ -3679,7 +3679,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(
auto countSlot = ivarList.addPlaceholder();
auto ivars = ivarList.beginArray(ObjCTypes.IvarTy);
- for (const ObjCIvarDecl *IVD = OID->all_declared_ivar_begin();
+ for (const ObjCIvarDecl *IVD = OID->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar()) {
// Ignore unnamed bit-fields.
if (!IVD->getDeclName())
@@ -3964,7 +3964,7 @@ llvm::Constant *CGObjCMac::GetPropertySe
return ObjCTypes.getSetPropertyFn();
}
-llvm::Constant *CGObjCMac::GetOptimizedPropertySetFunction(bool atomic,
+llvm::Constant *CGObjCMac::GetOptimizedPropertySetFunction(bool atomic,
bool copy) {
return ObjCTypes.getOptimizedSetPropertyFn(atomic, copy);
}
@@ -4959,9 +4959,9 @@ llvm::Constant *CGObjCMac::EmitModuleSym
llvm::Value *CGObjCMac::EmitClassRefFromId(CodeGenFunction &CGF,
IdentifierInfo *II) {
LazySymbols.insert(II);
-
+
llvm::GlobalVariable *&Entry = ClassReferences[II];
-
+
if (!Entry) {
llvm::Constant *Casted =
llvm::ConstantExpr::getBitCast(GetClassName(II->getName()),
@@ -4971,7 +4971,7 @@ llvm::Value *CGObjCMac::EmitClassRefFrom
"__OBJC,__cls_refs,literal_pointers,no_dead_strip",
CGM.getPointerAlign(), true);
}
-
+
return CGF.Builder.CreateAlignedLoad(Entry, CGF.getPointerAlign());
}
@@ -5056,7 +5056,7 @@ void IvarLayoutBuilder::visitRecord(cons
}
template <class Iterator, class GetOffsetFn>
-void IvarLayoutBuilder::visitAggregate(Iterator begin, Iterator end,
+void IvarLayoutBuilder::visitAggregate(Iterator begin, Iterator end,
CharUnits aggregateOffset,
const GetOffsetFn &getOffset) {
for (; begin != end; ++begin) {
@@ -5317,7 +5317,7 @@ CGObjCCommonMac::BuildIvarLayout(const O
// MRC weak layout strings follow the ARC style.
CharUnits baseOffset;
if (CGM.getLangOpts().getGC() == LangOptions::NonGC) {
- for (const ObjCIvarDecl *IVD = OI->all_declared_ivar_begin();
+ for (const ObjCIvarDecl *IVD = OI->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar())
ivars.push_back(IVD);
@@ -5353,7 +5353,7 @@ CGObjCCommonMac::BuildIvarLayout(const O
llvm::SmallVector<unsigned char, 4> buffer;
llvm::Constant *C = builder.buildBitmap(*this, buffer);
-
+
if (CGM.getLangOpts().ObjCGCBitmapPrint && !buffer.empty()) {
printf("\n%s ivar layout for class '%s': ",
ForStrongLayout ? "strong" : "weak",
@@ -5903,7 +5903,7 @@ ObjCNonFragileABITypesHelper::ObjCNonFra
// SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy);
-
+
// struct objc_typeinfo {
// const void** vtable; // objc_ehtype_vtable + 2
@@ -6033,7 +6033,7 @@ bool CGObjCNonFragileABIMac::isVTableDis
if (CGM.getLangOpts().getGC() != LangOptions::NonGC) {
VTableDispatchMethods.insert(GetNullarySelector("hash"));
VTableDispatchMethods.insert(GetUnarySelector("addObject"));
-
+
// "countByEnumeratingWithState:objects:count"
IdentifierInfo *KeyIdents[] = {
&CGM.getContext().Idents.get("countByEnumeratingWithState"),
@@ -6418,12 +6418,12 @@ llvm::Value *CGObjCNonFragileABIMac::Gen
void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
const ObjCInterfaceDecl *Interface = OCD->getClassInterface();
const char *Prefix = "\01l_OBJC_$_CATEGORY_";
-
+
llvm::SmallString<64> ExtCatName(Prefix);
ExtCatName += Interface->getObjCRuntimeNameAsString();
ExtCatName += "_$_";
ExtCatName += OCD->getNameAsString();
-
+
ConstantInitBuilder builder(CGM);
auto values = builder.beginStruct(ObjCTypes.CategorynfABITy);
values.add(GetClassName(OCD->getIdentifier()->getName()));
@@ -6684,7 +6684,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
// FIXME. Consolidate this with similar code in GenerateClass.
- for (const ObjCIvarDecl *IVD = OID->all_declared_ivar_begin();
+ for (const ObjCIvarDecl *IVD = OID->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar()) {
// Ignore unnamed bit-fields.
if (!IVD->getDeclName())
@@ -6785,7 +6785,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
// Use the protocol definition, if there is one.
if (const ObjCProtocolDecl *Def = PD->getDefinition())
PD = Def;
-
+
auto methodLists = ProtocolMethodLists::get(PD);
ConstantInitBuilder builder(CGM);
@@ -6824,7 +6824,7 @@ llvm::Constant *CGObjCNonFragileABIMac::
values.add(EmitPropertyList(
"\01l_OBJC_$_CLASS_PROP_LIST_" + PD->getObjCRuntimeNameAsString(),
nullptr, PD, ObjCTypes, true));
-
+
if (Entry) {
// Already created, fix the linkage and update the initializer.
Entry->setLinkage(llvm::GlobalValue::WeakAnyLinkage);
@@ -7058,7 +7058,7 @@ CGObjCNonFragileABIMac::EmitVTableMessag
messageRef->setVisibility(llvm::GlobalValue::HiddenVisibility);
messageRef->setSection(GetSectionName("__objc_msgrefs", "coalesced"));
}
-
+
bool requiresnullCheck = false;
if (CGM.getLangOpts().ObjCAutoRefCount && method)
for (const auto *ParamDecl : method->parameters()) {
@@ -7069,7 +7069,7 @@ CGObjCNonFragileABIMac::EmitVTableMessag
break;
}
}
-
+
Address mref =
Address(CGF.Builder.CreateBitCast(messageRef, ObjCTypes.MessageRefPtrTy),
CGF.getPointerAlign());
@@ -7153,7 +7153,7 @@ CGObjCNonFragileABIMac::EmitClassRefFrom
const ObjCInterfaceDecl *ID) {
CharUnits Align = CGF.getPointerAlign();
llvm::GlobalVariable *&Entry = ClassReferences[II];
-
+
if (!Entry) {
llvm::Constant *ClassGV;
if (ID) {
@@ -7243,7 +7243,7 @@ llvm::Value *CGObjCNonFragileABIMac::Get
assert(!isa<llvm::GlobalVariable>(ClassGV) ||
cast<llvm::GlobalVariable>(ClassGV)->hasExternalWeakLinkage());
}
-
+
return EmitClassRef(CGF, ID);
}
@@ -7304,7 +7304,7 @@ llvm::Value *CGObjCNonFragileABIMac::Emi
Address Addr = EmitSelectorAddr(CGF, Sel);
llvm::LoadInst* LI = CGF.Builder.CreateLoad(Addr);
- LI->setMetadata(CGM.getModule().getMDKindID("invariant.load"),
+ LI->setMetadata(CGM.getModule().getMDKindID("invariant.load"),
llvm::MDNode::get(VMContext, None));
return LI;
}
Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp Mon Jul 30 12:24:48 2018
@@ -181,7 +181,7 @@ void CGObjCRuntime::EmitTryCatchStmt(Cod
for (unsigned I = 0, E = Handlers.size(); I != E; ++I)
Catch->setHandler(I, Handlers[I].TypeInfo, Handlers[I].Block);
}
-
+
// Emit the try body.
CGF.EmitStmt(S.getTryBody());
@@ -232,7 +232,7 @@ void CGObjCRuntime::EmitTryCatchStmt(Cod
cleanups.ForceCleanup();
CGF.EmitBranchThroughCleanup(Cont);
- }
+ }
// Go back to the try-statement fallthrough.
CGF.Builder.restoreIP(SavedIP);
Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Mon Jul 30 12:24:48 2018
@@ -143,7 +143,7 @@ public:
/// Generate a constant string object.
virtual ConstantAddress GenerateConstantString(const StringLiteral *) = 0;
-
+
/// Generate a category. A category contains a list of methods (and
/// accompanying metadata) and a list of protocols.
virtual void GenerateCategory(const ObjCCategoryImplDecl *OCD) = 0;
@@ -211,7 +211,7 @@ public:
virtual llvm::Constant *GetPropertySetFunction() = 0;
/// Return the runtime function for optimized setting properties.
- virtual llvm::Constant *GetOptimizedPropertySetFunction(bool atomic,
+ virtual llvm::Constant *GetOptimizedPropertySetFunction(bool atomic,
bool copy) = 0;
// API for atomic copying of qualified aggregates in getter.
@@ -224,17 +224,17 @@ public:
/// API for atomic copying of qualified aggregates with non-trivial copy
/// assignment (c++) in getter.
virtual llvm::Constant *GetCppAtomicObjectGetFunction() = 0;
-
+
/// GetClass - Return a reference to the class for the given
/// interface decl.
virtual llvm::Value *GetClass(CodeGenFunction &CGF,
const ObjCInterfaceDecl *OID) = 0;
-
-
+
+
virtual llvm::Value *EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) {
llvm_unreachable("autoreleasepool unsupported in this ABI");
}
-
+
/// EnumerationMutationFunction - Return the function that's called by the
/// compiler when a mutation is detected during foreach iteration.
virtual llvm::Constant *EnumerationMutationFunction() = 0;
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Mon Jul 30 12:24:48 2018
@@ -166,7 +166,7 @@ struct CGRecordLowering {
return Layout.getFieldOffset(FD->getFieldIndex());
}
// Layout routines.
- void setBitFieldInfo(const FieldDecl *FD, CharUnits StartOffset,
+ void setBitFieldInfo(const FieldDecl *FD, CharUnits StartOffset,
llvm::Type *StorageType);
/// Lowers an ASTRecordLayout to a llvm type.
void lower(bool NonVirtualBaseType);
@@ -246,7 +246,7 @@ void CGRecordLowering::lower(bool NVBase
// 1) Store all members (fields and bases) in a list and sort them by offset.
// 2) Add a 1-byte capstone member at the Size of the structure.
// 3) Clip bitfield storages members if their tail padding is or might be
- // used by another field or base. The clipping process uses the capstone
+ // used by another field or base. The clipping process uses the capstone
// by treating it as another object that occurs after the record.
// 4) Determine if the llvm-struct requires packing. It's important that this
// phase occur after clipping, because clipping changes the llvm type.
@@ -436,7 +436,7 @@ CGRecordLowering::accumulateBitFields(Re
StartBitOffset = getFieldBitOffset(*Field);
Tail = StartBitOffset + Field->getBitWidthValue(Context);
StartFieldAsSingleRun = IsBetterAsSingleFieldRun(Tail - StartBitOffset,
- StartBitOffset);
+ StartBitOffset);
}
++Field;
continue;
@@ -686,7 +686,7 @@ CGBitFieldInfo CGBitFieldInfo::MakeInfo(
uint64_t Offset, uint64_t Size,
uint64_t StorageSize,
CharUnits StorageOffset) {
- // This function is vestigial from CGRecordLayoutBuilder days but is still
+ // This function is vestigial from CGRecordLayoutBuilder days but is still
// used in GCObjCRuntime.cpp. That usage has a "fixme" attached to it that
// when addressed will allow for the removal of this function.
llvm::Type *Ty = Types.ConvertTypeForMem(FD->getType());
@@ -781,14 +781,14 @@ CGRecordLayout *CodeGenTypes::ComputeRec
if (BaseTy) {
CharUnits NonVirtualSize = Layout.getNonVirtualSize();
- uint64_t AlignedNonVirtualTypeSizeInBits =
+ uint64_t AlignedNonVirtualTypeSizeInBits =
getContext().toBits(NonVirtualSize);
- assert(AlignedNonVirtualTypeSizeInBits ==
+ assert(AlignedNonVirtualTypeSizeInBits ==
getDataLayout().getTypeAllocSizeInBits(BaseTy) &&
"Type size mismatch!");
}
-
+
// Verify that the LLVM and AST field offsets agree.
llvm::StructType *ST = RL->getLLVMType();
const llvm::StructLayout *SL = getDataLayout().getStructLayout(ST);
@@ -806,7 +806,7 @@ CGRecordLayout *CodeGenTypes::ComputeRec
"Invalid field offset!");
continue;
}
-
+
// Ignore unnamed bit-fields.
if (!FD->getDeclName())
continue;
@@ -853,7 +853,7 @@ void CGRecordLayout::print(raw_ostream &
OS << "<CGRecordLayout\n";
OS << " LLVMType:" << *CompleteObjectType << "\n";
if (BaseSubobjectType)
- OS << " NonVirtualBaseLLVMType:" << *BaseSubobjectType << "\n";
+ OS << " NonVirtualBaseLLVMType:" << *BaseSubobjectType << "\n";
OS << " IsZeroInitializable:" << IsZeroInitializable << "\n";
OS << " BitFields:[\n";
Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Mon Jul 30 12:24:48 2018
@@ -30,8 +30,8 @@ GetAddrOfVTTVTable(CodeGenVTables &CGVT,
// This is a regular vtable.
return CGM.getCXXABI().getAddrOfVTable(MostDerivedClass, CharUnits());
}
-
- return CGVT.GenerateConstructionVTable(MostDerivedClass,
+
+ return CGVT.GenerateConstructionVTable(MostDerivedClass,
VTable.getBaseSubobject(),
VTable.isVirtual(),
Linkage,
@@ -45,7 +45,7 @@ CodeGenVTables::EmitVTTDefinition(llvm::
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/true);
llvm::Type *Int8PtrTy = CGM.Int8PtrTy, *Int32Ty = CGM.Int32Ty;
- llvm::ArrayType *ArrayType =
+ llvm::ArrayType *ArrayType =
llvm::ArrayType::get(Int8PtrTy, Builder.getVTTComponents().size());
SmallVector<llvm::GlobalVariable *, 8> VTables;
@@ -117,42 +117,42 @@ llvm::GlobalVariable *CodeGenVTables::Ge
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
- llvm::ArrayType *ArrayType =
+ llvm::ArrayType *ArrayType =
llvm::ArrayType::get(CGM.Int8PtrTy, Builder.getVTTComponents().size());
llvm::GlobalVariable *GV =
- CGM.CreateOrReplaceCXXRuntimeVariable(Name, ArrayType,
+ CGM.CreateOrReplaceCXXRuntimeVariable(Name, ArrayType,
llvm::GlobalValue::ExternalLinkage);
GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
return GV;
}
-uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD,
+uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD,
BaseSubobject Base) {
BaseSubobjectPairTy ClassSubobjectPair(RD, Base);
SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassSubobjectPair);
if (I != SubVTTIndicies.end())
return I->second;
-
+
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
- Builder.getSubVTTIndicies().begin(),
+ Builder.getSubVTTIndicies().begin(),
E = Builder.getSubVTTIndicies().end(); I != E; ++I) {
// Insert all indices.
BaseSubobjectPairTy ClassSubobjectPair(RD, I->first);
-
+
SubVTTIndicies.insert(std::make_pair(ClassSubobjectPair, I->second));
}
-
+
I = SubVTTIndicies.find(ClassSubobjectPair);
assert(I != SubVTTIndicies.end() && "Did not find index!");
-
+
return I->second;
}
-uint64_t
+uint64_t
CodeGenVTables::getSecondaryVirtualPointerIndex(const CXXRecordDecl *RD,
BaseSubobject Base) {
SecondaryVirtualPointerIndicesMapTy::iterator I =
@@ -164,17 +164,17 @@ CodeGenVTables::getSecondaryVirtualPoint
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
// Insert all secondary vpointer indices.
- for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
+ for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
Builder.getSecondaryVirtualPointerIndices().begin(),
E = Builder.getSecondaryVirtualPointerIndices().end(); I != E; ++I) {
std::pair<const CXXRecordDecl *, BaseSubobject> Pair =
std::make_pair(RD, I->first);
-
+
SecondaryVirtualPointerIndices.insert(std::make_pair(Pair, I->second));
}
I = SecondaryVirtualPointerIndices.find(std::make_pair(RD, Base));
assert(I != SecondaryVirtualPointerIndices.end() && "Did not find index!");
-
+
return I->second;
}
Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Mon Jul 30 12:24:48 2018
@@ -110,7 +110,7 @@ static RValue PerformReturnAdjustment(Co
return RValue::get(ReturnValue);
}
-/// This function clones a function's DISubprogram node and enters it into
+/// This function clones a function's DISubprogram node and enters it into
/// a value map with the intent that the map can be utilized by the cloner
/// to short-circuit Metadata node mapping.
/// Furthermore, the function resolves any DILocalVariable nodes referenced
Modified: cfe/trunk/lib/CodeGen/CGVTables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.h (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.h Mon Jul 30 12:24:48 2018
@@ -40,7 +40,7 @@ class CodeGenVTables {
typedef std::pair<const CXXRecordDecl *, BaseSubobject> BaseSubobjectPairTy;
typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> SubVTTIndiciesMapTy;
-
+
/// SubVTTIndicies - Contains indices into the various sub-VTTs.
SubVTTIndiciesMapTy SubVTTIndicies;
@@ -87,21 +87,21 @@ public:
/// getSubVTTIndex - Return the index of the sub-VTT for the base class of the
/// given record decl.
uint64_t getSubVTTIndex(const CXXRecordDecl *RD, BaseSubobject Base);
-
+
/// getSecondaryVirtualPointerIndex - Return the index in the VTT where the
/// virtual pointer for the given subobject is located.
uint64_t getSecondaryVirtualPointerIndex(const CXXRecordDecl *RD,
BaseSubobject Base);
- /// GenerateConstructionVTable - Generate a construction vtable for the given
+ /// GenerateConstructionVTable - Generate a construction vtable for the given
/// base subobject.
llvm::GlobalVariable *
- GenerateConstructionVTable(const CXXRecordDecl *RD, const BaseSubobject &Base,
- bool BaseIsVirtual,
+ GenerateConstructionVTable(const CXXRecordDecl *RD, const BaseSubobject &Base,
+ bool BaseIsVirtual,
llvm::GlobalVariable::LinkageTypes Linkage,
VTableAddressPointsMapTy& AddressPoints);
-
+
/// GetAddrOfVTT - Get the address of the VTT for the given record decl.
llvm::GlobalVariable *GetAddrOfVTT(const CXXRecordDecl *RD);
@@ -112,7 +112,7 @@ public:
/// EmitThunks - Emit the associated thunks for the given global decl.
void EmitThunks(GlobalDecl GD);
-
+
/// GenerateClassData - Generate all the class data required to be
/// generated upon definition of a KeyFunction. This includes the
/// vtable, the RTTI data structure (if RTTI is enabled) and the VTT
Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Mon Jul 30 12:24:48 2018
@@ -197,7 +197,7 @@ class LValue {
// objective-c's ivar
bool Ivar:1;
-
+
// objective-c's ivar is an array
bool ObjIsArray:1;
@@ -207,7 +207,7 @@ class LValue {
// Lvalue is a global reference of an objective-c object
bool GlobalObjCRef : 1;
-
+
// Lvalue is a thread local reference
bool ThreadLocalRef : 1;
@@ -301,7 +301,7 @@ public:
bool isVolatile() const {
return Quals.hasVolatile();
}
-
+
Expr *getBaseIvarExp() const { return BaseIvarExp; }
void setBaseIvarExp(Expr *V) { BaseIvarExp = V; }
@@ -452,7 +452,7 @@ class AggValueSlot {
/// slot might require calling an appropriate Objective-C GC
/// barrier. The exact interaction here is unnecessarily mysterious.
bool ObjCGCFlag : 1;
-
+
/// ZeroedFlag - This is set to true if the memory in the slot is
/// known to be zero before the assignment into it. This means that
/// zero fields don't need to be set.
@@ -472,7 +472,7 @@ class AggValueSlot {
/// evaluating an expression which constructs such an object.
bool AliasedFlag : 1;
- /// This is set to true if the tail padding of this slot might overlap
+ /// This is set to true if the tail padding of this slot might overlap
/// another object that may have already been initialized (and whose
/// value must be preserved by this initialization). If so, we may only
/// store up to the dsize of the type. Otherwise we can widen stores to
@@ -564,7 +564,7 @@ public:
void setVolatile(bool flag) {
Quals.setVolatile(flag);
}
-
+
Qualifiers::ObjCLifetime getObjCLifetime() const {
return Quals.getObjCLifetime();
}
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Mon Jul 30 12:24:48 2018
@@ -51,7 +51,7 @@ namespace clang {
public:
ClangDiagnosticHandler(const CodeGenOptions &CGOpts, BackendConsumer *BCon)
: CodeGenOpts(CGOpts), BackendCon(BCon) {}
-
+
bool handleDiagnostics(const DiagnosticInfo &DI) override;
bool isAnalysisRemarkEnabled(StringRef PassName) const override {
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jul 30 12:24:48 2018
@@ -1431,7 +1431,7 @@ void CodeGenModule::setNonAliasAttribute
F->addAttributes(llvm::AttributeList::FunctionIndex, Attrs);
}
}
-
+
if (const auto *CSA = D->getAttr<CodeSegAttr>())
GO->setSection(CSA->getName());
else if (const auto *SA = D->getAttr<SectionAttr>())
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Mon Jul 30 12:24:48 2018
@@ -280,14 +280,14 @@ private:
llvm::LLVMContext &VMContext;
std::unique_ptr<CodeGenTBAA> TBAA;
-
+
mutable std::unique_ptr<TargetCodeGenInfo> TheTargetCodeGenInfo;
-
+
// This should not be moved earlier, since its initialization depends on some
// of the previous reference members being already initialized and also checks
// if TheTargetCodeGenInfo is NULL
CodeGenTypes Types;
-
+
/// Holds information about C++ vtables.
CodeGenVTables VTables;
@@ -415,7 +415,7 @@ private:
/// order. Once the decl is emitted, the index is replaced with ~0U to ensure
/// that we don't re-emit the initializer.
llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
-
+
typedef std::pair<OrderGlobalInits, llvm::Function*> GlobalInitData;
struct GlobalInitPriorityCmp {
@@ -452,7 +452,7 @@ private:
/// The type used to describe the state of a fast enumeration in
/// Objective-C's for..in loop.
QualType ObjCFastEnumerationStateType;
-
+
/// @}
/// Lazily create the Objective-C runtime
@@ -576,7 +576,7 @@ public:
llvm::Constant *getStaticLocalDeclAddress(const VarDecl *D) {
return StaticLocalDeclMap[D];
}
- void setStaticLocalDeclAddress(const VarDecl *D,
+ void setStaticLocalDeclAddress(const VarDecl *D,
llvm::Constant *C) {
StaticLocalDeclMap[D] = C;
}
@@ -588,7 +588,7 @@ public:
llvm::GlobalVariable *getStaticLocalDeclGuardAddress(const VarDecl *D) {
return StaticLocalDeclGuardMap[D];
}
- void setStaticLocalDeclGuardAddress(const VarDecl *D,
+ void setStaticLocalDeclGuardAddress(const VarDecl *D,
llvm::GlobalVariable *C) {
StaticLocalDeclGuardMap[D] = C;
}
@@ -649,10 +649,10 @@ public:
bool shouldUseTBAA() const { return TBAA != nullptr; }
- const TargetCodeGenInfo &getTargetCodeGenInfo();
-
+ const TargetCodeGenInfo &getTargetCodeGenInfo();
+
CodeGenTypes &getTypes() { return Types; }
-
+
CodeGenVTables &getVTables() { return VTables; }
ItaniumVTableContext &getItaniumVTableContext() {
@@ -852,7 +852,7 @@ public:
/// Fetches the global unique block count.
int getUniqueBlockCount() { return ++Block.GlobalUniqueCount; }
-
+
/// Fetches the type of a generic block descriptor.
llvm::Type *getBlockDescriptorType();
@@ -871,7 +871,7 @@ public:
/// Notes that BE's global block is available via Addr. Asserts that BE
/// isn't already emitted.
void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr);
-
+
/// Return a pointer to a constant CFString object for the given string.
ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal);
@@ -1139,7 +1139,7 @@ public:
/// Return the store size, in character units, of the given LLVM type.
CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const;
-
+
/// Returns LLVM linkage for a declarator.
llvm::GlobalValue::LinkageTypes
getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage,
@@ -1316,7 +1316,7 @@ private:
void emitCPUDispatchDefinition(GlobalDecl GD);
void EmitObjCPropertyImplementations(const ObjCImplementationDecl *D);
void EmitObjCIvarInitializations(ObjCImplementationDecl *D);
-
+
// C++ related functions.
void EmitDeclContext(const DeclContext *DC);
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Mon Jul 30 12:24:48 2018
@@ -54,7 +54,7 @@ void CodeGenTypes::addRecordTypeName(con
SmallString<256> TypeName;
llvm::raw_svector_ostream OS(TypeName);
OS << RD->getKindName() << '.';
-
+
// Name the codegen type after the typedef name
// if there is no tag type name available
if (RD->getIdentifier()) {
@@ -100,7 +100,7 @@ llvm::Type *CodeGenTypes::ConvertTypeFor
/// isRecordLayoutComplete - Return true if the specified type is already
/// completely laid out.
bool CodeGenTypes::isRecordLayoutComplete(const Type *Ty) const {
- llvm::DenseMap<const Type*, llvm::StructType *>::const_iterator I =
+ llvm::DenseMap<const Type*, llvm::StructType *>::const_iterator I =
RecordDeclTypes.find(Ty);
return I != RecordDeclTypes.end() && !I->second->isOpaque();
}
@@ -113,7 +113,7 @@ isSafeToConvert(QualType T, CodeGenTypes
/// isSafeToConvert - Return true if it is safe to convert the specified record
/// decl to IR and lay it out, false if doing so would cause us to get into a
/// recursive compilation mess.
-static bool
+static bool
isSafeToConvert(const RecordDecl *RD, CodeGenTypes &CGT,
llvm::SmallPtrSet<const RecordDecl*, 16> &AlreadyChecked) {
// If we have already checked this type (maybe the same type is used by-value
@@ -122,14 +122,14 @@ isSafeToConvert(const RecordDecl *RD, Co
return true;
const Type *Key = CGT.getContext().getTagDeclType(RD).getTypePtr();
-
+
// If this type is already laid out, converting it is a noop.
if (CGT.isRecordLayoutComplete(Key)) return true;
-
+
// If this type is currently being laid out, we can't recursively compile it.
if (CGT.isRecordBeingLaidOut(Key))
return false;
-
+
// If this type would require laying out bases that are currently being laid
// out, don't do it. This includes virtual base classes which get laid out
// when a class is translated, even though they aren't embedded by-value into
@@ -140,13 +140,13 @@ isSafeToConvert(const RecordDecl *RD, Co
CGT, AlreadyChecked))
return false;
}
-
+
// If this type would require laying out members that are currently being laid
// out, don't do it.
for (const auto *I : RD->fields())
if (!isSafeToConvert(I->getType(), CGT, AlreadyChecked))
return false;
-
+
// If there are no problems, lets do it.
return true;
}
@@ -170,7 +170,7 @@ isSafeToConvert(QualType T, CodeGenTypes
return isSafeToConvert(AT->getElementType(), CGT, AlreadyChecked);
// Otherwise, there is no concern about transforming this. We only care about
- // things that are contained by-value in a structure that can have another
+ // things that are contained by-value in a structure that can have another
// structure as a member.
return true;
}
@@ -182,7 +182,7 @@ isSafeToConvert(QualType T, CodeGenTypes
static bool isSafeToConvert(const RecordDecl *RD, CodeGenTypes &CGT) {
// If no structs are being laid out, we can certainly do this one.
if (CGT.noRecordsBeingLaidOut()) return true;
-
+
llvm::SmallPtrSet<const RecordDecl*, 16> AlreadyChecked;
return isSafeToConvert(RD, CGT, AlreadyChecked);
}
@@ -229,7 +229,7 @@ bool CodeGenTypes::isFuncParamTypeConver
bool CodeGenTypes::isFuncTypeConvertible(const FunctionType *FT) {
if (!isFuncParamTypeConvertible(FT->getReturnType()))
return false;
-
+
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT))
for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
if (!isFuncParamTypeConvertible(FPT->getParamType(i)))
@@ -259,7 +259,7 @@ void CodeGenTypes::UpdateCompletedType(c
DI->completeType(ED);
return;
}
-
+
// If we completed a RecordDecl that we previously used and converted to an
// anonymous type, then go ahead and complete it now.
const RecordDecl *RD = cast<RecordDecl>(TD);
@@ -388,7 +388,7 @@ llvm::Type *CodeGenTypes::ConvertType(Qu
// RecordTypes are cached and processed specially.
if (const RecordType *RT = dyn_cast<RecordType>(Ty))
return ConvertRecordDeclType(RT->getDecl());
-
+
// See if type is already cached.
llvm::DenseMap<const Type *, llvm::Type *>::iterator TCI = TypeCache.find(Ty);
// If type is found in map then use it. Otherwise, convert type T.
@@ -494,7 +494,7 @@ llvm::Type *CodeGenTypes::ConvertType(Qu
// Model std::nullptr_t as i8*
ResultType = llvm::Type::getInt8PtrTy(getLLVMContext());
break;
-
+
case BuiltinType::UInt128:
case BuiltinType::Int128:
ResultType = llvm::IntegerType::get(getLLVMContext(), 128);
@@ -510,7 +510,7 @@ llvm::Type *CodeGenTypes::ConvertType(Qu
case BuiltinType::OCLReserveID:
ResultType = CGM.getOpenCLRuntime().convertOpenCLSpecificType(Ty);
break;
-
+
case BuiltinType::Dependent:
#define BUILTIN_TYPE(Id, SingletonId)
#define PLACEHOLDER_TYPE(Id, SingletonId) \
@@ -574,8 +574,8 @@ llvm::Type *CodeGenTypes::ConvertType(Qu
case Type::ConstantArray: {
const ConstantArrayType *A = cast<ConstantArrayType>(Ty);
llvm::Type *EltTy = ConvertTypeForMem(A->getElementType());
-
- // Lower arrays of undefined struct type to arrays of i8 just to have a
+
+ // Lower arrays of undefined struct type to arrays of i8 just to have a
// concrete type.
if (!EltTy->isSized()) {
SkippedLayout = true;
@@ -674,9 +674,9 @@ llvm::Type *CodeGenTypes::ConvertType(Qu
break;
}
}
-
+
assert(ResultType && "Didn't convert a type?");
-
+
TypeCache[Ty] = ResultType;
return ResultType;
}
@@ -709,7 +709,7 @@ llvm::StructType *CodeGenTypes::ConvertR
RD = RD->getDefinition();
if (!RD || !RD->isCompleteDefinition() || !Ty->isOpaque())
return Ty;
-
+
// If converting this type would cause us to infinitely loop, don't do it!
if (!isSafeToConvert(RD, *this)) {
DeferredRecords.push_back(RD);
@@ -720,12 +720,12 @@ llvm::StructType *CodeGenTypes::ConvertR
bool InsertResult = RecordsBeingLaidOut.insert(Key).second;
(void)InsertResult;
assert(InsertResult && "Recursively compiling a struct?");
-
+
// Force conversion of non-virtual base classes recursively.
if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
for (const auto &I : CRD->bases()) {
if (I.isVirtual()) continue;
-
+
ConvertRecordDeclType(I.getType()->getAs<RecordType>()->getDecl());
}
}
@@ -737,13 +737,13 @@ llvm::StructType *CodeGenTypes::ConvertR
// We're done laying out this struct.
bool EraseResult = RecordsBeingLaidOut.erase(Key); (void)EraseResult;
assert(EraseResult && "struct not in RecordsBeingLaidOut set?");
-
+
// If this struct blocked a FunctionType conversion, then recompute whatever
// was derived from that.
// FIXME: This is hugely overconservative.
if (SkippedLayout)
TypeCache.clear();
-
+
// If we're done converting the outer-most record, then convert any deferred
// structs as well.
if (RecordsBeingLaidOut.empty())
@@ -799,7 +799,7 @@ bool CodeGenTypes::isZeroInitializable(Q
// We have to ask the ABI about member pointers.
if (const MemberPointerType *MPT = T->getAs<MemberPointerType>())
return getCXXABI().isZeroInitializable(MPT);
-
+
// Everything else is okay.
return true;
}
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Mon Jul 30 12:24:48 2018
@@ -140,7 +140,7 @@ class CodeGenTypes {
/// Contains the LLVM IR type for any converted RecordDecl.
llvm::DenseMap<const Type*, llvm::StructType *> RecordDeclTypes;
-
+
/// Hold memoized CGFunctionInfo results.
llvm::FoldingSet<CGFunctionInfo> FunctionInfos;
@@ -149,15 +149,15 @@ class CodeGenTypes {
/// struct A { struct B { int x; } } when processing 'x', the 'A' and 'B'
/// types will be in this set.
llvm::SmallPtrSet<const Type*, 4> RecordsBeingLaidOut;
-
+
llvm::SmallPtrSet<const CGFunctionInfo*, 4> FunctionsBeingProcessed;
-
+
/// True if we didn't layout a function due to a being inside
/// a recursive struct conversion, set this to true.
bool SkippedLayout;
SmallVector<const RecordDecl *, 8> DeferredRecords;
-
+
/// This map keeps cache of llvm::Types and maps clang::Type to
/// corresponding llvm::Type.
llvm::DenseMap<const Type *, llvm::Type *> TypeCache;
@@ -343,7 +343,7 @@ public:
/// optional suffix and name the given LLVM type using it.
void addRecordTypeName(const RecordDecl *RD, llvm::StructType *Ty,
StringRef suffix);
-
+
public: // These are internal details of CGT that shouldn't be used externally.
/// ConvertRecordDeclType - Lay out a tagged decl type like struct or union.
@@ -365,7 +365,7 @@ public: // These are internal details o
/// IsZeroInitializable - Return whether a record type can be
/// zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
bool isZeroInitializable(const RecordDecl *RD);
-
+
bool isRecordLayoutComplete(const Type *Ty) const;
bool noRecordsBeingLaidOut() const {
return RecordsBeingLaidOut.empty();
@@ -373,7 +373,7 @@ public: // These are internal details o
bool isRecordBeingLaidOut(const Type *Ty) const {
return RecordsBeingLaidOut.count(Ty);
}
-
+
};
} // end namespace CodeGen
Modified: cfe/trunk/lib/CodeGen/ConstantInitBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ConstantInitBuilder.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ConstantInitBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/ConstantInitBuilder.cpp Mon Jul 30 12:24:48 2018
@@ -166,7 +166,7 @@ void ConstantAggregateBuilderBase::getGE
if (Parent) {
Parent->getGEPIndicesTo(indices, Begin);
- // Otherwise, add an index to drill into the first level of pointer.
+ // Otherwise, add an index to drill into the first level of pointer.
} else {
assert(indices.empty());
indices.push_back(llvm::ConstantInt::get(Builder.CGM.Int32Ty, 0));
Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Mon Jul 30 12:24:48 2018
@@ -165,7 +165,7 @@ public:
llvm::BasicBlock *
EmitCtorCompleteObjectHandler(CodeGenFunction &CGF,
const CXXRecordDecl *RD) override;
-
+
llvm::BasicBlock *
EmitDtorCompleteObjectHandler(CodeGenFunction &CGF);
@@ -1123,7 +1123,7 @@ MicrosoftCXXABI::EmitDtorCompleteObjectH
CGF.EmitBlock(CallVbaseDtorsBB);
// CGF will put the base dtor calls in this basic block for us later.
-
+
return SkipVbaseDtorsBB;
}
@@ -1393,7 +1393,7 @@ Address MicrosoftCXXABI::adjustThisArgum
Address Result = This;
if (ML.VBase) {
Result = CGF.Builder.CreateElementBitCast(Result, CGF.Int8Ty);
-
+
const CXXRecordDecl *Derived = MD->getParent();
const CXXRecordDecl *VBase = ML.VBase;
llvm::Value *VBaseOffset =
@@ -1562,21 +1562,21 @@ void MicrosoftCXXABI::EmitDestructorCall
This = adjustThisArgumentForVirtualFunctionCall(CGF, GlobalDecl(DD, Type),
This, false);
}
-
+
llvm::BasicBlock *BaseDtorEndBB = nullptr;
if (ForVirtualBase && isa<CXXConstructorDecl>(CGF.CurCodeDecl)) {
BaseDtorEndBB = EmitDtorCompleteObjectHandler(CGF);
- }
+ }
CGF.EmitCXXDestructorCall(DD, Callee, This.getPointer(),
/*ImplicitParam=*/nullptr,
/*ImplicitParamTy=*/QualType(), nullptr,
getFromDtorType(Type));
if (BaseDtorEndBB) {
- // Complete object handler should continue to be the remaining
+ // Complete object handler should continue to be the remaining
CGF.Builder.CreateBr(BaseDtorEndBB);
CGF.EmitBlock(BaseDtorEndBB);
- }
+ }
}
void MicrosoftCXXABI::emitVTableTypeMetadata(const VPtrInfo &Info,
Modified: cfe/trunk/lib/CodeGen/SwiftCallingConv.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/SwiftCallingConv.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/SwiftCallingConv.cpp (original)
+++ cfe/trunk/lib/CodeGen/SwiftCallingConv.cpp Mon Jul 30 12:24:48 2018
@@ -163,7 +163,7 @@ void SwiftAggLowering::addTypedData(cons
// - virtual bases
for (auto &vbaseSpecifier : cxxRecord->vbases()) {
auto baseRecord = vbaseSpecifier.getType()->getAsCXXRecordDecl();
- addTypedData(baseRecord, begin + layout.getVBaseClassOffset(baseRecord));
+ addTypedData(baseRecord, begin + layout.getVBaseClassOffset(baseRecord));
}
}
}
@@ -583,7 +583,7 @@ bool SwiftAggLowering::shouldPassIndirec
if (Entries.size() == 1) {
return getSwiftABIInfo(CGM).shouldPassIndirectlyForSwift(
Entries.back().Type,
- asReturnValue);
+ asReturnValue);
}
SmallVector<llvm::Type*, 8> componentTys;
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Jul 30 12:24:48 2018
@@ -305,7 +305,7 @@ static Address emitVoidPtrDirectVAArg(Co
Addr = Address(emitRoundPointerUpToAlignment(CGF, Ptr, DirectAlign),
DirectAlign);
} else {
- Addr = Address(Ptr, SlotSize);
+ Addr = Address(Ptr, SlotSize);
}
// Advance the pointer past the argument, then store that back.
@@ -369,7 +369,7 @@ static Address emitVoidPtrVAArg(CodeGenF
}
return Addr;
-
+
}
static Address emitMergePHI(CodeGenFunction &CGF,
@@ -1014,7 +1014,7 @@ class X86_32ABIInfo : public SwiftABIInf
ABIArgInfo classifyReturnType(QualType RetTy, CCState &State) const;
ABIArgInfo classifyArgumentType(QualType RetTy, CCState &State) const;
- /// Updates the number of available free registers, returns
+ /// Updates the number of available free registers, returns
/// true if any registers were allocated.
bool updateFreeRegs(QualType Ty, CCState &State) const;
@@ -1044,7 +1044,7 @@ public:
bool RetSmallStructInRegABI, bool Win32StructABI,
unsigned NumRegisterParameters, bool SoftFloatABI)
: SwiftABIInfo(CGT), IsDarwinVectorABI(DarwinVectorABI),
- IsRetSmallStructInRegABI(RetSmallStructInRegABI),
+ IsRetSmallStructInRegABI(RetSmallStructInRegABI),
IsWin32StructABI(Win32StructABI),
IsSoftFloatABI(SoftFloatABI),
IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
@@ -1057,7 +1057,7 @@ public:
// four vector registers for vectors, but those can overlap with the
// scalar registers.
return occupiesMoreThan(CGT, scalars, /*total*/ 3);
- }
+ }
bool isSwiftErrorInRegister() const override {
// x86-32 lowering does not support passing swifterror in a register.
@@ -1546,7 +1546,7 @@ bool X86_32ABIInfo::updateFreeRegs(QualT
return true;
}
-bool X86_32ABIInfo::shouldAggregateUseDirect(QualType Ty, CCState &State,
+bool X86_32ABIInfo::shouldAggregateUseDirect(QualType Ty, CCState &State,
bool &InReg,
bool &NeedsPadding) const {
// On Windows, aggregates other than HFAs are never passed in registers, and
@@ -1589,7 +1589,7 @@ bool X86_32ABIInfo::shouldPrimitiveUseIn
if (getContext().getTypeSize(Ty) > 32)
return false;
- return (Ty->isIntegralOrEnumerationType() || Ty->isPointerType() ||
+ return (Ty->isIntegralOrEnumerationType() || Ty->isPointerType() ||
Ty->isReferenceType());
}
@@ -2185,7 +2185,7 @@ public:
bool shouldPassIndirectlyForSwift(ArrayRef<llvm::Type*> scalars,
bool asReturnValue) const override {
return occupiesMoreThan(CGT, scalars, /*total*/ 4);
- }
+ }
bool isSwiftErrorInRegister() const override {
return true;
}
@@ -3785,7 +3785,7 @@ Address X86_64ABIInfo::EmitVAArg(CodeGen
CGF.Builder.CreateMemCpy(Tmp, RegAddr, TySize, false);
RegAddr = Tmp;
}
-
+
} else if (neededSSE == 1) {
RegAddr = Address(CGF.Builder.CreateGEP(RegSaveArea, fp_offset),
CharUnits::fromQuantity(16));
@@ -4180,7 +4180,7 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(Co
}
// Get the address of the saved value by scaling the number of
- // registers we've used by the number of
+ // registers we've used by the number of
CharUnits RegSize = CharUnits::fromQuantity((isInt || IsSoftFloatABI) ? 4 : 8);
llvm::Value *RegOffset =
Builder.CreateMul(NumRegs, Builder.getInt8(RegSize.getQuantity()));
@@ -4191,7 +4191,7 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(Co
// Increase the used-register count.
NumRegs =
- Builder.CreateAdd(NumRegs,
+ Builder.CreateAdd(NumRegs,
Builder.getInt8((isI64 || (isF64 && IsSoftFloatABI)) ? 2 : 1));
Builder.CreateStore(NumRegs, NumRegsAddr);
@@ -4227,7 +4227,7 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(Co
OverflowArea = Address(emitRoundPointerUpToAlignment(CGF, Ptr, Align),
Align);
}
-
+
MemAddr = Builder.CreateElementBitCast(OverflowArea, DirectTy);
// Increase the overflow area.
Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Mon Jul 30 12:24:48 2018
@@ -321,7 +321,7 @@ SanitizerArgs::SanitizerArgs(const ToolC
D.Diag(diag::err_drv_argument_not_allowed_with)
<< "-fsanitize=vptr" << NoRTTIArg->getAsString(Args);
} else {
- // The vptr sanitizer requires RTTI, but RTTI is disabled (by
+ // The vptr sanitizer requires RTTI, but RTTI is disabled (by
// default). Warn that the vptr sanitizer is being disabled.
D.Diag(diag::warn_drv_disabling_vptr_no_rtti_default);
}
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Jul 30 12:24:48 2018
@@ -564,7 +564,7 @@ std::string ToolChain::ComputeLLVMTriple
StringRef Suffix =
tools::arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
bool IsMProfile = ARM::parseArchProfile(Suffix) == ARM::ProfileKind::M;
- bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 &&
+ bool ThumbDefault = IsMProfile || (ARM::parseArchVersion(Suffix) == 7 &&
getTriple().isOSBinFormatMachO());
// FIXME: this is invalid for WindowsCE
if (getTriple().isOSWindows())
Modified: cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp Mon Jul 30 12:24:48 2018
@@ -279,7 +279,7 @@ void riscv::getRISCVTargetFeatures(const
if (!getExtensionVersion(D, MArch, std::string(1, Baseline),
Exts, Major, Minor))
return;
-
+
// TODO: Use version number when setting target features
// and consume the underscore '_' that might follow.
Modified: cfe/trunk/lib/Edit/Commit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Edit/Commit.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Edit/Commit.cpp (original)
+++ cfe/trunk/lib/Edit/Commit.cpp Mon Jul 30 12:24:48 2018
@@ -147,7 +147,7 @@ bool Commit::replaceWithInner(CharSource
}
FileOffset OuterEnd = OuterBegin.getWithOffset(OuterLen);
- FileOffset InnerEnd = InnerBegin.getWithOffset(InnerLen);
+ FileOffset InnerEnd = InnerBegin.getWithOffset(InnerLen);
if (OuterBegin.getFID() != InnerBegin.getFID() ||
InnerBegin < OuterBegin ||
InnerBegin > OuterEnd ||
@@ -300,7 +300,7 @@ bool Commit::canRemoveRange(CharSourceRa
range = Lexer::makeFileCharRange(range, SM, LangOpts);
if (range.isInvalid())
return false;
-
+
if (range.getBegin().isMacroID() || range.getEnd().isMacroID())
return false;
if (SM.isInSystemHeader(range.getBegin()) ||
Modified: cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp (original)
+++ cfe/trunk/lib/Edit/RewriteObjCFoundationAPI.cpp Mon Jul 30 12:24:48 2018
@@ -82,7 +82,7 @@ bool edit::rewriteObjCRedundantCallWithL
(NS.getNSDictionarySelector(
NSAPI::NSDict_dictionaryWithDictionary) == Sel ||
NS.getNSDictionarySelector(NSAPI::NSDict_initWithDictionary) == Sel))) {
-
+
commit.replaceWithInner(Msg->getSourceRange(),
Msg->getArg(0)->getSourceRange());
return true;
@@ -726,7 +726,7 @@ static bool getLiteralInfo(SourceRange l
} else
break;
}
-
+
if (!UpperU.hasValue() && !UpperL.hasValue())
UpperU = UpperL = true;
else if (UpperU.hasValue() && !UpperL.hasValue())
@@ -738,7 +738,7 @@ static bool getLiteralInfo(SourceRange l
Info.L = *UpperL ? "L" : "l";
Info.LL = *UpperL ? "LL" : "ll";
Info.F = UpperF ? "F" : "f";
-
+
Info.Hex = Info.Octal = false;
if (text.startswith("0x"))
Info.Hex = true;
@@ -851,7 +851,7 @@ static bool rewriteToNumberLiteral(const
// Try to modify the literal make it the same type as the method call.
// -Modify the suffix, and/or
// -Change integer to float
-
+
LiteralInfo LitInfo;
bool isIntZero = false;
if (const IntegerLiteral *IntE = dyn_cast<IntegerLiteral>(literalE))
@@ -862,7 +862,7 @@ static bool rewriteToNumberLiteral(const
// Not easy to do int -> float with hex/octal and uncommon anyway.
if (!LitIsFloat && CallIsFloating && (LitInfo.Hex || LitInfo.Octal))
return rewriteToNumericBoxedExpression(Msg, NS, commit);
-
+
SourceLocation LitB = LitInfo.WithoutSuffRange.getBegin();
SourceLocation LitE = LitInfo.WithoutSuffRange.getEnd();
@@ -879,7 +879,7 @@ static bool rewriteToNumberLiteral(const
} else {
if (CallIsUnsigned)
commit.insert(LitE, LitInfo.U);
-
+
if (CallIsLong)
commit.insert(LitE, LitInfo.L);
else if (CallIsLongLong)
@@ -997,7 +997,7 @@ static bool rewriteToNumericBoxedExpress
uint64_t FinalTySize = Ctx.getTypeSize(FinalTy);
uint64_t OrigTySize = Ctx.getTypeSize(OrigTy);
- bool isTruncated = FinalTySize < OrigTySize;
+ bool isTruncated = FinalTySize < OrigTySize;
bool needsCast = false;
if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
@@ -1090,7 +1090,7 @@ static bool rewriteToNumericBoxedExpress
}
if (needsCast) {
- DiagnosticsEngine &Diags = Ctx.getDiagnostics();
+ DiagnosticsEngine &Diags = Ctx.getDiagnostics();
// FIXME: Use a custom category name to distinguish migration diagnostics.
unsigned diagID = Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"converting to boxing syntax requires casting %0 to %1");
@@ -1145,7 +1145,7 @@ static bool doRewriteToUTF8StringBoxedEx
commit.insertBefore(ArgRange.getBegin(), "@");
else
commit.insertWrap("@(", ArgRange, ")");
-
+
return true;
}
}
Modified: cfe/trunk/lib/Format/BreakableToken.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Format/BreakableToken.cpp (original)
+++ cfe/trunk/lib/Format/BreakableToken.cpp Mon Jul 30 12:24:48 2018
@@ -573,7 +573,7 @@ BreakableBlockComment::getReflowSplit(un
llvm::Regex &CommentPragmasRegex) const {
if (!mayReflow(LineIndex, CommentPragmasRegex))
return Split(StringRef::npos, 0);
-
+
// If we're reflowing into a line with content indent, only reflow the next
// line if its starting whitespace matches the content indent.
size_t Trimmed = Content[LineIndex].find_first_not_of(Blanks);
Modified: cfe/trunk/lib/Format/ContinuationIndenter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.h (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.h Mon Jul 30 12:24:48 2018
@@ -107,7 +107,7 @@ private:
void moveStateToNewBlock(LineState &State);
/// Reformats a raw string literal.
- ///
+ ///
/// \returns An extra penalty induced by reformatting the token.
unsigned reformatRawStringLiteral(const FormatToken &Current,
LineState &State,
Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Mon Jul 30 12:24:48 2018
@@ -181,7 +181,7 @@ namespace {
void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
D->print(llvm::errs());
-
+
if (Stmt *Body = D->getBody()) {
llvm::errs() << '\n';
Body->viewAST();
Modified: cfe/trunk/lib/Frontend/ASTMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTMerge.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTMerge.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTMerge.cpp Mon Jul 30 12:24:48 2018
@@ -51,9 +51,9 @@ void ASTMergeAction::ExecuteAction() {
if (!Unit)
continue;
- ASTImporter Importer(CI.getASTContext(),
+ ASTImporter Importer(CI.getASTContext(),
CI.getFileManager(),
- Unit->getASTContext(),
+ Unit->getASTContext(),
Unit->getFileManager(),
/*MinimalImport=*/false);
@@ -64,9 +64,9 @@ void ASTMergeAction::ExecuteAction() {
if (IdentifierInfo *II = ND->getIdentifier())
if (II->isStr("__va_list_tag") || II->isStr("__builtin_va_list"))
continue;
-
+
Decl *ToD = Importer.Import(D);
-
+
if (ToD) {
DeclGroupRef DGR(ToD);
CI.getASTConsumer().HandleTopLevelDecl(DGR);
@@ -88,7 +88,7 @@ ASTMergeAction::ASTMergeAction(std::uniq
assert(AdaptedAction && "ASTMergeAction needs an action to adapt");
}
-ASTMergeAction::~ASTMergeAction() {
+ASTMergeAction::~ASTMergeAction() {
}
bool ASTMergeAction::usesPreprocessorOnly() const {
Modified: cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp (original)
+++ cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp Mon Jul 30 12:24:48 2018
@@ -126,7 +126,7 @@ IntrusiveRefCntPtr<ExternalSemaSource> c
bool firstInclude = (i == 0);
std::unique_ptr<CompilerInvocation> CInvok;
CInvok.reset(new CompilerInvocation(CI.getInvocation()));
-
+
CInvok->getPreprocessorOpts().ChainedIncludes.clear();
CInvok->getPreprocessorOpts().ImplicitPCHInclude.clear();
CInvok->getPreprocessorOpts().ImplicitPTHInclude.clear();
@@ -134,7 +134,7 @@ IntrusiveRefCntPtr<ExternalSemaSource> c
CInvok->getPreprocessorOpts().Includes.clear();
CInvok->getPreprocessorOpts().MacroIncludes.clear();
CInvok->getPreprocessorOpts().Macros.clear();
-
+
CInvok->getFrontendOpts().Inputs.clear();
FrontendInputFile InputFile(includes[i], IK);
CInvok->getFrontendOpts().Inputs.push_back(InputFile);
@@ -193,7 +193,7 @@ IntrusiveRefCntPtr<ExternalSemaSource> c
Clang->setModuleManager(Reader);
Clang->getASTContext().setExternalSource(Reader);
}
-
+
if (!Clang->InitializeSourceManager(InputFile))
return nullptr;
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Jul 30 12:24:48 2018
@@ -292,7 +292,7 @@ CompilerInstance::createDiagnostics(Diag
if (!Opts->DiagnosticSerializationFile.empty())
SetupSerializedDiagnostics(Opts, *Diags,
Opts->DiagnosticSerializationFile);
-
+
// Configure our handling of diagnostics.
ProcessWarningOptions(*Diags, *Opts);
@@ -935,7 +935,7 @@ bool CompilerInstance::ExecuteAction(Fro
// Adjust target options based on codegen options.
getTarget().adjustTargetOptions(getCodeGenOpts(), getTargetOpts());
- // rewriter project will change target built-in bool type from its default.
+ // rewriter project will change target built-in bool type from its default.
if (getFrontendOpts().ProgramAction == frontend::RewriteObjC)
getTarget().noSignedCharForObjCBool();
@@ -1026,7 +1026,7 @@ static InputKind::Language getLanguageFr
return LangOpts.CPlusPlus ? InputKind::CXX : InputKind::C;
}
-/// Compile a module file for the given module, using the options
+/// Compile a module file for the given module, using the options
/// provided by the importing compiler instance. Returns true if the module
/// was built without errors.
static bool
@@ -1042,7 +1042,7 @@ compileModuleImpl(CompilerInstance &Impo
std::make_shared<CompilerInvocation>(ImportingInstance.getInvocation());
PreprocessorOptions &PPOpts = Invocation->getPreprocessorOpts();
-
+
// For any options that aren't intended to affect how a module is built,
// reset them to their default values.
Invocation->getLangOpts()->resetNonModularOptions();
@@ -1092,11 +1092,11 @@ compileModuleImpl(CompilerInstance &Impo
// Don't free the remapped file buffers; they are owned by our caller.
PPOpts.RetainRemappedFileBuffers = true;
-
+
Invocation->getDiagnosticOpts().VerifyDiagnostics = 0;
assert(ImportingInstance.getInvocation().getModuleHash() ==
Invocation->getModuleHash() && "Module hash mismatch!");
-
+
// Construct a compiler instance that will be used to actually create the
// module. Since we're sharing a PCMCache,
// CompilerInstance::CompilerInstance is responsible for finalizing the
@@ -1172,7 +1172,7 @@ static const FileEntry *getPublicModuleM
return FileMgr.getFile(PublicFilename);
}
-/// Compile a module file for the given module, using the options
+/// Compile a module file for the given module, using the options
/// provided by the importing compiler instance. Returns true if the module
/// was built without errors.
static bool compileModuleImpl(CompilerInstance &ImportingInstance,
@@ -1183,7 +1183,7 @@ static bool compileModuleImpl(CompilerIn
InputKind::ModuleMap);
// Get or create the module map that we'll use to build this module.
- ModuleMap &ModMap
+ ModuleMap &ModMap
= ImportingInstance.getPreprocessor().getHeaderSearchInfo().getModuleMap();
bool Result;
if (const FileEntry *ModuleMapFile =
@@ -1327,7 +1327,7 @@ static void checkConfigMacro(Preprocesso
Module *Mod, SourceLocation ImportLoc) {
IdentifierInfo *Id = PP.getIdentifierInfo(ConfigMacro);
SourceManager &SourceMgr = PP.getSourceManager();
-
+
// If this identifier has never had a macro definition, then it could
// not have changed.
if (!Id->hadMacroDefinition())
@@ -1651,7 +1651,7 @@ CompilerInstance::loadModule(SourceLocat
= KnownModules.find(Path[0].first);
if (Known != KnownModules.end()) {
// Retrieve the cached top-level module.
- Module = Known->second;
+ Module = Known->second;
} else if (ModuleName == getLangOpts().CurrentModule) {
// This is the module we're building.
Module = PP->getHeaderSearchInfo().lookupModule(
@@ -1851,7 +1851,7 @@ CompilerInstance::loadModule(SourceLocat
// Cache the result of this top-level module lookup for later.
Known = KnownModules.insert(std::make_pair(Path[0].first, Module)).first;
}
-
+
// If we never found the module, fail.
if (!Module)
return ModuleLoadResult();
@@ -1897,13 +1897,13 @@ CompilerInstance::loadModule(SourceLocat
}
}
}
-
+
if (!Sub) {
// Attempt to perform typo correction to find a module name that works.
SmallVector<StringRef, 2> Best;
unsigned BestEditDistance = (std::numeric_limits<unsigned>::max)();
-
- for (clang::Module::submodule_iterator J = Module->submodule_begin(),
+
+ for (clang::Module::submodule_iterator J = Module->submodule_begin(),
JEnd = Module->submodule_end();
J != JEnd; ++J) {
unsigned ED = Name.edit_distance((*J)->Name,
@@ -1914,20 +1914,20 @@ CompilerInstance::loadModule(SourceLocat
Best.clear();
BestEditDistance = ED;
}
-
+
Best.push_back((*J)->Name);
}
}
-
+
// If there was a clear winner, user it.
if (Best.size() == 1) {
- getDiagnostics().Report(Path[I].second,
+ getDiagnostics().Report(Path[I].second,
diag::err_no_submodule_suggest)
<< Path[I].first << Module->getFullModuleName() << Best[0]
<< SourceRange(Path[0].second, Path[I-1].second)
<< FixItHint::CreateReplacement(SourceRange(Path[I].second),
Best[0]);
-
+
Sub = Module->findSubmodule(Best[0]);
}
}
@@ -1940,7 +1940,7 @@ CompilerInstance::loadModule(SourceLocat
<< SourceRange(Path[0].second, Path[I-1].second);
break;
}
-
+
Module = Sub;
}
}
Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DependencyFile.cpp (original)
+++ cfe/trunk/lib/Frontend/DependencyFile.cpp Mon Jul 30 12:24:48 2018
@@ -318,7 +318,7 @@ void DFGImpl::InclusionDirective(SourceL
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
- const Module *Imported,
+ const Module *Imported,
SrcMgr::CharacteristicKind FileType) {
if (!File) {
if (AddMissingHeaderDeps)
Modified: cfe/trunk/lib/Frontend/DependencyGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyGraph.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DependencyGraph.cpp (original)
+++ cfe/trunk/lib/Frontend/DependencyGraph.cpp Mon Jul 30 12:24:48 2018
@@ -33,9 +33,9 @@ class DependencyGraphCallback : public P
llvm::SetVector<const FileEntry *> AllFiles;
typedef llvm::DenseMap<const FileEntry *,
SmallVector<const FileEntry *, 2> > DependencyMap;
-
+
DependencyMap Dependencies;
-
+
private:
raw_ostream &writeNodeReference(raw_ostream &OS,
const FileEntry *Node);
@@ -56,7 +56,7 @@ public:
void EndOfMainFile() override {
OutputGraphFile();
}
-
+
};
}
@@ -75,11 +75,11 @@ void DependencyGraphCallback::InclusionD
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
- const Module *Imported,
+ const Module *Imported,
SrcMgr::CharacteristicKind FileType) {
if (!File)
return;
-
+
SourceManager &SM = PP->getSourceManager();
const FileEntry *FromFile
= SM.getFileEntryForID(SM.getFileID(SM.getExpansionLoc(HashLoc)));
@@ -87,7 +87,7 @@ void DependencyGraphCallback::InclusionD
return;
Dependencies[FromFile].push_back(File);
-
+
AllFiles.insert(File);
AllFiles.insert(FromFile);
}
@@ -109,7 +109,7 @@ void DependencyGraphCallback::OutputGrap
}
OS << "digraph \"dependencies\" {\n";
-
+
// Write the nodes
for (unsigned I = 0, N = AllFiles.size(); I != N; ++I) {
// Write the node itself.
@@ -119,15 +119,15 @@ void DependencyGraphCallback::OutputGrap
StringRef FileName = AllFiles[I]->getName();
if (FileName.startswith(SysRoot))
FileName = FileName.substr(SysRoot.size());
-
+
OS << DOT::EscapeString(FileName)
<< "\"];\n";
}
// Write the edges
- for (DependencyMap::iterator F = Dependencies.begin(),
+ for (DependencyMap::iterator F = Dependencies.begin(),
FEnd = Dependencies.end();
- F != FEnd; ++F) {
+ F != FEnd; ++F) {
for (unsigned I = 0, N = F->second.size(); I != N; ++I) {
OS.indent(2);
writeNodeReference(OS, F->first);
Modified: cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp (original)
+++ cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp Mon Jul 30 12:24:48 2018
@@ -172,9 +172,9 @@ void DiagnosticRenderer::emitIncludeStac
// Skip redundant include stacks altogether.
if (LastIncludeLoc == IncludeLoc)
return;
-
+
LastIncludeLoc = IncludeLoc;
-
+
if (!DiagOpts->ShowNoteIncludeStack && Level == DiagnosticsEngine::Note)
return;
@@ -199,7 +199,7 @@ void DiagnosticRenderer::emitIncludeStac
return;
// If this source location was imported from a module, print the module
- // import stack rather than the
+ // import stack rather than the
// FIXME: We want submodule granularity here.
std::pair<FullSourceLoc, StringRef> Imported = Loc.getModuleImportLoc();
if (!Imported.second.empty()) {
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Mon Jul 30 12:24:48 2018
@@ -288,7 +288,7 @@ static void addHeaderInclude(StringRef H
Includes += "}\n";
}
-/// Collect the set of header includes needed to construct the given
+/// Collect the set of header includes needed to construct the given
/// module and update the TopHeaders file set of the module.
///
/// \param Module The module we're collecting includes from.
@@ -345,7 +345,7 @@ static std::error_code collectModuleHead
vfs::FileSystem &FS = *FileMgr.getVirtualFileSystem();
for (vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End;
Dir != End && !EC; Dir.increment(EC)) {
- // Check whether this entry has an extension typically associated with
+ // Check whether this entry has an extension typically associated with
// headers.
if (!llvm::StringSwitch<bool>(llvm::sys::path::extension(Dir->getName()))
.Cases(".h", ".H", ".hh", ".hpp", true)
@@ -358,7 +358,7 @@ static std::error_code collectModuleHead
if (!Header)
continue;
- // If this header is marked 'unavailable' in this module, don't include
+ // If this header is marked 'unavailable' in this module, don't include
// it.
if (ModMap.isHeaderUnavailableInModule(Header, Module))
continue;
@@ -431,7 +431,7 @@ static Module *prepareToBuildModule(Comp
CI.getDiagnostics().Report(diag::err_missing_module_name);
// FIXME: Eventually, we could consider asking whether there was just
- // a single module described in the module map, and use that as a
+ // a single module described in the module map, and use that as a
// default. Then it would be fairly trivial to just "compile" a module
// map with a single module (the common case).
return nullptr;
Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Mon Jul 30 12:24:48 2018
@@ -377,7 +377,7 @@ private:
if (auto *NamedTemplate = dyn_cast_or_null<NamedDecl>(Inst.Entity)) {
llvm::raw_string_ostream OS(Entry.Name);
NamedTemplate->getNameForDiagnostic(OS, TheSema.getLangOpts(), true);
- const PresumedLoc DefLoc =
+ const PresumedLoc DefLoc =
TheSema.getSourceManager().getPresumedLoc(Inst.Entity->getLocation());
if(!DefLoc.isInvalid())
Entry.DefinitionLocation = std::string(DefLoc.getFilename()) + ":" +
@@ -709,13 +709,13 @@ void PrintPreprocessedAction::ExecuteAct
// the input format has inconsistent line endings.
//
// This should be a relatively fast operation since most files won't have
- // all of their source code on a single line. However, that is still a
+ // all of their source code on a single line. However, that is still a
// concern, so if we scan for too long, we'll just assume the file should
// be opened in binary mode.
bool BinaryMode = true;
bool InvalidFile = false;
const SourceManager& SM = CI.getSourceManager();
- const llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getMainFileID(),
+ const llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getMainFileID(),
&InvalidFile);
if (!InvalidFile) {
const char *cur = Buffer->getBufferStart();
@@ -723,7 +723,7 @@ void PrintPreprocessedAction::ExecuteAct
const char *next = (cur != end) ? cur + 1 : end;
// Limit ourselves to only scanning 256 characters into the source
- // file. This is mostly a sanity check in case the file has no
+ // file. This is mostly a sanity check in case the file has no
// newlines whatsoever.
if (end - cur > 256) end = cur + 256;
@@ -774,7 +774,7 @@ void PrintPreambleAction::ExecuteAction(
case InputKind::CUDA:
case InputKind::HIP:
break;
-
+
case InputKind::Unknown:
case InputKind::Asm:
case InputKind::LLVM_IR:
Modified: cfe/trunk/lib/Frontend/LayoutOverrideSource.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/LayoutOverrideSource.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/LayoutOverrideSource.cpp (original)
+++ cfe/trunk/lib/Frontend/LayoutOverrideSource.cpp Mon Jul 30 12:24:48 2018
@@ -23,7 +23,7 @@ static std::string parseName(StringRef S
unsigned Offset = 1;
while (Offset < S.size() && isIdentifierBody(S[Offset]))
++Offset;
-
+
return S.substr(0, Offset).str();
}
@@ -31,33 +31,33 @@ LayoutOverrideSource::LayoutOverrideSour
std::ifstream Input(Filename.str().c_str());
if (!Input.is_open())
return;
-
+
// Parse the output of -fdump-record-layouts.
std::string CurrentType;
Layout CurrentLayout;
bool ExpectingType = false;
-
+
while (Input.good()) {
std::string Line;
getline(Input, Line);
-
+
StringRef LineStr(Line);
- // Determine whether the following line will start a
+ // Determine whether the following line will start a
if (LineStr.find("*** Dumping AST Record Layout") != StringRef::npos) {
// Flush the last type/layout, if there is one.
if (!CurrentType.empty())
Layouts[CurrentType] = CurrentLayout;
CurrentLayout = Layout();
-
+
ExpectingType = true;
continue;
}
-
+
// If we're expecting a type, grab it.
if (ExpectingType) {
ExpectingType = false;
-
+
StringRef::size_type Pos;
if ((Pos = LineStr.find("struct ")) != StringRef::npos)
LineStr = LineStr.substr(Pos + strlen("struct "));
@@ -67,19 +67,19 @@ LayoutOverrideSource::LayoutOverrideSour
LineStr = LineStr.substr(Pos + strlen("union "));
else
continue;
-
+
// Find the name of the type.
CurrentType = parseName(LineStr);
CurrentLayout = Layout();
continue;
}
-
+
// Check for the size of the type.
StringRef::size_type Pos = LineStr.find(" Size:");
if (Pos != StringRef::npos) {
// Skip past the " Size:" prefix.
LineStr = LineStr.substr(Pos + strlen(" Size:"));
-
+
unsigned long long Size = 0;
(void)LineStr.getAsInteger(10, Size);
CurrentLayout.Size = Size;
@@ -91,13 +91,13 @@ LayoutOverrideSource::LayoutOverrideSour
if (Pos != StringRef::npos) {
// Skip past the "Alignment:" prefix.
LineStr = LineStr.substr(Pos + strlen("Alignment:"));
-
+
unsigned long long Alignment = 0;
(void)LineStr.getAsInteger(10, Alignment);
CurrentLayout.Align = Alignment;
continue;
}
-
+
// Check for the size/alignment of the type.
Pos = LineStr.find("sizeof=");
if (Pos != StringRef::npos) {
@@ -113,16 +113,16 @@ LayoutOverrideSource::LayoutOverrideSour
if (Pos != StringRef::npos) {
/* Skip past the align= prefix. */
LineStr = LineStr.substr(Pos + strlen("align="));
-
+
// Parse alignment.
unsigned long long Alignment = 0;
(void)LineStr.getAsInteger(10, Alignment);
CurrentLayout.Align = Alignment;
}
-
+
continue;
}
-
+
// Check for the field offsets of the type.
Pos = LineStr.find("FieldOffsets: [");
if (Pos == StringRef::npos)
@@ -134,55 +134,55 @@ LayoutOverrideSource::LayoutOverrideSour
unsigned Idx = 1;
while (Idx < LineStr.size() && isDigit(LineStr[Idx]))
++Idx;
-
+
unsigned long long Offset = 0;
(void)LineStr.substr(0, Idx).getAsInteger(10, Offset);
-
+
CurrentLayout.FieldOffsets.push_back(Offset);
-
+
// Skip over this offset, the following comma, and any spaces.
LineStr = LineStr.substr(Idx + 1);
while (!LineStr.empty() && isWhitespace(LineStr[0]))
LineStr = LineStr.substr(1);
}
}
-
+
// Flush the last type/layout, if there is one.
if (!CurrentType.empty())
Layouts[CurrentType] = CurrentLayout;
}
-bool
+bool
LayoutOverrideSource::layoutRecordType(const RecordDecl *Record,
uint64_t &Size, uint64_t &Alignment,
llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
- llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets)
+ llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets)
{
// We can't override unnamed declarations.
if (!Record->getIdentifier())
return false;
-
+
// Check whether we have a layout for this record.
llvm::StringMap<Layout>::iterator Known = Layouts.find(Record->getName());
if (Known == Layouts.end())
return false;
-
+
// Provide field layouts.
unsigned NumFields = 0;
- for (RecordDecl::field_iterator F = Record->field_begin(),
+ for (RecordDecl::field_iterator F = Record->field_begin(),
FEnd = Record->field_end();
F != FEnd; ++F, ++NumFields) {
if (NumFields >= Known->second.FieldOffsets.size())
continue;
-
+
FieldOffsets[*F] = Known->second.FieldOffsets[NumFields];
}
-
+
// Wrong number of fields.
if (NumFields != Known->second.FieldOffsets.size())
return false;
-
+
Size = Known->second.Size;
Alignment = Known->second.Align;
return true;
@@ -190,7 +190,7 @@ LayoutOverrideSource::layoutRecordType(c
LLVM_DUMP_METHOD void LayoutOverrideSource::dump() {
raw_ostream &OS = llvm::errs();
- for (llvm::StringMap<Layout>::iterator L = Layouts.begin(),
+ for (llvm::StringMap<Layout>::iterator L = Layouts.begin(),
LEnd = Layouts.end();
L != LEnd; ++L) {
OS << "Type: blah " << L->first() << '\n';
Modified: cfe/trunk/lib/Frontend/MultiplexConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/MultiplexConsumer.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/MultiplexConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/MultiplexConsumer.cpp Mon Jul 30 12:24:48 2018
@@ -107,7 +107,7 @@ public:
void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
const Attr *Attr) override;
void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override;
- void AddedAttributeToRecord(const Attr *Attr,
+ void AddedAttributeToRecord(const Attr *Attr,
const RecordDecl *Record) override;
private:
@@ -219,9 +219,9 @@ void MultiplexASTMutationListener::Redef
for (auto *L : Listeners)
L->RedefinedHiddenDefinition(D, M);
}
-
+
void MultiplexASTMutationListener::AddedAttributeToRecord(
- const Attr *Attr,
+ const Attr *Attr,
const RecordDecl *Record) {
for (auto *L : Listeners)
L->AddedAttributeToRecord(Attr, Record);
Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Mon Jul 30 12:24:48 2018
@@ -160,7 +160,7 @@ public:
}
bool MoveToLine(unsigned LineNo);
- bool AvoidConcat(const Token &PrevPrevTok, const Token &PrevTok,
+ bool AvoidConcat(const Token &PrevPrevTok, const Token &PrevTok,
const Token &Tok) {
return ConcatInfo.AvoidConcat(PrevPrevTok, PrevTok, Tok);
}
@@ -248,7 +248,7 @@ PrintPPOutputPPCallbacks::startNewLineIf
++CurLine;
return true;
}
-
+
return false;
}
@@ -262,11 +262,11 @@ void PrintPPOutputPPCallbacks::FileChang
// Unless we are exiting a #include, make sure to skip ahead to the line the
// #include directive was at.
SourceManager &SourceMgr = SM;
-
+
PresumedLoc UserLoc = SourceMgr.getPresumedLoc(Loc);
if (UserLoc.isInvalid())
return;
-
+
unsigned NewLine = UserLoc.getLine();
if (Reason == PPCallbacks::EnterFile) {
@@ -281,7 +281,7 @@ void PrintPPOutputPPCallbacks::FileChang
// off by one. We can do better by simply incrementing NewLine here.
NewLine += 1;
}
-
+
CurLine = NewLine;
CurFilename.clear();
@@ -292,7 +292,7 @@ void PrintPPOutputPPCallbacks::FileChang
startNewLineIfNeeded(/*ShouldUpdateCurrentLine=*/false);
return;
}
-
+
if (!Initialized) {
WriteLineInfo(CurLine);
Initialized = true;
Modified: cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/FixItRewriter.cpp Mon Jul 30 12:24:48 2018
@@ -184,7 +184,7 @@ void FixItRewriter::HandleDiagnostic(Dia
}
return;
}
-
+
if (!Editor.commit(commit)) {
++NumFailures;
Diag(Info.getLocation(), diag::note_fixit_failed);
Modified: cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/FrontendActions.cpp Mon Jul 30 12:24:48 2018
@@ -131,9 +131,9 @@ bool FixItRecompile::BeginInvocation(Com
FixItRewriter Rewriter(CI.getDiagnostics(), CI.getSourceManager(),
CI.getLangOpts(), FixItOpts.get());
FixAction->Execute();
-
+
err = Rewriter.WriteFixedFiles(&RewrittenFiles);
-
+
FixAction->EndSourceFile();
CI.setSourceManager(nullptr);
CI.setFileManager(nullptr);
Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp Mon Jul 30 12:24:48 2018
@@ -39,12 +39,12 @@ using llvm::utostr;
namespace {
class RewriteModernObjC : public ASTConsumer {
protected:
-
+
enum {
BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)),
block, ... */
BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
- BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the
+ BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the
__block variable */
BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
helpers */
@@ -52,7 +52,7 @@ namespace {
support routines */
BLOCK_BYREF_CURRENT_MAX = 256
};
-
+
enum {
BLOCK_NEEDS_FREE = (1 << 24),
BLOCK_HAS_COPY_DISPOSE = (1 << 25),
@@ -61,7 +61,7 @@ namespace {
BLOCK_IS_GLOBAL = (1 << 28),
BLOCK_HAS_DESCRIPTOR = (1 << 29)
};
-
+
Rewriter Rewrite;
DiagnosticsEngine &Diags;
const LangOptions &LangOpts;
@@ -75,7 +75,7 @@ namespace {
std::string InFileName;
std::unique_ptr<raw_ostream> OutFile;
std::string Preamble;
-
+
TypeDecl *ProtocolTypeDecl;
VarDecl *GlobalVarDecl;
Expr *GlobalConstructionExp;
@@ -88,13 +88,13 @@ namespace {
// ObjC foreach break/continue generation support.
int BcLabelCount;
-
+
unsigned TryFinallyContainsReturnDiag;
// Needed for super.
ObjCMethodDecl *CurMethodDef;
RecordDecl *SuperStructDecl;
RecordDecl *ConstantStringDecl;
-
+
FunctionDecl *MsgSendFunctionDecl;
FunctionDecl *MsgSendSuperFunctionDecl;
FunctionDecl *MsgSendStretFunctionDecl;
@@ -118,22 +118,22 @@ namespace {
SmallVector<ObjCInterfaceDecl*, 32> ObjCInterfacesSeen;
/// DefinedNonLazyClasses - List of defined "non-lazy" classes.
SmallVector<ObjCInterfaceDecl*, 8> DefinedNonLazyClasses;
-
+
/// DefinedNonLazyCategories - List of defined "non-lazy" categories.
SmallVector<ObjCCategoryDecl *, 8> DefinedNonLazyCategories;
-
+
SmallVector<Stmt *, 32> Stmts;
SmallVector<int, 8> ObjCBcLabelNo;
// Remember all the @protocol(<expr>) expressions.
llvm::SmallPtrSet<ObjCProtocolDecl *, 32> ProtocolExprDecls;
-
+
llvm::DenseSet<uint64_t> CopyDestroyCache;
// Block expressions.
SmallVector<BlockExpr *, 32> Blocks;
SmallVector<int, 32> InnerDeclRefsCount;
SmallVector<DeclRefExpr *, 32> InnerDeclRefs;
-
+
SmallVector<DeclRefExpr *, 32> BlockDeclRefs;
// Block related declarations.
@@ -144,11 +144,11 @@ namespace {
llvm::DenseMap<ValueDecl *, unsigned> BlockByRefDeclNo;
llvm::SmallPtrSet<ValueDecl *, 8> ImportedBlockDecls;
llvm::SmallPtrSet<VarDecl *, 8> ImportedLocalExternalDecls;
-
+
llvm::DenseMap<BlockExpr *, std::string> RewrittenBlockExprs;
- llvm::DenseMap<ObjCInterfaceDecl *,
+ llvm::DenseMap<ObjCInterfaceDecl *,
llvm::SmallSetVector<ObjCIvarDecl *, 8> > ReferencedIvars;
-
+
// ivar bitfield grouping containers
llvm::DenseSet<const ObjCInterfaceDecl *> ObjCInterefaceHasBitfieldGroups;
llvm::DenseMap<const ObjCIvarDecl* , unsigned> IvarGroupNumber;
@@ -156,7 +156,7 @@ namespace {
// of the struct where the bitfield belongs.
llvm::DenseMap<std::pair<const ObjCInterfaceDecl*, unsigned>, QualType> GroupRecordType;
SmallVector<FunctionDecl*, 32> FunctionDefinitionsSeen;
-
+
// This maps an original source AST to it's rewritten form. This allows
// us to avoid rewriting the same node twice (which is very uncommon).
// This is needed to support some of the exotic property rewriting.
@@ -167,12 +167,12 @@ namespace {
bool SilenceRewriteMacroWarning;
bool GenerateLineInfo;
bool objc_impl_method;
-
+
bool DisableReplaceStmt;
class DisableReplaceStmtScope {
RewriteModernObjC &R;
bool SavedValue;
-
+
public:
DisableReplaceStmtScope(RewriteModernObjC &R)
: R(R), SavedValue(R.DisableReplaceStmt) {
@@ -237,7 +237,7 @@ namespace {
}
}
}
-
+
void HandleTopLevelSingleDecl(Decl *D);
void HandleDeclInMainFile(Decl *D);
RewriteModernObjC(std::string inFile, std::unique_ptr<raw_ostream> OS,
@@ -314,7 +314,7 @@ namespace {
std::string &LineString);
void RewriteForwardClassDecl(DeclGroupRef D);
void RewriteForwardClassDecl(const SmallVectorImpl<Decl *> &DG);
- void RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,
+ void RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,
const std::string &typedefString);
void RewriteImplementations();
void RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
@@ -341,9 +341,9 @@ namespace {
void RewriteObjCQualifiedInterfaceTypes(Decl *Dcl);
void RewriteTypeOfDecl(VarDecl *VD);
void RewriteObjCQualifiedInterfaceTypes(Expr *E);
-
+
std::string getIvarAccessString(ObjCIvarDecl *D);
-
+
// Expression Rewriting.
Stmt *RewriteFunctionBodyOrGlobalInitializer(Stmt *S);
Stmt *RewriteAtEncode(ObjCEncodeExpr *Exp);
@@ -367,7 +367,7 @@ namespace {
Stmt *RewriteContinueStmt(ContinueStmt *S);
void RewriteCastExpr(CStyleCastExpr *CE);
void RewriteImplicitCastObjCExpr(CastExpr *IE);
-
+
// Computes ivar bitfield group no.
unsigned ObjCIvarBitfieldGroupNo(ObjCIvarDecl *IV);
// Names field decl. for ivar bitfield group.
@@ -381,28 +381,28 @@ namespace {
QualType SynthesizeBitfieldGroupStructType(
ObjCIvarDecl *IV,
SmallVectorImpl<ObjCIvarDecl *> &IVars);
-
+
// Block rewriting.
void RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D);
-
+
// Block specific rewrite rules.
void RewriteBlockPointerDecl(NamedDecl *VD);
void RewriteByRefVar(VarDecl *VD, bool firstDecl, bool lastDecl);
Stmt *RewriteBlockDeclRefExpr(DeclRefExpr *VD);
Stmt *RewriteLocalVariableExternalStorage(DeclRefExpr *DRE);
void RewriteBlockPointerFunctionArgs(FunctionDecl *FD);
-
+
void RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl,
std::string &Result);
-
+
void RewriteObjCFieldDecl(FieldDecl *fieldDecl, std::string &Result);
bool IsTagDefinedInsideClass(ObjCContainerDecl *IDecl, TagDecl *Tag,
bool &IsNamedDefinition);
- void RewriteLocallyDefinedNamedAggregates(FieldDecl *fieldDecl,
+ void RewriteLocallyDefinedNamedAggregates(FieldDecl *fieldDecl,
std::string &Result);
-
+
bool RewriteObjCFieldDeclType(QualType &Type, std::string &Result);
-
+
void RewriteIvarOffsetSymbols(ObjCInterfaceDecl *CDecl,
std::string &Result);
@@ -414,9 +414,9 @@ namespace {
ArrayRef<Expr *> Args,
SourceLocation StartLoc=SourceLocation(),
SourceLocation EndLoc=SourceLocation());
-
+
Expr *SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFlavor,
- QualType returnType,
+ QualType returnType,
SmallVectorImpl<QualType> &ArgTypes,
SmallVectorImpl<Expr*> &MsgExprs,
ObjCMethodDecl *Method);
@@ -424,7 +424,7 @@ namespace {
Stmt *SynthMessageExpr(ObjCMessageExpr *Exp,
SourceLocation StartLoc=SourceLocation(),
SourceLocation EndLoc=SourceLocation());
-
+
void SynthCountByEnumWithState(std::string &buf);
void SynthMsgSendFunctionDecl();
void SynthMsgSendSuperFunctionDecl();
@@ -436,7 +436,7 @@ namespace {
void SynthGetSuperClassFunctionDecl();
void SynthSelGetUidFunctionDecl();
void SynthSuperConstructorFunctionDecl();
-
+
// Rewriting metadata
template<typename MethodIterator>
void RewriteObjCMethodsMetaData(MethodIterator MethodBegin,
@@ -450,27 +450,27 @@ namespace {
void RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
std::string &Result);
void RewriteClassSetupInitHook(std::string &Result);
-
+
void RewriteMetaDataIntoBuffer(std::string &Result);
void WriteImageInfo(std::string &Result);
void RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *CDecl,
std::string &Result);
void RewriteCategorySetupInitHook(std::string &Result);
-
+
// Rewriting ivar
void RewriteIvarOffsetComputation(ObjCIvarDecl *ivar,
std::string &Result);
Stmt *RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV);
-
+
std::string SynthesizeByrefCopyDestroyHelper(VarDecl *VD, int flag);
std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
StringRef funcName, std::string Tag);
std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
StringRef funcName, std::string Tag);
- std::string SynthesizeBlockImpl(BlockExpr *CE,
+ std::string SynthesizeBlockImpl(BlockExpr *CE,
std::string Tag, std::string Desc);
- std::string SynthesizeBlockDescriptor(std::string DescTag,
+ std::string SynthesizeBlockDescriptor(std::string DescTag,
std::string ImplTag,
int i, StringRef funcName,
unsigned hasCopy);
@@ -512,18 +512,18 @@ namespace {
}
return false;
}
-
+
bool convertObjCTypeToCStyleType(QualType &T);
-
+
bool needToScanForQualifiers(QualType T);
QualType getSuperStructType();
QualType getConstantStringStructType();
QualType convertFunctionTypeOfBlocks(const FunctionType *FT);
-
+
void convertToUnqualifiedObjCType(QualType &T) {
if (T->isObjCQualifiedIdType()) {
bool isConst = T.isConstQualified();
- T = isConst ? Context->getObjCIdType().withConst()
+ T = isConst ? Context->getObjCIdType().withConst()
: Context->getObjCIdType();
}
else if (T->isObjCQualifiedClassType())
@@ -538,7 +538,7 @@ namespace {
}
}
}
-
+
// FIXME: This predicate seems like it would be useful to add to ASTContext.
bool isObjCType(QualType T) {
if (!LangOpts.ObjC1 && !LangOpts.ObjC2)
@@ -562,7 +562,7 @@ namespace {
bool PointerTypeTakesAnyObjCQualifiedType(QualType QT);
void GetExtentOfArgList(const char *Name, const char *&LParen,
const char *&RParen);
-
+
void QuoteDoublequotes(std::string &From, std::string &To) {
for (unsigned i = 0; i < From.length(); i++) {
if (From[i] == '"')
@@ -589,7 +589,7 @@ namespace {
return CStyleCastExpr::Create(*Ctx, Ty, VK_RValue, Kind, E, nullptr,
TInfo, SourceLocation(), SourceLocation());
}
-
+
bool ImplementationIsNonLazy(const ObjCImplDecl *OD) const {
IdentifierInfo* II = &Context->Idents.get("load");
Selector LoadSel = Context->Selectors.getSelector(0, &II);
@@ -653,7 +653,7 @@ RewriteModernObjC::RewriteModernObjC(std
// may break including some headers.
GlobalBlockRewriteFailedDiag = Diags.getCustomDiagID(DiagnosticsEngine::Warning,
"rewriting block literal declared in global scope is not implemented");
-
+
TryFinallyContainsReturnDiag = Diags.getCustomDiagID(
DiagnosticsEngine::Warning,
"rewriter doesn't support user-specified control flow semantics "
@@ -756,7 +756,7 @@ void RewriteModernObjC::HandleTopLevelSi
DG.push_back(*DI);
else
break;
-
+
++DI;
} while (DI != DIEnd);
RewriteForwardClassDecl(DG);
@@ -781,14 +781,14 @@ void RewriteModernObjC::HandleTopLevelSi
DG.push_back(*DI);
else
break;
-
+
++DI;
} while (DI != DIEnd);
RewriteForwardProtocolDecl(DG);
continue;
}
}
-
+
HandleTopLevelSingleDecl(*DI);
++DI;
}
@@ -836,28 +836,28 @@ static void WriteInternalIvarName(const
Result += IvarDecl->getName();
}
-std::string
+std::string
RewriteModernObjC::getIvarAccessString(ObjCIvarDecl *D) {
const ObjCInterfaceDecl *ClassDecl = D->getContainingInterface();
-
+
// Build name of symbol holding ivar offset.
std::string IvarOffsetName;
if (D->isBitField())
ObjCIvarBitfieldGroupOffset(D, IvarOffsetName);
else
WriteInternalIvarName(ClassDecl, D, IvarOffsetName);
-
+
std::string S = "(*(";
QualType IvarT = D->getType();
if (D->isBitField())
IvarT = GetGroupRecordTypeForObjCIvarBitfield(D);
-
+
if (!isa<TypedefType>(IvarT) && IvarT->isRecordType()) {
RecordDecl *RD = IvarT->getAs<RecordType>()->getDecl();
RD = RD->getDefinition();
if (RD && !RD->getDeclName().getAsIdentifierInfo()) {
// decltype(((Foo_IMPL*)0)->bar) *
- ObjCContainerDecl *CDecl =
+ ObjCContainerDecl *CDecl =
dyn_cast<ObjCContainerDecl>(D->getDeclContext());
// ivar in class extensions requires special treatment.
if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(CDecl))
@@ -868,7 +868,7 @@ RewriteModernObjC::getIvarAccessString(O
RecordDecl::Create(*Context, TTK_Struct, TUDecl, SourceLocation(),
SourceLocation(), &Context->Idents.get(RecName));
QualType PtrStructIMPL = Context->getPointerType(Context->getTagDeclType(RD));
- unsigned UnsignedIntSize =
+ unsigned UnsignedIntSize =
static_cast<unsigned>(Context->getTypeSize(Context->UnsignedIntTy));
Expr *Zero = IntegerLiteral::Create(*Context,
llvm::APInt(UnsignedIntSize, 0),
@@ -893,7 +893,7 @@ RewriteModernObjC::getIvarAccessString(O
std::string TypeString(castT.getAsString(Context->getPrintingPolicy()));
S += TypeString;
S += ")";
-
+
// ((char *)self + IVAR_OFFSET_SYMBOL_NAME)
S += "((char *)self + ";
S += IvarOffsetName;
@@ -913,7 +913,7 @@ static bool mustSynthesizeSetterGetterMe
bool getter) {
return getter ? !IMP->getInstanceMethod(PD->getGetterName())
: !IMP->getInstanceMethod(PD->getSetterName());
-
+
}
void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
@@ -922,7 +922,7 @@ void RewriteModernObjC::RewritePropertyI
static bool objcGetPropertyDefined = false;
static bool objcSetPropertyDefined = false;
SourceLocation startGetterSetterLoc;
-
+
if (PID->getLocStart().isValid()) {
SourceLocation startLoc = PID->getLocStart();
InsertText(startLoc, "// ");
@@ -946,7 +946,7 @@ void RewriteModernObjC::RewritePropertyI
unsigned Attributes = PD->getPropertyAttributes();
if (mustSynthesizeSetterGetterMethod(IMD, PD, true /*getter*/)) {
bool GenGetProperty = !(Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) &&
- (Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
+ (Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
ObjCPropertyDecl::OBJC_PR_copy));
std::string Getr;
if (GenGetProperty && !objcGetPropertyDefined) {
@@ -955,7 +955,7 @@ void RewriteModernObjC::RewritePropertyI
Getr = "\nextern \"C\" __declspec(dllimport) "
"id objc_getProperty(id, SEL, long, bool);\n";
}
- RewriteObjCMethodDecl(OID->getContainingInterface(),
+ RewriteObjCMethodDecl(OID->getContainingInterface(),
PD->getGetterMethodDecl(), Getr);
Getr += "{ ";
// Synthesize an explicit cast to gain access to the ivar.
@@ -969,7 +969,7 @@ void RewriteModernObjC::RewritePropertyI
Getr += " _TYPE";
if (FPRetType) {
Getr += ")"; // close the precedence "scope" for "*".
-
+
// Now, emit the argument types (if any).
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){
Getr += "(";
@@ -999,14 +999,14 @@ void RewriteModernObjC::RewritePropertyI
Getr += "; }";
InsertText(startGetterSetterLoc, Getr);
}
-
- if (PD->isReadOnly() ||
+
+ if (PD->isReadOnly() ||
!mustSynthesizeSetterGetterMethod(IMD, PD, false /*setter*/))
return;
// Generate the 'setter' function.
std::string Setr;
- bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
+ bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
ObjCPropertyDecl::OBJC_PR_copy);
if (GenSetProperty && !objcSetPropertyDefined) {
objcSetPropertyDefined = true;
@@ -1015,7 +1015,7 @@ void RewriteModernObjC::RewritePropertyI
"void objc_setProperty (id, SEL, long, id, bool, bool);\n";
}
- RewriteObjCMethodDecl(OID->getContainingInterface(),
+ RewriteObjCMethodDecl(OID->getContainingInterface(),
PD->getSetterMethodDecl(), Setr);
Setr += "{ ";
// Synthesize an explicit cast to initialize the ivar.
@@ -1063,9 +1063,9 @@ void RewriteModernObjC::RewriteForwardCl
const std::string &typedefString) {
SourceLocation startLoc = ClassDecl->getLocStart();
const char *startBuf = SM->getCharacterData(startLoc);
- const char *semiPtr = strchr(startBuf, ';');
+ const char *semiPtr = strchr(startBuf, ';');
// Replace the @class with typedefs corresponding to the classes.
- ReplaceText(startLoc, semiPtr-startBuf+1, typedefString);
+ ReplaceText(startLoc, semiPtr-startBuf+1, typedefString);
}
void RewriteModernObjC::RewriteForwardClassDecl(DeclGroupRef D) {
@@ -1139,24 +1139,24 @@ void RewriteModernObjC::RewriteCategoryD
else {
ReplaceText(LocStart, 0, "// ");
}
-
+
for (auto *I : CatDecl->instance_properties())
RewriteProperty(I);
-
+
for (auto *I : CatDecl->instance_methods())
RewriteMethodDeclaration(I);
for (auto *I : CatDecl->class_methods())
RewriteMethodDeclaration(I);
// Lastly, comment out the @end.
- ReplaceText(CatDecl->getAtEndRange().getBegin(),
+ ReplaceText(CatDecl->getAtEndRange().getBegin(),
strlen("@end"), "/* @end */\n");
}
void RewriteModernObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
SourceLocation LocStart = PDecl->getLocStart();
assert(PDecl->isThisDeclarationADefinition());
-
+
// FIXME: handle protocol headers that are declared across multiple lines.
ReplaceText(LocStart, 0, "// ");
@@ -1166,7 +1166,7 @@ void RewriteModernObjC::RewriteProtocolD
RewriteMethodDeclaration(I);
for (auto *I : PDecl->instance_properties())
RewriteProperty(I);
-
+
// Lastly, comment out the @end.
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
ReplaceText(LocEnd, strlen("@end"), "/* @end */\n");
@@ -1196,7 +1196,7 @@ void RewriteModernObjC::RewriteForwardPr
ReplaceText(LocStart, 0, "// ");
}
-void
+void
RewriteModernObjC::RewriteForwardProtocolDecl(const SmallVectorImpl<Decl *> &DG) {
SourceLocation LocStart = DG[0]->getLocStart();
if (LocStart.isInvalid())
@@ -1390,11 +1390,11 @@ void RewriteModernObjC::RewriteInterface
// we haven't seen a forward decl - generate a typedef.
RewriteOneForwardClassDecl(ClassDecl, ResultStr);
RewriteIvarOffsetSymbols(ClassDecl, ResultStr);
-
+
RewriteObjCInternalStruct(ClassDecl, ResultStr);
// Mark this typedef as having been written into its c++ equivalent.
ObjCWrittenInterfaces.insert(ClassDecl->getCanonicalDecl());
-
+
for (auto *I : ClassDecl->instance_properties())
RewriteProperty(I);
for (auto *I : ClassDecl->instance_methods())
@@ -1403,7 +1403,7 @@ void RewriteModernObjC::RewriteInterface
RewriteMethodDeclaration(I);
// Lastly, comment out the @end.
- ReplaceText(ClassDecl->getAtEndRange().getBegin(), strlen("@end"),
+ ReplaceText(ClassDecl->getAtEndRange().getBegin(), strlen("@end"),
"/* @end */\n");
}
}
@@ -1431,7 +1431,7 @@ Stmt *RewriteModernObjC::RewriteProperty
Base = cast<OpaqueValueExpr>(Base)->getSourceExpr();
Base = cast<Expr>(RewriteFunctionBodyOrGlobalInitializer(Base));
}
-
+
unsigned numArgs = OldMsg->getNumArgs();
for (unsigned i = 0; i < numArgs; i++) {
Expr *Arg = OldMsg->getArg(i);
@@ -1869,11 +1869,11 @@ Stmt *RewriteModernObjC::RewriteObjCSync
SourceLocation SynchLoc = S->getAtSynchronizedLoc();
ConvertSourceLocationToLineDirective(SynchLoc, buf);
buf += "{ id _rethrow = 0; id _sync_obj = (id)";
-
+
const char *lparenBuf = startBuf;
while (*lparenBuf != '(') lparenBuf++;
ReplaceText(startLoc, lparenBuf-startBuf+1, buf);
-
+
buf = "; objc_sync_enter(_sync_obj);\n";
buf += "try {\n\tstruct _SYNC_EXIT { _SYNC_EXIT(id arg) : sync_exit(arg) {}";
buf += "\n\t~_SYNC_EXIT() {objc_sync_exit(sync_exit);}";
@@ -1887,16 +1887,16 @@ Stmt *RewriteModernObjC::RewriteObjCSync
const char *RParenExprLocBuf = SM->getCharacterData(RParenExprLoc);
while (*RParenExprLocBuf != ')') RParenExprLocBuf--;
RParenExprLoc = startLoc.getLocWithOffset(RParenExprLocBuf-startBuf);
-
+
SourceLocation LBranceLoc = S->getSynchBody()->getLocStart();
const char *LBraceLocBuf = SM->getCharacterData(LBranceLoc);
assert (*LBraceLocBuf == '{');
ReplaceText(RParenExprLoc, (LBraceLocBuf - SM->getCharacterData(RParenExprLoc) + 1), buf);
-
+
SourceLocation startRBraceLoc = S->getSynchBody()->getLocEnd();
assert((*SM->getCharacterData(startRBraceLoc) == '}') &&
"bogus @synchronized block");
-
+
buf = "} catch (id e) {_rethrow = e;}\n";
Write_RethrowObject(buf);
buf += "}\n";
@@ -1923,7 +1923,7 @@ void RewriteModernObjC::WarnAboutReturnG
Stmt *RewriteModernObjC::RewriteObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S) {
SourceLocation startLoc = S->getAtLoc();
ReplaceText(startLoc, strlen("@autoreleasepool"), "/* @autoreleasepool */");
- ReplaceText(S->getSubStmt()->getLocStart(), 1,
+ ReplaceText(S->getSubStmt()->getLocStart(), 1,
"{ __AtAutoreleasePool __autoreleasepool; ");
return nullptr;
@@ -1935,7 +1935,7 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
std::string buf;
SourceLocation TryLocation = S->getAtTryLoc();
ConvertSourceLocationToLineDirective(TryLocation, buf);
-
+
if (finalStmt) {
if (noCatch)
buf += "{ id volatile _rethrow = 0;\n";
@@ -1953,11 +1953,11 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
else
// @try -> try
ReplaceText(startLoc, 1, "");
-
+
for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
ObjCAtCatchStmt *Catch = S->getCatchStmt(I);
VarDecl *catchDecl = Catch->getCatchParamDecl();
-
+
startLoc = Catch->getLocStart();
bool AtRemoved = false;
if (catchDecl) {
@@ -1968,12 +1968,12 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
if (IDecl) {
std::string Result;
ConvertSourceLocationToLineDirective(Catch->getLocStart(), Result);
-
+
startBuf = SM->getCharacterData(startLoc);
assert((*startBuf == '@') && "bogus @catch location");
SourceLocation rParenLoc = Catch->getRParenLoc();
const char *rParenBuf = SM->getCharacterData(rParenLoc);
-
+
// _objc_exc_Foo *_e as argument to catch.
Result += "catch (_objc_exc_"; Result += IDecl->getNameAsString();
Result += " *_"; Result += catchDecl->getNameAsString();
@@ -1986,7 +1986,7 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
Result += " *"; Result += catchDecl->getNameAsString();
Result += " = ("; Result += IDecl->getNameAsString(); Result += "*)";
Result += "_"; Result += catchDecl->getNameAsString();
-
+
Result += "; ";
SourceLocation lBraceLoc = Catch->getCatchBody()->getLocStart();
ReplaceText(lBraceLoc, 1, Result);
@@ -1997,12 +1997,12 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
if (!AtRemoved)
// @catch -> catch
ReplaceText(startLoc, 1, "");
-
+
}
if (finalStmt) {
buf.clear();
SourceLocation FinallyLoc = finalStmt->getLocStart();
-
+
if (noCatch) {
ConvertSourceLocationToLineDirective(FinallyLoc, buf);
buf += "catch (id e) {_rethrow = e;}\n";
@@ -2012,7 +2012,7 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
ConvertSourceLocationToLineDirective(FinallyLoc, buf);
buf += "catch (id e) {_rethrow = e;}\n";
}
-
+
SourceLocation startFinalLoc = finalStmt->getLocStart();
ReplaceText(startFinalLoc, 8, buf);
Stmt *body = finalStmt->getFinallyBody();
@@ -2020,7 +2020,7 @@ Stmt *RewriteModernObjC::RewriteObjCTryS
buf.clear();
Write_RethrowObject(buf);
ReplaceText(startFinalBodyLoc, 1, buf);
-
+
SourceLocation endFinalBodyLoc = body->getLocEnd();
ReplaceText(endFinalBodyLoc, 1, "}\n}");
// Now check for any return/continue/go statements within the @try.
@@ -2102,7 +2102,7 @@ RewriteModernObjC::SynthesizeCallToFunct
// Now, we cast the reference to a pointer to the objc_msgSend type.
QualType pToFunc = Context->getPointerType(msgSendType);
- ImplicitCastExpr *ICE =
+ ImplicitCastExpr *ICE =
ImplicitCastExpr::Create(*Context, pToFunc, CK_FunctionToPointerDecay,
DRE, nullptr, VK_RValue);
@@ -2525,7 +2525,7 @@ void RewriteModernObjC::SynthGetClassFun
// SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls);
void RewriteModernObjC::SynthGetSuperClassFunctionDecl() {
- IdentifierInfo *getSuperClassIdent =
+ IdentifierInfo *getSuperClassIdent =
&Context->Idents.get("class_getSuperclass");
SmallVector<QualType, 16> ArgTys;
ArgTys.push_back(Context->getObjCClassType());
@@ -2602,13 +2602,13 @@ Stmt *RewriteModernObjC::RewriteObjCStri
Stmt *RewriteModernObjC::RewriteObjCBoolLiteralExpr(ObjCBoolLiteralExpr *Exp) {
unsigned IntSize =
static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
-
- Expr *FlagExp = IntegerLiteral::Create(*Context,
- llvm::APInt(IntSize, Exp->getValue()),
+
+ Expr *FlagExp = IntegerLiteral::Create(*Context,
+ llvm::APInt(IntSize, Exp->getValue()),
Context->IntTy, Exp->getLocation());
CastExpr *cast = NoTypeInfoCStyleCastExpr(Context, Context->ObjCBuiltinBoolTy,
CK_BitCast, FlagExp);
- ParenExpr *PE = new (Context) ParenExpr(Exp->getLocation(), Exp->getExprLoc(),
+ ParenExpr *PE = new (Context) ParenExpr(Exp->getLocation(), Exp->getExprLoc(),
cast);
ReplaceStmt(Exp, PE);
return PE;
@@ -2623,25 +2623,25 @@ Stmt *RewriteModernObjC::RewriteObjCBoxe
SynthMsgSendFunctionDecl();
if (!GetClassFunctionDecl)
SynthGetClassFunctionDecl();
-
+
FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
SourceLocation StartLoc = Exp->getLocStart();
SourceLocation EndLoc = Exp->getLocEnd();
-
+
// Synthesize a call to objc_msgSend().
SmallVector<Expr*, 4> MsgExprs;
SmallVector<Expr*, 4> ClsExprs;
-
+
// Create a call to objc_getClass("<BoxingClass>"). It will be the 1st argument.
ObjCMethodDecl *BoxingMethod = Exp->getBoxingMethod();
ObjCInterfaceDecl *BoxingClass = BoxingMethod->getClassInterface();
-
+
IdentifierInfo *clsName = BoxingClass->getIdentifier();
ClsExprs.push_back(getStringLiteral(clsName->getName()));
CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl, ClsExprs,
StartLoc, EndLoc);
MsgExprs.push_back(Cls);
-
+
// Create a call to sel_registerName("<BoxingMethod>:"), etc.
// it will be the 2nd argument.
SmallVector<Expr*, 4> SelExprs;
@@ -2650,7 +2650,7 @@ Stmt *RewriteModernObjC::RewriteObjCBoxe
CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
SelExprs, StartLoc, EndLoc);
MsgExprs.push_back(SelExp);
-
+
// User provided sub-expression is the 3rd, and last, argument.
Expr *subExpr = Exp->getSubExpr();
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(subExpr)) {
@@ -2662,35 +2662,35 @@ Stmt *RewriteModernObjC::RewriteObjCBoxe
subExpr = NoTypeInfoCStyleCastExpr(Context, type, CK, subExpr);
}
MsgExprs.push_back(subExpr);
-
+
SmallVector<QualType, 4> ArgTypes;
ArgTypes.push_back(Context->getObjCClassType());
ArgTypes.push_back(Context->getObjCSelType());
for (const auto PI : BoxingMethod->parameters())
ArgTypes.push_back(PI->getType());
-
+
QualType returnType = Exp->getType();
// Get the type, we will need to reference it in a couple spots.
QualType msgSendType = MsgSendFlavor->getType();
-
+
// Create a reference to the objc_msgSend() declaration.
DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, false, msgSendType,
VK_LValue, SourceLocation());
-
+
CastExpr *cast = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(Context->VoidTy),
CK_BitCast, DRE);
-
+
// Now do the "normal" pointer to function cast.
QualType castType =
getSimpleFunctionType(returnType, ArgTypes, BoxingMethod->isVariadic());
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
cast);
-
+
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast);
-
+
const FunctionType *FT = msgSendType->getAs<FunctionType>();
CallExpr *CE = new (Context)
CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc);
@@ -2707,24 +2707,24 @@ Stmt *RewriteModernObjC::RewriteObjCArra
SynthMsgSendFunctionDecl();
if (!GetClassFunctionDecl)
SynthGetClassFunctionDecl();
-
+
FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
SourceLocation StartLoc = Exp->getLocStart();
SourceLocation EndLoc = Exp->getLocEnd();
-
+
// Build the expression: __NSContainer_literal(int, ...).arr
QualType IntQT = Context->IntTy;
QualType NSArrayFType =
getSimpleFunctionType(Context->VoidTy, IntQT, true);
std::string NSArrayFName("__NSContainer_literal");
FunctionDecl *NSArrayFD = SynthBlockInitFunctionDecl(NSArrayFName);
- DeclRefExpr *NSArrayDRE =
+ DeclRefExpr *NSArrayDRE =
new (Context) DeclRefExpr(NSArrayFD, false, NSArrayFType, VK_RValue,
SourceLocation());
SmallVector<Expr*, 16> InitExprs;
unsigned NumElements = Exp->getNumElements();
- unsigned UnsignedIntSize =
+ unsigned UnsignedIntSize =
static_cast<unsigned>(Context->getTypeSize(Context->UnsignedIntTy));
Expr *count = IntegerLiteral::Create(*Context,
llvm::APInt(UnsignedIntSize, NumElements),
@@ -2732,7 +2732,7 @@ Stmt *RewriteModernObjC::RewriteObjCArra
InitExprs.push_back(count);
for (unsigned i = 0; i < NumElements; i++)
InitExprs.push_back(Exp->getElement(i));
- Expr *NSArrayCallExpr =
+ Expr *NSArrayCallExpr =
new (Context) CallExpr(*Context, NSArrayDRE, InitExprs,
NSArrayFType, VK_LValue, SourceLocation());
@@ -2746,27 +2746,27 @@ Stmt *RewriteModernObjC::RewriteObjCArra
MemberExpr(NSArrayCallExpr, false, SourceLocation(), ARRFD,
SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary);
QualType ConstIdT = Context->getObjCIdType().withConst();
- CStyleCastExpr * ArrayLiteralObjects =
- NoTypeInfoCStyleCastExpr(Context,
+ CStyleCastExpr * ArrayLiteralObjects =
+ NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(ConstIdT),
CK_BitCast,
ArrayLiteralME);
-
+
// Synthesize a call to objc_msgSend().
SmallVector<Expr*, 32> MsgExprs;
SmallVector<Expr*, 4> ClsExprs;
QualType expType = Exp->getType();
-
+
// Create a call to objc_getClass("NSArray"). It will be th 1st argument.
- ObjCInterfaceDecl *Class =
+ ObjCInterfaceDecl *Class =
expType->getPointeeType()->getAs<ObjCObjectType>()->getInterface();
-
+
IdentifierInfo *clsName = Class->getIdentifier();
ClsExprs.push_back(getStringLiteral(clsName->getName()));
CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl, ClsExprs,
StartLoc, EndLoc);
MsgExprs.push_back(Cls);
-
+
// Create a call to sel_registerName("arrayWithObjects:count:").
// it will be the 2nd argument.
SmallVector<Expr*, 4> SelExprs;
@@ -2776,44 +2776,44 @@ Stmt *RewriteModernObjC::RewriteObjCArra
CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
SelExprs, StartLoc, EndLoc);
MsgExprs.push_back(SelExp);
-
+
// (const id [])objects
MsgExprs.push_back(ArrayLiteralObjects);
-
+
// (NSUInteger)cnt
Expr *cnt = IntegerLiteral::Create(*Context,
llvm::APInt(UnsignedIntSize, NumElements),
Context->UnsignedIntTy, SourceLocation());
MsgExprs.push_back(cnt);
-
+
SmallVector<QualType, 4> ArgTypes;
ArgTypes.push_back(Context->getObjCClassType());
ArgTypes.push_back(Context->getObjCSelType());
for (const auto *PI : ArrayMethod->parameters())
ArgTypes.push_back(PI->getType());
-
+
QualType returnType = Exp->getType();
// Get the type, we will need to reference it in a couple spots.
QualType msgSendType = MsgSendFlavor->getType();
-
+
// Create a reference to the objc_msgSend() declaration.
DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, false, msgSendType,
VK_LValue, SourceLocation());
-
+
CastExpr *cast = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(Context->VoidTy),
CK_BitCast, DRE);
-
+
// Now do the "normal" pointer to function cast.
QualType castType =
getSimpleFunctionType(returnType, ArgTypes, ArrayMethod->isVariadic());
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
cast);
-
+
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast);
-
+
const FunctionType *FT = msgSendType->getAs<FunctionType>();
CallExpr *CE = new (Context)
CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc);
@@ -2830,26 +2830,26 @@ Stmt *RewriteModernObjC::RewriteObjCDict
SynthMsgSendFunctionDecl();
if (!GetClassFunctionDecl)
SynthGetClassFunctionDecl();
-
+
FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
SourceLocation StartLoc = Exp->getLocStart();
SourceLocation EndLoc = Exp->getLocEnd();
-
+
// Build the expression: __NSContainer_literal(int, ...).arr
QualType IntQT = Context->IntTy;
QualType NSDictFType =
getSimpleFunctionType(Context->VoidTy, IntQT, true);
std::string NSDictFName("__NSContainer_literal");
FunctionDecl *NSDictFD = SynthBlockInitFunctionDecl(NSDictFName);
- DeclRefExpr *NSDictDRE =
+ DeclRefExpr *NSDictDRE =
new (Context) DeclRefExpr(NSDictFD, false, NSDictFType, VK_RValue,
SourceLocation());
-
+
SmallVector<Expr*, 16> KeyExprs;
SmallVector<Expr*, 16> ValueExprs;
-
+
unsigned NumElements = Exp->getNumElements();
- unsigned UnsignedIntSize =
+ unsigned UnsignedIntSize =
static_cast<unsigned>(Context->getTypeSize(Context->UnsignedIntTy));
Expr *count = IntegerLiteral::Create(*Context,
llvm::APInt(UnsignedIntSize, NumElements),
@@ -2861,9 +2861,9 @@ Stmt *RewriteModernObjC::RewriteObjCDict
KeyExprs.push_back(Element.Key);
ValueExprs.push_back(Element.Value);
}
-
+
// (const id [])objects
- Expr *NSValueCallExpr =
+ Expr *NSValueCallExpr =
new (Context) CallExpr(*Context, NSDictDRE, ValueExprs,
NSDictFType, VK_LValue, SourceLocation());
@@ -2877,13 +2877,13 @@ Stmt *RewriteModernObjC::RewriteObjCDict
MemberExpr(NSValueCallExpr, false, SourceLocation(), ARRFD,
SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary);
QualType ConstIdT = Context->getObjCIdType().withConst();
- CStyleCastExpr * DictValueObjects =
- NoTypeInfoCStyleCastExpr(Context,
+ CStyleCastExpr * DictValueObjects =
+ NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(ConstIdT),
CK_BitCast,
DictLiteralValueME);
// (const id <NSCopying> [])keys
- Expr *NSKeyCallExpr =
+ Expr *NSKeyCallExpr =
new (Context) CallExpr(*Context, NSDictDRE, KeyExprs,
NSDictFType, VK_LValue, SourceLocation());
@@ -2891,27 +2891,27 @@ Stmt *RewriteModernObjC::RewriteObjCDict
MemberExpr(NSKeyCallExpr, false, SourceLocation(), ARRFD,
SourceLocation(), ARRFD->getType(), VK_LValue, OK_Ordinary);
- CStyleCastExpr * DictKeyObjects =
- NoTypeInfoCStyleCastExpr(Context,
+ CStyleCastExpr * DictKeyObjects =
+ NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(ConstIdT),
CK_BitCast,
DictLiteralKeyME);
-
+
// Synthesize a call to objc_msgSend().
SmallVector<Expr*, 32> MsgExprs;
SmallVector<Expr*, 4> ClsExprs;
QualType expType = Exp->getType();
-
+
// Create a call to objc_getClass("NSArray"). It will be th 1st argument.
- ObjCInterfaceDecl *Class =
+ ObjCInterfaceDecl *Class =
expType->getPointeeType()->getAs<ObjCObjectType>()->getInterface();
-
+
IdentifierInfo *clsName = Class->getIdentifier();
ClsExprs.push_back(getStringLiteral(clsName->getName()));
CallExpr *Cls = SynthesizeCallToFunctionDecl(GetClassFunctionDecl, ClsExprs,
StartLoc, EndLoc);
MsgExprs.push_back(Cls);
-
+
// Create a call to sel_registerName("arrayWithObjects:count:").
// it will be the 2nd argument.
SmallVector<Expr*, 4> SelExprs;
@@ -2920,19 +2920,19 @@ Stmt *RewriteModernObjC::RewriteObjCDict
CallExpr *SelExp = SynthesizeCallToFunctionDecl(SelGetUidFunctionDecl,
SelExprs, StartLoc, EndLoc);
MsgExprs.push_back(SelExp);
-
+
// (const id [])objects
MsgExprs.push_back(DictValueObjects);
-
+
// (const id <NSCopying> [])keys
MsgExprs.push_back(DictKeyObjects);
-
+
// (NSUInteger)cnt
Expr *cnt = IntegerLiteral::Create(*Context,
llvm::APInt(UnsignedIntSize, NumElements),
Context->UnsignedIntTy, SourceLocation());
MsgExprs.push_back(cnt);
-
+
SmallVector<QualType, 8> ArgTypes;
ArgTypes.push_back(Context->getObjCClassType());
ArgTypes.push_back(Context->getObjCSelType());
@@ -2945,29 +2945,29 @@ Stmt *RewriteModernObjC::RewriteObjCDict
}
ArgTypes.push_back(T);
}
-
+
QualType returnType = Exp->getType();
// Get the type, we will need to reference it in a couple spots.
QualType msgSendType = MsgSendFlavor->getType();
-
+
// Create a reference to the objc_msgSend() declaration.
DeclRefExpr *DRE = new (Context) DeclRefExpr(MsgSendFlavor, false, msgSendType,
VK_LValue, SourceLocation());
-
+
CastExpr *cast = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(Context->VoidTy),
CK_BitCast, DRE);
-
+
// Now do the "normal" pointer to function cast.
QualType castType =
getSimpleFunctionType(returnType, ArgTypes, DictMethod->isVariadic());
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
cast);
-
+
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast);
-
+
const FunctionType *FT = msgSendType->getAs<FunctionType>();
CallExpr *CE = new (Context)
CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc);
@@ -2975,8 +2975,8 @@ Stmt *RewriteModernObjC::RewriteObjCDict
return CE;
}
-// struct __rw_objc_super {
-// struct objc_object *object; struct objc_object *superClass;
+// struct __rw_objc_super {
+// struct objc_object *object; struct objc_object *superClass;
// };
QualType RewriteModernObjC::getSuperStructType() {
if (!SuperStructDecl) {
@@ -3057,9 +3057,9 @@ static SourceLocation getFunctionSourceL
}
void RewriteModernObjC::RewriteLineDirective(const Decl *D) {
-
+
SourceLocation Location = D->getLocation();
-
+
if (Location.isFileID() && GenerateLineInfo) {
std::string LineString("\n#line ");
PresumedLoc PLoc = SM->getPresumedLoc(Location);
@@ -3069,7 +3069,7 @@ void RewriteModernObjC::RewriteLineDirec
if (isa<ObjCMethodDecl>(D))
LineString += "\"";
else LineString += "\"\n";
-
+
Location = D->getLocStart();
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
if (FD->isExternC() && !FD->isMain()) {
@@ -3091,11 +3091,11 @@ void RewriteModernObjC::RewriteLineDirec
/// msgSendType - function type of objc_msgSend_stret(...)
/// returnType - Result type of the method being synthesized.
/// ArgTypes - type of the arguments passed to objc_msgSend_stret, starting with receiver type.
-/// MsgExprs - list of argument expressions being passed to objc_msgSend_stret,
+/// MsgExprs - list of argument expressions being passed to objc_msgSend_stret,
/// starting with receiver.
/// Method - Method being rewritten.
Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFlavor,
- QualType returnType,
+ QualType returnType,
SmallVectorImpl<QualType> &ArgTypes,
SmallVectorImpl<Expr*> &MsgExprs,
ObjCMethodDecl *Method) {
@@ -3104,11 +3104,11 @@ Expr *RewriteModernObjC::SynthMsgSendStr
Method ? Method->isVariadic()
: false);
castType = Context->getPointerType(castType);
-
+
// build type for containing the objc_msgSend_stret object.
static unsigned stretCount=0;
std::string name = "__Stret"; name += utostr(stretCount);
- std::string str =
+ std::string str =
"extern \"C\" void * __cdecl memset(void *_Dst, int _Val, size_t _Size);\n";
str += "namespace {\n";
str += "struct "; str += name;
@@ -3127,13 +3127,13 @@ Expr *RewriteModernObjC::SynthMsgSendStr
Context->getPrintingPolicy());
str += ", "; str += ArgName;
}
-
+
str += ") {\n";
str += "\t unsigned size = sizeof(";
str += returnType.getAsString(Context->getPrintingPolicy()); str += ");\n";
-
+
str += "\t if (size == 1 || size == 2 || size == 4 || size == 8)\n";
-
+
str += "\t s = (("; str += castType.getAsString(Context->getPrintingPolicy());
str += ")(void *)objc_msgSend)(receiver, sel";
for (unsigned i = 2; i < ArgTypes.size(); i++) {
@@ -3144,11 +3144,11 @@ Expr *RewriteModernObjC::SynthMsgSendStr
str += ", arg"; str += utostr(i);
}
str+= ");\n";
-
+
str += "\t else if (receiver == 0)\n";
str += "\t memset((void*)&s, 0, sizeof(s));\n";
str += "\t else\n";
-
+
str += "\t s = (("; str += castType.getAsString(Context->getPrintingPolicy());
str += ")(void *)objc_msgSend_stret)(receiver, sel";
for (unsigned i = 2; i < ArgTypes.size(); i++) {
@@ -3159,7 +3159,7 @@ Expr *RewriteModernObjC::SynthMsgSendStr
str += ", arg"; str += utostr(i);
}
str += ");\n";
-
+
str += "\t}\n";
str += "\t"; str += returnType.getAsString(Context->getPrintingPolicy());
str += " s;\n";
@@ -3174,7 +3174,7 @@ Expr *RewriteModernObjC::SynthMsgSendStr
InsertText(FunLocStart, str);
++stretCount;
-
+
// AST for __Stretn(receiver, args).s;
IdentifierInfo *ID = &Context->Idents.get(name);
FunctionDecl *FD = FunctionDecl::Create(*Context, TUDecl, SourceLocation(),
@@ -3266,7 +3266,7 @@ Stmt *RewriteModernObjC::SynthMessageExp
ClsExprs.push_back(Cls);
Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl, ClsExprs,
StartLoc, EndLoc);
-
+
// (id)class_getSuperclass((Class)objc_getClass("CurrentClass"))
// To turn off a warning, type-cast to 'id'
InitExprs.push_back( // set 'super class', using class_getSuperclass().
@@ -3350,7 +3350,7 @@ Stmt *RewriteModernObjC::SynthMessageExp
Context->getObjCIdType(),
VK_RValue, SourceLocation()))
); // set the 'receiver'.
-
+
// (id)class_getSuperclass((Class)objc_getClass("CurrentClass"))
SmallVector<Expr*, 8> ClsExprs;
ClsExprs.push_back(getStringLiteral(ClassDecl->getIdentifier()->getName()));
@@ -3361,7 +3361,7 @@ Stmt *RewriteModernObjC::SynthMessageExp
ClsExprs.push_back(Cls);
Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl, ClsExprs,
StartLoc, EndLoc);
-
+
// (id)class_getSuperclass((Class)objc_getClass("CurrentClass"))
// To turn off a warning, type-cast to 'id'
InitExprs.push_back(
@@ -3446,7 +3446,7 @@ Stmt *RewriteModernObjC::SynthMessageExp
(void)convertBlockPointerToFunctionPointer(type);
const Expr *SubExpr = ICE->IgnoreParenImpCasts();
CastKind CK;
- if (SubExpr->getType()->isIntegralType(*Context) &&
+ if (SubExpr->getType()->isIntegralType(*Context) &&
type->isBooleanType()) {
CK = CK_IntegralToBoolean;
} else if (type->isObjCObjectPointerType()) {
@@ -3591,7 +3591,7 @@ QualType RewriteModernObjC::getProtocolT
/// The forward references (and metadata) are generated in
/// RewriteModernObjC::HandleTranslationUnit().
Stmt *RewriteModernObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) {
- std::string Name = "_OBJC_PROTOCOL_REFERENCE_$_" +
+ std::string Name = "_OBJC_PROTOCOL_REFERENCE_$_" +
Exp->getProtocol()->getNameAsString();
IdentifierInfo *ID = &Context->Idents.get(Name);
VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
@@ -3608,9 +3608,9 @@ Stmt *RewriteModernObjC::RewriteObjCProt
return castExpr;
}
-/// IsTagDefinedInsideClass - This routine checks that a named tagged type
-/// is defined inside an objective-c class. If so, it returns true.
-bool RewriteModernObjC::IsTagDefinedInsideClass(ObjCContainerDecl *IDecl,
+/// IsTagDefinedInsideClass - This routine checks that a named tagged type
+/// is defined inside an objective-c class. If so, it returns true.
+bool RewriteModernObjC::IsTagDefinedInsideClass(ObjCContainerDecl *IDecl,
TagDecl *Tag,
bool &IsNamedDefinition) {
if (!IDecl)
@@ -3638,13 +3638,13 @@ bool RewriteModernObjC::IsTagDefinedInsi
/// RewriteObjCFieldDeclType - This routine rewrites a type into the buffer.
/// It handles elaborated types, as well as enum types in the process.
-bool RewriteModernObjC::RewriteObjCFieldDeclType(QualType &Type,
+bool RewriteModernObjC::RewriteObjCFieldDeclType(QualType &Type,
std::string &Result) {
if (isa<TypedefType>(Type)) {
Result += "\t";
return false;
}
-
+
if (Type->isArrayType()) {
QualType ElemTy = Context->getBaseElementType(Type);
return RewriteObjCFieldDeclType(ElemTy, Result);
@@ -3658,7 +3658,7 @@ bool RewriteModernObjC::RewriteObjCField
Result += "\n\tunion ";
else
assert(false && "class not allowed as an ivar type");
-
+
Result += RD->getName();
if (GlobalDefinedTags.count(RD)) {
// struct/union is defined globally, use it.
@@ -3668,7 +3668,7 @@ bool RewriteModernObjC::RewriteObjCField
Result += " {\n";
for (auto *FD : RD->fields())
RewriteObjCFieldDecl(FD, Result);
- Result += "\t} ";
+ Result += "\t} ";
return true;
}
}
@@ -3682,7 +3682,7 @@ bool RewriteModernObjC::RewriteObjCField
Result += " ";
return true;
}
-
+
Result += " {\n";
for (const auto *EC : ED->enumerators()) {
Result += "\t"; Result += EC->getName(); Result += " = ";
@@ -3690,11 +3690,11 @@ bool RewriteModernObjC::RewriteObjCField
Result += Val.toString(10);
Result += ",\n";
}
- Result += "\t} ";
+ Result += "\t} ";
return true;
}
}
-
+
Result += "\t";
convertObjCTypeToCStyleType(Type);
return false;
@@ -3703,12 +3703,12 @@ bool RewriteModernObjC::RewriteObjCField
/// RewriteObjCFieldDecl - This routine rewrites a field into the buffer.
/// It handles elaborated types, as well as enum types in the process.
-void RewriteModernObjC::RewriteObjCFieldDecl(FieldDecl *fieldDecl,
+void RewriteModernObjC::RewriteObjCFieldDecl(FieldDecl *fieldDecl,
std::string &Result) {
QualType Type = fieldDecl->getType();
std::string Name = fieldDecl->getNameAsString();
-
- bool EleboratedType = RewriteObjCFieldDeclType(Type, Result);
+
+ bool EleboratedType = RewriteObjCFieldDeclType(Type, Result);
if (!EleboratedType)
Type.getAsStringInternal(Name, Context->getPrintingPolicy());
Result += Name;
@@ -3727,20 +3727,20 @@ void RewriteModernObjC::RewriteObjCField
AT = Context->getAsArrayType(AT->getElementType());
} while (AT);
}
-
+
Result += ";\n";
}
/// RewriteLocallyDefinedNamedAggregates - This routine rewrites locally defined
/// named aggregate types into the input buffer.
-void RewriteModernObjC::RewriteLocallyDefinedNamedAggregates(FieldDecl *fieldDecl,
+void RewriteModernObjC::RewriteLocallyDefinedNamedAggregates(FieldDecl *fieldDecl,
std::string &Result) {
QualType Type = fieldDecl->getType();
if (isa<TypedefType>(Type))
return;
if (Type->isArrayType())
Type = Context->getBaseElementType(Type);
- ObjCContainerDecl *IDecl =
+ ObjCContainerDecl *IDecl =
dyn_cast<ObjCContainerDecl>(fieldDecl->getDeclContext());
TagDecl *TD = nullptr;
@@ -3750,11 +3750,11 @@ void RewriteModernObjC::RewriteLocallyDe
else if (Type->isEnumeralType()) {
TD = Type->getAs<EnumType>()->getDecl();
}
-
+
if (TD) {
if (GlobalDefinedTags.count(TD))
return;
-
+
bool IsNamedDefinition = false;
if (IsTagDefinedInsideClass(IDecl, TD, IsNamedDefinition)) {
RewriteObjCFieldDeclType(Type, Result);
@@ -3775,7 +3775,7 @@ unsigned RewriteModernObjC::ObjCIvarBitf
for (const ObjCIvarDecl *IVD = CDecl->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar())
IVars.push_back(IVD);
-
+
for (unsigned i = 0, e = IVars.size(); i < e; i++)
if (IVars[i]->isBitField()) {
IvarGroupNumber[IVars[i++]] = ++GroupNo;
@@ -3816,7 +3816,7 @@ QualType RewriteModernObjC::GetGroupReco
std::pair<const ObjCInterfaceDecl*, unsigned> tuple = std::make_pair(CDecl, GroupNo);
if (GroupRecordType.count(tuple))
return GroupRecordType[tuple];
-
+
SmallVector<ObjCIvarDecl *, 8> IVars;
for (const ObjCIvarDecl *IVD = CDecl->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar()) {
@@ -3840,7 +3840,7 @@ QualType RewriteModernObjC::GetGroupReco
}
QualType RetQT = GroupRecordType[tuple];
assert(!RetQT.isNull() && "GetGroupRecordTypeForObjCIvarBitfield struct type is NULL");
-
+
return RetQT;
}
@@ -3895,13 +3895,13 @@ void RewriteModernObjC::RewriteObjCInter
for (ObjCIvarDecl *IVD = CDecl->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar())
IVars.push_back(IVD);
-
+
SourceLocation LocStart = CDecl->getLocStart();
SourceLocation LocEnd = CDecl->getEndOfDefinitionLoc();
-
+
const char *startBuf = SM->getCharacterData(LocStart);
const char *endBuf = SM->getCharacterData(LocEnd);
-
+
// If no ivars and no root or if its root, directly or indirectly,
// have no ivars (thus not synthesized) then no need to synthesize this class.
if ((!CDecl->isThisDeclarationADefinition() || IVars.size() == 0) &&
@@ -3910,13 +3910,13 @@ void RewriteModernObjC::RewriteObjCInter
ReplaceText(LocStart, endBuf-startBuf, Result);
return;
}
-
+
// Insert named struct/union definitions inside class to
// outer scope. This follows semantics of locally defined
// struct/unions in objective-c classes.
for (unsigned i = 0, e = IVars.size(); i < e; i++)
RewriteLocallyDefinedNamedAggregates(IVars[i], Result);
-
+
// Insert named structs which are syntheized to group ivar bitfields
// to outer scope as well.
for (unsigned i = 0, e = IVars.size(); i < e; i++)
@@ -3928,17 +3928,17 @@ void RewriteModernObjC::RewriteObjCInter
// skip over ivar bitfields in this group.
SKIP_BITFIELDS(i , e, IVars);
}
-
+
Result += "\nstruct ";
Result += CDecl->getNameAsString();
Result += "_IMPL {\n";
-
+
if (RCDecl && ObjCSynthesizedStructs.count(RCDecl)) {
Result += "\tstruct "; Result += RCDecl->getNameAsString();
Result += "_IMPL "; Result += RCDecl->getNameAsString();
Result += "_IVARS;\n";
}
-
+
for (unsigned i = 0, e = IVars.size(); i < e; i++) {
if (IVars[i]->isBitField()) {
ObjCIvarDecl *IV = IVars[i];
@@ -3984,7 +3984,7 @@ void RewriteModernObjC::RewriteIvarOffse
if (LangOpts.MicrosoftExt)
Result += "__declspec(allocate(\".objc_ivar$B\")) ";
Result += "extern \"C\" ";
- if (LangOpts.MicrosoftExt &&
+ if (LangOpts.MicrosoftExt &&
IvarDecl->getAccessControl() != ObjCIvarDecl::Private &&
IvarDecl->getAccessControl() != ObjCIvarDecl::Package)
Result += "__declspec(dllimport) ";
@@ -4031,14 +4031,14 @@ void RewriteModernObjC::RewriteImplement
}
}
-void RewriteModernObjC::RewriteByRefString(std::string &ResultStr,
+void RewriteModernObjC::RewriteByRefString(std::string &ResultStr,
const std::string &Name,
ValueDecl *VD, bool def) {
- assert(BlockByRefDeclNo.count(VD) &&
+ assert(BlockByRefDeclNo.count(VD) &&
"RewriteByRefString: ByRef decl missing");
if (def)
ResultStr += "struct ";
- ResultStr += "__Block_byref_" + Name +
+ ResultStr += "__Block_byref_" + Name +
"_" + utostr(BlockByRefDeclNo[VD]) ;
}
@@ -4057,7 +4057,7 @@ std::string RewriteModernObjC::Synthesiz
SourceLocation BlockLoc = CE->getExprLoc();
std::string S;
ConvertSourceLocationToLineDirective(BlockLoc, S);
-
+
S += "static " + RT.getAsString(Context->getPrintingPolicy()) + " __" +
funcName.str() + "_block_func_" + utostr(i);
@@ -4132,7 +4132,7 @@ std::string RewriteModernObjC::Synthesiz
if (HasLocalVariableExternalStorage(*I))
QT = Context->getPointerType(QT);
QT.getAsStringInternal(Name, Context->getPrintingPolicy());
- S += Name + " = __cself->" +
+ S += Name + " = __cself->" +
(*I)->getNameAsString() + "; // bound by copy\n";
}
}
@@ -4168,7 +4168,7 @@ std::string RewriteModernObjC::Synthesiz
S += ", " + utostr(BLOCK_FIELD_IS_OBJECT) + "/*BLOCK_FIELD_IS_OBJECT*/);";
}
S += "}\n";
-
+
S += "\nstatic void __";
S += funcName;
S += "_block_dispose_" + utostr(i);
@@ -4188,7 +4188,7 @@ std::string RewriteModernObjC::Synthesiz
return S;
}
-std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
+std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
std::string Desc) {
std::string S = "\nstruct " + Tag;
std::string Constructor = " " + Tag;
@@ -4277,7 +4277,7 @@ std::string RewriteModernObjC::Synthesiz
Constructor += ", ";
Constructor += Name + "(_" + Name + "->__forwarding)";
}
-
+
Constructor += " {\n";
if (GlobalVarDecl)
Constructor += " impl.isa = &_NSConcreteGlobalBlock;\n";
@@ -4303,19 +4303,19 @@ std::string RewriteModernObjC::Synthesiz
return S;
}
-std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag,
+std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag,
std::string ImplTag, int i,
StringRef FunName,
unsigned hasCopy) {
std::string S = "\nstatic struct " + DescTag;
-
+
S += " {\n size_t reserved;\n";
S += " size_t Block_size;\n";
if (hasCopy) {
S += " void (*copy)(struct ";
S += ImplTag; S += "*, struct ";
S += ImplTag; S += "*);\n";
-
+
S += " void (*dispose)(struct ";
S += ImplTag; S += "*);\n";
}
@@ -4343,7 +4343,7 @@ void RewriteModernObjC::SynthesizeBlockL
SC += "() {}";
InsertText(FunLocStart, SC);
}
-
+
// Insert closures that were part of the function.
for (unsigned i = 0, count=0; i < Blocks.size(); i++) {
CollectBlockDeclRefInfo(Blocks[i]);
@@ -4368,7 +4368,7 @@ void RewriteModernObjC::SynthesizeBlockL
// imported objects in the inner blocks not used in the outer
// blocks must be copied/disposed in the outer block as well.
- if (VD->getType()->isObjCObjectPointerType() ||
+ if (VD->getType()->isObjCObjectPointerType() ||
VD->getType()->isBlockPointerType())
ImportedBlockDecls.insert(VD);
}
@@ -4415,7 +4415,7 @@ void RewriteModernObjC::SynthesizeBlockL
}
if (GlobalConstructionExp) {
// extra fancy dance for global literal expression.
-
+
// Always the latest block expression on the block stack.
std::string Tag = "__";
Tag += FunName;
@@ -4424,7 +4424,7 @@ void RewriteModernObjC::SynthesizeBlockL
std::string globalBuf = "static ";
globalBuf += Tag; globalBuf += " ";
std::string SStr;
-
+
llvm::raw_string_ostream constructorExprBuf(SStr);
GlobalConstructionExp->printPretty(constructorExprBuf, nullptr,
PrintingPolicy(LangOpts));
@@ -4441,7 +4441,7 @@ void RewriteModernObjC::SynthesizeBlockL
}
void RewriteModernObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
- SourceLocation FunLocStart =
+ SourceLocation FunLocStart =
(!Blocks.empty()) ? getFunctionSourceLocation(*this, FD)
: FD->getTypeSpecStartLoc();
StringRef FuncName = FD->getName();
@@ -4528,7 +4528,7 @@ bool RewriteModernObjC::convertObjCTypeT
}
}
}
-
+
convertToUnqualifiedObjCType(T);
return T != oldT;
}
@@ -4544,7 +4544,7 @@ QualType RewriteModernObjC::convertFunct
SmallVector<QualType, 8> ArgTypes;
QualType Res = FT->getReturnType();
bool modified = convertObjCTypeToCStyleType(Res);
-
+
if (FTP) {
for (auto &I : FTP->param_types()) {
QualType t = I;
@@ -4569,13 +4569,13 @@ Stmt *RewriteModernObjC::SynthesizeBlock
CPT = DRE->getType()->getAs<BlockPointerType>();
} else if (const MemberExpr *MExpr = dyn_cast<MemberExpr>(BlockExp)) {
CPT = MExpr->getType()->getAs<BlockPointerType>();
- }
+ }
else if (const ParenExpr *PRE = dyn_cast<ParenExpr>(BlockExp)) {
return SynthesizeBlockCall(Exp, PRE->getSubExpr());
}
- else if (const ImplicitCastExpr *IEXPR = dyn_cast<ImplicitCastExpr>(BlockExp))
+ else if (const ImplicitCastExpr *IEXPR = dyn_cast<ImplicitCastExpr>(BlockExp))
CPT = IEXPR->getType()->getAs<BlockPointerType>();
- else if (const ConditionalOperator *CEXPR =
+ else if (const ConditionalOperator *CEXPR =
dyn_cast<ConditionalOperator>(BlockExp)) {
Expr *LHSExp = CEXPR->getLHS();
Stmt *LHSStmt = SynthesizeBlockCall(Exp, LHSExp);
@@ -4676,7 +4676,7 @@ Stmt *RewriteModernObjC::SynthesizeBlock
// };
//}
Stmt *RewriteModernObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) {
- // Rewrite the byref variable into BYREFVAR->__forwarding->BYREFVAR
+ // Rewrite the byref variable into BYREFVAR->__forwarding->BYREFVAR
// for each DeclRefExp where BYREFVAR is name of the variable.
ValueDecl *VD = DeclRefExp->getDecl();
bool isArrow = DeclRefExp->refersToEnclosingVariableOrCapture() ||
@@ -4684,7 +4684,7 @@ Stmt *RewriteModernObjC::RewriteBlockDec
FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
- &Context->Idents.get("__forwarding"),
+ &Context->Idents.get("__forwarding"),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
@@ -4694,7 +4694,7 @@ Stmt *RewriteModernObjC::RewriteBlockDec
StringRef Name = VD->getName();
FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(),
- &Context->Idents.get(Name),
+ &Context->Idents.get(Name),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
@@ -4703,14 +4703,14 @@ Stmt *RewriteModernObjC::RewriteBlockDec
DeclRefExp->getType(), VK_LValue, OK_Ordinary);
// Need parens to enforce precedence.
- ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),
- DeclRefExp->getExprLoc(),
+ ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),
+ DeclRefExp->getExprLoc(),
ME);
ReplaceStmt(DeclRefExp, PE);
return PE;
}
-// Rewrites the imported local variable V with external storage
+// Rewrites the imported local variable V with external storage
// (static, extern, etc.) as *V
//
Stmt *RewriteModernObjC::RewriteLocalVariableExternalStorage(DeclRefExpr *DRE) {
@@ -4722,7 +4722,7 @@ Stmt *RewriteModernObjC::RewriteLocalVar
VK_LValue, OK_Ordinary,
DRE->getLocation(), false);
// Need parens to enforce precedence.
- ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
+ ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
Exp);
ReplaceStmt(DRE, PE);
return PE;
@@ -4771,7 +4771,7 @@ void RewriteModernObjC::RewriteImplicitC
if (CastKind != CK_BlockPointerToObjCPointerCast &&
CastKind != CK_AnyPointerToBlockPointerCast)
return;
-
+
QualType QT = IC->getType();
(void)convertBlockPointerToFunctionPointer(QT);
std::string TypeString(QT.getAsString(Context->getPrintingPolicy()));
@@ -4851,7 +4851,7 @@ bool RewriteModernObjC::PointerTypeTakes
I->getPointeeType()->isObjCQualifiedInterfaceType())
return true;
}
-
+
}
return false;
}
@@ -4917,7 +4917,7 @@ void RewriteModernObjC::RewriteBlockPoin
}
buf += ')';
OrigLength++;
-
+
if (PointerTypeTakesAnyBlockArguments(DeclT) ||
PointerTypeTakesAnyObjCQualifiedType(DeclT)) {
// Replace the '^' with '*' for arguments.
@@ -4930,7 +4930,7 @@ void RewriteModernObjC::RewriteBlockPoin
if (*argListBegin == '^')
buf += '*';
else if (*argListBegin == '<') {
- buf += "/*";
+ buf += "/*";
buf += *argListBegin++;
OrigLength++;
while (*argListBegin != '>') {
@@ -4954,19 +4954,19 @@ void RewriteModernObjC::RewriteBlockPoin
/// SynthesizeByrefCopyDestroyHelper - This routine synthesizes:
/// void __Block_byref_id_object_copy(struct Block_byref_id_object *dst,
/// struct Block_byref_id_object *src) {
-/// _Block_object_assign (&_dest->object, _src->object,
+/// _Block_object_assign (&_dest->object, _src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_OBJECT
/// [|BLOCK_FIELD_IS_WEAK]) // object
-/// _Block_object_assign(&_dest->object, _src->object,
+/// _Block_object_assign(&_dest->object, _src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_BLOCK
/// [|BLOCK_FIELD_IS_WEAK]) // block
/// }
/// And:
/// void __Block_byref_id_object_dispose(struct Block_byref_id_object *_src) {
-/// _Block_object_dispose(_src->object,
+/// _Block_object_dispose(_src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_OBJECT
/// [|BLOCK_FIELD_IS_WEAK]) // object
-/// _Block_object_dispose(_src->object,
+/// _Block_object_dispose(_src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_BLOCK
/// [|BLOCK_FIELD_IS_WEAK]) // block
/// }
@@ -4980,14 +4980,14 @@ std::string RewriteModernObjC::Synthesiz
S = "static void __Block_byref_id_object_copy_";
S += utostr(flag);
S += "(void *dst, void *src) {\n";
-
+
// offset into the object pointer is computed as:
// void * + void* + int + int + void* + void *
- unsigned IntSize =
+ unsigned IntSize =
static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
- unsigned VoidPtrSize =
+ unsigned VoidPtrSize =
static_cast<unsigned>(Context->getTypeSize(Context->VoidPtrTy));
-
+
unsigned offset = (VoidPtrSize*4 + IntSize + IntSize)/Context->getCharWidth();
S += " _Block_object_assign((char*)dst + ";
S += utostr(offset);
@@ -4996,7 +4996,7 @@ std::string RewriteModernObjC::Synthesiz
S += "), ";
S += utostr(flag);
S += ");\n}\n";
-
+
S += "static void __Block_byref_id_object_dispose_";
S += utostr(flag);
S += "(void *src) {\n";
@@ -5021,8 +5021,8 @@ std::string RewriteModernObjC::Synthesiz
/// };
///
/// It then replaces declaration of ND variable with:
-/// struct __Block_byref_ND ND = {__isa=0B, __forwarding=&ND, __flags=some_flag,
-/// __size=sizeof(struct __Block_byref_ND),
+/// struct __Block_byref_ND ND = {__isa=0B, __forwarding=&ND, __flags=some_flag,
+/// __size=sizeof(struct __Block_byref_ND),
/// ND=initializer-if-any};
///
///
@@ -5048,7 +5048,7 @@ void RewriteModernObjC::RewriteByRefVar(
ByrefType += " *__forwarding;\n";
ByrefType += " int __flags;\n";
ByrefType += " int __size;\n";
- // Add void *__Block_byref_id_object_copy;
+ // Add void *__Block_byref_id_object_copy;
// void *__Block_byref_id_object_dispose; if needed.
QualType Ty = ND->getType();
bool HasCopyAndDispose = Context->BlockRequiresCopying(Ty, ND);
@@ -5060,7 +5060,7 @@ void RewriteModernObjC::RewriteByRefVar(
QualType T = Ty;
(void)convertBlockPointerToFunctionPointer(T);
T.getAsStringInternal(Name, Context->getPrintingPolicy());
-
+
ByrefType += " " + Name + ";\n";
ByrefType += "};\n";
// Insert this type in global scope. It is needed by helper function.
@@ -5072,7 +5072,7 @@ void RewriteModernObjC::RewriteByRefVar(
FunLocStart = CurMethodDef->getLocStart();
}
InsertText(FunLocStart, ByrefType);
-
+
if (Ty.isObjCGCWeak()) {
flag |= BLOCK_FIELD_IS_WEAK;
isa = 1;
@@ -5089,9 +5089,9 @@ void RewriteModernObjC::RewriteByRefVar(
if (!HF.empty())
Preamble += HF;
}
-
- // struct __Block_byref_ND ND =
- // {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND),
+
+ // struct __Block_byref_ND ND =
+ // {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND),
// initializer-if-any};
bool hasInit = (ND->getInit() != nullptr);
// FIXME. rewriter does not support __block c++ objects which
@@ -5102,7 +5102,7 @@ void RewriteModernObjC::RewriteByRefVar(
if (CXXDecl && CXXDecl->isDefaultConstructor())
hasInit = false;
}
-
+
unsigned flags = 0;
if (HasCopyAndDispose)
flags |= BLOCK_HAS_COPY_DISPOSE;
@@ -5125,7 +5125,7 @@ void RewriteModernObjC::RewriteByRefVar(
ByrefType += ", __Block_byref_id_object_dispose_";
ByrefType += utostr(flag);
}
-
+
if (!firstDecl) {
// In multiple __block declarations, and for all but 1st declaration,
// find location of the separating comma. This would be start location
@@ -5139,7 +5139,7 @@ void RewriteModernObjC::RewriteByRefVar(
DeclLoc = DeclLoc.getLocWithOffset(commaBuf - startDeclBuf);
startBuf = commaBuf;
}
-
+
if (!hasInit) {
ByrefType += "};\n";
unsigned nameSize = Name.size();
@@ -5164,11 +5164,11 @@ void RewriteModernObjC::RewriteByRefVar(
const char separator = lastDecl ? ';' : ',';
const char *startInitializerBuf = SM->getCharacterData(startLoc);
const char *separatorBuf = strchr(startInitializerBuf, separator);
- assert((*separatorBuf == separator) &&
+ assert((*separatorBuf == separator) &&
"RewriteByRefVar: can't find ';' or ','");
SourceLocation separatorLoc =
startLoc.getLocWithOffset(separatorBuf-startInitializerBuf);
-
+
InsertText(separatorLoc, lastDecl ? "}" : "};\n");
}
}
@@ -5196,7 +5196,7 @@ void RewriteModernObjC::CollectBlockDecl
// Find any imported blocks...they will need special attention.
for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
if (BlockDeclRefs[i]->getDecl()->hasAttr<BlocksAttr>() ||
- BlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ BlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
BlockDeclRefs[i]->getType()->isBlockPointerType())
ImportedBlockDecls.insert(BlockDeclRefs[i]->getDecl());
}
@@ -5213,11 +5213,11 @@ FunctionDecl *RewriteModernObjC::SynthBl
Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp,
const SmallVectorImpl<DeclRefExpr *> &InnerBlockDeclRefs) {
const BlockDecl *block = Exp->getBlockDecl();
-
+
Blocks.push_back(Exp);
CollectBlockDeclRefInfo(Exp);
-
+
// Add inner imported variables now used in current block.
int countOfInnerDecls = 0;
if (!InnerBlockDeclRefs.empty()) {
@@ -5243,12 +5243,12 @@ Stmt *RewriteModernObjC::SynthBlockInitE
// Find any imported blocks...they will need special attention.
for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++)
if (InnerBlockDeclRefs[i]->getDecl()->hasAttr<BlocksAttr>() ||
- InnerBlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ InnerBlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
InnerBlockDeclRefs[i]->getType()->isBlockPointerType())
ImportedBlockDecls.insert(InnerBlockDeclRefs[i]->getDecl());
}
InnerDeclRefsCount.push_back(countOfInnerDecls);
-
+
std::string FuncName;
if (CurFunctionDef)
@@ -5258,14 +5258,14 @@ Stmt *RewriteModernObjC::SynthBlockInitE
else if (GlobalVarDecl)
FuncName = std::string(GlobalVarDecl->getNameAsString());
- bool GlobalBlockExpr =
+ bool GlobalBlockExpr =
block->getDeclContext()->getRedeclContext()->isFileContext();
-
+
if (GlobalBlockExpr && !GlobalVarDecl) {
Diags.Report(block->getLocation(), GlobalBlockRewriteFailedDiag);
GlobalBlockExpr = false;
}
-
+
std::string BlockNumber = utostr(Blocks.size()-1);
std::string Func = "__" + FuncName + "_block_func_" + BlockNumber;
@@ -5279,13 +5279,13 @@ Stmt *RewriteModernObjC::SynthBlockInitE
// Simulate a constructor call...
std::string Tag;
-
+
if (GlobalBlockExpr)
Tag = "__global_";
else
Tag = "__";
Tag += FuncName + "_block_impl_" + BlockNumber;
-
+
FD = SynthBlockInitFunctionDecl(Tag);
DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, false, FType, VK_RValue,
SourceLocation());
@@ -5310,13 +5310,13 @@ Stmt *RewriteModernObjC::SynthBlockInitE
new (Context) UnaryOperator(new (Context) DeclRefExpr(NewVD, false,
Context->VoidPtrTy,
VK_LValue,
- SourceLocation()),
+ SourceLocation()),
UO_AddrOf,
- Context->getPointerType(Context->VoidPtrTy),
+ Context->getPointerType(Context->VoidPtrTy),
VK_RValue, OK_Ordinary,
SourceLocation(), false);
- InitExprs.push_back(DescRefExpr);
-
+ InitExprs.push_back(DescRefExpr);
+
// Add initializers for any closure decl refs.
if (BlockDeclRefs.size()) {
Expr *Exp;
@@ -5352,7 +5352,7 @@ Stmt *RewriteModernObjC::SynthBlockInitE
OK_Ordinary, SourceLocation(),
false);
}
-
+
}
InitExprs.push_back(Exp);
}
@@ -5363,14 +5363,14 @@ Stmt *RewriteModernObjC::SynthBlockInitE
std::string Name(ND->getNameAsString());
std::string RecName;
RewriteByRefString(RecName, Name, ND, true);
- IdentifierInfo *II = &Context->Idents.get(RecName.c_str()
+ IdentifierInfo *II = &Context->Idents.get(RecName.c_str()
+ sizeof("struct"));
RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
SourceLocation(), SourceLocation(),
II);
assert(RD && "SynthBlockInitExpr(): Can't find RecordDecl");
QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
-
+
FD = SynthBlockInitFunctionDecl((*I)->getName());
Exp = new (Context) DeclRefExpr(FD, false, FD->getType(), VK_LValue,
SourceLocation());
@@ -5379,7 +5379,7 @@ Stmt *RewriteModernObjC::SynthBlockInitE
for (const auto &CI : block->captures()) {
const VarDecl *variable = CI.getVariable();
if (variable == ND && CI.isNested()) {
- assert (CI.isByRef() &&
+ assert (CI.isByRef() &&
"SynthBlockInitExpr - captured block variable is not byref");
isNestedCapturedVar = true;
break;
@@ -5399,22 +5399,22 @@ Stmt *RewriteModernObjC::SynthBlockInitE
if (ImportedBlockDecls.size()) {
// generate BLOCK_HAS_COPY_DISPOSE(have helper funcs) | BLOCK_HAS_DESCRIPTOR
int flag = (BLOCK_HAS_COPY_DISPOSE | BLOCK_HAS_DESCRIPTOR);
- unsigned IntSize =
+ unsigned IntSize =
static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
- Expr *FlagExp = IntegerLiteral::Create(*Context, llvm::APInt(IntSize, flag),
+ Expr *FlagExp = IntegerLiteral::Create(*Context, llvm::APInt(IntSize, flag),
Context->IntTy, SourceLocation());
InitExprs.push_back(FlagExp);
}
NewRep = new (Context) CallExpr(*Context, DRE, InitExprs,
FType, VK_LValue, SourceLocation());
-
+
if (GlobalBlockExpr) {
assert (!GlobalConstructionExp &&
"SynthBlockInitExpr - GlobalConstructionExp must be null");
GlobalConstructionExp = NewRep;
NewRep = DRE;
}
-
+
NewRep = new (Context) UnaryOperator(NewRep, UO_AddrOf,
Context->getPointerType(NewRep->getType()),
VK_RValue, OK_Ordinary, SourceLocation(), false);
@@ -5423,7 +5423,7 @@ Stmt *RewriteModernObjC::SynthBlockInitE
// Put Paren around the call.
NewRep = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
NewRep);
-
+
BlockDeclRefs.clear();
BlockByRefDecls.clear();
BlockByRefDeclsPtrSet.clear();
@@ -5434,7 +5434,7 @@ Stmt *RewriteModernObjC::SynthBlockInitE
}
bool RewriteModernObjC::IsDeclStmtInForeachHeader(DeclStmt *DS) {
- if (const ObjCForCollectionStmt * CS =
+ if (const ObjCForCollectionStmt * CS =
dyn_cast<ObjCForCollectionStmt>(Stmts.back()))
return CS->getElement() == DS;
return false;
@@ -5506,7 +5506,7 @@ Stmt *RewriteModernObjC::RewriteFunction
RewrittenBlockExprs[BE] = Str;
Stmt *blockTranscribed = SynthBlockInitExpr(BE, InnerBlockDeclRefs);
-
+
//blockTranscribed->dump();
ReplaceStmt(S, blockTranscribed);
return blockTranscribed;
@@ -5520,17 +5520,17 @@ Stmt *RewriteModernObjC::RewriteFunction
if (ObjCStringLiteral *AtString = dyn_cast<ObjCStringLiteral>(S))
return RewriteObjCStringLiteral(AtString);
-
+
if (ObjCBoolLiteralExpr *BoolLitExpr = dyn_cast<ObjCBoolLiteralExpr>(S))
return RewriteObjCBoolLiteralExpr(BoolLitExpr);
-
+
if (ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(S))
return RewriteObjCBoxedExpr(BoxedExpr);
-
+
if (ObjCArrayLiteral *ArrayLitExpr = dyn_cast<ObjCArrayLiteral>(S))
return RewriteObjCArrayLiteralExpr(ArrayLitExpr);
-
- if (ObjCDictionaryLiteral *DictionaryLitExpr =
+
+ if (ObjCDictionaryLiteral *DictionaryLitExpr =
dyn_cast<ObjCDictionaryLiteral>(S))
return RewriteObjCDictionaryLiteralExpr(DictionaryLitExpr);
@@ -5557,11 +5557,11 @@ Stmt *RewriteModernObjC::RewriteFunction
return RewriteMessageExpr(MessExpr);
}
- if (ObjCAutoreleasePoolStmt *StmtAutoRelease =
+ if (ObjCAutoreleasePoolStmt *StmtAutoRelease =
dyn_cast<ObjCAutoreleasePoolStmt>(S)) {
return RewriteObjCAutoreleasePoolStmt(StmtAutoRelease);
}
-
+
if (ObjCAtTryStmt *StmtTry = dyn_cast<ObjCAtTryStmt>(S))
return RewriteObjCTryStmt(StmtTry);
@@ -5595,7 +5595,7 @@ Stmt *RewriteModernObjC::RewriteFunction
// the context of an ObjCForCollectionStmt. For example:
// NSArray *someArray;
// for (id <FooProtocol> index in someArray) ;
- // This is because RewriteObjCForCollectionStmt() does textual rewriting
+ // This is because RewriteObjCForCollectionStmt() does textual rewriting
// and it depends on the original text locations/positions.
if (Stmts.empty() || !IsDeclStmtInForeachHeader(DS))
RewriteObjCQualifiedInterfaceTypes(*DS->decl_begin());
@@ -5617,7 +5617,7 @@ Stmt *RewriteModernObjC::RewriteFunction
BlockByRefDeclNo[ND] = uniqueByrefDeclCount++;
RewriteByRefVar(VD, (DI == DS->decl_begin()), ((DI+1) == DE));
}
- else
+ else
RewriteTypeOfDecl(VD);
}
}
@@ -5643,13 +5643,13 @@ Stmt *RewriteModernObjC::RewriteFunction
}
// Handle blocks rewriting.
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(S)) {
- ValueDecl *VD = DRE->getDecl();
+ ValueDecl *VD = DRE->getDecl();
if (VD->hasAttr<BlocksAttr>())
return RewriteBlockDeclRefExpr(DRE);
if (HasLocalVariableExternalStorage(VD))
return RewriteLocalVariableExternalStorage(DRE);
}
-
+
if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
if (CE->getCallee()->getType()->isBlockPointerType()) {
Stmt *BlockCall = SynthesizeBlockCall(CE, CE->getCallee());
@@ -5812,7 +5812,7 @@ void RewriteModernObjC::HandleDeclInMain
case Decl::CXXRecord:
case Decl::Record: {
RecordDecl *RD = cast<RecordDecl>(D);
- if (RD->isCompleteDefinition())
+ if (RD->isCompleteDefinition())
RewriteRecordBody(RD);
break;
}
@@ -5825,7 +5825,7 @@ void RewriteModernObjC::HandleDeclInMain
/// Write_ProtocolExprReferencedMetadata - This routine writer out the
/// protocol reference symbols in the for of:
/// struct _protocol_t *PROTOCOL_REF = &PROTOCOL_METADATA.
-static void Write_ProtocolExprReferencedMetadata(ASTContext *Context,
+static void Write_ProtocolExprReferencedMetadata(ASTContext *Context,
ObjCProtocolDecl *PDecl,
std::string &Result) {
// Also output .objc_protorefs$B section and its meta-data.
@@ -5861,10 +5861,10 @@ void RewriteModernObjC::HandleTranslatio
}
InsertText(SM->getLocForStartOfFile(MainFileID), Preamble, false);
-
+
if (ClassImplementation.size() || CategoryImplementation.size())
RewriteImplementations();
-
+
for (unsigned i = 0, e = ObjCInterfacesSeen.size(); i < e; i++) {
ObjCInterfaceDecl *CDecl = ObjCInterfacesSeen[i];
// Write struct declaration for the class matching its ivar declarations.
@@ -5873,7 +5873,7 @@ void RewriteModernObjC::HandleTranslatio
// private ivars.
RewriteInterfaceDecl(CDecl);
}
-
+
// Get the buffer corresponding to MainFileID. If we haven't changed it, then
// we are done.
if (const RewriteBuffer *RewriteBuf =
@@ -5903,7 +5903,7 @@ void RewriteModernObjC::HandleTranslatio
void RewriteModernObjC::Initialize(ASTContext &context) {
InitializeCommon(context);
-
+
Preamble += "#ifndef __OBJC2__\n";
Preamble += "#define __OBJC2__\n";
Preamble += "#endif\n";
@@ -5919,7 +5919,7 @@ void RewriteModernObjC::Initialize(ASTCo
Preamble += "\n\t__rw_objc_super(struct objc_object *o, struct objc_object *s) ";
Preamble += ": object(o), superClass(s) {} ";
Preamble += "\n};\n";
-
+
if (LangOpts.MicrosoftExt) {
// Define all sections using syntax that makes sense.
// These are currently generated.
@@ -5933,13 +5933,13 @@ void RewriteModernObjC::Initialize(ASTCo
Preamble += "#pragma section(\".inst_meth$B\", long, read, write)\n";
Preamble += "#pragma section(\".cls_meth$B\", long, read, write)\n";
Preamble += "#pragma section(\".objc_ivar$B\", long, read, write)\n";
-
+
// These need be generated for performance. Currently they are not,
// using API calls instead.
Preamble += "#pragma section(\".objc_selrefs$B\", long, read, write)\n";
Preamble += "#pragma section(\".objc_classrefs$B\", long, read, write)\n";
Preamble += "#pragma section(\".objc_superrefs$B\", long, read, write)\n";
-
+
}
Preamble += "#ifndef _REWRITER_typedef_Protocol\n";
Preamble += "typedef struct objc_object Protocol;\n";
@@ -5948,10 +5948,10 @@ void RewriteModernObjC::Initialize(ASTCo
if (LangOpts.MicrosoftExt) {
Preamble += "#define __OBJC_RW_DLLIMPORT extern \"C\" __declspec(dllimport)\n";
Preamble += "#define __OBJC_RW_STATICIMPORT extern \"C\"\n";
- }
+ }
else
Preamble += "#define __OBJC_RW_DLLIMPORT extern\n";
-
+
Preamble += "__OBJC_RW_DLLIMPORT void objc_msgSend(void);\n";
Preamble += "__OBJC_RW_DLLIMPORT void objc_msgSendSuper(void);\n";
Preamble += "__OBJC_RW_DLLIMPORT void objc_msgSend_stret(void);\n";
@@ -6041,7 +6041,7 @@ void RewriteModernObjC::Initialize(ASTCo
Preamble += "#define __block\n";
Preamble += "#define __weak\n";
}
-
+
// Declarations required for modern objective-c array and dictionary literals.
Preamble += "\n#include <stdarg.h>\n";
Preamble += "struct __NSContainer_literal {\n";
@@ -6058,7 +6058,7 @@ void RewriteModernObjC::Initialize(ASTCo
Preamble += "\tdelete[] arr;\n";
Preamble += " }\n";
Preamble += "};\n";
-
+
// Declaration required for implementation of @autoreleasepool statement.
Preamble += "extern \"C\" __declspec(dllimport) void * objc_autoreleasePoolPush(void);\n";
Preamble += "extern \"C\" __declspec(dllimport) void objc_autoreleasePoolPop(void *);\n\n";
@@ -6067,7 +6067,7 @@ void RewriteModernObjC::Initialize(ASTCo
Preamble += " ~__AtAutoreleasePool() {objc_autoreleasePoolPop(atautoreleasepoolobj);}\n";
Preamble += " void * atautoreleasepoolobj;\n";
Preamble += "};\n";
-
+
// NOTE! Windows uses LLP64 for 64bit mode. So, cast pointer to long long
// as this avoids warning in any 64bit/32bit compilation model.
Preamble += "\n#define __OFFSETOFIVAR__(TYPE, MEMBER) ((long long) &((TYPE *)0)->MEMBER)\n";
@@ -6195,20 +6195,20 @@ static void WriteModernMetadataDeclarati
static bool meta_data_declared = false;
if (meta_data_declared)
return;
-
+
Result += "\nstruct _prop_t {\n";
Result += "\tconst char *name;\n";
Result += "\tconst char *attributes;\n";
Result += "};\n";
-
+
Result += "\nstruct _protocol_t;\n";
-
+
Result += "\nstruct _objc_method {\n";
Result += "\tstruct objc_selector * _cmd;\n";
Result += "\tconst char *method_type;\n";
Result += "\tvoid *_imp;\n";
Result += "};\n";
-
+
Result += "\nstruct _protocol_t {\n";
Result += "\tvoid * isa; // NULL\n";
Result += "\tconst char *protocol_name;\n";
@@ -6222,7 +6222,7 @@ static void WriteModernMetadataDeclarati
Result += "\tconst unsigned int flags; // = 0\n";
Result += "\tconst char ** extendedMethodTypes;\n";
Result += "};\n";
-
+
Result += "\nstruct _ivar_t {\n";
Result += "\tunsigned long int *offset; // pointer to ivar offset location\n";
Result += "\tconst char *name;\n";
@@ -6230,7 +6230,7 @@ static void WriteModernMetadataDeclarati
Result += "\tunsigned int alignment;\n";
Result += "\tunsigned int size;\n";
Result += "};\n";
-
+
Result += "\nstruct _class_ro_t {\n";
Result += "\tunsigned int flags;\n";
Result += "\tunsigned int instanceStart;\n";
@@ -6246,7 +6246,7 @@ static void WriteModernMetadataDeclarati
Result += "\tconst unsigned char *weakIvarLayout;\n";
Result += "\tconst struct _prop_list_t *properties;\n";
Result += "};\n";
-
+
Result += "\nstruct _class_t {\n";
Result += "\tstruct _class_t *isa;\n";
Result += "\tstruct _class_t *superclass;\n";
@@ -6254,7 +6254,7 @@ static void WriteModernMetadataDeclarati
Result += "\tvoid *vtable;\n";
Result += "\tstruct _class_ro_t *ro;\n";
Result += "};\n";
-
+
Result += "\nstruct _category_t {\n";
Result += "\tconst char *name;\n";
Result += "\tstruct _class_t *cls;\n";
@@ -6263,7 +6263,7 @@ static void WriteModernMetadataDeclarati
Result += "\tconst struct _protocol_list_t *protocols;\n";
Result += "\tconst struct _prop_list_t *properties;\n";
Result += "};\n";
-
+
Result += "extern \"C\" __declspec(dllimport) struct objc_cache _objc_empty_cache;\n";
Result += "#pragma warning(disable:4273)\n";
meta_data_declared = true;
@@ -6316,12 +6316,12 @@ static void Write_protocol_list_initiali
Result += "\nstatic ";
Write_protocol_list_t_TypeDecl(Result, SuperProtocols.size());
Result += " "; Result += VarName;
- Result += ProtocolName;
+ Result += ProtocolName;
Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
Result += "\t"; Result += utostr(SuperProtocols.size()); Result += ",\n";
for (unsigned i = 0, e = SuperProtocols.size(); i < e; i++) {
ObjCProtocolDecl *SuperPD = SuperProtocols[i];
- Result += "\t&"; Result += "_OBJC_PROTOCOL_";
+ Result += "\t&"; Result += "_OBJC_PROTOCOL_";
Result += SuperPD->getNameAsString();
if (i == e-1)
Result += "\n};\n";
@@ -6341,7 +6341,7 @@ static void Write_method_list_t_initiali
Result += "\nstatic ";
Write_method_list_t_TypeDecl(Result, Methods.size());
Result += " "; Result += VarName;
- Result += TopLevelDeclName;
+ Result += TopLevelDeclName;
Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
Result += "\t"; Result += "sizeof(_objc_method)"; Result += ",\n";
Result += "\t"; Result += utostr(Methods.size()); Result += ",\n";
@@ -6381,7 +6381,7 @@ static void Write_prop_list_t_initialize
Result += "\nstatic ";
Write__prop_list_t_TypeDecl(Result, Properties.size());
Result += " "; Result += VarName;
- Result += ProtocolName;
+ Result += ProtocolName;
Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
Result += "\t"; Result += "sizeof(_prop_t)"; Result += ",\n";
Result += "\t"; Result += utostr(Properties.size()); Result += ",\n";
@@ -6413,16 +6413,16 @@ enum MetaDataDlags {
CLS_ROOT = 0x2,
OBJC2_CLS_HIDDEN = 0x10,
CLS_EXCEPTION = 0x20,
-
+
/// (Obsolete) ARC-specific: this class has a .release_ivars method
CLS_HAS_IVAR_RELEASER = 0x40,
/// class was compiled with -fobjc-arr
CLS_COMPILED_BY_ARC = 0x80 // (1<<7)
};
-static void Write__class_ro_t_initializer(ASTContext *Context, std::string &Result,
- unsigned int flags,
- const std::string &InstanceStart,
+static void Write__class_ro_t_initializer(ASTContext *Context, std::string &Result,
+ unsigned int flags,
+ const std::string &InstanceStart,
const std::string &InstanceSize,
ArrayRef<ObjCMethodDecl *>baseMethods,
ArrayRef<ObjCProtocolDecl *>baseProtocols,
@@ -6433,8 +6433,8 @@ static void Write__class_ro_t_initialize
Result += "\nstatic struct _class_ro_t ";
Result += VarName; Result += ClassName;
Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
- Result += "\t";
- Result += llvm::utostr(flags); Result += ", ";
+ Result += "\t";
+ Result += llvm::utostr(flags); Result += ", ";
Result += InstanceStart; Result += ", ";
Result += InstanceSize; Result += ", \n";
Result += "\t";
@@ -6492,7 +6492,7 @@ static void Write_class_t(ASTContext *Co
const ObjCInterfaceDecl *CDecl, bool metaclass) {
bool rootClass = (!CDecl->getSuperClass());
const ObjCInterfaceDecl *RootClass = CDecl;
-
+
if (!rootClass) {
// Find the Root class
RootClass = CDecl->getSuperClass();
@@ -6509,7 +6509,7 @@ static void Write_class_t(ASTContext *Co
Result += "__declspec(dllexport) ";
else
Result += "__declspec(dllimport) ";
-
+
Result += "struct _class_t OBJC_CLASS_$_";
Result += CDecl->getNameAsString();
Result += ";\n";
@@ -6524,11 +6524,11 @@ static void Write_class_t(ASTContext *Co
else
Result += "__declspec(dllimport) ";
- Result += "struct _class_t ";
+ Result += "struct _class_t ";
Result += VarName;
Result += SuperClass->getNameAsString();
Result += ";\n";
-
+
if (metaclass && RootClass != SuperClass) {
Result += "extern \"C\" ";
if (RootClass->getImplementation())
@@ -6536,14 +6536,14 @@ static void Write_class_t(ASTContext *Co
else
Result += "__declspec(dllimport) ";
- Result += "struct _class_t ";
+ Result += "struct _class_t ";
Result += VarName;
Result += RootClass->getNameAsString();
Result += ";\n";
}
}
-
- Result += "\nextern \"C\" __declspec(dllexport) struct _class_t ";
+
+ Result += "\nextern \"C\" __declspec(dllexport) struct _class_t ";
Result += VarName; Result += CDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__DATA,__objc_data\"))) = {\n";
Result += "\t";
@@ -6557,7 +6557,7 @@ static void Write_class_t(ASTContext *Co
Result += ",\n\t";
}
else {
- Result += "0, // &"; Result += VarName;
+ Result += "0, // &"; Result += VarName;
Result += CDecl->getNameAsString();
Result += ",\n\t";
Result += "0, // &OBJC_CLASS_$_"; Result += CDecl->getNameAsString();
@@ -6565,7 +6565,7 @@ static void Write_class_t(ASTContext *Co
}
}
else {
- Result += "0, // &OBJC_METACLASS_$_";
+ Result += "0, // &OBJC_METACLASS_$_";
Result += CDecl->getNameAsString();
Result += ",\n\t";
if (!rootClass) {
@@ -6573,7 +6573,7 @@ static void Write_class_t(ASTContext *Co
Result += CDecl->getSuperClass()->getNameAsString();
Result += ",\n\t";
}
- else
+ else
Result += "0,\n\t";
}
Result += "0, // (void *)&_objc_empty_cache,\n\t";
@@ -6584,22 +6584,22 @@ static void Write_class_t(ASTContext *Co
Result += "&_OBJC_CLASS_RO_$_";
Result += CDecl->getNameAsString();
Result += ",\n};\n";
-
+
// Add static function to initialize some of the meta-data fields.
// avoid doing it twice.
if (metaclass)
return;
-
- const ObjCInterfaceDecl *SuperClass =
+
+ const ObjCInterfaceDecl *SuperClass =
rootClass ? CDecl : CDecl->getSuperClass();
-
+
Result += "static void OBJC_CLASS_SETUP_$_";
Result += CDecl->getNameAsString();
Result += "(void ) {\n";
Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString();
Result += ".isa = "; Result += "&OBJC_METACLASS_$_";
Result += RootClass->getNameAsString(); Result += ";\n";
-
+
Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString();
Result += ".superclass = ";
if (rootClass)
@@ -6608,26 +6608,26 @@ static void Write_class_t(ASTContext *Co
Result += "&OBJC_METACLASS_$_";
Result += SuperClass->getNameAsString(); Result += ";\n";
-
+
Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString();
Result += ".cache = "; Result += "&_objc_empty_cache"; Result += ";\n";
-
+
Result += "\tOBJC_CLASS_$_"; Result += CDecl->getNameAsString();
Result += ".isa = "; Result += "&OBJC_METACLASS_$_";
Result += CDecl->getNameAsString(); Result += ";\n";
-
+
if (!rootClass) {
Result += "\tOBJC_CLASS_$_"; Result += CDecl->getNameAsString();
Result += ".superclass = "; Result += "&OBJC_CLASS_$_";
Result += SuperClass->getNameAsString(); Result += ";\n";
}
-
+
Result += "\tOBJC_CLASS_$_"; Result += CDecl->getNameAsString();
Result += ".cache = "; Result += "&_objc_empty_cache"; Result += ";\n";
Result += "}\n";
}
-static void Write_category_t(RewriteModernObjC &RewriteObj, ASTContext *Context,
+static void Write_category_t(RewriteModernObjC &RewriteObj, ASTContext *Context,
std::string &Result,
ObjCCategoryDecl *CatDecl,
ObjCInterfaceDecl *ClassDecl,
@@ -6637,7 +6637,7 @@ static void Write_category_t(RewriteMode
ArrayRef<ObjCPropertyDecl *> ClassProperties) {
StringRef CatName = CatDecl->getName();
StringRef ClassName = ClassDecl->getName();
- // must declare an extern class object in case this class is not implemented
+ // must declare an extern class object in case this class is not implemented
// in this TU.
Result += "\n";
Result += "extern \"C\" ";
@@ -6645,11 +6645,11 @@ static void Write_category_t(RewriteMode
Result += "__declspec(dllexport) ";
else
Result += "__declspec(dllimport) ";
-
+
Result += "struct _class_t ";
Result += "OBJC_CLASS_$_"; Result += ClassName;
Result += ";\n";
-
+
Result += "\nstatic struct _category_t ";
Result += "_OBJC_$_CATEGORY_";
Result += ClassName; Result += "_$_"; Result += CatName;
@@ -6659,32 +6659,32 @@ static void Write_category_t(RewriteMode
Result += "\t0, // &"; Result += "OBJC_CLASS_$_"; Result += ClassName;
Result += ",\n";
if (InstanceMethods.size() > 0) {
- Result += "\t(const struct _method_list_t *)&";
+ Result += "\t(const struct _method_list_t *)&";
Result += "_OBJC_$_CATEGORY_INSTANCE_METHODS_";
Result += ClassName; Result += "_$_"; Result += CatName;
Result += ",\n";
}
else
Result += "\t0,\n";
-
+
if (ClassMethods.size() > 0) {
- Result += "\t(const struct _method_list_t *)&";
+ Result += "\t(const struct _method_list_t *)&";
Result += "_OBJC_$_CATEGORY_CLASS_METHODS_";
Result += ClassName; Result += "_$_"; Result += CatName;
Result += ",\n";
}
else
Result += "\t0,\n";
-
+
if (RefedProtocols.size() > 0) {
- Result += "\t(const struct _protocol_list_t *)&";
+ Result += "\t(const struct _protocol_list_t *)&";
Result += "_OBJC_CATEGORY_PROTOCOLS_$_";
Result += ClassName; Result += "_$_"; Result += CatName;
Result += ",\n";
}
else
Result += "\t0,\n";
-
+
if (ClassProperties.size() > 0) {
Result += "\t(const struct _prop_list_t *)&"; Result += "_OBJC_$_PROP_LIST_";
Result += ClassName; Result += "_$_"; Result += CatName;
@@ -6692,16 +6692,16 @@ static void Write_category_t(RewriteMode
}
else
Result += "\t0,\n";
-
+
Result += "};\n";
-
+
// Add static function to initialize the class pointer in the category structure.
Result += "static void OBJC_CATEGORY_SETUP_$_";
Result += ClassDecl->getNameAsString();
Result += "_$_";
Result += CatName;
Result += "(void ) {\n";
- Result += "\t_OBJC_$_CATEGORY_";
+ Result += "\t_OBJC_$_CATEGORY_";
Result += ClassDecl->getNameAsString();
Result += "_$_";
Result += CatName;
@@ -6716,7 +6716,7 @@ static void Write__extendedMethodTypes_i
StringRef ProtocolName) {
if (Methods.size() == 0)
return;
-
+
Result += "\nstatic const char *";
Result += VarName; Result += ProtocolName;
Result += " [] __attribute__ ((used, section (\"__DATA,__objc_const\"))) = \n";
@@ -6738,8 +6738,8 @@ static void Write__extendedMethodTypes_i
static void Write_IvarOffsetVar(RewriteModernObjC &RewriteObj,
ASTContext *Context,
- std::string &Result,
- ArrayRef<ObjCIvarDecl *> Ivars,
+ std::string &Result,
+ ArrayRef<ObjCIvarDecl *> Ivars,
ObjCInterfaceDecl *CDecl) {
// FIXME. visibilty of offset symbols may have to be set; for Darwin
// this is what happens:
@@ -6751,17 +6751,17 @@ static void Write_IvarOffsetVar(RewriteM
else
Visibility should be: DefaultVisibility;
*/
-
+
Result += "\n";
for (unsigned i =0, e = Ivars.size(); i < e; i++) {
ObjCIvarDecl *IvarDecl = Ivars[i];
if (Context->getLangOpts().MicrosoftExt)
Result += "__declspec(allocate(\".objc_ivar$B\")) ";
-
+
if (!Context->getLangOpts().MicrosoftExt ||
IvarDecl->getAccessControl() == ObjCIvarDecl::Private ||
IvarDecl->getAccessControl() == ObjCIvarDecl::Package)
- Result += "extern \"C\" unsigned long int ";
+ Result += "extern \"C\" unsigned long int ";
else
Result += "extern \"C\" __declspec(dllexport) unsigned long int ";
if (Ivars[i]->isBitField())
@@ -6799,7 +6799,7 @@ static void Write__ivar_list_t_initializ
else
Ivars.push_back(OriginalIvars[i]);
}
-
+
Result += "\nstatic ";
Write__ivar_list_t_TypeDecl(Result, Ivars.size());
Result += " "; Result += VarName;
@@ -6819,24 +6819,24 @@ static void Write__ivar_list_t_initializ
else
WriteInternalIvarName(CDecl, IvarDecl, Result);
Result += ", ";
-
+
Result += "\"";
if (Ivars[i]->isBitField())
RewriteObj.ObjCIvarBitfieldGroupDecl(Ivars[i], Result);
else
Result += IvarDecl->getName();
Result += "\", ";
-
+
QualType IVQT = IvarDecl->getType();
if (IvarDecl->isBitField())
IVQT = RewriteObj.GetGroupRecordTypeForObjCIvarBitfield(IvarDecl);
-
+
std::string IvarTypeString, QuoteIvarTypeString;
Context->getObjCEncodingForType(IVQT, IvarTypeString,
IvarDecl);
RewriteObj.QuoteDoublequotes(IvarTypeString, QuoteIvarTypeString);
Result += "\""; Result += QuoteIvarTypeString; Result += "\", ";
-
+
// FIXME. this alignment represents the host alignment and need be changed to
// represent the target alignment.
unsigned Align = Context->getTypeAlign(IVQT)/8;
@@ -6854,21 +6854,21 @@ static void Write__ivar_list_t_initializ
}
/// RewriteObjCProtocolMetaData - Rewrite protocols meta-data.
-void RewriteModernObjC::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl,
+void RewriteModernObjC::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl,
std::string &Result) {
-
+
// Do not synthesize the protocol more than once.
if (ObjCSynthesizedProtocols.count(PDecl->getCanonicalDecl()))
return;
WriteModernMetadataDeclarations(Context, Result);
-
+
if (ObjCProtocolDecl *Def = PDecl->getDefinition())
PDecl = Def;
// Must write out all protocol definitions in current qualifier list,
// and in their nested qualifiers before writing out current definition.
for (auto *I : PDecl->protocols())
RewriteObjCProtocolMetaData(I, Result);
-
+
// Construct method lists.
std::vector<ObjCMethodDecl *> InstanceMethods, ClassMethods;
std::vector<ObjCMethodDecl *> OptInstanceMethods, OptClassMethods;
@@ -6879,7 +6879,7 @@ void RewriteModernObjC::RewriteObjCProto
InstanceMethods.push_back(MD);
}
}
-
+
for (auto *MD : PDecl->class_methods()) {
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
OptClassMethods.push_back(MD);
@@ -6902,27 +6902,27 @@ void RewriteModernObjC::RewriteObjCProto
"_OBJC_PROTOCOL_METHOD_TYPES_",
PDecl->getNameAsString());
// Protocol's super protocol list
- SmallVector<ObjCProtocolDecl *, 8> SuperProtocols(PDecl->protocols());
+ SmallVector<ObjCProtocolDecl *, 8> SuperProtocols(PDecl->protocols());
Write_protocol_list_initializer(Context, Result, SuperProtocols,
"_OBJC_PROTOCOL_REFS_",
PDecl->getNameAsString());
-
- Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
+
+ Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
"_OBJC_PROTOCOL_INSTANCE_METHODS_",
PDecl->getNameAsString(), false);
-
- Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
+
+ Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
"_OBJC_PROTOCOL_CLASS_METHODS_",
PDecl->getNameAsString(), false);
- Write_method_list_t_initializer(*this, Context, Result, OptInstanceMethods,
+ Write_method_list_t_initializer(*this, Context, Result, OptInstanceMethods,
"_OBJC_PROTOCOL_OPT_INSTANCE_METHODS_",
PDecl->getNameAsString(), false);
-
- Write_method_list_t_initializer(*this, Context, Result, OptClassMethods,
+
+ Write_method_list_t_initializer(*this, Context, Result, OptClassMethods,
"_OBJC_PROTOCOL_OPT_CLASS_METHODS_",
PDecl->getNameAsString(), false);
-
+
// Protocol's property metadata.
SmallVector<ObjCPropertyDecl *, 8> ProtocolProperties(
PDecl->instance_properties());
@@ -6947,43 +6947,43 @@ void RewriteModernObjC::RewriteObjCProto
else
Result += "\t0,\n";
if (InstanceMethods.size() > 0) {
- Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_INSTANCE_METHODS_";
+ Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_INSTANCE_METHODS_";
Result += PDecl->getNameAsString(); Result += ",\n";
}
else
Result += "\t0,\n";
if (ClassMethods.size() > 0) {
- Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_CLASS_METHODS_";
+ Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_CLASS_METHODS_";
Result += PDecl->getNameAsString(); Result += ",\n";
}
else
Result += "\t0,\n";
-
+
if (OptInstanceMethods.size() > 0) {
- Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_OPT_INSTANCE_METHODS_";
+ Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_OPT_INSTANCE_METHODS_";
Result += PDecl->getNameAsString(); Result += ",\n";
}
else
Result += "\t0,\n";
-
+
if (OptClassMethods.size() > 0) {
- Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_OPT_CLASS_METHODS_";
+ Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_OPT_CLASS_METHODS_";
Result += PDecl->getNameAsString(); Result += ",\n";
}
else
Result += "\t0,\n";
-
+
if (ProtocolProperties.size() > 0) {
- Result += "\t(const struct _prop_list_t *)&_OBJC_PROTOCOL_PROPERTIES_";
+ Result += "\t(const struct _prop_list_t *)&_OBJC_PROTOCOL_PROPERTIES_";
Result += PDecl->getNameAsString(); Result += ",\n";
}
else
Result += "\t0,\n";
-
+
Result += "\t"; Result += "sizeof(_protocol_t)"; Result += ",\n";
Result += "\t0,\n";
-
+
if (AllMethods.size() > 0) {
Result += "\t(const char **)&"; Result += "_OBJC_PROTOCOL_METHOD_TYPES_";
Result += PDecl->getNameAsString();
@@ -6991,14 +6991,14 @@ void RewriteModernObjC::RewriteObjCProto
}
else
Result += "\t0\n};\n";
-
+
if (LangOpts.MicrosoftExt)
Result += "static ";
Result += "struct _protocol_t *";
Result += "_OBJC_LABEL_PROTOCOL_$_"; Result += PDecl->getNameAsString();
Result += " = &_OBJC_PROTOCOL_"; Result += PDecl->getNameAsString();
Result += ";\n";
-
+
// Mark this protocol as having been generated.
if (!ObjCSynthesizedProtocols.insert(PDecl->getCanonicalDecl()).second)
llvm_unreachable("protocol already synthesized");
@@ -7019,15 +7019,15 @@ static bool hasObjCExceptionAttribute(AS
void RewriteModernObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
std::string &Result) {
ObjCInterfaceDecl *CDecl = IDecl->getClassInterface();
-
+
// Explicitly declared @interface's are already synthesized.
if (CDecl->isImplicitInterfaceDecl())
- assert(false &&
+ assert(false &&
"Legacy implicit interface rewriting not supported in moder abi");
-
+
WriteModernMetadataDeclarations(Context, Result);
SmallVector<ObjCIvarDecl *, 8> IVars;
-
+
for (ObjCIvarDecl *IVD = CDecl->all_declared_ivar_begin();
IVD; IVD = IVD->getNextIvar()) {
// Ignore unnamed bit-fields.
@@ -7035,14 +7035,14 @@ void RewriteModernObjC::RewriteObjCClass
continue;
IVars.push_back(IVD);
}
-
- Write__ivar_list_t_initializer(*this, Context, Result, IVars,
+
+ Write__ivar_list_t_initializer(*this, Context, Result, IVars,
"_OBJC_$_INSTANCE_VARIABLES_",
CDecl);
-
+
// Build _objc_method_list for class's instance methods if needed
SmallVector<ObjCMethodDecl *, 32> InstanceMethods(IDecl->instance_methods());
-
+
// If any of our property implementations have associated getters or
// setters, produce metadata for them as well.
for (const auto *Prop : IDecl->property_impls()) {
@@ -7062,17 +7062,17 @@ void RewriteModernObjC::RewriteObjCClass
if (mustSynthesizeSetterGetterMethod(IDecl, PD, false /*setter*/))
InstanceMethods.push_back(Setter);
}
-
+
Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
"_OBJC_$_INSTANCE_METHODS_",
IDecl->getNameAsString(), true);
-
+
SmallVector<ObjCMethodDecl *, 32> ClassMethods(IDecl->class_methods());
-
+
Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
"_OBJC_$_CLASS_METHODS_",
IDecl->getNameAsString(), true);
-
+
// Protocols referenced in class declaration?
// Protocol's super protocol list
std::vector<ObjCProtocolDecl *> RefedProtocols;
@@ -7085,12 +7085,12 @@ void RewriteModernObjC::RewriteObjCClass
// and in their nested qualifiers before writing out current definition.
RewriteObjCProtocolMetaData(*I, Result);
}
-
- Write_protocol_list_initializer(Context, Result,
+
+ Write_protocol_list_initializer(Context, Result,
RefedProtocols,
"_OBJC_CLASS_PROTOCOLS_$_",
IDecl->getNameAsString());
-
+
// Protocol's property metadata.
SmallVector<ObjCPropertyDecl *, 8> ClassProperties(
CDecl->instance_properties());
@@ -7098,22 +7098,22 @@ void RewriteModernObjC::RewriteObjCClass
/* Container */IDecl,
"_OBJC_$_PROP_LIST_",
CDecl->getNameAsString());
-
+
// Data for initializing _class_ro_t metaclass meta-data
uint32_t flags = CLS_META;
std::string InstanceSize;
std::string InstanceStart;
-
+
bool classIsHidden = CDecl->getVisibility() == HiddenVisibility;
if (classIsHidden)
flags |= OBJC2_CLS_HIDDEN;
-
+
if (!CDecl->getSuperClass())
// class is root
flags |= CLS_ROOT;
InstanceSize = "sizeof(struct _class_t)";
InstanceStart = InstanceSize;
- Write__class_ro_t_initializer(Context, Result, flags,
+ Write__class_ro_t_initializer(Context, Result, flags,
InstanceStart, InstanceSize,
ClassMethods,
nullptr,
@@ -7126,14 +7126,14 @@ void RewriteModernObjC::RewriteObjCClass
flags = CLS;
if (classIsHidden)
flags |= OBJC2_CLS_HIDDEN;
-
+
if (hasObjCExceptionAttribute(*Context, CDecl))
flags |= CLS_EXCEPTION;
if (!CDecl->getSuperClass())
// class is root
flags |= CLS_ROOT;
-
+
InstanceSize.clear();
InstanceStart.clear();
if (!ObjCSynthesizedStructs.count(CDecl)) {
@@ -7144,15 +7144,15 @@ void RewriteModernObjC::RewriteObjCClass
InstanceSize = "sizeof(struct ";
InstanceSize += CDecl->getNameAsString();
InstanceSize += "_IMPL)";
-
+
ObjCIvarDecl *IVD = CDecl->all_declared_ivar_begin();
if (IVD) {
RewriteIvarOffsetComputation(IVD, InstanceStart);
}
- else
+ else
InstanceStart = InstanceSize;
}
- Write__class_ro_t_initializer(Context, Result, flags,
+ Write__class_ro_t_initializer(Context, Result, flags,
InstanceStart, InstanceSize,
InstanceMethods,
RefedProtocols,
@@ -7160,15 +7160,15 @@ void RewriteModernObjC::RewriteObjCClass
ClassProperties,
"_OBJC_CLASS_RO_$_",
CDecl->getNameAsString());
-
+
Write_class_t(Context, Result,
"OBJC_METACLASS_$_",
CDecl, /*metaclass*/true);
-
+
Write_class_t(Context, Result,
"OBJC_CLASS_$_",
CDecl, /*metaclass*/false);
-
+
if (ImplementationIsNonLazy(IDecl))
DefinedNonLazyClasses.push_back(CDecl);
}
@@ -7192,25 +7192,25 @@ void RewriteModernObjC::RewriteClassSetu
void RewriteModernObjC::RewriteMetaDataIntoBuffer(std::string &Result) {
int ClsDefCount = ClassImplementation.size();
int CatDefCount = CategoryImplementation.size();
-
+
// For each implemented class, write out all its meta data.
for (int i = 0; i < ClsDefCount; i++)
RewriteObjCClassMetaData(ClassImplementation[i], Result);
-
+
RewriteClassSetupInitHook(Result);
-
+
// For each implemented category, write out all its meta data.
for (int i = 0; i < CatDefCount; i++)
RewriteObjCCategoryImplDecl(CategoryImplementation[i], Result);
-
+
RewriteCategorySetupInitHook(Result);
-
+
if (ClsDefCount > 0) {
if (LangOpts.MicrosoftExt)
Result += "__declspec(allocate(\".objc_classlist$B\")) ";
Result += "static struct _class_t *L_OBJC_LABEL_CLASS_$ [";
Result += llvm::utostr(ClsDefCount); Result += "]";
- Result +=
+ Result +=
" __attribute__((used, section (\"__DATA, __objc_classlist,"
"regular,no_dead_strip\")))= {\n";
for (int i = 0; i < ClsDefCount; i++) {
@@ -7219,7 +7219,7 @@ void RewriteModernObjC::RewriteMetaDataI
Result += ",\n";
}
Result += "};\n";
-
+
if (!DefinedNonLazyClasses.empty()) {
if (LangOpts.MicrosoftExt)
Result += "__declspec(allocate(\".objc_nlclslist$B\")) \n";
@@ -7231,34 +7231,34 @@ void RewriteModernObjC::RewriteMetaDataI
Result += "};\n";
}
}
-
+
if (CatDefCount > 0) {
if (LangOpts.MicrosoftExt)
Result += "__declspec(allocate(\".objc_catlist$B\")) ";
Result += "static struct _category_t *L_OBJC_LABEL_CATEGORY_$ [";
Result += llvm::utostr(CatDefCount); Result += "]";
- Result +=
+ Result +=
" __attribute__((used, section (\"__DATA, __objc_catlist,"
"regular,no_dead_strip\")))= {\n";
for (int i = 0; i < CatDefCount; i++) {
Result += "\t&_OBJC_$_CATEGORY_";
- Result +=
- CategoryImplementation[i]->getClassInterface()->getNameAsString();
+ Result +=
+ CategoryImplementation[i]->getClassInterface()->getNameAsString();
Result += "_$_";
Result += CategoryImplementation[i]->getNameAsString();
Result += ",\n";
}
Result += "};\n";
}
-
+
if (!DefinedNonLazyCategories.empty()) {
if (LangOpts.MicrosoftExt)
Result += "__declspec(allocate(\".objc_nlcatlist$B\")) \n";
Result += "static struct _category_t *_OBJC_LABEL_NONLAZY_CATEGORY_$[] = {\n\t";
for (unsigned i = 0, e = DefinedNonLazyCategories.size(); i < e; i++) {
Result += "\t&_OBJC_$_CATEGORY_";
- Result +=
- DefinedNonLazyCategories[i]->getClassInterface()->getNameAsString();
+ Result +=
+ DefinedNonLazyCategories[i]->getClassInterface()->getNameAsString();
Result += "_$_";
Result += DefinedNonLazyCategories[i]->getNameAsString();
Result += ",\n";
@@ -7270,7 +7270,7 @@ void RewriteModernObjC::RewriteMetaDataI
void RewriteModernObjC::WriteImageInfo(std::string &Result) {
if (LangOpts.MicrosoftExt)
Result += "__declspec(allocate(\".objc_imageinfo$B\")) \n";
-
+
Result += "static struct IMAGE_INFO { unsigned version; unsigned flag; } ";
// version 0, ObjCABI is 2
Result += "_OBJC_IMAGE_INFO = { 0, 2 };\n";
@@ -7285,14 +7285,14 @@ void RewriteModernObjC::RewriteObjCCateg
// Find category declaration for this implementation.
ObjCCategoryDecl *CDecl
= ClassDecl->FindCategoryDeclaration(IDecl->getIdentifier());
-
+
std::string FullCategoryName = ClassDecl->getNameAsString();
FullCategoryName += "_$_";
FullCategoryName += CDecl->getNameAsString();
-
+
// Build _objc_method_list for class's instance methods if needed
SmallVector<ObjCMethodDecl *, 32> InstanceMethods(IDecl->instance_methods());
-
+
// If any of our property implementations have associated getters or
// setters, produce metadata for them as well.
for (const auto *Prop : IDecl->property_impls()) {
@@ -7310,17 +7310,17 @@ void RewriteModernObjC::RewriteObjCCateg
if (ObjCMethodDecl *Setter = PD->getSetterMethodDecl())
InstanceMethods.push_back(Setter);
}
-
+
Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
"_OBJC_$_CATEGORY_INSTANCE_METHODS_",
FullCategoryName, true);
-
+
SmallVector<ObjCMethodDecl *, 32> ClassMethods(IDecl->class_methods());
-
+
Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
"_OBJC_$_CATEGORY_CLASS_METHODS_",
FullCategoryName, true);
-
+
// Protocols referenced in class declaration?
// Protocol's super protocol list
SmallVector<ObjCProtocolDecl *, 8> RefedProtocols(CDecl->protocols());
@@ -7328,12 +7328,12 @@ void RewriteModernObjC::RewriteObjCCateg
// Must write out all protocol definitions in current qualifier list,
// and in their nested qualifiers before writing out current definition.
RewriteObjCProtocolMetaData(I, Result);
-
- Write_protocol_list_initializer(Context, Result,
+
+ Write_protocol_list_initializer(Context, Result,
RefedProtocols,
"_OBJC_CATEGORY_PROTOCOLS_$_",
FullCategoryName);
-
+
// Protocol's property metadata.
SmallVector<ObjCPropertyDecl *, 8> ClassProperties(
CDecl->instance_properties());
@@ -7341,7 +7341,7 @@ void RewriteModernObjC::RewriteObjCCateg
/* Container */IDecl,
"_OBJC_$_PROP_LIST_",
FullCategoryName);
-
+
Write_category_t(*this, Context, Result,
CDecl,
ClassDecl,
@@ -7349,7 +7349,7 @@ void RewriteModernObjC::RewriteObjCCateg
ClassMethods,
RefedProtocols,
ClassProperties);
-
+
// Determine if this category is also "non-lazy".
if (ImplementationIsNonLazy(IDecl))
DefinedNonLazyCategories.push_back(CDecl);
@@ -7385,7 +7385,7 @@ void RewriteModernObjC::RewriteObjCMetho
StringRef ClassName,
std::string &Result) {
if (MethodBegin == MethodEnd) return;
-
+
if (!objc_impl_method) {
/* struct _objc_method {
SEL _cmd;
@@ -7398,12 +7398,12 @@ void RewriteModernObjC::RewriteObjCMetho
Result += "\tchar *method_types;\n";
Result += "\tvoid *_imp;\n";
Result += "};\n";
-
+
objc_impl_method = true;
}
-
+
// Build _objc_method_list for class's methods if needed
-
+
/* struct {
struct _objc_method_list *next_method;
int method_count;
@@ -7432,7 +7432,7 @@ void RewriteModernObjC::RewriteObjCMetho
Result += IsInstanceMethod ? "inst" : "cls";
Result += "_meth\")))= ";
Result += "{\n\t0, " + utostr(NumMethods) + "\n";
-
+
Result += "\t,{{(SEL)\"";
Result += (*MethodBegin)->getSelector().getAsString().c_str();
std::string MethodTypeString;
@@ -7459,18 +7459,18 @@ void RewriteModernObjC::RewriteObjCMetho
Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
SourceRange OldRange = IV->getSourceRange();
Expr *BaseExpr = IV->getBase();
-
+
// Rewrite the base, but without actually doing replaces.
{
DisableReplaceStmtScope S(*this);
BaseExpr = cast<Expr>(RewriteFunctionBodyOrGlobalInitializer(BaseExpr));
IV->setBase(BaseExpr);
}
-
+
ObjCIvarDecl *D = IV->getDecl();
-
+
Expr *Replacement = IV;
-
+
if (BaseExpr->getType()->isObjCObjectPointerType()) {
const ObjCInterfaceType *iFaceDecl =
dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
@@ -7480,18 +7480,18 @@ Stmt *RewriteModernObjC::RewriteObjCIvar
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
clsDeclared);
assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class");
-
+
// Build name of symbol holding ivar offset.
std::string IvarOffsetName;
if (D->isBitField())
ObjCIvarBitfieldGroupOffset(D, IvarOffsetName);
else
WriteInternalIvarName(clsDeclared, D, IvarOffsetName);
-
+
ReferencedIvars[clsDeclared].insert(D);
-
+
// cast offset to "char *".
- CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context,
+ CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(Context->CharTy),
CK_BitCast,
BaseExpr);
@@ -7502,8 +7502,8 @@ Stmt *RewriteModernObjC::RewriteObjCIvar
DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, false,
Context->UnsignedLongTy, VK_LValue,
SourceLocation());
- BinaryOperator *addExpr =
- new (Context) BinaryOperator(castExpr, DRE, BO_Add,
+ BinaryOperator *addExpr =
+ new (Context) BinaryOperator(castExpr, DRE, BO_Add,
Context->getPointerType(Context->CharTy),
VK_RValue, OK_Ordinary, SourceLocation(), FPOptions());
// Don't forget the parens to enforce the proper binding.
@@ -7519,7 +7519,7 @@ Stmt *RewriteModernObjC::RewriteObjCIvar
RD = RD->getDefinition();
if (RD && !RD->getDeclName().getAsIdentifierInfo()) {
// decltype(((Foo_IMPL*)0)->bar) *
- ObjCContainerDecl *CDecl =
+ ObjCContainerDecl *CDecl =
dyn_cast<ObjCContainerDecl>(D->getDeclContext());
// ivar in class extensions requires special treatment.
if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(CDecl))
@@ -7530,7 +7530,7 @@ Stmt *RewriteModernObjC::RewriteObjCIvar
*Context, TTK_Struct, TUDecl, SourceLocation(), SourceLocation(),
&Context->Idents.get(RecName));
QualType PtrStructIMPL = Context->getPointerType(Context->getTagDeclType(RD));
- unsigned UnsignedIntSize =
+ unsigned UnsignedIntSize =
static_cast<unsigned>(Context->getTypeSize(Context->UnsignedIntTy));
Expr *Zero = IntegerLiteral::Create(*Context,
llvm::APInt(UnsignedIntSize, 0),
@@ -7552,20 +7552,20 @@ Stmt *RewriteModernObjC::RewriteObjCIvar
}
convertObjCTypeToCStyleType(IvarT);
QualType castT = Context->getPointerType(IvarT);
-
- castExpr = NoTypeInfoCStyleCastExpr(Context,
+
+ castExpr = NoTypeInfoCStyleCastExpr(Context,
castT,
CK_BitCast,
PE);
-
-
+
+
Expr *Exp = new (Context) UnaryOperator(castExpr, UO_Deref, IvarT,
VK_LValue, OK_Ordinary,
SourceLocation(), false);
PE = new (Context) ParenExpr(OldRange.getBegin(),
OldRange.getEnd(),
Exp);
-
+
if (D->isBitField()) {
FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
@@ -7582,9 +7582,9 @@ Stmt *RewriteModernObjC::RewriteObjCIvar
else
Replacement = PE;
}
-
+
ReplaceStmtWithRange(IV, Replacement, OldRange);
- return Replacement;
+ return Replacement;
}
#endif // CLANG_ENABLE_OBJC_REWRITER
Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp Mon Jul 30 12:24:48 2018
@@ -42,7 +42,7 @@ namespace {
BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)),
block, ... */
BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
- BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the
+ BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the
__block variable */
BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
helpers */
@@ -50,7 +50,7 @@ namespace {
support routines */
BLOCK_BYREF_CURRENT_MAX = 256
};
-
+
enum {
BLOCK_NEEDS_FREE = (1 << 24),
BLOCK_HAS_COPY_DISPOSE = (1 << 25),
@@ -60,7 +60,7 @@ namespace {
BLOCK_HAS_DESCRIPTOR = (1 << 29)
};
static const int OBJC_ABI_VERSION = 7;
-
+
Rewriter Rewrite;
DiagnosticsEngine &Diags;
const LangOptions &LangOpts;
@@ -74,7 +74,7 @@ namespace {
std::string InFileName;
std::unique_ptr<raw_ostream> OutFile;
std::string Preamble;
-
+
TypeDecl *ProtocolTypeDecl;
VarDecl *GlobalVarDecl;
unsigned RewriteFailedDiag;
@@ -85,13 +85,13 @@ namespace {
// ObjC foreach break/continue generation support.
int BcLabelCount;
-
+
unsigned TryFinallyContainsReturnDiag;
// Needed for super.
ObjCMethodDecl *CurMethodDef;
RecordDecl *SuperStructDecl;
RecordDecl *ConstantStringDecl;
-
+
FunctionDecl *MsgSendFunctionDecl;
FunctionDecl *MsgSendSuperFunctionDecl;
FunctionDecl *MsgSendStretFunctionDecl;
@@ -117,14 +117,14 @@ namespace {
SmallVector<int, 8> ObjCBcLabelNo;
// Remember all the @protocol(<expr>) expressions.
llvm::SmallPtrSet<ObjCProtocolDecl *, 32> ProtocolExprDecls;
-
+
llvm::DenseSet<uint64_t> CopyDestroyCache;
// Block expressions.
SmallVector<BlockExpr *, 32> Blocks;
SmallVector<int, 32> InnerDeclRefsCount;
SmallVector<DeclRefExpr *, 32> InnerDeclRefs;
-
+
SmallVector<DeclRefExpr *, 32> BlockDeclRefs;
// Block related declarations.
@@ -135,7 +135,7 @@ namespace {
llvm::DenseMap<ValueDecl *, unsigned> BlockByRefDeclNo;
llvm::SmallPtrSet<ValueDecl *, 8> ImportedBlockDecls;
llvm::SmallPtrSet<VarDecl *, 8> ImportedLocalExternalDecls;
-
+
llvm::DenseMap<BlockExpr *, std::string> RewrittenBlockExprs;
// This maps an original source AST to it's rewritten form. This allows
@@ -147,12 +147,12 @@ namespace {
bool IsHeader;
bool SilenceRewriteMacroWarning;
bool objc_impl_method;
-
+
bool DisableReplaceStmt;
class DisableReplaceStmtScope {
RewriteObjC &R;
bool SavedValue;
-
+
public:
DisableReplaceStmtScope(RewriteObjC &R)
: R(R), SavedValue(R.DisableReplaceStmt) {
@@ -262,7 +262,7 @@ namespace {
void RewriteInclude();
void RewriteForwardClassDecl(DeclGroupRef D);
void RewriteForwardClassDecl(const SmallVectorImpl<Decl *> &DG);
- void RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,
+ void RewriteForwardClassEpilogue(ObjCInterfaceDecl *ClassDecl,
const std::string &typedefString);
void RewriteImplementations();
void RewritePropertyImplDecl(ObjCPropertyImplDecl *PID,
@@ -289,7 +289,7 @@ namespace {
void RewriteObjCQualifiedInterfaceTypes(Decl *Dcl);
void RewriteTypeOfDecl(VarDecl *VD);
void RewriteObjCQualifiedInterfaceTypes(Expr *E);
-
+
// Expression Rewriting.
Stmt *RewriteFunctionBodyOrGlobalInitializer(Stmt *S);
Stmt *RewriteAtEncode(ObjCEncodeExpr *Exp);
@@ -309,17 +309,17 @@ namespace {
Stmt *RewriteBreakStmt(BreakStmt *S);
Stmt *RewriteContinueStmt(ContinueStmt *S);
void RewriteCastExpr(CStyleCastExpr *CE);
-
+
// Block rewriting.
void RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D);
-
+
// Block specific rewrite rules.
void RewriteBlockPointerDecl(NamedDecl *VD);
void RewriteByRefVar(VarDecl *VD);
Stmt *RewriteBlockDeclRefExpr(DeclRefExpr *VD);
Stmt *RewriteLocalVariableExternalStorage(DeclRefExpr *DRE);
void RewriteBlockPointerFunctionArgs(FunctionDecl *FD);
-
+
void RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl,
std::string &Result);
@@ -339,12 +339,12 @@ namespace {
std::string &Result) = 0;
virtual void RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
std::string &Result) = 0;
-
+
// Rewriting ivar access
virtual Stmt *RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) = 0;
virtual void RewriteIvarOffsetComputation(ObjCIvarDecl *ivar,
std::string &Result) = 0;
-
+
// Misc. AST transformation routines. Sometimes they end up calling
// rewriting routines on the new ASTs.
CallExpr *SynthesizeCallToFunctionDecl(FunctionDecl *FD,
@@ -352,15 +352,15 @@ namespace {
SourceLocation StartLoc=SourceLocation(),
SourceLocation EndLoc=SourceLocation());
CallExpr *SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFlavor,
- QualType msgSendType,
- QualType returnType,
+ QualType msgSendType,
+ QualType returnType,
SmallVectorImpl<QualType> &ArgTypes,
SmallVectorImpl<Expr*> &MsgExprs,
ObjCMethodDecl *Method);
Stmt *SynthMessageExpr(ObjCMessageExpr *Exp,
SourceLocation StartLoc=SourceLocation(),
SourceLocation EndLoc=SourceLocation());
-
+
void SynthCountByEnumWithState(std::string &buf);
void SynthMsgSendFunctionDecl();
void SynthMsgSendSuperFunctionDecl();
@@ -372,15 +372,15 @@ namespace {
void SynthGetSuperClassFunctionDecl();
void SynthSelGetUidFunctionDecl();
void SynthSuperConstructorFunctionDecl();
-
+
std::string SynthesizeByrefCopyDestroyHelper(VarDecl *VD, int flag);
std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
StringRef funcName, std::string Tag);
std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
StringRef funcName, std::string Tag);
- std::string SynthesizeBlockImpl(BlockExpr *CE,
+ std::string SynthesizeBlockImpl(BlockExpr *CE,
std::string Tag, std::string Desc);
- std::string SynthesizeBlockDescriptor(std::string DescTag,
+ std::string SynthesizeBlockDescriptor(std::string DescTag,
std::string ImplTag,
int i, StringRef funcName,
unsigned hasCopy);
@@ -423,13 +423,13 @@ namespace {
}
return false;
}
-
+
bool needToScanForQualifiers(QualType T);
QualType getSuperStructType();
QualType getConstantStringStructType();
QualType convertFunctionTypeOfBlocks(const FunctionType *FT);
bool BufferContainsPPDirectives(const char *startBuf, const char *endBuf);
-
+
void convertToUnqualifiedObjCType(QualType &T) {
if (T->isObjCQualifiedIdType())
T = Context->getObjCIdType();
@@ -445,7 +445,7 @@ namespace {
}
}
}
-
+
// FIXME: This predicate seems like it would be useful to add to ASTContext.
bool isObjCType(QualType T) {
if (!LangOpts.ObjC1 && !LangOpts.ObjC2)
@@ -468,7 +468,7 @@ namespace {
bool PointerTypeTakesAnyObjCQualifiedType(QualType QT);
void GetExtentOfArgList(const char *Name, const char *&LParen,
const char *&RParen);
-
+
void QuoteDoublequotes(std::string &From, std::string &To) {
for (unsigned i = 0; i < From.length(); i++) {
if (From[i] == '"')
@@ -504,7 +504,7 @@ namespace {
/*Pascal=*/false, StrType, SourceLocation());
}
};
-
+
class RewriteObjCFragileABI : public RewriteObjC {
public:
RewriteObjCFragileABI(std::string inFile, std::unique_ptr<raw_ostream> OS,
@@ -688,7 +688,7 @@ void RewriteObjC::HandleTopLevelSingleDe
DG.push_back(*DI);
else
break;
-
+
++DI;
} while (DI != DIEnd);
RewriteForwardClassDecl(DG);
@@ -707,14 +707,14 @@ void RewriteObjC::HandleTopLevelSingleDe
DG.push_back(*DI);
else
break;
-
+
++DI;
} while (DI != DIEnd);
RewriteForwardProtocolDecl(DG);
continue;
}
}
-
+
HandleTopLevelSingleDecl(*DI);
++DI;
}
@@ -790,7 +790,7 @@ void RewriteObjC::RewritePropertyImplDec
unsigned Attributes = PD->getPropertyAttributes();
if (!PD->getGetterMethodDecl()->isDefined()) {
bool GenGetProperty = !(Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) &&
- (Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
+ (Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
ObjCPropertyDecl::OBJC_PR_copy));
std::string Getr;
if (GenGetProperty && !objcGetPropertyDefined) {
@@ -799,7 +799,7 @@ void RewriteObjC::RewritePropertyImplDec
Getr = "\nextern \"C\" __declspec(dllimport) "
"id objc_getProperty(id, SEL, long, bool);\n";
}
- RewriteObjCMethodDecl(OID->getContainingInterface(),
+ RewriteObjCMethodDecl(OID->getContainingInterface(),
PD->getGetterMethodDecl(), Getr);
Getr += "{ ";
// Synthesize an explicit cast to gain access to the ivar.
@@ -813,7 +813,7 @@ void RewriteObjC::RewritePropertyImplDec
Getr += " _TYPE";
if (FPRetType) {
Getr += ")"; // close the precedence "scope" for "*".
-
+
// Now, emit the argument types (if any).
if (const FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FPRetType)){
Getr += "(";
@@ -843,13 +843,13 @@ void RewriteObjC::RewritePropertyImplDec
Getr += "; }";
InsertText(onePastSemiLoc, Getr);
}
-
+
if (PD->isReadOnly() || PD->getSetterMethodDecl()->isDefined())
return;
// Generate the 'setter' function.
std::string Setr;
- bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
+ bool GenSetProperty = Attributes & (ObjCPropertyDecl::OBJC_PR_retain |
ObjCPropertyDecl::OBJC_PR_copy);
if (GenSetProperty && !objcSetPropertyDefined) {
objcSetPropertyDefined = true;
@@ -857,8 +857,8 @@ void RewriteObjC::RewritePropertyImplDec
Setr = "\nextern \"C\" __declspec(dllimport) "
"void objc_setProperty (id, SEL, long, id, bool, bool);\n";
}
-
- RewriteObjCMethodDecl(OID->getContainingInterface(),
+
+ RewriteObjCMethodDecl(OID->getContainingInterface(),
PD->getSetterMethodDecl(), Setr);
Setr += "{ ";
// Synthesize an explicit cast to initialize the ivar.
@@ -903,9 +903,9 @@ void RewriteObjC::RewriteForwardClassEpi
const std::string &typedefString) {
SourceLocation startLoc = ClassDecl->getLocStart();
const char *startBuf = SM->getCharacterData(startLoc);
- const char *semiPtr = strchr(startBuf, ';');
+ const char *semiPtr = strchr(startBuf, ';');
// Replace the @class with typedefs corresponding to the classes.
- ReplaceText(startLoc, semiPtr-startBuf+1, typedefString);
+ ReplaceText(startLoc, semiPtr-startBuf+1, typedefString);
}
void RewriteObjC::RewriteForwardClassDecl(DeclGroupRef D) {
@@ -971,21 +971,21 @@ void RewriteObjC::RewriteCategoryDecl(Ob
ReplaceText(LocStart, 0, "// ");
for (auto *I : CatDecl->instance_properties())
- RewriteProperty(I);
+ RewriteProperty(I);
for (auto *I : CatDecl->instance_methods())
RewriteMethodDeclaration(I);
for (auto *I : CatDecl->class_methods())
RewriteMethodDeclaration(I);
// Lastly, comment out the @end.
- ReplaceText(CatDecl->getAtEndRange().getBegin(),
+ ReplaceText(CatDecl->getAtEndRange().getBegin(),
strlen("@end"), "/* @end */");
}
void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
SourceLocation LocStart = PDecl->getLocStart();
assert(PDecl->isThisDeclarationADefinition());
-
+
// FIXME: handle protocol headers that are declared across multiple lines.
ReplaceText(LocStart, 0, "// ");
@@ -995,7 +995,7 @@ void RewriteObjC::RewriteProtocolDecl(Ob
RewriteMethodDeclaration(I);
for (auto *I : PDecl->instance_properties())
RewriteProperty(I);
-
+
// Lastly, comment out the @end.
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
ReplaceText(LocEnd, strlen("@end"), "/* @end */");
@@ -1025,7 +1025,7 @@ void RewriteObjC::RewriteForwardProtocol
ReplaceText(LocStart, 0, "// ");
}
-void
+void
RewriteObjC::RewriteForwardProtocolDecl(const SmallVectorImpl<Decl *> &DG) {
SourceLocation LocStart = DG[0]->getLocStart();
if (LocStart.isInvalid())
@@ -1220,7 +1220,7 @@ void RewriteObjC::RewriteInterfaceDecl(O
RewriteMethodDeclaration(I);
// Lastly, comment out the @end.
- ReplaceText(ClassDecl->getAtEndRange().getBegin(), strlen("@end"),
+ ReplaceText(ClassDecl->getAtEndRange().getBegin(), strlen("@end"),
"/* @end */");
}
@@ -1677,7 +1677,7 @@ Stmt *RewriteObjC::RewriteObjCSynchroniz
buf += "}\n";
buf += "{ /* implicit finally clause */\n";
buf += " if (!_rethrow) objc_exception_try_exit(&_stack);\n";
-
+
std::string syncBuf;
syncBuf += " objc_sync_exit(";
@@ -1695,7 +1695,7 @@ Stmt *RewriteObjC::RewriteObjCSynchroniz
syncExpr->printPretty(syncExprBuf, nullptr, PrintingPolicy(LangOpts));
syncBuf += syncExprBuf.str();
syncBuf += ");";
-
+
buf += syncBuf;
buf += "\n if (_rethrow) objc_exception_throw(_rethrow);\n";
buf += "}\n";
@@ -1724,8 +1724,8 @@ void RewriteObjC::WarnAboutReturnGotoStm
}
}
-void RewriteObjC::HasReturnStmts(Stmt *S, bool &hasReturns)
-{
+void RewriteObjC::HasReturnStmts(Stmt *S, bool &hasReturns)
+{
// Perform a bottom up traversal of all children.
for (Stmt *SubStmt : S->children())
if (SubStmt)
@@ -1750,7 +1750,7 @@ void RewriteObjC::RewriteTryReturnStmts(
std::string buf;
buf = "{ objc_exception_try_exit(&_stack); return";
-
+
ReplaceText(startLoc, 6, buf);
InsertText(onePastSemiLoc, "}");
}
@@ -1774,7 +1774,7 @@ void RewriteObjC::RewriteSyncReturnStmts
buf = "{ objc_exception_try_exit(&_stack);";
buf += syncExitBuf;
buf += " return";
-
+
ReplaceText(startLoc, 6, buf);
InsertText(onePastSemiLoc, "}");
}
@@ -1930,7 +1930,7 @@ Stmt *RewriteObjC::RewriteObjCTryStmt(Ob
buf += " if (_rethrow) objc_exception_throw(_rethrow);\n";
buf += "}";
ReplaceText(lastCurlyLoc, 1, buf);
-
+
// Now check for any return/continue/go statements within the @try.
// The implicit finally clause won't called if the @try contains any
// jump statements.
@@ -2446,7 +2446,7 @@ void RewriteObjC::SynthGetClassFunctionD
// SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls);
void RewriteObjC::SynthGetSuperClassFunctionDecl() {
- IdentifierInfo *getSuperClassIdent =
+ IdentifierInfo *getSuperClassIdent =
&Context->Idents.get("class_getSuperclass");
SmallVector<QualType, 16> ArgTys;
ArgTys.push_back(Context->getObjCClassType());
@@ -2583,8 +2583,8 @@ QualType RewriteObjC::getConstantStringS
}
CallExpr *RewriteObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFlavor,
- QualType msgSendType,
- QualType returnType,
+ QualType msgSendType,
+ QualType returnType,
SmallVectorImpl<QualType> &ArgTypes,
SmallVectorImpl<Expr*> &MsgExprs,
ObjCMethodDecl *Method) {
@@ -2603,10 +2603,10 @@ CallExpr *RewriteObjC::SynthMsgSendStret
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_BitCast,
cast);
-
+
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast);
-
+
const FunctionType *FT = msgSendType->getAs<FunctionType>();
CallExpr *STCE = new (Context) CallExpr(
*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, SourceLocation());
@@ -2764,7 +2764,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjC
Context->getObjCIdType(),
VK_RValue, SourceLocation()))
); // set the 'receiver'.
-
+
// (id)class_getSuperclass((Class)objc_getClass("CurrentClass"))
SmallVector<Expr*, 8> ClsExprs;
ClsExprs.push_back(getStringLiteral(ClassDecl->getIdentifier()->getName()));
@@ -2778,7 +2778,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjC
ClsExprs.push_back(ArgExpr);
Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl, ClsExprs,
StartLoc, EndLoc);
-
+
// (id)class_getSuperclass((Class)objc_getClass("CurrentClass"))
// To turn off a warning, type-cast to 'id'
InitExprs.push_back(
@@ -2863,7 +2863,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjC
(void)convertBlockPointerToFunctionPointer(type);
const Expr *SubExpr = ICE->IgnoreParenImpCasts();
CastKind CK;
- if (SubExpr->getType()->isIntegralType(*Context) &&
+ if (SubExpr->getType()->isIntegralType(*Context) &&
type->isBooleanType()) {
CK = CK_IntegralToBoolean;
} else if (type->isObjCObjectPointerType()) {
@@ -2968,9 +2968,9 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjC
// call to objc_msgSend_stret and hang both varieties on a conditional
// expression which dictate which one to envoke depending on size of
// method's return type.
-
- CallExpr *STCE = SynthMsgSendStretCallExpr(MsgSendStretFlavor,
- msgSendType, returnType,
+
+ CallExpr *STCE = SynthMsgSendStretCallExpr(MsgSendStretFlavor,
+ msgSendType, returnType,
ArgTypes, MsgExprs,
Exp->getMethodDecl());
@@ -2990,7 +2990,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjC
llvm::APInt(IntSize, 8),
Context->IntTy,
SourceLocation());
- BinaryOperator *lessThanExpr =
+ BinaryOperator *lessThanExpr =
new (Context) BinaryOperator(sizeofExpr, limit, BO_LE, Context->IntTy,
VK_RValue, OK_Ordinary, SourceLocation(),
FPOptions());
@@ -3000,7 +3000,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjC
SourceLocation(), CE,
SourceLocation(), STCE,
returnType, VK_RValue, OK_Ordinary);
- ReplacingStmt = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
+ ReplacingStmt = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
CondExpr);
}
// delete Exp; leak for now, see RewritePropertyOrImplicitSetter() usage for more info.
@@ -3232,14 +3232,14 @@ void RewriteObjC::RewriteImplementations
RewriteImplementationDecl(CategoryImplementation[i]);
}
-void RewriteObjC::RewriteByRefString(std::string &ResultStr,
+void RewriteObjC::RewriteByRefString(std::string &ResultStr,
const std::string &Name,
ValueDecl *VD, bool def) {
- assert(BlockByRefDeclNo.count(VD) &&
+ assert(BlockByRefDeclNo.count(VD) &&
"RewriteByRefString: ByRef decl missing");
if (def)
ResultStr += "struct ";
- ResultStr += "__Block_byref_" + Name +
+ ResultStr += "__Block_byref_" + Name +
"_" + utostr(BlockByRefDeclNo[VD]) ;
}
@@ -3329,7 +3329,7 @@ std::string RewriteObjC::SynthesizeBlock
if (HasLocalVariableExternalStorage(*I))
QT = Context->getPointerType(QT);
QT.getAsStringInternal(Name, Context->getPrintingPolicy());
- S += Name + " = __cself->" +
+ S += Name + " = __cself->" +
(*I)->getNameAsString() + "; // bound by copy\n";
}
}
@@ -3365,7 +3365,7 @@ std::string RewriteObjC::SynthesizeBlock
S += ", " + utostr(BLOCK_FIELD_IS_OBJECT) + "/*BLOCK_FIELD_IS_OBJECT*/);";
}
S += "}\n";
-
+
S += "\nstatic void __";
S += funcName;
S += "_block_dispose_" + utostr(i);
@@ -3385,7 +3385,7 @@ std::string RewriteObjC::SynthesizeBlock
return S;
}
-std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
+std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
std::string Desc) {
std::string S = "\nstruct " + Tag;
std::string Constructor = " " + Tag;
@@ -3474,7 +3474,7 @@ std::string RewriteObjC::SynthesizeBlock
Constructor += ", ";
Constructor += Name + "(_" + Name + "->__forwarding)";
}
-
+
Constructor += " {\n";
if (GlobalVarDecl)
Constructor += " impl.isa = &_NSConcreteGlobalBlock;\n";
@@ -3500,19 +3500,19 @@ std::string RewriteObjC::SynthesizeBlock
return S;
}
-std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag,
+std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag,
std::string ImplTag, int i,
StringRef FunName,
unsigned hasCopy) {
std::string S = "\nstatic struct " + DescTag;
-
+
S += " {\n unsigned long reserved;\n";
S += " unsigned long Block_size;\n";
if (hasCopy) {
S += " void (*copy)(struct ";
S += ImplTag; S += "*, struct ";
S += ImplTag; S += "*);\n";
-
+
S += " void (*dispose)(struct ";
S += ImplTag; S += "*);\n";
}
@@ -3543,7 +3543,7 @@ void RewriteObjC::SynthesizeBlockLiteral
SC += "() {}";
InsertText(FunLocStart, SC);
}
-
+
// Insert closures that were part of the function.
for (unsigned i = 0, count=0; i < Blocks.size(); i++) {
CollectBlockDeclRefInfo(Blocks[i]);
@@ -3564,7 +3564,7 @@ void RewriteObjC::SynthesizeBlockLiteral
// imported objects in the inner blocks not used in the outer
// blocks must be copied/disposed in the outer block as well.
if (VD->hasAttr<BlocksAttr>() ||
- VD->getType()->isObjCObjectPointerType() ||
+ VD->getType()->isObjCObjectPointerType() ||
VD->getType()->isBlockPointerType())
ImportedBlockDecls.insert(VD);
}
@@ -3609,7 +3609,7 @@ void RewriteObjC::SynthesizeBlockLiteral
SC += "restrict ";
InsertText(FunLocStart, SC);
}
-
+
Blocks.clear();
InnerDeclRefsCount.clear();
InnerDeclRefs.clear();
@@ -3697,7 +3697,7 @@ QualType RewriteObjC::convertFunctionTyp
SmallVector<QualType, 8> ArgTypes;
QualType Res = FT->getReturnType();
bool HasBlockType = convertBlockPointerToFunctionPointer(Res);
-
+
if (FTP) {
for (auto &I : FTP->param_types()) {
QualType t = I;
@@ -3724,13 +3724,13 @@ Stmt *RewriteObjC::SynthesizeBlockCall(C
CPT = DRE->getType()->getAs<BlockPointerType>();
} else if (const MemberExpr *MExpr = dyn_cast<MemberExpr>(BlockExp)) {
CPT = MExpr->getType()->getAs<BlockPointerType>();
- }
+ }
else if (const ParenExpr *PRE = dyn_cast<ParenExpr>(BlockExp)) {
return SynthesizeBlockCall(Exp, PRE->getSubExpr());
}
- else if (const ImplicitCastExpr *IEXPR = dyn_cast<ImplicitCastExpr>(BlockExp))
+ else if (const ImplicitCastExpr *IEXPR = dyn_cast<ImplicitCastExpr>(BlockExp))
CPT = IEXPR->getType()->getAs<BlockPointerType>();
- else if (const ConditionalOperator *CEXPR =
+ else if (const ConditionalOperator *CEXPR =
dyn_cast<ConditionalOperator>(BlockExp)) {
Expr *LHSExp = CEXPR->getLHS();
Stmt *LHSStmt = SynthesizeBlockCall(Exp, LHSExp);
@@ -3831,7 +3831,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(C
// };
//}
Stmt *RewriteObjC::RewriteBlockDeclRefExpr(DeclRefExpr *DeclRefExp) {
- // Rewrite the byref variable into BYREFVAR->__forwarding->BYREFVAR
+ // Rewrite the byref variable into BYREFVAR->__forwarding->BYREFVAR
// for each DeclRefExp where BYREFVAR is name of the variable.
ValueDecl *VD = DeclRefExp->getDecl();
bool isArrow = DeclRefExp->refersToEnclosingVariableOrCapture() ||
@@ -3839,7 +3839,7 @@ Stmt *RewriteObjC::RewriteBlockDeclRefEx
FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
SourceLocation(),
- &Context->Idents.get("__forwarding"),
+ &Context->Idents.get("__forwarding"),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
@@ -3849,7 +3849,7 @@ Stmt *RewriteObjC::RewriteBlockDeclRefEx
StringRef Name = VD->getName();
FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(),
- &Context->Idents.get(Name),
+ &Context->Idents.get(Name),
Context->VoidPtrTy, nullptr,
/*BitWidth=*/nullptr, /*Mutable=*/true,
ICIS_NoInit);
@@ -3858,14 +3858,14 @@ Stmt *RewriteObjC::RewriteBlockDeclRefEx
DeclRefExp->getType(), VK_LValue, OK_Ordinary);
// Need parens to enforce precedence.
- ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),
- DeclRefExp->getExprLoc(),
+ ParenExpr *PE = new (Context) ParenExpr(DeclRefExp->getExprLoc(),
+ DeclRefExp->getExprLoc(),
ME);
ReplaceStmt(DeclRefExp, PE);
return PE;
}
-// Rewrites the imported local variable V with external storage
+// Rewrites the imported local variable V with external storage
// (static, extern, etc.) as *V
//
Stmt *RewriteObjC::RewriteLocalVariableExternalStorage(DeclRefExpr *DRE) {
@@ -3877,7 +3877,7 @@ Stmt *RewriteObjC::RewriteLocalVariableE
VK_LValue, OK_Ordinary,
DRE->getLocation(), false);
// Need parens to enforce precedence.
- ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
+ ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
Exp);
ReplaceStmt(DRE, PE);
return PE;
@@ -3991,7 +3991,7 @@ bool RewriteObjC::PointerTypeTakesAnyObj
I->getPointeeType()->isObjCQualifiedInterfaceType())
return true;
}
-
+
}
return false;
}
@@ -4057,7 +4057,7 @@ void RewriteObjC::RewriteBlockPointerDec
}
buf += ')';
OrigLength++;
-
+
if (PointerTypeTakesAnyBlockArguments(DeclT) ||
PointerTypeTakesAnyObjCQualifiedType(DeclT)) {
// Replace the '^' with '*' for arguments.
@@ -4070,7 +4070,7 @@ void RewriteObjC::RewriteBlockPointerDec
if (*argListBegin == '^')
buf += '*';
else if (*argListBegin == '<') {
- buf += "/*";
+ buf += "/*";
buf += *argListBegin++;
OrigLength++;
while (*argListBegin != '>') {
@@ -4094,19 +4094,19 @@ void RewriteObjC::RewriteBlockPointerDec
/// SynthesizeByrefCopyDestroyHelper - This routine synthesizes:
/// void __Block_byref_id_object_copy(struct Block_byref_id_object *dst,
/// struct Block_byref_id_object *src) {
-/// _Block_object_assign (&_dest->object, _src->object,
+/// _Block_object_assign (&_dest->object, _src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_OBJECT
/// [|BLOCK_FIELD_IS_WEAK]) // object
-/// _Block_object_assign(&_dest->object, _src->object,
+/// _Block_object_assign(&_dest->object, _src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_BLOCK
/// [|BLOCK_FIELD_IS_WEAK]) // block
/// }
/// And:
/// void __Block_byref_id_object_dispose(struct Block_byref_id_object *_src) {
-/// _Block_object_dispose(_src->object,
+/// _Block_object_dispose(_src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_OBJECT
/// [|BLOCK_FIELD_IS_WEAK]) // object
-/// _Block_object_dispose(_src->object,
+/// _Block_object_dispose(_src->object,
/// BLOCK_BYREF_CALLER | BLOCK_FIELD_IS_BLOCK
/// [|BLOCK_FIELD_IS_WEAK]) // block
/// }
@@ -4120,14 +4120,14 @@ std::string RewriteObjC::SynthesizeByref
S = "static void __Block_byref_id_object_copy_";
S += utostr(flag);
S += "(void *dst, void *src) {\n";
-
+
// offset into the object pointer is computed as:
// void * + void* + int + int + void* + void *
- unsigned IntSize =
+ unsigned IntSize =
static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
- unsigned VoidPtrSize =
+ unsigned VoidPtrSize =
static_cast<unsigned>(Context->getTypeSize(Context->VoidPtrTy));
-
+
unsigned offset = (VoidPtrSize*4 + IntSize + IntSize)/Context->getCharWidth();
S += " _Block_object_assign((char*)dst + ";
S += utostr(offset);
@@ -4136,7 +4136,7 @@ std::string RewriteObjC::SynthesizeByref
S += "), ";
S += utostr(flag);
S += ");\n}\n";
-
+
S += "static void __Block_byref_id_object_dispose_";
S += utostr(flag);
S += "(void *src) {\n";
@@ -4161,8 +4161,8 @@ std::string RewriteObjC::SynthesizeByref
/// };
///
/// It then replaces declaration of ND variable with:
-/// struct __Block_byref_ND ND = {__isa=0B, __forwarding=&ND, __flags=some_flag,
-/// __size=sizeof(struct __Block_byref_ND),
+/// struct __Block_byref_ND ND = {__isa=0B, __forwarding=&ND, __flags=some_flag,
+/// __size=sizeof(struct __Block_byref_ND),
/// ND=initializer-if-any};
///
///
@@ -4191,7 +4191,7 @@ void RewriteObjC::RewriteByRefVar(VarDec
ByrefType += " *__forwarding;\n";
ByrefType += " int __flags;\n";
ByrefType += " int __size;\n";
- // Add void *__Block_byref_id_object_copy;
+ // Add void *__Block_byref_id_object_copy;
// void *__Block_byref_id_object_dispose; if needed.
QualType Ty = ND->getType();
bool HasCopyAndDispose = Context->BlockRequiresCopying(Ty, ND);
@@ -4203,7 +4203,7 @@ void RewriteObjC::RewriteByRefVar(VarDec
QualType T = Ty;
(void)convertBlockPointerToFunctionPointer(T);
T.getAsStringInternal(Name, Context->getPrintingPolicy());
-
+
ByrefType += " " + Name + ";\n";
ByrefType += "};\n";
// Insert this type in global scope. It is needed by helper function.
@@ -4219,7 +4219,7 @@ void RewriteObjC::RewriteByRefVar(VarDec
flag |= BLOCK_FIELD_IS_WEAK;
isa = 1;
}
-
+
if (HasCopyAndDispose) {
flag = BLOCK_BYREF_CALLER;
QualType Ty = ND->getType();
@@ -4232,9 +4232,9 @@ void RewriteObjC::RewriteByRefVar(VarDec
if (!HF.empty())
InsertText(FunLocStart, HF);
}
-
- // struct __Block_byref_ND ND =
- // {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND),
+
+ // struct __Block_byref_ND ND =
+ // {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND),
// initializer-if-any};
bool hasInit = (ND->getInit() != nullptr);
unsigned flags = 0;
@@ -4294,13 +4294,13 @@ void RewriteObjC::RewriteByRefVar(VarDec
ByrefType += ", ";
}
ReplaceText(DeclLoc, endBuf-startBuf, ByrefType);
-
+
// Complete the newly synthesized compound expression by inserting a right
// curly brace before the end of the declaration.
// FIXME: This approach avoids rewriting the initializer expression. It
// also assumes there is only one declarator. For example, the following
// isn't currently supported by this routine (in general):
- //
+ //
// double __block BYREFVAR = 1.34, BYREFVAR2 = 1.37;
//
const char *startInitializerBuf = SM->getCharacterData(startLoc);
@@ -4336,7 +4336,7 @@ void RewriteObjC::CollectBlockDeclRefInf
// Find any imported blocks...they will need special attention.
for (unsigned i = 0; i < BlockDeclRefs.size(); i++)
if (BlockDeclRefs[i]->getDecl()->hasAttr<BlocksAttr>() ||
- BlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ BlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
BlockDeclRefs[i]->getType()->isBlockPointerType())
ImportedBlockDecls.insert(BlockDeclRefs[i]->getDecl());
}
@@ -4356,7 +4356,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
Blocks.push_back(Exp);
CollectBlockDeclRefInfo(Exp);
-
+
// Add inner imported variables now used in current block.
int countOfInnerDecls = 0;
if (!InnerBlockDeclRefs.empty()) {
@@ -4382,12 +4382,12 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
// Find any imported blocks...they will need special attention.
for (unsigned i = 0; i < InnerBlockDeclRefs.size(); i++)
if (InnerBlockDeclRefs[i]->getDecl()->hasAttr<BlocksAttr>() ||
- InnerBlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
+ InnerBlockDeclRefs[i]->getType()->isObjCObjectPointerType() ||
InnerBlockDeclRefs[i]->getType()->isBlockPointerType())
ImportedBlockDecls.insert(InnerBlockDeclRefs[i]->getDecl());
}
InnerDeclRefsCount.push_back(countOfInnerDecls);
-
+
std::string FuncName;
if (CurFunctionDef)
@@ -4434,13 +4434,13 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
new (Context) UnaryOperator(new (Context) DeclRefExpr(NewVD, false,
Context->VoidPtrTy,
VK_LValue,
- SourceLocation()),
+ SourceLocation()),
UO_AddrOf,
- Context->getPointerType(Context->VoidPtrTy),
+ Context->getPointerType(Context->VoidPtrTy),
VK_RValue, OK_Ordinary,
SourceLocation(), false);
- InitExprs.push_back(DescRefExpr);
-
+ InitExprs.push_back(DescRefExpr);
+
// Add initializers for any closure decl refs.
if (BlockDeclRefs.size()) {
Expr *Exp;
@@ -4486,14 +4486,14 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
std::string Name(ND->getNameAsString());
std::string RecName;
RewriteByRefString(RecName, Name, ND, true);
- IdentifierInfo *II = &Context->Idents.get(RecName.c_str()
+ IdentifierInfo *II = &Context->Idents.get(RecName.c_str()
+ sizeof("struct"));
RecordDecl *RD = RecordDecl::Create(*Context, TTK_Struct, TUDecl,
SourceLocation(), SourceLocation(),
II);
assert(RD && "SynthBlockInitExpr(): Can't find RecordDecl");
QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
-
+
FD = SynthBlockInitFunctionDecl((*I)->getName());
Exp = new (Context) DeclRefExpr(FD, false, FD->getType(), VK_LValue,
SourceLocation());
@@ -4502,7 +4502,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
for (const auto &CI : block->captures()) {
const VarDecl *variable = CI.getVariable();
if (variable == ND && CI.isNested()) {
- assert (CI.isByRef() &&
+ assert (CI.isByRef() &&
"SynthBlockInitExpr - captured block variable is not byref");
isNestedCapturedVar = true;
break;
@@ -4521,9 +4521,9 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
if (ImportedBlockDecls.size()) {
// generate BLOCK_HAS_COPY_DISPOSE(have helper funcs) | BLOCK_HAS_DESCRIPTOR
int flag = (BLOCK_HAS_COPY_DISPOSE | BLOCK_HAS_DESCRIPTOR);
- unsigned IntSize =
+ unsigned IntSize =
static_cast<unsigned>(Context->getTypeSize(Context->IntTy));
- Expr *FlagExp = IntegerLiteral::Create(*Context, llvm::APInt(IntSize, flag),
+ Expr *FlagExp = IntegerLiteral::Create(*Context, llvm::APInt(IntSize, flag),
Context->IntTy, SourceLocation());
InitExprs.push_back(FlagExp);
}
@@ -4544,7 +4544,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(Bl
}
bool RewriteObjC::IsDeclStmtInForeachHeader(DeclStmt *DS) {
- if (const ObjCForCollectionStmt * CS =
+ if (const ObjCForCollectionStmt * CS =
dyn_cast<ObjCForCollectionStmt>(Stmts.back()))
return CS->getElement() == DS;
return false;
@@ -4614,7 +4614,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOr
RewrittenBlockExprs[BE] = Str;
Stmt *blockTranscribed = SynthBlockInitExpr(BE, InnerBlockDeclRefs);
-
+
//blockTranscribed->dump();
ReplaceStmt(S, blockTranscribed);
return blockTranscribed;
@@ -4685,7 +4685,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOr
// the context of an ObjCForCollectionStmt. For example:
// NSArray *someArray;
// for (id <FooProtocol> index in someArray) ;
- // This is because RewriteObjCForCollectionStmt() does textual rewriting
+ // This is because RewriteObjCForCollectionStmt() does textual rewriting
// and it depends on the original text locations/positions.
if (Stmts.empty() || !IsDeclStmtInForeachHeader(DS))
RewriteObjCQualifiedInterfaceTypes(*DS->decl_begin());
@@ -4705,7 +4705,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOr
BlockByRefDeclNo[ND] = uniqueByrefDeclCount++;
RewriteByRefVar(VD);
}
- else
+ else
RewriteTypeOfDecl(VD);
}
}
@@ -4731,13 +4731,13 @@ Stmt *RewriteObjC::RewriteFunctionBodyOr
}
// Handle blocks rewriting.
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(S)) {
- ValueDecl *VD = DRE->getDecl();
+ ValueDecl *VD = DRE->getDecl();
if (VD->hasAttr<BlocksAttr>())
return RewriteBlockDeclRefExpr(DRE);
if (HasLocalVariableExternalStorage(VD))
return RewriteLocalVariableExternalStorage(DRE);
}
-
+
if (CallExpr *CE = dyn_cast<CallExpr>(S)) {
if (CE->getCallee()->getType()->isBlockPointerType()) {
Stmt *BlockCall = SynthesizeBlockCall(CE, CE->getCallee());
@@ -4894,7 +4894,7 @@ void RewriteObjC::HandleDeclInMainFile(D
case Decl::CXXRecord:
case Decl::Record: {
RecordDecl *RD = cast<RecordDecl>(D);
- if (RD->isCompleteDefinition())
+ if (RD->isCompleteDefinition())
RewriteRecordBody(RD);
break;
}
@@ -4942,7 +4942,7 @@ void RewriteObjC::HandleTranslationUnit(
void RewriteObjCFragileABI::Initialize(ASTContext &context) {
InitializeCommon(context);
-
+
// declaring objc_selector outside the parameter list removes a silly
// scope related warning...
if (IsHeader)
@@ -5079,7 +5079,7 @@ void RewriteObjCFragileABI::RewriteObjCP
ObjCProtocolDecl *PDecl, StringRef prefix,
StringRef ClassName, std::string &Result) {
static bool objc_protocol_methods = false;
-
+
// Output struct protocol_methods holder of method selector and type.
if (!objc_protocol_methods && PDecl->hasDefinition()) {
/* struct protocol_methods {
@@ -5091,16 +5091,16 @@ void RewriteObjCFragileABI::RewriteObjCP
Result += "\tstruct objc_selector *_cmd;\n";
Result += "\tchar *method_types;\n";
Result += "};\n";
-
+
objc_protocol_methods = true;
}
// Do not synthesize the protocol more than once.
if (ObjCSynthesizedProtocols.count(PDecl->getCanonicalDecl()))
return;
-
+
if (ObjCProtocolDecl *Def = PDecl->getDefinition())
PDecl = Def;
-
+
if (PDecl->instmeth_begin() != PDecl->instmeth_end()) {
unsigned NumMethods = std::distance(PDecl->instmeth_begin(),
PDecl->instmeth_end());
@@ -5117,7 +5117,7 @@ void RewriteObjCFragileABI::RewriteObjCP
Result += PDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __cat_inst_meth\")))= "
"{\n\t" + utostr(NumMethods) + "\n";
-
+
// Output instance methods declared in this protocol.
for (ObjCProtocolDecl::instmeth_iterator
I = PDecl->instmeth_begin(), E = PDecl->instmeth_end();
@@ -5134,7 +5134,7 @@ void RewriteObjCFragileABI::RewriteObjCP
}
Result += "\t }\n};\n";
}
-
+
// Output class methods declared in this protocol.
unsigned NumMethods = std::distance(PDecl->classmeth_begin(),
PDecl->classmeth_end());
@@ -5154,7 +5154,7 @@ void RewriteObjCFragileABI::RewriteObjCP
"{\n\t";
Result += utostr(NumMethods);
Result += "\n";
-
+
// Output instance methods declared in this protocol.
for (ObjCProtocolDecl::classmeth_iterator
I = PDecl->classmeth_begin(), E = PDecl->classmeth_end();
@@ -5171,7 +5171,7 @@ void RewriteObjCFragileABI::RewriteObjCP
}
Result += "\t }\n};\n";
}
-
+
// Output:
/* struct _objc_protocol {
// Objective-C 1.0 extensions
@@ -5191,10 +5191,10 @@ void RewriteObjCFragileABI::RewriteObjCP
Result += "\tstruct _objc_protocol_method_list *instance_methods;\n";
Result += "\tstruct _objc_protocol_method_list *class_methods;\n";
Result += "};\n";
-
+
objc_protocol = true;
}
-
+
Result += "\nstatic struct _objc_protocol _OBJC_PROTOCOL_";
Result += PDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __protocol\")))= "
@@ -5216,7 +5216,7 @@ void RewriteObjCFragileABI::RewriteObjCP
else
Result += "0\n";
Result += "};\n";
-
+
// Mark this protocol as having been generated.
if (!ObjCSynthesizedProtocols.insert(PDecl->getCanonicalDecl()).second)
llvm_unreachable("protocol already synthesized");
@@ -5227,10 +5227,10 @@ void RewriteObjCFragileABI::RewriteObjCP
StringRef prefix, StringRef ClassName,
std::string &Result) {
if (Protocols.empty()) return;
-
+
for (unsigned i = 0; i != Protocols.size(); i++)
RewriteObjCProtocolMetaData(Protocols[i], prefix, ClassName, Result);
-
+
// Output the top lovel protocol meta-data for the class.
/* struct _objc_protocol_list {
struct _objc_protocol_list *next;
@@ -5251,11 +5251,11 @@ void RewriteObjCFragileABI::RewriteObjCP
"{\n\t0, ";
Result += utostr(Protocols.size());
Result += "\n";
-
+
Result += "\t,{&_OBJC_PROTOCOL_";
Result += Protocols[0]->getNameAsString();
Result += " \n";
-
+
for (unsigned i = 1; i != Protocols.size(); i++) {
Result += "\t ,&_OBJC_PROTOCOL_";
Result += Protocols[i]->getNameAsString();
@@ -5267,14 +5267,14 @@ void RewriteObjCFragileABI::RewriteObjCP
void RewriteObjCFragileABI::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
std::string &Result) {
ObjCInterfaceDecl *CDecl = IDecl->getClassInterface();
-
+
// Explicitly declared @interface's are already synthesized.
if (CDecl->isImplicitInterfaceDecl()) {
// FIXME: Implementation of a class with no @interface (legacy) does not
// produce correct synthesis as yet.
RewriteObjCInternalStruct(CDecl, Result);
}
-
+
// Build _objc_ivar_list metadata for classes ivars if needed
unsigned NumIvars = !IDecl->ivar_empty()
? IDecl->ivar_size()
@@ -5293,10 +5293,10 @@ void RewriteObjCFragileABI::RewriteObjCC
Result += "\tchar *ivar_type;\n";
Result += "\tint ivar_offset;\n";
Result += "};\n";
-
+
objc_ivar = true;
}
-
+
/* struct {
int ivar_count;
struct _objc_ivar ivar_list[nIvars];
@@ -5312,7 +5312,7 @@ void RewriteObjCFragileABI::RewriteObjCC
"{\n\t";
Result += utostr(NumIvars);
Result += "\n";
-
+
ObjCInterfaceDecl::ivar_iterator IVI, IVE;
SmallVector<ObjCIvarDecl *, 8> IVars;
if (!IDecl->ivar_empty()) {
@@ -5346,13 +5346,13 @@ void RewriteObjCFragileABI::RewriteObjCC
RewriteIvarOffsetComputation(*IVI, Result);
Result += "}\n";
}
-
+
Result += "\t }\n};\n";
}
-
+
// Build _objc_method_list for class's instance methods if needed
SmallVector<ObjCMethodDecl *, 32> InstanceMethods(IDecl->instance_methods());
-
+
// If any of our property implementations have associated getters or
// setters, produce metadata for them as well.
for (const auto *Prop : IDecl->property_impls()) {
@@ -5374,15 +5374,15 @@ void RewriteObjCFragileABI::RewriteObjCC
}
RewriteObjCMethodsMetaData(InstanceMethods.begin(), InstanceMethods.end(),
true, "", IDecl->getName(), Result);
-
+
// Build _objc_method_list for class's class methods if needed
RewriteObjCMethodsMetaData(IDecl->classmeth_begin(), IDecl->classmeth_end(),
false, "", IDecl->getName(), Result);
-
+
// Protocols referenced in class declaration?
RewriteObjCProtocolListMetaData(CDecl->getReferencedProtocols(),
"CLASS", CDecl->getName(), Result);
-
+
// Declaration of class/meta-class metadata
/* struct _objc_class {
struct _objc_class *isa; // or const char *root_class_name when metadata
@@ -5417,7 +5417,7 @@ void RewriteObjCFragileABI::RewriteObjCC
Result += "};\n";
objc_class = true;
}
-
+
// Meta-class metadata generation.
ObjCInterfaceDecl *RootClass = nullptr;
ObjCInterfaceDecl *SuperClass = CDecl->getSuperClass();
@@ -5426,14 +5426,14 @@ void RewriteObjCFragileABI::RewriteObjCC
SuperClass = SuperClass->getSuperClass();
}
SuperClass = CDecl->getSuperClass();
-
+
Result += "\nstatic struct _objc_class _OBJC_METACLASS_";
Result += CDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __meta_class\")))= "
"{\n\t(struct _objc_class *)\"";
Result += (RootClass ? RootClass->getNameAsString() : CDecl->getNameAsString());
Result += "\"";
-
+
if (SuperClass) {
Result += ", \"";
Result += SuperClass->getNameAsString();
@@ -5464,7 +5464,7 @@ void RewriteObjCFragileABI::RewriteObjCC
else
Result += "\t,0,0,0,0\n";
Result += "};\n";
-
+
// class metadata generation.
Result += "\nstatic struct _objc_class _OBJC_CLASS_";
Result += CDecl->getNameAsString();
@@ -5522,15 +5522,15 @@ void RewriteObjCFragileABI::RewriteObjCC
void RewriteObjCFragileABI::RewriteMetaDataIntoBuffer(std::string &Result) {
int ClsDefCount = ClassImplementation.size();
int CatDefCount = CategoryImplementation.size();
-
+
// For each implemented class, write out all its meta data.
for (int i = 0; i < ClsDefCount; i++)
RewriteObjCClassMetaData(ClassImplementation[i], Result);
-
+
// For each implemented category, write out all its meta data.
for (int i = 0; i < CatDefCount; i++)
RewriteObjCCategoryImplDecl(CategoryImplementation[i], Result);
-
+
// Write objc_symtab metadata
/*
struct _objc_symtab
@@ -5542,7 +5542,7 @@ void RewriteObjCFragileABI::RewriteMetaD
void *defs[cls_def_cnt + cat_def_cnt];
};
*/
-
+
Result += "\nstruct _objc_symtab {\n";
Result += "\tlong sel_ref_cnt;\n";
Result += "\tSEL *refs;\n";
@@ -5550,7 +5550,7 @@ void RewriteObjCFragileABI::RewriteMetaD
Result += "\tshort cat_def_cnt;\n";
Result += "\tvoid *defs[" + utostr(ClsDefCount + CatDefCount)+ "];\n";
Result += "};\n\n";
-
+
Result += "static struct _objc_symtab "
"_OBJC_SYMBOLS __attribute__((used, section (\"__OBJC, __symbols\")))= {\n";
Result += "\t0, 0, " + utostr(ClsDefCount)
@@ -5560,7 +5560,7 @@ void RewriteObjCFragileABI::RewriteMetaD
Result += ClassImplementation[i]->getNameAsString();
Result += "\n";
}
-
+
for (int i = 0; i < CatDefCount; i++) {
Result += "\t,&_OBJC_CATEGORY_";
Result += CategoryImplementation[i]->getClassInterface()->getNameAsString();
@@ -5568,11 +5568,11 @@ void RewriteObjCFragileABI::RewriteMetaD
Result += CategoryImplementation[i]->getNameAsString();
Result += "\n";
}
-
+
Result += "};\n\n";
-
+
// Write objc_module metadata
-
+
/*
struct _objc_module {
long version;
@@ -5581,7 +5581,7 @@ void RewriteObjCFragileABI::RewriteMetaD
struct _objc_symtab *symtab;
}
*/
-
+
Result += "\nstruct _objc_module {\n";
Result += "\tlong version;\n";
Result += "\tlong size;\n";
@@ -5593,7 +5593,7 @@ void RewriteObjCFragileABI::RewriteMetaD
Result += "\t" + utostr(OBJC_ABI_VERSION) +
", sizeof(struct _objc_module), \"\", &_OBJC_SYMBOLS\n";
Result += "};\n\n";
-
+
if (LangOpts.MicrosoftExt) {
if (ProtocolExprDecls.size()) {
Result += "#pragma section(\".objc_protocol$B\",long,read,write)\n";
@@ -5623,14 +5623,14 @@ void RewriteObjCFragileABI::RewriteObjCC
// Find category declaration for this implementation.
ObjCCategoryDecl *CDecl
= ClassDecl->FindCategoryDeclaration(IDecl->getIdentifier());
-
+
std::string FullCategoryName = ClassDecl->getNameAsString();
FullCategoryName += '_';
FullCategoryName += IDecl->getNameAsString();
-
+
// Build _objc_method_list for class's instance methods if needed
SmallVector<ObjCMethodDecl *, 32> InstanceMethods(IDecl->instance_methods());
-
+
// If any of our property implementations have associated getters or
// setters, produce metadata for them as well.
for (const auto *Prop : IDecl->property_impls()) {
@@ -5672,7 +5672,7 @@ void RewriteObjCFragileABI::RewriteObjCC
// @property decl.
};
*/
-
+
static bool objc_category = false;
if (!objc_category) {
Result += "\nstruct _objc_category {\n";
@@ -5693,7 +5693,7 @@ void RewriteObjCFragileABI::RewriteObjCC
Result += "\"\n\t, \"";
Result += ClassDecl->getNameAsString();
Result += "\"\n";
-
+
if (IDecl->instmeth_begin() != IDecl->instmeth_end()) {
Result += "\t, (struct _objc_method_list *)"
"&_OBJC_CATEGORY_INSTANCE_METHODS_";
@@ -5710,7 +5710,7 @@ void RewriteObjCFragileABI::RewriteObjCC
}
else
Result += "\t, 0\n";
-
+
if (CDecl && CDecl->protocol_begin() != CDecl->protocol_end()) {
Result += "\t, (struct _objc_protocol_list *)&_OBJC_CATEGORY_PROTOCOLS_";
Result += FullCategoryName;
@@ -5731,7 +5731,7 @@ void RewriteObjCFragileABI::RewriteObjCM
StringRef ClassName,
std::string &Result) {
if (MethodBegin == MethodEnd) return;
-
+
if (!objc_impl_method) {
/* struct _objc_method {
SEL _cmd;
@@ -5744,12 +5744,12 @@ void RewriteObjCFragileABI::RewriteObjCM
Result += "\tchar *method_types;\n";
Result += "\tvoid *_imp;\n";
Result += "};\n";
-
+
objc_impl_method = true;
}
-
+
// Build _objc_method_list for class's methods if needed
-
+
/* struct {
struct _objc_method_list *next_method;
int method_count;
@@ -5771,7 +5771,7 @@ void RewriteObjCFragileABI::RewriteObjCM
Result += IsInstanceMethod ? "inst" : "cls";
Result += "_meth\")))= ";
Result += "{\n\t0, " + utostr(NumMethods) + "\n";
-
+
Result += "\t,{{(SEL)\"";
Result += (*MethodBegin)->getSelector().getAsString();
std::string MethodTypeString =
@@ -5798,16 +5798,16 @@ void RewriteObjCFragileABI::RewriteObjCM
Stmt *RewriteObjCFragileABI::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
SourceRange OldRange = IV->getSourceRange();
Expr *BaseExpr = IV->getBase();
-
+
// Rewrite the base, but without actually doing replaces.
{
DisableReplaceStmtScope S(*this);
BaseExpr = cast<Expr>(RewriteFunctionBodyOrGlobalInitializer(BaseExpr));
IV->setBase(BaseExpr);
}
-
+
ObjCIvarDecl *D = IV->getDecl();
-
+
Expr *Replacement = IV;
if (CurMethodDef) {
if (BaseExpr->getType()->isObjCObjectPointerType()) {
@@ -5819,7 +5819,7 @@ Stmt *RewriteObjCFragileABI::RewriteObjC
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
clsDeclared);
assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class");
-
+
// Synthesize an explicit cast to gain access to the ivar.
std::string RecName = clsDeclared->getIdentifier()->getName();
RecName += "_IMPL";
@@ -5848,7 +5848,7 @@ Stmt *RewriteObjCFragileABI::RewriteObjC
}
} else { // we are outside a method.
assert(!IV->isFreeIvar() && "Cannot have a free standing ivar outside a method");
-
+
// Explicit ivar refs need to have a cast inserted.
// FIXME: consider sharing some of this code with the code above.
if (BaseExpr->getType()->isObjCObjectPointerType()) {
@@ -5859,7 +5859,7 @@ Stmt *RewriteObjCFragileABI::RewriteObjC
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
clsDeclared);
assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class");
-
+
// Synthesize an explicit cast to gain access to the ivar.
std::string RecName = clsDeclared->getIdentifier()->getName();
RecName += "_IMPL";
@@ -5881,9 +5881,9 @@ Stmt *RewriteObjCFragileABI::RewriteObjC
IV->setBase(PE);
}
}
-
+
ReplaceStmtWithRange(IV, Replacement, OldRange);
- return Replacement;
+ return Replacement;
}
#endif // CLANG_ENABLE_OBJC_REWRITER
Modified: cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp Mon Jul 30 12:24:48 2018
@@ -28,31 +28,31 @@ using namespace clang;
using namespace clang::serialized_diags;
namespace {
-
+
class AbbreviationMap {
llvm::DenseMap<unsigned, unsigned> Abbrevs;
public:
AbbreviationMap() {}
-
+
void set(unsigned recordID, unsigned abbrevID) {
- assert(Abbrevs.find(recordID) == Abbrevs.end()
+ assert(Abbrevs.find(recordID) == Abbrevs.end()
&& "Abbreviation already set.");
Abbrevs[recordID] = abbrevID;
}
-
+
unsigned get(unsigned recordID) {
assert(Abbrevs.find(recordID) != Abbrevs.end() &&
"Abbreviation not set.");
return Abbrevs[recordID];
}
};
-
+
typedef SmallVector<uint64_t, 64> RecordData;
typedef SmallVectorImpl<uint64_t> RecordDataImpl;
typedef ArrayRef<uint64_t> RecordDataRef;
class SDiagsWriter;
-
+
class SDiagsRenderer : public DiagnosticNoteRenderer {
SDiagsWriter &Writer;
public:
@@ -172,7 +172,7 @@ private:
/// Emit the preamble for the serialized diagnostics.
void EmitPreamble();
-
+
/// Emit the BLOCKINFO block.
void EmitBlockInfoBlock();
@@ -197,10 +197,10 @@ private:
/// Emit a record for a CharSourceRange.
void EmitCharSourceRange(CharSourceRange R, const SourceManager &SM);
-
+
/// Emit the string information for the category.
unsigned getEmitCategory(unsigned category = 0);
-
+
/// Emit the string information for diagnostic flags.
unsigned getEmitDiagnosticFlag(DiagnosticsEngine::Level DiagLevel,
unsigned DiagID = 0);
@@ -312,7 +312,7 @@ static void EmitBlockID(unsigned ID, con
Record.clear();
Record.push_back(ID);
Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID, Record);
-
+
// Emit the block name if present.
if (!Name || Name[0] == 0)
return;
@@ -370,11 +370,11 @@ void SDiagsWriter::AddCharSourceRangeToR
unsigned SDiagsWriter::getEmitFile(const char *FileName){
if (!FileName)
return 0;
-
+
unsigned &entry = State->Files[FileName];
if (entry)
return entry;
-
+
// Lazily generate the record for the file.
entry = State->Files.size();
StringRef Name(FileName);
@@ -417,7 +417,7 @@ static void AddSourceLocationAbbrev(llvm
static void AddRangeLocationAbbrev(llvm::BitCodeAbbrev &Abbrev) {
AddSourceLocationAbbrev(Abbrev);
- AddSourceLocationAbbrev(Abbrev);
+ AddSourceLocationAbbrev(Abbrev);
}
void SDiagsWriter::EmitBlockInfoBlock() {
@@ -456,12 +456,12 @@ void SDiagsWriter::EmitBlockInfoBlock()
Abbrev->Add(BitCodeAbbrevOp(RECORD_DIAG));
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Diag level.
AddSourceLocationAbbrev(*Abbrev);
- Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Category.
+ Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Category.
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped Diag ID.
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16)); // Text size.
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Diagnostc text.
Abbrevs.set(RECORD_DIAG, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
-
+
// Emit abbreviation for RECORD_CATEGORY.
Abbrev = std::make_shared<BitCodeAbbrev>();
Abbrev->Add(BitCodeAbbrevOp(RECORD_CATEGORY));
@@ -476,7 +476,7 @@ void SDiagsWriter::EmitBlockInfoBlock()
AddRangeLocationAbbrev(*Abbrev);
Abbrevs.set(RECORD_SOURCE_RANGE,
Stream.EmitBlockInfoAbbrev(BLOCK_DIAG, Abbrev));
-
+
// Emit the abbreviation for RECORD_DIAG_FLAG.
Abbrev = std::make_shared<BitCodeAbbrev>();
Abbrev->Add(BitCodeAbbrevOp(RECORD_DIAG_FLAG));
@@ -485,18 +485,18 @@ void SDiagsWriter::EmitBlockInfoBlock()
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Flag name text.
Abbrevs.set(RECORD_DIAG_FLAG, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG,
Abbrev));
-
+
// Emit the abbreviation for RECORD_FILENAME.
Abbrev = std::make_shared<BitCodeAbbrev>();
Abbrev->Add(BitCodeAbbrevOp(RECORD_FILENAME));
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10)); // Mapped file ID.
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Size.
- Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Modification time.
+ Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // Modification time.
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 16)); // Text size.
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // File name text.
Abbrevs.set(RECORD_FILENAME, Stream.EmitBlockInfoAbbrev(BLOCK_DIAG,
Abbrev));
-
+
// Emit the abbreviation for RECORD_FIXIT.
Abbrev = std::make_shared<BitCodeAbbrev>();
Abbrev->Add(BitCodeAbbrevOp(RECORD_FIXIT));
@@ -529,7 +529,7 @@ unsigned SDiagsWriter::getEmitCategory(u
RecordData::value_type Record[] = {RECORD_CATEGORY, category, catName.size()};
State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_CATEGORY), Record,
catName);
-
+
return category;
}
@@ -537,7 +537,7 @@ unsigned SDiagsWriter::getEmitDiagnostic
unsigned DiagID) {
if (DiagLevel == DiagnosticsEngine::Note)
return 0; // No flag for notes.
-
+
StringRef FlagName = DiagnosticIDs::getWarningOptionForDiag(DiagID);
return getEmitDiagnosticFlag(FlagName);
}
@@ -553,7 +553,7 @@ unsigned SDiagsWriter::getEmitDiagnostic
if (entry.first == 0) {
entry.first = State->DiagFlags.size();
entry.second = FlagName;
-
+
// Lazily emit the string in a separate record.
RecordData::value_type Record[] = {RECORD_DIAG_FLAG, entry.first,
FlagName.size()};
@@ -630,7 +630,7 @@ void SDiagsWriter::EmitDiagnosticMessage
llvm::BitstreamWriter &Stream = State->Stream;
RecordData &Record = State->Record;
AbbreviationMap &Abbrevs = State->Abbrevs;
-
+
// Emit the RECORD_DIAG record.
Record.clear();
Record.push_back(RECORD_DIAG);
Modified: cfe/trunk/lib/Frontend/TestModuleFileExtension.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TestModuleFileExtension.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TestModuleFileExtension.cpp (original)
+++ cfe/trunk/lib/Frontend/TestModuleFileExtension.cpp Mon Jul 30 12:24:48 2018
@@ -91,7 +91,7 @@ llvm::hash_code TestModuleFileExtension:
Code = llvm::hash_combine(Code, MinorVersion);
Code = llvm::hash_combine(Code, UserInfo);
}
-
+
return Code;
}
Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Mon Jul 30 12:24:48 2018
@@ -100,7 +100,7 @@ printableTextForNextCharacter(StringRef
unsigned TabStop) {
assert(i && "i must not be null");
assert(*i<SourceLine.size() && "must point to a valid index");
-
+
if (SourceLine[*i]=='\t') {
assert(0 < TabStop && TabStop <= DiagnosticOptions::MaxTabStop &&
"Invalid -ftabstop value");
@@ -118,7 +118,7 @@ printableTextForNextCharacter(StringRef
unsigned char const *begin, *end;
begin = reinterpret_cast<unsigned char const *>(&*(SourceLine.begin() + *i));
end = begin + (SourceLine.size() - *i);
-
+
if (llvm::isLegalUTF8Sequence(begin, end)) {
llvm::UTF32 c;
llvm::UTF32 *cptr = &c;
@@ -203,7 +203,7 @@ static void byteToColumn(StringRef Sourc
out.resize(1u,0);
return;
}
-
+
out.resize(SourceLine.size()+1, -1);
int columns = 0;
@@ -255,10 +255,10 @@ namespace {
struct SourceColumnMap {
SourceColumnMap(StringRef SourceLine, unsigned TabStop)
: m_SourceLine(SourceLine) {
-
+
::byteToColumn(SourceLine, TabStop, m_byteToColumn);
::columnToByte(SourceLine, TabStop, m_columnToByte);
-
+
assert(m_byteToColumn.size()==SourceLine.size()+1);
assert(0 < m_byteToColumn.size() && 0 < m_columnToByte.size());
assert(m_byteToColumn.size()
@@ -309,7 +309,7 @@ struct SourceColumnMap {
StringRef getSourceLine() const {
return m_SourceLine;
}
-
+
private:
const std::string m_SourceLine;
SmallVector<int,200> m_byteToColumn;
@@ -684,7 +684,7 @@ void TextDiagnostic::emitDiagnosticMessa
if (DiagOpts->ShowColors)
OS.resetColor();
-
+
printDiagnosticLevel(OS, Level, DiagOpts->ShowColors,
DiagOpts->CLFallbackMode);
printDiagnosticMessage(OS,
@@ -891,7 +891,7 @@ void TextDiagnostic::emitIncludeLocation
OS << "In file included from " << PLoc.getFilename() << ':'
<< PLoc.getLine() << ":\n";
else
- OS << "In included file:\n";
+ OS << "In included file:\n";
}
void TextDiagnostic::emitImportLocation(FullSourceLoc Loc, PresumedLoc PLoc,
@@ -1269,15 +1269,15 @@ void TextDiagnostic::emitSnippet(StringR
return;
size_t i = 0;
-
+
std::string to_print;
bool print_reversed = false;
-
+
while (i<line.size()) {
std::pair<SmallString<16>,bool> res
= printableTextForNextCharacter(line, &i, DiagOpts->TabStop);
bool was_printable = res.second;
-
+
if (DiagOpts->ShowColors && was_printable == print_reversed) {
if (print_reversed)
OS.reverseColor();
@@ -1286,17 +1286,17 @@ void TextDiagnostic::emitSnippet(StringR
if (DiagOpts->ShowColors)
OS.resetColor();
}
-
+
print_reversed = !was_printable;
to_print += res.first.str();
}
-
+
if (print_reversed && DiagOpts->ShowColors)
OS.reverseColor();
OS << to_print;
if (print_reversed && DiagOpts->ShowColors)
OS.resetColor();
-
+
OS << '\n';
}
Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)
+++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Mon Jul 30 12:24:48 2018
@@ -139,7 +139,7 @@ CreateFrontendAction(CompilerInstance &C
if (FEOpts.FixAndRecompile) {
Act = llvm::make_unique<FixItRecompile>(std::move(Act));
}
-
+
#if CLANG_ENABLE_ARCMT
if (CI.getFrontendOpts().ProgramAction != frontend::MigrateSource &&
CI.getFrontendOpts().ProgramAction != frontend::GeneratePCH) {
@@ -260,4 +260,4 @@ bool ExecuteCompilerInvocation(CompilerI
return Success;
}
-} // namespace clang
+} // namespace clang
Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Mon Jul 30 12:24:48 2018
@@ -319,9 +319,9 @@ _mm512_set1_epi32(int __s)
}
static __inline __m512i __DEFAULT_FN_ATTRS512
-_mm512_maskz_set1_epi32(__mmask16 __M, int __A)
+_mm512_maskz_set1_epi32(__mmask16 __M, int __A)
{
- return (__m512i)__builtin_ia32_selectd_512(__M,
+ return (__m512i)__builtin_ia32_selectd_512(__M,
(__v16si)_mm512_set1_epi32(__A),
(__v16si)_mm512_setzero_si512());
}
Modified: cfe/trunk/lib/Headers/avx512vlcdintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlcdintrin.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512vlcdintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlcdintrin.h Mon Jul 30 12:24:48 2018
@@ -34,7 +34,7 @@
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_broadcastmb_epi64 (__mmask8 __A)
-{
+{
return (__m128i) _mm_set1_epi64x((long long) __A);
}
Modified: cfe/trunk/lib/Headers/clzerointrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/clzerointrin.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/clzerointrin.h (original)
+++ cfe/trunk/lib/Headers/clzerointrin.h Mon Jul 30 12:24:48 2018
@@ -45,6 +45,6 @@ _mm_clzero (void * __line)
__builtin_ia32_clzero ((void *)__line);
}
-#undef __DEFAULT_FN_ATTRS
+#undef __DEFAULT_FN_ATTRS
#endif /* __CLZEROINTRIN_H */
Modified: cfe/trunk/lib/Headers/lwpintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/lwpintrin.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/lwpintrin.h (original)
+++ cfe/trunk/lib/Headers/lwpintrin.h Mon Jul 30 12:24:48 2018
@@ -84,7 +84,7 @@ __slwpcb (void)
(__builtin_ia32_lwpins32((unsigned int) (DATA2), (unsigned int) (DATA1), \
(unsigned int) (FLAGS)))
-/// Decrements the LWP programmed value sample event counter. If the result is
+/// Decrements the LWP programmed value sample event counter. If the result is
/// negative, inserts an event record into the LWP event ring buffer in memory
/// and advances the ring buffer pointer.
///
@@ -125,7 +125,7 @@ __slwpcb (void)
(__builtin_ia32_lwpins64((unsigned long long) (DATA2), (unsigned int) (DATA1), \
(unsigned int) (FLAGS)))
-/// Decrements the LWP programmed value sample event counter. If the result is
+/// Decrements the LWP programmed value sample event counter. If the result is
/// negative, inserts an event record into the LWP event ring buffer in memory
/// and advances the ring buffer pointer.
///
Modified: cfe/trunk/lib/Headers/opencl-c.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/opencl-c.h?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/opencl-c.h (original)
+++ cfe/trunk/lib/Headers/opencl-c.h Mon Jul 30 12:24:48 2018
@@ -11540,7 +11540,7 @@ half16 __ovld __cnfn select(half16 a, ha
*
* vstoren write sizeof (gentypen) bytes given by data to address (p + (offset * n)).
*
- * The address computed as (p + (offset * n)) must be
+ * The address computed as (p + (offset * n)) must be
* 8-bit aligned if gentype is char, uchar;
* 16-bit aligned if gentype is short, ushort, half;
* 32-bit aligned if gentype is int, uint, float;
@@ -12888,7 +12888,7 @@ void __ovld write_mem_fence(cl_mem_fence
cl_mem_fence_flags __ovld get_fence(const void *ptr);
cl_mem_fence_flags __ovld get_fence(void *ptr);
-/**
+/**
* Builtin functions to_global, to_local, and to_private need to be declared as Clang builtin functions
* and checked in Sema since they should be declared as
* addr gentype* to_addr (gentype*);
@@ -13773,7 +13773,7 @@ ulong __ovld atomic_fetch_max_explicit(v
// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument can be ptrdiff_t.
// or/xor/and/min/max: atomic type argument can be intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand);
uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
@@ -14571,7 +14571,7 @@ int printf(__constant const char* st, ..
* only. The filter_mode specified in sampler
* must be set to CLK_FILTER_NEAREST; otherwise
* the values returned are undefined.
-
+
* The read_image{f|i|ui} calls that take
* integer coordinates must use a sampler with
* normalized coordinates set to
Modified: cfe/trunk/lib/Index/IndexBody.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexBody.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexBody.cpp (original)
+++ cfe/trunk/lib/Index/IndexBody.cpp Mon Jul 30 12:24:48 2018
@@ -30,7 +30,7 @@ public:
BodyIndexer(IndexingContext &indexCtx,
const NamedDecl *Parent, const DeclContext *DC)
: IndexCtx(indexCtx), Parent(Parent), ParentDC(DC) { }
-
+
bool shouldWalkTypesOfTypeLocs() const { return false; }
bool dataTraverseStmtPre(Stmt *S) {
@@ -322,7 +322,7 @@ public:
}
return true;
}
-
+
bool VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) {
if (ObjCMethodDecl *MD = E->getDictWithObjectsMethod()) {
return passObjCLiteralMethodCall(MD, E);
Modified: cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp (original)
+++ cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp Mon Jul 30 12:24:48 2018
@@ -37,7 +37,7 @@ public:
Relations.emplace_back((unsigned)SymbolRole::RelationIBTypeOf, Parent);
}
}
-
+
bool shouldWalkTypesOfTypeLocs() const { return false; }
#define TRY_TO(CALL_EXPR) \
@@ -193,7 +193,7 @@ void IndexingContext::indexTypeSourceInf
bool isIBType) {
if (!TInfo || TInfo->getTypeLoc().isNull())
return;
-
+
indexTypeLoc(TInfo->getTypeLoc(), Parent, DC, isBase, isIBType);
}
Modified: cfe/trunk/lib/Index/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingContext.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexingContext.cpp (original)
+++ cfe/trunk/lib/Index/IndexingContext.cpp Mon Jul 30 12:24:48 2018
@@ -75,7 +75,7 @@ bool IndexingContext::handleReference(co
if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D))
return true;
-
+
return handleDeclOccurrence(D, Loc, /*IsRef=*/true, Parent, Roles, Relations,
RefE, RefD, DC);
}
Modified: cfe/trunk/lib/Index/USRGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Index/USRGeneration.cpp (original)
+++ cfe/trunk/lib/Index/USRGeneration.cpp Mon Jul 30 12:24:48 2018
@@ -62,9 +62,9 @@ class USRGenerator : public ConstDeclVis
bool IgnoreResults;
ASTContext *Context;
bool generatedLoc;
-
+
llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
-
+
public:
explicit USRGenerator(ASTContext *Ctx, SmallVectorImpl<char> &Buf)
: Buf(Buf),
@@ -159,7 +159,7 @@ public:
void VisitTemplateParameterList(const TemplateParameterList *Params);
void VisitTemplateName(TemplateName Name);
void VisitTemplateArgument(const TemplateArgument &Arg);
-
+
/// Emit a Decl's name using NamedDecl::printName() and return true if
/// the decl had no name.
bool EmitDeclName(const NamedDecl *D);
@@ -366,7 +366,7 @@ void USRGenerator::VisitClassTemplateDec
void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
VisitDeclContext(D->getDeclContext());
if (!IgnoreResults)
- Out << "@NA@" << D->getName();
+ Out << "@NA@" << D->getName();
}
void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
@@ -493,7 +493,7 @@ void USRGenerator::VisitTagDecl(const Ta
if (const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
if (ClassTemplateDecl *ClassTmpl = CXXRecord->getDescribedClassTemplate()) {
AlreadyStarted = true;
-
+
switch (D->getTagKind()) {
case TTK_Interface:
case TTK_Class:
@@ -505,18 +505,18 @@ void USRGenerator::VisitTagDecl(const Ta
} else if (const ClassTemplatePartialSpecializationDecl *PartialSpec
= dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
AlreadyStarted = true;
-
+
switch (D->getTagKind()) {
case TTK_Interface:
case TTK_Class:
case TTK_Struct: Out << "@SP"; break;
case TTK_Union: Out << "@UP"; break;
case TTK_Enum: llvm_unreachable("enum partial specialization");
- }
+ }
VisitTemplateParameterList(PartialSpec->getTemplateParameters());
}
}
-
+
if (!AlreadyStarted) {
switch (D->getTagKind()) {
case TTK_Interface:
@@ -526,7 +526,7 @@ void USRGenerator::VisitTagDecl(const Ta
case TTK_Enum: Out << "@E"; break;
}
}
-
+
Out << '@';
assert(Buf.size() > 0);
const unsigned off = Buf.size() - 1;
@@ -551,7 +551,7 @@ void USRGenerator::VisitTagDecl(const Ta
}
}
}
-
+
// For a class template specialization, mangle the template arguments.
if (const ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(D)) {
@@ -640,7 +640,7 @@ void USRGenerator::VisitType(QualType T)
Out << 'P';
T = Expansion->getPattern();
}
-
+
if (const BuiltinType *BT = T->getAs<BuiltinType>()) {
unsigned char c = '\0';
switch (BT->getKind()) {
@@ -758,7 +758,7 @@ void USRGenerator::VisitType(QualType T)
unsigned Number = TypeSubstitutions.size();
TypeSubstitutions[T.getTypePtr()] = Number;
}
-
+
if (const PointerType *PT = T->getAs<PointerType>()) {
Out << '*';
T = PT->getPointeeType();
@@ -889,7 +889,7 @@ void USRGenerator::VisitTemplateParamete
Out << 'T';
continue;
}
-
+
if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) {
if (NTTP->isParameterPack())
Out << 'p';
@@ -897,7 +897,7 @@ void USRGenerator::VisitTemplateParamete
VisitType(NTTP->getType());
continue;
}
-
+
TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P);
if (TTP->isParameterPack())
Out << 'p';
@@ -913,11 +913,11 @@ void USRGenerator::VisitTemplateName(Tem
Out << 't' << TTP->getDepth() << '.' << TTP->getIndex();
return;
}
-
+
Visit(Template);
return;
}
-
+
// FIXME: Visit dependent template names.
}
@@ -939,21 +939,21 @@ void USRGenerator::VisitTemplateArgument
case TemplateArgument::Template:
VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
break;
-
+
case TemplateArgument::Expression:
// FIXME: Visit expressions.
break;
-
+
case TemplateArgument::Pack:
Out << 'p' << Arg.pack_size();
for (const auto &P : Arg.pack_elements())
VisitTemplateArgument(P);
break;
-
+
case TemplateArgument::Type:
VisitType(Arg.getAsType());
break;
-
+
case TemplateArgument::Integral:
Out << 'V';
VisitType(Arg.getIntegralType());
Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Jul 30 12:24:48 2018
@@ -246,9 +246,9 @@ Module *HeaderSearch::lookupModule(Strin
break;
}
}
-
+
// FIXME: Figure out how header maps and module maps will work together.
-
+
// Only deal with normal search directories.
if (!SearchDirs[Idx].isNormalDir())
continue;
@@ -263,7 +263,7 @@ Module *HeaderSearch::lookupModule(Strin
if (Module)
break;
}
-
+
// Search for a module map in a subdirectory with the same name as the
// module.
SmallString<128> NestedModuleMapDirName;
@@ -530,7 +530,7 @@ const FileEntry *DirectoryLookup::DoFram
RelativePath->clear();
RelativePath->append(Filename.begin()+SlashPos+1, Filename.end());
}
-
+
// Check "/System/Library/Frameworks/Cocoa.framework/Headers/file.h"
unsigned OrigSize = FrameworkName.size();
@@ -709,7 +709,7 @@ const FileEntry *HeaderSearch::LookupFil
if (SuggestedModule)
*SuggestedModule = ModuleMap::KnownHeader();
-
+
// If 'Filename' is absolute, check to see if it exists and no searching.
if (llvm::sys::path::is_absolute(Filename)) {
CurDir = nullptr;
@@ -898,7 +898,7 @@ const FileEntry *HeaderSearch::LookupFil
size_t SlashPos = Filename.find('/');
if (SlashPos != StringRef::npos) {
HFI.IndexHeaderMapHeader = 1;
- HFI.Framework = getUniqueFrameworkName(StringRef(Filename.begin(),
+ HFI.Framework = getUniqueFrameworkName(StringRef(Filename.begin(),
SlashPos));
}
}
@@ -1079,7 +1079,7 @@ LookupSubframeworkHeader(StringRef Filen
/// Merge the header file info provided by \p OtherHFI into the current
/// header file info (\p HFI)
-static void mergeHeaderFileInfo(HeaderFileInfo &HFI,
+static void mergeHeaderFileInfo(HeaderFileInfo &HFI,
const HeaderFileInfo &OtherHFI) {
assert(OtherHFI.External && "expected to merge external HFI");
@@ -1101,7 +1101,7 @@ static void mergeHeaderFileInfo(HeaderFi
if (HFI.Framework.empty())
HFI.Framework = OtherHFI.Framework;
}
-
+
/// getFileInfo - Return the HeaderFileInfo structure for the specified
/// FileEntry.
HeaderFileInfo &HeaderSearch::getFileInfo(const FileEntry *FE) {
@@ -1285,14 +1285,14 @@ StringRef HeaderSearch::getUniqueFramewo
return FrameworkNames.insert(Framework).first->first();
}
-bool HeaderSearch::hasModuleMap(StringRef FileName,
+bool HeaderSearch::hasModuleMap(StringRef FileName,
const DirectoryEntry *Root,
bool IsSystem) {
if (!HSOpts->ImplicitModuleMaps)
return false;
SmallVector<const DirectoryEntry *, 2> FixUpDirectories;
-
+
StringRef DirName = FileName;
do {
// Get the parent directory name.
@@ -1325,7 +1325,7 @@ bool HeaderSearch::hasModuleMap(StringRe
// If we hit the top of our search, we're done.
if (Dir == Root)
return false;
-
+
// Keep track of all of the directories we checked, so we can mark them as
// having module maps if we eventually do find a module map.
FixUpDirectories.push_back(Dir);
@@ -1385,7 +1385,7 @@ bool HeaderSearch::findUsableModuleForFr
SmallVector<std::string, 4> SubmodulePath;
const DirectoryEntry *TopFrameworkDir
= ::getTopFrameworkDir(FileMgr, FrameworkName, SubmodulePath);
-
+
// Determine the name of the top-level framework.
StringRef ModuleName = llvm::sys::path::stem(TopFrameworkDir->getName());
@@ -1532,16 +1532,16 @@ Module *HeaderSearch::loadFrameworkModul
return ModMap.findModule(Name);
}
-HeaderSearch::LoadModuleMapResult
+HeaderSearch::LoadModuleMapResult
HeaderSearch::loadModuleMapFile(StringRef DirName, bool IsSystem,
bool IsFramework) {
if (const DirectoryEntry *Dir = FileMgr.getDirectory(DirName))
return loadModuleMapFile(Dir, IsSystem, IsFramework);
-
+
return LMM_NoDirectory;
}
-HeaderSearch::LoadModuleMapResult
+HeaderSearch::LoadModuleMapResult
HeaderSearch::loadModuleMapFile(const DirectoryEntry *Dir, bool IsSystem,
bool IsFramework) {
auto KnownDir = DirectoryHasModuleMap.find(Dir);
@@ -1610,7 +1610,7 @@ void HeaderSearch::collectAllModules(Sma
}
// Populate the list of modules.
- for (ModuleMap::module_iterator M = ModMap.module_begin(),
+ for (ModuleMap::module_iterator M = ModMap.module_begin(),
MEnd = ModMap.module_end();
M != MEnd; ++M) {
Modules.push_back(M->getValue());
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Mon Jul 30 12:24:48 2018
@@ -30,7 +30,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
-#include <cstdint>
+#include <cstdint>
#include <cstring>
#include <string>
@@ -274,7 +274,7 @@ void clang::expandUCNs(SmallVectorImpl<c
static bool ProcessUCNEscape(const char *ThisTokBegin, const char *&ThisTokBuf,
const char *ThisTokEnd,
uint32_t &UcnVal, unsigned short &UcnLen,
- FullSourceLoc Loc, DiagnosticsEngine *Diags,
+ FullSourceLoc Loc, DiagnosticsEngine *Diags,
const LangOptions &Features,
bool in_char_string_literal = false) {
const char *UcnBegin = ThisTokBuf;
@@ -1539,7 +1539,7 @@ void StringLiteralParser::init(ArrayRef<
// that ThisTokBuf points to a buffer that is big enough for the whole token
// and 'spelled' tokens can only shrink.
bool StringInvalid = false;
- unsigned ThisTokLen =
+ unsigned ThisTokLen =
Lexer::getSpelling(StringToks[i], ThisTokBuf, SM, Features,
&StringInvalid);
if (StringInvalid)
Modified: cfe/trunk/lib/Lex/MacroArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/MacroArgs.cpp (original)
+++ cfe/trunk/lib/Lex/MacroArgs.cpp Mon Jul 30 12:24:48 2018
@@ -29,7 +29,7 @@ MacroArgs *MacroArgs::create(const Macro
"Can't have args for an object-like macro!");
MacroArgs **ResultEnt = nullptr;
unsigned ClosestMatch = ~0U;
-
+
// See if we have an entry with a big enough argument list to reuse on the
// free list. If so, reuse it.
for (MacroArgs **Entry = &PP.MacroArgCache; *Entry;
@@ -37,7 +37,7 @@ MacroArgs *MacroArgs::create(const Macro
if ((*Entry)->NumUnexpArgTokens >= UnexpArgTokens.size() &&
(*Entry)->NumUnexpArgTokens < ClosestMatch) {
ResultEnt = Entry;
-
+
// If we have an exact match, use it.
if ((*Entry)->NumUnexpArgTokens == UnexpArgTokens.size())
break;
@@ -83,7 +83,7 @@ void MacroArgs::destroy(Preprocessor &PP
// would deallocate the element vectors.
for (unsigned i = 0, e = PreExpArgTokens.size(); i != e; ++i)
PreExpArgTokens[i].clear();
-
+
// Add this to the preprocessor's free list.
ArgCache = PP.MacroArgCache;
PP.MacroArgCache = this;
@@ -93,14 +93,14 @@ void MacroArgs::destroy(Preprocessor &PP
/// its freelist.
MacroArgs *MacroArgs::deallocate() {
MacroArgs *Next = ArgCache;
-
+
// Run the dtor to deallocate the vectors.
this->~MacroArgs();
// Release the memory for the object.
static_assert(std::is_trivially_destructible<Token>::value,
"assume trivially destructible and forego destructors");
free(this);
-
+
return Next;
}
@@ -125,7 +125,7 @@ const Token *MacroArgs::getUnexpArgument
// in memory.
const Token *Start = getTrailingObjects<Token>();
const Token *Result = Start;
-
+
// Scan to find Arg.
for (; Arg; ++Result) {
assert(Result < Start+NumUnexpArgTokens && "Invalid arg #");
@@ -171,7 +171,7 @@ const std::vector<Token> &MacroArgs::get
// If we have already computed this, return it.
if (PreExpArgTokens.size() < getNumMacroArguments())
PreExpArgTokens.resize(getNumMacroArguments());
-
+
std::vector<Token> &Result = PreExpArgTokens[Arg];
if (!Result.empty()) return Result;
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Mon Jul 30 12:24:48 2018
@@ -103,8 +103,8 @@ ModuleMap::headerKindToRole(Module::Head
llvm_unreachable("unknown header kind");
}
-Module::ExportDecl
-ModuleMap::resolveExport(Module *Mod,
+Module::ExportDecl
+ModuleMap::resolveExport(Module *Mod,
const Module::UnresolvedExportDecl &Unresolved,
bool Complain) const {
// We may have just a wildcard.
@@ -112,7 +112,7 @@ ModuleMap::resolveExport(Module *Mod,
assert(Unresolved.Wildcard && "Invalid unresolved export");
return Module::ExportDecl(nullptr, true);
}
-
+
// Resolve the module-id.
Module *Context = resolveModuleId(Unresolved.Id, Mod, Complain);
if (!Context)
@@ -151,7 +151,7 @@ Module *ModuleMap::resolveModuleId(const
return Context;
}
-/// Append to \p Paths the set of paths needed to get to the
+/// Append to \p Paths the set of paths needed to get to the
/// subframework in which the given module lives.
static void appendSubframeworkPaths(Module *Mod,
SmallVectorImpl<char> &Path) {
@@ -161,10 +161,10 @@ static void appendSubframeworkPaths(Modu
if (Mod->IsFramework)
Paths.push_back(Mod->Name);
}
-
+
if (Paths.empty())
return;
-
+
// Add Frameworks/Name.framework for each subframework.
for (unsigned I = Paths.size() - 1; I != 0; --I)
llvm::sys::path::append(Path, "Frameworks", Paths[I-1] + ".framework");
@@ -325,7 +325,7 @@ ModuleMap::~ModuleMap() {
}
void ModuleMap::setTarget(const TargetInfo &Target) {
- assert((!this->Target || this->Target == &Target) &&
+ assert((!this->Target || this->Target == &Target) &&
"Improper target override");
this->Target = &Target;
}
@@ -528,7 +528,7 @@ void ModuleMap::diagnoseHeaderInclusion(
<< RequestingModule->getTopLevelModule()->Name << Filename;
} else if (RequestingModule && RequestingModuleIsModuleInterface &&
LangOpts.isCompilingModule()) {
- // Do not diagnose when we are not compiling a module.
+ // Do not diagnose when we are not compiling a module.
diag::kind DiagID = RequestingModule->getTopLevelModule()->IsFramework ?
diag::warn_non_modular_include_in_framework_module :
diag::warn_non_modular_include_in_module;
@@ -732,7 +732,7 @@ ModuleMap::isHeaderUnavailableInModule(c
if (IsUnavailable(Found))
return true;
}
-
+
// Infer a submodule with the same name as this header file.
SmallString<32> NameBuf;
StringRef Name = sanitizeFilenameAsIdentifier(
@@ -745,18 +745,18 @@ ModuleMap::isHeaderUnavailableInModule(c
return IsUnavailable(Found);
}
-
+
SkippedDirs.push_back(Dir);
-
+
// Retrieve our parent path.
DirName = llvm::sys::path::parent_path(DirName);
if (DirName.empty())
break;
-
+
// Resolve the parent path to a directory entry.
Dir = SourceMgr.getFileManager().getDirectory(DirName);
} while (Dir);
-
+
return false;
}
@@ -774,14 +774,14 @@ Module *ModuleMap::lookupModuleUnqualifi
if (Module *Sub = lookupModuleQualified(Name, Context))
return Sub;
}
-
+
return findModule(Name);
}
Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{
if (!Context)
return findModule(Name);
-
+
return Context->findSubmodule(Name);
}
@@ -892,7 +892,7 @@ Module *ModuleMap::inferFrameworkModule(
// Check whether we've already found this module.
if (Module *Mod = lookupModuleQualified(ModuleName, Parent))
return Mod;
-
+
FileManager &FileMgr = SourceMgr.getFileManager();
// If the framework has a parent path from which we're allowed to infer
@@ -953,7 +953,7 @@ Module *ModuleMap::inferFrameworkModule(
SmallString<128> UmbrellaName = StringRef(FrameworkDir->getName());
llvm::sys::path::append(UmbrellaName, "Headers", ModuleName + ".h");
const FileEntry *UmbrellaHeader = FileMgr.getFile(UmbrellaName);
-
+
// FIXME: If there's no umbrella header, we could probably scan the
// framework to load *everything*. But, it's not clear that this is a good
// idea.
@@ -983,14 +983,14 @@ Module *ModuleMap::inferFrameworkModule(
// The "Headers/" component of the name is implied because this is
// a framework module.
setUmbrellaHeader(Result, UmbrellaHeader, ModuleName + ".h");
-
+
// export *
Result->Exports.push_back(Module::ExportDecl(nullptr, true));
// module * { export * }
Result->InferSubmodules = true;
Result->InferExportWildcard = true;
-
+
// Look for subframeworks.
std::error_code EC;
SmallString<128> SubframeworksDirName
@@ -1200,11 +1200,11 @@ void ModuleMap::setInferredModuleAllowed
LLVM_DUMP_METHOD void ModuleMap::dump() {
llvm::errs() << "Modules:";
- for (llvm::StringMap<Module *>::iterator M = Modules.begin(),
- MEnd = Modules.end();
+ for (llvm::StringMap<Module *>::iterator M = Modules.begin(),
+ MEnd = Modules.end();
M != MEnd; ++M)
M->getValue()->print(llvm::errs(), 2);
-
+
llvm::errs() << "Headers:";
for (HeadersMap::iterator H = Headers.begin(), HEnd = Headers.end();
H != HEnd; ++H) {
@@ -1299,7 +1299,7 @@ namespace clang {
LSquare,
RSquare
} Kind;
-
+
unsigned Location;
unsigned StringLength;
union {
@@ -1309,16 +1309,16 @@ namespace clang {
// If Kind == IntegerLiteral.
uint64_t IntegerValue;
};
-
+
void clear() {
Kind = EndOfFile;
Location = 0;
StringLength = 0;
StringData = nullptr;
}
-
+
bool is(TokenKind K) const { return Kind == K; }
-
+
SourceLocation getLocation() const {
return SourceLocation::getFromRawEncoding(Location);
}
@@ -1326,7 +1326,7 @@ namespace clang {
uint64_t getInteger() const {
return Kind == IntegerLiteral ? IntegerValue : 0;
}
-
+
StringRef getString() const {
return Kind == IntegerLiteral ? StringRef()
: StringRef(StringData, StringLength);
@@ -1356,17 +1356,17 @@ namespace clang {
/// Whether this module map is in a system header directory.
bool IsSystem;
-
+
/// Whether an error occurred.
bool HadError = false;
-
+
/// Stores string data for the various string literals referenced
/// during parsing.
llvm::BumpPtrAllocator StringData;
-
+
/// The current token.
MMToken Tok;
-
+
/// The active module.
Module *ActiveModule = nullptr;
@@ -1413,7 +1413,7 @@ namespace clang {
using Attributes = ModuleMap::Attributes;
bool parseOptionalAttributes(Attributes &Attrs);
-
+
public:
explicit ModuleMapParser(Lexer &L, SourceManager &SourceMgr,
const TargetInfo *Target, DiagnosticsEngine &Diags,
@@ -1475,7 +1475,7 @@ retry:
case tok::eof:
Tok.Kind = MMToken::EndOfFile;
break;
-
+
case tok::l_brace:
Tok.Kind = MMToken::LBrace;
break;
@@ -1483,27 +1483,27 @@ retry:
case tok::l_square:
Tok.Kind = MMToken::LSquare;
break;
-
+
case tok::period:
Tok.Kind = MMToken::Period;
break;
-
+
case tok::r_brace:
Tok.Kind = MMToken::RBrace;
break;
-
+
case tok::r_square:
Tok.Kind = MMToken::RSquare;
break;
-
+
case tok::star:
Tok.Kind = MMToken::Star;
break;
-
+
case tok::exclaim:
Tok.Kind = MMToken::Exclaim;
break;
-
+
case tok::string_literal: {
if (LToken.hasUDSuffix()) {
Diags.Report(LToken.getLocation(), diag::err_invalid_string_udl);
@@ -1516,13 +1516,13 @@ retry:
StringLiteralParser StringLiteral(LToken, SourceMgr, LangOpts, *Target);
if (StringLiteral.hadError)
goto retry;
-
+
// Copy the string literal into our string data allocator.
unsigned Length = StringLiteral.GetStringLength();
char *Saved = StringData.Allocate<char>(Length + 1);
memcpy(Saved, StringLiteral.GetString().data(), Length);
Saved[Length] = 0;
-
+
// Form the token.
Tok.Kind = MMToken::StringLiteral;
Tok.StringData = Saved;
@@ -1548,7 +1548,7 @@ retry:
Tok.IntegerValue = Value;
break;
}
-
+
case tok::comment:
goto retry;
@@ -1576,7 +1576,7 @@ retry:
HadError = true;
goto retry;
}
-
+
return Result;
}
@@ -1591,14 +1591,14 @@ void ModuleMapParser::skipUntil(MMToken:
case MMToken::LBrace:
if (Tok.is(K) && braceDepth == 0 && squareDepth == 0)
return;
-
+
++braceDepth;
break;
case MMToken::LSquare:
if (Tok.is(K) && braceDepth == 0 && squareDepth == 0)
return;
-
+
++squareDepth;
break;
@@ -1621,7 +1621,7 @@ void ModuleMapParser::skipUntil(MMToken:
return;
break;
}
-
+
consumeToken();
} while (true);
}
@@ -1643,13 +1643,13 @@ bool ModuleMapParser::parseModuleId(Modu
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module_name);
return true;
}
-
+
if (!Tok.is(MMToken::Period))
break;
-
+
consumeToken();
} while (true);
-
+
return false;
}
@@ -1740,7 +1740,7 @@ void ModuleMapParser::diagnosePrivateMod
///
/// module-declaration:
/// 'extern' 'module' module-id string-literal
-/// 'explicit'[opt] 'framework'[opt] 'module' module-id attributes[opt]
+/// 'explicit'[opt] 'framework'[opt] 'module' module-id attributes[opt]
/// { module-member* }
///
/// module-member:
@@ -1778,8 +1778,8 @@ void ModuleMapParser::parseModuleDecl()
if (Tok.is(MMToken::FrameworkKeyword)) {
FrameworkLoc = consumeToken();
Framework = true;
- }
-
+ }
+
// Parse 'module' keyword.
if (!Tok.is(MMToken::ModuleKeyword)) {
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_module);
@@ -1790,10 +1790,10 @@ void ModuleMapParser::parseModuleDecl()
CurrModuleDeclLoc = consumeToken(); // 'module' keyword
// If we have a wildcard for the module name, this is an inferred submodule.
- // Parse it.
+ // Parse it.
if (Tok.is(MMToken::Star))
return parseInferredModuleDecl(Framework, Explicit);
-
+
// Parse the module name.
ModuleId Id;
if (parseModuleId(Id)) {
@@ -1805,7 +1805,7 @@ void ModuleMapParser::parseModuleDecl()
if (Id.size() > 1) {
Diags.Report(Id.front().second, diag::err_mmap_nested_submodule_id)
<< SourceRange(Id.front().second, Id.back().second);
-
+
HadError = true;
return;
}
@@ -1816,8 +1816,8 @@ void ModuleMapParser::parseModuleDecl()
ExplicitLoc = SourceLocation();
HadError = true;
}
-
- Module *PreviousActiveModule = ActiveModule;
+
+ Module *PreviousActiveModule = ActiveModule;
if (Id.size() > 1) {
// This module map defines a submodule. Go find the module of which it
// is a submodule.
@@ -1830,7 +1830,7 @@ void ModuleMapParser::parseModuleDecl()
ActiveModule = Next;
continue;
}
-
+
if (ActiveModule) {
Diags.Report(Id[I].second, diag::err_mmap_missing_module_qualified)
<< Id[I].first
@@ -1849,10 +1849,10 @@ void ModuleMapParser::parseModuleDecl()
Map.addAdditionalModuleMapFile(TopLevelModule, ModuleMapFile);
}
}
-
+
StringRef ModuleName = Id.back().first;
SourceLocation ModuleNameLoc = Id.back().second;
-
+
// Parse the optional attribute list.
Attributes Attrs;
if (parseOptionalAttributes(Attrs))
@@ -1864,9 +1864,9 @@ void ModuleMapParser::parseModuleDecl()
<< ModuleName;
HadError = true;
return;
- }
+ }
SourceLocation LBraceLoc = consumeToken();
-
+
// Determine whether this (sub)module has already been defined.
Module *ShadowingModule = nullptr;
if (Module *Existing = Map.lookupModuleQualified(ModuleName, ActiveModule)) {
@@ -1890,7 +1890,7 @@ void ModuleMapParser::parseModuleDecl()
else {
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rbrace);
Diags.Report(LBraceLoc, diag::note_mmap_lbrace_match);
- HadError = true;
+ HadError = true;
}
return;
}
@@ -1986,7 +1986,7 @@ void ModuleMapParser::parseModuleDecl()
case MMToken::UseKeyword:
parseUseDecl();
break;
-
+
case MMToken::RequiresKeyword:
parseRequiresDecl();
break;
@@ -2023,7 +2023,7 @@ void ModuleMapParser::parseModuleDecl()
default:
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_member);
consumeToken();
- break;
+ break;
}
} while (!Done);
@@ -2233,7 +2233,7 @@ void ModuleMapParser::parseHeaderDecl(MM
// Parse the header name.
if (!Tok.is(MMToken::StringLiteral)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header)
+ Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header)
<< "header";
HadError = true;
return;
@@ -2330,7 +2330,7 @@ static int compareModuleHeaders(const Mo
void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) {
// Parse the directory name.
if (!Tok.is(MMToken::StringLiteral)) {
- Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header)
+ Diags.Report(Tok.getLocation(), diag::err_mmap_expected_header)
<< "umbrella";
HadError = true;
return;
@@ -2338,7 +2338,7 @@ void ModuleMapParser::parseUmbrellaDirDe
std::string DirName = Tok.getString();
SourceLocation DirNameLoc = consumeToken();
-
+
// Check whether we already have an umbrella.
if (ActiveModule->Umbrella) {
Diags.Report(DirNameLoc, diag::err_mmap_umbrella_clash)
@@ -2357,7 +2357,7 @@ void ModuleMapParser::parseUmbrellaDirDe
llvm::sys::path::append(PathName, DirName);
Dir = SourceMgr.getFileManager().getDirectory(PathName);
}
-
+
if (!Dir) {
Diags.Report(DirNameLoc, diag::warn_mmap_umbrella_dir_not_found)
<< DirName;
@@ -2413,38 +2413,38 @@ void ModuleMapParser::parseUmbrellaDirDe
void ModuleMapParser::parseExportDecl() {
assert(Tok.is(MMToken::ExportKeyword));
SourceLocation ExportLoc = consumeToken();
-
+
// Parse the module-id with an optional wildcard at the end.
ModuleId ParsedModuleId;
bool Wildcard = false;
do {
// FIXME: Support string-literal module names here.
if (Tok.is(MMToken::Identifier)) {
- ParsedModuleId.push_back(std::make_pair(Tok.getString(),
+ ParsedModuleId.push_back(std::make_pair(Tok.getString(),
Tok.getLocation()));
consumeToken();
-
+
if (Tok.is(MMToken::Period)) {
consumeToken();
continue;
- }
-
+ }
+
break;
}
-
+
if(Tok.is(MMToken::Star)) {
Wildcard = true;
consumeToken();
break;
}
-
+
Diags.Report(Tok.getLocation(), diag::err_mmap_module_id);
HadError = true;
return;
} while (true);
-
- Module::UnresolvedExportDecl Unresolved = {
- ExportLoc, ParsedModuleId, Wildcard
+
+ Module::UnresolvedExportDecl Unresolved = {
+ ExportLoc, ParsedModuleId, Wildcard
};
ActiveModule->UnresolvedExports.push_back(Unresolved);
}
@@ -2468,7 +2468,7 @@ void ModuleMapParser::parseExportAsDecl(
consumeToken();
return;
}
-
+
if (!ActiveModule->ExportAsModule.empty()) {
if (ActiveModule->ExportAsModule == Tok.getString()) {
Diags.Report(Tok.getLocation(), diag::warn_mmap_redundant_export_as)
@@ -2479,7 +2479,7 @@ void ModuleMapParser::parseExportAsDecl(
<< Tok.getString();
}
}
-
+
ActiveModule->ExportAsModule = Tok.getString();
Map.addLinkAsDependency(ActiveModule);
@@ -2666,7 +2666,7 @@ void ModuleMapParser::parseInferredModul
Diags.Report(StarLoc, diag::err_mmap_inferred_no_umbrella);
Failed = true;
}
-
+
// Check for redefinition of an inferred module.
if (!Failed && ActiveModule->InferSubmodules) {
Diags.Report(StarLoc, diag::err_mmap_inferred_redef);
@@ -2721,7 +2721,7 @@ void ModuleMapParser::parseInferredModul
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_lbrace_wildcard);
HadError = true;
return;
- }
+ }
SourceLocation LBraceLoc = consumeToken();
// Parse the body of the inferred submodule.
@@ -2762,10 +2762,10 @@ void ModuleMapParser::parseInferredModul
}
consumeToken();
- if (Tok.is(MMToken::Star))
+ if (Tok.is(MMToken::Star))
ActiveModule->InferExportWildcard = true;
else
- Diags.Report(Tok.getLocation(),
+ Diags.Report(Tok.getLocation(),
diag::err_mmap_expected_export_wildcard);
consumeToken();
break;
@@ -2779,10 +2779,10 @@ void ModuleMapParser::parseInferredModul
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_inferred_member)
<< (ActiveModule != nullptr);
consumeToken();
- break;
+ break;
}
} while (!Done);
-
+
if (Tok.is(MMToken::RBrace))
consumeToken();
else {
@@ -2806,7 +2806,7 @@ void ModuleMapParser::parseInferredModul
/// \returns true if an error occurred, false otherwise.
bool ModuleMapParser::parseOptionalAttributes(Attributes &Attrs) {
bool HadError = false;
-
+
while (Tok.is(MMToken::LSquare)) {
// Consume the '['.
SourceLocation LSquareLoc = consumeToken();
@@ -2876,7 +2876,7 @@ bool ModuleMapParser::parseModuleMapFile
switch (Tok.Kind) {
case MMToken::EndOfFile:
return HadError;
-
+
case MMToken::ExplicitKeyword:
case MMToken::ExternKeyword:
case MMToken::ModuleKeyword:
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Mon Jul 30 12:24:48 2018
@@ -2597,13 +2597,13 @@ void Preprocessor::HandleDefineDirective
MacroInfo *const MI = ReadOptionalMacroParameterListAndBody(
MacroNameTok, ImmediatelyAfterHeaderGuard);
-
+
if (!MI) return;
if (MacroShadowsKeyword &&
!isConfigurationPattern(MacroNameTok, MI, getLangOpts())) {
Diag(MacroNameTok, diag::warn_pp_macro_hides_keyword);
- }
+ }
// Check that there is no paste (##) operator at the beginning or end of the
// replacement list.
unsigned NumTokens = MI->getNumTokens();
@@ -2716,7 +2716,7 @@ void Preprocessor::HandleUndefDirective(
auto *II = MacroNameTok.getIdentifierInfo();
auto MD = getMacroDefinition(II);
UndefMacroDirective *Undef = nullptr;
-
+
// If the macro is not defined, this is a noop undef.
if (const MacroInfo *MI = MD.getMacroInfo()) {
if (!MI->isUsed() && MI->isWarnIfUnused())
Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Mon Jul 30 12:24:48 2018
@@ -273,7 +273,7 @@ static bool EvaluateValue(PPValue &Resul
case tok::numeric_constant: {
SmallString<64> IntegerBuffer;
bool NumberInvalid = false;
- StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer,
+ StringRef Spelling = PP.getSpelling(PeekTok, IntegerBuffer,
&NumberInvalid);
if (NumberInvalid)
return true; // a diagnostic was already reported
@@ -832,11 +832,11 @@ Preprocessor::EvaluateDirectiveExpressio
// expression.
bool DisableMacroExpansionAtStartOfDirective = DisableMacroExpansion;
DisableMacroExpansion = false;
-
+
// Peek ahead one token.
Token Tok;
LexNonComment(Tok);
-
+
// C99 6.10.1p3 - All expressions are evaluated as intmax_t or uintmax_t.
unsigned BitWidth = getTargetInfo().getIntMaxTWidth();
@@ -846,7 +846,7 @@ Preprocessor::EvaluateDirectiveExpressio
// Parse error, skip the rest of the macro line.
if (Tok.isNot(tok::eod))
DiscardUntilEndOfDirective();
-
+
// Restore 'DisableMacroExpansion'.
DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective;
return {false, DT.IncludedUndefinedIds};
@@ -873,7 +873,7 @@ Preprocessor::EvaluateDirectiveExpressio
// Parse error, skip the rest of the macro line.
if (Tok.isNot(tok::eod))
DiscardUntilEndOfDirective();
-
+
// Restore 'DisableMacroExpansion'.
DisableMacroExpansion = DisableMacroExpansionAtStartOfDirective;
return {false, DT.IncludedUndefinedIds};
Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Mon Jul 30 12:24:48 2018
@@ -82,10 +82,10 @@ bool Preprocessor::EnterSourceFile(FileI
return false;
}
}
-
+
// Get the MemoryBuffer for this FID, if it fails, we fail.
bool Invalid = false;
- const llvm::MemoryBuffer *InputFile =
+ const llvm::MemoryBuffer *InputFile =
getSourceManager().getBuffer(FID, Loc, &Invalid);
if (Invalid) {
SourceLocation FileStart = SourceMgr.getLocForStartOfFile(FID);
@@ -145,7 +145,7 @@ void Preprocessor::EnterSourceFileWithPT
CurLexerSubmodule = nullptr;
if (CurLexerKind != CLK_LexAfterModuleImport)
CurLexerKind = CLK_PTHLexer;
-
+
// Notify the client, if desired, that we are in a new source file.
if (Callbacks) {
FileID FID = CurPPLexer->getFileID();
@@ -240,15 +240,15 @@ static void computeRelativePath(FileMana
if (const DirectoryEntry *CurDir = FM.getDirectory(Path)) {
if (CurDir == Dir) {
Result = FilePath.substr(Path.size());
- llvm::sys::path::append(Result,
+ llvm::sys::path::append(Result,
llvm::sys::path::filename(File->getName()));
return;
}
}
-
+
Path = llvm::sys::path::parent_path(Path);
}
-
+
Result = File->getName();
}
@@ -553,7 +553,7 @@ bool Preprocessor::HandleEndOfFile(Token
CurPTHLexer->getEOF(Result);
CurPTHLexer.reset();
}
-
+
if (!isIncrementalProcessingEnabled())
CurPPLexer = nullptr;
Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Mon Jul 30 12:24:48 2018
@@ -1186,7 +1186,7 @@ static bool EvaluateHasIncludeCommon(Tok
SmallString<128> FilenameBuffer;
StringRef Filename;
SourceLocation EndLoc;
-
+
switch (Tok.getKind()) {
case tok::eod:
// If the token kind is EOD, the error has already been diagnosed.
@@ -1260,7 +1260,7 @@ static bool EvaluateHasIncludeNext(Token
// __has_include_next is like __has_include, except that we start
// searching after the current found directory. If we can't do this,
// issue a diagnostic.
- // FIXME: Factor out duplication with
+ // FIXME: Factor out duplication with
// Preprocessor::HandleIncludeNextDirective.
const DirectoryLookup *Lookup = PP.GetCurDirLookup();
const FileEntry *LookupFromFile = nullptr;
@@ -1510,7 +1510,7 @@ void Preprocessor::ExpandBuiltinMacro(To
PLoc = SourceMgr.getPresumedLoc(NextLoc);
if (PLoc.isInvalid())
break;
-
+
NextLoc = PLoc.getIncludeLoc();
}
}
Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Mon Jul 30 12:24:48 2018
@@ -64,7 +64,7 @@ PragmaHandler::~PragmaHandler() = defaul
EmptyPragmaHandler::EmptyPragmaHandler(StringRef Name) : PragmaHandler(Name) {}
-void EmptyPragmaHandler::HandlePragma(Preprocessor &PP,
+void EmptyPragmaHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &FirstToken) {}
@@ -99,7 +99,7 @@ void PragmaNamespace::RemovePragmaHandle
Handlers.erase(Handler->getName());
}
-void PragmaNamespace::HandlePragma(Preprocessor &PP,
+void PragmaNamespace::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &Tok) {
// Read the 'namespace' that the directive is in, e.g. STDC. Do not macro
@@ -141,7 +141,7 @@ void Preprocessor::HandlePragmaDirective
PragmaHandlers->HandlePragma(*this, Introducer, Tok);
// If the pragma handler didn't read the rest of the line, consume it now.
- if ((CurTokenLexer && CurTokenLexer->isParsingPreprocessorDirective())
+ if ((CurTokenLexer && CurTokenLexer->isParsingPreprocessorDirective())
|| (CurPPLexer && CurPPLexer->ParsingPreprocessorDirective))
DiscardUntilEndOfDirective();
}
@@ -468,7 +468,7 @@ void Preprocessor::HandlePragmaSystemHea
PresumedLoc PLoc = SourceMgr.getPresumedLoc(SysHeaderTok.getLocation());
if (PLoc.isInvalid())
return;
-
+
unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename());
// Notify the client, if desired, that we are in a new source file.
@@ -601,7 +601,7 @@ void Preprocessor::HandlePragmaPushMacro
// Get the MacroInfo associated with IdentInfo.
MacroInfo *MI = getMacroInfo(IdentInfo);
-
+
if (MI) {
// Allow the original MacroInfo to be redefined later.
MI->setIsAllowRedefinitionsWithoutWarning(true);
@@ -653,7 +653,7 @@ void Preprocessor::HandlePragmaPopMacro(
}
void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) {
- // We will either get a quoted filename or a bracketed filename, and we
+ // We will either get a quoted filename or a bracketed filename, and we
// have to track which we got. The first filename is the source name,
// and the second name is the mapped filename. If the first is quoted,
// the second must be as well (cannot mix and match quotes and brackets).
@@ -675,7 +675,7 @@ void Preprocessor::HandlePragmaIncludeAl
StringRef SourceFileName;
SmallString<128> FileNameBuffer;
- if (SourceFilenameTok.is(tok::string_literal) ||
+ if (SourceFilenameTok.is(tok::string_literal) ||
SourceFilenameTok.is(tok::angle_string_literal)) {
SourceFileName = getSpelling(SourceFilenameTok, FileNameBuffer);
} else if (SourceFilenameTok.is(tok::less)) {
@@ -706,7 +706,7 @@ void Preprocessor::HandlePragmaIncludeAl
}
StringRef ReplaceFileName;
- if (ReplaceFilenameTok.is(tok::string_literal) ||
+ if (ReplaceFilenameTok.is(tok::string_literal) ||
ReplaceFilenameTok.is(tok::angle_string_literal)) {
ReplaceFileName = getSpelling(ReplaceFilenameTok, FileNameBuffer);
} else if (ReplaceFilenameTok.is(tok::less)) {
@@ -732,8 +732,8 @@ void Preprocessor::HandlePragmaIncludeAl
// they're both of the same type (angled vs non-angled)
StringRef OriginalSource = SourceFileName;
- bool SourceIsAngled =
- GetIncludeFilenameSpelling(SourceFilenameTok.getLocation(),
+ bool SourceIsAngled =
+ GetIncludeFilenameSpelling(SourceFilenameTok.getLocation(),
SourceFileName);
bool ReplaceIsAngled =
GetIncludeFilenameSpelling(ReplaceFilenameTok.getLocation(),
@@ -747,7 +747,7 @@ void Preprocessor::HandlePragmaIncludeAl
DiagID = diag::warn_pragma_include_alias_mismatch_quote;
Diag(SourceFilenameTok.getLocation(), DiagID)
- << SourceFileName
+ << SourceFileName
<< ReplaceFileName;
return;
@@ -1615,7 +1615,7 @@ struct PragmaPopMacroHandler : public Pr
}
};
-/// PragmaARCCFCodeAuditedHandler -
+/// PragmaARCCFCodeAuditedHandler -
/// \#pragma clang arc_cf_code_audited begin/end
struct PragmaARCCFCodeAuditedHandler : public PragmaHandler {
PragmaARCCFCodeAuditedHandler() : PragmaHandler("arc_cf_code_audited") {}
@@ -1790,7 +1790,7 @@ void Preprocessor::RegisterBuiltinPragma
ModuleHandler->AddPragma(new PragmaModuleEndHandler());
ModuleHandler->AddPragma(new PragmaModuleBuildHandler());
ModuleHandler->AddPragma(new PragmaModuleLoadHandler());
-
+
// Add region pragmas.
AddPragmaHandler(new PragmaRegionHandler("region"));
AddPragmaHandler(new PragmaRegionHandler("endregion"));
Modified: cfe/trunk/lib/Lex/PreprocessingRecord.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PreprocessingRecord.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PreprocessingRecord.cpp (original)
+++ cfe/trunk/lib/Lex/PreprocessingRecord.cpp Mon Jul 30 12:24:48 2018
@@ -67,7 +67,7 @@ PreprocessingRecord::getPreprocessedEnti
}
std::pair<int, int> Res = getPreprocessedEntitiesInRangeSlow(Range);
-
+
CachedRangeQuery.Range = Range;
CachedRangeQuery.Result = Res;
@@ -138,28 +138,28 @@ std::pair<int, int>
PreprocessingRecord::getPreprocessedEntitiesInRangeSlow(SourceRange Range) {
assert(Range.isValid());
assert(!SourceMgr.isBeforeInTranslationUnit(Range.getEnd(),Range.getBegin()));
-
+
std::pair<unsigned, unsigned>
Local = findLocalPreprocessedEntitiesInRange(Range);
-
+
// Check if range spans local entities.
if (!ExternalSource || SourceMgr.isLocalSourceLocation(Range.getBegin()))
return std::make_pair(Local.first, Local.second);
-
+
std::pair<unsigned, unsigned>
Loaded = ExternalSource->findPreprocessedEntitiesInRange(Range);
-
+
// Check if range spans local entities.
if (Loaded.first == Loaded.second)
return std::make_pair(Local.first, Local.second);
-
+
unsigned TotalLoaded = LoadedPreprocessedEntities.size();
-
+
// Check if range spans loaded entities.
if (Local.first == Local.second)
return std::make_pair(int(Loaded.first)-TotalLoaded,
int(Loaded.second)-TotalLoaded);
-
+
// Range spands loaded and local entities.
return std::make_pair(int(Loaded.first)-TotalLoaded, Local.second);
}
@@ -324,7 +324,7 @@ void PreprocessingRecord::SetExternalSou
unsigned PreprocessingRecord::allocateLoadedEntities(unsigned NumEntities) {
unsigned Result = LoadedPreprocessedEntities.size();
- LoadedPreprocessedEntities.resize(LoadedPreprocessedEntities.size()
+ LoadedPreprocessedEntities.resize(LoadedPreprocessedEntities.size()
+ NumEntities);
return Result;
}
@@ -371,7 +371,7 @@ PreprocessedEntity *PreprocessingRecord:
/// Retrieve the loaded preprocessed entity at the given index.
PreprocessedEntity *
PreprocessingRecord::getLoadedPreprocessedEntity(unsigned Index) {
- assert(Index < LoadedPreprocessedEntities.size() &&
+ assert(Index < LoadedPreprocessedEntities.size() &&
"Out-of bounds loaded preprocessed entity");
assert(ExternalSource && "No external source to load from");
PreprocessedEntity *&Entity = LoadedPreprocessedEntities[Index];
@@ -471,27 +471,27 @@ void PreprocessingRecord::InclusionDirec
const FileEntry *File,
StringRef SearchPath,
StringRef RelativePath,
- const Module *Imported,
+ const Module *Imported,
SrcMgr::CharacteristicKind FileType) {
InclusionDirective::InclusionKind Kind = InclusionDirective::Include;
-
+
switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) {
- case tok::pp_include:
- Kind = InclusionDirective::Include;
+ case tok::pp_include:
+ Kind = InclusionDirective::Include;
break;
-
- case tok::pp_import:
- Kind = InclusionDirective::Import;
+
+ case tok::pp_import:
+ Kind = InclusionDirective::Import;
break;
-
- case tok::pp_include_next:
- Kind = InclusionDirective::IncludeNext;
+
+ case tok::pp_include_next:
+ Kind = InclusionDirective::IncludeNext;
break;
-
- case tok::pp___include_macros:
+
+ case tok::pp___include_macros:
Kind = InclusionDirective::IncludeMacros;
break;
-
+
default:
llvm_unreachable("Unknown include directive kind");
}
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Mon Jul 30 12:24:48 2018
@@ -95,12 +95,12 @@ Preprocessor::Preprocessor(std::shared_p
TUKind(TUKind), SkipMainFilePreamble(0, true),
CurSubmoduleState(&NullSubmoduleState) {
OwnsHeaderSearch = OwnsHeaders;
-
+
// Default to discarding comments.
KeepComments = false;
KeepMacroComments = false;
SuppressIncludeNotFoundError = false;
-
+
// Macro expansion is enabled.
DisableMacroExpansion = false;
MacroExpansionInDirectivesOverride = false;
@@ -127,10 +127,10 @@ Preprocessor::Preprocessor(std::shared_p
// Initialize the pragma handlers.
RegisterBuiltinPragmas();
-
+
// Initialize builtin macros like __LINE__ and friends.
RegisterBuiltinMacros();
-
+
if(LangOpts.Borland) {
Ident__exception_info = getIdentifierInfo("_exception_info");
Ident___exception_info = getIdentifierInfo("__exception_info");
@@ -379,7 +379,7 @@ void Preprocessor::recomputeCurLexerKind
CurLexerKind = CLK_PTHLexer;
else if (CurTokenLexer)
CurLexerKind = CLK_TokenLexer;
- else
+ else
CurLexerKind = CLK_CachingLexer;
}
@@ -772,7 +772,7 @@ bool Preprocessor::HandleIdentifier(Toke
if (IsSpecialVariadicMacro)
II.setIsPoisoned(CurrentIsPoisoned);
}
-
+
// If this identifier was poisoned, and if it was not produced from a macro
// expansion, emit an error.
if (II.isPoisoned() && CurPPLexer) {
@@ -818,7 +818,7 @@ bool Preprocessor::HandleIdentifier(Toke
// like "#define TY typeof", "TY(1) x".
if (II.isExtensionToken() && !DisableMacroExpansion)
Diag(Identifier, diag::ext_token_used);
-
+
// If this is the 'import' contextual keyword following an '@', note
// that the next token indicates a module name.
//
@@ -881,15 +881,15 @@ void Preprocessor::Lex(Token &Result) {
void Preprocessor::LexAfterModuleImport(Token &Result) {
// Figure out what kind of lexer we actually have.
recomputeCurLexerKind();
-
+
// Lex the next token.
Lex(Result);
- // The token sequence
+ // The token sequence
//
// import identifier (. identifier)*
//
- // indicates a module import directive. We already saw the 'import'
+ // indicates a module import directive. We already saw the 'import'
// contextual keyword, so now we're looking for the identifiers.
if (ModuleImportExpectsIdentifier && Result.getKind() == tok::identifier) {
// We expected to see an identifier here, and we did; continue handling
@@ -900,7 +900,7 @@ void Preprocessor::LexAfterModuleImport(
CurLexerKind = CLK_LexAfterModuleImport;
return;
}
-
+
// If we're expecting a '.' or a ';', and we got a '.', then wait until we
// see the next identifier. (We can also see a '[[' that begins an
// attribute-specifier-seq here under the C++ Modules TS.)
@@ -1056,7 +1056,7 @@ CodeCompletionHandler::~CodeCompletionHa
void Preprocessor::createPreprocessingRecord() {
if (Record)
return;
-
+
Record = new PreprocessingRecord(getSourceManager());
addPPCallbacks(std::unique_ptr<PPCallbacks>(Record));
}
Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Mon Jul 30 12:24:48 2018
@@ -248,7 +248,7 @@ void TokenLexer::ExpandFunctionArguments
ActualArgs->invokedWithVariadicArgument(Macro);
VAOptExpansionContext VCtx(PP);
-
+
for (unsigned I = 0, E = NumTokens; I != E; ++I) {
const Token &CurTok = Tokens[I];
// We don't want a space for the next token after a paste
@@ -268,7 +268,7 @@ void TokenLexer::ExpandFunctionArguments
++I; // Skip the l_paren
VCtx.sawVAOptFollowedByOpeningParens(CurTok.getLocation(),
ResultToks.size());
-
+
continue;
}
@@ -336,14 +336,14 @@ void TokenLexer::ExpandFunctionArguments
}
// If we found the stringify operator, get the argument stringified. The
- // preprocessor already verified that the following token is a macro
+ // preprocessor already verified that the following token is a macro
// parameter or __VA_OPT__ when the #define was lexed.
-
+
if (CurTok.isOneOf(tok::hash, tok::hashat)) {
int ArgNo = Macro->getParameterNum(Tokens[I+1].getIdentifierInfo());
assert((ArgNo != -1 || VCtx.isVAOptToken(Tokens[I + 1])) &&
"Token following # is not an argument or __VA_OPT__!");
-
+
if (ArgNo == -1) {
// Handle the __VA_OPT__ case.
VCtx.sawHashOrHashAtBefore(NextTokGetsSpace,
@@ -706,7 +706,7 @@ bool TokenLexer::pasteTokens(Token &LHST
if (PP.getLangOpts().MicrosoftExt && (CurIdx >= 2) &&
TokenStream[CurIdx - 2].is(tok::hashhash))
LHSTok.clearFlag(Token::LeadingSpace);
-
+
SmallString<128> Buffer;
const char *ResultTokStrPtr = nullptr;
SourceLocation StartLoc = LHSTok.getLocation();
@@ -845,7 +845,7 @@ bool TokenLexer::pasteTokens(Token &LHST
// Transfer properties of the LHS over the Result.
Result.setFlagValue(Token::StartOfLine , LHSTok.isAtStartOfLine());
Result.setFlagValue(Token::LeadingSpace, LHSTok.hasLeadingSpace());
-
+
// Finally, replace LHS with the result, consume the RHS, and iterate.
++CurIdx;
LHSTok = Result;
@@ -868,7 +868,7 @@ bool TokenLexer::pasteTokens(Token &LHST
StartLoc = SM.getImmediateExpansionRange(StartLoc).getBegin();
while (SM.getFileID(EndLoc) != MacroFID)
EndLoc = SM.getImmediateExpansionRange(EndLoc).getEnd();
-
+
LHSTok.setLocation(SM.createExpansionLoc(LHSTok.getLocation(), StartLoc, EndLoc,
LHSTok.getLength()));
@@ -927,7 +927,7 @@ TokenLexer::getExpansionLocForMacroDefLo
assert(ExpandLocStart.isValid() && MacroExpansionStart.isValid() &&
"Not appropriate for token streams");
assert(loc.isValid() && loc.isFileID());
-
+
SourceManager &SM = PP.getSourceManager();
assert(SM.isInSLocAddrSpace(loc, MacroDefStart, MacroDefLength) &&
"Expected loc to come from the macro definition");
@@ -1019,7 +1019,7 @@ void TokenLexer::updateLocForMacroArgTok
SourceLocation InstLoc =
getExpansionLocForMacroDefLoc(ArgIdSpellLoc);
-
+
while (begin_tokens < end_tokens) {
// If there's only one token just create a SLocEntry for it.
if (end_tokens - begin_tokens == 1) {
Modified: cfe/trunk/lib/Parse/ParseAST.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseAST.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseAST.cpp (original)
+++ cfe/trunk/lib/Parse/ParseAST.cpp Mon Jul 30 12:24:48 2018
@@ -107,7 +107,7 @@ void clang::ParseAST(Preprocessor &PP, A
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<Sema> CleanupSema(S.get());
-
+
ParseAST(*S.get(), PrintStats, SkipFunctionBodies);
}
@@ -166,7 +166,7 @@ void clang::ParseAST(Sema &S, bool Print
// Process any TopLevelDecls generated by #pragma weak.
for (Decl *D : S.WeakTopLevelDecls())
Consumer->HandleTopLevelDecl(DeclGroupRef(D));
-
+
Consumer->HandleTranslationUnit(S.getASTContext());
// Finalize the template instantiation observer chain.
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Mon Jul 30 12:24:48 2018
@@ -590,9 +590,9 @@ void Parser::ParseLexedMemberInitializer
if (!Class.LateParsedDeclarations.empty()) {
// C++11 [expr.prim.general]p4:
- // Otherwise, if a member-declarator declares a non-static data member
+ // Otherwise, if a member-declarator declares a non-static data member
// (9.2) of a class X, the expression this is a prvalue of type "pointer
- // to X" within the optional brace-or-equal-initializer. It shall not
+ // to X" within the optional brace-or-equal-initializer. It shall not
// appear elsewhere in the member-declarator.
Sema::CXXThisScopeRAII ThisScope(Actions, Class.TagOrTemplate,
/*TypeQuals=*/(unsigned)0);
@@ -601,7 +601,7 @@ void Parser::ParseLexedMemberInitializer
Class.LateParsedDeclarations[i]->ParseLexedMemberInitializers();
}
}
-
+
if (!AlreadyHasClassScope)
Actions.ActOnFinishDelayedMemberDeclarations(getCurScope(),
Class.TagOrTemplate);
@@ -627,7 +627,7 @@ void Parser::ParseLexedMemberInitializer
Actions.ActOnStartCXXInClassMemberInitializer();
- ExprResult Init = ParseCXXMemberInitializer(MI.Field, /*IsFunction=*/false,
+ ExprResult Init = ParseCXXMemberInitializer(MI.Field, /*IsFunction=*/false,
EqualLoc);
Actions.ActOnFinishCXXInClassMemberInitializer(MI.Field, EqualLoc,
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Jul 30 12:24:48 2018
@@ -757,7 +757,7 @@ void Parser::ParseNullabilityTypeSpecifi
if (!getLangOpts().ObjC1)
Diag(AttrNameLoc, diag::ext_nullability)
<< AttrName;
- attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
+ attrs.addNew(AttrName, AttrNameLoc, nullptr, AttrNameLoc, nullptr, 0,
ParsedAttr::AS_Keyword);
break;
}
@@ -867,7 +867,7 @@ VersionTuple Parser::ParseVersionTuple(S
StopAtSemi | StopBeforeMatch | StopAtCodeCompletion);
return VersionTuple();
}
-
+
// Warn if separators, be it '.' or '_', do not match.
if (AfterMajorSeparator != AfterMinorSeparator)
Diag(Tok, diag::warn_expected_consistent_version_separator);
@@ -1047,7 +1047,7 @@ void Parser::ParseAvailabilityAttribute(
continue;
}
}
-
+
SourceRange VersionRange;
VersionTuple Version = ParseVersionTuple(VersionRange);
@@ -1259,7 +1259,7 @@ void Parser::ParseObjCBridgeRelatedAttri
Diag(Tok, diag::err_expected) << tok::l_paren;
return;
}
-
+
// Parse the related class name.
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_objcbridge_related_expected_related_class);
@@ -1292,7 +1292,7 @@ void Parser::ParseObjCBridgeRelatedAttri
SkipUntil(tok::r_paren, StopAtSemi);
return;
}
-
+
// Parse instance method name. Also non-optional but empty string is
// permitted.
IdentifierLoc *InstanceMethod = nullptr;
@@ -1303,14 +1303,14 @@ void Parser::ParseObjCBridgeRelatedAttri
SkipUntil(tok::r_paren, StopAtSemi);
return;
}
-
+
// Closing ')'.
if (T.consumeClose())
return;
-
+
if (endLoc)
*endLoc = T.getCloseLocation();
-
+
// Record this attribute
attrs.addNew(&ObjCBridgeRelated,
SourceRange(ObjCBridgeRelatedLoc, T.getCloseLocation()),
@@ -2032,7 +2032,7 @@ Parser::DeclGroupPtrTy Parser::ParseDecl
DeclsInGroup.push_back(FirstDecl);
bool ExpectSemi = Context != DeclaratorContext::ForContext;
-
+
// If we don't have a comma, it is either the end of the list (a ';') or an
// error, bail out.
SourceLocation CommaLoc;
@@ -3815,7 +3815,7 @@ void Parser::ParseDeclarationSpecifiers(
PrevSpec, DiagID, Type.get(),
Actions.getASTContext().getPrintingPolicy()))
Diag(StartLoc, DiagID) << PrevSpec;
-
+
DS.SetRangeEnd(EndLoc);
} else {
DS.SetTypeSpecError();
@@ -5627,7 +5627,7 @@ void Parser::ParseDirectDeclarator(Decla
} else {
AllowConstructorName =
(D.getContext() == DeclaratorContext::MemberContext);
- AllowDeductionGuide =
+ AllowDeductionGuide =
(D.getContext() == DeclaratorContext::FileContext ||
D.getContext() == DeclaratorContext::MemberContext);
}
@@ -6082,13 +6082,13 @@ void Parser::ParseFunctionDeclarator(Dec
LocalEndLoc = RParenLoc;
EndLoc = RParenLoc;
- // If there are attributes following the identifier list, parse them and
+ // If there are attributes following the identifier list, parse them and
// prohibit them.
MaybeParseCXX11Attributes(FnAttrs);
ProhibitAttributes(FnAttrs);
} else {
if (Tok.isNot(tok::r_paren))
- ParseParameterDeclarationClause(D, FirstArgAttrs, ParamInfo,
+ ParseParameterDeclarationClause(D, FirstArgAttrs, ParamInfo,
EllipsisLoc);
else if (RequiresArg)
Diag(Tok, diag::err_argument_required_after_attribute);
@@ -6391,8 +6391,8 @@ void Parser::ParseParameterDeclarationCl
ParseDeclarationSpecifiers(DS);
- // Parse the declarator. This is "PrototypeContext" or
- // "LambdaExprParameterContext", because we must accept either
+ // Parse the declarator. This is "PrototypeContext" or
+ // "LambdaExprParameterContext", because we must accept either
// 'declarator' or 'abstract-declarator' here.
Declarator ParmDeclarator(
DS, D.getContext() == DeclaratorContext::LambdaExprContext
@@ -6484,7 +6484,7 @@ void Parser::ParseParameterDeclarationCl
}
ParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
- ParmDeclarator.getIdentifierLoc(),
+ ParmDeclarator.getIdentifierLoc(),
Param, std::move(DefArgToks)));
}
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Jul 30 12:24:48 2018
@@ -61,7 +61,7 @@ Parser::DeclGroupPtrTy Parser::ParseName
assert(Tok.is(tok::kw_namespace) && "Not a namespace!");
SourceLocation NamespaceLoc = ConsumeToken(); // eat the 'namespace'.
ObjCDeclContextSwitch ObjCDC(*this);
-
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteNamespaceDecl(getCurScope());
cutOffParsing();
@@ -130,8 +130,8 @@ Parser::DeclGroupPtrTy Parser::ParseName
return nullptr;
}
- if (getCurScope()->isClassScope() || getCurScope()->isTemplateParamScope() ||
- getCurScope()->isInObjcMethodScope() || getCurScope()->getBlockParent() ||
+ if (getCurScope()->isClassScope() || getCurScope()->isTemplateParamScope() ||
+ getCurScope()->isInObjcMethodScope() || getCurScope()->getBlockParent() ||
getCurScope()->getFnParent()) {
Diag(T.getOpenLocation(), diag::err_namespace_nonnamespace_scope);
SkipUntil(tok::r_brace);
@@ -190,7 +190,7 @@ Parser::DeclGroupPtrTy Parser::ParseName
PrettyDeclStackTraceEntry CrashInfo(Actions.Context, NamespcDecl,
NamespaceLoc, "parsing namespace");
- // Parse the contents of the namespace. This includes parsing recovery on
+ // Parse the contents of the namespace. This includes parsing recovery on
// any improperly nested namespaces.
ParseInnerNamespace(ExtraIdentLoc, ExtraIdent, ExtraNamespaceLoc, 0,
InlineLoc, attrs, T);
@@ -200,8 +200,8 @@ Parser::DeclGroupPtrTy Parser::ParseName
DeclEnd = T.getCloseLocation();
Actions.ActOnFinishNamespaceDef(NamespcDecl, DeclEnd);
-
- return Actions.ConvertDeclToDeclGroup(NamespcDecl,
+
+ return Actions.ConvertDeclToDeclGroup(NamespcDecl,
ImplicitUsingDirectiveDecl);
}
@@ -236,7 +236,7 @@ void Parser::ParseInnerNamespace(std::ve
getCurScope(), SourceLocation(), NamespaceLoc[index], IdentLoc[index],
Ident[index], Tracker.getOpenLocation(), attrs,
ImplicitUsingDirectiveDecl);
- assert(!ImplicitUsingDirectiveDecl &&
+ assert(!ImplicitUsingDirectiveDecl &&
"nested namespace definition cannot define anonymous namespace");
ParseInnerNamespace(IdentLoc, Ident, NamespaceLoc, ++index, InlineLoc,
@@ -438,7 +438,7 @@ Parser::ParseUsingDirectiveOrDeclaration
ParsedAttributesWithRange &attrs) {
assert(Tok.is(tok::kw_using) && "Not using token");
ObjCDeclContextSwitch ObjCDC(*this);
-
+
// Eat 'using'.
SourceLocation UsingLoc = ConsumeToken();
@@ -896,7 +896,7 @@ Decl *Parser::ParseStaticAssertDeclarati
SourceLocation Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
assert(Tok.isOneOf(tok::kw_decltype, tok::annot_decltype)
&& "Not a decltype specifier");
-
+
ExprResult Result;
SourceLocation StartLoc = Tok.getLocation();
SourceLocation EndLoc;
@@ -999,7 +999,7 @@ SourceLocation Parser::ParseDecltypeSpec
return EndLoc;
}
-void Parser::AnnotateExistingDecltypeSpecifier(const DeclSpec& DS,
+void Parser::AnnotateExistingDecltypeSpecifier(const DeclSpec& DS,
SourceLocation StartLoc,
SourceLocation EndLoc) {
// make sure we have a token we can turn into an annotation token
@@ -1050,9 +1050,9 @@ void Parser::ParseUnderlyingTypeSpecifie
}
/// ParseBaseTypeSpecifier - Parse a C++ base-type-specifier which is either a
-/// class name or decltype-specifier. Note that we only check that the result
-/// names a type; semantic analysis will need to verify that the type names a
-/// class. The result is either a type or null, depending on whether a type
+/// class name or decltype-specifier. Note that we only check that the result
+/// names a type; semantic analysis will need to verify that the type names a
+/// class. The result is either a type or null, depending on whether a type
/// name was found.
///
/// base-type-specifier: [C++11 class.derived]
@@ -1083,7 +1083,7 @@ TypeResult Parser::ParseBaseTypeSpecifie
BaseLoc = Tok.getLocation();
// Parse decltype-specifier
- // tok == kw_decltype is just error recovery, it can only happen when SS
+ // tok == kw_decltype is just error recovery, it can only happen when SS
// isn't empty
if (Tok.isOneOf(tok::kw_decltype, tok::annot_decltype)) {
if (SS.isNotEmpty())
@@ -1348,8 +1348,8 @@ bool Parser::isValidAfterTypeSpecifier(b
void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
SourceLocation StartLoc, DeclSpec &DS,
const ParsedTemplateInfo &TemplateInfo,
- AccessSpecifier AS,
- bool EnteringContext, DeclSpecContext DSC,
+ AccessSpecifier AS,
+ bool EnteringContext, DeclSpecContext DSC,
ParsedAttributesWithRange &Attributes) {
DeclSpec::TST TagType;
if (TagTokKind == tok::kw_struct)
@@ -2061,7 +2061,7 @@ BaseResult Parser::ParseBaseSpecifier(De
if (BaseType.isInvalid())
return true;
- // Parse the optional ellipsis (for a pack expansion). The ellipsis is
+ // Parse the optional ellipsis (for a pack expansion). The ellipsis is
// actually part of the base-specifier-list grammar productions, but we
// parse it here for convenience.
SourceLocation EllipsisLoc;
@@ -2229,7 +2229,7 @@ void Parser::ParseOptionalCXX11VirtSpeci
bool Parser::isCXX11FinalKeyword() const {
VirtSpecifiers::Specifier Specifier = isCXX11VirtSpecifier();
return Specifier == VirtSpecifiers::VS_Final ||
- Specifier == VirtSpecifiers::VS_GNU_Final ||
+ Specifier == VirtSpecifiers::VS_GNU_Final ||
Specifier == VirtSpecifiers::VS_Sealed;
}
@@ -2397,7 +2397,7 @@ void Parser::MaybeParseAndDiagnoseDeclSp
/// override
/// final
/// [MS] sealed
-///
+///
/// pure-specifier:
/// '= 0'
///
@@ -2648,9 +2648,9 @@ Parser::ParseCXXClassMemberDeclaration(A
}
DeclaratorInfo.setFunctionDefinitionKind(DefinitionKind);
- // C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains
+ // C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains
// to a friend declaration, that declaration shall be a definition.
- if (DeclaratorInfo.isFunctionDeclarator() &&
+ if (DeclaratorInfo.isFunctionDeclarator() &&
DefinitionKind != FDK_Definition && DS.isFriendSpecified()) {
// Diagnose attributes that appear before decl specifier:
// [[]] friend int foo();
@@ -3142,7 +3142,7 @@ void Parser::ParseCXXMemberSpecification
if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) {
VirtSpecifiers::Specifier Specifier = isCXX11VirtSpecifier(Tok);
assert((Specifier == VirtSpecifiers::VS_Final ||
- Specifier == VirtSpecifiers::VS_GNU_Final ||
+ Specifier == VirtSpecifiers::VS_GNU_Final ||
Specifier == VirtSpecifiers::VS_Sealed) &&
"not a class definition");
FinalLoc = ConsumeToken();
@@ -3457,7 +3457,7 @@ MemInitResult Parser::ParseMemInitialize
TryConsumeToken(tok::ellipsis, EllipsisLoc);
return Actions.ActOnMemInitializer(ConstructorDecl, getCurScope(), SS, II,
- TemplateTypeTy, DS, IdLoc,
+ TemplateTypeTy, DS, IdLoc,
InitList.get(), EllipsisLoc);
} else if(Tok.is(tok::l_paren)) {
BalancedDelimiterTracker T(*this, tok::l_paren);
@@ -3506,7 +3506,7 @@ Parser::tryParseExceptionSpecification(b
CachedTokens *&ExceptionSpecTokens) {
ExceptionSpecificationType Result = EST_None;
ExceptionSpecTokens = nullptr;
-
+
// Handle delayed parsing of exception-specifications.
if (Delayed) {
if (Tok.isNot(tok::kw_throw) && Tok.isNot(tok::kw_noexcept))
@@ -3525,11 +3525,11 @@ Parser::tryParseExceptionSpecification(b
NoexceptExpr = nullptr;
return EST_BasicNoexcept;
}
-
+
Diag(Tok, diag::err_expected_lparen_after) << "throw";
return EST_DynamicNone;
}
-
+
// Cache the tokens for the exception-specification.
ExceptionSpecTokens = new CachedTokens;
ExceptionSpecTokens->push_back(StartTok); // 'throw' or 'noexcept'
@@ -3543,7 +3543,7 @@ Parser::tryParseExceptionSpecification(b
return EST_Unparsed;
}
-
+
// See if there's a dynamic specification.
if (Tok.is(tok::kw_throw)) {
Result = ParseDynamicExceptionSpecification(SpecificationRange,
@@ -3660,7 +3660,7 @@ ExceptionSpecificationType Parser::Parse
if (Tok.is(tok::ellipsis)) {
// C++0x [temp.variadic]p5:
- // - In a dynamic-exception-specification (15.4); the pattern is a
+ // - In a dynamic-exception-specification (15.4); the pattern is a
// type-id.
SourceLocation Ellipsis = ConsumeToken();
Range.setEnd(Ellipsis);
@@ -4207,7 +4207,7 @@ void Parser::ParseMicrosoftIfExistsClass
IfExistsCondition Result;
if (ParseMicrosoftIfExistsCondition(Result))
return;
-
+
BalancedDelimiterTracker Braces(*this, tok::l_brace);
if (Braces.consumeOpen()) {
Diag(Tok, diag::err_expected) << tok::l_brace;
@@ -4218,13 +4218,13 @@ void Parser::ParseMicrosoftIfExistsClass
case IEB_Parse:
// Parse the declarations below.
break;
-
+
case IEB_Dependent:
Diag(Result.KeywordLoc, diag::warn_microsoft_dependent_exists)
<< Result.IsIfExists;
// Fall through to skip.
LLVM_FALLTHROUGH;
-
+
case IEB_Skip:
Braces.skipToEnd();
return;
@@ -4262,6 +4262,6 @@ void Parser::ParseMicrosoftIfExistsClass
// Parse all the comma separated declarators.
ParseCXXClassMemberDeclaration(CurAS, AccessAttrs);
}
-
+
Braces.consumeClose();
}
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Jul 30 12:24:48 2018
@@ -441,7 +441,7 @@ Parser::ParseRHSOfBinaryExpression(ExprR
// is okay, to bind exactly as tightly. For example, compile A=B=C=D as
// A=(B=(C=D)), where each paren is a level of recursion here.
// The function takes ownership of the RHS.
- RHS = ParseRHSOfBinaryExpression(RHS,
+ RHS = ParseRHSOfBinaryExpression(RHS,
static_cast<prec::Level>(ThisPrec + !isRightAssoc));
RHSIsInitList = false;
@@ -656,14 +656,14 @@ class CastExpressionIdValidator : public
///
/// id-expression: [C++ 5.1]
/// unqualified-id
-/// qualified-id
+/// qualified-id
///
/// unqualified-id: [C++ 5.1]
/// identifier
/// operator-function-id
/// conversion-function-id
-/// '~' class-name
-/// template-id
+/// '~' class-name
+/// template-id
///
/// new-expression: [C++ 5.3.4]
/// '::'[opt] 'new' new-placement[opt] new-type-id
@@ -729,7 +729,7 @@ class CastExpressionIdValidator : public
/// '__trivially_copyable'
///
/// binary-type-trait:
-/// [GNU] '__is_base_of'
+/// [GNU] '__is_base_of'
/// [MS] '__is_convertible_to'
/// '__is_convertible'
/// '__is_same'
@@ -811,7 +811,7 @@ ExprResult Parser::ParseCastExpression(b
case tok::kw_false:
Res = ParseCXXBoolLiteral();
break;
-
+
case tok::kw___objc_yes:
case tok::kw___objc_no:
return ParseObjCBoolLiteral();
@@ -835,7 +835,7 @@ ExprResult Parser::ParseCastExpression(b
return ExprError();
assert(Tok.isNot(tok::kw_decltype) && Tok.isNot(tok::kw___super));
return ParseCastExpression(isUnaryExpression, isAddressOfOperand);
-
+
case tok::identifier: { // primary-expression: identifier
// unqualified-id: identifier
// constant: enumeration-constant
@@ -957,14 +957,14 @@ ExprResult Parser::ParseCastExpression(b
return ExprError();
}
// Allow either an identifier or the keyword 'class' (in C++).
- if (Tok.isNot(tok::identifier) &&
+ if (Tok.isNot(tok::identifier) &&
!(getLangOpts().CPlusPlus && Tok.is(tok::kw_class))) {
Diag(Tok, diag::err_expected_property_name);
return ExprError();
}
IdentifierInfo &PropertyName = *Tok.getIdentifierInfo();
SourceLocation PropertyLoc = ConsumeToken();
-
+
Res = Actions.ActOnClassPropertyRefExpr(II, PropertyName,
ILoc, PropertyLoc);
break;
@@ -973,7 +973,7 @@ ExprResult Parser::ParseCastExpression(b
// In an Objective-C method, if we have "super" followed by an identifier,
// the token sequence is ill-formed. However, if there's a ':' or ']' after
// that identifier, this is probably a message send with a missing open
- // bracket. Treat it as such.
+ // bracket. Treat it as such.
if (getLangOpts().ObjC1 && &II == Ident_super && !InMessageExpression &&
getCurScope()->isInObjcMethodScope() &&
((Tok.is(tok::identifier) &&
@@ -983,17 +983,17 @@ ExprResult Parser::ParseCastExpression(b
nullptr);
break;
}
-
+
// If we have an Objective-C class name followed by an identifier
// and either ':' or ']', this is an Objective-C class message
// send that's missing the opening '['. Recovery
// appropriately. Also take this path if we're performing code
// completion after an Objective-C class name.
- if (getLangOpts().ObjC1 &&
- ((Tok.is(tok::identifier) && !InMessageExpression) ||
+ if (getLangOpts().ObjC1 &&
+ ((Tok.is(tok::identifier) && !InMessageExpression) ||
Tok.is(tok::code_completion))) {
const Token& Next = NextToken();
- if (Tok.is(tok::code_completion) ||
+ if (Tok.is(tok::code_completion) ||
Next.is(tok::colon) || Next.is(tok::r_square))
if (ParsedType Typ = Actions.getTypeName(II, ILoc, getCurScope()))
if (Typ.get()->isObjCObjectOrInterfaceType()) {
@@ -1005,24 +1005,24 @@ ExprResult Parser::ParseCastExpression(b
unsigned DiagID;
DS.SetTypeSpecType(TST_typename, ILoc, PrevSpec, DiagID, Typ,
Actions.getASTContext().getPrintingPolicy());
-
+
Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext);
- TypeResult Ty = Actions.ActOnTypeName(getCurScope(),
+ TypeResult Ty = Actions.ActOnTypeName(getCurScope(),
DeclaratorInfo);
if (Ty.isInvalid())
break;
- Res = ParseObjCMessageExpressionBody(SourceLocation(),
- SourceLocation(),
+ Res = ParseObjCMessageExpressionBody(SourceLocation(),
+ SourceLocation(),
Ty.get(), nullptr);
break;
}
}
-
+
// Make sure to pass down the right value for isAddressOfOperand.
if (isAddressOfOperand && isPostfixExpressionSuffixStart())
isAddressOfOperand = false;
-
+
// Function designators are allowed to be undeclared (C99 6.5.1p2), so we
// need to know whether or not this identifier is a function designator or
// not.
@@ -1179,7 +1179,7 @@ ExprResult Parser::ParseCastExpression(b
if (getCurScope()->getFnParent() == nullptr)
return ExprError(Diag(Tok, diag::err_address_of_label_outside_fn));
-
+
Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(),
Tok.getLocation());
@@ -1384,7 +1384,7 @@ ExprResult Parser::ParseCastExpression(b
T.consumeClose();
if (!Result.isInvalid())
- Result = Actions.ActOnNoexceptExpr(KeyLoc, T.getOpenLocation(),
+ Result = Actions.ActOnNoexceptExpr(KeyLoc, T.getOpenLocation(),
Result.get(), T.getCloseLocation());
return Result;
}
@@ -1393,7 +1393,7 @@ ExprResult Parser::ParseCastExpression(b
case tok::kw_##Spelling:
#include "clang/Basic/TokenKinds.def"
return ParseTypeTrait();
-
+
case tok::kw___array_rank:
case tok::kw___array_extent:
return ParseArrayTypeTrait();
@@ -1401,7 +1401,7 @@ ExprResult Parser::ParseCastExpression(b
case tok::kw___is_lvalue_expr:
case tok::kw___is_rvalue_expr:
return ParseExpressionTrait();
-
+
case tok::at: {
SourceLocation AtLoc = ConsumeToken();
return ParseObjCAtExpression(AtLoc);
@@ -1489,16 +1489,16 @@ Parser::ParsePostfixExpressionSuffix(Exp
case tok::code_completion:
if (InMessageExpression)
return LHS;
-
+
Actions.CodeCompletePostfixExpression(getCurScope(), LHS);
cutOffParsing();
return ExprError();
-
+
case tok::identifier:
// If we see identifier: after an expression, and we're not already in a
// message send, then this is probably a message send with a missing
// opening bracket '['.
- if (getLangOpts().ObjC1 && !InMessageExpression &&
+ if (getLangOpts().ObjC1 && !InMessageExpression &&
(NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
LHS = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(),
nullptr, LHS.get());
@@ -1620,8 +1620,8 @@ Parser::ParsePostfixExpressionSuffix(Exp
if (!LHS.isInvalid()) {
ExprResult ECResult = Actions.ActOnCUDAExecConfigExpr(getCurScope(),
- OpenLoc,
- ExecConfigExprs,
+ OpenLoc,
+ ExecConfigExprs,
CloseLoc);
if (ECResult.isInvalid())
LHS = ExprError();
@@ -1635,7 +1635,7 @@ Parser::ParsePostfixExpressionSuffix(Exp
ExprVector ArgExprs;
CommaLocsTy CommaLocs;
-
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteCall(getCurScope(), LHS.get(), None);
cutOffParsing();
@@ -1675,7 +1675,7 @@ Parser::ParsePostfixExpressionSuffix(Exp
PT.consumeClose();
LHS = ExprError();
} else {
- assert((ArgExprs.size() == 0 ||
+ assert((ArgExprs.size() == 0 ||
ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
LHS = Actions.ActOnCallExpr(getCurScope(), LHS.get(), Loc,
@@ -1716,7 +1716,7 @@ Parser::ParsePostfixExpressionSuffix(Exp
if (LHS.isInvalid())
break;
- ParseOptionalCXXScopeSpecifier(SS, ObjectType,
+ ParseOptionalCXXScopeSpecifier(SS, ObjectType,
/*EnteringContext=*/false,
&MayBePseudoDestructor);
if (SS.isNotEmpty())
@@ -1749,7 +1749,7 @@ Parser::ParsePostfixExpressionSuffix(Exp
}
if (MayBePseudoDestructor && !LHS.isInvalid()) {
- LHS = ParseCXXPseudoDestructor(LHS.get(), OpLoc, OpKind, SS,
+ LHS = ParseCXXPseudoDestructor(LHS.get(), OpLoc, OpKind, SS,
ObjectType);
break;
}
@@ -1770,24 +1770,24 @@ Parser::ParsePostfixExpressionSuffix(Exp
// 'class' as if it were an identifier.
//
// This hack allows property access to the 'class' method because it is
- // such a common method name. For other C++ keywords that are
+ // such a common method name. For other C++ keywords that are
// Objective-C method names, one must use the message send syntax.
IdentifierInfo *Id = Tok.getIdentifierInfo();
SourceLocation Loc = ConsumeToken();
Name.setIdentifier(Id, Loc);
- } else if (ParseUnqualifiedId(SS,
- /*EnteringContext=*/false,
+ } else if (ParseUnqualifiedId(SS,
+ /*EnteringContext=*/false,
/*AllowDestructorName=*/true,
/*AllowConstructorName=*/
- getLangOpts().MicrosoftExt,
+ getLangOpts().MicrosoftExt,
/*AllowDeductionGuide=*/false,
ObjectType, &TemplateKWLoc, Name)) {
(void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
}
-
+
if (!LHS.isInvalid())
- LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.get(), OpLoc,
+ LHS = Actions.ActOnMemberAccessExpr(getCurScope(), LHS.get(), OpLoc,
OpKind, SS, TemplateKWLoc, Name,
CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
: nullptr);
@@ -1882,7 +1882,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTra
ParenParseOption ExprType = CastExpr;
SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
- Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/,
+ Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/,
false, CastTy, RParenLoc);
CastRange = SourceRange(LParenLoc, RParenLoc);
@@ -1896,7 +1896,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTra
if (getLangOpts().CPlusPlus || OpTok.isNot(tok::kw_typeof)) {
// GNU typeof in C requires the expression to be parenthesized. Not so for
// sizeof/alignof or in C++. Therefore, the parenthesized expression is
- // the start of a unary-expression, but doesn't include any postfix
+ // the start of a unary-expression, but doesn't include any postfix
// pieces. Parse these now if present.
if (!Operand.isInvalid())
Operand = ParsePostfixExpressionSuffix(Operand.get());
@@ -1962,7 +1962,7 @@ ExprResult Parser::ParseUnaryExprOrTypeT
} else {
Diag(Tok, diag::err_sizeof_parameter_pack);
}
-
+
if (!Name)
return ExprError();
@@ -1971,7 +1971,7 @@ ExprResult Parser::ParseUnaryExprOrTypeT
Sema::ReuseLambdaContextDecl);
return Actions.ActOnSizeofParameterPackExpr(getCurScope(),
- OpTok.getLocation(),
+ OpTok.getLocation(),
*Name, NameLoc,
RParenLoc);
}
@@ -2206,15 +2206,15 @@ ExprResult Parser::ParseBuiltinPrimaryEx
TypeResult DestTy = ParseTypeName();
if (DestTy.isInvalid())
return ExprError();
-
+
// Attempt to consume the r-paren.
if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected) << tok::r_paren;
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
}
-
- Res = Actions.ActOnAsTypeExpr(Expr.get(), DestTy.get(), StartLoc,
+
+ Res = Actions.ActOnAsTypeExpr(Expr.get(), DestTy.get(), StartLoc,
ConsumeParen());
break;
}
@@ -2235,15 +2235,15 @@ ExprResult Parser::ParseBuiltinPrimaryEx
TypeResult DestTy = ParseTypeName();
if (DestTy.isInvalid())
return ExprError();
-
+
// Attempt to consume the r-paren.
if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected) << tok::r_paren;
SkipUntil(tok::r_paren, StopAtSemi);
return ExprError();
}
-
- Res = Actions.ActOnConvertVectorExpr(Expr.get(), DestTy.get(), StartLoc,
+
+ Res = Actions.ActOnConvertVectorExpr(Expr.get(), DestTy.get(), StartLoc,
ConsumeParen());
break;
}
@@ -2298,7 +2298,7 @@ Parser::ParseParenExpression(ParenParseO
CastTy = nullptr;
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteOrdinaryName(getCurScope(),
+ Actions.CodeCompleteOrdinaryName(getCurScope(),
ExprType >= CompoundLiteral? Sema::PCC_ParenthesizedExpression
: Sema::PCC_Expression);
cutOffParsing();
@@ -2322,7 +2322,7 @@ Parser::ParseParenExpression(ParenParseO
}
BridgeCast = false;
}
-
+
// None of these cases should fall through with an invalid Result
// unless they've already reported an error.
if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
@@ -2376,16 +2376,16 @@ Parser::ParseParenExpression(ParenParseO
<< FixItHint::CreateReplacement(BridgeKeywordLoc,
"__bridge_retained");
}
-
+
TypeResult Ty = ParseTypeName();
T.consumeClose();
ColonProtection.restore();
RParenLoc = T.getCloseLocation();
ExprResult SubExpr = ParseCastExpression(/*isUnaryExpression=*/false);
-
+
if (Ty.isInvalid() || SubExpr.isInvalid())
return ExprError();
-
+
return Actions.ActOnObjCBridgedCast(getCurScope(), OpenLoc, Kind,
BridgeKeywordLoc, Ty.get(),
RParenLoc, SubExpr.get());
@@ -2411,8 +2411,8 @@ Parser::ParseParenExpression(ParenParseO
ParseSpecifierQualifierList(DS);
Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext);
ParseDeclarator(DeclaratorInfo);
-
- // If our type is followed by an identifier and either ':' or ']', then
+
+ // If our type is followed by an identifier and either ':' or ']', then
// this is probably an Objective-C message send where the leading '[' is
// missing. Recover as if that were the case.
if (!DeclaratorInfo.isInvalidType() && Tok.is(tok::identifier) &&
@@ -2423,10 +2423,10 @@ Parser::ParseParenExpression(ParenParseO
InMessageExpressionRAIIObject InMessage(*this, false);
Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
}
- Result = ParseObjCMessageExpressionBody(SourceLocation(),
- SourceLocation(),
+ Result = ParseObjCMessageExpressionBody(SourceLocation(),
+ SourceLocation(),
Ty.get(), nullptr);
- } else {
+ } else {
// Match the ')'.
T.consumeClose();
ColonProtection.restore();
@@ -2503,7 +2503,7 @@ Parser::ParseParenExpression(ParenParseO
// Reject the cast of super idiom in ObjC.
if (Tok.is(tok::identifier) && getLangOpts().ObjC1 &&
- Tok.getIdentifierInfo() == Ident_super &&
+ Tok.getIdentifierInfo() == Ident_super &&
getCurScope()->isInObjcMethodScope() &&
GetLookAheadToken(1).isNot(tok::period)) {
Diag(Tok.getLocation(), diag::err_illegal_super_cast)
@@ -2518,7 +2518,7 @@ Parser::ParseParenExpression(ParenParseO
/*isTypeCast=*/IsTypeCast);
if (!Result.isInvalid()) {
Result = Actions.ActOnCastExpr(getCurScope(), OpenLoc,
- DeclaratorInfo, CastTy,
+ DeclaratorInfo, CastTy,
RParenLoc, Result.get());
}
return Result;
@@ -2722,7 +2722,7 @@ ExprResult Parser::ParseGenericSelection
if (T.getCloseLocation().isInvalid())
return ExprError();
- return Actions.ActOnGenericSelectionExpr(KeyLoc, DefaultLoc,
+ return Actions.ActOnGenericSelectionExpr(KeyLoc, DefaultLoc,
T.getCloseLocation(),
ControllingExpr.get(),
Types, Exprs);
@@ -2825,7 +2825,7 @@ bool Parser::ParseExpressionList(SmallVe
Expr = ParseAssignmentExpression();
if (Tok.is(tok::ellipsis))
- Expr = Actions.ActOnPackExpansion(Expr.get(), ConsumeToken());
+ Expr = Actions.ActOnPackExpansion(Expr.get(), ConsumeToken());
if (Expr.isInvalid()) {
SkipUntil(tok::comma, tok::r_paren, StopBeforeMatch);
SawError = true;
@@ -2892,7 +2892,7 @@ void Parser::ParseBlockId(SourceLocation
Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Type);
return cutOffParsing();
}
-
+
// Parse the specifier-qualifier-list piece.
DeclSpec DS(AttrFactory);
ParseSpecifierQualifierList(DS);
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Mon Jul 30 12:24:48 2018
@@ -306,13 +306,13 @@ bool Parser::ParseOptionalCXXScopeSpecif
}
// If the next token is not '<', we have a qualified-id that refers
- // to a template name, such as T::template apply, but is not a
+ // to a template name, such as T::template apply, but is not a
// template-id.
if (Tok.isNot(tok::less)) {
TPA.Revert();
break;
- }
-
+ }
+
// Commit to parsing the template-id.
TPA.Commit();
TemplateTy Template;
@@ -366,7 +366,7 @@ bool Parser::ParseOptionalCXXScopeSpecif
TemplateId->RAngleLoc,
CCLoc,
EnteringContext)) {
- SourceLocation StartLoc
+ SourceLocation StartLoc
= SS.getBeginLoc().isValid()? SS.getBeginLoc()
: TemplateId->TemplateNameLoc;
SS.SetInvalid(SourceRange(StartLoc, CCLoc));
@@ -480,7 +480,7 @@ bool Parser::ParseOptionalCXXScopeSpecif
UnqualifiedId TemplateName;
TemplateName.setIdentifier(&II, Tok.getLocation());
bool MemberOfUnknownSpecialization;
- if (TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
+ if (TemplateNameKind TNK = Actions.isTemplateName(getCurScope(), SS,
/*hasTemplateKeyword=*/false,
TemplateName,
ObjectType,
@@ -500,16 +500,16 @@ bool Parser::ParseOptionalCXXScopeSpecif
continue;
}
- if (MemberOfUnknownSpecialization && (ObjectType || SS.isSet()) &&
+ if (MemberOfUnknownSpecialization && (ObjectType || SS.isSet()) &&
(IsTypename || IsTemplateArgumentList(1))) {
- // We have something like t::getAs<T>, where getAs is a
+ // We have something like t::getAs<T>, where getAs is a
// member of an unknown specialization. However, this will only
// parse correctly as a template, so suggest the keyword 'template'
// before 'getAs' and treat this as a dependent template name.
unsigned DiagID = diag::err_missing_dependent_template_keyword;
if (getLangOpts().MicrosoftExt)
DiagID = diag::warn_missing_dependent_template_keyword;
-
+
Diag(Tok.getLocation(), DiagID)
<< II.getName()
<< FixItHint::CreateInsertion(Tok.getLocation(), "template ");
@@ -524,9 +524,9 @@ bool Parser::ParseOptionalCXXScopeSpecif
return true;
}
else
- return true;
-
- continue;
+ return true;
+
+ continue;
}
}
@@ -719,7 +719,7 @@ ExprResult Parser::TryParseLambdaExpress
if (Next.is(tok::identifier) && After.is(tok::identifier)) {
return ExprEmpty();
}
-
+
// Here, we're stuck: lambda introducers and Objective-C message sends are
// unambiguous, but it requires arbitrary lookhead. [a,b,c,d,e,f,g] is a
// lambda, and [a,b,c,d,e,f,g h] is a Objective-C message send. Instead of
@@ -776,7 +776,7 @@ Optional<unsigned> Parser::ParseLambdaIn
if (Tok.is(tok::code_completion) &&
!(getLangOpts().ObjC1 && Intro.Default == LCD_None &&
!Intro.Captures.empty())) {
- Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
+ Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
/*AfterAmpersand=*/false);
cutOffParsing();
break;
@@ -793,14 +793,14 @@ Optional<unsigned> Parser::ParseLambdaIn
if (getLangOpts().ObjC1 && first)
Actions.CodeCompleteObjCMessageReceiver(getCurScope());
else
- Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
+ Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
/*AfterAmpersand=*/false);
cutOffParsing();
break;
}
first = false;
-
+
// Parse capture.
LambdaCaptureKind Kind = LCK_ByCopy;
LambdaCaptureInitKind InitKind = LambdaCaptureInitKind::NoInit;
@@ -811,10 +811,10 @@ Optional<unsigned> Parser::ParseLambdaIn
SourceLocation LocStart = Tok.getLocation();
if (Tok.is(tok::star)) {
- Loc = ConsumeToken();
+ Loc = ConsumeToken();
if (Tok.is(tok::kw_this)) {
- ConsumeToken();
- Kind = LCK_StarThis;
+ ConsumeToken();
+ Kind = LCK_StarThis;
} else {
return DiagResult(diag::err_expected_star_this_capture);
}
@@ -827,7 +827,7 @@ Optional<unsigned> Parser::ParseLambdaIn
ConsumeToken();
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
+ Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
/*AfterAmpersand=*/true);
cutOffParsing();
break;
@@ -1090,7 +1090,7 @@ ExprResult Parser::ParseLambdaExpression
PrettyStackTraceLoc CrashInfo(PP.getSourceManager(), LambdaBeginLoc,
"lambda expression parsing");
-
+
// FIXME: Call into Actions to add any init-capture declarations to the
// scope while parsing the lambda-declarator and compound-statement.
@@ -1135,13 +1135,13 @@ ExprResult Parser::ParseLambdaExpression
// Parse parameter-declaration-clause.
SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
SourceLocation EllipsisLoc;
-
+
if (Tok.isNot(tok::r_paren)) {
Actions.RecordParsingTemplateParameterDepth(TemplateParameterDepth);
ParseParameterDeclarationClause(D, Attr, ParamInfo, EllipsisLoc);
- // For a generic lambda, each 'auto' within the parameter declaration
+ // For a generic lambda, each 'auto' within the parameter declaration
// clause creates a template type parameter, so increment the depth.
- if (Actions.getCurGenericLambda())
+ if (Actions.getCurGenericLambda())
++CurTemplateDepthTracker;
}
T.consumeClose();
@@ -1161,7 +1161,7 @@ ExprResult Parser::ParseLambdaExpression
SourceLocation ConstexprLoc;
tryConsumeMutableOrConstexprToken(*this, MutableLoc, ConstexprLoc,
DeclEndLoc);
-
+
addConstexprToLambdaDeclSpecifier(*this, ConstexprLoc, DS);
// Parse exception-specification[opt].
@@ -1376,7 +1376,7 @@ ExprResult Parser::ParseCXXCasts() {
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
LAngleBracketLoc, DeclaratorInfo,
RAngleBracketLoc,
- T.getOpenLocation(), Result.get(),
+ T.getOpenLocation(), Result.get(),
T.getCloseLocation());
return Result;
@@ -1477,7 +1477,7 @@ ExprResult Parser::ParseCXXUuidof() {
return ExprError();
Result = Actions.ActOnCXXUuidof(OpLoc, T.getOpenLocation(), /*isType=*/true,
- Ty.get().getAsOpaquePtr(),
+ Ty.get().getAsOpaquePtr(),
T.getCloseLocation());
} else {
EnterExpressionEvaluationContext Unevaluated(
@@ -1507,13 +1507,13 @@ ExprResult Parser::ParseCXXUuidof() {
/// postfix-expression . pseudo-destructor-name
/// postfix-expression -> pseudo-destructor-name
///
-/// pseudo-destructor-name:
-/// ::[opt] nested-name-specifier[opt] type-name :: ~type-name
-/// ::[opt] nested-name-specifier template simple-template-id ::
-/// ~type-name
+/// pseudo-destructor-name:
+/// ::[opt] nested-name-specifier[opt] type-name :: ~type-name
+/// ::[opt] nested-name-specifier template simple-template-id ::
+/// ~type-name
/// ::[opt] nested-name-specifier[opt] ~type-name
-///
-ExprResult
+///
+ExprResult
Parser::ParseCXXPseudoDestructor(Expr *Base, SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@@ -1562,13 +1562,13 @@ Parser::ParseCXXPseudoDestructor(Expr *B
Diag(Tok, diag::err_destructor_tilde_identifier);
return ExprError();
}
-
+
// Parse the second type.
UnqualifiedId SecondTypeName;
IdentifierInfo *Name = Tok.getIdentifierInfo();
SourceLocation NameLoc = ConsumeToken();
SecondTypeName.setIdentifier(Name, NameLoc);
-
+
// If there is a '<', the second type name is a template-id. Parse
// it as such.
if (Tok.is(tok::less) &&
@@ -1821,7 +1821,7 @@ Sema::ConditionResult Parser::ParseCXXCo
MaybeParseGNUAttributes(DeclaratorInfo);
// Type-check the declaration itself.
- DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
+ DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
DeclaratorInfo);
if (Dcl.isInvalid())
return Sema::ConditionError();
@@ -1909,10 +1909,10 @@ void Parser::ParseCXXSimpleTypeSpecifier
getTypeAnnotation(Tok), Policy);
else
DS.SetTypeSpecError();
-
+
DS.SetRangeEnd(Tok.getAnnotationEndLoc());
ConsumeAnnotationToken();
-
+
DS.Finish(Actions, Policy);
return;
}
@@ -2009,7 +2009,7 @@ bool Parser::ParseCXXTypeSpecifierSeq(De
}
/// Finish parsing a C++ unqualified-id that is a template-id of
-/// some form.
+/// some form.
///
/// This routine is invoked when a '<' is encountered after an identifier or
/// operator-function-id is parsed by \c ParseUnqualifiedId() to determine
@@ -2023,10 +2023,10 @@ bool Parser::ParseCXXTypeSpecifierSeq(De
/// \param Name for constructor and destructor names, this is the actual
/// identifier that may be a template-name.
///
-/// \param NameLoc the location of the class-name in a constructor or
+/// \param NameLoc the location of the class-name in a constructor or
/// destructor.
///
-/// \param EnteringContext whether we're entering the scope of the
+/// \param EnteringContext whether we're entering the scope of the
/// nested-name-specifier.
///
/// \param ObjectType if this unqualified-id occurs within a member access
@@ -2035,9 +2035,9 @@ bool Parser::ParseCXXTypeSpecifierSeq(De
/// \param Id as input, describes the template-name or operator-function-id
/// that precedes the '<'. If template arguments were parsed successfully,
/// will be updated with the template-id.
-///
+///
/// \param AssumeTemplateId When true, this routine will assume that the name
-/// refers to a template without performing name lookup to verify.
+/// refers to a template without performing name lookup to verify.
///
/// \returns true if a parse error occurred, false otherwise.
bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
@@ -2070,10 +2070,10 @@ bool Parser::ParseUnqualifiedIdTemplateI
TemplateKWLoc.isValid(), Id,
ObjectType, EnteringContext, Template,
MemberOfUnknownSpecialization);
-
+
if (TNK == TNK_Non_template && MemberOfUnknownSpecialization &&
ObjectType && IsTemplateArgumentList()) {
- // We have something like t->getAs<T>(), where getAs is a
+ // We have something like t->getAs<T>(), where getAs is a
// member of an unknown specialization. However, this will only
// parse correctly as a template, so suggest the keyword 'template'
// before 'getAs' and treat this as a dependent template name.
@@ -2094,22 +2094,22 @@ bool Parser::ParseUnqualifiedIdTemplateI
getCurScope(), SS, TemplateKWLoc, Id, ObjectType, EnteringContext,
Template, /*AllowInjectedClassName*/ true);
if (TNK == TNK_Non_template)
- return true;
+ return true;
}
}
break;
-
+
case UnqualifiedIdKind::IK_ConstructorName: {
UnqualifiedId TemplateName;
bool MemberOfUnknownSpecialization;
TemplateName.setIdentifier(Name, NameLoc);
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateKWLoc.isValid(),
- TemplateName, ObjectType,
+ TemplateName, ObjectType,
EnteringContext, Template,
MemberOfUnknownSpecialization);
break;
}
-
+
case UnqualifiedIdKind::IK_DestructorName: {
UnqualifiedId TemplateName;
bool MemberOfUnknownSpecialization;
@@ -2122,26 +2122,26 @@ bool Parser::ParseUnqualifiedIdTemplateI
return true;
} else {
TNK = Actions.isTemplateName(getCurScope(), SS, TemplateKWLoc.isValid(),
- TemplateName, ObjectType,
+ TemplateName, ObjectType,
EnteringContext, Template,
MemberOfUnknownSpecialization);
-
+
if (TNK == TNK_Non_template && !Id.DestructorName.get()) {
Diag(NameLoc, diag::err_destructor_template_id)
<< Name << SS.getRange();
- return true;
+ return true;
}
}
break;
}
-
+
default:
return false;
}
-
+
if (TNK == TNK_Non_template)
return false;
-
+
// Parse the enclosed template argument list.
SourceLocation LAngleLoc, RAngleLoc;
TemplateArgList TemplateArgs;
@@ -2183,12 +2183,12 @@ bool Parser::ParseUnqualifiedIdTemplateI
/*IsCtorOrDtorName=*/true);
if (Type.isInvalid())
return true;
-
+
if (Id.getKind() == UnqualifiedIdKind::IK_ConstructorName)
Id.setConstructorName(Type.get(), NameLoc, RAngleLoc);
else
Id.setDestructorName(Id.StartLocation, Type.get(), RAngleLoc);
-
+
return false;
}
@@ -2223,7 +2223,7 @@ bool Parser::ParseUnqualifiedIdTemplateI
/// \param SS The nested-name-specifier that preceded this unqualified-id. If
/// non-empty, then we are parsing the unqualified-id of a qualified-id.
///
-/// \param EnteringContext whether we are entering the scope of the
+/// \param EnteringContext whether we are entering the scope of the
/// nested-name-specifier.
///
/// \param ObjectType if this unqualified-id occurs within a member access
@@ -2236,10 +2236,10 @@ bool Parser::ParseUnqualifiedIdOperator(
ParsedType ObjectType,
UnqualifiedId &Result) {
assert(Tok.is(tok::kw_operator) && "Expected 'operator' keyword");
-
+
// Consume the 'operator' keyword.
SourceLocation KeywordLoc = ConsumeToken();
-
+
// Determine what kind of operator name we have.
unsigned SymbolIdx = 0;
SourceLocation SymbolLocations[3];
@@ -2259,7 +2259,7 @@ bool Parser::ParseUnqualifiedIdOperator(
T.consumeClose();
if (T.getCloseLocation().isInvalid())
return true;
-
+
SymbolLocations[SymbolIdx++] = T.getOpenLocation();
SymbolLocations[SymbolIdx++] = T.getCloseLocation();
Op = isNew? OO_Array_New : OO_Array_Delete;
@@ -2268,7 +2268,7 @@ bool Parser::ParseUnqualifiedIdOperator(
}
break;
}
-
+
#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
case tok::Token: \
SymbolLocations[SymbolIdx++] = ConsumeToken(); \
@@ -2276,7 +2276,7 @@ bool Parser::ParseUnqualifiedIdOperator(
break;
#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly)
#include "clang/Basic/OperatorKinds.def"
-
+
case tok::l_paren: {
// Consume the '(' and ')'.
BalancedDelimiterTracker T(*this, tok::l_paren);
@@ -2284,13 +2284,13 @@ bool Parser::ParseUnqualifiedIdOperator(
T.consumeClose();
if (T.getCloseLocation().isInvalid())
return true;
-
+
SymbolLocations[SymbolIdx++] = T.getOpenLocation();
SymbolLocations[SymbolIdx++] = T.getCloseLocation();
Op = OO_Call;
break;
}
-
+
case tok::l_square: {
// Consume the '[' and ']'.
BalancedDelimiterTracker T(*this, tok::l_square);
@@ -2298,25 +2298,25 @@ bool Parser::ParseUnqualifiedIdOperator(
T.consumeClose();
if (T.getCloseLocation().isInvalid())
return true;
-
+
SymbolLocations[SymbolIdx++] = T.getOpenLocation();
SymbolLocations[SymbolIdx++] = T.getCloseLocation();
Op = OO_Subscript;
break;
}
-
+
case tok::code_completion: {
// Code completion for the operator name.
Actions.CodeCompleteOperatorName(getCurScope());
- cutOffParsing();
+ cutOffParsing();
// Don't try to parse any further.
return true;
}
-
+
default:
break;
}
-
+
if (Op != OO_None) {
// We have parsed an operator-function-id.
Result.setOperatorFunctionId(KeywordLoc, Op, SymbolLocations);
@@ -2409,12 +2409,12 @@ bool Parser::ParseUnqualifiedIdOperator(
//
// conversion-declarator:
// ptr-operator conversion-declarator[opt]
-
+
// Parse the type-specifier-seq.
DeclSpec DS(AttrFactory);
if (ParseCXXTypeSpecifierSeq(DS)) // FIXME: ObjectType?
return true;
-
+
// Parse the conversion-declarator, which is merely a sequence of
// ptr-operators.
Declarator D(DS, DeclaratorContext::ConversionIdContext);
@@ -2424,11 +2424,11 @@ bool Parser::ParseUnqualifiedIdOperator(
TypeResult Ty = Actions.ActOnTypeName(getCurScope(), D);
if (Ty.isInvalid())
return true;
-
+
// Note that this is a conversion-function-id.
- Result.setConversionFunctionId(KeywordLoc, Ty.get(),
+ Result.setConversionFunctionId(KeywordLoc, Ty.get(),
D.getSourceRange().getEnd());
- return false;
+ return false;
}
/// Parse a C++ unqualified-id (or a C identifier), which describes the
@@ -2448,7 +2448,7 @@ bool Parser::ParseUnqualifiedIdOperator(
/// \param SS The nested-name-specifier that preceded this unqualified-id. If
/// non-empty, then we are parsing the unqualified-id of a qualified-id.
///
-/// \param EnteringContext whether we are entering the scope of the
+/// \param EnteringContext whether we are entering the scope of the
/// nested-name-specifier.
///
/// \param AllowDestructorName whether we allow parsing of a destructor name.
@@ -2503,7 +2503,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
}
ParsedTemplateTy TemplateName;
- if (AllowConstructorName &&
+ if (AllowConstructorName &&
Actions.isCurrentClassName(*Id, getCurScope(), &SS)) {
// We have parsed a constructor name.
ParsedType Ty = Actions.getConstructorName(*Id, IdLoc, getCurScope(), SS,
@@ -2519,7 +2519,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
Result.setDeductionGuideName(TemplateName, IdLoc);
} else {
// We have parsed an identifier.
- Result.setIdentifier(Id, IdLoc);
+ Result.setIdentifier(Id, IdLoc);
}
// If the next token is a '<', we may have a template.
@@ -2537,13 +2537,13 @@ bool Parser::ParseUnqualifiedId(CXXScope
return false;
}
-
+
// unqualified-id:
// template-id (already parsed and annotated)
if (Tok.is(tok::annot_template_id)) {
TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
- // If the template-name names the current class, then this is a constructor
+ // If the template-name names the current class, then this is a constructor
if (AllowConstructorName && TemplateId->Name &&
Actions.isCurrentClassName(*TemplateId->Name, getCurScope(), &SS)) {
if (SS.isSet()) {
@@ -2551,7 +2551,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
// is taken as the constructor name where a constructor can be
// declared. Thus, the template arguments are extraneous, so
// complain about them and remove them entirely.
- Diag(TemplateId->TemplateNameLoc,
+ Diag(TemplateId->TemplateNameLoc,
diag::err_out_of_line_constructor_template_id)
<< TemplateId->Name
<< FixItHint::CreateRemoval(
@@ -2586,17 +2586,17 @@ bool Parser::ParseUnqualifiedId(CXXScope
ConsumeAnnotationToken();
return false;
}
-
+
// unqualified-id:
// operator-function-id
// conversion-function-id
if (Tok.is(tok::kw_operator)) {
if (ParseUnqualifiedIdOperator(SS, EnteringContext, ObjectType, Result))
return true;
-
+
// If we have an operator-function-id or a literal-operator-id and the next
// token is a '<', we may have a
- //
+ //
// template-id:
// operator-function-id < template-argument-list[opt] >
TemplateTy Template;
@@ -2616,14 +2616,14 @@ bool Parser::ParseUnqualifiedId(CXXScope
return false;
}
-
- if (getLangOpts().CPlusPlus &&
+
+ if (getLangOpts().CPlusPlus &&
(AllowDestructorName || SS.isSet()) && Tok.is(tok::tilde)) {
// C++ [expr.unary.op]p10:
- // There is an ambiguity in the unary-expression ~X(), where X is a
- // class-name. The ambiguity is resolved in favor of treating ~ as a
+ // There is an ambiguity in the unary-expression ~X(), where X is a
+ // class-name. The ambiguity is resolved in favor of treating ~ as a
// unary complement rather than treating ~X as referring to a destructor.
-
+
// Parse the '~'.
SourceLocation TildeLoc = ConsumeToken();
@@ -2637,7 +2637,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
}
return true;
}
-
+
// Parse the class-name.
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_destructor_tilde_identifier);
@@ -2688,7 +2688,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
}
// Note that this is a destructor name.
- ParsedType Ty = Actions.getDestructorName(TildeLoc, *ClassName,
+ ParsedType Ty = Actions.getDestructorName(TildeLoc, *ClassName,
ClassNameLoc, getCurScope(),
SS, ObjectType,
EnteringContext);
@@ -2698,7 +2698,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
Result.setDestructorName(TildeLoc, Ty, ClassNameLoc);
return false;
}
-
+
Diag(Tok, diag::err_expected_unqualified_id)
<< getLangOpts().CPlusPlus;
return true;
@@ -3002,7 +3002,7 @@ static unsigned TypeTraitArity(tok::Toke
}
}
-/// Parse the built-in type-trait pseudo-functions that allow
+/// Parse the built-in type-trait pseudo-functions that allow
/// implementation of the TR1/C++11 type traits templates.
///
/// primary-expression:
@@ -3018,7 +3018,7 @@ ExprResult Parser::ParseTypeTrait() {
unsigned Arity = TypeTraitArity(Kind);
SourceLocation Loc = ConsumeToken();
-
+
BalancedDelimiterTracker Parens(*this, tok::l_paren);
if (Parens.expectAndConsume())
return ExprError();
@@ -3040,7 +3040,7 @@ ExprResult Parser::ParseTypeTrait() {
return ExprError();
}
}
-
+
// Add this type to the list of arguments.
Args.push_back(Ty.get());
} while (TryConsumeToken(tok::comma));
@@ -3266,7 +3266,7 @@ Parser::ParseCXXAmbiguousParenExpression
ExprType = SimpleExpr;
Result = ParseExpression();
if (!Result.isInvalid() && Tok.is(tok::r_paren))
- Result = Actions.ActOnParenExpr(Tracker.getOpenLocation(),
+ Result = Actions.ActOnParenExpr(Tracker.getOpenLocation(),
Tok.getLocation(), Result.get());
// Match the ')'.
Modified: cfe/trunk/lib/Parse/ParseInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseInit.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseInit.cpp (original)
+++ cfe/trunk/lib/Parse/ParseInit.cpp Mon Jul 30 12:24:48 2018
@@ -20,21 +20,21 @@
using namespace clang;
-/// MayBeDesignationStart - Return true if the current token might be the start
-/// of a designator. If we can tell it is impossible that it is a designator,
+/// MayBeDesignationStart - Return true if the current token might be the start
+/// of a designator. If we can tell it is impossible that it is a designator,
/// return false.
bool Parser::MayBeDesignationStart() {
switch (Tok.getKind()) {
- default:
+ default:
return false;
-
+
case tok::period: // designator: '.' identifier
return true;
-
+
case tok::l_square: { // designator: array-designator
if (!PP.getLangOpts().CPlusPlus11)
return true;
-
+
// C++11 lambda expressions and C99 designators can be ambiguous all the
// way through the closing ']' and to the next character. Handle the easy
// cases here, and fall back to tentative parsing if those fail.
@@ -43,28 +43,28 @@ bool Parser::MayBeDesignationStart() {
case tok::r_square:
// Definitely starts a lambda expression.
return false;
-
+
case tok::amp:
case tok::kw_this:
case tok::identifier:
// We have to do additional analysis, because these could be the
// start of a constant expression or a lambda capture list.
break;
-
+
default:
- // Anything not mentioned above cannot occur following a '[' in a
+ // Anything not mentioned above cannot occur following a '[' in a
// lambda expression.
- return true;
+ return true;
}
-
+
// Handle the complicated case below.
- break;
+ break;
}
case tok::identifier: // designation: identifier ':'
return PP.LookAhead(0).is(tok::colon);
}
-
- // Parse up to (at most) the token after the closing ']' to determine
+
+ // Parse up to (at most) the token after the closing ']' to determine
// whether this is a C99 designator or a lambda.
TentativeParsingAction Tentative(*this);
@@ -198,7 +198,7 @@ ExprResult Parser::ParseInitializerWithP
// it will be rejected because a constant-expression cannot begin with a
// lambda-expression.
InMessageExpressionRAIIObject InMessage(*this, true);
-
+
BalancedDelimiterTracker T(*this, tok::l_square);
T.consumeOpen();
SourceLocation StartLoc = T.getOpenLocation();
@@ -212,7 +212,7 @@ ExprResult Parser::ParseInitializerWithP
if (getLangOpts().ObjC1 && getLangOpts().CPlusPlus) {
// Send to 'super'.
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
- NextToken().isNot(tok::period) &&
+ NextToken().isNot(tok::period) &&
getCurScope()->isInObjcMethodScope()) {
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
return ParseAssignmentExprWithObjCMessageExprStart(
@@ -226,13 +226,13 @@ ExprResult Parser::ParseInitializerWithP
SkipUntil(tok::r_square, StopAtSemi);
return ExprError();
}
-
+
// If the receiver was a type, we have a class message; parse
// the rest of it.
if (!IsExpr) {
CheckArrayDesignatorSyntax(*this, StartLoc, Desig);
- return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
- SourceLocation(),
+ return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
+ SourceLocation(),
ParsedType::getFromOpaquePtr(TypeOrExpr),
nullptr);
}
@@ -281,8 +281,8 @@ ExprResult Parser::ParseInitializerWithP
}
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
- SourceLocation(),
- ReceiverType,
+ SourceLocation(),
+ ReceiverType,
nullptr);
case Sema::ObjCInstanceMessage:
@@ -387,7 +387,7 @@ ExprResult Parser::ParseInitializerWithP
///
ExprResult Parser::ParseBraceInitializer() {
InMessageExpressionRAIIObject InMessage(*this, false);
-
+
BalancedDelimiterTracker T(*this, tok::l_brace);
T.consumeOpen();
SourceLocation LBraceLoc = T.getOpenLocation();
@@ -485,7 +485,7 @@ bool Parser::ParseMicrosoftIfExistsBrace
IfExistsCondition Result;
if (ParseMicrosoftIfExistsCondition(Result))
return false;
-
+
BalancedDelimiterTracker Braces(*this, tok::l_brace);
if (Braces.consumeOpen()) {
Diag(Tok, diag::err_expected) << tok::l_brace;
@@ -496,7 +496,7 @@ bool Parser::ParseMicrosoftIfExistsBrace
case IEB_Parse:
// Parse the declarations below.
break;
-
+
case IEB_Dependent:
Diag(Result.KeywordLoc, diag::warn_microsoft_dependent_exists)
<< Result.IsIfExists;
@@ -520,7 +520,7 @@ bool Parser::ParseMicrosoftIfExistsBrace
if (Tok.is(tok::ellipsis))
SubElt = Actions.ActOnPackExpansion(SubElt.get(), ConsumeToken());
-
+
// If we couldn't parse the subelement, bail out.
if (!SubElt.isInvalid())
InitExprs.push_back(SubElt.get());
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Jul 30 12:24:48 2018
@@ -247,7 +247,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.is(tok::l_paren) &&
!isKnownToBeTypeSpecifier(GetLookAheadToken(1))) { // we have a category.
-
+
BalancedDelimiterTracker T(*this, tok::l_paren);
T.consumeOpen();
@@ -258,7 +258,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
cutOffParsing();
return nullptr;
}
-
+
// For ObjC2, the category name is optional (not an error).
if (Tok.is(tok::identifier)) {
categoryId = Tok.getIdentifierInfo();
@@ -269,11 +269,11 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
<< tok::identifier; // missing category name.
return nullptr;
}
-
+
T.consumeClose();
if (T.getCloseLocation().isInvalid())
return nullptr;
-
+
// Next, we need to check for any protocol references.
assert(LAngleLoc.isInvalid() && "Cannot have already parsed protocols");
SmallVector<Decl *, 8> ProtocolRefs;
@@ -291,7 +291,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclar
if (Tok.is(tok::l_brace))
ParseObjCClassInstanceVariables(CategoryType, tok::objc_private, AtLoc);
-
+
ParseObjCInterfaceDeclList(tok::objc_not_keyword, CategoryType);
return CategoryType;
@@ -592,14 +592,14 @@ ObjCTypeParamList *Parser::parseObjCType
/// @required
/// @optional
///
-void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
+void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey,
Decl *CDecl) {
SmallVector<Decl *, 32> allMethods;
SmallVector<DeclGroupPtrTy, 8> allTUVariables;
tok::ObjCKeywordKind MethodImplKind = tok::objc_not_keyword;
SourceRange AtEnd;
-
+
while (1) {
// If this is a method prototype, parse it.
if (Tok.isOneOf(tok::minus, tok::plus)) {
@@ -618,8 +618,8 @@ void Parser::ParseObjCInterfaceDeclList(
}
if (Tok.is(tok::l_paren)) {
Diag(Tok, diag::err_expected_minus_or_plus);
- ParseObjCMethodDecl(Tok.getLocation(),
- tok::minus,
+ ParseObjCMethodDecl(Tok.getLocation(),
+ tok::minus,
MethodImplKind, false);
continue;
}
@@ -635,12 +635,12 @@ void Parser::ParseObjCInterfaceDeclList(
// Code completion within an Objective-C interface.
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteOrdinaryName(getCurScope(),
+ Actions.CodeCompleteOrdinaryName(getCurScope(),
CurParsedObjCImpl? Sema::PCC_ObjCImplementation
: Sema::PCC_ObjCInterface);
return cutOffParsing();
}
-
+
// If we don't have an @ directive, parse it as a function definition.
if (Tok.isNot(tok::at)) {
// The code below does not consume '}'s because it is afraid of eating the
@@ -685,7 +685,7 @@ void Parser::ParseObjCInterfaceDeclList(
// Skip until we see an '@' or '}' or ';'.
SkipUntil(tok::r_brace, tok::at, StopAtSemi);
break;
-
+
case tok::objc_implementation:
case tok::objc_interface:
Diag(AtLoc, diag::err_objc_missing_end)
@@ -694,7 +694,7 @@ void Parser::ParseObjCInterfaceDeclList(
<< (int) Actions.getObjCContainerKind();
ConsumeToken();
break;
-
+
case tok::objc_required:
case tok::objc_optional:
// This is only valid on protocols.
@@ -1021,7 +1021,7 @@ IdentifierInfo *Parser::ParseObjCSelecto
}
return nullptr;
}
-
+
case tok::identifier:
case tok::kw_asm:
case tok::kw_auto:
@@ -1134,11 +1134,11 @@ void Parser::ParseObjCTypeQualifierList(
while (1) {
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteObjCPassingType(getCurScope(), DS,
+ Actions.CodeCompleteObjCPassingType(getCurScope(), DS,
Context == DeclaratorContext::ObjCParameterContext);
return cutOffParsing();
}
-
+
if (Tok.isNot(tok::identifier))
return;
@@ -1160,17 +1160,17 @@ void Parser::ParseObjCTypeQualifierList(
case objc_bycopy: Qual = ObjCDeclSpec::DQ_Bycopy; break;
case objc_byref: Qual = ObjCDeclSpec::DQ_Byref; break;
- case objc_nonnull:
+ case objc_nonnull:
Qual = ObjCDeclSpec::DQ_CSNullability;
Nullability = NullabilityKind::NonNull;
break;
- case objc_nullable:
+ case objc_nullable:
Qual = ObjCDeclSpec::DQ_CSNullability;
Nullability = NullabilityKind::Nullable;
break;
- case objc_null_unspecified:
+ case objc_null_unspecified:
Qual = ObjCDeclSpec::DQ_CSNullability;
Nullability = NullabilityKind::Unspecified;
break;
@@ -1222,7 +1222,7 @@ static void takeDeclAttributes(ParsedAtt
/// '(' objc-type-qualifiers[opt] type-name ')'
/// '(' objc-type-qualifiers[opt] ')'
///
-ParsedType Parser::ParseObjCTypeName(ObjCDeclSpec &DS,
+ParsedType Parser::ParseObjCTypeName(ObjCDeclSpec &DS,
DeclaratorContext context,
ParsedAttributes *paramAttrs) {
assert(context == DeclaratorContext::ObjCParameterContext ||
@@ -1343,7 +1343,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
MaybeParseCXX11Attributes(methodAttrs);
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
+ Actions.CodeCompleteObjCMethodDecl(getCurScope(), mType == tok::minus,
ReturnType);
cutOffParsing();
return nullptr;
@@ -1409,7 +1409,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
// Code completion for the next piece of the selector.
if (Tok.is(tok::code_completion)) {
KeyIdents.push_back(SelIdent);
- Actions.CodeCompleteObjCMethodDeclSelector(getCurScope(),
+ Actions.CodeCompleteObjCMethodDeclSelector(getCurScope(),
mType == tok::minus,
/*AtParameterName=*/true,
ReturnType, KeyIdents);
@@ -1433,14 +1433,14 @@ Decl *Parser::ParseObjCMethodDecl(Source
// Code completion for the next piece of the selector.
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteObjCMethodDeclSelector(getCurScope(),
+ Actions.CodeCompleteObjCMethodDeclSelector(getCurScope(),
mType == tok::minus,
/*AtParameterName=*/false,
ReturnType, KeyIdents);
cutOffParsing();
return nullptr;
}
-
+
// Check for another keyword selector.
SelIdent = ParseObjCSelectorPiece(selLoc);
if (!SelIdent && Tok.isNot(tok::colon))
@@ -1478,7 +1478,7 @@ Decl *Parser::ParseObjCMethodDecl(Source
IdentifierInfo *ParmII = ParmDecl.getIdentifier();
Decl *Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDecl);
CParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmII,
- ParmDecl.getIdentifierLoc(),
+ ParmDecl.getIdentifierLoc(),
Param,
nullptr));
}
@@ -1614,7 +1614,7 @@ void Parser::parseObjCTypeArgsOrProtocol
// FIXME: Also include types here.
SmallVector<IdentifierLocPair, 4> identifierLocPairs;
for (unsigned i = 0, n = identifiers.size(); i != n; ++i) {
- identifierLocPairs.push_back(IdentifierLocPair(identifiers[i],
+ identifierLocPairs.push_back(IdentifierLocPair(identifiers[i],
identifierLocs[i]));
}
@@ -1800,10 +1800,10 @@ void Parser::parseObjCTypeArgsAndProtoco
<< SourceRange(protocolLAngleLoc, protocolRAngleLoc);
SkipUntil(tok::greater, tok::greatergreater, skipFlags);
} else {
- ParseObjCProtocolReferences(protocols, protocolLocs,
+ ParseObjCProtocolReferences(protocols, protocolLocs,
/*WarnOnDeclarations=*/false,
/*ForObjCContainer=*/false,
- protocolLAngleLoc, protocolRAngleLoc,
+ protocolLAngleLoc, protocolRAngleLoc,
consumeLastToken);
}
}
@@ -1857,7 +1857,7 @@ void Parser::HelperActionsForIvarDeclara
bool RBraceMissing) {
if (!RBraceMissing)
T.consumeClose();
-
+
Actions.ActOnObjCContainerStartDefinition(interfaceDecl);
Actions.ActOnLastBitfield(T.getCloseLocation(), AllIvarDecls);
Actions.ActOnObjCContainerFinishDefinition();
@@ -1893,7 +1893,7 @@ void Parser::ParseObjCClassInstanceVaria
SourceLocation atLoc) {
assert(Tok.is(tok::l_brace) && "expected {");
SmallVector<Decl *, 32> AllIvarDecls;
-
+
ParseScope ClassScope(this, Scope::DeclScope|Scope::ClassScope);
ObjCDeclContextSwitch ObjCDC(*this);
@@ -1915,7 +1915,7 @@ void Parser::ParseObjCClassInstanceVaria
Actions.CodeCompleteObjCAtVisibility(getCurScope());
return cutOffParsing();
}
-
+
switch (Tok.getObjCKeywordID()) {
case tok::objc_private:
case tok::objc_public:
@@ -1934,7 +1934,7 @@ void Parser::ParseObjCClassInstanceVaria
HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
T, AllIvarDecls, true);
return;
-
+
default:
Diag(Tok, diag::err_objc_illegal_visibility_spec);
continue;
@@ -1942,7 +1942,7 @@ void Parser::ParseObjCClassInstanceVaria
}
if (Tok.is(tok::code_completion)) {
- Actions.CodeCompleteOrdinaryName(getCurScope(),
+ Actions.CodeCompleteOrdinaryName(getCurScope(),
Sema::PCC_ObjCInstanceVariableList);
return cutOffParsing();
}
@@ -1992,7 +1992,7 @@ void Parser::ParseObjCClassInstanceVaria
/// "\@protocol identifier ;" should be resolved as "\@protocol
/// identifier-list ;": objc-interface-decl-list may not start with a
/// semicolon in the first alternative if objc-protocol-refs are omitted.
-Parser::DeclGroupPtrTy
+Parser::DeclGroupPtrTy
Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
ParsedAttributes &attrs) {
assert(Tok.isObjCAtKeyword(tok::objc_protocol) &&
@@ -2125,7 +2125,7 @@ Parser::ParseObjCAtImplementationDeclara
cutOffParsing();
return nullptr;
}
-
+
if (Tok.is(tok::identifier)) {
categoryId = Tok.getIdentifierInfo();
categoryLoc = ConsumeToken();
@@ -2145,7 +2145,7 @@ Parser::ParseObjCAtImplementationDeclara
SourceLocation protocolLAngleLoc, protocolRAngleLoc;
SmallVector<Decl *, 4> protocols;
SmallVector<SourceLocation, 4> protocolLocs;
- (void)ParseObjCProtocolReferences(protocols, protocolLocs,
+ (void)ParseObjCProtocolReferences(protocols, protocolLocs,
/*warnOnIncompleteProtocols=*/false,
/*ForObjCContainer=*/false,
protocolLAngleLoc, protocolRAngleLoc,
@@ -2169,7 +2169,7 @@ Parser::ParseObjCAtImplementationDeclara
ObjCImpDecl = Actions.ActOnStartClassImplementation(
AtLoc, nameId, nameLoc,
superClassId, superClassLoc);
-
+
if (Tok.is(tok::l_brace)) // we have ivars
ParseObjCClassInstanceVariables(ObjCImpDecl, tok::objc_private, AtLoc);
else if (Tok.is(tok::less)) { // we have illegal '<' try to recover
@@ -2178,7 +2178,7 @@ Parser::ParseObjCAtImplementationDeclara
SourceLocation protocolLAngleLoc, protocolRAngleLoc;
SmallVector<Decl *, 4> protocols;
SmallVector<SourceLocation, 4> protocolLocs;
- (void)ParseObjCProtocolReferences(protocols, protocolLocs,
+ (void)ParseObjCProtocolReferences(protocols, protocolLocs,
/*warnOnIncompleteProtocols=*/false,
/*ForObjCContainer=*/false,
protocolLAngleLoc, protocolRAngleLoc,
@@ -2235,16 +2235,16 @@ void Parser::ObjCImplParsingDataRAII::fi
assert(!Finished);
P.Actions.DefaultSynthesizeProperties(P.getCurScope(), Dcl, AtEnd.getBegin());
for (size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
- P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
+ P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
true/*Methods*/);
P.Actions.ActOnAtEnd(P.getCurScope(), AtEnd);
if (HasCFunction)
for (size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
- P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
+ P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
false/*c-functions*/);
-
+
/// Clear and free the cached objc methods.
for (LateParsedObjCMethodContainer::iterator
I = LateParsedObjCMethods.begin(),
@@ -2297,7 +2297,7 @@ Decl *Parser::ParseObjCPropertySynthesiz
cutOffParsing();
return nullptr;
}
-
+
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_synthesized_property_name);
SkipUntil(tok::semi);
@@ -2380,7 +2380,7 @@ Decl *Parser::ParseObjCPropertyDynamic(S
SkipUntil(tok::semi);
return nullptr;
}
-
+
IdentifierInfo *propertyId = Tok.getIdentifierInfo();
SourceLocation propertyLoc = ConsumeToken(); // consume property name
Actions.ActOnPropertyImplDecl(
@@ -2538,14 +2538,14 @@ StmtResult Parser::ParseObjCTryStmt(Sour
Diag(Tok, diag::err_expected) << tok::l_brace;
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
-
+
StmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
- RParenLoc,
- FirstPart,
+ RParenLoc,
+ FirstPart,
CatchBody.get());
if (!Catch.isInvalid())
CatchStmts.push_back(Catch.get());
-
+
} else {
Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
<< "@catch clause";
@@ -2588,8 +2588,8 @@ StmtResult Parser::ParseObjCTryStmt(Sour
Diag(atLoc, diag::err_missing_catch_finally);
return StmtError();
}
-
- return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.get(),
+
+ return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.get(),
CatchStmts,
FinallyStmt.get());
}
@@ -2613,11 +2613,11 @@ Parser::ParseObjCAutoreleasePoolStmt(Sou
BodyScope.Exit();
if (AutoreleasePoolBody.isInvalid())
AutoreleasePoolBody = Actions.ActOnNullStmt(Tok.getLocation());
- return Actions.ActOnObjCAutoreleasePoolStmt(atLoc,
+ return Actions.ActOnObjCAutoreleasePoolStmt(atLoc,
AutoreleasePoolBody.get());
}
-/// StashAwayMethodOrFunctionBodyTokens - Consume the tokens and store them
+/// StashAwayMethodOrFunctionBodyTokens - Consume the tokens and store them
/// for later parsing.
void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) {
if (SkipFunctionBodies && (!MDecl || Actions.canSkipFunctionBody(MDecl)) &&
@@ -2698,7 +2698,7 @@ Decl *Parser::ParseObjCMethodDefinition(
// Allow the rest of sema to find private method decl implementations.
Actions.AddAnyMethodToGlobalPool(MDecl);
- assert (CurParsedObjCImpl
+ assert (CurParsedObjCImpl
&& "ParseObjCMethodDefinition - Method out of @implementation");
// Consume the tokens and store them for later parsing.
StashAwayMethodOrFunctionBodyTokens(MDecl);
@@ -2711,13 +2711,13 @@ StmtResult Parser::ParseObjCAtStatement(
cutOffParsing();
return StmtError();
}
-
+
if (Tok.isObjCAtKeyword(tok::objc_try))
return ParseObjCTryStmt(AtLoc);
-
+
if (Tok.isObjCAtKeyword(tok::objc_throw))
return ParseObjCThrowStmt(AtLoc);
-
+
if (Tok.isObjCAtKeyword(tok::objc_synchronized))
return ParseObjCSynchronizedStmt(AtLoc);
@@ -2739,7 +2739,7 @@ StmtResult Parser::ParseObjCAtStatement(
SkipUntil(tok::semi);
return StmtError();
}
-
+
// Otherwise, eat the semicolon.
ExpectAndConsumeSemi(diag::err_expected_semi_after_expr);
return Actions.ActOnExprStmt(Res);
@@ -2789,7 +2789,7 @@ ExprResult Parser::ParseObjCAtExpression
case tok::char_constant:
return ParsePostfixExpressionSuffix(ParseObjCCharacterLiteral(AtLoc));
-
+
case tok::numeric_constant:
return ParsePostfixExpressionSuffix(ParseObjCNumericLiteral(AtLoc));
@@ -2799,19 +2799,19 @@ ExprResult Parser::ParseObjCAtExpression
case tok::kw_false: // Objective-C++, etc.
case tok::kw___objc_no: // c/c++/objc/objc++ __objc_no
return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc, false));
-
+
case tok::l_square:
// Objective-C array literal
return ParsePostfixExpressionSuffix(ParseObjCArrayLiteral(AtLoc));
-
+
case tok::l_brace:
// Objective-C dictionary literal
return ParsePostfixExpressionSuffix(ParseObjCDictionaryLiteral(AtLoc));
-
+
case tok::l_paren:
// Objective-C boxed expression
return ParsePostfixExpressionSuffix(ParseObjCBoxedExpr(AtLoc));
-
+
default:
if (Tok.getIdentifierInfo() == nullptr)
return ExprError(Diag(AtLoc, diag::err_unexpected_at));
@@ -2833,14 +2833,14 @@ ExprResult Parser::ParseObjCAtExpression
if (GetLookAheadToken(1).is(tok::l_brace) &&
ExprStatementTokLoc == AtLoc) {
char ch = Tok.getIdentifierInfo()->getNameStart()[0];
- str =
- ch == 't' ? "try"
- : (ch == 'f' ? "finally"
+ str =
+ ch == 't' ? "try"
+ : (ch == 'f' ? "finally"
: (ch == 'a' ? "autoreleasepool" : nullptr));
}
if (str) {
SourceLocation kwLoc = Tok.getLocation();
- return ExprError(Diag(AtLoc, diag::err_unexpected_at) <<
+ return ExprError(Diag(AtLoc, diag::err_unexpected_at) <<
FixItHint::CreateReplacement(kwLoc, str));
}
else
@@ -2856,7 +2856,7 @@ ExprResult Parser::ParseObjCAtExpression
/// Objective-C++ either as a type or as an expression. Note that this
/// routine must not be called to parse a send to 'super', since it
/// has no way to return such a result.
-///
+///
/// \param IsExpr Whether the receiver was parsed as an expression.
///
/// \param TypeOrExpr If the receiver was parsed as an expression (\c
@@ -2900,7 +2900,7 @@ bool Parser::ParseObjCXXMessageReceiver(
// expression (that starts with one of the above)
DeclSpec DS(AttrFactory);
ParseCXXSimpleTypeSpecifier(DS);
-
+
if (Tok.is(tok::l_paren)) {
// If we see an opening parentheses at this point, we are
// actually parsing an expression that starts with a
@@ -2926,7 +2926,7 @@ bool Parser::ParseObjCXXMessageReceiver(
TypeOrExpr = Receiver.get();
return false;
}
-
+
// We have a class message. Turn the simple-type-specifier or
// typename-specifier we parsed into a type and parse the
// remainder of the class message.
@@ -2953,26 +2953,26 @@ bool Parser::isSimpleObjCMessageExpressi
}
bool Parser::isStartOfObjCClassMessageMissingOpenBracket() {
- if (!getLangOpts().ObjC1 || !NextToken().is(tok::identifier) ||
+ if (!getLangOpts().ObjC1 || !NextToken().is(tok::identifier) ||
InMessageExpression)
return false;
-
+
ParsedType Type;
- if (Tok.is(tok::annot_typename))
+ if (Tok.is(tok::annot_typename))
Type = getTypeAnnotation(Tok);
else if (Tok.is(tok::identifier))
- Type = Actions.getTypeName(*Tok.getIdentifierInfo(), Tok.getLocation(),
+ Type = Actions.getTypeName(*Tok.getIdentifierInfo(), Tok.getLocation(),
getCurScope());
else
return false;
-
+
if (!Type.get().isNull() && Type.get()->isObjCObjectOrInterfaceType()) {
const Token &AfterNext = GetLookAheadToken(2);
if (AfterNext.isOneOf(tok::colon, tok::r_square)) {
if (Tok.is(tok::identifier))
TryAnnotateTypeOrScopeToken();
-
+
return Tok.is(tok::annot_typename);
}
}
@@ -2998,14 +2998,14 @@ ExprResult Parser::ParseObjCMessageExpre
cutOffParsing();
return ExprError();
}
-
+
InMessageExpressionRAIIObject InMessage(*this, true);
-
+
if (getLangOpts().CPlusPlus) {
// We completely separate the C and C++ cases because C++ requires
- // more complicated (read: slower) parsing.
-
- // Handle send to super.
+ // more complicated (read: slower) parsing.
+
+ // Handle send to super.
// FIXME: This doesn't benefit from the same typo-correction we
// get in Objective-C.
if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super &&
@@ -3025,11 +3025,11 @@ ExprResult Parser::ParseObjCMessageExpre
return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), nullptr,
static_cast<Expr *>(TypeOrExpr));
- return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
+ return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
ParsedType::getFromOpaquePtr(TypeOrExpr),
nullptr);
}
-
+
if (Tok.is(tok::identifier)) {
IdentifierInfo *Name = Tok.getIdentifierInfo();
SourceLocation NameLoc = Tok.getLocation();
@@ -3065,7 +3065,7 @@ ExprResult Parser::ParseObjCMessageExpre
ReceiverType = NewReceiverType.get();
}
- return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
+ return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(),
ReceiverType, nullptr);
case Sema::ObjCInstanceMessage:
@@ -3073,7 +3073,7 @@ ExprResult Parser::ParseObjCMessageExpre
break;
}
}
-
+
// Otherwise, an arbitrary expression can be the receiver of a send.
ExprResult Res = Actions.CorrectDelayedTyposInExpr(ParseExpression());
if (Res.isInvalid()) {
@@ -3143,11 +3143,11 @@ Parser::ParseObjCMessageExpressionBody(S
cutOffParsing();
return ExprError();
}
-
+
// Parse objc-selector
SourceLocation Loc;
IdentifierInfo *selIdent = ParseObjCSelectorPiece(Loc);
-
+
SmallVector<IdentifierInfo *, 12> KeyIdents;
SmallVector<SourceLocation, 12> KeyLocs;
ExprVector KeyExprs;
@@ -3167,10 +3167,10 @@ Parser::ParseObjCMessageExpressionBody(S
}
/// Parse the expression after ':'
-
+
if (Tok.is(tok::code_completion)) {
if (SuperLoc.isValid())
- Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc,
+ Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc,
KeyIdents,
/*AtArgumentEpression=*/true);
else if (ReceiverType)
@@ -3185,14 +3185,14 @@ Parser::ParseObjCMessageExpressionBody(S
cutOffParsing();
return ExprError();
}
-
+
ExprResult Expr;
if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
Expr = ParseBraceInitializer();
} else
Expr = ParseAssignmentExpression();
-
+
ExprResult Res(Expr);
if (Res.isInvalid()) {
// We must manually skip to a ']', otherwise the expression skipper will
@@ -3208,7 +3208,7 @@ Parser::ParseObjCMessageExpressionBody(S
// Code completion after each argument.
if (Tok.is(tok::code_completion)) {
if (SuperLoc.isValid())
- Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc,
+ Actions.CodeCompleteObjCSuperMessage(getCurScope(), SuperLoc,
KeyIdents,
/*AtArgumentEpression=*/false);
else if (ReceiverType)
@@ -3222,7 +3222,7 @@ Parser::ParseObjCMessageExpressionBody(S
cutOffParsing();
return ExprError();
}
-
+
// Check for another keyword selector.
selIdent = ParseObjCSelectorPiece(Loc);
if (!selIdent && Tok.isNot(tok::colon))
@@ -3260,7 +3260,7 @@ Parser::ParseObjCMessageExpressionBody(S
SkipUntil(tok::r_square, StopAtSemi);
return ExprError();
}
-
+
if (Tok.isNot(tok::r_square)) {
Diag(Tok, diag::err_expected)
<< (Tok.is(tok::identifier) ? tok::colon : tok::r_square);
@@ -3270,7 +3270,7 @@ Parser::ParseObjCMessageExpressionBody(S
SkipUntil(tok::r_square, StopAtSemi);
return ExprError();
}
-
+
SourceLocation RBracLoc = ConsumeBracket(); // consume ']'
unsigned nKeys = KeyIdents.size();
@@ -3324,7 +3324,7 @@ ExprResult Parser::ParseObjCStringLitera
/// ;
/// boolean-keyword: 'true' | 'false' | '__objc_yes' | '__objc_no'
/// ;
-ExprResult Parser::ParseObjCBooleanLiteral(SourceLocation AtLoc,
+ExprResult Parser::ParseObjCBooleanLiteral(SourceLocation AtLoc,
bool ArgValue) {
SourceLocation EndLoc = ConsumeToken(); // consume the keyword.
return Actions.ActOnObjCBoolLiteral(AtLoc, EndLoc, ArgValue);
@@ -3395,15 +3395,15 @@ ExprResult Parser::ParseObjCArrayLiteral
// the enclosing expression.
SkipUntil(tok::r_square, StopAtSemi);
return Res;
- }
-
+ }
+
Res = Actions.CorrectDelayedTyposInExpr(Res.get());
if (Res.isInvalid())
HasInvalidEltExpr = true;
// Parse the ellipsis that indicates a pack expansion.
if (Tok.is(tok::ellipsis))
- Res = Actions.ActOnPackExpansion(Res.get(), ConsumeToken());
+ Res = Actions.ActOnPackExpansion(Res.get(), ConsumeToken());
if (Res.isInvalid())
HasInvalidEltExpr = true;
@@ -3447,7 +3447,7 @@ ExprResult Parser::ParseObjCDictionaryLi
SkipUntil(tok::r_brace, StopAtSemi);
return ExprError();
}
-
+
ExprResult ValueExpr(ParseAssignmentExpression());
if (ValueExpr.isInvalid()) {
// We must manually skip to a '}', otherwise the expression skipper will
@@ -3456,7 +3456,7 @@ ExprResult Parser::ParseObjCDictionaryLi
SkipUntil(tok::r_brace, StopAtSemi);
return ValueExpr;
}
-
+
// Check the key and value for possible typos
KeyExpr = Actions.CorrectDelayedTyposInExpr(KeyExpr.get());
ValueExpr = Actions.CorrectDelayedTyposInExpr(ValueExpr.get());
@@ -3472,8 +3472,8 @@ ExprResult Parser::ParseObjCDictionaryLi
// We have a valid expression. Collect it in a vector so we can
// build the argument list.
- ObjCDictionaryElement Element = {
- KeyExpr.get(), ValueExpr.get(), EllipsisLoc, None
+ ObjCDictionaryElement Element = {
+ KeyExpr.get(), ValueExpr.get(), EllipsisLoc, None
};
Elements.push_back(Element);
@@ -3485,7 +3485,7 @@ ExprResult Parser::ParseObjCDictionaryLi
if (HasInvalidEltExpr)
return ExprError();
-
+
// Create the ObjCDictionaryLiteral.
return Actions.BuildObjCDictionaryLiteral(SourceRange(AtLoc, EndLoc),
Elements);
@@ -3551,26 +3551,26 @@ ExprResult Parser::ParseObjCSelectorExpr
SmallVector<IdentifierInfo *, 12> KeyIdents;
SourceLocation sLoc;
-
+
BalancedDelimiterTracker T(*this, tok::l_paren);
T.consumeOpen();
bool HasOptionalParen = Tok.is(tok::l_paren);
if (HasOptionalParen)
ConsumeParen();
-
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCSelector(getCurScope(), KeyIdents);
cutOffParsing();
return ExprError();
}
-
+
IdentifierInfo *SelIdent = ParseObjCSelectorPiece(sLoc);
if (!SelIdent && // missing selector name.
Tok.isNot(tok::colon) && Tok.isNot(tok::coloncolon))
return ExprError(Diag(Tok, diag::err_expected) << tok::identifier);
KeyIdents.push_back(SelIdent);
-
+
unsigned nColons = 0;
if (Tok.isNot(tok::r_paren)) {
while (1) {
@@ -3583,7 +3583,7 @@ ExprResult Parser::ParseObjCSelectorExpr
if (Tok.is(tok::r_paren))
break;
-
+
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCSelector(getCurScope(), KeyIdents);
cutOffParsing();
@@ -3611,12 +3611,12 @@ ExprResult Parser::ParseObjCSelectorExpr
void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) {
// MCDecl might be null due to error in method or c-function prototype, etc.
Decl *MCDecl = LM.D;
- bool skip = MCDecl &&
+ bool skip = MCDecl &&
((parseMethod && !Actions.isObjCMethodDecl(MCDecl)) ||
(!parseMethod && Actions.isObjCMethodDecl(MCDecl)));
if (skip)
return;
-
+
// Save the current token position.
SourceLocation OrigLoc = Tok.getLocation();
@@ -3636,15 +3636,15 @@ void Parser::ParseLexedObjCMethodDefs(Le
// Consume the previously pushed token.
ConsumeAnyToken(/*ConsumeCodeCompletionTok=*/true);
-
- assert(Tok.isOneOf(tok::l_brace, tok::kw_try, tok::colon) &&
+
+ assert(Tok.isOneOf(tok::l_brace, tok::kw_try, tok::colon) &&
"Inline objective-c method not starting with '{' or 'try' or ':'");
// Enter a scope for the method or c-function body.
ParseScope BodyScope(this, (parseMethod ? Scope::ObjCMethodScope : 0) |
Scope::FnScope | Scope::DeclScope |
Scope::CompoundStmtScope);
- // Tell the actions module that we have entered a method or c-function definition
+ // Tell the actions module that we have entered a method or c-function definition
// with the specified Declarator for the method/function.
if (parseMethod)
Actions.ActOnStartOfObjCMethodDef(getCurScope(), MCDecl);
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Mon Jul 30 12:24:48 2018
@@ -1492,7 +1492,7 @@ void Parser::HandlePragmaAttribute() {
// #pragma GCC visibility comes in two variants:
// 'push' '(' [visibility] ')'
// 'pop'
-void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
+void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &VisTok) {
SourceLocation VisLoc = VisTok.getLocation();
@@ -1552,7 +1552,7 @@ void PragmaGCCVisibilityHandler::HandleP
// pack '(' [integer] ')'
// pack '(' 'show' ')'
// pack '(' ('push' | 'pop') [',' identifier] [, integer] ')'
-void PragmaPackHandler::HandlePragma(Preprocessor &PP,
+void PragmaPackHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &PackTok) {
SourceLocation PackLoc = PackTok.getLocation();
@@ -1663,7 +1663,7 @@ void PragmaPackHandler::HandlePragma(Pre
// #pragma ms_struct on
// #pragma ms_struct off
-void PragmaMSStructHandler::HandlePragma(Preprocessor &PP,
+void PragmaMSStructHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &MSStructTok) {
PragmaMSStructKind Kind = PMSST_OFF;
@@ -1686,7 +1686,7 @@ void PragmaMSStructHandler::HandlePragma
PP.Diag(Tok.getLocation(), diag::warn_pragma_ms_struct);
return;
}
-
+
if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
<< "ms_struct";
@@ -1817,20 +1817,20 @@ static void ParseAlignPragma(Preprocesso
PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true);
}
-void PragmaAlignHandler::HandlePragma(Preprocessor &PP,
+void PragmaAlignHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &AlignTok) {
ParseAlignPragma(PP, AlignTok, /*IsOptions=*/false);
}
-void PragmaOptionsHandler::HandlePragma(Preprocessor &PP,
+void PragmaOptionsHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &OptionsTok) {
ParseAlignPragma(PP, OptionsTok, /*IsOptions=*/true);
}
// #pragma unused(identifier)
-void PragmaUnusedHandler::HandlePragma(Preprocessor &PP,
+void PragmaUnusedHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &UnusedTok) {
// FIXME: Should we be expanding macros here? My guess is no.
@@ -1911,7 +1911,7 @@ void PragmaUnusedHandler::HandlePragma(P
// #pragma weak identifier
// #pragma weak identifier '=' identifier
-void PragmaWeakHandler::HandlePragma(Preprocessor &PP,
+void PragmaWeakHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &WeakTok) {
SourceLocation WeakLoc = WeakTok.getLocation();
@@ -1970,7 +1970,7 @@ void PragmaWeakHandler::HandlePragma(Pre
}
// #pragma redefine_extname identifier identifier
-void PragmaRedefineExtnameHandler::HandlePragma(Preprocessor &PP,
+void PragmaRedefineExtnameHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &RedefToken) {
SourceLocation RedefLoc = RedefToken.getLocation();
@@ -2015,7 +2015,7 @@ void PragmaRedefineExtnameHandler::Handl
void
-PragmaFPContractHandler::HandlePragma(Preprocessor &PP,
+PragmaFPContractHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &Tok) {
tok::OnOffSwitch OOS;
@@ -2033,8 +2033,8 @@ PragmaFPContractHandler::HandlePragma(Pr
PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true);
}
-void
-PragmaOpenCLExtensionHandler::HandlePragma(Preprocessor &PP,
+void
+PragmaOpenCLExtensionHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &Tok) {
PP.LexUnexpandedToken(Tok);
@@ -2095,7 +2095,7 @@ PragmaOpenCLExtensionHandler::HandlePrag
PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true);
if (PP.getPPCallbacks())
- PP.getPPCallbacks()->PragmaOpenCLExtension(NameLoc, Ext,
+ PP.getPPCallbacks()->PragmaOpenCLExtension(NameLoc, Ext,
StateLoc, State);
}
@@ -2523,7 +2523,7 @@ void PragmaCommentHandler::HandlePragma(
// #pragma clang optimize off
// #pragma clang optimize on
-void PragmaOptimizeHandler::HandlePragma(Preprocessor &PP,
+void PragmaOptimizeHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducerKind Introducer,
Token &FirstToken) {
Token Tok;
@@ -2549,7 +2549,7 @@ void PragmaOptimizeHandler::HandlePragma
return;
}
PP.Lex(Tok);
-
+
if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::err_pragma_optimize_extra_argument)
<< PP.getSpelling(Tok);
Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Mon Jul 30 12:24:48 2018
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements parsing for GCC and Microsoft inline assembly.
+// This file implements parsing for GCC and Microsoft inline assembly.
//
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Mon Jul 30 12:24:48 2018
@@ -27,7 +27,7 @@ Decl *Parser::ParseDeclarationStartingWi
DeclaratorContext Context, SourceLocation &DeclEnd,
ParsedAttributes &AccessAttrs, AccessSpecifier AS) {
ObjCDeclContextSwitch ObjCDC(*this);
-
+
if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) {
return ParseExplicitInstantiation(Context, SourceLocation(), ConsumeToken(),
DeclEnd, AccessAttrs, AS);
@@ -360,7 +360,7 @@ bool
Parser::ParseTemplateParameterList(const unsigned Depth,
SmallVectorImpl<NamedDecl*> &TemplateParams) {
while (1) {
-
+
if (NamedDecl *TmpParam
= ParseTemplateParameter(Depth, TemplateParams.size())) {
TemplateParams.push_back(TmpParam);
@@ -403,23 +403,23 @@ bool Parser::isStartOfTemplateTypeParame
case tok::greatergreater:
case tok::ellipsis:
return true;
-
+
case tok::identifier:
- // This may be either a type-parameter or an elaborated-type-specifier.
+ // This may be either a type-parameter or an elaborated-type-specifier.
// We have to look further.
break;
-
+
default:
return false;
}
-
+
switch (GetLookAheadToken(2).getKind()) {
case tok::equal:
case tok::comma:
case tok::greater:
case tok::greatergreater:
return true;
-
+
default:
return false;
}
@@ -464,7 +464,7 @@ bool Parser::isStartOfTemplateTypeParame
/// 'class' identifier[opt] '=' type-id
/// 'typename' ...[opt] identifier[opt]
/// 'typename' identifier[opt] '=' type-id
-/// 'template' '<' template-parameter-list '>'
+/// 'template' '<' template-parameter-list '>'
/// 'class' ...[opt] identifier[opt]
/// 'template' '<' template-parameter-list '>' 'class' identifier[opt]
/// = id-expression
@@ -617,7 +617,7 @@ Parser::ParseTemplateTemplateParameter(u
getLangOpts().CPlusPlus11
? diag::warn_cxx98_compat_variadic_templates
: diag::ext_variadic_templates);
-
+
// Get the identifier, if given.
SourceLocation NameLoc;
IdentifierInfo *ParamName = nullptr;
@@ -652,16 +652,16 @@ Parser::ParseTemplateTemplateParameter(u
if (TryConsumeToken(tok::equal, EqualLoc)) {
DefaultArg = ParseTemplateTemplateArgument();
if (DefaultArg.isInvalid()) {
- Diag(Tok.getLocation(),
+ Diag(Tok.getLocation(),
diag::err_default_template_template_parameter_not_template);
SkipUntil(tok::comma, tok::greater, tok::greatergreater,
StopAtSemi | StopBeforeMatch);
}
}
-
+
return Actions.ActOnTemplateTemplateParameter(getCurScope(), TemplateLoc,
- ParamList, EllipsisLoc,
- ParamName, NameLoc, Depth,
+ ParamList, EllipsisLoc,
+ ParamName, NameLoc, Depth,
Position, EqualLoc, DefaultArg);
}
@@ -714,8 +714,8 @@ Parser::ParseNonTypeTemplateParameter(un
}
// Create the parameter.
- return Actions.ActOnNonTypeTemplateParameter(getCurScope(), ParamDecl,
- Depth, Position, EqualLoc,
+ return Actions.ActOnNonTypeTemplateParameter(getCurScope(), ParamDecl,
+ Depth, Position, EqualLoc,
DefaultArg.get());
}
@@ -1045,7 +1045,7 @@ bool Parser::AnnotateTemplateIdToken(Tem
// Build a template-id annotation token that can be processed
// later.
Tok.setKind(tok::annot_template_id);
-
+
IdentifierInfo *TemplateII =
TemplateName.getKind() == UnqualifiedIdKind::IK_Identifier
? TemplateName.Identifier
@@ -1059,7 +1059,7 @@ bool Parser::AnnotateTemplateIdToken(Tem
TemplateIdAnnotation *TemplateId = TemplateIdAnnotation::Create(
SS, TemplateKWLoc, TemplateNameLoc, TemplateII, OpKind, Template, TNK,
LAngleLoc, RAngleLoc, TemplateArgs, TemplateIds);
-
+
Tok.setAnnotationValue(TemplateId);
if (TemplateKWLoc.isValid())
Tok.setLocation(TemplateKWLoc);
@@ -1135,13 +1135,13 @@ ParsedTemplateArgument Parser::ParseTemp
// C++0x [temp.arg.template]p1:
// A template-argument for a template template-parameter shall be the name
// of a class template or an alias template, expressed as id-expression.
- //
+ //
// We parse an id-expression that refers to a class template or alias
// template. The grammar we parse is:
//
// nested-name-specifier[opt] template[opt] identifier ...[opt]
//
- // followed by a token that terminates a template argument, such as ',',
+ // followed by a token that terminates a template argument, such as ',',
// '>', or (in some cases) '>>'.
CXXScopeSpec SS; // nested-name-specifier, if present
ParseOptionalCXXScopeSpecifier(SS, nullptr,
@@ -1150,10 +1150,10 @@ ParsedTemplateArgument Parser::ParseTemp
ParsedTemplateArgument Result;
SourceLocation EllipsisLoc;
if (SS.isSet() && Tok.is(tok::kw_template)) {
- // Parse the optional 'template' keyword following the
+ // Parse the optional 'template' keyword following the
// nested-name-specifier.
SourceLocation TemplateKWLoc = ConsumeToken();
-
+
if (Tok.is(tok::identifier)) {
// We appear to have a dependent template name.
UnqualifiedId Name;
@@ -1191,16 +1191,16 @@ ParsedTemplateArgument Parser::ParseTemp
/*EnteringContext=*/false, Template, MemberOfUnknownSpecialization);
if (TNK == TNK_Dependent_template_name || TNK == TNK_Type_template) {
// We have an id-expression that refers to a class template or
- // (C++0x) alias template.
+ // (C++0x) alias template.
Result = ParsedTemplateArgument(SS, Template, Name.StartLocation);
}
}
}
-
+
// If this is a pack expansion, build it as such.
if (EllipsisLoc.isValid() && !Result.isInvalid())
Result = Actions.ActOnPackExpansion(Result, EllipsisLoc);
-
+
return Result;
}
@@ -1230,7 +1230,7 @@ ParsedTemplateArgument Parser::ParseTemp
/*Range=*/nullptr, DeclaratorContext::TemplateArgContext);
return Actions.ActOnTemplateTypeArgument(TypeArg);
}
-
+
// Try to parse a template template argument.
{
TentativeParsingAction TPA(*this);
@@ -1241,35 +1241,35 @@ ParsedTemplateArgument Parser::ParseTemp
TPA.Commit();
return TemplateTemplateArgument;
}
-
+
// Revert this tentative parse to parse a non-type template argument.
TPA.Revert();
}
-
- // Parse a non-type template argument.
+
+ // Parse a non-type template argument.
SourceLocation Loc = Tok.getLocation();
ExprResult ExprArg = ParseConstantExpressionInExprEvalContext(MaybeTypeCast);
if (ExprArg.isInvalid() || !ExprArg.get())
return ParsedTemplateArgument();
- return ParsedTemplateArgument(ParsedTemplateArgument::NonType,
+ return ParsedTemplateArgument(ParsedTemplateArgument::NonType,
ExprArg.get(), Loc);
}
-/// Determine whether the current tokens can only be parsed as a
-/// template argument list (starting with the '<') and never as a '<'
+/// Determine whether the current tokens can only be parsed as a
+/// template argument list (starting with the '<') and never as a '<'
/// expression.
bool Parser::IsTemplateArgumentList(unsigned Skip) {
struct AlwaysRevertAction : TentativeParsingAction {
AlwaysRevertAction(Parser &P) : TentativeParsingAction(P) { }
~AlwaysRevertAction() { Revert(); }
} Tentative(*this);
-
+
while (Skip) {
ConsumeAnyToken();
--Skip;
}
-
+
// '<'
if (!TryConsumeToken(tok::less))
return false;
@@ -1277,11 +1277,11 @@ bool Parser::IsTemplateArgumentList(unsi
// An empty template argument list.
if (Tok.is(tok::greater))
return true;
-
+
// See whether we have declaration specifiers, which indicate a type.
while (isCXXDeclarationSpecifier() == TPResult::True)
ConsumeAnyToken();
-
+
// If we have a '>' or a ',' then this is a template argument list.
return Tok.isOneOf(tok::greater, tok::comma);
}
@@ -1294,7 +1294,7 @@ bool Parser::IsTemplateArgumentList(unsi
/// template-argument-list ',' template-argument
bool
Parser::ParseTemplateArgumentList(TemplateArgList &TemplateArgs) {
-
+
ColonProtectionRAIIObject ColonProtection(*this, false);
do {
@@ -1310,7 +1310,7 @@ Parser::ParseTemplateArgumentList(Templa
// Save this template argument.
TemplateArgs.push_back(Arg);
-
+
// If the next token is a comma, consume it and keep reading
// arguments.
} while (TryConsumeToken(tok::comma));
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Mon Jul 30 12:24:48 2018
@@ -80,10 +80,10 @@ bool Parser::isCXXDeclarationStatement()
/// (if AllowForRangeDecl specified)
/// for ( for-range-declaration : for-range-initializer ) statement
///
-/// for-range-declaration:
+/// for-range-declaration:
/// decl-specifier-seq declarator
/// decl-specifier-seq ref-qualifier[opt] '[' identifier-list ']'
-///
+///
/// In any of the above cases there can be a preceding attribute-specifier-seq,
/// but the caller is expected to handle that.
bool Parser::isCXXSimpleDeclaration(bool AllowForRangeDecl) {
@@ -132,7 +132,7 @@ bool Parser::isCXXSimpleDeclaration(bool
// Ok, we have a simple-type-specifier/typename-specifier followed by a '(',
// or an identifier which doesn't resolve as anything. We need tentative
// parsing...
-
+
{
RevertingTentativeParsingAction PA(*this);
TPR = TryParseSimpleDeclaration(AllowForRangeDecl);
@@ -236,7 +236,7 @@ Parser::TPResult Parser::TryConsumeDecla
///
/// (if AllowForRangeDecl specified)
/// for ( for-range-declaration : for-range-initializer ) statement
-/// for-range-declaration:
+/// for-range-declaration:
/// attribute-specifier-seqopt type-specifier-seq declarator
///
Parser::TPResult Parser::TryParseSimpleDeclaration(bool AllowForRangeDecl) {
@@ -964,7 +964,7 @@ Parser::TPResult Parser::TryParseDeclara
return TPResult::Ambiguous;
}
-Parser::TPResult
+Parser::TPResult
Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) {
switch (Kind) {
// Obviously starts an expression.
@@ -1026,7 +1026,7 @@ Parser::isExpressionOrTypeSpecifierSimpl
case tok::kw_##Spelling:
#include "clang/Basic/TokenKinds.def"
return TPResult::True;
-
+
// Obviously starts a type-specifier-seq:
case tok::kw_char:
case tok::kw_const:
@@ -1084,7 +1084,7 @@ Parser::isExpressionOrTypeSpecifierSimpl
default:
break;
}
-
+
return TPResult::Ambiguous;
}
@@ -1338,7 +1338,7 @@ Parser::isCXXDeclarationSpecifier(Parser
// Debugger support
case tok::kw___unknown_anytype:
-
+
// type-specifier:
// simple-type-specifier
// class-specifier
@@ -1395,7 +1395,7 @@ Parser::isCXXDeclarationSpecifier(Parser
// Borland
case tok::kw___pascal:
return TPResult::True;
-
+
// AltiVec
case tok::kw___vector:
return TPResult::True;
@@ -1510,24 +1510,24 @@ Parser::isCXXDeclarationSpecifier(Parser
// Tentatively parse the protocol qualifiers.
RevertingTentativeParsingAction PA(*this);
ConsumeAnyToken(); // The type token
-
+
TPResult TPR = TryParseProtocolQualifiers();
bool isFollowedByParen = Tok.is(tok::l_paren);
bool isFollowedByBrace = Tok.is(tok::l_brace);
-
+
if (TPR == TPResult::Error)
return TPResult::Error;
-
+
if (isFollowedByParen)
return TPResult::Ambiguous;
if (getLangOpts().CPlusPlus11 && isFollowedByBrace)
return BracedCastResult;
-
+
return TPResult::True;
}
LLVM_FALLTHROUGH;
-
+
case tok::kw_char:
case tok::kw_wchar_t:
case tok::kw_char8_t:
@@ -1562,7 +1562,7 @@ Parser::isCXXDeclarationSpecifier(Parser
if (isStartOfObjCClassMessageMissingOpenBracket())
return TPResult::False;
-
+
return TPResult::True;
// GNU typeof support.
@@ -1681,18 +1681,18 @@ Parser::TPResult Parser::TryParseProtoco
if (Tok.isNot(tok::identifier))
return TPResult::Error;
ConsumeToken();
-
+
if (Tok.is(tok::comma)) {
ConsumeToken();
continue;
}
-
+
if (Tok.is(tok::greater)) {
ConsumeToken();
return TPResult::Ambiguous;
}
} while (false);
-
+
return TPResult::Error;
}
@@ -1910,7 +1910,7 @@ Parser::TPResult Parser::TryParseFunctio
// ref-qualifier[opt]
if (Tok.isOneOf(tok::amp, tok::ampamp))
ConsumeToken();
-
+
// exception-specification
if (Tok.is(tok::kw_throw)) {
ConsumeToken();
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Mon Jul 30 12:24:48 2018
@@ -41,7 +41,7 @@ public:
} // end anonymous namespace
IdentifierInfo *Parser::getSEHExceptKeyword() {
- // __except is accepted as a (contextual) keyword
+ // __except is accepted as a (contextual) keyword
if (!Ident__except && (getLangOpts().MicrosoftExt || getLangOpts().Borland))
Ident__except = PP.getIdentifierInfo("__except");
@@ -50,7 +50,7 @@ IdentifierInfo *Parser::getSEHExceptKeyw
Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies)
: PP(pp), Actions(actions), Diags(PP.getDiagnostics()),
- GreaterThanIsOperator(true), ColonIsSacred(false),
+ GreaterThanIsOperator(true), ColonIsSacred(false),
InMessageExpression(false), TemplateParameterDepth(0),
ParsingInObjCContainer(false) {
SkipFunctionBodies = pp.isCodeCompletionEnabled() || skipFunctionBodies;
@@ -161,8 +161,8 @@ bool Parser::ExpectAndConsumeSemi(unsign
handleUnexpectedCodeCompletionToken();
return false;
}
-
- if ((Tok.is(tok::r_paren) || Tok.is(tok::r_square)) &&
+
+ if ((Tok.is(tok::r_paren) || Tok.is(tok::r_square)) &&
NextToken().is(tok::semi)) {
Diag(Tok, diag::err_extraneous_token_before_semi)
<< PP.getSpelling(Tok)
@@ -171,7 +171,7 @@ bool Parser::ExpectAndConsumeSemi(unsign
ConsumeToken(); // The ';'.
return false;
}
-
+
return ExpectAndConsume(tok::semi, DiagID);
}
@@ -291,7 +291,7 @@ bool Parser::SkipUntil(ArrayRef<tok::Tok
if (!HasFlagsSet(Flags, StopAtCodeCompletion))
handleUnexpectedCodeCompletionToken();
return false;
-
+
case tok::l_paren:
// Recursively skip properly-nested parens.
ConsumeParen();
@@ -796,17 +796,17 @@ Parser::ParseExternalDeclaration(ParsedA
return ParseDeclaration(DeclaratorContext::FileContext, DeclEnd, attrs);
}
goto dont_know;
-
+
case tok::kw_inline:
if (getLangOpts().CPlusPlus) {
tok::TokenKind NextKind = NextToken().getKind();
-
+
// Inline namespaces. Allowed as an extension even in C++03.
if (NextKind == tok::kw_namespace) {
SourceLocation DeclEnd;
return ParseDeclaration(DeclaratorContext::FileContext, DeclEnd, attrs);
}
-
+
// Parse (then ignore) 'inline' prior to a template instantiation. This is
// a GCC extension that we intentionally do not support.
if (NextKind == tok::kw_template) {
@@ -867,7 +867,7 @@ bool Parser::isDeclarationAfterDeclarato
if (KW.is(tok::kw_default) || KW.is(tok::kw_delete))
return false;
}
-
+
return Tok.is(tok::equal) || // int X()= -> not a function def
Tok.is(tok::comma) || // int X(), -> not a function def
Tok.is(tok::semi) || // int X(); -> not a function def
@@ -883,17 +883,17 @@ bool Parser::isStartOfFunctionDefinition
assert(Declarator.isFunctionDeclarator() && "Isn't a function declarator");
if (Tok.is(tok::l_brace)) // int X() {}
return true;
-
+
// Handle K&R C argument lists: int X(f) int f; {}
if (!getLangOpts().CPlusPlus &&
- Declarator.getFunctionTypeInfo().isKNRPrototype())
+ Declarator.getFunctionTypeInfo().isKNRPrototype())
return isDeclarationSpecifier();
if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) {
const Token &KW = NextToken();
return KW.is(tok::kw_default) || KW.is(tok::kw_delete);
}
-
+
return Tok.is(tok::colon) || // X() : Base() {} (used for ctors)
Tok.is(tok::kw_try); // X() try { ... }
}
@@ -947,7 +947,7 @@ Parser::ParseDeclOrFunctionDefInternal(P
default:
llvm_unreachable("we only expect to get the length of the class/struct/union/enum");
}
-
+
};
// Suggest correct location to fix '[[attrib]] struct' to 'struct [[attrib]]'
SourceLocation CorrectLocationForAttributes =
@@ -1072,7 +1072,7 @@ Decl *Parser::ParseFunctionDefinition(Pa
// We should have either an opening brace or, in a C++ constructor,
// we may have a colon.
- if (Tok.isNot(tok::l_brace) &&
+ if (Tok.isNot(tok::l_brace) &&
(!getLangOpts().CPlusPlus ||
(Tok.isNot(tok::colon) && Tok.isNot(tok::kw_try) &&
Tok.isNot(tok::equal)))) {
@@ -1128,10 +1128,10 @@ Decl *Parser::ParseFunctionDefinition(Pa
}
return DP;
}
- else if (CurParsedObjCImpl &&
+ else if (CurParsedObjCImpl &&
!TemplateInfo.TemplateParams &&
(Tok.is(tok::l_brace) || Tok.is(tok::kw_try) ||
- Tok.is(tok::colon)) &&
+ Tok.is(tok::colon)) &&
Actions.CurContext->isTranslationUnit()) {
ParseScope BodyScope(this, Scope::FnScope | Scope::DeclScope |
Scope::CompoundStmtScope);
@@ -1171,7 +1171,7 @@ Decl *Parser::ParseFunctionDefinition(Pa
// Break out of the ParsingDeclarator context before we parse the body.
D.complete(Res);
-
+
// Break out of the ParsingDeclSpec context, too. This const_cast is
// safe because we're always the sole owner.
D.getMutableDeclSpec().abort();
@@ -1710,7 +1710,7 @@ bool Parser::TryAnnotateTypeOrScopeToken
TypeResult Ty;
if (Tok.is(tok::identifier)) {
// FIXME: check whether the next token is '<', first!
- Ty = Actions.ActOnTypenameType(getCurScope(), TypenameLoc, SS,
+ Ty = Actions.ActOnTypenameType(getCurScope(), TypenameLoc, SS,
*Tok.getIdentifierInfo(),
Tok.getLocation());
} else if (Tok.is(tok::annot_template_id)) {
@@ -1926,14 +1926,14 @@ SourceLocation Parser::handleUnexpectedC
cutOffParsing();
return PrevTokLocation;
}
-
+
if (S->getFlags() & Scope::ClassScope) {
Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Class);
cutOffParsing();
return PrevTokLocation;
}
}
-
+
Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Namespace);
cutOffParsing();
return PrevTokLocation;
@@ -1953,7 +1953,7 @@ void Parser::CodeCompleteMacroName(bool
Actions.CodeCompletePreprocessorMacroName(IsDefinition);
}
-void Parser::CodeCompletePreprocessorExpression() {
+void Parser::CodeCompletePreprocessorExpression() {
Actions.CodeCompletePreprocessorExpression();
}
@@ -1976,11 +1976,11 @@ bool Parser::ParseMicrosoftIfExistsCondi
BalancedDelimiterTracker T(*this, tok::l_paren);
if (T.consumeOpen()) {
- Diag(Tok, diag::err_expected_lparen_after)
+ Diag(Tok, diag::err_expected_lparen_after)
<< (Result.IsIfExists? "__if_exists" : "__if_not_exists");
return true;
}
-
+
// Parse nested-name-specifier.
if (getLangOpts().CPlusPlus)
ParseOptionalCXXScopeSpecifier(Result.SS, nullptr,
@@ -2004,7 +2004,7 @@ bool Parser::ParseMicrosoftIfExistsCondi
if (T.consumeClose())
return true;
-
+
// Check if the symbol exists.
switch (Actions.CheckMicrosoftIfExistsSymbol(getCurScope(), Result.KeywordLoc,
Result.IsIfExists, Result.SS,
@@ -2020,7 +2020,7 @@ bool Parser::ParseMicrosoftIfExistsCondi
case Sema::IER_Dependent:
Result.Behavior = IEB_Dependent;
break;
-
+
case Sema::IER_Error:
return true;
}
@@ -2032,7 +2032,7 @@ void Parser::ParseMicrosoftIfExistsExter
IfExistsCondition Result;
if (ParseMicrosoftIfExistsCondition(Result))
return;
-
+
BalancedDelimiterTracker Braces(*this, tok::l_brace);
if (Braces.consumeOpen()) {
Diag(Tok, diag::err_expected) << tok::l_brace;
@@ -2043,10 +2043,10 @@ void Parser::ParseMicrosoftIfExistsExter
case IEB_Parse:
// Parse declarations below.
break;
-
+
case IEB_Dependent:
llvm_unreachable("Cannot have a dependent external declaration");
-
+
case IEB_Skip:
Braces.skipToEnd();
return;
@@ -2109,7 +2109,7 @@ Parser::DeclGroupPtrTy Parser::ParseModu
/// Parse a module import declaration. This is essentially the same for
/// Objective-C and the C++ Modules TS, except for the leading '@' (in ObjC)
/// and the trailing optional attributes (in C++).
-///
+///
/// [ObjC] @import declaration:
/// '@' 'import' module-name ';'
/// [ModTS] module-import-declaration:
@@ -2121,7 +2121,7 @@ Decl *Parser::ParseModuleImport(SourceLo
bool IsObjCAtImport = Tok.isObjCAtKeyword(tok::objc_import);
SourceLocation ImportLoc = ConsumeToken();
SourceLocation StartLoc = AtLoc.isInvalid() ? ImportLoc : AtLoc;
-
+
SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 2> Path;
if (ParseModuleName(ImportLoc, Path, /*IsImport*/true))
return nullptr;
@@ -2174,12 +2174,12 @@ bool Parser::ParseModuleName(
cutOffParsing();
return true;
}
-
+
Diag(Tok, diag::err_module_expected_ident) << IsImport;
SkipUntil(tok::semi);
return true;
}
-
+
// Record this part of the module path.
Path.push_back(std::make_pair(Tok.getIdentifierInfo(), Tok.getLocation()));
ConsumeToken();
@@ -2258,7 +2258,7 @@ bool BalancedDelimiterTracker::expectAnd
if (getDepth() < P.getLangOpts().BracketDepth)
return false;
-
+
return diagnoseOverflow();
}
Modified: cfe/trunk/lib/Rewrite/DeltaTree.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/DeltaTree.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/DeltaTree.cpp (original)
+++ cfe/trunk/lib/Rewrite/DeltaTree.cpp Mon Jul 30 12:24:48 2018
@@ -50,7 +50,7 @@ namespace {
return Delta;
}
};
-
+
/// DeltaTreeNode - The common part of all nodes.
///
class DeltaTreeNode {
@@ -59,7 +59,7 @@ namespace {
DeltaTreeNode *LHS, *RHS;
SourceDelta Split;
};
-
+
private:
friend class DeltaTreeInteriorNode;
Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Mon Jul 30 12:24:48 2018
@@ -49,7 +49,7 @@ void html::HighlightRange(Rewriter &R, S
const char *BufferStart = SM.getBufferData(FID, &Invalid).data();
if (Invalid)
return;
-
+
HighlightRange(R.getEditBuffer(FID), BOffset, EOffset,
BufferStart, StartTag, EndTag);
}
Modified: cfe/trunk/lib/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Rewriter.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Rewriter.cpp Mon Jul 30 12:24:48 2018
@@ -88,7 +88,7 @@ void RewriteBuffer::RemoveText(unsigned
}
++posI;
}
-
+
unsigned lineSize = 0;
posI = curLineStart;
while (posI != end() && isWhitespaceExceptNL(*posI)) {
@@ -353,10 +353,10 @@ bool Rewriter::IncreaseIndentation(CharS
unsigned parentLineNo = SourceMgr->getLineNumber(FID, parentOff) - 1;
unsigned startLineNo = SourceMgr->getLineNumber(FID, StartOff) - 1;
unsigned endLineNo = SourceMgr->getLineNumber(FID, EndOff) - 1;
-
+
const SrcMgr::ContentCache *
Content = SourceMgr->getSLocEntry(FID).getFile().getContentCache();
-
+
// Find where the lines start.
unsigned parentLineOffs = Content->SourceLineCache[parentLineNo];
unsigned startLineOffs = Content->SourceLineCache[startLineNo];
Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Mon Jul 30 12:24:48 2018
@@ -90,7 +90,7 @@ namespace {
}
S.Diag(L, diag) << R1 << R2;
-
+
SourceLocation Open = SilenceableCondVal.getBegin();
if (Open.isValid()) {
SourceLocation Close = SilenceableCondVal.getEnd();
@@ -330,7 +330,7 @@ static void EmitDiagForCXXThrowInNonThro
S.Diag(FD->getLocation(), diag::note_throw_in_dtor)
<< !isa<CXXDestructorDecl>(FD) << !Ty->hasExceptionSpec()
<< FD->getExceptionSpecSourceRange();
- } else
+ } else
S.Diag(FD->getLocation(), diag::note_throw_in_function)
<< FD->getExceptionSpecSourceRange();
}
@@ -525,18 +525,18 @@ struct CheckFallThroughDiagnostics {
bool isVirtualMethod = false;
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Func))
isVirtualMethod = Method->isVirtual();
-
+
// Don't suggest that template instantiations be marked "noreturn"
bool isTemplateInstantiation = false;
if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(Func))
isTemplateInstantiation = Function->isTemplateInstantiation();
-
+
if (!isVirtualMethod && !isTemplateInstantiation)
D.diag_NeverFallThroughOrReturn =
diag::warn_suggest_noreturn_function;
else
D.diag_NeverFallThroughOrReturn = 0;
-
+
D.funMode = Function;
return D;
}
@@ -1226,7 +1226,7 @@ static void DiagnoseSwitchLabelsFallthro
bool PerFunction) {
// Only perform this analysis when using [[]] attributes. There is no good
// workflow for this warning when not using C++11. There is no good way to
- // silence the warning (no attribute is available) unless we are using
+ // silence the warning (no attribute is available) unless we are using
// [[]] attributes. One could use pragmas to silence the warning, but as a
// general solution that is gross and not in the spirit of this warning.
//
@@ -1492,7 +1492,7 @@ class UninitValsDiagReporter : public Un
// order of diagnostics when calling flushDiagnostics().
typedef llvm::MapVector<const VarDecl *, MappedType> UsesMap;
UsesMap uses;
-
+
public:
UninitValsDiagReporter(Sema &S) : S(S) {}
~UninitValsDiagReporter() override { flushDiagnostics(); }
@@ -1508,11 +1508,11 @@ public:
const UninitUse &use) override {
getUses(vd).getPointer()->push_back(use);
}
-
+
void handleSelfInit(const VarDecl *vd) override {
getUses(vd).setInt(true);
}
-
+
void flushDiagnostics() {
for (const auto &P : uses) {
const VarDecl *vd = P.first;
@@ -1521,7 +1521,7 @@ public:
UsesVec *vec = V.getPointer();
bool hasSelfInit = V.getInt();
- // Specially handle the case where we have uses of an uninitialized
+ // Specially handle the case where we have uses of an uninitialized
// variable, but the root cause is an idiomatic self-init. We want
// to report the diagnostic at the self-init since that is the root cause.
if (!vec->empty() && hasSelfInit && hasAlwaysUninitializedUse(vec))
@@ -1551,7 +1551,7 @@ public:
break;
}
}
-
+
// Release the uses vector.
delete vec;
}
@@ -1865,10 +1865,10 @@ namespace clang {
namespace consumed {
namespace {
class ConsumedWarningsHandler : public ConsumedWarningsHandlerBase {
-
+
Sema &S;
DiagList Warnings;
-
+
public:
ConsumedWarningsHandler(Sema &S) : S(S) {}
@@ -1889,28 +1889,28 @@ public:
Warnings.emplace_back(std::move(Warning), OptionalNotes());
}
-
+
void warnParamReturnTypestateMismatch(SourceLocation Loc,
StringRef VariableName,
StringRef ExpectedState,
StringRef ObservedState) override {
-
+
PartialDiagnosticAt Warning(Loc, S.PDiag(
diag::warn_param_return_typestate_mismatch) << VariableName <<
ExpectedState << ObservedState);
Warnings.emplace_back(std::move(Warning), OptionalNotes());
}
-
+
void warnParamTypestateMismatch(SourceLocation Loc, StringRef ExpectedState,
StringRef ObservedState) override {
-
+
PartialDiagnosticAt Warning(Loc, S.PDiag(
diag::warn_param_typestate_mismatch) << ExpectedState << ObservedState);
Warnings.emplace_back(std::move(Warning), OptionalNotes());
}
-
+
void warnReturnTypestateForUnconsumableType(SourceLocation Loc,
StringRef TypeName) override {
PartialDiagnosticAt Warning(Loc, S.PDiag(
@@ -1918,28 +1918,28 @@ public:
Warnings.emplace_back(std::move(Warning), OptionalNotes());
}
-
+
void warnReturnTypestateMismatch(SourceLocation Loc, StringRef ExpectedState,
StringRef ObservedState) override {
-
+
PartialDiagnosticAt Warning(Loc, S.PDiag(
diag::warn_return_typestate_mismatch) << ExpectedState << ObservedState);
Warnings.emplace_back(std::move(Warning), OptionalNotes());
}
-
+
void warnUseOfTempInInvalidState(StringRef MethodName, StringRef State,
SourceLocation Loc) override {
-
+
PartialDiagnosticAt Warning(Loc, S.PDiag(
diag::warn_use_of_temp_in_invalid_state) << MethodName << State);
Warnings.emplace_back(std::move(Warning), OptionalNotes());
}
-
+
void warnUseInInvalidState(StringRef MethodName, StringRef VariableName,
StringRef State, SourceLocation Loc) override {
-
+
PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_use_in_invalid_state) <<
MethodName << VariableName << State);
@@ -2027,7 +2027,7 @@ AnalysisBasedWarnings::IssueWarnings(sem
flushDiagnostics(S, fscope);
return;
}
-
+
const Stmt *Body = D->getBody();
assert(Body);
@@ -2113,7 +2113,7 @@ AnalysisBasedWarnings::IssueWarnings(sem
if (!analyzed)
flushDiagnostics(S, fscope);
}
-
+
// Warning: check missing 'return'
if (P.enableCheckFallThrough) {
const CheckFallThroughDiagnostics &CD =
Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp (original)
+++ cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Mon Jul 30 12:24:48 2018
@@ -49,7 +49,7 @@ bool CodeCompletionContext::wantConstruc
case CCC_ObjCMessageReceiver:
case CCC_ParenthesizedExpression:
return true;
-
+
case CCC_TopLevel:
case CCC_ObjCInterface:
case CCC_ObjCImplementation:
@@ -164,7 +164,7 @@ StringRef clang::getCompletionKindString
// Code completion string implementation
//===----------------------------------------------------------------------===//
-CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text)
+CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text)
: Kind(Kind), Text("") {
switch (Kind) {
case CK_TypedText:
@@ -178,7 +178,7 @@ CodeCompletionString::Chunk::Chunk(Chunk
case CK_Optional:
llvm_unreachable("Optional strings cannot be created from text");
-
+
case CK_LeftParen:
this->Text = "(";
break;
@@ -190,11 +190,11 @@ CodeCompletionString::Chunk::Chunk(Chunk
case CK_LeftBracket:
this->Text = "[";
break;
-
+
case CK_RightBracket:
this->Text = "]";
break;
-
+
case CK_LeftBrace:
this->Text = "{";
break;
@@ -206,11 +206,11 @@ CodeCompletionString::Chunk::Chunk(Chunk
case CK_LeftAngle:
this->Text = "<";
break;
-
+
case CK_RightAngle:
this->Text = ">";
break;
-
+
case CK_Comma:
this->Text = ", ";
break;
@@ -242,7 +242,7 @@ CodeCompletionString::Chunk::CreateText(
return Chunk(CK_Text, Text);
}
-CodeCompletionString::Chunk
+CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreateOptional(CodeCompletionString *Optional) {
Chunk Result;
Result.Kind = CK_Optional;
@@ -250,30 +250,30 @@ CodeCompletionString::Chunk::CreateOptio
return Result;
}
-CodeCompletionString::Chunk
+CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreatePlaceholder(const char *Placeholder) {
return Chunk(CK_Placeholder, Placeholder);
}
-CodeCompletionString::Chunk
+CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreateInformative(const char *Informative) {
return Chunk(CK_Informative, Informative);
}
-CodeCompletionString::Chunk
+CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreateResultType(const char *ResultType) {
return Chunk(CK_ResultType, ResultType);
}
-CodeCompletionString::Chunk
+CodeCompletionString::Chunk
CodeCompletionString::Chunk::CreateCurrentParameter(
const char *CurrentParameter) {
return Chunk(CK_CurrentParameter, CurrentParameter);
}
-CodeCompletionString::CodeCompletionString(const Chunk *Chunks,
+CodeCompletionString::CodeCompletionString(const Chunk *Chunks,
unsigned NumChunks,
- unsigned Priority,
+ unsigned Priority,
CXAvailabilityKind Availability,
const char **Annotations,
unsigned NumAnnotations,
@@ -281,7 +281,7 @@ CodeCompletionString::CodeCompletionStri
const char *BriefComment)
: NumChunks(NumChunks), NumAnnotations(NumAnnotations),
Priority(Priority), Availability(Availability),
- ParentName(ParentName), BriefComment(BriefComment) {
+ ParentName(ParentName), BriefComment(BriefComment) {
assert(NumChunks <= 0xffff);
assert(NumAnnotations <= 0xffff);
@@ -308,17 +308,17 @@ const char *CodeCompletionString::getAnn
std::string CodeCompletionString::getAsString() const {
std::string Result;
llvm::raw_string_ostream OS(Result);
-
+
for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) {
switch (C->Kind) {
case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break;
case CK_Placeholder: OS << "<#" << C->Text << "#>"; break;
-
- case CK_Informative:
+
+ case CK_Informative:
case CK_ResultType:
- OS << "[#" << C->Text << "#]";
+ OS << "[#" << C->Text << "#]";
break;
-
+
case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break;
default: OS << C->Text; break;
}
@@ -350,7 +350,7 @@ StringRef CodeCompletionTUInfo::getParen
const NamedDecl *ND = dyn_cast<NamedDecl>(DC);
if (!ND)
return {};
-
+
// Check whether we've already cached the parent name.
StringRef &CachedParentName = ParentNames[DC];
if (!CachedParentName.empty())
@@ -368,7 +368,7 @@ StringRef CodeCompletionTUInfo::getParen
if (ND->getIdentifier())
Contexts.push_back(DC);
}
-
+
DC = DC->getParent();
}
@@ -382,11 +382,11 @@ StringRef CodeCompletionTUInfo::getParen
else {
OS << "::";
}
-
+
const DeclContext *CurDC = Contexts[I-1];
if (const ObjCCategoryImplDecl *CatImpl = dyn_cast<ObjCCategoryImplDecl>(CurDC))
CurDC = CatImpl->getCategoryDecl();
-
+
if (const ObjCCategoryDecl *Cat = dyn_cast<ObjCCategoryDecl>(CurDC)) {
const ObjCInterfaceDecl *Interface = Cat->getClassInterface();
if (!Interface) {
@@ -395,13 +395,13 @@ StringRef CodeCompletionTUInfo::getParen
CachedParentName = StringRef((const char *)(uintptr_t)~0U, 0);
return {};
}
-
+
OS << Interface->getName() << '(' << Cat->getName() << ')';
} else {
OS << cast<NamedDecl>(CurDC)->getName();
}
}
-
+
CachedParentName = AllocatorRef->CopyString(OS.str());
}
@@ -413,7 +413,7 @@ CodeCompletionString *CodeCompletionBuil
sizeof(CodeCompletionString) + sizeof(Chunk) * Chunks.size() +
sizeof(const char *) * Annotations.size(),
alignof(CodeCompletionString));
- CodeCompletionString *Result
+ CodeCompletionString *Result
= new (Mem) CodeCompletionString(Chunks.data(), Chunks.size(),
Priority, Availability,
Annotations.data(), Annotations.size(),
@@ -459,14 +459,14 @@ void CodeCompletionBuilder::AddChunk(Cod
void CodeCompletionBuilder::addParentContext(const DeclContext *DC) {
if (DC->isTranslationUnit())
return;
-
+
if (DC->isFunctionOrMethod())
return;
-
+
const NamedDecl *ND = dyn_cast<NamedDecl>(DC);
if (!ND)
return;
-
+
ParentName = getCodeCompletionTUInfo().getParentName(DC);
}
@@ -492,11 +492,11 @@ CodeCompleteConsumer::OverloadCandidate:
switch (Kind) {
case CK_Function:
return Function->getType()->getAs<FunctionType>();
-
+
case CK_FunctionTemplate:
return FunctionTemplate->getTemplatedDecl()->getType()
->getAs<FunctionType>();
-
+
case CK_FunctionType:
return Type;
}
@@ -526,13 +526,13 @@ bool PrintingCodeCompleteConsumer::isRes
llvm_unreachable("Unknown code completion result Kind.");
}
-void
+void
PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef,
CodeCompletionContext Context,
CodeCompletionResult *Results,
unsigned NumResults) {
std::stable_sort(Results, Results + NumResults);
-
+
StringRef Filter = SemaRef.getPreprocessor().getCodeCompletionFilter();
// Print the results.
@@ -545,7 +545,7 @@ PrintingCodeCompleteConsumer::ProcessCod
OS << *Results[I].Declaration;
if (Results[I].Hidden)
OS << " (Hidden)";
- if (CodeCompletionString *CCS
+ if (CodeCompletionString *CCS
= Results[I].CreateCodeCompletionString(SemaRef, Context,
getAllocator(),
CCTUInfo,
@@ -574,14 +574,14 @@ PrintingCodeCompleteConsumer::ProcessCod
}
OS << '\n';
break;
-
+
case CodeCompletionResult::RK_Keyword:
OS << Results[I].Keyword << '\n';
break;
-
+
case CodeCompletionResult::RK_Macro:
OS << Results[I].Macro->getName();
- if (CodeCompletionString *CCS
+ if (CodeCompletionString *CCS
= Results[I].CreateCodeCompletionString(SemaRef, Context,
getAllocator(),
CCTUInfo,
@@ -590,9 +590,9 @@ PrintingCodeCompleteConsumer::ProcessCod
}
OS << '\n';
break;
-
+
case CodeCompletionResult::RK_Pattern:
- OS << "Pattern : "
+ OS << "Pattern : "
<< Results[I].Pattern->getAsString() << '\n';
break;
}
@@ -624,7 +624,7 @@ static std::string getOverloadAsString(c
return OS.str();
}
-void
+void
PrintingCodeCompleteConsumer::ProcessOverloadCandidates(Sema &SemaRef,
unsigned CurrentArg,
OverloadCandidate *Candidates,
@@ -655,19 +655,19 @@ void CodeCompletionResult::computeCursor
break;
}
LLVM_FALLTHROUGH;
-
+
case RK_Declaration: {
// Set the availability based on attributes.
switch (getDeclAvailability(Declaration)) {
case AR_Available:
case AR_NotYetIntroduced:
- Availability = CXAvailability_Available;
+ Availability = CXAvailability_Available;
break;
-
+
case AR_Deprecated:
Availability = CXAvailability_Deprecated;
break;
-
+
case AR_Unavailable:
Availability = CXAvailability_NotAvailable;
break;
@@ -676,11 +676,11 @@ void CodeCompletionResult::computeCursor
if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(Declaration))
if (Function->isDeleted())
Availability = CXAvailability_NotAvailable;
-
+
CursorKind = getCursorKindForDecl(Declaration);
if (CursorKind == CXCursor_UnexposedDecl) {
- // FIXME: Forward declarations of Objective-C classes and protocols
- // are not directly exposed, but we want code completion to treat them
+ // FIXME: Forward declarations of Objective-C classes and protocols
+ // are not directly exposed, but we want code completion to treat them
// like a definition.
if (isa<ObjCInterfaceDecl>(Declaration))
CursorKind = CXCursor_ObjCInterfaceDecl;
@@ -717,9 +717,9 @@ StringRef CodeCompletionResult::getOrder
// Handle declarations below.
break;
}
-
+
DeclarationName Name = Declaration->getDeclName();
-
+
// If the name is a simple identifier (by far the common case), or a
// zero-argument selector, just return a reference to that identifier.
if (IdentifierInfo *Id = Name.getAsIdentifierInfo())
@@ -728,12 +728,12 @@ StringRef CodeCompletionResult::getOrder
if (IdentifierInfo *Id
= Name.getObjCSelector().getIdentifierInfoForSlot(0))
return Id->getName();
-
+
Saved = Name.getAsString();
return Saved;
}
-
-bool clang::operator<(const CodeCompletionResult &X,
+
+bool clang::operator<(const CodeCompletionResult &X,
const CodeCompletionResult &Y) {
std::string XSaved, YSaved;
StringRef XStr = X.getOrderedName(XSaved);
@@ -741,11 +741,11 @@ bool clang::operator<(const CodeCompleti
int cmp = XStr.compare_lower(YStr);
if (cmp)
return cmp < 0;
-
+
// If case-insensitive comparison fails, try case-sensitive comparison.
cmp = XStr.compare(YStr);
if (cmp)
return cmp < 0;
-
+
return false;
}
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Mon Jul 30 12:24:48 2018
@@ -44,7 +44,7 @@ void UnqualifiedId::setConstructorTempla
EndLocation = TemplateId->RAngleLoc;
}
-void CXXScopeSpec::Extend(ASTContext &Context, SourceLocation TemplateKWLoc,
+void CXXScopeSpec::Extend(ASTContext &Context, SourceLocation TemplateKWLoc,
TypeLoc TL, SourceLocation ColonColonLoc) {
Builder.Extend(Context, TemplateKWLoc, TL, ColonColonLoc);
if (Range.getBegin().isInvalid())
@@ -56,23 +56,23 @@ void CXXScopeSpec::Extend(ASTContext &Co
}
void CXXScopeSpec::Extend(ASTContext &Context, IdentifierInfo *Identifier,
- SourceLocation IdentifierLoc,
+ SourceLocation IdentifierLoc,
SourceLocation ColonColonLoc) {
Builder.Extend(Context, Identifier, IdentifierLoc, ColonColonLoc);
-
+
if (Range.getBegin().isInvalid())
Range.setBegin(IdentifierLoc);
Range.setEnd(ColonColonLoc);
-
+
assert(Range == Builder.getSourceRange() &&
"NestedNameSpecifierLoc range computation incorrect");
}
void CXXScopeSpec::Extend(ASTContext &Context, NamespaceDecl *Namespace,
- SourceLocation NamespaceLoc,
+ SourceLocation NamespaceLoc,
SourceLocation ColonColonLoc) {
Builder.Extend(Context, Namespace, NamespaceLoc, ColonColonLoc);
-
+
if (Range.getBegin().isInvalid())
Range.setBegin(NamespaceLoc);
Range.setEnd(ColonColonLoc);
@@ -82,10 +82,10 @@ void CXXScopeSpec::Extend(ASTContext &Co
}
void CXXScopeSpec::Extend(ASTContext &Context, NamespaceAliasDecl *Alias,
- SourceLocation AliasLoc,
+ SourceLocation AliasLoc,
SourceLocation ColonColonLoc) {
Builder.Extend(Context, Alias, AliasLoc, ColonColonLoc);
-
+
if (Range.getBegin().isInvalid())
Range.setBegin(AliasLoc);
Range.setEnd(ColonColonLoc);
@@ -94,12 +94,12 @@ void CXXScopeSpec::Extend(ASTContext &Co
"NestedNameSpecifierLoc range computation incorrect");
}
-void CXXScopeSpec::MakeGlobal(ASTContext &Context,
+void CXXScopeSpec::MakeGlobal(ASTContext &Context,
SourceLocation ColonColonLoc) {
Builder.MakeGlobal(Context, ColonColonLoc);
-
+
Range = SourceRange(ColonColonLoc);
-
+
assert(Range == Builder.getSourceRange() &&
"NestedNameSpecifierLoc range computation incorrect");
}
@@ -116,7 +116,7 @@ void CXXScopeSpec::MakeSuper(ASTContext
"NestedNameSpecifierLoc range computation incorrect");
}
-void CXXScopeSpec::MakeTrivial(ASTContext &Context,
+void CXXScopeSpec::MakeTrivial(ASTContext &Context,
NestedNameSpecifier *Qualifier, SourceRange R) {
Builder.MakeTrivial(Context, Qualifier, R);
Range = R;
@@ -139,11 +139,11 @@ SourceLocation CXXScopeSpec::getLastQual
return Builder.getTemporary().getLocalBeginLoc();
}
-NestedNameSpecifierLoc
+NestedNameSpecifierLoc
CXXScopeSpec::getWithLocInContext(ASTContext &Context) const {
if (!Builder.getRepresentation())
return NestedNameSpecifierLoc();
-
+
return Builder.getWithLocInContext(Context);
}
@@ -232,7 +232,7 @@ DeclaratorChunk DeclaratorChunk::getFunc
I.Fun.DeleteParams = true;
}
for (unsigned i = 0; i < NumParams; i++)
- I.Fun.Params[i] = std::move(Params[i]);
+ I.Fun.Params[i] = std::move(Params[i]);
}
// Check what exception specification information we should actually store.
@@ -323,7 +323,7 @@ bool Declarator::isDeclarationOfFunction
}
llvm_unreachable("Invalid type chunk");
}
-
+
switch (DS.getTypeSpecType()) {
case TST_atomic:
case TST_auto:
@@ -369,20 +369,20 @@ bool Declarator::isDeclarationOfFunction
if (Expr *E = DS.getRepAsExpr())
return E->getType()->isFunctionType();
return false;
-
+
case TST_underlyingType:
case TST_typename:
case TST_typeofType: {
QualType QT = DS.getRepAsType().get();
if (QT.isNull())
return false;
-
+
if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT))
QT = LIT->getType();
if (QT.isNull())
return false;
-
+
return QT->isFunctionType();
}
}
@@ -438,8 +438,8 @@ template <class T> static bool BadSpecif
if (TNew != TPrev)
DiagID = diag::err_invalid_decl_spec_combination;
else
- DiagID = IsExtension ? diag::ext_duplicate_declspec :
- diag::warn_duplicate_declspec;
+ DiagID = IsExtension ? diag::ext_duplicate_declspec :
+ diag::warn_duplicate_declspec;
return true;
}
@@ -970,7 +970,7 @@ bool DeclSpec::setModulePrivateSpec(Sour
DiagID = diag::ext_duplicate_declspec;
return true;
}
-
+
ModulePrivateLoc = Loc;
return false;
}
@@ -1300,7 +1300,7 @@ bool DeclSpec::isMissingDeclaratorOk() {
StorageClassSpec != DeclSpec::SCS_typedef;
}
-void UnqualifiedId::setOperatorFunctionId(SourceLocation OperatorLoc,
+void UnqualifiedId::setOperatorFunctionId(SourceLocation OperatorLoc,
OverloadedOperatorKind Op,
SourceLocation SymbolLocations[3]) {
Kind = UnqualifiedIdKind::IK_OperatorFunctionId;
@@ -1309,7 +1309,7 @@ void UnqualifiedId::setOperatorFunctionI
OperatorFunctionId.Operator = Op;
for (unsigned I = 0; I != 3; ++I) {
OperatorFunctionId.SymbolLocations[I] = SymbolLocations[I].getRawEncoding();
-
+
if (SymbolLocations[I].isValid())
EndLocation = SymbolLocations[I];
}
@@ -1321,7 +1321,7 @@ bool VirtSpecifiers::SetSpecifier(Specif
FirstLocation = Loc;
LastLocation = Loc;
LastSpecifier = VS;
-
+
if (Specifiers & VS) {
PrevSpec = getSpecifierName(VS);
return true;
Modified: cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DelayedDiagnostic.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DelayedDiagnostic.cpp (original)
+++ cfe/trunk/lib/Sema/DelayedDiagnostic.cpp Mon Jul 30 12:24:48 2018
@@ -59,8 +59,8 @@ DelayedDiagnostic::makeAvailability(Avai
void DelayedDiagnostic::Destroy() {
switch (Kind) {
- case Access:
- getAccessData().~AccessedEntity();
+ case Access:
+ getAccessData().~AccessedEntity();
break;
case Availability:
Modified: cfe/trunk/lib/Sema/IdentifierResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/IdentifierResolver.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/IdentifierResolver.cpp (original)
+++ cfe/trunk/lib/Sema/IdentifierResolver.cpp Mon Jul 30 12:24:48 2018
@@ -46,7 +46,7 @@ class IdentifierResolver::IdDeclInfoMap
IdDeclInfoPool(IdDeclInfoPool *Next) : Next(Next) {}
};
-
+
IdDeclInfoPool *CurPool = nullptr;
unsigned int CurIndex = POOL_SIZE;
@@ -171,9 +171,9 @@ void IdentifierResolver::InsertDeclAfter
DeclarationName Name = D->getDeclName();
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
updatingIdentifier(*II);
-
+
void *Ptr = Name.getFETokenInfo<void>();
-
+
if (!Ptr) {
AddDecl(D);
return;
@@ -196,7 +196,7 @@ void IdentifierResolver::InsertDeclAfter
return;
}
- // General case: insert the declaration at the appropriate point in the
+ // General case: insert the declaration at the appropriate point in the
// list, which already has at least two elements.
IdDeclInfo *IDI = toIdDeclInfo(Ptr);
if (Pos.isIterator()) {
@@ -231,7 +231,7 @@ IdentifierResolver::iterator
IdentifierResolver::begin(DeclarationName Name) {
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
readingIdentifier(*II);
-
+
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) return end();
@@ -258,7 +258,7 @@ enum DeclMatchKind {
} // namespace
/// Compare two declarations to see whether they are different or,
-/// if they are the same, whether the new declaration should replace the
+/// if they are the same, whether the new declaration should replace the
/// existing declaration.
static DeclMatchKind compareDeclarations(NamedDecl *Existing, NamedDecl *New) {
// If the declarations are identical, ignore the new one.
@@ -289,40 +289,40 @@ static DeclMatchKind compareDeclarations
for (auto RD : New->redecls()) {
if (RD == Existing)
return DMK_Replace;
-
+
if (RD->isCanonicalDecl())
break;
}
-
+
return DMK_Ignore;
}
-
+
return DMK_Different;
}
bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
if (IdentifierInfo *II = Name.getAsIdentifierInfo())
readingIdentifier(*II);
-
+
void *Ptr = Name.getFETokenInfo<void>();
-
+
if (!Ptr) {
Name.setFETokenInfo(D);
return true;
}
-
+
IdDeclInfo *IDI;
-
+
if (isDeclPtr(Ptr)) {
NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
-
+
switch (compareDeclarations(PrevD, D)) {
case DMK_Different:
break;
-
+
case DMK_Ignore:
return false;
-
+
case DMK_Replace:
Name.setFETokenInfo(D);
return true;
@@ -330,7 +330,7 @@ bool IdentifierResolver::tryAddTopLevelD
Name.setFETokenInfo(nullptr);
IDI = &(*IdDeclInfos)[Name];
-
+
// If the existing declaration is not visible in translation unit scope,
// then add the new top-level declaration first.
if (!PrevD->getDeclContext()->getRedeclContext()->isTranslationUnit()) {
@@ -341,28 +341,28 @@ bool IdentifierResolver::tryAddTopLevelD
IDI->AddDecl(D);
}
return true;
- }
-
+ }
+
IDI = toIdDeclInfo(Ptr);
// See whether this declaration is identical to any existing declarations.
// If not, find the right place to insert it.
- for (IdDeclInfo::DeclsTy::iterator I = IDI->decls_begin(),
+ for (IdDeclInfo::DeclsTy::iterator I = IDI->decls_begin(),
IEnd = IDI->decls_end();
I != IEnd; ++I) {
-
+
switch (compareDeclarations(*I, D)) {
case DMK_Different:
break;
-
+
case DMK_Ignore:
return false;
-
+
case DMK_Replace:
*I = D;
return true;
}
-
+
if (!(*I)->getDeclContext()->getRedeclContext()->isTranslationUnit()) {
// We've found a declaration that is not visible from the translation
// unit (it's in an inner scope). Insert our declaration here.
@@ -370,7 +370,7 @@ bool IdentifierResolver::tryAddTopLevelD
return true;
}
}
-
+
// Add the declaration to the end.
IDI->AddDecl(D);
return true;
@@ -378,13 +378,13 @@ bool IdentifierResolver::tryAddTopLevelD
void IdentifierResolver::readingIdentifier(IdentifierInfo &II) {
if (II.isOutOfDate())
- PP.getExternalSource()->updateOutOfDateIdentifier(II);
+ PP.getExternalSource()->updateOutOfDateIdentifier(II);
}
void IdentifierResolver::updatingIdentifier(IdentifierInfo &II) {
if (II.isOutOfDate())
PP.getExternalSource()->updateOutOfDateIdentifier(II);
-
+
if (II.isFromAST())
II.setFETokenInfoChangedSinceDeserialization();
}
Modified: cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp (original)
+++ cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp Mon Jul 30 12:24:48 2018
@@ -121,7 +121,7 @@ void MultiplexExternalSemaSource::FindEx
Sources[i]->FindExternalLexicalDecls(DC, IsKindWeWant, Result);
}
-void MultiplexExternalSemaSource::FindFileRegionDecls(FileID File,
+void MultiplexExternalSemaSource::FindFileRegionDecls(FileID File,
unsigned Offset,
unsigned Length,
SmallVectorImpl<Decl *> &Decls){
@@ -179,13 +179,13 @@ bool MultiplexExternalSemaSource::DeclIs
}
bool MultiplexExternalSemaSource::layoutRecordType(const RecordDecl *Record,
- uint64_t &Size,
+ uint64_t &Size,
uint64_t &Alignment,
llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets){
for(size_t i = 0; i < Sources.size(); ++i)
- if (Sources[i]->layoutRecordType(Record, Size, Alignment, FieldOffsets,
+ if (Sources[i]->layoutRecordType(Record, Size, Alignment, FieldOffsets,
BaseOffsets, VirtualBaseOffsets))
return true;
return false;
@@ -243,10 +243,10 @@ void MultiplexExternalSemaSource::ReadMi
Source->ReadMismatchingDeleteExpressions(Exprs);
}
-bool MultiplexExternalSemaSource::LookupUnqualified(LookupResult &R, Scope *S){
+bool MultiplexExternalSemaSource::LookupUnqualified(LookupResult &R, Scope *S){
for(size_t i = 0; i < Sources.size(); ++i)
Sources[i]->LookupUnqualified(R, S);
-
+
return !R.empty();
}
@@ -255,13 +255,13 @@ void MultiplexExternalSemaSource::ReadTe
for(size_t i = 0; i < Sources.size(); ++i)
Sources[i]->ReadTentativeDefinitions(TentativeDefs);
}
-
+
void MultiplexExternalSemaSource::ReadUnusedFileScopedDecls(
SmallVectorImpl<const DeclaratorDecl*> &Decls) {
for(size_t i = 0; i < Sources.size(); ++i)
Sources[i]->ReadUnusedFileScopedDecls(Decls);
}
-
+
void MultiplexExternalSemaSource::ReadDelegatingConstructors(
SmallVectorImpl<CXXConstructorDecl*> &Decls) {
for(size_t i = 0; i < Sources.size(); ++i)
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Mon Jul 30 12:24:48 2018
@@ -1500,7 +1500,7 @@ LambdaScopeInfo *Sema::getCurLambda(bool
return CurLSI;
}
-// We have a generic lambda if we parsed auto parameters, or we have
+// We have a generic lambda if we parsed auto parameters, or we have
// an associated template parameter list.
LambdaScopeInfo *Sema::getCurGenericLambda() {
if (LambdaScopeInfo *LSI = getCurLambda()) {
Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Mon Jul 30 12:24:48 2018
@@ -152,8 +152,8 @@ struct AccessTarget : public AccessedEnt
: AccessedEntity(Entity) {
initialize();
}
-
- AccessTarget(ASTContext &Context,
+
+ AccessTarget(ASTContext &Context,
MemberNonce _,
CXXRecordDecl *NamingClass,
DeclAccessPair FoundDecl,
@@ -163,7 +163,7 @@ struct AccessTarget : public AccessedEnt
initialize();
}
- AccessTarget(ASTContext &Context,
+ AccessTarget(ASTContext &Context,
BaseNonce _,
CXXRecordDecl *BaseClass,
CXXRecordDecl *DerivedClass,
@@ -777,7 +777,7 @@ static AccessResult HasAccess(Sema &S,
// We interpret this as a restriction on [M3].
// In this part of the code, 'C' is just our context class ECRecord.
-
+
// These rules are different if we don't have an instance context.
if (!Target.hasInstanceContext()) {
// If it's not an instance member, these restrictions don't apply.
@@ -1272,8 +1272,8 @@ static void DiagnoseBadAccess(Sema &S, S
DiagnoseAccessPath(S, EC, Entity);
}
-/// MSVC has a bug where if during an using declaration name lookup,
-/// the declaration found is unaccessible (private) and that declaration
+/// MSVC has a bug where if during an using declaration name lookup,
+/// the declaration found is unaccessible (private) and that declaration
/// was bring into scope via another using declaration whose target
/// declaration is accessible (public) then no error is generated.
/// Example:
@@ -1290,15 +1290,15 @@ static void DiagnoseBadAccess(Sema &S, S
/// using B::f;
/// };
///
-/// Here, B::f is private so this should fail in Standard C++, but
+/// Here, B::f is private so this should fail in Standard C++, but
/// because B::f refers to A::f which is public MSVC accepts it.
-static bool IsMicrosoftUsingDeclarationAccessBug(Sema& S,
+static bool IsMicrosoftUsingDeclarationAccessBug(Sema& S,
SourceLocation AccessLoc,
AccessTarget &Entity) {
if (UsingShadowDecl *Shadow =
dyn_cast<UsingShadowDecl>(Entity.getTargetDecl())) {
const NamedDecl *OrigDecl = Entity.getTargetDecl()->getUnderlyingDecl();
- if (Entity.getTargetDecl()->getAccess() == AS_private &&
+ if (Entity.getTargetDecl()->getAccess() == AS_private &&
(OrigDecl->getAccess() == AS_public ||
OrigDecl->getAccess() == AS_protected)) {
S.Diag(AccessLoc, diag::ext_ms_using_declaration_inaccessible)
@@ -1536,7 +1536,7 @@ Sema::AccessResult Sema::CheckUnresolved
Found.getAccess() == AS_public)
return AR_accessible;
- AccessTarget Entity(Context, AccessTarget::Member, E->getNamingClass(),
+ AccessTarget Entity(Context, AccessTarget::Member, E->getNamingClass(),
Found, QualType());
Entity.setDiag(diag::err_access) << E->getSourceRange();
@@ -1691,7 +1691,7 @@ Sema::AccessResult Sema::CheckConstructo
AccessEntity.setDiag(PD);
return CheckAccess(*this, UseLoc, AccessEntity);
-}
+}
/// Checks access to an overloaded operator new or delete.
Sema::AccessResult Sema::CheckAllocationAccess(SourceLocation OpLoc,
@@ -1823,7 +1823,7 @@ Sema::AccessResult Sema::CheckBaseClassA
BaseD = cast<CXXRecordDecl>(Base->getAs<RecordType>()->getDecl());
DerivedD = cast<CXXRecordDecl>(Derived->getAs<RecordType>()->getDecl());
- AccessTarget Entity(Context, AccessTarget::Base, BaseD, DerivedD,
+ AccessTarget Entity(Context, AccessTarget::Base, BaseD, DerivedD,
Path.Access);
if (DiagID)
Entity.setDiag(DiagID) << Derived << Base;
@@ -1893,7 +1893,7 @@ bool Sema::IsSimplyAccessible(NamedDecl
if (ObjCMethodDecl *MD = getCurMethodDecl())
ClassOfMethodDecl = MD->getClassInterface();
else if (FunctionDecl *FD = getCurFunctionDecl()) {
- if (ObjCImplDecl *Impl
+ if (ObjCImplDecl *Impl
= dyn_cast<ObjCImplDecl>(FD->getLexicalDeclContext())) {
if (ObjCImplementationDecl *IMPD
= dyn_cast<ObjCImplementationDecl>(Impl))
@@ -1903,21 +1903,21 @@ bool Sema::IsSimplyAccessible(NamedDecl
ClassOfMethodDecl = CatImplClass->getClassInterface();
}
}
-
+
// If we're not in an interface, this ivar is inaccessible.
if (!ClassOfMethodDecl)
return false;
-
+
// If we're inside the same interface that owns the ivar, we're fine.
if (declaresSameEntity(ClassOfMethodDecl, Ivar->getContainingInterface()))
return true;
-
+
// If the ivar is private, it's inaccessible.
if (Ivar->getCanonicalAccessControl() == ObjCIvarDecl::Private)
return false;
-
+
return Ivar->getContainingInterface()->isSuperClassOf(ClassOfMethodDecl);
}
-
+
return true;
}
Modified: cfe/trunk/lib/Sema/SemaAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAttr.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAttr.cpp Mon Jul 30 12:24:48 2018
@@ -268,7 +268,7 @@ void Sema::DiagnoseUnterminatedPragmaPac
}
}
-void Sema::ActOnPragmaMSStruct(PragmaMSStructKind Kind) {
+void Sema::ActOnPragmaMSStruct(PragmaMSStructKind Kind) {
MSStructPragmaOn = (Kind == PMSST_ON);
}
@@ -693,7 +693,7 @@ void Sema::AddRangeBasedOptnone(Function
AddOptnoneAttributeIfNoConflicts(FD, OptimizeOffPragmaLocation);
}
-void Sema::AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD,
+void Sema::AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD,
SourceLocation Loc) {
// Don't add a conflicting attribute. No diagnostic is needed.
if (FD->hasAttr<MinSizeAttr>() || FD->hasAttr<AlwaysInlineAttr>())
Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Mon Jul 30 12:24:48 2018
@@ -401,18 +401,18 @@ bool Sema::isNonTypeNestedNameSpecifier(
isDependent = isDependentScopeSpecifier(SS);
Found.setContextRange(SS.getRange());
}
-
+
if (LookupCtx) {
// Perform "qualified" name lookup into the declaration context we
// computed, which is either the type of the base of a member access
// expression or the declaration context associated with a prior
// nested-name-specifier.
-
+
// The declaration context must be complete.
if (!LookupCtx->isDependentContext() &&
RequireCompleteDeclContext(SS, LookupCtx))
return false;
-
+
LookupQualifiedName(Found, LookupCtx);
} else if (isDependent) {
return false;
@@ -420,7 +420,7 @@ bool Sema::isNonTypeNestedNameSpecifier(
LookupName(Found, S);
}
Found.suppressDiagnostics();
-
+
return Found.getAsSingle<NamespaceDecl>();
}
@@ -739,7 +739,7 @@ bool Sema::BuildCXXNestedNameSpecifier(S
= TLB.push<UnresolvedUsingTypeLoc>(T);
UnresolvedTL.setNameLoc(IdInfo.IdentifierLoc);
} else if (isa<SubstTemplateTypeParmType>(T)) {
- SubstTemplateTypeParmTypeLoc TL
+ SubstTemplateTypeParmTypeLoc TL
= TLB.push<SubstTemplateTypeParmTypeLoc>(T);
TL.setNameLoc(IdInfo.IdentifierLoc);
} else if (isa<SubstTemplateTypeParmPackType>(T)) {
@@ -772,11 +772,11 @@ bool Sema::BuildCXXNestedNameSpecifier(S
}
// In Microsoft mode, if we are within a templated function and we can't
- // resolve Identifier, then extend the SS with Identifier. This will have
- // the effect of resolving Identifier during template instantiation.
+ // resolve Identifier, then extend the SS with Identifier. This will have
+ // the effect of resolving Identifier during template instantiation.
// The goal is to be able to resolve a function call whose
// nested-name-specifier is located inside a dependent base class.
- // Example:
+ // Example:
//
// class C {
// public:
@@ -850,7 +850,7 @@ bool Sema::ActOnCXXNestedNameSpecifierDe
return true;
if (!T->isDependentType() && !T->getAs<TagType>()) {
- Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class_or_namespace)
+ Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class_or_namespace)
<< T << getLangOpts().CPlusPlus;
return true;
}
@@ -891,7 +891,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(S
bool EnteringContext) {
if (SS.isInvalid())
return true;
-
+
// Translate the parser's template argument list in our AST format.
TemplateArgumentListInfo TemplateArgs(LAngleLoc, RAngleLoc);
translateTemplateArguments(TemplateArgsIn, TemplateArgs);
@@ -905,7 +905,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(S
DTN->getQualifier(),
DTN->getIdentifier(),
TemplateArgs);
-
+
// Create source-location information for this type.
TypeLocBuilder Builder;
DependentTemplateSpecializationTypeLoc SpecTL
@@ -918,7 +918,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(S
SpecTL.setRAngleLoc(RAngleLoc);
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
-
+
SS.Extend(Context, TemplateKWLoc, Builder.getTypeLocInContext(Context, T),
CCLoc);
return false;
@@ -937,7 +937,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(S
return true;
}
- // We were able to resolve the template name to an actual template.
+ // We were able to resolve the template name to an actual template.
// Build an appropriate nested-name-specifier.
QualType T =
CheckTemplateIdType(Template.get(), TemplateNameLoc, TemplateArgs);
@@ -971,7 +971,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(S
namespace {
/// A structure that stores a nested-name-specifier annotation,
- /// including both the nested-name-specifier
+ /// including both the nested-name-specifier
struct NestedNameSpecifierAnnotation {
NestedNameSpecifier *NNS;
};
@@ -991,14 +991,14 @@ void *Sema::SaveNestedNameSpecifierAnnot
return Annotation;
}
-void Sema::RestoreNestedNameSpecifierAnnotation(void *AnnotationPtr,
+void Sema::RestoreNestedNameSpecifierAnnotation(void *AnnotationPtr,
SourceRange AnnotationRange,
CXXScopeSpec &SS) {
if (!AnnotationPtr) {
SS.SetInvalid(AnnotationRange);
return;
}
-
+
NestedNameSpecifierAnnotation *Annotation
= static_cast<NestedNameSpecifierAnnotation *>(AnnotationPtr);
SS.Adopt(NestedNameSpecifierLoc(Annotation->NNS, Annotation + 1));
@@ -1065,7 +1065,7 @@ bool Sema::ActOnCXXEnterDeclaratorScope(
// it is a complete declaration context.
if (!DC->isDependentContext() && RequireCompleteDeclContext(SS, DC))
return true;
-
+
EnterDeclaratorContext(S, DC);
// Rebuild the nested name specifier for the new scope.
Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Mon Jul 30 12:24:48 2018
@@ -205,13 +205,13 @@ static TryCastResult TryStaticMemberPoin
CXXCastPath &BasePath);
static TryCastResult TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr,
- QualType DestType,
+ QualType DestType,
Sema::CheckedConversionKind CCK,
SourceRange OpRange,
unsigned &msg, CastKind &Kind,
bool ListInitialization);
static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
- QualType DestType,
+ QualType DestType,
Sema::CheckedConversionKind CCK,
SourceRange OpRange,
unsigned &msg, CastKind &Kind,
@@ -319,7 +319,7 @@ Sema::BuildCXXNamedCast(SourceLocation O
return ExprError();
DiscardMisalignedMemberAddress(DestType.getTypePtr(), E);
}
-
+
return Op.complete(CXXStaticCastExpr::Create(Context, Op.ResultType,
Op.ValueKind, Op.Kind, Op.SrcExpr.get(),
&Op.BasePath, DestTInfo,
@@ -573,11 +573,11 @@ CastsAwayConstness(Sema &Self, QualType
"Destination type is not pointer or pointer to member.");
}
- QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType),
+ QualType UnwrappedSrcType = Self.Context.getCanonicalType(SrcType),
UnwrappedDestType = Self.Context.getCanonicalType(DestType);
- // Find the qualifiers. We only care about cvr-qualifiers for the
- // purpose of this check, because other qualifiers (address spaces,
+ // Find the qualifiers. We only care about cvr-qualifiers for the
+ // purpose of this check, because other qualifiers (address spaces,
// Objective-C GC, etc.) are part of the type's identity.
QualType PrevUnwrappedSrcType = UnwrappedSrcType;
QualType PrevUnwrappedDestType = UnwrappedDestType;
@@ -719,7 +719,7 @@ void CastOperation::CheckDynamicCast() {
// C++0x 5.2.7p2: If T is a pointer type, v shall be an rvalue of a pointer to
// complete class type, [...]. If T is an lvalue reference type, v shall be
- // an lvalue of a complete class type, [...]. If T is an rvalue reference
+ // an lvalue of a complete class type, [...]. If T is an rvalue reference
// type, v shall be an expression having a complete class type, [...]
QualType SrcType = Self.Context.getCanonicalType(OrigSrcType);
QualType SrcPointee;
@@ -788,7 +788,7 @@ void CastOperation::CheckDynamicCast() {
if (DestRecord &&
Self.IsDerivedFrom(OpRange.getBegin(), SrcPointee, DestPointee)) {
if (Self.CheckDerivedToBaseConversion(SrcPointee, DestPointee,
- OpRange.getBegin(), OpRange,
+ OpRange.getBegin(), OpRange,
&BasePath)) {
SrcExpr = ExprError();
return;
@@ -950,15 +950,15 @@ void CastOperation::CheckReinterpretCast
return;
unsigned msg = diag::err_bad_cxx_cast_generic;
- TryCastResult tcr =
- TryReinterpretCast(Self, SrcExpr, DestType,
+ TryCastResult tcr =
+ TryReinterpretCast(Self, SrcExpr, DestType,
/*CStyle*/false, OpRange, msg, Kind);
if (tcr != TC_Success && msg != 0) {
if (SrcExpr.isInvalid()) // if conversion failed, don't report another error
return;
if (SrcExpr.get()->getType() == Self.Context.OverloadTy) {
- //FIXME: &f<int>; is overloaded and resolvable
- Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload)
+ //FIXME: &f<int>; is overloaded and resolvable
+ Self.Diag(OpRange.getBegin(), diag::err_bad_reinterpret_cast_overload)
<< OverloadExpr::find(SrcExpr.get()).Expression->getName()
<< DestType << OpRange;
Self.NoteAllOverloadCandidates(SrcExpr.get());
@@ -996,8 +996,8 @@ void CastOperation::CheckStaticCast() {
Kind = CK_ToVoid;
if (claimPlaceholder(BuiltinType::Overload)) {
- Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr,
- false, // Decay Function to ptr
+ Self.ResolveAndFixSingleFunctionTemplateSpecialization(SrcExpr,
+ false, // Decay Function to ptr
true, // Complain
OpRange, DestType, diag::err_bad_static_cast_overload);
if (SrcExpr.isInvalid())
@@ -1025,7 +1025,7 @@ void CastOperation::CheckStaticCast() {
if (SrcExpr.get()->getType() == Self.Context.OverloadTy) {
OverloadExpr* oe = OverloadExpr::find(SrcExpr.get()).Expression;
Self.Diag(OpRange.getBegin(), diag::err_bad_static_cast_overload)
- << oe->getName() << DestType << OpRange
+ << oe->getName() << DestType << OpRange
<< oe->getQualifierLoc().getSourceRange();
Self.NoteAllOverloadCandidates(SrcExpr.get());
} else {
@@ -1048,15 +1048,15 @@ void CastOperation::CheckStaticCast() {
/// possible. If @p CStyle, ignore access restrictions on hierarchy casting
/// and casting away constness.
static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
- QualType DestType,
+ QualType DestType,
Sema::CheckedConversionKind CCK,
SourceRange OpRange, unsigned &msg,
CastKind &Kind, CXXCastPath &BasePath,
bool ListInitialization) {
// Determine whether we have the semantics of a C-style cast.
- bool CStyle
+ bool CStyle
= (CCK == Sema::CCK_CStyleCast || CCK == Sema::CCK_FunctionalCast);
-
+
// The order the tests is not entirely arbitrary. There is one conversion
// that can be handled in two different ways. Given:
// struct A {};
@@ -1082,7 +1082,7 @@ static TryCastResult TryStaticCast(Sema
if (tcr != TC_NotApplicable)
return tcr;
- // C++11 [expr.static.cast]p3:
+ // C++11 [expr.static.cast]p3:
// A glvalue of type "cv1 T1" can be cast to type "rvalue reference to cv2
// T2" if "cv2 T2" is reference-compatible with "cv1 T1".
tcr = TryLValueToRValueCast(Self, SrcExpr.get(), DestType, CStyle, Kind,
@@ -1098,7 +1098,7 @@ static TryCastResult TryStaticCast(Sema
return TC_Failed;
if (tcr != TC_NotApplicable)
return tcr;
-
+
// C++ 5.2.9p6: May apply the reverse of any standard conversion, except
// lvalue-to-rvalue, array-to-pointer, function-to-pointer, and boolean
// conversions, subject to further restrictions.
@@ -1126,7 +1126,7 @@ static TryCastResult TryStaticCast(Sema
}
}
}
-
+
// Reverse integral promotion/conversion. All such conversions are themselves
// again integral promotions or conversions and are thus already handled by
// p2 (TryDirectInitialization above).
@@ -1199,7 +1199,7 @@ static TryCastResult TryStaticCast(Sema
}
}
else if (DestType->isObjCObjectPointerType()) {
- // allow both c-style cast and static_cast of objective-c pointers as
+ // allow both c-style cast and static_cast of objective-c pointers as
// they are pervasive.
Kind = CK_CPointerToObjCPointerCast;
return TC_Success;
@@ -1230,7 +1230,7 @@ static TryCastResult TryStaticCast(Sema
if (SrcPointer->getPointeeType()->getAs<RecordType>() &&
DestPointer->getPointeeType()->getAs<RecordType>())
msg = diag::err_bad_cxx_cast_unrelated_class;
-
+
// We tried everything. Everything! Nothing works! :-(
return TC_NotApplicable;
}
@@ -1284,11 +1284,11 @@ TryCastResult TryLValueToRValueCast(Sema
if (!Self.IsDerivedFrom(SrcExpr->getLocStart(), SrcExpr->getType(),
R->getPointeeType(), Paths))
return TC_NotApplicable;
-
+
Self.BuildBasePathArray(Paths, BasePath);
} else
Kind = CK_NoOp;
-
+
return TC_Success;
}
@@ -1323,8 +1323,8 @@ TryStaticReferenceDowncast(Sema &Self, E
// FIXME: If the source is a prvalue, we should issue a warning (because the
// cast always has undefined behavior), and for AST consistency, we should
// materialize a temporary.
- return TryStaticDowncast(Self,
- Self.Context.getCanonicalType(SrcExpr->getType()),
+ return TryStaticDowncast(Self,
+ Self.Context.getCanonicalType(SrcExpr->getType()),
Self.Context.getCanonicalType(DestPointee), CStyle,
OpRange, SrcExpr->getType(), DestType, msg, Kind,
BasePath);
@@ -1355,9 +1355,9 @@ TryStaticPointerDowncast(Sema &Self, Qua
return TC_NotApplicable;
}
- return TryStaticDowncast(Self,
+ return TryStaticDowncast(Self,
Self.Context.getCanonicalType(SrcPointer->getPointeeType()),
- Self.Context.getCanonicalType(DestPointer->getPointeeType()),
+ Self.Context.getCanonicalType(DestPointer->getPointeeType()),
CStyle, OpRange, SrcType, DestType, msg, Kind,
BasePath);
}
@@ -1368,7 +1368,7 @@ TryStaticPointerDowncast(Sema &Self, Qua
TryCastResult
TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
bool CStyle, SourceRange OpRange, QualType OrigSrcType,
- QualType OrigDestType, unsigned &msg,
+ QualType OrigDestType, unsigned &msg,
CastKind &Kind, CXXCastPath &BasePath) {
// We can only work with complete types. But don't complain if it doesn't work
if (!Self.isCompleteType(OpRange.getBegin(), SrcType) ||
@@ -1434,7 +1434,7 @@ TryStaticDowncast(Sema &Self, CanQualTyp
}
Self.Diag(OpRange.getBegin(), diag::err_ambiguous_base_to_derived_cast)
- << QualType(SrcType).getUnqualifiedType()
+ << QualType(SrcType).getUnqualifiedType()
<< QualType(DestType).getUnqualifiedType()
<< PathDisplayStr << OpRange;
msg = 0;
@@ -1478,8 +1478,8 @@ TryStaticDowncast(Sema &Self, CanQualTyp
/// where B is a base class of D [...].
///
TryCastResult
-TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType,
- QualType DestType, bool CStyle,
+TryStaticMemberPointerUpcast(Sema &Self, ExprResult &SrcExpr, QualType SrcType,
+ QualType DestType, bool CStyle,
SourceRange OpRange,
unsigned &msg, CastKind &Kind,
CXXCastPath &BasePath) {
@@ -1499,7 +1499,7 @@ TryStaticMemberPointerUpcast(Sema &Self,
WasOverloadedFunction = true;
}
}
-
+
const MemberPointerType *SrcMemPtr = SrcType->getAs<MemberPointerType>();
if (!SrcMemPtr) {
msg = diag::err_bad_static_cast_member_pointer_nonmp;
@@ -1569,8 +1569,8 @@ TryStaticMemberPointerUpcast(Sema &Self,
if (WasOverloadedFunction) {
// Resolve the address of the overloaded function again, this time
// allowing complaints if something goes wrong.
- FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(),
- DestType,
+ FunctionDecl *Fn = Self.ResolveAddressOfOverloadedFunction(SrcExpr.get(),
+ DestType,
true,
FoundOverload);
if (!Fn) {
@@ -1597,7 +1597,7 @@ TryStaticMemberPointerUpcast(Sema &Self,
/// @c static_cast if the declaration "T t(e);" is well-formed [...].
TryCastResult
TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType,
- Sema::CheckedConversionKind CCK,
+ Sema::CheckedConversionKind CCK,
SourceRange OpRange, unsigned &msg,
CastKind &Kind, bool ListInitialization) {
if (DestType->isRecordType()) {
@@ -1625,26 +1625,26 @@ TryStaticImplicitCast(Sema &Self, ExprRe
InitializationSequence InitSeq(Self, Entity, InitKind, SrcExprRaw);
// At this point of CheckStaticCast, if the destination is a reference,
- // or the expression is an overload expression this has to work.
+ // or the expression is an overload expression this has to work.
// There is no other way that works.
// On the other hand, if we're checking a C-style cast, we've still got
// the reinterpret_cast way.
- bool CStyle
+ bool CStyle
= (CCK == Sema::CCK_CStyleCast || CCK == Sema::CCK_FunctionalCast);
if (InitSeq.Failed() && (CStyle || !DestType->isReferenceType()))
return TC_NotApplicable;
-
+
ExprResult Result = InitSeq.Perform(Self, Entity, InitKind, SrcExprRaw);
if (Result.isInvalid()) {
msg = 0;
return TC_Failed;
}
-
+
if (InitSeq.isConstructorInitialization())
Kind = CK_ConstructorConversion;
else
Kind = CK_NoOp;
-
+
SrcExpr = Result;
return TC_Success;
}
@@ -1976,7 +1976,7 @@ static TryCastResult TryReinterpretCast(
unsigned &msg,
CastKind &Kind) {
bool IsLValueCast = false;
-
+
DestType = Self.Context.getCanonicalType(DestType);
QualType SrcType = SrcExpr.get()->getType();
@@ -2019,7 +2019,7 @@ static TryCastResult TryReinterpretCast(
// FIXME: Use a specific diagnostic for the rest of these cases.
case OK_VectorComponent: inappropriate = "vector element"; break;
case OK_ObjCProperty: inappropriate = "property expression"; break;
- case OK_ObjCSubscript: inappropriate = "container subscripting expression";
+ case OK_ObjCSubscript: inappropriate = "container subscripting expression";
break;
}
if (inappropriate) {
@@ -2033,7 +2033,7 @@ static TryCastResult TryReinterpretCast(
// This code does this transformation for the checked types.
DestType = Self.Context.getPointerType(DestTypeTmp->getPointeeType());
SrcType = Self.Context.getPointerType(SrcType);
-
+
IsLValueCast = true;
}
@@ -2121,18 +2121,18 @@ static TryCastResult TryReinterpretCast(
msg = diag::err_bad_cxx_cast_scalar_to_vector_different_size;
else
msg = diag::err_bad_cxx_cast_vector_to_vector_different_size;
-
+
return TC_Failed;
}
if (SrcType == DestType) {
// C++ 5.2.10p2 has a note that mentions that, subject to all other
// restrictions, a cast to the same type is allowed so long as it does not
- // cast away constness. In C++98, the intent was not entirely clear here,
+ // cast away constness. In C++98, the intent was not entirely clear here,
// since all other paragraphs explicitly forbid casts to the same type.
// C++11 clarifies this case with p2.
//
- // The only allowed types are: integral, enumeration, pointer, or
+ // The only allowed types are: integral, enumeration, pointer, or
// pointer-to-member types. We also won't restrict Obj-C pointers either.
Kind = CK_NoOp;
TryCastResult Result = TC_NotApplicable;
@@ -2260,7 +2260,7 @@ static TryCastResult TryReinterpretCast(
<< OpRange;
return SuccessResult;
}
-
+
// C++ 5.2.10p7: A pointer to an object can be explicitly converted to
// a pointer to an object of different type.
// Void pointers are not specified, but supported by every compiler out there.
@@ -2296,7 +2296,7 @@ void CastOperation::CheckCXXCStyleCast(b
if (claimPlaceholder(BuiltinType::Overload)) {
Self.ResolveAndFixSingleFunctionTemplateSpecialization(
- SrcExpr, /* Decay Function to ptr */ false,
+ SrcExpr, /* Decay Function to ptr */ false,
/* Complain */ true, DestRange, DestType,
diag::err_bad_cstyle_cast_overload);
if (SrcExpr.isInvalid())
@@ -2404,7 +2404,7 @@ void CastOperation::CheckCXXCStyleCast(b
}
}
-/// DiagnoseBadFunctionCast - Warn whenever a function call is cast to a
+/// DiagnoseBadFunctionCast - Warn whenever a function call is cast to a
/// non-matching type. Such as enum function call to int, int call to
/// pointer; etc. Cast to 'void' is an exception.
static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr,
@@ -2412,10 +2412,10 @@ static void DiagnoseBadFunctionCast(Sema
if (Self.Diags.isIgnored(diag::warn_bad_function_cast,
SrcExpr.get()->getExprLoc()))
return;
-
+
if (!isa<CallExpr>(SrcExpr.get()))
return;
-
+
QualType SrcType = SrcExpr.get()->getType();
if (DestType.getUnqualifiedType()->isVoidType())
return;
@@ -2434,7 +2434,7 @@ static void DiagnoseBadFunctionCast(Sema
return;
if (SrcType->isComplexIntegerType() && DestType->isComplexIntegerType())
return;
-
+
Self.Diag(SrcExpr.get()->getExprLoc(),
diag::warn_bad_function_cast)
<< SrcType << DestType << SrcExpr.get()->getSourceRange();
@@ -2641,26 +2641,26 @@ void CastOperation::CheckCStyleCast() {
if (const PointerType *ExprPtr = SrcType->getAs<PointerType>()) {
Qualifiers CastQuals = CastPtr->getPointeeType().getQualifiers();
Qualifiers ExprQuals = ExprPtr->getPointeeType().getQualifiers();
- if (CastPtr->getPointeeType()->isObjCLifetimeType() &&
+ if (CastPtr->getPointeeType()->isObjCLifetimeType() &&
ExprPtr->getPointeeType()->isObjCLifetimeType() &&
!CastQuals.compatiblyIncludesObjCLifetime(ExprQuals)) {
- Self.Diag(SrcExpr.get()->getLocStart(),
+ Self.Diag(SrcExpr.get()->getLocStart(),
diag::err_typecheck_incompatible_ownership)
<< SrcType << DestType << Sema::AA_Casting
<< SrcExpr.get()->getSourceRange();
return;
}
}
- }
+ }
else if (!Self.CheckObjCARCUnavailableWeakConversion(DestType, SrcType)) {
- Self.Diag(SrcExpr.get()->getLocStart(),
+ Self.Diag(SrcExpr.get()->getLocStart(),
diag::err_arc_convesion_of_weak_unavailable)
<< 1 << SrcType << DestType << SrcExpr.get()->getSourceRange();
SrcExpr = ExprError();
return;
}
}
-
+
DiagnoseCastOfObjCSEL(Self, SrcExpr, DestType);
DiagnoseCallingConvCast(Self, SrcExpr, DestType, OpRange);
DiagnoseBadFunctionCast(Self, SrcExpr, DestType);
@@ -2714,7 +2714,7 @@ ExprResult Sema::BuildCStyleCastExpr(Sou
TypeSourceInfo *CastTypeInfo,
SourceLocation RPLoc,
Expr *CastExpr) {
- CastOperation Op(*this, CastTypeInfo->getType(), CastExpr);
+ CastOperation Op(*this, CastTypeInfo->getType(), CastExpr);
Op.DestRange = CastTypeInfo->getTypeLoc().getSourceRange();
Op.OpRange = SourceRange(LPLoc, CastExpr->getLocEnd());
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Jul 30 12:24:48 2018
@@ -119,7 +119,7 @@ static bool checkArgCount(Sema &S, CallE
// Highlight all the excess arguments.
SourceRange range(call->getArg(desiredArgCount)->getLocStart(),
call->getArg(argCount - 1)->getLocEnd());
-
+
return S.Diag(range.getBegin(), diag::err_typecheck_call_too_many_args)
<< 0 /*function call*/ << desiredArgCount << argCount
<< call->getArg(1)->getSourceRange();
@@ -888,18 +888,18 @@ Sema::CheckBuiltinFunctionCall(FunctionD
Context.GetBuiltinType(BuiltinID, Error, &ICEArguments);
if (Error != ASTContext::GE_None)
ICEArguments = 0; // Don't diagnose previously diagnosed errors.
-
+
// If any arguments are required to be ICE's, check and diagnose.
for (unsigned ArgNo = 0; ICEArguments != 0; ++ArgNo) {
// Skip arguments not required to be ICE's.
if ((ICEArguments & (1 << ArgNo)) == 0) continue;
-
+
llvm::APSInt Result;
if (SemaBuiltinConstantArg(TheCall, ArgNo, Result))
return true;
ICEArguments &= ~(1 << ArgNo);
}
-
+
switch (BuiltinID) {
case Builtin::BI__builtin___CFStringMakeConstantString:
assert(TheCall->getNumArgs() == 1 &&
@@ -3850,7 +3850,7 @@ DiagnoseCStringFormatDirectiveInCFAPI(Se
static bool isNonNullType(ASTContext &ctx, QualType type) {
if (auto nullability = type->getNullability(ctx))
return *nullability == NullabilityKind::NonNull;
-
+
return false;
}
@@ -3893,12 +3893,12 @@ static void CheckNonNullArguments(Sema &
parms = FD->parameters();
else
parms = cast<ObjCMethodDecl>(FDecl)->parameters();
-
+
unsigned ParamIndex = 0;
for (ArrayRef<ParmVarDecl*>::iterator I = parms.begin(), E = parms.end();
I != E; ++I, ++ParamIndex) {
const ParmVarDecl *PVD = *I;
- if (PVD->hasAttr<NonNullAttr>() ||
+ if (PVD->hasAttr<NonNullAttr>() ||
isNonNullType(S.Context, PVD->getType())) {
if (NonNullArgs.empty())
NonNullArgs.resize(Args.size());
@@ -3920,7 +3920,7 @@ static void CheckNonNullArguments(Sema &
// Dig out the function prototype, if there is one.
Proto = type->getAs<FunctionProtoType>();
- }
+ }
}
// Fill in non-null argument information from the nullability
@@ -3931,17 +3931,17 @@ static void CheckNonNullArguments(Sema &
if (isNonNullType(S.Context, paramType)) {
if (NonNullArgs.empty())
NonNullArgs.resize(Args.size());
-
+
NonNullArgs.set(Index);
}
-
+
++Index;
}
}
}
// Check for non-null arguments.
- for (unsigned ArgIndex = 0, ArgIndexEnd = NonNullArgs.size();
+ for (unsigned ArgIndex = 0, ArgIndexEnd = NonNullArgs.size();
ArgIndex != ArgIndexEnd; ++ArgIndex) {
if (NonNullArgs[ArgIndex])
CheckNonNullArgument(S, Args[ArgIndex], CallSiteLoc);
@@ -4074,7 +4074,7 @@ bool Sema::CheckFunctionCall(FunctionDec
return false;
}
-bool Sema::CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation lbrac,
+bool Sema::CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation lbrac,
ArrayRef<const Expr *> Args) {
VariadicCallType CallType =
Method->isVariadic() ? VariadicMethod : VariadicDoesNotApply;
@@ -4577,7 +4577,7 @@ ExprResult Sema::SemaAtomicOpsOverloaded
AtomicExpr *AE = new (Context) AtomicExpr(TheCall->getCallee()->getLocStart(),
SubExprs, ResultType, Op,
TheCall->getRParenLoc());
-
+
if ((Op == AtomicExpr::AO__c11_atomic_load ||
Op == AtomicExpr::AO__c11_atomic_store ||
Op == AtomicExpr::AO__opencl_atomic_load ||
@@ -4744,52 +4744,52 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
bool WarnAboutSemanticsChange = false;
switch (BuiltinID) {
default: llvm_unreachable("Unknown overloaded atomic builtin!");
- case Builtin::BI__sync_fetch_and_add:
+ case Builtin::BI__sync_fetch_and_add:
case Builtin::BI__sync_fetch_and_add_1:
case Builtin::BI__sync_fetch_and_add_2:
case Builtin::BI__sync_fetch_and_add_4:
case Builtin::BI__sync_fetch_and_add_8:
case Builtin::BI__sync_fetch_and_add_16:
- BuiltinIndex = 0;
+ BuiltinIndex = 0;
break;
-
- case Builtin::BI__sync_fetch_and_sub:
+
+ case Builtin::BI__sync_fetch_and_sub:
case Builtin::BI__sync_fetch_and_sub_1:
case Builtin::BI__sync_fetch_and_sub_2:
case Builtin::BI__sync_fetch_and_sub_4:
case Builtin::BI__sync_fetch_and_sub_8:
case Builtin::BI__sync_fetch_and_sub_16:
- BuiltinIndex = 1;
+ BuiltinIndex = 1;
break;
-
- case Builtin::BI__sync_fetch_and_or:
+
+ case Builtin::BI__sync_fetch_and_or:
case Builtin::BI__sync_fetch_and_or_1:
case Builtin::BI__sync_fetch_and_or_2:
case Builtin::BI__sync_fetch_and_or_4:
case Builtin::BI__sync_fetch_and_or_8:
case Builtin::BI__sync_fetch_and_or_16:
- BuiltinIndex = 2;
+ BuiltinIndex = 2;
break;
-
- case Builtin::BI__sync_fetch_and_and:
+
+ case Builtin::BI__sync_fetch_and_and:
case Builtin::BI__sync_fetch_and_and_1:
case Builtin::BI__sync_fetch_and_and_2:
case Builtin::BI__sync_fetch_and_and_4:
case Builtin::BI__sync_fetch_and_and_8:
case Builtin::BI__sync_fetch_and_and_16:
- BuiltinIndex = 3;
+ BuiltinIndex = 3;
break;
- case Builtin::BI__sync_fetch_and_xor:
+ case Builtin::BI__sync_fetch_and_xor:
case Builtin::BI__sync_fetch_and_xor_1:
case Builtin::BI__sync_fetch_and_xor_2:
case Builtin::BI__sync_fetch_and_xor_4:
case Builtin::BI__sync_fetch_and_xor_8:
case Builtin::BI__sync_fetch_and_xor_16:
- BuiltinIndex = 4;
+ BuiltinIndex = 4;
break;
- case Builtin::BI__sync_fetch_and_nand:
+ case Builtin::BI__sync_fetch_and_nand:
case Builtin::BI__sync_fetch_and_nand_1:
case Builtin::BI__sync_fetch_and_nand_2:
case Builtin::BI__sync_fetch_and_nand_4:
@@ -4799,43 +4799,43 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
WarnAboutSemanticsChange = true;
break;
- case Builtin::BI__sync_add_and_fetch:
+ case Builtin::BI__sync_add_and_fetch:
case Builtin::BI__sync_add_and_fetch_1:
case Builtin::BI__sync_add_and_fetch_2:
case Builtin::BI__sync_add_and_fetch_4:
case Builtin::BI__sync_add_and_fetch_8:
case Builtin::BI__sync_add_and_fetch_16:
- BuiltinIndex = 6;
+ BuiltinIndex = 6;
break;
-
- case Builtin::BI__sync_sub_and_fetch:
+
+ case Builtin::BI__sync_sub_and_fetch:
case Builtin::BI__sync_sub_and_fetch_1:
case Builtin::BI__sync_sub_and_fetch_2:
case Builtin::BI__sync_sub_and_fetch_4:
case Builtin::BI__sync_sub_and_fetch_8:
case Builtin::BI__sync_sub_and_fetch_16:
- BuiltinIndex = 7;
+ BuiltinIndex = 7;
break;
-
- case Builtin::BI__sync_and_and_fetch:
+
+ case Builtin::BI__sync_and_and_fetch:
case Builtin::BI__sync_and_and_fetch_1:
case Builtin::BI__sync_and_and_fetch_2:
case Builtin::BI__sync_and_and_fetch_4:
case Builtin::BI__sync_and_and_fetch_8:
case Builtin::BI__sync_and_and_fetch_16:
- BuiltinIndex = 8;
+ BuiltinIndex = 8;
break;
-
- case Builtin::BI__sync_or_and_fetch:
+
+ case Builtin::BI__sync_or_and_fetch:
case Builtin::BI__sync_or_and_fetch_1:
case Builtin::BI__sync_or_and_fetch_2:
case Builtin::BI__sync_or_and_fetch_4:
case Builtin::BI__sync_or_and_fetch_8:
case Builtin::BI__sync_or_and_fetch_16:
- BuiltinIndex = 9;
+ BuiltinIndex = 9;
break;
-
- case Builtin::BI__sync_xor_and_fetch:
+
+ case Builtin::BI__sync_xor_and_fetch:
case Builtin::BI__sync_xor_and_fetch_1:
case Builtin::BI__sync_xor_and_fetch_2:
case Builtin::BI__sync_xor_and_fetch_4:
@@ -4844,7 +4844,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
BuiltinIndex = 10;
break;
- case Builtin::BI__sync_nand_and_fetch:
+ case Builtin::BI__sync_nand_and_fetch:
case Builtin::BI__sync_nand_and_fetch_1:
case Builtin::BI__sync_nand_and_fetch_2:
case Builtin::BI__sync_nand_and_fetch_4:
@@ -4863,7 +4863,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
BuiltinIndex = 12;
NumFixed = 2;
break;
-
+
case Builtin::BI__sync_bool_compare_and_swap:
case Builtin::BI__sync_bool_compare_and_swap_1:
case Builtin::BI__sync_bool_compare_and_swap_2:
@@ -4874,16 +4874,16 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
NumFixed = 2;
ResultType = Context.BoolTy;
break;
-
+
case Builtin::BI__sync_lock_test_and_set:
case Builtin::BI__sync_lock_test_and_set_1:
case Builtin::BI__sync_lock_test_and_set_2:
case Builtin::BI__sync_lock_test_and_set_4:
case Builtin::BI__sync_lock_test_and_set_8:
case Builtin::BI__sync_lock_test_and_set_16:
- BuiltinIndex = 14;
+ BuiltinIndex = 14;
break;
-
+
case Builtin::BI__sync_lock_release:
case Builtin::BI__sync_lock_release_1:
case Builtin::BI__sync_lock_release_2:
@@ -4894,14 +4894,14 @@ Sema::SemaBuiltinAtomicOverloaded(ExprRe
NumFixed = 0;
ResultType = Context.VoidTy;
break;
-
- case Builtin::BI__sync_swap:
+
+ case Builtin::BI__sync_swap:
case Builtin::BI__sync_swap_1:
case Builtin::BI__sync_swap_2:
case Builtin::BI__sync_swap_4:
case Builtin::BI__sync_swap_8:
case Builtin::BI__sync_swap_16:
- BuiltinIndex = 16;
+ BuiltinIndex = 16;
break;
}
@@ -5410,7 +5410,7 @@ bool Sema::SemaBuiltinFPClassification(C
}
}
}
-
+
return false;
}
@@ -5787,13 +5787,13 @@ bool Sema::SemaBuiltinConstantArg(CallEx
Expr *Arg = TheCall->getArg(ArgNum);
DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
FunctionDecl *FDecl = cast<FunctionDecl>(DRE->getDecl());
-
+
if (Arg->isTypeDependent() || Arg->isValueDependent()) return false;
-
+
if (!Arg->isIntegerConstantExpr(Result, Context))
return Diag(TheCall->getLocStart(), diag::err_constant_integer_arg_type)
<< FDecl->getDeclName() << Arg->getSourceRange();
-
+
return false;
}
@@ -5964,7 +5964,7 @@ bool Sema::SemaBuiltinLongjmp(CallExpr *
// TODO: This is less than ideal. Overload this to take a value.
if (SemaBuiltinConstantArg(TheCall, 1, Result))
return true;
-
+
if (Result != 1)
return Diag(TheCall->getLocStart(), diag::err_builtin_longjmp_invalid_val)
<< SourceRange(Arg->getLocStart(), Arg->getLocEnd());
@@ -6231,7 +6231,7 @@ checkFormatStringExpr(Sema &S, const Exp
// cannot contain format specifiers and thus are not a security
// liability.
return SLCT_UncheckedLiteral;
-
+
case Stmt::DeclRefExprClass: {
const DeclRefExpr *DR = cast<DeclRefExpr>(E);
@@ -6626,14 +6626,14 @@ protected:
void HandlePositionalNonpositionalArgs(SourceLocation Loc,
const char *startSpec,
unsigned specifierLen);
-
+
SourceRange getFormatStringRange();
CharSourceRange getSpecifierRange(const char *startSpecifier,
unsigned specifierLen);
SourceLocation getLocationOfByte(const char *x);
const Expr *getDataArg(unsigned i) const;
-
+
bool CheckNumArgs(const analyze_format_string::FormatSpecifier &FS,
const analyze_format_string::ConversionSpecifier &CS,
const char *startSpecifier, unsigned specifierLen,
@@ -7052,7 +7052,7 @@ public:
const char *startSpecifier, unsigned specifierLen);
bool checkForCStrMembers(const analyze_printf::ArgType &AT,
const Expr *E);
-
+
void HandleEmptyObjCModifierFlag(const char *startFlag,
unsigned flagLen) override;
@@ -7061,7 +7061,7 @@ public:
void HandleObjCFlagsWithNonObjCConversion(const char *flagsStart,
const char *flagsEnd,
- const char *conversionPosition)
+ const char *conversionPosition)
override;
};
@@ -7073,7 +7073,7 @@ bool CheckPrintfHandler::HandleInvalidPr
unsigned specifierLen) {
const analyze_printf::PrintfConversionSpecifier &CS =
FS.getConversionSpecifier();
-
+
return HandleInvalidConversionSpecifier(FS.getArgIndex(),
getLocationOfByte(CS.getStart()),
startSpecifier, specifierLen,
@@ -7736,7 +7736,7 @@ CheckPrintfHandler::checkFormatExpr(cons
CastFix << ")";
SmallVector<FixItHint,4> Hints;
- if (!AT.matchesType(S.Context, IntendedTy) || ShouldNotPrintDirectly)
+ if (!AT.matchesType(S.Context, IntendedTy) || ShouldNotPrintDirectly)
Hints.push_back(FixItHint::CreateReplacement(SpecRange, os.str()));
if (const CStyleCastExpr *CCast = dyn_cast<CStyleCastExpr>(E)) {
@@ -7777,7 +7777,7 @@ CheckPrintfHandler::checkFormatExpr(cons
SpecRange, Hints);
} else {
// In this case, the expression could be printed using a different
- // specifier, but we've decided that the specifier is probably correct
+ // specifier, but we've decided that the specifier is probably correct
// and we should cast instead. Just use the normal warning message.
EmitFormatDiagnostic(
S.PDiag(diag::warn_format_conversion_argument_type_mismatch)
@@ -7852,7 +7852,7 @@ CheckPrintfHandler::checkFormatExpr(cons
//===--- CHECK: Scanf format string checking ------------------------------===//
-namespace {
+namespace {
class CheckScanfHandler : public CheckFormatHandler {
public:
@@ -7872,7 +7872,7 @@ public:
bool HandleScanfSpecifier(const analyze_scanf::ScanfSpecifier &FS,
const char *startSpecifier,
unsigned specifierLen) override;
-
+
bool HandleInvalidScanfConversionSpecifier(
const analyze_scanf::ScanfSpecifier &FS,
const char *startSpecifier,
@@ -7908,7 +7908,7 @@ bool CheckScanfHandler::HandleScanfSpeci
const char *startSpecifier,
unsigned specifierLen) {
using namespace analyze_scanf;
- using namespace analyze_format_string;
+ using namespace analyze_format_string;
const ScanfConversionSpecifier &CS = FS.getConversionSpecifier();
@@ -7925,7 +7925,7 @@ bool CheckScanfHandler::HandleScanfSpeci
return false;
}
}
-
+
// Check if the field with is non-zero.
const OptionalAmount &Amt = FS.getFieldWidth();
if (Amt.getHowSpecified() == OptionalAmount::Constant) {
@@ -8981,7 +8981,7 @@ void Sema::CheckMemaccessArguments(const
else if (BId == Builtin::BImemcmp)
OperationType = 3;
}
-
+
DiagRuntimeBehavior(
Dest->getExprLoc(), Dest,
PDiag(diag::warn_dyn_class_memaccess)
@@ -9035,7 +9035,7 @@ static const Expr *ignoreLiteralAddition
const Expr *RHS = BO->getRHS()->IgnoreParenCasts();
const Expr *LHS = BO->getLHS()->IgnoreParenCasts();
-
+
if (isa<IntegerLiteral>(RHS))
Ex = LHS;
else if (isa<IntegerLiteral>(LHS))
@@ -9077,7 +9077,7 @@ void Sema::CheckStrlcpycatArguments(cons
if (CheckMemorySizeofForComparison(*this, SizeArg, FnName,
Call->getLocStart(), Call->getRParenLoc()))
return;
-
+
// Look for 'strlcpy(dst, x, sizeof(x))'
if (const Expr *Ex = getSizeOfExprArg(SizeArg))
CompareWithSrc = Ex;
@@ -9100,16 +9100,16 @@ void Sema::CheckStrlcpycatArguments(cons
const DeclRefExpr *SrcArgDRE = dyn_cast<DeclRefExpr>(SrcArg);
if (!SrcArgDRE)
return;
-
+
const DeclRefExpr *CompareWithSrcDRE = dyn_cast<DeclRefExpr>(CompareWithSrc);
- if (!CompareWithSrcDRE ||
+ if (!CompareWithSrcDRE ||
SrcArgDRE->getDecl() != CompareWithSrcDRE->getDecl())
return;
-
+
const Expr *OriginalSizeArg = Call->getArg(2);
Diag(CompareWithSrcDRE->getLocStart(), diag::warn_strlcpycat_wrong_size)
<< OriginalSizeArg->getSourceRange() << FnName;
-
+
// Output a FIXIT hint if the destination is an array (rather than a
// pointer to an array). This could be enhanced to handle some
// pointers if we know the actual size, like if DstArg is 'array+2'
@@ -9123,7 +9123,7 @@ void Sema::CheckStrlcpycatArguments(cons
OS << "sizeof(";
DstArg->printPretty(OS, nullptr, getPrintingPolicy());
OS << ")";
-
+
Diag(OriginalSizeArg->getLocStart(), diag::note_strlcpycat_wrong_size)
<< FixItHint::CreateReplacement(OriginalSizeArg->getSourceRange(),
OS.str());
@@ -10271,7 +10271,7 @@ static void AnalyzeAssignment(Sema &S, B
}
/// Diagnose an implicit cast; purely a helper for CheckImplicitConversion.
-static void DiagnoseImpCast(Sema &S, Expr *E, QualType SourceType, QualType T,
+static void DiagnoseImpCast(Sema &S, Expr *E, QualType SourceType, QualType T,
SourceLocation CContext, unsigned diag,
bool pruneControlFlow = false) {
if (pruneControlFlow) {
@@ -10876,7 +10876,7 @@ CheckImplicitConversion(Sema &S, Expr *E
// We also want to warn about it in -Wconversion.
// So if -Wconversion is off, use a completely identical diagnostic
// in the sign-compare group.
- // The conditional-checking code will
+ // The conditional-checking code will
if (ICContext) {
DiagID = diag::warn_impcast_integer_sign_conditional;
*ICContext = true;
@@ -10897,7 +10897,7 @@ CheckImplicitConversion(Sema &S, Expr *E
Source = S.Context.getCanonicalType(SourceType).getTypePtr();
}
}
-
+
if (const EnumType *SourceEnum = Source->getAs<EnumType>())
if (const EnumType *TargetEnum = Target->getAs<EnumType>())
if (SourceEnum->getDecl()->hasNameForLinkage() &&
@@ -10906,7 +10906,7 @@ CheckImplicitConversion(Sema &S, Expr *E
if (S.SourceMgr.isInSystemMacro(CC))
return;
- return DiagnoseImpCast(S, E, SourceType, T, CC,
+ return DiagnoseImpCast(S, E, SourceType, T, CC,
diag::warn_impcast_different_enum_types);
}
}
@@ -10945,7 +10945,7 @@ static void CheckConditionalOperator(Sem
// ...then check whether it would have warned about either of the
// candidates for a signedness conversion to the condition type.
if (E->getType() == T) return;
-
+
Suspicious = false;
CheckImplicitConversion(S, E->getTrueExpr()->IgnoreParenImpCasts(),
E->getType(), CC, &Suspicious);
@@ -12426,11 +12426,11 @@ namespace {
}
void VisitBlockExpr(BlockExpr *block) {
- // Look inside nested blocks
+ // Look inside nested blocks
if (block->getBlockDecl()->capturesVariable(Variable))
Visit(block->getBlockDecl()->getBody());
}
-
+
void VisitOpaqueValueExpr(OpaqueValueExpr *OVE) {
if (Capturer) return;
if (OVE->getSourceExpr())
@@ -12483,7 +12483,7 @@ static Expr *findCapturingExpr(Sema &S,
}
}
}
-
+
BlockExpr *block = dyn_cast<BlockExpr>(e);
if (!block || !block->getBlockDecl()->capturesVariable(owner.Variable))
return nullptr;
@@ -12736,12 +12736,12 @@ void Sema::checkRetainCycles(VarDecl *Va
RetainCycleOwner Owner;
if (!considerVariable(Var, /*DeclRefExpr=*/nullptr, Owner))
return;
-
+
// Because we don't have an expression for the variable, we have to set the
// location explicitly here.
Owner.Loc = Var->getLocation();
Owner.Range = Var->getSourceRange();
-
+
if (Expr *Capturer = findCapturingExpr(*this, Init, Owner))
diagnoseRetainCycle(*this, Capturer, Owner);
}
@@ -12814,7 +12814,7 @@ void Sema::checkUnsafeExprAssigns(Source
if (PD)
LHSType = PD->getType();
}
-
+
if (LHSType.isNull())
LHSType = LHS->getType();
@@ -12831,14 +12831,14 @@ void Sema::checkUnsafeExprAssigns(Source
// FIXME. Check for other life times.
if (LT != Qualifiers::OCL_None)
return;
-
+
if (PRE) {
if (PRE->isImplicitProperty())
return;
const ObjCPropertyDecl *PD = PRE->getExplicitProperty();
if (!PD)
return;
-
+
unsigned Attributes = PD->getPropertyAttributes();
if (Attributes & ObjCPropertyDecl::OBJC_PR_assign) {
// when 'assign' attribute was not explicitly specified
@@ -12848,7 +12848,7 @@ void Sema::checkUnsafeExprAssigns(Source
if (!(AsWrittenAttr & ObjCPropertyDecl::OBJC_PR_assign) &&
LHSType->isObjCRetainableType())
return;
-
+
while (ImplicitCastExpr *cast = dyn_cast<ImplicitCastExpr>(RHS)) {
if (cast->getCastKind() == CK_ARCConsumeObject) {
Diag(Loc, diag::warn_arc_retained_property_assign)
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 30 12:24:48 2018
@@ -3182,7 +3182,7 @@ bool Sema::MergeFunctionDecl(FunctionDec
if (OldTypeInfo.getNoCallerSavedRegs() !=
NewTypeInfo.getNoCallerSavedRegs()) {
if (NewTypeInfo.getNoCallerSavedRegs()) {
- AnyX86NoCallerSavedRegistersAttr *Attr =
+ AnyX86NoCallerSavedRegistersAttr *Attr =
New->getAttr<AnyX86NoCallerSavedRegistersAttr>();
Diag(New->getLocation(), diag::err_function_attribute_mismatch) << Attr;
Diag(OldLocation, diag::note_previous_declaration);
@@ -10720,7 +10720,7 @@ QualType Sema::deduceVarTypeFromInitiali
InitializedEntity Entity = InitializedEntity::InitializeVariable(VDecl);
InitializationKind Kind = InitializationKind::CreateForInit(
VDecl->getLocation(), DirectInit, Init);
- // FIXME: Initialization should not be taking a mutable list of inits.
+ // FIXME: Initialization should not be taking a mutable list of inits.
SmallVector<Expr*, 8> InitsCopy(DeduceInits.begin(), DeduceInits.end());
return DeduceTemplateSpecializationFromInitializer(TSI, Entity, Kind,
InitsCopy);
@@ -13409,7 +13409,7 @@ void Sema::AddKnownFunctionAttributes(Fu
break;
}
}
-
+
if (Context.BuiltinInfo.isReturnsTwice(BuiltinID) &&
!FD->hasAttr<ReturnsTwiceAttr>())
FD->addAttr(ReturnsTwiceAttr::CreateImplicit(Context,
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Jul 30 12:24:48 2018
@@ -1051,7 +1051,7 @@ static void handleConsumableAttr(Sema &S
<< AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
D->addAttr(::new (S.Context)
ConsumableAttr(AL.getRange(), S.Context, DefaultState,
AL.getAttributeSpellingListIndex()));
@@ -1061,30 +1061,30 @@ static bool checkForConsumableClass(Sema
const ParsedAttr &AL) {
ASTContext &CurrContext = S.getASTContext();
QualType ThisType = MD->getThisType(CurrContext)->getPointeeType();
-
+
if (const CXXRecordDecl *RD = ThisType->getAsCXXRecordDecl()) {
if (!RD->hasAttr<ConsumableAttr>()) {
S.Diag(AL.getLoc(), diag::warn_attr_on_unconsumable_class) <<
RD->getNameAsString();
-
+
return false;
}
}
-
+
return true;
}
static void handleCallableWhenAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!checkAttributeAtLeastNumArgs(S, AL, 1))
return;
-
+
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL))
return;
-
+
SmallVector<CallableWhenAttr::ConsumedState, 3> States;
for (unsigned ArgIndex = 0; ArgIndex < AL.getNumArgs(); ++ArgIndex) {
CallableWhenAttr::ConsumedState CallableState;
-
+
StringRef StateString;
SourceLocation Loc;
if (AL.isArgIdent(ArgIndex)) {
@@ -1102,10 +1102,10 @@ static void handleCallableWhenAttr(Sema
<< AL.getName() << StateString;
return;
}
-
+
States.push_back(CallableState);
}
-
+
D->addAttr(::new (S.Context)
CallableWhenAttr(AL.getRange(), S.Context, States.data(),
States.size(), AL.getAttributeSpellingListIndex()));
@@ -1113,7 +1113,7 @@ static void handleCallableWhenAttr(Sema
static void handleParamTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
ParamTypestateAttr::ConsumedState ParamState;
-
+
if (AL.isArgIdent(0)) {
IdentifierLoc *Ident = AL.getArgAsIdent(0);
StringRef StateString = Ident->Ident->getName();
@@ -1129,7 +1129,7 @@ static void handleParamTypestateAttr(Sem
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
// FIXME: This check is currently being done in the analysis. It can be
// enabled here only after the parser propagates attributes at
// template specialization definition, not declaration.
@@ -1141,7 +1141,7 @@ static void handleParamTypestateAttr(Sem
// ReturnType.getAsString();
// return;
//}
-
+
D->addAttr(::new (S.Context)
ParamTypestateAttr(AL.getRange(), S.Context, ParamState,
AL.getAttributeSpellingListIndex()));
@@ -1149,7 +1149,7 @@ static void handleParamTypestateAttr(Sem
static void handleReturnTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
ReturnTypestateAttr::ConsumedState ReturnState;
-
+
if (AL.isArgIdent(0)) {
IdentifierLoc *IL = AL.getArgAsIdent(0);
if (!ReturnTypestateAttr::ConvertStrToConsumedState(IL->Ident->getName(),
@@ -1163,7 +1163,7 @@ static void handleReturnTypestateAttr(Se
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
// FIXME: This check is currently being done in the analysis. It can be
// enabled here only after the parser propagates attributes at
// template specialization definition, not declaration.
@@ -1175,9 +1175,9 @@ static void handleReturnTypestateAttr(Se
//} else if (const CXXConstructorDecl *Constructor =
// dyn_cast<CXXConstructorDecl>(D)) {
// ReturnType = Constructor->getThisType(S.getASTContext())->getPointeeType();
- //
+ //
//} else {
- //
+ //
// ReturnType = cast<FunctionDecl>(D)->getCallResultType();
//}
//
@@ -1197,7 +1197,7 @@ static void handleReturnTypestateAttr(Se
static void handleSetTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL))
return;
-
+
SetTypestateAttr::ConsumedState NewState;
if (AL.isArgIdent(0)) {
IdentifierLoc *Ident = AL.getArgAsIdent(0);
@@ -1212,7 +1212,7 @@ static void handleSetTypestateAttr(Sema
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
D->addAttr(::new (S.Context)
SetTypestateAttr(AL.getRange(), S.Context, NewState,
AL.getAttributeSpellingListIndex()));
@@ -1221,8 +1221,8 @@ static void handleSetTypestateAttr(Sema
static void handleTestTypestateAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), AL))
return;
-
- TestTypestateAttr::ConsumedState TestState;
+
+ TestTypestateAttr::ConsumedState TestState;
if (AL.isArgIdent(0)) {
IdentifierLoc *Ident = AL.getArgAsIdent(0);
StringRef Param = Ident->Ident->getName();
@@ -1236,7 +1236,7 @@ static void handleTestTypestateAttr(Sema
AL.getName() << AANT_ArgumentIdentifier;
return;
}
-
+
D->addAttr(::new (S.Context)
TestTypestateAttr(AL.getRange(), S.Context, TestState,
AL.getAttributeSpellingListIndex()));
@@ -1980,7 +1980,7 @@ static void handleAnalyzerNoReturnAttr(S
return;
}
}
-
+
D->addAttr(::new (S.Context)
AnalyzerNoReturnAttr(AL.getRange(), S.Context,
AL.getAttributeSpellingListIndex()));
@@ -2343,7 +2343,7 @@ static void handleAvailabilityAttr(Sema
return;
IdentifierLoc *Platform = AL.getArgAsIdent(0);
unsigned Index = AL.getAttributeSpellingListIndex();
-
+
IdentifierInfo *II = Platform->Ident;
if (AvailabilityAttr::getPrettyPlatformName(II->getName()).empty())
S.Diag(Platform->Loc, diag::warn_availability_unknown_platform)
@@ -2533,7 +2533,7 @@ static void handleVisibilityAttr(Sema &S
<< AL.getName() << TypeStr;
return;
}
-
+
// Complain about attempts to use protected visibility on targets
// (like Darwin) that don't support it.
if (type == VisibilityAttr::Protected &&
@@ -2604,7 +2604,7 @@ static void handleObjCNSObject(Sema &S,
// @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
//
// In this case it follows tradition and suppresses an error in the above
- // case.
+ // case.
S.Diag(D->getLocation(), diag::warn_nsobject_attribute);
}
D->addAttr(::new (S.Context)
@@ -2752,14 +2752,14 @@ static void handleWarnUnusedResult(Sema
<< AL.getName() << 1;
return;
}
-
+
// If this is spelled as the standard C++17 attribute, but not in C++17, warn
// about using it as an extension.
if (!S.getLangOpts().CPlusPlus17 && AL.isCXX11Attribute() &&
!AL.getScopeName())
S.Diag(AL.getLoc(), diag::ext_cxx17_attr) << AL.getName();
- D->addAttr(::new (S.Context)
+ D->addAttr(::new (S.Context)
WarnUnusedResultAttr(AL.getRange(), S.Context,
AL.getAttributeSpellingListIndex()));
}
@@ -2892,7 +2892,7 @@ bool Sema::checkSectionName(SourceLocati
std::string Error = Context.getTargetInfo().isValidSectionSpecifier(SecName);
if (!Error.empty()) {
Diag(LiteralLoc, diag::err_attribute_section_invalid_for_target) << Error
- << 1 /*'section'*/;
+ << 1 /*'section'*/;
return false;
}
return true;
@@ -3191,7 +3191,7 @@ static void handleInitPriorityAttr(Sema
S.Diag(AL.getLoc(), diag::warn_attribute_ignored) << AL.getName();
return;
}
-
+
if (S.getCurFunctionOrMethodDecl()) {
S.Diag(AL.getLoc(), diag::err_init_priority_object_attr);
AL.setInvalid();
@@ -3269,10 +3269,10 @@ static void handleFormatAttr(Sema &S, De
// Check for supported formats.
FormatAttrKind Kind = getFormatAttrKind(Format);
-
+
if (Kind == IgnoredFormat)
return;
-
+
if (Kind == InvalidFormat) {
S.Diag(AL.getLoc(), diag::warn_attribute_type_not_supported)
<< AL.getName() << II->getName();
@@ -3454,7 +3454,7 @@ static void handleAnnotateAttr(Sema &S,
if (I->getAnnotation() == Str)
return;
}
-
+
D->addAttr(::new (S.Context)
AnnotateAttr(AL.getRange(), S.Context, Str,
AL.getAttributeSpellingListIndex()));
@@ -4595,7 +4595,7 @@ static void handleTypeTagForDatatypeAttr
<< AL.getName() << 1 << AANT_ArgumentIdentifier;
return;
}
-
+
if (!checkAttributeNumArgs(S, AL, 1))
return;
@@ -4819,7 +4819,7 @@ static void handleObjCReturnsInnerPointe
const ParsedAttr &Attrs) {
const int EP_ObjCMethod = 1;
const int EP_ObjCProperty = 2;
-
+
SourceLocation loc = Attrs.getLoc();
QualType resultType;
if (isa<ObjCMethodDecl>(D))
@@ -4887,7 +4887,7 @@ static void handleObjCBridgeAttr(Sema &S
return;
}
}
-
+
D->addAttr(::new (S.Context)
ObjCBridgeAttr(AL.getRange(), S.Context, Parm->Ident,
AL.getAttributeSpellingListIndex()));
@@ -4901,7 +4901,7 @@ static void handleObjCBridgeMutableAttr(
S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << AL.getName() << 0;
return;
}
-
+
D->addAttr(::new (S.Context)
ObjCBridgeMutableAttr(AL.getRange(), S.Context, Parm->Ident,
AL.getAttributeSpellingListIndex()));
@@ -5195,7 +5195,7 @@ static void handleMSP430InterruptAttr(Se
if (!AL.isArgExpr(0)) {
S.Diag(AL.getLoc(), diag::err_attribute_argument_type) << AL.getName()
<< AANT_ArgumentIntegerConstant;
- return;
+ return;
}
// FIXME: Check for decl - it should be void ()(void).
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Jul 30 12:24:48 2018
@@ -133,9 +133,9 @@ static void diagnoseNoescape(const ParmV
<< cast<ObjCMethodDecl>(NewD->getDeclContext());
}
-void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
+void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
const ObjCMethodDecl *Overridden) {
- if (Overridden->hasRelatedResultType() &&
+ if (Overridden->hasRelatedResultType() &&
!NewMethod->hasRelatedResultType()) {
// This can only happen when the method follows a naming convention that
// implies a related result type, and the original (overridden) method has
@@ -143,9 +143,9 @@ void Sema::CheckObjCMethodOverride(ObjCM
// a suitable return type.
QualType ResultType = NewMethod->getReturnType();
SourceRange ResultTypeRange = NewMethod->getReturnTypeSourceRange();
-
+
// Figure out which class this method is part of, if any.
- ObjCInterfaceDecl *CurrentClass
+ ObjCInterfaceDecl *CurrentClass
= dyn_cast<ObjCInterfaceDecl>(NewMethod->getDeclContext());
if (!CurrentClass) {
DeclContext *DC = NewMethod->getDeclContext();
@@ -157,27 +157,27 @@ void Sema::CheckObjCMethodOverride(ObjCM
= dyn_cast<ObjCCategoryImplDecl>(DC))
CurrentClass = CatImpl->getClassInterface();
}
-
+
if (CurrentClass) {
- Diag(NewMethod->getLocation(),
+ Diag(NewMethod->getLocation(),
diag::warn_related_result_type_compatibility_class)
<< Context.getObjCInterfaceType(CurrentClass)
<< ResultType
<< ResultTypeRange;
} else {
- Diag(NewMethod->getLocation(),
+ Diag(NewMethod->getLocation(),
diag::warn_related_result_type_compatibility_protocol)
<< ResultType
<< ResultTypeRange;
}
-
+
if (ObjCMethodFamily Family = Overridden->getMethodFamily())
- Diag(Overridden->getLocation(),
+ Diag(Overridden->getLocation(),
diag::note_related_result_type_family)
<< /*overridden method*/ 0
<< Family;
else
- Diag(Overridden->getLocation(),
+ Diag(Overridden->getLocation(),
diag::note_related_result_type_overridden);
}
@@ -250,7 +250,7 @@ bool Sema::CheckARCMethodDecl(ObjCMethod
return true;
}
return false;
-
+
case OMF_init:
// If the method doesn't obey the init rules, don't bother annotating it.
if (checkInitMethod(method, QualType()))
@@ -328,7 +328,7 @@ static void DiagnoseObjCImplementedDepre
/// pool.
void Sema::AddAnyMethodToGlobalPool(Decl *D) {
ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D);
-
+
// If we don't have a valid method decl, simply return.
if (!MDecl)
return;
@@ -343,7 +343,7 @@ void Sema::AddAnyMethodToGlobalPool(Decl
static bool
HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) {
QualType T = Param->getType();
-
+
if (const PointerType *PT = T->getAs<PointerType>()) {
T = PT->getPointeeType();
} else if (const ReferenceType *RT = T->getAs<ReferenceType>()) {
@@ -351,8 +351,8 @@ HasExplicitOwnershipAttr(Sema &S, ParmVa
} else {
return true;
}
-
- // If we have a lifetime qualifier, but it's local, we must have
+
+ // If we have a lifetime qualifier, but it's local, we must have
// inferred it. So, it is implicit.
return !T.getLocalQualifiers().hasObjCLifetime();
}
@@ -362,7 +362,7 @@ HasExplicitOwnershipAttr(Sema &S, ParmVa
void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
assert((getCurMethodDecl() == nullptr) && "Methodparsing confused");
ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D);
-
+
// If we don't have a valid method decl, simply return.
if (!MDecl)
return;
@@ -377,7 +377,7 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
// Allow all of Sema to see that we are entering a method definition.
PushDeclContext(FnBodyScope, MDecl);
PushFunctionScope();
-
+
// Create Decl objects for each parameter, entrring them in the scope for
// binding to their use.
@@ -398,7 +398,7 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
!HasExplicitOwnershipAttr(*this, Param))
Diag(Param->getLocation(), diag::warn_arc_strong_pointer_objc_pointer) <<
Param->getType();
-
+
if (Param->getIdentifier())
PushOnScopeChains(Param, FnBodyScope);
}
@@ -432,13 +432,13 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
// Warn on deprecated methods under -Wdeprecated-implementations,
// and prepare for warning on missing super calls.
if (ObjCInterfaceDecl *IC = MDecl->getClassInterface()) {
- ObjCMethodDecl *IMD =
+ ObjCMethodDecl *IMD =
IC->lookupMethod(MDecl->getSelector(), MDecl->isInstanceMethod());
-
+
if (IMD) {
- ObjCImplDecl *ImplDeclOfMethodDef =
+ ObjCImplDecl *ImplDeclOfMethodDef =
dyn_cast<ObjCImplDecl>(MDecl->getDeclContext());
- ObjCContainerDecl *ContDeclOfMethodDecl =
+ ObjCContainerDecl *ContDeclOfMethodDecl =
dyn_cast<ObjCContainerDecl>(IMD->getDeclContext());
ObjCImplDecl *ImplDeclOfMethodDecl = nullptr;
if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ContDeclOfMethodDecl))
@@ -481,12 +481,12 @@ void Sema::ActOnStartOfObjCMethodDef(Sco
} else if (Family == OMF_finalize) {
if (Context.getLangOpts().getGC() != LangOptions::NonGC)
getCurFunction()->ObjCShouldCallSuper = true;
-
+
} else {
const ObjCMethodDecl *SuperMethod =
SuperClass->lookupMethod(MDecl->getSelector(),
MDecl->isInstanceMethod());
- getCurFunction()->ObjCShouldCallSuper =
+ getCurFunction()->ObjCShouldCallSuper =
(SuperMethod && SuperMethod->hasAttr<ObjCRequiresSuperAttr>());
}
}
@@ -627,11 +627,11 @@ ActOnSuperClassOfClassInterface(Scope *S
// Handle type arguments on the superclass.
TypeSourceInfo *SuperClassTInfo = nullptr;
- if (!SuperTypeArgs.empty()) {
+ if (!SuperTypeArgs.empty()) {
TypeResult fullSuperClassType = actOnObjCTypeArgsAndProtocolQualifiers(
S,
SuperLoc,
- CreateParsedType(SuperClassType,
+ CreateParsedType(SuperClassType,
nullptr),
SuperTypeArgsRange.getBegin(),
SuperTypeArgs,
@@ -643,12 +643,12 @@ ActOnSuperClassOfClassInterface(Scope *S
if (!fullSuperClassType.isUsable())
return;
- SuperClassType = GetTypeFromParser(fullSuperClassType.get(),
+ SuperClassType = GetTypeFromParser(fullSuperClassType.get(),
&SuperClassTInfo);
}
if (!SuperClassTInfo) {
- SuperClassTInfo = Context.getTrivialTypeSourceInfo(SuperClassType,
+ SuperClassTInfo = Context.getTrivialTypeSourceInfo(SuperClassType,
SuperLoc);
}
@@ -852,7 +852,7 @@ static bool checkTypeParamListConsistenc
// When the new type parameter is invariant and is not part
// of the definition, just propagate the variance.
newTypeParam->setVariance(prevTypeParam->getVariance());
- } else if (prevTypeParam->getVariance()
+ } else if (prevTypeParam->getVariance()
== ObjCTypeParamVariance::Invariant &&
!(isa<ObjCInterfaceDecl>(prevTypeParam->getDeclContext()) &&
cast<ObjCInterfaceDecl>(prevTypeParam->getDeclContext())
@@ -1011,7 +1011,7 @@ Decl *Sema::ActOnStartClassInterface(
if (ObjCTypeParamList *prevTypeParamList = PrevIDecl->getTypeParamList()) {
if (typeParamList) {
// Both have type parameter lists; check for consistency.
- if (checkTypeParamListConsistency(*this, prevTypeParamList,
+ if (checkTypeParamListConsistency(*this, prevTypeParamList,
typeParamList,
TypeParamListContext::Definition)) {
typeParamList = nullptr;
@@ -1038,7 +1038,7 @@ Decl *Sema::ActOnStartClassInterface(
Context.getTrivialTypeSourceInfo(typeParam->getUnderlyingType())));
}
- typeParamList = ObjCTypeParamList::create(Context,
+ typeParamList = ObjCTypeParamList::create(Context,
SourceLocation(),
clonedTypeParams,
SourceLocation());
@@ -1063,18 +1063,18 @@ Decl *Sema::ActOnStartClassInterface(
AddPragmaAttributes(TUScope, IDecl);
PushOnScopeChains(IDecl, TUScope);
- // Start the definition of this class. If we're in a redefinition case, there
+ // Start the definition of this class. If we're in a redefinition case, there
// may already be a definition, so we'll end up adding to it.
if (!IDecl->hasDefinition())
IDecl->startDefinition();
-
+
if (SuperName) {
// Diagnose availability in the context of the @interface.
ContextRAII SavedContext(*this, IDecl);
- ActOnSuperClassOfClassInterface(S, AtInterfaceLoc, IDecl,
- ClassName, ClassLoc,
- SuperName, SuperLoc, SuperTypeArgs,
+ ActOnSuperClassOfClassInterface(S, AtInterfaceLoc, IDecl,
+ ClassName, ClassLoc,
+ SuperName, SuperLoc, SuperTypeArgs,
SuperTypeArgsRange);
} else { // we have a root class.
IDecl->setEndOfDefinitionLoc(ClassLoc);
@@ -1106,7 +1106,7 @@ void Sema::ActOnTypedefedProtocols(Small
LookupOrdinaryName);
if (!IDecl)
return;
-
+
if (const TypedefNameDecl *TDecl = dyn_cast_or_null<TypedefNameDecl>(IDecl)) {
QualType T = TDecl->getUnderlyingType();
if (T->isObjCObjectType())
@@ -1175,7 +1175,7 @@ bool Sema::CheckForwardProtocolDeclarati
IdentifierInfo *PName,
SourceLocation &Ploc, SourceLocation PrevLoc,
const ObjCList<ObjCProtocolDecl> &PList) {
-
+
bool res = false;
for (ObjCList<ObjCProtocolDecl>::iterator I = PList.begin(),
E = PList.end(); I != E; ++I) {
@@ -1186,10 +1186,10 @@ bool Sema::CheckForwardProtocolDeclarati
Diag(PrevLoc, diag::note_previous_definition);
res = true;
}
-
+
if (!PDecl->hasDefinition())
continue;
-
+
if (CheckForwardProtocolDeclarationForCircularDependency(PName, Ploc,
PDecl->getLocation(), PDecl->getReferencedProtocols()))
res = true;
@@ -1241,7 +1241,7 @@ Decl *Sema::ActOnStartProtocolInterface(
PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
ProtocolLoc, AtProtoInterfaceLoc,
/*PrevDecl=*/PrevDecl);
-
+
PushOnScopeChains(PDecl, TUScope);
PDecl->startDefinition();
}
@@ -1271,7 +1271,7 @@ static bool NestedProtocolHasNoDefinitio
UndefinedProtocol = PDecl;
return true;
}
-
+
for (auto *PI : PDecl->protocols())
if (NestedProtocolHasNoDefinition(PI, UndefinedProtocol)) {
UndefinedProtocol = PI;
@@ -1318,7 +1318,7 @@ Sema::FindProtocolDeclaration(bool WarnO
// case, do it.
// FIXME: Recover nicely in the hidden case.
ObjCProtocolDecl *UndefinedProtocol;
-
+
if (WarnOnDeclarations &&
NestedProtocolHasNoDefinition(PDecl, UndefinedProtocol)) {
Diag(Pair.second, diag::warn_undef_protocolref) << Pair.first;
@@ -1411,7 +1411,7 @@ void Sema::actOnObjCTypeArgsOrProtocolQu
unsigned numProtocolsResolved = 0;
auto resolvedAsProtocols = [&] {
assert(numProtocolsResolved == identifiers.size() && "Unresolved protocols");
-
+
// Determine whether the base type is a parameterized class, in
// which case we want to warn about typos such as
// "NSArray<NSObject>" (that should be NSArray<NSObject *>).
@@ -1434,7 +1434,7 @@ void Sema::actOnObjCTypeArgsOrProtocolQu
}
for (unsigned i = 0, n = protocols.size(); i != n; ++i) {
- ObjCProtocolDecl *&proto
+ ObjCProtocolDecl *&proto
= reinterpret_cast<ObjCProtocolDecl *&>(protocols[i]);
// For an objc container, delay protocol reference checking until after we
// can set the objc decl as the availability context, otherwise check now.
@@ -1476,7 +1476,7 @@ void Sema::actOnObjCTypeArgsOrProtocolQu
}
}
}
-
+
// All of the protocols listed also have type names, and at least
// one is an Objective-C class name. Check whether all of the
// protocol conformances are declared by the base class itself, in
@@ -1551,7 +1551,7 @@ void Sema::actOnObjCTypeArgsOrProtocolQu
// Local function that forms a reference to the given type or
// Objective-C class declaration.
- auto resolveTypeReference = [&](TypeOrClassDecl typeDecl, SourceLocation loc)
+ auto resolveTypeReference = [&](TypeOrClassDecl typeDecl, SourceLocation loc)
-> TypeResult {
// Form declaration specifiers. They simply refer to the type.
DeclSpec DS(attrFactory);
@@ -1767,10 +1767,10 @@ Sema::ActOnForwardProtocolDeclaration(So
ObjCProtocolDecl *PrevDecl = LookupProtocol(Ident, IdentPair.second,
forRedeclarationInCurContext());
ObjCProtocolDecl *PDecl
- = ObjCProtocolDecl::Create(Context, CurContext, Ident,
+ = ObjCProtocolDecl::Create(Context, CurContext, Ident,
IdentPair.second, AtProtocolLoc,
PrevDecl);
-
+
PushOnScopeChains(PDecl, TUScope);
CheckObjCDeclScope(PDecl);
@@ -1798,7 +1798,7 @@ Decl *Sema::ActOnStartCategoryInterface(
/// Check that class of this category is already completely declared.
- if (!IDecl
+ if (!IDecl
|| RequireCompleteType(ClassLoc, Context.getObjCInterfaceType(IDecl),
diag::err_category_forward_interface,
CategoryName == nullptr)) {
@@ -1810,7 +1810,7 @@ Decl *Sema::ActOnStartCategoryInterface(
IDecl, typeParamList);
CDecl->setInvalidDecl();
CurContext->addDecl(CDecl);
-
+
if (!IDecl)
Diag(ClassLoc, diag::err_undef_interface) << ClassName;
return ActOnObjCContainerStartDefinition(CDecl);
@@ -1818,7 +1818,7 @@ Decl *Sema::ActOnStartCategoryInterface(
if (!CategoryName && IDecl->getImplementation()) {
Diag(ClassLoc, diag::err_class_extension_after_impl) << ClassName;
- Diag(IDecl->getImplementation()->getLocation(),
+ Diag(IDecl->getImplementation()->getLocation(),
diag::note_implementation_declared);
}
@@ -1871,8 +1871,8 @@ Decl *Sema::ActOnStartCategoryInterface(
ProtoLocs, Context);
// Protocols in the class extension belong to the class.
if (CDecl->IsClassExtension())
- IDecl->mergeClassExtensionProtocolList((ObjCProtocolDecl*const*)ProtoRefs,
- NumProtoRefs, Context);
+ IDecl->mergeClassExtensionProtocolList((ObjCProtocolDecl*const*)ProtoRefs,
+ NumProtoRefs, Context);
}
CheckObjCDeclScope(CDecl);
@@ -1933,7 +1933,7 @@ Decl *Sema::ActOnStartCategoryImplementa
CDecl->setInvalidDecl();
} else {
CatIDecl->setImplementation(CDecl);
- // Warn on implementating category of deprecated class under
+ // Warn on implementating category of deprecated class under
// -Wdeprecated-implementations flag.
DiagnoseObjCImplementedDeprecations(*this, CatIDecl,
CDecl->getLocation());
@@ -2027,7 +2027,7 @@ Decl *Sema::ActOnStartClassImplementatio
} else {
IDecl->setEndOfDefinitionLoc(ClassLoc);
}
-
+
PushOnScopeChains(IDecl, TUScope);
} else {
// Mark the interface as being completed, even if it was just as
@@ -2054,7 +2054,7 @@ Decl *Sema::ActOnStartClassImplementatio
} else { // add it to the list.
IDecl->setImplementation(IMPDecl);
PushOnScopeChains(IMPDecl, TUScope);
- // Warn on implementating deprecated class under
+ // Warn on implementating deprecated class under
// -Wdeprecated-implementations flag.
DiagnoseObjCImplementedDeprecations(*this, IDecl, IMPDecl->getLocation());
}
@@ -2108,7 +2108,7 @@ void Sema::CheckImplementationIvars(ObjC
IDecl->makeDeclVisibleInContext(ivars[i]);
ImpDecl->addDecl(ivars[i]);
}
-
+
return;
}
// If implementation has empty ivar list, just return.
@@ -2121,17 +2121,17 @@ void Sema::CheckImplementationIvars(ObjC
Diag(ImpDecl->getLocation(), diag::warn_on_superclass_use);
for (unsigned i = 0; i < numIvars; i++) {
ObjCIvarDecl* ImplIvar = ivars[i];
- if (const ObjCIvarDecl *ClsIvar =
+ if (const ObjCIvarDecl *ClsIvar =
IDecl->getIvarDecl(ImplIvar->getIdentifier())) {
- Diag(ImplIvar->getLocation(), diag::err_duplicate_ivar_declaration);
+ Diag(ImplIvar->getLocation(), diag::err_duplicate_ivar_declaration);
Diag(ClsIvar->getLocation(), diag::note_previous_definition);
continue;
}
// Check class extensions (unnamed categories) for duplicate ivars.
for (const auto *CDecl : IDecl->visible_extensions()) {
- if (const ObjCIvarDecl *ClsExtIvar =
+ if (const ObjCIvarDecl *ClsExtIvar =
CDecl->getIvarDecl(ImplIvar->getIdentifier())) {
- Diag(ImplIvar->getLocation(), diag::err_duplicate_ivar_declaration);
+ Diag(ImplIvar->getLocation(), diag::err_duplicate_ivar_declaration);
Diag(ClsExtIvar->getLocation(), diag::note_previous_definition);
continue;
}
@@ -2212,8 +2212,8 @@ static void WarnUndefinedMethod(Sema &S,
}
/// Determines if type B can be substituted for type A. Returns true if we can
-/// guarantee that anything that the user will do to an object of type A can
-/// also be done to an object of type B. This is trivially true if the two
+/// guarantee that anything that the user will do to an object of type A can
+/// also be done to an object of type B. This is trivially true if the two
/// types are the same, or if B is a subclass of A. It becomes more complex
/// in cases where protocols are involved.
///
@@ -2222,12 +2222,12 @@ static void WarnUndefinedMethod(Sema &S,
/// example, if A is a subclass of B, then B* may refer to an instance of A.
/// The principle of substitutability means that we may use an instance of A
/// anywhere that we may use an instance of B - it will implement all of the
-/// ivars of B and all of the methods of B.
+/// ivars of B and all of the methods of B.
///
-/// This substitutability is important when type checking methods, because
+/// This substitutability is important when type checking methods, because
/// the implementation may have stricter type definitions than the interface.
/// The interface specifies minimum requirements, but the implementation may
-/// have more accurate ones. For example, a method may privately accept
+/// have more accurate ones. For example, a method may privately accept
/// instances of B, but only publish that it accepts instances of A. Any
/// object passed to it will be type checked against B, and so will implicitly
/// by a valid A*. Similarly, a method may return a subclass of the class that
@@ -2243,7 +2243,7 @@ static void WarnUndefinedMethod(Sema &S,
/// advertises, but it may be specified more accurately. This avoids the need
/// for explicit down-casting by callers.
///
-/// Note: This is a stricter requirement than for assignment.
+/// Note: This is a stricter requirement than for assignment.
static bool isObjCTypeSubstitutable(ASTContext &Context,
const ObjCObjectPointerType *A,
const ObjCObjectPointerType *B,
@@ -2332,15 +2332,15 @@ static bool CheckMethodOverrideReturn(Se
!= 0));
S.Diag(MethodDecl->getLocation(), diag::note_previous_declaration);
}
-
+
if (S.Context.hasSameUnqualifiedType(MethodImpl->getReturnType(),
MethodDecl->getReturnType()))
return true;
if (!Warn)
return false;
- unsigned DiagID =
- IsOverridingMode ? diag::warn_conflicting_overriding_ret_types
+ unsigned DiagID =
+ IsOverridingMode ? diag::warn_conflicting_overriding_ret_types
: diag::warn_conflicting_ret_types;
// Mismatches between ObjC pointers go into a different warning
@@ -2356,8 +2356,8 @@ static bool CheckMethodOverrideReturn(Se
if (isObjCTypeSubstitutable(S.Context, IfacePtrTy, ImplPtrTy, false))
return false;
- DiagID =
- IsOverridingMode ? diag::warn_non_covariant_overriding_ret_types
+ DiagID =
+ IsOverridingMode ? diag::warn_non_covariant_overriding_ret_types
: diag::warn_non_covariant_ret_types;
}
}
@@ -2386,21 +2386,21 @@ static bool CheckMethodOverrideParam(Sem
IfaceVar->getObjCDeclQualifier())) {
if (Warn) {
if (IsOverridingMode)
- S.Diag(ImplVar->getLocation(),
+ S.Diag(ImplVar->getLocation(),
diag::warn_conflicting_overriding_param_modifiers)
<< getTypeRange(ImplVar->getTypeSourceInfo())
<< MethodImpl->getDeclName();
- else S.Diag(ImplVar->getLocation(),
+ else S.Diag(ImplVar->getLocation(),
diag::warn_conflicting_param_modifiers)
<< getTypeRange(ImplVar->getTypeSourceInfo())
<< MethodImpl->getDeclName();
S.Diag(IfaceVar->getLocation(), diag::note_previous_declaration)
- << getTypeRange(IfaceVar->getTypeSourceInfo());
+ << getTypeRange(IfaceVar->getTypeSourceInfo());
}
else
return false;
}
-
+
QualType ImplTy = ImplVar->getType();
QualType IfaceTy = IfaceVar->getType();
if (Warn && IsOverridingMode &&
@@ -2423,8 +2423,8 @@ static bool CheckMethodOverrideParam(Sem
if (!Warn)
return false;
- unsigned DiagID =
- IsOverridingMode ? diag::warn_conflicting_overriding_param_types
+ unsigned DiagID =
+ IsOverridingMode ? diag::warn_conflicting_overriding_param_types
: diag::warn_conflicting_param_types;
// Mismatches between ObjC pointers go into a different warning
@@ -2440,8 +2440,8 @@ static bool CheckMethodOverrideParam(Sem
if (isObjCTypeSubstitutable(S.Context, ImplPtrTy, IfacePtrTy, true))
return false;
- DiagID =
- IsOverridingMode ? diag::warn_non_contravariant_overriding_param_types
+ DiagID =
+ IsOverridingMode ? diag::warn_non_contravariant_overriding_param_types
: diag::warn_non_contravariant_param_types;
}
}
@@ -2449,8 +2449,8 @@ static bool CheckMethodOverrideParam(Sem
S.Diag(ImplVar->getLocation(), DiagID)
<< getTypeRange(ImplVar->getTypeSourceInfo())
<< MethodImpl->getDeclName() << IfaceTy << ImplTy;
- S.Diag(IfaceVar->getLocation(),
- (IsOverridingMode ? diag::note_previous_declaration
+ S.Diag(IfaceVar->getLocation(),
+ (IsOverridingMode ? diag::note_previous_declaration
: diag::note_previous_definition))
<< getTypeRange(IfaceVar->getTypeSourceInfo());
return false;
@@ -2535,8 +2535,8 @@ void Sema::WarnConflictingTypedMethods(O
checkMethodFamilyMismatch(*this, ImpMethodDecl, MethodDecl))
return;
- CheckMethodOverrideReturn(*this, ImpMethodDecl, MethodDecl,
- IsProtocolMethodDecl, false,
+ CheckMethodOverrideReturn(*this, ImpMethodDecl, MethodDecl,
+ IsProtocolMethodDecl, false,
true);
for (ObjCMethodDecl::param_iterator IM = ImpMethodDecl->param_begin(),
@@ -2548,7 +2548,7 @@ void Sema::WarnConflictingTypedMethods(O
}
if (ImpMethodDecl->isVariadic() != MethodDecl->isVariadic()) {
- Diag(ImpMethodDecl->getLocation(),
+ Diag(ImpMethodDecl->getLocation(),
diag::warn_conflicting_variadic);
Diag(MethodDecl->getLocation(), diag::note_previous_declaration);
}
@@ -2557,11 +2557,11 @@ void Sema::WarnConflictingTypedMethods(O
void Sema::CheckConflictingOverridingMethod(ObjCMethodDecl *Method,
ObjCMethodDecl *Overridden,
bool IsProtocolMethodDecl) {
-
- CheckMethodOverrideReturn(*this, Method, Overridden,
- IsProtocolMethodDecl, true,
+
+ CheckMethodOverrideReturn(*this, Method, Overridden,
+ IsProtocolMethodDecl, true,
true);
-
+
for (ObjCMethodDecl::param_iterator IM = Method->param_begin(),
IF = Overridden->param_begin(), EM = Method->param_end(),
EF = Overridden->param_end();
@@ -2569,9 +2569,9 @@ void Sema::CheckConflictingOverridingMet
CheckMethodOverrideParam(*this, Method, Overridden, *IM, *IF,
IsProtocolMethodDecl, true, true);
}
-
+
if (Method->isVariadic() != Overridden->isVariadic()) {
- Diag(Method->getLocation(),
+ Diag(Method->getLocation(),
diag::warn_conflicting_overriding_variadic);
Diag(Overridden->getLocation(), diag::note_previous_declaration);
}
@@ -2587,20 +2587,20 @@ void Sema::WarnExactTypedMethods(ObjCMet
// to implement it.
if (MethodDecl->getImplementationControl() == ObjCMethodDecl::Optional)
return;
- // don't issue warning when primary class's method is
+ // don't issue warning when primary class's method is
// depecated/unavailable.
if (MethodDecl->hasAttr<UnavailableAttr>() ||
MethodDecl->hasAttr<DeprecatedAttr>())
return;
-
- bool match = CheckMethodOverrideReturn(*this, ImpMethodDecl, MethodDecl,
+
+ bool match = CheckMethodOverrideReturn(*this, ImpMethodDecl, MethodDecl,
IsProtocolMethodDecl, false, false);
if (match)
for (ObjCMethodDecl::param_iterator IM = ImpMethodDecl->param_begin(),
IF = MethodDecl->param_begin(), EM = ImpMethodDecl->param_end(),
EF = MethodDecl->param_end();
IM != EM && IF != EF; ++IM, ++IF) {
- match = CheckMethodOverrideParam(*this, ImpMethodDecl, MethodDecl,
+ match = CheckMethodOverrideParam(*this, ImpMethodDecl, MethodDecl,
*IM, *IF,
IsProtocolMethodDecl, false, false);
if (!match)
@@ -2611,9 +2611,9 @@ void Sema::WarnExactTypedMethods(ObjCMet
if (match)
match = !(MethodDecl->isClassMethod() &&
MethodDecl->getSelector() == GetNullarySelector("load", Context));
-
+
if (match) {
- Diag(ImpMethodDecl->getLocation(),
+ Diag(ImpMethodDecl->getLocation(),
diag::warn_category_method_impl_match);
Diag(MethodDecl->getLocation(), diag::note_method_declared_at)
<< MethodDecl->getDeclName();
@@ -2662,10 +2662,10 @@ static void CheckProtocolMethodDefs(Sema
ObjCContainerDecl *CDecl,
LazyProtocolNameSet &ProtocolsExplictImpl) {
ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl);
- ObjCInterfaceDecl *IDecl = C ? C->getClassInterface()
+ ObjCInterfaceDecl *IDecl = C ? C->getClassInterface()
: dyn_cast<ObjCInterfaceDecl>(CDecl);
assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
-
+
ObjCInterfaceDecl *Super = IDecl->getSuperClass();
ObjCInterfaceDecl *NSIDecl = nullptr;
@@ -2714,7 +2714,7 @@ static void CheckProtocolMethodDefs(Sema
if (!PDecl->isThisDeclarationADefinition() &&
PDecl->getDefinition())
PDecl = PDecl->getDefinition();
-
+
// If a method lookup fails locally we still need to look and see if
// the method was implemented by a base class or an inherited
// protocol. This lookup is slow, but occurs rarely in correct code
@@ -2733,10 +2733,10 @@ static void CheckProtocolMethodDefs(Sema
nullptr /* category */))) {
// If a method is not implemented in the category implementation but
// has been declared in its primary class, superclass,
- // or in one of their protocols, no need to issue the warning.
- // This is because method will be implemented in the primary class
+ // or in one of their protocols, no need to issue the warning.
+ // This is because method will be implemented in the primary class
// or one of its super class implementation.
-
+
// Ugly, but necessary. Method declared in protocol might have
// have been synthesized due to a property declared in the class which
// uses the protocol.
@@ -2846,7 +2846,7 @@ void Sema::MatchAllMethodDeclarations(co
}
}
}
-
+
if (ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl> (CDecl)) {
// Also, check for methods declared in protocols inherited by
// this protocol.
@@ -2855,7 +2855,7 @@ void Sema::MatchAllMethodDeclarations(co
IMPDecl, PI, IncompleteImpl, false,
WarnCategoryMethodImpl);
}
-
+
if (ObjCInterfaceDecl *I = dyn_cast<ObjCInterfaceDecl> (CDecl)) {
// when checking that methods in implementation match their declaration,
// i.e. when WarnCategoryMethodImpl is false, check declarations in class
@@ -2880,8 +2880,8 @@ void Sema::MatchAllMethodDeclarations(co
IMPDecl, PI, IncompleteImpl, false,
WarnCategoryMethodImpl);
- // FIXME. For now, we are not checking for extact match of methods
- // in category implementation and its primary class's super class.
+ // FIXME. For now, we are not checking for extact match of methods
+ // in category implementation and its primary class's super class.
if (!WarnCategoryMethodImpl && I->getSuperClass())
MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
IMPDecl,
@@ -2891,7 +2891,7 @@ void Sema::MatchAllMethodDeclarations(co
/// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
/// category matches with those implemented in its primary class and
-/// warns each time an exact match is found.
+/// warns each time an exact match is found.
void Sema::CheckCategoryVsClassMethodMatches(
ObjCCategoryImplDecl *CatIMPDecl) {
// Get category's primary class.
@@ -2903,7 +2903,7 @@ void Sema::CheckCategoryVsClassMethodMat
return;
ObjCInterfaceDecl *SuperIDecl = IDecl->getSuperClass();
SelectorSet InsMap, ClsMap;
-
+
for (const auto *I : CatIMPDecl->instance_methods()) {
Selector Sel = I->getSelector();
// When checking for methods implemented in the category, skip over
@@ -2913,7 +2913,7 @@ void Sema::CheckCategoryVsClassMethodMat
continue;
InsMap.insert(Sel);
}
-
+
for (const auto *I : CatIMPDecl->class_methods()) {
Selector Sel = I->getSelector();
if (SuperIDecl && SuperIDecl->lookupMethod(Sel, false))
@@ -2922,12 +2922,12 @@ void Sema::CheckCategoryVsClassMethodMat
}
if (InsMap.empty() && ClsMap.empty())
return;
-
+
SelectorSet InsMapSeen, ClsMapSeen;
bool IncompleteImpl = false;
MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
CatIMPDecl, IDecl,
- IncompleteImpl, false,
+ IncompleteImpl, false,
true /*WarnCategoryMethodImpl*/);
}
@@ -2977,10 +2977,10 @@ void Sema::ImplMethodsVsClassMethods(Sco
MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen,
IMPDecl, CDecl,
IncompleteImpl, true);
-
+
// check all methods implemented in category against those declared
// in its primary class.
- if (ObjCCategoryImplDecl *CatDecl =
+ if (ObjCCategoryImplDecl *CatDecl =
dyn_cast<ObjCCategoryImplDecl>(IMPDecl))
CheckCategoryVsClassMethodMatches(CatDecl);
@@ -3005,7 +3005,7 @@ void Sema::ImplMethodsVsClassMethods(Sco
ExplicitImplProtocols);
DiagnoseUnimplementedProperties(S, IMPDecl, CDecl,
/*SynthesizeProperties=*/false);
- }
+ }
} else
llvm_unreachable("invalid ObjCContainerDecl type.");
}
@@ -3020,7 +3020,7 @@ Sema::ActOnForwardClassDeclaration(Sourc
for (unsigned i = 0; i != NumElts; ++i) {
// Check for another declaration kind with the same name.
NamedDecl *PrevDecl
- = LookupSingleName(TUScope, IdentList[i], IdentLocs[i],
+ = LookupSingleName(TUScope, IdentList[i], IdentLocs[i],
LookupOrdinaryName, forRedeclarationInCurContext());
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
// GCC apparently allows the following idiom:
@@ -3047,7 +3047,7 @@ Sema::ActOnForwardClassDeclaration(Sourc
}
}
}
-
+
// Create a declaration to describe this forward declaration.
ObjCInterfaceDecl *PrevIDecl
= dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
@@ -3138,7 +3138,7 @@ static bool matchTypes(ASTContext &Conte
// Consider all the kinds of non-dependent canonical types:
// - functions and arrays aren't possible as return and parameter types
-
+
// - vector types of equal size can be arbitrarily mixed
if (isa<VectorType>(left)) return isa<VectorType>(right);
if (isa<VectorType>(right)) return false;
@@ -3386,14 +3386,14 @@ void Sema::AddMethodToGlobalPool(ObjCMet
if (ExternalSource)
ReadMethodPool(Method->getSelector());
-
+
GlobalMethodPool::iterator Pos = MethodPool.find(Method->getSelector());
if (Pos == MethodPool.end())
Pos = MethodPool.insert(std::make_pair(Method->getSelector(),
GlobalMethods())).first;
Method->setDefined(impl);
-
+
ObjCMethodList &Entry = instance ? Pos->second.first : Pos->second.second;
addMethodToGlobalList(&Entry, Method);
}
@@ -3521,7 +3521,7 @@ ObjCMethodDecl *Sema::LookupMethodInGlob
bool instance) {
if (ExternalSource)
ReadMethodPool(Sel);
-
+
GlobalMethodPool::iterator Pos = MethodPool.find(Sel);
if (Pos == MethodPool.end())
return nullptr;
@@ -3571,7 +3571,7 @@ void Sema::DiagnoseMultipleMethodInGloba
break;
}
}
-
+
if (issueDiagnostic) {
if (issueError)
Diag(R.getBegin(), diag::err_arc_multiple_method_decl) << Sel << R;
@@ -3579,7 +3579,7 @@ void Sema::DiagnoseMultipleMethodInGloba
Diag(R.getBegin(), diag::warn_strict_multiple_method_decl) << Sel << R;
else
Diag(R.getBegin(), diag::warn_multiple_method_decl) << Sel << R;
-
+
Diag(Methods[0]->getLocStart(),
issueError ? diag::note_possibility : diag::note_using)
<< Methods[0]->getSourceRange();
@@ -3602,7 +3602,7 @@ ObjCMethodDecl *Sema::LookupImplementedM
(Method->getMethod()->isDefined() ||
Method->getMethod()->isPropertyAccessor()))
return Method->getMethod();
-
+
for (const ObjCMethodList *Method = &Methods.second; Method;
Method = Method->getNext())
if (Method->getMethod() &&
@@ -3619,7 +3619,7 @@ HelperSelectorsForTypoCorrection(
const unsigned MaxEditDistance = 1;
unsigned BestEditDistance = MaxEditDistance + 1;
std::string MethodName = Method->getSelector().getAsString();
-
+
unsigned MinPossibleEditDistance = abs((int)MethodName.size() - (int)Typo.size());
if (MinPossibleEditDistance > 0 &&
Typo.size() / MinPossibleEditDistance < 1)
@@ -3694,7 +3694,7 @@ Sema::SelectorsForTypoCorrection(Selecto
Methods.push_back(M->getMethod());
}
}
-
+
SmallVector<const ObjCMethodDecl *, 8> SelectedMethods;
for (unsigned i = 0, e = Methods.size(); i < e; i++) {
HelperSelectorsForTypoCorrection(SelectedMethods,
@@ -3704,11 +3704,11 @@ Sema::SelectorsForTypoCorrection(Selecto
}
/// DiagnoseDuplicateIvars -
-/// Check for duplicate ivars in the entire class at the start of
+/// Check for duplicate ivars in the entire class at the start of
/// \@implementation. This becomes necesssary because class extension can
/// add ivars to a class in random order which will not be known until
/// class's \@implementation is seen.
-void Sema::DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID,
+void Sema::DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID,
ObjCInterfaceDecl *SID) {
for (auto *Ivar : ID->ivars()) {
if (Ivar->isInvalidDecl())
@@ -3980,7 +3980,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceR
if (const ObjCPropertyImplDecl *PIDecl
= IC->FindPropertyImplDecl(Property->getIdentifier(),
Property->getQueryKind()))
- if (PIDecl->getPropertyImplementation()
+ if (PIDecl->getPropertyImplementation()
== ObjCPropertyImplDecl::Dynamic)
continue;
@@ -4107,12 +4107,12 @@ CvtQTToAstBitMask(ObjCDeclSpec::ObjCDecl
/// Check whether the declared result type of the given Objective-C
/// method declaration is compatible with the method's class.
///
-static Sema::ResultTypeCompatibilityKind
+static Sema::ResultTypeCompatibilityKind
CheckRelatedResultTypeCompatibility(Sema &S, ObjCMethodDecl *Method,
ObjCInterfaceDecl *CurrentClass) {
QualType ResultType = Method->getReturnType();
- // If an Objective-C method inherits its related result type, then its
+ // If an Objective-C method inherits its related result type, then its
// declared result type must be compatible with its own class type. The
// declared result type is compatible if:
if (const ObjCObjectPointerType *ResultObjectType
@@ -4121,25 +4121,25 @@ CheckRelatedResultTypeCompatibility(Sema
if (ResultObjectType->isObjCIdType() ||
ResultObjectType->isObjCQualifiedIdType())
return Sema::RTC_Compatible;
-
+
if (CurrentClass) {
- if (ObjCInterfaceDecl *ResultClass
+ if (ObjCInterfaceDecl *ResultClass
= ResultObjectType->getInterfaceDecl()) {
// - it is the same as the method's class type, or
if (declaresSameEntity(CurrentClass, ResultClass))
return Sema::RTC_Compatible;
-
+
// - it is a superclass of the method's class type
if (ResultClass->isSuperClassOf(CurrentClass))
return Sema::RTC_Compatible;
- }
+ }
} else {
// Any Objective-C pointer type might be acceptable for a protocol
// method; we just don't know.
return Sema::RTC_Unknown;
}
}
-
+
return Sema::RTC_Incompatible;
}
@@ -4163,7 +4163,7 @@ public:
if (it == S.MethodPool.end()) {
if (!S.getExternalSource()) return;
S.ReadMethodPool(selector);
-
+
it = S.MethodPool.find(selector);
if (it == S.MethodPool.end())
return;
@@ -4211,7 +4211,7 @@ private:
void searchFrom(ObjCProtocolDecl *protocol) {
if (!protocol->hasDefinition())
return;
-
+
// A method in a protocol declaration overrides declarations from
// referenced ("parent") protocols.
search(protocol->getReferencedProtocols());
@@ -4243,7 +4243,7 @@ private:
// A method in a class declaration overrides declarations from
if (!iface->hasDefinition())
return;
-
+
// - categories,
for (auto *Cat : iface->known_categories())
search(Cat);
@@ -4360,11 +4360,11 @@ void Sema::CheckObjCMethodOverrides(ObjC
continue; // Conflicting properties are detected elsewhere.
// Check for overriding methods
- if (isa<ObjCInterfaceDecl>(ObjCMethod->getDeclContext()) ||
+ if (isa<ObjCInterfaceDecl>(ObjCMethod->getDeclContext()) ||
isa<ObjCImplementationDecl>(ObjCMethod->getDeclContext()))
CheckConflictingOverridingMethod(ObjCMethod, overridden,
isa<ObjCProtocolDecl>(overridden->getDeclContext()));
-
+
if (CurrentClass && overridden->getDeclContext() != CurrentClass &&
isa<ObjCInterfaceDecl>(overridden->getDeclContext()) &&
!overridden->isImplicit() /* not meant for properties */) {
@@ -4574,17 +4574,17 @@ Decl *Sema::ActOnMethodDeclaration(
ArgType = GetTypeFromParser(ArgInfo[i].Type, &DI);
}
- LookupResult R(*this, ArgInfo[i].Name, ArgInfo[i].NameLoc,
+ LookupResult R(*this, ArgInfo[i].Name, ArgInfo[i].NameLoc,
LookupOrdinaryName, forRedeclarationInCurContext());
LookupName(R, S);
if (R.isSingleResult()) {
NamedDecl *PrevDecl = R.getFoundDecl();
if (S->isDeclScope(PrevDecl)) {
- Diag(ArgInfo[i].NameLoc,
- (MethodDefinition ? diag::warn_method_param_redefinition
- : diag::warn_method_param_declaration))
+ Diag(ArgInfo[i].NameLoc,
+ (MethodDefinition ? diag::warn_method_param_redefinition
+ : diag::warn_method_param_declaration))
<< ArgInfo[i].Name;
- Diag(PrevDecl->getLocation(),
+ Diag(PrevDecl->getLocation(),
diag::note_previous_declaration);
}
}
@@ -4615,7 +4615,7 @@ Decl *Sema::ActOnMethodDeclaration(
Params.push_back(Param);
}
-
+
for (unsigned i = 0, e = CNumArgs; i != e; ++i) {
ParmVarDecl *Param = cast<ParmVarDecl>(CParamInfo[i].Param);
QualType ArgType = Param->getType();
@@ -4628,7 +4628,7 @@ Decl *Sema::ActOnMethodDeclaration(
Param->setDeclContext(ObjCMethod);
Params.push_back(Param);
}
-
+
ObjCMethod->setMethodParams(Context, Params, SelectorLocs);
ObjCMethod->setObjCDeclQualifier(
CvtQTToAstBitMask(ReturnQT.getObjCDeclQualifier()));
@@ -4730,12 +4730,12 @@ Decl *Sema::ActOnMethodDeclaration(
case OMF_initialize:
case OMF_performSelector:
break;
-
+
case OMF_alloc:
case OMF_new:
InferRelatedResultType = ObjCMethod->isClassMethod();
break;
-
+
case OMF_init:
case OMF_autorelease:
case OMF_retain:
@@ -4743,7 +4743,7 @@ Decl *Sema::ActOnMethodDeclaration(
InferRelatedResultType = ObjCMethod->isInstanceMethod();
break;
}
-
+
if (InferRelatedResultType &&
!ObjCMethod->getReturnType()->isObjCIndependentClassType())
ObjCMethod->SetRelatedResultType();
@@ -4779,7 +4779,7 @@ bool Sema::CheckObjCDeclScope(Decl *D) {
// an objc container, it means the parser missed emitting an error.
if (isa<TranslationUnitDecl>(getCurLexicalContext()->getRedeclContext()))
return false;
-
+
Diag(D->getLocation(), diag::err_objc_decls_may_only_appear_in_global_scope);
D->setInvalidDecl();
@@ -4834,7 +4834,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(Ty
SourceLocation IdLoc,
IdentifierInfo *Id,
bool Invalid) {
- // ISO/IEC TR 18037 S6.7.3: "The type of an object with automatic storage
+ // ISO/IEC TR 18037 S6.7.3: "The type of an object with automatic storage
// duration shall not be qualified by an address-space qualifier."
// Since all parameters have automatic store duration, they can not have
// an address space.
@@ -4842,7 +4842,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(Ty
Diag(IdLoc, diag::err_arg_with_address_space);
Invalid = true;
}
-
+
// An @catch parameter must be an unqualified object pointer type;
// FIXME: Recover from "NSObject foo" by inserting the * in "NSObject *foo"?
if (Invalid) {
@@ -4861,11 +4861,11 @@ VarDecl *Sema::BuildObjCExceptionDecl(Ty
Invalid = true;
Diag(IdLoc, diag::err_catch_param_not_objc_type);
}
-
+
VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id,
T, TInfo, SC_None);
New->setExceptionVariable(true);
-
+
// In ARC, infer 'retaining' for variables of retainable type.
if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(New))
Invalid = true;
@@ -4877,7 +4877,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(Ty
Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) {
const DeclSpec &DS = D.getDeclSpec();
-
+
// We allow the "register" storage class on exception variables because
// GCC did, but we drop it completely. Any other storage class is an error.
if (DS.getStorageClassSpec() == DeclSpec::SCS_register) {
@@ -4897,12 +4897,12 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope
D.getMutableDeclSpec().ClearStorageClassSpecs();
DiagnoseFunctionSpecifiers(D.getDeclSpec());
-
+
// Check that there are no default arguments inside the type of this
// exception object (C++ only).
if (getLangOpts().CPlusPlus)
CheckExtraCXXDefaultArguments(D);
-
+
TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
QualType ExceptionType = TInfo->getType();
@@ -4911,21 +4911,21 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope
D.getIdentifierLoc(),
D.getIdentifier(),
D.isInvalidType());
-
+
// Parameter declarators cannot be qualified (C++ [dcl.meaning]p1).
if (D.getCXXScopeSpec().isSet()) {
Diag(D.getIdentifierLoc(), diag::err_qualified_objc_catch_parm)
<< D.getCXXScopeSpec().getRange();
New->setInvalidDecl();
}
-
+
// Add the parameter declaration into this scope.
S->AddDecl(New);
if (D.getIdentifier())
IdResolver.AddDecl(New);
-
+
ProcessDeclAttributes(S, New, D);
-
+
if (New->hasAttr<BlocksAttr>())
Diag(New->getLocation(), diag::err_block_on_nonlocal);
return New;
@@ -4935,7 +4935,7 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope
/// initialization.
void Sema::CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI,
SmallVectorImpl<ObjCIvarDecl*> &Ivars) {
- for (ObjCIvarDecl *Iv = OI->all_declared_ivar_begin(); Iv;
+ for (ObjCIvarDecl *Iv = OI->all_declared_ivar_begin(); Iv;
Iv= Iv->getNextIvar()) {
QualType QT = Context.getBaseElementType(Iv->getType());
if (QT->isRecordType())
@@ -4951,11 +4951,11 @@ void Sema::DiagnoseUseOfUnimplementedSel
for (unsigned I = 0, N = Sels.size(); I != N; ++I)
ReferencedSelectors[Sels[I].first] = Sels[I].second;
}
-
+
// Warning will be issued only when selector table is
// generated (which means there is at lease one implementation
// in the TU). This is to match gcc's behavior.
- if (ReferencedSelectors.empty() ||
+ if (ReferencedSelectors.empty() ||
!Context.AnyObjCImplementation())
return;
for (auto &SelectorAndLocation : ReferencedSelectors) {
Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Mon Jul 30 12:24:48 2018
@@ -385,7 +385,7 @@ bool Sema::CheckEquivalentExceptionSpec(
OnFirstException = false;
else
OS << ", ";
-
+
OS << E.getAsString(getPrintingPolicy());
}
OS << ")";
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jul 30 12:24:48 2018
@@ -248,7 +248,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *
Diag(Loc, diag::err_deleted_inherited_ctor_use)
<< Ctor->getParent()
<< Ctor->getInheritedConstructor().getConstructor()->getParent();
- else
+ else
Diag(Loc, diag::err_deleted_function_use);
NoteDeletedFunction(FD);
return true;
@@ -401,7 +401,7 @@ void Sema::DiagnoseSentinelCalls(NamedDe
if (MissingNilLoc.isInvalid())
Diag(Loc, diag::warn_missing_sentinel) << int(calleeType);
else
- Diag(MissingNilLoc, diag::warn_missing_sentinel)
+ Diag(MissingNilLoc, diag::warn_missing_sentinel)
<< int(calleeType)
<< FixItHint::CreateInsertion(MissingNilLoc, ", " + NullValue);
Diag(D->getLocation(), diag::note_sentinel_here) << int(calleeType);
@@ -423,7 +423,7 @@ ExprResult Sema::DefaultFunctionArrayCon
if (result.isInvalid()) return ExprError();
E = result.get();
}
-
+
QualType Ty = E->getType();
assert(!Ty.isNull() && "DefaultFunctionArrayConversion - missing type");
@@ -479,12 +479,12 @@ static void DiagnoseDirectIsaAccess(Sema
const ObjCIvarDecl *IV = OIRE->getDecl();
if (!IV)
return;
-
+
DeclarationName MemberName = IV->getDeclName();
IdentifierInfo *Member = MemberName.getAsIdentifierInfo();
if (!Member || !Member->isStr("isa"))
return;
-
+
const Expr *Base = OIRE->getBase();
QualType BaseType = Base->getType();
if (OIRE->isArrow())
@@ -536,7 +536,7 @@ ExprResult Sema::DefaultLvalueConversion
if (result.isInvalid()) return ExprError();
E = result.get();
}
-
+
// C++ [conv.lval]p1:
// A glvalue of a non-function, non-array type T can be
// converted to a prvalue.
@@ -604,8 +604,8 @@ ExprResult Sema::DefaultLvalueConversion
(void)isCompleteType(E->getExprLoc(), T);
UpdateMarkingForLValueToRValue(E);
-
- // Loading a __weak object implicitly retains the value, so we need a cleanup to
+
+ // Loading a __weak object implicitly retains the value, so we need a cleanup to
// balance that.
if (E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
Cleanup.setExprNeedsCleanups(true);
@@ -614,14 +614,14 @@ ExprResult Sema::DefaultLvalueConversion
nullptr, VK_RValue);
// C11 6.3.2.1p2:
- // ... if the lvalue has atomic type, the value has the non-atomic version
+ // ... if the lvalue has atomic type, the value has the non-atomic version
// of the type of the lvalue ...
if (const AtomicType *Atomic = T->getAs<AtomicType>()) {
T = Atomic->getValueType().getUnqualifiedType();
Res = ImplicitCastExpr::Create(Context, T, CK_AtomicToNonAtomic, Res.get(),
nullptr, VK_RValue);
}
-
+
return Res;
}
@@ -876,7 +876,7 @@ ExprResult Sema::DefaultVariadicArgument
E = ExprRes.get();
}
}
-
+
ExprResult ExprRes = DefaultArgumentPromotion(E);
if (ExprRes.isInvalid())
return ExprError();
@@ -1011,7 +1011,7 @@ static QualType handleIntToFloatConversi
CK_IntegralToFloating);
return FloatTy;
}
-
+
// Convert both sides to the appropriate complex float.
assert(IntTy->isComplexIntegerType());
QualType result = S.Context.getComplexType(FloatTy);
@@ -1201,7 +1201,7 @@ static QualType handleComplexIntConversi
QualType ComplexType = S.Context.getComplexType(ScalarType);
RHS = S.ImpCastExprToType(RHS.get(), ComplexType,
CK_IntegralRealToComplex);
-
+
return ComplexType;
}
@@ -1212,7 +1212,7 @@ static QualType handleComplexIntConversi
handleIntegerConversion<doIntegralCast, doComplexIntegralCast>
(S, LHS, RHS, LHSType, RHSEltType, IsCompAssign);
QualType ComplexType = S.Context.getComplexType(ScalarType);
-
+
if (!IsCompAssign)
LHS = S.ImpCastExprToType(LHS.get(), ComplexType,
CK_IntegralRealToComplex);
@@ -2099,7 +2099,7 @@ Sema::ActOnIdExpression(Scope *S, CXXSco
bool IvarLookupFollowUp = II && !SS.isSet() && getCurMethodDecl();
LookupParsedName(R, S, &SS, !IvarLookupFollowUp);
- // If the result might be in a dependent base class, this is a dependent
+ // If the result might be in a dependent base class, this is a dependent
// id-expression.
if (R.getResultKind() == LookupResult::NotFoundInCurrentInstantiation)
return ActOnDependentIdExpression(SS, TemplateKWLoc, NameInfo,
@@ -2357,7 +2357,7 @@ Sema::LookupInObjCMethod(LookupResult &L
IdentifierInfo *II, bool AllowBuiltinCreation) {
SourceLocation Loc = Lookup.getNameLoc();
ObjCMethodDecl *CurMethod = getCurMethodDecl();
-
+
// Check for error condition which is already reported.
if (!CurMethod)
return ExprError();
@@ -2445,7 +2445,7 @@ Sema::LookupInObjCMethod(LookupResult &L
Diag(Loc, diag::warn_implicitly_retains_self)
<< FixItHint::CreateInsertion(Loc, "self->");
}
-
+
return Result;
}
} else if (CurMethod->isInstanceMethod()) {
@@ -2918,7 +2918,7 @@ ExprResult Sema::BuildDeclarationNameExp
if (!CapturedType.isNull())
type = CapturedType;
}
-
+
break;
}
@@ -2934,7 +2934,7 @@ ExprResult Sema::BuildDeclarationNameExp
diagnoseUncapturableValueReference(*this, Loc, BD, CurContext);
break;
}
-
+
case Decl::Function: {
if (unsigned BID = cast<FunctionDecl>(VD)->getBuiltinID()) {
if (!Context.BuiltinInfo.isPredefinedLibFunction(BID)) {
@@ -2959,7 +2959,7 @@ ExprResult Sema::BuildDeclarationNameExp
valueKind = VK_LValue;
break;
}
-
+
// C99 DR 316 says that, if a function type comes from a
// function definition (without a prototype), that type is only
// used for checking compatibility. Therefore, when referencing
@@ -4029,11 +4029,11 @@ ExprResult
Sema::CreateUnaryExprOrTypeTraitExpr(Expr *E, SourceLocation OpLoc,
UnaryExprOrTypeTrait ExprKind) {
ExprResult PE = CheckPlaceholderExpr(E);
- if (PE.isInvalid())
+ if (PE.isInvalid())
return ExprError();
E = PE.get();
-
+
// Verify that the operand is valid.
bool isInvalid = false;
if (E->isTypeDependent()) {
@@ -4562,7 +4562,7 @@ bool Sema::CheckCXXDefaultArgExpr(Source
diag::note_default_argument_declared_here);
return true;
}
-
+
if (Param->hasUninstantiatedDefaultArg()) {
Expr *UninstExpr = Param->getUninstantiatedDefaultArg();
@@ -4664,7 +4664,7 @@ bool Sema::CheckCXXDefaultArgExpr(Source
"default argument expression has capturing blocks?");
}
- // We already type-checked the argument, so we know it works.
+ // We already type-checked the argument, so we know it works.
// Just mark all of the declarations in this potentially-evaluated expression
// as being "referenced".
MarkDeclarationsReferencedInExpr(Param->getDefaultArg(),
@@ -4861,7 +4861,7 @@ Sema::ConvertArgumentsForCall(CallExpr *
if (!TC && FDecl && !FDecl->getBuiltinID() && !IsExecConfig)
Diag(FDecl->getLocStart(), diag::note_callee_decl)
<< FDecl;
-
+
// This deletes the extra arguments.
Call->setNumArgs(Context, NumParams);
return true;
@@ -4869,7 +4869,7 @@ Sema::ConvertArgumentsForCall(CallExpr *
}
SmallVector<Expr *, 8> AllArgs;
VariadicCallType CallType = getVariadicCallType(FDecl, Proto, Fn);
-
+
Invalid = GatherArgumentsForCall(Call->getLocStart(), FDecl,
Proto, 0, Args, AllArgs, CallType);
if (Invalid)
@@ -5275,11 +5275,11 @@ tryImplicitlyCaptureThisIfImplicitMember
// Check if the naming class in which the unresolved members were found is
// related (same as or is a base of) to the enclosing class.
-
+
if (!enclosingClassIsRelatedToClassInWhichMembersWereFound(UME, S))
return;
-
-
+
+
DeclContext *EnclosingFunctionCtx = S.CurContext->getParent()->getParent();
// If the enclosing function is not dependent, then this lambda is
// capture ready, so if we can capture this, do so.
@@ -5625,7 +5625,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
Diag(RParenLoc, diag::warn_call_wrong_number_of_arguments)
<< (Args.size() > Def->param_size()) << FDecl << Fn->getSourceRange();
}
-
+
// If the function we're calling isn't a function prototype, but we have
// a function prototype from a prior declaratiom, use that prototype.
if (!FDecl->hasPrototype())
@@ -5643,7 +5643,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
PerformCopyInitialization(Entity, SourceLocation(), Arg);
if (ArgE.isInvalid())
return true;
-
+
Arg = ArgE.getAs<Expr>();
} else {
@@ -5654,7 +5654,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
Arg = ArgE.getAs<Expr>();
}
-
+
if (RequireCompleteType(Arg->getLocStart(),
Arg->getType(),
diag::err_call_incomplete_argument, Arg))
@@ -5728,7 +5728,7 @@ Sema::BuildCompoundLiteralExpr(SourceLoc
InitializedEntity Entity
= InitializedEntity::InitializeCompoundLiteralInit(TInfo);
InitializationKind Kind
- = InitializationKind::CreateCStyleCast(LParenLoc,
+ = InitializationKind::CreateCStyleCast(LParenLoc,
SourceRange(LParenLoc, RParenLoc),
/*InitList=*/true);
InitializationSequence InitSeq(*this, Entity, Kind, LiteralExpr);
@@ -6007,11 +6007,11 @@ static bool breakDownVectorType(QualType
assert(eltType->isScalarType());
return true;
}
-
+
// We allow lax conversion to and from non-vector types, but only if
// they're real types (i.e. non-complex, non-pointer scalar types).
if (!type->isRealType()) return false;
-
+
len = 1;
eltType = type;
return true;
@@ -6026,7 +6026,7 @@ static bool breakDownVectorType(QualType
/// vector nor a real type.
bool Sema::areLaxCompatibleVectorTypes(QualType srcTy, QualType destTy) {
assert(destTy->isVectorType() || srcTy->isVectorType());
-
+
// Disallow lax conversions between scalars and ExtVectors (these
// conversions are allowed for other vector types because common headers
// depend on them). Most scalar OP ExtVector cases are handled by the
@@ -6039,13 +6039,13 @@ bool Sema::areLaxCompatibleVectorTypes(Q
QualType srcEltTy, destEltTy;
if (!breakDownVectorType(srcTy, srcLen, srcEltTy)) return false;
if (!breakDownVectorType(destTy, destLen, destEltTy)) return false;
-
+
// ASTContext::getTypeSize will return the size rounded up to a
// power of 2, so instead of using that, we need to use the raw
// element size multiplied by the element count.
uint64_t srcEltSize = Context.getTypeSize(srcEltTy);
uint64_t destEltSize = Context.getTypeSize(destEltTy);
-
+
return (srcLen * srcEltSize == destLen * destEltSize);
}
@@ -6053,7 +6053,7 @@ bool Sema::areLaxCompatibleVectorTypes(Q
/// known to be a vector type?
bool Sema::isLaxVectorConversion(QualType srcTy, QualType destTy) {
assert(destTy->isVectorType() || srcTy->isVectorType());
-
+
if (!Context.getLangOpts().LaxVectorConversions)
return false;
return areLaxCompatibleVectorTypes(srcTy, destTy);
@@ -6211,9 +6211,9 @@ Sema::ActOnCastExpr(Scope *S, SourceLoca
if (getLangOpts().CPlusPlus && !castType->isVoidType() &&
!getSourceManager().isInSystemMacro(LParenLoc))
Diag(LParenLoc, diag::warn_old_style_cast) << CastExpr->getSourceRange();
-
+
CheckTollFreeBridgeCast(castType, CastExpr);
-
+
CheckObjCBridgeRelatedCast(castType, CastExpr);
DiscardMisalignedMemberAddress(castType.getTypePtr(), CastExpr);
@@ -6250,7 +6250,7 @@ ExprResult Sema::BuildVectorLiteral(Sour
SmallVector<Expr *, 8> initExprs;
const VectorType *VTy = Ty->getAs<VectorType>();
unsigned numElems = Ty->getAs<VectorType>()->getNumElements();
-
+
// '(...)' form of vector initialization in AltiVec: the number of
// initializers must be one or must match the size of the vector.
// If a single value is specified in the initializer then it will be
@@ -6290,7 +6290,7 @@ ExprResult Sema::BuildVectorLiteral(Sour
PrepareScalarCast(Literal, ElemTy));
return BuildCStyleCastExpr(LParenLoc, TInfo, RParenLoc, Literal.get());
}
-
+
initExprs.append(exprs, exprs + numExprs);
}
// FIXME: This means that pretty-printing the final AST will produce curly
@@ -6787,7 +6787,7 @@ static QualType
OpenCLCheckVectorConditional(Sema &S, ExprResult &Cond,
ExprResult &LHS, ExprResult &RHS,
SourceLocation QuestionLoc) {
- Cond = S.DefaultFunctionArrayLvalueConversion(Cond.get());
+ Cond = S.DefaultFunctionArrayLvalueConversion(Cond.get());
if (Cond.isInvalid())
return QualType();
QualType CondTy = Cond.get()->getType();
@@ -7359,7 +7359,7 @@ ExprResult Sema::ActOnConditionalOp(Sour
ExprValueKind VK = VK_RValue;
ExprObjectKind OK = OK_Ordinary;
ExprResult Cond = CondExpr, LHS = LHSExpr, RHS = RHSExpr;
- QualType result = CheckConditionalOperands(Cond, LHS, RHS,
+ QualType result = CheckConditionalOperands(Cond, LHS, RHS,
VK, OK, QuestionLoc);
if (result.isNull() || Cond.isInvalid() || LHS.isInvalid() ||
RHS.isInvalid())
@@ -7431,7 +7431,7 @@ checkPointerTypesForAssignment(Sema &S,
// Treat lifetime mismatches as fatal.
else if (lhq.getObjCLifetime() != rhq.getObjCLifetime())
ConvTy = Sema::IncompatiblePointerDiscardsQualifiers;
-
+
// For GCC/MS compatibility, other qualifier mismatches are treated
// as still compatible in C.
else ConvTy = Sema::CompatiblePointerDiscardsQualifiers;
@@ -7778,7 +7778,7 @@ Sema::CheckAssignmentConstraints(QualTyp
// - conversions from 'Class' to the redefinition type
if (RHSType->isObjCClassType() &&
- Context.hasSameType(LHSType,
+ Context.hasSameType(LHSType,
Context.getObjCClassRedefinitionType())) {
Kind = CK_BitCast;
return Compatible;
@@ -7845,10 +7845,10 @@ Sema::CheckAssignmentConstraints(QualTyp
// A* -> B*
if (RHSType->isObjCObjectPointerType()) {
Kind = CK_BitCast;
- Sema::AssignConvertType result =
+ Sema::AssignConvertType result =
checkObjCPointerTypesForAssignment(*this, LHSType, RHSType);
if (getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
- result == Compatible &&
+ result == Compatible &&
!CheckObjCARCUnavailableWeakConversion(OrigLHSType, RHSType))
result = IncompatibleObjCWeakRef;
return result;
@@ -7872,7 +7872,7 @@ Sema::CheckAssignmentConstraints(QualTyp
// - conversions to 'Class' from its redefinition type
if (LHSType->isObjCClassType() &&
- Context.hasSameType(RHSType,
+ Context.hasSameType(RHSType,
Context.getObjCClassRedefinitionType())) {
return Compatible;
}
@@ -7881,7 +7881,7 @@ Sema::CheckAssignmentConstraints(QualTyp
}
// Only under strict condition T^ is compatible with an Objective-C pointer.
- if (RHSType->isBlockPointerType() &&
+ if (RHSType->isBlockPointerType() &&
LHSType->isBlockCompatibleObjCPointerType(Context)) {
if (ConvertRHS)
maybeExtendBlockObject(RHS);
@@ -8113,7 +8113,7 @@ Sema::CheckSingleAssignmentConstraints(Q
Diag(PDecl->getLocation(), diag::note_entity_declared_at) << PDecl;
}
}
-
+
CastKind Kind;
Sema::AssignConvertType result =
CheckAssignmentConstraints(LHSType, RHS, Kind, ConvertRHS);
@@ -8249,7 +8249,7 @@ static bool tryVectorConvertAndSplat(Sem
// The conversion to apply to the scalar before splatting it,
// if necessary.
CastKind scalarCast = CK_NoOp;
-
+
if (vectorEltTy->isIntegralType(S.Context)) {
if (S.getLangOpts().OpenCL && (scalarTy->isRealFloatingType() ||
(scalarTy->isIntegerType() &&
@@ -8709,7 +8709,7 @@ QualType Sema::CheckRemainderOperands(
if (LHS.get()->getType()->isVectorType() ||
RHS.get()->getType()->isVectorType()) {
- if (LHS.get()->getType()->hasIntegerRepresentation() &&
+ if (LHS.get()->getType()->hasIntegerRepresentation() &&
RHS.get()->getType()->hasIntegerRepresentation())
return CheckVectorOperands(LHS, RHS, Loc, IsCompAssign,
/*AllowBothBool*/getLangOpts().AltiVec,
@@ -9061,7 +9061,7 @@ QualType Sema::CheckAdditionOperands(Exp
// In C++ adding zero to a null pointer is defined.
llvm::APSInt KnownVal;
if (!getLangOpts().CPlusPlus ||
- (!IExp->isValueDependent() &&
+ (!IExp->isValueDependent() &&
(!IExp->EvaluateAsInt(KnownVal, Context) || KnownVal != 0))) {
// Check the conditions to see if this is the 'p = nullptr + n' idiom.
bool IsGNUIdiom = BinaryOperator::isNullPointerArithmeticExtension(
@@ -9138,7 +9138,7 @@ QualType Sema::CheckSubtractionOperands(
Expr::NPC_ValueDependentIsNotNull)) {
// In C++ adding zero to a null pointer is defined.
llvm::APSInt KnownVal;
- if (!getLangOpts().CPlusPlus ||
+ if (!getLangOpts().CPlusPlus ||
(!RHS.get()->isValueDependent() &&
(!RHS.get()->EvaluateAsInt(KnownVal, Context) || KnownVal != 0))) {
diagnoseArithmeticOnNullPointer(*this, Loc, LHS.get(), false);
@@ -10416,7 +10416,7 @@ QualType Sema::CheckCompareOperands(Expr
if (isError)
return QualType();
}
-
+
if (LHSType->isIntegerType())
LHS = ImpCastExprToType(LHS.get(), RHSType,
LHSIsNull ? CK_NullToPointer : CK_IntegralToPointer);
@@ -10425,7 +10425,7 @@ QualType Sema::CheckCompareOperands(Expr
RHSIsNull ? CK_NullToPointer : CK_IntegralToPointer);
return computeResultTy();
}
-
+
// Handle block pointers.
if (!IsRelational && RHSIsNull
&& LHSType->isBlockPointerType() && RHSType->isIntegerType()) {
@@ -10596,7 +10596,7 @@ inline QualType Sema::CheckLogicalOperan
// Check vector operands differently.
if (LHS.get()->getType()->isVectorType() || RHS.get()->getType()->isVectorType())
return CheckVectorLogicalOperands(LHS, RHS, Loc);
-
+
// Diagnose cases where the user write a logical and/or but probably meant a
// bitwise one. We do this when the LHS is a non-bool integer and the RHS
// is a constant.
@@ -11120,7 +11120,7 @@ QualType Sema::CheckAssignmentOperands(E
<< LHSType.getUnqualifiedType();
return QualType();
}
-
+
AssignConvertType ConvTy;
if (CompoundType.isNull()) {
Expr *RHSCheck = RHS.get();
@@ -11357,7 +11357,7 @@ static QualType CheckIncrementDecrementO
// Otherwise, we just need a complete type.
if (checkArithmeticIncompletePointerType(S, OpLoc, Op) ||
checkArithmeticOnObjCPointer(S, OpLoc, Op))
- return QualType();
+ return QualType();
} else if (ResType->isAnyComplexType()) {
// C99 does not support ++/-- on complex types, we allow as an extension.
S.Diag(OpLoc, diag::ext_integer_increment_complex)
@@ -11397,7 +11397,7 @@ static QualType CheckIncrementDecrementO
return ResType.getUnqualifiedType();
}
}
-
+
/// getPrimaryDecl - Helper function for CheckAddressOfOperand().
/// This routine allows us to typecheck complex/recursive expressions
@@ -11557,7 +11557,7 @@ QualType Sema::CheckAddressOfOperand(Exp
Expr::LValueClassification lval = op->ClassifyLValue(Context);
unsigned AddressOfError = AO_No_Error;
- if (lval == Expr::LV_ClassTemporary || lval == Expr::LV_ArrayTemporary) {
+ if (lval == Expr::LV_ClassTemporary || lval == Expr::LV_ArrayTemporary) {
bool sfinae = (bool)isSFINAEContext();
Diag(OpLoc, isSFINAEContext() ? diag::err_typecheck_addrof_temporary
: diag::ext_typecheck_addrof_temporary)
@@ -11772,7 +11772,7 @@ static QualType CheckIndirectionOperand(
// ...except that certain expressions are never l-values in C.
if (!S.getLangOpts().CPlusPlus && Result.isCForbiddenLValueType())
VK = VK_RValue;
-
+
return Result;
}
@@ -11910,7 +11910,7 @@ static void checkObjCPointerIntrospectio
if (SelArg0.startswith("performSelector"))
Diag = diag::warn_objc_pointer_masking_performSelector;
}
-
+
S.Diag(OpLoc, Diag)
<< ObjCPointerExpr->getSourceRange();
}
@@ -12209,7 +12209,7 @@ ExprResult Sema::CreateBuiltinBinOp(Sour
else if (const ObjCIvarRefExpr *OIRE =
dyn_cast<ObjCIvarRefExpr>(LHS.get()->IgnoreParenCasts()))
DiagnoseDirectIsaAccess(*this, OIRE, OpLoc, RHS.get());
-
+
// Opc is not a compound assignment if CompResultTy is null.
if (CompResultTy.isNull()) {
if (ConvertHalfVec)
@@ -12549,7 +12549,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
return ExprError();
}
}
-
+
ExprResult LHS = CheckPlaceholderExpr(LHSExpr);
if (LHS.isInvalid()) return ExprError();
LHSExpr = LHS.get();
@@ -12762,7 +12762,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(So
return ExprError(Diag(OpLoc, diag::err_typecheck_unary_expr)
<< resultType << Input.get()->getSourceRange());
}
-
+
// LNot always has type int. C99 6.5.3.3p5.
// In C++, it's bool. C++ 5.3.1p8
resultType = Context.getLogicalOperationType();
@@ -12820,23 +12820,23 @@ bool Sema::isQualifiedMemberAccess(Expr
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
if (!DRE->getQualifier())
return false;
-
+
ValueDecl *VD = DRE->getDecl();
if (!VD->isCXXClassMember())
return false;
-
+
if (isa<FieldDecl>(VD) || isa<IndirectFieldDecl>(VD))
return true;
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(VD))
return Method->isInstance();
-
+
return false;
}
-
+
if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
if (!ULE->getQualifier())
return false;
-
+
for (NamedDecl *D : ULE->decls()) {
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
if (Method->isInstance())
@@ -12846,10 +12846,10 @@ bool Sema::isQualifiedMemberAccess(Expr
break;
}
}
-
+
return false;
}
-
+
return false;
}
@@ -13031,17 +13031,17 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
QualType ArgTy = TInfo->getType();
bool Dependent = ArgTy->isDependentType();
SourceRange TypeRange = TInfo->getTypeLoc().getLocalSourceRange();
-
+
// We must have at least one component that refers to the type, and the first
// one is known to be a field designator. Verify that the ArgTy represents
// a struct/union/class.
if (!Dependent && !ArgTy->isRecordType())
- return ExprError(Diag(BuiltinLoc, diag::err_offsetof_record_type)
+ return ExprError(Diag(BuiltinLoc, diag::err_offsetof_record_type)
<< ArgTy << TypeRange);
-
+
// Type must be complete per C99 7.17p3 because a declaring a variable
// with an incomplete type would be ill-formed.
- if (!Dependent
+ if (!Dependent
&& RequireCompleteType(BuiltinLoc, ArgTy,
diag::err_offsetof_incomplete_type, TypeRange))
return ExprError();
@@ -13061,7 +13061,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
CurrentType = AT->getElementType();
} else
CurrentType = Context.DependentTy;
-
+
ExprResult IdxRval = DefaultLvalueConversion(static_cast<Expr*>(OC.U.E));
if (IdxRval.isInvalid())
return ExprError();
@@ -13080,7 +13080,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
Exprs.push_back(Idx);
continue;
}
-
+
// Offset of a field.
if (CurrentType->isDependentType()) {
// We have the offset of a field, but we can't look into the dependent
@@ -13089,19 +13089,19 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
CurrentType = Context.DependentTy;
continue;
}
-
+
// We need to have a complete type to look into.
if (RequireCompleteType(OC.LocStart, CurrentType,
diag::err_offsetof_incomplete_type))
return ExprError();
-
+
// Look for the designated field.
const RecordType *RC = CurrentType->getAs<RecordType>();
- if (!RC)
+ if (!RC)
return ExprError(Diag(OC.LocEnd, diag::err_offsetof_record_type)
<< CurrentType);
RecordDecl *RD = RC->getDecl();
-
+
// C++ [lib.support.types]p5:
// The macro offsetof accepts a restricted set of type arguments in this
// International Standard. type shall be a POD structure or a POD union
@@ -13122,7 +13122,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
<< CurrentType))
DidWarnAboutNonPOD = true;
}
-
+
// Look for the field.
LookupResult R(*this, OC.U.IdentInfo, OC.LocStart, LookupMemberName);
LookupQualifiedName(R, RD);
@@ -13135,9 +13135,9 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
if (!MemberDecl)
return ExprError(Diag(BuiltinLoc, diag::err_no_member)
- << OC.U.IdentInfo << RD << SourceRange(OC.LocStart,
+ << OC.U.IdentInfo << RD << SourceRange(OC.LocStart,
OC.LocEnd));
-
+
// C99 7.17p3:
// (If the specified member is a bit-field, the behavior is undefined.)
//
@@ -13180,9 +13180,9 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
} else
Comps.push_back(OffsetOfNode(OC.LocStart, MemberDecl, OC.LocEnd));
- CurrentType = MemberDecl->getType().getNonReferenceType();
+ CurrentType = MemberDecl->getType().getNonReferenceType();
}
-
+
return OffsetOfExpr::Create(Context, Context.getSizeType(), BuiltinLoc, TInfo,
Comps, Exprs, RParenLoc);
}
@@ -13193,7 +13193,7 @@ ExprResult Sema::ActOnBuiltinOffsetOf(Sc
ParsedType ParsedArgTy,
ArrayRef<OffsetOfComponent> Components,
SourceLocation RParenLoc) {
-
+
TypeSourceInfo *ArgTInfo;
QualType ArgTy = GetTypeFromParser(ParsedArgTy, &ArgTInfo);
if (ArgTy.isNull())
@@ -13298,7 +13298,7 @@ void Sema::ActOnBlockArguments(SourceLoc
T = Context.getFunctionType(Context.DependentTy, None, EPI);
Sig = Context.getTrivialTypeSourceInfo(T);
}
-
+
// GetTypeForDeclarator always produces a function type for a block
// literal signature. Furthermore, it is always a FunctionProtoType
// unless the function was written with a typedef.
@@ -13376,7 +13376,7 @@ void Sema::ActOnBlockArguments(SourceLoc
CheckParmsForFunctionDef(CurBlock->TheDecl->parameters(),
/*CheckParameterNames=*/false);
}
-
+
// Finally we can process decl attributes.
ProcessDeclAttributes(CurScope, CurBlock->TheDecl, ParamInfo);
@@ -13452,7 +13452,7 @@ ExprResult Sema::ActOnBlockStmtExpr(Sour
FunctionType::ExtInfo Ext = FTy->getExtInfo();
if (NoReturn && !Ext.getNoReturn()) Ext = Ext.withNoReturn(true);
-
+
// Turn protoless block types into nullary block types.
if (isa<FunctionNoProtoType>(FTy)) {
FunctionProtoType::ExtProtoInfo EPI;
@@ -13500,7 +13500,7 @@ ExprResult Sema::ActOnBlockStmtExpr(Sour
if (getLangOpts().CPlusPlus && RetTy->isRecordType() &&
!BSI->TheDecl->isDependentContext())
computeNRVO(Body, BSI);
-
+
BlockExpr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy);
AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
PopFunctionScopeInfo(&WP, Result->getBlockDecl(), Result);
@@ -13674,7 +13674,7 @@ bool Sema::ConversionToObjCStringLiteral
if (!ID || !ID->getIdentifier()->isStr("NSString"))
return false;
}
-
+
// Ignore any parens, implicit casts (should only be
// array-to-pointer decays), and not-so-opaque values. The last is
// important for making this trigger for property assignments.
@@ -13907,7 +13907,7 @@ bool Sema::DiagnoseAssignmentResult(Assi
PDecl && IFace && !IFace->hasDefinition())
Diag(IFace->getLocation(), diag::note_incomplete_class_and_qualified_id)
<< IFace << PDecl;
-
+
if (SecondType == Context.OverloadTy)
NoteAllOverloadCandidates(OverloadExpr::find(SrcExpr).Expression,
FirstType, /*TakingAddress=*/true);
@@ -13917,7 +13917,7 @@ bool Sema::DiagnoseAssignmentResult(Assi
if (Action == AA_Returning && ConvTy == IncompatiblePointer)
EmitRelatedResultTypeNoteForReturn(DstType);
-
+
if (Complained)
*Complained = true;
return isInvalid;
@@ -13931,7 +13931,7 @@ ExprResult Sema::VerifyIntegerConstantEx
S.Diag(Loc, diag::err_expr_not_ice) << S.LangOpts.CPlusPlus << SR;
}
} Diagnoser;
-
+
return VerifyIntegerConstantExpression(E, Result, Diagnoser);
}
@@ -13941,16 +13941,16 @@ ExprResult Sema::VerifyIntegerConstantEx
bool AllowFold) {
class IDDiagnoser : public VerifyICEDiagnoser {
unsigned DiagID;
-
+
public:
IDDiagnoser(unsigned DiagID)
: VerifyICEDiagnoser(DiagID == 0), DiagID(DiagID) { }
-
+
void diagnoseNotICE(Sema &S, SourceLocation Loc, SourceRange SR) override {
S.Diag(Loc, DiagID) << SR;
}
} Diagnoser(DiagID);
-
+
return VerifyIntegerConstantExpression(E, Result, Diagnoser, AllowFold);
}
@@ -14516,19 +14516,19 @@ diagnoseUncapturableValueReference(Sema
// capture.
}
-
-static bool isVariableAlreadyCapturedInScopeInfo(CapturingScopeInfo *CSI, VarDecl *Var,
+
+static bool isVariableAlreadyCapturedInScopeInfo(CapturingScopeInfo *CSI, VarDecl *Var,
bool &SubCapturesAreNested,
- QualType &CaptureType,
+ QualType &CaptureType,
QualType &DeclRefType) {
// Check whether we've already captured it.
if (CSI->CaptureMap.count(Var)) {
// If we found a capture, any subcaptures are nested.
SubCapturesAreNested = true;
-
+
// Retrieve the capture type for this variable.
CaptureType = CSI->getCapture(Var).getCaptureType();
-
+
// Compute the type of an expression that refers to this variable.
DeclRefType = CaptureType.getNonReferenceType();
@@ -14548,8 +14548,8 @@ static bool isVariableAlreadyCapturedInS
// Only block literals, captured statements, and lambda expressions can
// capture; other scopes don't work.
-static DeclContext *getParentOfCapturingContextOrNull(DeclContext *DC, VarDecl *Var,
- SourceLocation Loc,
+static DeclContext *getParentOfCapturingContextOrNull(DeclContext *DC, VarDecl *Var,
+ SourceLocation Loc,
const bool Diagnose, Sema &S) {
if (isa<BlockDecl>(DC) || isa<CapturedDecl>(DC) || isLambdaCallOperator(DC))
return getLambdaAwareParentOfDeclContext(DC);
@@ -14560,11 +14560,11 @@ static DeclContext *getParentOfCapturing
return nullptr;
}
-// Certain capturing entities (lambdas, blocks etc.) are not allowed to capture
+// Certain capturing entities (lambdas, blocks etc.) are not allowed to capture
// certain types of variables (unnamed, variably modified types etc.)
// so check for eligibility.
-static bool isVariableCapturable(CapturingScopeInfo *CSI, VarDecl *Var,
- SourceLocation Loc,
+static bool isVariableCapturable(CapturingScopeInfo *CSI, VarDecl *Var,
+ SourceLocation Loc,
const bool Diagnose, Sema &S) {
bool IsBlock = isa<BlockScopeInfo>(CSI);
@@ -14586,7 +14586,7 @@ static bool isVariableCapturable(Capturi
if (Var->getType()->isVariablyModifiedType() && IsBlock) {
if (Diagnose) {
S.Diag(Loc, diag::err_ref_vm_type);
- S.Diag(Var->getLocation(), diag::note_previous_decl)
+ S.Diag(Var->getLocation(), diag::note_previous_decl)
<< Var->getDeclName();
}
return false;
@@ -14631,21 +14631,21 @@ static bool isVariableCapturable(Capturi
}
// Returns true if the capture by block was successful.
-static bool captureInBlock(BlockScopeInfo *BSI, VarDecl *Var,
- SourceLocation Loc,
- const bool BuildAndDiagnose,
+static bool captureInBlock(BlockScopeInfo *BSI, VarDecl *Var,
+ SourceLocation Loc,
+ const bool BuildAndDiagnose,
QualType &CaptureType,
- QualType &DeclRefType,
+ QualType &DeclRefType,
const bool Nested,
Sema &S) {
Expr *CopyExpr = nullptr;
bool ByRef = false;
-
+
// Blocks are not allowed to capture arrays.
if (CaptureType->isArrayType()) {
if (BuildAndDiagnose) {
S.Diag(Loc, diag::err_ref_array_type);
- S.Diag(Var->getLocation(), diag::note_previous_decl)
+ S.Diag(Var->getLocation(), diag::note_previous_decl)
<< Var->getDeclName();
}
return false;
@@ -14703,7 +14703,7 @@ static bool captureInBlock(BlockScopeInf
// Block capture by copy introduces 'const'.
CaptureType = CaptureType.getNonReferenceType().withConst();
DeclRefType = CaptureType;
-
+
if (S.getLangOpts().CPlusPlus && BuildAndDiagnose) {
if (const RecordType *Record = DeclRefType->getAs<RecordType>()) {
// The capture logic needs the destructor, so make sure we mark it.
@@ -14723,15 +14723,15 @@ static bool captureInBlock(BlockScopeInf
// the stack requires a const copy constructor. This is not true
// of the copy/move done to move a __block variable to the heap.
Expr *DeclRef = new (S.Context) DeclRefExpr(Var, Nested,
- DeclRefType.withConst(),
+ DeclRefType.withConst(),
VK_LValue, Loc);
-
+
ExprResult Result
= S.PerformCopyInitialization(
InitializedEntity::InitializeBlock(Var->getLocation(),
CaptureType, false),
Loc, DeclRef);
-
+
// Build a full-expression copy expression if initialization
// succeeded and used a non-trivial constructor. Recover from
// errors by pretending that the copy isn't necessary.
@@ -14747,7 +14747,7 @@ static bool captureInBlock(BlockScopeInf
// Actually capture the variable.
if (BuildAndDiagnose)
- BSI->addCapture(Var, HasBlocksAttr, ByRef, Nested, Loc,
+ BSI->addCapture(Var, HasBlocksAttr, ByRef, Nested, Loc,
SourceLocation(), CaptureType, CopyExpr);
return true;
@@ -14757,11 +14757,11 @@ static bool captureInBlock(BlockScopeInf
/// Capture the given variable in the captured region.
static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI,
- VarDecl *Var,
- SourceLocation Loc,
- const bool BuildAndDiagnose,
+ VarDecl *Var,
+ SourceLocation Loc,
+ const bool BuildAndDiagnose,
QualType &CaptureType,
- QualType &DeclRefType,
+ QualType &DeclRefType,
const bool RefersToCapturedVariable,
Sema &S) {
// By default, capture variables by reference.
@@ -14799,7 +14799,7 @@ static bool captureInCapturedRegion(Capt
RD->addDecl(Field);
if (S.getLangOpts().OpenMP && RSI->CapRegionKind == CR_OpenMP)
S.setOpenMPCaptureKind(Field, Var, RSI->OpenMPLevel);
-
+
CopyExpr = new (S.Context) DeclRefExpr(Var, RefersToCapturedVariable,
DeclRefType, VK_LValue, Loc);
Var->setReferenced(true);
@@ -14810,14 +14810,14 @@ static bool captureInCapturedRegion(Capt
if (BuildAndDiagnose)
RSI->addCapture(Var, /*isBlock*/false, ByRef, RefersToCapturedVariable, Loc,
SourceLocation(), CaptureType, CopyExpr);
-
-
+
+
return true;
}
/// Create a field within the lambda class for the variable
/// being captured.
-static void addAsFieldToClosureType(Sema &S, LambdaScopeInfo *LSI,
+static void addAsFieldToClosureType(Sema &S, LambdaScopeInfo *LSI,
QualType FieldType, QualType DeclRefType,
SourceLocation Loc,
bool RefersToCapturedVariable) {
@@ -14835,13 +14835,13 @@ static void addAsFieldToClosureType(Sema
/// Capture the given variable in the lambda.
static bool captureInLambda(LambdaScopeInfo *LSI,
- VarDecl *Var,
- SourceLocation Loc,
- const bool BuildAndDiagnose,
+ VarDecl *Var,
+ SourceLocation Loc,
+ const bool BuildAndDiagnose,
QualType &CaptureType,
- QualType &DeclRefType,
+ QualType &DeclRefType,
const bool RefersToCapturedVariable,
- const Sema::TryCaptureKind Kind,
+ const Sema::TryCaptureKind Kind,
SourceLocation EllipsisLoc,
const bool IsTopScope,
Sema &S) {
@@ -14853,7 +14853,7 @@ static bool captureInLambda(LambdaScopeI
} else {
ByRef = (LSI->ImpCaptureStyle == LambdaScopeInfo::ImpCap_LambdaByref);
}
-
+
// Compute the type of the field that will capture this variable.
if (ByRef) {
// C++11 [expr.prim.lambda]p15:
@@ -14865,7 +14865,7 @@ static bool captureInLambda(LambdaScopeI
//
// FIXME: It is not clear whether we want to build an lvalue reference
// to the DeclRefType or to CaptureType.getNonReferenceType(). GCC appears
- // to do the former, while EDG does the latter. Core issue 1249 will
+ // to do the former, while EDG does the latter. Core issue 1249 will
// clarify, but for now we follow GCC because it's a more permissive and
// easily defensible position.
CaptureType = S.Context.getLValueReferenceType(DeclRefType);
@@ -14913,26 +14913,26 @@ static bool captureInLambda(LambdaScopeI
if (BuildAndDiagnose)
addAsFieldToClosureType(S, LSI, CaptureType, DeclRefType, Loc,
RefersToCapturedVariable);
-
+
// Compute the type of a reference to this captured variable.
if (ByRef)
DeclRefType = CaptureType.getNonReferenceType();
else {
// C++ [expr.prim.lambda]p5:
- // The closure type for a lambda-expression has a public inline
- // function call operator [...]. This function call operator is
- // declared const (9.3.1) if and only if the lambda-expression's
+ // The closure type for a lambda-expression has a public inline
+ // function call operator [...]. This function call operator is
+ // declared const (9.3.1) if and only if the lambda-expression's
// parameter-declaration-clause is not followed by mutable.
DeclRefType = CaptureType.getNonReferenceType();
if (!LSI->Mutable && !CaptureType->isReferenceType())
- DeclRefType.addConst();
+ DeclRefType.addConst();
}
-
+
// Add the capture.
if (BuildAndDiagnose)
- LSI->addCapture(Var, /*IsBlock=*/false, ByRef, RefersToCapturedVariable,
+ LSI->addCapture(Var, /*IsBlock=*/false, ByRef, RefersToCapturedVariable,
Loc, EllipsisLoc, CaptureType, /*CopyExpr=*/nullptr);
-
+
return true;
}
@@ -14945,10 +14945,10 @@ bool Sema::tryCaptureVariable(
DeclContext *VarDC = Var->getDeclContext();
if (Var->isInitCapture())
VarDC = VarDC->getParent();
-
+
DeclContext *DC = CurContext;
- const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt
- ? *FunctionScopeIndexToStopAt : FunctionScopes.size() - 1;
+ const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt
+ ? *FunctionScopeIndexToStopAt : FunctionScopes.size() - 1;
// We need to sync up the Declaration Context with the
// FunctionScopeIndexToStopAt
if (FunctionScopeIndexToStopAt) {
@@ -14959,7 +14959,7 @@ bool Sema::tryCaptureVariable(
}
}
-
+
// If the variable is declared in the current context, there is no need to
// capture it.
if (VarDC == DC) return true;
@@ -14975,7 +14975,7 @@ bool Sema::tryCaptureVariable(
// performing the "simple" checks that don't depend on type. We stop when
// we've either hit the declared scope of the variable or find an existing
// capture of that variable. We start from the innermost capturing-entity
- // (the DC) and ensure that all intervening capturing-entities
+ // (the DC) and ensure that all intervening capturing-entities
// (blocks/lambdas etc.) between the innermost capturer and the variable`s
// declcontext can either capture the variable or have already captured
// the variable.
@@ -14987,8 +14987,8 @@ bool Sema::tryCaptureVariable(
do {
// Only block literals, captured statements, and lambda expressions can
// capture; other scopes don't work.
- DeclContext *ParentDC = getParentOfCapturingContextOrNull(DC, Var,
- ExprLoc,
+ DeclContext *ParentDC = getParentOfCapturingContextOrNull(DC, Var,
+ ExprLoc,
BuildAndDiagnose,
*this);
// We need to check for the parent *first* because, if we *have*
@@ -15007,29 +15007,29 @@ bool Sema::tryCaptureVariable(
// Check whether we've already captured it.
- if (isVariableAlreadyCapturedInScopeInfo(CSI, Var, Nested, CaptureType,
+ if (isVariableAlreadyCapturedInScopeInfo(CSI, Var, Nested, CaptureType,
DeclRefType)) {
CSI->getCapture(Var).markUsed(BuildAndDiagnose);
break;
}
- // If we are instantiating a generic lambda call operator body,
+ // If we are instantiating a generic lambda call operator body,
// we do not want to capture new variables. What was captured
// during either a lambdas transformation or initial parsing
- // should be used.
+ // should be used.
if (isGenericLambdaCallOperatorSpecialization(DC)) {
if (BuildAndDiagnose) {
- LambdaScopeInfo *LSI = cast<LambdaScopeInfo>(CSI);
+ LambdaScopeInfo *LSI = cast<LambdaScopeInfo>(CSI);
if (LSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_None) {
Diag(ExprLoc, diag::err_lambda_impcap) << Var->getDeclName();
- Diag(Var->getLocation(), diag::note_previous_decl)
+ Diag(Var->getLocation(), diag::note_previous_decl)
<< Var->getDeclName();
- Diag(LSI->Lambda->getLocStart(), diag::note_lambda_decl);
+ Diag(LSI->Lambda->getLocStart(), diag::note_lambda_decl);
} else
diagnoseUncapturableValueReference(*this, ExprLoc, Var, DC);
}
return true;
}
- // Certain capturing entities (lambdas, blocks etc.) are not allowed to capture
+ // Certain capturing entities (lambdas, blocks etc.) are not allowed to capture
// certain types of variables (unnamed, variably modified types etc.)
// so check for eligibility.
if (!isVariableCapturable(CSI, Var, ExprLoc, BuildAndDiagnose, *this))
@@ -15070,11 +15070,11 @@ bool Sema::tryCaptureVariable(
}
}
if (CSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_None && !Explicit) {
- // No capture-default, and this is not an explicit capture
- // so cannot capture this variable.
+ // No capture-default, and this is not an explicit capture
+ // so cannot capture this variable.
if (BuildAndDiagnose) {
Diag(ExprLoc, diag::err_lambda_impcap) << Var->getDeclName();
- Diag(Var->getLocation(), diag::note_previous_decl)
+ Diag(Var->getLocation(), diag::note_previous_decl)
<< Var->getDeclName();
if (cast<LambdaScopeInfo>(CSI)->Lambda)
Diag(cast<LambdaScopeInfo>(CSI)->Lambda->getLocStart(),
@@ -15083,12 +15083,12 @@ bool Sema::tryCaptureVariable(
// capture a variable that an inner lambda explicitly captures, we
// should have the inner lambda do the explicit capture - because
// it makes for cleaner diagnostics later. This would purely be done
- // so that the diagnostic does not misleadingly claim that a variable
- // can not be captured by a lambda implicitly even though it is captured
+ // so that the diagnostic does not misleadingly claim that a variable
+ // can not be captured by a lambda implicitly even though it is captured
// explicitly. Suggestion:
- // - create const bool VariableCaptureWasInitiallyExplicit = Explicit
+ // - create const bool VariableCaptureWasInitiallyExplicit = Explicit
// at the function head
- // - cache the StartingDeclContext - this must be a lambda
+ // - cache the StartingDeclContext - this must be a lambda
// - captureInLambda in the innermost lambda the variable.
}
return true;
@@ -15100,31 +15100,31 @@ bool Sema::tryCaptureVariable(
} while (!VarDC->Equals(DC));
// Walk back down the scope stack, (e.g. from outer lambda to inner lambda)
- // computing the type of the capture at each step, checking type-specific
- // requirements, and adding captures if requested.
- // If the variable had already been captured previously, we start capturing
- // at the lambda nested within that one.
- for (unsigned I = ++FunctionScopesIndex, N = MaxFunctionScopesIndex + 1; I != N;
+ // computing the type of the capture at each step, checking type-specific
+ // requirements, and adding captures if requested.
+ // If the variable had already been captured previously, we start capturing
+ // at the lambda nested within that one.
+ for (unsigned I = ++FunctionScopesIndex, N = MaxFunctionScopesIndex + 1; I != N;
++I) {
CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FunctionScopes[I]);
-
+
if (BlockScopeInfo *BSI = dyn_cast<BlockScopeInfo>(CSI)) {
- if (!captureInBlock(BSI, Var, ExprLoc,
- BuildAndDiagnose, CaptureType,
+ if (!captureInBlock(BSI, Var, ExprLoc,
+ BuildAndDiagnose, CaptureType,
DeclRefType, Nested, *this))
return true;
Nested = true;
} else if (CapturedRegionScopeInfo *RSI = dyn_cast<CapturedRegionScopeInfo>(CSI)) {
- if (!captureInCapturedRegion(RSI, Var, ExprLoc,
- BuildAndDiagnose, CaptureType,
+ if (!captureInCapturedRegion(RSI, Var, ExprLoc,
+ BuildAndDiagnose, CaptureType,
DeclRefType, Nested, *this))
return true;
Nested = true;
} else {
LambdaScopeInfo *LSI = cast<LambdaScopeInfo>(CSI);
- if (!captureInLambda(LSI, Var, ExprLoc,
- BuildAndDiagnose, CaptureType,
- DeclRefType, Nested, Kind, EllipsisLoc,
+ if (!captureInLambda(LSI, Var, ExprLoc,
+ BuildAndDiagnose, CaptureType,
+ DeclRefType, Nested, Kind, EllipsisLoc,
/*IsTopScope*/I == N - 1, *this))
return true;
Nested = true;
@@ -15134,7 +15134,7 @@ bool Sema::tryCaptureVariable(
}
bool Sema::tryCaptureVariable(VarDecl *Var, SourceLocation Loc,
- TryCaptureKind Kind, SourceLocation EllipsisLoc) {
+ TryCaptureKind Kind, SourceLocation EllipsisLoc) {
QualType CaptureType;
QualType DeclRefType;
return tryCaptureVariable(Var, Loc, Kind, EllipsisLoc,
@@ -15153,10 +15153,10 @@ bool Sema::NeedToCaptureVariable(VarDecl
QualType Sema::getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc) {
QualType CaptureType;
QualType DeclRefType;
-
+
// Determine whether we can capture this variable.
if (tryCaptureVariable(Var, Loc, TryCapture_Implicit, SourceLocation(),
- /*BuildAndDiagnose=*/false, CaptureType,
+ /*BuildAndDiagnose=*/false, CaptureType,
DeclRefType, nullptr))
return QualType();
@@ -15165,49 +15165,49 @@ QualType Sema::getCapturedDeclRefType(Va
-// If either the type of the variable or the initializer is dependent,
+// If either the type of the variable or the initializer is dependent,
// return false. Otherwise, determine whether the variable is a constant
// expression. Use this if you need to know if a variable that might or
// might not be dependent is truly a constant expression.
-static inline bool IsVariableNonDependentAndAConstantExpression(VarDecl *Var,
+static inline bool IsVariableNonDependentAndAConstantExpression(VarDecl *Var,
ASTContext &Context) {
-
- if (Var->getType()->isDependentType())
+
+ if (Var->getType()->isDependentType())
return false;
const VarDecl *DefVD = nullptr;
Var->getAnyInitializer(DefVD);
- if (!DefVD)
+ if (!DefVD)
return false;
EvaluatedStmt *Eval = DefVD->ensureEvaluatedStmt();
Expr *Init = cast<Expr>(Eval->Value);
- if (Init->isValueDependent())
+ if (Init->isValueDependent())
return false;
- return IsVariableAConstantExpression(Var, Context);
+ return IsVariableAConstantExpression(Var, Context);
}
void Sema::UpdateMarkingForLValueToRValue(Expr *E) {
- // Per C++11 [basic.def.odr], a variable is odr-used "unless it is
+ // Per C++11 [basic.def.odr], a variable is odr-used "unless it is
// an object that satisfies the requirements for appearing in a
// constant expression (5.19) and the lvalue-to-rvalue conversion (4.1)
// is immediately applied." This function handles the lvalue-to-rvalue
// conversion part.
MaybeODRUseExprs.erase(E->IgnoreParens());
-
+
// If we are in a lambda, check if this DeclRefExpr or MemberExpr refers
// to a variable that is a constant expression, and if so, identify it as
- // a reference to a variable that does not involve an odr-use of that
- // variable.
+ // a reference to a variable that does not involve an odr-use of that
+ // variable.
if (LambdaScopeInfo *LSI = getCurLambda()) {
Expr *SansParensExpr = E->IgnoreParens();
VarDecl *Var = nullptr;
- if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(SansParensExpr))
+ if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(SansParensExpr))
Var = dyn_cast<VarDecl>(DRE->getFoundDecl());
else if (MemberExpr *ME = dyn_cast<MemberExpr>(SansParensExpr))
Var = dyn_cast<VarDecl>(ME->getMemberDecl());
-
- if (Var && IsVariableNonDependentAndAConstantExpression(Var, Context))
- LSI->markVariableExprAsNonODRUsed(SansParensExpr);
+
+ if (Var && IsVariableNonDependentAndAConstantExpression(Var, Context))
+ LSI->markVariableExprAsNonODRUsed(SansParensExpr);
}
}
@@ -15508,13 +15508,13 @@ namespace {
class EvaluatedExprMarker : public EvaluatedExprVisitor<EvaluatedExprMarker> {
Sema &S;
bool SkipLocalVariables;
-
+
public:
typedef EvaluatedExprVisitor<EvaluatedExprMarker> Inherited;
-
- EvaluatedExprMarker(Sema &S, bool SkipLocalVariables)
+
+ EvaluatedExprMarker(Sema &S, bool SkipLocalVariables)
: Inherited(S.Context), S(S), SkipLocalVariables(SkipLocalVariables) { }
-
+
void VisitDeclRefExpr(DeclRefExpr *E) {
// If we were asked not to visit local variables, don't.
if (SkipLocalVariables) {
@@ -15522,7 +15522,7 @@ namespace {
if (VD->hasLocalStorage())
return;
}
-
+
S.MarkDeclRefReferenced(E);
}
@@ -15530,13 +15530,13 @@ namespace {
S.MarkMemberReferenced(E);
Inherited::VisitMemberExpr(E);
}
-
+
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
S.MarkFunctionReferenced(E->getLocStart(),
const_cast<CXXDestructorDecl*>(E->getTemporary()->getDestructor()));
Visit(E->getSubExpr());
}
-
+
void VisitCXXNewExpr(CXXNewExpr *E) {
if (E->getOperatorNew())
S.MarkFunctionReferenced(E->getLocStart(), E->getOperatorNew());
@@ -15551,18 +15551,18 @@ namespace {
QualType Destroyed = S.Context.getBaseElementType(E->getDestroyedType());
if (const RecordType *DestroyedRec = Destroyed->getAs<RecordType>()) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
- S.MarkFunctionReferenced(E->getLocStart(),
+ S.MarkFunctionReferenced(E->getLocStart(),
S.LookupDestructor(Record));
}
-
+
Inherited::VisitCXXDeleteExpr(E);
}
-
+
void VisitCXXConstructExpr(CXXConstructExpr *E) {
S.MarkFunctionReferenced(E->getLocStart(), E->getConstructor());
Inherited::VisitCXXConstructExpr(E);
}
-
+
void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
Visit(E->getExpr());
}
@@ -15579,9 +15579,9 @@ namespace {
/// Mark any declarations that appear within this expression or any
/// potentially-evaluated subexpressions as "referenced".
///
-/// \param SkipLocalVariables If true, don't mark local variables as
+/// \param SkipLocalVariables If true, don't mark local variables as
/// 'referenced'.
-void Sema::MarkDeclarationsReferencedInExpr(Expr *E,
+void Sema::MarkDeclarationsReferencedInExpr(Expr *E,
bool SkipLocalVariables) {
EvaluatedExprMarker(*this, SkipLocalVariables).Visit(E);
}
@@ -15661,7 +15661,7 @@ bool Sema::CheckCallReturnType(QualType
class CallReturnIncompleteDiagnoser : public TypeDiagnoser {
FunctionDecl *FD;
CallExpr *CE;
-
+
public:
CallReturnIncompleteDiagnoser(FunctionDecl *FD, CallExpr *CE)
: FD(FD), CE(CE) { }
@@ -15672,14 +15672,14 @@ bool Sema::CheckCallReturnType(QualType
<< T << CE->getSourceRange();
return;
}
-
+
S.Diag(Loc, diag::err_call_function_incomplete_return)
<< CE->getSourceRange() << FD->getDeclName() << T;
S.Diag(FD->getLocation(), diag::note_entity_declared_at)
<< FD->getDeclName();
}
} Diagnoser(FD, CE);
-
+
if (RequireCompleteType(Loc, ReturnType, Diagnoser))
return true;
@@ -15762,7 +15762,7 @@ void Sema::DiagnoseEqualityWithExtraPare
opE->getLHS()->IgnoreParenImpCasts()->isModifiableLvalue(Context)
== Expr::MLV_Valid) {
SourceLocation Loc = opE->getOperatorLoc();
-
+
Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange();
SourceRange ParenERange = ParenE->getSourceRange();
Diag(Loc, diag::note_equality_comparison_silence)
@@ -16099,7 +16099,7 @@ ExprResult RebuildUnknownAnyExpr::VisitC
}
// Rebuild the appropriate pointer-to-function type.
- switch (Kind) {
+ switch (Kind) {
case FK_MemberFunction:
// Nothing to do.
break;
@@ -16148,15 +16148,15 @@ ExprResult RebuildUnknownAnyExpr::VisitI
if (E->getCastKind() == CK_FunctionToPointerDecay) {
assert(E->getValueKind() == VK_RValue);
assert(E->getObjectKind() == OK_Ordinary);
-
+
E->setType(DestType);
-
+
// Rebuild the sub-expression as the pointee (function) type.
DestType = DestType->castAs<PointerType>()->getPointeeType();
-
+
ExprResult Result = Visit(E->getSubExpr());
if (!Result.isUsable()) return ExprError();
-
+
E->setSubExpr(Result.get());
return E;
} else if (E->getCastKind() == CK_LValueToRValue) {
@@ -16218,7 +16218,7 @@ ExprResult RebuildUnknownAnyExpr::resolv
SC_None, false/*isInlineSpecified*/,
FD->hasPrototype(),
false/*isConstexprSpecified*/);
-
+
if (FD->getQualifier())
NewFD->setQualifierInfo(FD->getQualifierLoc());
@@ -16486,7 +16486,7 @@ Sema::ActOnObjCBoolLiteral(SourceLocatio
Sema::LookupOrdinaryName);
if (LookupName(Result, getCurScope()) && Result.isSingleResult()) {
NamedDecl *ND = Result.getFoundDecl();
- if (TypedefDecl *TD = dyn_cast<TypedefDecl>(ND))
+ if (TypedefDecl *TD = dyn_cast<TypedefDecl>(ND))
Context.setBOOLDecl(TD);
}
}
Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=338291&r1=338290&r2=338291&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Mon Jul 30 12:24:48 2018
@@ -120,7 +120,7 @@ static IMAKind ClassifyImplicitMemberAcc
// member reference.
if (Classes.empty())
return IMA_Static;
-
+
// C++11 [expr.prim.general]p12:
// An id-expression that denotes a non-static data member or non-static
// member function of a class can only be used:
@@ -166,7 +166,7 @@ static IMAKind ClassifyImplicitMemberAcc
else
contextClass = cast<CXXRecordDecl>(DC);
- // [class.mfct.non-static]p3:
+ // [class.mfct.non-static]p3:
// ...is used in the body of a non-static member function of class X,
// if name lookup (3.4.1) resolves the name in the id-expression to a
// non-static non-type member of some class C [...]
@@ -417,14 +417,14 @@ CheckExtVectorComponent(Sema &S, QualTyp
QualType VT = S.Context.getExtVectorType(vecType->getElementType(), CompSize);
// Now look up the TypeDefDecl from the vector type. Without this,
// diagostics look bad. We want extended vector types to appear built-in.
- for (Sema::ExtVectorDeclsType::iterator
+ for (Sema::ExtVectorDeclsType::iterator
I = S.ExtVectorDecls.begin(S.getExternalSource()),
- E = S.ExtVectorDecls.end();
+ E = S.ExtVectorDecls.end();
I != E; ++I) {
if ((*I)->getUnderlyingType() == VT)
return S.Context.getTypedefType(*I);
}
-
+
return VT; // should never get here (a typedef type should always be found).
}
@@ -817,10 +817,10 @@ Sema::BuildAnonymousStructUnionMemberRef
// static data members cannot be anonymous structs or unions.
// Supporting this is as easy as building a MemberExpr here.
assert(!baseObjectExpr && "anonymous struct/union is static data member?");
-
+
DeclarationNameInfo baseNameInfo(DeclarationName(), loc);
-
- ExprResult result
+
+ ExprResult result
= BuildDeclarationNameExpr(EmptySS, baseNameInfo, baseVariable);
if (result.isInvalid()) return ExprError();
@@ -855,10 +855,10 @@ Sema::BuildAnonymousStructUnionMemberRef
if (!result)
return ExprError();
}
-
+
// In all cases, we should now skip the first declaration in the chain.
++FI;
-
+
while (FI != FEnd) {
FieldDecl *field = cast<FieldDecl>(*FI++);
@@ -873,7 +873,7 @@ Sema::BuildAnonymousStructUnionMemberRef
fakeFoundDecl, memberNameInfo)
.get();
}
-
+
return result;
}
@@ -965,8 +965,8 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
return ExprError();
BaseExpr = Converted.get();
}
-
-
+
+
const DeclarationNameInfo &MemberNameInfo = R.getLookupNameInfo();
DeclarationName MemberName = MemberNameInfo.getName();
SourceLocation MemberLoc = MemberNameInfo.getLoc();
@@ -1035,7 +1035,7 @@ Sema::BuildMemberReferenceExpr(Expr *Bas
!SuppressQualifierCheck &&
CheckQualifiedMemberReference(BaseExpr, BaseType, SS, R))
return ExprError();
-
+
// Construct an unresolved result if we in fact got an unresolved
// result.
if (R.isOverloadedResult() || R.isUnresolvableResult()) {
@@ -1421,7 +1421,7 @@ static ExprResult LookupMemberExpr(Sema
if (UnaryOperator *UO = dyn_cast<UnaryOperator>(BaseExp))
if (UO->getOpcode() == UO_Deref)
BaseExp = UO->getSubExpr()->IgnoreParenCasts();
-
+
if (DeclRefExpr *DE = dyn_cast<DeclRefExpr>(BaseExp))
if (DE->getType().getObjCLifetime() == Qualifiers::OCL_Weak) {
S.Diag(DE->getLocation(), diag::err_arc_weak_ivar_access);
@@ -1431,7 +1431,7 @@ static ExprResult LookupMemberExpr(Sema
if (warn) {
if (ObjCMethodDecl *MD = S.getCurMethodDecl()) {
ObjCMethodFamily MF = MD->getMethodFamily();
- warn = (MF != OMF_init && MF != OMF_dealloc &&
+ warn = (MF != OMF_init && MF != OMF_dealloc &&
MF != OMF_finalize &&
!S.IvarBacksCurrentMethodAccessor(IDecl, MD, IV));
}
@@ -1732,7 +1732,7 @@ Sema::BuildFieldReferenceExpr(Expr *Base
}
if (VK != VK_RValue && Field->isBitField())
OK = OK_BitField;
-
+
// Figure out the type of the member; see C99 6.5.2.3p3, C++ [expr.ref]
QualType MemberType = Field->getType();
if (const ReferenceType *Ref = MemberType->getAs<ReferenceType>()) {
@@ -1797,7 +1797,7 @@ Sema::BuildImplicitMemberExpr(const CXXS
const TemplateArgumentListInfo *TemplateArgs,
bool IsKnownInstance, const Scope *S) {
assert(!R.empty() && !R.isAmbiguous());
-
+
SourceLocation loc = R.getNameLoc();
// If this is known to be an instance access, go ahead and build an
More information about the cfe-commits
mailing list