///
/// \param Loc The source location for which we are interested in finding out
/// the diagnostic state. Can be null in order to query the latest state.
- DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
- const DiagnosticsEngine &Diag) const;
+ DiagnosticIDs::Level
+ getDiagnosticLevel(unsigned DiagID, SourceLocation Loc,
+ const DiagnosticsEngine &Diag) const LLVM_READONLY;
/// \brief An internal implementation helper used when \p DiagClass is
/// already known.
- DiagnosticIDs::Level getDiagnosticLevel(unsigned DiagID,
- unsigned DiagClass,
- SourceLocation Loc,
- const DiagnosticsEngine &Diag) const;
+ DiagnosticIDs::Level
+ getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, SourceLocation Loc,
+ const DiagnosticsEngine &Diag) const LLVM_READONLY;
/// \brief Used to report a diagnostic that is finally fully formed.
///
///
/// The name of a token will be an internal name (such as "l_square")
/// and should not be used as part of diagnostic messages.
-const char *getTokenName(enum TokenKind Kind);
+const char *getTokenName(enum TokenKind Kind) LLVM_READNONE;
/// \brief Determines the spelling of simple punctuation tokens like
/// '!' or '%', and returns NULL for literal and annotation tokens.
/// and will not produce any alternative spellings (e.g., a
/// digraph). For the actual spelling of a given Token, use
/// Preprocessor::getSpelling().
-const char *getTokenSimpleSpelling(enum TokenKind Kind);
+const char *getTokenSimpleSpelling(enum TokenKind Kind) LLVM_READNONE;
/// \brief Return true if this is a raw identifier or an identifier kind.
inline bool isAnyIdentifier(TokenKind K) {
//===----------------------------------------------------------------------===//
#include "clang/Basic/TokenKinds.h"
-#include <cassert>
+#include "llvm/Support/ErrorHandling.h"
using namespace clang;
static const char * const TokNames[] = {
};
const char *tok::getTokenName(enum TokenKind Kind) {
- assert(Kind < tok::NUM_TOKENS);
- return TokNames[Kind];
+ if (Kind < tok::NUM_TOKENS)
+ return TokNames[Kind];
+ llvm_unreachable("unknown TokenKind");
+ return 0;
}
const char *tok::getTokenSimpleSpelling(enum TokenKind Kind) {