[cfe-commits] r39325 - in /cfe/cfe/trunk: AST/SemaDecl.cpp Sema/SemaDecl.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:43:07 PDT 2007


Author: sabre
Date: Wed Jul 11 11:43:07 2007
New Revision: 39325

URL: http://llvm.org/viewvc/llvm-project?rev=39325&view=rev
Log:
When injecting a definition for implicitly defined functions, do so at
translation-unit scope, so we only warn about each implicitly defined
function once.  This cuts the number of errors parsing carbon.h from 616 to 550.

Modified:
    cfe/cfe/trunk/AST/SemaDecl.cpp
    cfe/cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/cfe/trunk/AST/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/SemaDecl.cpp?rev=39325&r1=39324&r2=39325&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/AST/SemaDecl.cpp Wed Jul 11 11:43:07 2007
@@ -337,11 +337,11 @@
   D.AddTypeInfo(DeclaratorChunk::getFunction(false, false, 0, 0, Loc));
   D.SetIdentifier(&II, Loc);
   
-  Decl *Result = static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
+  // Find translation-unit scope to insert this function into.
+  while (S->getParent())
+    S = S->getParent();
   
-  // Visit this implicit declaration like any other top-level form.
-  LastInGroupList.push_back(Result);
-  return Result;
+  return static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
 }
 
 
@@ -458,6 +458,10 @@
   SourceLocation Loc = DeclStart;
   if (II) Loc = D.getIdentifierLoc();
   
+  // FIXME: Unnamed fields can be handled in various different ways, for
+  // example, unnamed unions inject all members into the struct namespace!
+  
+  
   if (BitWidth) {
     // TODO: Validate.
     printf("WARNING: BITFIELDS IGNORED!\n");

Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39325&r1=39324&r2=39325&view=diff

==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:43:07 2007
@@ -337,11 +337,11 @@
   D.AddTypeInfo(DeclaratorChunk::getFunction(false, false, 0, 0, Loc));
   D.SetIdentifier(&II, Loc);
   
-  Decl *Result = static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
+  // Find translation-unit scope to insert this function into.
+  while (S->getParent())
+    S = S->getParent();
   
-  // Visit this implicit declaration like any other top-level form.
-  LastInGroupList.push_back(Result);
-  return Result;
+  return static_cast<Decl*>(ParseDeclarator(S, D, 0, 0));
 }
 
 
@@ -458,6 +458,10 @@
   SourceLocation Loc = DeclStart;
   if (II) Loc = D.getIdentifierLoc();
   
+  // FIXME: Unnamed fields can be handled in various different ways, for
+  // example, unnamed unions inject all members into the struct namespace!
+  
+  
   if (BitWidth) {
     // TODO: Validate.
     printf("WARNING: BITFIELDS IGNORED!\n");





More information about the cfe-commits mailing list