[cfe-commits] r71930 - in /cfe/trunk: include/clang/Parse/Action.h lib/Parse/ParseDecl.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp tools/clang-cc/PrintParserCallbacks.cpp
Mike Stump
mrs at apple.com
Sat May 16 00:06:06 PDT 2009
Author: mrs
Date: Sat May 16 02:06:02 2009
New Revision: 71930
URL: http://llvm.org/viewvc/llvm-project?rev=71930&view=rev
Log:
Implement a FIXME, we now pass in the locations of the braces for enums.
Modified:
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/tools/clang-cc/PrintParserCallbacks.cpp
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=71930&r1=71929&r2=71930&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Sat May 16 02:06:02 2009
@@ -408,7 +408,8 @@
SourceLocation EqualLoc, ExprTy *Val) {
return DeclPtrTy();
}
- virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclPtrTy EnumDecl,
+ virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
+ SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
DeclPtrTy *Elements, unsigned NumElements) {}
//===--------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=71930&r1=71929&r2=71930&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat May 16 02:06:02 2009
@@ -1534,10 +1534,10 @@
}
// Eat the }.
- MatchRHSPunctuation(tok::r_brace, LBraceLoc);
+ SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc);
- Actions.ActOnEnumBody(StartLoc, EnumDecl, &EnumConstantDecls[0],
- EnumConstantDecls.size());
+ Actions.ActOnEnumBody(StartLoc, LBraceLoc, RBraceLoc, EnumDecl,
+ &EnumConstantDecls[0], EnumConstantDecls.size());
Action::AttrTy *AttrList = 0;
// If attributes exist after the identifier list, parse them.
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=71930&r1=71929&r2=71930&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat May 16 02:06:02 2009
@@ -489,7 +489,8 @@
DeclPtrTy LastEnumConstant,
SourceLocation IdLoc, IdentifierInfo *Id,
SourceLocation EqualLoc, ExprTy *Val);
- virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclPtrTy EnumDecl,
+ virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
+ SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
DeclPtrTy *Elements, unsigned NumElements);
DeclContext *getContainingDC(DeclContext *DC);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=71930&r1=71929&r2=71930&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat May 16 02:06:02 2009
@@ -4215,9 +4215,8 @@
return DeclPtrTy::make(New);
}
-// FIXME: For consistency with ActOnFields(), we should have the parser
-// pass in the source location for the left/right braces.
-void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclPtrTy EnumDeclX,
+void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
+ SourceLocation RBraceLoc, DeclPtrTy EnumDeclX,
DeclPtrTy *Elements, unsigned NumElements) {
EnumDecl *Enum = cast<EnumDecl>(EnumDeclX.getAs<Decl>());
QualType EnumType = Context.getTypeDeclType(Enum);
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=71930&r1=71929&r2=71930&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Sat May 16 02:06:02 2009
@@ -245,7 +245,9 @@
}
}
- SemaRef.ActOnEnumBody(Enum->getLocation(), Sema::DeclPtrTy::make(Enum),
+ // FIXME: Fixup LBraceLoc and RBraceLoc
+ SemaRef.ActOnEnumBody(Enum->getLocation(), SourceLocation(), SourceLocation(),
+ Sema::DeclPtrTy::make(Enum),
&Enumerators[0], Enumerators.size());
return Enum;
Modified: cfe/trunk/tools/clang-cc/PrintParserCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/PrintParserCallbacks.cpp?rev=71930&r1=71929&r2=71930&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/PrintParserCallbacks.cpp (original)
+++ cfe/trunk/tools/clang-cc/PrintParserCallbacks.cpp Sat May 16 02:06:02 2009
@@ -181,9 +181,9 @@
return DeclPtrTy();
}
- //===--------------------------------------------------------------------===//
+ //===------------------------------------------------------------------===//
// Type Parsing Callbacks.
- //===--------------------------------------------------------------------===//
+ //===------------------------------------------------------------------===//
virtual TypeResult ActOnTypeName(Scope *S, Declarator &D) {
llvm::cout << __FUNCTION__ << "\n";
@@ -237,14 +237,15 @@
return DeclPtrTy();
}
- virtual void ActOnEnumBody(SourceLocation EnumLoc, DeclPtrTy EnumDecl,
+ virtual void ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
+ SourceLocation RBraceLoc, DeclPtrTy EnumDecl,
DeclPtrTy *Elements, unsigned NumElements) {
llvm::cout << __FUNCTION__ << "\n";
}
- //===--------------------------------------------------------------------===//
+ //===------------------------------------------------------------------===//
// Statement Parsing Callbacks.
- //===--------------------------------------------------------------------===//
+ //===------------------------------------------------------------------===//
virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
llvm::cout << __FUNCTION__ << "\n";
@@ -368,7 +369,7 @@
return StmtEmpty();
}
virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
- bool IsSimple,
+ bool IsSimple,
bool IsVolatile,
unsigned NumOutputs,
unsigned NumInputs,
@@ -438,9 +439,9 @@
return StmtEmpty();
}
- //===--------------------------------------------------------------------===//
+ //===------------------------------------------------------------------===//
// Expression Parsing Callbacks.
- //===--------------------------------------------------------------------===//
+ //===------------------------------------------------------------------===//
// Primary Expressions.
More information about the cfe-commits
mailing list