|
60 | 60 | # include <sys/types.h> |
61 | 61 | #endif |
62 | 62 |
|
| 63 | +#if defined(__has_cpp_attribute) |
| 64 | +# if __has_cpp_attribute (clang::lifetimebound) |
| 65 | +# define SIMPLECPP_LIFETIMEBOUND [[clang::lifetimebound]] |
| 66 | +# else |
| 67 | +# define SIMPLECPP_LIFETIMEBOUND |
| 68 | +# endif |
| 69 | +#else |
| 70 | +# define SIMPLECPP_LIFETIMEBOUND |
| 71 | +#endif |
| 72 | + |
63 | 73 | static bool isHex(const std::string &s) |
64 | 74 | { |
65 | 75 | return s.size()>2 && (s.compare(0,2,"0x")==0 || s.compare(0,2,"0X")==0); |
@@ -1680,7 +1690,7 @@ namespace simplecpp { |
1680 | 1690 | } |
1681 | 1691 |
|
1682 | 1692 | /** how has this macro been used so far */ |
1683 | | - const std::list<Location> &usage() const { |
| 1693 | + const std::list<Location> &usage() const SIMPLECPP_LIFETIMEBOUND { |
1684 | 1694 | return usageList; |
1685 | 1695 | } |
1686 | 1696 |
|
@@ -1870,7 +1880,7 @@ namespace simplecpp { |
1870 | 1880 |
|
1871 | 1881 | const Token *appendTokens(TokenList &tokens, |
1872 | 1882 | const Location &rawloc, |
1873 | | - const Token * const lpar, |
| 1883 | + const Token * const lpar SIMPLECPP_LIFETIMEBOUND, |
1874 | 1884 | const MacroMap ¯os, |
1875 | 1885 | const std::set<TokenString> &expandedmacros, |
1876 | 1886 | const std::vector<const Token*> ¶metertokens) const { |
@@ -2997,7 +3007,7 @@ static long long evaluate(simplecpp::TokenList &expr, const simplecpp::DUI &dui, |
2997 | 3007 | return expr.cfront() && expr.cfront() == expr.cback() && expr.cfront()->number ? stringToLL(expr.cfront()->str()) : 0LL; |
2998 | 3008 | } |
2999 | 3009 |
|
3000 | | -static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok) |
| 3010 | +static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok SIMPLECPP_LIFETIMEBOUND) |
3001 | 3011 | { |
3002 | 3012 | const unsigned int line = tok->location.line; |
3003 | 3013 | const unsigned int file = tok->location.fileIndex; |
|
0 commit comments