Currently, you don't seem to do anything special with command-line arguments 
for the frontend. You just create the compilation database and handle the one 
extra positional argument: the name of the file with headers in it. The 
CommonOptionsParser takes care of the compilation database for you. Check out 
cpp11-migrate/Cpp11Migrate.cpp for an example. You can also see there how we 
use the command-line library to add extra options. If you're interested in 
front-end options provided by other parts of clang, because they use the 
command-line library they'll be there already as long as you link your 
application against the sub-libs of clang that define those options. I'm not 
sure clang::driver::OptTable is necessary but that's beyond my current realm of 
expertise.

-----Original Message-----
From: Thompson, John [mailto:[email protected]] 
Sent: Wednesday, March 13, 2013 2:50 PM
To: Vane, Edwin
Cc: [email protected]
Subject: RE: [clang-tools-extra] r176883 - Review feedback change per Edwin: 
Move non-public members to end of classes.

Edwin,

> Did you look at the idea of using CommonOptionsParser? If it doesn't apply 
> for some reason that's fine but for tool consistency it would be nice.

I've been trying to figure it out.  Perhaps you can help.  I need it to also 
accept all the clang front-end options, but so far can't figure out how to 
connect them.  Are the front end options handling and that of 
CommonOptionsParser independent of each other?

I took a stab at it with the following, hoping the first call would load the 
static opts, but it seems to not do it:

  clang::driver::OptTable *Opts = clang::driver::createDriverOptTable();
  CommonOptionsParser OptionsParser(argc, argv);

-John

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
On Behalf Of Vane, Edwin
Sent: Wednesday, March 13, 2013 11:30 AM
To: John Thompson; [email protected]
Subject: RE: [clang-tools-extra] r176883 - Review feedback change per Edwin: 
Move non-public members to end of classes.

Did you look at the idea of using CommonOptionsParser? If it doesn't apply for 
some reason that's fine but for tool consistency it would be nice.

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
On Behalf Of John Thompson
Sent: Tuesday, March 12, 2013 2:52 PM
To: [email protected]
Subject: [clang-tools-extra] r176883 - Review feedback change per Edwin: Move 
non-public members to end of classes.

Author: jtsoftware
Date: Tue Mar 12 13:51:47 2013
New Revision: 176883

URL: http://llvm.org/viewvc/llvm-project?rev=176883&view=rev
Log:
Review feedback change per Edwin: Move non-public members to end of classes.

Modified:
    clang-tools-extra/trunk/modularize/Modularize.cpp

Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=176883&r1=176882&r2=176883&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Tue Mar 12 
+++ 13:51:47 2013
@@ -145,9 +145,6 @@ struct HeaderEntry {  typedef std::vector<HeaderEntry> 
HeaderContents;
 
 class EntityMap : public llvm::StringMap<llvm::SmallVector<Entry, 2> > {
-  llvm::DenseMap<const FileEntry *, HeaderContents> CurHeaderContents;
-  llvm::DenseMap<const FileEntry *, HeaderContents> AllHeaderContents;
-
 public:
   llvm::DenseMap<const FileEntry *, HeaderContents> HeaderContentMismatches;
     
@@ -197,14 +194,14 @@ public:
     
     CurHeaderContents.clear();
   }
+private:
+  llvm::DenseMap<const FileEntry *, HeaderContents> CurHeaderContents;
+  llvm::DenseMap<const FileEntry *, HeaderContents> AllHeaderContents;
 };
 
 class CollectEntitiesVisitor
   : public RecursiveASTVisitor<CollectEntitiesVisitor>
 {
-  SourceManager &SM;
-  EntityMap &Entities;
-
 public:
   CollectEntitiesVisitor(SourceManager &SM, EntityMap &Entities)
     : SM(SM), Entities(Entities) { }
@@ -249,12 +246,12 @@ public:
     Entities.add(Name, isa<TagDecl>(ND)? Entry::Tag : Entry::Value, Loc);
     return true;
   }
+private:
+  SourceManager &SM;
+  EntityMap &Entities;
 };
 
 class CollectEntitiesConsumer : public ASTConsumer {
-  EntityMap &Entities;
-  Preprocessor &PP;
-
 public:
   CollectEntitiesConsumer(EntityMap &Entities, Preprocessor &PP)
     : Entities(Entities), PP(PP) { }
@@ -280,30 +277,32 @@ public:
     // Merge header contents.
     Entities.mergeCurHeaderContents();
   }
+private:
+  EntityMap &Entities;
+  Preprocessor &PP;
 };
 
 class CollectEntitiesAction : public SyntaxOnlyAction {
-  EntityMap &Entities;
-  
+public:
+  CollectEntitiesAction(EntityMap &Entities) : Entities(Entities) { }
 protected:
   virtual clang::ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
                                                 StringRef InFile) {
     return new CollectEntitiesConsumer(Entities, CI.getPreprocessor());
   }
-
-public:
-  CollectEntitiesAction(EntityMap &Entities) : Entities(Entities) { }
+private:
+  EntityMap &Entities;
 };
 
 class ModularizeFrontendActionFactory : public FrontendActionFactory {
-  EntityMap &Entities;
-
 public:
   ModularizeFrontendActionFactory(EntityMap &Entities) : Entities(Entities) { }
 
   virtual CollectEntitiesAction *create() {
     return new CollectEntitiesAction(Entities);
   }
+private:
+  EntityMap &Entities;  
 };
 
 int main(int argc, const char **argv) {


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to