summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-03-27 20:16:58 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-03-27 20:16:58 +0000
commit9a71c99844972bb352067d00a4d35b848238fc9d (patch)
tree47177f641af524bc225e133ebd4ce9421bf7315b /clang/lib/Sema/SemaDecl.cpp
parent7b57cef5b088dd87b105c293cffb5745eea008a7 (diff)
downloadbcm5719-llvm-9a71c99844972bb352067d00a4d35b848238fc9d.tar.gz
bcm5719-llvm-9a71c99844972bb352067d00a4d35b848238fc9d.zip
[modules] Allow a function to be redefined if the old definition is not visible.
llvm-svn: 233407
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9bbfeaf19ef..3b9bb842c4e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -10282,6 +10282,15 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD,
if (canRedefineFunction(Definition, getLangOpts()))
return;
+ // If we don't have a visible definition of the function, and it's inline,
+ // it's OK to form another definition of it.
+ //
+ // FIXME: Should we skip the body of the function and use the old definition
+ // in this case? That may be necessary for functions that return local types
+ // through a deduced return type, or instantiate templates with local types.
+ if (!hasVisibleDefinition(Definition) && Definition->isInlineSpecified())
+ return;
+
if (getLangOpts().GNUMode && Definition->isInlineSpecified() &&
Definition->getStorageClass() == SC_Extern)
Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
OpenPOWER on IntegriCloud