summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-03-20 00:02:27 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-03-20 00:02:27 +0000
commit73768709f2627080f1635aef7573766257f2ec59 (patch)
tree9d448f53444446e0383b111da170b3776d617107 /clang/lib
parentbbdc26ba1b05215347cae02242fb512586a9554e (diff)
downloadbcm5719-llvm-73768709f2627080f1635aef7573766257f2ec59.tar.gz
bcm5719-llvm-73768709f2627080f1635aef7573766257f2ec59.zip
Don't crash-on-valid when an inline function is friend of class template
We assumed that the most recent declaration of an inline function would also be inline. However, a more recent declaration can come from a friend declaration in a class template that is instantiated at the definition of the function. llvm-svn: 232786
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/ASTContext.cpp2
-rw-r--r--clang/lib/AST/Decl.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 932bc1cb86d..89e1d52c643 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -7911,7 +7911,7 @@ static GVALinkage basicGVALinkageForFunction(const ASTContext &Context,
// Functions specified with extern and inline in -fms-compatibility mode
// forcibly get emitted. While the body of the function cannot be later
// replaced, the function definition cannot be discarded.
- if (FD->getMostRecentDecl()->isMSExternInline())
+ if (FD->isMSExternInline())
return GVA_StrongODR;
return GVA_DiscardableODR;
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index a7e879e04c8..e700cf85997 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -2734,7 +2734,8 @@ bool FunctionDecl::isMSExternInline() const {
if (!Context.getLangOpts().MSVCCompat && !hasAttr<DLLExportAttr>())
return false;
- for (const FunctionDecl *FD = this; FD; FD = FD->getPreviousDecl())
+ for (const FunctionDecl *FD = getMostRecentDecl(); FD;
+ FD = FD->getPreviousDecl())
if (FD->getStorageClass() == SC_Extern)
return true;
OpenPOWER on IntegriCloud