diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2015-05-26 19:44:52 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2015-05-26 19:44:52 +0000 |
| commit | 674cf26892a724ffff202d3e48ff6b25b3a46a6d (patch) | |
| tree | cff5c26ee68a79ef6b9e83e35aaa7dc06710733a /clang/lib | |
| parent | 74df0df135e17963761e4771755ed091a4f99c96 (diff) | |
| download | bcm5719-llvm-674cf26892a724ffff202d3e48ff6b25b3a46a6d.tar.gz bcm5719-llvm-674cf26892a724ffff202d3e48ff6b25b3a46a6d.zip | |
__declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension.
Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets.
llvm-svn: 238238
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Basic/IdentifierTable.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index 629b236eee4..e830be9603e 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -215,6 +215,12 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { if (LangOpts.ParseUnknownAnytype) AddKeyword("__unknown_anytype", tok::kw___unknown_anytype, KEYALL, LangOpts, *this); + + // FIXME: __declspec isn't really a CUDA extension, however it is required for + // supporting cuda_builtin_vars.h, which uses __declspec(property). Once that + // has been rewritten in terms of something more generic, remove this code. + if (LangOpts.CUDA) + AddKeyword("__declspec", tok::kw___declspec, KEYALL, LangOpts, *this); } /// \brief Checks if the specified token kind represents a keyword in the diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index d0df7d7ed29..bd114d7e34a 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -531,6 +531,9 @@ bool Parser::ParseMicrosoftDeclSpecArgs(IdentifierInfo *AttrName, /// extended-decl-modifier extended-decl-modifier-seq void Parser::ParseMicrosoftDeclSpecs(ParsedAttributes &Attrs, SourceLocation *End) { + assert((getLangOpts().MicrosoftExt || getLangOpts().Borland || + getLangOpts().CUDA) && + "Incorrect language options for parsing __declspec"); assert(Tok.is(tok::kw___declspec) && "Not a declspec!"); while (Tok.is(tok::kw___declspec)) { |

