[cfe-users] Analyzer diagnostics for uninstantiated classes
Benjamin Bannier
bbannier at gmail.com
Tue Oct 15 04:01:45 PDT 2013
Hi,
clang's analyzer doesn't seem to emit diagnostics for uninstantiated
classes. Can I as a frontend user turn these on with some flag?
The current situation is a little unfortunate when developing library code: the
library might not instantiate all its types while in user code the definitions
of all functions might not be available.
I see this behavior e.g. in r192680.
Example:
struct A {
void setup() { n = N; }
A() {
setup();
N = 1;
}
int N, n;
};
int main() {
//A a; // **HERE**
}
With the line marked **HERE** commented out `clang --analyze` finds nothing,
while with it active I get what I wanted:
test.cpp:2:20: warning: Assigned value is garbage or undefined
void setup() { n = N; }
^ ~
1 warning generated
What awesome times were I am surprised by this kind problem, thanks for the
great work,
Benjamin
--
"Good judgment comes from experience. Experience comes from bad judgment."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20131015/2f5fdff1/attachment.sig>
More information about the cfe-users
mailing list