summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2015-06-24 22:02:08 +0000
committerDouglas Gregor <dgregor@apple.com>2015-06-24 22:02:08 +0000
commitaea7afdc1304cfef3b2cf61793729b1f55f26d0a (patch)
tree80670a6c9757e83d93e42c74128d0730cbaea889 /clang/lib/Basic
parent63d606bdcb606ace3cea3455dcaf0c3dac108d4e (diff)
downloadbcm5719-llvm-aea7afdc1304cfef3b2cf61793729b1f55f26d0a.tar.gz
bcm5719-llvm-aea7afdc1304cfef3b2cf61793729b1f55f26d0a.zip
Replace __double_underscored type nullability qualifiers with _Uppercase_underscored
Addresses a conflict with glibc's __nonnull macro by renaming the type nullability qualifiers as follows: __nonnull -> _Nonnull __nullable -> _Nullable __null_unspecified -> _Null_unspecified This is the major part of rdar://problem/21530726, but does not yet provide the Darwin-specific behavior for the old names. llvm-svn: 240596
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp21
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp9
2 files changed, 26 insertions, 4 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 7f5a15dab6b..f89caf7b248 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -24,6 +24,27 @@
using namespace clang;
+const DiagnosticBuilder &clang::operator<<(const DiagnosticBuilder &DB,
+ DiagNullabilityKind nullability) {
+ StringRef string;
+ switch (nullability.first) {
+ case NullabilityKind::NonNull:
+ string = nullability.second ? "'nonnull'" : "'_Nonnull'";
+ break;
+
+ case NullabilityKind::Nullable:
+ string = nullability.second ? "'nullable'" : "'_Nullable'";
+ break;
+
+ case NullabilityKind::Unspecified:
+ string = nullability.second ? "'null_unspecified'" : "'_Null_unspecified'";
+ break;
+ }
+
+ DB.AddString(string);
+ return DB;
+}
+
static void DummyArgToStringFn(DiagnosticsEngine::ArgumentKind AK, intptr_t QT,
StringRef Modifier, StringRef Argument,
ArrayRef<DiagnosticsEngine::ArgumentValue> PrevArgs,
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index b2950081000..40b28222b8b 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -647,16 +647,17 @@ const char *clang::getOperatorSpelling(OverloadedOperatorKind Operator) {
llvm_unreachable("Invalid OverloadedOperatorKind!");
}
-StringRef clang::getNullabilitySpelling(NullabilityKind kind) {
+StringRef clang::getNullabilitySpelling(NullabilityKind kind,
+ bool isContextSensitive) {
switch (kind) {
case NullabilityKind::NonNull:
- return "__nonnull";
+ return isContextSensitive ? "nonnull" : "_Nonnull";
case NullabilityKind::Nullable:
- return "__nullable";
+ return isContextSensitive ? "nullable" : "_Nullable";
case NullabilityKind::Unspecified:
- return "__null_unspecified";
+ return isContextSensitive ? "null_unspecified" : "_Null_unspecified";
}
llvm_unreachable("Unknown nullability kind.");
}
OpenPOWER on IntegriCloud