From f4fee9e1e5ed46a5e54ea2fd4ccb69e1bb4055c3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 3 Jun 2008 06:10:17 +0000 Subject: make rewrite macros insert a space when commenting out macros where the token didn't lead with a space. llvm-svn: 51896 --- clang/Driver/RewriteMacros.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang') diff --git a/clang/Driver/RewriteMacros.cpp b/clang/Driver/RewriteMacros.cpp index 136492517d6..7e8629359d6 100644 --- a/clang/Driver/RewriteMacros.cpp +++ b/clang/Driver/RewriteMacros.cpp @@ -115,8 +115,9 @@ void clang::RewriteMacrosInInput(Preprocessor &PP,const std::string &InFileName, // deleted. Comment out the raw token. if (RawOffs <= PPOffs) { // Comment out a whole run of tokens instead of bracketing each one with - // comments. - RB.InsertTextAfter(RawOffs, "/*", 2); + // comments. Add a leading space if RawTok didn't have one. + bool HasSpace = RawTok.hasLeadingSpace(); + RB.InsertTextAfter(RawOffs, " /*"+HasSpace, 2+!HasSpace); unsigned EndPos; // Switch on comment lexing. If we get a comment, we don't want to -- cgit v1.2.3