[PATCH] D112996: [CodeCompletion] Generally consider header files without extension
Christian Kandeler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 2 03:15:28 PDT 2021
ckandeler created this revision.
ckandeler added a reviewer: sammccall.
ckandeler requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Real-world use case: The Qt framework's headers have the same name
as the respective class defined in them, and Qt's traditional qmake
build tool uses -I (rather than -isystem) to pull them in.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112996
Files:
clang/lib/Sema/SemaCodeComplete.cpp
clang/test/CodeCompletion/included-files.cpp
Index: clang/test/CodeCompletion/included-files.cpp
===================================================================
--- clang/test/CodeCompletion/included-files.cpp
+++ clang/test/CodeCompletion/included-files.cpp
@@ -22,12 +22,12 @@
// CHECK-3-NOT: foo.h>
// CHECK-3: foosys>
-// With -I rather than -isystem, the header extension is required.
+// A header extension is not required.
#include <foosys>
// RUN: %clang -fsyntax-only -I %t/a -Xclang -code-completion-at=%t/main.cc:26:13 %t/main.cc | FileCheck -check-prefix=CHECK-4 %s
// CHECK-4-NOT: foo.cc>
// CHECK-4-NOT: foo.h>
-// CHECK-4-NOT: foosys>
+// CHECK-4: foosys>
// Backslash handling.
#include "a\foosys"
Index: clang/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- clang/lib/Sema/SemaCodeComplete.cpp
+++ clang/lib/Sema/SemaCodeComplete.cpp
@@ -9648,7 +9648,8 @@
if (!(Filename.endswith_insensitive(".h") ||
Filename.endswith_insensitive(".hh") ||
Filename.endswith_insensitive(".hpp") ||
- Filename.endswith_insensitive(".inc")))
+ Filename.endswith_insensitive(".inc") ||
+ !Filename.contains('.')))
break;
}
AddCompletion(Filename, /*IsDirectory=*/false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112996.384024.patch
Type: text/x-patch
Size: 1315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211102/22a0efca/attachment-0001.bin>
More information about the cfe-commits
mailing list