Remove trailing return flag from FunctionTypeLoc, since we now carry that

information on FunctionProtoType. (This also fixes one of *many* misalignment
problems in the TypeLoc hierarchy...)

llvm-svn: 161901
This commit is contained in:
Richard Smith
2012-08-14 22:51:13 +00:00
parent 8da8b3a2b0
commit 1226c60593
5 changed files with 1 additions and 15 deletions

View File

@@ -1061,7 +1061,6 @@ public:
struct FunctionLocInfo {
SourceLocation LocalRangeBegin;
SourceLocation LocalRangeEnd;
bool TrailingReturn;
};
/// \brief Wrapper for source info for functions.
@@ -1084,13 +1083,6 @@ public:
getLocalData()->LocalRangeEnd = L;
}
bool getTrailingReturn() const {
return getLocalData()->TrailingReturn;
}
void setTrailingReturn(bool Trailing) {
getLocalData()->TrailingReturn = Trailing;
}
ArrayRef<ParmVarDecl *> getParams() const {
return ArrayRef<ParmVarDecl *>(getParmArray(), getNumArgs());
}
@@ -1119,7 +1111,6 @@ public:
void initializeLocal(ASTContext &Context, SourceLocation Loc) {
setLocalRangeBegin(Loc);
setLocalRangeEnd(Loc);
setTrailingReturn(false);
for (unsigned i = 0, e = getNumArgs(); i != e; ++i)
setArg(i, NULL);
}

View File

@@ -3224,7 +3224,6 @@ namespace {
assert(Chunk.Kind == DeclaratorChunk::Function);
TL.setLocalRangeBegin(Chunk.Loc);
TL.setLocalRangeEnd(Chunk.EndLoc);
TL.setTrailingReturn(Chunk.Fun.hasTrailingReturnType());
const DeclaratorChunk::FunctionTypeInfo &FTI = Chunk.Fun;
for (unsigned i = 0, e = TL.getNumArgs(), tpi = 0; i != e; ++i) {

View File

@@ -4205,7 +4205,7 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
QualType ResultType;
if (TL.getTrailingReturn()) {
if (T->hasTrailingReturn()) {
if (getDerived().TransformFunctionTypeParams(TL.getBeginLoc(),
TL.getParmArray(),
TL.getNumArgs(),
@@ -4262,7 +4262,6 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
FunctionProtoTypeLoc NewTL = TLB.push<FunctionProtoTypeLoc>(Result);
NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
NewTL.setTrailingReturn(TL.getTrailingReturn());
for (unsigned i = 0, e = NewTL.getNumArgs(); i != e; ++i)
NewTL.setArg(i, ParamDecls[i]);
@@ -4286,7 +4285,6 @@ QualType TreeTransform<Derived>::TransformFunctionNoProtoType(
FunctionNoProtoTypeLoc NewTL = TLB.push<FunctionNoProtoTypeLoc>(Result);
NewTL.setLocalRangeBegin(TL.getLocalRangeBegin());
NewTL.setLocalRangeEnd(TL.getLocalRangeEnd());
NewTL.setTrailingReturn(false);
return Result;
}

View File

@@ -4259,7 +4259,6 @@ void TypeLocReader::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
TL.setLocalRangeBegin(ReadSourceLocation(Record, Idx));
TL.setLocalRangeEnd(ReadSourceLocation(Record, Idx));
TL.setTrailingReturn(Record[Idx++]);
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) {
TL.setArg(i, ReadDeclAs<ParmVarDecl>(Record, Idx));
}

View File

@@ -486,7 +486,6 @@ void TypeLocWriter::VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
void TypeLocWriter::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
Writer.AddSourceLocation(TL.getLocalRangeBegin(), Record);
Writer.AddSourceLocation(TL.getLocalRangeEnd(), Record);
Record.push_back(TL.getTrailingReturn());
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i)
Writer.AddDeclRef(TL.getArg(i), Record);
}