diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-10 16:29:40 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-10 16:29:40 +0000 |
commit | 075f8f1b6bed4d1b224c74f87508534cc6392ce6 (patch) | |
tree | c928464ba32f736d3a38292dd23a6ef919ce4d1c /lib/Sema/SemaType.cpp | |
parent | c3c0af36bac3d71f61dd758585ab307892545de4 (diff) |
Added ParenType type node.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 5f86010602..23c159fbc5 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -521,6 +521,11 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc, return Context.getQualifiedType(T, Qs); } +/// \brief Build a paren type including \p T. +QualType Sema::BuildParenType(QualType T) { + return Context.getParenType(T); +} + /// \brief Build a pointer type. /// /// \param T The type to which we'll be building a pointer. @@ -1002,7 +1007,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, // Check for auto functions and trailing return type and adjust the // return type accordingly. if (getLangOptions().CPlusPlus0x && D.isFunctionDeclarator()) { - const DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun; + const DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo(); if (T == Context.UndeducedAutoTy) { if (FTI.TrailingReturnType) { T = GetTypeFromParser(ParsedType::getFromOpaquePtr(FTI.TrailingReturnType), @@ -1082,6 +1087,9 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, DeclaratorChunk &DeclType = D.getTypeObject(e-i-1); switch (DeclType.Kind) { default: assert(0 && "Unknown decltype!"); + case DeclaratorChunk::Paren: + T = BuildParenType(T); + break; case DeclaratorChunk::BlockPointer: // If blocks are disabled, emit an error. if (!LangOpts.Blocks) @@ -1678,6 +1686,11 @@ namespace { } // FIXME: exception specs } + void VisitParenTypeLoc(ParenTypeLoc TL) { + assert(Chunk.Kind == DeclaratorChunk::Paren); + TL.setLParenLoc(Chunk.Loc); + TL.setRParenLoc(Chunk.EndLoc); + } void VisitTypeLoc(TypeLoc TL) { llvm_unreachable("unsupported TypeLoc kind in declarator!"); |