// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-// This file defines the DelayedDiagnostic class, which is used to
-// record diagnostics that are being conditionally produced during
-// declarator parsing. Certain kinds of diagnostics --- notably
-// deprecation and access control --- are suppressed based on
-// semantic properties of the parsed declaration that aren't known
-// until it is fully parsed.
-//
-// This file also defines AccessedEntity.
-//
+///
+/// \file
+/// \brief Defines the classes clang::DelayedDiagnostic and
+/// clang::AccessedEntity.
+///
+/// DelayedDiangostic is used to record diagnostics that are being
+/// conditionally produced during declarator parsing. Certain kinds of
+/// diagnostics -- notably deprecation and access control -- are suppressed
+/// based on semantic properties of the parsed declaration that aren't known
+/// until it is fully parsed.
+///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_SEMA_DELAYED_DIAGNOSTIC_H
-#define LLVM_CLANG_SEMA_DELAYED_DIAGNOSTIC_H
+#ifndef LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H
+#define LLVM_CLANG_SEMA_DELAYEDDIAGNOSTIC_H
#include "clang/Sema/Sema.h"
/// the complete parsing of the current declaration.
class DelayedDiagnostic {
public:
- enum DDKind { Deprecation, Access, ForbiddenType };
+ enum DDKind { Deprecation, Unavailable, Access, ForbiddenType };
unsigned char Kind; // actually a DDKind
bool Triggered;
void Destroy();
- static DelayedDiagnostic makeDeprecation(SourceLocation Loc,
- const NamedDecl *D,
- const ObjCInterfaceDecl *UnknownObjCClass,
- const ObjCPropertyDecl *ObjCProperty,
- StringRef Msg);
+ static DelayedDiagnostic makeAvailability(Sema::AvailabilityDiagnostic AD,
+ SourceLocation Loc,
+ const NamedDecl *D,
+ const ObjCInterfaceDecl *UnknownObjCClass,
+ const ObjCPropertyDecl *ObjCProperty,
+ StringRef Msg,
+ bool ObjCPropertyAccess);
+
static DelayedDiagnostic makeAccess(SourceLocation Loc,
const AccessedEntity &Entity) {
}
const NamedDecl *getDeprecationDecl() const {
- assert(Kind == Deprecation && "Not a deprecation diagnostic.");
+ assert((Kind == Deprecation || Kind == Unavailable) &&
+ "Not a deprecation diagnostic.");
return DeprecationData.Decl;
}
StringRef getDeprecationMessage() const {
- assert(Kind == Deprecation && "Not a deprecation diagnostic.");
+ assert((Kind == Deprecation || Kind == Unavailable) &&
+ "Not a deprecation diagnostic.");
return StringRef(DeprecationData.Message,
DeprecationData.MessageLen);
}
const ObjCPropertyDecl *getObjCProperty() const {
return DeprecationData.ObjCProperty;
}
+
+ bool getObjCPropertyAccess() const {
+ return DeprecationData.ObjCPropertyAccess;
+ }
private:
const ObjCPropertyDecl *ObjCProperty;
const char *Message;
size_t MessageLen;
+ bool ObjCPropertyAccess;
};
struct FTD {
};
};
-/// DelayedDiagnosticPool - A collection of diagnostics which were
-/// delayed.
+/// \brief A collection of diagnostics which were delayed.
class DelayedDiagnosticPool {
const DelayedDiagnosticPool *Parent;
SmallVector<DelayedDiagnostic, 4> Diagnostics;
/// Does this pool, or any of its ancestors, contain any diagnostics?
bool empty() const {
- return (Diagnostics.empty() && (Parent == NULL || Parent->empty()));
+ return (Diagnostics.empty() && (!Parent || Parent->empty()));
}
/// Add a diagnostic to this pool.
if (pool.Diagnostics.empty()) return;
if (Diagnostics.empty()) {
- Diagnostics = llvm_move(pool.Diagnostics);
+ Diagnostics = std::move(pool.Diagnostics);
} else {
Diagnostics.append(pool.pool_begin(), pool.pool_end());
}