[PATCH] D59934: Compare SourceLocations from different TUs by FileID

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 07:16:39 PDT 2019


balazske added a comment.

Is it a better fix to change getMacroInfoForLocation?

  static const MacroInfo *getMacroInfoForLocation(const Preprocessor &PP,
                                                  const SourceManager &SM,
                                                  const IdentifierInfo *II,
                                                  SourceLocation Loc) {
  
    // Can not get macro information for locations not in main TU.
    std::pair<FileID, unsigned> DecMainLoc =
        std::make_pair(SM.getMainFileID(), 0);
    std::pair<FileID, unsigned> DecLoc = SM.getDecomposedLoc(Loc);
    if (!SM.isInTheSameTranslationUnit(DecMainLoc, DecLoc).first)
      return nullptr;
  ...


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59934/new/

https://reviews.llvm.org/D59934





More information about the cfe-commits mailing list