diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2016-05-12 16:28:25 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2016-05-12 16:28:25 +0000 |
commit | 43ab9a00eb165625e07c1bc92afcfb521e926b1d (patch) | |
tree | 10be147ffb481fa49fbd93e8015e6284805b5117 /clang/lib | |
parent | c28531295daa574b681d485096b0ddfd48eb188e (diff) | |
download | bcm5719-llvm-43ab9a00eb165625e07c1bc92afcfb521e926b1d.tar.gz bcm5719-llvm-43ab9a00eb165625e07c1bc92afcfb521e926b1d.zip |
[OpenCL] Output OpenCL version in diagnostics.
Diagnostics should note version dependent issues by giving
a hint about current version being compiled for.
This patch changes diagnostics of static storage class specifier
and generic type qualifier to specify OpenCL version as well as
converts other diagnostics to match the style.
Patch by Vedran Miletic!
Review: http://reviews.llvm.org/D19780
llvm-svn: 269305
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 1c93c08f718..91445281673 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -28,6 +28,7 @@ #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/ScopedPrinter.h" using namespace clang; @@ -3514,9 +3515,13 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, if (DiagID == diag::ext_duplicate_declspec) Diag(Tok, DiagID) << PrevSpec << FixItHint::CreateRemoval(Tok.getLocation()); - else if (DiagID == diag::err_opencl_unknown_type_specifier) - Diag(Tok, DiagID) << PrevSpec << isStorageClass; - else + else if (DiagID == diag::err_opencl_unknown_type_specifier) { + const int OpenCLVer = getLangOpts().OpenCLVersion; + std::string VerSpec = llvm::to_string(OpenCLVer / 100) + + std::string (".") + + llvm::to_string((OpenCLVer % 100) / 10); + Diag(Tok, DiagID) << VerSpec << PrevSpec << isStorageClass; + } else Diag(Tok, DiagID) << PrevSpec; } |