|
57 | 57 | # include <sys/stat.h> |
58 | 58 | #endif |
59 | 59 |
|
| 60 | +#if defined(__has_cpp_attribute) |
| 61 | +# if __has_cpp_attribute (clang::lifetimebound) |
| 62 | +# define SIMPLECPP_LIFETIMEBOUND [[clang::lifetimebound]] |
| 63 | +# else |
| 64 | +# define SIMPLECPP_LIFETIMEBOUND |
| 65 | +# endif |
| 66 | +#else |
| 67 | +# define SIMPLECPP_LIFETIMEBOUND |
| 68 | +#endif |
| 69 | + |
60 | 70 | static bool isHex(const std::string &s) |
61 | 71 | { |
62 | 72 | return s.size()>2 && (s.compare(0,2,"0x")==0 || s.compare(0,2,"0X")==0); |
@@ -1694,7 +1704,7 @@ namespace simplecpp { |
1694 | 1704 | } |
1695 | 1705 |
|
1696 | 1706 | /** how has this macro been used so far */ |
1697 | | - const std::list<Location> &usage() const { |
| 1707 | + const std::list<Location> &usage() const SIMPLECPP_LIFETIMEBOUND { |
1698 | 1708 | return usageList; |
1699 | 1709 | } |
1700 | 1710 |
|
@@ -1884,7 +1894,7 @@ namespace simplecpp { |
1884 | 1894 |
|
1885 | 1895 | const Token *appendTokens(TokenList &tokens, |
1886 | 1896 | const Location &rawloc, |
1887 | | - const Token * const lpar, |
| 1897 | + const Token * const lpar SIMPLECPP_LIFETIMEBOUND, |
1888 | 1898 | const MacroMap ¯os, |
1889 | 1899 | const std::set<TokenString> &expandedmacros, |
1890 | 1900 | const std::vector<const Token*> ¶metertokens) const { |
@@ -3014,7 +3024,7 @@ static long long evaluate(simplecpp::TokenList &expr, const simplecpp::DUI &dui, |
3014 | 3024 | return expr.cfront() && expr.cfront() == expr.cback() && expr.cfront()->number ? stringToLL(expr.cfront()->str()) : 0LL; |
3015 | 3025 | } |
3016 | 3026 |
|
3017 | | -static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok) |
| 3027 | +static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok SIMPLECPP_LIFETIMEBOUND) |
3018 | 3028 | { |
3019 | 3029 | const unsigned int line = tok->location.line; |
3020 | 3030 | const unsigned int file = tok->location.fileIndex; |
|
0 commit comments