Author Topic: Clang::SourceManager  (Read 3691 times)

bas

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Clang::SourceManager
« on: March 29, 2013, 10:29:26 AM »
One 'problem'(challenge) I'm running into is that the clang SourceManager (that's used to handle
the C file and all its includes) cannot really handle multiple C (or C2) files. So the current implementation
of the c2compiler has 1 SourceManager per C2 file. The problem with this is that SourceLocations (for
Diagnostic messages etc) is resolved by the Sourcemanager, but in C2 this would require both the
SourceLocation and a pointer to the right SourceManager, which is really bad (since sourcelocations
are used everywhere). I've looked into the design of SourceManager, but it's not clear how much effort
it's gonna take to modify it to support multiple 'main' files. This would be option 1.

Option 2 would be to translate the clang SourceLocations to something else that can be translated
back to a SourceManager and the original SourceLocation. Hmm...