diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Rewrite/HTMLRewrite.cpp | 5 | ||||
| -rw-r--r-- | clang/test/Misc/emit-html.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index cf49701a1d7..0ef998deb13 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -437,6 +437,11 @@ void html::HighlightMacros(Rewriter &R, FileID FID, Preprocessor& PP) { // preprocessor directives. if (Tok.is(tok::hash) && Tok.isAtStartOfLine()) continue; + + // If this is a ## token, change its kind to unknown so that repreprocessing + // it will not produce an error. + if (Tok.is(tok::hashhash)) + Tok.setKind(tok::unknown); // If this raw token is an identifier, the raw lexer won't have looked up // the corresponding identifier info for it. Do this now so that it will be diff --git a/clang/test/Misc/emit-html.c b/clang/test/Misc/emit-html.c index 1bcab12dbc9..c4a184584bf 100644 --- a/clang/test/Misc/emit-html.c +++ b/clang/test/Misc/emit-html.c @@ -3,3 +3,9 @@ // rdar://6562329 #line 42 "foo.c" +// PR3635 +#define F(fmt, ...) fmt, ## __VA_ARGS__ +int main(int argc, char **argv) { + return F(argc, 1); +} + |

