Fix -Wunused-comparison for comparisons in arguments to function-like macros.
Previously, -Wunused-comparison ignored comparisons in both macro bodies and macro arguments, but we would still emit a -Wunused-value warning for either. Now we correctly emit -Wunused-comparison for expressions in macro arguments. Also, add isMacroBodyExpansion to SourceManager, to go along with isMacroArgExpansion. llvm-svn: 172279
This commit is contained in:
@@ -974,11 +974,18 @@ bool SourceManager::isMacroArgExpansion(SourceLocation Loc) const {
|
||||
if (!Loc.isMacroID()) return false;
|
||||
|
||||
FileID FID = getFileID(Loc);
|
||||
const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
|
||||
const SrcMgr::ExpansionInfo &Expansion = E->getExpansion();
|
||||
const SrcMgr::ExpansionInfo &Expansion = getSLocEntry(FID).getExpansion();
|
||||
return Expansion.isMacroArgExpansion();
|
||||
}
|
||||
|
||||
bool SourceManager::isMacroBodyExpansion(SourceLocation Loc) const {
|
||||
if (!Loc.isMacroID()) return false;
|
||||
|
||||
FileID FID = getFileID(Loc);
|
||||
const SrcMgr::ExpansionInfo &Expansion = getSLocEntry(FID).getExpansion();
|
||||
return Expansion.isMacroBodyExpansion();
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Queries about the code at a SourceLocation.
|
||||
|
||||
Reference in New Issue
Block a user