blob: 36d27980df79a16fee8efbe47c3f62eb5e491ab1 [file] [edit]
// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Defines #pragma directives controlling nullability behavior.
//
// #pragma nullability file_default (nullable|nonnull)
//
// This controls how unannotated pointer types are interpreted.
// This is based on the governing file, where the `*` is written.
// If this file has a pragma, it determines nullability, else it is Unspecified.
#ifndef CRUBIT_NULLABILITY_PRAGMA_H_
#define CRUBIT_NULLABILITY_PRAGMA_H_
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/DenseMap.h"
namespace clang {
class Preprocessor;
}
namespace clang::tidy::nullability {
using NullabilityPragmas = llvm::DenseMap<FileID, NullabilityKind>;
// Install pragma handlers which record results into `Out`.
// This must be called before parsing begins.
// `Out` must outlive the preprocessor (i.e. the compilation).
void registerPragmaHandler(clang::Preprocessor &PP, NullabilityPragmas &Out);
} // namespace clang::tidy::nullability
#endif