Page MenuHomePhabricator

Refactor MacroInfo for easier access in for-loops
ClosedPublic

Authored by edse on May 22 2015, 5:30 AM.

Details

Summary

Added possibilty to extract the arguments in a MacroInfo as a container in order to use C++11 style for loops.

Diff Detail

Event Timeline

edse updated this revision to Diff 26316.May 22 2015, 5:30 AM
edse retitled this revision from to Refactor MacroInfo for easier access in for-loops.
edse updated this object.
edse edited the test plan for this revision. (Show Details)
edse added reviewers: alexfh, danielmarjamaki.
edse added a subscriber: Unknown Object (MLST).
danielmarjamaki accepted this revision.May 22 2015, 5:45 AM
danielmarjamaki edited edge metadata.

looks good to me

This revision is now accepted and ready to land.May 22 2015, 5:45 AM
alexfh accepted this revision.May 22 2015, 5:56 AM
alexfh edited edge metadata.

Looks good with comments.

include/clang/Lex/MacroInfo.h
185

I'd probably go with ArrayRef<const IdentifierInfo*>, if no potential users need a non-const version.

lib/Lex/PPMacroExpansion.cpp
365

Lines 365-369 can be replaced with:

return std::find(MI->args_begin(), MI->args_end(), II) == MI->args_end();
lib/Serialization/ASTWriter.cpp
2138

Specifying the exact type would make the code more readable here, imho:

for (const IdentifierInfo *I : MI->args())
  ...

I applied patch you gave me. rL238547