This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #540 from kleintom/template_qualname
Use the original template pattern for function template qualnames.
- Loading branch information
Showing
8 changed files
with
194 additions
and
21 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "main.h" | ||
#include "foo.h" | ||
|
||
using namespace bear; | ||
using namespace sonic; | ||
|
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "main.h" | ||
#include "foo.h" | ||
|
||
using namespace bear; | ||
using namespace sonic; | ||
|
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
26 changes: 26 additions & 0 deletions
26
dxr/plugins/clang/tests/test_qualnames/code/template_foo.cpp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "template_foo.h" | ||
|
||
//// Template instantiation and specialization: | ||
void doit() { | ||
char aa = 'a'; | ||
|
||
fud(Baz<int>()); | ||
fud(aa); | ||
fud(3); | ||
|
||
Baz<int> bb; | ||
guz(bb); | ||
|
||
Gub gg; | ||
gg.bug(2); | ||
gg.bug(aa); | ||
|
||
Gleb<char> gl; | ||
gl.lerb(true); | ||
gl.lerb(3); | ||
|
||
Derb<int> cc; | ||
cc.flarb(3); | ||
Derb<char *> dd; | ||
dd.flarb(&aa); | ||
} |
40 changes: 40 additions & 0 deletions
40
dxr/plugins/clang/tests/test_qualnames/code/template_foo.h
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//// Qualnames involving template instantiation and specialization: | ||
template<class T> | ||
void fud(T ) {} | ||
// Full specialization: | ||
template<> | ||
inline void fud(int ) {} | ||
|
||
template<typename T> | ||
class Baz {}; | ||
|
||
template<typename T> | ||
void guz(Baz<T> ) {} | ||
|
||
struct Gub { | ||
template<typename T> | ||
void bug(T ) {} | ||
}; | ||
// Full specialization: | ||
template<> inline void Gub::bug(char ) {} | ||
|
||
template<typename T> | ||
struct Gleb { | ||
template<typename U> | ||
void lerb(U ) {} | ||
}; | ||
// Full specialization (seems like you can't partially specialize a templated | ||
// method of a templated class): | ||
template<> | ||
template<> | ||
inline void Gleb<char>::lerb(int ) {} | ||
|
||
template<typename T> | ||
struct Derb { | ||
void flarb(T ) {} | ||
}; | ||
// Partial specialization: | ||
template<typename T> | ||
struct Derb<T*> { | ||
void flarb(T * ) {} | ||
}; |
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