summaryrefslogtreecommitdiff
path: root/source/Symbol/ClangASTContext.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-02 18:31:19 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-02 18:31:19 +0000
commit773dd0e6e632d48d7123a321ba86f50847b9afc0 (patch)
treec6bd992bb1963df11f8de346d12a5a70c2e4deb2 /source/Symbol/ClangASTContext.cpp
parent5060b64b7d79491d507a75201be161fd0c38fcbb (diff)
Notes
Diffstat (limited to 'source/Symbol/ClangASTContext.cpp')
-rw-r--r--source/Symbol/ClangASTContext.cpp122
1 files changed, 50 insertions, 72 deletions
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index 6ad353099bc57..8e2576aaec956 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -378,10 +378,9 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
// Set some properties which depend solely on the input kind; it would be nice
// to move these to the language standard, and have the driver resolve the
// input kind + language standard.
- if (IK == IK_Asm) {
+ if (IK.getLanguage() == InputKind::Asm) {
Opts.AsmPreprocessor = 1;
- } else if (IK == IK_ObjC || IK == IK_ObjCXX || IK == IK_PreprocessedObjC ||
- IK == IK_PreprocessedObjCXX) {
+ } else if (IK.isObjectiveC()) {
Opts.ObjC1 = Opts.ObjC2 = 1;
}
@@ -389,30 +388,24 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
if (LangStd == LangStandard::lang_unspecified) {
// Based on the base language, pick one.
- switch (IK) {
- case IK_None:
- case IK_AST:
- case IK_LLVM_IR:
- case IK_RenderScript:
+ switch (IK.getLanguage()) {
+ case InputKind::Unknown:
+ case InputKind::LLVM_IR:
+ case InputKind::RenderScript:
llvm_unreachable("Invalid input kind!");
- case IK_OpenCL:
- LangStd = LangStandard::lang_opencl;
+ case InputKind::OpenCL:
+ LangStd = LangStandard::lang_opencl10;
break;
- case IK_CUDA:
- case IK_PreprocessedCuda:
+ case InputKind::CUDA:
LangStd = LangStandard::lang_cuda;
break;
- case IK_Asm:
- case IK_C:
- case IK_PreprocessedC:
- case IK_ObjC:
- case IK_PreprocessedObjC:
+ case InputKind::Asm:
+ case InputKind::C:
+ case InputKind::ObjC:
LangStd = LangStandard::lang_gnu99;
break;
- case IK_CXX:
- case IK_PreprocessedCXX:
- case IK_ObjCXX:
- case IK_PreprocessedObjCXX:
+ case InputKind::CXX:
+ case InputKind::ObjCXX:
LangStd = LangStandard::lang_gnucxx98;
break;
}
@@ -432,7 +425,7 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
Opts.WChar = true;
// OpenCL has some additional defaults.
- if (LangStd == LangStandard::lang_opencl) {
+ if (LangStd == LangStandard::lang_opencl10) {
Opts.OpenCL = 1;
Opts.AltiVec = 1;
Opts.CXXOperatorNames = 1;
@@ -784,8 +777,8 @@ IdentifierTable *ClangASTContext::getIdentifierTable() {
LangOptions *ClangASTContext::getLanguageOptions() {
if (m_language_options_ap.get() == nullptr) {
m_language_options_ap.reset(new LangOptions());
- ParseLangArgs(*m_language_options_ap, IK_ObjCXX, GetTargetTriple());
- // InitializeLangOptions(*m_language_options_ap, IK_ObjCXX);
+ ParseLangArgs(*m_language_options_ap, InputKind::ObjCXX, GetTargetTriple());
+ // InitializeLangOptions(*m_language_options_ap, InputKind::ObjCXX);
}
return m_language_options_ap.get();
}
@@ -961,75 +954,60 @@ ClangASTContext::GetBasicTypeEnumeration(const ConstString &name) {
static llvm::once_flag g_once_flag;
llvm::call_once(g_once_flag, []() {
// "void"
- g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
+ g_type_map.Append(ConstString("void"), eBasicTypeVoid);
// "char"
- g_type_map.Append(ConstString("char").GetStringRef(), eBasicTypeChar);
- g_type_map.Append(ConstString("signed char").GetStringRef(),
- eBasicTypeSignedChar);
- g_type_map.Append(ConstString("unsigned char").GetStringRef(),
- eBasicTypeUnsignedChar);
- g_type_map.Append(ConstString("wchar_t").GetStringRef(), eBasicTypeWChar);
- g_type_map.Append(ConstString("signed wchar_t").GetStringRef(),
- eBasicTypeSignedWChar);
- g_type_map.Append(ConstString("unsigned wchar_t").GetStringRef(),
+ g_type_map.Append(ConstString("char"), eBasicTypeChar);
+ g_type_map.Append(ConstString("signed char"), eBasicTypeSignedChar);
+ g_type_map.Append(ConstString("unsigned char"), eBasicTypeUnsignedChar);
+ g_type_map.Append(ConstString("wchar_t"), eBasicTypeWChar);
+ g_type_map.Append(ConstString("signed wchar_t"), eBasicTypeSignedWChar);
+ g_type_map.Append(ConstString("unsigned wchar_t"),
eBasicTypeUnsignedWChar);
// "short"
- g_type_map.Append(ConstString("short").GetStringRef(), eBasicTypeShort);
- g_type_map.Append(ConstString("short int").GetStringRef(),
- eBasicTypeShort);
- g_type_map.Append(ConstString("unsigned short").GetStringRef(),
- eBasicTypeUnsignedShort);
- g_type_map.Append(ConstString("unsigned short int").GetStringRef(),
+ g_type_map.Append(ConstString("short"), eBasicTypeShort);
+ g_type_map.Append(ConstString("short int"), eBasicTypeShort);
+ g_type_map.Append(ConstString("unsigned short"), eBasicTypeUnsignedShort);
+ g_type_map.Append(ConstString("unsigned short int"),
eBasicTypeUnsignedShort);
// "int"
- g_type_map.Append(ConstString("int").GetStringRef(), eBasicTypeInt);
- g_type_map.Append(ConstString("signed int").GetStringRef(),
- eBasicTypeInt);
- g_type_map.Append(ConstString("unsigned int").GetStringRef(),
- eBasicTypeUnsignedInt);
- g_type_map.Append(ConstString("unsigned").GetStringRef(),
- eBasicTypeUnsignedInt);
+ g_type_map.Append(ConstString("int"), eBasicTypeInt);
+ g_type_map.Append(ConstString("signed int"), eBasicTypeInt);
+ g_type_map.Append(ConstString("unsigned int"), eBasicTypeUnsignedInt);
+ g_type_map.Append(ConstString("unsigned"), eBasicTypeUnsignedInt);
// "long"
- g_type_map.Append(ConstString("long").GetStringRef(), eBasicTypeLong);
- g_type_map.Append(ConstString("long int").GetStringRef(), eBasicTypeLong);
- g_type_map.Append(ConstString("unsigned long").GetStringRef(),
- eBasicTypeUnsignedLong);
- g_type_map.Append(ConstString("unsigned long int").GetStringRef(),
+ g_type_map.Append(ConstString("long"), eBasicTypeLong);
+ g_type_map.Append(ConstString("long int"), eBasicTypeLong);
+ g_type_map.Append(ConstString("unsigned long"), eBasicTypeUnsignedLong);
+ g_type_map.Append(ConstString("unsigned long int"),
eBasicTypeUnsignedLong);
// "long long"
- g_type_map.Append(ConstString("long long").GetStringRef(),
- eBasicTypeLongLong);
- g_type_map.Append(ConstString("long long int").GetStringRef(),
- eBasicTypeLongLong);
- g_type_map.Append(ConstString("unsigned long long").GetStringRef(),
+ g_type_map.Append(ConstString("long long"), eBasicTypeLongLong);
+ g_type_map.Append(ConstString("long long int"), eBasicTypeLongLong);
+ g_type_map.Append(ConstString("unsigned long long"),
eBasicTypeUnsignedLongLong);
- g_type_map.Append(ConstString("unsigned long long int").GetStringRef(),
+ g_type_map.Append(ConstString("unsigned long long int"),
eBasicTypeUnsignedLongLong);
// "int128"
- g_type_map.Append(ConstString("__int128_t").GetStringRef(),
- eBasicTypeInt128);
- g_type_map.Append(ConstString("__uint128_t").GetStringRef(),
- eBasicTypeUnsignedInt128);
+ g_type_map.Append(ConstString("__int128_t"), eBasicTypeInt128);
+ g_type_map.Append(ConstString("__uint128_t"), eBasicTypeUnsignedInt128);
// Miscellaneous
- g_type_map.Append(ConstString("bool").GetStringRef(), eBasicTypeBool);
- g_type_map.Append(ConstString("float").GetStringRef(), eBasicTypeFloat);
- g_type_map.Append(ConstString("double").GetStringRef(), eBasicTypeDouble);
- g_type_map.Append(ConstString("long double").GetStringRef(),
- eBasicTypeLongDouble);
- g_type_map.Append(ConstString("id").GetStringRef(), eBasicTypeObjCID);
- g_type_map.Append(ConstString("SEL").GetStringRef(), eBasicTypeObjCSel);
- g_type_map.Append(ConstString("nullptr").GetStringRef(),
- eBasicTypeNullPtr);
+ g_type_map.Append(ConstString("bool"), eBasicTypeBool);
+ g_type_map.Append(ConstString("float"), eBasicTypeFloat);
+ g_type_map.Append(ConstString("double"), eBasicTypeDouble);
+ g_type_map.Append(ConstString("long double"), eBasicTypeLongDouble);
+ g_type_map.Append(ConstString("id"), eBasicTypeObjCID);
+ g_type_map.Append(ConstString("SEL"), eBasicTypeObjCSel);
+ g_type_map.Append(ConstString("nullptr"), eBasicTypeNullPtr);
g_type_map.Sort();
});
- return g_type_map.Find(name.GetStringRef(), eBasicTypeInvalid);
+ return g_type_map.Find(name, eBasicTypeInvalid);
}
return eBasicTypeInvalid;
}