[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    [cfe-dev] Builtin macros vs "#define __llvm__" and like
From:       via cfe-dev <cfe-dev () lists ! llvm ! org>
Date:       2019-11-28 16:59:59
Message-ID: 45000001574960399 () iva7-25cfe2cacdf7 ! qloud-c ! yandex ! net
[Download RAW message or body]

Hi folks! I'm currently investigating macros loading process during PCH and modules \
loading.

And I would say that it's a bit tricky. First thing weird thing is how clang deals \
with predefined macros. It creates them as regular (non built-in) ones. Below are \
A+B+C which currently stay still, but perhaps may produce some issues in future.

A. InitializePredefinedMacros is called during preprocessor initialization which \
comes earlier then any ASTReader stuff. B. Such macros are to be written by \
ASTWriter, so the *will* go into .pch C. Such macros will be loaded by ASTReader and \
in some sort overwrite their twins created during phase A.

And here comes question. Is it really necessary? During init stage we create macro, \
then we load same from .pch, and then technically we even can write same into new \
.pch? I probably miss something. Why not to treat with such macros just like with \
built-ins?

And D. When we read modules, we somehow boil out, thanks to those lines:

  // Don't read the directive history for a module; we don't have anywhere
  // to put it.
  if (M.isModule())
    return;

So far all of this works. But it looks like it's a bit misdesigned. Did I guys miss \
something perhaps?

Thanks!
_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic