[PATCH] D34985: Do not read the file to determine its name.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 9 06:14:28 PDT 2017


rsmith added a comment.

Looks like most of the users of this function are detecting whether we're in the builtins buffer. Perhaps we should have a dedicated method for that which uses something more principled than a string comparison against "<built-in>"?



================
Comment at: lib/Basic/SourceManager.cpp:1485
+
+  return getBuffer(FID, Invalid)->getBufferIdentifier();
 }
----------------
This repeats the FID -> SLocEntry lookup; if you manage to get a ContentCache above, perhaps call `getBuffer(...)->getBufferIdentifier()` on it directly?

(If you can't get a content cache, this code path will also fail and will produce the name "<<<INVALID BUFFER>>>".)


Repository:
  rL LLVM

https://reviews.llvm.org/D34985





More information about the cfe-commits mailing list