Created
May 5, 2014 13:32
-
-
Save vsapsai/44d46dfac05cc2494790 to your computer and use it in GitHub Desktop.
"extern template" test case.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// extern_template.h, .cc don't correspond to interface/implementation pattern. | |
// They have the same name so that IWYU prints recommendations for both files. | |
#include "extern_template.h" | |
#include "indirect.h" | |
class IndirectClass; | |
void foo() { | |
ExternTemplateClass<IndirectClass> et; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "indirect.h" | |
class IndirectClass; | |
template <typename T> | |
class ExternTemplateClass { | |
public: | |
~ExternTemplateClass(); | |
}; | |
template <typename T> | |
ExternTemplateClass<T>::~ExternTemplateClass() { | |
T::StaticMethod(); | |
} | |
extern template class ExternTemplateClass<IndirectClass>; | |
//template class ExternTemplateClass<IndirectClass>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//===--- indirect.h - test input file for iwyu ----------------------------===// | |
// | |
// The LLVM Compiler Infrastructure | |
// | |
// This file is distributed under the University of Illinois Open Source | |
// License. See LICENSE.TXT for details. | |
// | |
//===----------------------------------------------------------------------===// | |
// This file is meant to be #included by "direct.h", which is directly | |
// #included by some .cc file. It provides an easy-to-access | |
// definition of a symbol that will cause an iwyu violation in a .cc | |
// file. | |
#ifndef DEVTOOLS_MAINTENANCE_INCLUDE_WHAT_YOU_USE_TESTS_INDIRECT_H_ | |
#define DEVTOOLS_MAINTENANCE_INCLUDE_WHAT_YOU_USE_TESTS_INDIRECT_H_ | |
class IndirectClass { | |
public: | |
void Method() const { }; | |
int a; | |
static void StaticMethod() { }; | |
static int statica; | |
}; | |
#endif // DEVTOOLS_MAINTENANCE_INCLUDE_WHAT_YOU_USE_TESTS_INDIRECT_H_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment