Community
Participate
Working Groups
Build Identifier: 201105160958 I have a file called http.cpp: #include <char_output.hpp> //... void Cebatech_handle_http_page( Generic_socket *client_socket, char *url, uint32_t display_type ) { Stream_output sio( client_socket, display_type ); //... } the included file char_output.hpp has: class Stream_output : public Char_output { // ... } CODAN tells me that I can't instantiate Stream_output because it doesn't implement an inherited pure virtual from Char_output. I control+click on Stream_output, and it gives me a choice of two locations: char_output.hpp and io.hpp. 1) I don't even include io.hpp, so I don't know why it's even asking me. 2) CDT resolves to the wrong (in this case) definition in io.hpp, resulting in the CODAN false positive. There are dozens of this kind of issue in the codebase I'm working on so far. Expected result: It should resolve the class based upon first-order includes first. Reproducible: Always
Sounds similar to bug 337583.
yes, that does look similar but without mention of the CODAN false positive side effect. if there's no chance of the indexer being fixed for release, perhaps the CODAN inspection can be made a bit smarter so as to not report false positives in the case of type ambiguity?
The index maintains a single version of each type, regardless of how many definitions there are. Like a linker CDT cannot deal with different versions of the same type. This will not change because I don't know of a consistent way to model that. In C or C++ you can refer to a type without including the definition by simply using its name. In such a case you cannot make the choice between two available definitions. Example: class XXX; void fun(XXX* x); // XXX needs to be identified although the definition of // XXX may not be in scope. An AST maintains an IIndexFileSet that tracks the header files included, you can use it to check whether a certain binding is declared in one of the header files or not (see IIndexFileSet.containsDeclaration(IIndexBinding)). The codan checker could use this information to correct the result. In the example provided the IIndexFileSet of the AST will not contain a declaration of the pure-virtual method that triggers the warning.
see comment 3.