summaryrefslogtreecommitdiffstats
path: root/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaExpr.cpp5
-rw-r--r--lib/Sema/SemaStmt.cpp8
-rw-r--r--lib/Sema/SemaType.cpp27
-rw-r--r--lib/Sema/TreeTransform.h27
4 files changed, 10 insertions, 57 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 3507361412..9564c8f0cb 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4096,7 +4096,6 @@ static void captureVariablyModifiedType(ASTContext &Context, QualType T,
case Type::Attributed:
case Type::SubstTemplateTypeParm:
case Type::PackExpansion:
- case Type::MacroQualified:
// Keep walking after single level desugaring.
T = T.getSingleStepDesugaredType(Context);
break;
@@ -13696,8 +13695,8 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
// Look for an explicit signature in that function type.
FunctionProtoTypeLoc ExplicitSignature;
- if ((ExplicitSignature = Sig->getTypeLoc()
- .getAsAdjusted<FunctionProtoTypeLoc>())) {
+ if ((ExplicitSignature =
+ Sig->getTypeLoc().getAsAdjusted<FunctionProtoTypeLoc>())) {
// Check whether that explicit signature was synthesized by
// GetTypeForDeclarator. If so, don't save that as part of the
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index fe0cf74496..e9faba6e6b 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -3390,10 +3390,10 @@ bool LocalTypedefNameReferencer::VisitRecordType(const RecordType *RT) {
}
TypeLoc Sema::getReturnTypeLoc(FunctionDecl *FD) const {
- return FD->getTypeSourceInfo()
- ->getTypeLoc()
- .getAsAdjusted<FunctionProtoTypeLoc>()
- .getReturnLoc();
+ TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc().IgnoreParens();
+ while (auto ATL = TL.getAs<AttributedTypeLoc>())
+ TL = ATL.getModifiedLoc().IgnoreParens();
+ return TL.castAs<FunctionProtoTypeLoc>().getReturnLoc();
}
/// Deduce the return type for a function from a returned expression, per
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 65cf3f59b3..3b25595a33 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -5643,9 +5643,6 @@ namespace {
assert(Chunk.Kind == DeclaratorChunk::Pipe);
TL.setKWLoc(Chunk.Loc);
}
- void VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
- TL.setExpansionLoc(Chunk.Loc);
- }
void VisitTypeLoc(TypeLoc TL) {
llvm_unreachable("unsupported TypeLoc kind in declarator!");
@@ -5724,9 +5721,6 @@ GetTypeSourceInfoForDeclarator(TypeProcessingState &State,
CurrTL = ATL.getValueLoc().getUnqualifiedLoc();
}
- while (MacroQualifiedTypeLoc TL = CurrTL.getAs<MacroQualifiedTypeLoc>())
- CurrTL = TL.getNextTypeLoc().getUnqualifiedLoc();
-
while (AttributedTypeLoc TL = CurrTL.getAs<AttributedTypeLoc>()) {
fillAttributedTypeLoc(TL, State);
CurrTL = TL.getNextTypeLoc().getUnqualifiedLoc();
@@ -6987,16 +6981,12 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr,
return true;
}
-bool Sema::hasExplicitCallingConv(QualType T) {
- const AttributedType *AT;
-
- // Stop if we'd be stripping off a typedef sugar node to reach the
- // AttributedType.
- while ((AT = T->getAs<AttributedType>()) &&
- AT->getAs<TypedefType>() == T->getAs<TypedefType>()) {
+bool Sema::hasExplicitCallingConv(QualType &T) {
+ QualType R = T.IgnoreParens();
+ while (const AttributedType *AT = dyn_cast<AttributedType>(R)) {
if (AT->isCallingConv())
return true;
- T = AT->getModifiedType();
+ R = AT->getModifiedType().IgnoreParens();
}
return false;
}
@@ -7581,15 +7571,6 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
distributeFunctionTypeAttr(state, attr, type);
break;
}
-
- // Handle attributes that are defined in a macro. We do not want this to be
- // applied to ObjC builtin attributes.
- if (isa<AttributedType>(type) && attr.hasMacroIdentifier() &&
- !type.getQualifiers().hasObjCLifetime() &&
- !type.getQualifiers().hasObjCGCAttr()) {
- const IdentifierInfo *MacroII = attr.getMacroIdentifier();
- type = state.getSema().Context.getMacroQualifiedType(type, MacroII);
- }
}
if (!state.getSema().getLangOpts().OpenCL ||
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index dddb2476c7..a8ea6b01d1 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -883,12 +883,6 @@ public:
return SemaRef.Context.getTypeDeclType(Typedef);
}
- /// Build a new MacroDefined type.
- QualType RebuildMacroQualifiedType(QualType T,
- const IdentifierInfo *MacroII) {
- return SemaRef.Context.getMacroQualifiedType(T, MacroII);
- }
-
/// Build a new class/struct/union type.
QualType RebuildRecordType(RecordDecl *Record) {
return SemaRef.Context.getTypeDeclType(Record);
@@ -6199,27 +6193,6 @@ TreeTransform<Derived>::TransformParenType(TypeLocBuilder &TLB,
return Result;
}
-template <typename Derived>
-QualType
-TreeTransform<Derived>::TransformMacroQualifiedType(TypeLocBuilder &TLB,
- MacroQualifiedTypeLoc TL) {
- QualType Inner = getDerived().TransformType(TLB, TL.getInnerLoc());
- if (Inner.isNull())
- return QualType();
-
- QualType Result = TL.getType();
- if (getDerived().AlwaysRebuild() || Inner != TL.getInnerLoc().getType()) {
- Result =
- getDerived().RebuildMacroQualifiedType(Inner, TL.getMacroIdentifier());
- if (Result.isNull())
- return QualType();
- }
-
- MacroQualifiedTypeLoc NewTL = TLB.push<MacroQualifiedTypeLoc>(Result);
- NewTL.setExpansionLoc(TL.getExpansionLoc());
- return Result;
-}
-
template<typename Derived>
QualType TreeTransform<Derived>::TransformDependentNameType(
TypeLocBuilder &TLB, DependentNameTypeLoc TL) {