aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/MacroInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/MacroInfo.cpp')
-rw-r--r--lib/Lex/MacroInfo.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Lex/MacroInfo.cpp b/lib/Lex/MacroInfo.cpp
index de19ff502a..df89450f5a 100644
--- a/lib/Lex/MacroInfo.cpp
+++ b/lib/Lex/MacroInfo.cpp
@@ -49,9 +49,14 @@ bool MacroInfo::isIdenticalTo(const MacroInfo &Other, Preprocessor &PP) const {
for (unsigned i = 0, e = ReplacementTokens.size(); i != e; ++i) {
const Token &A = ReplacementTokens[i];
const Token &B = Other.ReplacementTokens[i];
- if (A.getKind() != B.getKind() ||
- A.isAtStartOfLine() != B.isAtStartOfLine() ||
- A.hasLeadingSpace() != B.hasLeadingSpace())
+ if (A.getKind() != B.getKind())
+ return false;
+
+ // If this isn't the first first token, check that the whitespace and
+ // start-of-line characteristics match.
+ if (i != 0 &&
+ (A.isAtStartOfLine() != B.isAtStartOfLine() ||
+ A.hasLeadingSpace() != B.hasLeadingSpace()))
return false;
// If this is an identifier, it is easy.