From 0723bea947ef76206e1190c3f488d4bcf7b48c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 11 Oct 2017 17:11:27 +0200 Subject: [PATCH] Only generate line directive when necessary --- src/libclang/preprocessor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libclang/preprocessor.cpp b/src/libclang/preprocessor.cpp index 7459933..0630979 100644 --- a/src/libclang/preprocessor.cpp +++ b/src/libclang/preprocessor.cpp @@ -198,8 +198,11 @@ namespace void set_line(unsigned line) { - *result_ += "#line " + std::to_string(line) + "\n"; - cur_line_ = line; + if (cur_line_ != line) + { + *result_ += "#line " + std::to_string(line) + "\n"; + cur_line_ = line; + } } void write_str(std::string str)