namespace clang {
+class Decl;
class IdentifierInfo;
/// Token - This structure provides full information about a lexed token.
/// may be dirty (have trigraphs / escaped newlines).
/// Annotations (resolved type names, C++ scopes, etc): isAnnotation().
/// This is a pointer to sema-specific data for the annotation token.
+ /// Eof:
+ // This is a pointer to a Decl.
/// Other:
/// This is null.
void *PtrData;
assert(!isAnnotation() &&
"getIdentifierInfo() on an annotation token!");
if (isLiteral()) return nullptr;
+ if (is(tok::eof)) return nullptr;
return (IdentifierInfo*) PtrData;
}
void setIdentifierInfo(IdentifierInfo *II) {
PtrData = (void*) II;
}
+ const Decl *getDecl() const {
+ assert(is(tok::eof));
+ return reinterpret_cast<const Decl *>(PtrData);
+ }
+ void setDecl(const Decl *D) {
+ assert(is(tok::eof));
+ assert(!PtrData);
+ PtrData = const_cast<Decl *>(D);
+ }
+
/// getRawIdentifier - For a raw identifier token (i.e., an identifier
/// lexed in raw mode), returns a reference to the text substring in the
/// buffer if known.
Eof.startToken();
Eof.setKind(tok::eof);
Eof.setLocation(Tok.getLocation());
+ Eof.setDecl(VarD);
Toks.push_back(Eof);
}
while (Tok.isNot(tok::eof))
ConsumeAnyToken();
}
- ConsumeAnyToken();
+ // Make sure this is *our* artificial EOF token.
+ if (Tok.getDecl() == MI.Field)
+ ConsumeAnyToken();
}
/// ConsumeAndStoreUntil - Consume and store the token at the passed token
--- /dev/null
+// RUN: not %clang_cc1 -fsyntax-only %s
+template <typename T> struct S {
+ int k = ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
+int f;