[cfe-commits] r39172 - in /cfe/cfe/trunk: AST/SemaType.cpp Sema/SemaType.cpp include/clang/AST/Type.h
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:40:31 PDT 2007
Author: sabre
Date: Wed Jul 11 11:40:31 2007
New Revision: 39172
URL: http://llvm.org/viewvc/llvm-project?rev=39172&view=rev
Log:
We can now parse and remember the distinction between:
'unsigned char' and 'unsigned char const'.
-Chris
Modified:
cfe/cfe/trunk/AST/SemaType.cpp
cfe/cfe/trunk/Sema/SemaType.cpp
cfe/cfe/trunk/include/clang/AST/Type.h
Modified: cfe/cfe/trunk/AST/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaType.cpp?rev=39172&r1=39171&r2=39172&view=diff
==============================================================================
--- cfe/cfe/trunk/AST/SemaType.cpp (original)
+++ cfe/cfe/trunk/AST/SemaType.cpp Wed Jul 11 11:40:31 2007
@@ -131,7 +131,6 @@
//DeclSpec::TST_union:
//DeclSpec::TST_struct:
//DeclSpec::TST_typedef:
-
}
}
@@ -140,7 +139,8 @@
TypeRef Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
TypeRef T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
- // FIXME: Apply const/volatile/restrict qualifiers to T.
+ // Apply const/volatile/restrict qualifiers to T.
+ T = T.getQualifiedType(D.getDeclSpec().TypeQualifiers);
return T;
return TypeRef();
Modified: cfe/cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaType.cpp?rev=39172&r1=39171&r2=39172&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaType.cpp Wed Jul 11 11:40:31 2007
@@ -131,7 +131,6 @@
//DeclSpec::TST_union:
//DeclSpec::TST_struct:
//DeclSpec::TST_typedef:
-
}
}
@@ -140,7 +139,8 @@
TypeRef Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
TypeRef T = ConvertDeclSpecToType(D.getDeclSpec(), Context);
- // FIXME: Apply const/volatile/restrict qualifiers to T.
+ // Apply const/volatile/restrict qualifiers to T.
+ T = T.getQualifiedType(D.getDeclSpec().TypeQualifiers);
return T;
return TypeRef();
Modified: cfe/cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Type.h?rev=39172&r1=39171&r2=39172&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Type.h Wed Jul 11 11:40:31 2007
@@ -51,12 +51,16 @@
ThePtr |= Quals;
}
+ Type *getTypePtr() const {
+ return reinterpret_cast<Type*>(ThePtr & ~CVRFlags);
+ }
+
Type &operator*() const {
- return *reinterpret_cast<Type*>(ThePtr & ~CVRFlags);
+ return *getTypePtr();
}
Type *operator->() const {
- return reinterpret_cast<Type*>(ThePtr & ~CVRFlags);
+ return getTypePtr();
}
/// isNull - Return true if this TypeRef doesn't point to a type yet.
@@ -77,6 +81,15 @@
return ThePtr & CVRFlags;
}
+ TypeRef getQualifiedType(unsigned TQs) const {
+ return TypeRef(getTypePtr(), TQs);
+ }
+
+ TypeRef getUnqualifiedType() const {
+ return TypeRef(getTypePtr());
+ }
+
+
void dump() const;
};
More information about the cfe-commits
mailing list