summaryrefslogtreecommitdiffstats
path: root/clang
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
commitf4fee9e1e5ed46a5e54ea2fd4ccb69e1bb4055c3 (patch)
tree85ee136892d861302d9551ef705985493106463d /clang
parentb877e2c3cacb2837bcbd8f5fc1a10fa140b99e4c (diff)
downloadbcm5719-llvm-f4fee9e1e5ed46a5e54ea2fd4ccb69e1bb4055c3.tar.gz
bcm5719-llvm-f4fee9e1e5ed46a5e54ea2fd4ccb69e1bb4055c3.zip
make rewrite macros insert a space when commenting out macros where the token didn't
lead with a space. llvm-svn: 51896
Diffstat (limited to 'clang')
-rw-r--r--clang/Driver/RewriteMacros.cpp5
1 files changed, 3 insertions, 2 deletions
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
OpenPOWER on IntegriCloud