Browse Source

Interrogate should pick up definitions in all files explicitly named

rdb 10 years ago
parent
commit
cdc8d7d4d9

+ 6 - 0
dtool/src/cppparser/cppPreprocessor.cxx

@@ -1715,6 +1715,12 @@ handle_include_directive(const string &args, const YYLTYPE &loc) {
     } else {
     } else {
       _last_c = '\0';
       _last_c = '\0';
 
 
+      // If it was explicitly named on the command-line, mark it S_local.
+      filename.make_absolute();
+      if (_explicit_files.count(filename)) {
+        source = CPPFile::S_local;
+      }
+
       CPPFile file(filename, filename_as_referenced, source);
       CPPFile file(filename, filename_as_referenced, source);
 
 
       // Don't include it if we included it before and it had #pragma once.
       // Don't include it if we included it before and it had #pragma once.

+ 2 - 0
dtool/src/cppparser/cppPreprocessor.h

@@ -88,6 +88,8 @@ public:
   Includes _quote_includes;
   Includes _quote_includes;
   Includes _angle_includes;
   Includes _angle_includes;
 
 
+  set<Filename> _explicit_files;
+
   // This is normally true, to indicate that the preprocessor should
   // This is normally true, to indicate that the preprocessor should
   // decode identifiers like foo::bar<snarf> into a single IDENTIFIER,
   // decode identifiers like foo::bar<snarf> into a single IDENTIFIER,
   // TYPENAME_IDENTIFIER, or SCOPING token for yacc's convenience.
   // TYPENAME_IDENTIFIER, or SCOPING token for yacc's convenience.

+ 9 - 3
dtool/src/interrogate/interrogate.cxx

@@ -506,9 +506,15 @@ main(int argc, char **argv) {
     build_c_wrappers = true;
     build_c_wrappers = true;
   }
   }
 
 
-  // Get all of the .h files.
-  for (i = 1; i < argc; ++i) 
-  {
+  // Add all of the .h files we are explicitly including to the parser.
+  for (i = 1; i < argc; ++i) {
+    Filename filename = Filename::from_os_specific(argv[i]);
+    filename.make_absolute();
+    parser._explicit_files.insert(filename);
+  }
+
+  // Now go through them again and feed them into the C++ parser.
+  for (i = 1; i < argc; ++i) {
     Filename filename = Filename::from_os_specific(argv[i]);
     Filename filename = Filename::from_os_specific(argv[i]);
     if (!parser.parse_file(filename)) {
     if (!parser.parse_file(filename)) {
       cerr << "Error parsing file: '" << argv[i] << "'\n";
       cerr << "Error parsing file: '" << argv[i] << "'\n";