[patch] Misc fixes to our handling of language linkage.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Feb 11 15:49:20 PST 2013


The attached patch adds a getLanguageLinkage method that explicit
models the possible language linkages (C, C++, none). This fixes some
cases we were producing wrong answers when a function or variable has
no language linkage. In particular, with this patch we don't warn
anymore in

extern "C" {
  static NonPod foo();
}

Checking the linkage when computing the language linkage introduces
two small chalenges:

* We cannot check the language linkage when computing the linkage.
This was done to decide if we should produce uniqueExternal or not,
and I think just checking the decl context has the desired result.
* We cannot ask for the linkage of a decl before linking it in, which
makes the check for conflicting language linkages a bit asymmetrical.

This exposes that we are not currently including the language linkage
in the function type. I added a test with a fixme.

In a followup patch I intend to remove the old isExternC and rename
the current hasCLanguageLinkage to isExternC.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 11126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130211/5d734be3/attachment.obj>


More information about the cfe-commits mailing list