Skip to content
  1. Aug 30, 2009
    • Anders Carlsson's avatar
      Improve diagnostics for missing members. This renames the... · 896c230a
      Anders Carlsson authored
      Improve diagnostics for missing members. This renames the err_typecheck_no_member to err_typecheck_no_member_deprecated. The idea is that err_typecheck_no_member_deprecated should be phased out and any call sites that reference it should call DiagnoseMissingMember instead.
      
      llvm-svn: 80469
      896c230a
  2. Aug 27, 2009
  3. Aug 26, 2009
    • Douglas Gregor's avatar
      Improve diagnostics and recovery when the nested-name-specifier of a · 053f691d
      Douglas Gregor authored
      qualified name does not actually refer into a class/class
      template/class template partial specialization. 
      
      Improve printing of nested-name-specifiers to eliminate redudant
      qualifiers. Also, make it possible to output a nested-name-specifier
      through a DiagnosticBuilder, although there are relatively few places
      that will use this leeway.
      
      llvm-svn: 80056
      053f691d
  4. Aug 17, 2009
    • David Chisnall's avatar
      Initial patch to support definitions of id and Class from headers in Objective-C code. · 9f57c290
      David Chisnall authored
      This currently breaks test/SemaObjC/id-isa-ref.m and issues some spurious warnings when you attempt to assign a struct objc_class* value to a Class variable.  The test case probably should fail as it's written, because without the definition of Class the compiler should not assume struct objc_class* is a valid receiver type, but it's left broken because it would be nice if we could get that passing too for the special case of isa.
      
      Approved by snaroff.
      
      llvm-svn: 79248
      9f57c290
  5. Aug 10, 2009
  6. Aug 08, 2009
  7. Jul 31, 2009
  8. Jul 30, 2009
  9. Jul 15, 2009
    • Steve Naroff's avatar
      Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say... · 1329fa0e
      Steve Naroff authored
      Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).
      
      This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).
      
      This patch also adds Type::isObjCBuiltinType().
      
      This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.
      
      llvm-svn: 75808
      1329fa0e
  10. Jul 11, 2009
    • Steve Naroff's avatar
      This patch includes a conceptually simple, but very intrusive/pervasive change. · 7cae42b0
      Steve Naroff authored
      The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.
      
      This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.
      
      By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. 
      
      Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.
      
      llvm-svn: 75314
      7cae42b0
  11. Jul 06, 2009
  12. Jul 02, 2009
    • Douglas Gregor's avatar
      Add support for retrieving the Doxygen comment associated with a given · c6d5edd2
      Douglas Gregor authored
      declaration in the AST. 
      
      The new ASTContext::getCommentForDecl function searches for a comment
      that is attached to the given declaration, and returns that comment, 
      which may be composed of several comment blocks.
      
      Comments are always available in an AST. However, to avoid harming
      performance, we don't actually parse the comments. Rather, we keep the
      source ranges of all of the comments within a large, sorted vector,
      then lazily extract comments via a binary search in that vector only
      when needed (which never occurs in a "normal" compile).
      
      Comments are written to a precompiled header/AST file as a blob of
      source ranges. That blob is only lazily loaded when one requests a
      comment for a declaration (this never occurs in a "normal" compile). 
      
      The indexer testbed now supports comment extraction. When the
      -point-at location points to a declaration with a Doxygen-style
      comment, the indexer testbed prints the associated comment
      block(s). See test/Index/comments.c for an example.
      
      Some notes:
        - We don't actually attempt to parse the comment blocks themselves,
        beyond identifying them as Doxygen comment blocks to associate them
        with a declaration.
        - We won't find comment blocks that aren't adjacent to the
        declaration, because we start our search based on the location of
        the declaration.
        - We don't go through the necessary hops to find, for example,
        whether some redeclaration of a declaration has comments when our
        current declaration does not. Similarly, we don't attempt to
        associate a \param Foo marker in a function body comment with the
        parameter named Foo (although that is certainly possible).
        - Verification of my "no performance impact" claims is still "to be
        done".
      
      llvm-svn: 74704
      c6d5edd2
  13. Jun 23, 2009
  14. Jun 22, 2009
    • Douglas Gregor's avatar
      Rework the way we track which declarations are "used" during · 0b6a6242
      Douglas Gregor authored
      compilation, and (hopefully) introduce RAII objects for changing the
      "potentially evaluated" state at all of the necessary places within
      Sema and Parser. Other changes:
      
        - Set the unevaluated/potentially-evaluated context appropriately
          during template instantiation.
        - We now recognize three different states while parsing or
          instantiating expressions: unevaluated, potentially evaluated, and
          potentially potentially evaluated (for C++'s typeid).
        - When we're in a potentially potentially-evaluated context, queue
          up MarkDeclarationReferenced calls in a stack. For C++ typeid
          expressions that are potentially evaluated, we will play back
          these MarkDeclarationReferenced calls when we exit the
          corresponding potentially potentially-evaluated context.
        - Non-type template arguments are now parsed as constant
          expressions, so they are not potentially-evaluated.
      
      llvm-svn: 73899
      0b6a6242
  15. Jun 20, 2009
  16. Jun 18, 2009
    • Steve Naroff's avatar
      First step toward fixing <rdar://problem/6613046> refactor clang objc type representation. · fb4330f2
      Steve Naroff authored
      Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).
      
      This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). 
      
      No functionality change.
      
      llvm-svn: 73649
      fb4330f2
  17. Jun 16, 2009
  18. Jun 14, 2009
    • Douglas Gregor's avatar
      Introduce a SFINAE "trap" that keeps track of the number of errors · e141633f
      Douglas Gregor authored
      that were suppressed due to SFINAE. By checking whether any errors
      occur at the end of template argument deduction, we avoid the
      possibility of suppressing an error (due to SFINAE) and then
      recovering so well that template argument deduction never detects that
      there was a problem. Thanks to Eli for the push in this direction.
      
      llvm-svn: 73336
      e141633f
    • Douglas Gregor's avatar
      Update LLVM. · 33834516
      Douglas Gregor authored
      Implement support for C++ Substitution Failure Is Not An Error
      (SFINAE), which says that errors that occur during template argument
      deduction do *not* produce diagnostics and do not necessarily make a
      program ill-formed. Instead, template argument deduction silently
      fails. This is currently implemented for template argument deduction
      during matching of class template partial specializations, although
      the mechanism will also apply to template argument deduction for
      function templates. The scheme is simple:
      
        - If we are in a template argument deduction context, any diagnostic
          that is considered a SFINAE error (or warning) will be
          suppressed. The error will be propagated up the call stack via the
          normal means.
        - By default, all warnings and errors are SFINAE errors. Add the
          NoSFINAE class to a diagnostic in the .td file to make it a hard
          error (e.g., for access-control violations).
      
      Note that, to make this fully work, every place in Sema that emits an
      error *and then immediately recovers* will need to check
      Sema::isSFINAEContext() to determine whether it must immediately
      return an error rather than recovering.
      
      llvm-svn: 73332
      33834516
  19. Jun 03, 2009
  20. May 29, 2009
  21. May 14, 2009
  22. Apr 30, 2009
  23. Apr 24, 2009
  24. Apr 22, 2009
    • Douglas Gregor's avatar
      Eliminate Sema::KnownFunctionIDs, so that Sema doesn't end up pulling · fedd428d
      Douglas Gregor authored
      in a bunch of declarations from the PCH file. We're down to loading
      very few declarations in Carbon-prefixed "Hello, World!":
      
      *** PCH Statistics:
        6/20693 types read (0.028995%)
        7/59230 declarations read (0.011818%)
        50/44914 identifiers read (0.111324%)
        0/32954 statements read (0.000000%)
        5/6187 macros read (0.080815%)
      
      llvm-svn: 69825
      fedd428d
  25. Apr 21, 2009
    • Douglas Gregor's avatar
      Explictly track tentative definitions within Sema, then hand those · beecd58e
      Douglas Gregor authored
      tentative definitions off to the ASTConsumer at the end of the
      translation unit. 
      
      Eliminate CodeGen's internal tracking of tentative definitions, and
      instead hook into ASTConsumer::CompleteTentativeDefinition. Also,
      tweak the definition-deferal logic for C++, where there are no
      tentative definitions.
      
      Fixes <rdar://problem/6808352>, and will make it much easier for
      precompiled headers to cope with tentative definitions in the future.
      
      llvm-svn: 69681
      beecd58e
  26. Apr 15, 2009
  27. Apr 14, 2009
  28. Apr 01, 2009
    • Douglas Gregor's avatar
      Give Type::getDesugaredType a "for-display" mode that can apply more · 2e0757f3
      Douglas Gregor authored
      heuristics to determine when it's useful to desugar a type for display
      to the user. Introduce two C++-specific heuristics:
      
        - For a qualified type (like "foo::bar"), only produce a new
          desugred type if desugaring the qualified type ("bar", in this
          case) produces something interesting. For example, if "foo::bar"
          refers to a class named "bar", don't desugar. However, if
          "foo::bar" refers to a typedef of something else, desugar to that
          something else. This gives some useful desugaring such as
          "foo::bar (aka 'int')".
        - Don't desugar class template specialization types like
          "basic_string<char>" down to their underlying "class
          basic_string<char, char_traits<char>, allocator<char>>, etc.";
          it's better just to leave such types alone. 
      
      Update diagnostics.html with some discussion and examples of type
      preservation in C++, showing qualified names and class template
      specialization types.
      
      llvm-svn: 68207
      2e0757f3
  29. Mar 28, 2009
    • Chris Lattner's avatar
      Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a · 83f095cc
      Chris Lattner authored
      pointer.  Its purpose in life is to be a glorified void*, but which does not
      implicitly convert to void* or other OpaquePtr's with a different UID.
      
      Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
      entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
      makes the C++ compiler enforce that these aren't convertible to other opaque
      types.
      
      We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
      but I don't plan to do that in the short term.
      
      The one outstanding known problem with this patch is that we lose the 
      bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
      bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
      this with a subsequent patch.
      
      llvm-svn: 67952
      83f095cc
  30. Mar 20, 2009
  31. Mar 13, 2009
  32. Mar 11, 2009
  33. Feb 28, 2009
    • Steve Naroff's avatar
      Fix <rdar://problem/6451399> problems with labels and blocks. · d123bd05
      Steve Naroff authored
      - Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with.
      - Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr().
      - Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope.
      - Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions).  
      
      llvm-svn: 65694
      d123bd05
  34. Feb 20, 2009
    • Chris Lattner's avatar
      replace a dirty hack with a clean solution. Too bad we can't · cf868c45
      Chris Lattner authored
      use Blocks for our callbacks ;-)
      
      llvm-svn: 65083
      cf868c45
    • Chris Lattner's avatar
      Fix a long standard problem with clang retaining "too much" sugar · 810d330c
      Chris Lattner authored
      information about types.  We often print diagnostics where we say 
      "foo_t" is bad, but the user doesn't know how foo_t is declared 
      (because it is a typedef).  Fix this by expanding sugar when present
      in a diagnostic (and not one of a few special cases, like vectors).
      
      Before:
      t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)')
       MAX(P, F);
       ^~~~~~~~~
      t.m:1:78: note: instantiated from:
      #define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                                   ^
      
      After:
      t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
       MAX(P, F);
       ^~~~~~~~~
      t.m:1:78: note: instantiated from:
      #define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                                   ^
      
      llvm-svn: 65081
      810d330c
Loading