Skip to content
  1. Oct 29, 2007
  2. Oct 17, 2007
  3. Oct 16, 2007
    • Fariborz Jahanian's avatar
      4bef462a
    • Steve Naroff's avatar
      · f73b784a
      Steve Naroff authored
      Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".
      
      This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.
      
      I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).
      
      llvm-svn: 43021
      f73b784a
  4. Oct 15, 2007
    • Steve Naroff's avatar
      · 32e44c00
      Steve Naroff authored
      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).
      
      llvm-svn: 43009
      32e44c00
    • Steve Naroff's avatar
      · 66e9f331
      Steve Naroff authored
      Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.
      
      Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).
      
      llvm-svn: 42983
      66e9f331
  5. Oct 11, 2007
  6. Oct 10, 2007
    • Steve Naroff's avatar
      · c62adb6d
      Steve Naroff authored
      Make sure methods with no return type default to "id".
      
      This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added).
      
      Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope.
      
      Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped).
      
      llvm-svn: 42817
      c62adb6d
  7. Oct 07, 2007
  8. Oct 01, 2007
    • Steve Naroff's avatar
      · 67391b8a
      Steve Naroff authored
      Move ObjC decls to DeclObjC.h, a new AST header.
      Update clients and add to project file.
      
      llvm-svn: 42494
      67391b8a
  9. Sep 22, 2007
  10. Sep 19, 2007
    • Steve Naroff's avatar
      · 2cd263ff
      Steve Naroff authored
      Remove SelectorTable/SelectorInfo, simply store all selectors in the central IdentifierTable.
      
      Rationale:
      
      We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually).
      
      It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data:
      
      Two tables:
      
      *** Selector/Identifier Stats:
      # Selectors/Identifiers: 51635 
      Bytes allocated:         1999824
      
      One table:
      
      *** Identifier Table Stats:
      # Identifiers:   49500
      Bytes allocated: 1990316
      
      llvm-svn: 42139
      2cd263ff
  11. Sep 17, 2007
    • Steve Naroff's avatar
      · 73d534a2
      Steve Naroff authored
      Add support for ObjC keyword selectors.
      
      - Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable.
      - Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo().
      - Add SelectorInfo slot to ObjcMethodDecl.
      - Add helper function to derive a SelectorInfo from ObjcKeywordInfo.
      
      Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's.
      llvm-svn: 42023
      73d534a2
  12. Sep 16, 2007
  13. Sep 14, 2007
    • Steve Naroff's avatar
      · 1d4b5eae
      Steve Naroff authored
      Now that the dust has settled on the Decl refactoring, I noticed FieldDecl didn't need NextDeclarator.  As a result, I'm removing it. 
      
      Removing both slots (NextDeclarator/Next) end up reducing the size of fields/ivars by 40%.
      
      llvm-svn: 41948
      1d4b5eae
  14. Sep 11, 2007
  15. Sep 06, 2007
    • Steve Naroff's avatar
      · 09bf815f
      Steve Naroff authored
      The goal of this commit is to get just enough Sema support to recognize Objective-C classes
      as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*
      preliminary.
      
      The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.
      
      llvm-svn: 41752
      09bf815f
  16. Aug 30, 2007
    • Steve Naroff's avatar
      Fix a comment. · cadebd08
      Steve Naroff authored
      llvm-svn: 41618
      cadebd08
    • Steve Naroff's avatar
      Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's. · 90dfdd57
      Steve Naroff authored
      Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
      attributes are not specific to VLA's. Most of them are specific to array parameter types.
      
      llvm-svn: 41616
      90dfdd57
    • Steve Naroff's avatar
      · 5c13180a
      Steve Naroff authored
      Fix the following redefinition errors submitted by Keith Bauer...
      
      [dylan:~/llvm/tools/clang] admin% cat tentative_decls.c 
      // incorrectly generates redefinition error
      extern int array[3];
      int array[3];
      
      // incorrectly generates a redefinition error
      extern void nup(int a[3]);
      void nup(int a[3]) {}
      
      It turns out that this exposed a fairly major flaw in the type system,
      array types were never getting uniqued! This is because all array types
      contained an expression, which aren't unique.
      
      To solve this, we now have 2 array types, ConstantArrayType and
      VariableArrayType. ConstantArrayType's are unique, VAT's aren't.
      
      This is a fairly extensive set of fundamental changes. Fortunately,
      all the tests pass. Nevertheless, there may be some collateral damage:-)
      If so, let me know!
      
      llvm-svn: 41592
      5c13180a
  17. Aug 28, 2007
  18. Aug 27, 2007
    • Chris Lattner's avatar
      constify some stuff · 8f63b9d5
      Chris Lattner authored
      llvm-svn: 41503
      8f63b9d5
    • Chris Lattner's avatar
      implement sizeof(enum x), patch inspired by Keith Bauer. · a9e7961a
      Chris Lattner authored
      llvm-svn: 41500
      a9e7961a
    • Steve Naroff's avatar
      Replaced ASTContext::maxFloatingType() with ASTContext::compareFloatingType(). · 7af82d46
      Steve Naroff authored
      Changed Sema::UsualArithmeticConversions to use the new API.
      
      This fixes the following case...
      
      _Complex double X;
      double y;
      
      void foo() {
        X = X + y;
      }
      
      [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -parse-ast-dump
      Read top-level variable decl: 'X'
      Read top-level variable decl: 'y'
      
      void foo()
      (CompoundStmt 0x2605cc0
        (BinaryOperator 0x2605ca0 '_Complex double' '='
          (DeclRefExpr 0x2605c10 '_Complex double' Decl='X' 0x2605ab0)
          (BinaryOperator 0x2605c80 '_Complex double' '+'
            (DeclRefExpr 0x2605c30 '_Complex double' Decl='X' 0x2605ab0)
            (ImplicitCastExpr 0x2605c70 '_Complex double'
              (DeclRefExpr 0x2605c50 'double' Decl='y' 0x2605ae0)))))
      
      llvm-svn: 41483
      7af82d46
    • Steve Naroff's avatar
      · fc6ffa25
      Steve Naroff authored
      Tweak a comment and assert.
      
      llvm-svn: 41475
      fc6ffa25
    • Steve Naroff's avatar
      · 9091ef70
      Steve Naroff authored
      Replaced ASTContext::maxComplexType() with ASTContext::getFloatingTypeOfSizeWithinDomain().
      
      Changed Sema::UsualArithmeticConversions to correctly implement complex/float conversions, 
      using maxFloatingType() with getFloatingTypeOfSizeWithinDomain().
      
      llvm-svn: 41474
      9091ef70
  19. Aug 17, 2007
  20. Aug 01, 2007
    • Steve Naroff's avatar
      · a773cd5d
      Steve Naroff authored
      Add comments to getTypeOfExpr/getTypeOfType.
      Also add instances of TypeOfExpr/TypeOfType to the Types vector (so we can keep track of them).
      
      llvm-svn: 40677
      a773cd5d
    • Steve Naroff's avatar
      · 236becbb
      Steve Naroff authored
      Two typeof() related changes...
      
      - Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
      - Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
      for error diagnostics (since it's more natural to display the expressions type). 
      
      One "random" (or at least delayed:-) change...
      
      - Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
      off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
      emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
      this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
      an issue, we can revisit.
      
      llvm-svn: 40676
      236becbb
  21. Jul 31, 2007
    • Steve Naroff's avatar
      · ad373bdc
      Steve Naroff authored
      Add parsing and AST support for GNU "typeof".
      Many small changes to lot's of files.
      Still some FIXME's, however the basic support is in place.
      
      llvm-svn: 40631
      ad373bdc
  22. Jul 24, 2007
  23. Jul 20, 2007
  24. Jul 18, 2007
    • Chris Lattner's avatar
      implement sizeof/alignof support for structs, unions and complex. · 647fb226
      Chris Lattner authored
      This allows us to compile this:
      
      struct abc { char A; double D; };
      
      int foo() {
        return sizeof(struct abc);
        return __alignof__(struct abc);
      }
      
      Into:
      
              ret i32 16
              ret i32 8
      
      llvm-svn: 40010
      647fb226
    • Steve Naroff's avatar
      · 91fcddb5
      Steve Naroff authored
      First round of extended vector support. Here is an overview...
      
      - added ocu_vector_type attribute, Sema::HandleOCUVectorTypeAttribute(). 
      - added new AST node, OCUVectorType, a subclass of VectorType.
      - added ASTContext::getOCUVectorType.
      - changed ASTContext::convertToVectorType() to ASTContext::getVectorType(). This is 
      unrelated to extended vectors, however I was in the vicinity and it was on my todo list.
      Added a FIXME to Sema::HandleVectorTypeAttribute to deal with converting complex types.
      
      llvm-svn: 40007
      91fcddb5
    • Chris Lattner's avatar
      initial layout support for structures and unions. This isn't actually · 53cfe804
      Chris Lattner authored
      hooked up to anything, so it's not very useful yet.
      
      llvm-svn: 40006
      53cfe804
Loading