1 //===- SMLoc.h - Source location for use with diagnostics -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the SMLoc class. This class encapsulates a location in
11 // source code for use in diagnostics.
13 //===----------------------------------------------------------------------===//
15 #ifndef SUPPORT_SMLOC_H
16 #define SUPPORT_SMLOC_H
20 // SMLoc - Represents a location in source code.
25 SMLoc(const SMLoc &RHS) : Ptr(RHS.Ptr) {}
27 bool isValid() const { return Ptr != 0; }
29 bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; }
30 bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; }
32 const char *getPointer() const { return Ptr; }
34 static SMLoc getFromPointer(const char *Ptr) {