Bug #:
Submitted by:
Reviewed by:
Fix "FIXME: does this lose qualifiers from the typedef??" in ASTContext::getTypedefType().

This change was fairly pervasive...nevertheless, here are the highlights:
- Change the type of Type::CanonicalType to TypeRef (was "Type *").
- Change the implementation of TypeRef::getCanonicalType() to work for typedefs.
- Make the implementation of Type::getCanonicalType private (only TypeRef should access). This
will force clients to use TypeRef::getCanonicalType (the correct version of the function). Since
TypeRef overloads "->", it was very easy to fall into this bug...
- Changed many references of "Type *" to "TypeRef"...when the raw type pointer is required, use t.getTypePtr().
- Changed all the *Type classes to take a TypeRef.
- Made the Type constructor protected (cleanup).
- Removed function Expr::getType().
- Convert functions in SemaExpr to use the above support. This fixed the "const" bug I was originally investigating.

I will follow this check-in up with a rename of TypeRef->QualType. I will also make sure the constructor does not default to 0 (which can lead to broken code...).

llvm-svn: 39394
diff --git a/clang/AST/SemaDecl.cpp b/clang/AST/SemaDecl.cpp
index 4a89f03..eee0a44 100644
--- a/clang/AST/SemaDecl.cpp
+++ b/clang/AST/SemaDecl.cpp
@@ -23,6 +23,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/SmallSet.h"
+
 using namespace llvm;
 using namespace clang;
 
@@ -622,7 +623,7 @@
     if (!FD) continue;  // Already issued a diagnostic.
     
     // Get the type for the field.
-    Type *FDTy = FD->getType()->getCanonicalType();
+    Type *FDTy = FD->getType().getCanonicalType().getTypePtr();
     
     // C99 6.7.2.1p2 - A field may not be a function type.
     if (isa<FunctionType>(FDTy)) {