[cfe-commits] r79941 - in /cfe/trunk: lib/Analysis/CFG.cpp test/SemaTemplate/fun-template-def.cpp

Douglas Gregor dgregor at apple.com
Mon Aug 24 17:41:45 PDT 2009


On Aug 24, 2009, at 3:38 PM, Chris Lattner wrote:

>
> On Aug 24, 2009, at 2:39 PM, Douglas Gregor wrote:
>
>> Author: dgregor
>> Date: Mon Aug 24 16:39:56 2009
>> New Revision: 79941
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=79941&view=rev
>> Log:
>> Don't try to evaluate an expression that is type- or value- 
>> dependent while building the CFG
>
> Does it really make sense to build a CFG of an uninstantiated  
> template?

It might. The control flow of a template doesn't really depend on its  
template parameters, with two notable exceptions:

   (1) A dependent function call might end up calling a noreturn  
function in every instantiation.
   (2) A value- or type-dependent expression used in a branch might  
evaluate true (or false) in every instantiation.

Maybe that's enough reason to turn off the flow-control diagnostics  
for templates, but I will point out that Clang's flow-control  
diagnostics managed to catch a missing "return" in an uninstantiated  
template today, in real code :)

	- Doug



More information about the cfe-commits mailing list