diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2015-10-04 17:51:05 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2015-10-04 17:51:05 +0000 |
commit | d170c4b57a91adc74ca89c6d4af616a00323b12c (patch) | |
tree | bd60d6ac58deaccfba05e60cae9bd94f6aeff62b /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | f9d71a54391fe07a2f5b308428fa243a228346aa (diff) | |
download | bcm5719-llvm-d170c4b57a91adc74ca89c6d4af616a00323b12c.tar.gz bcm5719-llvm-d170c4b57a91adc74ca89c6d4af616a00323b12c.zip |
Add -f[no-]declspec to control recognition of __declspec as a keyword
In versions of clang prior to r238238, __declspec was recognized as a keyword in
all modes. It was then changed to only be enabled when Microsoft or Borland
extensions were enabled (and for CUDA, as a temporary measure). There is a
desire to support __declspec in Playstation code, and possibly other
environments. This commit adds a command-line switch to allow explicit
enabling/disabling of the recognition of __declspec as a keyword. Recognition
is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and
disabled in all other environments.
Patch by Warren Ristow!
llvm-svn: 249279
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 5f81ce268cf..a1afd80f699 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1630,6 +1630,17 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns); Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm); + // __declspec is enabled by default for the PS4 by the driver, and also + // enabled for Microsoft Extensions or Borland Extensions, here. + // + // FIXME: __declspec is also currently enabled for CUDA, but 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 the Opts.CUDA term here. + Opts.DeclSpecKeyword = + Args.hasFlag(OPT_fdeclspec, OPT_fno_declspec, + (Opts.MicrosoftExt || Opts.Borland || Opts.CUDA)); + if (!Opts.CurrentModule.empty() && !Opts.ImplementationOfModule.empty() && Opts.CurrentModule != Opts.ImplementationOfModule) { Diags.Report(diag::err_conflicting_module_names) |