[PATCH] CodeGen: Emit some functions as weak_odr under -fms-extensions

Richard Smith richard at metafoo.co.uk
Thu Mar 27 16:26:15 PDT 2014


  Seems rather light on test cases.

  How does this interact with templates?


================
Comment at: lib/AST/Decl.cpp:2587
@@ +2586,3 @@
+// the function to be required.
+bool FunctionDecl::isMSExternInline() const {
+  const ASTContext &Context = getASTContext();
----------------
You've put this between the helper function `RedeclForcesDefC99` and the function that uses it; move it up above that function, please!

================
Comment at: lib/AST/Decl.cpp:2596
@@ +2595,3 @@
+  do {
+    IsInlineSpecified |= FD->isInlineSpecified();
+    IsExternSpecified |= FD->getStorageClass() == SC_Extern;
----------------
I assume the idea here is to compute whether any declaration has the `inline` keyword and to exclude the case where `inline` was implied by `constexpr` or by being defined inside a class definition. Please add tests for those cases.

================
Comment at: lib/AST/Decl.cpp:2598-2599
@@ +2597,4 @@
+    IsExternSpecified |= FD->getStorageClass() == SC_Extern;
+    if (IsInlineSpecified && IsExternSpecified)
+      break;
+  } while ((FD = FD->getPreviousDecl()));
----------------
Do we really hit this special case if the `extern` and `inline` keywords are on different declarations? (Again, add a test case please!)


http://llvm-reviews.chandlerc.com/D3207



More information about the cfe-commits mailing list