-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"enhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature
Description
If, e.g. write:
int main() {
std::cout << "Hello world\n";
}
I think it would be nice for the compiler to suggest importing <iostream>
. If I later write
#include <iostream>
int main() {
std::cout << "Hello world\n";
int a = 0, b = 0;
std::memcpy(&a, &b, 4);
}
it would be nice if it suggested importing <cstring>
. I think a simple internal list of popular functions would be enough, we don't need to get fancy here.
I don't know if this collides with functionality that clangd or similar tools already provide though.
Popular D compilers have similar functionality:
~ » cat test.d
void main() {
writeln("hello world");
}
~ » ldc2 test.d
test.d(7): Error: `writeln` is not defined, perhaps `import std.stdio;` is needed?
ldionne
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"enhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing feature