<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 12, 2012, at 2:45 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite" style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt; "><div dir="ltr"><div>That led to the question posed by Dmitri on irc why there are start ranges in the first place - we could instead tablegen all diagnostics at once and let the tablegen take care of generating the appropriate enum values for the start of certain ranges.</div><div><br></div><div>So if anybody has better ideas for how to solve the lookup problem, or knows why the diagnostic ids have fixed start values, I'd be very interested to learn more about it :)</div></div></div></blockquote><br style="font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "></div><div>The purpose of the fixed starting values is just compile-time efficiency: we'd like to be able to add/remove diagnostics (generally in one part of clang) without requiring a full recompile.  As long as your scheme still allows this in most cases — maybe tblgen gets re-run for all diagnostics whenever any of them change, but tblgen rounds up to the next multiple of 50 between ranges so that adding a diagnostic in one range doesn't usually force a full recompile — I think we're fine.</div></div></blockquote><br></div><div>Right.  Basically move the magic constants in DiagnosticIDs.h:</div><div><br></div><div><div>   enum {</div><div>      DIAG_START_DRIVER        =                               300,</div><div>      DIAG_START_FRONTEND      = DIAG_START_DRIVER          +  100,</div><div>      DIAG_START_SERIALIZATION = DIAG_START_FRONTEND        +  100,</div><div>      DIAG_START_LEX           = DIAG_START_SERIALIZATION   +  120,</div><div>      DIAG_START_PARSE         = DIAG_START_LEX             +  300,</div><div>      DIAG_START_AST           = DIAG_START_PARSE           +  400,</div><div>      DIAG_START_COMMENT       = DIAG_START_AST             +  100,</div><div>      DIAG_START_SEMA          = DIAG_START_COMMENT         +  100,</div><div>      DIAG_START_ANALYSIS      = DIAG_START_SEMA            + 3000,</div><div>      DIAG_UPPER_LIMIT         = DIAG_START_ANALYSIS        +  100</div><div>    };</div><div><br></div><div>from the header file into tblgen.</div><div><br></div><div>-Chris</div></div></body></html>