diff options
| author | Steve Naroff <snaroff@apple.com> | 2007-07-26 03:11:44 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2007-07-26 03:11:44 +0000 |
| commit | 185616f293afe50cf13a529ca8c01df0e89868d0 (patch) | |
| tree | 927e990c2c528caab76f7933e07be98a0bf53efb /clang/AST/Type.cpp | |
| parent | 6e082ad6179b73f383b5dee7a65e54596c74197e (diff) | |
| download | bcm5719-llvm-185616f293afe50cf13a529ca8c01df0e89868d0.tar.gz bcm5719-llvm-185616f293afe50cf13a529ca8c01df0e89868d0.zip | |
Various improvements to Sema::ParseMemberReferenceExpr().
- Added source range support to Diag's.
- Used the new type predicate API to remove dealing with the canonical
type explicitly.
- Added Type::isRecordType().
- Removed some casts.
- Removed a const qualifier from RecordType::getDecl().
llvm-svn: 40508
Diffstat (limited to 'clang/AST/Type.cpp')
| -rw-r--r-- | clang/AST/Type.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/AST/Type.cpp b/clang/AST/Type.cpp index b09d3afa63a..867a409d833 100644 --- a/clang/AST/Type.cpp +++ b/clang/AST/Type.cpp @@ -96,6 +96,17 @@ const ArrayType *Type::isArrayType() const { return 0; } +const RecordType *Type::isRecordType() const { + // If this is directly a reference type, return it. + if (const RecordType *RTy = dyn_cast<RecordType>(this)) + return RTy; + + // If this is a typedef for an record type, strip the typedef off without + // losing all typedef information. + if (isa<RecordType>(CanonicalType)) + return cast<RecordType>(cast<TypedefType>(this)->LookThroughTypedefs()); +} + bool Type::isStructureType() const { if (const TagType *TT = dyn_cast<TagType>(CanonicalType)) { if (TT->getDecl()->getKind() == Decl::Struct) |

