Revert "System: Add SwapByteOrder and update Support/MathExtras.h to use it."
[oota-llvm.git] / include / llvm / Support / SMLoc.h
1 //===- SMLoc.h - Source location for use with diagnostics -------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the SMLoc class.  This class encapsulates a location in
11 // source code for use in diagnostics.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SUPPORT_SMLOC_H
16 #define SUPPORT_SMLOC_H
17
18 namespace llvm {
19
20 // SMLoc - Represents a location in source code.
21 class SMLoc {    
22   const char *Ptr;
23 public:
24   SMLoc() : Ptr(0) {}
25   SMLoc(const SMLoc &RHS) : Ptr(RHS.Ptr) {}
26     
27   bool isValid() const { return Ptr != 0; }
28     
29   bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; }
30   bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; }
31     
32   const char *getPointer() const { return Ptr; }
33     
34   static SMLoc getFromPointer(const char *Ptr) {
35     SMLoc L;
36     L.Ptr = Ptr;
37     return L;
38   }
39 };
40
41 }
42
43 #endif
44