From ad80af8f191503fe33deecf8efc57ff2878aa3d1 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Sun, 15 Mar 2015 01:08:23 +0000 Subject: -Wempty-body: fix false negative triggered by macros When if statement condition ended in a macro: if (ptr == NULL); the check used to consider the definition location of NULL, instead of the current line. Patch by Manasij Mukherjee. llvm-svn: 232295 --- clang/lib/Sema/SemaChecking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaChecking.cpp') diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c4ff8b4ef39..5eafa503486 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -8625,7 +8625,7 @@ bool ShouldDiagnoseEmptyStmtBody(const SourceManager &SourceMgr, // Get line numbers of statement and body. bool StmtLineInvalid; - unsigned StmtLine = SourceMgr.getSpellingLineNumber(StmtLoc, + unsigned StmtLine = SourceMgr.getPresumedLineNumber(StmtLoc, &StmtLineInvalid); if (StmtLineInvalid) return false; -- cgit v1.2.3