diff options
| author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-13 22:27:55 +0000 |
|---|---|---|
| committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-13 22:27:55 +0000 |
| commit | a44c902d2f6bfedfc28ae9e1dab7a6bbb285e74c (patch) | |
| tree | 7fc80f04a2f3ae9e66144713a51babed4bfd6b37 /clang | |
| parent | 9c00c014ab9f671e5aa830aa17c267fafcad39e8 (diff) | |
| download | bcm5719-llvm-a44c902d2f6bfedfc28ae9e1dab7a6bbb285e74c.tar.gz bcm5719-llvm-a44c902d2f6bfedfc28ae9e1dab7a6bbb285e74c.zip | |
Skip ParenType on function instantiations.
llvm-svn: 121720
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/TypeLoc.h | 2 | ||||
| -rw-r--r-- | clang/lib/AST/TypeLoc.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 |
3 files changed, 13 insertions, 3 deletions
diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h index 1ec0e6cdd1f..6f2e705953d 100644 --- a/clang/include/clang/AST/TypeLoc.h +++ b/clang/include/clang/AST/TypeLoc.h @@ -115,6 +115,8 @@ public: /// \brief Skips past any qualifiers, if this is qualified. UnqualTypeLoc getUnqualifiedLoc() const; // implemented in this header + TypeLoc IgnoreParens() const; + /// \brief Initializes this to state that every location in this /// type is the given location. /// diff --git a/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp index 0ba9fc00876..c987b9bb9b1 100644 --- a/clang/lib/AST/TypeLoc.cpp +++ b/clang/lib/AST/TypeLoc.cpp @@ -229,3 +229,11 @@ TypeSpecifierType BuiltinTypeLoc::getWrittenTypeSpec() const { return TST_unspecified; } + +TypeLoc TypeLoc::IgnoreParens() const { + TypeLoc TL = *this; + while (ParenTypeLoc* PTL = dyn_cast<ParenTypeLoc>(&TL)) + TL = PTL->getInnerLoc(); + return TL; +} + diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index f98efec5ed2..31692fc1f2e 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1908,10 +1908,10 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, if (NewTInfo != OldTInfo) { // Get parameters from the new type info. - TypeLoc OldTL = OldTInfo->getTypeLoc(); + TypeLoc OldTL = OldTInfo->getTypeLoc().IgnoreParens(); if (FunctionProtoTypeLoc *OldProtoLoc = dyn_cast<FunctionProtoTypeLoc>(&OldTL)) { - TypeLoc NewTL = NewTInfo->getTypeLoc(); + TypeLoc NewTL = NewTInfo->getTypeLoc().IgnoreParens(); FunctionProtoTypeLoc *NewProtoLoc = cast<FunctionProtoTypeLoc>(&NewTL); assert(NewProtoLoc && "Missing prototype?"); for (unsigned i = 0, i_end = NewProtoLoc->getNumArgs(); i != i_end; ++i) { @@ -1926,7 +1926,7 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D, // The function type itself was not dependent and therefore no // substitution occurred. However, we still need to instantiate // the function parameters themselves. - TypeLoc OldTL = OldTInfo->getTypeLoc(); + TypeLoc OldTL = OldTInfo->getTypeLoc().IgnoreParens(); if (FunctionProtoTypeLoc *OldProtoLoc = dyn_cast<FunctionProtoTypeLoc>(&OldTL)) { for (unsigned i = 0, i_end = OldProtoLoc->getNumArgs(); i != i_end; ++i) { |

