|
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); |
@@ -1679,7 +1689,7 @@ namespace simplecpp { |
1679 | 1689 | } |
1680 | 1690 |
|
1681 | 1691 | /** how has this macro been used so far */ |
1682 | | - const std::list<Location> &usage() const { |
| 1692 | + const std::list<Location> &usage() const SIMPLECPP_LIFETIMEBOUND { |
1683 | 1693 | return usageList; |
1684 | 1694 | } |
1685 | 1695 |
|
@@ -1874,7 +1884,7 @@ namespace simplecpp { |
1874 | 1884 |
|
1875 | 1885 | const Token *appendTokens(TokenList &tokens, |
1876 | 1886 | const Location &rawloc, |
1877 | | - const Token * const lpar, |
| 1887 | + const Token * const lpar SIMPLECPP_LIFETIMEBOUND, |
1878 | 1888 | const MacroMap ¯os, |
1879 | 1889 | const std::set<TokenString> &expandedmacros, |
1880 | 1890 | const std::vector<const Token*> ¶metertokens) const { |
@@ -3001,7 +3011,7 @@ static long long evaluate(simplecpp::TokenList &expr, const simplecpp::DUI &dui, |
3001 | 3011 | return expr.cfront() && expr.cfront() == expr.cback() && expr.cfront()->number ? stringToLL(expr.cfront()->str()) : 0LL; |
3002 | 3012 | } |
3003 | 3013 |
|
3004 | | -static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok) |
| 3014 | +static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok SIMPLECPP_LIFETIMEBOUND) |
3005 | 3015 | { |
3006 | 3016 | const unsigned int line = tok->location.line; |
3007 | 3017 | const unsigned int file = tok->location.fileIndex; |
|
0 commit comments