summaryrefslogtreecommitdiff
path: root/AspectC++/version.h
blob: eae6960d3f383c9b807dc3e8eb348d4ae401ece9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

#ifndef __version_h__
#define __version_h__

#include "infos.h"

static inline const char *ac_version() {return AC_VERSION;}
static inline const char *ac_program() {return "ac++";}

// Version management helpers:
// Returns a version number that can be compared by using >, >=, ==, ...
#define GET_VERSION_NUMBER(MAJOR, MINOR, PATCHLEVEL) \
                            MAJOR * 10000 \
                            + MINOR * 100 \
                            + PATCHLEVEL

#ifdef FRONTEND_CLANG
// Clang version:
#include "clang/Basic/Version.h"
#define CLANG_VERSION_NUMBER GET_VERSION_NUMBER(CLANG_VERSION_MAJOR, \
                                                CLANG_VERSION_MINOR, \
                                                CLANG_VERSION_PATCHLEVEL)

// Some version numbers:
#define VERSION_NUMBER_3_5_2 GET_VERSION_NUMBER(3, 5, 2)
#define VERSION_NUMBER_3_6_2 GET_VERSION_NUMBER(3, 6, 2)
#define VERSION_NUMBER_3_7_1 GET_VERSION_NUMBER(3, 7, 1)
#define VERSION_NUMBER_3_8_0 GET_VERSION_NUMBER(3, 8, 0)
#define VERSION_NUMBER_3_9_1 GET_VERSION_NUMBER(3, 9, 1)
#define VERSION_NUMBER_4_0_0 GET_VERSION_NUMBER(4, 0, 0)
#define VERSION_NUMBER_5_0_0 GET_VERSION_NUMBER(5, 0, 0)
#define VERSION_NUMBER_6_0_0 GET_VERSION_NUMBER(6, 0, 0)
#define VERSION_NUMBER_7_0_0 GET_VERSION_NUMBER(7, 0, 0)
#define VERSION_NUMBER_9_0_0 GET_VERSION_NUMBER(9, 0, 0)

// StartLoc and EndLoc API change
#if CLANG_VERSION_NUMBER >= VERSION_NUMBER_9_0_0
#define CLANG_GET_LOC_END(ptr) ((ptr)->getEndLoc())
#define CLANG_GET_START_LOC(ptr) ((ptr)->getBeginLoc())
#define CLANG_GET_LOC_START(ptr) ((ptr)->getBeginLoc())
#else
#define CLANG_GET_LOC_END(ptr) ((ptr)->getLocEnd())
#define CLANG_GET_START_LOC(ptr) ((ptr)->getStartLoc())
#define CLANG_GET_LOC_START(ptr) ((ptr)->getLocStart())
#endif

#endif // FRONTEND_CLANG

#endif // __version_h__