]> granicus.if.org Git - clang/commitdiff
Pass source locations of identifiers referenced by @class through Action::ActOnForwar...
authorTed Kremenek <kremenek@apple.com>
Tue, 17 Nov 2009 23:12:20 +0000 (23:12 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 17 Nov 2009 23:12:20 +0000 (23:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89162 91177308-0d34-0410-b5e6-96231b3b80d8

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

index ceeb9c40e5441f1462268268d9885b2269646e13..f656905219212d85be710fda3fb37157894594bf 100644 (file)
@@ -2102,6 +2102,7 @@ public:
   virtual DeclPtrTy ActOnForwardClassDeclaration(
     SourceLocation AtClassLoc,
     IdentifierInfo **IdentList,
+    SourceLocation *IdentLocs,
     unsigned NumElts) {
     return DeclPtrTy();
   }
@@ -2415,6 +2416,7 @@ public:
 
   virtual DeclPtrTy ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                                  IdentifierInfo **IdentList,
+                                                 SourceLocation *SLocs,
                                                  unsigned NumElts);
 
   virtual DeclPtrTy ActOnStartClassInterface(SourceLocation interLoc,
index 25b40c78183c94225320141d9e241336fa2c6d55..deb5498b906ed21ba15bcba1c8a4bad15224fdcd 100644 (file)
@@ -79,10 +79,11 @@ namespace {
     /// 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
index bf05b2baccd4f86ef327791fef0e17ba7cf41d3f..a83966d91e6bb9c92ad44f68958efd2a1814be06 100644 (file)
@@ -213,7 +213,9 @@ MinimalAction::ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
 /// 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]);
index 6ca2314ef4f1d46bf65a36d799e0a140080870db..6a2c2135539d713f1920dbe2eb1c7cd5b6313c45 100644 (file)
@@ -61,6 +61,8 @@ Parser::DeclPtrTy Parser::ParseObjCAtDirectives() {
 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 @@ Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
       return DeclPtrTy();
     }
     ClassNames.push_back(Tok.getIdentifierInfo());
+    ClassLocs.push_back(Tok.getLocation());
     ConsumeToken();
 
     if (Tok.isNot(tok::comma))
@@ -81,8 +84,9 @@ Parser::DeclPtrTy Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
   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());
 }
 
 ///
index ab8e58754ef80eec71135014060886de1665f3c7..637075be715d82b982a3d4c2b942d5659e9352e3 100644 (file)
@@ -3505,8 +3505,9 @@ public:
                                                   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,
index 54b0c3afab0c5c53835a89048aaa3081e7506bc3..8961cf165ac0c67169b5e81c189302c447bdb825 100644 (file)
@@ -1160,6 +1160,7 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl,
 Action::DeclPtrTy
 Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
                                    IdentifierInfo **IdentList,
+                                   SourceLocation *IdentLocs,
                                    unsigned NumElts) {
   llvm::SmallVector<ObjCInterfaceDecl*, 32> Interfaces;