Reviewers: alexfh, aaron.ballman
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D22260
llvm-svn: 275263
diag(FD->getLocation(),
"function %0 defined in a header file; "
"function definitions in header files can lead to ODR violations")
- << FD << FixItHint::CreateInsertion(FD->getSourceRange().getBegin(),
- "inline ");
+ << FD << FixItHint::CreateInsertion(
+ FD->getReturnTypeSourceRange().getBegin(), "inline ");
} else if (const auto *VD = dyn_cast<VarDecl>(ND)) {
// Static data members of a class template are allowed.
if (VD->getDeclContext()->isDependentContext() && VD->isStaticDataMember())
template <>
int CA::f3() {
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: function 'f3<int>' defined in a header file;
+// CHECK-FIXES: inline int CA::f3() {
int a = 1;
return a;
}
}
template <>
-// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: function 'f3<int>' defined in a header file;
int f3() {
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f3<int>' defined in a header file;
+// CHECK-FIXES: inline int f3() {
int a = 1;
return a;
}
int CD<int, int>::f() {
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: function 'f' defined in a header file;
+// CHECK-FIXES: inline int CD<int, int>::f() {
return 0;
}