summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/DeclSpec.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-11-10 19:49:08 +0000
committerDouglas Gregor <dgregor@apple.com>2009-11-10 19:49:08 +0000
commitb53edfb8dcbd24ff3fd9e5087356083374bb8f8b (patch)
treec4dcc12fbeac939ec8b8ee82d62f055439c0a171 /clang/lib/Parse/DeclSpec.cpp
parente03486758786a8ecadb852ea291489f22bf64cb9 (diff)
downloadbcm5719-llvm-b53edfb8dcbd24ff3fd9e5087356083374bb8f8b.tar.gz
bcm5719-llvm-b53edfb8dcbd24ff3fd9e5087356083374bb8f8b.zip
Improve parsing of template arguments to lay the foundation for
handling template template parameters properly. This refactoring: - Parses template template arguments as id-expressions, representing the result of the parse as a template name (Action::TemplateTy) rather than as an expression (lame!). - Represents all parsed template arguments via a new parser-specific type, ParsedTemplateArgument, which stores the kind of template argument (type, non-type, template) along with all of the source information about the template argument. This replaces an ad hoc set of 3 vectors (one for a void*, which was either a type or an expression; one for a bit telling whether the first was a type or an expression; and one for a single source location pointing at the template argument). - Moves TemplateIdAnnotation into the new Parse/Template.h. It never belonged in the Basic library anyway. llvm-svn: 86708
Diffstat (limited to 'clang/lib/Parse/DeclSpec.cpp')
-rw-r--r--clang/lib/Parse/DeclSpec.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Parse/DeclSpec.cpp b/clang/lib/Parse/DeclSpec.cpp
index 0a4e036e439..f00f33fcb94 100644
--- a/clang/lib/Parse/DeclSpec.cpp
+++ b/clang/lib/Parse/DeclSpec.cpp
@@ -13,6 +13,7 @@
#include "clang/Parse/DeclSpec.h"
#include "clang/Parse/ParseDiagnostic.h"
+#include "clang/Parse/Template.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/LangOptions.h"
#include "llvm/ADT/STLExtras.h"
@@ -26,6 +27,15 @@ static DiagnosticBuilder Diag(Diagnostic &D, SourceLocation Loc,
return D.Report(FullSourceLoc(Loc, SrcMgr), DiagID);
}
+
+void UnqualifiedId::setTemplateId(TemplateIdAnnotation *TemplateId) {
+ assert(TemplateId && "NULL template-id annotation?");
+ Kind = IK_TemplateId;
+ this->TemplateId = TemplateId;
+ StartLocation = TemplateId->TemplateNameLoc;
+ EndLocation = TemplateId->RAngleLoc;
+}
+
/// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
/// "TheDeclarator" is the declarator that this will be added to.
DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isVariadic,
OpenPOWER on IntegriCloud