IWYU: Add mappings for std::enable_if on chrono durations

IWYU incorrectly classifies this internal STL type as not internal, and
suggests including `<type_traits>` for it.  Work around the problem by
mapping the offending names to a file that we always include.

See include-what-you-use issue 434.
This commit is contained in:
Brad King 2017-11-28 10:45:44 -05:00
parent 8b5ae1c1d3
commit 923b8fadd5
9 changed files with 4 additions and 8 deletions

View File

@ -17,7 +17,6 @@
#include <set> #include <set>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <type_traits>
static const char* cmCTestErrorMatches[] = { static const char* cmCTestErrorMatches[] = {
"^[Bb]us [Ee]rror", "^[Bb]us [Ee]rror",

View File

@ -9,7 +9,6 @@
#include <chrono> #include <chrono>
#include <ostream> #include <ostream>
#include <string> #include <string>
#include <type_traits>
cmCTestConfigureHandler::cmCTestConfigureHandler() cmCTestConfigureHandler::cmCTestConfigureHandler()
{ {

View File

@ -27,7 +27,6 @@
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <type_traits>
#include <utility> #include <utility>
class cmMakefile; class cmMakefile;

View File

@ -14,7 +14,6 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <string.h> #include <string.h>
#include <type_traits>
struct CatToErrorType struct CatToErrorType
{ {

View File

@ -10,7 +10,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <type_traits>
#include <utility> #include <utility>
#include "cmCTest.h" #include "cmCTest.h"

View File

@ -16,7 +16,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <type_traits>
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include "cmCTest.h" #include "cmCTest.h"

View File

@ -20,7 +20,6 @@
#include <chrono> #include <chrono>
#include <memory> // IWYU pragma: keep #include <memory> // IWYU pragma: keep
#include <sstream> #include <sstream>
#include <type_traits>
static const char* cmCTestUpdateHandlerUpdateStrings[] = { static const char* cmCTestUpdateHandlerUpdateStrings[] = {
"Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4" "Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4"

View File

@ -4,7 +4,6 @@
#include "cmProcessOutput.h" #include "cmProcessOutput.h"
#include <iostream> #include <iostream>
#include <type_traits>
cmProcess::cmProcess() cmProcess::cmProcess()
{ {

View File

@ -63,6 +63,10 @@
{ symbol: [ "std::__decay_and_strip<const std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<const std::basic_string<char> &>::__type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::__decay_and_strip<cmFindPackageCommand::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<cmFindPackageCommand::PathLabel &>::__type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::__decay_and_strip<__gnu_cxx::__normal_iterator<const cmCTestTestHandler::cmCTestTestProperties *, std::vector<cmCTestTestHandler::cmCTestTestProperties, std::allocator<cmCTestTestHandler::cmCTestTestProperties> > > &>::__type", private, "\"cmConfigure.h\"", public ] }, { symbol: [ "std::__decay_and_strip<__gnu_cxx::__normal_iterator<const cmCTestTestHandler::cmCTestTestProperties *, std::vector<cmCTestTestHandler::cmCTestTestProperties, std::allocator<cmCTestTestHandler::cmCTestTestProperties> > > &>::__type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::__success_type<std::chrono::duration<double, std::ratio<1, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<60, 1> > >::type", private, "\"cmConfigure.h\"", public ] },
{ symbol: [ "std::enable_if<true, std::chrono::duration<long, std::ratio<1, 1000> > >::type", private, "\"cmConfigure.h\"", public ] },
# KWIML # KWIML
{ include: [ "<stdint.h>", public, "\"cm_kwiml.h\"", public ] }, { include: [ "<stdint.h>", public, "\"cm_kwiml.h\"", public ] },