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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 18 01:31:17 PDT 2018


sammccall added inline comments.


================
Comment at: lib/Sema/SemaCodeComplete.cpp:8057
+          if (!(Filename.endswith(".h") || Filename.endswith(".hh") ||
+                Filename.endswith(".H") || Filename.endswith(".hpp") ||
+                Filename.endswith(".inc")))
----------------
ilya-biryukov wrote:
> 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.
Oh true, headers will work in practice with any extension, so Driver might be too restrictive.
Made these case insensitive.


Repository:
  rC Clang

https://reviews.llvm.org/D52076





More information about the cfe-commits mailing list