Permalink
Browse files

Propagating prior merge from 'llvm.org/master'.

  • Loading branch information...
Automerger Automerger
Automerger authored and Automerger committed Oct 28, 2016
2 parents 09d77bb + 48a2e9c commit f42c1bed0bbc7774e5bfaefc50cb39f347115ed1
View
@@ -1632,6 +1632,11 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
/// skipped.
unsigned HasSkippedBody : 1;
/// Indicates if the function declaration will have a body, once we're done
/// parsing it. (We don't set it to false when we're done parsing, in the
/// hopes this is simpler.)
unsigned WillHaveBody : 1;
/// \brief End part of this FunctionDecl's source range.
///
/// We could compute the full range in getSourceRange(). However, when we're
@@ -1701,25 +1706,21 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
protected:
FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
const DeclarationNameInfo &NameInfo,
QualType T, TypeSourceInfo *TInfo,
StorageClass S, bool isInlineSpecified,
const DeclarationNameInfo &NameInfo, QualType T,
TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified,
bool isConstexprSpecified)
: DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
StartLoc),
DeclContext(DK),
redeclarable_base(C),
ParamInfo(nullptr), Body(),
SClass(S),
IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
IsDefaulted(false), IsExplicitlyDefaulted(false),
HasImplicitReturnZero(false), IsLateTemplateParsed(false),
IsConstexpr(isConstexprSpecified), UsesSEHTry(false),
HasSkippedBody(false), EndRangeLoc(NameInfo.getEndLoc()),
TemplateOrSpecialization(),
DNLoc(NameInfo.getInfo()) {}
: DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
StartLoc),
DeclContext(DK), redeclarable_base(C), ParamInfo(nullptr), Body(),
SClass(S), IsInline(isInlineSpecified),
IsInlineSpecified(isInlineSpecified), IsVirtualAsWritten(false),
IsPure(false), HasInheritedPrototype(false), HasWrittenPrototype(true),
IsDeleted(false), IsTrivial(false), IsDefaulted(false),
IsExplicitlyDefaulted(false), HasImplicitReturnZero(false),
IsLateTemplateParsed(false), IsConstexpr(isConstexprSpecified),
UsesSEHTry(false), HasSkippedBody(false), WillHaveBody(false),
EndRangeLoc(NameInfo.getEndLoc()), TemplateOrSpecialization(),
DNLoc(NameInfo.getInfo()) {}
typedef Redeclarable<FunctionDecl> redeclarable_base;
FunctionDecl *getNextRedeclarationImpl() override {
@@ -2001,6 +2002,10 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
bool hasSkippedBody() const { return HasSkippedBody; }
void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped; }
/// True if this function will eventually have a body, once it's fully parsed.
bool willHaveBody() const { return WillHaveBody; }
void setWillHaveBody(bool V = true) { WillHaveBody = V; }
void setPreviousDeclaration(FunctionDecl * PrevDecl);
FunctionDecl *getCanonicalDecl() override;
@@ -2957,11 +2957,10 @@ class ConstructorUsingShadowDecl final : public UsingShadowDecl {
dyn_cast<ConstructorUsingShadowDecl>(Target)),
ConstructedBaseClassShadowDecl(NominatedBaseClassShadowDecl),
IsVirtual(TargetInVirtualBase) {
// If we found a constructor for a non-virtual base class, but it chains to
// a constructor for a virtual base, we should directly call the virtual
// base constructor instead.
// If we found a constructor that chains to a constructor for a virtual
// base, we should directly call that virtual base constructor instead.
// FIXME: This logic belongs in Sema.
if (!TargetInVirtualBase && NominatedBaseClassShadowDecl &&
if (NominatedBaseClassShadowDecl &&
NominatedBaseClassShadowDecl->constructsVirtualBase()) {
ConstructedBaseClassShadowDecl =
NominatedBaseClassShadowDecl->ConstructedBaseClassShadowDecl;
@@ -272,6 +272,12 @@ BUILTIN(__builtin_altivec_vctzh, "V8UsV8Us", "")
BUILTIN(__builtin_altivec_vctzw, "V4UiV4Ui", "")
BUILTIN(__builtin_altivec_vctzd, "V2ULLiV2ULLi", "")
BUILTIN(__builtin_altivec_vclzlsbb, "SiV16Uc", "")
BUILTIN(__builtin_altivec_vctzlsbb, "SiV16Uc", "")
BUILTIN(__builtin_altivec_vprtybw, "V4UiV4Ui", "")
BUILTIN(__builtin_altivec_vprtybd, "V2ULLiV2ULLi", "")
BUILTIN(__builtin_altivec_vprtybq, "V1ULLLiV1ULLLi", "")
// Vector population count built-ins
BUILTIN(__builtin_altivec_vpopcntb, "V16UcV16Uc", "")
BUILTIN(__builtin_altivec_vpopcnth, "V8UsV8Us", "")
@@ -8156,8 +8156,6 @@ def err_atomic_init_constant : Error<
" in the declaration statement in the program scope">;
def err_opencl_implicit_vector_conversion : Error<
"implicit conversions between vector types (%0 and %1) are not permitted">;
def err_opencl_block_proto_variadic : Error<
"invalid block prototype, variadic arguments are not allowed in OpenCL">;
def err_opencl_invalid_type_array : Error<
"array of %0 type is invalid in OpenCL">;
def err_opencl_ternary_with_block : Error<
@@ -8169,6 +8167,8 @@ def err_opencl_type_can_only_be_used_as_function_parameter : Error <
def warn_opencl_attr_deprecated_ignored : Warning <
"%0 attribute is deprecated and ignored in OpenCL version %1">,
InGroup<IgnoredAttributes>;
def err_opencl_variadic_function : Error<
"invalid prototype, variadic arguments are not allowed in OpenCL">;
// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
def err_opencl_builtin_pipe_first_arg : Error<
@@ -79,4 +79,4 @@ IMAGE_READ_WRITE_TYPE(image3d, OCLImage3d)
#undef GENERIC_IMAGE_TYPE
#undef IMAGE_READ_TYPE
#undef IMAGE_WRITE_TYPE
#undef IMAGE_READ_WRITE_TYPE
#undef IMAGE_READ_WRITE_TYPE
@@ -113,9 +113,9 @@ class AccessedEntity {
/// the complete parsing of the current declaration.
class DelayedDiagnostic {
public:
enum DDKind { Deprecation, Unavailable, Access, ForbiddenType };
enum DDKind : unsigned char { Availability, Access, ForbiddenType };
unsigned char Kind; // actually a DDKind
DDKind Kind;
bool Triggered;
SourceLocation Loc;
@@ -164,17 +164,19 @@ class DelayedDiagnostic {
return *reinterpret_cast<const AccessedEntity*>(AccessData);
}
const NamedDecl *getDeprecationDecl() const {
assert((Kind == Deprecation || Kind == Unavailable) &&
"Not a deprecation diagnostic.");
return DeprecationData.Decl;
const NamedDecl *getAvailabilityDecl() const {
assert(Kind == Availability && "Not an availability diagnostic.");
return AvailabilityData.Decl;
}
StringRef getDeprecationMessage() const {
assert((Kind == Deprecation || Kind == Unavailable) &&
"Not a deprecation diagnostic.");
return StringRef(DeprecationData.Message,
DeprecationData.MessageLen);
StringRef getAvailabilityMessage() const {
assert(Kind == Availability && "Not an availability diagnostic.");
return StringRef(AvailabilityData.Message, AvailabilityData.MessageLen);
}
AvailabilityResult getAvailabilityResult() const {
assert(Kind == Availability && "Not an availability diagnostic.");
return AvailabilityData.AR;
}
/// The diagnostic ID to emit. Used like so:
@@ -195,27 +197,28 @@ class DelayedDiagnostic {
assert(Kind == ForbiddenType && "not a forbidden-type diagnostic");
return QualType::getFromOpaquePtr(ForbiddenTypeData.OperandType);
}
const ObjCInterfaceDecl *getUnknownObjCClass() const {
return DeprecationData.UnknownObjCClass;
return AvailabilityData.UnknownObjCClass;
}
const ObjCPropertyDecl *getObjCProperty() const {
return DeprecationData.ObjCProperty;
return AvailabilityData.ObjCProperty;
}
bool getObjCPropertyAccess() const {
return DeprecationData.ObjCPropertyAccess;
return AvailabilityData.ObjCPropertyAccess;
}
private:
struct DD {
struct AD {
const NamedDecl *Decl;
const ObjCInterfaceDecl *UnknownObjCClass;
const ObjCPropertyDecl *ObjCProperty;
const char *Message;
size_t MessageLen;
AvailabilityResult AR;
bool ObjCPropertyAccess;
};
@@ -226,8 +229,7 @@ class DelayedDiagnostic {
};
union {
/// Deprecation
struct DD DeprecationData;
struct AD AvailabilityData;
struct FTD ForbiddenTypeData;
/// Access control.
View
@@ -936,6 +936,9 @@ class TemplateDiff {
++(*this);
}
/// Return true if the iterator is non-singular.
bool isValid() const { return TST; }
/// isEnd - Returns true if the iterator is one past the end.
bool isEnd() const {
assert(TST && "InternalIterator is invalid with a null TST.");
@@ -995,21 +998,21 @@ class TemplateDiff {
}
};
bool UseDesugaredIterator;
InternalIterator SugaredIterator;
InternalIterator DesugaredIterator;
public:
TSTiterator(ASTContext &Context, const TemplateSpecializationType *TST)
: UseDesugaredIterator(TST->isSugared() && !TST->isTypeAlias()),
SugaredIterator(TST),
: SugaredIterator(TST),
DesugaredIterator(
GetTemplateSpecializationType(Context, TST->desugar())) {}
(TST->isSugared() && !TST->isTypeAlias())
? GetTemplateSpecializationType(Context, TST->desugar())
: nullptr) {}
/// &operator++ - Increment the iterator to the next template argument.
TSTiterator &operator++() {
++SugaredIterator;
if (UseDesugaredIterator)
if (DesugaredIterator.isValid())
++DesugaredIterator;
return *this;
}
@@ -1032,12 +1035,12 @@ class TemplateDiff {
/// hasDesugaredTA - Returns true if there is another TemplateArgument
/// available.
bool hasDesugaredTA() const {
return UseDesugaredIterator && !DesugaredIterator.isEnd();
return DesugaredIterator.isValid() && !DesugaredIterator.isEnd();
}
/// getDesugaredTA - Returns the desugared TemplateArgument.
reference getDesugaredTA() const {
assert(UseDesugaredIterator &&
assert(DesugaredIterator.isValid() &&
"Desugared TemplateArgument should not be used.");
return *DesugaredIterator;
}
View
@@ -3048,7 +3048,8 @@ const Attr *FunctionDecl::getUnusedResultAttr() const {
/// an externally visible symbol, but "extern inline" will not create an
/// externally visible symbol.
bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
assert(doesThisDeclarationHaveABody() && "Must have the function definition");
assert(doesThisDeclarationHaveABody() ||
willHaveBody() && "Must be a function definition");
assert(isInlined() && "Function must be inline");
ASTContext &Context = getASTContext();
View
@@ -739,7 +739,7 @@ void CXXRecordDecl::addedMember(Decl *D) {
}
if (!Field->hasInClassInitializer() && !Field->isMutable()) {
if (CXXRecordDecl *FieldType = Field->getType()->getAsCXXRecordDecl()) {
if (CXXRecordDecl *FieldType = T->getAsCXXRecordDecl()) {
if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
data().HasUninitializedFields = true;
} else {
Oops, something went wrong.

0 comments on commit f42c1be

Please sign in to comment.