diff options
Diffstat (limited to 'include/clang/Sema')
-rw-r--r-- | include/clang/Sema/ExternalSemaSource.h | 56 | ||||
-rw-r--r-- | include/clang/Sema/ParseAST.h | 37 | ||||
-rw-r--r-- | include/clang/Sema/SemaConsumer.h | 45 | ||||
-rw-r--r-- | include/clang/Sema/SemaDiagnostic.h | 27 |
4 files changed, 165 insertions, 0 deletions
diff --git a/include/clang/Sema/ExternalSemaSource.h b/include/clang/Sema/ExternalSemaSource.h new file mode 100644 index 0000000..0f0d375 --- /dev/null +++ b/include/clang/Sema/ExternalSemaSource.h @@ -0,0 +1,56 @@ +//===--- ExternalSemaSource.h - External Sema Interface ---------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the ExternalSemaSource interface. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H +#define LLVM_CLANG_SEMA_EXTERNAL_SEMA_SOURCE_H + +#include "clang/AST/DeclObjC.h" +#include "clang/AST/ExternalASTSource.h" + +namespace clang { + +class Sema; + +/// \brief An abstract interface that should be implemented by +/// external AST sources that also provide information for semantic +/// analysis. +class ExternalSemaSource : public ExternalASTSource { +public: + ExternalSemaSource() { + ExternalASTSource::SemaSource = true; + } + + /// \brief Initialize the semantic source with the Sema instance + /// being used to perform semantic analysis on the abstract syntax + /// tree. + virtual void InitializeSema(Sema &S) {} + + /// \brief Load the contents of the global method pool for a given + /// selector. + /// + /// \returns a pair of Objective-C methods lists containing the + /// instance and factory methods, respectively, with this selector. + virtual std::pair<ObjCMethodList, ObjCMethodList> + ReadMethodPool(Selector Sel) { + return std::pair<ObjCMethodList, ObjCMethodList>(); + } + + // isa/cast/dyn_cast support + static bool classof(const ExternalASTSource *Source) { + return Source->SemaSource; + } + static bool classof(const ExternalSemaSource *) { return true; } +}; + +} // end namespace clang + +#endif diff --git a/include/clang/Sema/ParseAST.h b/include/clang/Sema/ParseAST.h new file mode 100644 index 0000000..bdce5e9 --- /dev/null +++ b/include/clang/Sema/ParseAST.h @@ -0,0 +1,37 @@ +//===--- ParseAST.h - Define the ParseAST method ----------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the clang::ParseAST method. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_SEMA_PARSEAST_H +#define LLVM_CLANG_SEMA_PARSEAST_H + +namespace clang { + class Preprocessor; + class ASTConsumer; + class ASTContext; + + /// \brief Parse the entire file specified, notifying the ASTConsumer as + /// the file is parsed. + /// + /// This operation inserts the parsed decls into the translation + /// unit held by Ctx. + /// + /// \param CompleteTranslationUnit When true, the parsed file is + /// considered to be a complete translation unit, and any + /// end-of-translation-unit wrapup will be performed. + void ParseAST(Preprocessor &pp, ASTConsumer *C, + ASTContext &Ctx, bool PrintStats = false, + bool CompleteTranslationUnit = true); + +} // end namespace clang + +#endif diff --git a/include/clang/Sema/SemaConsumer.h b/include/clang/Sema/SemaConsumer.h new file mode 100644 index 0000000..e8219470 --- /dev/null +++ b/include/clang/Sema/SemaConsumer.h @@ -0,0 +1,45 @@ +//===--- SemaConsumer.h - Abstract interface for AST semantics --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the SemaConsumer class, a subclass of +// ASTConsumer that is used by AST clients that also require +// additional semantic analysis. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_CLANG_SEMA_SEMACONSUMER_H +#define LLVM_CLANG_SEMA_SEMACONSUMER_H + +#include "clang/AST/ASTConsumer.h" + +namespace clang { + class Sema; + + /// \brief An abstract interface that should be implemented by + /// clients that read ASTs and then require further semantic + /// analysis of the entities in those ASTs. + class SemaConsumer : public ASTConsumer { + public: + SemaConsumer() { + ASTConsumer::SemaConsumer = true; + } + + /// \brief Initialize the semantic consumer with the Sema instance + /// being used to perform semantic analysis on the abstract syntax + /// tree. + virtual void InitializeSema(Sema &S) {} + + // isa/cast/dyn_cast support + static bool classof(const ASTConsumer *Consumer) { + return Consumer->SemaConsumer; + } + static bool classof(const SemaConsumer *) { return true; } + }; +} + +#endif diff --git a/include/clang/Sema/SemaDiagnostic.h b/include/clang/Sema/SemaDiagnostic.h new file mode 100644 index 0000000..e215ed4 --- /dev/null +++ b/include/clang/Sema/SemaDiagnostic.h @@ -0,0 +1,27 @@ +//===--- DiagnosticSema.h - Diagnostics for libsema -------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_DIAGNOSTICSEMA_H +#define LLVM_CLANG_DIAGNOSTICSEMA_H + +#include "clang/Basic/Diagnostic.h" + +namespace clang { + namespace diag { + enum { +#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP) ENUM, +#define SEMASTART +#include "clang/Basic/DiagnosticSemaKinds.inc" +#undef DIAG + NUM_BUILTIN_SEMA_DIAGNOSTICS + }; + } // end namespace diag +} // end namespace clang + +#endif |