yawanng added inline comments.
================ Comment at: clang-tidy/android/FileOpenFlagCheck.cpp:61 + SourceLocation EndLoc = + Lexer::getLocForEndOfToken(FlagArg->getLocEnd(), 0, SM, getLangOpts()); + ---------------- hokein wrote: > Instead of using getLangOpts(), you should use `Result.Context.getLangOpts()`. May I ask what's the difference between the `Result.Context.getLangOpts()` and `getLangOpts()`? Does `Result.Context.getLangOpts()` have a longer lifetime than `getLangOpts()`? ================ Comment at: clang-tidy/android/FileOpenFlagCheck.cpp:79 + std::pair<FileID, unsigned> ExpansionInfo = SM.getDecomposedLoc(Loc); + auto MacroName = + SM.getBufferData(ExpansionInfo.first) ---------------- hokein wrote: > You could use `Lexer::getImmediateMacroName(Loc, SM, Opts);` to get the marco > name, or doesn't it work here? `getImmediateMacroName` sometimes cannot return the `O_CLOEXEC `, like #define O_CLOEXEC _O_CLOEXEC #define _O_CLOEXEC 1 `getImmediateMacroName` will return `_O_CLOEXEC`, whereas `O_CLOEXEC` is what we need. I change this to directly get the source text if it's a macro, which seems to be simpler. https://reviews.llvm.org/D33304 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits