[cfe-commits] r89162 - in /cfe/trunk: include/clang/Parse/Action.h lib/Frontend/PrintParserCallbacks.cpp lib/Parse/MinimalAction.cpp lib/Parse/ParseObjc.cpp lib/Sema/Sema.h lib/Sema/SemaDeclObjC.cpp

Ted Kremenek kremenek at apple.com
Tue Nov 17 15:12:21 PST 2009


Author: kremenek
Date: Tue Nov 17 17:12:20 2009
New Revision: 89162

URL: http://llvm.org/viewvc/llvm-project?rev=89162&view=rev
Log:
Pass source locations of identifiers referenced by @class through Action::ActOnForwardClassDeclaration().

Modified:
    cfe/trunk/include/clang/Parse/Action.h
    cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
    cfe/trunk/lib/Parse/MinimalAction.cpp
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=89162&r1=89161&r2=89162&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Tue Nov 17 17:12:20 2009
@@ -2102,6 +2102,7 @@
   virtual DeclPtrTy ActOnForwardClassDeclaration(
     SourceLocation AtClassLoc,
     IdentifierInfo **IdentList,
+    SourceLocation *IdentLocs,
     unsigned NumElts) {
     return DeclPtrTy();
   }
@@ -2415,6 +2416,7 @@
 
   virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                                  IdentifierInfo **IdentList,
+                                                 SourceLocation *SLocs,
                                                  unsigned NumElts);
 
   virtual DeclPtrTy ActOnStartClassInterface(SourceLocation interLoc,

Modified: cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp?rev=89162&r1=89161&r2=89162&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp Tue Nov 17 17:12:20 2009
@@ -79,10 +79,11 @@
     /// Scope will always be top level file scope.
     Action::DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                                    IdentifierInfo **IdentList,
+                                                   SourceLocation *IdentLocs,
                                                    unsigned NumElts) {
       Out << __FUNCTION__ << "\n";
       return MinimalAction::ActOnForwardClassDeclaration(AtClassLoc, IdentList,
-                                                         NumElts);
+                                                         IdentLocs, NumElts);
     }
 
     // Pure Printing

Modified: cfe/trunk/lib/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/MinimalAction.cpp?rev=89162&r1=89161&r2=89162&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/MinimalAction.cpp (original)
+++ cfe/trunk/lib/Parse/MinimalAction.cpp Tue Nov 17 17:12:20 2009
@@ -213,7 +213,9 @@
 /// Scope will always be top level file scope.
 Action::DeclPtrTy
 MinimalAction::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
-                                IdentifierInfo **IdentList, unsigned NumElts) {
+                                            IdentifierInfo **IdentList,
+                                            SourceLocation *IdentLocs,
+                                            unsigned NumElts) {
   for (unsigned i = 0; i != NumElts; ++i) {
     // Allocate and add the 'TypeNameInfo' "decl".
     getTable(TypeNameInfoTablePtr)->AddEntry(true, IdentList[i]);

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=89162&r1=89161&r2=89162&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Tue Nov 17 17:12:20 2009
@@ -61,6 +61,8 @@
 Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
   ConsumeToken(); // the identifier "class"
   llvm::SmallVector<IdentifierInfo *, 8> ClassNames;
+  llvm::SmallVector<SourceLocation, 8> ClassLocs;
+
 
   while (1) {
     if (Tok.isNot(tok::identifier)) {
@@ -69,6 +71,7 @@
       return DeclPtrTy();
     }
     ClassNames.push_back(Tok.getIdentifierInfo());
+    ClassLocs.push_back(Tok.getLocation());
     ConsumeToken();
 
     if (Tok.isNot(tok::comma))
@@ -81,8 +84,9 @@
   if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@class"))
     return DeclPtrTy();
 
-  return Actions.ActOnForwardClassDeclaration(atLoc,
-                                      &ClassNames[0], ClassNames.size());
+  return Actions.ActOnForwardClassDeclaration(atLoc, ClassNames.data(),
+                                              ClassLocs.data(),
+                                              ClassNames.size());
 }
 
 ///

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=89162&r1=89161&r2=89162&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Tue Nov 17 17:12:20 2009
@@ -3505,8 +3505,9 @@
                                                   SourceLocation CatLoc);
 
   virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation Loc,
-                                               IdentifierInfo **IdentList,
-                                               unsigned NumElts);
+                                                 IdentifierInfo **IdentList,
+                                                 SourceLocation *IdentLocs,
+                                                 unsigned NumElts);
 
   virtual DeclPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
                                             const IdentifierLocPair *IdentList,

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=89162&r1=89161&r2=89162&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Nov 17 17:12:20 2009
@@ -1160,6 +1160,7 @@
 Action::DeclPtrTy
 Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                    IdentifierInfo **IdentList,
+                                   SourceLocation *IdentLocs,
                                    unsigned NumElts) {
   llvm::SmallVector<ObjCInterfaceDecl*, 32> Interfaces;
 





More information about the cfe-commits mailing list