#ifndef LLVM_LLVMCONTEXT_H
#define LLVM_LLVMCONTEXT_H
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
class LLVMContextImpl;
class StringRef;
+class Twine;
class Instruction;
class Module;
class SMDiagnostic;
MD_dbg = 0, // "dbg"
MD_tbaa = 1, // "tbaa"
MD_prof = 2, // "prof"
- MD_fpaccuracy = 3 // "fpaccuracy"
+ MD_fpmath = 3, // "fpmath"
+ MD_range = 4, // "range"
+ MD_tbaa_struct = 5 // "tbaa.struct"
};
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
- typedef void (*InlineAsmDiagHandlerTy)(const SMDiagnostic&, void *Context,
- unsigned LocCookie);
+ typedef void (*DiagHandlerTy)(const SMDiagnostic&, void *Context,
+ unsigned LocCookie);
- /// setInlineAsmDiagnosticHandler - This method sets a handler that is invoked
- /// when problems with inline asm are detected by the backend. The first
- /// argument is a function pointer and the second is a context pointer that
- /// gets passed into the DiagHandler.
+ /// setDiagnosticHandler - This method sets a handler that is invoked
+ /// when problems are detected by the backend. The first argument is a
+ /// function pointer and the second is a context pointer that gets passed
+ /// into the DiagHandler.
///
/// LLVMContext doesn't take ownership or interpret either of these
/// pointers.
- void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
- void *DiagContext = 0);
+ void setDiagnosticHandler(DiagHandlerTy DiagHandler, void *DiagContext = 0);
- /// getInlineAsmDiagnosticHandler - Return the diagnostic handler set by
- /// setInlineAsmDiagnosticHandler.
- InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const;
+ /// getDiagnosticHandler - Return the diagnostic handler set by
+ /// setDiagnosticHandler.
+ DiagHandlerTy getDiagnosticHandler() const;
- /// getInlineAsmDiagnosticContext - Return the diagnostic context set by
- /// setInlineAsmDiagnosticHandler.
- void *getInlineAsmDiagnosticContext() const;
+ /// getDiagnosticContext - Return the diagnostic context set by
+ /// setDiagnosticHandler.
+ void *getDiagnosticContext() const;
+ /// FIXME: Temporary copies of the old names; to be removed as soon as
+ /// clang switches to the new ones.
+ typedef DiagHandlerTy InlineAsmDiagHandlerTy;
+ void setInlineAsmDiagnosticHandler(InlineAsmDiagHandlerTy DiagHandler,
+ void *DiagContext = 0) {
+ setDiagnosticHandler(DiagHandler, DiagContext);
+ }
+ InlineAsmDiagHandlerTy getInlineAsmDiagnosticHandler() const {
+ return getDiagnosticHandler();
+ }
+ void *getInlineAsmDiagnosticContext() const {
+ return getDiagnosticContext();
+ }
/// emitError - Emit an error message to the currently installed error handler
/// with optional location information. This function returns, so code should
/// be prepared to drop the erroneous construct on the floor and "not crash".
/// The generated code need not be correct. The error message will be
/// implicitly prefixed with "error: " and should not end with a ".".
- void emitError(unsigned LocCookie, StringRef ErrorStr);
- void emitError(const Instruction *I, StringRef ErrorStr);
- void emitError(StringRef ErrorStr);
+ void emitError(unsigned LocCookie, const Twine &ErrorStr);
+ void emitError(const Instruction *I, const Twine &ErrorStr);
+ void emitError(const Twine &ErrorStr);
+
+ /// emitWarning - This is similar to emitError but it emits a warning instead
+ /// of an error.
+ void emitWarning(unsigned LocCookie, const Twine &ErrorStr);
+ void emitWarning(const Instruction *I, const Twine &ErrorStr);
+ void emitWarning(const Twine &ErrorStr);
private:
- // DO NOT IMPLEMENT
- LLVMContext(LLVMContext&);
- void operator=(LLVMContext&);
+ LLVMContext(LLVMContext&) LLVM_DELETED_FUNCTION;
+ void operator=(LLVMContext&) LLVM_DELETED_FUNCTION;
/// addModule - Register a module as being instantiated in this context. If
/// the context is deleted, the module will be deleted as well.