summaryrefslogtreecommitdiff
path: root/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-05-15 21:40:27 +0200
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-05-15 21:40:27 +0200
commitb0274c7c30af17c0255846bcd53cac4f7d76ddea (patch)
tree4243e33459039a96c26557de48f989e85c925a4c /lib/Format/WhitespaceManager.cpp
parent38f7a3147aad1e25d0738356519cf9235f5c80b7 (diff)
parentcce70c7c5f0f4c1a41658fbed845f8b3a565c99c (diff)
downloadclang-embtk-support-master.tar.gz
clang-embtk-support-master.tar.bz2
clang-embtk-support-master.tar.xz
Merge branch 'master' into embtk-support-masterembtk-support-master
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'lib/Format/WhitespaceManager.cpp')
-rw-r--r--lib/Format/WhitespaceManager.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Format/WhitespaceManager.cpp b/lib/Format/WhitespaceManager.cpp
index a75c592bfe..7ffebacba5 100644
--- a/lib/Format/WhitespaceManager.cpp
+++ b/lib/Format/WhitespaceManager.cpp
@@ -122,7 +122,7 @@ void WhitespaceManager::addUntouchableComment(unsigned Column) {
std::string WhitespaceManager::getNewLineText(unsigned NewLines,
unsigned Spaces) {
- return std::string(NewLines, '\n') + std::string(Spaces, ' ');
+ return std::string(NewLines, '\n') + getIndentText(Spaces);
}
std::string WhitespaceManager::getNewLineText(unsigned NewLines,
@@ -139,7 +139,15 @@ std::string WhitespaceManager::getNewLineText(unsigned NewLines,
Offset = 0;
}
}
- return NewLineText + std::string(Spaces, ' ');
+ return NewLineText + getIndentText(Spaces);
+}
+
+std::string WhitespaceManager::getIndentText(unsigned Spaces) {
+ if (!Style.UseTab)
+ return std::string(Spaces, ' ');
+
+ return std::string(Spaces / Style.IndentWidth, '\t') +
+ std::string(Spaces % Style.IndentWidth, ' ');
}
void WhitespaceManager::alignComments() {