aboutsummaryrefslogtreecommitdiff
path: root/Driver/RewriteMacros.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-03 06:10:17 +0000
committerChris Lattner <sabre@nondot.org>2008-06-03 06:10:17 +0000
commit1a78735ade87b547473eff6d630b7569afabb708 (patch)
tree748fe622535cc27213eed6c1125ce9d3a09b69f7 /Driver/RewriteMacros.cpp
parent459a1e2212115f4ff89db7f444df5af41792b18a (diff)
make rewrite macros insert a space when commenting out macros where the token didn't
lead with a space. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteMacros.cpp')
-rw-r--r--Driver/RewriteMacros.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Driver/RewriteMacros.cpp b/Driver/RewriteMacros.cpp
index 136492517d..7e8629359d 100644
--- a/Driver/RewriteMacros.cpp
+++ b/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