[PATCH] D52076: [CodeComplete] Add completions for filenames in #include directives.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 18 00:27:14 PDT 2018


ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Sema/SemaCodeComplete.cpp:8057
+          if (!(Filename.endswith(".h") || Filename.endswith(".hh") ||
+                Filename.endswith(".H") || Filename.endswith(".hpp") ||
+                Filename.endswith(".inc")))
----------------
sammccall wrote:
> ilya-biryukov wrote:
> > Maybe do case-insensitive matching?
> > A corner case, but still...
> This matches Driver's behavior (I'd reuse it but I don't think Sema can/should depend on Driver). Clang doesn't think "HPP" is a valid c++ header filename.
> I'll add a comment.
IIUC, Driver uses this to infer the language based on file extension (when no explicit -x flag was provided).
However, this does not stop anyone from using uppercase file extensions in practice (and I assume inferring on headers is also pretty rare, since all compiles start with source files anyway).
But this should rare in any case, I don't think it's a blocker.


Repository:
  rC Clang

https://reviews.llvm.org/D52076





More information about the cfe-commits mailing list