diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-01 20:32:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-01 20:32:20 +0000 |
commit | aa49ecc4586af252e2841c2bc8f5689526da7a4b (patch) | |
tree | 3ffbc2a7340b4a1a6537b97ec2762e6a4890a7ff /clang/lib/Parse/Parser.cpp | |
parent | 67056b613dd84239f962dc4ef9266fd098e43d62 (diff) | |
download | bcm5719-llvm-aa49ecc4586af252e2841c2bc8f5689526da7a4b.tar.gz bcm5719-llvm-aa49ecc4586af252e2841c2bc8f5689526da7a4b.zip |
Not content to implement just "extern" explicit template
instantiations, GCC also supports "inline" and "static" explicit
template instantiations. Parse and warn about such constructs, but
don't implement the semantics of either "inline" or "static". They
don't seem to be widely used.
llvm-svn: 120599
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index fefe7871df0..f5e4bfb6498 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -525,12 +525,38 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr, return ParseDeclaration(Stmts, Declarator::FileContext, DeclEnd, Attr); } - case tok::kw_inline: - if (getLang().CPlusPlus && NextToken().is(tok::kw_namespace)) { - // Inline namespaces. Allowed as an extension even in C++03. + case tok::kw_static: + // Parse (then ignore) 'static' prior to a template instantiation. This is + // a GCC extension that we intentionally do not support. + if (getLang().CPlusPlus && NextToken().is(tok::kw_template)) { + Diag(ConsumeToken(), diag::warn_static_inline_explicit_inst_ignored) + << 0; SourceLocation DeclEnd; StmtVector Stmts(Actions); - return ParseDeclaration(Stmts, Declarator::FileContext, DeclEnd, Attr); + return ParseDeclaration(Stmts, Declarator::FileContext, DeclEnd, Attr); + } + goto dont_know; + + case tok::kw_inline: + if (getLang().CPlusPlus) { + tok::TokenKind NextKind = NextToken().getKind(); + + // Inline namespaces. Allowed as an extension even in C++03. + if (NextKind == tok::kw_namespace) { + SourceLocation DeclEnd; + StmtVector Stmts(Actions); + return ParseDeclaration(Stmts, Declarator::FileContext, DeclEnd, Attr); + } + + // Parse (then ignore) 'inline' prior to a template instantiation. This is + // a GCC extension that we intentionally do not support. + if (NextKind == tok::kw_template) { + Diag(ConsumeToken(), diag::warn_static_inline_explicit_inst_ignored) + << 1; + SourceLocation DeclEnd; + StmtVector Stmts(Actions); + return ParseDeclaration(Stmts, Declarator::FileContext, DeclEnd, Attr); + } } goto dont_know; |