aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex/Token.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Lex/Token.h')
-rw-r--r--include/clang/Lex/Token.h51
1 files changed, 45 insertions, 6 deletions
diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h
index 73e087ecb6..5bbb63add9 100644
--- a/include/clang/Lex/Token.h
+++ b/include/clang/Lex/Token.h
@@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_TOKEN_H
#define LLVM_CLANG_TOKEN_H
+#include "clang/Basic/TemplateKinds.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Basic/SourceLocation.h"
@@ -247,24 +248,62 @@ struct PPConditionalInfo {
/// TemplateIdAnnotation - Information about a template-id annotation
/// token, which contains the template declaration, template
-/// arguments, and the source locations for important tokens.
+/// arguments, whether those template arguments were types or
+/// expressions, and the source locations for important tokens. All of
+/// the information about template arguments is allocated directly
+/// after this structure.
struct TemplateIdAnnotation {
/// TemplateNameLoc - The location of the template name within the
/// source.
SourceLocation TemplateNameLoc;
- /// Template - The declaration of the template corresponding to the
+ /// FIXME: Temporarily stores the name of a specialization
+ IdentifierInfo *Name;
+
+ /// The declaration of the template corresponding to the
/// template-name. This is an Action::DeclTy*.
void *Template;
- /// LAngleLoc - The location of the '<' before the template argument
+ /// The kind of template that Template refers to.
+ TemplateNameKind Kind;
+
+ /// The location of the '<' before the template argument
/// list.
SourceLocation LAngleLoc;
- /// NumArgs - The number of template arguments. The arguments
- /// themselves are Action::TemplateArgTy pointers allocated directly
- /// following the TemplateIdAnnotation structure.
+ /// The location of the '>' after the template argument
+ /// list.
+ SourceLocation RAngleLoc;
+
+ /// NumArgs - The number of template arguments.
unsigned NumArgs;
+
+ /// \brief Retrieves a pointer to the template arguments
+ void **getTemplateArgs() { return (void **)(this + 1); }
+
+ /// \brief Retrieves a pointer to the array of template argument
+ /// locations.
+ SourceLocation *getTemplateArgLocations() {
+ return (SourceLocation *)(getTemplateArgs() + NumArgs);
+ }
+
+ /// \brief Retrieves a pointer to the array of flags that states
+ /// whether the template arguments are types.
+ bool *getTemplateArgIsType() {
+ return (bool *)(getTemplateArgLocations() + NumArgs);
+ }
+
+ static TemplateIdAnnotation* Allocate(unsigned NumArgs) {
+ TemplateIdAnnotation *TemplateId
+ = (TemplateIdAnnotation *)malloc(sizeof(TemplateIdAnnotation) +
+ sizeof(void*) * NumArgs +
+ sizeof(SourceLocation) * NumArgs +
+ sizeof(bool) * NumArgs);
+ TemplateId->NumArgs = NumArgs;
+ return TemplateId;
+ }
+
+ void Destroy() { free(this); }
};
} // end namespace clang