aaron.ballman added inline comments.
================ Comment at: include/clang/AST/TypeLoc.h:533 + } else { + BuiltinRange.setBegin(std::min(Range.getBegin(), BuiltinRange.getBegin())); + BuiltinRange.setEnd(std::max(Range.getEnd(), BuiltinRange.getEnd())); ---------------- malcolm.parsons wrote: > I suspect that using `min` and `max` on `SourceLocation`s is only valid if > both locations are in the same file. > > Doing this > long.h: > ``` > long > ``` > unsigned.cpp: > ``` > unsigned > #include "long.h" > i; > ``` > > causes > clang-query> match typeLoc() > ... > clang-query: llvm/tools/clang/lib/Frontend/DiagnosticRenderer.cpp:273: > clang::SourceLocation retrieveMacroLocation(clang::SourceLocation, > clang::FileID, clang::FileID, const llvm::SmallVectorImpl<clang::FileID>&, > bool, const clang::SourceManager*): Assertion `SM->getFileID(Loc) == > MacroFileID' failed. > > Is there a better way to combine `SourceRange`s, or should the final range be > accumulated in DeclSpec.cpp? Hmm, that's a good point, but I'm not aware of a better utility. Perhaps @rsmith knows of one? https://reviews.llvm.org/D25363 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits