r343457 - [CodeComplete] #include completion treats -I as non-system (require header-like extension).
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 1 04:56:43 PDT 2018
Author: sammccall
Date: Mon Oct 1 04:56:42 2018
New Revision: 343457
URL: http://llvm.org/viewvc/llvm-project?rev=343457&view=rev
Log:
[CodeComplete] #include completion treats -I as non-system (require header-like extension).
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/CodeCompletion/included-files.cpp
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=343457&r1=343456&r2=343457&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Mon Oct 1 04:56:42 2018
@@ -8098,7 +8098,7 @@ void Sema::CodeCompleteIncludedFile(llvm
AddFilesFromDirLookup(D, false);
}
for (const auto &D : make_range(S.angled_dir_begin(), S.angled_dir_end()))
- AddFilesFromDirLookup(D, true);
+ AddFilesFromDirLookup(D, false);
for (const auto &D : make_range(S.system_dir_begin(), S.system_dir_end()))
AddFilesFromDirLookup(D, true);
Modified: cfe/trunk/test/CodeCompletion/included-files.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/included-files.cpp?rev=343457&r1=343456&r2=343457&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/included-files.cpp (original)
+++ cfe/trunk/test/CodeCompletion/included-files.cpp Mon Oct 1 04:56:42 2018
@@ -15,15 +15,21 @@
// CHECK-2: foosys.h"
// CHECK-2-NOT: foosys"
-// Angled string showes all files, but only in system dirs.
+// Angled shows headers from system dirs.
#include <foosys>
// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:19:13 %t/main.cc | FileCheck -check-prefix=CHECK-3 %s
// CHECK-3-NOT: foo.cc>
// CHECK-3-NOT: foo.h>
// CHECK-3: foosys>
+// With -I rather than -isystem, the header extension is 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>
+
// Backslash handling.
#include "a\foosys"
-// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:26:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-4 %s
-// CHECK-4: foosys.h"
-
+// RUN: %clang -fsyntax-only -isystem %t/a -Xclang -code-completion-at=%t/main.cc:33:13 %t/main.cc -fms-compatibility | FileCheck -check-prefix=CHECK-5 %s
+// CHECK-5: foosys.h"
More information about the cfe-commits
mailing list