Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Precompiled Headers & #pragma once #41

Open
Nopey opened this issue Aug 26, 2023 · 0 comments
Open

Support Precompiled Headers & #pragma once #41

Nopey opened this issue Aug 26, 2023 · 0 comments
Labels
enhancement New feature or request
Projects

Comments

@Nopey
Copy link

Nopey commented Aug 26, 2023

In my project, there are many precompiled headers such as this:

// common.h
#pragma once

class Common {
    int field1;
    char field2;
    void *field3;
};

If common.h is precompiled, StructLayout's clang will fail to compile the header; clang ignores the #pragma once directive on the primary source file.

To side-step this issue, the plugin could take an alternative approach:
Generate a new sourcefile, structlayout.cpp:

#include "common.h" // this will respect #pragma once, if present
class StructLayoutTarget {
    Common real_target;
};

The plugin would then invoke clang with the appropriate headers, pch's, defines, etc as it does now, but targeting structlayout.cpp and its StructLayoutTarget class instead of targeting common.h and its Common class.

Related: #40

@Viladoman Viladoman added the enhancement New feature or request label Sep 18, 2023
@Viladoman Viladoman added this to Open in Parser Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Parser
  
Open
Development

No branches or pull requests

2 participants