Ericsson / clang

Cross Translation Unit analysis capability for Clang Static Analyzer. (Fork of official clang at http://llvm.org/git/clang)
http://clang.llvm.org/
Other
15 stars 10 forks source link

Fix macro expansion in CTU #599

Closed bruntib closed 5 years ago

bruntib commented 5 years ago

In CTU mode the macro's position can't be located in the imported TU. This commit skips this case, however this might be a symptomatic treatment.

dkrupp commented 5 years ago

Can one of the admins verify this patch?

Szelethus commented 5 years ago

LGTM! Thanks!

martong commented 5 years ago

In CTU mode the macro's position can't be located in the imported TU.

Is this an error in CTU? Do we expect to have that location imported? FYI @balazske is working right now on importing all source locations properly....

martong commented 5 years ago

Could you please check if you have the error with this branch? balazske:sourcelocation_import_fix We expect all source locations proper there.

Szelethus commented 5 years ago

Hmmm. The idea behind macro expansion is to receive the Preprocessor object after the end of the analysis, which will leave it in its final state, containing every preprocessor related event for that given TU. Unless you actually merge all Preprocessor states for each TU, I don't think this'll work, and I'm not even sure where we could begin with that.