summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp11
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;
}
OpenPOWER on IntegriCloud