[cfe-commits] r39231 - in /cfe/cfe/trunk: AST/Sema.h AST/SemaType.cpp Parse/ParseDecl.cpp Sema/Sema.h Sema/SemaType.cpp include/clang/Parse/Action.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:41:37 PDT 2007


Author: sabre
Date: Wed Jul 11 11:41:37 2007
New Revision: 39231

URL: http://llvm.org/viewvc/llvm-project?rev=39231&view=rev
Log:
implement ParseParamDeclaratorType in the ast builder

Modified:
    cfe/cfe/trunk/AST/Sema.h
    cfe/cfe/trunk/AST/SemaType.cpp
    cfe/cfe/trunk/Parse/ParseDecl.cpp
    cfe/cfe/trunk/Sema/Sema.h
    cfe/cfe/trunk/Sema/SemaType.cpp
    cfe/cfe/trunk/include/clang/Parse/Action.h

Modified: cfe/cfe/trunk/AST/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Sema.h?rev=39231&r1=39230&r2=39231&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Sema.h (original)
+++ cfe/cfe/trunk/AST/Sema.h Wed Jul 11 11:41:37 2007
@@ -58,6 +58,8 @@
   
   virtual TypeResult ParseTypeName(Scope *S, Declarator &D);
   
+  virtual TypeResult ParseParamDeclaratorType(Scope *S, Declarator &D);
+  
   //===--------------------------------------------------------------------===//
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
   //

Modified: cfe/cfe/trunk/AST/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaType.cpp?rev=39231&r1=39230&r2=39231&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaType.cpp (original)
+++ cfe/cfe/trunk/AST/SemaType.cpp Wed Jul 11 11:41:37 2007
@@ -146,3 +146,15 @@
   
   return T.getAsOpaquePtr();
 }
+
+Sema::TypeResult Sema::ParseParamDeclaratorType(Scope *S, Declarator &D) {
+  // Note: parameters have identifiers, but we don't care about them here, we
+  // just want the type converted.
+  TypeRef T = GetTypeForDeclarator(D, S);
+  
+  // If the type of the declarator was invalid, this is an invalid typename.
+  if (T.isNull())
+    return true;
+  
+  return T.getAsOpaquePtr();
+}

Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=39231&r1=39230&r2=39231&view=diff

==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:41:37 2007
@@ -1022,7 +1022,8 @@
       
       // Inform the actions module about the parameter declarator, so it gets
       // added to the current scope.
-      Action::TypeResult ParamTy = Actions.ParseParamDeclaratorType(ParmDecl);
+      Action::TypeResult ParamTy =
+        Actions.ParseParamDeclaratorType(CurScope, ParmDecl);
         
       // Remember this parsed parameter in ParamInfo.
       ParamInfo.push_back(DeclaratorChunk::ParamInfo(ParmDecl.getIdentifier(),

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

==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:41:37 2007
@@ -58,6 +58,8 @@
   
   virtual TypeResult ParseTypeName(Scope *S, Declarator &D);
   
+  virtual TypeResult ParseParamDeclaratorType(Scope *S, Declarator &D);
+  
   //===--------------------------------------------------------------------===//
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
   //

Modified: cfe/cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaType.cpp?rev=39231&r1=39230&r2=39231&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaType.cpp Wed Jul 11 11:41:37 2007
@@ -146,3 +146,15 @@
   
   return T.getAsOpaquePtr();
 }
+
+Sema::TypeResult Sema::ParseParamDeclaratorType(Scope *S, Declarator &D) {
+  // Note: parameters have identifiers, but we don't care about them here, we
+  // just want the type converted.
+  TypeRef T = GetTypeForDeclarator(D, S);
+  
+  // If the type of the declarator was invalid, this is an invalid typename.
+  if (T.isNull())
+    return true;
+  
+  return T.getAsOpaquePtr();
+}

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

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:41:37 2007
@@ -136,7 +136,7 @@
     return 0;
   }
   
-  virtual TypeResult ParseParamDeclaratorType(Declarator &D) {
+  virtual TypeResult ParseParamDeclaratorType(Scope *S, Declarator &D) {
     return 0;
   }
   





More information about the cfe-commits mailing list