clang-1/CodeGen
Steve Naroff ec0550fa36 Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
  if (const RecordType *RT = getAsStructureType())
    return !strcmp(RT->getDecl()->getName(), "objc_object");
  return false;
}

...which is now...

bool isObjcIdType(QualType T) const {
  return T->getAsStructureType() == IdStructType;
}

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

-    Result = TCE->typesAreCompatible();
+    Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43009 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 20:41:53 +00:00
..
CGBuiltin.cpp Generate code for va_start and va_end. 2007-10-12 23:56:29 +00:00
CGDecl.cpp Rename FileVariable -> FileVar for consistency with its class name, 2007-10-08 21:37:32 +00:00
CGExpr.cpp move IdentifierTable.h from liblex to libbasic. 2007-10-07 08:58:51 +00:00
CGExprAgg.cpp Use LLVMFoldingBuilder 2007-10-09 19:49:58 +00:00
CGExprComplex.cpp Use LLVMFoldingBuilder 2007-10-09 19:49:58 +00:00
CGExprScalar.cpp Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type). 2007-10-15 20:41:53 +00:00
CGObjC.cpp completely refactor codegen of scalar expressions out into its own CGExprScalar.cpp file. 2007-08-24 05:35:26 +00:00
CGStmt.cpp Recognize while(1) and avoid extra blocks. 2007-10-09 20:51:27 +00:00
CodeGenFunction.cpp Generate code for va_start and va_end. 2007-10-12 23:56:29 +00:00
CodeGenFunction.h Use LLVMFoldingBuilder 2007-10-09 19:49:58 +00:00
CodeGenModule.cpp Phase 2 of making the Decl class more lightweight... 2007-09-13 21:41:19 +00:00
CodeGenModule.h Phase 2 of making the Decl class more lightweight... 2007-09-13 21:41:19 +00:00
CodeGenTypes.cpp Added a new class for Interfaces qualified by protocol list. 2007-10-08 23:06:41 +00:00
CodeGenTypes.h Implement code generation for constant CFStrings. 2007-08-21 00:21:21 +00:00
Makefile Stage two of getting CFE top correct. 2007-07-11 17:01:13 +00:00
ModuleBuilder.cpp In "int X,Y;", compile both X and Y. 2007-07-14 00:16:50 +00:00