summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/LangStandards.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-04-26 23:44:33 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-04-26 23:44:33 +0000
commitb0fe70451e23a2b5ef19399d286c6a1cdaf5e686 (patch)
treef05534e837c1fad09fe652126e564b092add3fa6 /clang/lib/Frontend/LangStandards.cpp
parent092e32e540c6d024b8bdcf30e81a9177d4cb9e37 (diff)
downloadbcm5719-llvm-b0fe70451e23a2b5ef19399d286c6a1cdaf5e686.tar.gz
bcm5719-llvm-b0fe70451e23a2b5ef19399d286c6a1cdaf5e686.zip
Don't accept -std= values that would switch us to a different source language.
We already prohibited this in most cases (in r130710), but had some bugs in our enforcement of this rule. Specifically, this prevents the following combinations: * -x c -std=clN.M, which would previously effectively act as if -x cl were used, despite the input being a C source file. (-x cl -std=cNN continues to be disallowed.) * -x c++ -std=cuda, which would previously select C++98 + CUDA, despite that not being a C++ standard. (-x cuda -std=c++NN is still permitted, and selects CUDA with the given C++ standard as its base language. -x cuda -std=cuda is still supported with the meaning of CUDA + C++98.) * -x renderscript -std=c++NN, which would previously form a hybrid "C++ with RenderScript extensions" language. We could support such a thing, but shouldn't do so by accident. llvm-svn: 301497
Diffstat (limited to 'clang/lib/Frontend/LangStandards.cpp')
-rw-r--r--clang/lib/Frontend/LangStandards.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Frontend/LangStandards.cpp b/clang/lib/Frontend/LangStandards.cpp
index f133327f429..47023e58fa0 100644
--- a/clang/lib/Frontend/LangStandards.cpp
+++ b/clang/lib/Frontend/LangStandards.cpp
@@ -13,15 +13,15 @@
using namespace clang;
using namespace clang::frontend;
-#define LANGSTANDARD(id, name, desc, features) \
- static const LangStandard Lang_##id = { name, desc, features };
+#define LANGSTANDARD(id, name, lang, desc, features) \
+static const LangStandard Lang_##id = { name, desc, features, InputKind::lang };
#include "clang/Frontend/LangStandards.def"
const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
switch (K) {
case lang_unspecified:
llvm::report_fatal_error("getLangStandardForKind() on unspecified kind");
-#define LANGSTANDARD(id, name, desc, features) \
+#define LANGSTANDARD(id, name, lang, desc, features) \
case lang_##id: return Lang_##id;
#include "clang/Frontend/LangStandards.def"
}
@@ -30,7 +30,7 @@ const LangStandard &LangStandard::getLangStandardForKind(Kind K) {
const LangStandard *LangStandard::getLangStandardForName(StringRef Name) {
Kind K = llvm::StringSwitch<Kind>(Name)
-#define LANGSTANDARD(id, name, desc, features) \
+#define LANGSTANDARD(id, name, lang, desc, features) \
.Case(name, lang_##id)
#include "clang/Frontend/LangStandards.def"
.Default(lang_unspecified);
OpenPOWER on IntegriCloud