[PATCH] D39210: Add default calling convention support for regcall.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 17:11:25 PDT 2017

rnk added inline comments.

Comment at: lib/Sema/SemaType.cpp:3269-3273
+  bool IsMain = false;
+  if (D.getIdentifier() && D.getIdentifier()->isStr("main") &&
+      S.CurContext->getRedeclContext()->isTranslationUnit() &&
+      !S.getLangOpts().Freestanding)
+    IsMain = true;
I highly doubt this is correct. I have a feeling there are all kinds of ways you can get this to fire on things that aren't a function declaration. It's also inefficient to check the identifier string every time we make a function type. Please find somewhere else to add this. I'd suggest adjusting the function type in CheckMain, or some time before then, whereever we make main implicitly extern "C".


More information about the cfe-commits mailing list